dronefly-core 0.3.8__tar.gz → 0.3.9.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/PKG-INFO +2 -2
  2. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/commands/__init__.py +16 -13
  3. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/pyproject.toml +2 -2
  4. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/LICENSE +0 -0
  5. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/README.md +0 -0
  6. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/__init__.py +0 -0
  7. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/clients/__init__.py +0 -0
  8. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/clients/inat.py +0 -0
  9. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/constants.py +0 -0
  10. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/formatters/__init__.py +0 -0
  11. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/formatters/constants.py +0 -0
  12. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/formatters/generic.py +0 -0
  13. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/models/__init__.py +0 -0
  14. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/models/controlled_terms.py +0 -0
  15. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/models/user.py +0 -0
  16. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/parsers/__init__.py +0 -0
  17. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/parsers/constants.py +0 -0
  18. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/parsers/natural.py +0 -0
  19. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/parsers/unixlike.py +0 -0
  20. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/parsers/url.py +0 -0
  21. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/query/__init__.py +0 -0
  22. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/query/query.py +0 -0
  23. {dronefly_core-0.3.8 → dronefly_core-0.3.9.dev0}/dronefly/core/utils/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dronefly-core
3
- Version: 0.3.8
3
+ Version: 0.3.9.dev0
4
4
  Summary: Core dronefly components
5
5
  License: AGPL-3.0-or-later
6
6
  Author: Ben Armstrong
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: dateparser (>=1.1.1,<2.0.0)
16
16
  Requires-Dist: html2markdown (>=0.1.7,<0.2.0)
17
17
  Requires-Dist: inflect (>=5.3.0,<6.0.0)
18
- Requires-Dist: pyinaturalist (>=0.19.0,<0.20)
18
+ Requires-Dist: pyinaturalist (==0.20.0.dev0)
19
19
  Requires-Dist: rich (>=13.4)
20
20
  Description-Content-Type: text/markdown
21
21
 
@@ -148,22 +148,28 @@ class Commands:
148
148
  # Handle a useful subset of query args in a simplistic way for now
149
149
  # (i.e. no config table lookup yet) to model full query in bot
150
150
  if query.user == "me":
151
- query_args["user"] = client.users.from_ids(
152
- ctx.author.inat_user_id, limit=1
153
- ).one()
151
+ if ctx.author.inat_user_id:
152
+ query_args["user"] = client.users.from_ids(
153
+ ctx.author.inat_user_id
154
+ ).one()
155
+ else:
156
+ return "Your iNat user is not known"
157
+ elif query.user == "any":
158
+ # i.e. override default "by me" when no arguments are given
159
+ pass
154
160
  else:
155
- users = client.users.autocomplete(q=query.user, limit=1)
156
- if users:
157
- query_args["user"] = users[0]
161
+ user = client.users.autocomplete(q=query.user).one()
162
+ if user:
163
+ query_args["user"] = user
158
164
  if query and query.main and query.main.terms:
159
165
  main_query_str = " ".join(query.main.terms)
160
- taxon = client.taxa.autocomplete(q=main_query_str, limit=1).one()
166
+ taxon = client.taxa.autocomplete(q=main_query_str).one()
161
167
  query_args["taxon"] = taxon
162
168
  if query.place:
163
- place = client.places.autocomplete(q=query.place, limit=1).one()
169
+ place = client.places.autocomplete(q=query.place).one()
164
170
  query_args["place"] = place
165
171
  if query.project:
166
- project = client.projects.search(q=query.project, limit=1).one()
172
+ project = client.projects.search(q=query.project).one()
167
173
  query_args["project"] = project
168
174
  query_response = QueryResponse(**query_args)
169
175
  obs_args = query_response.obs_args()
@@ -274,7 +280,6 @@ class Commands:
274
280
  obs = client.observations.search(
275
281
  user_id=ctx.author.inat_user_id,
276
282
  taxon_id=taxon.id,
277
- limit=1,
278
283
  reverse=True,
279
284
  ).one()
280
285
  if not obs:
@@ -282,9 +287,7 @@ class Commands:
282
287
 
283
288
  taxon_summary = client.observations.taxon_summary(obs.id)
284
289
  if obs.community_taxon_id and obs.community_taxon_id != obs.taxon.id:
285
- community_taxon = client.taxa.from_ids(
286
- obs.community_taxon_id, limit=1
287
- ).one()
290
+ community_taxon = client.taxa.from_ids(obs.community_taxon_id).one()
288
291
  community_taxon_summary = client.observations.taxon_summary(
289
292
  obs.id, community=1
290
293
  )
@@ -6,7 +6,7 @@ max-line-length = 100
6
6
 
7
7
  [tool.poetry]
8
8
  name = "dronefly-core"
9
- version = "0.3.8"
9
+ version = "0.3.9.dev0"
10
10
  description = "Core dronefly components"
11
11
  authors = ["Ben Armstrong <synrg@debian.org>"]
12
12
  license = "AGPL-3.0-or-later"
@@ -17,7 +17,7 @@ packages = [
17
17
 
18
18
  [tool.poetry.dependencies]
19
19
  python = ">=3.8.1,<3.13"
20
- pyinaturalist = ">=0.19.0,<0.20"
20
+ pyinaturalist = "=0.20.0.dev0"
21
21
  dateparser = "^1.1.1"
22
22
  inflect = "^5.3.0"
23
23
  html2markdown = "^0.1.7"