Skip to content

Commit

Permalink
chore: pre-commit autoupdate (meltano#7278)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Will Da Silva <will@willdasilva.xyz>
  • Loading branch information
pre-commit-ci[bot] and WillDaSilva committed Feb 10, 2023
1 parent 32e2d4d commit 7aa898b
Show file tree
Hide file tree
Showing 31 changed files with 25 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ repos:
- "prettier@2.8.1"

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
exclude: ^(src/meltano/migrations/)
Expand Down
2 changes: 0 additions & 2 deletions src/meltano/api/workers/api_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def run(self):
with self.project.settings.feature_flag(
FeatureFlags.ENABLE_UVICORN, raise_error=False
) as allow:

enable_uvicorn = allow

# Use Uvicorn when on Windows
Expand Down Expand Up @@ -86,7 +85,6 @@ def run(self):

# Add reload argument if reload is true
if self.reload:

args += [
"--reload",
]
Expand Down
3 changes: 0 additions & 3 deletions src/meltano/cli/elt.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ async def _run_job(tracker, project, job, session, context_builder, force=False)

@asynccontextmanager
async def _redirect_output(log, output_logger):

meltano_stdout = output_logger.out(
"meltano", log.bind(stdio="stdout", cmd_type="elt")
)
Expand Down Expand Up @@ -285,7 +284,6 @@ async def _run_elt(


async def _run_extract_load(log, elt_context, output_logger, **kwargs): # noqa: WPS231

extractor = elt_context.extractor.name
loader = elt_context.loader.name

Expand Down Expand Up @@ -352,7 +350,6 @@ async def _run_extract_load(log, elt_context, output_logger, **kwargs): # noqa:


async def _run_transform(log, elt_context, output_logger, **kwargs):

stderr_log = logger.bind(
run_id=str(elt_context.job.run_id),
state_id=elt_context.job.job_name,
Expand Down
1 change: 0 additions & 1 deletion src/meltano/cli/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def removal_manager_status_update(removal_manager: PluginLocationRemoveManager):
)

elif removal_manager.plugin_removed:

msg = f"Removed {plugin_descriptor} from {location}"

if isinstance(removal_manager, DbRemoveManager):
Expand Down
3 changes: 2 additions & 1 deletion src/meltano/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ async def _run_blocks(
raise CliError(
f"Run invocation could not be completed as block failed: {err}"
) from err
except Exception as bare_err: # make sure we also fire block failed events for all other exceptions
except Exception as bare_err:
# make sure we also fire block failed events for all other exceptions
with tracker.with_contexts(tracking_ctx):
tracker.track_block_event(blk_name, BlockEvents.failed)
raise bare_err
Expand Down
1 change: 0 additions & 1 deletion src/meltano/core/block/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def __init__(
blocks = self._expand_jobs(blocks, task_sets_service)

for idx, name in enumerate(blocks):

try:
parsed_name, command_name = name.split(":")
except ValueError:
Expand Down
1 change: 0 additions & 1 deletion src/meltano/core/migration_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def _create_user_role(self, session: Session) -> None:
session: The session to use.
"""
if not session.query(Role).filter_by(name="admin").first():

session.add(
Role(
name="admin",
Expand Down
1 change: 0 additions & 1 deletion src/meltano/core/plugin/meltano_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class MeltanoFilePlugin(FilePlugin):

overwrite = {"meltano.yml"}

def __init__(self, discovery: bool = False):
Expand Down
1 change: 0 additions & 1 deletion src/meltano/core/plugin_invoker.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ def env(self): # noqa: WPS210
with self.project.settings.feature_flag(
FeatureFlags.STRICT_ENV_VAR_MODE, raise_error=False
) as strict_env_var_mode:

# Expand root env w/ os.environ
expanded_project_env = {
**expand_env_vars(
Expand Down
3 changes: 1 addition & 2 deletions src/meltano/core/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ def find_named(xs: Iterable[_G], name: str, obj_type: type | None = None) -> _G:
def makedirs(func):
@functools.wraps(func)
def decorate(*args, **kwargs):

enabled = kwargs.get("make_dirs", True)

path = func(*args, **kwargs)
Expand Down Expand Up @@ -437,7 +436,7 @@ def pop_at_path(d, path, default=None): # noqa: WPS210

popped = cursor.pop(tail, default)

for (cursor, key) in reversed(cursors):
for cursor, key in reversed(cursors):
if len(cursor[key]) == 0:
cursor.pop(key, None)

Expand Down
4 changes: 2 additions & 2 deletions src/meltano/core/venv_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ def requires_clean_install(self, pip_install_args: list[str]) -> bool:
Returns:
Whether virtual environment doesn't exist or can't be reused.
"""
# A generator function is used to perform the checks lazily
def checks():

def checks(): # A generator is used to perform the checks lazily
# The Python installation used to create this venv no longer exists
yield not self.exec_path("python").exists()
# The deprecated `meltano_venv.pth` feature is used by this venv
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@pytest.fixture(scope="class")
def compatible_copy_tree():
"""Copy files recursively from source to destination, ignoring existing dirs."""
# noqa: DAR201

def _compatible_copy_tree(source: Path, destination: Path):
"""Copy files recursively from source to destination, ignoring existing dirs."""
if sys.version_info >= (3, 8):
Expand Down
2 changes: 0 additions & 2 deletions tests/meltano/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def test_version(self, cli_runner):
def test_default_environment_is_activated(
self, deactivate_project, project_files_cli, cli_runner, pushd
):

pushd(project_files_cli.root)
cli_runner.invoke(
cli,
Expand All @@ -158,7 +157,6 @@ def test_environment_flag_overrides_default(
def test_environment_variable_overrides_default(
self, deactivate_project, project_files_cli, cli_runner, pushd, monkeypatch
):

monkeypatch.setenv("MELTANO_ENVIRONMENT", "test-subconfig-2-yml")
pushd(project_files_cli.root)
cli_runner.invoke(
Expand Down
1 change: 0 additions & 1 deletion tests/meltano/cli/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def test_config_meltano_set(self, project: Project, cli_runner):
)

def test_config_test(self, project: Project, cli_runner, tap):

mock_invoke = mock.Mock()
mock_invoke.sterr.at_eof.side_effect = True
mock_invoke.stdout.at_eof.side_effect = (False, True)
Expand Down
1 change: 0 additions & 1 deletion tests/meltano/cli/test_elt.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def matches(self, lines: list[dict]) -> bool:
True if a matching log line is found, else False
"""
for line in lines:

matches = (
line.get("name") == self.name
and line.get("cmd_type") == self.cmd_type
Expand Down
2 changes: 0 additions & 2 deletions tests/meltano/cli/test_invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def project_tap_mock(project_add_service):
class TestCliInvoke:
@pytest.fixture
def mock_invoke(self, utility, plugin_invoker_factory):

process_mock = Mock()
process_mock.name = "utility-mock"
process_mock.wait = AsyncMock(return_value=0)
Expand Down Expand Up @@ -192,7 +191,6 @@ def test_invoke_triggers(
) as apply_catalog_rules, patch.object(
SingerTap, "look_up_state"
) as look_up_state:

# Modes other than sync don't trigger discovery or applying catalog rules
cli_runner.invoke(cli, ["invoke", tap.name, "--some-tap-option"])
assert discover_catalog.call_count == 0
Expand Down
1 change: 0 additions & 1 deletion tests/meltano/cli/test_job_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ def test_job_list(self, session, project, cli_runner, task_sets_service):
with mock.patch(
"meltano.cli.job.TaskSetsService", return_value=task_sets_service
), mock.patch("meltano.cli.job._validate_tasks", return_value=True):

cli_args = [
"job",
"add",
Expand Down
7 changes: 0 additions & 7 deletions tests/meltano/cli/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


class MockIOBlock(IOBlock):

string_id = "mock-io-block"


Expand Down Expand Up @@ -646,7 +645,6 @@ def test_run_elb_tap_failure(
dbt_process,
job_logging_service,
):

# in this scenario, the tap fails on the third read. Target should still complete, but dbt should not.
args = ["run", tap.name, target.name, "dbt:run"]

Expand Down Expand Up @@ -721,7 +719,6 @@ def test_run_elb_target_failure_before_tap_finished( # noqa: WPS118
dbt_process,
job_logging_service,
):

args = ["run", tap.name, target.name, "dbt:run"]

# Have `tap_process.wait` take 2s to make sure the target can fail before tap finishes
Expand Down Expand Up @@ -819,7 +816,6 @@ def test_run_elb_target_failure_after_tap_finished( # noqa: WPS118
dbt_process,
job_logging_service,
):

args = ["run", tap.name, target.name, "dbt:run"]

target_process.wait.return_value = 1
Expand Down Expand Up @@ -895,7 +891,6 @@ def test_run_elb_tap_and_target_failed(
dbt_process,
job_logging_service,
):

args = ["run", tap.name, target.name, "dbt:run"]

tap_process.wait.return_value = 1
Expand Down Expand Up @@ -978,7 +973,6 @@ def test_run_elb_tap_line_length_limit_error(
dbt_process,
job_logging_service,
):

args = ["run", tap.name, target.name]

# Raise a ValueError wrapping a LimitOverrunError, like StreamReader.readline does:
Expand Down Expand Up @@ -1186,7 +1180,6 @@ def test_run_elb_mapper_failure(
dbt_process,
job_logging_service,
):

# in this scenario, the map fails on the second read. Target should still complete, but dbt should not.
args = ["run", tap.name, "mock-mapping-0", target.name, "dbt:run"]

Expand Down
1 change: 0 additions & 1 deletion tests/meltano/cli/test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def test_schedule_remove(self, cli_runner, job_schedule):
def test_schedule_set(
self, cli_runner, elt_schedule, job_schedule, schedule_service
):

with mock.patch(
"meltano.cli.schedule.ScheduleService", return_value=schedule_service
):
Expand Down
14 changes: 7 additions & 7 deletions tests/meltano/cli/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_list_pattern(
self, state_service, cli_runner, patterns_with_expected_results
):
with mock.patch("meltano.cli.state.StateService", return_value=state_service):
for (pattern, expected_result) in patterns_with_expected_results:
for pattern, expected_result in patterns_with_expected_results:
result = cli_runner.invoke(cli, ["state", "list", "--pattern", pattern])
assert_cli_runner(result)
assert self.get_result_set(result) == expected_result
Expand Down Expand Up @@ -137,7 +137,7 @@ def test_merge_from_string(self, state_service, state_ids, cli_runner):
job_pairs = []
for idx in range(0, len(state_ids) - 1, 2):
job_pairs.append((state_ids[idx], state_ids[idx + 1]))
for (job_src, job_dst) in job_pairs:
for job_src, job_dst in job_pairs:
job_src_state = state_service.get_state(job_src)
job_dst_state = state_service.get_state(job_dst)
result = cli_runner.invoke(
Expand Down Expand Up @@ -165,7 +165,7 @@ def test_merge_from_file(
job_pairs = []
for idx in range(0, len(state_ids) - 1, 2):
job_pairs.append((state_ids[idx], state_ids[idx + 1]))
for (job_src, job_dst) in job_pairs:
for job_src, job_dst in job_pairs:
job_src_state = state_service.get_state(job_src)
job_dst_state = state_service.get_state(job_dst)
filepath = os.path.join(tmp_path, f"{job_src}-{job_dst}")
Expand All @@ -185,7 +185,7 @@ def test_merge_from_job(self, state_service, state_ids, cli_runner):
job_pairs = []
for idx in range(0, len(state_ids) - 1, 2):
job_pairs.append((state_ids[idx], state_ids[idx + 1]))
for (job_src, job_dst) in job_pairs:
for job_src, job_dst in job_pairs:
job_state_src = state_service.get_state(job_src)
job_state_dst = state_service.get_state(job_dst)
merged_state = merge(job_state_src, job_state_dst)
Expand All @@ -200,7 +200,7 @@ def test_copy_over_existing(self, state_service, state_ids, cli_runner):
job_pairs = []
for idx in range(0, len(state_ids) - 1, 2):
job_pairs.append((state_ids[idx], state_ids[idx + 1]))
for (job_src, job_dst) in job_pairs:
for job_src, job_dst in job_pairs:
job_src_state = state_service.get_state(job_src)
result = cli_runner.invoke(
cli,
Expand All @@ -226,7 +226,7 @@ def test_move(self, state_service, state_ids, cli_runner):
job_pairs = []
for idx in range(0, len(state_ids) - 1, 2):
job_pairs.append((state_ids[idx], state_ids[idx + 1]))
for (job_src, job_dst) in job_pairs:
for job_src, job_dst in job_pairs:
job_src_state = state_service.get_state(job_src)
result = cli_runner.invoke(
cli,
Expand All @@ -238,7 +238,7 @@ def test_move(self, state_service, state_ids, cli_runner):

def test_get(self, state_service, cli_runner, state_ids_with_expected_states):
with mock.patch("meltano.cli.state.StateService", return_value=state_service):
for (state_id, expected_state) in state_ids_with_expected_states:
for state_id, expected_state in state_ids_with_expected_states:
result = cli_runner.invoke(cli, ["state", "get", state_id])
assert_cli_runner(result)
assert json.loads(result.stdout) == expected_state
Expand Down
2 changes: 0 additions & 2 deletions tests/meltano/core/block/test_extract_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ async def test_elb_validation(
plugin_invoker_factory,
elb_context,
):

tap_process.sterr.at_eof.side_effect = True
tap_process.stdout.at_eof.side_effect = (False, False, True)
tap_process.stdout.readline = AsyncMock(
Expand All @@ -434,7 +433,6 @@ async def test_elb_validation(

invoke_async = AsyncMock(side_effect=(tap_process, target_process))
with mock.patch.object(PluginInvoker, "invoke_async", new=invoke_async):

blocks = (
SingerBlock(
block_ctx=elb_context,
Expand Down
2 changes: 0 additions & 2 deletions tests/meltano/core/block/test_singer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def mock_target_plugin_invoker(self, process_mock_factory, target):
async def test_singer_block_start(
self, elt_context, mock_tap_plugin_invoker, mock_target_plugin_invoker
):

block = SingerBlock(
block_ctx=elt_context,
project=elt_context.project,
Expand Down Expand Up @@ -195,7 +194,6 @@ async def test_singer_block_io(self, elt_context, mock_tap_plugin_invoker, log):
async def test_singer_block_close_stdin(
self, elt_context, mock_tap_plugin_invoker, mock_target_plugin_invoker
):

producer = SingerBlock(
block_ctx=elt_context,
project=elt_context.project,
Expand Down
2 changes: 0 additions & 2 deletions tests/meltano/core/job/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ async def test_run_failed(self, session):

@pytest.mark.asyncio
async def test_run_interrupted(self, session):

if platform.system() == "Windows":
pytest.xfail(
"Doesn't pass on windows, this is currently being tracked here https://github.com/meltano/meltano/issues/2842"
Expand All @@ -111,7 +110,6 @@ async def test_run_interrupted(self, session):

@pytest.mark.asyncio
async def test_run_terminated(self, session):

if platform.system() == "Windows":
pytest.xfail(
"Doesn't pass on windows, this is currently being tracked here https://github.com/meltano/meltano/issues/2842"
Expand Down

0 comments on commit 7aa898b

Please sign in to comment.