Skip to main content

一个用于多功能的Python库

Project description

由mly, wyy, sty创建的工具库

附属模块:
  • xyz_tools_plus.math 数学模块
    • gcd(*nums: int) -> int: 计算多个整数的最大公约数
    • lcm(*nums: int) -> int: 计算多个整数的最小公倍数
    • is_prime(n) -> bool: 判断一个整数是否为素数
    • comb(n: int, k: int) -> int: 计算组合数 C(n, k)
    • pow(x, y): 快速计算 x 的 y 次幂
    • fib_list(n) -> list: 生成包含前 N 项的斐波那契数列
    • fib(n) -> int: 返回第 N 项的斐波那契数
    • pell_list(n) -> list: 生成包含前 N 项的佩尔数列
    • pell(n) -> int: 返回第 N 项的佩尔数
    • factor(n: int) -> list: 分解整数 n 的质因数
    • manhattan_d(point1, point2): 计算两个点之间的曼哈顿距离
    • euclidean_d(point1, point2, precision=None): 计算两个点之间的欧几里得距离,可指定小数位数
    • matrix_add(matrix1, matrix2): 计算两个矩阵的加法
    • matrix_sub(matrix1, matrix2): 计算两个矩阵的减法
    • matrix_mu(matrix1, matrix2): 计算两个矩阵的乘法
    • matrix_transpose(matrix): 计算矩阵的转置
    • matrix_scalar_mul(matrix, scalar): 计算矩阵与标量的乘法
    • list_max(nums, n): 找到数组中第 N 大的数
    • max(*nums, n): 找到多个数中第 N 大的数, 输入n时请注意使用n = [num]
    • list_max_index(nums, n): 找到数组中第 N 大的数的索引
    • max_index(*nums, n): 找到多个数中第 N 大的数的索引, 输入n时请注意使用n = [num]
    • list_min(nums, n): 找到数组中第 N 小的数
    • min(*nums, n): 找到多个数中第 N 小的数, 输入n时请注意使用n = [num]
    • list_min_index(nums, n): 找到数组中第 N 小的数的索引
    • min_index(*nums, n): 找到多个数中第 N 小的数的索引, 输入n时请注意使用n = [num]
    • mean(nums: list or tuple) -> float: 计算一组数字的平均值
    • arith_sum(a, d, n): 计算等差数列的前 n 项和
    • geo_sum(a, r, n): 计算等比数列的前 n 项和
    • math_help() -> None: 显示math帮助信息
  • xyz_tools_plus.RSA RSA
    • get_rsa_keys(p: int, q: int) -> Tuple[Tuple[int, int], Tuple[int, int]]: 生成 RSA 公钥和私钥
    • rsa_encrypt(public_key: Tuple[int, int], plaintext: int) -> int: 使用 RSA 公钥加密数据
    • rsa_decrypt(private_key: Tuple[int, int], ciphertext: int) -> int: 使用 RSA 私钥解密数据
    • RSA_help(): 显示帮助信息
  • xyz_tools_plus.sort 排序模块
    • quick_sort: 使用快速排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • shell_sort: 使用希尔排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • heap_sort: 使用堆排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • bucket_sort: 使用桶排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • insertion_sort: 使用插入排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • bubble_sort: 使用冒泡排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • merge_sort: 使用归并排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • selection_sort: 使用选择排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • counting_sort: 使用计数排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • radix_sort: 使用基数排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • sort_help: 显示可用的排序算法列表f
  • xyz_tools_plus.morse 摩斯电码模块
    • morse(input_string): 将字符串转换为摩尔斯电码
    • unmorse(morse_code): 将摩尔斯电码转换为字符串
    • morse_help(): 打印摩尔斯电码的使用帮助信息
  • xyz_tools_plus.puzzle puzzle求解模块
    • solve_24_num_puzzle(board):函数用于求解 5x5 数字华容道问题
      • 参数:
        • board: 初始 5x5 矩阵,格式为二维元组,例如 ((1, 2, 3, 4, 5), (6, 7, 8, 9, 10), ...)。
      • 返回值:
        • 如果有解,则返回解决方案路径(字符串形式),例如 'UURDL'。
        • 如果无解,则返回空字符串。
    • puzzle_help: puzzle_help函数用于打印可用函数的帮助信息。
  • xyz_tools_plus.mod 整除特征模块
    • mod2(n): 判断 n 是否能被 2 整除
    • mod3(n): 判断 n 是否能被 3 整除
    • mod4(n): 判断 n 是否能被 4 整除
    • mod5(n): 判断 n 是否能被 5 整除
    • mod6(n): 判断 n 是否能被 6 整除
    • mod7(n): 判断 n 是否能被 7 整除
    • mod8(n): 判断 n 是否能被 8 整除
    • mod9(n): 判断 n 是否能被 9 整除
    • mod_help(): 显示所有可用的函数
  • xyz_tools_plus._random 随机数库(“_”是因为避开random标准库)
    • randint(a, b): 返回[a,b]之间的随机整数
    • randfloat(a, b): 返回[a,b]之间的随机浮点数
    • randlst(a, b, n): 返回[a,b]之间的n个随机整数
    • randls_float(a, b, n): 返回[a,b]之间的n个随机浮点数
    • randint_notsame(a, b): 返回[a,b]之间的不重复随机整数
    • randfloat_notsame(a, b): 返回[a,b]之间的不重复随机浮点数
    • randlst_notsame(a, b, n): 返回[a,b]之间的n个不重复随机整数
    • randls_float_notsame(a, b, n): 返回[a,b]之间的n个不重复随机浮点数
    • random_help(): 显示帮助信息
  • xyz_tools_plus._hash 哈希库 (“_”是因为避开hash标准库)
    • sha256(input_string: str) -> str: 使用 SHA-256 算法加密字符串
    • sha512(input_string: str) -> str: 使用 SHA-512 算法加密字符串
    • sha3_256(input_string: str) -> str: 使用 SHA3-256 算法加密字符串
    • sha3_512(input_string: str) -> str: 使用 SHA3-512 算法加密字符串
    • hash_help(): 提供模块帮助信息
  • xyz_tools_plus_plus.AI AI模块
    • ask_ollama(model_name, prompt): 调用本地Ollama运行指定的模型。
    • AI_help(): 显示帮助信息。
