Skip to content

Commit

Permalink
Python >= 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Oct 2, 2023
1 parent 30ad6ac commit 5258e5a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
3 changes: 0 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[flake8]
max-line-length = 132
exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,archive/
per-file-ignores =
__init__.py:F401
modules.py:F401
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9', '3.11' ]
python-version: [ '3.10', '3.11' ]
name: Lint Python ${{ matrix.python-version }}

steps:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mozloc"
version = "1.5.0"
version = "1.6.0"
description = "Using Mozilla Location services, log location vs. time using WiFi or convert to KML."
keywords = ["wifi", "geolocation"]
classifiers = ["Development Status :: 5 - Production/Stable",
Expand All @@ -18,7 +18,7 @@ classifiers = ["Development Status :: 5 - Production/Stable",
"Topic :: System :: Networking",
"Topic :: Utilities"
]
requires-python = ">=3.9"
requires-python = ">=3.10"
dynamic = ["readme"]
dependencies = ["requests", "pandas"]

Expand Down
2 changes: 2 additions & 0 deletions src/mozloc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from .base import log_wifi_loc
from .modules import get_signal, parse_signal, cli_config_check

__all__ = ["log_wifi_loc", "get_signal", "parse_signal", "cli_config_check"]
21 changes: 13 additions & 8 deletions src/mozloc/modules.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import sys

if sys.platform == "win32":
from .netsh import cli_config_check, get_signal, parse_signal
elif sys.platform == "linux":
from .netman import cli_config_check, get_signal, parse_signal
elif sys.platform == "darwin":
from .airport import cli_config_check, get_signal, parse_signal
else:
raise ImportError(f"MozLoc doesn't work with platform {sys.platform}")

match sys.platform:
case "win32":
from .netsh import cli_config_check, get_signal, parse_signal
case "linux":
from .netman import cli_config_check, get_signal, parse_signal
case "darwin":
from .airport import cli_config_check, get_signal, parse_signal
case _:
raise ImportError(f"MozLoc doesn't work with platform {sys.platform}")


__all__ = ["cli_config_check", "get_signal", "parse_signal"]
13 changes: 7 additions & 6 deletions src/mozloc/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@


def get_loc_mozilla(dat: T.Sequence[T.Any], url: str):
if isinstance(dat, pandas.DataFrame):
json_to = dat.to_json(orient="records")
elif isinstance(dat, list):
json_to = json.dumps(dat)
else:
raise TypeError("Unknown data format")
match dat:
case pandas.DataFrame():
json_to = dat.to_json(orient="records")
case list():
json_to = json.dumps(dat)
case _:
raise TypeError("Unknown data format")

json_to = '{ "wifiAccessPoints":' + json_to + "}"
try:
Expand Down

0 comments on commit 5258e5a

Please sign in to comment.