queue-local 0.0.63__tar.gz → 0.0.64.post2466__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.
@@ -1,15 +1,21 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: queue-local
3
- Version: 0.0.63
3
+ Version: 0.0.64.post2466
4
4
  Home-page: https://github.com/circles-zone/queue-local-python-package
5
5
  Author: Circles
6
6
  Author-email: info@circles.life
7
7
  Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: Other/Proprietary License
9
8
  Classifier: Operating System :: OS Independent
10
9
  Description-Content-Type: text/markdown
11
10
  Requires-Dist: database-mysql-local>=0.0.292
12
11
  Requires-Dist: logger-local>=0.0.135
13
12
  Requires-Dist: user-context-remote>=0.0.30
13
+ Dynamic: author
14
+ Dynamic: author-email
15
+ Dynamic: classifier
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: home-page
19
+ Dynamic: requires-dist
14
20
 
15
21
  queue-local
@@ -38,7 +38,7 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
38
38
  created_user_id, updated_user_id
39
39
  updated_timestamp, start_timestamp, end_timestamp
40
40
 
41
- ALTER TABLE `invitation`.`invitation_table`
41
+ ALTER TABLE `invitation`.`invitation_table`
42
42
  ADD COLUMN `queue_status_id` SMALLINT UNSIGNED NULL AFTER `updated_effective_profile_id`,
43
43
  ADD COLUMN `action_id` SMALLINT UNSIGNED NULL AFTER `queue_status_id`,
44
44
  ADD COLUMN `process_id` MEDIUMINT UNSIGNED NULL AFTER `action_id`,
@@ -66,7 +66,7 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
66
66
  self.user_context = UserContext()
67
67
 
68
68
  def push(self, queue_data_dict: dict = None, queue_dict: dict = None) -> int:
69
- queue_dict=queue_dict or queue_data_dict
69
+ queue_dict = queue_dict or queue_data_dict
70
70
  """Pushes a new entry to the queue and returns the new queue id.
71
71
  queue_dict consists of columns and values to insert into the queue table."""
72
72
  created_user_id = UserContext().get_effective_user_id()
@@ -74,7 +74,7 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
74
74
  self._fix_parameters_json(queue_dict)
75
75
 
76
76
  queue_dict["queue_status_id"] = QueueStatusEnum.NEW.value
77
-
77
+
78
78
  queue_dict["created_user_id"] = created_user_id
79
79
 
80
80
  if self.queue_item_id_column_name in queue_dict:
@@ -87,14 +87,14 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
87
87
  return queue_id
88
88
  # TODO Can we do this everywhere? [I will make it auto in the meta logger]
89
89
 
90
-
91
90
  def push_back(self, queue_item: dict = None, queue_dict: dict = None) -> None:
92
91
  """Push a taken queue item back to the queue."""
93
- queue_dict = queue_item or queue_dict
92
+ queue_dict = queue_item or queue_dict
94
93
  queue_dict = {"queue_status_id": QueueStatusEnum.NEW.value, "process_id": None}
95
94
  self.update_by_column_and_value(column_value=queue_item[self.queue_item_id_column_name], data_dict=queue_dict)
96
95
 
97
- def get(self, *, action_ids: tuple = (), custom_condition: str = "", data_dict: dict = None, queue_dict: dict = None) -> dict:
96
+ def get(self, *, action_ids: tuple = (), custom_condition: str = "",
97
+ data_dict: dict = None, queue_dict: dict = None) -> dict:
98
98
  """
99
99
  Returns the first item from the queue (possibly considering specific actions) and marks it as taken.
100
100
 
@@ -102,7 +102,7 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
102
102
  :param custom_condition: Custom condition to add to the WHERE clause (optional).
103
103
  :return: Dictionary representing the retrieved queue item.
104
104
  """
105
- queue_dict=data_dict or queue_dict
105
+ queue_dict = data_dict or queue_dict
106
106
  action_ids = self._fix_action_ids(action_ids)
107
107
  queue_dict = {"process_id": os.getpid()}
