From 762080c11d2ed5c168c749ebf3884c62b8acf17f Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Tue, 5 Sep 2023 03:58:21 +0000 Subject: [PATCH 1/3] releaser: pretty format invocations --- releaser.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/releaser.py b/releaser.py index e25c151..ed58520 100644 --- a/releaser.py +++ b/releaser.py @@ -38,10 +38,16 @@ path_surplus = Path(__file__).parent.joinpath("./surplus/surplus.py") build_time = datetime.now(timezone(timedelta(hours=8))) # using SGT insert_build_branch: str = run( - "git rev-parse --abbrev-ref HEAD", capture_output=True, text=True, shell=True + "git rev-parse --abbrev-ref HEAD", + capture_output=True, + text=True, + shell=True, ).stdout.strip("\n") insert_build_commit: str = run( - "git rev-parse HEAD", capture_output=True, text=True, shell=True + "git rev-parse HEAD", + capture_output=True, + text=True, + shell=True, ).stdout.strip("\n") insert_build_datetime: str = repr(build_time).replace("datetime.", "") From 8ccee82f262213401ab6eb9d3e30c166193887b6 Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Tue, 5 Sep 2023 04:34:12 +0000 Subject: [PATCH 2/3] docs: fix english oops --- README.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0901d28..50dcdc9 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ options: here are a few examples to get you quickly started using surplus in your own program: -1. let surplus do the heavy lifiting +1. let surplus do the heavy lifting ```python >>> from surplus import surplus, Behaviour @@ -98,7 +98,7 @@ here are a few examples to get you quickly started using surplus in your own pro 'Ngee Ann Polytechnic\n535 Clementi Road\nBukit Timah\n599489\nNorthwest, Singapore' ``` -2. handle queries seperately +2. handle queries separately ```python >>> import surplus @@ -123,7 +123,7 @@ here are a few examples to get you quickly started using surplus in your own pro notes: -- you can change what surplus does by passing in a custom [`Behaviour`](#class-behaviour) +- you can change what surplus does when passing in a custom [`Behaviour`](#class-behaviour) object - most surplus functions return a [`Result`](#class-result) object. while you can @@ -175,7 +175,7 @@ the command to create an empty commit is `git commit --allow-empty` ### reporting incorrect output > [!NOTE] -> this section is independent from the rest of the contributing section. +> this section is independent of the rest of the contributing section. different output from the iOS Shortcuts app is expected, however incorrect output is not. @@ -189,13 +189,13 @@ and do the following: function, which by default is OpenStreetMap Nominatim. (_don't know what the above means? then you are using the default reverser._) - also look at the [what counts as "incorrect"](#what-counts-as-incorrect) section + also look at the ['what counts as "incorrect"'](#what-counts-as-incorrect) section before moving on. 2. include the erroneous query. (_the Plus Code/local code/latlong coord/query string you passed into surplus_) -3. include output from the teminal with the +3. include output from the terminal with the [`--debug` flag](#command-line-usage) passed to the surplus CLI or with `debug=True` set in function calls. @@ -242,8 +242,9 @@ other examples that _should not_ be reported are: - name of place is incorrect/different - this may be due to incorrect data from the geolocator function, which is OpenStreetMap Nominatim by default. - in the case of Nominatim, it means that the data on OpenStreetMap is incorrect. + this may be due to incorrect data from the geocoder function, which is OpenStreetMap + Nominatim by default. in the case of Nominatim, it means that the data on OpenStreetMap + is incorrect. (_if so, then consider updating OpenStreetMap to help not just you, but other surplus and OpenStreetMap users!_) @@ -778,7 +779,7 @@ methods #### `Latlong.__str__()` -method that returns a comma-and-space-seperated string of `self.latitude` and +method that returns a comma-and-space-separated string of `self.latitude` and `self.longitude` - signature @@ -1078,12 +1079,12 @@ pluscodes 2022.1.3 Compute Plus Codes (Open Location Codes). - [geopy](https://pypi.org/project/geopy/): Python Geocoding Toolbox - MIT License + MIT Licence - [geographiclib](https://pypi.org/project/geographiclib/): The geodesic routines from GeographicLib - MIT License + MIT Licence - [pluscodes](https://pypi.org/project/pluscodes/): Compute Plus Codes (Open Location Codes) From 14193a705ece5847e279376db8b28457f42b5f87 Mon Sep 17 00:00:00 2001 From: Mark Joshwel <89562141+markjoshwel@users.noreply.github.com> Date: Tue, 5 Sep 2023 05:05:30 +0000 Subject: [PATCH 3/3] s+: fix debug statements going to stdout --- surplus/surplus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/surplus/surplus.py b/surplus/surplus.py index b1e8606..156cc74 100644 --- a/surplus/surplus.py +++ b/surplus/surplus.py @@ -693,7 +693,7 @@ def parse_query(behaviour: Behaviour) -> Result[Query]: split_query = behaviour.query if behaviour.debug: - print(f"debug: {split_query=}\ndebug: {original_query=}", behaviour.stderr) + print(f"debug: {split_query=}\ndebug: {original_query=}", file=behaviour.stderr) # not a plus/local code, try to match for latlong or string query match split_query: @@ -1102,7 +1102,7 @@ def cli() -> int: query = parse_query(behaviour=behaviour) if behaviour.debug: - print(f"debug: cli: {query=}") + print(f"debug: cli: {query=}", file=behaviour.stderr) if not query: print(f"error: {query.cry(string=not behaviour.debug)}", file=behaviour.stderr)