Saravanan666/pypi-org huggingface dataset:
Package: contextmenuwidget
context_menu_widgetDescriptionContextMenuWidget is a Python package that provides an extendedtk.Menuclass with a context menu for specified widgets, including commands like Cut, Copy, Paste, and Select All.
Version 0.03InstallationInstall the package using pip:pipinstallContextMenuWidgetUsagefrom contextmenuwidget import ContextMenuWidgetCurrent version : V1.0.4Example usage of the ContextMenuWidget classfromcontextmenuwidgetimportContextMenuWidgetroot=tk.Tk()label_entry=tk.Label(root,text="Entry Widget : ")label_entry.grid(column=0,row=0,sticky="w")widget_entry=tk.Entry(root,width=31)widget_entry.grid(column=1,row=0,sticky="w")context_menu=ContextMenuWidget(widget_entry)label_text=tk.Label(root,text="Text Widget : ")label_text.grid(column=0,row=1,sticky="wn")widget_text=tk.Text(root,height=13,width=31,wrap=tk.NONE)widget_text.grid(column=1,row=1,sticky="w")context_menu=ContextMenuWidget(widget_text)vertical_scrollbar=tk.Scrollbar(root,orient=tk.VERTICAL)vertical_scrollbar.grid(column=2,row=1,sticky="ns")widget_text.config(yscrollcommand=vertical_scrollbar.set)vertical_scrollbar.config(command=widget_text.yview)horizontal_scrollbar=tk.Scrollbar(root,orient=tk.HORIZONTAL)horizontal_scrollbar.grid(column=1,row=2,sticky="we")widget_text.config(xscrollcommand=horizontal_scrollbar.set)horizontal_scrollbar.config(command=widget_text.xview)root.mainloop()FeaturesContext Menu: Extends tk.Menu with Cut, Copy, Paste, and Select All commands.
Icons: Utilizes icons for visual representation of menu commands.
Dynamic Updates: Dynamically updates menu entry states based on widget content and clipboard status.
Cross-Platform: Supports right-click events on different platforms.Dependenciestkinter (Ensure that tkinter is installed)LicenseThis project is licensed under the MIT License - see the LICENSE file for details.
Package: contextplt
contextpltSource code repository for the contextplt package.You can create a matplotlib figure using context manager.
This package enables you to write short code and
create a lot of figures in a simple manner.InstallationpipinstallcontextpltUsageSee documentation page :https://toshiakiasakura.github.io/contextplt/NoteDockerfile and docker-compose.yml are prepared for running example codes.Related packagesnecoplot
Package: context-printer
Python library to improve console printing by adding context to your prints. It makes your console much cleaner, and you won't have to worry about making your prints beautiful.Installation:pip install context_printerBasic usage example:fromcontext_printerimportContextPrinterasCtpCtp.enter_section('Main section',color='blue')Ctp.print('Text in main section')foriinrange(3):Ctp.enter_section('Subsection{}'.format(i+1))Ctp.print('Text in subsection')Ctp.print('Text in subsection')Ctp.exit_section()Ctp.exit_section()The above example will print the following:
Package: contextpro
contextprocontextpro is a Python library for concurrent text preprocessing using functions from some well-known NLP packages including NLTK, spaCy and TextBlob.Documentation:https://contextpro.readthedocs.io/en/latest/Source code:https://gitlab.com/elzawie/contextproInstallationWindows / OS X / Linux:Installation with pippip install contextpro
python -m spacy download en_core_web_smInstallation with poetrypoetry add contextpro
python -m spacy download en_core_web_smConfigurationBefore using the package, execute the below commands in your virtual environment:importnltknltk.download("punkt")nltk.download("stopwords")nltk.download("wordnet")Usage examplesfromcontextpro.normalizationimportbatch_replace_contractionscorpus=["I don't want to be rude, but you shouldn't do this","Do you think he'll pass his driving test?","I'll see you next week","I'm going for a walk"]batch_replace_contractions(corpus)["I do not want to be rude, but you should not do this","Do you think he will pass his driving test?","I will see you next week","I am going for a walk",]fromcontextpro.normalizationimportbatch_remove_stopwordscorpus=[['My','name','is','Dr','Jekyll'],['His','name','is','Mr','Hyde'],['This','guy','s','name','is','Edward','Scissorhands'],['And','this','is','Tom','Parker']]batch_remove_stopwords(corpus)[['My','name','Dr','Jekyll'],['His','name','Mr','Hyde'],['This','guy','name','Edward','Scissorhands'],['And','Tom','Parker']]fromcontextpro.normalizationimportbatch_lemmatizecorpus=[["I","like","driving","a","car"],["I","am","going","for","a","walk"],["What","are","you","doing"],["Where","are","you","coming","from"]]batch_lemmatize(corpus,num_workers=2,pos="v")[['I','like','drive','a','car'],['I','be','go','for','a','walk'],['What','be','you','do'],['Where','be','you','come','from']]fromcontextpro.normalizationimportbatch_convert_numerals_to_numberscorpus=["A bunch of five","A picture is worth a thousand words","A stitch in time saves nine","Back to square one","Behind the eight ball","Between two stools",]batch_convert_numerals_to_numbers(corpus,num_workers=2)['A bunch of 5','A picture is worth a 1000 words','A stitch in time saves 9','Back to square 1','Behind the 8 ball','Between 2 stools',]fromcontextpro.statisticsimportbatch_calculate_corpus_statisticscorpus=["My name is Dr. Jekyll.","His name is Mr. Hyde","This guy's name is Edward Scissorhands","And this is Tom Parker"]batch_calculate_corpus_statistics(corpus,lowercase=False,remove_stopwords=False,num_workers=2,)characterstokenspunctuation_charactersdigitswhitespace_characters\0225204120510423871053225004ascii_characterssentiment_scoresubjectivity_score0220.00.01200.00.02380.00.03220.00.0Release Historyhttps://gitlab.com/elzawie/contextpro/-/releasesMetaŁukasz Zawieska –zawieskal@yahoo.comGitlab accountGithub accountDistributed under the MIT license. SeeLICENSEfor more information.
Package: context-python
Context Python LibraryThe Context Python library provides a convenient way to interface with the Context APIs. We include pre-defined classes and operations to interact with API resources.Installationpip install --upgrade context-pythonUsageThe library needs to be configured with your Context API key, which is available in theContext Settings Dashboard.Synchronous Exampleimportgetcontextfromgetcontext.generated.modelsimportConversation,Message,MessageRole,Ratingfromgetcontext.tokenimportCredentialimportostoken=os.environ.get("GETCONTEXT_TOKEN")c=getcontext.ContextAPI(credential=Credential(token))c.log.conversation(body={"conversation":Conversation(messages=[Message(message="You are a helpful assistant!",role=MessageRole.SYSTEM,),Message(message="Hello, world!",role=MessageRole.USER,),Message(message="Hi, how can I help?",role=MessageRole.ASSISTANT,rating=Rating.POSITIVE,),],)})Async Exampleimportasyncioimportgetcontext.generated.aioasgetcontextfromgetcontext.generated.modelsimportConversation,Message,MessageRole,Ratingfromgetcontext.tokenimportAsyncCredentialimportostoken=os.environ.get("GETCONTEXT_TOKEN")asyncdeflog():asyncwithgetcontext.ContextAPI(credential=AsyncCredential(token))asclient:awaitclient.log.conversation(body={"conversation":Conversation(messages=[Message(message="You are a helpful assistant!",role=MessageRole.SYSTEM,),Message(message="Hello, world!",role=MessageRole.USER,),Message(message="Hi, how can I help?",role=MessageRole.ASSISTANT,rating=Rating.POSITIVE,),],)})loop=asyncio.get_event_loop()loop.run_until_complete(log())loop.close()Appendixpython:trueoutput-folder:getcontext/generated/no-namespace-folders:truecredential-default-policy-type:BearerTokenCredentialPolicyblack:truepython3-only:trueadd-credential:truecredential-scopes:allmodels-mode:msrest
Package: contextshare
contextshareSimple context manager to share numpy arrays in python multiprocessing. Installation onPython >= 3.8:pip install contextshareExampleThe following code example is complete and compares aserial()implementation  with theparallel()version thereof implemented withcontextshare.#!/usr/bin/env pythonimportcontextshareassharedimportnumpyasnpdefserial(sigmas):alphas=[]forsigmainsigmas:K=np.exp(-0.5*D/(sigma*sigma))alphas.append(np.linalg.solve(K,b))returnalphasdefparallel(sigmas):withshared.SharedMemory({"D":D,"b":b},nworkers=11)assm:@sm.registerdefone_sigma(sigma):K=np.exp(-0.5*D/(sigma*sigma))returnnp.linalg.solve(K,b)forsigmainsigmas:one_sigma(sigma)returnsm.evaluate(progress=True)if__name__=="__main__":N=2000D=np.random.random((N,N))b=np.random.random(N)sigmas=2.0**np.arange(1,12)s=serial(sigmas)p=parallel(sigmas)DocumentationThe context managershared.SharedMemorytakes two arguments: the dictionary of numpy arrays to make available on all parallel workers and the number of workers to create.# makes variables D and b available under the same name on 11 workerswithshared.SharedMemory({"D":D,"b":b},nworkers=11)assm:The workers are spawned upon entering the context and are stopped upon exiting. Shared memory references are cleaned up automatically. Note that only numpy arrays are supported for sharing. Other arguments should be placed in the arguments of the function below. The function to call (i.e. the body of the serial for loop) needs to be placed in a function and either decorated or called explicitly:# decorator@sm.registerdefone_sigma(sigma):pass# or, equivalently, an explicit callsm.register(one_sigma)Calling this decorated function returns immediately and enqueues a function call. Callingsm.evaluate(progress=True)starts the calculations and returns the results in order. Withprogress=Truea progress bar is shown, default is to be silent.CreditsThis package was created withCookiecutterusing theaudreyr/cookiecutter-pypackage` template.=======
History0.1.0 (2021-02-23)First release on PyPI.
Package: context-temp
Context Manager wrappers for temp files and directories which remove the file
or directory when when the manager goes out of scope.Installation$pipinstallcontext_tempSupportscontext_temp has been tested with Python 3.8-3.11Docs & SourceDocs:http://context_temp.readthedocs.io/en/latest/Source:https://github.com/cltrudeau/context_temp
Package: contexttimer
contexttimerprovides you with a couple of utilities to quickly measure the execution time of a code block or a function.Timer as a context managercontexttimer.Timeris a context manager measuring the execution time of the code block it contains.
The elapsed time is accessible through theelapsedproperty.>>> with Timer() as t:
...     # some code here
>>> print t.elapsed
# a value in secondsThecontexttimer.Timercontext managercontexttimer.Timeris acontext managerwith 2 parameters and a public property:default_timer: a platform specific timer function (time.timefor Unix platforms andtime.clockfor Windows platforms). You can instanciate aTimerobject with your own timer, by passing it to the constructor.factor: a multiplying factor applied to theelapsedproperty. For example, a factor or 1000 will lead toelapsedbeing expressed in milliseconds instead of seconds. Default value of 1.elapsed: (read only property) the wall clock timing of the execution of the code block, in seconds. By default, expressed in seconds.Example>>> from contexttimer import Timer
>>> with Timer(factor=1000) as t:
...     for i in xrange(10000000):
...         pass
...
>>> print(t.elapsed)
73.6618041992 # in milisecondsNote thatelapsedis calculated on demand, so it is possible to time sub-parts of your code block:>>> with Timer(factor=1000) as t:
...     # do some things
...     print t.elapsed
...     # do other tings
...     print t.elapsed
...
10.122  # in ms
20.567Thecontexttimer.timerfunction decoratorYou can use the@timerfunction decorator to measure the time execution of an entire function.
When the function returns its value, its execution time will be printed to the stdout (default), or to the argument logger.Examples>>> @timer
... def sleep_for_2s():
...     time.sleep(2)>>> sleep_for_2s()
function sleep_for_2s execution time: 2.002>>> logging.basicConfig()
>>> @timer(logger=logging.getLogger())
... def sleep_for_2s():
...     time.sleep(2)>>> sleep_for_2s()
DEBUG:root:function blah execution time: 2.002As it makes use of theTimercontext manager inside, all arguments passed to the@timerdecorator will be used aTimerinit arguments.Example:>>> @timer(factor=1000)
... def sleepawhile(n):
...     time.sleep(n)
...
>>> sleepawhile(2)
function sleepawhile execution time: 2000.089Thecontexttimer.timeout.timeoutdecoratorYou can use the@timeoutfunction decorator to stop a function/method call and call a handler if the call exceeds a fixed amount of time.Example:>>> def timeout_handler(limit, f, *args, **kwargs):
...     print "{func} call timed out after {lim}s.".format(
...         func=f.__name__, lim=limit)
...
>>> @timeout(limit=5, handler=timeout_handler)
... def work(foo, bar, baz="spam")
...     time.sleep(10)
>>> work("foo", "bar", "baz")
# time passes...
work call timed out after 5s.
>>>ThanksThanks to halloi, wolanko and Jon Blackburn for their helpful insights and contributions.Licensecontexttimeris released under the GPLv3 license.
Package: contextual-encoders
Contextual EncodersContextual Encoders is a library ofscikit-learncompatible contextual variable encoders.The documentation can be found here:ReadTheDocs.This package uses Poetry (documentation).InstallationThe library can be installed withpippip install contextual-encodersWhat are contextual variables?Contextual variables are numerical or categorical variables, that underlie a certain context or relationship.
Examples are the days of the week, that have a hidden graph structure:When encoding these categorical variables with a simple encoding strategy such asOne-Hot-Encoding, the hidden structure will be neglected.
However, when the context can be specified, this additional information can be put it into the learning procedure to increase the performance of the learning model.
This is, where Contextual Encoders come into place.PrincipleThe step of encoding contextual variables is split up into four sub-steps:Define the contextDefine the measureCalculate the (dis-) similarity matrixMap the distance matrix to euclidean vectorsSetp 4. is optional and depends on the ML technique that uses the encoding.
For example,Agglomerative Clusteringtechniques do not require euclidean vectors, they can use a dissimilarity matrix directly.Basic UsageThe code below demonstrates the basic usage of the library.
Here, a simple dataset with 10 features is used.fromcontextual_encodersimportContextualEncoder,GraphContext,PathLengthMeasureimportnumpyasnp# Create a sample datasetx=np.array(["Fri","Tue","Fri","Sat","Mon","Tue","Wed","Tue","Fri","Fri"])# Step 1: Define the contextday=GraphContext("day")day.add_concept("Mon","Tue")day.add_concept("Tue","Wed")day.add_concept("Wed","Thur")day.add_concept("Thur","Fri")day.add_concept("Fri","Sat")day.add_concept("Sat","Sun")day.add_concept("Sun","Mon")# Step 2: Define the measureday_measure=PathLengthMeasure(day)# Step 3+4: Calculate (Dis-) similarity Matrix#           and map to euclidean vectorsencoder=ContextualEncoder(day_measure)encoded_data=encoder.fit_transform(x)similarity_matrix=encoder.get_similarity_matrix()dissimilarity_matrix=encoder.get_dissimilarity_matrix()The output of the code is visualized below.
The graph-based structure can be clearly seen when the euclidean data points are plotted.
Note, that only five points can be seen, because the days "Thur" and "Sun" are missing in the dataset.Similarity MatrixDissimilarity MatrixEuclidean Data PointsMore complicated examples can be found in thedocumentation.NoticeThePreprocessingmodule from scikit-learn offers multiple encoders for categorical variables.
These encoders use simple techniques to encode categorical variables into numerical variables.
Additionally, theCategory Encoderspackage offers more sophisticated encoders for the same purpose.
This package is meant to be used as an extension to the previous two packages in the cases, when the context of a numerical or categorical variable can be specified.This project is currently in the developer stage.
Package: contextualise-ssh-server
contextualise-ssh-serverContextualise motley-cue and pam-ssh-oidc on a VM ServerInstallationcontextualise-ssh-server is available onPyPI. Install usingpip:pipinstallcontextualise_ssh_serverConfigurationConfig is read from/etc/contextualise_ssh_server.confThere is a default config file in the place where pip installs this packageThere you will also find templates for motley_cue.conf and feudal_adapter.confEnvironment VariablesThese control the behaviour:SSH_AUTHORISE_OTHERS_IN_MY_VO: If set to a nonempty value ALL members of
ALL VOs of the user will be authorised to log in.SSH_AUTHORISE_VOS: If the above variable is not set and this variable
specifies a json list of VOs (actually AARC-G069/G027 Entitlements) to
authorise.Example:export SSH_AUTHORISE_VOS="['urn:mace:egi.eu:group:cryoem.instruct-eric.eu:admins:role=owner#aai.egi.eu', 'urn:mace:egi.eu:group:umsa.cerit-sc.cz:admins:role=owner#aai.egi.eu']UsageThe tools will output the two config filesmotley_cue.confandfeudal_adapter.confin the folder in which it is called.Those need to be placed in/etc/motley_cuewith the access token of the
user as the only parameter:contextualise_ssh_server <OIDC_ACCESS_TOKEN>PAMFor enabling and disabling tokens in pam, you can use the scriptsenable-pam-ssh.shanddisable-pam-ssh.shThey are installed into the same folder as the python file, which you can
find withcontextualise_ssh_server -bVM IntegrationInstall packages to VM image:yum install motley-cue pam-ssh-oidcInclude this in the VM startup:# enable tokens in pam:
`contextualise_ssh_server -b`/enable-pam-ssh.sh

