Skip to content

Commit

Permalink
Use flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
adsharma committed May 5, 2024
1 parent 497579f commit 31fc121
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
- uses: actions/checkout@v2

- name: Install linters
run: pip3 install black pyflakes
run: pip3 install black flake8

- name: Run black
run: black */ *.py

- name: Run pyflakes
run: pyflakes */ *.py
- name: Run flake8
run: flake8 --max-line-length 100
2 changes: 1 addition & 1 deletion fquery/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(
self._to_json = False

def __str__(self) -> str:
query_name = str(self.OP)[len("QueryableOp.") :]
query_name = str(self.OP)[len("QueryableOp."):]
if self.OP == QueryableOp.LEAF:
return f"{query_name} ({self.__class__.__name__})"
else:
Expand Down
4 changes: 2 additions & 2 deletions fquery/sql_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def visit_where(self, query):
left, op, right = query._expr.value.split()
right = ast.literal_eval(right)
table, field = left.split(".") if "." in left else (self.sql, left)
if type(table) == str:
if type(table) is str:
table = Tables(table)[0]
binary_op = _cmp_ops_dict[op]
self.sql_stack.append(
Expand All @@ -73,7 +73,7 @@ async def visit_where(self, query):
async def visit_order_by(self, query):
key = query._expr.value
table, field = key.split(".") if "." in key else (self.sql, key)
if type(table) == str:
if type(table) is str:
table = Tables(table)[0]
self.sql_stack.append(lambda x: x.orderby(table.__getattr__(field)))
await self.visit(query.child)
4 changes: 2 additions & 2 deletions fquery/walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ async def _materialize_walk_obj(d) -> Tree:
return await asyncio.gather(
*(val for val in (_materialize_walk_obj(v) for v in resolved) if val)
)
elif type(d) == types.AsyncGeneratorType:
elif type(d) is types.AsyncGeneratorType:
d_list = [i async for i in d] # TODO: Optimize
resolved = await resolve_parallel_iterable(d_list)
return await asyncio.gather(
Expand Down Expand Up @@ -393,7 +393,7 @@ async def _materialize_walk(d) -> Tree:
return await asyncio.gather(
*(val for val in (_materialize_walk(v) for v in resolved) if val)
)
elif type(d) == types.AsyncGeneratorType:
elif type(d) is types.AsyncGeneratorType:
d_list = [i async for i in d] # TODO: Optimize
resolved = await resolve_parallel_iterable(d_list)
return await asyncio.gather(
Expand Down

0 comments on commit 31fc121

Please sign in to comment.