Saravanan666/pypi-org huggingface dataset:
Package: txt2hpo
txt2hpotxt2hpois a Python library for extracting HPO-encoded phenotypes from text.txt2hporecognizes differences in inflection (e.g. hypotonic vs. hypotonia), handles negation and comes with a built-in medical spellchecker.InstallationInstall using pippipinstalltxt2hpoInstall from GitHubgitclonehttps://github.com/GeneDx/txt2hpo.gitcdtxt2hpo
pythonsetup.pyinstallLibrary usagefromtxt2hpo.extractimportExtractorextract=Extractor()result=extract.hpo("patient with developmental delay and hypotonia")print(result.hpids)["HP:0001263","HP:0001290"]txt2hpowill attempt to correct spelling errors by default, at the cost of slower processing.
This feature can be turned off by setting thecorrect_spellingflag toFalse.fromtxt2hpo.extractimportExtractorextract=Extractor(correct_spelling=False)result=extract.hpo("patient with devlopental delay and hyptonia")print(result.hpids)[]txt2hpohandles negation usingnegspaCy. To remove negated phenotypes setremove_negatedflag to True.
Both the extracted and negated HPO terms can be retrieved.fromtxt2hpo.extractimportExtractorextract=Extractor(remove_negated=True)result=extract.hpo("patient has developmental delay but no hypotonia")print(result.hpids)["HP:0001263"]print(result.negated_hpids)["HP:0001252"]txt2hpopicks the longest overlapping phenotype by default. To disable this feature setremove_overlappingflag to False.fromtxt2hpo.extractimportExtractorextract=Extractor(remove_overlapping=False)result=extract.hpo("patient with polycystic kidney disease")print(result.hpids)["HP:0000113","HP:0000112"]extract=Extractor(remove_overlapping=True)result=extract.hpo("patient with polycystic kidney disease")print(result.hpids)["HP:0000113"]txt2hpooutputs a valid JSON string, which contains information about extracted HPIDs, their character span and matched string.fromtxt2hpo.extractimportExtractorextract=Extractor()result=extract.hpo("patient with developmental delay and hypotonia")print(result.json)'[{"hpid": ["HP:0001290"], "index": [37, 46], "matched": "hypotonia"},{"hpid":["HP:0001263"],"index":[13,32],"matched":"developmental delay"}]'
Package: txt2image
Make it easy to add text to an image.Installpip install txt2imageExamplesTake a look in the example folder. The first example only shows the different
tools you can use to create your own images. For the second example you need the
package requests.:pip install requestsThe third example shows the QuoteImage-class.DevelopmentClone repo:git clone https://github.com/axju/txt2image.gitCreate virtual environment and update dev-tools:python3 -m venv venv
source venv/bin/activate
pip install --upgrade wheel pip setuptools twine toxInstall local:pip install -e .Run some tests:tox
python setup.py testPublish the packages:python setup.py sdist bdist_wheel
twine upload dist/*
Package: txt2img
txt2img is a python tool to convert the text into a image.1. IntroductionNormally people read the text in the .txt file. Sometimes there are needs for
people to render the text into an image, for example you don’t want the text
being copied, or you’d like to render the ascii art with colors, etc.2. how to use itAfter install, you can convert a text to a picture easily:txt2img input.txt output.pngAfter install, you can also embed the asciiart directly into a html or pdf
document with my developed script: sphinxcontrib-cmd2img, for examples:.. cmd2img:: txt2img
    :caption: a flower

    .· .·.   [1;35m/╲     /|[0m
            ·[1;35m│  \  ╱ |[0m
       [1;35m\-.___ / \  \/ / /[0m
        [1;35m\ __ ╲  [1;33m.,.[1;35m| ╱__[0m
        [1;35m╱  乁  [1;33m'\|)[1;35m╱￣  ╲[0m
    [1;35m-＜`︶╲__╱ [1;33m︶[1;35m╲    ╲ \[0m
        [35m￣￣ /   /  ╱﹀乀 \│[0m
             [1;35m╲  ' /[1;30m╲  ·╲/[0m
               [1;35m\| /   [1;30m\  ; ｀[0m
                [1;35m\/     [1;30m\  ·,[0m
    .----/[1;35m      ′      [1;30m︳  ·__,[0mMore and more features are in develop.5. CHANGLOG1.0.0 Initial upload;1.0.1 Given a prompt for user to input the font path.1.0.2 Add a new option fontsize to set the font size.1.0.3 Add a new option “spacing” to adjust the line space.1.0.4 Bug fix: When line has ‘m’, it is processed as a control character by wrong.
Package: txt2mobi3-app
Create a simple PyQt5 application for converting Chinese txt files into
mobi files. It wrapstxt2mobi3. Since it
supports Chinese only, the documentation and the code comments are
written in Chinese.1. 安装和运行1.1. 从PyPI安装和运行：$pipinstalltxt2mobi3_app$txt2mobi3_app1.2. 从安装包：Linux下面以Ubuntu 16.04LTS为例：$ sudo dpkg -i target/txt2mobi3_app.debMacOS将txt2mobi3_app.dmg移动到Application中。Windows点击运行txt2mobi3_appSetup.exe。2. 产生安装包这里我们使用fbs来产生Linux、MacOS和Windows上的安装包。注意我们依赖的三个关键python包的版本如下：fbs==0.3.6
PyQt5==5.11.3
PyInstaller==3.42.1. Linux下面以Ubuntu 16.04LTS为例：安装fbm$sudoaptinstallrubyruby-devrubygemsbuild-essential$sudogeminstall--no-ri--no-rdocfpm产生安装包$python-mfbsinstaller生成的安装包txt2mobi3_app.deb会在target目录中。如果想产生一个可以单独运行的可执行文件，那么就运行下面这个fbs命令。$python-mfbsfreeze生成的可执行文件位于target/txt2mobi3_app目录中。将target/txt2mobi3_app目录复制到别的机器上后就可运行其中的可执行文件。2.2. MacOS以macOS Sierra 10.12.6为例：先产生一个可以单独执行的可执行文件。$python-mfbsfreeze产生安装包。$python-mfbsinstaller2.3. Windows如果是Windows 10，你可能需要安装Windows 10
SDK。安装NSIS并将其安装目录添加到PATH环境变量中。产生安装包$python-mfbsinstaller生成的安装包txt2mobi3_appSetup.exe.ext会在target目录中。如果想产生一个可以单独运行的可执行文件，那么就运行下面这个fbs命令。$python-mfbsfreeze3. README.rstREADME.rst is generated from README.md viapandoc.$pandoc--from=markdown--to=rst--output=README.rstREADME.md
Package: txt2tags
Txt2tagsTxt2tags is a document generator. It reads a text file with
minimal markup such as**bold**and//italic//and converts it
to the following formats:AsciiDocCreole 1.0DocBookDokuWikiGoogle WikiHTMLLaTeXLoutMagicPointMarkdownMoinMoinPmWikiPlain TextSGMLUNIX ManpageWikipedia/MediaWikiYou can use it as a command line program or in a Python application.InstallationWe recommend usingpipxto install and run txt2tags in an isolated environment without affecting any system packages:python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install txt2tags
txt2tags --helpOf course you can also use pip to install txt2tags globally or in a virtual environment:pip install -U txt2tagsUsageSimple example for command line usage:Write a text file like this (leave 1st line blank):= Hello =
I'm a robot. You're my **master**!
[smile.jpg]Run this command:txt2tags --target html --no-headers file.t2tThe result is:<H1>Hello</H1>
<P>
I'm a robot. You're my <B>master</B>!
<IMG ALIGN="middle" SRC="smile.jpg" BORDER="0" ALT="">
</P>HistoryAurelio Jargas started the development of Txt2tags in 2001. The program
saw several releases from 2001 to 2010, the last of which was version
2.6. Afterwards, Aurelio became less involved in the development. Still,
many new features were added in the main repository
(https://github.com/txt2tags/txt2tags), but they were never officially
released. In my opinion, many of the new features are only useful for a
very small set of users. The extra code adds bloat to the program and
makes it hard to maintain the code. Unfortunately, these concerns are
not shared by the whole Txt2tags development team. Therefore, I decided
to branch off version 2.6 and maintain a simpler txt2tags version that
works on Python 3. The fileTODO.mdlists the goals for the
project.If you'd like to help out with any of the tasks, please get in touch.
Pull requests are very welcome!
Package: txt2tmx
This script creates a line-to-line aligned tmx fileIt accepts either two sentence-segmented txt files, with one sentence per line in
each file, or one txt file with two tab-delimited elements per line.
Based on that, the script creates a tmx file in the same location as the original file(s).In case of a single tab-delimited file it must have the following format:
'Original-text Tab-char Translation' per each line.You must also pass as the first argument the desired language codes as follows:
-c en-US#ar-SA; -c EN#RU, etc.The default language codes are en-US and ru-RUHow to install on Windows (no admin rights required)Step 1. Get Python 3 from Microsoft StoreStep 2. Get PowerShell from Microsoft StoreStep 3. Create a new folder in your file system on WindowsStep 4. Right-click on that folder and select Open in TerminalStep 5. Write the following in the command line of the open Terminal window:> python3 -m venv .venv
> .\.venv\Scripts\Activate.ps1
> python3 -m pip install txt2tmxHow to useIf you've just finished the installation, type in in the command line (for
a single source file):> python3 -m txt2tmx -c en#ar C:\full-path\your-file.txtOr, in case of two source files:> python3 -m txt2tmx -c en#ar C:\full-path\file_1.txt C:\full-path\file_2.txtIf you already closed PowerShell, use Windows Explorer to find the folder that you created in Step 3 (or simply repeat Steps 3 to 5 if you can't find it). Open that folder in PowerShell Terminal. Then type in the following commands in the PowerShell window:> .\.venv\Scripts\Activate.ps1
> python3 -m txt2tmx -c en#ar C:\full-path\your-file.txt
Package: txt2txt
txt2txt - An extremely easy to use seq2seq implementation with Attention for text to text use casesExamplesAdding two numbersMore Complex Math and fit_generatorInstallationpip install txt2txtTraining a modelfrom txt2txt import build_params, build_model, convert_training_data

input_data = ['123', '213', '312', '321', '132', '231']
output_data = ['123', '123', '123', '123', '123', '123']

build_params(input_data = input_data, output_data = output_data, params_path = 'test/params', max_lenghts=(10, 10))

model, params = build_model(params_path='test/params')

input_data, output_data = convert_training_data(input_data, output_data, params)

checkpoint = ModelCheckpoint('test/checkpoint', monitor='val_acc', verbose=1, save_best_only=True, mode='max')
callbacks_list = [checkpoint]

model.fit(input_data, output_data, validation_data=(input_data, output_data), batch_size=2, epochs=20, callbacks=callbacks_list)Loading a trained model and running inferencefrom txt2txt import build_model, infer
model, params = build_model(params_path='test/params')
model.load_weights('path_to_checkpoint_file')
infer(input_text, model, params)Note: Checkouthttps://github.com/bedapudi6788/deepcorrectfor pre-trained models for english punctuation correction and grammar correction.RequirementsThis module needs Keras and Tensorflow. (tested with tf>=1.8.0, keras>=2.2.0).Tensorflow is not included in setup.py and needs to be installed seperately.What's the use of this moduleWorking with seq2seq tasks in NLP, I realised there aren't any easy to use, simple to understand and good performing libraries available for this. Though libraries like FairSeq or transformer are available they are in general either too complex for a newbie to understand or most probably overkill (and are very tough to train) for simple projects.This module provides pre-built seq2seq model with Attention that performs excellently on most of the "simple" NLP taks. (Tested with Punctuation correction, transliteration and spell correction)To DoMake number of encoder and decoder layers configurableGive option to add language model probability in beam searchLicenseAlthough txt2txt is licensed under GPL, if you want to use it commercially without open sourcing your code please email me or raise a issue in this repo so that I can provide you explicit written permission to use as you wish. The only reason for doing this is, it would be nice to know if some company is using my work.
Package: txt2voice
Text to Audio SDKThe Yandex Text to Audio SDK is a Python package that allows you to convert text to audio using Yandex premium voices. It provides an easy-to-use asynchronous interface for generating audio files from text with customizable voice, speed, and other parameters.InstallationYou can install the SDK from PyPI using pip:pipinstalltxt2voiceQuick StartHere's a simple example demonstrating how to use the SDK to convert text to audio:importasynciofromtxt2voice.apiimportTextToVoice,RequestParamsfromtxt2voice.modelsimportVoiceParams,SpeedParams,AudioContentasyncdefmain():token='YOUR_IAM_TOKEN'folder_id='YOUR_FOLDER_ID'text='Hello, this is an example text for audio conversion!'output_file='output_audio.mp3'api=TextToVoice(url='https://tts.api.cloud.yandex.net/speech/v1/tts:synthesize')convert_params=RequestParams(voice=VoiceParams(male='fillip',female='alyona'),speed=SpeedParams(speed=1.0),path_to_audiofiles=output_file,folder_id=folder_id,iam_token=token,lang='ru-RU',text=text)audio_content:AudioContent=awaitapi.request_audio_content(convert_params)api.convert_ogg_to_mp3(audio_content,'output_audio.mp3')if__name__=='__main__':asyncio.run(main())DependenciesThe Yandex Text to Audio SDK has the following dependencies:aiohttppydanticpydubYou can install them using pip with the following command:pipinstallaiohttppydanticpydubContributingContributions to the project are welcome! If you find a bug, have a feature request, or want to contribute code, please open an issue or submit a pull request.LicenseThis SDK is licensed under the MIT License. See theLICENSEfile for details.Happy audio conversion with Yandex Text to Audio SDK!
Package: txtadv-nightly
txtadv_nightly<<<<<<< Updated upstream
txtadv_nightly is the nightly version of txtadv, the feature-rich text adventure library! Check out txtadv at (pypi.org/project/txtadv/)[https://pypi.org/project/txtadv/]txtadv_nightly is the nightly version of txtadv, the feature-rich text adventure library! Check out txtadv atpypi.org/project/txtadvStashed changes
Package: txtai.py
Python client for txtaitxtaiis an all-in-one embeddings database for semantic search, LLM orchestration and language model workflows.This repository contains Python bindings for the txtai API. This is a minimal dependency library for Python designed for use cases where txtai is running through the API. In all other cases, txtai should be installed directly.Installationtxtai.py can be installed via PyPIpip install txtai.pyExamplesThe examples directory has a series of examples that give an overview of txtai. See the list of examples below.ExampleDescriptionIntroducing txtaiOverview of the functionality provided by txtaiExtractive QA with txtaiExtractive question-answering with txtaiLabeling with zero-shot classificationLabeling with zero-shot classificationPipelines and workflowsPipelines and workflowstxtai.py connects to a txtai api instance. Seethis linkfor details on how to start a new api instance.Once an api instance is running, do the following to run the examples.git clone https://github.com/neuml/txtai.py
cd txtai.py/examples
python embeddings.py
python extractor.py
python labels.py
python pipelines.py
Package: txtar
txtartxtaris a Python reimplementation of Go's txtar format, a tool for bundling and managing multiple text files in a single archive.FeaturesParsetxtarformatted text into structured data.Serialize structured data back intotxtarformat.Unpacktxtararchives into the file system.UsageIn unit testsfrompathlibimportPathimportosdeftest_my_function():# Define the txtar structure for sysfs-like filestxtar_content="""-- sys/class/thermal/thermal_zone0/temp --55000-- sys/class/power_supply/BAT0/capacity --45-- sys/block/sda/size --1024000"""withMockFS.from_string(txtar_content):assertos.path.exists("/sys/class/thermal/thermal_zone0/temp")assertos.path.exists("/sys/class/power_supply/BAT0/capacity")assertos.path.exists("/sys/block/sda/size")assertPath("/sys/block/sda/size").exists()Reading a filefromtxtarimportTxTarcontent="..."# txtar formatted stringarchive=TxTar.parse(content)Serializing to txtar FormatfromtxtarimportTxTar,Filearchive=TxTar(comments=["Example txtar archive"],files=[File(name="example.txt",lines=["Hello","World"])])content=archive.serialize()Unpacking an ArchivefrompathlibimportPathfromtxtarimportTxTararchive=TxTar.parse("...")archive.unpack_in(Path("/path/to/unpack"))DevelopmentInstall dependencies:poetry installRun tests withpytest.Releasingpoetry publish --build --username __token__ --password $PYPI_PASSWORD
Package: txtcli
txt-cliThe CLI tool forhttps://github.com/ahui2016/txtInstall (安装)txt-cli 使用了 Python 3.10 的新特性，比如 type union operator, 因此，如果你的系统中未安装 Python 3.10, 推荐使用pyenv或miniconda来安装最新版本的 Python。例如，安装 miniconda 后，可以这样创建 3.10 环境：$condacreate--namepy310python=3.10
$condaactivatepy310简单安装方法执行以下命令即可：pipinstalltxtcli升级：pipinstall-Utxtcli另一种安装方法另外，还可以使用 pipx 来安装, pipx 会自动为 txt-cli 创建一个虚拟环境，不会污染系统环境，并且使用时不用管理虚拟环境。推荐大家多了解一下 pipx。pipx 的介绍及安装方法:https://pypa.github.io/pipx/安装 pipx 后执行以下命令即可：pipxinstalltxtcli升级：pipxupgradetxtcliServer and the secret-key (服务器地址与密钥)安装后，默认已设置了演示版的服务器地址，可使用命令txt getkey, 输入主密码(abc) 即可获取日常操作密钥。执行txt getkey后如无错误，即可正常使用。如果密钥过期，可使用命令txt getkey -gen生产新密钥。如果你有自己的服务器，可使用命令txt server -set [url]修改服务器地址。Features (功能)基本功能txt send [message]发送消息 (添加暂存消息)txt send默认发送系统剪贴板的内容txt send -g打开 GUI 窗口发送消息txt send -f ./file.txt发送文件内容txt toggle [index/alias]切换一条消息的类型(暂存/永久), 默认把 T1 切换为 P1txt相当于 'txt list'txt list列出最近几条暂存消息txt list -n 3列出最近 3 条暂存消息（默认 n = 9）txt list p1列出最近 n 条永久消息（默认 n = 9）txt list p3 -n 7从第 3 条永久消息开始，列出 5 条永久消息txt get [index/alias]通过 index 或别名获取(复制，同时打印到屏幕)一条消息，默认获取 T1txt list -a/--alias列出全部别名txt alias -l/--list列出全部别名txt alias [index/alias] [alias]设置或删除别名txt delete [index/alias]删除一条消息txt search [keyword]查找消息其他功能txt getkey获取密钥（同时提示密钥状态），需要输入主密码txt getkey -gen/--generate生产新密钥，需要输入主密码txt getkey -forget清除密钥（需要重新获取密钥才能正常使用）txt changepwd更改主密码 (暂时不做这个功能)txt server查看当前服务器地址txt server -set [url]修改服务器地址其中，index是消息的流水号，每当添加消息、删除消息、转换状态时都会导致流水号发生变化，以 T 开头的流水号表示暂存消息，以 P 开头表示永久消息，比如T1表示最新一条暂存消息,P3表示第 3 条永久消息，其中 T/P 不分大小写。alias是消息的别名，一个别名只能对应一条消息。不可采用“以 T 或 P 开头紧跟数字”的形式（为了避免与 index 冲突）。Help (帮助)txt -h（命令列表）txt getkey -h（每个子命令都有帮助信息）复制失败复制到剪贴板的功能由 pyperclip 实现，如果复制失败，请看这里https://pyperclip.readthedocs.io/en/latest/#not-implemented-error一个技巧txt get可以获取最新一条消息，假设其内容是 "ls -lh", 那么，使用bash <(txt get)的形式可以执行命令 "ls -lh"一般先执行txt get, 检查内容没问题后再执行bash <(txt get), 可以避免复制黏贴的麻烦。另外，使用txt get > aaa.txt的方式可以把内容写到一个文本文件中。更新日志v0.1.2addtxt alias -l/--list列出全部别名v0.1.1addtxt delete删除时有 y/n 确认。v0.1.0addtxt send -g/--gui打开 GUI 窗口发送消息，可方便地避免字符转义问题。v0.0.9addtxt getkey -forget清除密钥，相当于登出，需要重新获取密钥才能正常使用v0.0.8addtxt send默认发送系统剪贴板的内容，好处是方便，而且不用担心字符转义的问题。changetxt send Hello World!多数情况下不需要加双引号把句子包裹起来。但要注意字符转义的问题。例如txt send He said: "Hello World!"会被转义成He said: Hello World!(半角双引号不见了)。add对于遇到字符转义问题，并且无法读取系统剪贴板的情况，还可以用txt send -f ./file.txt的方式发送文件内容。Todo二维码
Package: txtcn-wiki
从维基百科抽取中文语料维基百科语料下载地址 :dumps.wikimedia.org/zhwiki有很多链接，下载比如https://dumps.wikimedia.org/zhwiki/20200701/zhwiki-20200701-pages-articles.xml.bz2然后，用如下命令安装txtcn_wiki（ 请用 python3 的 pip，有些系统上直接是pip3)pip install txtcn_wiki安装成功后，用如下方式即可抽取。txtcn_wiki /share/wiki/zhwiki-20200701-pages-articles.xml.bz2小技巧：维基百科打包打包很大，但是不需要完全下载也可以运行以上命令（会报错，但能部分输出）。会在bz2的同目录输出两个文件条目正文：zhwiki-20200701-pages-articles.title.txt.zd条目标题：zhwiki-20200701-pages-articles.txt.zd这两个文件是Zstandard压缩后的纯文本文件 ( 参见Zstandard：一种新的无损压缩算法)使用本软件包附带的zdcat命令可以查看， 比如：zdcat /share/wiki/zhwiki-20200701-pages-articles.title.txt.zd在条目正文中，条目的标题以 "➜ " 开头。在程序中读取zd文件，可用如下方法（zd可以单独安装，比如pip install zd，源码见gitee.com/znlp/zd）import zd

with zd.open(
  "/share/wiki/zhwiki-20200701-pages-articles.txt.zd"
) as f:
  for i in f:
    print(i)如使用有问题请到github.com/txtcn/wiki发帖。特别感谢代码改编自《获取并处理中文维基百科语料 - 科学空间|Scientific Spaces》我的其他项目友情推荐1.中文语料库-每日自动更新版网上有一些中文语料库，但是居然都不是自动更新的。是可忍，孰不可忍。我想自动挖掘研究市场热点炒股票，没有新数据搞毛线。于是，有了这个项目 :《中文语料库-每日自动更新版》。核心思想，通过RSS订阅，存档内容。然后通过GitHub Actions来实现每日运行，这样就实现了一个无服务器的自动更新语料库。2. 谷歌浏览器实用插件：六度空间 · 短链接可以生成短链接（短网址）、二维码，一键复制标题和链接。现有的chrome插件，没有一个能自动复制并带上标题的，所以自己写了一个，很实用，欢迎试用。安装地址：Chrome 网上应用店如果没法访问Chrome网上应用店，可以按照以下步骤安装。点击这里下载源码，并解压在Chrome浏览器中输入chrome://extensions，并开启开发者模式（点击右上角）点击「加载已解压的扩展程序」选择刚刚解压的目录。这是开源项目，欢迎参与改进。关于作者张沈鹏，欢迎扫码关注我的微信公众号。
Package: txtdata
Easy and light manager for basic text data.TxtData is a Python library designed for basic handling of data in .txt files. This lightweight library, with less than 400 lines of code, offers an easy-to-use API and includes comprehensive, well-written tests.Simple and intuitive handling of .txt data.Lightweight design for efficient performance.Extensive testing ensuring reliability.Installationpip install txtdataExamplesfromtxtdataimportTxtData# Creating an empty TxtData instancetxt=TxtData()print(txt.empty)# Output: True# Creating with a simple dictionary.txt=TxtData({'A':[1,2,3],'B':['x','y','z']})print(txt)# Output: [{'A': 1, 'B': 'x'}, {'A': 2, 'B': 'y'}, {'A': 3, 'B': 'z'}]# Inserting datatxt=TxtData()txt.insert({'A':123,'B':'zzz'})# single data by single dicttxt.insert(A=182,C='asdf')# single data by keywordtxt.insert([{'A':None},{'B':'zzz','C':'yes'}])# multiple data by list of dictstxt.insert({'A':[1,3],'B':['yyy','www']})# multiple data by dict of listsprint(txt)# Output: [#     {'A': 123, 'B': 'zzz', 'C': None},#     {'A': 182, 'B': None, 'C': 'asdf'},#     {'A': None, 'B': None, 'C': None},#     {'A': None, 'B': 'zzz', 'C': 'yes'},#     {'A': 1, 'B': 'yyy', 'C': None},#     {'A': 3, 'B': 'www', 'C': None}# ]# Filtering datafiltered_txt=txt.filter(A=182)print(len(filtered_txt))# Output: 1 (based on data above)# Deletetxt.delete(B=None)# Deletes all data with B equals to None# Savingtxt.save('data.txt',delimiter=';')# txt file:# A;B;C# 123;zzz;# 182;;asdf# ;;# ;zzz;yes# 1;yyy;# 3;www;
Package: txtdb
txtdbA simple NoSQL database that uses .txt files.UsageFirst, import txtdb and create a database:importtxtdbname_of_db=txtdb.init("name_of_db")addAdds elements do the database.name_of_db.add("element","element2",...,"elementn")remove_allRemoves all the elements from the database.name_of_db.remove_all()remove_by_elementRemoves elements from the database by their value.name_of_db.remove_by_element("element","element2",...,"elementn")remove_by_stringRemoves elements from the database where a string is in.name_of_db.remove_by_string("string","string2",...,"stringn")remove_by_indexRemoves elements from the database by their indexes.name_of_db.remove_by_index(index1,index2,...,indexn)get_allReturns all the elements in the database.name_of_db.get_all()get_by_stringReturns all the elements in the database where a string is in.name_of_db.get_by_string(index1,index2,...,indexn)get_by_indexReturns all the elements by their indexes.name_of_db.get_by_index(index1,index2,...,indexn)countReturns the number of elements that a txtdb function has returned.name_of_db.count("txtdb_output")
Package: tx_tecreports
Python code for interacting withTexas Ethics CommissionreportsNoteThis does not account for all of the variations in all reports (yet).
This message will stay here until it does.Installation & ConfigurationYou can install this usingpiplike this:pip install tx_tecreportsNow you’re ready to start usingtx_tecreports.Usagetx_tecreportsparses campaign finance reports from theTexas Ethics Commission.  You use thetx_tecreports.fetcher.get_reportlike this.>>>fromtx_tecreports.fetcherimportget_reportYou can fetch any report so long as you have the correct ID.  For
example, you could grab Wendy Davis’ first special session report
(the first one filed after her filibuster) with the ID581606.
You can find that ID by visiting herfiler pageon theTexas Ethics Commissionwebsite.>>>report=get_report(581606)Now you can interact with the various data in the cover element viareport.cover.>>>report.cover.type_of_filingu'COH-SS'>>>report.cover.is_originalTrue>>>report.cover.through_date-report.cover.from_datedatetime.timedelta(29)You can verify that this is her personal filing by seeing that
the filer_type is aIND:>>>report.cover.filer.filer_typeu'IND'The really interesting data is in thereceiptsproperty, a list
of all of the contributions received in this report.  For example,
you can see how many contributions where made by looking at its
length:>>>len(report.receipts)1240You can create a list of all of the contributions on any given day
with by looking at thecontribution.datelike this:>>>len([aforainreport.receiptsifa.contribution.date==report.cover.from_date])0Oops, looks like she didn’t have any contributions on the first day
of that report.  Let’s change it to the last day:>>>len([aforainreport.receiptsifa.contribution.date==report.cover.through_date])1187That’s more like it!TODO: Flesh out this example as part of the narrative text>>>fromtx_tecreports.fetcherimportget_filings_list>>>filings=get_filings_list("00062095COH")>>>len(filings)>=33# Has 33 filings as of January 2014True>>>report=filings[-1].report>>>len(report.receipts)157>>>report.total_receipts279284.94