# create motley-cue config
cd /tmp
contextualise_ssh_server $USER_OIDC_ACCESS_TOKEN

# place them in /etc/motley_cue/ 
sudo cat motley_cue.conf     > /etc/motley_cue/motley_cue.conf
sudo cat feudal_adapter.conf > /etc/motley_cue/feudal_adapter.conf
Package: contextualized-ml
An easy-to-use machine learning toolbox for estimating models, distributions, and functions with context-specific parameters.Context-specific parameters:Find hidden heterogeneity in data -- are all samples the same?Identify context-specific predictors -- are there different reasons for outcomes?Enable domain adaptation -- can learned models extrapolate to new contexts?Quick StartInstallationpip install contextualized-mlTake a look at theeasy demofor a quickstart with sklearn-style wrappers.Build a Contextualized Modelfrom contextualized.easy import ContextualizedRegressor
model = ContextualizedRegressor()
model.fit(C, X, Y)Predict Context-Specific Parametersmodel.predict_params(C)See thedocsfor more examples.Important linksDocumentationPypi package indexContextualized FamilyContext-dependent modeling is a universal problem, and every domain presents unique challenges and opportunities.
Here are some layers that others have added on top of Contextualized.
Feel free to add your own page(s) by sending a PR or request an improvement by creating an issue. SeeCONTRIBUTING.mdfor more information about the process of contributing to this project.bio-contextualized.mlContextualized and analytical tools for modeling medical and biological heterogeneityThanks to all our contributorsContextualized ML was originally implemented byCaleb Ellington(CMU) andBen Lengerich(MIT).Many people have helped. Check outACKNOWLEDGEMENTS.md!Related Publications and Pre-printsContextualized Machine LearningContextualized Networks Reveal Heterogeneous Transcriptomic Regulation in Tumors at Sample-Specific ResolutionContextualized Policy Recovery: Modeling and Interpreting Medical Decisions with Adaptive Imitation LearningAutomated Interpretable Discovery of Heterogeneous Treatment Effectiveness: A COVID-19 Case StudyNOTMAD: Estimating Bayesian Networks with Sample-Specific Structures and ParametersDiscriminative Subtyping of Lung Cancers from Histopathology Images via Contextual Deep LearningPersonalized Survival Prediction with Contextual Explanation NetworksContextual Explanation NetworksVideosCold Spring Harbor Laboratory: Contextualized Graphical Models Reveal Sample-Specific Transcriptional Networks for 7000 TumorsSample-Specific Models for Interpretable Analysis with Applications to Disease SubtypingContact UsPlease get in touch with any questions, feature requests, or applications by using theGitHub discussions page.
Package: contextuallogging
contextualloggingPure-Python semantic logging library with context-local values.PyPISourceDocumentationInstallationThis package is available on PyPI and can be installed with pip:pipinstallcontextualloggingBasic UsageThis packages introduces two primary components:TheContextualFormatterlogging formatter subclass.The@contextdecorator.This is a basic example:importsysimportloggingfromcontextualloggingimportcontext,ContextualFormatterlogger=logging.getLogger()handler=logging.StreamHandler(sys.stdout)handler.setFormatter(ContextualFormatter())logger.addHandler(handler)logger.setLevel(logging.INFO)@context(keyword="username",key="user")definner_function(username:str)->None:logger.info("inner_function")@context(keyword="request_id")defouter_function(request_id:str)->None:logger.info("outer_function")inner_function(username="cfandrews")logger.info("outer_function again")outer_function(request_id="7fb9b341")Which will output:{"level":"INFO","logger":"root","message":"outer_function","request_id":"7fb9b341","timestamp":"2023-11-25T20:56:41.796564Z"}{"level":"INFO","logger":"root","message":"inner_function","request_id":"7fb9b341","timestamp":"2023-11-25T20:56:41.797024Z","user":"cfandrews"}{"level":"INFO","logger":"root","message":"outer_function again","request_id":"7fb9b341","timestamp":"2023-11-25T20:56:41.797075Z"}ContextualFormatterTheContextualFormatteris a subclass oflogging.Formatterand can be used in the exact same way as any other logging formatter. This class
formats log messages as JSON blobs and includes a number of fields by default, such as anISO 8601timestamp in the UTC timezone, log level, logger name, and message. Logging context is added to the output JSON blob as
additional fields mixed into the base log.@contextThe@contextdecorator adds
fields to the logging context from the keyword arguments passed into the wrapped function. The logging context persists
for the entire function call and is automatically reset after the function returns, creating a stack-like structure in
which context is persisted down the call stack but not back up.
Package: contextvars
PEP 567 BackportThis package implements a backport of Python 3.7contextvarsmodule (see PEP 567) for Python 3.6.Important:at this moment this package does not provide an
asyncio event loop with PEP 567 support yet.  Stay tuned for updates.Original “contextvars” PackageThis package replaces the old “contextvars” PyPI package which
repository is availablehere.DocumentationRead the officialcontextvarsmodule documentation here:https://docs.python.org/3.7/library/contextvars.htmlPEP 567also provides
a comprehensive overview of the API and explains all design choices.Installation$pipinstallcontextvarsUsageimportcontextvarsmy_var=contextvars.ContextVar('my_var')# ...Listing as a DependencyThe good news is that the standard library always takes the
precedence over site packages, so even if a localcontextvarsmodule is installed, the one from the standard library will be used.
Therefore you can simply list “contextvars” in yourrequirements.txtorsetup.pyfiles.Another option is to use“platform specific dependencies”setuptools feature:importsetuptoolssetuptools.setup(name="Project",...install_requires=['contextvars;python_version<"3.7"'])LicenseApache 2.0.
Package: contextvars-executor
info:contextvars friendly ThreadPoolExecutorInstallationpipinstallcontextvars_executorWhy???related Python issueUsageimportasyncioimportcontextvarsfromcontextvars_executorimportContextVarExecutorctx=contextvars.ContextVar('42')defthread():ret=ctx.get()assertret==42returnretasyncdefmain(*,loop):ctx.set(42)ret=awaitloop.run_in_executor(None,thread)assertret==42loop=asyncio.get_event_loop()loop.set_default_executor(ContextVarExecutor())loop.run_until_complete(main(loop=loop))Python 3.7+ is required, there is no need to support older python versions!!!