Update hacking for Python3

The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Remove hacking and friends from lower-constraints, they are not needed
for installation.

Change-Id: Ibc3b00aca7332f12b58893213acfc88749b74aa1
This commit is contained in:
Andreas Jaeger 2020-04-14 18:55:07 +02:00
parent f5332fd0d1
commit 11a19f2ea8
9 changed files with 61 additions and 60 deletions

View File

@ -48,5 +48,6 @@ def main():
return upgradecheck.main(
cfg.CONF, project='freezer-api', upgrade_command=Checks())
if __name__ == '__main__':
sys.exit(main())

View File

@ -40,12 +40,12 @@ class BackupMetadataDoc(object):
def is_valid(self):
try:
assert (self.project_id is not '')
assert (self.backup_id is not '')
assert (self.user_id is not '')
assert (self.data['container'] is not '')
assert (self.data['hostname'] is not '')
assert (self.data['backup_name'] is not '')
assert (self.project_id != '')
assert (self.backup_id != '')
assert (self.user_id != '')
assert (self.data['container'] != '')
assert (self.data['hostname'] != '')
assert (self.data['backup_name'] != '')
except Exception:
return False
return True

View File

@ -18,19 +18,19 @@ limitations under the License.
fqdn_regex = "([a-zA-Z\\d]|[a-zA-Z\\d][a-zA-Z\\d\\-]{0,61}[a-zA-Z\\d])" \
"(\\.([a-zA-Z\\d]|[a-zA-Z\\d][a-zA-Z\\d\\-]{0,61}[a-zA-Z\\d]))*"
# Allow alphanumeric, underscore and minus
project_regex = "(?:([\\w\\-]+)\_)?"
client_id_regex = "^{project}{host}$".format(project=project_regex,
host=fqdn_regex)
project_regex = r"(?:([\w\-]+)\_)?"
client_id_regex = r"^{project}{host}$".format(project=project_regex,
host=fqdn_regex)
freezer_action_properties = {
"action": {
"id": "action",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"mode": {
"id": "mode",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"path_to_backup": {
@ -83,37 +83,37 @@ schedule_properties = {
"schedule_date": {
"id": "schedule_date",
"type": "string",
"pattern": "^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])"
"-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9])"
":([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-]"
"(?:2[0-3]|[01][0-9]):[0-5][0-9])?$"
"pattern": r"^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])"
r"-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9])"
r":([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-]"
r"(?:2[0-3]|[01][0-9]):[0-5][0-9])?$"
},
"schedule_interval": {
"id": "schedule_interval",
"type": "string",
"pattern": "^(continuous|(\d+ +(weeks|days|"
"hours|minutes|seconds)))$"
"pattern": r"^(continuous|(\d+ +(weeks|days|"
r"hours|minutes|seconds)))$"
},
"schedule_start_date": {
"id": "schedule_start_date",
"type": "string",
"pattern": "^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])"
"-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):"
"([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-]"
"(?:2[0-3]|[01][0-9]):[0-5][0-9])?$"
"pattern": r"^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])"
r"-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):"
r"([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-]"
r"(?:2[0-3]|[01][0-9]):[0-5][0-9])?$"
},
"schedule_end_date": {
"id": "schedule_end_date",
"type": "string",
"pattern": "^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])"
"-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9])"
":([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-]"
"(?:2[0-3]|[01][0-9]):[0-5][0-9])?$"
"pattern": r"^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])"
r"-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9])"
r":([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-]"
r"(?:2[0-3]|[01][0-9]):[0-5][0-9])?$"
},
"schedule_year": {
"id": "schedule_year",
"type": "string",
"pattern": "^\d{4}$"
"pattern": r"^\d{4}$"
},
"schedule_month": {
"id": "schedule_month",
@ -192,7 +192,7 @@ job_schema = {
},
"job_id": {
"id": "job_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"client_id": {
@ -202,7 +202,7 @@ job_schema = {
},
"session_id": {
"id": "session_id",
"pattern": "^[\w-]*$",
"pattern": r"^[\w-]*$",
"type": "string"
},
"session_tag": {
@ -215,12 +215,12 @@ job_schema = {
},
"user_id": {
"id": "user_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"project_id": {
"id": "project_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"description": {
@ -288,7 +288,7 @@ job_patch_schema = {
},
"job_id": {
"id": "job_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"client_id": {
@ -298,7 +298,7 @@ job_patch_schema = {
},
"session_id": {
"id": "session_id",
"pattern": "^[\w-]*$",
"pattern": r"^[\w-]*$",
"type": "string"
},
"session_tag": {
@ -311,12 +311,12 @@ job_patch_schema = {
},
"user_id": {
"id": "user_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"project_id": {
"id": "project_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"description": {
@ -338,17 +338,17 @@ job_patch_schema = {
additional_action_properties = {
"action_id": {
"id": "action_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"user_id": {
"id": "user_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"project_id": {
"id": "project_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
}
}
@ -392,17 +392,17 @@ session_schema = {
},
"session_id": {
"id": "session_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"user_id": {
"id": "user_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"project_id": {
"id": "project_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"session_tag": {
@ -439,17 +439,17 @@ session_patch_schema = {
},
"session_id": {
"id": "session_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"user_id": {
"id": "user_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"project_id": {
"id": "project_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"session_tag": {
@ -504,12 +504,12 @@ client_schema = {
},
"user_id": {
"id": "user_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
},
"project_id": {
"id": "project_id",
"pattern": "^[\w-]+$",
"pattern": r"^[\w-]+$",
"type": "string"
}
},

View File

@ -36,11 +36,11 @@ class BackupMetadataDoc(object):
def is_valid(self):
try:
assert (self.backup_id is not '')
assert (self.user_id is not '')
assert (self.data['container'] is not '')
assert (self.data['hostname'] is not '')
assert (self.data['backup_name'] is not '')
assert (self.backup_id != '')
assert (self.user_id != '')
assert (self.data['container'] != '')
assert (self.data['hostname'] != '')
assert (self.data['backup_name'] != '')
except Exception:
return False
return True

View File

@ -97,6 +97,7 @@ fake_data_0_backup_metadata = {
def get_fake_backup_metadata():
return copy.deepcopy(fake_data_0_backup_metadata)
fake_malformed_data_0_backup_metadata = {
"hostname": "alpha",
"backup_name": "important_data_backup",
@ -424,6 +425,7 @@ def get_fake_client_1():
def get_fake_client_id():
return uuid.uuid4().hex
fake_action_0 = {
"freezer_action":
{
@ -517,6 +519,7 @@ def get_fake_action_id():
def get_fake_action_3():
return copy.deepcopy(fake_action_3)
fake_session_0 = {
"session_id": 'turistidellademocrazia',
"session_tag": 5,

View File

@ -13,8 +13,6 @@ elasticsearch==2.0.0
extras==1.0.0
falcon==1.0.0
fixtures==3.0.0
flake8==2.5.4
hacking==0.12.0
idna==2.6
imagesize==1.0.0
iso8601==0.1.12
@ -26,7 +24,6 @@ linecache2==1.0.0
logilab-common==1.4.1
Mako==1.0.7
MarkupSafe==1.0
mccabe==0.4.0
monotonic==1.4
msgpack==0.5.6
netaddr==0.7.19
@ -48,9 +45,7 @@ oslotest==3.3.0
Paste==2.0.2
PasteDeploy==1.5.0
pbr==3.1.1
pep8==1.7.1
pycadf==2.7.0
pyflakes==1.0.0
Pygments==2.2.0
pyinotify==0.9.6
pylint==1.4.5

View File

@ -34,6 +34,8 @@ repository_name = 'openstack/freezer-api'
bug_project = 'freezer'
bug_tag = 'release notes'
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

View File

@ -1,9 +1,10 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
flake8<2.6.0,>=2.5.4 # MIT
#pylint==1.9.2 # GPLv2
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
# hacking already pins flake8
hacking>=3.0,<=3.1.0 # Apache-2.0
pylint==2.3.1 # GPLv2
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
oslotest>=3.3.0 # Apache-2.0
@ -14,5 +15,4 @@ os-api-ref>=1.4.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
openstackdocstheme>=1.31.2 # Apache-2.0
astroid==2.1.0 # LGPLv2.1
pylint==2.3.1 # GPLv2
PyMySQL>=0.7.6 # MIT License

View File

@ -71,7 +71,7 @@ commands = flake8 freezer_api
# H405 -> Multi line docstrings should start with a one line summary followed by an empty line.
ignore = H202,H401,H404,H405
show-source = True
exclude = .venv,.tox,dist,doc,*egg,specs,build
exclude = .venv,.tox,dist,doc,*egg,specs,build,*/source/conf.py
[testenv:docs]
commands =