radboy 0.0.502__py3-none-any.whl → 0.0.504__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 radboy might be problematic. Click here for more details.

@@ -2,11 +2,13 @@ from . import *
2
2
 
3
3
 
4
4
  class CookBookUi:
5
- def list_uids_names(self):
5
+ def list_uids_names(self,assistMsg=''):
6
+ if assistMsg != '':
7
+ assistMsg+="\n"
6
8
  while True:
7
9
  try:
8
10
  with Session(ENGINE) as session:
9
- stext=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Name or UID?[b=skip]",helpText="b|back skips",data="string")
11
+ stext=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.orange_red_1}{assistMsg}{Fore.light_yellow}Name or UID?[b=skip]",helpText="b|back skips",data="string")
10
12
  if stext is None:
11
13
  return None,None
12
14
  if stext in ['d',]:
@@ -95,7 +97,8 @@ class CookBookUi:
95
97
  #edit everything found by searchtext using recipe_uid as the final selection parameter
96
98
  def create_new_rcp(self):
97
99
  with Session(ENGINE) as session:
98
- ruid,rname=self.list_uids_names()
100
+ assistMsg=f"search for existing recipe to add to..."
101
+ ruid,rname=self.list_uids_names(assistMsg=assistMsg)
99
102
  uid=uuid1()
100
103
  uid=str(uid)
101
104
  excludes=['cbid','DTOE','recipe_uid','Instructions','recipe_name']
@@ -1,5 +1,6 @@
1
1
  from . import *
2
2
 
3
+ from decimal import Decimal
3
4
 
4
5
  class OccurancesUi:
5
6
  first_time_excludes=['oid','created_dtoe',]
@@ -95,10 +96,22 @@ class OccurancesUi:
95
96
  return None,None
96
97
 
97
98
  def master_display(self,result,num,ct):
98
- hstring=std_colorize(f"{Fore.light_sea_green}[group name] '{result.group_name}' {Fore.dodger_blue_3}- [guuid] '{result.group_uid}' -{Fore.green_yellow} [oid] '{result.oid}' - {Fore.light_magenta}[name] '{result.name}' - {Fore.magenta}[type] '{result.type}' - {Fore.orange_red_1}[qty] '{result.quantity}' {Fore.light_steel_blue}'{result.unit_of_measure}'{Fore.light_salmon_1} - [uid]'{result.uid}'",num,ct)
99
+ hstring=std_colorize(f"{Fore.light_sea_green}[group name] '{result.group_name}' {Fore.dodger_blue_3}- [guuid] '{result.group_uid}' -{Fore.green_yellow} [oid] '{result.oid}' - {Fore.light_magenta}[name] '{result.name}' - {Fore.magenta}[type] '{result.type}' - {Fore.orange_red_1}[QUANTITY/QTY] '{result.quantity}' {Fore.light_steel_blue}'{result.unit_of_measure}'{Fore.light_salmon_1} - [uid]'{result.uid}' - {Fore.cyan}[created_dtoe] '{result.created_dtoe}' {Fore.red}[age] '{datetime.now()-result.created_dtoe}'",num,ct)
99
100
  print(hstring)
100
101
  return hstring
101
102
 
103
+ def setAllTo(self):
104
+ with Session(ENGINE) as session:
105
+ query=session.query(Occurances)
106
+ all_set=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What Value does everything get set to?",helpText="this applies to everythinging",data="float")
107
+ if all_set is None:
108
+ return
109
+ elif all_set in ['d',]:
110
+ all_set=0
111
+
112
+ query.update({'quantity':all_set})
113
+ session.commit()
114
+
102
115
  def lst_names(self):
103
116
  with Session(ENGINE) as session:
104
117
  hs=[]
@@ -141,10 +154,82 @@ class OccurancesUi:
141
154
  helpText='\n'.join(hs)
142
155
  return results,helpText
143
156
  return None,None
