ezKit 1.9.0__tar.gz → 1.9.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ezKit
3
- Version: 1.9.0
3
+ Version: 1.9.1
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -10,6 +10,7 @@ from typing import Any
10
10
 
11
11
  from loguru import logger
12
12
  from sqlalchemy import CursorResult, Index, create_engine, text
13
+ from sqlalchemy.orm import DeclarativeBase
13
14
 
14
15
  from . import utils
15
16
 
@@ -19,13 +20,13 @@ class Database():
19
20
 
20
21
  engine = create_engine('sqlite://')
21
22
 
22
- def __init__(self, engine_url, **engine_options):
23
+ def __init__(self, target: str, **options):
23
24
  """Initiation"""
24
- if engine_url is not None and utils.isTrue(engine_url, str):
25
- if utils.isTrue(engine_options, dict):
26
- self.engine = create_engine(engine_url, **engine_options)
25
+ if isinstance(target, str) and utils.isTrue(target, str):
26
+ if utils.isTrue(options, dict):
27
+ self.engine = create_engine(target, **options)
27
28
  else:
28
- self.engine = create_engine(engine_url)
29
+ self.engine = create_engine(target)
29
30
  else:
30
31
  pass
31
32
 
@@ -45,7 +46,7 @@ class Database():
45
46
  logger.exception(e)
46
47
  return False
47
48
 
48
- def metadata_init(self, base, **kwargs) -> bool:
49
+ def metadata_init(self, base: DeclarativeBase, **kwargs) -> bool:
49
50
  # https://stackoverflow.com/questions/19175311/how-to-create-only-one-table-with-sqlalchemy
50
51
  info = "Database init table"
51
52
  try:
@@ -11,6 +11,15 @@ class Mongo():
11
11
 
12
12
  client = MongoClient()
13
13
 
14
+ def __init__(self, target: str | dict):
15
+ """Initiation"""
16
+ if isinstance(target, str) and utils.isTrue(target, str):
17
+ self.client = MongoClient(target)
18
+ elif isinstance(target, dict) and utils.isTrue(target, dict):
19
+ self.client = MongoClient(**target)
20
+ else:
21
+ pass
22
+
14
23
  def close(self) -> bool:
15
24
  """client close"""
16
25
  try:
@@ -16,12 +16,12 @@ class Redis:
16
16
  # 这里修改以下参数: host, port, socket_timeout, socket_connect_timeout, charset
17
17
  redis = RedisClient.Redis()
18
18
 
19
- def __init__(self, arguments: str | dict):
19
+ def __init__(self, target: str | dict):
20
20
  """Initiation"""
21
- if isinstance(arguments, str) and utils.isTrue(arguments, str):
22
- self.redis = RedisClient.from_url(arguments)
23
- elif isinstance(arguments, dict) and utils.isTrue(arguments, dict):
24
- self.redis = RedisClient.Redis(**arguments)
21
+ if isinstance(target, str) and utils.isTrue(target, str):
22
+ self.redis = RedisClient.from_url(target)
23
+ elif isinstance(target, dict) and utils.isTrue(target, dict):
24
+ self.redis = RedisClient.Redis(**target)
25
25
  else:
26
26
  pass
27
27
 
@@ -1340,8 +1340,7 @@ def increment_version(
1340
1340
 
1341
1341
 
1342
1342
  def make_directory(
1343
- directory: str,
1344
- debug: bool = False
1343
+ directory: str
1345
1344
  ) -> bool:
1346
1345
  """创建目录"""
1347
1346
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ezKit
3
- Version: 1.9.0
3
+ Version: 1.9.1
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -3,7 +3,7 @@ from setuptools import find_packages, setup
3
3
 
4
4
  setup(
5
5
  name='ezKit',
6
- version='1.9.0',
6
+ version='1.9.1',
7
7
  author='septvean',
8
8
  author_email='septvean@gmail.com',
9
9
  description='Easy Kit',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes