Saravanan666/pypi-org huggingface dataset:
Package: loggrok
I wrote loggrok a while back as I needed a simple libraryfor analyzing logs.  I am not actively developing loggrok, but please let me know
if you find any bugs etc.Features include:Simple callback system (loggrok.actions)Seemless iteration over multiple rollover-index based log files - smartly joins
broken lines (RollingIndexLogStream)Custom regex-based header and message body matching.Example usage:>>> from loggrok.actions import Action
>>> action = Action()
>>> def printError(entry):
...     print 'err!', str(entry)[:-1]
...
>>> action.addLevelCallback('ERROR', printError)
>>> def printWarning(entry):
...     print 'warning!', str(entry)[:-1]
...
>>> action.addLevelCallback('WARN', printWarning)
>>> from loggrok.log import LogStream
>>> stream = LogStream(fname)
>>> stream.action = action
>>> for entry in stream:
...     continue
...
err! blah blah
warning! blah blah
err! blah blahYou can also write your own regexes for matching custom headers:>>> from loggrok.parse import HeaderParser, MessageParser
>>> header_patt = r'^([a-zA-Z]+) ([a-zA-Z]+) <(\d+)> '
# Entry attributes correspond to groups in regex pattern
>>> header_attrs = ('foo', 'bar', 'baz')
>>> header_parser = HeaderParser(header_patt, header_attrs)
>>> message_patterns = (...) # regexs for message body - after header
>>> message_attrs = (...) # tuple of attribute tuples corresponding to patters
>>> messageParser = MessageParser(message_patterns, message_attrs)
...
>>> stream.messageParser = messageParserSee doctest in tests directory for working examples.To run unit tests:python runtests.pyN.B. - loggrok will emit warning related to “broken” CurriedCallable class, though
it should not cause issues.
Package: loggui
LogGuiGUI for Python loggingInstallationInstall requirementspip3 install -r requirements.txtInstall LogGui!python3 setup.py install(Optionally) Try it out!python3 -m loggui example/just_logging.pyUsageRun scriptpython3 -m loggui path_to_scriptInclude in your codeAdd this in place where you want the GUI to show up:import logging
from loggui import GUILoggerHandler
rlogger = logging.getLogger()
rlogger.setLevel(logging.DEBUG)
rlogger.addHandler(GUILoggerHandler())
Package: loggylog
Complex logging, simple APIInstallationFrom PyPI:$ pip install loggylogFrom the project root directory:$ python setup.py installUsageYou simply instanciate a logger, and give it a log level.
The log level can either be a string or a list. If it is a string, it will
log that log level or greater, eg.'warning'specifies warning, critical, or error.If you use a list, it will only write those log levels.['warning']would only write
warning level log messages to that file.Specifying a string with comma separated values like'info,error'is equivalent to
using['info', 'error'], for convenience if passed as a string through the command line.Ifsudo=True, it will see if it has permission to write to the path, and if not or if
the file does not exist and it does not have permission to create a file there, it will
ask for sudo permission and chown the file. This has no effect if you already have permission,
but is useful for first time runs of applications that write to/var/log/example.logbut don’t
have permission to.It also uses the string methodformattransparently, so this works as expected:>>> log.critical('Approaching {percent:.2%} the speed of light', percent=0.55554)
'Approaching 55.55% the speed of light'See the formatdocumentationfor more examples.Example API usage:from loggylog import Logger

log = Logger()

# default is to write all log messages
log.add_log('./myproject.log')

# write everything but debug level to ./myproject.log
log.add_log('./myproject.log', level='info')

# write error logging to myproject_error.log
log.add_log('./myproject_error.log', level='error')

# display to standard out the following log levels
log.add_log('<stdout>', level=['warning', 'critical', 'error'])

# 'warning' is the same as ['warning', 'critical', 'error'] or just 'warning'
# sudo=True will make sure it has permission to write to a file with that
# path, or get sudo and chown and chmod it appropriately.
log.add_log('/var/log/myproject.log', level='warning', sudo=True)

# ['error'] will just write only error logging
log.add_log('just_errors.log', level=['error'])

# if for some reason CSV is more convenient than a list...
log.add_log('info_and_warning.log', level='info,warning')

# Basic logging
log.debug('debuggybug')
log.info('i got something to tell you')
log.warning('winter is coming')
log.critical('critical temperature in reactor')
log.error('sumthin brken')

# Also, it transparently uses string formatting
log.info("We're going to build a {}", 'wall')
log.info("It's going to be {size}", size='yuge')
# Ordering by integers in braces
log.critical("{1} for {0}", 'me', 'vote')
# See https://docs.python.org/3.1/library/string.html#format-examples
# for more examples.Release Notes0.0.1:Project created
Package: loggz
python-loggzA helper to implement simple but standard and jsonified strategies for logging.Table of ContentsSynopsisUsageInstallationBuildTestsCompatibilityIssuesContributingCreditsResourcesHistoryLicenseSynopsisA helper to implement simple but standard and jsonified strategies for logging.Usageimportloggzloggz.setup()# Initialize logging using default settingsLOG=loggz.factory('root')# Get the logger named `root`# Add an info log including extra values...LOG.info('Values',extra={'values':[1,2,3,5,8,13,2]})Installationpip3installloggzBuildpython3setup.pybuildTestspython3setup.pytestCompatibilityTested usingPython 3.7.IssuesFeel free tosubmit issuesand enhancement requests.ContributingPlease refer to project's style guidelines and guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.Forkthe repo on GitHubClonethe project to your own machineCommitchanges to your own branchPushyour work back up to your forkSubmit aPull requestso that we can review your changesNOTE: Be sure to merge the latest from "upstream" before making a pull request!CreditsThank you very much to this used or integrated open source developments:Israel FLfor theJSON Formatter.MIT License (MIT), Copyright (c) 2018, Israel Flores.ResourcesMaking a Python packageHistoryPlease refer tothe changelog file.LicenseThe MIT LicenseCopyright (c) 2021Deepnox SAS, Paris, France.Permission 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.
Package: log-handler-daily-path
log-handler-daily-path - 一个每日切换日志路径模块About这是一个日志路径每日轮转模块，按照指定方式每日切换日志输出路径。日志输出的路径为： { base_path }/{ yyyy-MM-dd }/{ filename }RequirementsPython3Install通过pip命令安装：pipinstalllog-handler-daily-pathUsageimportloggingfromlog_handler_daily_pathimportDailyRotatingPathHanderlogging.basicConfig(level=logging.DEBUG)log_handler=DailyRotatingPathHander(base_path="/var/log",filename="app.log",backup_days=30)logging.getLogger().addHandler(log_handler)logger=logging.getLogger("Logger")logger.info("xxx")AuthorRocky Peng
Package: log-harvestor-py
log-harvestor-pyDocumentationSeeAPI Docsfor Log-Harvestor API Documetnation.This package is specific toPython.Please see ourdocsfor other supported languages, or use standard HTTP requests.Installationpip install log-harvestor-pyUsageThis package requires that you have aLog Harvestoraccount, andForwarder'screated.
If you have not done this yet:Go toLogHarvestor.comRegister for a new Account (This is free)RegisterCreate a new Forwarder -LinkGenerate a Forwarder TokenNow you can use this forwarder token to send logs, by adding it to the config:fromlogharvestorimportForwarderpvt_token='your_forwarder_token'fwdr=Forwarder(token=token,verbose=True)fwdr.log('test',{"title":'Hello World'})ConfigurationOptionDefaultDescriptionToken""The JWT token assigned to your forwarderApiUrlhttps://app.logharvestor.com/logThis should never change unless using proxiesVerbosefalseVerbose mode prints info to the consoleExamplesConfiguringfromlogharvestorimportForwarderpvt_token:="your_forwarder_token"fwdr=Forwarder(token=token,verbose=True)Test ConnectionfromlogharvestorimportForwarderpvt_token:="your_forwarder_token"fwdr=Forwarder(token=token,verbose=True)success,res=fwdr.test_conn()# `success` != True, the connection failed# `res` contains the error that occured# Error Examle (Invalid Token):#   False, <Response [401]>LoggingfromlogharvestorimportForwarderpvt_token:="your_forwarder_token"fwdr=Forwarder(token=token,verbose=True)# Stringsfwdr.log('test',msg="Hello World!")# Numbersfwdr.log('test',msg=123)# Objects / Dictsfwdr.log('test',msg={"a":123,"b":"456","c":"hello"})# Arrays / Listsfwdr.log('test',msg=["hello","mars","goodbye","world"]))fwdr.log('test',msg=[1,2,34,567,8,90])# Mixedfwdr.log('test',msg={"a":123,"b":{"c":"123","d":{}}})# Nestedfwdr.log('test',msg=[123,"abc",[1,2,3],{"question":"Hello?","answer":"World!"},{"question":"So long?","answer":"Thanks for all the fish!"}])RecomendationsKeep your Logging specific, and consise. This makes searching faster and more accurateNo need to add timestamps or info about the forwarder. This information is automatically included with the log.
Package: loghelper
日志助手特性几乎无需配置，就可生成日志文件可选，输出到文件的同时打印到屏幕可选（安装python-json-logger即可），生成纯文本日志的同时生成一份json格式的日志，方便采集可选（安装flask即可），捕获flask的remote_addr和url信息可选（安装concurrent-log），支持多进程并发记录日志创建logger# 简易用法fromloghelperimportLogHelperlog_helper=LogHelper(log_dir='my_project',log_path='/tmp/')logger=log_helper.create_logger()logger.info('Hello World')# 完整用法importloggingfromloghelperimportLogHelper,ConcurrentTimedRotatingFileHandlerlog_helper=LogHelper(log_dir='my_project',log_path='/var/log/',backup_count=7,when='midnight',timed_rotating_file_handler=ConcurrentTimedRotatingFileHandler)logger=log_helper.create_logger(name='my_module',filename='my_module',add_stream_handler=True,json_ensure_ascii=False,reserved_attrs=['msg','args','levelno','relativeCreated',],level=logging.INFO)logger.info('Hello World')生成日志样例纯文本格式  /tmp/my_project/raw_loghelper.loghelper.Runtime.log<2021-12-15 14:40:38,844> INFO (<stdin> <module> 1) {13064 4474015232 MainThread} [- 127.0.0.1] Hello Worldjson格式 /tmp/my_project/json_loghelper.loghelper.Runtime.log{"message":"Hello World","name":"loghelper.loghelper","levelname":"INFO","pathname":"<stdin>","filename":"<stdin>","module":"<stdin>","exc_info":null,"exc_text":null,"stack_info":null,"lineno":1,"funcName":"<module>","created":1639550438.844173,"msecs":844.1729545593262,"thread":4474015232,"threadName":"MainThread","processName":"MainProcess","process":13064,"url":"-","remote_addr":"127.0.0.1","asctime":"2021-12-15 14:40:38,844","timestamp":"2021-12-15T06:40:38.844173+00:00"}仅日志记录敏感信息（如堆栈，异常）fromloghelperimportSensitiveLoggerlogger=SensitiveLogger(logger)msg=logger.error(msg='发生错误',sensitive_msg=f'{ex}')生成msg样例发生错误 (详见日志:['/tmp/my_project/raw_loghelper.loghelper.Runtime.log', '/tmp/my_project/json_loghelper.loghelper.Runtime.log'])生成日志样例发生错误 (错误详情:ex的具体内容)
Package: log-helper-bit3
Log HelperEs un paquete que tiene como propósito facilitar la gestión de logs en
una clase que herede o extienda del mismo. El paquete brinda la posibilidad
de almacenar en una variable los logs y ponerlos a disposición de la clase
que lo hereda para que registre los pasos en estos y así la clase que
la llama pueda registrar en su log los pasos que se siguieron en la clase
en cuestión.Instalaciónpip install log-helper-bit3CreadoresEl paquete fue desarrollado por el equipo de desarrollo de la compañía
BITCUBICO Technology para su uso interno, el desarrollador de esta
iniciativa es Mauricio Montoya Medrano
Package: loghooks
Log HooksA discord webhook logging libraryThere are no docs as this isn't meant to be used in bots that are sharded or log a lot. Just ping moanie#6598 on discord.py for help (ID: 691406006277898302)Example:importdiscordimportloggingimportaiohttpfromloghooksimportWebhookHandlerclient=discord.Client()# use commands.Bot if you wish. It doesn't make a difference.handler=WebhookHandler(webhook_url="webhook-url",session=aiohttp.ClientSession())@client.eventasyncdefon_ready():print("ready")# actual logging stufflogger=logging.getLogger("discord")logger.setLevel(logging.DEBUG)logger.addHandler(handler)handler.setLevel(logging.INFO)client.run("Bot Token")Using your own functionsimportdiscordimportloggingimportaiohttpfromloghooksimportWebhookHandlerfromloggingimportLogRecordclient=discord.Client()# use commands.Bot if you wish. It doesn't make a difference.handler=WebhookHandler(webhook_url="webhook-url",session=aiohttp.ClientSession())@client.eventasyncdefon_ready():print("ready")asyncdefmy_custom_webhook_function(log:LogRecord):...# handle your log here# actual logging stufflogger=logging.getLogger("discord")logger.setLevel(logging.DEBUG)logger.addHandler(handler)handler.setLevel(logging.INFO)handler.setCustomHandle(my_custom_webhook_function)client.run("Bot Token")
Package: log_hunter
Hunter Log File AccessLibrary and CLI tool to access kibana logglines in bulk.Free software: Apache Software License 2.0Documentation:https://log-hunter.readthedocs.io.Featureslog in directly to the backend elasticsearchsearch message linesallow filtering on image_name, env, before and afterstandard .netrc support for credentialsCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2017-05-04)First release on PyPI.
Package: logic2-automation
Saleae Logic 2 Automationlogic2-automationimplements a Python client for theLogic 2 Automation API.Documentation can be found athttps://saleae.github.io/logic2-automation/Changelog1.0.7Fix builds not building with hatchling 1.19.0.Add option for setting gRPC port.1.0.6Movedgrpcio-toolsto build dependencies.1.0.5The .whl build has been fixed, and now includes the generate protobuf/grpc files.1.0.4YANKED!The protobuf files (saleae/grpc) generated during the .whl build were not being included in the .whl file. This was caused by thesaleae/grpcdirectory being added to the .gitignore file. These ignored files have been moved to the parent directory's .gitignore, and an empty .gitignore has been added to the python directory.Fix boolean analyzer settings not being sent as the correct type.1.0.3Updated the README to link out to the docs, and move build instructions to BUILD.md.Updated the install docs.1.0.2Update the distribution to only include a source distribution so that gRPC/protobuf files can be generated at install time, and be based on the installed version of grpcio/grpcio-tools/protobuf.1.0.1YANKED!This release was pulled shortly after it was released due to a conflict between the latest gRPC and the generated protobuf files.Changegrpc&grpc-toolsdependency to version>=1.13.0. This lowers the minimum version, and doesn't stick it to a specific version.1.0.0First release
Package: logic4py
Logic4pyLogic4py is a library for teaching logicLicenseLogic4py is available byMIT License.Requirements:You must install:rply 0.7.8 packagegraphvizipywidgetspandasruamel.yamlInstallTo install Logic4py from Github, run the following command:pipinstallgit+https://github.com/daviromero/logic4py.gitTo install Logic4py from PyPi repository, run the following command:pipinstalllogic4py
Package: logicalinduction
Logical induction in PythonThis repository contains code to support the guide to logical induction for
software engineers (which has not yet been published). It consists of a
straightforward python implementation of the logical induction algorithm
published byGarrabrant et alin 2018. I have prioritized simplicity over
efficiency.To run the example code:$gitclonegit@github.com:monasticacademy/logical-induction.git
$cdlogical-induction
$pythonexamples/two_updates.py