144
- def total_by(self):
145
- by=['group_name','group_uid','name','uid','type']
146
- #need to select for total
147
157
 
158
+ def total_by_only_quantity(self,normalize=False):
159
+ reg=pint.UnitRegistry()
160
+ with Session(ENGINE) as session:
161
+ by=['group_name','group_uid','name','uid','type']
162
+ htext=[]
163
+ ctby=len(by)
164
+ for num,i in enumerate(by):
165
+ htext.append(std_colorize(i,num,ctby))
166
+ htext='\n'.join(htext)
167
+ print(htext)
168
+ whiches=Prompt.__init2__(self,func=FormBuilderMkText,ptext="Which indexes to total by?",helpText=htext,data="list")
169
+ if whiches is None:
170
+ return
171
+ elif whiches in ['d',]:
172
+ whiches=[0,]
173
+ print("ss")
174
+ for i in whiches:
175
+ try:
176
+ which=int(i)
177
+ if which in range(0,len(by)+1):
178
+ fields={
179
+ by[which]:{'default':None,'type':'string'}
180
+ }
181
+ search=FormBuilder(data=fields)
182
+ if search is None:
183
+ continue
184
+ s=[]
185
+ for iii in search:
186
+
187
+ if search[iii] is not None:
188
+ s.append(
189
+ getattr(Occurances,iii).icontains(search[iii])
190
+ )
191
+ if not normalize:
192
+ total=Decimal('0.00000')
193
+ else:
194
+ total=None
195
+ column_name=by[which]
196
+
197
+ query=session.query(Occurances)
198
+ query=query.filter(or_(*s))
199
+
200
+
201
+ query=orderQuery(query,Occurances.created_dtoe,inverse=True)
202
+ results=query.all()
203
+ ct=len(results)
204
+ for num,result in enumerate(results):
205
+ try:
206
+ if not normalize:
207
+ msg=self.master_display(result,num,ct)
208
+ current_value=getattr(result,'quantity')
209
+ if current_value is None:
210
+ current_value=0
211
+ print(f"Occurance(name='{result.name}',uid='{result.uid}',oid={result.oid}{column_name}).Total = {total:.f5} + {current_value}")
212
+ total+=Decimal(current_value).quantize(total)
213
+ else:
214
+ msg=self.master_display(result,num,ct)
215
+ current_value=Decimal(getattr(result,'quantity')).quantize(Decimal('0.00000'))
216
+ unit_of_measure=getattr(result,'unit_of_measure')
217
+ if unit_of_measure not in reg:
218
+ reg.define(f"{unit_of_measure} = 1")
219
+
220
+ qty=reg.Quantity(current_value,unit_of_measure)
221
+
222
+ if total is None:
223
+ total=qty
224
+ else:
225
+ total+=qty
226
+ except Exception as eeee:
227
+ print(eeee)
228
+
229
+ print(f"{column_name}.Total = {total:.5f}")
230
+
231
+ except Exception as e:
232
+ print(e)
148
233
  def copy_to_new(self,prompted=True):
149
234
  local_excludes=['quantity','uid',]
150
235
  #search and copy old details to a new Occurance setting created_dtoe to today, and quantity to 0
@@ -186,7 +271,7 @@ class OccurancesUi:
186
271
  fd['quantity']=fd2['quantity']
187
272
  else:
188
273
  fd['quantity']=0
189
- fd['name']=f"{fd['name']} {dayString(datetime.now())}"
274
+ fd['name']=f"{fd['name']} {dayString(datetime.now())}"
190
275
  if fd:
191
276
  try:
192
277
  for k in fd:
@@ -247,7 +332,7 @@ class OccurancesUi:
247
332
  return
248
333
  cta=len(search)
249
334
  try:
250
- for which in whiches:
335
+ for num,which in enumerate(whiches):
251
336
  try:
252
337
  which=int(which)
253
338
  if which in range(0,cta+1):
