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

Support newer versions of click #11746

Merged
merged 3 commits into from
Mar 29, 2022
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 aerospike/datadog_checks/aerospike/aerospike.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def collect_latencies(self, namespaces):
latencies = bucket_vals.split(',')
if latencies and len(latencies) == 17:
for i in range(len(latencies)):
bucket = 2 ** i
bucket = 2**i
tags = namespace_tags + ['bucket:{}'.format(bucket)]
latency_name = metric_name
self.send(NAMESPACE_LATENCY_METRIC_TYPE, latency_name, latencies[i], tags)
Expand Down
2 changes: 1 addition & 1 deletion aerospike/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_collect_latencies_parser(aggregator):

for metric_type in ['read', 'udf']:
for i in range(17):
bucket = 2 ** i
bucket = 2**i
aggregator.assert_metric(
'aerospike.namespace.latency.{}'.format(metric_type),
tags=['namespace:{}'.format('test'), 'tag:value', 'bucket:{}'.format(str(bucket))],
Expand Down
1 change: 0 additions & 1 deletion datadog_checks_base/datadog_checks/base/utils/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
def closing(sock):
return _closing(sock)


else:

def closing(sock):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def is_windows(name=None):

@staticmethod
def python_architecture():
if sys.maxsize > 2 ** 32:
if sys.maxsize > 2**32:
return "64bit"
else:
return "32bit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class LegacyCheck(OpenMetricsBaseCheckV2):
def create_scraper(self, config):
return OpenMetricsCompatibilityScraper(self, self.get_config_with_defaults(config))


except Exception:
pass

Expand Down
1 change: 0 additions & 1 deletion datadog_checks_dev/datadog_checks/dev/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def write_file_lines(file, lines, encoding='utf-8'):
with open(file, 'w', encoding=encoding) as f:
f.writelines(lines)


else:

def write_file(file, contents, encoding='utf-8'):
Expand Down
2 changes: 1 addition & 1 deletion datadog_checks_dev/datadog_checks/dev/plugin/tox.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Style deps:
# We pin deps in order to make CI more stable/reliable.
ISORT_DEP = 'isort==5.10.0'
BLACK_DEP = 'black==21.10b0'
BLACK_DEP = 'black==22.3.0'
FLAKE8_DEP = 'flake8==4.0.1'
FLAKE8_BUGBEAR_DEP = 'flake8-bugbear==21.9.2'
FLAKE8_LOGGING_FORMAT_DEP = 'flake8-logging-format==0.6.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
context_settings=CONTEXT_SETTINGS,
short_help="Update integration CHANGELOG.md by adding the Agent version",
)
@click.argument('checks', autocompletion=complete_active_checks, nargs=-1)
@click.argument('checks', shell_complete=complete_active_checks, nargs=-1)
@click.option('--since', help="Initial Agent version", default='6.3.0')
@click.option('--to', help="Final Agent version")
@click.option(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help="Remove a project's build artifacts")
@click.argument('check', autocompletion=complete_testable_checks, required=False)
@click.argument('check', shell_complete=complete_testable_checks, required=False)
@click.option(
'--compiled-only', '-c', is_flag=True, help=f"Remove compiled files only ({', '.join(sorted(DELETE_EVERYWHERE))})."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Edit config file using default editor')
@click.argument('check', autocompletion=complete_active_checks)
@click.argument('env', autocompletion=complete_configured_envs)
@click.argument('check', shell_complete=complete_active_checks)
@click.argument('env', shell_complete=complete_configured_envs)
@click.option('--editor', '-e', help='Editor to use')
@click.pass_context
def edit(ctx, check, env, editor):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='List active or available environments')
@click.argument('checks', nargs=-1, autocompletion=complete_testable_checks)
@click.argument('checks', nargs=-1, shell_complete=complete_testable_checks)
def ls(checks):
"""List active or available environments."""
if checks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@


@click.command('reload', context_settings=CONTEXT_SETTINGS, short_help='Restart an Agent to detect environment changes')
@click.argument('check', autocompletion=complete_active_checks)
@click.argument('env', autocompletion=complete_configured_envs, required=False)
@click.argument('check', shell_complete=complete_active_checks)
@click.argument('env', shell_complete=complete_configured_envs, required=False)
def reload_env(check, env):
"""Restart an Agent to detect environment changes."""
envs = get_configured_envs(check)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@


