PKDevTools 0.13.20250208.218__tar.gz → 0.13.20250208.220__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/DBManager.py +117 -0
- pkdevtools-0.13.20250208.220/PKDevTools/classes/__init__.py +1 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/PKG-INFO +2 -2
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKG-INFO +2 -2
- pkdevtools-0.13.20250208.218/PKDevTools/classes/__init__.py +0 -1
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/LICENSE +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/LICENSE.txt +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/README.txt +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/__init__.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Archiver.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/ColorText.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Committer.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/CookieHelper.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Environment.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Fetcher.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/FunctionTimeouts.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/GmailReader.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/MarketHours.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/MenuOptions.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/NSEMarketStatus.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/OutputControls.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/PKDateUtilities.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/PKGitFolderDownloader.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/PKJoinableQueue.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/PKMultiProcessorClient.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/PKPickler.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/PKTimer.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Pikey.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Singleton.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/SuppressOutput.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/System.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Telegram.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/UserSubscriptions.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Utils.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/WorkflowManager.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/githubutilities.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/log.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/multiprocessing_logging.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/squash.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/updater.py +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/release.md +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/requirements.txt +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/SOURCES.txt +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/dependency_links.txt +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/entry_points.txt +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/not-zip-safe +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/requires.txt +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/top_level.txt +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/README.md +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/setup.cfg +0 -0
- {pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/setup.py +0 -0
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/DBManager.py
RENAMED
@@ -410,3 +410,120 @@ class DBManager:
|
|
410
410
|
self.conn.close()
|
411
411
|
self.conn = None
|
412
412
|
return scanners[0].userIds if len(scanners) > 0 else []
|
413
|
+
|
414
|
+
def updateAlertSubscriptionModel(self,userID,charge:float,scanId:str):
|
415
|
+
try:
|
416
|
+
success = False
|
417
|
+
result = self.connection().execute("""
|
418
|
+
UPDATE alertsubscriptions
|
419
|
+
SET
|
420
|
+
balance = balance - ?,
|
421
|
+
scannerJobs = scannerJobs || ';' || ?
|
422
|
+
WHERE userId = ?;
|
423
|
+
""", (charge, scanId, userID))
|
424
|
+
if result.rows_affected > 0:
|
425
|
+
default_logger().debug(f"User: {userID} updated with balance and scannerJobs!")
|
426
|
+
success = self.topUpScannerJobs(scanId,userID)
|
427
|
+
except Exception as e: # pragma: no cover
|
428
|
+
print(f"Could not updateAlertSubscriptionModel UserID: {userID}\n{e}")
|
429
|
+
default_logger().debug(e, exc_info=True)
|
430
|
+
pass
|
431
|
+
finally:
|
432
|
+
if self.conn is not None:
|
433
|
+
self.conn.close()
|
434
|
+
self.conn = None
|
435
|
+
return success
|
436
|
+
|
437
|
+
def topUpAlertSubscriptionBalance(self,userID,topup:float):
|
438
|
+
"""
|
439
|
+
Handles a new user insertion as well as update.
|
440
|
+
|
441
|
+
If UserID does not exist, a new row is inserted with the given Balance.
|
442
|
+
If UserID already exists, only the Balance is updated by adding the new amount
|
443
|
+
(Balance + excluded.Balance).
|
444
|
+
"""
|
445
|
+
try:
|
446
|
+
success = False
|
447
|
+
result = self.connection().execute("""
|
448
|
+
INSERT INTO alertsubscriptions (userId, balance)
|
449
|
+
VALUES (?, ?)
|
450
|
+
ON CONFLICT(userId) DO UPDATE
|
451
|
+
SET balance = balance + excluded.balance;
|
452
|
+
""", (userID,topup))
|
453
|
+
if result.rows_affected > 0:
|
454
|
+
default_logger().debug(f"User: {userID} topped up with balance !")
|
455
|
+
success = True
|
456
|
+
except Exception as e: # pragma: no cover
|
457
|
+
print(f"Could not topUpAlertSubscriptionBalance UserID: {userID}\n{e}")
|
458
|
+
default_logger().debug(e, exc_info=True)
|
459
|
+
pass
|
460
|
+
finally:
|
461
|
+
if self.conn is not None:
|
462
|
+
self.conn.close()
|
463
|
+
self.conn = None
|
464
|
+
return success
|
465
|
+
|
466
|
+
def topUpScannerJobs(self,scanId,userID):
|
467
|
+
"""
|
468
|
+
Handles a new user insertion as well as update for a given scanId.
|
469
|
+
|
470
|
+
If scanId does not exist, a new row is inserted with the given userId.
|
471
|
+
If scanId already exists, only the users is updated by adding the new userId
|
472
|
+
"""
|
473
|
+
try:
|
474
|
+
success = False
|
475
|
+
result = self.connection().execute("""
|
476
|
+
INSERT INTO scannerjobs (scannerId, users)
|
477
|
+
VALUES (?, ?)
|
478
|
+
ON CONFLICT(scannerId) DO UPDATE
|
479
|
+
SET users = users || ';' || excluded.users;
|
480
|
+
""", (scanId,userID))
|
481
|
+
if result.rows_affected > 0:
|
482
|
+
default_logger().debug(f"User: {userID} added to scanId !")
|
483
|
+
success = True
|
484
|
+
except Exception as e: # pragma: no cover
|
485
|
+
print(f"Could not topUpScannerJobs UserID: {userID}\n{e}")
|
486
|
+
default_logger().debug(e, exc_info=True)
|
487
|
+
pass
|
488
|
+
finally:
|
489
|
+
if self.conn is not None:
|
490
|
+
self.conn.close()
|
491
|
+
self.conn = None
|
492
|
+
return success
|
493
|
+
|
494
|
+
def resetScannerJobs(self):
|
495
|
+
"""
|
496
|
+
Truncates scannerJobs and clears all jobs from users' alert subscriptions
|
497
|
+
"""
|
498
|
+
try:
|
499
|
+
success1 = False
|
500
|
+
result = self.connection().execute("DELETE from scannerjobs")
|
501
|
+
if result.rows_affected > 0:
|
502
|
+
default_logger().debug(f"scannerJobs truncated !")
|
503
|
+
success1 = True
|
504
|
+
except Exception as e: # pragma: no cover
|
505
|
+
print(f"Could not deleteScannerJobs \n{e}")
|
506
|
+
default_logger().debug(e, exc_info=True)
|
507
|
+
pass
|
508
|
+
finally:
|
509
|
+
if self.conn is not None:
|
510
|
+
self.conn.close()
|
511
|
+
self.conn = None
|
512
|
+
try:
|
513
|
+
success2 = False
|
514
|
+
result = self.connection().execute("""
|
515
|
+
UPDATE alertsubscriptions
|
516
|
+
SET scannerJobs = ''
|
517
|
+
""")
|
518
|
+
if result.rows_affected > 0:
|
519
|
+
default_logger().debug(f"alertsubscriptions updated with cleaned up scannerJobs!")
|
520
|
+
success2 = True
|
521
|
+
except Exception as e: # pragma: no cover
|
522
|
+
print(f"Could not deleteScannerJobs \n{e}")
|
523
|
+
default_logger().debug(e, exc_info=True)
|
524
|
+
pass
|
525
|
+
finally:
|
526
|
+
if self.conn is not None:
|
527
|
+
self.conn.close()
|
528
|
+
self.conn = None
|
529
|
+
return success1 and success2
|
@@ -0,0 +1 @@
|
|
1
|
+
VERSION='0.13.20250208.220'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: PKDevTools
|
3
|
-
Version: 0.13.20250208.
|
3
|
+
Version: 0.13.20250208.220
|
4
4
|
Summary: A general day-to-day toolset for PKScreener repos
|
5
5
|
Home-page: https://github.com/pkjmesra/PKDevTools
|
6
|
-
Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250208.
|
6
|
+
Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250208.220.zip
|
7
7
|
Author: pkjmesra
|
8
8
|
Author-email: pkjmesra@gmail.com
|
9
9
|
License: OSI Approved (MIT)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: PKDevTools
|
3
|
-
Version: 0.13.20250208.
|
3
|
+
Version: 0.13.20250208.220
|
4
4
|
Summary: A general day-to-day toolset for PKScreener repos
|
5
5
|
Home-page: https://github.com/pkjmesra/PKDevTools
|
6
|
-
Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250208.
|
6
|
+
Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250208.220.zip
|
7
7
|
Author: pkjmesra
|
8
8
|
Author-email: pkjmesra@gmail.com
|
9
9
|
License: OSI Approved (MIT)
|
@@ -1 +0,0 @@
|
|
1
|
-
VERSION='0.13.20250208.218'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Archiver.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/ColorText.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Committer.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/CookieHelper.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Environment.py
RENAMED
File without changes
|
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/FunctionTimeouts.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/GmailReader.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/MarketHours.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/MenuOptions.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/NSEMarketStatus.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/OutputControls.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/PKDateUtilities.py
RENAMED
File without changes
|
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/PKJoinableQueue.py
RENAMED
File without changes
|
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/PKPickler.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Singleton.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/SuppressOutput.py
RENAMED
File without changes
|
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/Telegram.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/WorkflowManager.py
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools/classes/githubutilities.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/entry_points.txt
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/not-zip-safe
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/requires.txt
RENAMED
File without changes
|
{pkdevtools-0.13.20250208.218 → pkdevtools-0.13.20250208.220}/PKDevTools.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|