Saravanan666/pypi-org huggingface dataset:
Package: cqh-file-watcher
something likeFile-Watcherfor vscodeUsagecqh_file_watcher-c***.confconf exampleuse pattern{"command_list":[
    {
        "pattern": "*.py",
        "command": "sudo supervisorctl restart redis"
    }
],
"directory": "/home/vagrant/code/code1"
}no pattern{"command_list":[

    {
        "command": "echo things changed"
    }
],
"directory": "/home/vagrant/code/code1"
}directory for command{"command_list":[
    {
        "pattern": "*.py",
        "command": "sudo supervisorctl restart redis"
        "directory":  "/home/vagrant"
    }
]
"directory": "/home/vagrant/code/code1"
}add ignore pattern for one{"command_list":[
    {
        "pattern": "*.py",
        "ignore_pattern": ["_build/.*"],
        "command": "sudo supervisorctl restart redis"
        "directory":  "/home/vagrant"
    }
]
"directory": "/home/vagrant/code/code1"
}add ignore pattern for multi{"command_list":[
    {
        "pattern": "*.py",
        "ignore_pattern": ["_build/.*" , "_download/.*", "^css/.*", "^_static/.*"],
        "command": "sudo supervisorctl restart redis"
        "directory":  "/home/vagrant"
    }
]
"directory": "/home/vagrant/code/code1"
}use DIRECTORY env{"command_list":[
    {
        "pattern": "*.py",
        "ignore_pattern": ["_build/.*" , "_download/.*", "^css/.*", "^_static/.*"],
        "command": "sudo supervisorctl restart redis"
        "directory":  "/home/vagrant"
    }
]
"directory": "${DIRECTORY}"
}some problemssre_constants.error: nothing to repeat at position 0config{"command_list":[
    {
        "pattern": "*\\.py",
        "ignore_pattern": ["_build/.*" , "_download/.*", "^css/.*", "^_static/.*"],
        "command": "${DIRECTORY}/venv/bin/invoke gpush"
    }
],
"directory": "${DIRECTORY}"
}replacepattern:"*\\.py"withpatter:".*\\.py"
Package: cqh-psum
UsageExample统计一个进程cqh_psum--name=python统计多个进程cqh_psum--name=python,coder,nginx忽略某些进程cqh_psum--name=supervisor--exclude=supervisorctl,grep查看具体的进程cqh_psum--name=supervisor--show=1and查新cqh_psum--name=supervisor__supervisorctl--show=1显示所有进程, 这个*是特殊处理的cqh_psum--name=*--show=1
Package: cqh-tail
python tailcopy fromactivestateUsagewatch dircqh_tail --pattern=~/**/*.logwatch dir and filtercqh_tail --pattern=~/**/*.log --line-filter="\.general/"problemsUnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x82 in position 0: invalid start byteTraceback (most recent call last):
File "/home/deploy/envs/default/bin/cqh_tail", line 8, in <module>
    sys.exit(main())
File "/home/deploy/envs/default/lib/python3.6/site-packages/cqh_tail/run.py", line 318, in main
    w = LogWatcher(pattern, tail_lines=count, callback=echo)
File "/home/deploy/envs/default/lib/python3.6/site-packages/cqh_tail/run.py", line 66, in __init__
    self._callback(file.name, lines)
File "/home/deploy/envs/default/lib/python3.6/site-packages/cqh_tail/run.py", line 313, in echo
    line = line.decode(convert_args.encode)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 0: invalid start byte