@@ -255,7 +340,7 @@ class OccurancesUi:
255
340
  x=session.query(Occurances).filter(Occurances.oid==oid).first()
256
341
  includes=['quantity',]
257
342
  fields={i.name:{'default':getattr(x,i.name),'type':str(i.type).lower()} for i in Occurances.__table__.columns if i.name in includes}
258
- fd=FormBuilder(data=fields)
343
+ fd=FormBuilder(data=fields,passThruText=self.master_display(x,num,cta)+"\n")
259
344
  if fd:
260
345
  try:
261
346
  for k in fd:
@@ -429,6 +514,22 @@ class OccurancesUi:
429
514
  'desc':f"copy all details of Occurances to new Occurance except for quantity and uids prompting for user provided changes to old",
430
515
  'exec':lambda self=self:self.copy_to_new(prompted=False),
431
516
  },
517
+ uuid1():{
518
+ 'cmds':generate_cmds(startcmd=['ttl','total','count'],endCmd=['qty','qty only','quantity only']),
519
+ 'desc':f"count only quantity fields by column names without normalization",
520
+ 'exec':lambda self=self:self.total_by_only_quantity(),
521
+ },
522
+ uuid1():{
523
+ 'cmds':generate_cmds(startcmd=['ttl','total','count'],endCmd=['nmlz','normalized','normal']),
524
+ 'desc':f"count only quantity fields by column names with normalization",
525
+ 'exec':lambda self=self:self.total_by_only_quantity(normalize=True),
526
+ },
527
+ uuid1():{
528
+ 'cmds':generate_cmds(startcmd=['setto','clrto','st2'],endCmd=['all','*',]),
529
+ 'desc':f"set all Occurances to user provided value/in essence a clear/pre init",
530
+ 'exec':lambda self=self:self.setAllTo(),
531
+ },
532
+
432
533
  }
433
534
 
434
535
  htext=[]
radboy/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION='0.0.502'
1
+ VERSION='0.0.504'
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: radboy
3
- Version: 0.0.502
3
+ Version: 0.0.504
4
4
  Summary: A small example package
5
5
  Author: Carl Joseph Hirner III
6
6
  Author-email: Carl Hirner III <k.j.hirner.wisdom@gmail.com>
@@ -5,7 +5,7 @@ radboy/Holidays.txt,sha256=y-JZPihh5iaWKxMIHNXD39yVuVmf1vMs4FdNDcg0f1Y,3114
5
5
  radboy/InventoryGlossary.txt,sha256=018-Yqca6DFb10jPdkUY-5qhkRlQN1k3rxoTaERQ-LA,91008
6
6
  radboy/RecordMyCodes.py,sha256=Lt2reA6xchq3U7Y08DvkrHboZ25i1ts7X2E9gSIwcVg,41101
7
7
  radboy/Run.py,sha256=JUoCTHnzQBv7n8PB2_i93ANdAC_iW__RkAge8esCnk4,76
8
- radboy/__init__.py,sha256=Us27Bqzc2h2YT-8rjX2f1imPTMI9oyE6_sdTy5_ht9I,17
8
+ radboy/__init__.py,sha256=En83j1LmV-ODOIoOt8N5WddzsAAktm-RRP8CeSepkjM,17
9
9
  radboy/api_key,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  radboy/case-export-2024-05-14-13-10-00.672971.xlsx,sha256=Wd592d_VLFmfUI9KKKSVjNwjV91euc1T7ATyvwvUhlg,5431
11
11
  radboy/case-export-2024-05-14-13-13-22.540614.xlsx,sha256=OnGrhmScHfGp_mVaWW-LNMsqrQgyZDpiU3wV-2s3U5Q,5556
@@ -75,7 +75,7 @@ radboy/ConvertCode/__pycache__/__init__.cpython-311.pyc,sha256=1-K1vfRZxAs9MoOyy
75
75
  radboy/ConvertCode/__pycache__/__init__.cpython-312.pyc,sha256=77LSCMdrPg91lbsloPumUo1SpAt5A8l1WPgTxGIvwTs,274
