atomicshop 1.7.2__py3-none-any.whl → 1.7.4__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.

Potentially problematic release.


This version of atomicshop might be problematic. Click here for more details.

atomicshop/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  """Atomic Basic functions and classes to make developer life easier"""
2
2
 
3
3
  __author__ = "Den Kras"
4
- __version__ = '1.7.2'
4
+ __version__ = '1.7.4'
@@ -56,8 +56,9 @@ class AppointmentManager:
56
56
  print_api("Assuming you don't need this functionality", color='yellow')
57
57
  pass
58
58
 
59
- def find_earliest_date(self, date_list: list):
59
+ def find_earliest_date(self, date_list: list, **kwargs):
60
60
  date_list.sort()
61
+ print_api(f"Dates to check: {date_list}", **kwargs)
61
62
  for single_date in date_list:
62
63
  # Check if current date iteration is not blacklisted and between earliest and latest dates.
63
64
  if single_date not in self.blacklist_dates and \
@@ -25,7 +25,8 @@ def get_difference(list1, list2):
25
25
  return [x for x in list1 if x not in s]
26
26
 
27
27
 
28
- def replace_elements_with_values_from_dict(list_instance: list, dictionary: dict) -> list:
28
+ def replace_elements_with_values_from_dict(
29
+ list_instance: list, dictionary: dict, contains: bool = False, case_insensitive: bool = False) -> list:
29
30
  """
30
31
  Function exchanges elements from list with elements from dictionary.
31
32
 
@@ -38,7 +39,32 @@ def replace_elements_with_values_from_dict(list_instance: list, dictionary: dict
38
39
 
39
40
  :param list_instance: list.
40
41
  :param dictionary: dictionary.
42
+ :param contains: boolean, if 'True' will try to replace words that are a part of another word.
43
+ Example:
44
+ list_instance = ['Hello', 'my', 'name', 'is', 'names987', 'and', 'I', 'am', 'agesbla', 'years', 'old']
45
+ dictionary = {'name': 'John', 'age': '30'}
46
+ replace_words_with_values_from_dict(sentence, dictionary, contains=True)
47
+ Result:
48
+ ['Hello', 'my', 'name', 'is', 'Johns987', 'and', 'I', 'am', '30sbla', 'years', 'old']
49
+ With 'contains=False' the result would unchanged:
50
+ ['Hello', 'my', 'name', 'is', 'names987', 'and', 'I', 'am', 'agesbla', 'years', 'old']
51
+ :param case_insensitive: boolean, if 'True' will treat words in the list as case-insensitive. Default is 'False'.
41
52
  :return: list.
42
53
  """
43
54
 
44
- return [dictionary.get(x, x) for x in list_instance]
55
+ converted_list: list = list()
56
+ for word in list_instance:
57
+ if case_insensitive:
58
+ word = word.lower()
59
+
60
+ word = dictionary.get(word, word)
61
+
62
+ if contains:
63
+ # convert if the word contains key of the dictionary.
64
+ for key in dictionary.keys():
65
+ if key in word:
66
+ word = word.replace(key, dictionary[key])
67
+
68
+ converted_list.append(word)
69
+
70
+ return converted_list
@@ -210,7 +210,16 @@ def contains_letter(string: str) -> bool:
210
210
  return string.upper().isupper()
211
211
 
212
212
 
213
- def replace_words_with_values_from_dict(sentence: str, dictionary: dict, contains: bool = False):
213
+ def is_alphanumeric_only(string: str) -> bool:
214
+ """
215
+ Function to check if string contains only alphanumeric characters.
216
+ """
217
+
218
+ return string.isalnum()
219
+
220
+
221
+ def replace_words_with_values_from_dict(
222
+ sentence: str, dictionary: dict, contains: bool = False, case_insensitive: bool = False) -> str:
214
223
  """
215
224
  Function replaces words, which are keys with values from dictionary.
216
225
 
@@ -232,6 +241,8 @@ def replace_words_with_values_from_dict(sentence: str, dictionary: dict, contain
232
241
  'Hello, my name is Johns987, and I am 30sbla years old.'
233
242
  With 'contains=False' the result would unchanged:
234
243
  'Hello, my name is names987, and I am agesbla years old.'
244
+ :param case_insensitive: boolean, if 'True' will treat words in the 'sentence' as case-insensitive.
245
+ Default is 'False'.
235
246
  :return: string, with replaced words.
236
247
  """
237
248
 