Package: cqhttp
CQHTTP Python SDK本项目为 CQHTTP 插件的 Python SDK，封装了 web server 相关的代码，让使用 Python 的开发者能方便地开发插件。关于 CQHTTP 插件，见richardchien/coolq-http-api。用法首先安装cqhttp包：pipinstallcqhttp注意可能需要把pip换成pip3。本 SDK 依赖于Flask和requests包，因此它们也会被安装。也可以克隆本仓库之后用python setup.py install来安装。然后新建 Python 文件，运行 bot：fromcqhttpimportCQHttpbot=CQHttp(api_root='http://127.0.0.1:5700/',access_token='your-token',secret='your-secret')@bot.on_messagedefhandle_msg(event):bot.send(event,'你好呀，下面一条是你刚刚发的：')return{'reply':event['message'],'at_sender':False}@bot.on_notice('group_increase')# 如果插件版本是 3.x，这里需要使用 @bot.on_eventdefhandle_group_increase(event):bot.send(event,message='欢迎新人～',auto_escape=True)# 发送欢迎新人@bot.on_request('group','friend')defhandle_request(event):return{'approve':True}# 同意所有加群、加好友请求bot.run(host='127.0.0.1',port=8080,debug=True)创建实例首先创建CQHttp类的实例，传入api_root，即为 CQHTTP 插件的监听地址，例如http://127.0.0.1:5700，如果你不需要调用 API，也可以不传入。Access token 和签名密钥也在这里传入，如果没有配置access_token或secret项，则不传。事件处理on_message、on_notice、on_request、on_meta_event装饰器分别对应插件的四个上报类型（post_type），括号中指出要处理的消息类型（message_type）、通知类型（notice_type）、请求类型（request_type）、元事件类型（meta_event_type），一次可指定多个，如果留空，则会处理所有这个上报类型的上报。在上面的例子中handle_msg函数将会在收到任意渠道的消息时被调用，handle_group_increase函数会在群成员增加时调用。上面装饰器装饰的函数，统一接受一个参数，即为上报的数据，具体数据内容见事件上报；返回值可以是一个字典，会被自动作为 JSON 响应返回给 CQHTTP 插件，具体见上报请求的响应数据格式。API 调用在设置了api_root的情况下，直接在CQHttp类的实例上就可以调用 API，例如bot.send_private_msg(user_id=123456, message='hello')，这里的send_private_msg即为/send_private_msg发送私聊消息中的/send_private_msg，API 所需参数直接通过命名参数（keyword argument）传入。其它 API 见API 列表。为了简化发送消息的操作，提供了send(context, message)函数，这里的第一个参数context也就是上报数据，传入之后函数会自己判断当前需要发送到哪里（哪个好友，或哪个群），无需手动再指定，其它参数仍然可以从 keyword argument 指定，例如auto_escape=True。每个 API 调用最后都会由requests库来发出请求，如果网络无法连接，它可能会抛出ConnectionError等异常，见错误与异常。而一旦请求成功，本 SDK 会判断 HTTP 响应状态码，只有当状态码为 200，且status字段为ok或async时，会返回data字段的内容，否则抛出cqhttp.Error异常，在这个异常中你可以通过status_code和retcode属性来获取 HTTP 状态码和插件的retcode（如果状态码不为 200，则retcode为 None），具体响应状态码和retcode的含义，见响应说明。运行实例使用装饰器定义好处理函数之后，调用bot.run()即可运行。你需要传入host和port参数，来指定服务端需要运行在哪个地址，然后在 CQHTTP 插件的配置文件中，在post_url项填写此地址（http://host:port/）。CQHttp Helper项目根目录下的cqhttp_helper.py文件是SuperMarioSF贡献的帮助类，在CQHttp类的基础上提供了每个 API 调用的具体函数，以便在支持的代码编辑器中使用代码补全和文档速览。注意，此文件不在 pip 安装的包中，需单独下载，如果以后插件新增接口，此文件可能没有及时更新，但不影响使用，你仍然可以像使用原始的CQHttp一样使用它。部署bot.run()只适用于开发环境，不建议用于生产环境，因此 SDK 从 1.2.1 版本开始提供bot.wsgi属性以获取其内部兼容 WSGI 的 app 对象，从而可以使用 Gunicorn、uWSGI 等软件来部署。添加路由CQHttp内部使用Flask来提供 web server，默认添加了 bot 所需的/路由，如需添加其它路由，例如在/admin/提供管理面板访问，可以通过bot.server_app访问内部的Flask实例来做到：app=bot.server_app@app.route('/admin')asyncdefadmin():return'This is the admin page.'目前bot.server_app和bot.wsgi等价。更新日志更新日志见CHANGELOG.md。遇到问题本 SDK 的代码非常简单，如果发现有问题可以参考下源码，可以自行做一些修复，也欢迎提交 pull request 或 issue。
Package: cqhttpsdk
go-cqhttpSDK——依赖于go-cqhttp，需要先正确安装并运行，使用HTTP协议，使你更方便的请求go-cqhttpAPI使用方法：到go-cqhttpSDK下载go_cqhttpsdk.py并引入或者pip install cqhttpsdk实例化sdk方法sdk = go_cqhttpsdk.sdk设置API的url地址sdk.url = 'http://127.0.0.1:5700'开始使用例子：import go_cqhttpsdk as sdk
sdk = sdk.sdk()
sdk.url = "http://127.0.0.1:5700"
sdk.发送私聊消息(3192145045,'','你好')
sdk.send_private_msg(3192145045,'','hello shizhi')感谢：requests，go-cqhttp，tencent小提示:配置文件config.yml内容account: # 账号相关
  uin: # QQ账号
  password: '' # 密码为空时使用扫码登录
  encrypt: false  # 是否开启密码加密
  status: 0      # 在线状态 请参考 https://docs.go-cqhttp.org/guide/config.html#在线状态
  relogin: # 重连设置
  delay: 3   # 首次重连延迟, 单位秒
  interval: 3   # 重连间隔
  max-times: 0  # 最大重连次数, 0为无限制

  # 是否使用服务器下发的新地址进行重连
  # 注意, 此设置可能导致在海外服务器上连接情况更差
  use-sso-address: true

