PKDevTools 0.13.20250208.217__tar.gz → 0.13.20250208.219__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.
Files changed (51) hide show
  1. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/DBManager.py +104 -0
  2. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/Telegram.py +2 -2
  3. pkdevtools-0.13.20250208.219/PKDevTools/classes/__init__.py +1 -0
  4. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools.egg-info/PKG-INFO +2 -2
  5. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKG-INFO +2 -2
  6. pkdevtools-0.13.20250208.217/PKDevTools/classes/__init__.py +0 -1
  7. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/LICENSE +0 -0
  8. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/LICENSE.txt +0 -0
  9. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/README.txt +0 -0
  10. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/__init__.py +0 -0
  11. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/Archiver.py +0 -0
  12. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/ColorText.py +0 -0
  13. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/Committer.py +0 -0
  14. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/CookieHelper.py +0 -0
  15. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/Environment.py +0 -0
  16. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/Fetcher.py +0 -0
  17. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/FunctionTimeouts.py +0 -0
  18. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/GmailReader.py +0 -0
  19. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/MarketHours.py +0 -0
  20. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/MenuOptions.py +0 -0
  21. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/NSEMarketStatus.py +0 -0
  22. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/OutputControls.py +0 -0
  23. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/PKDateUtilities.py +0 -0
  24. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/PKGitFolderDownloader.py +0 -0
  25. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/PKJoinableQueue.py +0 -0
  26. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/PKMultiProcessorClient.py +0 -0
  27. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/PKPickler.py +0 -0
  28. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/PKTimer.py +0 -0
  29. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/Pikey.py +0 -0
  30. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/Singleton.py +0 -0
  31. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/SuppressOutput.py +0 -0
  32. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/System.py +0 -0
  33. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/UserSubscriptions.py +0 -0
  34. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/Utils.py +0 -0
  35. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/WorkflowManager.py +0 -0
  36. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/githubutilities.py +0 -0
  37. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/log.py +0 -0
  38. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/multiprocessing_logging.py +0 -0
  39. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/squash.py +0 -0
  40. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/classes/updater.py +0 -0
  41. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/release.md +0 -0
  42. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools/requirements.txt +0 -0
  43. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools.egg-info/SOURCES.txt +0 -0
  44. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools.egg-info/dependency_links.txt +0 -0
  45. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools.egg-info/entry_points.txt +0 -0
  46. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools.egg-info/not-zip-safe +0 -0
  47. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools.egg-info/requires.txt +0 -0
  48. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/PKDevTools.egg-info/top_level.txt +0 -0
  49. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/README.md +0 -0
  50. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/setup.cfg +0 -0
  51. {pkdevtools-0.13.20250208.217 → pkdevtools-0.13.20250208.219}/setup.py +0 -0
