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

fix: compatibility with black v25+ #15789

Merged
merged 1 commit into from
Jan 29, 2025
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 awx/main/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ def schema(self, model_instance):
'type': 'string',
# The environment variable _value_ can be any ascii,
# but pexpect will choke on any unicode
'pattern': '^[\x00-\x7F]*$',
'pattern': '^[\x00-\x7f]*$',
},
},
'additionalProperties': False,
Expand Down
4 changes: 2 additions & 2 deletions awx/main/migrations/0050_v340_drop_celery_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
'djkombu_message',
'djkombu_queue',
]
postgres_sql = ([("DROP TABLE IF EXISTS {} CASCADE;".format(table))] for table in tables_to_drop)
sqlite_sql = ([("DROP TABLE IF EXISTS {};".format(table))] for table in tables_to_drop)
postgres_sql = (["DROP TABLE IF EXISTS {} CASCADE;".format(table)] for table in tables_to_drop)
sqlite_sql = (["DROP TABLE IF EXISTS {};".format(table)] for table in tables_to_drop)


class Migration(migrations.Migration):
Expand Down
6 changes: 3 additions & 3 deletions awx/main/tests/functional/api/test_unified_jobs_stdout.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_ansi_stdout_filtering(sqlite_copy, Parent, Child, relation, view, downl
job = Parent()
job.save()
for i in range(3):
Child(**{relation: job, 'stdout': '\x1B[0;36mTesting {}\x1B[0m\n'.format(i), 'start_line': i}).save()
Child(**{relation: job, 'stdout': '\x1b[0;36mTesting {}\x1b[0m\n'.format(i), 'start_line': i}).save()
url = reverse(view, kwargs={'pk': job.pk})

# ansi codes in ?format=txt should get filtered
Expand All @@ -96,7 +96,7 @@ def test_ansi_stdout_filtering(sqlite_copy, Parent, Child, relation, view, downl
# ask for ansi and you'll get it
fmt = "?format={}".format("ansi_download" if download else "ansi")
response = get(url + fmt, user=admin, expect=200)
assert smart_str(response.content).splitlines() == ['\x1B[0;36mTesting %d\x1B[0m' % i for i in range(3)]
assert smart_str(response.content).splitlines() == ['\x1b[0;36mTesting %d\x1b[0m' % i for i in range(3)]
has_download_header = response.has_header('Content-Disposition')
assert has_download_header if download else not has_download_header

Expand All @@ -115,7 +115,7 @@ def test_colorized_html_stdout(sqlite_copy, Parent, Child, relation, view, get,
job = Parent()
job.save()
for i in range(3):
Child(**{relation: job, 'stdout': '\x1B[0;36mTesting {}\x1B[0m\n'.format(i), 'start_line': i}).save()
Child(**{relation: job, 'stdout': '\x1b[0;36mTesting {}\x1b[0m\n'.format(i), 'start_line': i}).save()
url = reverse(view, kwargs={'pk': job.pk}) + '?format=html'

response = get(url, user=admin, expect=200)
Expand Down
4 changes: 2 additions & 2 deletions awx/main/tests/unit/utils/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def test_forbidden_filter_string(self, mock_get_host_model, filter_string):
@pytest.mark.parametrize(
"filter_string,q_expected",
[
(u'(a=abc\u1F5E3def)', Q(**{u"a": u"abc\u1F5E3def"})),
(u'(ansible_facts__a=abc\u1F5E3def)', Q(**{u"ansible_facts__contains": {u"a": u"abc\u1F5E3def"}})),
(u'(a=abc\u1f5e3def)', Q(**{u"a": u"abc\u1f5e3def"})),
(u'(ansible_facts__a=abc\u1f5e3def)', Q(**{u"ansible_facts__contains": {u"a": u"abc\u1f5e3def"}})),
],
)
def test_unicode(self, mock_get_host_model, filter_string, q_expected):
Expand Down
4 changes: 2 additions & 2 deletions awxkit/awxkit/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@
exception when a character outside of the BMP is sent to `send_keys`.
Code pulled from http://stackoverflow.com/a/3220210.
"""
pattern = re.compile('[^\u0000-\uD7FF\uE000-\uFFFF]', re.UNICODE)
pattern = re.compile('[^\u0000-\ud7ff\ue000-\uffff]', re.UNICODE)

Check warning on line 269 in awxkit/awxkit/utils/__init__.py

View check run for this annotation

Codecov / codecov/patch

awxkit/awxkit/utils/__init__.py#L269

Added line #L269 was not covered by tests
length = args[0] if len(args) else kwargs.get('length', 10)
scrubbed = pattern.sub('\uFFFD', ''.join([gen_utf_char() for _ in range(length)]))
scrubbed = pattern.sub('\ufffd', ''.join([gen_utf_char() for _ in range(length)]))

Check warning on line 271 in awxkit/awxkit/utils/__init__.py

View check run for this annotation

Codecov / codecov/patch

awxkit/awxkit/utils/__init__.py#L271

Added line #L271 was not covered by tests

return scrubbed

Expand Down
Loading