reywechat 1.0.34__py3-none-any.whl → 1.0.35__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.
reywechat/rdb.py CHANGED
@@ -37,7 +37,7 @@ class WeChatDatabase(BaseWeChat):
37
37
  def __init__(
38
38
  self,
39
39
  wechat: WeChat,
40
- rdatabase: Database | dict[Literal['wechat', 'file'], Database]
40
+ database: Database | dict[Literal['wechat', 'file'], Database]
41
41
  ) -> None:
42
42
  """
43
43
  Build instance attributes.
@@ -45,28 +45,28 @@ class WeChatDatabase(BaseWeChat):
45
45
  Parameters
46
46
  ----------
47
47
  wechat : `WeChatClient` instance.
48
- rdatabase : `WeChatDatabase` instance of `reykit` package.
49
- - `WeChatDatabase`, Set all `WeChatDatabase`: instances.
50
- - `dict`, Set each `WeChatDatabase`: instance, all item is required.
51
- `Key 'wechat'`: `WeChatDatabase` instance used in WeChat methods.
52
- `Key 'file'`: `WeChatDatabase` instance used in file methods.
48
+ database : `Database` instance of `reykit` package.
49
+ - `Database`, Set all `Database`: instances.
50
+ - `dict`, Set each `Database`: instance, all item is required.
51
+ `Key 'wechat'`: `Database` instance used in WeChat methods.
52
+ `Key 'file'`: `Database` instance used in file methods.
53
53
  """
54
54
 
55
55
  # Set attribute.
56
56
  self.wechat = wechat
57
- match rdatabase:
57
+ match database:
58
58
  case Database():
59
- self.rdatabase_wechat = self.rdatabase_file = rdatabase
59
+ self.database_wechat = self.database_file = database
60
60
  case dict():
61
- self.rdatabase_wechat: Database = rdatabase.get('wechat')
62
- self.rdatabase_file: Database = rdatabase.get('file')
61
+ self.database_wechat: Database = database.get('wechat')
62
+ self.database_file: Database = database.get('file')
63
63
  if (
64
- self.rdatabase_wechat
65
- or self.rdatabase_file
64
+ self.database_wechat
65
+ or self.database_file
66
66
  ):
67
- throw(ValueError, rdatabase)
67
+ throw(ValueError, database)
68
68
  case _:
69
- throw(TypeError, rdatabase)
69
+ throw(TypeError, database)
70
70
 
71
71
  ## Database path name.
72
72
  self.path_names = {
@@ -80,7 +80,7 @@ class WeChatDatabase(BaseWeChat):
80
80
  }
81
81
 
82
82
  # Check.
83
- if 'sqlite' in (self.rdatabase_wechat.backend, self.rdatabase_file.backend):
83
+ if 'sqlite' in (self.database_wechat.backend, self.database_file.backend):
84
84
  text='not suitable for SQLite databases'
85
85
  throw(AssertionError, text=text)
86
86
 
@@ -514,10 +514,10 @@ class WeChatDatabase(BaseWeChat):
514
514
  # Build.
515
515
 
516
516
  ## WeChat.
517
- self.rdatabase_wechat.build.build(databases, tables, views_stats=views_stats)
517
+ self.database_wechat.build.build(databases, tables, views_stats=views_stats)
518
518
 
519
519
  ## File.
520
- self.rdatabase_file.file.build()
520
+ self.database_file.file.build()
521
521
 
522
522
  # Update.
523
523
  self.update_contact_user()
@@ -547,7 +547,7 @@ class WeChatDatabase(BaseWeChat):
547
547
  ]
548
548
 
549
549
  # Insert and update.
550
- conn = self.rdatabase_wechat.connect()
550
+ conn = self.database_wechat.connect()
551
551
 
552
552
  ## Insert.
553
553
  if contact_table != []:
@@ -603,7 +603,7 @@ class WeChatDatabase(BaseWeChat):
603
603
  ]
604
604
 
605
605
  # Insert and update.
606
- conn = self.rdatabase_wechat.connect()
606
+ conn = self.database_wechat.connect()
607
607
 
608
608
  ## Insert.
609
609
  if contact_table != []:
@@ -681,7 +681,7 @@ class WeChatDatabase(BaseWeChat):
681
681
  ]
682
682
 
683
683
  # Insert and update.
684
- conn = self.rdatabase_wechat.connect()
684
+ conn = self.database_wechat.connect()
685
685
 
686
686
  ## Insert.
687
687
  if room_user_data != []:
@@ -753,7 +753,7 @@ class WeChatDatabase(BaseWeChat):
753
753
  }
754
754
 
755
755
  ## Insert.
