Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecations warnings #627

Merged
merged 2 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion anitya/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
SOCIAL_AUTH_LOGIN_REDIRECT_URL='/',
SOCIAL_AUTH_LOGIN_ERROR_URL='/login-error/',
LIBRARIESIO_PLATFORM_WHITELIST=[],
DEFAULT_REGEX='%(name)s(?:[-_]?(?:minsrc|src|source))?[-_]([^-/_\s]+?)(?i)(?:[-_]'\
DEFAULT_REGEX='(?i)%(name)s(?:[-_]?(?:minsrc|src|source))?[-_]([^-/_\s]+?)(?:[-_]'\
'(?:minsrc|src|source|asc|release))?\.(?:tar|t[bglx]z|tbz2|zip)',
# Token for GitHub API
GITHUB_ACCESS_TOKEN=None,
Expand Down
32 changes: 16 additions & 16 deletions anitya/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

""" Forms used in anitya. """

from wtforms import TextField, TextAreaField, validators, SelectField
from wtforms import StringField, TextAreaField, validators, SelectField
from wtforms import BooleanField

from anitya.compat import FlaskForm
Expand All @@ -13,29 +13,29 @@ class TokenForm(FlaskForm):
Form for API tokens.

Attributes:
description (TextField): The human-readable API token description, useful
description (StringField): The human-readable API token description, useful
for users to describe the token's purpose.
"""
description = TextField('Token description', [validators.optional()])
description = StringField('Token description', [validators.optional()])


class ProjectForm(FlaskForm):
name = TextField('Project name', [validators.Required()])
homepage = TextField(
'Homepage', [validators.Required(), validators.URL()])
name = StringField('Project name', [validators.DataRequired()])
homepage = StringField(
'Homepage', [validators.DataRequired(), validators.URL()])
backend = SelectField(
'Backend',
[validators.Required()],
[validators.DataRequired()],
choices=[(item, item) for item in []]
)
version_url = TextField('Version URL', [validators.optional()])
version_prefix = TextField('Version prefix', [validators.optional()])
regex = TextField('Regex', [validators.optional()])
version_url = StringField('Version URL', [validators.optional()])
version_prefix = StringField('Version prefix', [validators.optional()])
regex = StringField('Regex', [validators.optional()])
insecure = BooleanField(
'Use insecure connection', [validators.optional()])

distro = TextField('Distro (optional)', [validators.optional()])
package_name = TextField('Package (optional)', [validators.optional()])
distro = StringField('Distro (optional)', [validators.optional()])
package_name = StringField('Package (optional)', [validators.optional()])
check_release = BooleanField(
'Check latest release on submit', [validators.optional()])

Expand All @@ -52,12 +52,12 @@ def __init__(self, *args, **kwargs):


class FlagProjectForm(FlaskForm):
reason = TextAreaField('Reason for flagging', [validators.Required()])
reason = TextAreaField('Reason for flagging', [validators.DataRequired()])


class MappingForm(FlaskForm):
distro = TextField('Distribution', [validators.Required()])
package_name = TextField('Package name', [validators.Required()])
distro = StringField('Distribution', [validators.DataRequired()])
package_name = StringField('Package name', [validators.DataRequired()])

def __init__(self, *args, **kwargs):
""" Calls the default constructor and fill in additional information.
Expand All @@ -77,4 +77,4 @@ class ConfirmationForm(FlaskForm):


class DistroForm(FlaskForm):
name = TextField('Distribution name', [validators.Required()])
name = StringField('Distribution name', [validators.DataRequired()])
4 changes: 2 additions & 2 deletions anitya/lib/backends/debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# <name>_<version>.orig.<compression format>. So, for example,
# reprepro_4.13.1.orig.tar.gz.
DEBIAN_REGEX = (
'%(name)s(?:[-_]?(?:minsrc|src|source))?[-_]([^-/_\s]+?)(?i)(?:[-_]'
'(?:minsrc|src|source|asc))?\.(?:orig\.)?(?:tar|t[bglx]z|tbz2|zip)'
r'(?i)%(name)s(?:[-_]?(?:minsrc|src|source))?[-_]([^-/_\s]+?)(?:[-_]'
r'(?:minsrc|src|source|asc))?\.(?:orig\.)?(?:tar|t[bglx]z|tbz2|zip)'
)


Expand Down
2 changes: 1 addition & 1 deletion anitya/lib/xml2dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _parse_node(self, node):
k, v = self._namespace_split(k, object_dict({'value': v}))
node_tree[k] = v
# Save childrens
for child in node.getchildren():
for child in list(node):
tag, tree = self._namespace_split(
child.tag, self._parse_node(child))
# the first time, so store it in dict
Expand Down
2 changes: 1 addition & 1 deletion files/anitya.toml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ librariesio_platform_whitelist = []

# Default regular expression used for backend
default_regex = """\
%(name)s(?:[-_]?(?:minsrc|src|source))?[-_]([^-/_\\s]+?)(?i)(?:[-_]\
(?i)%(name)s(?:[-_]?(?:minsrc|src|source))?[-_]([^-/_\\s]+?)(?:[-_]\
(?:minsrc|src|source|asc|release))?\\.(?:tar|t[bglx]z|tbz2|zip)\
# Github access token
# This is used by GitHub API for github backend
Expand Down