afterupdate1:theskyisblue1.000000theskyisblue|theskyisgreen0.000000

afterupdate2:theskyisgreen→theworldisround0.000000theskyisblue0.000000theskyisblue|theskyisgreen1.000000Organization of the codeThe main interface is theLogicalInductorclass ininductor.py:classLogicalInductor(object):...defupdate(self,observation,trading_algorithm):"""Given:* An observation* A trading algorithmReturn:* A belief stateImplements the logical induction algorithm as per 5.4.1 in the paper"""The update function takes as input an observation, which is a logical sentence
that is to be taken to be true from here on, and a trading algorithm, which is a
set of formulas specifying trades to be executed that the logical inductor will
set its credences in order to avoid being exploited by.The representation of logical sentences is implemented insentence.pyand
works as follows. The classsentence.Atomrepresents a claim about the world
not further reducible by logical connectives such as AND, OR, NOT. Its
constructor takes a string, which can be anything and is only to help humans
keep track of what is going on. The other classes in this file implement
conjunctions, disjunctions, logical negation, and material implication.The representation of trading formulas is implemented informula.py. A trading
formula is a simple language for expressing buy/sell trades that a logical
inductor must not be exploited by. The classes in this file follow section A.2
from the paper.The representation of belief states and histories of is incredence.py. A
belief state is a map from sentences to credences, and a history of belief
states is a list of belief states.The code inenumerator.pyprovides various routines for enumerating possible
worlds.The code inexample/two_updates.pyinstantiates a logical inductor and
feeds it two observations, printing out the credences it receives in response.
Package: logical-permissions
This is a generic library that provides support for dictionary-based
permissions with logic gates such as AND and OR. You can register any
kind of permission types such as roles and flags. The idea with this
library is to be an ultra-flexible foundation that can be used by any
framework. It supports python 2 and 3.INSTALLATIONpip install logical-permissionsUSAGEPlease refer tohttps://github.com/ordermind/logical-permissions-pyfor documentation.
Package: logical-rush
logical_rushBatch-computing solution for cashflow calculations.Developed by Rodolfo Blasserhttps://www.linkedin.com/in/rodblasser/UsagePrototype batch-computing library for calculating loan amortization tables.Exampleimportrandomimportpandasaspdimporttimeimportlogical_rushproducts=['Auto','Personal','Commercial','Mortgage','MicroCredit']terms=[5,10,15,20,25,30]#terms = [5, 10, 15]rates=[0.04,0.05,0.06,0.07,0.08]amounts=[10000,20000,30000,50000,60000]freqs=[1,2,3,6]# =============================================================================# Testing performance# =============================================================================res=[]foreach_iinrange(*{'start':100,'stop':500,'step':5}.values()):dx=pd.DataFrame(index=range(each_i),columns=['id','amt','rate','pers','int_freq','cap_freq'],)print("\ndx created with{}rows".format(dx.shape[0]))dx['id']=(dx.index+1000)dx['amt']=dx['amt'].apply(lambdax:random.choice(amounts))dx['rate']=dx['rate'].apply(lambdax:random.choice(rates))/12dx['pers']=dx['pers'].apply(lambdax:random.choice(terms))*12#* 30 # daily flowsdx['int_freq']=dx['int_freq'].apply(lambdax:random.choice(freqs))dx['cap_freq']=dx['cap_freq'].apply(lambdax:random.choice(freqs))dx['id']=dx['id'].astype(str)dx['amt']=dx['amt'].astype(float)dx['rate']=dx['rate'].astype(float)dx_dict=dx.to_dict(orient="records")dxs=dx.copy()forcindxs.columns:dxs[c]=dxs[c].astype(str)dxs_dict=dxs.to_dict(orient="records")# Sequentialtic=time.time()i=logical_rush.cashflower_fn(dx_dict)tac=time.time()tictac_seq=tac-ticprint("SEQ:{}".format(tictac_seq))flows_len=len(i)deli# Paralleltic=time.time()ipar=logical_rush.cashflower_par(dxs_dict)tac=time.time()tictac_par=tac-ticprint("PAR:{}".format(tictac_par))delipar# GIL Releasetic=time.time()igil=logical_rush.cashflower_gil(dxs_dict)tac=time.time()tictac_gil=tac-ticprint("GIL:{}".format(tictac_gil))deligilres.append([each_i,flows_len,tictac_seq,tictac_par,tictac_gil])print("\t{}SEQ loans @{}seconds | output:{}flows".format(each_i,round(tictac_seq,4),flows_len))print("\t{}PAR loans @{}seconds | output:{}flows".format(each_i,round(tictac_par,4),flows_len))print("\t{}GIL loans @{}seconds | output:{}flows".format(each_i,round(tictac_gil,4),flows_len))# Export comparisonpd.DataFrame(res).to_csv("benchmarking_results_seq_par_gil_flows.csv")
Package: logical-zonotope
#Logical Zonotope Python Library
Logical Zonotope: A Set Representation for Binary Vectors
Based onhttps://arxiv.org/abs/2210.08596logical zonotopes can be used to greatly reduce the computational complexity of a variety of operations over sets of binary vectors, including logical operations (e.g. XOR, NAND, AND, OR) and semi-tensor products.Installationpip install logical-zonotopefromlogical_zonotopeimportLogicalZonotope,z_xnor#Instanciating Logical Zonotope Objectszonotope_1=LogicalZonotope()zonotope_2=LogicalZonotope()zonotope_1.set((1,1),{(1,0)})zonotope_2.set((0,1),{(1,1),(1,0),(1,1)})# Calling the z_xnor methodz_xnor(zonotope_1,zonotope_2).print()
Package: logicbankutils
Utility Functions for Logic Bank, and others (no Logic Bank dependencies).Addressing Python Path, for proper import operationThis is fromstackoverflow.  Essentially, many of us have discovered the hard way is that:import statements often work in PyCharmbut fail in VSCode, Command Line, etcSetting`PYTHONPATH`is what makes imports work. I use the following VSCODE.envcontent so that it works for any project:PYTHONPATH=${PROJ_DIR}:${PYTHONPATH}This is essentially what PyCharm does when you checkAdd Content Roots to PYTHONPATHin your run/debug configuration. It’s a helpful setting, but it spoils you because your code fails outside PyCharm.Or, if you run in terminal, first export:export PYTHONPATH=…add_python_pathYou may find it easier to address this in your application, by calling the following:defadd_python_path(project_dir:str,my_file:str)->(str,str):"""
    @param project_dir: enclosing path node, with optional "*" for starts-with (e.g., LogicBank, LogicBank*)
    @param my_file: callers __file__ variable
    @result (path_was_fixed, path)For example, if you are several levels deep in a project were the root is`MyProjectRoot`:importlogic_bank_utils.utilaslogic_bank_utils(did_fix_path,sys_env_info)=\logic_bank_utils.add_python_path(project_dir="MyProjectRoot",my_file=__file__)print("\n"+did_fix_path+"\n\n"+sys_env_info+"\n\n")Depends on:Python 3.8Change Log0.3.0 - Initial Version0.4.0 - Improved doc0.5.0 - More formatting on return string0.6.0 - Provide for my-project* (startsWith)