Skip to content

Commit

Permalink
Chore: Update dependencies, satisfy linter, and format code
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Oct 1, 2023
1 parent 5abf3ac commit 3c55f78
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 17 deletions.
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ classifiers = [
]
[project.optional-dependencies]
develop = [
"black<23",
"black<24",
"hunter<4",
"mypy==0.991",
"poethepoet<0.19",
"pyproject-fmt<0.6",
"ruff==0.0.231",
"validate-pyproject<0.12",
"mypy==1.5.1",
"poethepoet<0.25",
"pyproject-fmt<1.2",
"ruff==0.0.291",
"validate-pyproject<0.15",
]
release = [
"build<1",
"build<2",
'minibump<1; python_version >= "3.10"',
"twine<5",
]
Expand Down
1 change: 0 additions & 1 deletion skeem/autopk.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def infer_pk(
def _infer_pk(
data: t.Any, content_type: t.Optional[ContentType] = None, address: t.Optional[AddressType] = None
) -> t.Optional[str]:

# Try to converge data into pandas DataFrame.
if isinstance(data, pd.DataFrame):
df = data
Expand Down
3 changes: 0 additions & 3 deletions skeem/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def to_sql_ddl(self) -> SqlResult:
raise NotImplementedError(f"Backend '{self.backend}' not implemented")

def _ddl_frictionless(self) -> SqlResult:

# Suppress warnings of BeautifulSoup
from bs4 import GuessedAtParserWarning

Expand Down Expand Up @@ -118,7 +117,6 @@ def _ddl_frictionless(self) -> SqlResult:
# TODO: Make `infer_pk` obtain a `Resource` instance, and/or refactor as method.
# TODO: Optimize runtime by not needing to open the resource twice.
if self.target.primary_key is None:

logger.info("Converging resource to pandas DataFrame")
df: pd.DataFrame = resource.to_pandas()
logger.info(f"pandas DataFrame size={len(df)}")
Expand Down Expand Up @@ -158,7 +156,6 @@ def _ddl_frictionless(self) -> SqlResult:
return SqlResult(sql)

def _ddl_ddlgen(self) -> SqlResult:

from skeem.ddlgen.ddlgenerator import TablePlus
from skeem.ddlgen.sources import SourcePlus

Expand Down
1 change: 0 additions & 1 deletion skeem/ddlgen/monkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


def activate():

ddlgenerator.ddlgenerator.mock_engines = AnyDialect()
ddlgenerator.ddlgenerator.Table = TablePlus
ddlgenerator.reshape.clean_key_name = clean_key_name
Expand Down
3 changes: 2 additions & 1 deletion skeem/ddlgen/sources.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ast
import io
import logging
import typing as t
Expand Down Expand Up @@ -201,7 +202,7 @@ def _eval_grib2(target, fieldnames: t.List[str] = None, *args, **kwargs):
candidates = msg.splitlines()[1:]
candidate = candidates[0].strip()
logger.info(f"WARNING: Falling back to '{candidate}'. Reason: {ex}")
kwargs = eval(f"dict({candidate})")
kwargs = ast.literal_eval(f"dict({candidate})")
ds = xr.open_dataset(gribfile, engine="cfgrib", **kwargs, decode_times=False)
else:
raise
Expand Down
2 changes: 1 addition & 1 deletion skeem/ddlgen/typehelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def coerce_to_specific(datum: CoercionType) -> t.Optional[CoercionType]:
if not (1700 < result.year < 2150):
raise Exception("false date hit (%s) for %s" % (str(result), datum))
return result
except Exception:
except Exception: # noqa: S110
pass
try:
return int(str(datum))
Expand Down
1 change: 0 additions & 1 deletion skeem/util/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


def about_platform():

subsection("Python")
print(bullet_item(platform.platform()))
print()
Expand Down
1 change: 0 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def test_schema_generator_invalid_content_type():

@pytest.mark.xfail
def test_schema_generator_without_resource_type():

# Let's create a _valid_ `SchemaGenerator` instance first.
sg = SchemaGenerator(
resource=Resource(data=io.StringIO("a,b"), content_type="csv"),
Expand Down
2 changes: 1 addition & 1 deletion tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def random_table_name(label: t.Union[Path, str]):
name = label
if isinstance(label, Path):
name = label.name
return f"skeem-test-{name}-{random.randint(1, 9999)}"
return f"skeem-test-{name}-{random.randint(1, 9999)}" # noqa: S311


def get_basic_sql_reference(
Expand Down

0 comments on commit 3c55f78

Please sign in to comment.