package
stringlengths
1
122
pacakge-description
stringlengths
0
1.3M
zyb-message
No description available on PyPI.
zyb-naster
UNKNOWN
zyc
zycA GUI utility for searching and selecting parts and footprints for use withSKiDL.Free software: MIT licenseDocumentation:https://devbisme.github.io/zyc.FeaturesKeyword search and selection of parts in KiCad libraries.Keyword search and selection of footprints in KiCad libraries.Copy-and-paste part instances into SKiDL code.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History1.0.0 (2021-09-16)Disabled creation of SKiDL logging and ERC files.Decided this tool was mature to the point it could be called 1.0.0.0.4.0 (2020-09-20)Fixed infinite recursion caused by search that returns an entire list of invalid footprints (issue #2).0.3.0 (2020-06-07)Fixed copy-paste part/footprint errors caused by clipboard already being open.0.2.0 (2020-04-28)Replaced sorting function deleted from SKiDL.Updated some Grid definitions for wxpython 4.0.0.1.0 (2019-12-17)Extracted zyc utility from SKiDL repo and released separately on PyPi.
zycelium.ansiformat
ansiformatANSI Formatted Text for Terminals.AnsiFormat for Custom FormattingColorsfromzycelium.ansiformatimportAnsiFormataf=AnsiFormat()print(af("Red text on default background").red)print(af("Default text on lime background").on.lime)print(af("Black text on yellow background").black.on.yellow)print(af("Black text on cyan background").black.on.color("#00ffff"))print(af("Red text on yellow background").color("#ff0000").on.color("#ffff00"))Effectsfromzycelium.ansiformatimportAnsiFormataf=AnsiFormat()print(af("Bold").bold)print(af("Dim").dim)print(af("Italic").italic)print(af("Underline").underline)print(af("Blink").blink)print(af("Inverse").inverse)print(af("Hidden").hidden)print(af("Strike").strike)Using Colors and Effects Togetherfromzycelium.ansiformatimportAnsiFormataf=AnsiFormat()print(af("Red text on default background, bold").red.bold)print(af("Same, but with shortcut (b) for bold").red.b)print(af("Same, but with shortcut (i) for italic").red.i)print(af("Default text on lime background, with strike-through").on.lime.strike)print(af("Black text on yellow background, underlined").black.on.yellow.underline)print(af("Black text on cyan background, blinking").black.on.color("#00ffff").blink)print(af("Red text on yellow background, inversed").color("#ff0000").on.color("#ffff00").inverse)AnsiMarkup for Quick Formattingfromzycelium.ansiformatimportAnsiMarkup,palettem=AnsiMarkup(palette=palette.midnight_ablaze)print(m.debug("debug"))print(m.info("info"))print(m.ok("ok"))print(m.warning("warning"))print(m.error("error"))print(m.critical("critical"))print(m.p("paragraph"))print(m.aside("aside"))print(m.note("note"))print(m.alert("alert"))print(m.h1("heading one"))print(m.h2("heading two"))print(m.h3("heading three"))print(m.h4("heading four"))print(m.h5("heading five"))print(m.h6("heading six"))withm.indent():print(m.li("list item 1"))print(m.li("list item 2"))withm.indent():print(m.li("list item 2.1"))print(m.li("list item 2.2"))
zycelium.dataconfig
zycelium.dataconfigCreatedataclassesbacked by configuration files.Development Status :: 3 - AlphaUsageUse defaults:Create a new python script and name itexample.pyfromzycelium.dataconfigimportdataconfig@dataconfigclassConfig:name:str="World"config=Config().load()print(f"Hello,{config.name}!")Create aconfig.inifile in the same directory asexample.pyname="DataConfig"Finally, from the same directory, runpython example.py, your console session should look something like this:$pythonexample.pyHello, DataConfig!The defaults here are:Config file name:"config.ini"Paths to look for the config file (current working directory):["."]Specify file-name for configuration:fromzycelium.dataconfigimportdataconfig@dataconfig(file="custom_config.ini")classConfig:name:str="World"config=Config().load()print(f"Hello,{config.name}!")In this example, we specify the file-name on this line:@dataconfig(file="custom_config.ini")with keyword argumentsfile="custom_config.ini"passed to@dataconfig().Specify file-lookup-paths:fromzycelium.dataconfigimportdataconfig@dataconfig(paths=[".","examples","/usr/local/etc"])classConfig:name:str="World"config=Config().load()print(f"Hello,{config.name}!")Here, we passpaths=[".", "examples"]to@dataconfig()to specify the paths on filesystem wheredataconfigshould look for the default"config.ini"file. We can also specify the filename along with the paths. Paths can be relative to current working directory or absolute.Save configuration to file:fromzycelium.dataconfigimportdataconfigFILE_NAME="newconfig.ini"@dataconfig(file=FILE_NAME)classConfig:name:str="World"config=Config()config.save()print(f"Saved config to file:{FILE_NAME}.")Here, we set the config-file-name while creating the class, whensave()is called, it will create the file and save contents ofConfig.If we try running the same example again, we will get an error:FileExistsError: File newconfig.ini exists, refusing to overwrite.This is to protect us from accidentally overwriting an existing config file. To overwrite it, passoverwrite=Truetosave()like this:config.save(overwrite=True)Frozen configuration:fromzycelium.dataconfigimportdataconfig@dataconfig(frozen=True)classConfig:name:str="World"config=Config().load(replace=True)print(f"Hello,{config.name}!")To load a frozen config, we need to passreplace=Truetoload(), if we forget, we get the error:dataclasses.FrozenInstanceError: cannot assign to field 'name'Once loaded, we cannot overwrite the configuration.Use with Click Integration for CLI apps:Here, dataconfig will generate options for click CLI framework, one to add defaults to all options with names that exist in the dataconfig class, overridden by values found in the configuration file. These options can be overridden by passing values as usual to the command line.There's also a new option added to the command: "--conf", which can be used to specify a different configuration file to load defaults.And finally, any changes made in the command line are applied to the dataconfig object, but not saved to the configuration file unless thesave()method is called later.Frozen dataconfig does not work with commandline integration.importclickfromzycelium.dataconfigimportdataconfig@dataconfigclassConfig:name:str="World"config=Config()# No need to load() config when using click_option()@click.command()@click.option("--name")@config.click_option()defmain(name):print(f"Hello,{name}!")print(f"Hello,{config.name}!")main()For more examples:Read through thetests/directory, where you will find the expected usage and how and why dataconfig can fail.InstallFromPyPIpip install zycelium.dataconfigFrom source:git clone https://github.com/zycelium/dataconfig.gitcd dataconfigpip install -e .
zyc-love
安装pipinstallzyc_love#直接最新版本即可使用fromlove_code.loveimportrunif__name__=="__main__":run()
zyctool
工具库
zydis
No description available on PyPI.
zydmayday-pamda
pamdaThis is a repo try to copyhttps://github.com/ramda/ramdain python.installFor whom wants to use this package.>pipinstallzydmayday-pamda >pipinstallzydmayday-pamda-U# get the latestUsage>>>frompamdaimportcurry>>>defsum(a,b,c):returna+b+c>>>curry(sum)(1)(2,3)6>>>importpamdaasR# similar to ramda syntax>>>defsum(a,b,c):returna+b+c>>>R.curry(sum)(1)(2,3)6ContributeFor whom wants to contribute to this repo.# see: https://pre-commit.com/ for more details$pre-commitinstall# install hooksCheck the latest branch to be released inhere.Checkout new branch from that release branch and create PR.CheckListFunctions supported now.__add# different from ramda, ramda treat null as 0>>>R.add(None,None)# float('nan)addIndexadjustallTransducer part is not fully tested.allPassalwaysAnd (andis a keyword in python)andThenanyanyPassapapertureappendapplyapplySpecapplyToascendassocassocPathbinarybindbothcallchainclampclonecollectBycomparatorcomplementcomposecomposeWithconcatcondconstructconstructNconvergecountcountBycurrycurryNdecdefaultTodescenddifferencedifferenceWithdissocdissocPathdividedropdropLastdropLastWhiledropRepeatsdropRepeatsWithdropWhileeitheremptyendsWitheqByeqPropsequalsevolveFfilterfindfindIndexfindLastfindLastIndexflattenflipforEachforEachObjIndexedfromPairsgroupBygroupWithgtgtehashasInhasPathheadidenticalidentityifElseincincludesindexByindexOfinitinnerJoininsertinsertAllintersectionintersperseintoinvertinvertObjinvokerisisEmptyisNiljoinjuxtkeys# When using R.keys(obj) and obj is a class instance, we use obj.__dict__ as keys.classA:c='not included'def__init__(self):self.a=1self.b=2a=A()R.keys(a)# ['a', 'b']keysInlastlastIndexOflengthlenslensIndexlensPathlensPropliftliftNltlteMap (mapis a keyword in python)mapAccummapAccumRightmapObjIndexedmatchmathModmaxmaxBymeanmedianmemoizeWithmergeAllmergeDeepLeftmergeDeepRightmergeDeepWithmergeDeepWithKeymergeLeftmergeRightmergeWithmergeWithKeyminminBymodifymodifyPathmodulomovemultiplynArynegatenonenotnthnthArgoobjOfofomitononceorotherwiseoverpairpartialpartialObjectpartialRightpartitionpathpathEqpathOrpathspathSatisfiespickpickAllpickBypipepipeWithpluckprependproductprojectpromapproppropEqpropIspropOrpropspropSatisfiesrangereducereduceByreducedreduceRightreduceWhilerejectremoverepeatreplacereversescansequencesetslicesortsortBysortWithsplitsplitAtsplitEverysplitWhensplitWheneverstartsWithsubtractsumsymmetricDifferencesymmetricDifferenceWithTtailtaketakeLasttakeLastWhiletakeWhiletaptestthunkifytimestoLowertoPairstoPairsIntoStringtoUppertransducetransposetraversetrimtryCatchtypeunapplyunaryuncurryNunfoldunionunionWithuniquniqByuniqWithunlessunnestuntilunwindupdateuseWithvaluesvaluesInviewwhenwherewhereAnywhereEqwithoutxorxprodzipzipObjzipWith
zyf
安装pip install zyf或者pip install zyf -ihttps://pypi.python.org/simple使用函数计时示例1:timeitfromzyf.timerimporttimeit@timeitdefsleep(seconds:int):time.sleep(seconds)sleep()运行>> sleep(1) Function sleep -> takes 1.001 seconds示例2:Timeitfromzyf.timerimporttimeit,Timeit@Timeit(prefix='跑步')defrun():time.sleep(3)run()运行跑步 -> takes 3.000 seconds示例3:repeat_timeitfromzyf.timerimportrepeat_timeit@repeat_timeit(number=5)deflist_insert_time_test():l=[]foriinrange(10000):l.insert(0,i)@repeat_timeit(repeat=3,number=5)deflist_append_time_test():l=[]foriinrange(1000000):l.append(i)returnl@repeat_timeit(number=5,print_detail=True)deflist_gen_time_test():l=[iforiinrange(1000000)]returnl@repeat_timeit(repeat=3,number=5,print_detail=True)deflist_extend_time_test():l=[]foriinrange(1000000):l.extend([i])@repeat_timeit(repeat=3,number=5,print_detail=True,print_table=True)deflist_range_time_test():l=list(range(1000000))运行>>list_insert_time_test()Functionlist_insert_time_test->5functioncalls:averagetakes0.097seconds>>list_append_time_test()Functionlist_append_time_test->3trialswith5functioncallspertrial:averagetrial3.269seconds.averagefunctioncall0.654seconds>>list_gen_time_test()TimeSpendof5functioncalls:Function->list_gen_time_test:total1.550seconds,average0.310secondsAverage:0.310seconds>>list_extend_time_test()TimeSpendof3trialswith5functioncallspertrial:Function->list_extend_time_test:best:3.289seconds,worst:3.626seconds,average:3.442secondsAveragetrial:3.442seconds.Averagefunctioncall:0.688seconds>>list_range_time_test()TimeSpendof3trialswith5functioncallspertrial:+----------------------+---------------+---------------+---------------+-----------------------+|Function|Besttrial|Worsttrial|Averagetrial|Averagefunctioncall|+----------------------+---------------+---------------+---------------+-----------------------+|list_range_time_test|0.640seconds|0.714seconds|0.677seconds|0.135seconds|+----------------------+---------------+---------------+---------------+-----------------------+示例4:构建列表效率对比fromzyf.timerimportrepeat_timeit@repeat_timeit(number=3)deflist_insert_time_test():l=[]foriinrange(100000):l.insert(0,i)@repeat_timeit(number=5)deflist_extend_time_test():l=[]foriinrange(100000):l.extend([i])@repeat_timeit(number=5)deflist_append_time_test():l=[]foriinrange(100000):l.append(i)returnl@repeat_timeit(number=5)deflist_gen_time_test():l=[iforiinrange(100000)]returnl@repeat_timeit(number=5)deflist_range_time_test():l=list(range(100000))if__name__=='__main__':list_range_time_test()list_gen_time_test()list_append_time_test()list_extend_time_test()list_insert_time_test()运行结果Functionlist_range_time_test->5functioncalls:averagetakes0.012seconds Functionlist_gen_time_test->5functioncalls:averagetakes0.017seconds Functionlist_append_time_test->5functioncalls:averagetakes0.038seconds Functionlist_extend_time_test->5functioncalls:averagetakes0.067seconds Functionlist_insert_time_test->3functioncalls:averagetakes13.747seconds请求头user_agent功能说明支持获取各类请求头,包含移动端和PC端浏览器,可以指定获取某类请求头,也可以随机获取。使用示例fromzyf.user_agentimportUserAgentua=UserAgent()print(ua.random)print(ua.chrome)print(ua.firefox)print(ua.opera)print(ua.uc)print(ua.mobile)输出Mozilla/5.0(WindowsNT6.1;WOW64)AppleWebKit/536.3(KHTML,likeGecko)Chrome/19.0.1061.1Safari/536.3 Mozilla/5.0(WindowsNT6.2)AppleWebKit/536.6(KHTML,likeGecko)Chrome/20.0.1090.0Safari/536.6 Mozilla/5.0(X11;U;Linuxx86_64;zh-CN;rv:1.9.2.10)Gecko/20100922Ubuntu/10.10(maverick)Firefox/3.6.10 Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;en)Opera9.50 Openwave/UCWEB7.0.2.37/28/999 Mozilla/5.0(iPad;U;CPUOS4_3_3likeMacOSX;en-us)AppleWebKit/533.17.9(KHTML,likeGecko)Version/5.0.2Mobile/8J2Safari/6533.18.5文件操作scan_directory_contents功能说明扫描指定文件夹内所有文件,输出文件路径使用示例fromzyf.fileimportscan_directory_contentsforfileinscan_directory_contents('D:/python/data'):print(file)# 可以指定后缀forfileinscan_directory_contents('D:/python/data',suffix='.csv'):print(file)count_word_freq功能说明对文献.xlsx中关键词列的进行词频统计,可指定单词分隔符,默认为`; ',也可指定输出词频统计列名,默认为freq和word。使用示例fromzyf.fileimportcount_word_freqcount_word_freq('文献.xlsx',col_name='关键词',sep='; ',to_col_freq='频数',to_col_word='单词',to_file='文献_关键词_统计.xlsx')颜色相关color功能说明打印功能扩展,添加颜色输出使用示例fromzyf.colorimportprint_color,Foregroundprint_color("这是什么颜色",foreground=Foreground.Red)print_color("这是什么颜色",foreground=Foreground.White)print_color("这是什么颜色",foreground=Foreground.Green)print_color("这是什么颜色",foreground=Foreground.Black)print_color("这是什么颜色",foreground=Foreground.Blue)print_color("这是什么颜色",foreground=Foreground.Cyan)print_color("这是什么颜色",foreground=Foreground.Purplish_red)print_color("这是什么颜色",foreground=Foreground.Yellow)数据下载政策数据下载根据关键词对政策数据库进行搜索,并将搜索到的政策数据进行下载及字段解析,存储到文件中。使用说明国务院政策文件库 1. 设置settings中的请求参数 -> gov_policy_params 2. 运行代码 北大法宝 1. 网页登陆之后将cookie复制,修改settings中的cookie信息 2. 根据你的检索词和检索时间修改settings中的QueryBased64Request和Year 3. 运行代码 律商网 1. 网页登陆之后将cookie复制,修改settings中的cookie信息 2. 根据你的检索信息修改settings中的keyword/start/end/page_size 3. 运行代码注:北大法宝和律商网需要有会员账号才能全部完整政策信息, 所以需要设置cookie信息。使用示例国务院政策数据下载defgov_policy_demo():fromzyf.crawler.policy.goverment_policyimportGovPolicyCrawlerspider=GovPolicyCrawler()spider.run(keyword='疫情',issue_depart=['国务院','国务院部门','国务院公报'],page_size=50)北大法宝政策数据下载defpkulaw_policy_demo():fromzyf.crawler.policy.pkulaw_policyimportPkulawdCrawlerpkulaw_request_params={'cookie':None,'query_base64_request':{'疫情':'eyJGaWVsZE5hbWUiOm51bGwsIlZhbHVlIjpudWxsLCJSdWxlVHlwZSI6NCwiTWFueVZhbHVlU3BsaXQiOiJcdTAwMDAiLCJXb3JkTWF0Y2hUeXBlIjowLCJXb3JkUmF0ZSI6MCwiQ29tYmluYXRpb25UeXBlIjoyLCJDaGlsZE5vZGVzIjpbeyJGaWVsZE5hbWUiOiJLZXl3b3JkU2VhcmNoVHJlZSIsIlZhbHVlIjpudWxsLCJSdWxlVHlwZSI6NCwiTWFueVZhbHVlU3BsaXQiOiJcdTAwMDAiLCJXb3JkTWF0Y2hUeXBlIjowLCJXb3JkUmF0ZSI6MCwiQ29tYmluYXRpb25UeXBlIjoxLCJDaGlsZE5vZGVzIjpbeyJGaWVsZE5hbWUiOiJDaGVja0Z1bGxUZXh0IiwiVmFsdWUiOiLnlqvmg4UiLCJSdWxlVHlwZSI6NCwiTWFueVZhbHVlU3BsaXQiOiJcdTAwMDAiLCJXb3JkTWF0Y2hUeXBlIjoxLCJXb3JkUmF0ZSI6MCwiQ29tYmluYXRpb25UeXBlIjoyLCJDaGlsZE5vZGVzIjpbXSwiQW5hbHl6ZXIiOiJpa19zbWFydCIsIkJvb3N0IjoiMC4xIiwiTWluaW11bV9zaG91bGRfbWF0Y2giOm51bGx9LHsiRmllbGROYW1lIjoiU291cmNlQ2hlY2tGdWxsVGV4dCIsIlZhbHVlIjoi55ar5oOFIiwiUnVsZVR5cGUiOjQsIk1hbnlWYWx1ZVNwbGl0IjoiXHUwMDAwIiwiV29yZE1hdGNoVHlwZSI6MSwiV29yZFJhdGUiOjAsIkNvbWJpbmF0aW9uVHlwZSI6MiwiQ2hpbGROb2RlcyI6W10sIkFuYWx5emVyIjpudWxsLCJCb29zdCI6bnVsbCwiTWluaW11bV9zaG91bGRfbWF0Y2giOm51bGx9XSwiQW5hbHl6ZXIiOm51bGwsIkJvb3N0IjpudWxsLCJNaW5pbXVtX3Nob3VsZF9tYXRjaCI6bnVsbH1dLCJBbmFseXplciI6bnVsbCwiQm9vc3QiOm51bGwsIk1pbmltdW1fc2hvdWxkX21hdGNoIjpudWxsfQ==',},'year':[2003,2004],'page_size':100,}crawler=PkulawdCrawler(**pkulaw_request_params)crawler.run()律商网政策数据下载deflexis_policy_demo():fromzyf.crawler.policy.lexis_policyimportLexisNexisCrawlerlexis_request_params={'cookie':None,'keywords':'疫情','start':'2020-01-01','end':'2020-12-31','page_size':100,}crawler=LexisNexisCrawler(**lexis_request_params)crawler.run()综合示例配置文件:settings.py# 国务院gov_policy_params={'keyword':'医疗联合体','min_time':None,'max_time':None,'issue_depart':['国务院','国务院部门','国务院公报'],'searchfield':'title:content:summary','sort':'pubtime','page_size':50,'to_file':None}# 北大法宝pkulaw_request_params={'cookie':None,'query_base64_request':{'疫情':'eyJGaWVsZE5hbWUiOm51bGwsIlZhbHVlIjpudWxsLCJSdWxlVHlwZSI6NCwiTWFueVZhbHVlU3BsaXQiOiJcdTAwMDAiLCJXb3JkTWF0Y2hUeXBlIjowLCJXb3JkUmF0ZSI6MCwiQ29tYmluYXRpb25UeXBlIjoyLCJDaGlsZE5vZGVzIjpbeyJGaWVsZE5hbWUiOiJLZXl3b3JkU2VhcmNoVHJlZSIsIlZhbHVlIjpudWxsLCJSdWxlVHlwZSI6NCwiTWFueVZhbHVlU3BsaXQiOiJcdTAwMDAiLCJXb3JkTWF0Y2hUeXBlIjowLCJXb3JkUmF0ZSI6MCwiQ29tYmluYXRpb25UeXBlIjoxLCJDaGlsZE5vZGVzIjpbeyJGaWVsZE5hbWUiOiJDaGVja0Z1bGxUZXh0IiwiVmFsdWUiOiLnlqvmg4UiLCJSdWxlVHlwZSI6NCwiTWFueVZhbHVlU3BsaXQiOiJcdTAwMDAiLCJXb3JkTWF0Y2hUeXBlIjoxLCJXb3JkUmF0ZSI6MCwiQ29tYmluYXRpb25UeXBlIjoyLCJDaGlsZE5vZGVzIjpbXSwiQW5hbHl6ZXIiOiJpa19zbWFydCIsIkJvb3N0IjoiMC4xIiwiTWluaW11bV9zaG91bGRfbWF0Y2giOm51bGx9LHsiRmllbGROYW1lIjoiU291cmNlQ2hlY2tGdWxsVGV4dCIsIlZhbHVlIjoi55ar5oOFIiwiUnVsZVR5cGUiOjQsIk1hbnlWYWx1ZVNwbGl0IjoiXHUwMDAwIiwiV29yZE1hdGNoVHlwZSI6MSwiV29yZFJhdGUiOjAsIkNvbWJpbmF0aW9uVHlwZSI6MiwiQ2hpbGROb2RlcyI6W10sIkFuYWx5emVyIjpudWxsLCJCb29zdCI6bnVsbCwiTWluaW11bV9zaG91bGRfbWF0Y2giOm51bGx9XSwiQW5hbHl6ZXIiOm51bGwsIkJvb3N0IjpudWxsLCJNaW5pbXVtX3Nob3VsZF9tYXRjaCI6bnVsbH1dLCJBbmFseXplciI6bnVsbCwiQm9vc3QiOm51bGwsIk1pbmltdW1fc2hvdWxkX21hdGNoIjpudWxsfQ==',},'year':[2003,2004],'page_size':100,}# 律商网lexis_request_params={'cookie':None,'keywords':'疫情','start':'2020-01-01','end':'2020-12-31','page_size':100,}使用示例importsettingsdefpolicy_spider():print('请选择政策来源: 1. 国务院政策文件库 2.北大法宝 3.律商网 4. 新冠疫情数据(卫健委)')choice=input('请选择政策来源(数字)>> ')ifchoice=='1':fromzyf.crawler.policy.goverment_policyimportGovPolicyCrawlercrawler=GovPolicyCrawler()crawler.run(**settings.gov_policy_params)elifchoice=='2':fromzyf.crawler.policy.pkulaw_policyimportPkulawdCrawlercrawler=PkulawdCrawler(**settings.pkulaw_request_params)crawler.run()elifchoice=='3':fromzyf.crawler.policy.lexis_policyimportLexisNexisCrawlercrawler=LexisNexisCrawler(**settings.lexis_request_params)crawler.run()else:raiseException('输入的政策来源不正确')图片下载使用说明使用示例fromzyf.colorimportprint_colordefstart_spider():print_color('高清壁纸:1. NET牛人(https://ss.netnr.com/) 2. 彼岸图网(https://pic.netbian.com/)')choice=input('请选择壁纸来源 >> ')ifchoice=='1':fromzyf.crawler.image.netnrimportNetnrCrawlercrawler=NetnrCrawler(dir_path='images/netnr')elifchoice=='2':fromzyf.crawler.image.netbianimportNetbianCrawlercrawler=NetbianCrawler(dir_path='images/netbian')else:raiseException('输入的壁纸来源不正确')crawler.run()if__name__=='__main__':start_spider()数据库连接DBPoolHelper使用说明提供sqlite3、mysql、postgresql、sqkserver连接池,方便操作,该功能使用依赖于dbutils,需要提前安装,另外,需要安装对应数据库的第三方依赖postgressql -> psycopg2mysql -> pymysqlsqlite -> sqlite3使用示例fromzyf.dbimportDBPoolHelperdb1=DBPoolHelper(db_type='postgressql',dbname='student',user='postgres',password='0000',host='localhost',port=5432)db2=DBPoolHelper(db_type='mysql',dbname='student',user='root',password='0000',host='localhost',port=3306)db3=DBPoolHelper(db_type='sqlite3',dbname='student.db')MongoHelper使用说明为mongodb操作提供便利,需要安装pymongo使用示例fromzyf.dbimportMongoHelpermongo=MongoHelper(mongo_db='flask',mongo_uri='localhost')data=mongo.read('label')print(data.head())condition={"药品ID":509881}data=mongo.dbFind('label',condition)print(data)foriindata:print(i)foriteminmongo.findAll():print(item)远程控制ParamikoHelper使用说明在Python代码中直接使用SSH协议对远程服务器、网络设备执行命令操作、文件上传下载服务。使用示例fromzyf.remote_controlimportParamikoHelperhostname='X.X.X.X'username='XXX'password='XXX'remotepath1='XXX'localpath1='XXX'remotepath2='XXX'localpath2='XXX'client=ParamikoHelper(hostname=hostname,username=username,password=password)content,code=client.exec_command("display ip interface brief")client.download_file(remotepath1,localpath1)client.put_file(localpath2,remotepath2)client.__close__()print(content,code)
zyfra-check
No description available on PyPI.
zyf-timer
安装pip install zyf_timer或者pip install zyf_timer -ihttps://pypi.python.org/simple使用函数计时示例1:timeitfromzyfimporttimeit@timeitdefsleep(seconds:int):time.sleep(seconds)运行>>sleep(1)Functionsleep->takes1.001seconds示例2:repeat_timeitfromzyfimportrepeat_timeit@repeat_timeit(number=5)deflist_insert_time_test():l=[]foriinrange(10000):l.insert(0,i)@repeat_timeit(repeat=3,number=5)deflist_append_time_test():l=[]foriinrange(1000000):l.append(i)returnl@repeat_timeit(number=5,print_detail=True)deflist_gen_time_test():l=[iforiinrange(1000000)]returnl@repeat_timeit(repeat=3,number=5,print_detail=True)deflist_extend_time_test():l=[]foriinrange(1000000):l.extend([i])@repeat_timeit(repeat=3,number=5,print_detail=True,print_table=True)deflist_range_time_test():l=list(range(1000000))运行>>list_insert_time_test()Functionlist_insert_time_test->5functioncalls:averagetakes0.097seconds >>list_append_time_test()Functionlist_append_time_test->3trialswith5functioncallspertrial:averagetrial3.269seconds.averagefunctioncall0.654seconds >>list_gen_time_test()TimeSpendof5functioncalls:Function->list_gen_time_test:total1.550seconds,average0.310seconds Average:0.310seconds >>list_extend_time_test()TimeSpendof3trialswith5functioncallspertrial:Function->list_extend_time_test:best:3.289seconds,worst:3.626seconds,average:3.442seconds Averagetrial:3.442seconds.Averagefunctioncall:0.688seconds >>list_range_time_test()TimeSpendof3trialswith5functioncallspertrial: +----------------------+---------------+---------------+---------------+-----------------------+|Function|Besttrial|Worsttrial|Averagetrial|Averagefunctioncall|+----------------------+---------------+---------------+---------------+-----------------------+|list_range_time_test|0.640seconds|0.714seconds|0.677seconds|0.135seconds|+----------------------+---------------+---------------+---------------+-----------------------+示例3:构建列表效率对比fromzyfimportrepeat_timeit@repeat_timeit(number=3)deflist_insert_time_test():l=[]foriinrange(100000):l.insert(0,i)@repeat_timeit(number=5)deflist_extend_time_test():l=[]foriinrange(100000):l.extend([i])@repeat_timeit(number=5)deflist_append_time_test():l=[]foriinrange(100000):l.append(i)returnl@repeat_timeit(number=5)deflist_gen_time_test():l=[iforiinrange(100000)]returnl@repeat_timeit(number=5)deflist_range_time_test():l=list(range(100000))if__name__=='__main__':list_range_time_test()list_gen_time_test()list_append_time_test()list_extend_time_test()list_insert_time_test()运行结果Functionlist_range_time_test->5functioncalls:averagetakes0.012seconds Functionlist_gen_time_test->5functioncalls:averagetakes0.017seconds Functionlist_append_time_test->5functioncalls:averagetakes0.038seconds Functionlist_extend_time_test->5functioncalls:averagetakes0.067seconds Functionlist_insert_time_test->3functioncalls:averagetakes13.747seconds
zygimantas-print-lib
No description available on PyPI.
zygoat
zygoatWhat is zygoat?zygoatis a command line tool used to bootstrap and configure a React/Django/Postgres stack web application.Linting, test configuration, boilerplate, and development environment are automatically taken care of usingzygoatso that you can get up and running faster.zygoatalso includes a preset deployment configuration to allow you to deploy your stack to an AWS environment with a single command. You'll get a full serverless AWS stack to keep things inexpensive and nimble.How does it work?zygoatworks by definingComponents, defined as parts of projects, and then defining how you implement those components based on whether you're creating a new project, updating an existing project, or deleting a component that's no longer needed.For instance, for the python backend, we want to includeblack, which is a tool for automatically formatting python code in a standard way to make it pep8 compliant. To installblackin for the python backend part of the project, we create aComponentfor it, specifically aFileComponent, which defines how we treat files that we need in projects. Then we register theBlackcomponent (defined inblack.py) with theBackendcomponent (defined inbackend/__init__.py) as a sub component. This way, whenever you create or update (or delete) a project with theBackendcomponent, you'll do the same 'phase' to theBlackcomponent.Installationpipinstall--upgradezygoatUsagemkdirmy-cool-new-app&&cdmy-cool-new-app gitinit zgnewmy-cool-new-appFor more customization and configuration,check out the official documentation.How do I develop changes for it?Make a new git repository somewhere, we'll call it test-zgmkdirtest-zg&&cdtest-zg gitinitInstall the zygoat package locallypipinstall--user--upgrade~/Projects/zygoat# Or wherever you have itIf you're using the asdf version manager, reshimasdfreshimpythonRun zg commands, see if they failzgnewtestzgupdate zgdeleteContributingzygoatis developed using thePoetrypackaging framework for Python projects to make development as simple and portable as possible.DocumentationAvailable on ReadTheDocs
zygoat-django
No description available on PyPI.
zygomorphic
ZygomorphicAuthor:Scott TorborgExample package to figure out bumpr.LicenseZygomorphic is licensed under an MIT license. Please see the LICENSE file for more information.
zygote
UNKNOWN
zygrpc
libzygrpc智眼Grpc SDK生成gRPC代码安装依赖:pip install -U grpcio protobuf grpcio-tools生成gRPC代码:在libzygrpc目录下运行python -m grpc_tools.protoc -I . --python_out=python/ --grpc_python_out=python/ proto/zhiyan_rpc.protogRPC工具会生成两个Python文件:proto/zhiyan_rpc_pb2.pyproto/zhiyan_rpc_pb2_grpc.py注意事项生成proto/zhiyan_rpc_pb2_grpc.py文件后,需要确认其中导入zhiyan_rpc_pb2.py是否正确:fromprotoimportzhiyan_rpc_pb2asproto_dot_zhiyan__rpc__pb2安装SDK从 pip 安装pip install -U zygrpc使用方法使用比如:from proto import zhiyan_rpc_pb2本地打包安装打包安装依赖包:pip install -U setuptools wheel运行:rm -rf build/ dist/ zygrpc.egg-info/ && python setup.py bdist_wheel在dist目录下会生成类似zygrpc-1.0.0-py3-none-any.whl的安装包。本地安装全局安装:sudo pip install -U dist/zygrpc-0.0.1-py3-none-any.whl用户目录安装:pip install --user -U dist/zygrpc-0.0.1-py3-none-any.whl卸载pip uninstall zygrpc
zyh
介绍测试python环境!借助zyh这个库github repo:https://github.com/amanyara/zyh安装你可以使用pip install zyh来下载。(推荐,因为还会在你系统内安装同名的命令行工具)或者直接clone这个repo用法在当前文件夹下假如你使用pip的方式安装,只需要运行zyh即可
zyhadd
No description available on PyPI.
zyhsub
No description available on PyPI.
zyjj-client-sdk
智游剪辑客户端sdk包
zyjxcswe
No description available on PyPI.
zyk_hfp_test1
UNKNOWN
zykj-py-apollo
No description available on PyPI.
zyklop
This program is a wrapper around rsync. It will help you:if you need to sync files from remote server frequentlyNo need to keep the location of the file in your mind. It finds them for you.RequirementsPython >= 2.6 (Python >= 2.7 for tests)rsync installedlocate installed with up-to-date database on the remote systemFirst StepsIf you are new to ssh, setup an ssh configuration first. If you are dealing with a lot of servers, giving them an alias makes them easier to remember and you don’t have to type as much.Create an ssh configuration in your SSH home, e.g.:vim ~/.ssh/configYou can use the following example as a starter:Host spameggs Hostname 12.112.11.122 Compression yes CompressionLevel 9 User guidobut be sure to check thedocumentationor the man page (5) forssh_configMake the config only readable for the owner:chmod 600 ~/.ssh/configTest if you can login to your configured host using only your alias:ssh spameggsExamplesSyncing ZODB from remote server configured in~/.ssh/configas spameggs. We choose not the first database, but the second:$ zyklop spameggs:Data.fs . Use /opt/otherbuildout/var/filestorage/Data.fs? Y(es)/N(o)/A(bort) n Use /opt/buildout/var/filestorage/Data.fs? Y(es)/N(o)/A(bort) ySyncing a directory providing a path segment:$ zyklop spameggs:buildout/var/filestorage$ .Syncing a directory which ends withblobstorage`, excluding any otherblobstoragedirectories with postfixes in the name (e.g.blobstorage.old):$ zyklop spameggs:blobstorage$ .Use anabsolute pathif you know exactly where to copy from:$ zyklop spameggs:/tmp/Data.fs .Syncing a directory which needs higher privileges. We use the-sargument:$ zyklop -s spameggs:blobstorage$ .Dry runprints out all found remote paths and just exits:$ zyklop -d spameggs:blobstorage$ . /opt/otherbuildout/var/blobstorage /opt/otherbuildout/var/blobstorage.old /opt/buildout/var/blobstoragSync the first result zyklop finds automaticallywithout prompting:$ zyklop -y spameggs:blobstorage$ .Known ProblemsZyklop just hangsThis can be caused by paramiko and a not sufficient SSH setup. Make sure you can login without problems by simply issuing a:ssh myhostIf that does not solve your problem, try to provide an absolute path from the source. Sometimes users don’t have many privileges on the remote server and the paramiko just waits for the output of a remote command:zyklop myhost:/path/to/file .MotivationI’m dealing with Zope servers most of my time. Some of them have ahugeData.fs - an object oriented database. I do have in 99% of the cases an older version of the clients database on my PC. Copying the whole database will take me ages. Using rsync and simply downloading a binary patch makes updating my local database a quick thing.To summarize, with zyklop I’d like to address two things:Downloading large ZODBs takes a long time and bandwidth. I simply don’t want to wait that long and download that much.Most of the time I can not remember the exact path where the item to copy is on the remote server.TODOtty support: sometimes needed if SSH is configured to only allow tty’s to connect.Don’t hang if only password auth is configured for SSHDevelopmentIf you’re interested in hacking, clone zyklop on github:https://github.com/romanofski/zyklopCHANGES0.5.2 (2013-02-12)Bugfix: use one function to retrieve the username.0.5.1 (2013-02-12)Command line utility now shows version information.Bugfix: now uses the ‘user’ configured in the ssh config and falls back to the environment user0.5 (2013-02-06)Added -d or –dry-run switch to only print out found remote paths by zyklopAdded -y or –assume-yes switch to sync the first result found.Fixed b0rked README.rst0.4 (2013-02-05)Improved documentationFixed bug, which lead to a hanging command when issuing a remote command in order to find the target path0.3 (2013-01-14)Changed host, match parameters: Now you can specify the source host and path match in one parameter delimited by a column, similar to scp (e.g. foohost:/path)Allow to provide an absolute path to the file you’d like to copy.0.2 (2012-03-08)Added basic support for using sudo in finding and syncing (rsync)Added argparse as dependency as Python 2.6 won’t have itNew positional argument to provide destination to copy file/directory
zyklus
No description available on PyPI.
zylib
zylibThis is a util lib
zyl_nester
UNKNOWN
zylo
ZyloZylo is a lightweight web framework made with love.FeaturesSimple and intuitive routingTemplate rendering using Jinja2Session management with the sessions libraryStatic file servingInstallationYou can install Zylo using pip:pipinstallzyloUsage# app.pyfromzylo.core.branchimportZyloapp=Zylo()@app.route('/')defhome(request):return'Hello, World!'if__name__=='__main__':app.run()changelogsBeta version 2.0.7Latest update of betaBug fixed with update --> 2.0.7Updated Usage Guide 1.2.2Newly designed system based on Matrix 1.0.0 MetapolistMajor Bug fixies in zyloNo longer support for version 1 beta --> # clearoutAttractive echosystem in zyloFreshly updated Mailer, Blueprint, Sessions, Chiper, JwT, BaseModals, ZyloStrict route has been removed in version --> 2.0.7Added battries support usign ZyloAdminUsage GuideOur team working hard and the usage guide will be avilable within 24hrs onhttp://zylo.vvfin.inorhttps://github.com/E491K8/ZyloProject/Batteries SupportInstallation of ZyloAdmin v1pipinstallzyloadminCreate zylo projectzyloadminstartproject-i{projectName}
zylo-admin
Zylo-AdminZylo-Admin a battery startup for newly updated zylo v2.0.8Available scriptszylo-adminstartproject-i{projectname}zylo-adminmanageenginezylo-adminrunserver{projectname}zylo-admin --> Main module()zylo-admin startproject --> create wsgi project for zylo()zylo-admin startproject -i {projectname} --> -i denote project cells it set on 100.55 m/s by defaultzylo-admin manage engine --> manage for managing all the static and templating files & engine denote the default engine in settings.pyzylo-admin runserver {projectname} --> runserver to run the server in debug mode by default just passig the create wsgi folder name
zylogger
zyloggerA logger that can be used directly without any config.buildpython setup.py sdist bdist_wheelupload to test_pypipython -m twine upload --verbose --repository testpypi dist/*upload to pypipython -m twine uploadusageinstallpip install zyloggerusageimport logging import zylogger zylogger.init() logging.info('hello zylogger')
zyl-utils
data_utilsandmodel_utils
zylxd
No description available on PyPI.
zymbit
Python library to communicate with the Zymbit cloud
zymbit-connect
# Zymbit Connect #Utility to connect to the Zymbit Cloud
zymbit-trequests
A Tornado async HTTP/HTTPS client adapter for python-requests.The problemYou enjoy usingTornadoto build fast non-blocking web applications, and you want to use a library from PyPI that makes a few HTTP requests, but pretty much every dev and their dog usesRequeststo make HTTP requests (rightly so, because it’sawesome), but requests has no knowledge of the event loop nor can it yield when a socket blocks, which means any time you try to use a library like that it begins to block your request handling and grud-knows what other worlds of pain.The solutionLuckily there are solutions, one such is to use thegreenletmodule to wrap blocking operations and swap Tornado coroutines at the right time, there is even the handytornaletmodule which handles this for you.To make life even easier, you lucky lucky people, I’ve createdtrequests, an async Requests adapter which uses greenlets (via tornalet) and the inbuilt non-blocking HTTP client methos in Tornado, to make any call to a library (utilizing Requests) non-blocking.Installation$pipinstalltrequestsUsage# Assume bobs_big_data uses python-requests for HTTP requestsimportbobs_big_datafromtornado.webimportRequestHandlerfromtrequestsimportsetup_sessionfromtornaletimporttornalet# Tell requests to use our AsyncHTTPadapter for the default# session instance, you can also pass you own throughsetup_session()classWebHandler(RequestHandler):@tornaletdefget(self):data={'foo':'bar'}# This will now unblock the current coroutine, like magicresponse=bobs_big_data.BigData(data).post()returnself.write(response)TestsTo run the basic testsuite hit uppython setup.py test.Caveatstrequestshas been used in production in a large scale metrics application, and is a very small and quite simple module.HoweverI’ve released it as0.9.xmainly because it’s missing 100% compatibility with the Requests adapter API, most noticeablycookie jarandsessionsupport, which I will improve (or please send me a pull request if you fancy adding support), and release as a1.xbranch when I have the time.Also at the moment thesetup_sessionutility actually monkey patches thesessionutility functions in Requests, as this was the only way I could see to override the mounts on “default” session instances (e.g. those created for every call when a session isn’t provided). I’m hoping to change this in the future.
zymbitwalletsdk
Zymbit Wallet Python SDKOverviewEthereum accounts, signatures, and transactions have an additional layer of complexity over traditional cryptographic keys and signatures. The Zymbit Wallet SDK aims to abstract away this complexity, enabling you to create and manage multiple blockchain wallets and seamlessly integrate with various blockchains without having to deal with their technical intricacies.The first iteration of the SDK encapsulates all wallet creation, management, and use (sending transactions and interacting with dApps) capabilities for Ethereum and EVM compatible chains.If you are a developer interested in creating your own custom implementations of Accounts and/or Keyrings to work with ZymbitKeyringManager, you should further explore this repository. By extending the Account andKeyring Abstract Base Classes (ABCs), you can implement the required methods and any additional functionality as needed. The elliptic curves we support (secp256k1, secp256r1, and ed25519) are used by many major blockchains, including Bitcoin, Ethereum, Cardano, Solana, and Polkadot. Developing your own keyrings can be incredibly beneficial for a wide range of applications, such as key management or on-chain interactions like sending transactions or interacting with smart contracts.NOTE:Only compatible withHSM6,SCM, andSENInstallationpip install zymbitwalletsdkDocumentation:Zymbit Wallet Python SDK Documentation
zymkey
No description available on PyPI.
zymod
libzymod-python智眼Python SDK单元测试基于test文件夹中的\\__init__.py->load_tests自动发现:python -m unittest tests安装SDK从 pip 安装pip install -U zymod使用方法使用比如:from zymod import upload本地打包安装打包安装依赖包:pip install -U setuptools wheel生成 requirements.txt:python zy_env_marker.py运行:rm -rf build/ dist/ zymod.egg-info/ && python setup.py bdist_wheel在dist目录下会生成类似zymod-1.0.0-py3-none-any.whl的安装包。本地安装全局安装:sudo pip install -U dist/zymod-*-py3-none-any.whl用户目录安装:pip install --user -U dist/zymod-*-py3-none-any.whl卸载pip uninstall zymod上传至PyPI配置文件~/.pypirc[distutils] index-servers= pypi [pypi] username: password:安装上传工具pip install -U twine上传twine upload dist/*如果使用国内镜像源,需要等一两天国内服务器才会同步官方源。可以临时指定官方源安装:python3 -m pip install -i https://pypi.org/simple/ example-pkg
zymodbustcpclient
No description available on PyPI.
zymouse
============介绍========================introduce============----------------------Project Address~~~~~~~~~~~~~~~~~~~~~~Project at https://github.com/zymouse/zymouse
zymp
Zymp is a Python library to design “restriction site arrays”, which are compact sequences with many restriction sites.For instance here is a 159-nucleotide sequence made with Zymp, with 49 enzyme recognition sites (out of 52 provided). That’s a frequency of around 3 nucleotides per site:InfosPIP installation:pipinstallzympGithub Page:https://github.com/Edinburgh-Genome-Foundry/zympLicense:MIT, Copyright Edinburgh Genome FoundryMore biology softwareZymp is part of theEGF Codonssynthetic biology software suite for DNA design, manufacturing and validation.
zymptest
MIT LicenseCopyright (c) 2018 The Python Packaging AuthorityPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
zymtest2
-- coding: utf-8 --Example PackageThis is a simple IP package. You can useGithub-flavored Markdownto write your content.
zymylogger
No description available on PyPI.
zymysql
No description available on PyPI.
zyncify
zynczync is a utility tool for python operations.INSTALLATIONpipinstallzyncifyUsage1. IMPORTfromzyncimport*2. FUNCTIONSloggerlogger takes in a string and logs it with an INFO level.fromzyncimportlogger# logging a string INFOlogger("info message")# logging a variable INFOmessage="info message"logger(message)#### returns: INFO info messagebuggerbugger takes in a string and logs it with a DEBUG level.fromzyncimportbugger# logging a string DEBUGbugger("debug message")# logging a variable DEBUGmessage="debug message"bugger(message)#### returns: DEBUG debug messageweggerwegger takes in a string and logs it with an ERROR level.fromzyncimportwegger# logging a string ERRORwegger("error message")# logging a variable ERRORmessage="error message"wegger(message)#### returns: ERROR debug messageSluggerSlugger converts a string to slug while maintaining capitalization.fromzyncimportSlugger# Slugging a string with CapsSlugger("Test String")# Slugging a variable with capsstring="Test String"Slugger(string)#### returns: Test-Stringsluggerslugger converts a string to a slug with no capitalization.fromzyncimportslugger# Slugging a string without Capsslugger("Test String")# Slugging a variable without capsstring="Test String"slugger(string)#### returns: test-string3. TAIL LOG FILEtail-f./.zync.logAuthorTJ Bredemeyertwitter: @tjbredemeyer
zyne
Zyne: Python MVC Web FrameworkZyne is a Python MVC web framework built for agility.It's a WSGI framework and can be used with any WSGI application server such as Gunicorn.InstallationpipinstallzyneHow to use itBasic usage:fromzyne.apiimportAPIapp=API()@app.route("/home")defhome(request,response):response.text="Hello from the HOME page"@app.route("/hello/{name}")defgreeting(request,response,name):response.text=f"Hello,{name}"@app.route("/book")classBooksResource:defget(self,req,resp):resp.text="Books Page"defpost(self,req,resp):resp.text="Endpoint to create a book"@app.route("/template")deftemplate_handler(req,resp):resp.body=app.template("index.html",context={"name":"Zyne","title":"A MVC Web Framework"}).encode()Unit TestsThe recommended way of writing unit tests is withpytest. There are two built in fixtures that you may want to use when writing unit tests with Zyne. The first one isappwhich is an instance of the mainAPIclass:deftest_route_overlap_throws_exception(app):@app.route("/")defhome(req,resp):resp.text="Welcome Home."withpytest.raises(AssertionError):@app.route("/")defhome2(req,resp):resp.text="Welcome Home2."The other one isclientthat you can use to send HTTP requests to your handlers. It is based on the famousrequestsand it should feel very familiar:deftest_parameterized_route(app,client):@app.route("/{name}")defhello(req,resp,name):resp.text=f"hey{name}"assertclient.get("http://testserver/matthew").text=="hey matthew"TemplatesThe default folder for templates istemplates. You can change it when initializing the mainAPI()class:app=API(templates_dir="templates_dir_name")Then you can use HTML files in that folder like so in a handler:@app.route("/show/template")defhandler_with_template(req,resp):resp.html=app.template("example.html",context={"title":"Awesome Framework","body":"welcome to the future!"})Static FilesJust like templates, the default folder for static files isstaticand you can override it:app=API(static_dir="static_dir_name")Then you can use the files inside this folder in HTML files:<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><title>{{title}}</title><linkhref="/static/main.css"rel="stylesheet"type="text/css"></head><body><h1>{{body}}</h1><p>This is a paragraph</p></body></html>MiddlewareYou can create custom middleware classes by inheriting from thezyne.middleware.Middlewareclass and overriding its two methods that are called before and after each request:fromzyne.apiimportAPIfromzyne.middlewareimportMiddlewareapp=API()classSimpleCustomMiddleware(Middleware):defprocess_request(self,req):print("Before dispatch",req.url)defprocess_response(self,req,res):print("After dispatch",req.url)app.add_middleware(SimpleCustomMiddleware)
zynet
No description available on PyPI.
zynlp
sourcecode seehttps://github.com/zynlp/zynlpmore info seehttp://www.zynlp.com
zy-package
Example PackageThis is a simple example package. You can useGithub-flavored Markdownto write your content.
zype
zype-python 0.2.0A simple wrapper around Zype API inspired by SoundCloud APIclient.InstallationRun:pip install zypeTo use:from zype import Zype client = Zype(api_key="<YOUR API KEY>")ExamplesTo get all videos available on your account, you can do:from zype import Zype client = Zype(api_key="<YOUR API KEY>") videos = client.get('videos') if videos is not None: for v in videos: print v.title
zypl-macro
IntroductionThis here is a Python interface module meant to streamline obtaining macroeconomic data from Zypl.ai's alternative data API macro endpoint. It offers a few simple methods to obtain the data from server and store it locally for future usage, whatever that may be.Please keep in mind that for succesfull usage of this module it is absolutely essential for you to be in a good mood and healthy disposition, otherwise it might not work. To be fair, it might not work either way, but if you meet the requirement stated above you, at the very least, won't get upset by this fact nearly as much.UsageThis module is obtained from pip with the usual installation line:pip install zypl_macroIf you're not running your machine under Windows or do not know how to use pip, please referherefor pointers. It is all very straightforward.After installing the module first order of business is to import and instantiate its utility class, like so:from zypl_macro.library import DataGetter getter_instance = DataGetter()After this you're going to have to provide authorization token aka API key in order to be allowed to query data endpoint. It is done via a dedicated method:getter_instance.auth('your-very-very-secret-token')You can get an API key from zypl's alternative data API server administration, if they'll feel like providing you with one. Please don't lose it. Once you succesfully got an instance of the class in your code and provided it with the token, you can start querying data. For now there are three main methods you can utilize.get_countriesYou can obtain the list of all the countries supported in alt data system calling this method.getter_instance.get_countries()get_indicatorsWorks similar to the previous one and provides you with a list of all the macroeconomic indicators in the database. You can call with a country specified in order to get only indicators pertaining to that country, otherwise you're gonna get them all.getter_instance.get_indicators(country='Uzbekistan')get_dataThis is the main method that allows you to obtain the data itself. The only mandatory argument is the country you want your data on:getter_instance.get_data(country='Tajikistan')You can also provide it withstartandendarguments to specify the date range you want to get your data in. Dates must be in iso format, e.g. YYYY-MM-DD.getter_instance.get_data(country='Tajikistan', start='2020-02-01', end='2022-02-01')You can provide either of these arguments or both of them or none, it'll be fine.frequencyargument lets you pick the frequency (duh) of the data you're going to get. Indicators are grouped by frequencies of their collection, which goes as follows: Daily, Monthly, Quarterly, Yearly. You'll get different sets of indicators depending on this argument.getter_instance.get_data(country='Tajikistan', frequency='Monthly')indicatorsargument lets you specify exact list of indicators you want to obtain. It should be passed as a list or tuple containing names of desired indicators as strings. These are case sensitive and should match exactly what you get from get_indicators(), so keep it in mind.getter_instance.get_data(country='Tajikistan', indicators=['GDP', 'Inflation Food'])Take care if you specify indicators together with frequency. The latter takes priority, so you might not get all the indicators you asked for if some of them aren't in selected frequency group.MiscAll the utility functions return either pandas dataframe or stringified message of the error occured, if any. You're free to do with them what you will, just don't forget to actually check what you got returned.If alt data API endpoint gets changed or moved somewhere (it shouldn't, but weirder things has been known to happen), this module is not going to work properly. In this case, and if you happen to know its new living address, you can call _set_url method to point the module there. Please don't touch this method otherwise, things will break.
zypper-patch-status-collector
This queries the current patch status of the system from Zypper and exports it in a format compatible with thePrometheus Node Exporter’stextfile collector.Usage# HELP zypper_applicable_patches The current count of applicable patches # TYPE zypper_applicable_patches gauge zypper_applicable_patches{category="security",severity="critical"} 0 zypper_applicable_patches{category="security",severity="important"} 2 zypper_applicable_patches{category="security",severity="moderate"} 0 zypper_applicable_patches{category="security",severity="low"} 0 zypper_applicable_patches{category="security",severity="unspecified"} 0 zypper_applicable_patches{category="recommended",severity="critical"} 0 zypper_applicable_patches{category="recommended",severity="important"} 0 zypper_applicable_patches{category="recommended",severity="moderate"} 0 zypper_applicable_patches{category="recommended",severity="low"} 0 zypper_applicable_patches{category="recommended",severity="unspecified"} 0 zypper_applicable_patches{category="optional",severity="critical"} 0 zypper_applicable_patches{category="optional",severity="important"} 0 zypper_applicable_patches{category="optional",severity="moderate"} 0 zypper_applicable_patches{category="optional",severity="low"} 0 zypper_applicable_patches{category="optional",severity="unspecified"} 0 zypper_applicable_patches{category="feature",severity="critical"} 0 zypper_applicable_patches{category="feature",severity="important"} 0 zypper_applicable_patches{category="feature",severity="moderate"} 0 zypper_applicable_patches{category="feature",severity="low"} 0 zypper_applicable_patches{category="feature",severity="unspecified"} 0 zypper_applicable_patches{category="document",severity="critical"} 0 zypper_applicable_patches{category="document",severity="important"} 0 zypper_applicable_patches{category="document",severity="moderate"} 0 zypper_applicable_patches{category="document",severity="low"} 0 zypper_applicable_patches{category="document",severity="unspecified"} 0 zypper_applicable_patches{category="yast",severity="critical"} 0 zypper_applicable_patches{category="yast",severity="important"} 0 zypper_applicable_patches{category="yast",severity="moderate"} 0 zypper_applicable_patches{category="yast",severity="low"} 0 zypper_applicable_patches{category="yast",severity="unspecified"} 0 # HELP zypper_service_needs_restart Set to 1 if service requires a restart due to using no-longer-existing libraries. # TYPE zypper_service_needs_restart gauge zypper_service_needs_restart{service="nscd"} 1 zypper_service_needs_restart{service="dbus"} 1 zypper_service_needs_restart{service="cups"} 1 zypper_service_needs_restart{service="sshd"} 1 zypper_service_needs_restart{service="cron"} 1 # HELP zypper_product_end_of_life Unix timestamp on when support for the product will end. # TYPE zypper_product_end_of_life gauge zypper_product_end_of_life{product="openSUSE"} 1606694400 zypper_product_end_of_life{product="openSUSE_Addon_NonOss"} 1000000000000001 # HELP zypper_needs_rebooting Whether the system requires a reboot as core libraries or services have been updated. # TYPE zypper_needs_rebooting gauge zypper_needs_rebooting 0 # HELP zypper_scrape_success Whether the last scrape for zypper data was successful. # TYPE zypper_scrape_success gauge zypper_scrape_success 1To get this picked up by thePrometheus Node Exporter’stextfile collector dump the output into azypper.promfile in the textfile collector directory. You can utilise the--output-fileparameter to have the exporter write directly to that file.:> zypper-patch-status-collector --output-file /var/lib/node_exporter/collector/zypper.promInstallationRunning this requires Python.Install as any Python software via pip:pip install zypper-patch-status-collectorIt also requires the reboot advisory and the lifecycle plug-in for zypper to be installed:zypper install zypper-needs-restarting zypper-lifecycle-pluginTestsThe tests are based onpytest. Just run the following in the project root:pytestThe default configuration requires the following Python packages to be available:pytestpytest-covpytest-mockLicenseThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.You can find a full version of the license in theLICENSE file. If not, seehttps://www.gnu.org/licenses/.
zyppnotify
NotifySending mails and teams messages in a smart way. This project makes it easy to send basic messages through Teams or Email.Installationpip install zyppnotifyNotify MailWhen using theNotifyMailclass, the environment variablesEMAIL_USER(mailadress you want to mail with),MAIL_TENANT_ID,MAIL_CLIENT_IDandMAIL_CLIENT_SECRET(3x App registration credentials with User.Read.All permission with admin consent to authenticate to MS Graph) need to be set. The initialization of this class will return an error if one of thes variables is not set.fromnotifyimportNotifyMail,NotifyTeams# versturen van een basis bericht met onderwerp en tekstmail=NotifyMail(to="[email protected]",subject="Notify me!",message="This is a test message, send through the notify package")mail.send_email()Notify TeamsfromnotifyimportNotifyTeamsfromnotify.testsimportimport_sample_dfswebhook=("REPLACE_ME")teams=NotifyTeams(webhook=webhook)# versturen van een basis bericht met onderwerp en tekstteams.basic_message(title="Notify me!",message="This is a test message, send through the notify package")# versturen van een uitgebreid rapport over dataframes.dfs=import_sample_dfs()teams.basic_message(title="Notify me!",message="This is optional",buttons={"button_name":"https://www.my_link.nl"},dfs=dfs)# creates a report on the dataframes processed.Notify utilsfromnotifyimportformat_numbers,dataframe_to_htmlfromnotify.testsimportimport_sample_dfsdf=import_sample_dfs().get("Transactions")# format numbers and currencies using dutch localedf=format_numbers(df,currency_columns=["amount"],number_columns=[])html_table=dataframe_to_html(df)
zy-predict-tool
## zy-predict-tool
zypzctest
No description available on PyPI.
zyrdeku
还海奥华
zyr-distributions
No description available on PyPI.
zyr-zhuanshu
zyr studio exclusive library, using the method 1.jindu() to create a progress bar 2.cc () word-by-word output 3.getsum() to sum
zys0428
No description available on PyPI.
zyt
No description available on PyPI.
zyte
No description available on PyPI.
zyte-api
Python client libraries forZyte API.Command-line utility and asyncio-based library are provided by this package.Installationpip install zyte-apizyte-apirequires Python 3.7+.API keyMake sure you have an API key for theZyte APIservice. You can setZYTE_API_KEYenvironment variable with the key to avoid passing it around explicitly.Read thedocumentationfor more information.License is BSD 3-clause.Documentation:https://python-zyte-api.readthedocs.ioSource code:https://github.com/zytedata/python-zyte-apiIssue tracker:https://github.com/zytedata/python-zyte-api/issuesChanges0.4.8 (2023-11-02)Include the Zyte API request ID value in a new.request_idattribute inzyte_api.aio.errors.RequestError.0.4.7 (2023-09-26)AsyncClientnow lets you set a custom user agent to send to Zyte API.0.4.6 (2023-09-26)Increased the client timeout to match the server’s.Mentioned theapi_keyparameter ofAsyncClientin the docs example.0.4.5 (2023-01-03)w3lib >= 2.1.1 is required in install_requires, to ensure that URLs are escaped properly.unnecessaryrequestslibrary is removed from install_requiresfixed tox 4 support0.4.4 (2022-12-01)Fixed an issue with submitting URLs which contain unescaped symbolsNew “retrying” argument for AsyncClient.__init__, which allows to set custom retrying policy for the client--dont-retry-errorsargument in the CLI tool0.4.3 (2022-11-10)Connections are no longer reused between requests. This reduces the amount ofServerDisconnectedErrorexceptions.0.4.2 (2022-10-28)Bump minimumaiohttpversion to 3.8.0, as earlier versions don’t support brotli decompression of responsesDeclared Python 3.11 support0.4.1 (2022-10-16)Network errors, like server timeouts or disconnections, are now retried for up to 15 minutes, instead of 5 minutes.0.4.0 (2022-09-20)Require to installBrotlias a dependency. This changes the requests to haveAccept-Encoding:brand automatically decompress brotli responses.0.3.0 (2022-07-29)Internal AggStats class is cleaned up:AggStats.n_extracted_queriesattribute is removed, as it was a duplicate ofAggStats.n_resultsAggStats.n_resultsis renamed toAggStats.n_successAggStats.n_input_queriesis removed as redundant and misleading; AggStats got a newAggStats.n_processedproperty instead.This change is backwards incompatible if you used stats directly.0.2.1 (2022-07-29)aiohttp.client_exceptions.ClientConnectorErroris now treated as a network error and retried accordingly.Removed the unusedzyte_api.syncmodule.0.2.0 (2022-07-14)Temporary download errors are now retried 3 times by default. They were not retried in previous releases.0.1.4 (2022-05-21)This release contains usability improvements to the command-line script:Instead ofpython-mzyte_apiyou can now run it aszyte-api;the type of the input file (--intypeargument) is guessed now, based on file extension and content; .jl, .jsonl and .txt files are supported.0.1.3 (2022-02-03)Minor documenation fixRemove support for Python 3.6Added support for Python 3.100.1.2 (2021-11-10)Default timeouts changed0.1.1 (2021-11-01)CHANGES.rst updated properly0.1.0 (2021-11-01)Initial release.
zyte-api-convertor
zyte-api-convertorA Python module to convert Zyte API Json payload toScrapy ZyteAPIproject. It uses Scrapy and scrapy-zyte-api plugin to generate the project, also it uses black to format the code.RequirementsPython 3.6+ Scrapy scrapy-zyte-api blackDocumentationZyte API DocumentationTest the Zyte API payload using postman or curl. Once it gives the desired response, use the same payload with this module to convert it to a Scrapy ZyteAPI project.Installationpip install zyte-api-convertorUsageUsage:zyte-api-convertor<payload>--project-name<project_name>--spider-name<spider_name>Example:zyte-api-convertor'{"url": "https://httpbin.org/ip", "browserHtml": true, "screenshot": true}'--project-namesample_project--spider-namesample_spiderUsage:zyte-api-convertor<payload>--project-name<project_name>Example:zyte-api-convertor'{"url": "https://httpbin.org/ip", "browserHtml": true, "screenshot": true}'--project-namesample_projectUsage:zyte-api-convertor<payload>--spider-name<spider_name>Example:zyte-api-convertor'{"url": "https://httpbin.org/ip", "browserHtml": true, "screenshot": true}'--spider-namesample_spiderUsage:zyte-api-convertor<payload>Example:zyte-api-convertor'{"url": "https://httpbin.org/ip", "browserHtml": true, "screenshot": true}'Examplezyte-api-convertor expects a valid json payload at the least. But it does have other options as well. You can use the--project-nameand--spider-nameoptions to set the project and spider name. If you don't use these options, it will use the default project and spider name.zyte-api-convertor'{"url": "https://httpbin.org/ip", "browserHtml": true, "screenshot": true}'--project-namesample_project--spider-namesample_spiderOutput:mukthy@Mukthys-MacBook-Pro%zyte-api-convertor'{"url": "https://httpbin.org/ip", "browserHtml": true, "screenshot": true}'--project-namesample_project--spider-namesample_spider CodeGenerated! Writingtofile... WritingDone! reformattedsample_project/sample_project/spiders/sample_project.py Alldone!✨🍰✨1filereformatted. FormattingDone!Project Created Successfully.mukthy@Mukthys-MacBook-Pro%sample_project%tree . ├──sample_project │├──__init__.py │├──items.py │├──middlewares.py │├──pipelines.py │├──settings.py │└──spiders │├──__init__.py │└──sample_project.py └──scrapy.cfg3directories,8filesSample Spider Code:importscrapyclassSampleQuotesSpider(scrapy.Spider):name="sample_spider"custom_settings={"DOWNLOAD_HANDLERS":{"http":"scrapy_zyte_api.ScrapyZyteAPIDownloadHandler","https":"scrapy_zyte_api.ScrapyZyteAPIDownloadHandler",},"DOWNLOADER_MIDDLEWARES":{"scrapy_zyte_api.ScrapyZyteAPIDownloaderMiddleware":1000},"REQUEST_FINGERPRINTER_CLASS":"scrapy_zyte_api.ScrapyZyteAPIRequestFingerprinter","TWISTED_REACTOR":"twisted.internet.asyncioreactor.AsyncioSelectorReactor","ZYTE_API_KEY":"YOUR_API_KEY",}defstart_requests(self):yieldscrapy.Request(url="https://httpbin.org/ip",meta={"zyte_api":{"javascript":False,"screenshot":True,"browserHtml":True,"actions":[],"requestHeaders":{},"geolocation":"US","experimental":{"responseCookies":False},}},)defparse(self,response):print(response.text)Please note that theZYTE_API_KEYis not set in thecustom_settingsof the spider. You need to set it before running it.
zyte-autoextract
Python client libraries forZyte Automatic Extraction API. It allows to extract product, article, job posting, etc. information from any website - whatever the API supports.Command-line utility, asyncio-based library and a simple synchronous wrapper are provided by this package.License is BSD 3-clause.Installationpip install zyte-autoextractzyte-autoextract requires Python 3.6+ for CLI tool and for the asyncio API; basic, synchronous API works with Python 3.5.UsageFirst, make sure you have an API key. To avoid passing it inapi_keyargument with every call, you can setZYTE_AUTOEXTRACT_KEYenvironment variable with the key.Command-line interfaceThe most basic way to use the client is from a command line. First, create a file with urls, an URL per line (e.g.urls.txt). Second, setZYTE_AUTOEXTRACT_KEYenv variable with your Zyte Automatic Extraction API key (you can also pass API key as--api-keyscript argument).Then run a script, to get the results:python -m autoextract urls.txt --page-type article --output res.jlNoteThe results can be stored in an order which is different from the input order. If you need to match the output results to the input URLs, the best way is to usemetafield (see below); it is passed through, and returned as-is inrow["query"]["userQuery"]["meta"].If you need more flexibility, you can customize the requests by creating a JsonLines file with queries: a JSON object per line. You can pass any Zyte Automatic Extraction options there. Example - store it inqueries.jlfile:{"url": "http://example.com", "meta": "id0", "articleBodyRaw": false} {"url": "http://example.com/foo", "meta": "id1", "articleBodyRaw": false} {"url": "http://example.com/bar", "meta": "id2", "articleBodyRaw": false}SeeAPI docsfor a description of all supported parameters in these query dicts. API docs mention batch requests and their limitation (no more than 100 queries at time); these limits don’t apply to the queries.jl file (i.e. it may have millions of rows), as the command-line script does its own batching.Note that in the examplepageTypeargument is omitted;pageTypevalues are filled automatically from--page-typecommand line argument value. You can also set a differentpageTypefor a row inqueries.jlfile; it has a priority over--page-typepassed in cmdline.To get results for thisqueries.jlfile, run:python -m autoextract --intype jl queries.jl --page-type article --output res.jlProcessing speedEach API key has a limit on RPS. To get your URLs processed faster you can tune concurrency options: batch size and a number of connections.Best options depend on the RPS limit and on websites you’re extracting data from. For example, if your API key has a limit of 3RPS, and average response time you observe for your websites is 10s, then to get to these 3RPS you may set e.g. batch size = 2, number of connections = 15 - this would allow to process 30 requests in parallel.To set these options in the CLI, use--n-connand--batch-sizearguments:python -m autoextract urls.txt --page-type articles --n-conn 15 --batch-size 2 --output res.jlIf too many requests are being processed in parallel, you’ll be getting throttling errors. They are handled by CLI automatically, but they make extraction less efficient; please tune the concurrency options to not hit the throttling errors (HTTP 429) often.You may be also limited by the website speed. Zyte Automatic Extraction tries not to hit any individual website too hard, but it could be better to limit this on a client side as well. If you’re extracting data from a single website, it could make sense to decrease the amount of parallel requests; it can ensure higher success ratio overall.If you’re extracting data from multiple websites, it makes sense to spread the load across time: if you have websites A, B and C, don’t send requests in AAAABBBBCCCC order, send them in ABCABCABCABC order instead.To do so, you can change the order of the queries in your input file. Alternatively, you can pass--shuffleoptions; it randomly shuffles input queries before sending them to the API:python -m autoextract urls.txt –shuffle –page-type articles –output res.jlRunpython-mautoextract--helpto get description of all supported options.ErrorsThe following errors could happen while making requests:Network errorsRequest-level errorsAuthentication failureMalformed requestToo many queries in requestRequest payload size is too largeQuery-level errorsDownloader errorsProxy errors…Some errors can be retried while others can’t.For example, you can retry a query with a Proxy Timeout error because this is a temporary error and there are chances that this response will be different within the next retries.On the other hand, it makes no sense to retry queries that return a 404 Not Found error because the response is not supposed to change if retried.RetriesBy default, we will automatically retry Network and Request-level errors. You could also enable Query-level errors retries by specifying the--max-query-error-retriesargument.Enable Query-level retries to increase the success rate at the cost of more requests being performed if you are interested in a higher success rate.python -m autoextract urls.txt --page-type articles --max-query-error-retries 3 --output res.jlFailing queries are retried until the max number of retries or a timeout is reached. If it’s still not possible to fetch all queries without errors, the last available result is written to the output including both queries with success and the ones with errors.Synchronous APISynchronous API provides an easy way to try Zyte Automatic Extraction. For production usage asyncio API is strongly recommended. Currently the synchronous API doesn’t handle throttling errors, and has other limitations; it is most suited for quickly checking extraction results for a few URLs.To send a request, userequest_rawfunction; consult with theAPI docsto understand how to populate the query:from autoextract.sync import request_raw query = [{'url': 'http://example.com.foo', 'pageType': 'article'}] results = request_raw(query)Note that if there are several URLs in the query, results can be returned in arbitrary order.There is also aautoextract.sync.request_batchhelper, which accepts URLs and page type, and ensures results are in the same order as requested URLs:from autoextract.sync import request_batch urls = ['http://example.com/foo', 'http://example.com/bar'] results = request_batch(urls, page_type='article')NoteCurrently request_batch is limited to 100 URLs at time only.asyncio APIBasic usage is similar to the sync API (request_raw), but asyncio event loop is used:from autoextract.aio import request_raw async def foo(): query = [{'url': 'http://example.com.foo', 'pageType': 'article'}] results1 = await request_raw(query) # ...There is alsorequest_parallel_as_completedfunction, which allows to process many URLs in parallel, using both batching and multiple connections:import sys from autoextract.aio import request_parallel_as_completed, create_session from autoextract import ArticleRequest async def extract_from(urls): requests = [ArticleRequest(url) for url in urls] async with create_session() as session: res_iter = request_parallel_as_completed(requests, n_conn=15, batch_size=2, session=session) for fut in res_iter: try: batch_result = await fut for res in batch_result: # do something with a result, e.g. print(json.dumps(res)) except RequestError as e: print(e, file=sys.stderr) raiserequest_parallel_as_completedis modelled afterasyncio.as_completed(seehttps://docs.python.org/3/library/asyncio-task.html#asyncio.as_completed), and actually uses it under the hood.Notefrom autoextract import ArticleRequestand its usage in the example above. There are several Request helper classes, which simplify building of the queries.request_parallel_as_completedandrequest_rawfunctions handle throttling (http 429 errors) and network errors, retrying a request in these cases.CLI interface implementation (autoextract/__main__.py) can serve as an usage example.Request helpersTo query Zyte Automatic Extraction you need to create a dict with request parameters, e.g.:{'url': 'http://example.com.foo', 'pageType': 'article'}To simplify the library usage and avoid typos, zyte-autoextract provides helper classes for constructing these dicts:* autoextract.Request * autoextract.ArticleRequest * autoextract.ProductRequest * autoextract.JobPostingRequestYou can pass instances of these classes instead of dicts everywhere when requests dicts are accepted. So e.g. instead of writing this:query = [{"url": url, "pageType": "article"} for url in urls]You can write this:query = [Request(url, pageType="article") for url in urls]or this:query = [ArticleRequest(url) for url in urls]There is one difference:articleBodyRawparameter is set toFalseby default when Request or its variants are used, while it isTrueby default in the API.You can override API params passing a dictionary with extra data using theextraargument. Note that it will overwrite any previous configuration made using standard attributes likearticleBodyRawandfullHtml.Extra parameters example:request = ArticleRequest( url=url, fullHtml=True, extra={ "customField": "custom value", "fullHtml": False } )This will generate a query that looks like this:{ "url": url, "pageType": "article", "fullHtml": False, # our extra parameter overrides the previous value "customField": "custom value" # not a default param but defined even then }ContributingSource code:https://github.com/zytedata/zyte-autoextractIssue tracker:https://github.com/zytedata/zyte-autoextract/issuesUsetoxto run tests with different Python versions:toxThe command above also runs type checks; we use mypy.Changes0.7.1 (2021-11-24)–disable-cert-validation option to disable TSL certificates validation.0.7.0 (2021-02-10)Update to accommodate upstream rebranding changes, as Scrapinghub has become Zyte.This update involves some major changes:The repository name and the package name in the Python Package Index have changed fromscrapinghub-autoextracttozyte-autoextract.TheSCRAPINGHUB_AUTOEXTRACT_KEYenvironment variable has been renamed toZYTE_AUTOEXTRACT_KEY.0.6.1 (2021-01-27)fixedmax_retriesbehaviour. Total attempts must be max_retries + 10.6.0 (2020-12-29)CLI changes: error display in the progress bar is changed; summary is printed after the executionsmore errors are retried when retrying is enabled, which allows for a higher success ratefixed tcp connection poolingautoextract.aio.request_rawfunction allows to pass custom headers to the API (not to remote websites)autoextract.aio.request_rawnow allows to customize the retry behavior, viaretryingargumenttenacity.RetryErroris no longer raised by the library; concrete errors are raised insteadPython 3.9 supportCI is moved from Travis to Github Actions0.5.2 (2020-11-27)QueryErroris renamed to_QueryError, as this is not an error users of the library ever see.Retrials were broken by having userAgent in the userQuery API output; temporary workaround is added to make retrials work again.0.5.1 (2020-08-21)fix a problem that was preventing calls torequest_rawwhenendpointargument wasNone0.5.0 (2020-08-21)add--api-endpointoption to the command line utilityimproves documentation adding details aboutRequest’s extra parameters0.4.0 (2020-08-17)autoextract.Requesthelper class now allows to set arbitrary parameters for AutoExtract requests - they can be passed inextraargument.0.3.0 (2020-07-24)In this release retry-related features are added or improved. It is now possible to fix some of the temporary errors by enabling query-level retries, and the default retry behavior is improved.backwards-incompatible: autoextract.aio.ApiError is renamed to autoextract.aio.RequestErrormax_query_error_retriesargument is added toautoextract.aio.request_rawandautoextract.aio.request_parallel_as_completedfunctions; it allows to enable retries of temporary query-level errors returned by the API.CLI: added--max-query-error-retriesoption to retry temporary query-level errors.HTTP 500 errors from server are retried now;documentation and test improvements.0.2.0 (2020-04-15)asyncio API is rewritten, to simplify use in cases where passing meta is required.autoextract.aio.request_parallel_as_completedis added,autoextract.aio.request_parallelandautoextract.aio.request_batchare removed.CLI: it now shows various stats: mean response and connect time, % of throttling errors, % of network and other errorsCLI: new--intypejloption allows to process a .jl file with arbitrary AutoExtract API queriesCLI: new--shuffleoption allows to shuffle input data, to spread it more evenly across websites.CLI: it no longer exits on unrecoverable errors, to aid long-running processing tasks.retry logic is adjusted to handle network errors better.autoextract.aio.request_rawandautoextract.aio.request_parallel_as_completedfunctions provide an interface to return statistics about requests made, including retries.autoextract.Request, autoextract.ArticleRequest, autoextract.ProductRequest, autoextract.JobPostingRequest helper classesDocumentation improvements.0.1.1 (2020-03-12)allow up to 100 elements in a batch, not up to 99custom User-Agent header is addedPython 3.8 support is declared & tested0.1 (2019-10-09)Initial release.
zyte-common-items
zyte-common-itemsis a Python 3.8+ library ofitemandpage objectclasses for web data extraction that we use atZyteto maximize opportunities for code reuse.Documentation:https://zyte-common-items.readthedocs.io/en/latest/License: BSD 3-clause
zyte-parsers
zyte-parsersis a Python 3.7+ library that contains functions to extract data from webpage parts.Documentation:https://zyte-parsers.readthedocs.io/en/latest/License: BSD 3-clause
zytesc
No description available on PyPI.
zyte-scrapycloud-cli
No description available on PyPI.
zyte-spider-templates
Spider templates for automatic crawlers.This library containsScrapyspider templates. They can be used out of the box with the Zyte features such asZyte APIor modified to be used standalone. There is asample Scrapy projectfor this library that you can use as a starting point for your own projects.Documentation:https://zyte-spider-templates.readthedocs.io/en/latest/License: BSD 3-clause
zyte-spmstats
Zyte-spmstatsIt is a small python module for interacting with Zyte Smart Proxy Manager Stats APIDocumentationZyte SPM Stats API DocumentationInstallationpip install zyte-spmstatsUsageFor a single domain/netloc:python -m zyte.spmstats <ORG-API> amazon.com 2022-06-15T18:50:00 2022-06-17T23:00Output:{ "failed": 0, "clean": 29, "time_gte": "2022-06-10T18:55:00", "concurrency": 0, "domain": "amazon.com", "traffic": 3865060, "total_time": 1945 },For a multiple domain/netloc:python -m zyte.spmstats <ORG-API> amazon.com,pharmamarket.be 2022-06-15T18:50:00 2022-06-17T23:00Output:"results": [ { "failed": 88, "clean": 230, "time_gte": "2022-06-13T07:50:00", "concurrency": 1, "domain": "pharmamarket.be", "traffic": 3690976, "total_time": 2386 }, { "failed": 224, "clean": 8497, "time_gte": "2022-06-16T01:45:00", "concurrency": 80, "domain": "amazon.com", "traffic": 2280046474, "total_time": 1373 }]
zytestpip
No description available on PyPI.
zy-test-pip
No description available on PyPI.
zython
zythonExpress constraint programming problem with python and solve it with minizinc.Constraint programming (CP) is a paradigm for solving combinatorial problems. Minizinc is used for model and optimization problems solving using CP. You can express a model as a number of parameter, variables and constraints - minizinc will solve it (or said it if there isn't any solution).If you are wonder which digit should be assigned to letters, so the expressionSEND+MORE=MONEYwill be hold, or how many color you should have to brush map of Australia and two states with the same border won't have any common color, or try to understand which units you should hire in your favourite strategy game, so you will have the strongest army for that amount of money you can use CP.Zython lets you express such model with pure python, so there is no need to learn a new language, and you can easily integrate CP into your python programs.Getting StartedPrerequisitesYou should have minizinc 2.6.0+ install and have it executable in$PATH. You can download it fromofficial site.Python 3.8+Installationpip install zythonUsageOur first example will be quadratic equation solving.It can be expressed in minizinc as:var -100..100: x; int: a; int: b; int: c; constraint a*(x*x) + b*x = c; solve satisfy;or usingminizinc-pythonpackage asimport minizinc # Create a MiniZinc model model = minizinc.Model() model.add_string(""" var -100..100: x; int: a; int: b; int: c; constraint a*(x*x) + b*x = c; solve satisfy; """) # Transform Model into a instance gecode = minizinc.Solver.lookup("gecode") inst = minizinc.Instance(gecode, model) inst["a"] = 1 inst["b"] = 4 inst["c"] = 0 # Solve the instance result = inst.solve(all_solutions=True) for i in range(len(result)): print("x = {}".format(result[i, "x"]))While zython makes it possible to describe this model using python only:class MyModel(zython.Model): def __init__(self, a: int, b: int, c: int): self.a = var(a) self.b = var(b) self.c = var(c) self.x = var(range(-100, 101)) self.constraints = [self.a * self.x ** 2 + self.b * self.x + self.c == 0] model = MyModel(1, 4, 0) result = model.solve_satisfy(all_solutions=True)CollaborationZython uses the following libraries:Test is created withpytestlibrarynoxfor test executionrufffor coding style checkingsphinxfor documentationRequirements necessary for zython run specified inrequirements.txtfile, while testing and development requirements are specified inrequirements_dev.txt, and documentation requirements are inrequirements_doc.txt. For example, if you decided to fix bug, and you need no documentation fixes, you shouldn't installrequirements_doc.txt. Project can be cloned from github and all dependencies can be installed via pip.git clone [email protected]:ArtyomKaltovich/zython.git python -m venv /path/to/new/venv if needed pip install -r requirements.txt pip install -r requirements_dev.txtThe project has CI pipeline which check code stile and run some tests. Before submitting PR it is recommended to run all the checks locally by executing the following command:nox --reuse-existing-virtualenvsIt is recommended to open new issue and describe a bug or feature request before submitting PR. While implementing new feature or fixing bug it is necessary to add tests to cover it.Good Luck and thank you for improvements. :)Coverage metricTo check coverage for all tests (both doc and unit tests) you should run the following command:pytesttestzythondoc--doctest-glob="*.rst"--doctest-modules--cov=zython--cov-branch--cov-report=term-missing
zytlib
pyctlibIntroductionPackagepyctlibis the fundamental package for projectPyCTLib, a powerful toolkit for python development. This package provides basic functions for fastpython v3.6+programming. It provides easy communication with the inputs and outputs for the operating systems. It provides quick try-catch functiontouch, useful types likevector, timing tools liketimethisandscopeas long as manipulation of file path, reading & writing of text/binary files and command line tools.InstallationThis package can be installed bypip install pyctlibor moving the source code to the directory of python libraries (the source code can be downloaded ongithuborPyPI).pipinstallpyctlibBasic Typesvectorvectoris an improved implement oflistfor python. In addition to original function forlist, it has the following advanced usage:In[1]:frompyctlib.basictypeimportvectorIn[2]:a=vector([1,2,3,4,5,6,7,8,9,10])In[3]:a.map(lambdax:x*2)Out[3]:[2,4,6,8,10,12,14,16,18,20]In[4]:a.filter(lambdax:x%2==0)Out[4]:[2,4,6,8,10]In[5]:a.all(lambdax:x>1)Out[5]:FalseIn[6]:a.any(lambdax:x==2)Out[6]:TrueIn[7]:a[a>7]=7In[8]:aOut[8]:[1,2,3,4,5,6,7,7,7,7]In[9]:a.reduce(lambdax,y:x+y)Out[9]:49In[10]:a.index(lambdax:x%4==0)Out[10]:3File ManagementTiming Toolsscope>>>frompyctlibimportscope,jump>>>withscope("name1"):...print("timed1")...timed1[name1takes0.000048s]>>>withscope("name2"),jump:...print("timed2")...>>>timethis>>>frompyctlibimporttimethis>>>@timethis...deffunc():print('timed')...>>>func()timed[functakes0.000050s]Touch function>>>frompyctlibimporttouch>>>touch(lambda:1/0,'error')'error'>>>touch('a')>>>a=4>>>touch('a')4Acknowledgment@Yiteng Zhang, Yuncheng Zhou: Developers
zy-tools
1: cd to setup.py 2: python3 setup.py sdist build 3: twine upload dist/*
zyutil
UNKNOWN
zyw
No description available on PyPI.
zyxelprometheus
zyxelprometheusGet statistics from a Zyxel router and expose them to Prometheus.Running[--passwd [PASSWD]] [--bind [BIND]] [-d] [--raw] [--traffic-only] [--xdsl-only] optional arguments: -h, --help show this help message and exit --host [HOST] the host name to connect to (must start with https://) --user [USER] the user name to use (can also be set with $ZYXEL_USER) --passwd [PASSWD] the password to use (can also be set with $ZYXEL_PASSWD) --bind [BIND] the ip address and port to bind to when running in server mode (-d) -d, --serve run in server mode, collecting the statistics each time /metrics is requested --raw prints out the raw values collected from the router and exits --traffic-only only requests traffic data --xdsl-only only requests XDSL data
zyxel-t50-modem
Zyxel T50A small wrapper for the Zyxel T50 modem.It can retrieve basic status of the modem and a list of connected devices. This is used for adevice tracking integrationofHome Assistant.Simple exampleimportjsonfromzyxelt50.modemimportZyxelT50Modemrouter=ZyxelT50Modem('#YOUR ADMIN PASSWORD#')router.connect()status=router.get_connected_devices()print(json.dumps(status,indent=4))
zyxTest
this is home page
zyx-tools
usageinstallpip install zyx_toolslogprintfrom zyx_tools import OtherToolinit logprintmust in main startOtherTool.init_log()start print log filetail = logprint.Tail(log_name,"build_log") tail.daemon = True tail.start()close print log threadtail.stop()
zyytif
No description available on PyPI.
zyz
Python Toolkit of Yuanzhen Zhou.
zyzFlask
No description available on PyPI.
zyz-hello-world
readme hello world
zyzhi
# pypi-helloworldThis is a demo pypi helloworld project to show a PyPI project end2end workflow.Enjoy!
zyzz
========``zyzz``========-------------------Python util modules-------------------
zz
No description available on PyPI.
zzam
A package that makes it easy to convert, parse and process several type of values and data types
zzarpdf
This is the homepage of our project.
zzarrs
No description available on PyPI.
zzaTest
No description available on PyPI.
zz-crawler-api
CrawlAPI Package
zzd
installpip install zzd$$E = MC^2$$
zzda-pkg
Failed to fetch description. HTTP Status Code: 404
zzdb
The light Python DB API wrapper with some ORM functions (MySQL, PostgreSQL, SQLite)Quick start (run demo files)- in docker:gitclonehttps://github.com/AndreiPuchko/zzdb&&cdzzdb/database.docker ./up.sh ./down.sh- on your system:pipinstallzzdb gitclonehttps://github.com/AndreiPuchko/zzdb&&cdzzdb# sqlite:python3./demo/demo.py# mysql and postgresql:pipinstallmysql-connector-pythonpsycopg2-binarypushddatabase.docker&&docker-composeup-d&&popdpython3./demo/demo_mysql.py python3./demo/demo_postgresql.pypushddatabase.docker&&docker-composedown-v&&popdFeatures:Connectfromzzdb.dbimportZzDbdatabase_sqlite=ZzDb("sqlite3",database_name=":memory:")# or justdatabase_sqlite=ZzDb()database_mysql=ZzDb("mysql",user="root",password="zztest"host="0.0.0.0",port="3308",database_name="zztest",)# or justdatabase_mysql=ZzDb(url="mysql://root:[email protected]:3308/zztest")database_postgresql=ZzDb("postgresql",user="zzuser",password="zztest"host="0.0.0.0",port=5432,database_name="zztest1",)Define & migrate database schema (ADD COLUMN only).zzdb.schemaimportZzDbSchemaschema=ZzDbSchema()schema.add(table="topic_table",column="uid",datatype="int",datalen=9,pk=True)schema.add(table="topic_table",column="name",datatype="varchar",datalen=100)schema.add(table="message_table",column="uid",datatype="int",datalen=9,pk=True)schema.add(table="message_table",column="message",datatype="varchar",datalen=100)schema.add(table="message_table",column="parent_uid",to_table="topic_table",to_column="uid",related="name")database.set_schema(schema)INSERT, UPDATE, DELETEdatabase.insert("topic_table",{"name":"topic 0"})database.insert("topic_table",{"name":"topic 1"})database.insert("topic_table",{"name":"topic 2"})database.insert("topic_table",{"name":"topic 3"})database.insert("message_table",{"message":"Message 0 in 0","parent_uid":0})database.insert("message_table",{"message":"Message 1 in 0","parent_uid":0})database.insert("message_table",{"message":"Message 0 in 1","parent_uid":1})database.insert("message_table",{"message":"Message 1 in 1","parent_uid":1})# this returns False because there is no value 2 in topic_table.id - schema works!database.insert("message_table",{"message":"Message 1 in 1","parent_uid":2})database.delete("message_table",{"uid":2})database.update("message_table",{"uid":0,"message":"updated message"})Cursorcursor=database.cursor(table_name="topic_table")cursor=database.cursor(table_name="topic_table",where=" name like '%2%'",order="name desc")cursor.insert({"name":"insert record via cursor"})cursor.delete({"uid":2})cursor.update({"uid":0,"message":"updated message"})cursor=database.cursor(sql="select name from topic_table")forxincursor.records():print(x)print(cursor.r.name)cursor.record(0)['name']cursor.row_count()cursor.first()cursor.last()cursor.next()cursor.prev()cursor.bof()cursor.eof()
zzdeeprollover
ZZDeepRolloverThis code enables the detection of rollovers performed by zebrafish larvae tracked by the open-source softwareZebraZoom. This code is still in "beta mode". For more information visitzebrazoom.orgor email us [email protected] Map:Preparing the rollovers detection modelTesting the rollovers detection modelTraining the rollovers detection modelUsing the rollovers detection modelPreparing the rollovers detection model:The detection of rollovers is based on deep learning. You must first install pytorch on your machine. It may be better to first create an anaconda environment for this purpose.You then need to place the output result folders ofZebraZoominside the folder "ZZoutput" of this repository.In order to train the rollovers detection model, you must also manually classify the frames of some of the tracked videos in order to be able to create a training set. Look inside the folder "manualClassificationExamples" for examples of how to create such manual classifications. You then need to place those manual classifications inside the corresponding output result folders of ZebraZoom.Testing the rollovers detection model:In order to test the accuracy of the rollovers detection model, you can use the script leaveOneOutVideoTest.py, you will need to adjust some variables at the beginning of that script. The variable "videos" is an array that must contain the name of videos for which a manual classification of frames exist and has been placed inside the corresponding output result folder (inside the folder ZZoutput of this repository).The script leaveOneOutVideoTest.py will loop through all the videos learning the model on all but one video and testing on the video left out.Training the rollovers detection model:Once the model has been tested using the steps described in the previous section, you can now learn the final model on all the videos for which a manual classification of frames exist using the script trainModel.py (you will need to adjust a few variables in that script).Using the rollovers detection model:As mentionned above, you can then use the script useModel.py to apply the rollovers detection model on a video.