goodmap 0.4.1__py3-none-any.whl → 0.4.3__py3-none-any.whl

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.
goodmap/core_api.py CHANGED
@@ -46,10 +46,10 @@ def core_pages(
46
46
  """Suggest new location"""
47
47
  try:
48
48
  suggested_location = request.get_json()
49
- suggested_location.update({"UUID": str(uuid.uuid4())})
49
+ suggested_location.update({"uuid": str(uuid.uuid4())})
50
50
  location = location_model.model_validate(suggested_location)
51
51
  message = (
52
- f"A new location has been suggested under UUID: '{location.UUID}' "
52
+ f"A new location has been suggested under uuid: '{location.uuid}' "
53
53
  f"at position: {location.position}"
54
54
  )
55
55
  notifier_function(message)
@@ -72,8 +72,9 @@ def core_pages(
72
72
  )
73
73
  notifier_function(message)
74
74
  except Exception as e:
75
- return make_response(jsonify({"message": f"Error sending notification : {e}"}), 400)
76
- return make_response(jsonify({"message": "Location reported"}), 200)
75
+ error_message = gettext("Error sending notification")
76
+ return make_response(jsonify({"message": f"{error_message} : {e}"}), 400)
77
+ return make_response(jsonify({"message": gettext("Location reported")}), 200)
77
78
 
78
79
  @core_api.route("/data")
79
80
  class Data(Resource):
@@ -102,7 +103,7 @@ def core_pages(
102
103
  class GetLocations(Resource):
103
104
  def get(self):
104
105
  """
105
- Shows list of locations with UUID and position
106
+ Shows list of locations with uuid and position
106
107
  """
107
108
  query_params = request.args.to_dict(flat=False)
108
109
  all_locations = database.get_locations(query_params)
@@ -5,7 +5,7 @@ from pydantic import BaseModel, Field, create_model, field_validator
5
5
 
6
6
  class LocationBase(BaseModel, extra="allow"):
7
7
  position: tuple[float, float]
8
- UUID: str
8
+ uuid: str
9
9
 
10
10
  @field_validator("position")
11
11
  @classmethod
@@ -17,7 +17,7 @@ class LocationBase(BaseModel, extra="allow"):
17
17
  return v
18
18
 
19
19
  def basic_info(self):
20
- return {"UUID": self.UUID, "position": self.position}
20
+ return {"uuid": self.uuid, "position": self.position}
21
21
 
22
22
 
23
23
  def create_location_model(obligatory_fields: list[tuple[str, Type[Any]]]) -> Type[BaseModel]:
goodmap/db.py CHANGED
@@ -51,25 +51,25 @@ def get_data(db):
51
51
  # get_location
52
52
 
53
53
 
54
- def get_location_from_raw_data(raw_data, UUID, location_model):
55
- point = next((point for point in raw_data["data"] if point["UUID"] == UUID), None)
54
+ def get_location_from_raw_data(raw_data, uuid, location_model):
55
+ point = next((point for point in raw_data["data"] if point["uuid"] == uuid), None)
56
56
  return location_model.model_validate(point) if point else None
57
57
 
58
58
 
59
- def google_json_db_get_location(self, UUID, location_model):
59
+ def google_json_db_get_location(self, uuid, location_model):
60
60
  return get_location_from_raw_data(
61
- json.loads(self.blob.download_as_text(client=None))["map"], UUID, location_model
61
+ json.loads(self.blob.download_as_text(client=None))["map"], uuid, location_model
62
62
  )
63
63
 
64
64
 
65
- def json_file_db_get_location(self, UUID, location_model):
65
+ def json_file_db_get_location(self, uuid, location_model):
66
66
  with open(self.data_file_path, "r") as file:
67
- point = get_location_from_raw_data(json.load(file)["map"], UUID, location_model)
67
+ point = get_location_from_raw_data(json.load(file)["map"], uuid, location_model)
68
68
  return point
69
69
 
70
70
 
71
- def json_db_get_location(self, UUID, location_model):
72
- return get_location_from_raw_data(self.data, UUID, location_model)
71
+ def json_db_get_location(self, uuid, location_model):
72
+ return get_location_from_raw_data(self.data, uuid, location_model)
73
73
 
74
74
 
75
75
  def get_location(db, location_model):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: goodmap
3
- Version: 0.4.1
3
+ Version: 0.4.3
4
4
  Summary: Map engine to serve all the people :)
5
5
  Author: Krzysztof Kolodzinski
6
6
  Author-email: krzysztof.kolodzinski@problematy.pl
@@ -110,7 +110,7 @@ TODO: `obligatory_fields` is a new subsection, start using it in the actual appl
110
110
  ```
111
111
  - `meta-data` - some special data like
112
112
  ```
113
- "UUID"
113
+ "uuid"
114
114
  ```
115
115
 
116
116
  You can define the fields in all these subsections. Besides these types of fields, there is no restriction on the number of fields a datapoint can have.
@@ -1,14 +1,14 @@
1
1
  goodmap/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
2
  goodmap/core.py,sha256=hOTHrDRzbqkfSeKAoD01lzSoY4W8JwupXlJTwTzcvAU,586
3
- goodmap/core_api.py,sha256=taWgRhAFa2A_lnpHeVwczghs326cB3fLLMwghhvuZkI,6476
4
- goodmap/data_models/location.py,sha256=6JMEiPMLCNC445kl7k-PXYiOer1wbNgobXRS4dcOoCA,1054
3
+ goodmap/core_api.py,sha256=wy861bym-OtJV_y65TNJNr_hxUW45bUK0j2Vt96HG1s,6544
4
+ goodmap/data_models/location.py,sha256=ESR4Z_zINIjldJKhlXImMaQrdtUPJBQc6SatpPPJyNQ,1054
5
5
  goodmap/data_validator.py,sha256=e_PCc2CTgiEBK6inF_HDX5mb5R8poh3KkcbhyrLrFVA,4086
6
- goodmap/db.py,sha256=LIecsT6lpg2cKBYxyLbq4WSZ9wXBLaFvmyN4NsJpDk8,3665
6
+ goodmap/db.py,sha256=AJHUP3n29BRjgt6GoGnPtxLNg5TL-KSJhtSZtsZKmGM,3665
7
7
  goodmap/formatter.py,sha256=VlUHcK1HtM_IEU0VE3S5TOkZLVheMdakvUeW2tCKdq0,783
8
8
  goodmap/goodmap.py,sha256=cPTTyGqajuza3RDlfFuCl8idxy7TFo6LPuANP8hmg7U,1806
9
9
  goodmap/templates/admin.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  goodmap/templates/map.html,sha256=eU_h61l404g8e3_wszUokDrOC92bQ1nFl8yGMKRXFww,3820
11
- goodmap-0.4.1.dist-info/LICENSE.md,sha256=nkCQOR7uheLRvHRfXmwx9LhBnMcPeBU9d4ebLojDiQU,1067
12
- goodmap-0.4.1.dist-info/METADATA,sha256=c8DsZbEA0or2Le5Y2TL4J0SzLc5rBOJYeS-zWeczCfo,4525
13
- goodmap-0.4.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
14
- goodmap-0.4.1.dist-info/RECORD,,
11
+ goodmap-0.4.3.dist-info/LICENSE.md,sha256=nkCQOR7uheLRvHRfXmwx9LhBnMcPeBU9d4ebLojDiQU,1067
12
+ goodmap-0.4.3.dist-info/METADATA,sha256=nvPI8Jtcm5s-KrGCABgU5OKgYEui4gjC5B-MKgg26tU,4525
13
+ goodmap-0.4.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
14
+ goodmap-0.4.3.dist-info/RECORD,,