756
- self.rdatabase_wechat.execute_insert(
756
+ self.database_wechat.execute_insert(
757
757
  (self.path_names['wechat'], self.path_names['wechat.contact_user']),
758
758
  data,
759
759
  'update'
@@ -794,7 +794,7 @@ class WeChatDatabase(BaseWeChat):
794
794
  ## Insert.
795
795
 
796
796
  ### 'contact_room'.
797
- self.rdatabase_wechat.execute_insert(
797
+ self.database_wechat.execute_insert(
798
798
  (self.path_names['wechat'], self.path_names['wechat.contact_room']),
799
799
  data,
800
800
  'update'
@@ -816,7 +816,7 @@ class WeChatDatabase(BaseWeChat):
816
816
  }
817
817
 
818
818
  ## Update.
819
- self.rdatabase_wechat.execute_update(
819
+ self.database_wechat.execute_update(
820
820
  (self.path_names['wechat'], self.path_names['wechat.contact_room']),
821
821
  data
822
822
  )
@@ -838,7 +838,7 @@ class WeChatDatabase(BaseWeChat):
838
838
  }
839
839
 
840
840
  ## Update.
841
- self.rdatabase_wechat.execute_update(
841
+ self.database_wechat.execute_update(
842
842
  (self.path_names['wechat'], self.path_names['wechat.contact_room']),
843
843
  data
844
844
  )
@@ -898,7 +898,7 @@ class WeChatDatabase(BaseWeChat):
898
898
  if message.file is None:
899
899
  file_id = None
900
900
  else:
901
- file_id = self.rdatabase_file.file.upload(
901
+ file_id = self.database_file.file.upload(
902
902
  message.file['path'],
903
903
  message.file['name'],
904
904
  'WeChat'
@@ -918,7 +918,7 @@ class WeChatDatabase(BaseWeChat):
918
918
  }
919
919
 
920
920
  # Insert.
921
- self.rdatabase_wechat.execute_insert(
921
+ self.database_wechat.execute_insert(
922
922
  (self.path_names['wechat'], self.path_names['wechat.message_receive']),
923
923
  data,
924
924
  'ignore'
@@ -957,7 +957,7 @@ class WeChatDatabase(BaseWeChat):
957
957
  }
958
958
 
959
959
  # Update.
960
- self.rdatabase_wechat.execute_update(
960
+ self.database_wechat.execute_update(
961
961
  (self.path_names['wechat'], self.path_names['wechat.message_send']),
962
962
  data
963
963
  )
@@ -984,7 +984,7 @@ class WeChatDatabase(BaseWeChat):
984
984
  """
985
985
 
986
986
  # Information.
987
- file_info = self.rdatabase_file.file.query(file_id)
987
+ file_info = self.database_file.file.query(file_id)
988
988
  file_md5 = file_info['md5']
989
989
  file_name = file_info['name']
990
990
 
@@ -993,7 +993,7 @@ class WeChatDatabase(BaseWeChat):
993
993
 
994
994
  ## Download.
995
995
  if cache_path is None:
996
- file_bytes = self.rdatabase_file.file.download(file_id)
996
+ file_bytes = self.database_file.file.download(file_id)
997
997
  cache_path = self.wechat.cache.store(file_bytes, file_name)
998
998
 
999
999
  return cache_path, file_name
@@ -1013,7 +1013,7 @@ class WeChatDatabase(BaseWeChat):
1013
1013
  """
1014
1014
 
1015
1015
  # Handle parameter.
1016
- conn = self.rdatabase_wechat.connect()
1016
+ conn = self.database_wechat.connect()
1017
1017
 
1018
1018
  # Read.
1019
1019
  where = (
@@ -1109,7 +1109,7 @@ class WeChatDatabase(BaseWeChat):
1109
1109
 
1110
1110
  ## User.
1111
1111
  if message.room is None:
1112
- result = message.receiver.wechat.database.rdatabase_wechat.execute_select(
1112
+ result = message.receiver.wechat.database.database_wechat.execute_select(
1113
1113
  (self.path_names['wechat'], self.path_names['wechat.contact_user']),
1114
1114
  ['valid'],
1115
1115
  '`user_id` = :user_id',
@@ -1134,7 +1134,7 @@ class WeChatDatabase(BaseWeChat):
1134
1134
  ') AS `a`\n'
1135
1135
  'WHERE `valid` = 1'
1136
1136
  )
1137
- result = message.receiver.wechat.database.rdatabase_wechat.execute(
1137
+ result = message.receiver.wechat.database.database_wechat.execute(
1138
1138
  sql,
1139
1139
  room_id=message.room,
1140
1140
  user_id=message.user
@@ -1251,7 +1251,7 @@ class WeChatDatabase(BaseWeChat):
1251
1251
  ## Cache.
1252
1252
  cache_path = self.wechat.cache.store(file_path, file_name)
1253
1253
 
1254
- file_id = self.rdatabase_file.file.upload(
1254
+ file_id = self.database_file.file.upload(
1255
1255
  cache_path,
1256
1256
  file_name,
1257
1257
  'WeChat'
@@ -1261,7 +1261,7 @@ class WeChatDatabase(BaseWeChat):
1261
1261
  data['file_id'] = file_id
1262
1262
 
1263
1263
  # Insert.
1264
- self.rdatabase_wechat.execute_insert(
1264
+ self.database_wechat.execute_insert(
1265
1265
  (self.path_names['wechat'], self.path_names['wechat.message_send']),
1266
1266
  data
1267
1267
  )
reywechat/rwechat.py CHANGED
@@ -40,7 +40,7 @@ class WeChat(BaseWeChat):
40
40
 
41
41
  def __init__(
42
42
  self,
43
- rrdatabase: Database | dict[Literal['wechat', 'file'], Database] | None,
43
+ database: Database | dict[Literal['wechat', 'file'], Database] | None,
44
44
  max_receiver: int = 2,
45
45
  call_name: str | None = None,
46
46
  project_dir: str | None = None
@@ -50,11 +50,11 @@ class WeChat(BaseWeChat):
50
50
 
51
51
  Parameters
52
52
  ----------
53
- rrdatabase : `WeChatDatabase` instance of `reykit` package.
54
- - `WeChatDatabase`, Set all `WeChatDatabase`: instances.
55
- - `dict`, Set each `WeChatDatabase`: instance, all item is required.
56
- `Key 'wechat'`: `WeChatDatabase` instance used in WeChat methods.
57
- `Key 'file'`: `WeChatDatabase` instance used in file methods.
53
+ database : `Database` instance of `reykit` package.
54
+ - `Database`, Set all `Database`: instances.
55
+ - `dict`, Set each `Database`: instance, all item is required.
56
+ `Key 'wechat'`: `Database` instance used in WeChat methods.
57
+ `Key 'file'`: `Database` instance used in file methods.
58
58
  max_receiver : Maximum number of receivers.
59
59
  call_name : Trigger call name.
60
60
  - `None`: Use account nickname.
@@ -82,7 +82,7 @@ class WeChat(BaseWeChat):
82
82
  self.receiver = WechatReceiver(self, max_receiver, call_name)
83
83
  self.trigger = self.receiver.trigger
84
84
  self.sender = WeChatSender(self)
85
- self.database = WeChatDatabase(self, rrdatabase)
85
+ self.database = WeChatDatabase(self, database)
86
86
  self.schedule = WeChatSchedule(self)
87
87
 
88
88
  ## Client.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reywechat
3
- Version: 1.0.34
3
+ Version: 1.0.35
4
4
  Summary: WeChat method set.
5
5
  Project-URL: homepage, https://github.com/reyxbo/reywechat/
6
6
  Author-email: Rey <reyxbo@163.com>
@@ -3,15 +3,15 @@ reywechat/rall.py,sha256=zEW-mLL2uP8aT2_foCMFGmMi_3RCrGl8qutnSVkmY1E,397
3
3
  reywechat/rbase.py,sha256=0NunIUIXra2ML2N6odwMk5oENTE0r6VSBHWXUvgI-lc,1124
4
4
  reywechat/rcache.py,sha256=Hh_HE-t_KUMlrz4gEFPh1AjmhnrSgH520IFJPumWb7A,908
5
5
  reywechat/rclient.py,sha256=MEvQB3pHb5ORukKbKntalRtFcKIOP9BGtDsMt5ihQfM,22524
6
- reywechat/rdb.py,sha256=iSED-Ezxj3XaXy85muHLeqm8je7Eqpl_7AzbIq01xyU,41535
6
+ reywechat/rdb.py,sha256=tknEavihcZ3-BYb29terhO8pE6s3t0NZABvUJoBdUTI,41464
7
7
  reywechat/rlog.py,sha256=x4WFLNoeKqGjPVoI81ZZNEd9ctdYToSg5hEFuESmCQY,5254
8
8
  reywechat/rreceive.py,sha256=RkUwPsWz6k_Ua3ovrbXRMVajeNOJQqvpPXz_CvJyUPQ,35162
9
9
  reywechat/rschedule.py,sha256=bZEEZV3K4zrJvupe1Eq6kGR7kunbVq5dfGnqFKYF3JI,1857
10
10
  reywechat/rsend.py,sha256=UmdKCOb1cPKEmBPHt9htjxB8fPyi5jW5pGwpRQIZdKA,13720
11
11
  reywechat/rtrigger.py,sha256=n8kUNovh62r7crlXrp33uaKvbILT-wcfvUqeyGt7YhM,4956
12
- reywechat/rwechat.py,sha256=d9yNnLLz0YI1buatf5j4YMhj6tUH6yWsDnx91EyAhow,4926
12
+ reywechat/rwechat.py,sha256=Iir9EC0E3TmLElPf6k_Tkc7lZOr4uO1X9bpOZ0t0EV0,4884
13
13
  reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
14
- reywechat-1.0.34.dist-info/METADATA,sha256=nWSxt-AjwWCOwKNx7vwgOyccc_q2iU7G47oMhzqmgS0,1551
15
- reywechat-1.0.34.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- reywechat-1.0.34.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
17
- reywechat-1.0.34.dist-info/RECORD,,
14
+ reywechat-1.0.35.dist-info/METADATA,sha256=XWhoKggz_4cP8rfJ9l0uMxB5--EyWWw0Zb8TsWT7YzI,1551
15
+ reywechat-1.0.35.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ reywechat-1.0.35.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
17
+ reywechat-1.0.35.dist-info/RECORD,,