76
76
  radboy/ConvertCode/__pycache__/__init__.cpython-313.pyc,sha256=4F9h0V0Z5sQHdZQGEsnfCSLMQK4lUD5CzJwU4Elv-EU,153
77
77
  radboy/ConvertCode/__pycache__/codep.cpython-311.pyc,sha256=-qJqPEjGOP1-x6Xw6W4Msfuu2iwVffN_-DerH18Is2o,1086
78
- radboy/CookBook/CookBook.py,sha256=gvbIcClMh78_6qDBYiZ0VkO_lnyirgjVTRNAglXyk6I,18224
78
+ radboy/CookBook/CookBook.py,sha256=udDoeFxrSBdCwhrsWRN3gKW23tVI6hl5pH8p2adc99A,18403
79
79
  radboy/CookBook/__init__.py,sha256=svTiqqFxHZeqYCRorLx6qLxL3oI1pil4fxomm-kkQ88,927
80
80
  radboy/DB/CoinCombo.py,sha256=NJfTmx3XYgS41zkAyyO2W6de1Mj3rWsCWqU4ikHfvJI,13604
81
81
  radboy/DB/DatePicker.py,sha256=6eNjmryFWPpzrRYmI418UwSGin3XpJlL52h8cauanbY,18004
@@ -198,7 +198,7 @@ radboy/FB/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
198
198
  radboy/FB/__pycache__/FBMTXT.cpython-312.pyc,sha256=XCVFa7Mo83LGIdRrTvcK73siUpcVIEQfXKCH2QHeViw,9626
199
199
  radboy/FB/__pycache__/FBMTXT.cpython-313.pyc,sha256=yGN_5nMHjf2Yy7s7nF0BSkJjapNVHwpRO4DlnnLFhuA,54686
200
200
  radboy/FB/__pycache__/FormBuilder.cpython-312.pyc,sha256=lNQdB-zApsXM7OQF9MIi0zRZD1SAL6stKEN-AyQiIKg,18873
201
- radboy/FB/__pycache__/FormBuilder.cpython-313.pyc,sha256=WOX7ndix3aTqTaF01w1x4X_b-DX15RAoBdH7_L5NPCc,19706
201
+ radboy/FB/__pycache__/FormBuilder.cpython-313.pyc,sha256=_fbgfAUT4-IebcxlfzTXFxpSzuxLGliNXMh5Skvilrw,19706
202
202
  radboy/FB/__pycache__/__init__.cpython-312.pyc,sha256=ULEL8Au_CxcYpNAcSoSbI65M7-av1W6Zuy6kQJUu-Mw,265
203
203
  radboy/FB/__pycache__/__init__.cpython-313.pyc,sha256=Mp4kqFJa86-gyUu1vr9rubcUHUDr-O75hevV5IQdSFw,144
204
204
  radboy/GDOWN/GDOWN.py,sha256=Z5q6TR92I4eQpxhsJpOwhH__f1tK2IcGctPRw8OAEr8,798
@@ -264,7 +264,7 @@ radboy/ModuleTemplate/Tasks.py,sha256=RF4sWnLH4FyzMU8AHOov7WP24-udd96-l9c9SvbIP_
264
264
  radboy/ModuleTemplate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
265
265
  radboy/ModuleTemplate/__pycache__/Tasks.cpython-311.pyc,sha256=rllpmYgt71yfhr2e08OB_iYnlcO5eIIGCQErAj6ikTA,1989
266
266
  radboy/ModuleTemplate/__pycache__/__init__.cpython-311.pyc,sha256=J6kTs2HBMSDNpjWxKLwzOfg70xEDLVtulYrYvCVF3Mw,239