@click.command('shell', context_settings=CONTEXT_SETTINGS, short_help='Run a shell inside agent container')
@click.argument('check', autocompletion=complete_active_checks)
@click.argument('env', autocompletion=complete_configured_envs, required=False)
@click.argument('check', shell_complete=complete_active_checks)
@click.argument('env', shell_complete=complete_configured_envs, required=False)
@click.option('-c', '--exec-command', help='Optionally execute command inside container, executes after any installs')
@click.option('-v', '--install-vim', is_flag=True, help='Optionally install editing/viewing tools vim and less')
@click.option('-i', '--install-tools', multiple=True, help='Optionally install custom tools')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Start an environment')
@click.argument('check', autocompletion=complete_testable_checks)
@click.argument('env', autocompletion=complete_envs)
@click.argument('check', shell_complete=complete_testable_checks)
@click.argument('env', shell_complete=complete_envs)
@click.option(
'--agent',
'-a',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Stop environments.')
@click.argument('check', autocompletion=complete_active_checks)
@click.argument('env', autocompletion=complete_configured_envs, required=False)
@click.argument('check', shell_complete=complete_active_checks)
@click.argument('env', shell_complete=complete_configured_envs, required=False)
def stop(check, env):
"""Stop environments, use "all" as check argument to stop everything."""
all_checks = check == 'all'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Test an environment')
@click.argument('checks', autocompletion=complete_active_checks, nargs=-1)
@click.argument('checks', shell_complete=complete_active_checks, nargs=-1)
@click.option(
'--agent',
'-a',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Create a catalog with information about integrations')
@click.argument('checks', nargs=-1, autocompletion=complete_valid_checks, required=True)
@click.argument('checks', nargs=-1, shell_complete=complete_valid_checks, required=True)
@click.option(
'-f',
'--file',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Build a wheel for a check')
@click.argument('check', autocompletion=complete_testable_checks)
@click.argument('check', shell_complete=complete_testable_checks)
@click.option('--sdist', '-s', is_flag=True)
def build(check, sdist):
"""Build a wheel for a check as it is on the repo HEAD"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Update the changelog for a check')
@click.argument('check', autocompletion=complete_testable_checks, callback=validate_check_arg)
@click.argument('check', shell_complete=complete_testable_checks, callback=validate_check_arg)
@click.argument('version')
@click.argument('old_version', required=False)
@click.option('--end')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Release one or more checks')
@click.argument('checks', autocompletion=complete_valid_checks, nargs=-1, required=True)
@click.argument('checks', shell_complete=complete_valid_checks, nargs=-1, required=True)
@click.option('--version')
@click.option('--end')
@click.option('--new', 'initial_release', is_flag=True, help='Ensure versions are at 1.0.0')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Show all the pending PRs for a given check.')
@click.argument('check', autocompletion=complete_valid_checks, callback=validate_check_arg)
@click.argument('check', shell_complete=complete_valid_checks, callback=validate_check_arg)
@click.option('--organization', '-r', default='DataDog', help="The Github organization the repository belongs to")
@click.option(
'--tag-pattern',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Tag the git repo with the current release of a check')
@click.argument('check', autocompletion=complete_valid_checks)
@click.argument('check', shell_complete=complete_valid_checks)
@click.argument('version', required=False)
@click.option('--push/--no-push', default=True)
@click.option('--dry-run', '-n', is_flag=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Build and upload a check to PyPI')
@click.argument('check', autocompletion=complete_valid_checks)
@click.argument('check', shell_complete=complete_valid_checks)
@click.option('--sdist', '-s', is_flag=True)
@click.option('--dry-run', '-n', is_flag=True)
@click.pass_context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def display_envs(check_envs):


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Run tests')
@click.argument('checks', autocompletion=complete_testable_checks, nargs=-1)
@click.argument('checks', shell_complete=complete_testable_checks, nargs=-1)
@click.option('--format-style', '-fs', is_flag=True, help='Run only the code style formatter')
@click.option('--style', '-s', is_flag=True, help='Run only style checks')
@click.option('--bench', '-b', is_flag=True, help='Run only benchmarks')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
context_settings=CONTEXT_SETTINGS,
short_help="Verify that the checks versions are in sync with the requirements-agent-release.txt file",
)
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
def agent_reqs(check):
"""Verify that the checks versions are in sync with the requirements-agent-release.txt file.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
context_settings=CONTEXT_SETTINGS,
short_help='Validate that no integration uses the legacy signature',
)
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
def legacy_signature(check):
"""Validate that no integration uses the legacy signature.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Run all CI validations for a repo')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.pass_context
def all(ctx, check):
"""Run all CI validations for a repo.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Validate default configuration files')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option('--sync', '-s', is_flag=True, help='Generate example configuration files based on specifications')
@click.option('--verbose', '-v', is_flag=True, help='Verbose mode')
@click.pass_context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def check_widgets(decoded, filename, app_uuid, fix, file_fixed, file_failed, dis


@click.command('dashboards', context_settings=CONTEXT_SETTINGS, short_help='Validate dashboard definition JSON files')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option('--fix', is_flag=True, help='Attempt to fix errors')
def dashboards(check, fix):
"""Validate all Dashboard definition files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def verify_dependency(source, name, python_versions, file):


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Verify dependencies across all checks')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option(
'--require-base-check-version', is_flag=True, help='Require specific version for datadog-checks-base requirement'
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


@click.command('eula', context_settings=CONTEXT_SETTINGS, short_help='Validate EULA files')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
def eula(check):
"""Validate all EULA definition files.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def validate_use_http_wrapper(check):


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Validate usage of http wrapper')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
def http(check):
"""Validate all integrations for usage of http wrapper."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def validate_import(filepath, check, autofix):


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Validate proper base imports')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option('--autofix', is_flag=True, help='Apply suggested fix')
@click.pass_context
def imports(ctx, check, autofix):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Validate check style for python files')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option('--verbose', '-v', is_flag=True, help='Verbose mode')
@click.pass_context
def integration_style(ctx, check, verbose):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


@click.command('jmx-metrics', context_settings=CONTEXT_SETTINGS, short_help='Validate JMX metrics files')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option('--verbose', '-v', is_flag=True, help='Verbose mode')
def jmx_metrics(check, verbose):
"""Validate all default JMX metrics definitions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Validate `manifest.json` files')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option('--fix', is_flag=True, help='Attempt to fix errors')
@click.pass_context
def manifest(ctx, check, fix):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def check_duplicate_values(current_check, line, row, header_name, duplicates, fa
'--check-duplicates', is_flag=True, help='Output warnings if there are duplicate short names and descriptions'
)
@click.option('--show-warnings', '-w', is_flag=True, help='Show warnings in addition to failures')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
def metadata(check, check_duplicates, show_warnings):
"""Validates metadata.csv files

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def content_matches(current_model_file_lines, expected_model_file_lines):


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Validate configuration data models')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option('--sync', '-s', is_flag=True, help='Generate data models based on specifications')
@click.option('--verbose', '-v', is_flag=True, help='Verbose mode')
@click.pass_context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def read_project_name(check_name):


@click.command('package', context_settings=CONTEXT_SETTINGS, short_help='Validate Python package metadata')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
def package(check):
"""Validate all files for Python package metadata.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@click.command(context_settings=CONTEXT_SETTINGS, short_help='Validate README.md files')
@click.pass_context
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option('--format-links', '-fl', is_flag=True, help='Automatically format links')
def readmes(ctx, check, format_links):
"""Validates README files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
context_settings=CONTEXT_SETTINGS,
short_help='Validate recommended monitor definition JSON files',
)
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
def recommended_monitors(check):
"""Validate all recommended monitors definition files.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Validate saved view files')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
def saved_views(check):
"""Validates saved view files

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@


@click.command('service-checks', context_settings=CONTEXT_SETTINGS, short_help='Validate `service_checks.json` files')
@click.argument('check', autocompletion=complete_valid_checks, required=False)
@click.argument('check', shell_complete=complete_valid_checks, required=False)
@click.option('--sync', is_flag=True, help='Generate example configuration files based on specifications')
def service_checks(check, sync):
"""Validate all `service_checks.json` files.
Expand Down
Loading