Skip to content

Commit

Permalink
updated version v1.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
i2cy committed Sep 19, 2022
1 parent d1a4f54 commit 1ab3a81
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .idea/I2cylib.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions build/lib/i2cylib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# Filename: __init__.py
# Created on: 2021/3/6

name = "i2cylib"
description = "This is a universal package contains a lot of useful functions and tools written by I2cy."

from .utils import *
from .crypto import *
from .filesystem import *
from .network import *
from .database import *
from .engineering import *
from .serial import *

name = "i2cylib"
description = "This is a universal package contains a lot of useful functions and tools written by I2cy."
6 changes: 3 additions & 3 deletions build/lib/i2cylib/network/I2TCP/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def massive_send(clt, data):

if __name__ == '__main__':
logger = Logger()
srv = Server(port=24678, key=b"test", logger=logger, secured_connection=False)
srv = Server(port=24678, key=b"test", logger=logger, secured_connection=True)
clt = Client(port=24678, hostname="127.0.0.1", key=b"test", logger=logger)

srv.start()
Expand All @@ -31,8 +31,8 @@ def massive_send(clt, data):
data = b""

logger.INFO("[main] generating random data to send")
for i in range(1024*256):
data += bytes((int(256*random.random()),))
for i in range(1024 * 256):
data += bytes((int(256 * random.random()),))

for i in range(16):
threading.Thread(target=massive_send, args=(clt, "A{}".format(i).encode() + data)).start()
Expand Down
3 changes: 2 additions & 1 deletion build/lib/i2cylib/utils/path/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@

from .path_fixer import *
from .read_path import *
from .scan_path import *
from .scan_path import *
from .i2tec_home import *
131 changes: 131 additions & 0 deletions build/lib/i2cylib/utils/path/i2tec_home.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: i2cy([email protected])
# Project: I2cylib
# Filename: i2tec_home
# Created on: 2022/9/19

import os
from pathlib import Path
from shutil import rmtree


class DirTree(os.PathLike):

def __init__(self, *root: (os.PathLike, str)):
self.__root = Path(*root)
self.name = self.__root.name

def __str__(self):
return self.__root.as_posix()

def __fspath__(self):
return self.__root.__fspath__()

def __iter__(self):
return self.__root.iterdir()

def __len__(self):
cnt = 0
for i in self.__root.iterdir():
cnt += 1
return cnt

def exists(self):
return self.__root.exists()

def fixPath(self, is_file=True, touch=False):
if is_file:
self.__root.parent.mkdir(parents=True, exist_ok=True)
if touch:
self.__root.touch(exist_ok=True)
else:
self.__root.mkdir(parents=True, exist_ok=True)

def isFixed(self):
return self.__root.parent.exists()

def touch(self):
if self.exists():
return

self.fixPath(is_file=True, touch=True)

def isFile(self):
return self.__root.is_file()

def isDir(self):
return self.__root.is_dir()

def remove(self):
if self.isDir():
rmtree(self)
else:
os.remove(self)

def asPosix(self):
return str(self)

def parent(self):
return DirTree(self.__root.parent)

def toList(self, dir_only=False, file_only=False):
ret = []
for ele in self:
if ele.is_dir():
if not file_only:
ret.append(DirTree(ele))
else:
if not dir_only:
ret.append(DirTree(ele))
return ret

def join(self, *path: (os.PathLike, str)):
return DirTree(self, *path)


def i2TecHome():
return DirTree(Path.home(), ".i2tec")


if __name__ == '__main__':
import time

root = i2TecHome()
root.fixPath(False)
print(root)
print("root got {} file(dir)s within".format(len(root)))
print("listing files under it:")
for i, path in enumerate(root.toList(file_only=True)):
print("\t{}. \"{}\"".format(i, path))

file_path = root.join("{}.txt".format(int(time.time())))
print("creating text file ")
with open(file_path, "w") as f:
f.write("test.file.content.{}".format(time.time))
f.close()

print("creating dir")
dir_path = root.join("{}".format(int(time.time())))
dir_path.fixPath(False)
print("making random files")
for i in range(5):
dir_path.join("{}.txt".format(time.time())).touch()

print("listing everything under root:")
for i, path in enumerate(root.toList()):
print("\t{}. \"{}\"".format(i, path))

print("listing everything under test dir:")
for i, path in enumerate(dir_path.toList()):
print("\t{}. \"{}\"".format(i, path))

print("removing dir")
dir_path.remove()

print("removing test file")
file_path.remove()