heartbeat:
  # 心跳频率, 单位秒
  # -1 为关闭心跳
  interval: 5

message:
  # 上报数据类型
  # 可选: string,array
  post-format: string
  # 是否忽略无效的CQ码, 如果为假将原样发送
  ignore-invalid-cqcode: false
  # 是否强制分片发送消息
  # 分片发送将会带来更快的速度
  # 但是兼容性会有些问题
  force-fragment: false
  # 是否将url分片发送
  fix-url: false
  # 下载图片等请求网络代理
  proxy-rewrite: ''
  # 是否上报自身消息
  report-self-message: false
  # 移除服务端的Reply附带的At
  remove-reply-at: false
  # 为Reply附加更多信息
  extra-reply-data: false
  # 跳过 Mime 扫描, 忽略错误数据
  skip-mime-scan: false

output:
  # 日志等级 trace,debug,info,warn,error
  log-level: warn
  # 日志时效 单位天. 超过这个时间之前的日志将会被自动删除. 设置为 0 表示永久保留.
  log-aging: 15
  # 是否在每次启动时强制创建全新的文件储存日志. 为 false 的情况下将会在上次启动时创建的日志文件续写
  log-force-new: true
  # 是否启用 DEBUG
  debug: false # 开启调试模式

# 默认中间件锚点
default-middlewares: &default
  # 访问密钥, 强烈推荐在公网的服务器设置
  access-token: ''
  # 事件过滤器文件目录
  filter: ''
  # API限速设置
  # 该设置为全局生效
  # 原 cqhttp 虽然启用了 rate_limit 后缀, 但是基本没插件适配
  # 目前该限速设置为令牌桶算法, 请参考:
  # https://baike.baidu.com/item/%E4%BB%A4%E7%89%8C%E6%A1%B6%E7%AE%97%E6%B3%95/6597000?fr=aladdin
  rate-limit:
    enabled: false # 是否启用限速
    frequency: 1  # 令牌回复频率, 单位秒
    bucket: 1     # 令牌桶大小

database: # 数据库相关设置
  leveldb:
    # 是否启用内置leveldb数据库
    # 启用将会增加10-20MB的内存占用和一定的磁盘空间
    # 关闭将无法使用 撤回 回复 get_msg 等上下文相关功能
    enable: true