@@ -410,3 +410,107 @@ 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
+ result = self.connection().execute("""
417
+ UPDATE alertsubscriptions
418
+ SET
419
+ balance = balance - ?,
420
+ scannerJobs = scannerJobs || ';' || ?
421
+ WHERE userId = ?;
422
+ """, (charge, scanId, userID))
423
+ if result.rows_affected > 0:
424
+ default_logger().debug(f"User: {userID} updated with balance and scannerJobs!")
425
+ self.topUpScannerJobs(scanId,userID)
426
+ except Exception as e: # pragma: no cover
427
+ print(f"Could not updateAlertSubscriptionModel UserID: {userID}\n{e}")
428
+ default_logger().debug(e, exc_info=True)
429
+ pass
430
+ finally:
431
+ if self.conn is not None:
432
+ self.conn.close()
433
+ self.conn = None
434
+
435
+ def topUpAlertSubscriptionBalance(self,userID,topup:float):
436
+ """
437
+ Handles a new user insertion as well as update.
438
+
439
+ If UserID does not exist, a new row is inserted with the given Balance.
440
+ If UserID already exists, only the Balance is updated by adding the new amount
441
+ (Balance + excluded.Balance).
442
+ """
443
+ try:
444
+ result = self.connection().execute("""
445
+ INSERT INTO alertsubscriptions (userId, balance)
446
+ VALUES (?, ?)
447
+ ON CONFLICT(userId) DO UPDATE
448
+ SET balance = balance + excluded.balance;
449
+ """, (userID,topup))
450
+ if result.rows_affected > 0:
451
+ default_logger().debug(f"User: {userID} topped up with balance !")
452
+ except Exception as e: # pragma: no cover
453
+ print(f"Could not topUpAlertSubscriptionBalance UserID: {userID}\n{e}")
454
+ default_logger().debug(e, exc_info=True)
455
+ pass
456
+ finally:
457
+ if self.conn is not None:
458
+ self.conn.close()
459
+ self.conn = None
460
+
461
+ def topUpScannerJobs(self,scanId,userID):
462
+ """
463
+ Handles a new user insertion as well as update for a given scanId.
464
+
465
+ If scanId does not exist, a new row is inserted with the given userId.
466
+ If scanId already exists, only the users is updated by adding the new userId
467
+ """
468
+ try:
469
+ result = self.connection().execute("""
470
+ INSERT INTO scannerjobs (scannerId, users)
471
+ VALUES (?, ?)
472
+ ON CONFLICT(scannerId) DO UPDATE
473
+ SET users = users || ';' || excluded.users;
474
+ """, (scanId,userID))
475
+ if result.rows_affected > 0:
476
+ default_logger().debug(f"User: {userID} added to scanId !")
477
+ except Exception as e: # pragma: no cover
478
+ print(f"Could not topUpScannerJobs UserID: {userID}\n{e}")
479
+ default_logger().debug(e, exc_info=True)
480
+ pass
481
+ finally:
482
+ if self.conn is not None:
483
+ self.conn.close()
484
+ self.conn = None
485
+
486
+ def resetScannerJobs(self):
487
+ """
488
+ Truncates scannerJobs and clears all jobs from users' alert subscriptions
489
+ """
490
+ try:
491
+ result = self.connection().execute("DELETE from scannerjobs")
492
+ if result.rows_affected > 0:
493
+ default_logger().debug(f"scannerJobs truncated !")
494
+ except Exception as e: # pragma: no cover
495
+ print(f"Could not deleteScannerJobs \n{e}")
496
+ default_logger().debug(e, exc_info=True)
497
+ pass
498
+ finally:
499
+ if self.conn is not None:
500
+ self.conn.close()
501
+ self.conn = None
502
+ try:
503
+ result = self.connection().execute("""
504
+ UPDATE alertsubscriptions
505
+ SET scannerJobs = ''
506
+ """)
507
+ if result.rows_affected > 0:
508
+ default_logger().debug(f"alertsubscriptions updated with cleaned up scannerJobs!")
509
+ except Exception as e: # pragma: no cover
510
+ print(f"Could not deleteScannerJobs \n{e}")
511
+ default_logger().debug(e, exc_info=True)
512
+ pass
513
+ finally:
514
+ if self.conn is not None:
515
+ self.conn.close()
516
+ self.conn = None
@@ -190,8 +190,8 @@ def send_message(message, userID=None, parse_type="HTML", list_png=None, retrial
190
190
  if len(reply_markup_encoded) > 0:
191
191
  url = (
192
192
  botsUrl
193
- + "/sendMessage?chat_id={}&text={}&reply_markup={reply_markup_encoded}".format(
194
- people_id, escaped_text[:MAX_MSG_LENGTH], reply_markup_encoded=reply_markup_encoded
193
+ + "/sendMessage?chat_id={}&text={}&reply_markup={reply_markup_encoded}&parse_mode={parse_mode}".format(
194
+ people_id, escaped_text[:MAX_MSG_LENGTH], reply_markup_encoded=reply_markup_encoded,parse_mode=parse_type
195
195
  )
196
196
  )
197
197
  else:
@@ -0,0 +1 @@
1
+ VERSION='0.13.20250208.219'
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PKDevTools
3
- Version: 0.13.20250208.217
3
+ Version: 0.13.20250208.219
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.217.zip
6
+ Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250208.219.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.217
3
+ Version: 0.13.20250208.219
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.217.zip
6
+ Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250208.219.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.217'