267
- radboy/Occurances/Occurances.py,sha256=ll7QGbkZRmrSKBhJxUW1GaEB4c2spQejkeLSYVAMQ0I,14357
267
+ radboy/Occurances/Occurances.py,sha256=kiUn1w1DQ2s85ddF4rEq7bSwg-QyVEqsk_XCHFGWj3Y,17873
268
268
  radboy/Occurances/__init__.py,sha256=Xv528_TFNgaC7fr3ykgYG4qUxoz-_8dQMEAhDBAtdXw,930
269
269
  radboy/Of/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
270
270
  radboy/Of/of.py,sha256=l5YyMVe4rixyYeJZ6BKzkVEr7lk2SuMyPxm14LMwF9c,1341
@@ -398,7 +398,7 @@ radboy/__pycache__/Run.cpython-311.pyc,sha256=G_UEfMtkLRjR6ZpGA_BJzGenuaCcP469Y9
398
398
  radboy/__pycache__/Run.cpython-312.pyc,sha256=v4xolc3mHyla991XhpYBUbBHYT0bnJ1gE-lkFoQ4GFA,241
399
399
  radboy/__pycache__/__init__.cpython-311.pyc,sha256=R-DVbUioMOW-Fnaq7FpT5F1a5p0q3b_RW-HpLRArCAY,242
400
400
  radboy/__pycache__/__init__.cpython-312.pyc,sha256=FsFzLXOlTK8_7ixoPZzakkR8Wibt-DvXLFh-oG2QlPw,164
401
- radboy/__pycache__/__init__.cpython-313.pyc,sha256=6-d12VLxilYwsrI29rhnmzNU2ME2iS6onbVZS7eh_TI,165
401
+ radboy/__pycache__/__init__.cpython-313.pyc,sha256=g9uSbMmCFA3fM-UiOequ_5zQBG-7nNVoxp9dYrULbfE,165
402
402
  radboy/__pycache__/__init__.cpython-39.pyc,sha256=D48T6x6FUeKPfubo0sdS_ZUut3FmBvPMP7qT6rYBZzU,275
403
403
  radboy/__pycache__/possibleCode.cpython-311.pyc,sha256=zFiHyzqD8gUnIWu4vtyMYIBposiRQqaRXfcT_fOl4rU,20882
404
404
  radboy/__pycache__/possibleCode.cpython-312.pyc,sha256=tk_CO-AcsO3YZj5j6vEsw3g37UmEzWc5YgeWEoJEUg4,27922
@@ -423,7 +423,7 @@ radboy/tkGui/Images/__pycache__/__init__.cpython-311.pyc,sha256=tXBYpqbOlZ24B1BI
423
423
  radboy/tkGui/__pycache__/BeginnersLuck.cpython-311.pyc,sha256=xLQOnV1wuqHGaub16mPX0dDMGU9ryCeLtNz5e517_GE,3004
424
424
  radboy/tkGui/__pycache__/Review.cpython-311.pyc,sha256=wKq24iM6Xe2OampgZ7-8U6Nvmgs2y-qWOrGwtWhc75k,4047
425
425
  radboy/tkGui/__pycache__/__init__.cpython-311.pyc,sha256=BX7DBn5qbvKTvlrKOP5gzTBPBTeTgSMjBW6EMl7N8e0,230
426
- radboy-0.0.502.dist-info/METADATA,sha256=v8Lzb-Jq6PpPYX-siwJ9DtjSyZUrRwU5QJup-iaZCe8,1601
427
- radboy-0.0.502.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
428
- radboy-0.0.502.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
429
- radboy-0.0.502.dist-info/RECORD,,
426
+ radboy-0.0.504.dist-info/METADATA,sha256=QiwVgTN06C0ifoZp0NV9oPm7P-DEcfRJTguNCL9pqZs,1601
427
+ radboy-0.0.504.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
428
+ radboy-0.0.504.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
429
+ radboy-0.0.504.dist-info/RECORD,,