Skip to main content

NoneBot2 编程命名风格快速转换插件 (snake_case / camelCase / PascalCase / kebab-case / UPPER_SNAKE_CASE / Train-Case)

Project description

nonebot

nonebot-plugin-namepy

✨ NoneBot2 编程命名风格快速转换插件 ✨

license python nonebot

📖 介绍

写代码时经常被 userName / user_name / USER_NAME 之间的转换打断思路?这个插件让你在群聊里一句话搞定。

支持在以下 6 种命名风格之间互转,自带智能分词,能正确处理形如 XMLParserHTTP_url2name 的混合大小写与缩写组合:

  • snake_case
  • camelCase
  • PascalCase
  • kebab-case
  • UPPER_SNAKE_CASE
  • Train-Case

💿 安装

使用 nb-cli 安装
nb plugin install nonebot-plugin-namepy
使用包管理器安装
pip install nonebot-plugin-namepy

poetry add nonebot-plugin-namepy

打开 NoneBot 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入:

plugins = ["nonebot_plugin_namepy"]

🎉 使用

指令 说明 示例
/命名 <标识符> 一次性展示全部 6 种风格 /命名 user_name
/驼峰 <标识符> camelCase /驼峰 user_nameuserName
/大驼峰 <标识符> PascalCase /大驼峰 user_nameUserName
/下划线 <标识符> snake_case /下划线 userNameuser_name
/常量 <标识符> UPPER_SNAKE_CASE /常量 userNameUSER_NAME
/中划线 <标识符> kebab-case /中划线 userNameuser-name
/标题 <标识符> Train-Case /标题 user_nameUser-Name

支持的别名:大驼峰帕斯卡下划线蛇形常量大写下划线大下划线中划线连字符标题火车

🔍 智能分词

输入 /命名 XMLParserHTTP_url2name 会得到:

原始词元:['xml', 'parser', 'http', 'url', '2', 'name']
snake_case      : xml_parser_http_url_2_name
camelCase       : xmlParserHttpUrl2Name
PascalCase      : XmlParserHttpUrl2Name
kebab-case      : xml-parser-http-url-2-name
UPPER_SNAKE_CASE: XML_PARSER_HTTP_URL_2_NAME
Train-Case      : Xml-Parser-Http-Url-2-Name

可正确处理:

  • 多重大写缩略词后接小写:HTTPServer["http", "server"]
  • 字母数字交替:v2Tag42["v", "2", "tag", "42"]
  • 已存在的分隔符:user-id_FOO["user", "id", "foo"]

📄 许可

本项目采用 MIT License

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

nonebot_plugin_namepy-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

nonebot_plugin_namepy-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_namepy-0.1.0.tar.gz.

File metadata

  • Download URL: nonebot_plugin_namepy-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for nonebot_plugin_namepy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b7c39e89d95c06af79b44ba613447417b6c4101bf8294a0c76a01673f7ebda53
MD5 eb800ac26bb1beafa8a7fe97a37f3982
BLAKE2b-256 944401fffac4a7c0923e1410ec5178f97920529822fd88487b1c848b712f133b

See more details on using hashes here.

File details

Details for the file nonebot_plugin_namepy-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_namepy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 469676048eedec7ee047e50f98e21e82f7f4fbf9acdf777a1b436a424c88ca55
MD5 8a5f217a5956c31323013de9bff263e8
BLAKE2b-256 4f83da32663b0945ee50a7c0997a74167d3091a8d05134b503dc9ea724e3a075

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