print("listing everything under root:")
for i, path in enumerate(root.toList()):
print("\t{}. \"{}\"".format(i, path))
Binary file added dist/i2cylib-1.12.0-py3-none-any.whl
Binary file not shown.
Binary file added dist/i2cylib-1.12.0.tar.gz
Binary file not shown.
Binary file added history/i2cylib-1.11.1-py3-none-any.whl
Binary file not shown.
Binary file added history/i2cylib-1.11.1.tar.gz
Binary file not shown.
Binary file added history/i2cylib-1.11.2-py3-none-any.whl
Binary file not shown.
Binary file added history/i2cylib-1.11.2.tar.gz
Binary file not shown.
50 changes: 25 additions & 25 deletions i2cylib.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
Metadata-Version: 2.1
Name: i2cylib
Version: 1.11.2
Version: 1.12.0
Summary: A Python library contains a lot of useful functions and tools
Home-page: https://github.com/i2cy/i2cylib
Author: I2cy Cloud
Author-email: [email protected]
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/i2cy/i2cylib/issues
Project-URL: Source Code, https://github.com/i2cy/i2cylib
Project-URL: Documentation, https://github.com/i2cy/I2cylib/wiki/API-Document
Description: # 主要包含
- `ICCode` i2cy常用的混淆算法
- `Dynkey` 动态验证密匙生成/验证工具
- `SQLiteDB` SQLite3数据库面向对象式API
- `ICFat64` 类FAT虚拟文件系统
- `I2TCP` 高度封装的用户层通讯协议
- `PID` 异步PID模组
- `utils` 各种常用的小工具

# 安装方法
`pip install i2cylib`

# 内嵌命令行工具
- `icen` 基于ICCode混淆算法的文件加密工具
- `i2cydbserver` 基于SQLite的数据库服务端
- `i2scan` 端口扫描、系统推断工具

# 环境需求
`Python3.6+`

# API文档
[Project Wiki](https://github.com/i2cy/I2cylib/wiki/API-Document)
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# 主要包含
- `ICCode` i2cy常用的混淆算法
- `Dynkey` 动态验证密匙生成/验证工具
- `SQLiteDB` SQLite3数据库面向对象式API
- `ICFat64` 类FAT虚拟文件系统
- `I2TCP` 高度封装的用户层通讯协议
- `PID` 异步PID模组
- `utils` 各种常用的小工具

# 安装方法
`pip install i2cylib`

# 内嵌命令行工具
- `icen` 基于ICCode混淆算法的文件加密工具
- `i2cydbserver` 基于SQLite的数据库服务端
- `i2scan` 端口扫描、系统推断工具

# 环境需求
`Python3.6+`

# API文档
[Project Wiki](https://github.com/i2cy/I2cylib/wiki/API-Document)
2 changes: 1 addition & 1 deletion i2cylib.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
LICENSE
README.md
pyproject.toml
setup.py
Expand Down Expand Up @@ -69,6 +68,7 @@ i2cylib/utils/os/__init__.py
i2cylib/utils/os/linux_hddtemp.py
i2cylib/utils/os/win_tasklist.py
i2cylib/utils/path/__init__.py
i2cylib/utils/path/i2tec_home.py
i2cylib/utils/path/path_fixer.py
i2cylib/utils/path/read_path.py
i2cylib/utils/path/scan_path.py
Expand Down
1 change: 1 addition & 0 deletions i2cylib.egg-info/entry_points.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
i2cydbserver = i2cylib.database.I2DB.i2cydbserver:main
i2en = i2cylib.crypto.I2En.icen:main
i2scan = i2cylib.network.I2Scan.i2scan:main

6 changes: 3 additions & 3 deletions i2cylib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# Filename: __init__.py
# Created on: 2021/3/6

name = "i2cylib"
description = "This is a universal package contains a lot of useful functions and tools written by I2cy."

from .utils import *
from .crypto import *
from .filesystem import *
from .network import *
from .database import *
from .engineering import *
from .serial import *

name = "i2cylib"
description = "This is a universal package contains a lot of useful functions and tools written by I2cy."
6 changes: 3 additions & 3 deletions i2cylib/network/I2TCP/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def massive_send(clt, data):

if __name__ == '__main__':
logger = Logger()
srv = Server(port=24678, key=b"test", logger=logger, secured_connection=False)
srv = Server(port=24678, key=b"test", logger=logger, secured_connection=True)
clt = Client(port=24678, hostname="127.0.0.1", key=b"test", logger=logger)

srv.start()
Expand All @@ -31,8 +31,8 @@ def massive_send(clt, data):
data = b""

logger.INFO("[main] generating random data to send")
for i in range(1024*256):
data += bytes((int(256*random.random()),))
for i in range(1024 * 256):
data += bytes((int(256 * random.random()),))

for i in range(16):
threading.Thread(target=massive_send, args=(clt, "A{}".format(i).encode() + data)).start()
Expand Down
3 changes: 2 additions & 1 deletion i2cylib/utils/path/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@

from .path_fixer import *
from .read_path import *
from .scan_path import *
from .scan_path import *
from .i2tec_home import *
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setuptools.setup(
name="i2cylib", # Replace with your own username
version="1.11.2",
version="1.12.0",
author="I2cy Cloud",
author_email="[email protected]",
description="A Python library contains a lot of useful functions and tools",
Expand Down

0 comments on commit 1ab3a81

Please sign in to comment.