Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
surplus v2.2.0 (#38)
Browse files Browse the repository at this point in the history
* build(deps-dev): bump black from 23.7.0 to 23.9.1 (#33)

Bumps [black](https://github.com/psf/black) from 23.7.0 to 23.9.1.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@23.7.0...23.9.1)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* meta: update devbox files

* ctt: type analyse

* ci: update devbox-install-action (#35)

* import protocol from typing straight (#36)

* ctt: update uq and np tests

* s+,docs: add termux-location json support (#37)

docs: update api accordingly

* meta: bump ver

* s+,ctt: fix italian addressing + add test (#34)

* st: fix regression in last commit + add per-line settings dict

* ctt: update modena test

* docs: update api docs for the new st constants

* ci,devbox: fix for ci

* ctt: update modena test

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
markjoshwel and dependabot[bot] authored Oct 14, 2023
1 parent 533cdb2 commit fdf3a86
Show file tree
Hide file tree
Showing 10 changed files with 506 additions and 260 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v3

- name: install devbox
uses: jetpack-io/devbox-install-action@v0.3.0
uses: jetpack-io/devbox-install-action@v0.7.0

- name: install dependencies
run: devbox run poetry install
Expand All @@ -28,10 +28,10 @@ jobs:
run: devbox run poetry run mypy .

- name: check for black formatting compliance
run: devbox run poetry run "black --check ."
run: devbox run poetry run black --check .

- name: analyse isort compliance
run: devbox run poetry run "isort --check *.py **/*.py"
run: devbox run poetry run isort --check *.py **/*.py

test:
runs-on: ubuntu-latest
Expand All @@ -40,7 +40,7 @@ jobs:
uses: actions/checkout@v3

- name: install devbox
uses: jetpack-io/devbox-install-action@v0.3.0
uses: jetpack-io/devbox-install-action@v0.7.0

- name: install dependencies
run: devbox run poetry install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-slsa3-auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: tj-actions/branch-names@v7

- name: install devbox
uses: jetpack-io/devbox-install-action@v0.6.1
uses: jetpack-io/devbox-install-action@v0.7.0

- name: install dependencies
run: devbox run poetry install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-slsa3-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: tj-actions/branch-names@v7

- name: install devbox
uses: jetpack-io/devbox-install-action@v0.6.1
uses: jetpack-io/devbox-install-action@v0.7.0

- name: install dependencies
run: devbox run poetry install
Expand Down
77 changes: 62 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ to iOS Shortcuts-like shareable text.

```text
$ surplus 9R3J+R9 Singapore
surplus version 2.1.1
surplus version 2.2.0
Thomson Plaza
301 Upper Thomson Road
Sin Ming, Bishan
Expand Down Expand Up @@ -57,7 +57,7 @@ see [licence](#licence) for licensing information.

```text
usage: surplus [-h] [-d] [-v] [-c {pluscode,localcode,latlong,sharetext}]
[-u USER_AGENT]
[-u USER_AGENT] [-t]
[query ...]
Google Maps Plus Code to iOS Shortcuts-like shareable text
Expand All @@ -79,6 +79,9 @@ options:
-u USER_AGENT, --user-agent USER_AGENT
user agent string to use for geocoding service,
defaults to fingerprinted user agent string
-t, --using-termux-location
treats input as a termux-location output json
string, and parses it accordingly
```

### example api usage
Expand Down Expand Up @@ -260,7 +263,7 @@ of incorrect outputs.
```text
$ s+ --debug 8QJF+RP Singapore
surplus version 2.1.1, debug mode (latest@future, Tue 05 Sep 2023 23:38:59 +0800)
surplus version 2.2.0, debug mode (latest@future, Tue 05 Sep 2023 23:38:59 +0800)
debug: parse_query: behaviour.query=['8QJF+RP', 'Singapore']
debug: _match_plus_code: portion_plus_code='8QJF+RP', portion_locality='Singapore'
debug: cli: query=Result(value=LocalCodeQuery(code='8QJF+RP', locality='Singapore'), error=None)
Expand Down Expand Up @@ -602,24 +605,62 @@ line breakdown of shareable text output, accompanied by their Nominatim keys:
> this constant only affects the default surplus Nominatim geocoding functions. custom
> functions do not read from this, unless deliberately programmed to do so
- `SHAREABLE_TEXT_LINE_0_KEYS: typing.Final[tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_1_KEYS: typing.Final[tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_2_KEYS: typing.Final[tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_3_KEYS: typing.Final[tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_4_KEYS: typing.Final[tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_5_KEYS: typing.Final[tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_6_KEYS: typing.Final[tuple[str, ...]]`
- `SHAREABLE_TEXT_LINE_0_KEYS: dict[str, tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_1_KEYS: dict[str, tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_2_KEYS: dict[str, tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_3_KEYS: dict[str, tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_4_KEYS: dict[str, tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_5_KEYS: dict[str, tuple[str, ...]]`
`SHAREABLE_TEXT_LINE_6_KEYS: dict[str, tuple[str, ...]]`
a tuple of strings containing Nominatim keys used in shareable text line 0-6
a dictionary of iso3166-2 country-portion string keys with a tuple of Nominatim keys
used in shareable text line 0-6 as their values
- `SHAREABLE_TEXT_NAMES: typing.Final[tuple[str, ...]]`
```python
{
"default": (...),
"SG": (...,),
...
}
```

- `SHAREABLE_TEXT_LINE_SETTINGS: dict[str, dict[int, tuple[str, bool]]]`

a dictionary of iso3166-2 country-portion string keys with a dictionary as their values

the dictionary values are dictionaries with integers as keys, and a tuple of two strings

the first string is the separator string to use, and the second string is a boolean flag
that if `True` will check the line for seen names

```python
{
"default": {
0: (", ", False),
...
6: (", ", False),
},
"IT": {
0: (", ", False),
...
6: (", ", False),
},
...
}
```

- `SHAREABLE_TEXT_NAMES: dict[str, tuple[str, ...]]`

a dictionary of iso3166-2 country-portion string keys with a tuple of strings as their
values
a tuple of strings containing Nominatim keys used in shareable text line 0-2 and
special keys in line 3

used for seen name checks

- `SHAREABLE_TEXT_LOCALITY: dict[str, tuple[str, ...]]`

a dictionary of iso3166-2 country-portion strings with a tuples of strings as their
a dictionary of iso3166-2 country-portion string keys with a tuple of strings as their
values

used when generating the locality portions of shortened Plus Codes/local codes
Expand All @@ -632,6 +673,9 @@ line breakdown of shareable text output, accompanied by their Nominatim keys:
}
```

- `SHAREABLE_TEXT_DEFAULT: typing.Final[str]`
constant for what is the "default" key in the `SHAREABLE*` constants

- `EMPTY_LATLONG: typing.Final[Latlong]`
a constant for an empty latlong coordinate, with latitude and longitude set to 0.0

Expand Down Expand Up @@ -793,6 +837,9 @@ attributes
- `convert_to_type: ConversionResultTypeEnum = ConversionResultTypeEnum.SHAREABLE_TEXT`
what type to convert the query to

- `using_termux_location: bool = False`
treats query as a termux-location output json string, and parses it accordingly

### `class SurplusDefaultGeocoding`

> [!IMPORTANT]
Expand Down Expand Up @@ -1288,7 +1335,7 @@ it contains the following, in order, alongside an example:
1. `version` - the surplus version alongside a suffix, if any

```text
2.1.1-local
2.2.0-local
```

2. `system_info` - generic machine and operating system information
Expand All @@ -1312,7 +1359,7 @@ it contains the following, in order, alongside an example:
after hashing, this string becomes a 12 character hexadecimal string, as shown below:

```text
surplus/2.1.1-local (1fdbfa0b0cfb)
surplus/2.2.0-local (1fdbfa0b0cfb)
^^^^^^^^^^^^
this is the hashed result of unique_info
```
Expand Down
11 changes: 4 additions & 7 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"packages": [
"python311",
"python311Packages.ipykernel",
"poetry"
"python311@latest",
"python311Packages.ipykernel@latest",
"poetry@latest"
],
"shell": {
"init_hook": [
"poetry env use $(which python)",
"poetry shell"
]
"init_hook": ["poetry install"]
},
"nixpkgs": {
"commit": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62"
Expand Down
66 changes: 59 additions & 7 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,67 @@
{
"lockfile_version": "1",
"packages": {
"poetry": {
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#poetry"
"poetry@latest": {
"last_modified": "2023-10-04T02:19:08Z",
"plugin_version": "0.0.3",
"resolved": "github:NixOS/nixpkgs/d1c9180c6d1f8fce9469436f48c1cb8180d7087d#poetry",
"source": "devbox-search",
"version": "1.6.1",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/i7q6kxa3ac7c57zalr4vwa04c1bll3xd-python3.10-poetry-1.6.1"
},
"aarch64-linux": {
"store_path": "/nix/store/b0gmqd0y5pich25mk5p649g1bbbyxp0v-python3.10-poetry-1.6.1"
},
"x86_64-darwin": {
"store_path": "/nix/store/q5zqqp3k58z46q4imgmj5pxbinmzjyqf-python3.10-poetry-1.6.1"
},
"x86_64-linux": {
"store_path": "/nix/store/6v2zvmag2il359sbd8j1q7b3c20gs6yd-python3.10-poetry-1.6.1"
}
}
},
"python311": {
"python311@latest": {
"last_modified": "2023-09-27T18:02:17Z",
"plugin_version": "0.0.1",
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#python311"
"resolved": "github:NixOS/nixpkgs/517501bcf14ae6ec47efd6a17dda0ca8e6d866f9#python311",
"source": "devbox-search",
"version": "3.11.4",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/rycxjkclx801wrhwrgllak0302xzjdvx-python3-3.11.4"
},
"aarch64-linux": {
"store_path": "/nix/store/h4xi1djsmhk7bjdipz58xkfnf8lc9mpm-python3-3.11.4"
},
"x86_64-darwin": {
"store_path": "/nix/store/yqs2zxkxn61xzimdaz1pbgawk2lnm0d8-python3-3.11.4"
},
"x86_64-linux": {
"store_path": "/nix/store/3k7is7nc2xbav8a48vx7arad522d8czx-python3-3.11.4"
}
}
},
"python311Packages.ipykernel": {
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#python311Packages.ipykernel"
"python311Packages.ipykernel@latest": {
"last_modified": "2023-09-29T09:08:59Z",
"resolved": "github:NixOS/nixpkgs/bd9b686c0168041aea600222be0805a0de6e6ab8#python311Packages.ipykernel",
"source": "devbox-search",
"version": "6.21.2",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/78gi0qk9lmrb4rk5ignww29p5j0l79gs-python3.11-ipykernel-6.21.2"
},
"aarch64-linux": {
"store_path": "/nix/store/74m55prblwmsyx1ylv135iqw2wqj4c6a-python3.11-ipykernel-6.21.2"
},
"x86_64-darwin": {
"store_path": "/nix/store/j0wpnwkdcqfp2bmp2b9pgzdngnmxzjj9-python3.11-ipykernel-6.21.2"
},
"x86_64-linux": {
"store_path": "/nix/store/3kqcf56q2q46hj0g5n4rxzzy1c9vdiqa-python3.11-ipykernel-6.21.2"
}
}
}
}
}
}
Loading

0 comments on commit fdf3a86

Please sign in to comment.