更新日志
  • 日期 版本号 内容
  • 2025.5.22 0.1.6 修复错误,修复README
  • 2025.5.9 0.1.5 修复错误,修复README,新增AI中ollama支持
  • 2025.5.8 0.1.4 修复错误
  • 2025.5.8 0.1.4-beta4 修复错误
  • 2025.5.8 0.1.4-beta3 修复错误
  • 2025.5.8 0.1.4-beta2 修复错误
  • 2025.5.8 0.1.4-beta1 修复错误
  • 2025.5.8 0.1.3 紧急修复重大错误
  • 2025.5.8 0.1.2 紧急修复重大错误
  • 2025.5.8 0.1.1 修复依赖错误
  • 2025.5.8 0.1.0 从mlymath分离出分支xyz_tools_plus,修复了README.md中的错误,新增sha512,mean,geo_sum,arith_sum

mly万岁!!!🎉

wyy万岁!!!🎉

sty万岁!!!🎉

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xyz_tools_plus-0.1.6.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xyz_tools_plus-0.1.6-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file xyz_tools_plus-0.1.6.tar.gz.

File metadata

  • Download URL: xyz_tools_plus-0.1.6.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for xyz_tools_plus-0.1.6.tar.gz
Algorithm Hash digest
SHA256 12ffe670b8a576563d64c01b663a9567a7d19bb95fd306fe2e3262091976a609
MD5 c5771c54a2a7ece81f05daf146cf0fb9
BLAKE2b-256 1ec025fd762e32073a271759921f09c711bcd6f35f045ed22f2e2a042ceaeba9

See more details on using hashes here.

File details

Details for the file xyz_tools_plus-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: xyz_tools_plus-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for xyz_tools_plus-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 95ac5b2a659080d5fb77cbfe29f5b106d6fdc27b143d30acff56167ea421584a
MD5 070e324442a15212017bcb7a7b5d9580
BLAKE2b-256 74fe7eaadcec460f7b899d19825113c09f183eb13413b47c13bf3850df8293ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page