# 连接服务列表
servers:
  # 添加方式，同一连接方式可添加多个，具体配置说明请查看文档
  #- http: # http 通信
  #- ws:   # 正向 Websocket
  #- ws-reverse: # 反向 Websocket
  #- pprof: #性能分析服务器
  # HTTP 通信设置
  - http:
      # 服务端监听地址
      host: 0.0.0.0
      # 服务端监听端口
      port: 5700
      # 反向HTTP超时时间, 单位秒
      # 最小值为5，小于5将会忽略本项设置
      timeout: 5
      # 长轮询拓展
      long-polling:
        # 是否开启
        enabled: false
        # 消息队列大小，0 表示不限制队列大小，谨慎使用
        max-queue-size: 2000
      middlewares:
       <<: *default # 引用默认中间件
      # 反向HTTP POST地址列表
      post :
      #- url: '' # 地址
      #  secret: ''           # 密钥
      - url: 'http://localhost:5000/' # 地址
      secret: ''          # 密钥
Package: cqi
CQi SDK for PythonA Python library for theIMS Open Corpus Workbench(CWB)Corpus Query Interface(CQi) API.InstallationThe latest stable versionis available on PyPI. Either addcqito yourrequirements.txtfile or install with pip:pip install cqiVersion compatibilityPackage versionProtocol version0.1.0 - 0.1.70.1Usageimportcqiclient=cqi.CQiClient('127.0.0.1')client.connect(username='anonymous',password='')# <class 'cqi.status.StatusConnectOk'>client.ping()# <class 'cqi.status.StatusPingOk'>corpus=client.corpora.get('CORPUS')# <Corpus: CORPUS>corpus.query('"and" []* "the";','Results')# <class 'cqi.status.StatusOk'>results=corpus.subcorpora.get('Results')# <Subcorpus: CORPUS:Results>client.disconnect()# <class 'cqi.status.StatusByeOk'>
Package: cql
A Python driver for CQL that adheres to py-dbapi v2(PEP249, Python Database API Specification v2.0:  http://www.python.org/dev/peps/pep-0249/).Standard use:>> import cql>> con = cql.connect(host, port, keyspace)>> cursor = con.cursor()>> cursor.execute("CQL QUERY", dict(kw='Foo', kw2='Bar, etc...))- cursor.description  # None initially, list of N tuples that representthe N columns in a row after an execute. Onlycontains type and name info, not values.- cursor.rowcount     # -1 initially, N after an execute- cursor.arraysize    # variable size of a fetchmany call- cursor.fetchone()   # returns  a single row- cursor.fetchmany()  # returns  self.arraysize # of rows- cursor.fetchall()   # returns  all rows, don't do this.>> cursor.execute("ANOTHER QUERY", **more_kwargs)>> for row in cursor:  # Iteration is equivalent to lots of fetchone() calls>>     doRowMagic(row)>> cursor.close()>> con.close()Query substitution:- Use named parameters and a dictionary of names and values.e.g. execute("SELECT * FROM CF WHERE name=:name", {"name": "Foo"})
Package: cqlite
cqliteQuery a CSV file from the commandlineInstallationpipx install cqliteUsageIn memory query:cqlite<csv_file><query>e.g.cqlitefakedata.csv"SELECT * FROM csv WHERE name LIKE '%Tommy% AND date_of_birth < '1980-01-01';"(note filedata is loaded into a table called "csv").Save `<csv_file>.csv as a SQLite database (<csv_file>.db):cqlite<csv_file>--persist
Package: cqljupyter
A Jupyter kernel for Apache CassandraTo install:pip install cqljupyterTo configure the Cassandra host or IP address:python -m cqljupyter.install  [<hostname> <port>] [--ssl] [-u user] [-p password]You can always rerun the above command to change the connection. It's best to restart Jupyter after running it.
You can often get away with closing your notebook, and then refreshing the main Jupyter page too, but that's
error-prone.then start the notebook:jupyter notebookIn the notebook interface, selectCQLfrom theNewmenuTo run the sample CQL:jupyter notebook Sample.ipynbSyntaxAll standard CQL syntax is supported since this package reuses the CQLSH python module.Auto-completeUse theTABkey to invoke auto-completeHTMLIf you start a cell with%%html, the html will be returned and renderedBuildBuild using:python -m buildImplementation NotesThe cqlsh.py script was ported from 3.11 and converted using 2to3 to python3
syntaxhttps://github.com/apache/cassandra/blob/cassandra-3.11.10/bin/cqlsh.pyToDo: upgrade to Cassandra 4.0 cqlshFor details of how this works, see these Jupyter docs:Making simple Python wrapper kernelsMaking kernels for JupyterAuthorThis package was developed by Brad Schoening for Python 3. It is based upon earlier work
by Steve Lowenthal and uses the open source Apache Cassandra CQLSH library.LicenseThis project is licensed under the terms of theApache 2.0 license.
Package: cql_kernel
A Jupyter kernel for the Apache Cassandra DatabaseTo install::pip install cql_kernelpython -m cql_kernel.install  [<cassandra hostname>]You can always rerun the the above command to change the hostname.  It's best to restart Jupyter after running it.You can get away with closing your notebook, and then refreshing the main Jupyter page too, but that's error-prone.To use it, run one of::ipython notebook# In the notebook interface, select CQL from the 'New' menuipython qtconsole --kernel cqlipython console --kernel cqlSyntax::All regular cqlsh syntax is supported.Auto-complete::Use the <TAB> key to invoke auto-complete%%html magic::If you start a cell with %%html, the html will be returned and renderedFor details of how this works, see the Jupyter docs on `wrapper kernels<http://jupyter-client.readthedocs.org/en/latest/wrapperkernels.html>`_, andPexpect's docs on the `replwrap module<http://pexpect.readthedocs.org/en/latest/api/replwrap.html>`_To build::python setup.py sdist uploadpython setup.py bdist upload
Package: cql-parser
CQL (Contextual Query Language) Parser (for Python)Grammar and SpecificationNoticePrefix parsing and resolution is still work-in-progress!
Test cases mostly check out but it definitely needs to be finished before
using in real world scenarios.RequiresPython 3.8+ (only tested on 3.8.10)ply(github version)- vendored insrc/cql/_vendor/plypytestfor testingBuilding# see: https://setuptools.pypa.io/en/latest/build_meta.htmlpython3-mpipinstall-qbuild
python3-mbuildInstall# built packagepython3-mpipinstalldist/cql_parser-<version>-py2.py3-none-any.whl# orpython3-mpipinstalldist/cql-parser-<version>.tar.gz# for local developmentpython3-mpipinstall-e.[test]UsageReally quick:importcqlprint(cql.parse("dc.title any fish").toXCQLString(pretty=True))A bit more involved:importlogginglogging.basicConfig(level=logging.DEBUG)fromcql.parserimportCQLParser12# use CQL version 1.2 parsercqlparser=CQLParser12()query=cqlparser.run("dc.title any fish")# do something with the outputprint(query.toCQL())print(query.toXCQLString(pretty=True))A for a deeper dive, take a look atsrc/cql/__init__.pyor the various test files intests/.DevelopmentUsespytest(with coverage, clarity and randomly plugins).See test files intests/folder. Theregressiontest files are a copy fromindexdata/cql-javaand are not included in the built package.TheXCQLserialization differs slightly from the onlyCQL Python 'library'I could find.As for changing the lexer or parser, seeplydocs.Run all tests with:# install test dependenciespython3-minstall-e.[test]# runpytestRun style checks:python3-mpipinstall-e.[style]black--check.
flake8.--show-source--statistics
isort--check--diff.# building the package:python3-mpipinstall-e.[build]python3-mbuild
twinecheck--strictdist/*Vendor dependencies:python3-mpipinstall-e.[vendor]vendoringsync# NOTE: some changes still not automated ...gitcheckout--src/cql/_vendor/ply/LICENSESee alsohttp://zing.z3950.org/cqlhttp://www.loc.gov/standards/sru/cql/index.htmlOther implementations:Java,JavaScript, etc.
Package: cqls
Corpus Query Langauge SubsetParse Corpus Query Language into a list of queries in JSON format.InstallationpipinstallcqlsUsage>>>importcqls>>>cql='''... "我" [pos="V."]+... '''>>>cqls.parse(cql,default_attr="word",max_quant=5)[[{'match':{'word':['我']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}}],[{'match':{'word':['我']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}}],[{'match':{'word':['我']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}}],[{'match':{'word':['我']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}}],[{'match':{'word':['我']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}},{'match':{'pos':['V.']},'not_match':{}}]]Supported CQL featurestoken:[],"我",[word="我"],[word!="我" & pos="N.*"]token-level quantifier:+,*,?,{n,m}grouping:("a" "b"? "c"){1,2}label:lab1:[word="我" & pos="N.*"] lab2:("a" "b")
Package: cqml
cqmlComposable Query Meta LanguageCQML is declarative data format for specifying complete data analysis pipelines.  It is most commonly implemented as YAML, but can trivially be transformed into JSON, CSON, or macOS and Java property lists.The initial back-end is written for the DataBrick's flavor of PySpark and Spark SQL, but should be easy to extend to other databases and warehouses.USAGE#pip install git+https://github.com/TheSwanFactory/cqml.git@main #@v3-daily
pip install cqml #==0.3.0
import cqmlTestingFrom top-level directory:$ python3 -m pip install -r requirements.txt
$ pip install pytest
$ python3 -m pytestBuilding the Packages$ python3 -m pip install --upgrade build
$ python3 -m pip install --upgrade twine
$ prerelease && release && python3 -m build && python3 -m twine upload dist/* && postreleaseDevelopment Buildawk -Fv '{printf("%sv%d\n",$1,v$2+1)}' version.txt > /tmp/version.txt && cp /tmp/version.txt version.txt && git commit -a && git push
Package: cqparts
What iscqparts?cqpartsis CAD for Python programmers, short for “cadqueryparts”.Usingcqpartsyou can wrap geometry made withcadqueryto build complex
and deeply parametric models.Full documentation at:https://fragmuffin.github.io/cqpartsInstallingPre-requisitesYou’ll need to fulfill the requirements ofcadquery, the simplest way to do
that is to installcadqueryfirst by following the instructions here:http://dcowden.github.io/cadquery/installation.htmlPyPIOncecadqueryis installed, installcqpartswith:pip install cqpartscqparts_*Content LibrariesYou can also install content libraries with a similarpip installcommand.List available libraries with:pip search cqparts_For example, to install thecqparts_bearingscontent library, run:pip install cqparts_bearingsExample UsageHere is just one of the simplest examples to give you an idea of what this
library does.More detailed examples found inthe official documentation for cqparts.Wrapping a CubeA simple cube defined withcadqueryalone:# create unit cube solid
import cadquery
size = 10
cube = cadquery.Workplane('XY').box(size, size, size)

# display cube (optional)
from Helpers import show
show(cube)Wrapping this in acqparts.Partobject can be done like this:# create unit cube as cqparts.Part
import cadquery
import cqparts
from cqparts.params import PositiveFloat

class MyCube(cqparts.Part):
    size = PositiveFloat(1, doc="cube size")
    def make(self):
        return cadquery.Workplane('XY').box(self.size, self.size, self.size)

# create cube instance
cube = MyCube(size=10)

# display cube (optional)
from cqparts.display import display
display(cube)You can see that under the bonnet (in themakefunction) the geometry is
created withcadquery, but the resultingMyCubeclass is instantiated
more intuitively, and more object orientated.Creating a Hierarchycqpartscan also be used to create a deep hierarchy ofpartsandassembliesto build something deeply complicated and entirely parametric.A simple example of this is thetoy car tutorial.cqpartsCapabilitiesThe work done incqparts_fastenersis a good example of how usefulcqpartswrapping can be; read about theFastenerclass, how it works,
and what can be done with it in thecqparts_fasteners docsContributingIssues, and Pull Requests are encouraged, and happily received, please readCONTRIBUTING.mdfor guidance on how to contribute.
Package: cqparts-bearings
ComponentsBall BearingsTapered Roller BearingsExamplesBallBearingCreate a ball bearing with:from cqparts_bearings.ball import BallBearing

bearing = BallBearing(
    # outer edges
    inner_diam=8,
    outer_diam=20,
    width=5,

    # internal rolling elements
    ball_count=6,
    ball_diam=4,
)

# display [optional]
from cqparts.display import display
display(bearing)

# export model to file, various formats available [optional]
bearing.exporter('gltf')('bearing.gltf')AllBallBearingparameters are documentedhere.The bearing is generated in the following hierarchy:>>> print(bearing.tree_str())
<BallBearing: angle=0.0, ball_count=6, ball_diam=4.0, ball_min_gap=0.4, inner_diam=8.0, inner_width=2.0, outer_diam=20.0, outer_width=2.0, rolling_radius=7.0, tolerance=0.001, width=5.0>
 ├○ inner_ring
 ├○ outer_ring
 └─ rolling_elements
     ├○ ball_000
     ├○ ball_001
     ├○ ball_002
     ├○ ball_003
     ├○ ball_004
     └○ ball_005
Package: cqparts-fasteners
ComponentsBase ComponentsFew of these are useful on their own, they’re used to build more complex parts.HeadsCounter-sunk varietiesCylindrical varietiesExternally Driven (eg: hex head)Drive TypesCruciform varieties (eg: phillips, frearson)Hex (aka: alan) varietiesSquare varieties (eg: single, double, triple square)SlottedTamper Resistant varietiesThreadsStandard threads included:ISO68 (standard for metric bolts)Triangular (eg: for woodscrews)Ball ScrewAny custom thread can be built by creating aprofileas aWirefrom within
an object inheriting from the baseThreadclass.
(read more here)NoteThreads currently bugged byissue #1.Threads are currently simplified to a cylinder until this is fixed.Warning when using for 3d printing, threads will not form correctly until the
bug is fixed… please+1the issue if you’d like to use properly formed
threads.Male Fastener ComponentsBoltsScrewsFemale Fastener ComponentsNutsUtilitiesTheFastenersutility assembly can be used to automatically apply fasteners
to arbitrary materials.For example, with the following 2 detatched blocks:AFastenercan be applied to these two blocks to hold them together in a
variety of ways, with varied parameters, such as these 2 exmples:More detailed examples of customizing aFasteneraredocumented here.Catalogue(s)BoltDepotboltdepot.comhas an exceptional website for
details of their products, enough to build 3d models accurate enough for most
applications.At this time, the catalogue you get with this library contains some of the
products forboltdepot.comin the categories:Bolts :boltdepot-bolts.jsonNuts :boltdepot-nuts.jsonWoodscrews :boltdepot-woodscrews.jsonOther SuppliersWith increased interest in this library I would like to see this list grow, but
at this time, it’s just the catalogues listed above.ExamplesMachine ScrewWe can create a fastener with many tuned parameters, for this example we’ll create
an M3 machine screw, 4mm long, with a domed cheese head, and a 2mm hex drive:from cqparts_fasteners.male import MaleFastenerPart

screw = MaleFastenerPart(
    head=('cheese', {
        'diameter': 4.5,
        'height': 1.5,
        'domed': True,
        'dome_ratio': 0.5,
    }),
    drive=('hex', {
        'depth': 1,
        'width': 2,
    }),
    thread=('iso68', {
        'diameter': 3,  # M3
    }),
    length=4,
)

from cqparts.display import display
display(screw)CatalogueBoltWith use of aJSONCataloguewe can search for all fasteners within that
catalogue that suit certain parameters, such as length, diameter, anything used
as a parameter to build the part.For this example, we’ll explicitly define the product’sid, guarenteeing
only one result is returned:import os

from cqparts.catalogue import JSONCatalogue
import cqparts_fasteners

catalogue_filename = os.path.join(
    os.path.dirname(cqparts_fasteners.__file__),
    'catalogue',
    'boltdepot-bolts.json',
)
catalogue = JSONCatalogue(catalogue_filename)
item = catalogue.get_query()
bolt = catalogue.get(item.id == '221')

from cqparts.display import display
display(bolt)This should generate an accurate model for BoltDepot’sproduct #221.