Skip to content

Commit 8f67f9d

Browse files
committed
fix flake8 issues
1 parent bc69b2d commit 8f67f9d

File tree

10 files changed

+18
-30
lines changed

10 files changed

+18
-30
lines changed

engine/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ RUN --mount=type=cache,id=pip-cache,target=/root/.cache/pip \
187187

188188
# Install PyAthena for Amazon Athena SQLAlchemy-based FDW, as well as pandas
189189
RUN --mount=type=cache,id=pip-cache,target=/root/.cache/pip \
190-
pip install "PyAthena>=2.4.1" && \
191-
pip install "pandas>=1.0.0"
190+
pip install "PyAthena==2.25.2" && \
191+
pip install "pandas==1.5.3"
192192

193193
# Install Google's Big Query SQLAlchemy dialect lib
194194
RUN --mount=type=cache,id=pip-cache,target=/root/.cache/pip \

splitgraph/cloud/models.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ def to_external(self) -> External:
128128
ingestion_schedule: Optional[IngestionSchedule] = None
129129

130130
if self.ingestionScheduleByNamespaceAndRepository:
131-
schemas = {
132-
tn: ts for tn, ts in self.ingestionScheduleByNamespaceAndRepository.schema_.items()
133-
}
131+
schemas = dict(self.ingestionScheduleByNamespaceAndRepository.schema_.items())
134132
ingestion_schedule = IngestionSchedule(
135133
schedule=self.ingestionScheduleByNamespaceAndRepository.schedule,
136134
enabled=self.ingestionScheduleByNamespaceAndRepository.enabled,

splitgraph/commandline/misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def _eval(command, args):
301301
object_manager = ObjectManager(object_engine=engine, metadata_engine=engine)
302302

303303
command_locals = locals().copy()
304-
command_locals.update({k: v for k, v in args})
304+
command_locals.update(dict(args))
305305

306306
# The whole point of this function is to unsafely run Python code from the cmdline,
307307
# so silence the Bandit warning.

splitgraph/commandline/splitfile.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def build_c(splitfile, args, output_repository, layered_querying):
5353
from splitgraph.core.repository import Repository
5454
from splitgraph.splitfile.execution import execute_commands
5555

56-
args = {k: v for k, v in args}
56+
args = dict(args)
5757
click.echo("Executing Splitfile %s with arguments %r" % (splitfile.name, args))
5858

5959
if output_repository is None:
@@ -245,12 +245,8 @@ def rebuild_c(image_spec, update, against, layered_querying):
245245
# Replace the sources used to construct the image with either the latest ones or the images specified by the user.
246246
# This doesn't require us at this point to have pulled all the dependencies: the Splitfile executor will do it
247247
# after we feed in the reconstructed and patched Splitfile.
248-
deps = {k: v for k, v in image.provenance()}
249-
new_images = (
250-
{repo: repl_image for repo, repl_image in against}
251-
if not update
252-
else {repo: "latest" for repo, _ in deps.items()}
253-
)
248+
deps = dict(image.provenance())
249+
new_images = dict(against) if not update else {repo: "latest" for repo, _ in deps.items()}
254250
deps.update(new_images)
255251

256252
click.echo("Rerunning %s:%s against:" % (str(repository), image.image_hash))

splitgraph/core/fragment_manager.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1355,9 +1355,7 @@ def _add_overlapping_objects(
13551355
# Go through all objects and see if they 1) come after any of our chosen objects and 2)
13561356
# overlap those objects' PKs (if they come after them)
13571357
original_order = {object_id: i for i, object_id in enumerate(all_objects)}
1358-
object_pk_dict = {
1359-
object_id: object_pk for object_id, object_pk in zip(all_objects, object_pks)
1360-
}
1358+
object_pk_dict = dict(zip(all_objects, object_pks))
13611359
objects_to_scan = set(filtered_objects)
13621360
for overlap_candidate in all_objects:
13631361
if overlap_candidate in objects_to_scan:

splitgraph/core/image_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __call__(self) -> List[Image]:
4242
return result
4343

4444
def _make_image(self, img_tuple: Any) -> Image:
45-
r_dict = {k: v for k, v in zip(IMAGE_COLS, img_tuple)}
45+
r_dict = dict(zip(IMAGE_COLS, img_tuple))
4646
r_dict.update(repository=self.repository)
4747
return Image(**r_dict)
4848

splitgraph/core/object_manager.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,12 @@ def make_objects_external(
382382
partial_failure: Optional[IncompleteObjectUploadError] = None
383383
try:
384384
with switch_engine(self.object_engine):
385-
successful = {
386-
o: u
387-
for o, u in external_handler.upload_objects(new_objects, self.metadata_engine)
388-
}
385+
successful = dict(
386+
external_handler.upload_objects(new_objects, self.metadata_engine)
387+
)
389388
except IncompleteObjectUploadError as e:
390389
partial_failure = e
391-
successful = {o: u for o, u in zip(e.successful_objects, e.successful_object_urls)}
390+
successful = dict(zip(e.successful_objects, e.successful_object_urls))
392391

393392
locations = [(o, u, handler) for o, u in successful.items()]
394393
self.register_object_locations(locations)

splitgraph/core/table.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def _generate_results():
492492
)
493493
)
494494
for row in result:
495-
yield {c: v for c, v in zip(columns, row)}
495+
yield dict(zip(columns, row))
496496

497497
try:
498498
yield _generate_results()

splitgraph/ingestion/csv/__init__.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,9 @@ def get_table_options(
345345
if not isinstance(tables, dict):
346346
return {}
347347

348-
result = {
349-
k: v
350-
for k, v in tables.get(table_name, cast(Tuple[TableSchema, TableParams], ({}, {})))[
351-
1
352-
].items()
353-
}
348+
result = dict(
349+
tables.get(table_name, cast(Tuple[TableSchema, TableParams], ({}, {})))[1].items()
350+
)
354351

355352
# Set a default s3_object if we're using S3 and not HTTP
356353
if "url" not in result:

test/splitgraph/test_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def test_arg_flag_supercedes_env_var(fs_fast):
536536

537537
with patch.object(sys, "argv", mock_argv):
538538
with patch_os_environ(mock_environ):
539-
assert os.environ.get("SG_NAMESPACE", None) == "namespace-from-env-var"
539+
assert os.environ.get("SG_NAMESPACE") == "namespace-from-env-var"
540540
assert sys.argv[2] == "namespace-from-arg"
541541

542542
config = create_config_dict()

0 commit comments

Comments
 (0)