@@ -239,12 +250,8 @@ def replace_words_with_values_from_dict(sentence: str, dictionary: dict, contain
239
250
  sentence_parts: list = sentence.split(" ")
240
251
 
241
252
  # Replace exact words with values from dictionary.
242
- sentence_parts = lists.replace_elements_with_values_from_dict(sentence_parts, dictionary)
253
+ sentence_parts = lists.replace_elements_with_values_from_dict(
254
+ sentence_parts, dictionary, contains=contains, case_insensitive=case_insensitive)
243
255
  joined_sentence: str = ' '.join(sentence_parts)
244
256
 
245
- if contains:
246
- # After we tried the exact matches for each word, there can be cases where the word is a part of another word.
247
- for key, value in dictionary.items():
248
- joined_sentence = joined_sentence.replace(key, value)
249
-
250
257
  return joined_sentence
@@ -23,14 +23,19 @@ STRINGS_MISTAKES_TO_NUMBERS: dict = {
23
23
  'for': '4',
24
24
  'hate': '8',
25
25
  'sex': '6',
26
- 'sexy': '6'
26
+ 'sexy': '6',
27
+ 'thor': '4'
27
28
  }
28
29
 
29
30
 
30
31
  STRINGS_MISTAKES_TO_CHARACTERS: dict = {
31
32
  'and': 'n',
33
+ 'ask': 's',
32
34
  'ass': 's',
35
+ 'are': 'r',
36
+ 'be': 'b',
33
37
  'in': 'n',
38
+ 'jay': 'j',
34
39
  'see': 'c',
35
40
  'why': 'y',
36
41
  'you': 'u'
@@ -49,11 +54,11 @@ def change_words_to_characters_and_numbers(sentence: str):
49
54
  """
50
55
 
51
56
  # Change words to numbers.
52
- sentence = strings.replace_words_with_values_from_dict(sentence, STRINGS_TO_NUMBERS, True)
57
+ sentence = strings.replace_words_with_values_from_dict(sentence, STRINGS_TO_NUMBERS, True, True)
53
58
  # Change words with mistakes to numbers.
54
- sentence = strings.replace_words_with_values_from_dict(sentence, STRINGS_MISTAKES_TO_NUMBERS, True)
59
+ sentence = strings.replace_words_with_values_from_dict(sentence, STRINGS_MISTAKES_TO_NUMBERS, True, True)
55
60
  # Change words with mistakes to characters.
56
- sentence = strings.replace_words_with_values_from_dict(sentence, STRINGS_MISTAKES_TO_CHARACTERS, True)
61
+ sentence = strings.replace_words_with_values_from_dict(sentence, STRINGS_MISTAKES_TO_CHARACTERS, True, True)
57
62
 
58
63
  return sentence
59
64
 
@@ -229,13 +229,6 @@ class PlaywrightEngine:
229
229
  # Click the submit button.
230
230
  self.page.locator("#sign-in-form").get_by_role("button", name=submit_button_text).click()
231
231
 
232
- def wait_and_reload_page_in_exception(self, exception, time_to_sleep_minutes: int):
233
- print_api(exception, error_type=True, color="red")
234
- message = f'Could be the site is down, will retry in {time_to_sleep_minutes} minutes'
235
- print_api(message, error_type=True, color="red")
236
- time.sleep(time_to_sleep_minutes * 60)
237
- combos.page_refresh___wait_maximum_idle(self.page)
238
-
239
232
  def check_for_element_change(self, locator_string: str):
240
233
  """
241
234
  Function gets the locator string input, read text from all the locators that contain this object.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 1.7.2
3
+ Version: 1.7.4
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
- atomicshop/__init__.py,sha256=FmlkeDKgaA-7LutaIS4Nu2uX8GQhx6T9avryAy2GVq8,122
1
+ atomicshop/__init__.py,sha256=nFrjYMK6DtrJ8RYXEH9shJCJZx04CoAhJBCakoA0M_s,122
2
2
  atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
3
- atomicshop/appointment_management.py,sha256=PlE6r315_w-b2nK3CVFdincHnPDNbSEggA_bvpQQyYU,7215
3
+ atomicshop/appointment_management.py,sha256=xtZABiomtc0YZfuooy6Lm-wioFgJ6QepO1ZvwQHWutg,7286
4
4
  atomicshop/archiver.py,sha256=KKdNI150yiMO_Y1TZdKjXtw4TP5LI5FJzI8VbvFKVwo,4763
5
5
  atomicshop/command_line_processing.py,sha256=u5yT9Ger_cu7ni5ID0VFlRbVD46ARHeNC9tRM-_YXrQ,1038
6
6
  atomicshop/console_output.py,sha256=G-6jxnWooT1nJSaPxcCqIuw8S22R_0lOJcfrdovRhwE,1372
@@ -26,7 +26,7 @@ atomicshop/question_answer_engine.py,sha256=DuOn7QEgKKfqZu2cR8mVeFIfFgayfBHiW-jY
26
26
  atomicshop/scheduling.py,sha256=mej1eQZkrrk7W4CWTjl5GEB6evqoYDfUMfc9fGbIH_k,2446
27
27
  atomicshop/script_as_string_processor.py,sha256=KJ5k_c0nccTyMXwbWIsovE7zWBFZD7QgD9GtdhMnmuo,1643
28
28
  atomicshop/sound.py,sha256=KSzWRF8dkpEVXmFidIv-Eftc3kET-hQzQOxZRE7rMto,24297
29
- atomicshop/speech_recognize.py,sha256=E1MEhtor64U4TlKfBbPPE9obPlgur65qsmz5k-nOrXI,5203
29
+ atomicshop/speech_recognize.py,sha256=uVzyad9ciUcv1wBjjsd4isdhWSVpqe20MT6WWVrykMk,5306
30
30
  atomicshop/ssh_remote.py,sha256=ZC8T_gLjNF-dBTl3BzDqcwJYiT92Ev23UF0qzT0t2sU,16590
31
31
  atomicshop/sys_functions.py,sha256=MTBxRve5bh58SPvhX3gMiGqHlSBuI_rdNN1NnnBBWqI,906
32
32
  atomicshop/tempfiles.py,sha256=uq1ve2WlWehZ3NOTXJnpBBMt6HyCdBufqedF0HyzA6k,2517
@@ -51,10 +51,10 @@ atomicshop/basics/guids.py,sha256=iRx5n18ATZWhpo748BwEjuLWLsu9y3OwF5-Adp-Dtik,40
51
51
  atomicshop/basics/hexs.py,sha256=XbawqHIgZeGvG94vFW95iCr6RE3HtBbfrdcEyX1lSoM,1083
52
52
  atomicshop/basics/isinstancing.py,sha256=X7Y55bWzCk9LCMKpc2diSf0T8x7OkgHfmh4U9RopruQ,907
53
53
  atomicshop/basics/list_of_dicts.py,sha256=fu0H6dUD9uUo2kl7FYIrWzOQMwCmg7qRxGnFM5S319E,5716
54
- atomicshop/basics/lists.py,sha256=F_umrqsjAj1LatEasK34dzuaFTzN9pp5GGVct5FqJYs,1294
54
+ atomicshop/basics/lists.py,sha256=ZyTjHyvkta-4_xCG1P-LFMENELmgAYlDdPq4hMRAOR8,2545
55
55
  atomicshop/basics/numbers.py,sha256=FRjAH1Thk3z3ayxq0Ik6Wh93ELDRk1geyDYTv8amZBE,165
56
56
  atomicshop/basics/randoms.py,sha256=DmYLtnIhDK29tAQrGP1Nt-A-v8WC7WIEB8Edi-nk3N4,282
57
- atomicshop/basics/strings.py,sha256=qHZtuiz_y2q7fo86qHS7OYbD4NIO5NOLxozh16oq45U,9410
57
+ atomicshop/basics/strings.py,sha256=hT7j_ADInQ6iNgrNOTm7x3U8CmfZiqRTIj5xBKGObqE,9576
58
58
  atomicshop/basics/threads.py,sha256=Md2tDERnaf1kqB-ZTbr9qMTpS0s8uOrLwqQd5fo2H8E,881
59
59
  atomicshop/basics/timeit_template.py,sha256=fYLrk-X_dhdVtnPU22tarrhhvlggeW6FdKCXM8zkX68,405
60
60
  atomicshop/basics/tracebacks.py,sha256=cNfh_oAwF55kSIdqtv3boHZQIoQI8TajxkTnwJwpweI,535
@@ -118,12 +118,12 @@ atomicshop/wrappers/playwrightw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
118
118
  atomicshop/wrappers/playwrightw/_tryouts.py,sha256=l1BLkFsiIMNlgv7nfZd1XGEvXQkIQkIcg48__9OaC00,4920
119
119
  atomicshop/wrappers/playwrightw/base.py,sha256=LNDT82yK_CbTQe8_-irHoKqD27z9W4HYME9FFiB44ow,2356
120
120
  atomicshop/wrappers/playwrightw/combos.py,sha256=K6IInobWWFwOgEObZNvY1eBes5CoL_FI2u48zwHhzNA,4592
121
- atomicshop/wrappers/playwrightw/engine.py,sha256=rF3FJeI64fh60-o1pDAaFqUXFqZOkI14ljf0rws26VA,15786
121
+ atomicshop/wrappers/playwrightw/engine.py,sha256=dej3cQLmKvumqEZ8P6E0PxqzJtHdnGI6SQpB28ldBzY,15374
122
122
  atomicshop/wrappers/playwrightw/locators.py,sha256=6wsLywZxDuii7mwv-zQsRbqQC8r7j96Bma5b5_7ZoVo,2411
123
123
  atomicshop/wrappers/playwrightw/waits.py,sha256=0xQfc2XL_fwSccOpW_gm9nNcahOWbCyAOOxwCHZFWJg,6698
124
124
  atomicshop/wrappers/pywin32w/wmi_win32process.py,sha256=4LPBDgBnkGPxmqbeQNDqVNQXKQ_z-VJU3QUVz74128U,6824
125
- atomicshop-1.7.2.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
126
- atomicshop-1.7.2.dist-info/METADATA,sha256=yiDEy2zU_NP4oDGz2c4GEXCdhKuBAHoAzTKIgjGbEL0,9083
127
- atomicshop-1.7.2.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
128
- atomicshop-1.7.2.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
129
- atomicshop-1.7.2.dist-info/RECORD,,
125
+ atomicshop-1.7.4.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
126
+ atomicshop-1.7.4.dist-info/METADATA,sha256=LIyx6_8DVdiVCx7Wxqyu2IfuiqekFuAwVL9a9tzefpI,9083
127
+ atomicshop-1.7.4.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
128
+ atomicshop-1.7.4.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
129
+ atomicshop-1.7.4.dist-info/RECORD,,