108
108
  update_where = f"process_id IS NULL " \
@@ -112,13 +112,15 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
112
112
  (f"AND {custom_condition}" if custom_condition else "")
113
113
  self.update_by_where(where=update_where, order_by=self.queue_item_id_column_name, limit=1, data_dict=queue_dict)
114
114
 
115
- select_where = f"process_id = {os.getpid()} AND (queue_status_id IS NULL OR queue_status_id = {QueueStatusEnum.NEW.value})"
116
-
115
+ select_where = f"process_id = {os.getpid()} AND (queue_status_id IS NULL OR queue_status_id = {QueueStatusEnum.NEW.value})" # noqa: E501
116
+
117
117
  queue_item = self.select_one_dict_by_where(where=select_where)
118
118
  if queue_item:
119
119
  update_queue_dict = {"queue_status_id": QueueStatusEnum.RETRIEVED.value,
120
- "user_jwt": self.user_context.get_user_jwt()}
121
- self.update_by_column_and_value(column_value=queue_item[self.queue_item_id_column_name], data_dict=update_queue_dict)
120
+ "user_jwt": self.user_context.get_user_jwt()}
121
+ self.update_by_column_and_value(
122
+ column_value=queue_item[self.queue_item_id_column_name],
123
+ data_dict=update_queue_dict)
122
124
  self.logger.info("Entry retrieved and updated from the queue database successfully",
123
125
  object=queue_item)
124
126
  else:
@@ -148,13 +150,11 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
148
150
 
149
151
  @staticmethod
150
152
  def _fix_parameters_json(data_dict: dict = None):
151
- queue_dict=data_dict
152
- """Fixes the parameters_json argument to fit the SQL syntax (parameters_json must be a string)"""
153
+ queue_dict = data_dict
154
+ """Fixes the parameters_json argument to fit the SQL syntax (parameters_json must be a string)""" # noqa: E501
153
155
  for key, value in queue_dict.items():
154
156
  if "parameters_json" in key:
155
157
  if isinstance(value, str):
156
158
  queue_dict[key] = value.replace("'", '"')
157
159
  else:
158
160
  queue_dict[key] = json.dumps(value)
159
-
160
-
@@ -1,15 +1,21 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: queue-local
3
- Version: 0.0.63
3
+ Version: 0.0.64.post2466
4
4
  Home-page: https://github.com/circles-zone/queue-local-python-package
5
5
  Author: Circles
6
6
  Author-email: info@circles.life
7
7
  Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: Other/Proprietary License
9
8
  Classifier: Operating System :: OS Independent
10
9
  Description-Content-Type: text/markdown
11
10
  Requires-Dist: database-mysql-local>=0.0.292
12
11
  Requires-Dist: logger-local>=0.0.135
13
12
  Requires-Dist: user-context-remote>=0.0.30
13
+ Dynamic: author
14
+ Dynamic: author-email
15
+ Dynamic: classifier
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: home-page
19
+ Dynamic: requires-dist
14
20
 
15
21
  queue-local
@@ -1,11 +1,11 @@
1
- import setuptools
1
+ import setuptools
2
2
 
3
3
  PACKAGE_NAME = "queue-local"
4
4
  package_dir = PACKAGE_NAME.replace("-", "_")
5
5
 
6
6
  setuptools.setup(
7
7
  name=PACKAGE_NAME,
8
- version='0.0.63', # https://pypi.org/project/queue-local/
8
+ version='0.0.64-2466', # https://pypi.org/project/queue-local/
9
9
  author="Circles",
10
10
  author_email="info@circles.life",
11
11
  url=f"https://github.com/circles-zone/{PACKAGE_NAME}-python-package",
@@ -16,7 +16,6 @@ setuptools.setup(
16
16
  long_description_content_type='text/markdown',
17
17
  classifiers=[
18
18
  "Programming Language :: Python :: 3",
19
- "License :: Other/Proprietary License",
20
19
  "Operating System :: OS Independent",
21
20
  ],
22
21
  install_requires=["database-mysql-local>=0.0.292",