radboy 0.0.502__py3-none-any.whl → 0.0.503__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.
- radboy/FB/__pycache__/FormBuilder.cpython-313.pyc +0 -0
- radboy/Occurances/Occurances.py +108 -7
- radboy/__init__.py +1 -1
- radboy/__pycache__/__init__.cpython-313.pyc +0 -0
- {radboy-0.0.502.dist-info → radboy-0.0.503.dist-info}/METADATA +1 -1
- {radboy-0.0.502.dist-info → radboy-0.0.503.dist-info}/RECORD +8 -8
- {radboy-0.0.502.dist-info → radboy-0.0.503.dist-info}/WHEEL +0 -0
- {radboy-0.0.502.dist-info → radboy-0.0.503.dist-info}/top_level.txt +0 -0
|
Binary file
|
radboy/Occurances/Occurances.py
CHANGED
|
@@ -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}[
|
|
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
|
-
|
|
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.
|
|
1
|
+
VERSION='0.0.503'
|
|
Binary file
|
|
@@ -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=
|
|
8
|
+
radboy/__init__.py,sha256=rpb4-5-VMsdEK-fEqHy8P46_wyOzRG82m5px4ZqY40g,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
|
|
@@ -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=
|
|
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=
|
|
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=
|
|
401
|
+
radboy/__pycache__/__init__.cpython-313.pyc,sha256=ls_h-bssylYwXbevLK3pdBZJUXwaqEciZKg_iXBD9I8,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.
|
|
427
|
-
radboy-0.0.
|
|
428
|
-
radboy-0.0.
|
|
429
|
-
radboy-0.0.
|
|
426
|
+
radboy-0.0.503.dist-info/METADATA,sha256=YZa0xbyxIZBBlUzeMBK8E5-7MdLoHx0Z_FjNfn_7y9I,1601
|
|
427
|
+
radboy-0.0.503.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
428
|
+
radboy-0.0.503.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
|
|
429
|
+
radboy-0.0.503.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|