Saravanan666/pypi-org huggingface dataset:
Package: classic-app-layer
Classic App LayerThis package provides primitives for application layer.
Part of project "Classic".Usage for validation:fromdataclassesimportdataclassfromclassic.appimportDTO,validate_with_dtofrompydanticimportvalidate_argumentsclassSomeDTO(DTO):"""Based on pydantic.BaseModel. Used for validating input"""some_field:intanother_field:str@dataclassclassSomeAppCls:"""Some class with app logic. May be mapped on DB."""some_field:intanother_field:strclassSomeService:@validate_argumentsdefsome_method(self,arg:int):assertisinstance(arg,int)@validate_with_dtodefanother_method(self,params:SomeDTO):instance=params.create_obj(SomeAppCls)print(instance)Usage for errors:fromclassic.appimportAppError,ErrorsList# Describe errors, possible in applicationclassIncorrectState(AppError):msg_template='Incorrect app state - "{text}"'code='app.incorrect_state'classServiceNotReady(AppError):msg_template='Service not ready yet'code='app.service_not_ready'# In another file with services:classSomeService:def__init__(self):self.ready_to_serve=Falsedefis_ready(self):"""Demonstrates simple usage"""ifnotself.ready_to_serve:raiseServiceNotReady()defmark_as_ready(self):"""Demonstrates usage of error message templates"""ifself.ready_to_serve:raiseIncorrectState(text='Service are ready')self.ready_to_serve=Truedefjust_give_errors(self):"""Demonstrates method, what may have more than 1 error"""errors=[IncorrectState(text='error 1'),IncorrectState(text='error 2')]raiseErrorsList(errors)# Somewhere in adapters:service=SomeService()try:service.is_ready()exceptAppErroraserror:print(f'Application responses with error code "{error.code}", 'f'message is "{error.message}"')try:service.mark_as_ready()service.mark_as_ready()exceptAppErroraserror:print(f'Application responses with error code "{error.code}", 'f'message is "{error.message}"')try:service.just_give_errors()exceptErrorsListaserrors_list:forerrorinerrors_list.errors:print(f'Application responses with error code "{error.code}", 'f'message is "{error.message}"')
Package: classic-aspects
Classic AspectsThis package provides convenient utils for late decorating, based on idea of
aspects-oriented programming. Part of project "Classic".Usage:fromclassic.aspectsimportPointCutpoints=PointCut()@points.join_pointdefadd_numbers(left,right):returnleft+rightassertadd_numbers(1,2)==3# Returns 3defsome_decorator(fn):defwrapper(*args,**kwargs):print('Function called!')returnfn(*args,**kwargs)returnwrapperadd_numbers.join(some_decorator)assertadd_numbers(1,2)==3# Returns 3 and print "Function called!"
Package: classic-CandidateElimination
Candidate-Elimination AlgorithmCandidate-Elimination Algorithm is a Machine Learning Algorithm that builds the version space from Specific Hypothesis and General Hypothesis.InstallationInstall directly from myPyPipip install classic-CandidateEliminationOr Clone theRepositoryand installpython3 setup.py installParameters* X_trainThe Training Set array consisting of Features.* y_trainThe Training Set array consisting of Outcome.Attributes* fit(X_train, y_train)Fit the Training Set to the model.* predict(y_test)Predict the Test Set Results.Documentation1.  Install the packagepip install classic_FindS2. Import the libraryfrom classic_CandidateElimination import Candidate_Elimination3. Create an object for FindS classce = Candidate_Elimination()4. Fit your Training Set to the modelfs.fit(X_train, y_train)5. Predict your Test Set resultsy_pred = fs.predict(y_test)Example Code1. Import the dataset and Preprocessimport numpy as npimport pandas as pddataset = pd.read_csv('Covid-19_Data.csv')result = {'Yes':1, 'No':0}dataset['Covid_19'] = dataset['Covid_19'].map(result)X = dataset.iloc[:, 0:5].valuesy = dataset.iloc[:, -1].valuesfrom sklearn.model_selection import KFoldkf = KFold(n_splits=10)for train_index, test_index in kf.split(X,y):X_train, X_test = X[train_index], X[test_index]y_train, y_test = y[train_index], y[test_index]2. Use the Find-S Libraryfrom classic_CandidateElimination import Candidate_Eliminationce = Candidate_Elimination()ce.fit(X_train, y_train)y_pred = ce.predict(X_test)FootnotesYou can find the code at myGithub.Connect with me on Social Mediahttps://www.github.com/safir72347https://www.linkedin.com/in/safir72347/https://www.instagram.com/safir_12_10/
Package: classic-components
Classic ComponentsЭтот пакет предоставляет функциональность компонентов. Является частью проекта
"Classic".Главное, что предоставляет пакет - это декоратор component для обертывания
классов. Класс, обернутый таким декоратором, называется далее компонентом,
и обладает рядом свойств:автоматически сгенерированный конструктор на базе аннотаций.добавляет "дополнительные аннотации" к аннотациям класса (подробности далее)добавляет автоматическую регистрацию инстансов в указанных реестрахПростой пример:fromclassic.componentsimportcomponent@componentclassSomeService:prop:intdefaction(self):print(self.prop)service=SomeService(prop=1)service.action()# prints 1Генерацию конструктора можно отключить:fromclassic.componentsimportcomponent@component(init=False)classSomeService:prop:intdefaction(self):print(self.prop)service=SomeService(prop=1)# TypeError: SomeService() takes no argumentsРеестрыТакже пакет предоставляет интерфейс для создания реестров и базовую реализацию
реестра со слабыми ссылками. Это нужно не столько для кода приложений, сколько
для других библиотек в платформе.fromclassic.componentsimportcomponent,Registry,WeakSetRegistry@component(init=False)classSomeService:registry:Registrydefaction(self):print(self.prop)registry=WeakSetRegistry()service=SomeService(registry=registry)print(registry.storage)# {<weakref at 0x109390fe0; to 'SomeService' at 0x10933ec50>}
Package: classic-criteria
Classic CriteriaДает объект-критерий.Нужен для описания критериев объектов, чтобы затем определять,
соответствуют ли те или иные объекты критерию, или для формирования запроса,
к примеру, в SQL-хранилище.Пример:fromdatetimeimportdatetimefromdataclassesimportdataclassfromclassic.criteriaimportCriteria@dataclassclassTask:created_at:datetimefinished_at:datetime@dataclassclassTaskOlderThan(Criteria[Task]):date:datetimedefis_satisfied_by(self,candidate:Task)->bool:returncandidate.created_at<self.date@dataclassclassTaskObsolete(Criteria[Task]):days_to_work:intdefis_satisfied_by(self,candidate:Task)->bool:days_spent=candidate.finished_at-candidate.created_atreturndays_spent.days>self.days_to_worksome_task=Task(created_at=datetime(2024,1,1),finished_at=datetime(2024,1,10),)criteria=TaskObsolete(3)&TaskOlderThan(datetime(2024,1,31))assertcriteria.is_satisfied_by(some_task)some_task=Task(created_at=datetime(2024,1,1),finished_at=datetime(2024,1,1),)criteria=TaskObsolete(3)&TaskOlderThan(datetime(2024,1,31))assertnotcriteria.is_satisfied_by(some_task)
Package: classicdata
Classic DatasetsLoaders for classic datasets commonly used in Machine Learning:Name# Samples# Features# ClassesIonosphere351342Letter Recognition200001610Telescope19020102Pen Digits109921610Robot Navigation5456244Segmentation2310167USPS929825610Installationpip install classicdataRunpython -m classicdata.infoto list all implemented datasets.Example UsagefromclassicdataimportIonosphereionosphere=Ionosphere()# Use ionosphere.points and ionosphere.labels...
Package: classic-error-handling
Classic App LayerThis package provides primitives for application layer.
Part of project "Classic".Usage for validation:fromdataclassesimportdataclassfromclassic.appimportDTO,validate_with_dtofrompydanticimportvalidate_argumentsclassSomeDTO(DTO):"""Based on pydantic.BaseModel. Used for validating input"""some_field:intanother_field:str@dataclassclassSomeAppCls:"""Some class with app logic. May be mapped on DB."""some_field:intanother_field:strclassSomeService:@validate_argumentsdefsome_method(self,arg:int):assertisinstance(arg,int)@validate_with_dtodefanother_method(self,params:SomeDTO):instance=params.create_obj(SomeAppCls)print(instance)Usage for errors:fromclassic.appimportAppError,ErrorsList# Describe errors, possible in applicationclassIncorrectState(AppError):msg_template='Incorrect app state - "{text}"'code='app.incorrect_state'classServiceNotReady(AppError):msg_template='Service not ready yet'code='app.service_not_ready'# In another file with services:classSomeService:def__init__(self):self.ready_to_serve=Falsedefis_ready(self):"""Demonstrates simple usage"""ifnotself.ready_to_serve:raiseServiceNotReady()defmark_as_ready(self):"""Demonstrates usage of error message templates"""ifself.ready_to_serve:raiseIncorrectState(text='Service are ready')self.ready_to_serve=Truedefjust_give_errors(self):"""Demonstrates method, what may have more than 1 error"""errors=[IncorrectState(text='error 1'),IncorrectState(text='error 2')]raiseErrorsList(errors)# Somewhere in adapters:service=SomeService()try:service.is_ready()exceptAppErroraserror:print(f'Application responses with error code "{error.code}", 'f'message is "{error.message}"')try:service.mark_as_ready()service.mark_as_ready()exceptAppErroraserror:print(f'Application responses with error code "{error.code}", 'f'message is "{error.message}"')try:service.just_give_errors()exceptErrorsListaserrors_list:forerrorinerrors_list.errors:print(f'Application responses with error code "{error.code}", 'f'message is "{error.message}"')
Package: classicexperiments
Classic ExperimentsPersistent and reproducible experimental pipelines for Machine Learning.Installationpip install classicexperimentsExample UsageWe want to compare several classifiers with respect to a number of datasets.
We simply load the datasets and define a number ofEstimatorinstances.importsklearn.ensembleimportsklearn.neighborsimportsklearn.neural_networkimportsklearn.preprocessingimportsklearn.treefromclassicdataimport(USPS,ImageSegmentation,Ionosphere,LetterRecognition,MagicGammaTelescope,PenDigits,RobotNavigation,)fromclassicexperimentsimportEstimator,Evaluation,Experiment# Prepare datasets.datasets=[Ionosphere(),LetterRecognition(),MagicGammaTelescope(),PenDigits(),RobotNavigation(),ImageSegmentation(),USPS(),]# Prepare estimators.estimators=[Estimator(name="Dummy",estimator_class=sklearn.dummy.DummyClassifier,parameters={},),Estimator(name="5-nn",estimator_class=sklearn.neighbors.KNeighborsClassifier,parameters={"n_neighbors":5},),Estimator(name="Tree",estimator_class=sklearn.tree.DecisionTreeClassifier,parameters={},),Estimator(name="Forest",estimator_class=sklearn.ensemble.AdaBoostClassifier,parameters={},),Estimator(name="MLP",estimator_class=sklearn.neural_network.MLPClassifier,parameters={},),Estimator(name="KernelSVM",estimator_class=sklearn.svm.SVC,parameters={"kernel":"sigmoid"},),]# Prepare experiments.experiments=[Experiment(dataset=dataset,estimator=estimator,estimation_function=sklearn.model_selection.cross_val_score,parameters={},scaler=sklearn.preprocessing.StandardScaler(),)forestimatorinestimatorsfordatasetindatasets]# Prepare evaluation.evaluation=Evaluation(experiments=experiments,base_dir="evaluation")# Run evaluation.evaluation.run()# Present results.evaluation.present(table_format="github")Results are automatically stored, and we end up with a tidy table.DatasetDummy5-nnTreeForestMLPKernelSVMIonosphere0.64 ±0.00360.83 ±0.03880.86 ±0.04910.91 ±0.05490.90 ±0.04050.84 ±0.0630Letter Recognition0.04 ±0.00010.94 ±0.00220.88 ±0.00510.26 ±0.03560.95 ±0.00440.47 ±0.0119Pen Digits0.10 ±0.00000.99 ±0.00220.96 ±0.00480.43 ±0.11980.99 ±0.00170.74 ±0.0067Robot Navigation0.40 ±0.00010.77 ±0.05630.98 ±0.01400.80 ±0.03650.87 ±0.04720.48 ±0.0272Segmentation0.14 ±0.00000.92 ±0.05050.94 ±0.03340.48 ±0.07000.95 ±0.03620.75 ±0.0914Telescope0.65 ±0.00010.81 ±0.00600.82 ±0.00460.84 ±0.00500.87 ±0.00500.65 ±0.0043USPS0.17 ±0.00030.96 ±0.00300.88 ±0.00880.55 ±0.08980.97 ±0.00490.88 ±0.0053
Package: classic-FindS
Find-S AlgorithmFind-S algorithm is a Machine Learning Algorithm that finds the most specific hypothesis that fits all the positive examples.InstallationInstall directly from myPyPipip install classic-FindSOr Clone theRepositoryand installpython3 setup.py installParameters* X_trainThe Training Set array consisting of Features.* y_trainThe Training Set array consisting of Outcome.Attributes* fit(X_train, y_train)Fit the Training Set to the model.* predict(y_test)Predict the Test Set Results.Documentation1.  Install the packagepip install classic_FindS2. Import the libraryfrom classic_FindS import FindS3. Create an object for FindS classfs = FindS()4. Fit your Training Set to the modelfs.fit(X_train, y_train)5. Predict your Test Set resultsy_pred = fs.predict(y_test)Example Code1. Import the dataset and Preprocessimport numpy as npimport pandas as pddataset = pd.read_csv('Covid-19_Data.csv')result = {'Yes':1, 'No':0}dataset['Covid_19'] = dataset['Covid_19'].map(result)X = dataset.iloc[:, 0:5].valuesy = dataset.iloc[:, -1].valuesfrom sklearn.model_selection import KFoldkf = KFold(n_splits=10)for train_index, test_index in kf.split(X,y):X_train, X_test = X[train_index], X[test_index]y_train, y_test = y[train_index], y[test_index]2. Use the Find-S Libraryfrom classic_FindS import FindSfs = FindS()S_hypothesis = fs.fit(X_train, y_train)print("Specific Hypothesis : ", S_hypothesis)y_pred = fs.predict(X_test)FootnotesYou can find the code at myGithub.Connect with me on Social Mediahttps://www.github.com/safir72347https://www.linkedin.com/in/safir72347/https://www.instagram.com/safir_12_10/
Package: classic-http-api
Classic HTTP ApiThis package provides base for http APIs, based Falcon framework.Part of project "Classic".Usage:fromclassic.http_apiimportAppclassReports:defon_get_for_day(self,request,response):response.media={'day':'report'}defon_get_for_month(self,request,response):response.media={'day':'period'}app=App()# Will generate URLs:# /api/reports/for_day# /api/reports/for_monthapp.register(Reports())# If we need to customize url:app.register(Reports(),url='/order_reports')# Urls will be:# /api/order_reports/for_day# /api/order_reports/for_month# We may register methods only:app.add_method('/reports/daily',Reports(),suffix='for_day')# Url will be /api/reports/daily# prefix may be customized in App class:app=App(prefix='/api/custom')# Now, URL will be /api/custom/reports/dailyapp.add_method('/reports/daily',Reports(),suffix='for_day')Also, App class can transform pydantic.ValidationError, AppError and ErrorsList
from classic.app to formats:ValidationError:[{"type":"namespace.error_code","msg":"Verbose message","loc":["path","to","error"]}]AppError:[{"type":"namespace.error_code","msg":"Verbose message","ctx":{"any_key":"any_useful_info"}}]Also, this response statuses in this cases will be 400.
Package: classic-http-auth
Classic http authThis package provides utils for authentication and authorization processes. Part of project "Classic".Authentication usagefromclassic.http_authimportauthenticate@join_point@authenticatedefon_get_show_product(self,request,response):client=request.context.clientClient appears in request.context.clientFor this you need to create instance in your core level codefromclassic.http_authimportAuthenticatorauthenticator=Authenticator()Decorate any controller as authentication needed (parameter "authenticator" will automatically describe in the constructor)fromclassic.http_authimportauthenticator_needed@component@authenticator_neededclassCatalog:catalog:services.Catalog...Decorators order is doesn't matterChoose a properly strategy in your api factory code (adapter level) and put the authenticator in the controllerfromclassic.http_authimportstrategiesasauth_strategiesfromsimple_shop.adapters.shop_apiimportauthenticatorauthenticator.set_strategies(auth_strategies.JWT(secret_key='123',))controller=controllers.Catalog(authenticator=authenticator,catalog=catalog,)You can pass multiple strategies to the authenticator. First succeed strategy will be winnerIf all strategies failed exception will be raisedAuthorization usageThis stage is doing after authenticationDefine groups and permissions (access schema) in your core level code and pass this one to the authenticatorfromclassic.http_authimportAuthenticator,Group,Permissionfull_control=Permission('full_control')read_only=Permission('read_only')groups=(Group('admins',permissions=[full_control]),Group('managers',permissions=[read_only]),Group('guests'),)authenticator=Authenticator(app_groups=groups)Apply authorization decorator to the controller method with needed groups and permission combinationfromclassic.http_authimportGroup,authenticate@authenticate@authorize(Group('admin'))defon_get_show_product(self,request,response):...You can combine groups and permissions as you wantfromclassic.http_authimportGroup,Permission,authenticate,authorize@authenticate@authorize((Group('admin')&Group('foo'))|Permission('write'))defon_get_show_product(self,request,response):...If access denied exception will be raisedDependenciesfalcon for pushing client info through HTTPpyjwt for strategiesTests and development modeYou can use dummy strategyauth_strategy=auth_strategies.JWT(secret_key='123')auth_dummy_strategy=auth_strategies.Dummy(login=login,name=name,groups=groups,email=email)ifnotis_dev:authenticator.set_strategies(auth_strategy)else:authenticator.set_strategies(auth_dummy_strategy)Dummy auth data appear in a client
Package: classic-ID3-DecisionTree
ID3 Decision Tree AlgorithmID3 is a Machine Learning Decision Tree Classification Algorithm that uses two methods to build the model. The two methods are Information Gain and Gini Index.Version 1.0.0 - Information Gain OnlyVersion 2.0.0 - Gini Index addedVersion 2.0.1 - Documentation SortedVersion 2.0.2 - All SortedInstallationInstall directly from myPyPipip install classic-ID3-DecisionTreeOr Clone theRepositoryand installpython3 setup.py installParameters* X_trainThe Training Set array consisting of Features.* y_trainThe Training Set array consisting of Outcome.* datasetThe Entire DataSet.Attributes* DecisionTreeClassifier()Initialise the instance of Decision Tree Classifier class.* add_features(dataset, result_col_name)Add the features to the model by sending the dataset. The model will fetch the column features. The second parameter is the column name of outcome array.* information_gain(X_train, y_train)To build the decision tree using Information Gain* gini_index(X_train, y_train)To build the decision tree using Gini Index* predict(y_test)Predict the Test Set ResultsDocumentation1.  Install the packagepip install classic-ID3-DecisionTree2. Import the libraryfrom classic_ID3_decision_tree import DecisionTreeClassifier3. Create an object for Decision Tree Classifier classid3 = DecisionTreeClassifier()4. Add Column Features to the modelid3.add_features(dataset, result_col_name)5. Build the Decision Tree Model using Information Gainid3.information_gain(X_train, y_train)OR5. Build the Decision Tree Model using Gini Indexid3.gini_index(X_train, y_train)6. Predict the Test Set Resultsy_pred = id3.predict(X_test)Example Code0. Download the datasetDownload dataset fromhere1. Import the dataset and Preprocessimport numpy as npimport matplotlib.pyplot as pltimport pandas as pddataset = pd.read_csv('house-votes-84.csv')rawdataset = pd.read_csv('house-votes-84.csv')party = {'republican':0, 'democrat':1}vote = {'y':1, 'n':0, '?':0}for col in dataset.columns:if col != 'party':dataset[col] = dataset[col].map(vote)dataset['party'] = dataset['party'].map(party)X = dataset.iloc[:, 1:17].valuesy = dataset.iloc[:, 0].valuesfrom sklearn.model_selection import KFoldkf = KFold(n_splits=5)for train_index, test_index in kf.split(X,y):X_train, X_test = X[train_index], X[test_index]y_train, y_test = y[train_index], y[test_index]2. Use the ID3 Libraryfrom classic_ID3_decision_tree import DecisionTreeClassifierid3 = DecisionTreeClassifier()id3.add_features(dataset, 'party')print(id3.features)id3.information_gain(X_train, y_train)ORid3.gini_index(X_train, y_train)y_pred = ig.predict(X_test)FootnotesYou can find the code at myGithub.Connect with me on Social Mediahttps://www.github.com/safir72347https://www.linkedin.com/in/safir72347/https://www.instagram.com/safir_12_10/
Package: classic-isotherms
ClassicIsothermsClassicIsotherms is a Python module that provides implementations of various classic adsorption isotherm equations. It allows you to calculate the loading and deviations for different isotherm models based on pressure, temperature, and parameters.InstallationYou can install ClassicIsotherms using pip:pipinstallclassic-isothermsUsageimportClassicIsotherms# Create an instance of ClassicIsothermisotherm=ClassicIsotherms("freundlich")# Calculate loading for a given pressure, temperature, and parameterspressure=1.5temperature=298.15parameters=[2.0,1.5]loading=isotherm.get_loading(pressure,temperature,parameters)print("Loading:",loading)# Calculate loadings for multiple pressurespressures=[1.0,2.0,3.0]loadings=isotherm.get_loadings(pressures,temperature,parameters)print("Loadings:",loadings)# Calculate deviation using a specific deviation functionexperimental_loadings=[0.5,1.0,1.5]deviation_equation="SSE"deviation=isotherm.get_deviation(pressures,experimental_loadings,temperature,parameters,deviation_equation)print("Deviation:",deviation)Supported Isotherm ModelsThe following classic adsorption isotherm models are currently supported:Freundlich ('freundlich')Langmuir ('langmuir')Redlich-Peterson ('redlich-perterson')Sips ('sips')Toth ('toth')Unilan ('unilan')Keller-Staudt-Toth ('keller-staudt-toth')Supported Deviation MethodsThe following deviation methods are currently supported:Sum of Squared Errors ('SSE')Average Relative Error ('ARE')Absolute Error ('EABS')Hybrid Deviation ('HYBRID')Mean Percentage Standard Deviation ('MPSD')Sum of Relative Errors ('SRE')Chi-square Deviation ('CHI_2')Residual Sum of Squares Deviation ('R_S')ContributingContributions are welcome! If you have suggestions, bug reports, or feature requests, please open an issue on theGitHub repository.LicenseClassicIsotherms is licensed under the MIT License. See theLICENSEfile for more information.
Package: classicmenu-indicator
What is ClassicMenu Indicator?ClassicMenu Indicator is a notification area applet (application
indicator) for the top panel of Ubuntu’s Unity desktop environment and
other environments that support the AppIndicator protocol.It provides a simple way to get a GNOME Classic-style application menu
for those who prefer this over the Unity dash menu.If you use WINE applications or games they are available in
ClassicMenu Indicator, too. Depending on your local settings you may
have to open the Preferences dialog from the ClassicMenu Indicator
submenu and activate the WINE menu there.Get itClassicMenu Indicator is available athttp://www.florian-diesch.de/software/classicmenu-indicator/StatusAs far as I know there aren’t any critical bugs in ClassicMenu Indicator.If you find a bug in ClassicMenu Indicator please report it at thebugtracker at Launchapdso that I can fix it. Thank you.RequirementsClassicMenu Indicator is beeing developed on Ubuntu 15.10 “Wily
Werewolf” and additionally tested on Ubuntu 16.04 “Xenial Xerus”,
Ubuntu 12.04 “Precise Pangolin” and Ubuntu 14.04 “Trusty Tahr”.ClassicMenu Indicator needs the following packages from the software sources:python3-gigir1.2-glib-2.0gir1.2-gtk-3.0gir1.2-gmenu-3.0gir1.2-appindicator3-0.1python3-pkg-resourcesIf you install the .deb package this packages will be automatically
installed if needed.ProjectFor bug reports or feature requests please use thebugtracker at LaunchpadTheproject page at Launchpadofers some other services, too.LicenseThis 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 should have received a copy of the GNU General Public License
along with this program.  If not, seehttp://www.gnu.org/licenses/