Skip to content

Commit

Permalink
style: no implicit optional lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jun 26, 2023
1 parent da9825b commit 536c394
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion ibis/backends/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ def current_database(self) -> str | None:
"""

@abc.abstractmethod
def list_databases(self, like: str = None) -> list[str]:
def list_databases(self, like: str | None = None) -> list[str]:
"""List existing databases in the current connection.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/base/df/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
class Scope:
def __init__(
self,
param: dict[Node, Any] = None,
param: dict[Node, Any] | None = None,
timecontext: TimeContext | None = None,
):
"""Create a new scope.
Expand Down
6 changes: 3 additions & 3 deletions ibis/backends/dask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def version(self):
def execute(
self,
query: ir.Expr,
params: Mapping[ir.Expr, object] = None,
params: Mapping[ir.Expr, object] | None = None,
limit: str = 'default',
**kwargs,
):
Expand All @@ -94,7 +94,7 @@ def execute(
return _apply_schema(query.op(), result)

def compile(
self, query: ir.Expr, params: Mapping[ir.Expr, object] = None, **kwargs
self, query: ir.Expr, params: Mapping[ir.Expr, object] | None = None, **kwargs
):
"""Compile `expr`.
Expand All @@ -110,7 +110,7 @@ def compile(

return execute_and_reset(query.op(), params=params, **kwargs)

def table(self, name: str, schema: sch.Schema = None):
def table(self, name: str, schema: sch.Schema | None = None):
df = self.dictionary[name]
schema = schema or self.schemas.get(name, None)
schema = DaskData.infer_table(df, schema=schema)
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/dask/execution/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def compute_projection(
node,
parent,
data,
scope: Scope = None,
scope: Scope | None = None,
timecontext: TimeContext | None = None,
**kwargs,
):
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/dask/execution/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def compute_sort_key(
key: str | SortKey,
data: dd.DataFrame,
timecontext: TimeContext,
scope: Scope = None,
scope: Scope | None = None,
**kwargs,
):
"""Compute a sort key.
Expand Down Expand Up @@ -237,7 +237,7 @@ def compute_sort_key(
def compute_sorted_frame(
df: dd.DataFrame,
order_by: list[str | SortKey],
group_by: list[str | SortKey] = None,
group_by: list[str | SortKey] | None = None,
timecontext=None,
**kwargs,
) -> dd.DataFrame:
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/datafusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def to_pyarrow_batches(
def execute(
self,
expr: ir.Expr,
params: Mapping[ir.Expr, object] = None,
params: Mapping[ir.Expr, object] | None = None,
limit: int | str | None = "default",
**kwargs: Any,
):
Expand All @@ -349,7 +349,7 @@ def execute(
def compile(
self,
expr: ir.Expr,
params: Mapping[ir.Expr, object] = None,
params: Mapping[ir.Expr, object] | None = None,
**kwargs: Any,
):
return translate(expr.op())
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def list_databases(self, like=None):
def list_tables(self, like=None, database=None):
return self._filter_with_like(list(self.dictionary.keys()), like)

def table(self, name: str, schema: sch.Schema = None):
def table(self, name: str, schema: sch.Schema | None = None):
df = self.dictionary[name]
schema = schema or self.schemas.get(name, None)
schema = PandasData.infer_table(df, schema=schema)
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/pandas/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def execute_until_in_scope(
node,
scope: Scope,
timecontext: TimeContext | None = None,
aggcontext: agg_ctx.AggregationContext = None,
aggcontext: agg_ctx.AggregationContext | None = None,
clients: Iterable | None = None,
post_execute_: Callable | None = None,
**kwargs: Any,
Expand Down Expand Up @@ -372,7 +372,7 @@ def main_execute(
params: Mapping[ops.Node, Any] | None = None,
scope: Scope | None = None,
timecontext: TimeContext | None = None,
aggcontext: agg_ctx.AggregationContext = None,
aggcontext: agg_ctx.AggregationContext | None = None,
cache: Mapping[ops.Node, Any] | None = None,
**kwargs: Any,
):
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/pandas/execution/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def trim_window_result(data: pd.Series | pd.DataFrame, timecontext: TimeContext
def execute_window_op(
op,
data,
scope: Scope = None,
scope: Scope | None = None,
timecontext: TimeContext | None = None,
aggcontext=None,
clients=None,
Expand Down
12 changes: 7 additions & 5 deletions ibis/backends/polars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def list_databases(self, like=None):
def list_tables(self, like=None, database=None):
return self._filter_with_like(list(self._tables.keys()), like)

def table(self, name: str, _schema: sch.Schema = None) -> ir.Table:
def table(self, name: str, _schema: sch.Schema | None = None) -> ir.Table:
schema = schema_from_polars(self._tables[name].schema)
return ops.DatabaseTable(name, schema, self).to_expr()

Expand Down Expand Up @@ -349,7 +349,9 @@ def has_operation(cls, operation: type[ops.Value]) -> bool:
issubclass(operation, op_impl) for op_impl in op_classes
)

def compile(self, expr: ir.Expr, params: Mapping[ir.Expr, object] = None, **_: Any):
def compile(
self, expr: ir.Expr, params: Mapping[ir.Expr, object] | None = None, **_: Any
):
node = expr.op()
ctx = self._context
if params:
Expand Down Expand Up @@ -385,7 +387,7 @@ def _get_schema_using_query(self, query: str) -> sch.Schema:
def execute(
self,
expr: ir.Expr,
params: Mapping[ir.Expr, object] = None,
params: Mapping[ir.Expr, object] | None = None,
limit: int | None = None,
**kwargs: Any,
):
Expand Down Expand Up @@ -413,7 +415,7 @@ def execute(
def _to_pyarrow_table(
self,
expr: ir.Expr,
params: Mapping[ir.Expr, object] = None,
params: Mapping[ir.Expr, object] | None = None,
limit: int | None = None,
**kwargs: Any,
):
Expand All @@ -433,7 +435,7 @@ def _to_pyarrow_table(
def to_pyarrow(
self,
expr: ir.Expr,
params: Mapping[ir.Expr, object] = None,
params: Mapping[ir.Expr, object] | None = None,
limit: int | None = None,
**kwargs: Any,
):
Expand Down
4 changes: 2 additions & 2 deletions ibis/common/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ class Argument(Annotation):

def __init__(
self,
validator: Validator = None,
validator: Validator | None = None,
default: Any = EMPTY,
typehint: type = None,
typehint: type | None = None,
kind: int = POSITIONAL_OR_KEYWORD,
):
super().__init__(validator, default, typehint)
Expand Down
2 changes: 1 addition & 1 deletion ibis/common/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ def pattern(obj: AnyType) -> Pattern:
return EqualTo(obj)


def match(pat: Pattern, value: AnyType, context: dict[str, AnyType] = None):
def match(pat: Pattern, value: AnyType, context: Optional[dict[str, AnyType]] = None):
"""Match a value against a pattern.
Parameters
Expand Down

0 comments on commit 536c394

Please sign in to comment.