hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
qsc_code_num_words_quality_signal
int64
qsc_code_num_chars_quality_signal
float64
qsc_code_mean_word_length_quality_signal
float64
qsc_code_frac_words_unique_quality_signal
float64
qsc_code_frac_chars_top_2grams_quality_signal
float64
qsc_code_frac_chars_top_3grams_quality_signal
float64
qsc_code_frac_chars_top_4grams_quality_signal
float64
qsc_code_frac_chars_dupe_5grams_quality_signal
float64
qsc_code_frac_chars_dupe_6grams_quality_signal
float64
qsc_code_frac_chars_dupe_7grams_quality_signal
float64
qsc_code_frac_chars_dupe_8grams_quality_signal
float64
qsc_code_frac_chars_dupe_9grams_quality_signal
float64
qsc_code_frac_chars_dupe_10grams_quality_signal
float64
qsc_code_frac_chars_replacement_symbols_quality_signal
float64
qsc_code_frac_chars_digital_quality_signal
float64
qsc_code_frac_chars_whitespace_quality_signal
float64
qsc_code_size_file_byte_quality_signal
float64
qsc_code_num_lines_quality_signal
float64
qsc_code_num_chars_line_max_quality_signal
float64
qsc_code_num_chars_line_mean_quality_signal
float64
qsc_code_frac_chars_alphabet_quality_signal
float64
qsc_code_frac_chars_comments_quality_signal
float64
qsc_code_cate_xml_start_quality_signal
float64
qsc_code_frac_lines_dupe_lines_quality_signal
float64
qsc_code_cate_autogen_quality_signal
float64
qsc_code_frac_lines_long_string_quality_signal
float64
qsc_code_frac_chars_string_length_quality_signal
float64
qsc_code_frac_chars_long_word_length_quality_signal
float64
qsc_code_frac_lines_string_concat_quality_signal
float64
qsc_code_cate_encoded_data_quality_signal
float64
qsc_code_frac_chars_hex_words_quality_signal
float64
qsc_code_frac_lines_prompt_comments_quality_signal
float64
qsc_code_frac_lines_assert_quality_signal
float64
qsc_codepython_cate_ast_quality_signal
float64
qsc_codepython_frac_lines_func_ratio_quality_signal
float64
qsc_codepython_cate_var_zero_quality_signal
bool
qsc_codepython_frac_lines_pass_quality_signal
float64
qsc_codepython_frac_lines_import_quality_signal
float64
qsc_codepython_frac_lines_simplefunc_quality_signal
float64
qsc_codepython_score_lines_no_logic_quality_signal
float64
qsc_codepython_frac_lines_print_quality_signal
float64
qsc_code_num_words
int64
qsc_code_num_chars
int64
qsc_code_mean_word_length
int64
qsc_code_frac_words_unique
null
qsc_code_frac_chars_top_2grams
int64
qsc_code_frac_chars_top_3grams
int64
qsc_code_frac_chars_top_4grams
int64
qsc_code_frac_chars_dupe_5grams
int64
qsc_code_frac_chars_dupe_6grams
int64
qsc_code_frac_chars_dupe_7grams
int64
qsc_code_frac_chars_dupe_8grams
int64
qsc_code_frac_chars_dupe_9grams
int64
qsc_code_frac_chars_dupe_10grams
int64
qsc_code_frac_chars_replacement_symbols
int64
qsc_code_frac_chars_digital
int64
qsc_code_frac_chars_whitespace
int64
qsc_code_size_file_byte
int64
qsc_code_num_lines
int64
qsc_code_num_chars_line_max
int64
qsc_code_num_chars_line_mean
int64
qsc_code_frac_chars_alphabet
int64
qsc_code_frac_chars_comments
int64
qsc_code_cate_xml_start
int64
qsc_code_frac_lines_dupe_lines
int64
qsc_code_cate_autogen
int64
qsc_code_frac_lines_long_string
int64
qsc_code_frac_chars_string_length
int64
qsc_code_frac_chars_long_word_length
int64
qsc_code_frac_lines_string_concat
null
qsc_code_cate_encoded_data
int64
qsc_code_frac_chars_hex_words
int64
qsc_code_frac_lines_prompt_comments
int64
qsc_code_frac_lines_assert
int64
qsc_codepython_cate_ast
int64
qsc_codepython_frac_lines_func_ratio
int64
qsc_codepython_cate_var_zero
int64
qsc_codepython_frac_lines_pass
int64
qsc_codepython_frac_lines_import
int64
qsc_codepython_frac_lines_simplefunc
int64
qsc_codepython_score_lines_no_logic
int64
qsc_codepython_frac_lines_print
int64
effective
string
hits
int64
47809d65f9b6492472bef06377ad2f44a10c127c
1,742
py
Python
motto/core.py
attakei/jamproject
f3a677f4f95c112b89fb38957e6ba1a3c923ea85
[ "Apache-2.0" ]
null
null
null
motto/core.py
attakei/jamproject
f3a677f4f95c112b89fb38957e6ba1a3c923ea85
[ "Apache-2.0" ]
1
2020-01-05T14:04:35.000Z
2020-01-05T14:04:35.000Z
motto/core.py
attakei/motto
f3a677f4f95c112b89fb38957e6ba1a3c923ea85
[ "Apache-2.0" ]
null
null
null
"""Core classes for motto """ from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple, Union from typing_extensions import Protocol, TypedDict class Message(object): """Reporting message class. This object is appended for paragraphes by skills. Responsibility is only telling event "what" for user, not "where". """ def __init__(self, body: str): self.body: str = body """message body""" class Report(object): """Report by skills. """ def __init__(self): self._messages: List[Message] = [] def __repr__(self): cnt = len(self) if cnt == 0: return "[No reports]" if cnt == 1: return "[1 report]" return f"[{cnt} reports]" def __len__(self) -> int: return len(self._messages) def add(self, msg: Message): self._messages.append(msg) class Token(Protocol): """Token interface for tokenize engine. Based from Janome. """ surface: ClassVar[str] class Sentence(object): """Sentence dataset and accessor. """ def __init__(self, tokens: Union[Tuple[Token, ...], List[Token]]): self._tokens: Tuple[Token, ...] = tuple(tokens) if isinstance( tokens, list ) else tokens def __repr__(self) -> str: cnt = len(self) if cnt == 0: return "[no tokens]" if cnt == 1: return "[1 token]" return f"[{cnt} tokens]" def __len__(self) -> int: return len(self._tokens) def __getitem__(self, key) -> Token: return self._tokens[key] SkillParams = Dict[str, Any] SkillProc = Callable[[Sentence, SkillParams], Optional[Message]] Config = Dict[str, Any]
22.050633
78
0.588978
204
1,742
4.838235
0.372549
0.042553
0.033435
0.024316
0.12766
0.101317
0.101317
0.048632
0
0
0
0.0048
0.282434
1,742
78
79
22.333333
0.7848
0.161883
0
0.2
0
0
0.050969
0
0
0
0
0
0
1
0.225
false
0
0.05
0.075
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
4785cd8056f1f3e45758e79a377162fd96261ea3
6,450
py
Python
folder_tree/migrations/0001_initial.py
JoenyBui/django-folder-tree
a742f3d69ad01f5403ce43578240a6cc54fa6956
[ "BSD-3-Clause" ]
null
null
null
folder_tree/migrations/0001_initial.py
JoenyBui/django-folder-tree
a742f3d69ad01f5403ce43578240a6cc54fa6956
[ "BSD-3-Clause" ]
null
null
null
folder_tree/migrations/0001_initial.py
JoenyBui/django-folder-tree
a742f3d69ad01f5403ce43578240a6cc54fa6956
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-12-13 22:10 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import folder_tree.models import mptt.fields class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='GeneralFile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(blank=True, max_length=255, null=True)), ('is_executable', models.BooleanField(default=False)), ('is_locked', models.BooleanField(default=False)), ('created', models.DateTimeField(auto_now_add=True)), ('modified', models.DateTimeField(auto_now_add=True)), ('file_type', models.IntegerField(choices=[(0, 'txt'), (1, 'png'), (2, 'jpg'), (3, 'jpeg'), (4, 'gif'), (5, 'bmp'), (6, 'mpg'), (7, 'mpeg'), (8, 'mov'), (9, 'avi'), (10, 'wmv'), (11, 'csv'), (12, 'pdf'), (13, 'xls'), (14, 'xlsx'), (15, 'doc'), (16, 'docx'), (17, 'ppt'), (18, 'pptx'), (-1, 'unknown')], default=-1)), ('file', models.FileField(default='default.txt', upload_to=folder_tree.models.user_file_path)), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], options={ 'abstract': False, }, ), migrations.CreateModel( name='ImageFile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(blank=True, max_length=255, null=True)), ('is_executable', models.BooleanField(default=False)), ('is_locked', models.BooleanField(default=False)), ('created', models.DateTimeField(auto_now_add=True)), ('modified', models.DateTimeField(auto_now_add=True)), ('file_type', models.IntegerField(choices=[(1, 'png'), (2, 'jpg'), (3, 'jpeg'), (4, 'gif'), (5, 'bmp')], default=-1)), ('photo', models.ImageField(upload_to=folder_tree.models.user_file_path)), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], options={ 'abstract': False, }, ), migrations.CreateModel( name='Trash', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ], ), migrations.CreateModel( name='TreeFolder', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('is_locked', models.BooleanField(default=False)), ('created', models.DateTimeField(auto_now_add=True)), ('modified', models.DateTimeField(auto_now_add=True)), ('lft', models.PositiveIntegerField(db_index=True, editable=False)), ('rght', models.PositiveIntegerField(db_index=True, editable=False)), ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)), ('level', models.PositiveIntegerField(db_index=True, editable=False)), ], options={ 'abstract': False, }, ), migrations.CreateModel( name='TreeProfile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ], ), migrations.CreateModel( name='ProjectFolder', fields=[ ('treefolder_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='folder_tree.TreeFolder')), ('app_type', models.IntegerField(choices=[(1, 'WhAM')], default=1)), ], options={ 'abstract': False, }, bases=('folder_tree.treefolder',), ), migrations.AddField( model_name='treeprofile', name='root_folder', field=models.ForeignKey(blank=True, default=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='folder_tree.TreeFolder'), ), migrations.AddField( model_name='treeprofile', name='user', field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='treefolder', name='parent', field=mptt.fields.TreeForeignKey(blank=True, default=0, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='folder_tree.TreeFolder'), ), migrations.AddField( model_name='treefolder', name='user', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='trash', name='prev', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='folder_tree.TreeFolder'), ), migrations.AddField( model_name='trash', name='profile', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='folder_tree.TreeProfile'), ), migrations.AddField( model_name='imagefile', name='folder', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='folder_tree.ProjectFolder'), ), migrations.AddField( model_name='generalfile', name='folder', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='folder_tree.ProjectFolder'), ), ]
47.426471
332
0.582171
658
6,450
5.553191
0.214286
0.028462
0.045977
0.07225
0.749589
0.741379
0.697865
0.643131
0.6185
0.585112
0
0.013768
0.268062
6,450
135
333
47.777778
0.76022
0.010543
0
0.629921
1
0
0.110989
0.028688
0
0
0
0
0
1
0
false
0
0.047244
0
0.07874
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
479004b6cfb780abc09aa80bc0894ff64e48376b
182
py
Python
extra_tests/snippets/stdlib_types.py
mainsail-org/RustPython
5d2d87c24f1ff7201fcc8d4fcffadb0ec12dc127
[ "CC-BY-4.0", "MIT" ]
11,058
2018-05-29T07:40:06.000Z
2022-03-31T11:38:42.000Z
extra_tests/snippets/stdlib_types.py
mainsail-org/RustPython
5d2d87c24f1ff7201fcc8d4fcffadb0ec12dc127
[ "CC-BY-4.0", "MIT" ]
2,105
2018-06-01T10:07:16.000Z
2022-03-31T14:56:42.000Z
extra_tests/snippets/stdlib_types.py
mainsail-org/RustPython
5d2d87c24f1ff7201fcc8d4fcffadb0ec12dc127
[ "CC-BY-4.0", "MIT" ]
914
2018-07-27T09:36:14.000Z
2022-03-31T19:56:34.000Z
import types from testutils import assert_raises ns = types.SimpleNamespace(a=2, b='Rust') assert ns.a == 2 assert ns.b == "Rust" with assert_raises(AttributeError): _ = ns.c
16.545455
41
0.714286
28
182
4.535714
0.535714
0.188976
0
0
0
0
0
0
0
0
0
0.013158
0.164835
182
10
42
18.2
0.822368
0
0
0
0
0
0.043956
0
0
0
0
0
0.571429
1
0
false
0
0.285714
0
0.285714
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
2
4790afe07c99445354df0a84235383f75387a69b
2,164
py
Python
selene/common/delegation.py
KalinkinaMaria/selene
859e1102c85740b52af8d0f08dd6b6490b4bd2ff
[ "MIT" ]
null
null
null
selene/common/delegation.py
KalinkinaMaria/selene
859e1102c85740b52af8d0f08dd6b6490b4bd2ff
[ "MIT" ]
1
2021-06-02T04:21:17.000Z
2021-06-02T04:21:17.000Z
selene/common/delegation.py
vkarpenko/selene
4776357430c940be38f38be9981006dd156f9730
[ "MIT" ]
null
null
null
from abc import ABCMeta def _make_delegator_method(name): def delegator(self, *args, **kwargs): return getattr(self.__delegate__, name)(*args, **kwargs) # pragma: no cover # todo: consider using __call__() instead of __delegate__ # in Python delegates are objects with __call__ method.. # so why not to use the following: # return getattr(self(), name)(*args, **kwargs) # ? return delegator # def _make_delegator_method_to_property(name): # def delegator(self, *args, **kwargs): # return getattr(self.__delegate__, name) # return delegator def _make_delegator_property(name): return property(lambda self: getattr(self.__delegate__, name)) # pragma: no cover def _is_property(name, cls): return isinstance(getattr(cls, name, None), property) class DelegatingMeta(ABCMeta): def __new__(mcs, name, bases, dct): abstract_property_names = frozenset.union( *(frozenset(filter(lambda m: _is_property(m, base), base.__abstractmethods__)) for base in bases)) for base in bases: base.__abstractmethods__ = frozenset(filter(lambda m: not _is_property(m, base), base.__abstractmethods__)) abstract_method_names = frozenset.union(*(base.__abstractmethods__ for base in bases)) for name in abstract_method_names: if name not in dct: dct[name] = _make_delegator_method(name) # for name in abstract_property_names: # if name not in dct: # dct[name] = _make_delegator_method_to_property(name) cls = super(DelegatingMeta, mcs).__new__(mcs, name, bases, dct) for name in abstract_property_names: if name not in dct: setattr(cls, name, _make_delegator_property(name)) return cls # todo: finalize naming: Delegating, Delegate, actual_delegate, delegatee, delegator o_O ? # We have the following players in this game: # * MetaClass for Classes of Objects who delegates their implementation to aggregated object # So who should be named how?
34.903226
119
0.657116
259
2,164
5.150579
0.320463
0.058471
0.056972
0.051724
0.431034
0.330585
0.261619
0.207646
0.207646
0.207646
0
0
0.257856
2,164
61
120
35.47541
0.830635
0.351201
0
0.153846
0
0
0
0
0
0
0
0.016393
0
1
0.192308
false
0
0.038462
0.115385
0.461538
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
1
0
0
0
2
47928a4b5a14d921593fc3e938a7ef189730aea5
186
py
Python
src/pymystem_example1.py
componavt/neural_synset
b58f03af90af6fe2ffe8253a1222c99c2b8907df
[ "Unlicense" ]
null
null
null
src/pymystem_example1.py
componavt/neural_synset
b58f03af90af6fe2ffe8253a1222c99c2b8907df
[ "Unlicense" ]
null
null
null
src/pymystem_example1.py
componavt/neural_synset
b58f03af90af6fe2ffe8253a1222c99c2b8907df
[ "Unlicense" ]
null
null
null
# -*- coding: utf-8 -*- from pymystem3 import Mystem # text = "some good newses" text = "Красивая мама красиво мыла раму" m = Mystem() lemmas = m.lemmatize(text) print(''.join(lemmas))
20.666667
40
0.677419
26
186
4.846154
0.807692
0
0
0
0
0
0
0
0
0
0
0.012821
0.16129
186
8
41
23.25
0.794872
0.252688
0
0
0
0
0.227941
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
4799c59de86fb0c7aac927367ccd22e4581ad71b
905
py
Python
star_types/parameters.py
annalieNK/star-types
194ffa6f03db175ae8ac6fbc912bb8a45c52cbfe
[ "MIT" ]
null
null
null
star_types/parameters.py
annalieNK/star-types
194ffa6f03db175ae8ac6fbc912bb8a45c52cbfe
[ "MIT" ]
null
null
null
star_types/parameters.py
annalieNK/star-types
194ffa6f03db175ae8ac6fbc912bb8a45c52cbfe
[ "MIT" ]
null
null
null
def parameters(model_type): if model_type == 'random forest': param_grid = { 'classifier__estimator__n_estimators': [50, 100], 'classifier__estimator__max_features' :['sqrt', 'log2'], 'classifier__estimator__max_depth' : [4,6,8] } elif model_type == 'logistic regression': param_grid = { 'classifier__estimator__C': [0.1, 1.0, 10] } elif model_type == 'support vector machine': param_grid = { 'classifier__estimator__C': [0.1, 1.0, 10], 'classifier__estimator__kernel': ['linear'], 'classifier__estimator__probability': [True] } elif model_type == 'kneighbors': param_grid = { 'classifier__estimator__n_neighbors': [1, 3, 5], 'classifier__estimator__weights': ['uniform', 'distance'] } return param_grid
36.2
69
0.581215
90
905
5.288889
0.5
0.359244
0.159664
0.235294
0.268908
0.147059
0.147059
0.147059
0.147059
0.147059
0
0.037736
0.297238
905
25
70
36.2
0.710692
0
0
0.173913
0
0
0.408389
0.30574
0
0
0
0
0
1
0.043478
false
0
0
0
0.086957
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
479c044c04a29437935975e735d0a42de577c613
1,866
py
Python
Square_Lattice/obs.py
suron-003/Dynamic-Structure-Factor
908ebcd8e6db5c6bf19a3a782c3b0a4b97a35f8b
[ "MIT" ]
1
2022-01-25T16:36:28.000Z
2022-01-25T16:36:28.000Z
Square_Lattice/obs.py
suron-003/Dynamic-Structure-Factor
908ebcd8e6db5c6bf19a3a782c3b0a4b97a35f8b
[ "MIT" ]
null
null
null
Square_Lattice/obs.py
suron-003/Dynamic-Structure-Factor
908ebcd8e6db5c6bf19a3a782c3b0a4b97a35f8b
[ "MIT" ]
null
null
null
import numpy as np from numpy import random, linspace, cos, pi import math import random import matplotlib.pyplot as plt from scipy.fft import fft, fftfreq from scipy.fft import rfft, rfftfreq import copy from mpl_toolkits.mplot3d import axes3d from mpl_toolkits import mplot3d from plotly import __version__ import pandas as pd from scipy.optimize import fsolve import cmath from numba import jit from numpy import linalg as LA from scipy.linalg import expm, norm from scipy.integrate import odeint import time import numba from parameters import * from lattice import * import plotly.offline as pyo import plotly.graph_objs as go from plotly.offline import iplot import plotly.figure_factory as ff import plotly.express as px @jit(nopython=True) def ene(lat): e = 0 for x in range(0,s): for y in range(0,s): x1 = int((x+1)%s) x2 = int((x-1)%s) y1 = int((y+1)%s) y2 = int((y-1)%s) ej = (J*(np.dot(lat[x,y],lat[x1,y]+lat[x2,y]+lat[x,y1]+lat[x,y2]))) exx1 = -1*d*np.dot(dxx1,np.cross(lat[x,y],lat[x1,y])) exx2 = -1*d*np.dot(dxx2,np.cross(lat[x,y],lat[x2,y])) eyy1 = -1*d*np.dot(dyy1,np.cross(lat[x,y],lat[x,y1])) eyy2 = -1*d*np.dot(dyy2,np.cross(lat[x,y],lat[x,y2])) edm = (exx1 + exx2 + eyy1 + eyy2) eb = -1*b*np.dot(b_vec,lat[x,y]) e = e + (ej/2 + edm/2 + eb) return e @jit(nopython=True) def H_eff(lat,x,y): x1 = int((x+1)%s) x2 = int((x-1)%s) y1 = int((y+1)%s) y2 = int((y-1)%s) dxx1 = np.array([0.0,-1.0,0.0]) dxx2 = np.array([0.0,1.0,0.0]) dyy2 = np.array([1.0,0.0,0.0]) dyy1 = np.array([-1.0,0.0,0.0]) b_vec = np.array([0.0,0.0,1.0]) heff = (-1*b*gamma*b_vec) + (0.5*J*(lat[x1,y] + lat[x2,y] + lat[x,y1] + lat[x,y2])) - d*(0.5*(np.cross(dxx1,lat[x1,y]) + np.cross(dxx2,lat[x2,y]) + np.cross(dyy1,lat[x,y1]) + np.cross(dyy2,lat[x,y2]))) return heff
30.096774
203
0.633976
382
1,866
3.065445
0.251309
0.029035
0.025619
0.034159
0.199829
0.199829
0.167378
0.140051
0.095645
0.095645
0
0.065147
0.177385
1,866
62
204
30.096774
0.69772
0
0
0.172414
0
0
0
0
0
0
0
0
0
1
0.034483
false
0
0.465517
0
0.534483
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
47ab86e8093f2c1a626207ebde134e3527326fd9
659
py
Python
mwasurveyweb/templatetags/template_filters.py
tjgalvin/SS18B-NHurleyWalker
81b1bbb9e7131a92804b0dbddac795217b524160
[ "MIT" ]
1
2020-07-23T08:48:50.000Z
2020-07-23T08:48:50.000Z
mwasurveyweb/templatetags/template_filters.py
tjgalvin/SS18B-NHurleyWalker
81b1bbb9e7131a92804b0dbddac795217b524160
[ "MIT" ]
6
2020-02-11T23:38:13.000Z
2022-02-10T07:28:07.000Z
mwasurveyweb/templatetags/template_filters.py
tjgalvin/SS18B-NHurleyWalker
81b1bbb9e7131a92804b0dbddac795217b524160
[ "MIT" ]
1
2020-07-23T09:01:29.000Z
2020-07-23T09:01:29.000Z
""" Distributed under the MIT License. See LICENSE.txt for more info. """ from django import template register = template.Library() @register.filter def get_item(dictionary, key): """ Returns the object for that key from a dictionary. :param dictionary: A dictionary object :param key: Key to search for :return: Object that corresponds to the key in the dictionary """ return dictionary.get(key, None) @register.filter def field_type(field): """ Returns the field type of an input :param field: input field :return: string representing the class name """ return field.field.widget.__class__.__name__
22.724138
65
0.704097
89
659
5.101124
0.483146
0.061674
0.07489
0
0
0
0
0
0
0
0
0
0.212443
659
28
66
23.535714
0.874759
0.534143
0
0.25
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.125
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
47e9940c13fbcbe44daf1d6db6129df93471f1e5
2,965
py
Python
scripts/ch4_correlation_plot.py
mathkann/understanding-random-forests
d2c5e0174d1a778be37a495083d756b2829160ec
[ "BSD-3-Clause" ]
353
2015-01-03T13:34:03.000Z
2022-03-25T05:16:30.000Z
scripts/ch4_correlation_plot.py
mathkann/understanding-random-forests
d2c5e0174d1a778be37a495083d756b2829160ec
[ "BSD-3-Clause" ]
1
2016-06-29T05:43:41.000Z
2016-06-29T05:43:41.000Z
scripts/ch4_correlation_plot.py
mathkann/understanding-random-forests
d2c5e0174d1a778be37a495083d756b2829160ec
[ "BSD-3-Clause" ]
153
2015-01-14T03:46:42.000Z
2021-12-26T10:13:51.000Z
import numpy as np import matplotlib.pyplot as plt import pandas as pd blue = (0, 0, 1.0) green = (0, 0.8, 0) red = (1.0, 0, 0) red_alpha = (1.0, 0, 0, 0.001) gray = (0.7, 0.7, 0.7) results = [[],[], ["RandomForestRegressor-K=1",3.527128,2.820386,0.706743,0.063868,0.009973,0.286104,0.420639], ["RandomForestRegressor-K=2",3.036291,2.333874,0.702417,0.075537,0.011347,0.314841,0.387576], ["RandomForestRegressor-K=3",2.823907,2.109897,0.714009,0.087809,0.012335,0.349486,0.364523], ["RandomForestRegressor-K=4",2.715613,1.979086,0.736527,0.102472,0.014302,0.391750,0.344778], ["RandomForestRegressor-K=5",2.643232,1.887080,0.756151,0.111790,0.015411,0.421380,0.334772], ["RandomForestRegressor-K=6",2.642354,1.851498,0.790856,0.125342,0.016268,0.466556,0.324300], ["RandomForestRegressor-K=7",2.636296,1.822316,0.813980,0.134200,0.017159,0.495746,0.318234], ["RandomForestRegressor-K=8",2.623646,1.784344,0.839303,0.146081,0.018631,0.531100,0.308202], ["RandomForestRegressor-K=9",2.645439,1.780447,0.864992,0.152977,0.019492,0.558601,0.306390], ["RandomForestRegressor-K=10",2.638901,1.753437,0.885464,0.160371,0.020184,0.583494,0.301970], ["ExtraTreesRegressor-K=1",3.376099,2.723586,0.652514,0.051864,0.009532,0.230752,0.421761], ["ExtraTreesRegressor-K=2",2.801100,2.146534,0.654566,0.060858,0.011926,0.258086,0.396480], ["ExtraTreesRegressor-K=3",2.536644,1.886837,0.649807,0.067322,0.012756,0.273424,0.376383], ["ExtraTreesRegressor-K=4",2.409943,1.745583,0.664360,0.076519,0.016511,0.302962,0.361399], ["ExtraTreesRegressor-K=5",2.330165,1.651706,0.678459,0.086137,0.017063,0.331515,0.346944], ["ExtraTreesRegressor-K=6",2.285386,1.597063,0.688323,0.092147,0.019216,0.349667,0.338655], ["ExtraTreesRegressor-K=7",2.263983,1.553772,0.710211,0.100322,0.020510,0.378116,0.332094], ["ExtraTreesRegressor-K=8",2.246997,1.528167,0.718831,0.107167,0.021703,0.396323,0.322507], ["ExtraTreesRegressor-K=9",2.236845,1.495768,0.741077,0.115699,0.023020,0.423894,0.317183], ["ExtraTreesRegressor-K=10",2.232862,1.469781,0.763081,0.123849,0.024420,0.451778,0.311304]] max_features = range(1, 10+1) ax = plt.subplot(1, 2, 1) plt.plot(max_features, [results[1+k][1] for k in max_features], 'o-', color=blue, label='Random Forest') plt.plot(max_features, [results[1+k][2] for k in max_features], 'o--', color=blue) plt.plot(max_features, [results[1+k][3] for k in max_features], 'o:', color=blue) plt.plot(max_features, [results[11+k][1] for k in max_features], 'o-', color=red, label='Extremely Randomized Trees') plt.plot(max_features, [results[11+k][2] for k in max_features], 'o--', color=red) plt.plot(max_features, [results[11+k][3] for k in max_features], 'o:', color=red) plt.legend(loc="best") plt.xlabel("$K$") plt.subplot(1, 2, 2, sharex=ax) plt.plot(max_features, [results[1+k][4] for k in max_features], 'o-', color=blue) plt.plot(max_features, [results[11+k][4] for k in max_features], 'o-', color=red) plt.xlabel("$K$") plt.ylabel("$\\rho$") plt.show()
57.019231
117
0.725801
553
2,965
3.858951
0.352622
0.087629
0.037488
0.067479
0.208997
0.208997
0.208997
0.148079
0.144799
0.075914
0
0.376379
0.051939
2,965
51
118
58.137255
0.382782
0
0
0.044444
0
0
0.187521
0.162563
0
0
0
0
0
1
0
false
0
0.066667
0
0.066667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
47e9c55cbdb85ad05b1bd86a08b95251624c0eb6
4,029
py
Python
Run_Vfree-Synthetic_Flat.py
Fernandez-Trincado/DataReductionPy
f06eb975067dc80cac038a47d3b9a9dde43bfdb6
[ "FSFAP" ]
1
2020-01-25T06:28:40.000Z
2020-01-25T06:28:40.000Z
Run_Vfree-Synthetic_Flat.py
Fernandez-Trincado/DataReductionPy
f06eb975067dc80cac038a47d3b9a9dde43bfdb6
[ "FSFAP" ]
null
null
null
Run_Vfree-Synthetic_Flat.py
Fernandez-Trincado/DataReductionPy
f06eb975067dc80cac038a47d3b9a9dde43bfdb6
[ "FSFAP" ]
null
null
null
#!/usr/bin/python # Created by: Jose G. Fernandez Trincado # Date: 2013 June 28 # Program: This program correct the imagen .fit (Science) by Syntethic Flat # 1 m Reflector telescope, National Astronomical Observatory of Venezuela # Mode f/5, 21 arcmin x 21 arcmin # Project: Omega Centauri, Tidal Tails. # The program Astrometry_V1.py defined was developed by J. G. Fernandez Trincado at the Centro de Investigaciones de Astronomia "Francisco J. Duarte". # If you have any problems, please contact J. G. Fernandez Trincado, [email protected] / [email protected] import numpy as np import scipy as sc import pyfits import sys, os from pyraf import iraf #run, program. #Example: # Next program: ./Run_Vfree-Synthetic_Flat.py GrupoX.dat # >>> GrupoX.dat/XXX.XX.XXX.XX.XXXX.hlv* location='/home/jfernandez/Escritorio/Tesis_2013-2014_CIDA_ULA/Data_Tesis_2013_2014_CIDA-ULA/Reflector/' if len(sys.argv[:]) < 2.: print '***************************************************' print 'Warning: ./Run_Vfree-Synthetic_Flat.py GrupoX.dat' print '***************************************************' else: #Combine images MEDIAN #TASK IRAF: images.immatch.imcombine #Function to combine images for generates Master Flat def Master_combina(inter_img,filt): iraf.images.immatch() iraf.images.immatch.output=filt iraf.images.immatch.headers='' iraf.images.immatch.bpmasks='' iraf.images.immatch.rejmasks='' iraf.images.immatch.nrejmasks='' iraf.images.immatch.expmasks='' iraf.images.immatch.sigmas='' iraf.images.immatch.logfile='STDOUT' iraf.images.immatch.combine='median' iraf.images.immatch.reject='avsigclip' iraf.images.immatch.project='no' iraf.images.immatch.outtype='real' iraf.images.immatch.outlimits='' iraf.images.immatch.offsets='none' iraf.images.immatch.masktype='none' iraf.images.immatch.maskvalue=0. iraf.images.immatch.blank=1.0 iraf.images.immatch.scale='mode' iraf.images.immatch.zero='none' iraf.images.immatch.weight='mode' iraf.images.immatch.statsec='' iraf.images.immatch.expname='' iraf.images.immatch.lthreshold='INDEF' iraf.images.immatch.hthreshold='INDEF' iraf.images.immatch.nlow=1. iraf.images.immatch.nhigh=1. iraf.images.immatch.nkeep=1. iraf.images.immatch.mclip='yes' iraf.images.immatch.lsigma=3. iraf.images.immatch.hsigma=3. iraf.images.immatch.rdnoise=7. iraf.images.immatch.gain=1.68 iraf.images.immatch.snoise=0. iraf.images.immatch.sigscale=0.1 iraf.images.immatch.pclip=-0.5 iraf.images.immatch.grow=0. iraf.images.immatch.imcombine(inter_img) data=sc.genfromtxt(sys.argv[1],dtype=str) #Lee lista dentro de los directorios, estas listas contienen la ruta de las imagenes ya clasificadas por filtro y tiempo de exposicion. for i in np.arange(len(data)): temp='/Initial_list_Syntethic_flat_' os.system('ls '+data[i]+temp+'* >temporal_classified.dat') data_clas=sc.genfromtxt('temporal_classified.dat',dtype=str) for j in np.arange(len(data_clas)): if data_clas[j] == data[i]+temp+'I60': os.system('cat '+data[i]+temp+'I60 >> MasterFlat_I60_Good.dat') elif data_clas[j] == data[i]+temp+'I90': os.system('cat '+data[i]+temp+'I90 >> MasterFlat_I90_Good.dat') elif data_clas[j] == data[i]+temp+'V60': os.system('cat '+data[i]+temp+'V60 >> MasterFlat_V60_Good.dat') elif data_clas[j] == data[i]+temp+'V90': os.system('cat '+data[i]+temp+'V90 >> MasterFlat_V90_Good.dat') else: pass os.system('rm temporal_classified.dat') os.system('ls MasterFlat_*_Good.dat >list_temp_gen.dat') data_end=sc.genfromtxt('list_temp_gen.dat',dtype=str) for k in np.arange(len(data_end)): print 'Generating Master Flat: '+data_end[k] print '' Master_combina('@'+data_end[k],data_end[k]+'.fit') print 'End of the process' print '' for h in np.arange(len(data)): os.system('cp '+data_end[k]+'.fit '+data[h]+'/') os.system('rm '+data_end[k]+'.fit') os.system('rm list_temp_gen.dat MasterFlat_*_Good.dat') #END
28.778571
150
0.70489
599
4,029
4.651085
0.360601
0.139986
0.237976
0.025844
0.128141
0.089375
0.0542
0.031228
0.031228
0
0
0.021283
0.125341
4,029
139
151
28.985612
0.769296
0.231571
0
0.075949
0
0
0.235218
0.148473
0
0
0
0
0
0
null
null
0.012658
0.063291
null
null
0.088608
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
47e9dce96f4661d34f10811dc840595ffed5833b
829
py
Python
abing/backend/abing/models/feature.py
dohyungp/abitrary
4dc3f4c79a433a2debe1f1e151d00400a2225e9c
[ "MIT" ]
5
2020-12-04T14:15:26.000Z
2020-12-30T09:11:09.000Z
abing/backend/abing/models/feature.py
dohyungp/abitrary
4dc3f4c79a433a2debe1f1e151d00400a2225e9c
[ "MIT" ]
8
2020-12-20T16:33:30.000Z
2021-01-06T01:56:55.000Z
abing/backend/abing/models/feature.py
dohyungp/abitrary
4dc3f4c79a433a2debe1f1e151d00400a2225e9c
[ "MIT" ]
1
2021-01-06T15:25:19.000Z
2021-01-06T15:25:19.000Z
from typing import TYPE_CHECKING from sqlalchemy import Column, Integer, String, Boolean, DateTime, ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.sql import func from abing.db.base_class import Base if TYPE_CHECKING: from .arm import Arm # noqa: F401 class Feature(Base): __tablename__ = "features" id = Column(Integer, primary_key=True, index=True, autoincrement=True) key = Column(String(200), index=True) value = Column(String) description = Column(String) arm_id = Column(Integer, ForeignKey("arms.id"), nullable=False) arm = relationship("Arm", back_populates="features") time_created = Column(DateTime(timezone=True), server_default=func.now()) time_updated = Column( DateTime(timezone=True), server_default=func.now(), onupdate=func.now() )
30.703704
79
0.731001
105
829
5.638095
0.466667
0.070946
0.054054
0.087838
0.155405
0.155405
0.155405
0.155405
0
0
0
0.008646
0.162847
829
26
80
31.884615
0.84438
0.012063
0
0
0
0
0.031824
0
0
0
0
0
0
1
0
false
0
0.315789
0
0.842105
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
47ee5fdbd7a2fd709f968f5597836efd8e182df3
207
py
Python
software/test/sample.py
technovus-sfu/swarmbots
6a50193a78056c0359c426b097b96e1c37678a55
[ "MIT" ]
null
null
null
software/test/sample.py
technovus-sfu/swarmbots
6a50193a78056c0359c426b097b96e1c37678a55
[ "MIT" ]
3
2018-02-05T23:21:02.000Z
2018-05-03T02:58:50.000Z
software/test/sample.py
technovus-sfu/swarmbots
6a50193a78056c0359c426b097b96e1c37678a55
[ "MIT" ]
null
null
null
# print("Hello World!") # sum = 2 + 2 # print(sum) # for i in range(10,-10,-1): # if i % 2 == 0: # print(i) # else: # pass # while(1): # val = input("Enter ") # print(val)
13.8
28
0.434783
30
207
3
0.633333
0
0
0
0
0
0
0
0
0
0
0.074627
0.352657
207
14
29
14.785714
0.597015
0.874396
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
47f07bbd0388ba3dd47eb8f252a382985372ec31
548
py
Python
CursoemVideoPython/Desafio 34.py
Beebruna/Python
bdbe10ea76acca1b417f5960db0aae8be44e0af3
[ "MIT" ]
null
null
null
CursoemVideoPython/Desafio 34.py
Beebruna/Python
bdbe10ea76acca1b417f5960db0aae8be44e0af3
[ "MIT" ]
null
null
null
CursoemVideoPython/Desafio 34.py
Beebruna/Python
bdbe10ea76acca1b417f5960db0aae8be44e0af3
[ "MIT" ]
null
null
null
''' Escreva um programa que pergunte o salário de um funcionário e calcule o valor do seu aumento. Para salários superiores a R$1.250,00, calcule um aumento de 10% Para os inferiores ou iguais, o aumento é de 15%. ''' salario = float(input('Digite o salário: R$ ')) if salario < 0: print('Valor inválido!') else: if salario <= 1250: print(f'O aumento será de R${salario*0.15} e passará a ser R${salario + salario*0.15}') else: print(f'O aumento será de R${salario * 0.10} e passará a ser R${salario + salario * 0.10}')
34.25
99
0.669708
96
548
3.822917
0.458333
0.108992
0.038147
0.076294
0.310627
0.310627
0.310627
0.310627
0.158038
0
0
0.062356
0.209854
548
16
99
34.25
0.785219
0.381387
0
0.25
0
0.25
0.584337
0
0
0
0
0
0
1
0
false
0.25
0
0
0
0.375
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
9a07ac994b1953108c37e98bccdd7052124320ff
1,192
py
Python
src/holocron/_processors/import_processors.py
ikalnytskyi/holocron
f0bda50f1aab7d1013fac5bd8fb01f7ebeb7bdc3
[ "BSD-3-Clause" ]
6
2016-11-27T11:53:18.000Z
2021-02-08T00:37:59.000Z
src/holocron/_processors/import_processors.py
ikalnytskyi/holocron
f0bda50f1aab7d1013fac5bd8fb01f7ebeb7bdc3
[ "BSD-3-Clause" ]
25
2017-04-12T15:27:55.000Z
2022-01-21T23:37:37.000Z
src/holocron/_processors/import_processors.py
ikalnytskyi/holocron
f0bda50f1aab7d1013fac5bd8fb01f7ebeb7bdc3
[ "BSD-3-Clause" ]
1
2020-11-15T17:49:36.000Z
2020-11-15T17:49:36.000Z
"""Import processors from 3rd party sources.""" import contextlib import sys import pkg_resources from ._misc import parameters @parameters( jsonschema={ "type": "object", "properties": { "imports": {"type": "array", "items": {"type": "string"}}, "from_": {"type": "string"}, }, } ) def process(app, items, *, imports, from_=None): distribution = pkg_resources.get_distribution("holocron") with contextlib.ExitStack() as exit: if from_: sys.path.insert(0, from_) exit.callback(sys.path.pop, 0) for import_ in imports: entry_point = pkg_resources.EntryPoint.parse(import_, distribution) app.add_processor(entry_point.name, entry_point.resolve()) # Processors are generators, so we must return iterable to be compliant # with the protocol. The only reason why a top-level 'process' function is # not a processor itself is because otherwise processors will be imported # pipeline evaluation time while we need them be imported pipeline creation # time. def passgen(app, items): yield from items return passgen(app, items)
29.073171
79
0.64849
141
1,192
5.375887
0.58156
0.047493
0.047493
0
0
0
0
0
0
0
0
0.003348
0.248322
1,192
40
80
29.8
0.842634
0.282718
0
0
0
0
0.087574
0
0
0
0
0
0
1
0.08
false
0.08
0.32
0
0.44
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
9a1e2ae93bc1197259db93644405545d0b6670ce
1,100
py
Python
src/chatty/auth/auth.py
CITIZENSHIP-CHATTY/backend
8982a0f3cff8ba2efe6a903bb4ab47f9c6044487
[ "MIT" ]
null
null
null
src/chatty/auth/auth.py
CITIZENSHIP-CHATTY/backend
8982a0f3cff8ba2efe6a903bb4ab47f9c6044487
[ "MIT" ]
4
2020-04-19T09:25:46.000Z
2020-05-07T20:20:04.000Z
src/chatty/auth/auth.py
CITIZENSHIP-CHATTY/backend
8982a0f3cff8ba2efe6a903bb4ab47f9c6044487
[ "MIT" ]
null
null
null
from chatty import utils from aiohttp import web from chatty.auth.models import User async def registration(request): auth_data = await request.json() if not await utils.validation_credentials(auth_data): return web.json_response({"message": "Invalid credentials"}, status=400) await User.create(auth_data) return web.json_response({"message": "Registration successfully"}, status=200) async def login(request): auth_data = await request.json() try: username = auth_data['username'] password = auth_data['password'] except KeyError: return web.json_response({"message": "Username or password were not provided"}, status=400) user = await User.get_by_username(username) if not user: return web.json_response({"message": "User with such name does not exists"}, status=400) if not await utils.check_password(password, user['password']): return web.json_response({'message': "Password incorrect"}) token = await utils.generate_jwt_token(user) return web.json_response({"token": token}, status=200)
32.352941
99
0.708182
142
1,100
5.359155
0.352113
0.063075
0.102497
0.165572
0.324573
0.176084
0.094612
0
0
0
0
0.016667
0.181818
1,100
33
100
33.333333
0.828889
0
0
0.086957
0
0
0.180909
0
0
0
0
0
0
1
0
false
0.173913
0.130435
0
0.391304
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
9a2ad5d8f34b4182942a86d8ef3f197c1b06c12e
1,296
py
Python
test.py
MarkMurillo/python_ctype_structure_example
9e889cc4cbdeab8433c396262f086071bb961e13
[ "MIT" ]
null
null
null
test.py
MarkMurillo/python_ctype_structure_example
9e889cc4cbdeab8433c396262f086071bb961e13
[ "MIT" ]
null
null
null
test.py
MarkMurillo/python_ctype_structure_example
9e889cc4cbdeab8433c396262f086071bb961e13
[ "MIT" ]
null
null
null
"""test.py Python3 Test script that demonstrates the passing of an initialized python structure to C and retrieving the structure back. """ import testMod from ctypes import * class TESTSTRUCT(Structure): pass TESTSTRUCT._fields_ = [ ("name", c_char_p), ("next", POINTER(TESTSTRUCT), #We can use a structure pointer for a linked list. ("next2", c_void_p) #We can use void pointers for structures as well! ] struct1 = TESTSTRUCT(c_char_p("Hello!".encode()), None, None) struct2 = TESTSTRUCT(c_char_p("Goodbye!".encode()), None, None) struct22 = TESTSTRUCT(c_char_p("My Love!".encode()), None, None) struct1.next = pointer(struct2) #Must cast lp to void p before assigning it or it will complain... struct1.next2 = cast(pointer(struct22), c_void_p) outbytes = testMod.py_returnMe(struct1) #Must cast outbytes back into pointer for a struct and retrieve contents. struct3 = cast(outbytes, POINTER(TESTSTRUCT)).contents #Next is already a pointer so all we need are just the contents. nextStruct = struct3.next.contents #Next2 is a void p so we need to cast it back to TESTSTRUCT pointer and get #the contents. next2Struct = cast(struct3.next2, POINTER(TESTSTRUCT)).contents print ("Result: {}, {}, {}".format(struct3.name, nextStrut.name, next2Struct.name)
31.609756
88
0.73534
190
1,296
4.936842
0.436842
0.021322
0.025586
0.051173
0
0
0
0
0
0
0
0.019196
0.155864
1,296
40
89
32.4
0.838208
0
0
0
0
0
0.069191
0
0
0
0
0
0
0
null
null
0.052632
0.105263
null
null
0.052632
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
9a43ea16514e92431028e9e426f7d3c0a8b72e9b
3,088
py
Python
src/octopus/core/framework/__init__.py
smaragden/OpenRenderManagement
cf3ab356f96969d7952b60417b48e941955e435c
[ "BSD-3-Clause" ]
35
2015-02-23T23:13:13.000Z
2021-01-03T05:56:39.000Z
src/octopus/core/framework/__init__.py
smaragden/OpenRenderManagement
cf3ab356f96969d7952b60417b48e941955e435c
[ "BSD-3-Clause" ]
15
2015-01-12T12:58:29.000Z
2016-03-30T13:10:19.000Z
src/octopus/core/framework/__init__.py
mikrosimage/OpenRenderManagement
6f9237a86cb8e4b206313f9c22424c8002fd5e4d
[ "BSD-3-Clause" ]
20
2015-03-18T06:57:13.000Z
2020-07-01T15:09:36.000Z
import tornado import logging import httplib try: import simplejson as json except ImportError: import json from octopus.core.framework.wsappframework import WSAppFramework, MainLoopApplication from octopus.core.framework.webservice import MappingSet from octopus.core.communication.http import Http400 from octopus.core.tools import Workload __all__ = ['WSAppFramework', 'MainLoopApplication'] __all__ += ['Controller', 'ControllerError', 'ResourceNotFoundErro', 'BaseResource'] logger = logging.getLogger('main.dispatcher.webservice') def queue(func): def queued_func(self, *args, **kwargs): return self.queueAndWait(func, self, *args, **kwargs) return queued_func class ControllerError(Exception): """ Raised by a controller to report a problem. Subclass at will. """ class ResourceNotFoundError(ControllerError): """ Raised by a controller to report access to a missing resource. """ def __init__(self, *args, **kwargs): Exception.__init__(self, *args) for name, value in kwargs.items(): setattr(self, name, value) class Controller(object): def __init__(self, framework, root): self.framework = framework self.root = root self.mappings = MappingSet() def __call__(self, request, path, *args): return self.mappings.match(request, path, *args) def getDispatchTree(self): return self.framework.application.dispatchTree def map(self, pathPattern, methodDict): self.mappings.add((pathPattern, methodDict)) class BaseResource(tornado.web.RequestHandler): def initialize(self, framework): self.framework = framework def getDispatchTree(self): return self.framework.application.dispatchTree def get_error_html(self, status_code, exception=None, **kwargs): message = httplib.responses[status_code] if exception is not None and isinstance(exception, tornado.web.HTTPError): message = exception.log_message return "%(code)d: %(message)s" % { "code": status_code, "message": message, } @property def dispatcher(self): return self.framework.application def getBodyAsJSON(self): try: if self.request.body == "" or self.request.body is None: return "" return json.loads(self.request.body) except: raise Http400("The HTTP body is not a valid JSON object") def getServerAddress(self): server_address = self.request.host.split(':') if len(server_address) == 2: return server_address[0], server_address[1] return server_address[0], "" def queueAndWait(self, func, *args): workload = Workload(lambda: func(*args)) self.framework.application.queueWorkload(workload) return workload.wait() def writeCallback(self, chunk): data = self.request.arguments if 'callback' in data: chunk = ('%s(%s);' % (data['callback'][0], chunk)) self.write(chunk)
29.409524
85
0.663536
337
3,088
5.970326
0.364985
0.05169
0.029821
0.034294
0.134195
0.093439
0.0666
0.0666
0.0666
0
0
0.004632
0.230894
3,088
104
86
29.692308
0.842526
0.040155
0
0.111111
0
0
0.072281
0.008865
0
0
0
0
0
1
0.208333
false
0
0.138889
0.069444
0.569444
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
9a467e6fc069bf386281b9a110e435f9e100a70b
139
py
Python
exercises/spotify/auth_data.py
introprogramming/exercises
8e52f3fa87d29a14ddcf00e8d87598d0721a41f6
[ "MIT" ]
2
2018-08-20T22:44:40.000Z
2018-09-14T17:03:35.000Z
exercises/spotify/auth_data.py
introprogramming/exercises
8e52f3fa87d29a14ddcf00e8d87598d0721a41f6
[ "MIT" ]
31
2015-08-06T16:25:57.000Z
2019-06-11T12:22:35.000Z
exercises/spotify/auth_data.py
introprogramming/exercises
8e52f3fa87d29a14ddcf00e8d87598d0721a41f6
[ "MIT" ]
1
2016-08-15T15:06:40.000Z
2016-08-15T15:06:40.000Z
# Login to https://developer.spotify.com/dashboard/, create an application and fill these out before use! client_id = "" client_secret = ""
46.333333
105
0.755396
20
139
5.15
0.95
0
0
0
0
0
0
0
0
0
0
0
0.129496
139
3
106
46.333333
0.85124
0.741007
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9a61c54ca6366d9eef60d2491aa686f033543efd
3,261
py
Python
GAparsimony/util/config.py
misantam/GAparsimony
0241092dc5d7741b5546151ff829167588e4f703
[ "MIT" ]
null
null
null
GAparsimony/util/config.py
misantam/GAparsimony
0241092dc5d7741b5546151ff829167588e4f703
[ "MIT" ]
1
2021-12-05T10:24:55.000Z
2021-12-05T11:01:25.000Z
GAparsimony/util/config.py
misantam/GAparsimony
0241092dc5d7741b5546151ff829167588e4f703
[ "MIT" ]
null
null
null
################################################# #****************LINEAR MODELS******************# ################################################# CLASSIF_LOGISTIC_REGRESSION = {"C":{"range": (1., 100.), "type": 1}, "tol":{"range": (0.0001,0.9999), "type": 1}} CLASSIF_PERCEPTRON = {"tol":{"range": (0.0001,0.9999), "type": 1}, "alpha":{"range": (0.0001,0.9999), "type": 1}} REG_LASSO = {"tol":{"range": (0.0001,0.9999), "type": 1}, "alpha":{"range": (1., 100.), "type": 1}} REG_RIDGE = {"tol":{"range": (0.0001,0.9999), "type": 1}, "alpha":{"range": (1., 100.), "type": 1}} ################################################ #*****************SVM MODELS*******************# ################################################ CLASSIF_SVC = {"C":{"range": (1.,100.), "type": 1}, "alpha":{"range": (0.0001,0.9999), "type": 1}} REG_SVR = {"C":{"range": (1.,100.), "type": 1}, "alpha":{"range": (0.0001,0.9999), "type": 1}} ################################################## #******************KNN MODELS********************# ################################################## CLASSIF_KNEIGHBORSCLASSIFIER = {"n_neighbors":{"range": (2,11), "type": 0}, "p":{"range": (1, 3), "type": 0}} REG_KNEIGHBORSREGRESSOR = {"n_neighbors":{"range": (2,11), "type": 0}, "p":{"range": (1, 3), "type": 0}} ################################################## #******************MLP MODELS********************# ################################################## CLASSIF_MLPCLASSIFIER = {"tol":{"range": (0.0001,0.9999), "type": 1}, "alpha":{"range": (0.0001, 0.999), "type": 1}} REG_MLPREGRESSOR = {"tol":{"range": (0.0001,0.9999), "type": 1}, "alpha":{"range": (0.0001, 0.999), "type": 1}} ################################################## #*************Random Forest MODELS***************# ################################################## CLASSIF_RANDOMFORESTCLASSIFIER = {"n_estimators":{"range": (100,250), "type": 0}, "max_depth":{"range": (4, 20), "type": 0}, "min_samples_split":{"range": (2,25), "type": 0}} REG_RANDOMFORESTREGRESSOR = {"n_estimators":{"range": (100,250), "type": 0}, "max_depth":{"range": (4, 20), "type": 0}, "min_samples_split":{"range": (2,25), "type": 0}} ################################################## #*************Decision trees MODELS**************# ################################################## CLASSIF_DECISIONTREECLASSIFIER = {"min_weight_fraction_leaf":{"range": (0,20), "type": 0}, "max_depth":{"range": (4, 20), "type": 0}, "min_samples_split":{"range": (2,25), "type": 0}} REG_DECISIONTREEREGRESSOR = {"min_weight_fraction_leaf":{"range": (0,20), "type": 0}, "max_depth":{"range": (4, 20), "type": 0}, "min_samples_split":{"range": (2,25), "type": 0}}
40.259259
90
0.340693
279
3,261
3.849462
0.200717
0.074488
0.102421
0.112663
0.6946
0.6946
0.680633
0.680633
0.659218
0.659218
0
0.085141
0.236431
3,261
81
91
40.259259
0.346185
0.113155
0
0.53125
0
0
0.240815
0.021248
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9a6446896e65dc764ddad3e136039fc438fa2758
1,710
py
Python
airbox/commands/__init__.py
lewisjared/airbox
56bfdeb3e81bac47c80fbf249d9ead31c94a2139
[ "MIT" ]
null
null
null
airbox/commands/__init__.py
lewisjared/airbox
56bfdeb3e81bac47c80fbf249d9ead31c94a2139
[ "MIT" ]
null
null
null
airbox/commands/__init__.py
lewisjared/airbox
56bfdeb3e81bac47c80fbf249d9ead31c94a2139
[ "MIT" ]
null
null
null
""" This module contains a number of other commands that can be run via the cli. All classes in this submodule which inherit the baseclass `airbox.commands.base.Command` are automatically included in the possible commands to execute via the commandline. The commands can be called using their `name` property. """ from logging import getLogger from .backup import BackupCommand from .backup_sync import BackupSyncCommand from .basic_plot import BasicPlotCommand from .create_mounts import CreateMountsCommand from .install import InstallCommand from .print_fstab import PrintFstabCommand from .run_schedule import RunScheduleCommand from .spectronus_subset import SpectronusSubsetCommand from .subset import SubsetCommand logger = getLogger(__name__) # Commands are registered below _commands = [ BackupCommand(), BackupSyncCommand(), BasicPlotCommand(), CreateMountsCommand(), InstallCommand(), PrintFstabCommand(), RunScheduleCommand(), SpectronusSubsetCommand(), SubsetCommand() ] def find_commands(): """ Finds all the Commands in this package :return: List of Classes within """ # TODO: Make this actually do that. For now commands are manually registered pass def initialise_commands(parser): """ Initialise the parser with the commandline arguments for each parser :param parser: :return: """ find_commands() for c in _commands: p = parser.add_parser(c.name, help=c.help) c.initialise_parser(p) def run_command(cmd_name): """ Attempts to run a command :param config: Configuration data """ for c in _commands: if cmd_name == c.name: return c.run()
26.307692
118
0.729825
202
1,710
6.074257
0.475248
0.00815
0.00978
0.02282
0
0
0
0
0
0
0
0
0.20117
1,710
64
119
26.71875
0.898243
0.37193
0
0.060606
0
0
0
0
0
0
0
0.015625
0
1
0.090909
false
0.030303
0.30303
0
0.424242
0.030303
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
2
7bd8ac16582450f85a23c7ef200dbfd91aa09837
2,636
py
Python
core/predictor/RF/rf_predict.py
LouisYZK/dds-avec2019
9a0ee86bddf6c23460a689bde8d75302f1d5aa45
[ "BSD-2-Clause" ]
8
2020-02-28T04:04:30.000Z
2021-12-28T07:06:06.000Z
core/predictor/RF/rf_predict.py
LouisYZK/dds-avec2019
9a0ee86bddf6c23460a689bde8d75302f1d5aa45
[ "BSD-2-Clause" ]
1
2021-04-18T09:35:13.000Z
2021-04-18T09:35:13.000Z
core/predictor/RF/rf_predict.py
LouisYZK/dds-avec2019
9a0ee86bddf6c23460a689bde8d75302f1d5aa45
[ "BSD-2-Clause" ]
2
2020-03-26T21:42:15.000Z
2021-09-09T12:50:41.000Z
"""Simple predictor using random forest """ import pandas as pd import numpy as np import math from sklearn.ensemble import RandomForestRegressor from sklearn.ensemble import RandomForestClassifier from sklearn import preprocessing from sklearn.metrics import mean_absolute_error from sklearn.metrics import f1_score from sklearn.model_selection import cross_val_score from sklearn import metrics from core.predictor.predictor import Predictor from common.sql_handler import SqlHandler from common.metric import ccc_score import config from global_values import * from common.log_handler import get_logger logger = get_logger() def pre_data(df): df[np.isnan(df)] = 0.0 df[np.isinf(df)] = 0.0 return df class RfPredictor(Predictor): def __init__(self, train, dev, features=None): """ Input: train and dev are ndarray-like data features are the freature name in tran and dev """ self.train_set = pre_data(train) self.dev_set = pre_data(dev) self.feature_list = features def train(self): self.rf = RandomForestRegressor(n_estimators=100, criterion='mse', n_jobs=-1) X = self.train_set.loc[:, 'F0_mean':].values y = self.train_set['PHQ8_Score'].values.ravel() self.rf.fit(X, y) def predict(self, X): y = self.rf.predict(X) return y def eval(self): X = self.dev_set.loc[:, 'F0_mean':].values y = self.dev_set['PHQ8_Score'].values scores = cross_val_score(self.rf, X, y, cv=10, scoring='neg_mean_absolute_error') mae = abs(scores.mean()) scores = cross_val_score(self.rf, X, y, cv=10, scoring='neg_mean_squared_error') rmse = math.sqrt(abs(scores.mean())) y_pred = self.predict(X) ccc = ccc_score(y, y_pred) fea_importance = self.rf.feature_importances_ fea_imp_dct = {fea:val for fea, val in zip(self.feature_list, fea_importance)} top = sorted(fea_imp_dct, key=lambda x: fea_imp_dct[x], reverse=True)[:5] top_fea = {fea: fea_imp_dct[fea] for fea in top} return {'MAE': mae, 'RMSE': rmse, 'CCC':ccc, 'feature_importaces': top_fea} class MultiModalRandomForest(Predictor): def __init__(self, data, features): """ data and features is a dictionary that conatines data we need. """ self.data = data self.features = features def train(self): pass def predict(self): pass def eval(self): pass
30.651163
90
0.638088
359
2,636
4.504178
0.339833
0.047619
0.022263
0.030921
0.084106
0.084106
0.084106
0.055659
0.055659
0.055659
0
0.009274
0.263657
2,636
86
91
30.651163
0.823802
0.074734
0
0.116667
0
0
0.046394
0.018979
0
0
0
0
0
1
0.15
false
0.05
0.316667
0
0.55
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
7bed1d2243d33ac3902ca09a4b56c1ae1c77465e
553
py
Python
server/players/query.py
kfields/django-arcade
24df3d43dde2d69df333529d8790507fb1f5fcf1
[ "MIT" ]
1
2021-10-03T05:44:32.000Z
2021-10-03T05:44:32.000Z
server/players/query.py
kfields/django-arcade
24df3d43dde2d69df333529d8790507fb1f5fcf1
[ "MIT" ]
null
null
null
server/players/query.py
kfields/django-arcade
24df3d43dde2d69df333529d8790507fb1f5fcf1
[ "MIT" ]
null
null
null
from loguru import logger from channels.db import database_sync_to_async from schema.base import query from .models import Player from .schemata import PlayerConnection @query.field("allPlayers") @database_sync_to_async def resolve_all_players(root, info, after='', before='', first=0, last=0): players = [p for p in Player.objects.all()] connection = PlayerConnection(players) result = connection.wire() return result @query.field("player") @database_sync_to_async def resolve_player(*_, id): return Player.objects.get(id=id)
24.043478
74
0.755877
77
553
5.25974
0.519481
0.088889
0.103704
0.140741
0.14321
0.14321
0
0
0
0
0
0.004202
0.139241
553
22
75
25.136364
0.846639
0
0
0.125
0
0
0.028933
0
0
0
0
0
0
1
0.125
false
0
0.3125
0.0625
0.5625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
7bf26d67b6d552692974b4958df2a46110802ae6
1,529
py
Python
src/python_settings/python_settings.py
tomatze/opendihu-webapp
0f08bdeb82348a1e30fa44db1ac3b9b1606f1da1
[ "MIT" ]
17
2018-11-25T19:29:34.000Z
2021-09-20T04:46:22.000Z
src/python_settings/python_settings.py
tomatze/opendihu-webapp
0f08bdeb82348a1e30fa44db1ac3b9b1606f1da1
[ "MIT" ]
1
2020-11-12T15:15:58.000Z
2020-12-29T15:29:24.000Z
src/python_settings/python_settings.py
tomatze/opendihu-webapp
0f08bdeb82348a1e30fa44db1ac3b9b1606f1da1
[ "MIT" ]
4
2018-10-17T12:18:10.000Z
2021-05-28T13:24:20.000Z
import re # import all settings-modules here, so we can only import this module to get them all from python_settings.settings_activatable import * from python_settings.settings_child_placeholder import * from python_settings.settings_choice import * from python_settings.settings_comment import * from python_settings.settings_conditional import * from python_settings.settings_container import * from python_settings.settings_dict_entry import * from python_settings.settings_empty_line import * from python_settings.settings_list_entry import * # this holds a complete settings.py by parsing its config-dict and storing the rest of the file in prefix and postfix class PythonSettings(): prefix = '' config_dict = None postfix = '' # takes a string of a settings.py and parses it def __init__(self, settings=None): if settings: # isolate content of config{} to settings and save the rest of the file settings_prefix and settings_postfix split1 = settings.split('config = {') self.prefix = split1[0][:-1] settings = split1[1] split2 = re.compile(r'(?m)^}').split(settings, 1) settings = split2[0] settings = '{' + settings + '}' self.postfix = split2[1][1:] # iterate over tokens to create SettingsDict self.config_dict = SettingsDict(settings) return None def __repr__(self): return self.prefix + '\nconfig = ' + str(self.config_dict) + self.postfix
39.205128
120
0.695226
196
1,529
5.244898
0.392857
0.155642
0.157588
0.227626
0.280156
0
0
0
0
0
0
0.011008
0.2276
1,529
38
121
40.236842
0.859441
0.258339
0
0
0
0
0.025709
0
0
0
0
0
0
1
0.074074
false
0
0.37037
0.037037
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
d01f7d7cb1aafa6f0cf4dd66656aaf36d58e3686
371
py
Python
CanTingSystem/Party.py
scottyyf/oodoop
d254b8a355c985c7672381495ab8a44d7d55e153
[ "MIT" ]
2
2021-12-14T10:46:14.000Z
2021-12-14T10:47:00.000Z
CanTingSystem/Party.py
scottyyf/oodoop
d254b8a355c985c7672381495ab8a44d7d55e153
[ "MIT" ]
9
2021-12-06T06:16:15.000Z
2021-12-20T06:39:50.000Z
CanTingSystem/Party.py
scottyyf/oodoop
d254b8a355c985c7672381495ab8a44d7d55e153
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: Party.py Author: Scott Yang(Scott) Email: [email protected] Copyright: Copyright (c) 2021, Skybility Software Co.,Ltd. All rights reserved. Description: """ class Party(object): def __init__(self, capacity): self._capacity = capacity def get_capacity(self): return self._capacity
19.526316
79
0.684636
47
371
5.255319
0.744681
0.145749
0
0
0
0
0
0
0
0
0
0.016447
0.180593
371
18
80
20.611111
0.796053
0.560647
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0
0.2
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
d02bbe745d7a87ef8769d267b8913fe863e1ddc6
545
py
Python
tests/conftest.py
disktnk/onnx-chainer
e4542568009e63e7da83aa0f11b2cb5504e8cef8
[ "MIT" ]
null
null
null
tests/conftest.py
disktnk/onnx-chainer
e4542568009e63e7da83aa0f11b2cb5504e8cef8
[ "MIT" ]
null
null
null
tests/conftest.py
disktnk/onnx-chainer
e4542568009e63e7da83aa0f11b2cb5504e8cef8
[ "MIT" ]
null
null
null
import chainer import pytest def pytest_addoption(parser): parser.addoption( '--value-check-runtime', dest='value-check-runtime', default='onnxruntime', choices=['skip', 'onnxruntime', 'mxnet'], help='select test runtime') @pytest.fixture(scope='function') def disable_experimental_warning(): org_config = chainer.disable_experimental_feature_warning chainer.disable_experimental_feature_warning = True try: yield finally: chainer.disable_experimental_feature_warning = org_config
27.25
77
0.722936
58
545
6.551724
0.534483
0.2
0.205263
0.260526
0.315789
0
0
0
0
0
0
0
0.174312
545
19
78
28.684211
0.844444
0
0
0
0
0
0.179817
0.038532
0
0
0
0
0
1
0.133333
false
0
0.133333
0
0.266667
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d0458729a238b401f69f7c90aa4a7ae3169c62fa
1,959
py
Python
clouddq/classes/dq_rule.py
charleskubicek/cloud-data-quality
0f7dee7daeaaf974203ae154fc7ba729c05cee5d
[ "Apache-2.0" ]
1
2021-11-07T15:03:33.000Z
2021-11-07T15:03:33.000Z
clouddq/classes/dq_rule.py
ant-laz/cloud-data-quality
2f41ec692e7a0ec8988bb8e715fcf5e926fa47be
[ "Apache-2.0" ]
null
null
null
clouddq/classes/dq_rule.py
ant-laz/cloud-data-quality
2f41ec692e7a0ec8988bb8e715fcf5e926fa47be
[ "Apache-2.0" ]
null
null
null
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """todo: add classes docstring.""" from __future__ import annotations from dataclasses import dataclass from clouddq.classes.rule_type import RuleType @dataclass class DqRule: """ """ rule_id: str rule_type: RuleType params: dict | None = None def resolve_sql_expr(self: DqRule) -> str: return self.rule_type.to_sql(self.params).safe_substitute() @classmethod def from_dict(cls: DqRule, rule_id: str, kwargs: dict) -> DqRule: """ Args: cls: DqRule: rule_id: str: kwargs: typing.Dict: Returns: """ rule_type: RuleType = RuleType(kwargs.get("rule_type", "")) params: dict = kwargs.get("params", dict()) return DqRule(rule_id=str(rule_id), rule_type=rule_type, params=params) def to_dict(self: DqRule) -> dict: """ Args: self: DqRule: Returns: """ return dict( { f"{self.rule_id}": { "rule_type": self.rule_type.name, "params": self.params, "rule_sql_expr": self.resolve_sql_expr(), } } ) def dict_values(self: DqRule) -> dict: """ Args: self: DqRule: Returns: """ return dict(self.to_dict().get(self.rule_id))
23.890244
79
0.597754
239
1,959
4.76569
0.426778
0.063213
0.042142
0.052678
0.154522
0.121159
0.079017
0.079017
0.079017
0
0
0.005827
0.299132
1,959
81
80
24.185185
0.823744
0.363451
0
0
0
0
0.052632
0
0
0
0
0.012346
0
1
0.148148
false
0
0.111111
0.037037
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
1
0
0
2
d0461663494469b9d6df96b164f06712f149aa53
749
py
Python
py/minsk/analysis/syntax/expressions/parenthesized.py
Phytolizer/Minsk
5fb59f0d5d8cf1f0046471b91e2f5d0c41fc874c
[ "MIT" ]
null
null
null
py/minsk/analysis/syntax/expressions/parenthesized.py
Phytolizer/Minsk
5fb59f0d5d8cf1f0046471b91e2f5d0c41fc874c
[ "MIT" ]
1
2022-03-23T03:34:48.000Z
2022-03-24T06:47:30.000Z
py/minsk/analysis/syntax/expressions/parenthesized.py
Phytolizer/Minsk
5fb59f0d5d8cf1f0046471b91e2f5d0c41fc874c
[ "MIT" ]
null
null
null
from dataclasses import dataclass from typing import Iterable from minsk.analysis.syntax.expression import ExpressionSyntax from minsk.analysis.syntax.kind import SyntaxKind from minsk.analysis.syntax.node import SyntaxNode from minsk.analysis.syntax.token import SyntaxToken @dataclass(frozen=True) class ParenthesizedExpressionSyntax(ExpressionSyntax): open_parenthesis_token: SyntaxToken expression: ExpressionSyntax close_parenthesis_token: SyntaxToken @property def kind(self) -> SyntaxKind: return SyntaxKind.ParenthesizedExpression @property def children(self) -> Iterable[SyntaxNode]: yield self.open_parenthesis_token yield self.expression yield self.close_parenthesis_token
29.96
61
0.791722
79
749
7.405063
0.392405
0.061538
0.116239
0.157265
0
0
0
0
0
0
0
0
0.154873
749
24
62
31.208333
0.924171
0
0
0.105263
0
0
0
0
0
0
0
0
0
1
0.105263
false
0
0.315789
0.052632
0.684211
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
d04f4962f6074bb45c68186f6ea8419d8e3eca30
649
py
Python
stocklab/core/crawler.py
hchsiao/stocklab
9c8f786249d5fd5eb954829f63549f0635a428ff
[ "MIT" ]
1
2020-03-26T14:49:31.000Z
2020-03-26T14:49:31.000Z
stocklab/core/crawler.py
syoukore/stocklab
9c8f786249d5fd5eb954829f63549f0635a428ff
[ "MIT" ]
null
null
null
stocklab/core/crawler.py
syoukore/stocklab
9c8f786249d5fd5eb954829f63549f0635a428ff
[ "MIT" ]
1
2020-06-16T16:56:23.000Z
2020-06-16T16:56:23.000Z
from . import StocklabObject class Crawler(StocklabObject): """The base class for stocklab Crawlers.""" def __init__(self): super().__init__() class CrawlerTrigger(Exception): """ A `Node` will raise this exception when the required data is not locally available (e.g. not in the database). This object will also carry the parameters for the corresponding crawler function (`Crawler.crawler_entry`). """ def __init__(self, **kwargs): super().__init__() self.kwargs = kwargs def __str__(self): # TODO: Expose more information? return f'CrawlerTrigger {self.kwargs}'
29.5
76
0.665639
76
649
5.407895
0.618421
0.058394
0.053528
0
0
0
0
0
0
0
0
0
0.234206
649
21
77
30.904762
0.826962
0.446841
0
0.2
0
0
0.08589
0
0
0
0
0.047619
0
1
0.3
false
0
0.1
0.1
0.7
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
0
0
0
0
2
d064ab0067234e99ee2f70ae98cf7d5fece967e6
304
py
Python
spellcheck.py
laiquzzama/laiquzzama
42393808ecb0342392ab055d9d94220de8a15796
[ "Apache-2.0" ]
3
2021-03-06T01:42:51.000Z
2021-04-13T12:02:47.000Z
spellcheck.py
laiquzzama/laiquzzama
42393808ecb0342392ab055d9d94220de8a15796
[ "Apache-2.0" ]
null
null
null
spellcheck.py
laiquzzama/laiquzzama
42393808ecb0342392ab055d9d94220de8a15796
[ "Apache-2.0" ]
null
null
null
from textblob import TextBlob a = str(input("enter your word to check spell") _b = TextBlob(a) print (_b.correct()) # from textblob import Textblob #mylst = ["firt","clor"] #correct_list = [] #for word in mylst: # correct_list.append(TextBlob()) # #for word in correct_list: # print (word.correct())
19
47
0.700658
44
304
4.727273
0.5
0.158654
0.173077
0.25
0
0
0
0
0
0
0
0
0.151316
304
15
48
20.266667
0.806202
0
0
0
0
0
0.23622
0
0
0
0
0
0
0
null
null
0
0.25
null
null
0.25
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
d085434851368c058d877fff6243d0f3f90e2c23
462
py
Python
config.py
LandRegistry/historian-alpha
3f2c2060d0f747772e8362dbe4867aea24731180
[ "MIT" ]
null
null
null
config.py
LandRegistry/historian-alpha
3f2c2060d0f747772e8362dbe4867aea24731180
[ "MIT" ]
null
null
null
config.py
LandRegistry/historian-alpha
3f2c2060d0f747772e8362dbe4867aea24731180
[ "MIT" ]
1
2021-04-11T06:07:16.000Z
2021-04-11T06:07:16.000Z
import os class Config(object): DEBUG = False STORAGE = os.environ['STORAGE'] SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] # these are on heroku only so get safely BASIC_AUTH_USERNAME = os.environ.get('BASIC_AUTH_USERNAME') BASIC_AUTH_PASSWORD = os.environ.get('BASIC_AUTH_PASSWORD') class DevelopmentConfig(Config): DEBUG = True class TestConfig(DevelopmentConfig): TESTING = True STORAGE = os.environ['STORAGE']
25.666667
63
0.727273
58
462
5.603448
0.5
0.138462
0.098462
0.141538
0.129231
0
0
0
0
0
0
0
0.175325
462
17
64
27.176471
0.853018
0.082251
0
0.166667
0
0
0.151659
0
0
0
0
0
0
1
0
false
0.083333
0.083333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
d08cfb1d89201e35321b4d716317704e5a60a247
552
py
Python
tests/test_dbapi_sqlite.py
cyanodbc/cyanodbc
6ed49ded15a545edf4b78886868daebc8c5d4874
[ "MIT" ]
2
2020-07-10T17:36:00.000Z
2020-08-12T14:57:48.000Z
tests/test_dbapi_sqlite.py
detule/cyanodbc
e7713c3cc3333a018409ec50ee1e5836a8d85f06
[ "MIT" ]
15
2018-09-09T12:05:15.000Z
2020-07-07T12:06:16.000Z
tests/test_dbapi_sqlite.py
detule/cyanodbc
e7713c3cc3333a018409ec50ee1e5836a8d85f06
[ "MIT" ]
1
2020-07-02T10:58:07.000Z
2020-07-02T10:58:07.000Z
import cyanodbc import dbapi20 from distro import linux_distribution import pytest class CyanodbcDBApiTest(dbapi20.DatabaseAPI20Test): driver = cyanodbc connect_args = ("Driver={SQLite3 ODBC Driver};Database=" "example.db;Timeout=1000;", ) "" def test_setoutputsize(self): pass def test_nextset(self): pass # for sqlite no nextset() @pytest.mark.skipif(linux_distribution()[2]=="xenial", reason = "Strange behavior seen in Xenial") def test_rowcount(self): super().test_rowcount()
26.285714
60
0.684783
62
552
5.983871
0.66129
0.056604
0
0
0
0
0
0
0
0
0
0.027523
0.210145
552
20
61
27.6
0.823395
0.041667
0
0.117647
0
0
0.187856
0.045541
0
0
0
0
0
1
0.176471
false
0.117647
0.235294
0
0.588235
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
d0a233e2c4be9f3270a7527a6c44f88fc90c7f07
179
py
Python
python/ql/src/Security/CWE-022/examples/tarslip_bad.py
vadi2/codeql
a806a4f08696d241ab295a286999251b56a6860c
[ "MIT" ]
4,036
2020-04-29T00:09:57.000Z
2022-03-31T14:16:38.000Z
python/ql/src/Security/CWE-022/examples/tarslip_bad.py
vadi2/codeql
a806a4f08696d241ab295a286999251b56a6860c
[ "MIT" ]
2,970
2020-04-28T17:24:18.000Z
2022-03-31T22:40:46.000Z
python/ql/src/Security/CWE-022/examples/tarslip_bad.py
ScriptBox99/github-codeql
2ecf0d3264db8fb4904b2056964da469372a235c
[ "MIT" ]
794
2020-04-29T00:28:25.000Z
2022-03-30T08:21:46.000Z
import tarfile with tarfile.open('archive.zip') as tar: #BAD : This could write any file on the filesystem. for entry in tar: tar.extract(entry, "/tmp/unpack/")
22.375
55
0.664804
27
179
4.407407
0.851852
0
0
0
0
0
0
0
0
0
0
0
0.223464
179
7
56
25.571429
0.856115
0.27933
0
0
0
0
0.181102
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d0a27cee092dbbcf3e9f8c3f67fcac4a8d78a9b8
2,206
py
Python
thermidor/classes/clusterer_socket.py
rcorrero/thermidor
01381da6dcef6d256c4438f90b46197ea89c4e7d
[ "BSD-3-Clause" ]
null
null
null
thermidor/classes/clusterer_socket.py
rcorrero/thermidor
01381da6dcef6d256c4438f90b46197ea89c4e7d
[ "BSD-3-Clause" ]
null
null
null
thermidor/classes/clusterer_socket.py
rcorrero/thermidor
01381da6dcef6d256c4438f90b46197ea89c4e7d
[ "BSD-3-Clause" ]
null
null
null
# Author: Richard Correro from sklearn.base import ClusterMixin from .transformer_socket import TransformerSocket class ClustererSocket(TransformerSocket, ClusterMixin): '''Class which allows for treating clusterers as model parameters. Parameters ---------- estimator : Sci-kit learn estimator object If estimator is None or 'passthrough' then transform returns X. ''' def predict(self, X, sample_weight=None): '''Predict the closest cluster each sample in X belongs to. Parameters ---------- X : ndarray, shape (n_samples, n_features) Input data. sample_weight : array-like, shape (n_samples,), optional The weights for each observation in X. If None, all observations are assigned equal weight (default: None) Returns ------- labels : ndarray, shape (n_samples,) cluster labels ''' return self.estimator.predict(X, sample_weight) def fit_predict(self, X, y=None): '''Performs clustering on X and returns cluster labels. Parameters ---------- X : ndarray, shape (n_samples, n_features) Input data. y : Ignored not used, present for API consistency by convention. Returns ------- labels : ndarray, shape (n_samples,) cluster labels ''' return self.estimator.fit_predict(X, y) def score(self, X, y=None, sample_weight=None): '''Returns estimator's score method, if applicable. Parameters ---------- X : {array-like, sparse matrix}, shape = [n_samples, n_features] New data. y : Ignored not used, present here for API consistency by convention. sample_weight : array-like, shape (n_samples,), optional The weights for each observation in X. If None, all observations are assigned equal weight (default: None) Returns ------- score : float Opposite of the value of X on the K-means objective. ''' return self.estimator.score(X, y, sample_weight)
30.219178
76
0.593835
247
2,206
5.226721
0.388664
0.032533
0.070488
0.061967
0.477924
0.415957
0.378776
0.378776
0.378776
0.378776
0
0
0.312783
2,206
72
77
30.638889
0.851583
0.619674
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.222222
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
d0ac701e358934362e43d3495ffc036dc298f1b4
184
py
Python
Curso_de_Python_ Curso_em_Video/PythonTeste/condicoesEx001.py
DanilooSilva/Cursos_de_Python
8f167a4c6e16f01601e23b6f107578aa1454472d
[ "MIT" ]
null
null
null
Curso_de_Python_ Curso_em_Video/PythonTeste/condicoesEx001.py
DanilooSilva/Cursos_de_Python
8f167a4c6e16f01601e23b6f107578aa1454472d
[ "MIT" ]
null
null
null
Curso_de_Python_ Curso_em_Video/PythonTeste/condicoesEx001.py
DanilooSilva/Cursos_de_Python
8f167a4c6e16f01601e23b6f107578aa1454472d
[ "MIT" ]
null
null
null
import random numeroPc = random.randint(1, 5) numeroUsuario = int(input('Digite um número: ')) print('Parabéns vc acertou!' if numeroPc == numeroUsuario else 'O Computador venceu')
23
85
0.73913
24
184
5.666667
0.875
0
0
0
0
0
0
0
0
0
0
0.012658
0.141304
184
7
86
26.285714
0.848101
0
0
0
0
0
0.309783
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d0ae7da86f116336cc253188f9639ca495e26131
5,739
py
Python
src/get_device_id.py
icemanzz/SPS_NM_Scripts
f7b9e05e441d35715ee98bf1e2a73765a3a8d7c9
[ "Apache-2.0" ]
null
null
null
src/get_device_id.py
icemanzz/SPS_NM_Scripts
f7b9e05e441d35715ee98bf1e2a73765a3a8d7c9
[ "Apache-2.0" ]
null
null
null
src/get_device_id.py
icemanzz/SPS_NM_Scripts
f7b9e05e441d35715ee98bf1e2a73765a3a8d7c9
[ "Apache-2.0" ]
null
null
null
import pyipmi import pyipmi.interfaces import os import re import datetime import os.path import time import math import numpy import mmap import array import getopt import sys #Inmport path sys.path.append('../src') from aardvark_initial import * #Inmport path sys.path.append('../') from os_parameters_define import * from utility_function import * from nm_ipmi_raw_to_str import * from error_messages_define import * from nm_functions import * from config import * def aardvark_ipmi_init(target_addr, channel): ## Test pyIPMI opts, args = getopt.getopt(sys.argv[1:], 't:hvVI:H:U:P:o:b:') interface_name = 'aardvark' name = 'pullups' value = 'off' aardvark_pullups = False aardvark_serial = None aardvark_target_power = False target_address = target_addr target_routing = [(target_addr ,channel)] ### interface = pyipmi.interfaces.create_interface(interface_name, serial_number=aardvark_serial) ipmi = pyipmi.create_connection(interface) ipmi.target = pyipmi.Target(target_address) #ipmi.target.set_routing(target_routing) return ipmi def get_device_id_py(ipmi): netfn, get_did_raw = get_did_raw_to_str_py() # Send Get DID to ME rsp = send_ipmb_aardvark(ipmi , netfn , get_did_raw ) # Check if rsp data correct sts = ipmi_resp_analyst_py( ord(rsp[0]), App ) if(sts != SUCCESSFUL ): return ERROR # Analyst get did resp data format # Get Major Version = resp byte4 bits[6:0] DEBUG('Get Major Version:') marjor_version = get_bits_data_py( ord(rsp[3]) , 0 , 7) DEBUG('get_me_device_id : Marjor_version = %d' %marjor_version) # Get Device Available bit : byte4 bit[7] = 1 = device in boot loader mode. = 0 = normal operation mode. available_bit = get_bits_data_py( ord(rsp[3]) , 7 , 1) DEBUG('get_me_device_id : Available Bit = %d' % available_bit) # Get Minor version (byte5 bit[7:4]) and Milestone version (byte5 bits[3:0])number milestone_version = get_bits_data_py( ord(rsp[4]) , 0 , 4) DEBUG('get_me_device_id : milestone_version = %d' %milestone_version) minor_version = get_bits_data_py( ord(rsp[4]) , 4 , 4) DEBUG('get_me_device_id : minor_version = %d' %minor_version) # Get Build version number byte14=A.B and byte15 bit[7:4] =C, build version = 100A+10B+C build_version_AB = get_bits_data_py( ord(rsp[13]) , 0 , 8) DEBUG('get_me_device_id : build_version_AB = %d' %build_version_AB) build_version_C = get_bits_data_py( ord(rsp[14]) , 4 , 4) DEBUG('get_me_device_id : build_version_C Bit = %d' %build_version_C) sps_version = format(marjor_version, '02x') + '.' + format(minor_version, '02x') + '.' + format(milestone_version, '02x') + '.' + format(build_version_AB,'02x')+format(build_version_C, 'x') DEBUG('Current SPS FW version = ' + sps_version ) # Get byte11 bit[7:0] platform SKU platform = get_bits_data_py( ord(rsp[10]) , 0 , 8) DEBUG('get_me_device_id : platform = %d' %platform) # Get byte13 bit[3:0] DCMI version, bytes13 bit[7:4] = NM version nm = get_bits_data_py( ord(rsp[12]) , 0 , 4) DEBUG('get_me_device_id : nm = %d' %nm) dcmi = get_bits_data_py( ord(rsp[12]) , 4 , 4) DEBUG('get_me_device_id : dcmi = %d' %dcmi) # Get byte16 bit[1:0] image flag image = get_bits_data_py( ord(rsp[15]) , 0 , 2) DEBUG('get_me_device_id : image_sts = %d' %image) sts = PASS return sts, sps_version, platform , dcmi , nm , image def usage(): # Description of how to use this script print' Useage $ sudo python get_device_id.py [delay_time (sec)] [loop_number]' print' ex: sudo python get_device_id.py 1 100' return ## Define Delay Time check function def delay_check(parameter): delay_time = int(parameter , 10) if(delay_time > 0 ): sts = PASS else: delay_time = ERROR sts = ERROR return sts, delay_time ## Define Delay Time check function def loop_check(parameter): if(parameter == 'loop'): loop_number = 'loop' sts = PASS else: loop_number = int(parameter , 10) if(loop_number > 0 ): sts = PASS else: loop_number = ERROR sts = ERROR return sts, loop_number ## Define Input parameters lenth check def parameter_check(parameter): if(len(parameter) != 3 ): usage() sts =ERROR return ERROR else: return PASS ## _Main_ ## # Initial aardvark #ipmi = aardvark_ipmi_init(target_me_addr, target_me_bridge_channel) # Check delay time parameter sts = parameter_check(sys.argv) if(sts == PASS): print 'Check Delay Time parameter setting' sts, delay_time = delay_check(str(sys.argv[1])) print ( "delay time = %d " %(delay_time) ) sts, loop_number = loop_check(str(sys.argv[2])) print ("loop_number = " , loop_number) else: sts = ERROR if(sts == PASS): print 'Start to Send Get Device ID..' while loop_number : sts, sps_version, platform, dcmi, nm, image = get_device_id_py(ipmi) # Add delay time 5 secs to make sure me go back to stable mode time.sleep(delay_time) # Show Result print('SPS Version = '+ sps_version) print('platform = %d' %platform ) print('dcmi =%d' %dcmi) print('nm = %d' %nm) print('image = %d' %(image)) if( loop_number == 'loop' ): loop_number = True else: loop_number = loop_number -1 if(sts == ERROR ): loop_number = False break else: print' Done! '
31.021622
194
0.638439
817
5,739
4.253366
0.222766
0.034532
0.025324
0.03741
0.232806
0.159712
0.106763
0.01554
0
0
0
0.023538
0.252309
5,739
184
195
31.190217
0.786297
0.161178
0
0.150794
0
0
0.153379
0
0
0
0
0
0
0
null
null
0.055556
0.15873
null
null
0.095238
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
d0b20375cd75fe0eef53b990d01615a34d6461be
442
py
Python
create.py
chen-robert/hackcmu21
0728af0aa4f61b1969d0b73f7e8688fee90c1cb9
[ "MIT" ]
null
null
null
create.py
chen-robert/hackcmu21
0728af0aa4f61b1969d0b73f7e8688fee90c1cb9
[ "MIT" ]
null
null
null
create.py
chen-robert/hackcmu21
0728af0aa4f61b1969d0b73f7e8688fee90c1cb9
[ "MIT" ]
null
null
null
import sqlite3 import datetime conn = sqlite3.connect('database.db') print("Opened database successfully") # NOTE: ID is DEPRECATED conn.execute('CREATE TABLE simulated (id TEXT, lat NUMERIC, lon NUMERIC, alt NUMERIC, time TIMESTAMP DEFAULT CURRENT_TIMESTAMP)') conn.execute('CREATE TABLE locations (id TEXT, lat NUMERIC, lon NUMERIC, alt NUMERIC, time TIMESTAMP DEFAULT CURRENT_TIMESTAMP)') print("Table created successfully") conn.close()
40.181818
129
0.791855
59
442
5.898305
0.508475
0.063218
0.097701
0.126437
0.413793
0.413793
0.413793
0.413793
0.413793
0.413793
0
0.005102
0.113122
442
11
130
40.181818
0.882653
0.049774
0
0
0
0.25
0.694511
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.25
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d0bf49499bee89967eb7d175fcbf84d7e2af6904
1,140
py
Python
covid_19/users_app/models.py
MikePolyakov/djanjo_project
4d80cac9142bacdaa91b5f7be0c7377a365c3db9
[ "MIT" ]
null
null
null
covid_19/users_app/models.py
MikePolyakov/djanjo_project
4d80cac9142bacdaa91b5f7be0c7377a365c3db9
[ "MIT" ]
6
2021-06-04T23:11:44.000Z
2022-03-12T00:29:55.000Z
covid_19/users_app/models.py
id2k1149/django_project
4d80cac9142bacdaa91b5f7be0c7377a365c3db9
[ "MIT" ]
null
null
null
from django.db import models from django.contrib.auth.models import AbstractUser from django.db.models.signals import post_save from django.dispatch import receiver # Create your models here. from django.dispatch import receiver class AppUser(AbstractUser): email = models.EmailField(unique=True) is_author = models.BooleanField(default=False) # Переопределение метода save def save(self, *args, **kwargs): super().save(*args, **kwargs) # Создаем профиль # Если провиль не создан if not Profile.objects.filter(user=self).exists(): Profile.objects.create(user=self) class Profile(models.Model): # При создании пользователя создать Profile info = models.TextField(blank=True) user = models.OneToOneField(AppUser, on_delete=models.CASCADE) # сигналы при сохранении пользователя (опасно использовать, трудно отслеживать) # @receiver(post_save, sender=AppUser) # def create_profile(sender, instance, **kwargs): # print('Сработал обработчик сигнала') # if not Profile.objects.filter(user=instance).exists(): # Profile.objects.create(user=instance)
30.810811
79
0.728947
137
1,140
6.029197
0.518248
0.060533
0.029056
0.058111
0.220339
0.070218
0
0
0
0
0
0
0.171053
1,140
36
80
31.666667
0.874074
0.387719
0
0.133333
0
0
0
0
0
0
0
0
0
1
0.066667
false
0
0.333333
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
d0ce5b7ab68cf3a392399184b703c3027b6d7ef3
180
py
Python
config.py
x5g/AutoWritePoems
634d30587bb8e5cf15d8287d259ac22fe0798762
[ "MIT" ]
null
null
null
config.py
x5g/AutoWritePoems
634d30587bb8e5cf15d8287d259ac22fe0798762
[ "MIT" ]
null
null
null
config.py
x5g/AutoWritePoems
634d30587bb8e5cf15d8287d259ac22fe0798762
[ "MIT" ]
null
null
null
class Config(object): poetry_file = 'poetry4min.txt' weight_file = 'poetry_model_4_1.h5' # 根据前六个字预测第七个字 max_len = 4 batch_size = 128 learning_rate = 0.0005
22.5
39
0.672222
25
180
4.52
0.88
0
0
0
0
0
0
0
0
0
0
0.094891
0.238889
180
7
40
25.714286
0.729927
0.066667
0
0
0
0
0.198795
0
0
0
0
0
0
1
0
false
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d0df17b69424625513414f688731105176ee7001
319
py
Python
demo/flask_app/flask_api/model.py
joshyjoseph/react-docker-swagger-demo
7ba7dce6ff1457fd6bfa2af0873f60c07f918ade
[ "MIT" ]
null
null
null
demo/flask_app/flask_api/model.py
joshyjoseph/react-docker-swagger-demo
7ba7dce6ff1457fd6bfa2af0873f60c07f918ade
[ "MIT" ]
null
null
null
demo/flask_app/flask_api/model.py
joshyjoseph/react-docker-swagger-demo
7ba7dce6ff1457fd6bfa2af0873f60c07f918ade
[ "MIT" ]
null
null
null
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class TeamModel(db.Model): rowId = db.Column(db.Integer, primary_key=True) teamName = db.Column(db.String) teamRole = db.Column(db.String) def __repr__(self) -> str: return "{}:{}:{}".format(self.rowId, self.teamName, self.teamRole)
24.538462
74
0.680251
41
319
5.146341
0.560976
0.113744
0.14218
0.151659
0
0
0
0
0
0
0
0
0.172414
319
12
75
26.583333
0.799242
0
0
0
0
0
0.025078
0
0
0
0
0
0
1
0.125
false
0
0.125
0.125
0.875
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
d0e40ed7df88adf45e5432f3af67cf4214a7c00a
331
py
Python
examples/system-prompt.py
davidbrochart/python-prompt-toolkit
8498692b31671fee7c5a426300a9df2ee290eae2
[ "BSD-3-Clause" ]
2
2020-04-12T01:23:25.000Z
2021-05-22T13:46:00.000Z
examples/system-prompt.py
davidbrochart/python-prompt-toolkit
8498692b31671fee7c5a426300a9df2ee290eae2
[ "BSD-3-Clause" ]
null
null
null
examples/system-prompt.py
davidbrochart/python-prompt-toolkit
8498692b31671fee7c5a426300a9df2ee290eae2
[ "BSD-3-Clause" ]
2
2016-12-30T23:57:44.000Z
2021-05-22T13:50:21.000Z
#!/usr/bin/env python from __future__ import unicode_literals from prompt_toolkit import prompt if __name__ == '__main__': print('If you press meta-! or esc-! at the following prompt, you can enter system commands.') answer = prompt('Give me some input: ', enable_system_bindings=True) print('You said: %s' % answer)
33.1
97
0.725076
48
331
4.666667
0.770833
0
0
0
0
0
0
0
0
0
0
0
0.169184
331
9
98
36.777778
0.814545
0.060423
0
0
0
0
0.4
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
d0efa324455bfc009730dba34af132a2fd676468
260
py
Python
app/hunter/urls.py
edynox/iis
594200506b641cbac249dc6e95d229bea1edeb28
[ "MIT" ]
null
null
null
app/hunter/urls.py
edynox/iis
594200506b641cbac249dc6e95d229bea1edeb28
[ "MIT" ]
null
null
null
app/hunter/urls.py
edynox/iis
594200506b641cbac249dc6e95d229bea1edeb28
[ "MIT" ]
null
null
null
from django.conf.urls import url from .views import profile, hunterList, changePass urlpatterns = [ url(r'^$', profile, name='hunter_profile'), url(r'^password', changePass, name='hunter_password'), url(r'^list', hunterList, name='hunter_list') ]
28.888889
58
0.703846
33
260
5.454545
0.484848
0.066667
0
0
0
0
0
0
0
0
0
0
0.138462
260
8
59
32.5
0.803571
0
0
0
0
0
0.215385
0
0
0
0
0
0
1
0
false
0.285714
0.285714
0
0.285714
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
d0f08bf1893b85dd5be23260d025c66fdf373d25
938
py
Python
test_ukz/test_ukzlang/test_uk_pipes.py
clauderichard/Ultrakazoid
619f1afd1fd55afb06e7d27b2bc30eee9929f660
[ "MIT" ]
null
null
null
test_ukz/test_ukzlang/test_uk_pipes.py
clauderichard/Ultrakazoid
619f1afd1fd55afb06e7d27b2bc30eee9929f660
[ "MIT" ]
null
null
null
test_ukz/test_ukzlang/test_uk_pipes.py
clauderichard/Ultrakazoid
619f1afd1fd55afb06e7d27b2bc30eee9929f660
[ "MIT" ]
null
null
null
from .test_uk_base import TestUkBase class TestUkPipes(TestUkBase): ################ # Tests def test_pipe_seq_start(self): self.equkz("|c","c") self.equkz("c|","c<¬") self.equkz("[ce|]","[ce]<¬") def test_pipe_seq_end(self): self.equkz("[c||d]e","c(de)") self.equkz("[c*2_3||d]e","c*2_3(de)") def test_pipe_par_start(self): self.equkz("(ce|)","(ce)<¬") self.equkz("(ce*2|)","[e_2c]<¬") def test_pipe_par_end(self): self.equkz("(c*2||de*3)f","(c_2de_3).f") def test_pipe_reverseorder(self): self.failukz("[c||d|e]") self.failukz("(c||d|e)") def test_pipe_par_duplicate_start(self): self.failukz("(c|d|e)") def test_pipe_seq_duplicate_start(self): self.failukz("[c|d|e]") def test_pipe_par_duplicate_end(self): self.failukz("(c||d||e)") def test_pipe_seq_duplicate_end(self): self.failukz("[c||d||e]") ################################
24.051282
44
0.574627
152
938
3.328947
0.203947
0.124506
0.195652
0.15415
0.541502
0.418972
0.383399
0.383399
0.335968
0.335968
0
0.012626
0.15565
938
38
45
24.684211
0.621212
0.00533
0
0
0
0
0.16761
0
0
0
0
0
0
1
0.36
false
0
0.04
0
0.44
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
d0f7159e2aa65ab951c742e07f51245c54e91b4b
293
py
Python
rest_framework_siren/renderers.py
clarkperkins/django-rest-framework-siren
a0bc3d9990d88cfda7204fd0cf78ef08c38084b5
[ "Apache-2.0" ]
2
2017-01-29T03:08:12.000Z
2019-03-28T20:12:01.000Z
rest_framework_siren/renderers.py
clarkperkins/django-rest-framework-siren
a0bc3d9990d88cfda7204fd0cf78ef08c38084b5
[ "Apache-2.0" ]
null
null
null
rest_framework_siren/renderers.py
clarkperkins/django-rest-framework-siren
a0bc3d9990d88cfda7204fd0cf78ef08c38084b5
[ "Apache-2.0" ]
null
null
null
""" Provides Siren rendering support. """ from __future__ import unicode_literals from rest_framework.renderers import JSONRenderer class SirenRenderer(JSONRenderer): """ Renderer which serializes to YAML. """ media_type = 'application/vnd.siren+json' format = 'siren'
18.3125
49
0.726962
31
293
6.645161
0.83871
0
0
0
0
0
0
0
0
0
0
0
0.180887
293
15
50
19.533333
0.858333
0.232082
0
0
0
0
0.153465
0.128713
0
0
0
0
0
1
0
false
0
0.4
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
190468c6a6a1d847c7290e48226df8d86d0b3049
330
py
Python
src/area51/nowd/decorator.py
thatcr/knowed
025b66e4b660ed4339d3156ebca19065bb65b630
[ "MIT" ]
null
null
null
src/area51/nowd/decorator.py
thatcr/knowed
025b66e4b660ed4339d3156ebca19065bb65b630
[ "MIT" ]
null
null
null
src/area51/nowd/decorator.py
thatcr/knowed
025b66e4b660ed4339d3156ebca19065bb65b630
[ "MIT" ]
null
null
null
import inspect from .descriptors import Descriptor from .arguments import ArgsDescriptor def node(fget, *args, **kwargs): signature = inspect.signature(fget) base = ArgsDescriptor if len(signature.parameters) > 1 else Descriptor cls = type(fget.__code__.co_name, (base, ), {}) return cls(fget, *args, **kwargs)
27.5
74
0.718182
40
330
5.8
0.625
0.068966
0.12069
0
0
0
0
0
0
0
0
0.003636
0.166667
330
12
75
27.5
0.84
0
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0.375
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
190623703fe56b71a26a9d008afda8919d9e105d
253
py
Python
output/models/nist_data/list_pkg/nmtoken/schema_instance/nistschema_sv_iv_list_nmtoken_max_length_2_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
1
2021-08-14T17:59:21.000Z
2021-08-14T17:59:21.000Z
output/models/nist_data/list_pkg/nmtoken/schema_instance/nistschema_sv_iv_list_nmtoken_max_length_2_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
4
2020-02-12T21:30:44.000Z
2020-04-15T20:06:46.000Z
output/models/nist_data/list_pkg/nmtoken/schema_instance/nistschema_sv_iv_list_nmtoken_max_length_2_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
null
null
null
from output.models.nist_data.list_pkg.nmtoken.schema_instance.nistschema_sv_iv_list_nmtoken_max_length_2_xsd.nistschema_sv_iv_list_nmtoken_max_length_2 import NistschemaSvIvListNmtokenMaxLength2 __all__ = [ "NistschemaSvIvListNmtokenMaxLength2", ]
42.166667
194
0.893281
31
253
6.580645
0.645161
0.117647
0.137255
0.176471
0.343137
0.343137
0.343137
0.343137
0
0
0
0.016736
0.055336
253
5
195
50.6
0.83682
0
0
0
0
0
0.13834
0.13834
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ef6c9cef1dd0ae3c36a242179a531b49d4c57a72
486
py
Python
pyvisio/__init__.py
i-wan/pyvisio
6beed5a18644793e5c6769c5a4fa5f64f9dc436b
[ "MIT" ]
1
2018-06-05T13:15:35.000Z
2018-06-05T13:15:35.000Z
pyvisio/__init__.py
i-wan/pyvisio
6beed5a18644793e5c6769c5a4fa5f64f9dc436b
[ "MIT" ]
1
2017-06-05T18:17:16.000Z
2017-06-05T18:17:16.000Z
pyvisio/__init__.py
i-wan/pyvisio
6beed5a18644793e5c6769c5a4fa5f64f9dc436b
[ "MIT" ]
1
2019-06-30T17:36:35.000Z
2019-06-30T17:36:35.000Z
# -*- coding: utf-8 -*- """ PyVisio visDocuments - Visio Document manipulation library See docstring for class VisDocument for usage """ #TODO docstring __author__ = 'Ivo Velcovsky' __email__ = '[email protected]' __copyright__ = "Copyright (c) 2015" __license__ = "MIT" __status__ = "Development" from .visCOM import * from .documents import * from .stencils import * from .shapes import * if __name__ == "__main__": import doctest doctest.testmod()
21.130435
59
0.691358
52
486
5.923077
0.75
0.097403
0
0
0
0
0
0
0
0
0
0.012887
0.201646
486
22
60
22.090909
0.780928
0.292181
0
0
0
0
0.226837
0
0
0
0
0.045455
0
1
0
false
0
0.416667
0
0.416667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
2
ef81335057d05cc62a7c03fc8a45db94b745d375
1,890
py
Python
fylesdk/apis/fyle_v3/fyle_v3.py
fylein/fyle-sdk-py
826f804ec4d94d5f95fb304254a373679a494238
[ "MIT" ]
4
2019-05-07T07:38:27.000Z
2021-09-14T08:39:12.000Z
fylesdk/apis/fyle_v3/fyle_v3.py
snarayanank2/fyle-sdk-py
826f804ec4d94d5f95fb304254a373679a494238
[ "MIT" ]
3
2019-09-23T11:50:31.000Z
2020-02-10T12:12:10.000Z
fylesdk/apis/fyle_v3/fyle_v3.py
fylein/fyle-sdk-py
826f804ec4d94d5f95fb304254a373679a494238
[ "MIT" ]
12
2019-05-06T09:48:51.000Z
2020-11-13T10:00:26.000Z
""" Fyle V3 APIs Base Class """ from .expenses import Expenses from .reports import Reports from .employees import Employees from .orgs import Orgs from .reimbursements import Reimbursements from .cost_centes import CostCenters from .categories import Categories from .projects import Projects from .refunds import Refunds from .balance_transfers import BalanceTransfers from .settlements import Settlements from .advance_requests import AdvanceRequests from .advances import Advances from .bank_transactions import BankTransactions from .trip_requests import TripRequests from .expense_custom_properties import ExpenseCustomProperties from .employee_custom_properties import EmployeeCustomProperties from .advance_request_custom_properties import AdvanceRequestCustomProperties from .trip_request_custom_properties import TripRequestCustomProperties class FyleV3: def __init__(self): """ Constructor to Initialize all APIs """ # Initialize V3 API Classes self.expenses = Expenses() self.reports = Reports() self.employees = Employees() self.orgs = Orgs() self.reimbursements = Reimbursements() self.cost_centers = CostCenters() self.categories = Categories() self.projects = Projects() self.refunds = Refunds() self.balance_transfers = BalanceTransfers() self.settlements = Settlements() self.advance_requests = AdvanceRequests() self.advances = Advances() self.bank_transactions = BankTransactions() self.trip_requests = TripRequests() self.expense_custom_properties = ExpenseCustomProperties() self.employee_custom_properties = EmployeeCustomProperties() self.advance_request_custom_properties = AdvanceRequestCustomProperties() self.trip_request_custom_properties = TripRequestCustomProperties()
37.8
81
0.757672
182
1,890
7.681319
0.28022
0.091559
0.062947
0.042918
0
0
0
0
0
0
0
0.001943
0.183069
1,890
49
82
38.571429
0.903497
0.044974
0
0
0
0
0
0
0
0
0
0
0
1
0.025
false
0
0.475
0
0.525
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
ef8277ef3ae9c0ea2b164ecadf77b6f20ca717ce
598
py
Python
core/mayaScripts/SimpleCube.py
Bernardrouhi/HandFree
fbb9623cba0b8e7eb18649d29465393f06c2b9ee
[ "MIT" ]
null
null
null
core/mayaScripts/SimpleCube.py
Bernardrouhi/HandFree
fbb9623cba0b8e7eb18649d29465393f06c2b9ee
[ "MIT" ]
null
null
null
core/mayaScripts/SimpleCube.py
Bernardrouhi/HandFree
fbb9623cba0b8e7eb18649d29465393f06c2b9ee
[ "MIT" ]
null
null
null
import sys import maya.standalone maya.standalone.initialize(name='python') from maya import cmds # try: def run(): # get scene file file_path = sys.argv[1] # Open Scene cmds.file(file_path, open=True) #-------------- Script -------------- cmds.polyCube( d=10, h=10 , w=10) cmds.polyCube( d=10, h=10 , w=10) cmds.polyCube( d=10, h=10 , w=10) cmds.polyCube( d=10, h=10 , w=10) cmds.polyCube( d=10, h=10 , w=10) #------------------------------------ # Save Scene cmds.file(save=True, force=True) run() maya.standalone.uninitialize() # except Exception as e: # sys.stdout.write(1)
19.933333
41
0.602007
94
598
3.808511
0.37234
0.167598
0.181564
0.209497
0.293296
0.293296
0.293296
0.293296
0.293296
0.293296
0
0.062745
0.147157
598
30
42
19.933333
0.639216
0.262542
0
0.333333
0
0
0.013857
0
0
0
0
0
0
1
0.066667
false
0
0.2
0
0.266667
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ef8bac5da5b68c79dd574b7a205be89cb3f23f5d
178
py
Python
headlines.py
plamenbelev/headlines
49e5995042abf31b2f898ca1daaf7ee99005dde9
[ "MIT" ]
null
null
null
headlines.py
plamenbelev/headlines
49e5995042abf31b2f898ca1daaf7ee99005dde9
[ "MIT" ]
null
null
null
headlines.py
plamenbelev/headlines
49e5995042abf31b2f898ca1daaf7ee99005dde9
[ "MIT" ]
null
null
null
from flask import Flask app = Flask(__name__) @app.route("/") def get_news(): return 'No news is good news' if __name__ == '__main__': app.run(port=5000, debug=True)
14.833333
34
0.662921
27
178
3.888889
0.740741
0
0
0
0
0
0
0
0
0
0
0.027778
0.191011
178
12
34
14.833333
0.701389
0
0
0
0
0
0.162011
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0.142857
0.428571
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
2
ef9fbd19157663838a068e78c39ee7e40bade1b6
127
py
Python
delightfulsoup/utils/unminify.py
etpinard/delightfulsoup
6d8cf976bf216e0e311808ffbd871a5915ba7b09
[ "MIT" ]
null
null
null
delightfulsoup/utils/unminify.py
etpinard/delightfulsoup
6d8cf976bf216e0e311808ffbd871a5915ba7b09
[ "MIT" ]
null
null
null
delightfulsoup/utils/unminify.py
etpinard/delightfulsoup
6d8cf976bf216e0e311808ffbd871a5915ba7b09
[ "MIT" ]
null
null
null
""" unminify ======== """ def unminify(soup, encoding='utf-8'): """ """ return soup.prettify().encode(encoding)
10.583333
43
0.527559
12
127
5.583333
0.75
0
0
0
0
0
0
0
0
0
0
0.009901
0.204724
127
11
44
11.545455
0.653465
0.133858
0
0
0
0
0.055556
0
0
0
0
0
0
1
0.5
false
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
efb4a4c9d9efe6b7461d24bff10a128e9ce9296a
2,692
py
Python
shuttl/__init__.py
shuttl-io/shuttl-cms
50c85db0de42e901c371561270be6425cc65eccc
[ "MIT" ]
2
2017-06-26T18:06:58.000Z
2017-10-11T21:45:29.000Z
shuttl/__init__.py
shuttl-io/shuttl-cms
50c85db0de42e901c371561270be6425cc65eccc
[ "MIT" ]
null
null
null
shuttl/__init__.py
shuttl-io/shuttl-cms
50c85db0de42e901c371561270be6425cc65eccc
[ "MIT" ]
null
null
null
import sys from flask import Flask, redirect, request, session, url_for from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.login import LoginManager, current_user from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from flask_wtf.csrf import CsrfProtect from .sessions import ShuttlSessionInterface app = Flask(__name__) app.config.from_object("shuttl.settings.DevelopmentConfig") app.session_interface = ShuttlSessionInterface() csrf = CsrfProtect(app) db = SQLAlchemy(app) login_manager = LoginManager() login_manager.init_app(app) from shuttl.MiddleWare import OrganizationMiddleware from .Views import * from .Models import * from .misc import shuttl, shuttlOrgs @login_manager.unauthorized_handler def unauthorized(): url = redirect(url_for("shuttlOrgs.login", organization=request.organization.sys_name)) return url @login_manager.user_loader def load_user(id): return User.query.get(int(id)) migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) from .Commands.FillDB import FillDB from .Commands.TestSuite import TestSuite from .Commands.Add import Add from .Commands.DemoFiller import DemoFiller from .Commands.ResetPublishers import ResetPublishers from .Commands.UploadToS3 import UploadS3 from .Templates.Tags import load_tags # load_tags(app.jinja_env) manager.add_command('test', TestSuite()) manager.add_command('add', Add()) manager.add_command('filldb', FillDB()) manager.add_command('demofiller', DemoFiller()) manager.add_command("resetQueue", ResetPublishers()) manager.add_command('upload', UploadS3) app.register_blueprint(shuttl) app.register_blueprint(shuttlOrgs) from .Models.Reseller import Reseller, ResellerDoesNotExist from .Models.organization import Organization, OrganizationDoesNotExistException @app.before_request def before_request(): request.organization = None # hostname = request.headers.get("host") # try: # reseller = Reseller.GetNameFromHost(hostname) # try: # hostname = request.headers.get("host").split("//", 1)[-1] # subdomain = hostname.split(".", 1)[0] # request.organization = Organization.Get(name=subdomain.replace("_", " "), vendor = reseller) # except OrganizationDoesNotExistException: # pass # pass # except ResellerDoesNotExist: # pass pass @app.teardown_request def teardown_request(exception): pass from .Models.FileTree.FileObjects.FileObject import FileObject FileObject.LoadMapper() @app.before_first_request def beforeFirstRequest(): from .Templates.Tags import load_tags load_tags(app.jinja_env)
28.041667
106
0.76523
310
2,692
6.506452
0.306452
0.034705
0.058999
0.022806
0.078334
0.049579
0.049579
0.049579
0.049579
0.049579
0
0.003013
0.137073
2,692
95
107
28.336842
0.86526
0.165676
0
0.067797
0
0
0.040323
0.014785
0
0
0
0
0
1
0.084746
false
0.033898
0.389831
0.016949
0.508475
0.033898
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
effc0cb6fddb743089c7bdb462500e13e334b104
342
py
Python
tests/test_invalid_login.py
joshmgrant/Python-Pytest-Nerodia
55e8d92cd21e3093e6eb434e4ab7b126c974c6f0
[ "MIT" ]
1
2019-03-19T08:29:02.000Z
2019-03-19T08:29:02.000Z
tests/test_invalid_login.py
joshmgrant/Python-Pytest-Nerodia
55e8d92cd21e3093e6eb434e4ab7b126c974c6f0
[ "MIT" ]
null
null
null
tests/test_invalid_login.py
joshmgrant/Python-Pytest-Nerodia
55e8d92cd21e3093e6eb434e4ab7b126c974c6f0
[ "MIT" ]
null
null
null
import pytest def test_locked_out_user(browser): browser.goto('http://www.saucedemo.com') browser.text_field(data_test='username').value = 'locked_out_user' browser.text_field(data_test='password').value ='secret_sauce' browser.button(type='submit').click() assert browser.button(class_name='error-button').exists
28.5
70
0.733918
46
342
5.217391
0.652174
0.075
0.108333
0.166667
0.2
0
0
0
0
0
0
0
0.119883
342
12
71
28.5
0.797342
0
0
0
0
0
0.247813
0
0
0
0
0
0.142857
1
0.142857
false
0.142857
0.142857
0
0.285714
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
effc868ba3985263b54f27c9ba1dafa032b3a960
351
py
Python
services/shortto.py
joshthecoder/shorty-python
35687d010683944d75e3f0dce7799903296172c5
[ "MIT" ]
11
2015-05-29T04:58:28.000Z
2020-05-31T17:07:52.000Z
services/shortto.py
joshthecoder/shorty-python
35687d010683944d75e3f0dce7799903296172c5
[ "MIT" ]
null
null
null
services/shortto.py
joshthecoder/shorty-python
35687d010683944d75e3f0dce7799903296172c5
[ "MIT" ]
2
2015-03-10T06:22:31.000Z
2018-06-18T18:20:59.000Z
## Shorty ## Copyright 2009 Joshua Roesslein ## See LICENSE ## @url short.to class Shortto(Service): def shrink(self, bigurl): resp = request('http://short.to/s.txt', {'url': bigurl}) return resp.read() def expand(self, tinyurl): resp = request('http://long.to/do.txt', {'url': tinyurl}) return resp.read()
21.9375
65
0.60114
45
351
4.688889
0.622222
0.066351
0.14218
0
0
0
0
0
0
0
0
0.014706
0.225071
351
15
66
23.4
0.761029
0.182336
0
0.285714
0
0
0.173285
0
0
0
0
0
0
1
0.285714
false
0
0
0
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
4bc780e7bf91dc67b2e9b3c85f1b9477066d6c29
87
py
Python
opensanctions/helpers/gender.py
fastbone/opensanctions
dea7f7d073083eece26241bcade697a2b959a09e
[ "MIT" ]
null
null
null
opensanctions/helpers/gender.py
fastbone/opensanctions
dea7f7d073083eece26241bcade697a2b959a09e
[ "MIT" ]
null
null
null
opensanctions/helpers/gender.py
fastbone/opensanctions
dea7f7d073083eece26241bcade697a2b959a09e
[ "MIT" ]
null
null
null
# Welcome to the wonderful world of police databases: MALE = "male" FEMALE = "female"
17.4
53
0.724138
12
87
5.25
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.183908
87
4
54
21.75
0.887324
0.586207
0
0
0
0
0.294118
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
4bc9dc6d068e1225034cf817b0d3efa5bdeee220
128
py
Python
Aula10.py
rsmelocunha/Python-projects
1740d1cbafb0aebfffeb0bfdb4ccccf0dbd14093
[ "MIT" ]
null
null
null
Aula10.py
rsmelocunha/Python-projects
1740d1cbafb0aebfffeb0bfdb4ccccf0dbd14093
[ "MIT" ]
null
null
null
Aula10.py
rsmelocunha/Python-projects
1740d1cbafb0aebfffeb0bfdb4ccccf0dbd14093
[ "MIT" ]
null
null
null
ano = int(input('Digite o ano do seu carro: ')) idadecarro = 2022 - ano print('Carro novo' if idadecarro <=3 else 'Carro Velho')
42.666667
56
0.695313
21
128
4.238095
0.761905
0
0
0
0
0
0
0
0
0
0
0.046729
0.164063
128
3
56
42.666667
0.785047
0
0
0
0
0
0.372093
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
4bcbcc55408d8cf46761e62d961a3d39291ace5d
440
py
Python
tests/test_get_current_os_name.py
c-pher/PyWinOS
a16a16a24abaa53a06b9365b2535c8ab31a7fdfb
[ "MIT" ]
4
2020-04-17T15:54:43.000Z
2020-11-08T06:39:05.000Z
tests/test_get_current_os_name.py
c-pher/PyWinOS
a16a16a24abaa53a06b9365b2535c8ab31a7fdfb
[ "MIT" ]
65
2020-01-05T21:45:17.000Z
2022-03-31T16:50:20.000Z
tests/test_get_current_os_name.py
c-pher/PyWinOS
a16a16a24abaa53a06b9365b2535c8ab31a7fdfb
[ "MIT" ]
null
null
null
import os def test_get_current_os_name(client_local): response = client_local.get_current_os_name_local() print(response) print(os.name) if os.name == 'nt': assert 'Windows' in response, 'Current OS name is not Windows' elif os.name == 'Linux': assert 'Linux' in response, 'Current OS name is not Linux' elif os.name == 'posix': assert response == 'Darwin', 'Current OS name is not MacOS'
29.333333
70
0.661364
64
440
4.390625
0.359375
0.192171
0.231317
0.160142
0.263345
0.199288
0.199288
0
0
0
0
0
0.231818
440
14
71
31.428571
0.831361
0
0
0
0
0
0.263636
0
0
0
0
0
0.272727
1
0.090909
false
0
0.090909
0
0.181818
0.181818
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
4bcc5632c54ea11fd3756fc709d789ae83392c50
55
py
Python
dearpygui_map/__init__.py
mkouhia/dearpygui_map
8db86e6917b88c118aff94a22e383ef517c40620
[ "MIT" ]
null
null
null
dearpygui_map/__init__.py
mkouhia/dearpygui_map
8db86e6917b88c118aff94a22e383ef517c40620
[ "MIT" ]
21
2022-02-21T08:31:03.000Z
2022-03-08T19:27:33.000Z
dearpygui_map/__init__.py
mkouhia/dearpygui_map
8db86e6917b88c118aff94a22e383ef517c40620
[ "MIT" ]
null
null
null
"""Map widget for Dear PyGui""" __version__ = "0.0.1"
13.75
31
0.636364
9
55
3.444444
0.888889
0
0
0
0
0
0
0
0
0
0
0.065217
0.163636
55
3
32
18.333333
0.608696
0.454545
0
0
0
0
0.208333
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
4be3297fddc6fb6fba4bd8355331638ba8b66d70
707
py
Python
models/zeros.py
DawyD/illumination-preserving-rotations
4fb69dc2526579a7677c27e75eae3a0b0000b5de
[ "MIT" ]
null
null
null
models/zeros.py
DawyD/illumination-preserving-rotations
4fb69dc2526579a7677c27e75eae3a0b0000b5de
[ "MIT" ]
null
null
null
models/zeros.py
DawyD/illumination-preserving-rotations
4fb69dc2526579a7677c27e75eae3a0b0000b5de
[ "MIT" ]
null
null
null
import tensorflow as tf from tensorflow.keras.layers import Conv2D, ReLU, SeparableConv2D, Input, SpatialDropout2D, MaxPool2D, Concatenate, Conv2DTranspose, BatchNormalization from tensorflow.keras.regularizers import l1, l2 from models.net import Net from layers.kerasGroupNorm import GroupNormalization class Zeros(Net): def __init__(self, output_shape): super(Zeros).__init__() self.output_shape = output_shape def net(self): model = tf.keras.Sequential() model.add(Input(self.output_shape, name='output_shape')) model.add(tf.keras.layers.Lambda(lambda x: tf.zeros_like(x)[..., 0:1])) return model def get_name(self): return "Zeros"
35.35
151
0.721358
89
707
5.561798
0.47191
0.111111
0.090909
0.076768
0
0
0
0
0
0
0
0.015491
0.178218
707
19
152
37.210526
0.836489
0
0
0
0
0
0.024045
0
0
0
0
0
0
1
0.1875
false
0
0.3125
0.0625
0.6875
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
4be54c7f61feb9501683fa638bd0374bbe09f529
13,922
py
Python
Lib/pagebot/elements/conditions.py
bghryct/PageBot
394150c0fd399f02faec28f4576046882f4d7d39
[ "MIT" ]
68
2018-10-22T22:42:58.000Z
2022-03-19T11:07:31.000Z
Lib/pagebot/elements/conditions.py
TypeNetwork/PageBot
394150c0fd399f02faec28f4576046882f4d7d39
[ "MIT" ]
97
2017-07-10T23:49:30.000Z
2018-10-03T08:17:55.000Z
Lib/pagebot/elements/conditions.py
TypeNetwork/PageBot
394150c0fd399f02faec28f4576046882f4d7d39
[ "MIT" ]
9
2017-07-11T09:59:00.000Z
2018-09-12T11:59:30.000Z
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # ----------------------------------------------------------------------------- # # P A G E B O T # # Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens # www.pagebot.io # Licensed under MIT conditions # # Supporting DrawBot, www.drawbot.com # Supporting Flat, xxyxyz.org/flat # ----------------------------------------------------------------------------- # # conditions.py # class Conditions: # C O N D I T I O N S def isBottomOnBottom(self, tolerance=0): return abs(self.parent.pb - self.mBottom) <= tolerance def isBottomOnSideBottom(self, tolerance=0): return abs(self.mBottom) <= tolerance def isBottomOnBleedBottom(self, tolerance=0): return abs(self.mBottom - self.bleedBottom) <= tolerance def isBottomOnTop(self, tolerance=0): return abs(self.parent.h - self.parent.pt - self.mBottom) <= tolerance def isCenterOnCenter(self, tolerance=0): pl = self.parent.pl # Get parent padding left center = (self.parent.w - self.parent.pr - pl)/2 return abs(pl + center - self.center) <= tolerance def isCenterOnCenterSides(self, tolerance=0): return abs(self.parent.w/2 - self.center) <= tolerance def isCenterOnLeft(self, tolerance=0): return abs(self.parent.pl - self.center) <= tolerance def isCenterOnRight(self, tolerance=0): return abs(self.parent.w - self.parent.pr - self.center) <= tolerance def isCenterOnSideRight(self, tolerance=0): return abs(self.parent.w - self.center) <= tolerance def isMiddleOnBottom(self, tolerance=0): return abs(self.parent.pb - self.middle) <= tolerance def isMiddleOnSideBottom(self, tolerance=0): return abs(self.middle) <= tolerance def isMiddleOnTop(self, tolerance=0): return abs(self.parent.h - self.parent.pt - self.middle) <= tolerance def isMiddleOnSideTop(self, tolerance=0): return abs(self.parent.h - self.middle) <= tolerance def isMiddleOnMiddle(self, tolerance=0): pt = self.parent.pt # Get parent padding top pb = self.parent.pb middle = (self.parent.h - pt - pb)/2 return abs(pb + middle - self.middle) <= tolerance def isMiddleOnMiddleSides(self, tolerance=0): return abs(self.parent.h - self.middle) <= tolerance def isLeftOnCenter(self, tolerance=0): pl = self.parent.pl # Get parent padding left center = (self.parent.w - self.parent.pr - pl)/2 return abs(pl + center - self.mLeft) <= tolerance def isLeftOnCenterSides(self, tolerance=0): return abs(self.parent.w/2 - self.mLeft) <= tolerance def isLeftOnLeft(self, tolerance=0): return abs(self.parent.pl - self.mLeft) <= tolerance def isLeftOnSideLeft(self, tolerance=0): return abs(self.mLeft) <= tolerance def isLeftOnBleedLeft(self, tolerance=0): return abs(self.mLeft + self.bleedLeft) <= tolerance def isLeftOnRight(self, tolerance=0): return abs(self.parent.w - self.parent.pr - self.mLeft) <= tolerance def isLeftOnSideRight(self, tolerance=0): return abs(self.parent.w - self.mLeft) <= tolerance def isCenterOnSideLeft(self, tolerance=0): return abs(self.parent.mLeft - self.center) <= tolerance def isTopOnMiddle(self, tolerance=0): pt = self.parent.pt # Get parent padding top pb = self.parent.pb middle = (self.parent.h - pb - pt)/2 return abs(pb + middle - self.mTop) <= tolerance def isTopOnMiddleSides(self, tolerance=0): return abs(self.parent.h/2 - self.mTop) <= tolerance def isOriginOnBottom(self, tolerance=0): pb = self.parent.pb # Get parent padding left return abs(pb - self.y) <= tolerance def isOriginOnSideBottom(self, tolerance=0): return abs(self.y) <= tolerance def isOriginOnCenter(self, tolerance=0): pl = self.parent.pl # Get parent padding left center = (self.parent.w - self.parent.pr - pl)/2 return abs(pl + center - self.x) <= tolerance def isOriginOnCenterSides(self, tolerance=0): return abs(self.parent.w/2 - self.x) <= tolerance def isOriginOnLeft(self, tolerance=0): return abs(self.parent.pl - self.x) <= tolerance def isOriginOnSideLeft(self, tolerance=0): return abs(self.x) <= tolerance def isOriginOnRight(self, tolerance=0): return abs(self.parent.w - self.parent.pr - self.x) <= tolerance def isOriginOnSideRight(self, tolerance=0): return abs(self.parent.w - self.x) <= tolerance def isOriginOnTop(self, tolerance=0): return abs(self.parent.h - self.parent.pt - self.y) <= tolerance def isOriginOnSideTop(self, tolerance=0): """Answers if the origin of self is on the top side of self.parent. >>> from pagebot.elements.element import Element >>> e1 = Element(w=200, h=400) >>> e2 = Element(w=50, h=50, parent=e1) >>> #FIX e1.isOriginOnSideTop() False >>> #FIX e2.isOriginOnSideTop() False >>> e2.y = e1.top >>> #FIX e2.isOriginOnSideTop(), e2.y, e1.top (True, 500pt, 500pt) """ if self.parent is None: return False return abs(self.parent.top - self.y) <= tolerance def isOriginOnMiddle(self, tolerance=0): """Answers if the origin of self is on the top side of self.parent. >>> from pagebot.elements.element import Element >>> e1 = Element(w=200, h=400) >>> e2 = Element(w=50, h=50, parent=e1) >>> e1.isOriginOnMiddle() False >>> #FIX e2.isOriginOnMiddle() False >>> e2.y = e1.middle >>> #FIX e2.isOriginOnMiddle(), e2.y, e1.middle (True, 500pt, 500pt) """ if self.parent is None: return False return abs(self.parent.middle - self.y) <= tolerance def isOriginOnMiddleSides(self, tolerance=0): return abs(self.parent.h/2 - self.y) <= tolerance def isRightOnCenter(self, tolerance=0): """Answers if the right size of `self` is on the middle of the parent. >>> from pagebot.elements.element import Element >>> e1 = Element(x=100, w=200) # e1.right == 300 >>> e2 = Element(w=600, elements=[e1]) """ return abs(self.parent.pl + self.parent.pw/2 - self.mRight) <= tolerance def isRightOnCenterSides(self, tolerance=0): return abs(self.parent.w/2 - self.mRight) <= tolerance def isRightOnLeft(self, tolerance=0): return abs(self.parent.pl - self.mRight) <= tolerance def isRightOnRight(self, tolerance=0): return abs(self.parent.w - self.parent.pr - self.mRight) <= tolerance def isRightOnSideRight(self, tolerance=0): return abs(self.parent.w - self.mRight) <= tolerance def isRightOnBleedRight(self, tolerance=0): return abs(self.parent.w + self.bleedLeft) <= tolerance def isBottomOnMiddle(self, tolerance=0): pt = self.parent.pt # Get parent padding top pb = self.parent.pb middle = (self.parent.h - pb - pt)/2 return abs(pb + middle - self.mBottom) <= tolerance def isBottomOnMiddleSides(self, tolerance=0): return abs(self.parent.h/2 - self.mBottom) <= tolerance def isTopOnBottom(self, tolerance=0): return abs(self.parent.pb - self.mTop) <= tolerance def isTopOnTop(self, tolerance=0): return abs(self.parent.h - self.parent.pt - self.mTop) <= tolerance def isTopOnSideTop(self, tolerance=0): return abs(self.parent.h - self.mTop) <= tolerance def isTopOnBleedTop(self, tolerance=0): return abs(self.parent.h - self.mTop + self.bleedTop) <= tolerance # Shrink block conditions def isSchrunkOnBlockLeft(self, tolerance): boxX, _, _, _ = self.marginBox return abs(self.mLeft + self.pl - boxX) <= tolerance def isShrunkOnBlockRight(self, tolerance): boxX, _, boxW, _ = self.marginBox return abs(self.mRight - self.pr - (boxX + boxW)) <= tolerance def isShrunkOnBlockTop(self, tolerance): _, boxY, _, boxH = self.marginBox return self.mTop - self.pt - (boxY + boxH) <= tolerance def isShrunkOnBlockBottom(self, tolerance): """Test if the bottom of self is shrunk to the bottom position of the block.""" _, boxY, _, boxH = self.marginBox return abs(self.pb - boxY) <= tolerance def isShrunkOnBlockSideLeft(self, tolerance): boxX, _, _, _ = self.box return abs(self.mLeft - boxX) <= tolerance def isShrunkOnBlockSideRight(self, tolerance): boxX, _, boxW, _ = self.mbox return abs(self.mRight - (boxX + boxW)) <= tolerance def isShrunkOnBlockSideTop(self, tolerance): _, boxY, _, boxH = self.box return self.mTop - (boxY + boxH) <= tolerance def isShrunkOnBlockSideBottom(self, tolerance): _, boxY, _, boxH = self.marginBox return abs(self.mBottom - boxY) <= tolerance # Unimplemented here for text operations. def isShrunkOnTextHeight(self, tolerance=0): """For non-text elements, this is always True to satisfy the calling condition.""" return True def shrink2TextHeight(self, tolerance=0): """For non-text elements, this is always True to satisfy the calling condition.""" return True def isShrunkOnTextWidth(self, tolerance=0): """For non-text elements, this is always True to satisfy the calling condition.""" return True def shrink2TextWidth(self, tolerance=0): """For non-text elements, this is always True to satisfy the calling condition.""" return True # Float conditions to page padding. def isFloatOnTop(self, tolerance=0): answer = abs(min(self.getFloatSideTop(), self.parent.h - self.parent.pt) - self.mTop) <= tolerance return answer def isFloatOnBottom(self, tolerance=0): return abs(max(self.getFloatSideBottom(), self.parent.pb) - self.mBottom) <= tolerance def isFloatOnLeft(self, tolerance=0): answer = abs(max(self.getFloatSideLeft(), self.parent.pl) - self.mLeft) <= tolerance return answer def isFloatOnRight(self, tolerance=0): return abs(min(self.getFloatSideRight(), self.parent.w - self.parent.pr) - self.mRight) <= tolerance # Float conditions to page sides def isFloatOnSideTop(self, tolerance=0): return abs(self.getFloatSideTop() - self.mTop) <= tolerance def isFloatOnSideBottom(self, tolerance=0): return abs(self.getFloatSideBottom() - self.mBottom) <= tolerance def isFloatOnSideLeft(self, tolerance=0): return abs(self.getFloatSideLeft() - self.mLeft) <= tolerance def isFloatOnSideRight(self, tolerance=0): return abs(self.getFloatSideRight() - self.mRight) <= tolerance # Column/Row conditions def isLeftOnCol(self, col, tolerance): """Move top of the element to col index position.""" gridColumns = self.getGridColumns() if col in range(len(gridColumns)): return abs(self.mLeft - gridColumns[col][0]) <= tolerance return False # row is not in range of gridColumns def isRightOnCol(self, col, tolerance): """Move top of the element to col index position.""" gridColumns = self.getGridColumns() if col in range(len(gridColumns)): return abs(self.mRight - gridColumns[col][0] - self.gw) <= tolerance return False # row is not in range of gridColumns def isFitOnColSpan(self, col, colSpan, tolerance): """Answers if the self.w is the same as the total of column widths between col and col+colSpan. >>> from pagebot.toolbox.units import pt >>> from pagebot.elements.element import Element >>> gridX = (pt(100, 10), pt(200, 20), pt(300, 30), pt(400, 40), pt(500, 50)) >>> e1 = Element(padding=30, w=600, gridX=gridX) >>> e1.getGridColumns() [(0, 100pt), (110pt, 200pt), (330pt, 300pt), (660pt, 400pt), (1100pt, 500pt)] >>> e2 = Element(w=100, parent=e1) >>> e1.getGridColumns() [(0, 100pt), (110pt, 200pt), (330pt, 300pt), (660pt, 400pt), (1100pt, 500pt)] >>> e2.isFitOnColSpan(0, 1, 0) True >>> e2.w = 310 >>> e2.isFitOnColSpan(0, 2, 0) True >>> e2.w = 950 >>> e2.isFitOnColSpan(1, 3, 0) True """ gridColumns = self.getGridColumns() if col >= 0 and col+colSpan <= len(gridColumns): c1 = gridColumns[col] c2 = gridColumns[col + colSpan - 1] return abs(self.w - (c2[0] - c1[0] + c2[1])) <= tolerance return False def isTopOnRow(self, row, tolerance): """Move top of the element to row.""" gridRows = self.getGridRows() if row in range(len(gridRows)): return abs(self.mTop - gridRows[row][0]) <= tolerance # row is not in range of gridColumns. return False def isBottomOnRow(self, row, tolerance): """Move top of the element to row.""" gridRows = self.getGridRows() if row in range(len(gridRows)): return abs(self.mBottom - gridRows[row][0]) <= tolerance # row is not in range of gridColumns. return False def isFitOnRowSpan(self, row, rowSpan, tolerance): gridRows = self.getGridRows() if row >= 0 and row+rowSpan < len(gridRows): r1 = gridRows[row] r2 = gridRows[row + rowSpan - 1] return abs(self.h - (r2[0] - r1[0] + r2[1])) <= tolerance return False if __name__ == '__main__': import doctest import sys sys.exit(doctest.testmod()[0])
35.789203
108
0.617943
1,690
13,922
5.075148
0.154438
0.085111
0.099569
0.104932
0.545062
0.504955
0.464731
0.42509
0.42509
0.351988
0
0.027964
0.249964
13,922
388
109
35.881443
0.79343
0.218
0
0.222222
0
0
0.00077
0
0
0
0
0
0
1
0.362319
false
0
0.009662
0.217391
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
4bf9cae86ed3b64532d63a132ed50c966d6bd0b4
826
py
Python
app/models.py
Katze2/Flask-template
99925f6bfbaf92ace9b0fd7c792b989ed90a7e00
[ "MIT" ]
null
null
null
app/models.py
Katze2/Flask-template
99925f6bfbaf92ace9b0fd7c792b989ed90a7e00
[ "MIT" ]
null
null
null
app/models.py
Katze2/Flask-template
99925f6bfbaf92ace9b0fd7c792b989ed90a7e00
[ "MIT" ]
null
null
null
# -*- encoding: utf-8 -*- from app import db class ModelExample(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(250)) content = db.Column(db.Text) date = db.Column(db.DateTime) class User(db.Model): id = db.Column(db.Integer, primary_key = True) user = db.Column(db.String(64), unique = True) password = db.Column(db.String(500)) name = db.Column(db.String(500)) email = db.Column(db.String(120), unique = True) # posts = db.relationship('Post', backref = 'author', lazy = 'dynamic') def is_authenticated(self): return True def is_active(self): return True def is_anonymous(self): return False def get_id(self): return unicode(self.id) def __repr__(self): return '<User %r>' % (self.nickname)
24.294118
75
0.634383
117
826
4.393162
0.435897
0.140078
0.175097
0.155642
0.303502
0.155642
0.155642
0.155642
0.155642
0.155642
0
0.02322
0.217918
826
33
76
25.030303
0.772446
0.112591
0
0.181818
0
0
0.012329
0
0
0
0
0
0
1
0.227273
false
0.045455
0.045455
0.227273
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
4bfe8f82bf9964afbee833e2a996e71d61b97873
1,638
py
Python
Code/list.py
sunjinshuai/Python
b4d76bc20e9d740108c98cb8d023ca5da3e6c070
[ "MIT" ]
null
null
null
Code/list.py
sunjinshuai/Python
b4d76bc20e9d740108c98cb8d023ca5da3e6c070
[ "MIT" ]
null
null
null
Code/list.py
sunjinshuai/Python
b4d76bc20e9d740108c98cb8d023ca5da3e6c070
[ "MIT" ]
null
null
null
list1 = ['physics', 'chemistry', 1997, 2000] list2 = [1, 2, 3, 4, 5 ] list3 = ["a", "b", "c", "d"] print list1, list2, list3 # 访问列表中的值 # 使用下标索引来访问列表中的值,同样你也可以使用方括号的形式截取字符,如下所示: print "list1[0]: ", list1[0] print "list2[1:5]: ", list2[1:5] # 更新列表 # 你可以对列表的数据项进行修改或更新,你也可以使用append()方法来添加列表项,如下所示: list = [] ## 空列表 list.append('Google') ## 使用 append() 添加元素 list.append('Python') print list # 删除列表元素 # 可以使用 del 语句来删除列表的元素,如下实例: list1 = ['Python', 'iOS', 'Java', 'C++'] print list1 del list1[2] print "After deleting value at index 2 : " print list1 # Python列表脚本操作符 # 列表对 + 和 * 的操作符与字符串相似。+ 号用于组合列表,* 号用于重复列表。 list1 = ['Python', 'iOS', 'Java', 'C++'] print len(list1) list2 = ['C', 'Ruby', 'Javastript'] print list1 + list2 print ['Python'] * 4 print 'iOS' in list1 for str in list1: print str # Python列表截取 list1 = ['Python', 'iOS', 'Java', 'C++'] print list1[2] print list1[-2] print list1[1:] # cmp() 方法用于比较两个列表的元素。 # cmp()方法语法: # cmp(list1, list2) # 如果比较的元素是同类型的,则比较其值,返回结果。 # 如果两个元素不是同一种类型,则检查它们是否是数字。 # 如果是数字,执行必要的数字强制类型转换,然后比较。 # 如果有一方的元素是数字,则另一方的元素"大"(数字是"最小的") # 否则,通过类型名字的字母顺序进行比较。 # 如果有一个列表首先到达末尾,则另一个长一点的列表"大"。 # 如果我们用尽了两个列表的元素而且所 有元素都是相等的,那么结果就是个平局,就是说返回一个 0。 list1, list2 = [123, 'xyz'], [456, 'abc'] print cmp(list1, list2); print cmp(list2, list1); list3 = list2 + [786]; list4 = [123, 'xyz'] print cmp(list2, list3) print cmp(list1, list4) # extend() 函数用于在列表末尾一次性追加另一个序列中的多个值(用新列表扩展原来的列表)。 # extend()方法语法: # list.extend(seq) # 该方法没有返回值,但会在已存在的列表中添加新的列表内容。 aList = [123, 'xyz', 'zara', 'abc', 123]; bList = [2009, 'manni']; aList.extend(bList) print "Extended List : ", aList
20.222222
49
0.651404
211
1,638
5.056872
0.473934
0.074977
0.039363
0.050609
0.09747
0.076851
0.054358
0
0
0
0
0.06414
0.162393
1,638
81
50
20.222222
0.713557
0.357143
0
0.131579
0
0
0.194932
0
0
0
0
0
0
0
null
null
0
0
null
null
0.526316
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
2
ef055217f03abbaf7fba6a972f73a617fc132c0f
838
py
Python
src/python/modules/TensorflowCommon/utils.py
dsyme/ADBench
87af0219a568807f8432754688ceb636efac12c6
[ "MIT" ]
58
2019-12-30T16:22:01.000Z
2022-01-23T12:26:51.000Z
src/python/modules/TensorflowCommon/utils.py
dsyme/ADBench
87af0219a568807f8432754688ceb636efac12c6
[ "MIT" ]
112
2019-05-25T07:26:58.000Z
2019-12-28T13:55:33.000Z
src/python/modules/TensorflowCommon/utils.py
dsyme/ADBench
87af0219a568807f8432754688ceb636efac12c6
[ "MIT" ]
22
2020-03-12T16:37:55.000Z
2022-02-23T10:14:37.000Z
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import tensorflow as tf def to_tf_tensor(ndarray, dtype = tf.float64): '''Converts the given multidimensional array to a tensorflow tensor. Args: ndarray (ndarray-like): parameter for conversion. dtype (type, optional): defines a type of tensor elements. Defaults to tf.float64. Returns: tensorflow tensor ''' return tf.convert_to_tensor(ndarray, dtype = dtype) def shape(tf_tensor): '''Returns shape of a tensorflow tensor like a list if integers.''' return tf_tensor.get_shape().as_list() def flatten(tf_tensor, column_major = False): '''Returns the flaten tensor.''' if column_major: tf_tensor = tf.transpose(tf_tensor) return tf.reshape(tf_tensor, [-1])
22.648649
78
0.674224
109
838
5.055046
0.46789
0.101633
0.065336
0
0
0
0
0
0
0
0
0.007776
0.232697
838
37
79
22.648649
0.849145
0.491647
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.111111
0
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
ef094d452aa651937866c8d859cce7f5a8e866fa
1,265
py
Python
examples/235. Lowest Common Ancestor of a Binary Search Tree.py
yehzhang/RapidTest
2302fc10ddafba1d16ef1d7448d46c66f5a05da2
[ "MIT" ]
null
null
null
examples/235. Lowest Common Ancestor of a Binary Search Tree.py
yehzhang/RapidTest
2302fc10ddafba1d16ef1d7448d46c66f5a05da2
[ "MIT" ]
null
null
null
examples/235. Lowest Common Ancestor of a Binary Search Tree.py
yehzhang/RapidTest
2302fc10ddafba1d16ef1d7448d46c66f5a05da2
[ "MIT" ]
null
null
null
from rapidtest import Test, Case, TreeNode from solutions.lowest_common_ancestor_of_a_binary_search_tree import Solution with Test(Solution, post_proc=TreeNode.get_val) as test: root = TreeNode.from_iterable([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5]) Case(root, TreeNode(2), TreeNode(4), result=TreeNode(2)) Case(root, TreeNode(4), TreeNode(2), result=TreeNode(2)) Case(root, TreeNode(2), TreeNode(8), result=TreeNode(6)) Case(root, TreeNode(8), TreeNode(2), result=TreeNode(6)) Case(root, TreeNode(3), TreeNode(7), result=TreeNode(6)) Case(root, TreeNode(0), TreeNode(4), result=TreeNode(2)) Case(root, TreeNode(0), TreeNode(5), result=TreeNode(2)) Case(root, TreeNode(2), TreeNode(6), result=TreeNode(6)) Case(root, TreeNode(6), TreeNode(2), result=TreeNode(6)) Case(root, TreeNode(6), TreeNode(2), result=TreeNode(6)) Case(root, TreeNode(0), TreeNode(0), result=TreeNode(0)) @test def greater_children(i): return Case(TreeNode.from_iterable([i, None, i + 1]), TreeNode(i), TreeNode(i + 1), result=TreeNode(i)) @test def smaller_children(i): return Case(TreeNode.from_iterable([i, i - 1]), TreeNode(i), TreeNode(i - 1), result=TreeNode(i))
43.62069
91
0.660079
185
1,265
4.437838
0.227027
0.221681
0.214373
0.138855
0.685749
0.65408
0.616322
0.616322
0.225335
0.225335
0
0.044188
0.177075
1,265
28
92
45.178571
0.744476
0
0
0.26087
0
0
0
0
0
0
0
0
0
1
0.086957
false
0
0.086957
0.086957
0.26087
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ef09cb460708054f80c71807033f5ec91f1f2963
12,087
py
Python
proto/npu_utilization_pb2.py
akaczm/jun-telemetry
84c7208669f4f1749f8db45f4815dafefdbec083
[ "MIT" ]
4
2019-12-02T12:20:47.000Z
2021-08-25T12:52:26.000Z
proto/npu_utilization_pb2.py
akaczm/jun-telemetry
84c7208669f4f1749f8db45f4815dafefdbec083
[ "MIT" ]
null
null
null
proto/npu_utilization_pb2.py
akaczm/jun-telemetry
84c7208669f4f1749f8db45f4815dafefdbec083
[ "MIT" ]
1
2021-08-25T12:47:44.000Z
2021-08-25T12:47:44.000Z
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: npu_utilization.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() import telemetry_top_pb2 as telemetry__top__pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='npu_utilization.proto', package='', syntax='proto2', serialized_options=None, serialized_pb=_b('\n\x15npu_utilization.proto\x1a\x13telemetry_top.proto\"C\n\x1bNetworkProcessorUtilization\x12$\n\x0enpu_util_stats\x18\x01 \x03(\x0b\x32\x0c.Utilization\"q\n\x0bUtilization\x12\x12\n\nidentifier\x18\x01 \x02(\t\x12\x13\n\x0butilization\x18\x02 \x01(\r\x12\x1c\n\x07packets\x18\x03 \x03(\x0b\x32\x0b.PacketLoad\x12\x1b\n\x06memory\x18\x04 \x03(\x0b\x32\x0b.MemoryLoad\"\xba\x01\n\nMemoryLoad\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x61verage_util\x18\x02 \x01(\r\x12\x14\n\x0chighest_util\x18\x03 \x01(\r\x12\x13\n\x0blowest_util\x18\x04 \x01(\r\x12\x1e\n\x16\x61verage_cache_hit_rate\x18\x05 \x01(\r\x12\x1e\n\x16highest_cache_hit_rate\x18\x06 \x01(\r\x12\x1d\n\x15lowest_cache_hit_rate\x18\x07 \x01(\r\"\xa2\x01\n\nPacketLoad\x12\x12\n\nidentifier\x18\x01 \x02(\t\x12\x0c\n\x04rate\x18\x02 \x01(\x04\x12\'\n\x1f\x61verage_instructions_per_packet\x18\x03 \x01(\r\x12&\n\x1e\x61verage_wait_cycles_per_packet\x18\x04 \x01(\r\x12!\n\x19\x61verage_cycles_per_packet\x18\x05 \x01(\r:W\n\x18jnpr_npu_utilization_ext\x12\x17.JuniperNetworksSensors\x18\x0c \x01(\x0b\x32\x1c.NetworkProcessorUtilization') , dependencies=[telemetry__top__pb2.DESCRIPTOR,]) JNPR_NPU_UTILIZATION_EXT_FIELD_NUMBER = 12 jnpr_npu_utilization_ext = _descriptor.FieldDescriptor( name='jnpr_npu_utilization_ext', full_name='jnpr_npu_utilization_ext', index=0, number=12, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=True, extension_scope=None, serialized_options=None, file=DESCRIPTOR) _NETWORKPROCESSORUTILIZATION = _descriptor.Descriptor( name='NetworkProcessorUtilization', full_name='NetworkProcessorUtilization', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='npu_util_stats', full_name='NetworkProcessorUtilization.npu_util_stats', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=46, serialized_end=113, ) _UTILIZATION = _descriptor.Descriptor( name='Utilization', full_name='Utilization', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='identifier', full_name='Utilization.identifier', index=0, number=1, type=9, cpp_type=9, label=2, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='utilization', full_name='Utilization.utilization', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='packets', full_name='Utilization.packets', index=2, number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='memory', full_name='Utilization.memory', index=3, number=4, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=115, serialized_end=228, ) _MEMORYLOAD = _descriptor.Descriptor( name='MemoryLoad', full_name='MemoryLoad', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='name', full_name='MemoryLoad.name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_util', full_name='MemoryLoad.average_util', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='highest_util', full_name='MemoryLoad.highest_util', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='lowest_util', full_name='MemoryLoad.lowest_util', index=3, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_cache_hit_rate', full_name='MemoryLoad.average_cache_hit_rate', index=4, number=5, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='highest_cache_hit_rate', full_name='MemoryLoad.highest_cache_hit_rate', index=5, number=6, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='lowest_cache_hit_rate', full_name='MemoryLoad.lowest_cache_hit_rate', index=6, number=7, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=231, serialized_end=417, ) _PACKETLOAD = _descriptor.Descriptor( name='PacketLoad', full_name='PacketLoad', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='identifier', full_name='PacketLoad.identifier', index=0, number=1, type=9, cpp_type=9, label=2, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='rate', full_name='PacketLoad.rate', index=1, number=2, type=4, cpp_type=4, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_instructions_per_packet', full_name='PacketLoad.average_instructions_per_packet', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_wait_cycles_per_packet', full_name='PacketLoad.average_wait_cycles_per_packet', index=3, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_cycles_per_packet', full_name='PacketLoad.average_cycles_per_packet', index=4, number=5, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=420, serialized_end=582, ) _NETWORKPROCESSORUTILIZATION.fields_by_name['npu_util_stats'].message_type = _UTILIZATION _UTILIZATION.fields_by_name['packets'].message_type = _PACKETLOAD _UTILIZATION.fields_by_name['memory'].message_type = _MEMORYLOAD DESCRIPTOR.message_types_by_name['NetworkProcessorUtilization'] = _NETWORKPROCESSORUTILIZATION DESCRIPTOR.message_types_by_name['Utilization'] = _UTILIZATION DESCRIPTOR.message_types_by_name['MemoryLoad'] = _MEMORYLOAD DESCRIPTOR.message_types_by_name['PacketLoad'] = _PACKETLOAD DESCRIPTOR.extensions_by_name['jnpr_npu_utilization_ext'] = jnpr_npu_utilization_ext _sym_db.RegisterFileDescriptor(DESCRIPTOR) NetworkProcessorUtilization = _reflection.GeneratedProtocolMessageType('NetworkProcessorUtilization', (_message.Message,), { 'DESCRIPTOR' : _NETWORKPROCESSORUTILIZATION, '__module__' : 'npu_utilization_pb2' # @@protoc_insertion_point(class_scope:NetworkProcessorUtilization) }) _sym_db.RegisterMessage(NetworkProcessorUtilization) Utilization = _reflection.GeneratedProtocolMessageType('Utilization', (_message.Message,), { 'DESCRIPTOR' : _UTILIZATION, '__module__' : 'npu_utilization_pb2' # @@protoc_insertion_point(class_scope:Utilization) }) _sym_db.RegisterMessage(Utilization) MemoryLoad = _reflection.GeneratedProtocolMessageType('MemoryLoad', (_message.Message,), { 'DESCRIPTOR' : _MEMORYLOAD, '__module__' : 'npu_utilization_pb2' # @@protoc_insertion_point(class_scope:MemoryLoad) }) _sym_db.RegisterMessage(MemoryLoad) PacketLoad = _reflection.GeneratedProtocolMessageType('PacketLoad', (_message.Message,), { 'DESCRIPTOR' : _PACKETLOAD, '__module__' : 'npu_utilization_pb2' # @@protoc_insertion_point(class_scope:PacketLoad) }) _sym_db.RegisterMessage(PacketLoad) jnpr_npu_utilization_ext.message_type = _NETWORKPROCESSORUTILIZATION telemetry__top__pb2.JuniperNetworksSensors.RegisterExtension(jnpr_npu_utilization_ext) # @@protoc_insertion_point(module_scope)
40.972881
1,125
0.755522
1,539
12,087
5.610136
0.118908
0.053741
0.055942
0.041696
0.619875
0.577369
0.552467
0.543201
0.532546
0.500811
0
0.037244
0.124762
12,087
294
1,126
41.112245
0.778902
0.03268
0
0.648855
1
0.003817
0.17848
0.131056
0
0
0
0
0
1
0
false
0
0.022901
0
0.022901
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ef124d3ce81475f29c8f62fc6238715aeebcf110
764
py
Python
ACCNTS/migrations/0012_auto_20190329_0554.py
domambia/csdigital-gs1kenya-internal-erp
6736d0e9a3a51653689f8ae921cf811f378d9d8e
[ "MIT" ]
12
2019-08-02T07:58:16.000Z
2022-01-31T23:45:08.000Z
ACCNTS/migrations/0012_auto_20190329_0554.py
domambia/csdigital-gs1kenya-internal-erp
6736d0e9a3a51653689f8ae921cf811f378d9d8e
[ "MIT" ]
8
2019-08-02T08:06:18.000Z
2022-03-11T23:45:17.000Z
ACCNTS/migrations/0012_auto_20190329_0554.py
domambia/csdigital-gs1kenya-internal-erp
6736d0e9a3a51653689f8ae921cf811f378d9d8e
[ "MIT" ]
11
2019-07-31T16:23:36.000Z
2022-01-29T08:30:07.000Z
# Generated by Django 2.1.5 on 2019-03-29 05:54 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ACCNTS', '0011_asset_employeetax_income_liability'), ] operations = [ migrations.AddField( model_name='asset', name='dated', field=models.DateField(default=datetime.datetime.now), ), migrations.AddField( model_name='income', name='dated', field=models.DateField(default=datetime.datetime.now), ), migrations.AddField( model_name='liability', name='dated', field=models.DateField(default=datetime.datetime.now), ), ]
25.466667
66
0.590314
74
764
6
0.486486
0.121622
0.155405
0.182432
0.493243
0.493243
0.493243
0.493243
0.493243
0.369369
0
0.035382
0.29712
764
29
67
26.344828
0.791434
0.058901
0
0.521739
1
0
0.111576
0.054393
0
0
0
0
0
1
0
false
0
0.086957
0
0.217391
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ef2c168f7b4d969663dc1ed93f01785a68c36dd1
3,695
py
Python
cVQE/operators/converters/tensoredop_distributor.py
gblazq/cVQE
5a566103c35696ec0cf2b016c38d71de696e0e29
[ "Apache-2.0" ]
1
2021-09-16T12:43:21.000Z
2021-09-16T12:43:21.000Z
cVQE/operators/converters/tensoredop_distributor.py
gblazq/cVQE
5a566103c35696ec0cf2b016c38d71de696e0e29
[ "Apache-2.0" ]
null
null
null
cVQE/operators/converters/tensoredop_distributor.py
gblazq/cVQE
5a566103c35696ec0cf2b016c38d71de696e0e29
[ "Apache-2.0" ]
null
null
null
# Copyright 2021 Guillermo Blázquez # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from functools import reduce from qiskit.aqua.operators.converters import ConverterBase from qiskit.aqua.operators.list_ops import TensoredOp, SummedOp from qiskit.aqua.operators.primitive_ops import PauliOp class TensoredOpDistributor(ConverterBase): """ A converter that applies the distributive property of tensor products. Only works with operators that consist on TensoredOps, SummedOps or PauliOps. E.g. if op = (I - Z)^(X + 2*Y), the converter will return (I^X) + 2(I^Z) - (Z^X) - 2(Z^Y) """ #TODO: check coefficients def convert(self, operator): """ Apply the distributive property to TensoredOps. If the operator is a SummedOp, apply it to each of the summands. If it's a PauliOp, return the operator. Args: operator: the Operator to convert. Returns: the converted Operator Raises: TypeError: if the operator is not a TensoredOp, SummedOp or PauliOp """ if isinstance(operator, TensoredOp): return reduce(self._convert, operator).reduce() elif isinstance(operator, SummedOp): return SummedOp([self.convert(op) for op in operator], coeff=operator.coeff).reduce() elif isinstance(operator, PauliOp): return operator else: raise TypeError('TensoredOpDistributor can only distribute TensoredOps, SummedOps or PauliOps') def _convert(self, op1, op2): """ Distribute the tensor product over two operands in a TensoredOp Args: op1: the first operator in the tensor product op2: the second operator in the tensor product Returns: the result of op1^op2, distributing the tensor product if possible Raises: TypeError: if any of the two operators is not a TensoredOp, SummedOp or PauliOp """ if isinstance(op1, PauliOp) and isinstance(op2, PauliOp): return op1^op2 elif (isinstance(op1, PauliOp) or isinstance(op1, TensoredOp)) and isinstance(op2, SummedOp): return SummedOp([self._convert(op1, o) for o in op2.oplist], coeff=op2.coeff) elif isinstance(op1, PauliOp) and isinstance(op2, TensoredOp): return self._convert(op1, self.convert(op2)) elif isinstance(op1, SummedOp) and (isinstance(op2, PauliOp) or isinstance(op2, TensoredOp)): return SummedOp([self._convert(o, op2) for o in op1.oplist], coeff=op1.coeff) elif isinstance(op1, SummedOp) and isinstance(op2, SummedOp): return SummedOp([self._convert(o1, o2) for o1 in op1.oplist for o2 in op2.oplist]) elif isinstance(op1, TensoredOp) and isinstance(op2, PauliOp): return self._convert(self.convert(op1), op2) elif isinstance(op1, TensoredOp) and isinstance(op2, TensoredOp): return self._convert(self.convert(op1), self.convert(op2)) else: raise TypeError('TensoredOpDistributor can only distribute operators consisting on PauliOps, SummedOps or TensoredOps')
43.988095
131
0.677402
472
3,695
5.28178
0.302966
0.052948
0.044926
0.040112
0.320096
0.267549
0.209386
0.075411
0.036101
0
0
0.018962
0.243572
3,695
83
132
44.518072
0.872987
0.401894
0
0.064516
0
0
0.088221
0.021053
0
0
0
0.012048
0
1
0.064516
false
0
0.129032
0
0.548387
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
1
0
0
2
ef313c50d5c6317ec48b8b4af0c2b6702fb01991
8,027
py
Python
tests/test_core_deformation.py
matmodlab/matmodlab2
97bb858e2b625cca5f3291db5d50bdbb6352e976
[ "BSD-3-Clause" ]
6
2017-02-14T02:04:56.000Z
2022-02-03T04:53:32.000Z
tests/test_core_deformation.py
tjfulle/matmodlab2
97bb858e2b625cca5f3291db5d50bdbb6352e976
[ "BSD-3-Clause" ]
10
2017-01-21T00:00:06.000Z
2017-01-22T07:39:44.000Z
tests/test_core_deformation.py
tjfulle/matmodlab2
97bb858e2b625cca5f3291db5d50bdbb6352e976
[ "BSD-3-Clause" ]
3
2018-10-20T22:53:59.000Z
2022-01-13T07:17:24.000Z
# -*- coding: utf-8 -*- """ This file contains tests for tensor.py """ import sys import pathlib import pytest import numpy as np from testing_utils import isclose # Ensure that 'matmodlab2' is imported from parent directory. sys.path.insert(0, str(pathlib.Path(__file__).absolute().parent.parent)) import matmodlab2 import matmodlab2.core.deformation as df def vec_isclose(name, comp, gold, rtol=1.0e-12, atol=1.0e-12): print("===== {0}".format(name)) print("comp:", comp) print("gold:", gold) print("diff:", gold - comp) PASS = np.allclose(comp, gold, rtol=rtol, atol=atol) print("PASS" if PASS else "FAIL") return PASS deformation_measures_db = [ {"name": "Uniaxial Extension", "eps": np.array([0.042857142857142857143,0,0,0,0,0]), "depsdt": np.array([0.10000000000000000000,0,0,0,0,0]), "subtests": [ { "k": 2, "u": np.array([1.0419761445034553738,1.0000000000000000000,1.0000000000000000000,0,0,0]), "dudt": np.array([0.095971486993739310740,0,0,0,0,0]), "d": np.array([0.092105263157894736842,0,0,0,0,0]), }, { "k": 1, "u": np.array([1.0428571428571428571,1.0000000000000000000,1.0000000000000000000,0,0,0]), "dudt": np.array([0.10000000000000000000,0,0,0,0,0]), "d": np.array([0.095890410958904109589,0,0,0,0,0]), }, { "k": 0, "u": np.array([1.0437887715175541853,1.0000000000000000000,1.0000000000000000000,0,0,0]), "dudt": np.array([0.10437887715175541853,0,0,0,0,0]), "d": np.array([0.10000000000000000000,0,0,0,0,0]), }, { "k": -1, "u": np.array([1.0447761194029850746,1.0000000000000000000,1.0000000000000000000,0,0,0]), "dudt": np.array([0.10915571396747605257,0,0,0,0,0]), "d": np.array([0.10447761194029850746,0,0,0,0,0]), }, { "k": -2, "u": np.array([1.0458250331675944350,1.0000000000000000000,1.0000000000000000000,0,0,0]), "dudt": np.array([0.11438711300270564133,0,0,0,0,0]), "d": np.array([0.10937500000000000000,0,0,0,0,0]), }, ], }, {"name": "Uniaxial Extension with rotation", "eps": np.array([0.026196877156206737235,0.016660265700936119908,0,0.020891312403896220150,0,0]), "depsdt": np.array([-0.0045059468741139683829,0.10450594687411396838,0,0.063726469853100399588,0,0]), "subtests": [ { "k": 2, "u": np.array([1.0256583576911247384,1.0163177868123306353,1.0000000000000000000,0.020461857461098139159,0,0]), "dudt": np.array([-0.0056192451222061811013,0.10159073211594549184,0,0.061454775148472809312,0,0]), "d": np.array([-0.0066876940055755266344,0.098792957163470263477,0,0.059274595960483676859,0,0]), }, { "k": 1, "u": np.array([1.0261968771562067372,1.0166602657009361199,1.0000000000000000000,0.020891312403896220150,0,0]), "dudt": np.array([-0.0045059468741139683829,0.10450594687411396838,0,0.063726469853100399588,0,0]), "d": np.array([-0.0056693735828201687630,0.10155978454172427835,0,0.061415383576480024658,0,0]), }, { "k": 0, "u": np.array([1.0267663449262200007,1.0170224265913341846,1.0000000000000000000,0.021345447796308002806,0,0]), "dudt": np.array([-0.0032560207940279426371,0.10763489794578336117,0,0.066186651517750065998,0,0]), "d": np.array([-0.0045260401459293278687,0.10452604014592932787,0,0.063731056011271402912,0,0]), }, { "k": -1, "u": np.array([1.0273698716557383822,1.0174062477472466924,1.0000000000000000000,0.021826744302578140456,0,0]), "dudt": np.array([-0.0018481668596687927090,0.11100388082714484528,0,0.068860299997538432155,0,0]), "d": np.array([-0.0032383326989564664762,0.10771594463925497394,0,0.066244519079865882721,0,0]), }, { "k": -2, "u": np.array([1.0280110311733133167,1.0178140019942811183,1.0000000000000000000,0.022338051955872830687,0,0]), "dudt": np.array([-0.00025673980976010909772,0.11464385281246575042,0,0.071777050608761226760,0,0]), "d": np.array([-0.0017829682784827673453,0.11115796827848276735,0,0.068982906840537447349,0,0]), }, ], }, ] @pytest.mark.parametrize('a', np.linspace(0.0, 1.0e+1, 10)) @pytest.mark.parametrize('t', np.linspace(0.0, 1.0e+1, 10)) def test_deformation_measures_from_strain_uni_strain(a, t): """ Verify that we are converting from strain to D correctly. """ # Setup eps = np.array([a * t, 0.0, 0.0, 0.0, 0.0, 0.0]) depsdt = np.array([a, 0.0, 0.0, 0.0, 0.0, 0.0]) d_g = np.array([a, 0.0, 0.0, 0.0, 0.0, 0.0]) # Test d = df.rate_of_strain_to_rate_of_deformation(depsdt, eps, 0) assert vec_isclose("D", d, d_g) # Teardown pass def test_deformation_measures_from_strain_dissertation_test(): """ Verify that we are converting from strain to D correctly. """ a = 0.5 t = 0.1 # Setup (inputs) st = np.sin(np.pi * t) ct = np.cos(np.pi * t) sht = np.sinh(a * t) eat = np.exp(a * t) eps = np.array([a * t * np.cos(np.pi * t / 2.0) ** 2, a * t * np.sin(np.pi * t / 2.0) ** 2, 0.0, a * t * np.sin(np.pi * t) / 2.0, 0.0, 0.0]) depsdt = np.array([a / 2.0 * (1.0 + ct - np.pi * t * st), a / 2.0 * (1.0 - ct + np.pi * t * st), 0.0, a / 2.0 * (np.pi * t * ct + st), 0.0, 0.0]) # Setup (expected outputs) d_g = np.array([(a + a * ct - np.pi * st * sht) / 2.0, (a - a * ct + np.pi * st * sht) / 2.0, 0.0, (a * st + np.pi * ct * sht) / 2.0, 0.0, 0.0]) # Test d = df.rate_of_strain_to_rate_of_deformation(depsdt, eps, 0) assert vec_isclose("D", d, d_g) # Teardown pass def test_deformation_measures_from_strain_dissertation_static(): """ Verify that we are converting from strain to D correctly. """ # Setup (inputs) eps=np.array([2.6634453918413015230,0.13875241035650067478,0,0.60791403008229297100,0,0]) depsdt=np.array([-0.66687706806142212351,1.9745693757537298158,0,4.2494716756395844993,0,0]) # Setup (expected outputs) d_g=np.array([-4.3525785227788080461,5.6602708304711157384,0,11.902909607738023219,0,0]) # Test d = df.rate_of_strain_to_rate_of_deformation(depsdt, eps, 0) assert vec_isclose("D", d, d_g) # Teardown pass @pytest.mark.parametrize('db', deformation_measures_db) @pytest.mark.parametrize('idx', [0, 1, 2, 3, 4]) def test_deformation_measures_from_strain_db(db, idx): """ Test the deformation measures for various values of kappa. """ # Setup (inputs) kappa = db['subtests'][idx]['k'] print("Test name, kappa: {0}, {1}".format(db['name'], kappa)) eps = db['eps'] depsdt = db['depsdt'] # Setup (expected outputs) d_g = db['subtests'][idx]['d'] print("kappa=", kappa) # Test d = df.rate_of_strain_to_rate_of_deformation(depsdt, eps, kappa) assert vec_isclose("D", d, d_g) # Teardown pass def test_scalar_volume_strain_to_tensor(): ev = 1. kappa = 0 e = df.scalar_volume_strain_to_tensor(ev, kappa) assert isclose(np.sum(e[:3]), ev) kappa = 1 e = df.scalar_volume_strain_to_tensor(ev, kappa) eij = ((kappa * ev + 1.) ** (1. / 3.) - 1.) / kappa assert isclose(e[0], eij) kappa = -2 try: e = df.scalar_volume_strain_to_tensor(ev, kappa) raise Exception('Expected ValueError') except ValueError as e: assert e.args[0] == '1 + kappa * ev must be positive'
38.042654
123
0.590133
1,068
8,027
4.354869
0.188202
0.058052
0.047732
0.043002
0.431735
0.414104
0.359063
0.359063
0.332187
0.239303
0
0.364341
0.244674
8,027
210
124
38.22381
0.402771
0.067148
0
0.21519
0
0
0.042794
0
0
0
0
0
0.044304
1
0.037975
false
0.044304
0.044304
0
0.088608
0.044304
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ef377a0c8139bd037fffc10567802d319f904716
1,104
py
Python
Hackerrank/Python/class-1-dealing-with-complex-numbers.py
PROxZIMA/Competitive-Coding
ba6b365ea130b6fcaa15c5537b530ed363bab793
[ "MIT" ]
1
2021-01-10T13:29:21.000Z
2021-01-10T13:29:21.000Z
Hackerrank/Python/class-1-dealing-with-complex-numbers.py
PROxZIMA/Competitive-Coding
ba6b365ea130b6fcaa15c5537b530ed363bab793
[ "MIT" ]
null
null
null
Hackerrank/Python/class-1-dealing-with-complex-numbers.py
PROxZIMA/Competitive-Coding
ba6b365ea130b6fcaa15c5537b530ed363bab793
[ "MIT" ]
null
null
null
import math class Complex(object): def __init__(self, real, imaginary): self.real = real self.imaginary = imaginary def __add__(self, no): return (Complex(self.real + no.real, self.imaginary + no.imaginary)) def __sub__(self, no): return (Complex(self.real - no.real, self.imaginary - no.imaginary)) def __mul__(self, no): return (Complex(self.real * no.real - self.imaginary * no.imaginary, self.real * no.imaginary + self.imaginary * no.real)) def __truediv__(self, no): product = self * Complex(no.real, -no.imaginary) sq = no.real**2 + no.imaginary**2 return (Complex(product.real/sq, product.imaginary/sq)) def mod(self): return (Complex((self.real**2 + self.imaginary**2)**0.5, 0)) def __str__(self): return f'{self.real:.2f}{self.imaginary:+.2f}i' if __name__ == '__main__': c = map(float, input().split()) d = map(float, input().split()) x = Complex(*c) y = Complex(*d) print(*map(str, [x+y, x-y, x*y, x/y, x.mod(), y.mod()]), sep='\n')
33.454545
130
0.588768
154
1,104
4.012987
0.25974
0.10356
0.110032
0.135922
0.300971
0.300971
0.300971
0.286408
0.286408
0.286408
0
0.010727
0.240036
1,104
33
131
33.454545
0.725864
0
0
0
0
0
0.042534
0.033484
0
0
0
0
0
1
0.28
false
0
0.04
0.2
0.6
0.04
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
ef3f29141380c4970504779ca0adbe37edfcc48e
377
py
Python
lang/Python/abstract-type-2.py
ethansaxenian/RosettaDecode
8ea1a42a5f792280b50193ad47545d14ee371fb7
[ "MIT" ]
null
null
null
lang/Python/abstract-type-2.py
ethansaxenian/RosettaDecode
8ea1a42a5f792280b50193ad47545d14ee371fb7
[ "MIT" ]
null
null
null
lang/Python/abstract-type-2.py
ethansaxenian/RosettaDecode
8ea1a42a5f792280b50193ad47545d14ee371fb7
[ "MIT" ]
null
null
null
from abc import ABCMeta, abstractmethod class BaseQueue(metaclass=ABCMeta): """Abstract Class """ def __init__(self): self.contents = list() @abstractmethod def Enqueue(self, item): pass @abstractmethod def Dequeue(self): pass def Print_Contents(self): for i in self.contents: print(i, end=' ')
17.136364
39
0.594164
40
377
5.475
0.575
0.109589
0
0
0
0
0
0
0
0
0
0
0.30504
377
21
40
17.952381
0.835878
0.037135
0
0.307692
0
0
0.002841
0
0
0
0
0
0
1
0.307692
false
0.153846
0.076923
0
0.461538
0.076923
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
ef519f677beac77f2c2e144f66d4be64d1cbd341
200
py
Python
main.py
Gabriel-ino/Automated-Sticker-Hero
d76952cc35f051b7d9562912f0a063fed6f75068
[ "MIT" ]
null
null
null
main.py
Gabriel-ino/Automated-Sticker-Hero
d76952cc35f051b7d9562912f0a063fed6f75068
[ "MIT" ]
null
null
null
main.py
Gabriel-ino/Automated-Sticker-Hero
d76952cc35f051b7d9562912f0a063fed6f75068
[ "MIT" ]
null
null
null
from App import App from utils.get_screen_size import get_screen_size if __name__ == "__main__": app = App() h, w, ch = get_screen_size() while True: app.proccessing(h, w, ch)
16.666667
49
0.655
31
200
3.774194
0.516129
0.230769
0.333333
0
0
0
0
0
0
0
0
0
0.245
200
11
50
18.181818
0.774834
0
0
0
0
0
0.040404
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ef51f52103e4f12bc37feb84f6d66527017f0c6d
1,836
py
Python
dgp/core/config_validators.py
dataspot/dgp
553a255a4884b935cf2efecdc761050232f0f066
[ "MIT" ]
1
2019-07-17T11:34:27.000Z
2019-07-17T11:34:27.000Z
dgp/core/config_validators.py
datahq/dgp
f39592ce20ba67b73b08188f14585b6eb3d43f96
[ "MIT" ]
2
2019-04-30T12:32:32.000Z
2019-04-30T12:35:26.000Z
dgp/core/config_validators.py
dataspot/dgp
553a255a4884b935cf2efecdc761050232f0f066
[ "MIT" ]
null
null
null
class BaseValidator(): MISSING = 0 INVALID = 1 def check(self, config): raise NotImplementedError() class Validator(BaseValidator): def __init__(self, *validators): self._validators = validators def check(self, config): errors = [] for validator in self._validators: errors.extend(validator.check(config)) return errors class ConfigValidationError(): def __init__(self, code, key, **kw): self.code = code self.key = key self.options = kw def __str__(self): if self.code == BaseValidator.MISSING: return 'Missing configuration: {} ({})'.format(self.options.get('description') or self.key, self.key) elif self.code == BaseValidator.INVALID: return 'Invalid configuration: {}'.format(self.options.get('description') or self.key) def __iter__(self): return iter((self.code, self.key, self.options)) class Required(BaseValidator): def __init__(self, key, description=None): self.key = key self.description = description def check(self, config): if self.key in config: return [] else: return [ConfigValidationError(self.MISSING, self.key, description=self.description)] class Empty(BaseValidator): def __init__(self, key, description=None): self.key = key self.description = description def check(self, config): if self.key in config: if not config[self.key]: return [] else: return [ConfigValidationError(self.INVALID, self.key, description=self.description)] else: return [ConfigValidationError(self.MISSING, self.key, description=self.description)]
27.402985
113
0.606209
189
1,836
5.751323
0.206349
0.096596
0.082797
0.066237
0.517019
0.443422
0.443422
0.443422
0.443422
0.345906
0
0.001531
0.288671
1,836
66
114
27.818182
0.830781
0
0
0.416667
0
0
0.041939
0
0
0
0
0
0
1
0.208333
false
0
0
0.020833
0.541667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
322da51e0820f1bb72e55d0a9cb187b9bcde3c32
223
py
Python
LandingPage/forms.py
Mihai925/EduCoding-Legacy
7c6de105deb186c3442f8d7f9f1b9f99708f8fb6
[ "MIT" ]
null
null
null
LandingPage/forms.py
Mihai925/EduCoding-Legacy
7c6de105deb186c3442f8d7f9f1b9f99708f8fb6
[ "MIT" ]
null
null
null
LandingPage/forms.py
Mihai925/EduCoding-Legacy
7c6de105deb186c3442f8d7f9f1b9f99708f8fb6
[ "MIT" ]
null
null
null
__author__ = 'varun' from django import forms class ContactUsForm(forms.Form): name = forms.CharField() email = forms.CharField() phone = forms.CharField() message = forms.CharField(widget=forms.Textarea)
22.3
52
0.713004
25
223
6.2
0.64
0.36129
0
0
0
0
0
0
0
0
0
0
0.174888
223
10
52
22.3
0.842391
0
0
0
0
0
0.022321
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.857143
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
32305cc75fdcf32a5f4bd15262b34af9e4f413d5
384
py
Python
api/tests/test_app.py
guyskk/purepage
64e2180b751e787f9fe477f9b212b31c84d34cfb
[ "MIT" ]
13
2016-05-03T07:56:43.000Z
2019-08-03T05:58:58.000Z
api/tests/test_app.py
guyskk/purepage
64e2180b751e787f9fe477f9b212b31c84d34cfb
[ "MIT" ]
null
null
null
api/tests/test_app.py
guyskk/purepage
64e2180b751e787f9fe477f9b212b31c84d34cfb
[ "MIT" ]
3
2016-06-04T12:49:34.000Z
2019-04-24T08:51:34.000Z
def test_client(client): assert client.get("/").status_code == 200 def test_root(root): me = root.user.get_me() assert me["id"] == "root" assert me["role"] == "root" def test_user(user): res = user("guyskk", email="[email protected]") me = res.user.get_me() assert me["id"] == "guyskk" assert me["role"] == "normal" assert "email" not in me
21.333333
53
0.596354
56
384
3.982143
0.375
0.143498
0.080717
0.134529
0.170404
0.170404
0
0
0
0
0
0.009934
0.213542
384
17
54
22.588235
0.728477
0
0
0
0
0
0.164491
0
0
0
0
0
0.5
1
0.25
false
0
0
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
1
0
0
0
0
0
0
0
2
32316e929a4d5ae59c28e0cfefeaa04b18e91623
1,017
py
Python
authApp/views/userDetailView.py
juan-skill/django_vue_bank
109f3b84086f4520a5220c311d9d3403a7adc3a2
[ "MIT" ]
null
null
null
authApp/views/userDetailView.py
juan-skill/django_vue_bank
109f3b84086f4520a5220c311d9d3403a7adc3a2
[ "MIT" ]
null
null
null
authApp/views/userDetailView.py
juan-skill/django_vue_bank
109f3b84086f4520a5220c311d9d3403a7adc3a2
[ "MIT" ]
null
null
null
from django.conf import settings from rest_framework import generics, status from rest_framework.response import Response from rest_framework_simplejwt.backends import TokenBackend from rest_framework.permissions import IsAuthenticated from authApp.models.user import User from authApp.serializers.userSerializer import UserSerializer class UserDetailView(generics.RetrieveAPIView): queryset = User.objects.all() serializer_class = UserSerializer permission_classes = (IsAuthenticated,) def get(self, request, *args, **kwargs): token = request.META.get('HTTP_AUTHORIZATION')[7:] tokenBackend = TokenBackend(algorithm=settings.SIMPLE_JWT['ALGORITHM']) valid_data = tokenBackend.decode(token,verify=False) if valid_data['user_id'] != kwargs['pk']: stringResponse = {'detail':'Unauthorized Request'} return Response(stringResponse, status=status.HTTP_401_UNAUTHORIZED) return super().get(request, *args, **kwargs)
39.115385
80
0.738446
108
1,017
6.824074
0.527778
0.043419
0.092266
0
0
0
0
0
0
0
0
0.004751
0.172075
1,017
25
81
40.68
0.870546
0
0
0
0
0
0.060964
0
0
0
0
0
0
1
0.052632
false
0
0.368421
0
0.736842
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
325ca5543e9808ec6039d4cf69192bb2bde47b8f
522
py
Python
tests/core/resource_test_base.py
alteia-ai/alteia-python-sdk
27ec7458334334ed6a1edae52cb25d5ce8734177
[ "MIT" ]
11
2020-12-22T14:39:21.000Z
2022-02-18T16:34:34.000Z
tests/core/resource_test_base.py
alteia-ai/alteia-python-sdk
27ec7458334334ed6a1edae52cb25d5ce8734177
[ "MIT" ]
1
2021-08-05T14:21:12.000Z
2021-08-09T13:22:55.000Z
tests/core/resource_test_base.py
alteia-ai/alteia-python-sdk
27ec7458334334ed6a1edae52cb25d5ce8734177
[ "MIT" ]
null
null
null
import os from unittest.mock import patch import alteia from tests.alteiatest import AlteiaTestBase class ResourcesTestBase(AlteiaTestBase): @classmethod def setUpClass(cls): with patch('alteia.core.connection.token.TokenManager.renew_token') as mock: mock.return_value = None cls.sdk = alteia.SDK(config_path=cls.get_absolute_path("./config-test.json")) @staticmethod def get_absolute_path(file_path): return os.path.join(os.path.dirname(__file__), file_path)
27.473684
89
0.726054
66
522
5.545455
0.560606
0.060109
0.081967
0
0
0
0
0
0
0
0
0
0.180077
522
18
90
29
0.85514
0
0
0
0
0
0.136015
0.101533
0
0
0
0
0
1
0.153846
false
0
0.307692
0.076923
0.615385
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
32664ad5a10d717905dcb559f04579027da2c523
268
py
Python
Python/InvertTree.py
lywc20/daily-programming
78529e535aea5bda409e5a2a009274dca7011e29
[ "MIT" ]
null
null
null
Python/InvertTree.py
lywc20/daily-programming
78529e535aea5bda409e5a2a009274dca7011e29
[ "MIT" ]
null
null
null
Python/InvertTree.py
lywc20/daily-programming
78529e535aea5bda409e5a2a009274dca7011e29
[ "MIT" ]
null
null
null
class TreeNode: def __init__(self,val): self.left = None self.right = None self.val = None def invertTree(self,root): if root: root.left, root.right = self.invertTree(root.right), self.invertTree(root.left) return root
24.363636
87
0.619403
35
268
4.628571
0.371429
0.08642
0.160494
0.283951
0.308642
0
0
0
0
0
0
0
0.272388
268
10
88
26.8
0.830769
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0
0
0.444444
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
3266f7d31cc045815dafabe76a68d2f3cebde4da
6,843
py
Python
cadence/apps/backend/views.py
BitLooter/Cadence
3adbe51f042120f7154711a58a614ce0e8b3664b
[ "BSD-2-Clause" ]
null
null
null
cadence/apps/backend/views.py
BitLooter/Cadence
3adbe51f042120f7154711a58a614ce0e8b3664b
[ "BSD-2-Clause" ]
null
null
null
cadence/apps/backend/views.py
BitLooter/Cadence
3adbe51f042120f7154711a58a614ce0e8b3664b
[ "BSD-2-Clause" ]
null
null
null
import json import logging from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotFound from django.core.exceptions import ObjectDoesNotExist from django.views.decorators.csrf import csrf_exempt # See note below on saveplaylist import models # Set up logging logger = logging.getLogger("apps") # View function decorators ########################## def log_request(f): """Records request info to the log file""" def wrapper(*args, **kwargs): request = args[0] # Display simpler message if there are no view parameters if kwargs == {}: message = "{} request from {}".format(f.__name__, request.get_host()) elif "item_id" in kwargs: message = "{} (#{}) request from {}".format(f.__name__, kwargs["item_id"], request.get_host()) else: message = "{} {} request from {}".format(f.__name__, repr(kwargs), request.get_host()) logger.info(message) return f(*args, **kwargs) wrapper.__doc__ = f.__doc__ return wrapper def handle_not_found(f): """ For views that request a specific object (e.g. a playlist), return a 404 page and log an error if the object was not found. Assumes the object being looked for is passed as a kwarg named 'item_id'. If this view does not fit this pattern, you will not be able to handle 404 errors for it with this decorator. """ def wrapper(*args, **kwargs): try: return f(*args, **kwargs) except ObjectDoesNotExist as e: print e.message error = "{} (#{})".format(e.message, kwargs["item_id"]) logger.error(error) return HttpResponseNotFound(error, mimetype="text/plain") wrapper.__doc__ = f.__doc__ return wrapper # View functions ################ #TODO: check for external errors like database access problems def playlists(request): """ Generic view for /data/playlists/, choosing a view function for the request type. Saves a playlist or returns a list of them, depending on request type. A GET request will return a list of available playlists in JSON format; a POST request saves a new playlist to the server, using the POST data (also in JSON format). Does not actually do anything itself, but rather calls the correct function for the task. """ # If POST, we're saving a playlist if request.method == "POST": return saveplaylist(request) # Otherwise, default behavior is to return a list of playlists else: return playlistlist(request) @log_request def playlistlist(request): """View method for list of playlists. Returns list of playlists in JSON.""" lists = models.Playlist.getPlaylistList() return json_response(lists) @log_request def saveplaylist(request): """ View method for saving a playlist (POST). Saves a new playlist to the database. Data is in JSON format, and is expected to take the form of a dict with 'name' and 'tracks' fields, name being a string and tracks being a list of track IDs. Example:: { "name": "Top ten Tuvian throat singing rap singles" "tracks": [553, 1490, 6643, 1186, 6689, 91, 642, 11, 853, 321] } """ try: info = json.loads(request.raw_post_data) except ValueError: response = HttpResponseBadRequest("Error: POST data is not valid JSON", mimetype="text/plain") logger.exception("Not saving playlist from {}, invalid JSON in request - POST data: '{}'".format(request.get_host(), request.raw_post_data)) else: # Sanity check on the data - name is a (unicode) string, tracks are all integers if "name" not in info or "tracks" not in info: logger.debug("data check") response = HttpResponseBadRequest("Error: Not enough parameters were passed", mimetype="text/plain") logger.error("Not saving playlist from {}, not enough information given - POST data: '{}'".format(request.get_host(), request.raw_post_data)) elif (type(info["name"]) != unicode) or not (all(type(t) == int for t in info["tracks"])): response = HttpResponseBadRequest("Error: Given data is invalid", mimetype="text/plain") logger.error("Not saving playlist from {}, given data is invalid - POST data: '{}'".format(request.get_host(), request.raw_post_data)) else: newID = models.Playlist.savePlaylist(info["tracks"], info["name"]) # TODO: return information about the new playlist response = HttpResponse(json.dumps("Playlist saved to {}".format(info["name"])), status=201, mimetype="text/plain") response["Location"] = "/cadence/data/playlist/{}/".format(newID) logger.info("Playlist from {} successfully saved as #{}".format(request.get_host(), newID)) return response @handle_not_found @log_request def playlist_tracks(request, item_id): """View method for playlist tracklist. Returns playlist matching ID.""" return json_response(models.Playlist.getPlaylist(item_id)) @log_request def media(request): """ View method for all media. Returns information on every track in the library. Note that for very large libraries, this could produce a great amount of data and load slowly on the client (not to mention "Holy crap Frank, how'd we go over our data limit again this month?"). Therefore, this view may be disabled depending on the current site settings. """ return json_response(models.Media.getFullLibrary()) @handle_not_found @log_request def media_details(request, item_id): """View method for details on a specific media item""" return json_response(models.Media.getDetails(item_id)) @log_request def albums(request): """View method for albums list. Returns list of albums in the library.""" return json_response(models.Album.getAlbums()) @handle_not_found @log_request def album_tracks(request, item_id): """View method for album tracklist. Returns media for album matching ID.""" return json_response(models.Album.getAlbumTracks(item_id)) @log_request def artists(request): """View method for artists list. Returns list of artists in the library.""" return json_response(models.Artist.getArtists()) @handle_not_found @log_request def artist_tracks(request, item_id): """View method for artist tracklist. Returns media for artist matching ID.""" return json_response(models.Artist.getArtistTracks(item_id)) # Utility methods ################# def json_response(output): """Returns an HTTP Response with the data in output as the content in JSON format""" return HttpResponse(json.dumps(output), mimetype="application/json")
34.736041
153
0.672366
900
6,843
5.013333
0.282222
0.015957
0.025931
0.037234
0.217642
0.187278
0.106826
0.054078
0.054078
0.032358
0
0.007874
0.220517
6,843
196
154
34.913265
0.83802
0.064153
0
0.306818
0
0
0.152094
0.006368
0
0
0
0.010204
0
0
null
null
0.011364
0.068182
null
null
0.011364
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
3272a27a8fc6fa3c964e19b20bd692f8755a0dee
6,151
py
Python
tests/models.py
intellineers/django-bridger
ed097984a99df7da40a4d01bd00c56e3c6083056
[ "BSD-3-Clause" ]
2
2020-03-17T00:53:23.000Z
2020-07-16T07:00:33.000Z
tests/models.py
intellineers/django-bridger
ed097984a99df7da40a4d01bd00c56e3c6083056
[ "BSD-3-Clause" ]
76
2019-12-05T01:15:57.000Z
2021-09-07T16:47:27.000Z
tests/models.py
intellineers/django-bridger
ed097984a99df7da40a4d01bd00c56e3c6083056
[ "BSD-3-Clause" ]
1
2020-02-05T15:09:47.000Z
2020-02-05T15:09:47.000Z
from datetime import date, time from django.contrib.postgres.fields import ArrayField from django.db import models from django.utils import timezone from django_fsm import FSMField, transition from rest_framework.reverse import reverse from simple_history.models import HistoricalRecords from bridger.buttons import ActionButton from bridger.display import FieldSet, InstanceDisplay, Section from bridger.enums import RequestType from bridger.search import register as search_register from bridger.tags import TagModelMixin @search_register(endpoint="modeltest-list") class ModelTest(TagModelMixin, models.Model): @classmethod def search_for_term(cls, search_term, request=None): return ( cls.objects.all() .annotate( _search=models.functions.Concat( models.F("char_field"), models.Value(" "), models.F("text_field"), output_field=models.CharField(), ) ) .annotate(_repr=models.F("char_field")) ) STATUS1 = "status1" STATUS2 = "status2" STATUS3 = "status3" status_choices = ((STATUS1, "Status1"), (STATUS2, "Status2"), (STATUS3, "Status3")) MOVE_BUTTON1 = ActionButton( method=RequestType.PATCH, icon="wb-icon-thumbs-up-full", key="move1", label="Move1", action_label="Move1", description_fields="<p>We will move1 this model.</p>", instance_display=InstanceDisplay(sections=( Section(fields=FieldSet(fields=("char_field", "integer_field"))),) ), identifiers=("tests:modeltest",), ) MOVE_BUTTON2 = ActionButton( method=RequestType.PATCH, icon="wb-icon-thumbs-up-full", key="move2", label="Move2", action_label="Move2", description_fields="<p>We will move2 this model.</p>", instance_display=InstanceDisplay(sections=( Section(fields=FieldSet(fields=("char_field", "integer_field"))),) ), identifiers=("tests:modeltest",), ) # Text char_field = models.CharField(max_length=255, verbose_name="Char", help_text="This is the help text of a char field.",) text_field = models.TextField(null=True, blank=True) # Numbers integer_field = models.IntegerField(verbose_name="Integer") float_field = models.FloatField() decimal_field = models.DecimalField(decimal_places=4, max_digits=7) percent_field = models.FloatField() # Date and Time datetime_field = models.DateTimeField(verbose_name="DateTime") datetime_field1 = models.DateTimeField(verbose_name="DateTime 1") date_field = models.DateField() time_field = models.TimeField() # Boolean boolean_field = models.BooleanField() star_rating = models.PositiveIntegerField() # Choice choice_field = models.CharField(max_length=64, choices=(("a", "A"), ("b", "B")), default="a") # Status status_field = FSMField(default=STATUS1, choices=status_choices, verbose_name="Status") # Files image_field = models.ImageField(null=True, blank=True) file_field = models.FileField(null=True, blank=True) history = HistoricalRecords() def get_tag_detail_endpoint(self): return reverse("modeltest-detail", args=[self.id]) def get_tag_representation(self): return self.char_field @transition( field=status_field, source=[STATUS1], target=STATUS2, custom={"_transition_button": MOVE_BUTTON1}, ) def move1(self): """Moves the model from Status1 to Status2""" pass @transition( field=status_field, source=[STATUS1, STATUS2], target=STATUS3, custom={"_transition_button": MOVE_BUTTON2}, ) def move2(self): """Moves the model from Status1 or Status2 to Status3""" pass @classmethod def get_endpoint_basename(cls): return "modeltest" @classmethod def get_endpoint(cls): return "modeltest-list" @classmethod def get_representation_endpoint(cls): return "modeltestrepresentation-list" @classmethod def get_representation_value_key(cls): return "id" @classmethod def get_representation_label_key(cls): return "{{char_field}}" class Meta: verbose_name = "Test Model" verbose_name_plural = "Test Models" @search_register(endpoint="relatedmodeltest-list") class RelatedModelTest(TagModelMixin, models.Model): @classmethod def search_for_term(cls, request=None): return cls.objects.all().annotate(_search=models.F("char_field")).annotate(_repr=models.F("char_field")) text_json = models.JSONField(default=list, blank=True, null=True) text_markdown = models.TextField(default="") model_test = models.ForeignKey( to="tests.ModelTest", related_name="related_models", null=True, blank=True, on_delete=models.CASCADE, verbose_name="Model Test", ) model_tests = models.ManyToManyField( to="tests.ModelTest", related_name="related_models_m2m", blank=True, verbose_name="Model Tests1", ) char_field = models.CharField(max_length=255, verbose_name="Char") list_field = ArrayField(base_field=models.CharField(max_length=255), null=True, blank=True, default=list) history = HistoricalRecords() def get_tag_detail_endpoint(self): return reverse("relatedmodeltest-detail", args=[self.id]) def get_tag_representation(self): return self.char_field def __str__(self): return self.char_field @property def upper_char_field(self): return self.char_field.upper() @classmethod def get_endpoint_basename(cls): return "relatedmodeltest" @classmethod def get_representation_endpoint(cls): return "relatedmodeltestrepresentation-list" @classmethod def get_representation_value_key(cls): return "id" @classmethod def get_representation_label_key(cls): return "{{char_field}}" class Meta: verbose_name = "Related Model Test" verbose_name_plural = "Related Model Tests"
31.22335
123
0.677451
691
6,151
5.833575
0.253256
0.04639
0.037956
0.046142
0.484495
0.434135
0.358224
0.293724
0.293724
0.242124
0
0.011139
0.211835
6,151
196
124
31.382653
0.820338
0.023736
0
0.340136
0
0
0.129426
0.025217
0
0
0
0
0
1
0.129252
false
0.013605
0.081633
0.115646
0.557823
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
329e532aeccbe51ed3829d6a07920bf7c69171ef
602
py
Python
Python OOP/Exams/23 August 2021/1, 2/project/astronaut/astronaut_repository.py
a-shiro/SoftUni-Courses
7d0ca6401017a28b5ff7e7fa3e5df8bba8ddbe77
[ "MIT" ]
null
null
null
Python OOP/Exams/23 August 2021/1, 2/project/astronaut/astronaut_repository.py
a-shiro/SoftUni-Courses
7d0ca6401017a28b5ff7e7fa3e5df8bba8ddbe77
[ "MIT" ]
null
null
null
Python OOP/Exams/23 August 2021/1, 2/project/astronaut/astronaut_repository.py
a-shiro/SoftUni-Courses
7d0ca6401017a28b5ff7e7fa3e5df8bba8ddbe77
[ "MIT" ]
null
null
null
class AstronautRepository: def __init__(self): self.astronauts = [] def add(self, astronaut): self.astronauts.append(astronaut) def remove(self, astronaut): self.astronauts.remove(astronaut) def find_by_name(self, name: str): for astronaut in self.astronauts: if astronaut.name == name: return astronaut def find_suited_astronauts(self): return sorted([astronaut for astronaut in self.astronauts if astronaut.oxygen > 30], key=lambda x: x.oxygen, reverse=True)[0:5]
30.1
92
0.609635
67
602
5.358209
0.432836
0.194986
0.094708
0.150418
0.21727
0.21727
0.21727
0
0
0
0
0.009501
0.300664
602
19
93
31.684211
0.84323
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.066667
0.533333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
32b0d4c387e53daeda7939c3bdfe5d3e18cb6dbb
210
py
Python
setup.py
cogsy23/pyfsm
22236994f7455a39489d1438b7c8bbcd081352be
[ "MIT" ]
null
null
null
setup.py
cogsy23/pyfsm
22236994f7455a39489d1438b7c8bbcd081352be
[ "MIT" ]
null
null
null
setup.py
cogsy23/pyfsm
22236994f7455a39489d1438b7c8bbcd081352be
[ "MIT" ]
null
null
null
from setuptools import setup, find_packages setup( name='FSM', version='0.1', author='Ben Coughlan', author_email='[email protected]', packages=find_packages(), license_file='LICENSE', )
19.090909
43
0.666667
27
210
5.037037
0.740741
0.176471
0
0
0
0
0
0
0
0
0
0.011696
0.185714
210
10
44
21
0.783626
0
0
0
0
0
0.190476
0
0
0
0
0
0
1
0
true
0
0.111111
0
0.111111
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
32c012e2243ac30d8702a0e4c7e1a09c458c9ec8
12,819
py
Python
pysnmp/HUAWEI-CDP-COMPLIANCE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/HUAWEI-CDP-COMPLIANCE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/HUAWEI-CDP-COMPLIANCE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module HUAWEI-CDP-COMPLIANCE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-CDP-COMPLIANCE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:31:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint") hwDatacomm, = mibBuilder.importSymbols("HUAWEI-MIB", "hwDatacomm") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") EnabledStatus, = mibBuilder.importSymbols("P-BRIDGE-MIB", "EnabledStatus") ZeroBasedCounter32, TimeFilter = mibBuilder.importSymbols("RMON2-MIB", "ZeroBasedCounter32", "TimeFilter") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Unsigned32, TimeTicks, Counter32, IpAddress, iso, NotificationType, ObjectIdentity, ModuleIdentity, Counter64, Bits, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "TimeTicks", "Counter32", "IpAddress", "iso", "NotificationType", "ObjectIdentity", "ModuleIdentity", "Counter64", "Bits", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "Integer32") TextualConvention, TruthValue, TimeStamp, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "TimeStamp", "DisplayString") hwCdpComplianceMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198)) if mibBuilder.loadTexts: hwCdpComplianceMIB.setLastUpdated('200905050000Z') if mibBuilder.loadTexts: hwCdpComplianceMIB.setOrganization('Huawei Technologies co.,Ltd.') hwCdpComplianceObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1)) hwCdpComplianceNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 2)) hwCdpComplianceConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 3)) hwCdpComplianceConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1)) hwCdpComplianceStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 2)) hwCdpComplianceRemoteSystemsData = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 3)) hwCdpComplianceEnable = MibScalar((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1, 1), EnabledStatus().clone()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwCdpComplianceEnable.setStatus('current') hwCdpComplianceNotificationInterval = MibScalar((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10)).clone(5)).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: hwCdpComplianceNotificationInterval.setStatus('current') hwCdpCompliancePortConfigTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1, 3), ) if mibBuilder.loadTexts: hwCdpCompliancePortConfigTable.setStatus('current') hwCdpCompliancePortConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1, 3, 1), ).setIndexNames((0, "HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpCompliancePortConfigIfIndex")) if mibBuilder.loadTexts: hwCdpCompliancePortConfigEntry.setStatus('current') hwCdpCompliancePortConfigIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1, 3, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: hwCdpCompliancePortConfigIfIndex.setStatus('current') hwCdpCompliancePortConfigAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("rxOnly", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwCdpCompliancePortConfigAdminStatus.setStatus('current') hwCdpCompliancePortConfigHoldTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1, 3, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 254)).clone(180)).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: hwCdpCompliancePortConfigHoldTime.setStatus('current') hwCdpCompliancePortConfigNotificationEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1, 3, 1, 4), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwCdpCompliancePortConfigNotificationEnable.setStatus('current') hwCdpCompliancePortStatsReset = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 1, 3, 1, 5), EnabledStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwCdpCompliancePortStatsReset.setStatus('current') hwCdpComplianceStatsRemTablesLastChangeTime = MibScalar((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 2, 1), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: hwCdpComplianceStatsRemTablesLastChangeTime.setStatus('current') hwCdpComplianceStatsRemTablesAgeouts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 2, 2), ZeroBasedCounter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hwCdpComplianceStatsRemTablesAgeouts.setStatus('current') hwCdpComplianceStatsRxPortTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 2, 3), ) if mibBuilder.loadTexts: hwCdpComplianceStatsRxPortTable.setStatus('current') hwCdpComplianceStatsRxPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 2, 3, 1), ).setIndexNames((0, "HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceStatsRxPortIfIndex")) if mibBuilder.loadTexts: hwCdpComplianceStatsRxPortEntry.setStatus('current') hwCdpComplianceStatsRxPortIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 2, 3, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: hwCdpComplianceStatsRxPortIfIndex.setStatus('current') hwCdpComplianceStatsRxPortFramesTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 2, 3, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hwCdpComplianceStatsRxPortFramesTotal.setStatus('current') hwCdpComplianceStatsRxPortAgeoutsTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 2, 3, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hwCdpComplianceStatsRxPortAgeoutsTotal.setStatus('current') hwCdpComplianceRemoteTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 3, 1), ) if mibBuilder.loadTexts: hwCdpComplianceRemoteTable.setStatus('current') hwCdpComplianceRemoteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 3, 1, 1), ).setIndexNames((0, "HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceRemLocalPortIfIndex")) if mibBuilder.loadTexts: hwCdpComplianceRemoteEntry.setStatus('current') hwCdpComplianceRemLocalPortIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 3, 1, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: hwCdpComplianceRemLocalPortIfIndex.setStatus('current') hwCdpComplianceRemTimeMark = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 3, 1, 1, 2), TimeFilter()).setMaxAccess("readonly") if mibBuilder.loadTexts: hwCdpComplianceRemTimeMark.setStatus('current') hwCdpComplianceRemoteInfo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 1, 3, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1600))).setMaxAccess("readonly") if mibBuilder.loadTexts: hwCdpComplianceRemoteInfo.setStatus('current') hwCdpComplianceNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 2, 1)) hwCdpComplianceRemTablesChange = NotificationType((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 2, 1, 1)).setObjects(("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceStatsRemTablesLastChangeTime"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceStatsRemTablesAgeouts")) if mibBuilder.loadTexts: hwCdpComplianceRemTablesChange.setStatus('current') hwCdpComplianceCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 3, 1)) hwCdpComplianceGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 3, 2)) hwCdpComplianceCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 3, 1, 1)).setObjects(("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceConfigGroup"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceStatsGroup"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceRemSysGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hwCdpComplianceCompliance = hwCdpComplianceCompliance.setStatus('current') hwCdpComplianceConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 3, 2, 1)).setObjects(("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceEnable"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceNotificationInterval"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpCompliancePortConfigAdminStatus"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpCompliancePortConfigHoldTime"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpCompliancePortConfigNotificationEnable")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hwCdpComplianceConfigGroup = hwCdpComplianceConfigGroup.setStatus('current') hwCdpComplianceStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 3, 2, 2)).setObjects(("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceStatsRxPortFramesTotal"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpCompliancePortStatsReset"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceStatsRemTablesLastChangeTime"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceStatsRemTablesAgeouts"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceStatsRxPortAgeoutsTotal")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hwCdpComplianceStatsGroup = hwCdpComplianceStatsGroup.setStatus('current') hwCdpComplianceRemSysGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 3, 2, 3)).setObjects(("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceRemoteInfo"), ("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceRemTimeMark")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hwCdpComplianceRemSysGroup = hwCdpComplianceRemSysGroup.setStatus('current') hwCdpComplianceTrapGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 198, 3, 2, 4)).setObjects(("HUAWEI-CDP-COMPLIANCE-MIB", "hwCdpComplianceRemTablesChange")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hwCdpComplianceTrapGroup = hwCdpComplianceTrapGroup.setStatus('current') mibBuilder.exportSymbols("HUAWEI-CDP-COMPLIANCE-MIB", hwCdpComplianceRemoteTable=hwCdpComplianceRemoteTable, hwCdpCompliancePortConfigAdminStatus=hwCdpCompliancePortConfigAdminStatus, hwCdpComplianceRemoteInfo=hwCdpComplianceRemoteInfo, hwCdpComplianceGroups=hwCdpComplianceGroups, hwCdpComplianceRemoteEntry=hwCdpComplianceRemoteEntry, hwCdpCompliancePortConfigIfIndex=hwCdpCompliancePortConfigIfIndex, hwCdpComplianceEnable=hwCdpComplianceEnable, hwCdpComplianceNotifications=hwCdpComplianceNotifications, hwCdpComplianceCompliance=hwCdpComplianceCompliance, hwCdpCompliancePortConfigTable=hwCdpCompliancePortConfigTable, hwCdpComplianceNotificationPrefix=hwCdpComplianceNotificationPrefix, hwCdpComplianceStatsGroup=hwCdpComplianceStatsGroup, hwCdpComplianceStatsRemTablesAgeouts=hwCdpComplianceStatsRemTablesAgeouts, hwCdpComplianceStatsRemTablesLastChangeTime=hwCdpComplianceStatsRemTablesLastChangeTime, hwCdpComplianceStatsRxPortIfIndex=hwCdpComplianceStatsRxPortIfIndex, hwCdpComplianceRemTimeMark=hwCdpComplianceRemTimeMark, hwCdpComplianceRemoteSystemsData=hwCdpComplianceRemoteSystemsData, hwCdpComplianceStatsRxPortAgeoutsTotal=hwCdpComplianceStatsRxPortAgeoutsTotal, hwCdpCompliancePortStatsReset=hwCdpCompliancePortStatsReset, hwCdpComplianceRemTablesChange=hwCdpComplianceRemTablesChange, hwCdpComplianceConfiguration=hwCdpComplianceConfiguration, hwCdpComplianceTrapGroup=hwCdpComplianceTrapGroup, hwCdpComplianceMIB=hwCdpComplianceMIB, hwCdpComplianceRemLocalPortIfIndex=hwCdpComplianceRemLocalPortIfIndex, hwCdpComplianceObjects=hwCdpComplianceObjects, hwCdpComplianceNotificationInterval=hwCdpComplianceNotificationInterval, hwCdpComplianceStatsRxPortEntry=hwCdpComplianceStatsRxPortEntry, hwCdpCompliancePortConfigEntry=hwCdpCompliancePortConfigEntry, PYSNMP_MODULE_ID=hwCdpComplianceMIB, hwCdpComplianceCompliances=hwCdpComplianceCompliances, hwCdpComplianceRemSysGroup=hwCdpComplianceRemSysGroup, hwCdpCompliancePortConfigHoldTime=hwCdpCompliancePortConfigHoldTime, hwCdpComplianceStatsRxPortTable=hwCdpComplianceStatsRxPortTable, hwCdpComplianceConformance=hwCdpComplianceConformance, hwCdpComplianceConfigGroup=hwCdpComplianceConfigGroup, hwCdpComplianceStatistics=hwCdpComplianceStatistics, hwCdpCompliancePortConfigNotificationEnable=hwCdpCompliancePortConfigNotificationEnable, hwCdpComplianceStatsRxPortFramesTotal=hwCdpComplianceStatsRxPortFramesTotal)
140.868132
2,381
0.791715
1,244
12,819
8.156752
0.138264
0.010446
0.010939
0.014586
0.297625
0.230413
0.213758
0.187543
0.180447
0.180447
0
0.072977
0.075357
12,819
90
2,382
142.433333
0.783093
0.026835
0
0.060976
0
0
0.176961
0.10276
0
0
0
0
0
1
0
false
0
0.121951
0
0.121951
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
32c40b429ba7f1090b72fd13e36b8055346940c3
827
py
Python
q2_api_client/clients/mobile_ws/calendar_client.py
jcook00/q2-api-client
4431af164eb4baf52e26e8842e017cad1609a279
[ "BSD-2-Clause" ]
null
null
null
q2_api_client/clients/mobile_ws/calendar_client.py
jcook00/q2-api-client
4431af164eb4baf52e26e8842e017cad1609a279
[ "BSD-2-Clause" ]
null
null
null
q2_api_client/clients/mobile_ws/calendar_client.py
jcook00/q2-api-client
4431af164eb4baf52e26e8842e017cad1609a279
[ "BSD-2-Clause" ]
null
null
null
from q2_api_client.clients.base_q2_client import BaseQ2Client from q2_api_client.endpoints.mobile_ws_endpoints import CalendarEndpoint class CalendarClient(BaseQ2Client): def get_calendar(self): """GET /mobilews/calendar :return: Response object :rtype: requests.Response """ endpoint = CalendarEndpoint.CALENDAR.value return self._get(url=self._build_url(endpoint)) def get_calendar_by_type(self, transaction_type): """GET /mobilews/calendar/{transactionType} :param str transaction_type: path parameter :return: Response object :rtype: requests.Response """ endpoint = CalendarEndpoint.CALENDAR_TRANSACTION_TYPE.value.format(transactionType=transaction_type) return self._get(url=self._build_url(endpoint))
33.08
108
0.718259
90
827
6.344444
0.411111
0.105079
0.031524
0.052539
0.381786
0.381786
0.381786
0.381786
0.255692
0
0
0.007541
0.198307
827
24
109
34.458333
0.853695
0.255139
0
0.222222
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.222222
0
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
32c4baf38f537ef55e48bae1faabe6aee1fe7ca3
11,477
py
Python
cg_token.py
gmnicke2/GISolve-API-Util
74d10d2ae60c1f000ef151a394ef9276b284867a
[ "MIT" ]
null
null
null
cg_token.py
gmnicke2/GISolve-API-Util
74d10d2ae60c1f000ef151a394ef9276b284867a
[ "MIT" ]
null
null
null
cg_token.py
gmnicke2/GISolve-API-Util
74d10d2ae60c1f000ef151a394ef9276b284867a
[ "MIT" ]
null
null
null
#!/usr/bin/env python """ Set of utilities to issue/verify/revoke a CG token with REST calls Requires valid username and password either in bash environment or given at the command line. Issue Token: Token can be easily created (and stored to env) with the folloing: # create token using CG_USERNAME, CG_PASSWORD, and CG_API env variables ./cg_token.py # create token specifying all the parameters on command line ./cg_token.py --username <login> --password <password> --endpoint <url> # create token using CG_USERNAME, CG_API, but prompt for password ./cg_token.py --password - # add token to environmental variables export CG_TOKEN=`./cg_token.py` # add token to environmental variable, specify extra parameters export CG_TOKEN=`./cg_token.py --username <login> --endpoint <newurl>` Verify or Revoke Token: Verifying or Revoking requires the positional 'verify' or 'revoke' command line argument. User can still override env variables with command-line arguments. Uses CG_API, and CG_TOKEN env variables for both. Verify uses CG_CLIENT_ID and CG_CLIENT_IP for consumer ID & user client IP, Revoke uses CG_USERNAME and CG_PASSWORD for security purposes : # Verify token, overriding CG_CLIENT_ID and CG_CLIENT_IP with command # line (Upon success, it will print the remaining lifetime of the token # in seconds) ./cg_token.py verify --clientid <ID> --clientip <IP> # Revoke token, overriding CG_TOKEN with command line ./cg_token.py revoke --token <token> Print debug info to stderr: Append the flag "--debug" or "-d" : ./cg_token.py --debug """ import sys, os, getpass import json import logging import requests import argparse from requests import exceptions as rex # This is used sed to disable InsecureRequestWarning. requests.packages.urllib3.disable_warnings() logger = logging.getLogger(__name__) class CGException(Exception) : def __init__(self, result) : self.message = result['message'] self.error_code = result['error_code'] def __str__(self) : return ("Error %d: %s" %(self.error_code, self.message)) def logger_initialize(debug) : """Initializes the format and level for the logger""" _format = ("%(levelname)s - %(asctime)s\n%(message)s\n") if debug : logging.basicConfig(format=_format, level=logging.DEBUG) else : logging.basicConfig(format=_format, level=logging.WARNING) def log_response(method, url, response, request) : """Logs request and response when in debug mode""" if request.get('password', '') : request['password'] = '*******' logger.debug("URL: " + url) logger.debug("Request: " + method) logger.debug("Request Data (in JSON format)" ": " + json.dumps(request,indent=4,separators=(',',': '))) logger.debug("Response (in JSON format)" ": " + json.dumps(response,indent=4,separators=(',',': '))) def parse_args() : """Defines command line positional and optional arguments and checks for valid action input if present. Additionally prompts with getpass if user specifies "--password -" to override CG_PASSWORD Args: none Returns: A (tuple) containing the following: args (namespace) : used to overwrite env variables when necessary action (string) : for main to use as a switch for calls to perform """ parser = argparse.ArgumentParser() parser.add_argument("-d", "--debug", action="store_true", help='Allow debug info to be written to stderr') parser.add_argument("-e", "--endpoint", default=os.getenv('CG_API',''), help="Set API url") parser.add_argument("-p", "--password", default=os.getenv('CG_PASSWORD',''), help="Set password. '-' for secure prompting") parser.add_argument("-u", "--username", default=os.getenv('CG_USERNAME',''), help="Set Username") parser.add_argument("-t", "--token", default=os.getenv('CG_TOKEN',''), help="Set Token for Verify/Revoke") parser.add_argument("-l", "--lifetime", type=long, default=43200, help="Set Lifetime for Token Issue in seconds" ". minimum=3600 (1hr), maximum=12*3600 (12hr)") parser.add_argument("-b", "--binding", type=int, default=1, help="1: Bind with IP Address, 0: Don't Bind") parser.add_argument("-c", "--clientid", default=os.getenv('CG_CLIENT_ID',''), help="Set Client ID for Verify") parser.add_argument("-i", "--clientip", default=os.getenv('CG_CLIENT_IP',''), help="Set Client IP for Verify") parser.add_argument("action", nargs='?', type=str, default='issue', help='issue/verify/revoke') args = parser.parse_args() logger_initialize(args.debug) if args.password and args.password == '-' : args.password = getpass.getpass("Enter desired CG Password: ") if not args.endpoint : logger.error('CG_API (API url for REST calls) ' 'not specified\n') sys.exit(1) if args.action.lower() not in ['issue','verify','revoke'] : logger.error('Invalid Action') sys.exit(1) return (args,args.action.lower()) def cg_rest(method, endpoint, headers={}, **kwargs) : """Calls the CG REST endpoint passing keyword arguments given. 'cg_rest' provides a basic wrapper around the HTTP request to the rest endpoint, and attempts to provide informative error messages when errors occur. Exceptions are passed to the calling function for final resolution. cg_rest('POST', <url>, headers=<HTTP headers dict>, username=<username>, password=<password>, ...) or with a previously constructed data/params dict cg_rest('POST', <url>, headers=headers, **data/params) or with no header necessary cg_rest('POST', <url>, **data/params) Args: method (str): the HTTP method that will be called endpoint (str, URL): the REST endpoint headers (dict, optional): HTTP headers kwargs (optional): common keywords include username, password, etc. Returns: (dict): decodes the response and returns it as a dictionary Raises: Raises CGException when the gateway server return an error status. Other exceptions may be raised based errors with the HTTP request and response. See documentation of Python's request module for a complete list. """ try : if method.upper() == 'POST' or method.upper() == 'PUT' : r = requests.request(method.upper(), endpoint, timeout=50, verify=False, headers=headers, data=kwargs) else : # Must be 'GET' or 'DELETE' r = requests.request(method.upper(), endpoint, timeout=50, verify=False, headers=headers, params=kwargs) r.raise_for_status() except (rex.ConnectionError, rex.HTTPError, rex.MissingSchema) as e : logger.debug("Problem with API endpoint '%s', " "is it entered correctly?" %endpoint) raise except (rex.Timeout) as e : logger.debug('Request timed out, the service may be ' 'temporarily unavailable') raise response = r.json() log_response(method, endpoint, response, kwargs) # If status is not provided, default to error. if response.get('status','') and response.get('status','') == 'error' : logger.debug("Call fails with '%s'" %response['result']['message']) raise CGException(response['result']) return response def issue_token(endpoint, username, password, lifetime, binding) : """Calls the Gateway issueToken function and returns token. Args: endpoint (string, URL): the REST endpoint username (string): the user's login password (string): the user's password lifetime (int): the lifetime of a token in seconds (3600 <= lifetime <= 12*3600) binding (int): 1 if user wants token to be bound to user IP 0 else Returns: (string): Open Service API token Raises: Passes any exceptions raised in cg_rest. """ data = { 'username' : username, 'password' : password, 'lifetime' : lifetime, 'binding' : binding } url = endpoint.rstrip('/') + '/token' logger.debug('Issuing token from %s' %url) response = cg_rest('POST', url, **data) return response['result']['token'] def verify_token(endpoint, username, token, client_id, client_ip) : """Calls the Gateway verifyToken function, returns remaining token lifetime. Args: endpoint(string, URL): the REST endpoint username (string): token (string): Token to verify client_id (string): Consumer ID client_ip (string): User Client's IP Address Returns: (int): Remaining lifetime of token (in seconds) Raises: Passes any exceptions raised in cg_rest. """ data = { 'token' : token, 'consumer' : client_id, 'remote_addr' : client_ip, 'username' : username } url = endpoint.rstrip('/') + '/token' logger.debug("Verifying token '%s' from '%s'" %(token,url)) data_length = str(len(json.dumps(data))) headers = {'Content-Length' : data_length} response = cg_rest('PUT', url, headers=headers, **data) return response['result']['lifetime'] def revoke_token(endpoint, username, password, token) : """Calls the Gateway revokeToken function Args: endpoint (string, URL): the REST endpoint username (string): the user's login password (string): the user's password token (string): The token to be revoked Returns: void Raises: Passes any exceptions raised in cg_rest. """ params = { 'token' : token, 'username' : username, 'password' : password, } url = endpoint.rstrip('/') + "/token" logger.debug("Revoking token '%s' from '%s'" %(token,url)) response = cg_rest('DELETE', url, **params) def main() : (args, action) = parse_args() try : if action == "issue" : if ((args.binding not in [0,1]) or not (3600<=args.lifetime<=43200)) : logger.error("Lifetime must be between 3600 and 43200," "\nBinding must be 0 or 1") sys.exit(1) print issue_token(args.endpoint, args.username, args.password, args.lifetime, args.binding) else : if not args.token : logger.error('No valid CG_TOKEN given') sys.exit(1) if action == "verify" : print verify_token(args.endpoint, args.username, args.token, args.clientid, args.clientip) else : revoke_token(args.endpoint, args.username, args.password, args.token) except CGException as e : logger.error(e) sys.exit(1) if __name__ == '__main__' : main()
33.55848
81
0.611658
1,386
11,477
4.984127
0.227273
0.0152
0.024609
0.014765
0.1837
0.143167
0.091922
0.085263
0.066589
0.046902
0
0.008039
0.273852
11,477
341
82
33.656892
0.820854
0.01246
0
0.169811
0
0
0.199081
0.003982
0
0
0
0
0
0
null
null
0.08805
0.037736
null
null
0.012579
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
086a788b83deae56a16772a629310d3b84a228a0
570
py
Python
Server/server/model_inference/predictor.py
thaiminhpv/Doctor-Cyclop-Hackathon-2021
afb943f7d00ceccb408c895077517ddd06d87fd7
[ "MIT" ]
6
2021-04-30T05:28:04.000Z
2022-03-21T14:50:43.000Z
Server/server/model_inference/predictor.py
thaiminhpv/Doctor-Cyclop-Hackathon-2021
afb943f7d00ceccb408c895077517ddd06d87fd7
[ "MIT" ]
null
null
null
Server/server/model_inference/predictor.py
thaiminhpv/Doctor-Cyclop-Hackathon-2021
afb943f7d00ceccb408c895077517ddd06d87fd7
[ "MIT" ]
1
2022-01-10T14:58:02.000Z
2022-01-10T14:58:02.000Z
import numpy as np import pandas as pd from server.model_inference.config import labels from server.model_inference.core_model import get_model_prediction from server.util.prediction_to_json import pandas_to_json def get_predictions(images): ids = list(images.keys()) out = np.hstack((np.asarray(ids)[np.newaxis,].T, (np.zeros((len(ids), len(labels)))))) df_sub = pd.DataFrame(out, columns=['StudyInstanceUID', *labels]) predicted_df = get_model_prediction(df_sub, images) predicted_json = pandas_to_json(predicted_df) return predicted_json
31.666667
90
0.764912
84
570
4.952381
0.452381
0.072115
0.072115
0.115385
0
0
0
0
0
0
0
0
0.12807
570
17
91
33.529412
0.837022
0
0
0
0
0
0.02807
0
0
0
0
0
0
1
0.083333
false
0
0.416667
0
0.583333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
086cc04c9a62e2ff1bedaaac23c04ca27ca1b7b4
2,264
py
Python
schedule/tests/scheduler_latest_test.py
conzty01/RA_Scheduler
6bf4931871aef4058d93917e62ceb31766e06b3a
[ "MIT" ]
1
2021-03-31T05:26:17.000Z
2021-03-31T05:26:17.000Z
schedule/tests/scheduler_latest_test.py
conzty01/RA_Scheduler
6bf4931871aef4058d93917e62ceb31766e06b3a
[ "MIT" ]
83
2018-03-19T18:32:34.000Z
2022-02-01T02:15:01.000Z
schedule/tests/scheduler_latest_test.py
conzty01/RA_Scheduler
6bf4931871aef4058d93917e62ceb31766e06b3a
[ "MIT" ]
2
2021-01-15T22:16:00.000Z
2021-02-10T01:03:32.000Z
from schedule.scheduler4_0 import schedule from schedule.ra_sched import Schedule, RA from unittest.mock import MagicMock, patch from datetime import date import unittest import random class TestScheduler(unittest.TestCase): def setUp(self): # -- Create a patchers for the logging -- self.patcher_loggingDEBUG = patch("logging.debug", autospec=True) self.patcher_loggingINFO = patch("logging.info", autospec=True) self.patcher_loggingWARNING = patch("logging.warning", autospec=True) self.patcher_loggingCRITICAL = patch("logging.critical", autospec=True) self.patcher_loggingERROR = patch("logging.error", autospec=True) # Start the patcher - mock returned self.mocked_loggingDEBUG = self.patcher_loggingDEBUG.start() self.mocked_loggingINFO = self.patcher_loggingINFO.start() self.mocked_loggingWARNING = self.patcher_loggingWARNING.start() self.mocked_loggingCRITICAL = self.patcher_loggingCRITICAL.start() self.mocked_loggingERROR = self.patcher_loggingERROR.start() def tearDown(self): self.patcher_loggingDEBUG.stop() self.patcher_loggingINFO.stop() self.patcher_loggingWARNING.stop() self.patcher_loggingCRITICAL.stop() self.patcher_loggingERROR.stop() def test_scheduler_whenUnableToGenerateSchedule_returnsEmptyList(self): # -- Arrange -- # -- Act -- # -- Assert -- pass def test_scheduler_whenAbleToGenerateSchedule_returnsScheduleObject(self): # -- Arrange -- # -- Act -- # -- Assert -- pass def test_scheduler_returnsExpectedSchedule(self): # -- Arrange -- # -- Act -- # -- Assert -- pass def test_createDateDict_buildsExpectedDateDictionary(self): # -- Arrange -- # -- Act -- # -- Assert -- pass def test_createPreviousDuties_returnsLastDateAssignedDictionary(self): # -- Arrange -- # -- Act -- # -- Assert -- pass def test_createPreviousDuties_returnsNumDoubleDaysDictionary(self): # -- Arrange -- # -- Act -- # -- Assert -- pass if __name__ == "__main__": unittest.main()
31.444444
79
0.651502
204
2,264
7.014706
0.308824
0.115304
0.0587
0.083857
0.165618
0.148847
0.148847
0.127184
0
0
0
0.001171
0.245583
2,264
71
80
31.887324
0.836651
0.1303
0
0.157895
0
0
0.039528
0
0
0
0
0
0
1
0.210526
false
0.157895
0.157895
0
0.394737
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
087388739eebaad50c966ec02ed0312b37726c72
1,203
py
Python
w_cutscenes_test.py
wholetonegames/panda3d-ness-rpg
8d81e8418c1bc20706b5b3f4c0631fe9bd76a65e
[ "MIT" ]
1
2021-02-01T03:09:28.000Z
2021-02-01T03:09:28.000Z
w_cutscenes_test.py
wholetonegames/panda3d-ness-rpg
8d81e8418c1bc20706b5b3f4c0631fe9bd76a65e
[ "MIT" ]
null
null
null
w_cutscenes_test.py
wholetonegames/panda3d-ness-rpg
8d81e8418c1bc20706b5b3f4c0631fe9bd76a65e
[ "MIT" ]
null
null
null
from w_i_stage import IStage from direct.interval.IntervalGlobal import Sequence, Func, Wait class CutsceneTest(IStage): def __init__(self): IStage.__init__(self) def setup(self): self.previousMap = base.gameData.currentMap base.gameData.currentMap = 'city' self.previousPos = base.gameData.heroPos base.gameData.heroPos = 'startPos' self.initStage() self.initHero() taskMgr.add(self.moveHero, "moveTask") self.start() self.animate() def animate(self): seq = Sequence( Func(self.heroNorth), Wait(2.0), Func(self.heroStop), Wait(1.0), Func(base.requestWithFade, 'RPGField') ) seq.start() def heroNorth(self): base.directionMap["up"] = True def heroStop(self): base.directionMap["up"] = False def quit(self): render.clearLight() taskMgr.remove("moveTask") self.stage.removeNode() base.gameData.currentMap = self.previousMap base.gameData.heroPos = self.previousPos def cancelCommand(self): pass def intoEvent(self, entry): pass
25.0625
63
0.596841
124
1,203
5.709677
0.443548
0.101695
0.09322
0.076271
0
0
0
0
0
0
0
0.004706
0.293433
1,203
47
64
25.595745
0.828235
0
0
0.052632
0
0
0.03325
0
0
0
0
0
0
1
0.210526
false
0.052632
0.052632
0
0.289474
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
08826307649d95fd1f1fa357479507c8385245c7
1,181
py
Python
tests/test_get_schedule.py
j-muller/pypuregym
396862047f8b5c0b1138b5c562ddb6958aaa6817
[ "MIT" ]
1
2020-12-31T01:42:14.000Z
2020-12-31T01:42:14.000Z
tests/test_get_schedule.py
j-muller/pypuregym
396862047f8b5c0b1138b5c562ddb6958aaa6817
[ "MIT" ]
null
null
null
tests/test_get_schedule.py
j-muller/pypuregym
396862047f8b5c0b1138b5c562ddb6958aaa6817
[ "MIT" ]
null
null
null
from .utilities import Response SCHEDULE_RESPONSE = b""" {"error":{"code":200,"message":"Success"},"data":{"classes":[{ "id":113209,"sector":"F","class_type_id":48,"start_date":"2020-06-07", "end_date":"2020-06-07","start_time":"09:00:00","end_time":"09:45:00", "duration":"2700000","teacher_id":782,"location_id":10,"level_id":9, "pillar_id":6,"button_status":0,"booking_id":0, "start_datetime":"2020-06-07T09:00:00+08:00","is_free":false, "color_code":"","is_filmed":false,"is_online":0,"is_cycling":false, "free_class_type":0,"special_flag":null,"duration_min":45, "class_type":{"id":48,"name":"TRX Blast", "description":"","is_fuze":false,"pillar":{"name":"Strength", "color":"#ed1c24","code":"strength_and_conditioning"},"level":"All Levels"}, "teacher":{"id":782,"name":"","full_name":"","image_link":"", "type":"teacher"}}]}} """ def test_get_schedule(pure_api, monkeypatch): monkeypatch.setattr( 'requests.sessions.Session.get', lambda *args, **kwargs: Response(SCHEDULE_RESPONSE), ) classes = pure_api.get_schedule( start_date='2020-06-07', last_date='2020-06-07', location_id=10, ) assert len(classes) == 1
36.90625
76
0.663844
169
1,181
4.414201
0.526627
0.040214
0.053619
0.064343
0.045576
0
0
0
0
0
0
0.096925
0.091448
1,181
31
77
38.096774
0.598322
0
0
0
0
0.111111
0.699407
0.655377
0
0
0
0
0.037037
1
0.037037
false
0
0.037037
0
0.074074
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0897118d6f2834e2b8c74ba12247412406dbd2c7
557
py
Python
Trakttv.bundle/Contents/Libraries/Shared/playhouse/berkeleydb.py
disrupted/Trakttv.bundle
24712216c71f3b22fd58cb5dd89dad5bb798ed60
[ "RSA-MD" ]
1,346
2015-01-01T14:52:24.000Z
2022-03-28T12:50:48.000Z
Trakttv.bundle/Contents/Libraries/Shared/playhouse/berkeleydb.py
alcroito/Plex-Trakt-Scrobbler
4f83fb0860dcb91f860d7c11bc7df568913c82a6
[ "RSA-MD" ]
474
2015-01-01T10:27:46.000Z
2022-03-21T12:26:16.000Z
Trakttv.bundle/Contents/Libraries/Shared/playhouse/berkeleydb.py
alcroito/Plex-Trakt-Scrobbler
4f83fb0860dcb91f860d7c11bc7df568913c82a6
[ "RSA-MD" ]
191
2015-01-02T18:27:22.000Z
2022-03-29T10:49:48.000Z
import datetime import decimal from playhouse.sqlite_ext import * # Peewee assumes that the `pysqlite2` module was compiled against the # BerkeleyDB SQLite libraries. from pysqlite2 import dbapi2 as berkeleydb berkeleydb.register_adapter(decimal.Decimal, str) berkeleydb.register_adapter(datetime.date, str) berkeleydb.register_adapter(datetime.time, str) class BerkeleyDatabase(SqliteExtDatabase): def _connect(self, database, **kwargs): conn = berkeleydb.connect(database, **kwargs) self._add_conn_hooks(conn) return conn
27.85
69
0.779174
66
557
6.454545
0.560606
0.126761
0.176056
0.131455
0.169014
0
0
0
0
0
0
0.006303
0.145422
557
19
70
29.315789
0.888655
0.172352
0
0
0
0
0
0
0
0
0
0
0
1
0.083333
false
0
0.333333
0
0.583333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
089bce5935bf86ce3e21aaf4f16ec72196bcf521
433
py
Python
bot/handlers/common.py
slawiko/remindmelater_bot
76e46f7a42ee2eb02d0b06eea1eb2b8c6f76cb9e
[ "Apache-2.0" ]
null
null
null
bot/handlers/common.py
slawiko/remindmelater_bot
76e46f7a42ee2eb02d0b06eea1eb2b8c6f76cb9e
[ "Apache-2.0" ]
2
2017-06-11T11:07:30.000Z
2017-06-24T05:37:34.000Z
bot/handlers/common.py
slawiko/remindmelater_bot
76e46f7a42ee2eb02d0b06eea1eb2b8c6f76cb9e
[ "Apache-2.0" ]
null
null
null
import logging from telegram.ext import CommandHandler logger = logging.getLogger(__name__) def handle_dispatcher(dispatcher): dispatcher.add_handler(ping()) dispatcher.add_error_handler(error) def error(a, b, c): logger.error('Error %s %s "%s"' % a, b, c) def ping(): def handle(bot, update): bot.send_message(chat_id=update.message.chat_id, text="pong") return CommandHandler('ping', handle)
18.041667
69
0.699769
59
433
4.949153
0.491525
0.061644
0.020548
0
0
0
0
0
0
0
0
0
0.170901
433
23
70
18.826087
0.81337
0
0
0
0
0
0.055684
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0
0.583333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
08a23fb05230d43cddbfc2a0b66eda446175157f
322
py
Python
PTA/PAT_B/Python3/B1061_AC.py
StrayDragon/OJ-Solutions
b31b11c01507544aded2302923da080b39cf2ba8
[ "MIT" ]
1
2019-05-13T10:09:55.000Z
2019-05-13T10:09:55.000Z
PTA/PAT_B/Python3/B1061_AC.py
StrayDragon/OJ-Solutions
b31b11c01507544aded2302923da080b39cf2ba8
[ "MIT" ]
null
null
null
PTA/PAT_B/Python3/B1061_AC.py
StrayDragon/OJ-Solutions
b31b11c01507544aded2302923da080b39cf2ba8
[ "MIT" ]
null
null
null
n, m = map(int, input().split()) scores = list(map(int, input().split())) answers = list(map(int, input().split())) for i in range(n): actuals = list(map(int, input().split())) result = 0 for i, score in enumerate(scores): if actuals[i] == answers[i]: result += score print(result)
21.466667
45
0.568323
46
322
3.978261
0.434783
0.131148
0.240437
0.349727
0.327869
0
0
0
0
0
0
0.004082
0.23913
322
14
46
23
0.742857
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.1
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
08a840735e2065bf6687b54ab836fe21b29363da
901
py
Python
src/npgru/predictor/tensorflow_predictor.py
grainpowder/gru-forward-numpy-app
efd24f9f397d51e7e18bdad5cba12451ad69d3de
[ "MIT" ]
null
null
null
src/npgru/predictor/tensorflow_predictor.py
grainpowder/gru-forward-numpy-app
efd24f9f397d51e7e18bdad5cba12451ad69d3de
[ "MIT" ]
null
null
null
src/npgru/predictor/tensorflow_predictor.py
grainpowder/gru-forward-numpy-app
efd24f9f397d51e7e18bdad5cba12451ad69d3de
[ "MIT" ]
null
null
null
from typing import List, Tuple import sentencepiece as spm import tensorflow as tf import tensorflow.keras as keras from npgru.predictor.category_predictor import CategoryPredictor from npgru.preprocessor.model_file import get_model_dir class TensorflowPredictor(CategoryPredictor): def __init__(self): model_dir = get_model_dir() self._tokenizer = spm.SentencePieceProcessor(model_file=str(model_dir.joinpath("tokenizer.model"))) self._model = keras.models.load_model(model_dir.joinpath("tensorflow")) def predict(self, title: str, num_predictions) -> List[Tuple[int, float]]: tokenized_title = self._tokenizer.encode(title) if title else [1] probabilities = self._model(tf.constant([tokenized_title])) prediction = sorted(enumerate(probabilities.numpy()[0]), key=lambda x: x[1], reverse=True)[:num_predictions] return prediction
39.173913
116
0.751387
112
901
5.839286
0.491071
0.061162
0.033639
0
0
0
0
0
0
0
0
0.003916
0.149834
901
22
117
40.954545
0.849869
0
0
0
0
0
0.027747
0
0
0
0
0
0
1
0.125
false
0
0.375
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
08b87f9a1caf36c7bc295170c1ae9c29a566dd2b
1,494
py
Python
Python scripts/Mail/search-and-modify-inbox-mail.py
shartrooper/My-python-scripts
5c3a8db4ed9a75bd9ab4b29153a788d9e6c5d28c
[ "MIT" ]
null
null
null
Python scripts/Mail/search-and-modify-inbox-mail.py
shartrooper/My-python-scripts
5c3a8db4ed9a75bd9ab4b29153a788d9e6c5d28c
[ "MIT" ]
null
null
null
Python scripts/Mail/search-and-modify-inbox-mail.py
shartrooper/My-python-scripts
5c3a8db4ed9a75bd9ab4b29153a788d9e6c5d28c
[ "MIT" ]
null
null
null
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> # pip install imapclient // pip install pyzmail >>> import imapclient >>> conn= imapclient.IMAPClient('imap.gmail.com', ssl=True) #True to use SSL encryption >>> conn.login('[email protected]','whatever') >>> conn.select_folter('INBOX',readonly= True) >>> UIDs = conn.search(['SINCE 20-Aug-2015']) #return a list of unique IDs for mails >>> rawMessage=conn.fetch(['mail int UID number to fetch'],['BODY[]','FLAGS']) >>> import pyzmail >>> pyzmail.PyzMessage.factory(rawMessage['same UID Number passed to rawMessage'][b'BODY']) >>> message=pyzmail.PyzMessage.factory(rawMessage['same UID Number passed to rawMessage'][b'BODY']) T >>> message.get_subject() #mail's subject >>> message.get_addresses('from') >>> message.get_addresses('to') >>> message.get_addresses('bcc') >>> message.text_part # return len and type >>> message.text_part #None if doesn't have html >>> message.html_part == None # True >>> message.text_part.get_payload().decode('UTF-8') >>> message.text_part.charset >>> conn.list_folders() >>> conn.select_folder('INBOX',readonly=False) #to modify the inbox >>> UIDS= conn.search(['ON 24-Aug-2015']) >>> conn.delete_messages(['UIDs to delete']) >>> ''' Full documentation ar: https://imapclient.readthedocs.org http://www.magiksys.net/pyzmail '''
33.954545
101
0.680054
208
1,494
4.817308
0.548077
0.03992
0.05988
0.067864
0.139721
0.139721
0.139721
0.139721
0.139721
0.139721
0
0.034884
0.136546
1,494
44
101
33.954545
0.74186
0.127845
0
0.074074
0
0
0.277157
0
0
0
0
0
0
0
null
null
0.074074
0.074074
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
08f715599ebdccb7db7f9153cc150737106850d8
6,904
py
Python
fabric_cf/actor/core/util/resource_count.py
fabric-testbed/ActorBase
3c7dd040ee79fef0759e66996c93eeec57c790b2
[ "MIT" ]
null
null
null
fabric_cf/actor/core/util/resource_count.py
fabric-testbed/ActorBase
3c7dd040ee79fef0759e66996c93eeec57c790b2
[ "MIT" ]
67
2020-12-21T15:39:49.000Z
2022-02-27T17:55:00.000Z
fabric_cf/actor/core/util/resource_count.py
fabric-testbed/ControlFramework
95ab745e32f15c993bc7a017aa97a5a0f67f210f
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # 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. # # # Author: Komal Thareja ([email protected]) from fabric_cf.actor.core.util.resource_type import ResourceType class CountsPerType: """ Inner class representing counts for a given resource type. """ def __init__(self, *, resource_type: ResourceType): self.resource_type = resource_type self.active = 0 self.pending = 0 self.expired = 0 self.failed = 0 self.closed = 0 class ResourceCount: """ ResourceCount is a utility class used to count reservations in a ReservationSet based on the reservation state and resource type. An instance of this class is used as an argument to the "tally" methods in ReservationSet. Note: no internal locking. """ def __init__(self): # Counts per resource type. <String, CountsPerType> self.map = {} def get_counts(self, *, resource_type: ResourceType) -> CountsPerType: """ Returns the count entry for the given resource type. Args: resource_type: resource type Returns: count entry for the given resource type """ return self.map.get(resource_type.get_type(), None) def get_or_create_counts(self, *, resource_type: ResourceType) -> CountsPerType: """ Returns or creates a new count entry for the given resource type. Args: resource_type: resource type Returns: count entry for the given resource type """ result = self.map.get(resource_type.get_type(), None) if result is None: result = CountsPerType(resource_type=resource_type) self.map[resource_type.get_type()] = result return result def count_active(self, *, resource_type: ResourceType) -> int: """ Returns the number of active units from the given resource type. Args: resource_type: resource type Returns: number of active units """ counts = self.get_counts(resource_type=resource_type) if counts is not None: return counts.active else: return 0 def count_close(self, *, resource_type: ResourceType) -> int: """ Returns the number of closed units from the given resource type. Args: resource_type: resource type Returns: number of closed units """ counts = self.get_counts(resource_type=resource_type) if counts is not None: return counts.closed else: return 0 def count_expired(self, *, resource_type: ResourceType) -> int: """ Returns the number of expired units from the given resource type. Args: resource_type: resource type Returns: number of expired units """ counts = self.get_counts(resource_type=resource_type) if counts is not None: return counts.expired else: return 0 def count_failed(self, *, resource_type: ResourceType) -> int: """ Returns the number of failed units from the given resource type. Args: resource_type: resource type Returns: number of failed units """ counts = self.get_counts(resource_type=resource_type) if counts is not None: return counts.failed else: return 0 def count_pending(self, *, resource_type: ResourceType) -> int: """ Returns the number of pending units from the given resource type. Args: resource_type: resource type Returns: number of pending units """ counts = self.get_counts(resource_type=resource_type) if counts is not None: return counts.pending else: return 0 def tally_active(self, *, resource_type: ResourceType, count: int): """ Increments with count the internal counter for active units of the specified type. Args: resource_type: resource type count: count """ counts = self.get_or_create_counts(resource_type=resource_type) counts.active += count def tally_close(self, *, resource_type: ResourceType, count: int): """ Increments with count the internal counter for closed units of the specified type. Args: resource_type: resource type count: count """ counts = self.get_or_create_counts(resource_type=resource_type) counts.closed += count def tally_expired(self, *, resource_type: ResourceType, count: int): """ Increments with count the internal counter for expired units of the specified type. Args: resource_type: resource type count: count """ counts = self.get_or_create_counts(resource_type=resource_type) counts.expired += count def tally_failed(self, *, resource_type: ResourceType, count: int): """ Increments with count the internal counter for failed units of the specified type. Args: resource_type: resource type count: count """ counts = self.get_or_create_counts(resource_type=resource_type) counts.failed += count def tally_pending(self, *, resource_type: ResourceType, count: int): """ Increments with count the internal counter for pending units of the specified type. Args: resource_type: resource type count: count """ counts = self.get_or_create_counts(resource_type=resource_type) counts.pending += count
33.033493
119
0.637167
832
6,904
5.168269
0.203125
0.214884
0.111628
0.133953
0.588372
0.543256
0.543256
0.51814
0.502791
0.445814
0
0.003497
0.295915
6,904
208
120
33.192308
0.881094
0.464079
0
0.384615
0
0
0
0
0
0
0
0
0
1
0.215385
false
0
0.015385
0
0.446154
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
3eaf7ae8895d39770420351b1a65c6dd69d2f75e
1,829
py
Python
sdk/python/kfp/v2/components/utils.py
ryansteakley/pipelines
98677b2190fb327be68e4bb0d00c520593707f21
[ "Apache-2.0" ]
1
2021-10-23T00:39:47.000Z
2021-10-23T00:39:47.000Z
sdk/python/kfp/v2/components/utils.py
ryansteakley/pipelines
98677b2190fb327be68e4bb0d00c520593707f21
[ "Apache-2.0" ]
null
null
null
sdk/python/kfp/v2/components/utils.py
ryansteakley/pipelines
98677b2190fb327be68e4bb0d00c520593707f21
[ "Apache-2.0" ]
null
null
null
# Copyright 2021 The Kubeflow Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Definitions of utils methods.""" import importlib import os import re import sys import types def load_module(module_name: str, module_directory: str) -> types.ModuleType: """Dynamically imports the Python module with the given name and package path. E.g., Assuming there is a file called `my_module.py` under `/some/directory/my_module`, we can use:: load_module('my_module', '/some/directory') to effectively `import mymodule`. Args: module_name: The name of the module. package_path: The package under which the specified module resides. """ module_spec = importlib.util.spec_from_file_location( name=module_name, location=os.path.join(module_directory, f'{module_name}.py')) module = importlib.util.module_from_spec(module_spec) sys.modules[module_spec.name] = module module_spec.loader.exec_module(module) return module def maybe_rename_for_k8s(name: str) -> str: """Cleans and converts a name to be k8s compatible. Args: name: The original name. Returns: A sanitized name. """ return re.sub('-+', '-', re.sub('[^-0-9a-z]+', '-', name.lower())).lstrip('-').rstrip('-')
31.534483
77
0.689995
256
1,829
4.832031
0.496094
0.048504
0.021019
0.025869
0
0
0
0
0
0
0
0.008293
0.208857
1,829
57
78
32.087719
0.846579
0.592674
0
0
0
0
0.050076
0
0
0
0
0
0
1
0.125
false
0
0.4375
0
0.6875
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3eb1886d18a07c578c32647296635bbe0ed29b6d
285
py
Python
yamlcfg/__init__.py
RiskIQ/pyyamlcfg
93affb9dfdbae7deebd60b50b23b7036682866e4
[ "BSD-2-Clause" ]
2
2016-05-25T13:50:14.000Z
2017-08-08T18:24:04.000Z
yamlcfg/__init__.py
RiskIQ/pyyamlcfg
93affb9dfdbae7deebd60b50b23b7036682866e4
[ "BSD-2-Clause" ]
2
2015-09-13T12:48:50.000Z
2019-04-25T10:26:00.000Z
yamlcfg/__init__.py
RiskIQ/pyyamlcfg
93affb9dfdbae7deebd60b50b23b7036682866e4
[ "BSD-2-Clause" ]
3
2016-04-29T07:12:44.000Z
2019-04-08T07:52:14.000Z
#!/usr/bin/env python ''' yamlcfg Bring in Configs into namespace ''' from yamlcfg.conf import Config as BaseConfig from yamlcfg.yml import YAMLConfig YMLConfig = YAMLConfig YamlConfig = YAMLConfig from yamlcfg.util import normalize, validate_ext from yamlcfg.env import check_env
19
48
0.8
39
285
5.794872
0.615385
0.19469
0
0
0
0
0
0
0
0
0
0
0.136842
285
14
49
20.357143
0.918699
0.214035
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3ebc05f1d094795c30a0aca20105e5ff7a3813fa
596
py
Python
data_visualization_gui/src/interactive.py
bbueno5000/DataGUI
940fcd0fb8dbde22350eacd538a8a1c244eb28ea
[ "MIT" ]
null
null
null
data_visualization_gui/src/interactive.py
bbueno5000/DataGUI
940fcd0fb8dbde22350eacd538a8a1c244eb28ea
[ "MIT" ]
2
2021-03-31T19:46:50.000Z
2021-12-13T20:37:15.000Z
data_visualization_gui/src/interactive.py
bbueno5000/DataGUI
940fcd0fb8dbde22350eacd538a8a1c244eb28ea
[ "MIT" ]
null
null
null
""" DOCSTRING """ import dash import dash.dependencies as dependencies import dash_core_components.Graph as Graph import dash_core_components.Input as Input import dash_html_components.Div as Div import dash_html_components.H1 as H1 app = dash.Dash() app.layout = Div(children=[Input(id='input', value='blank', type='text'), Div(id='output')]) @app.callback(Output(component_id='output', component_property='children'), [Input(component_id='input', component_property='value')]) def update_value(input_data): return 'Input: "{}"'.format(input_data) app.run_server(debug=True)
35.058824
92
0.753356
84
596
5.154762
0.392857
0.138568
0.064665
0.110855
0
0
0
0
0
0
0
0.003759
0.107383
596
17
93
35.058824
0.81015
0.015101
0
0
0
0
0.094828
0
0
0
0
0
0
1
0.076923
false
0
0.461538
0.076923
0.615385
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3ec94f77c122b98fdf7c96a211b8a9024dac0bae
57,058
py
Python
pysnmp-with-texts/HH3C-DOT3-EFM-EPON-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
8
2019-05-09T17:04:00.000Z
2021-06-09T06:50:51.000Z
pysnmp-with-texts/HH3C-DOT3-EFM-EPON-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
4
2019-05-31T16:42:59.000Z
2020-01-31T21:57:17.000Z
pysnmp-with-texts/HH3C-DOT3-EFM-EPON-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module HH3C-DOT3-EFM-EPON-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-DOT3-EFM-EPON-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:26:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint") hh3cEpon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cEpon") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") Unsigned32, ObjectIdentity, IpAddress, TimeTicks, Integer32, mib_2, Gauge32, iso, Counter64, Counter32, ModuleIdentity, NotificationType, MibIdentifier, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "ObjectIdentity", "IpAddress", "TimeTicks", "Integer32", "mib-2", "Gauge32", "iso", "Counter64", "Counter32", "ModuleIdentity", "NotificationType", "MibIdentifier", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, MacAddress, DisplayString, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "MacAddress", "DisplayString", "TruthValue") hh3cDot3EfmeponMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2)) hh3cDot3EfmeponMIB.setRevisions(('2004-09-21 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hh3cDot3EfmeponMIB.setRevisionsDescriptions(('Initial version, published as RFC XXXX.',)) if mibBuilder.loadTexts: hh3cDot3EfmeponMIB.setLastUpdated('200409210000Z') if mibBuilder.loadTexts: hh3cDot3EfmeponMIB.setOrganization('Hangzhou H3C Tech. Co., Ltd.') if mibBuilder.loadTexts: hh3cDot3EfmeponMIB.setContactInfo('Platform Team Hangzhou H3C Tech. Co., Ltd. Hai-Dian District Beijing P.R. China http://www.h3c.com Zip:100085 ') if mibBuilder.loadTexts: hh3cDot3EfmeponMIB.setDescription("The objects in this MIB module are used to manage the Ethernet in the First Mile (EFM) Multi Point Control Protocol (MPCP) Interfaces as defined in IEEE Draft P802.3ah/D3.0 clause 64,65. The following reference is used throughout this MIB module: [802.3ah] refers to: IEEE Draft P802.3ah/D3.3: 'Draft amendment to - Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements - Part 3: Carrier sense multiple access with collision detection (CSMA/CD) access method and physical layer specifications - Media Access Control Parameters, Physical Layers and Management Parameters for subscriber access networks', 22 April 2004. Of particular interest are Clause 64(MPCP) 65(P2MP RS) and 60 (PON PMDs). Clause 30, 'Management', and Clause 45, 'Management Data Input/Output (MDIO) Interface'. Copyright (C) The Internet Society (2004). This version of this MIB module is part of XXXX see the RFC itself for full legal notices.") hh3cDot3MpcpMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1)) hh3cDot3MpcpObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1)) hh3cDot3MpcpConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 2)) hh3cDot3MpcpTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1), ) if mibBuilder.loadTexts: hh3cDot3MpcpTable.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpTable.setDescription('Table for dot3 Multi-Point Control Protocol (MPCP) MIB modules.') hh3cDot3MpcpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: hh3cDot3MpcpEntry.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpEntry.setDescription('An entry in the dot3 MPCP MIB modules table.') hh3cDot3MpcpID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpID.setReference('[802.3ah], 30.3.5.1.1.') if mibBuilder.loadTexts: hh3cDot3MpcpID.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpID.setDescription('This variable is assigned so as to uniquely identify the Multi-Point MAC Control (MPCP) entity, as defined in [802.3ah] clause 64, among the subordinate managed objects of the containing object. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 2), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpOperStatus.setReference('[802.3ah], 30.3.5.1.2.') if mibBuilder.loadTexts: hh3cDot3MpcpOperStatus.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpOperStatus.setDescription('This variable can be used to define the operational state of the Multi-Point MAC Control sublayer as defined in [802.3ah] clause 64. Selecting admin for an interface with Multi-Point MAC Control sublayer. When the attribute is True the the interface will act as if Multi-point control protocol is enabled. When the attribute is False the interface will act as if it does not have the Multi-point control protocol. The operational state can be changed using the hh3cDot3MpcpAdminState attribute. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpMode = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("olt", 1), ("onu", 2))).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hh3cDot3MpcpMode.setReference('[802.3ah], 30.3.5.1.3.') if mibBuilder.loadTexts: hh3cDot3MpcpMode.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpMode.setDescription('This variable can be used to identify the operational state of the Multi-Point MAC Control sublayer as defined in [802.3ah] clause 64. Selecting olt(1) for an OLT (server) mode and onu(2) for an ONU (client) mode. Writing can be done during only during initialization, when hh3cDot3MpcpOperStatus indicates Flase. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpLinkID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpLinkID.setReference('[802.3ah], 30.3.5.1.4.') if mibBuilder.loadTexts: hh3cDot3MpcpLinkID.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpLinkID.setDescription('A read-only value that identifies the Logical Link identity (LLID) associated with the MAC port as specified in [802.3ah] clause 65.1.3.2.2. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpRemoteMACAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 5), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpRemoteMACAddress.setReference('[802.3ah], 30.3.5.1.5.') if mibBuilder.loadTexts: hh3cDot3MpcpRemoteMACAddress.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpRemoteMACAddress.setDescription('A read-only value that identifies the source_address parameter of the last MPCPDUs passed to the MAC Control. This value is updated on reception of a valid frame with (1) a destination Field equal to the reserved multicast address for MAC Control specified in [802.3ah] Annex 31A, (2) lengthOrType field value equal to the reserved Type for MAC Control as specified in [802.3ah] Annex 31A. (3) an MPCP subtype value equal to the subtype reserved for MPCP as specified in [802.3ah] Annex 31A. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpRegistrationState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unregistered", 1), ("registering", 2), ("registered", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpRegistrationState.setReference('[802.3ah], 30.3.5.1.6.') if mibBuilder.loadTexts: hh3cDot3MpcpRegistrationState.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpRegistrationState.setDescription('A read-only value that identifies the operational state of the Multi-Point MAC Control sublayer as defined in [802.3ah] clause 64. When this attribute has the enumeration unregistered(1) the interface may be used for registering a link partner. When this attribute has the enumeration registering(2) the interface is in the process of registering a link-partner. When this attribute has the enumeration registered(3) the interface has an established link-partner. This attribute is relevant for an OLT and an ONU. For the OLT it provides an indication per LLID.') hh3cDot3MpcpTransmitElapsed = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 7), Integer32()).setUnits('TQ (16nsec)').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpTransmitElapsed.setReference('[802.3ah], 30.3.5.1.19.') if mibBuilder.loadTexts: hh3cDot3MpcpTransmitElapsed.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpTransmitElapsed.setDescription('A read-only value that reports the interval from last MPCP frame transmission in increments of Time Quanta (TQ) 16ns. The value returned shall be (interval from last MPCP frame transmission in ns)/16. If this value exceeds (2^32-1) the value (2^32-1) shall be returned. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpReceiveElapsed = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 8), Integer32()).setUnits('TQ (16nsec)').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpReceiveElapsed.setReference('[802.3ah], 30.3.5.1.20.') if mibBuilder.loadTexts: hh3cDot3MpcpReceiveElapsed.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpReceiveElapsed.setDescription('A read-only value that reports the interval from last MPCP frame reception in increments of Time Quanta (TQ) 16ns. The value returned shall be (interval from last MPCP last MPCP frame reception in ns)/16. If this value exceeds (2^32-1) the value (2^32-1) shall be returned. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpRoundTripTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 9), Integer32()).setUnits('TQ (16nsec)').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpRoundTripTime.setReference('[802.3ah], 30.3.5.1.21.') if mibBuilder.loadTexts: hh3cDot3MpcpRoundTripTime.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpRoundTripTime.setDescription('A read-only value that reports the MPCP round trip time in increments of Time Quanta (TQ) 16ns. The value returned shall be (round trip time in ns)/16. If this value exceeds (2^16-1) the value (2^16-1) shall be returned. This attribute is relevant for an OLT and an ONU. For the OLT there is a value per LLID') hh3cDot3MpcpMaximumPendingGrants = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpMaximumPendingGrants.setReference('[802.3ah], 30.3.5.1.24.') if mibBuilder.loadTexts: hh3cDot3MpcpMaximumPendingGrants.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpMaximumPendingGrants.setDescription('A read-only value that indicates the maximum number of grants an ONU can store. The maximum number of grants an ONU can store has a range of 0 to 255. This attribute is relevant for an OLT and an ONU. For the OLT there is a value per LLID') hh3cDot3MpcpAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 11), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hh3cDot3MpcpAdminState.setReference('[802.3ah], 30.3.5.2.1.') if mibBuilder.loadTexts: hh3cDot3MpcpAdminState.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpAdminState.setDescription('This variable can be used to define the operational state of the Multi-Point MAC Control sublayer as defined in [802.3ah] clause 64. Selecting admin for an interface with Multi-Point MAC Control sublayer. When selecting the value as True the interface Multi-Point control protocol is enabled. When selecting the value as False the interface acts as if the Multi-point Control protocol does not exist. Reading reflects the state of the attribute and the operation of the Multi-point control protocol mode of the interface. Writing can be done all the time. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpOnTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 12), Integer32()).setUnits('TQ (16nsec)').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpOnTime.setReference('[802.3ah], 64.3.5.1.') if mibBuilder.loadTexts: hh3cDot3MpcpOnTime.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpOnTime.setDescription('A read-only value that reports the -on time- for a grant burst in increments of Time Quanta (TQ) 16ns as defined in [802.3ah] 60,64. The value returned shall be (on time ns)/16. If this value exceeds (2^32-1) the value (2^32-1) shall be returned. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpOffTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 13), Integer32()).setUnits('TQ (16nsec)').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpOffTime.setReference('[802.3ah], 64.3.5.1.') if mibBuilder.loadTexts: hh3cDot3MpcpOffTime.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpOffTime.setDescription('A read-only value that reports the -off time- for a grant burst in increments of Time Quanta (TQ) 16ns as defined in [802.3ah] 60,64. The value returned shall be (off time ns)/16. If this value exceeds (2^32-1) the value (2^32-1) shall be returned. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpSyncTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 1, 1, 14), Integer32()).setUnits('TQ (16nsec)').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpSyncTime.setReference('[802.3ah], 64.3.3.2.') if mibBuilder.loadTexts: hh3cDot3MpcpSyncTime.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpSyncTime.setDescription('A read-only value that reports the -sync lock time- for an OLT receiver in increments of Time Quanta (TQ) 16ns as defined in [802.3ah] 60,64,65. The value returned shall be (sync lock time ns)/16. If this value exceeds (2^32-1) the value (2^32-1) shall be returned. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpStatTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2), ) if mibBuilder.loadTexts: hh3cDot3MpcpStatTable.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpStatTable.setDescription('This table defines the list of statistics counters of [802.3ah] clause 64 MPCP interface.') hh3cDot3MpcpStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: hh3cDot3MpcpStatEntry.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpStatEntry.setDescription('Table entries for table of statistics counters of [802.3ah] clause 64 MPCP interface.') hh3cDot3MpcpMACCtrlFramesTransmitted = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 1), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpMACCtrlFramesTransmitted.setReference('[802.3ah], 30.3.5.1.7.') if mibBuilder.loadTexts: hh3cDot3MpcpMACCtrlFramesTransmitted.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpMACCtrlFramesTransmitted.setDescription('A count of MPCP frames passed to the MAC sublayer for transmission. This counter is incremented when a MA_CONTROL.request service primitive is generated within the MAC control sublayer with an opcode indicating a MPCP frame. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpMACCtrlFramesReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 2), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpMACCtrlFramesReceived.setReference('[802.3ah], 30.3.5.1.8.') if mibBuilder.loadTexts: hh3cDot3MpcpMACCtrlFramesReceived.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpMACCtrlFramesReceived.setDescription('A count of MPCP frames passed by the MAC sublayer to the MAC Control sublayer. This counter is incremented when a ReceiveFrame function call returns a valid frame with: (1) a lengthOrType field value equal to the reserved Type for 802.3_MAC_Control as specified in 31.4.1.3, and (2) an opcode indicating a MPCP frame. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpDiscoveryWindowsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpDiscoveryWindowsSent.setReference('[802.3ah], 30.3.5.1.22.') if mibBuilder.loadTexts: hh3cDot3MpcpDiscoveryWindowsSent.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpDiscoveryWindowsSent.setDescription('A count of discovery windows generated. The counter is incremented by one for each generated discovery window. This attribute is relevant for an OLT and an ONU. At the ONU value should be zero.') hh3cDot3MpcpDiscoveryTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpDiscoveryTimeout.setReference('[802.3ah], 30.3.5.1.23.') if mibBuilder.loadTexts: hh3cDot3MpcpDiscoveryTimeout.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpDiscoveryTimeout.setDescription('A count of the number of times a discovery timeout occurs. Increment the counter by one for each discovery processing state-machine reset resulting from timeout waiting for message arrival. This attribute is relevant for an OLT and an ONU.') hh3cDot3MpcpTxRegRequest = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 5), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpTxRegRequest.setReference('[802.3ah], 30.3.5.1.12.') if mibBuilder.loadTexts: hh3cDot3MpcpTxRegRequest.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpTxRegRequest.setDescription('A count of the number of times a REGISTER_REQ MPCP frames transmission occurs. Increment the counter by one for each REGISTER_REQ MPCP frame transmitted as defined in [802.3ah] clause 64. This counter is mandatory for an ONU. This attribute is relevant for an OLT and an ONU. At the OLT value should be zero.') hh3cDot3MpcpRxRegRequest = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 6), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpRxRegRequest.setReference('[802.3ah], 30.3.5.1.17.') if mibBuilder.loadTexts: hh3cDot3MpcpRxRegRequest.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpRxRegRequest.setDescription('A count of the number of times a REGISTER_REQ MPCP frames reception occurs. A single counter at the ONU and a set of counters, one for each LLID, at the OLT. Increment the counter by one for each REGISTER_REQ MPCP frame received for each LLID as defined in [802.3ah] clause 64. This counter is mandatory for an ONU and for an OLT. At the ONU value should be zero.') hh3cDot3MpcpTxRegAck = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 7), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpTxRegAck.setReference('[802.3ah], 30.3.5.1.10.') if mibBuilder.loadTexts: hh3cDot3MpcpTxRegAck.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpTxRegAck.setDescription('A count of the number of times a REGISTER_ACK MPCP frames transmission occurs. Increment the counter by one for each REGISTER_ACK MPCP frame transmitted as defined in [802.3ah] clause 64. This counter is mandatory for an ONU. This attribute is relevant for an OLT and an ONU. At the OLT the value should be zero.') hh3cDot3MpcpRxRegAck = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 8), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpRxRegAck.setReference('[802.3ah], 30.3.5.1.15.') if mibBuilder.loadTexts: hh3cDot3MpcpRxRegAck.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpRxRegAck.setDescription('A count of the number of times a REGISTER_ACK MPCP frames reception occurs. A single counter at the ONU and a set of counters, one for each LLID, at the OLT. Increment the counter by one for each REGISTER_ACK MPCP frame received for each LLID, as defined in [802.3ah] clause 64. This counter is mandatory for an ONU and for an OLT. At the ONU the value should be zero.') hh3cDot3MpcpTxReport = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 9), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpTxReport.setReference('[802.3ah], 30.3.5.1.13.') if mibBuilder.loadTexts: hh3cDot3MpcpTxReport.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpTxReport.setDescription('A count of the number of times a REPORT MPCP frames transmission occurs. Increment the counter by one for each REPORT MPCP frame transmitted as defined in [802.3ah] clause 64. This counter is mandatory for an ONU. This attribute is relevant for an OLT and an ONU. At the OLT value should be zero.') hh3cDot3MpcpRxReport = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 10), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpRxReport.setReference('[802.3ah], 30.3.5.1.18.') if mibBuilder.loadTexts: hh3cDot3MpcpRxReport.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpRxReport.setDescription('A count of the number of times a REPORT MPCP frames reception occurs. A single counter at the ONU and a set of counters, one for each LLID, at the OLT. Increment the counter by one for each REPORT MPCP frame received for each LLID, as defined in [802.3ah] clause 64. This counter is mandatory for an ONU and for an OLT. At the ONU value should be zero.') hh3cDot3MpcpTxGate = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 11), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpTxGate.setReference('[802.3ah], 30.3.5.1.9.') if mibBuilder.loadTexts: hh3cDot3MpcpTxGate.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpTxGate.setDescription('A count of the number of times a GATE MPCP frames transmission occurs. A set of counters, one for each LLID, at the OLT. Increment the counter by one for each GATE MPCP frame transmitted, for each LLID, as defined in [802.3ah] clause 64. This counter is mandatory for an OLT. This attribute is relevant for an OLT and an ONU. At the ONU the value should be zero.') hh3cDot3MpcpRxGate = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 12), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpRxGate.setReference('[802.3ah], 30.3.5.1.14.') if mibBuilder.loadTexts: hh3cDot3MpcpRxGate.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpRxGate.setDescription('A count of the number of times a GATE MPCP frames reception occurs. A single counter at the ONU and a set of counters, one for each LLID ,at the OLT. Increment the counter by one for each GATE MPCP frame received, for each LLID, as defined in [802.3ah] clause 64. This counter is mandatory for an ONU and for an OLT. At the OLT the value should be zero.') hh3cDot3MpcpTxRegister = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 13), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpTxRegister.setReference('[802.3ah], 30.3.5.1.11.') if mibBuilder.loadTexts: hh3cDot3MpcpTxRegister.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpTxRegister.setDescription('A count of the number of times a REGISTER MPCP frames transmission occurs. A set of counters, one for each LLID, at the OLT. Increment the counter by one for each REGISTER MPCP frame transmitted, for each LLID, as defined in [802.3ah] clause 64. This counter is mandatory for an OLT. This attribute is relevant for an OLT and an ONU. At the ONU the value should be zero.') hh3cDot3MpcpRxRegister = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 14), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpRxRegister.setReference('[802.3ah], 30.3.5.1.16.') if mibBuilder.loadTexts: hh3cDot3MpcpRxRegister.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpRxRegister.setDescription('A count of the number of times a REGISTER MPCP frames reception occurs. A single counter at the ONU and a set of counters, one for each LLID, at the OLT. Increment the counter by one for each REGISTER MPCP frame received, for each LLID, as defined in [802.3ah] clause 64. This counter is mandatory for an ONU and for an OLT. at the OLT the value should be zero.') hh3cDot3MpcpRxNotSupportedMPCP = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 1, 2, 1, 15), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3MpcpRxNotSupportedMPCP.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpRxNotSupportedMPCP.setDescription('A count of the number of times a non-supported MPCP frames reception occurs. A single counter at the ONU and a set of counters, one for each LLID, at the OLT. Increment the counter by one for each non-supported MPCP frame received, for each LLID, as defined in [802.3ah] clause 64. This counter is mandatory for an ONU and for an OLT.') hh3cDot3MpcpGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 2, 1)) hh3cDot3MpcpGroupBase = ObjectGroup((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 2, 1, 1)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpID"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpOperStatus"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpMode"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpLinkID"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpRemoteMACAddress"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpRegistrationState"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpMaximumPendingGrants"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpAdminState")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3MpcpGroupBase = hh3cDot3MpcpGroupBase.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpGroupBase.setDescription('A collection of objects of dot3 Mpcp Basic entity state definition.') hh3cDot3MpcpGroupParam = ObjectGroup((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 2, 1, 2)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpTransmitElapsed"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpReceiveElapsed"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpRoundTripTime"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpOnTime"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpOffTime"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpSyncTime")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3MpcpGroupParam = hh3cDot3MpcpGroupParam.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpGroupParam.setDescription('A collection of objects of dot3 Mpcp for P2MP parameters.') hh3cDot3MpcpGroupStat = ObjectGroup((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 2, 1, 3)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpMACCtrlFramesTransmitted"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpMACCtrlFramesReceived"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpDiscoveryWindowsSent"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpDiscoveryTimeout"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpTxRegRequest"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpRxRegRequest"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpTxRegAck"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpRxRegAck"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpTxReport"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpRxReport"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpTxGate"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpRxGate"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpTxRegister"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpRxRegister"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpRxNotSupportedMPCP")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3MpcpGroupStat = hh3cDot3MpcpGroupStat.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpGroupStat.setDescription('A collection of objects of dot3 Mpcp Statistics') hh3cDot3MpcpCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 2, 2)) hh3cDot3MpcpCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 1, 2, 2, 1)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpGroupBase"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpGroupParam"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3MpcpGroupStat")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3MpcpCompliance = hh3cDot3MpcpCompliance.setStatus('current') if mibBuilder.loadTexts: hh3cDot3MpcpCompliance.setDescription('The compliance statement for Multi-point control protocol interfaces.') hh3cDot3OmpEmulationMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2)) hh3cDot3OmpEmulationObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1)) hh3cDot3OmpeConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 2)) hh3cDot3OmpEmulationTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 1), ) if mibBuilder.loadTexts: hh3cDot3OmpEmulationTable.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationTable.setDescription('Table for dot3 OmpEmulation MIB modules.') hh3cDot3OmpEmulationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: hh3cDot3OmpEmulationEntry.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationEntry.setDescription('An entry in the dot3 OmpEmulation MIB modules table.') hh3cDot3OmpEmulationID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationID.setReference('[802.3ah], 30.3.7.1.1.') if mibBuilder.loadTexts: hh3cDot3OmpEmulationID.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationID.setDescription('The value of hh3cDot3OmpEmulationID is assigned so as to uniquely identify a OMPEmulation entity among the subordinate managed objects of the containing object. The value is mandated for an ONU.') hh3cDot3OmpEmulationType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unknown", 1), ("olt", 2), ("onu", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationType.setReference('[802.3ah], 30.3.7.1.2.') if mibBuilder.loadTexts: hh3cDot3OmpEmulationType.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationType.setDescription('A read-only value that indicates that mode of operation of the Reconciliation Sublayer for Point to Point Emulation (see [802.3ah] clause 65.1). unknown(1) value is assigned in initializing, true state or type not yet known. olt(2) value is assigned when Sublayer operating in OLT mode. onu(3) value is assigned when Sublayer operating in ONU mode.') hh3cDot3OmpEmulationStatTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2), ) if mibBuilder.loadTexts: hh3cDot3OmpEmulationStatTable.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationStatTable.setDescription('This table defines the list of statistics counters of [802.3ah] clause 65 OMP interface.') hh3cDot3OmpEmulationStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: hh3cDot3OmpEmulationStatEntry.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationStatEntry.setDescription('Table entries for Table of statistics counters of [802.3ah] clause 65 OMP interface.') hh3cDot3OmpEmulationSLDErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 1), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationSLDErrors.setReference('[802.3ah], 30.3.7.1.3.') if mibBuilder.loadTexts: hh3cDot3OmpEmulationSLDErrors.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationSLDErrors.setDescription('A count of frames received that do not contain a valid SLD field as defined in [802.3ah] clause 65.1.3.3.1. This attribute is mandatory for an OLT and optional for an ONU.') hh3cDot3OmpEmulationCRC8Errors = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 2), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationCRC8Errors.setReference('[802.3ah], 30.3.7.1.4.') if mibBuilder.loadTexts: hh3cDot3OmpEmulationCRC8Errors.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationCRC8Errors.setDescription('A count of frames received that contain a valid SLD field, as defined in [802.3ah] clause 65.1.3.3.1, but do not pass the CRC-8 check as defined in [802.3ah] clause 65.1.3.3.3. This attribute is mandatory for an OLT and for an ONU.') hh3cDot3OmpEmulationBadLLID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 3), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationBadLLID.setReference('[802.3ah], 30.3.7.1.8.') if mibBuilder.loadTexts: hh3cDot3OmpEmulationBadLLID.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationBadLLID.setDescription('A count of frames received that contain a valid SLD field, as defined in [802.3ah] clause 65.1.3.3.1, and pass the CRC-8 check, as defined in [802.3ah] clause 65.1.3.3.3, but are discarded due to the LLID check as defined in [802.3ah] clause 65.1.3.3.2. This attribute is relevant for an OLT and an ONU.') hh3cDot3OmpEmulationGoodLLID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 4), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationGoodLLID.setReference('[802.3ah], 30.3.7.1.5.') if mibBuilder.loadTexts: hh3cDot3OmpEmulationGoodLLID.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationGoodLLID.setDescription('A count of frames received that contain a valid SLD field, as defined in [802.3ah] clause 65.1.3.3.1, and pass the CRC-8 check, as defined in [802.3ah] clause 65.1.3.3.3. This attribute is relevant for an OLT and an ONU.') hh3cDot3OmpEmulationOnuPonCastLLID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 5), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationOnuPonCastLLID.setReference('[802.3ah], 30.3.7.1.6.') if mibBuilder.loadTexts: hh3cDot3OmpEmulationOnuPonCastLLID.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationOnuPonCastLLID.setDescription('A count of frames received that contain a valid SLD field in an ONU, as defined in [802.3ah] 65.1.3.3.1, passes the CRC-8 check, as defined in [802.3ah] 65.1.3.3.3, and the frame meets the rule for acceptance defined in [802.3ah] 65.1.3.3.2.') hh3cDot3OmpEmulationOltPonCastLLID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 6), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationOltPonCastLLID.setReference('[802.3ah], 30.3.7.1.7.') if mibBuilder.loadTexts: hh3cDot3OmpEmulationOltPonCastLLID.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationOltPonCastLLID.setDescription('A count of frames received that contain a valid SLD field in an OLT, as defined in [802.3ah] 65.1.3.3.1, passes the CRC-8 check, as defined in [802.3ah] 65.1.3.3.3, and the frame meets the rule for acceptance defined in [802.3ah] 65.1.3.3.2.') hh3cDot3OmpEmulationBroadcastLLIDNotOnuID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 7), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationBroadcastLLIDNotOnuID.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationBroadcastLLIDNotOnuID.setDescription('A count of frames received that contain a valid SLD field in a OLT, as defined in [802.3ah] clause 65.1.3.3.1, and pass the CRC-8 check, as defined in [802.3ah] clause 65.1.3.3.3, and contain broadcast LLID as defined in [802.3ah] clause 65. This attribute is mandatory for an OLT and for an ONU.') hh3cDot3OmpEmulationOnuLLIDNotBroadcast = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 8), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationOnuLLIDNotBroadcast.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationOnuLLIDNotBroadcast.setDescription("A count of frames received that contain a valid SLD field in a OLT, as defined in [802.3ah] clause 65.1.3.3.1, and pass the CRC-8 check, as defined in [802.3ah] clause 65.1.3.3.3, and contain the ONU's LLID as defined in [802.3ah] clause 65. This attribute is mandatory for an ONU and mandatory for an OLT (a counter per LLID).") hh3cDot3OmpEmulationBroadcastLLIDPlusOnuId = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 9), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationBroadcastLLIDPlusOnuId.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationBroadcastLLIDPlusOnuId.setDescription("A count of frames received that contain a valid SLD field in a OLT, as defined in [802.3ah] clause 65.1.3.3.1, and pass the CRC-8 check, as defined in [802.3ah] clause 65.1.3.3.3, and contain the broadcast LLID plus ONU's LLID (frame reflected) as defined in [802.3ah] clause 65. This attribute is mandatory for an ONU and mandatory for an OLT (a counter per LLID).") hh3cDot3OmpEmulationNotBroadcastLLIDNotOnuId = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 1, 2, 1, 10), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3OmpEmulationNotBroadcastLLIDNotOnuId.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpEmulationNotBroadcastLLIDNotOnuId.setDescription("A count of frames received that contain a valid SLD field in a OLT, as defined in [802.3ah] clause 65.1.3.3.1, and pass the CRC-8 check, as defined in [802.3ah] clause 65.1.3.3.3, and does not contain the ONU's LLID as defined in [802.3ah] clause 65. This attribute is mandatory for an ONU") hh3cDot3OmpeGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 2, 1)) hh3cDot3OmpeGroupID = ObjectGroup((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 2, 1, 1)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationID"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationType")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3OmpeGroupID = hh3cDot3OmpeGroupID.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpeGroupID.setDescription('A collection of objects of dot3 OMP emulation ID entity state definition.') hh3cDot3OmpeGroupStat = ObjectGroup((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 2, 1, 2)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationSLDErrors"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationCRC8Errors"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationBadLLID"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationGoodLLID"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationOnuPonCastLLID"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationOltPonCastLLID"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationBroadcastLLIDNotOnuID"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationOnuLLIDNotBroadcast"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationBroadcastLLIDPlusOnuId"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpEmulationNotBroadcastLLIDNotOnuId")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3OmpeGroupStat = hh3cDot3OmpeGroupStat.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpeGroupStat.setDescription('A collection of objects of dot3 OMP emulation Statistics') hh3cDot3OmpeCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 2, 2)) hh3cDot3OmpeCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 2, 2, 2, 1)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpeGroupID"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3OmpeGroupStat")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3OmpeCompliance = hh3cDot3OmpeCompliance.setStatus('current') if mibBuilder.loadTexts: hh3cDot3OmpeCompliance.setDescription('The compliance statement for OMPEmulation interfaces.') hh3cDot3EponMauMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3)) hh3cDot3EponMauObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 1)) hh3cDot3EponMauConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 2)) hh3cDot3EponMauTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 1, 1), ) if mibBuilder.loadTexts: hh3cDot3EponMauTable.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauTable.setDescription('Table for dot3 MAU EPON MIB modules.') hh3cDot3EponMauEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: hh3cDot3EponMauEntry.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauEntry.setDescription('An entry in the dot3 MAU EPON MIB modules table.') hh3cDot3EponMauPCSCodingViolation = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 1, 1, 1, 1), Counter32()).setUnits('octets').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3EponMauPCSCodingViolation.setReference('[802.3ah], 30.5.1.1.12.') if mibBuilder.loadTexts: hh3cDot3EponMauPCSCodingViolation.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauPCSCodingViolation.setDescription('For 100 Mb/ s operation it is a count of the number of times an invalid code-group is received, other than the /H/ code-group. For 1000 Mb/ s operation it is a count of the number of times an invalid codegroup is received, other than the /V/ code-group.') hh3cDot3EponMauFecAbility = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unknown", 1), ("nonsupported", 2), ("supported", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3EponMauFecAbility.setReference('[802.3ah], 30.5.1.1.13.') if mibBuilder.loadTexts: hh3cDot3EponMauFecAbility.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauFecAbility.setDescription('A read-only value that indicates the support of operation of the 1000BASE-PX PHY optional FEC Sublayer for Forward error correction see [802.3ah] clause 65.2). unknown(1) value is assigned in initializing, for non FEC support state or type not yet known. nonsupported(2) value is assigned when Sublayer is not support. supported(3) value is assigned when Sublayer is supported.') hh3cDot3EponMauFecMode = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unknown", 1), ("disabled", 2), ("enabled", 3))).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hh3cDot3EponMauFecMode.setReference('[802.3ah], 30.5.1.1.14.') if mibBuilder.loadTexts: hh3cDot3EponMauFecMode.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauFecMode.setDescription('A read-write value that indicates the mode of operation of the 1000BASE-PX PHY optional FEC Sublayer for Forward error correction see [802.3ah] clause 65.2). A GET operation returns the current mode of operation the PHY. A SET operation changes the mode of operation of the PHY to the indicated value. unknown(1) value is assigned in initializing, for non FEC support state or type not yet known. disabled(2) value is assigned when Sublayer operating in disabled mode. enabled(3) value is assigned when Sublayer operating in FEC mode. writing can be done all the time.') hh3cDot3EponMauFECCorrectedBlocks = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 1, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3EponMauFECCorrectedBlocks.setReference('[802.3ah], 30.5.1.1.15.') if mibBuilder.loadTexts: hh3cDot3EponMauFECCorrectedBlocks.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauFECCorrectedBlocks.setDescription('For 10PASS-TS, 2BASE-TL and 1000BASE-PX PHYs, a count of corrected FEC blocks. This counter will not increment for other PHY Types. Increment the counter by one for each received block that is corrected by the FEC function in the PHY.') hh3cDot3EponMauFECUncorrectableBlocks = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 1, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3EponMauFECUncorrectableBlocks.setReference('[802.3ah], 30.5.1.1.16.') if mibBuilder.loadTexts: hh3cDot3EponMauFECUncorrectableBlocks.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauFECUncorrectableBlocks.setDescription('For 10PASS-TS, 2BASE-TL and 1000BASE-PX PHYs, a count of uncorrectable FEC blocks. This counter will not increment for other PHY Types. Increment the counter by one for each FEC block that is determined to be uncorrectable by the FEC function in the PHY.') hh3cDot3EponMauBufferHeadCodingViolation = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 1, 1, 1, 6), Counter32()).setUnits('octets').setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cDot3EponMauBufferHeadCodingViolation.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauBufferHeadCodingViolation.setDescription('For 1000 Mbps operation it is a counts of the number of invalid code-group received directly from the link.') hh3cDot3EponMauType = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3)) hh3cEponMauType1000BasePXOLT = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 1)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePXOLT.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePXOLT.setDescription('Multipoint MAC Control (per 802.3 section 64,65) OLT (master), unknown PMD') if mibBuilder.loadTexts: hh3cEponMauType1000BasePXOLT.setReference('[802.3ah], 30.5.1.1.2.') hh3cEponMauType1000BasePXONU = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 2)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePXONU.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePXONU.setDescription('Multipoint MAC Control (per 802.3 section 64,65),ONU (slave), unknown PMD') if mibBuilder.loadTexts: hh3cEponMauType1000BasePXONU.setReference('[802.3ah], 30.5.1.1.2.') hh3cEponMauType1000BasePX10DOLT = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 3)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10DOLT.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10DOLT.setDescription('EPON over 10K link, downlink (per 802.3 section 60), OLT side') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10DOLT.setReference('[802.3ah], 30.5.1.1.2.') hh3cEponMauType1000BasePX10DONU = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 4)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10DONU.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10DONU.setDescription('EPON over 10K link, downlink (per 802.3 section 60), ONU side') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10DONU.setReference('[802.3ah], 30.5.1.1.2.') hh3cEponMauType1000BasePX10UOLT = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 5)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10UOLT.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10UOLT.setDescription('EPON over 10K link, uplink (per 802.3 section 60), OLT side') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10UOLT.setReference('[802.3ah], 30.5.1.1.2.') hh3cEponMauType1000BasePX10UONU = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 6)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10UONU.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10UONU.setDescription('EPON over 10K link, uplink (per 802.3 section 60), ONU side') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX10UONU.setReference('[802.3ah], 30.5.1.1.2.') hh3cEponMauType1000BasePX20DOLT = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 7)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20DOLT.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20DOLT.setDescription('EPON over 20K link, downlink (per 802.3 section 60), OLT side') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20DOLT.setReference('[802.3ah], 30.5.1.1.2.') hh3cEponMauType1000BasePX20DONU = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 8)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20DONU.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20DONU.setDescription('EPON over 20K link, downlink (per 802.3 section 60), ONU side') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20DONU.setReference('[802.3ah], 30.5.1.1.2.') hh3cEponMauType1000BasePX20UOLT = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 9)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20UOLT.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20UOLT.setDescription('EPON over 20K link, uplink (per 802.3 section 60), OLT side') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20UOLT.setReference('[802.3ah], 30.5.1.1.2.') hh3cEponMauType1000BasePX20UONU = ObjectIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 3, 10)) if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20UONU.setStatus('current') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20UONU.setDescription('EPON over 20K link, uplink (per 802.3 section 60), ONU side') if mibBuilder.loadTexts: hh3cEponMauType1000BasePX20UONU.setReference('[802.3ah], 30.5.1.1.2.') hh3cDot3EponMauGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 2, 1)) hh3cDot3EponMauGroupAll = ObjectGroup((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 2, 1, 1)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3EponMauPCSCodingViolation")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3EponMauGroupAll = hh3cDot3EponMauGroupAll.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauGroupAll.setDescription('A collection of objects of dot3 MAU definition.') hh3cDot3EponMauGroupFEC = ObjectGroup((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 2, 1, 2)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3EponMauFecAbility"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3EponMauFecMode"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3EponMauFECCorrectedBlocks"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3EponMauFECUncorrectableBlocks"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3EponMauBufferHeadCodingViolation")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3EponMauGroupFEC = hh3cDot3EponMauGroupFEC.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauGroupFEC.setDescription('A collection of objects of FEC group definition.') hh3cDot3EponMauCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 2, 2)) hh3cDot3EponMauCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 25506, 2, 42, 2, 3, 2, 2, 1)).setObjects(("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3EponMauGroupAll"), ("HH3C-DOT3-EFM-EPON-MIB", "hh3cDot3EponMauGroupFEC")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hh3cDot3EponMauCompliance = hh3cDot3EponMauCompliance.setStatus('current') if mibBuilder.loadTexts: hh3cDot3EponMauCompliance.setDescription('The compliance statement for MAU EPON interfaces.') mibBuilder.exportSymbols("HH3C-DOT3-EFM-EPON-MIB", hh3cDot3MpcpRxNotSupportedMPCP=hh3cDot3MpcpRxNotSupportedMPCP, hh3cEponMauType1000BasePXONU=hh3cEponMauType1000BasePXONU, hh3cDot3OmpEmulationGoodLLID=hh3cDot3OmpEmulationGoodLLID, hh3cDot3MpcpCompliances=hh3cDot3MpcpCompliances, hh3cEponMauType1000BasePX10UOLT=hh3cEponMauType1000BasePX10UOLT, hh3cDot3OmpeGroupStat=hh3cDot3OmpeGroupStat, hh3cDot3OmpeConformance=hh3cDot3OmpeConformance, hh3cEponMauType1000BasePX10UONU=hh3cEponMauType1000BasePX10UONU, hh3cEponMauType1000BasePX20DONU=hh3cEponMauType1000BasePX20DONU, hh3cDot3OmpEmulationStatEntry=hh3cDot3OmpEmulationStatEntry, hh3cDot3OmpEmulationType=hh3cDot3OmpEmulationType, hh3cDot3MpcpRxGate=hh3cDot3MpcpRxGate, hh3cEponMauType1000BasePX10DONU=hh3cEponMauType1000BasePX10DONU, hh3cDot3EponMauPCSCodingViolation=hh3cDot3EponMauPCSCodingViolation, hh3cEponMauType1000BasePX20UONU=hh3cEponMauType1000BasePX20UONU, hh3cDot3MpcpTxRegister=hh3cDot3MpcpTxRegister, hh3cDot3MpcpDiscoveryWindowsSent=hh3cDot3MpcpDiscoveryWindowsSent, hh3cDot3OmpEmulationMIB=hh3cDot3OmpEmulationMIB, hh3cDot3MpcpMACCtrlFramesReceived=hh3cDot3MpcpMACCtrlFramesReceived, hh3cDot3MpcpConformance=hh3cDot3MpcpConformance, hh3cDot3MpcpMACCtrlFramesTransmitted=hh3cDot3MpcpMACCtrlFramesTransmitted, hh3cDot3OmpEmulationCRC8Errors=hh3cDot3OmpEmulationCRC8Errors, PYSNMP_MODULE_ID=hh3cDot3EfmeponMIB, hh3cDot3OmpEmulationBadLLID=hh3cDot3OmpEmulationBadLLID, hh3cDot3MpcpObjects=hh3cDot3MpcpObjects, hh3cDot3EponMauGroupFEC=hh3cDot3EponMauGroupFEC, hh3cDot3MpcpAdminState=hh3cDot3MpcpAdminState, hh3cDot3EponMauGroups=hh3cDot3EponMauGroups, hh3cDot3MpcpGroups=hh3cDot3MpcpGroups, hh3cDot3EponMauType=hh3cDot3EponMauType, hh3cDot3MpcpStatTable=hh3cDot3MpcpStatTable, hh3cDot3MpcpOnTime=hh3cDot3MpcpOnTime, hh3cDot3OmpEmulationStatTable=hh3cDot3OmpEmulationStatTable, hh3cDot3EponMauBufferHeadCodingViolation=hh3cDot3EponMauBufferHeadCodingViolation, hh3cDot3MpcpGroupParam=hh3cDot3MpcpGroupParam, hh3cDot3OmpEmulationBroadcastLLIDNotOnuID=hh3cDot3OmpEmulationBroadcastLLIDNotOnuID, hh3cDot3MpcpCompliance=hh3cDot3MpcpCompliance, hh3cDot3EponMauFECUncorrectableBlocks=hh3cDot3EponMauFECUncorrectableBlocks, hh3cDot3MpcpRxReport=hh3cDot3MpcpRxReport, hh3cEponMauType1000BasePX10DOLT=hh3cEponMauType1000BasePX10DOLT, hh3cDot3OmpEmulationSLDErrors=hh3cDot3OmpEmulationSLDErrors, hh3cDot3EponMauCompliances=hh3cDot3EponMauCompliances, hh3cDot3MpcpRemoteMACAddress=hh3cDot3MpcpRemoteMACAddress, hh3cDot3MpcpMaximumPendingGrants=hh3cDot3MpcpMaximumPendingGrants, hh3cDot3MpcpTable=hh3cDot3MpcpTable, hh3cDot3EponMauEntry=hh3cDot3EponMauEntry, hh3cDot3OmpEmulationOnuPonCastLLID=hh3cDot3OmpEmulationOnuPonCastLLID, hh3cDot3EponMauTable=hh3cDot3EponMauTable, hh3cDot3OmpEmulationEntry=hh3cDot3OmpEmulationEntry, hh3cDot3MpcpRxRegRequest=hh3cDot3MpcpRxRegRequest, hh3cDot3EponMauFecAbility=hh3cDot3EponMauFecAbility, hh3cDot3EponMauMIB=hh3cDot3EponMauMIB, hh3cDot3MpcpTxRegRequest=hh3cDot3MpcpTxRegRequest, hh3cDot3MpcpEntry=hh3cDot3MpcpEntry, hh3cDot3MpcpStatEntry=hh3cDot3MpcpStatEntry, hh3cDot3OmpEmulationObjects=hh3cDot3OmpEmulationObjects, hh3cDot3MpcpMode=hh3cDot3MpcpMode, hh3cDot3OmpEmulationNotBroadcastLLIDNotOnuId=hh3cDot3OmpEmulationNotBroadcastLLIDNotOnuId, hh3cDot3EponMauCompliance=hh3cDot3EponMauCompliance, hh3cDot3MpcpReceiveElapsed=hh3cDot3MpcpReceiveElapsed, hh3cDot3MpcpOperStatus=hh3cDot3MpcpOperStatus, hh3cDot3MpcpOffTime=hh3cDot3MpcpOffTime, hh3cDot3OmpEmulationBroadcastLLIDPlusOnuId=hh3cDot3OmpEmulationBroadcastLLIDPlusOnuId, hh3cDot3MpcpMIB=hh3cDot3MpcpMIB, hh3cDot3MpcpGroupBase=hh3cDot3MpcpGroupBase, hh3cDot3MpcpGroupStat=hh3cDot3MpcpGroupStat, hh3cDot3OmpeGroups=hh3cDot3OmpeGroups, hh3cDot3OmpEmulationTable=hh3cDot3OmpEmulationTable, hh3cDot3OmpEmulationID=hh3cDot3OmpEmulationID, hh3cDot3MpcpTransmitElapsed=hh3cDot3MpcpTransmitElapsed, hh3cDot3EponMauObjects=hh3cDot3EponMauObjects, hh3cDot3EponMauFecMode=hh3cDot3EponMauFecMode, hh3cDot3MpcpTxReport=hh3cDot3MpcpTxReport, hh3cDot3EponMauFECCorrectedBlocks=hh3cDot3EponMauFECCorrectedBlocks, hh3cDot3OmpeCompliance=hh3cDot3OmpeCompliance, hh3cDot3EponMauGroupAll=hh3cDot3EponMauGroupAll, hh3cEponMauType1000BasePX20UOLT=hh3cEponMauType1000BasePX20UOLT, hh3cDot3OmpEmulationOnuLLIDNotBroadcast=hh3cDot3OmpEmulationOnuLLIDNotBroadcast, hh3cDot3MpcpTxRegAck=hh3cDot3MpcpTxRegAck, hh3cDot3MpcpRegistrationState=hh3cDot3MpcpRegistrationState, hh3cDot3MpcpRoundTripTime=hh3cDot3MpcpRoundTripTime, hh3cDot3EfmeponMIB=hh3cDot3EfmeponMIB, hh3cDot3MpcpRxRegAck=hh3cDot3MpcpRxRegAck, hh3cDot3MpcpDiscoveryTimeout=hh3cDot3MpcpDiscoveryTimeout, hh3cEponMauType1000BasePX20DOLT=hh3cEponMauType1000BasePX20DOLT, hh3cDot3MpcpLinkID=hh3cDot3MpcpLinkID, hh3cDot3MpcpRxRegister=hh3cDot3MpcpRxRegister, hh3cDot3MpcpID=hh3cDot3MpcpID, hh3cEponMauType1000BasePXOLT=hh3cEponMauType1000BasePXOLT, hh3cDot3EponMauConformance=hh3cDot3EponMauConformance, hh3cDot3OmpeCompliances=hh3cDot3OmpeCompliances, hh3cDot3OmpEmulationOltPonCastLLID=hh3cDot3OmpEmulationOltPonCastLLID, hh3cDot3OmpeGroupID=hh3cDot3OmpeGroupID, hh3cDot3MpcpTxGate=hh3cDot3MpcpTxGate, hh3cDot3MpcpSyncTime=hh3cDot3MpcpSyncTime)
169.311573
5,121
0.783483
7,495
57,058
5.962508
0.080987
0.053704
0.093983
0.008414
0.569245
0.447672
0.427398
0.391573
0.352906
0.327955
0
0.095076
0.101353
57,058
336
5,122
169.815476
0.77648
0.005924
0
0.033846
0
0.150769
0.418032
0.04403
0
0
0
0
0
1
0
false
0.043077
0.024615
0
0.024615
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3ecdb707d9b5224c78e8710bc0080bbb309fdaf0
279
py
Python
config.py
DiagnoSkin/diagnoskin-server
e1cae10423323cc681d6acf6cc5d1511e6e2cae5
[ "Apache-2.0" ]
null
null
null
config.py
DiagnoSkin/diagnoskin-server
e1cae10423323cc681d6acf6cc5d1511e6e2cae5
[ "Apache-2.0" ]
4
2021-06-08T20:42:49.000Z
2022-03-12T00:08:54.000Z
config.py
DiagnoSkin/diagnoskin-server
e1cae10423323cc681d6acf6cc5d1511e6e2cae5
[ "Apache-2.0" ]
null
null
null
import json class Config: def __init__(self, configPath): with open(configPath) as configFile: configFileContent = json.load(configFile) self.imageHeight = configFileContent['imageHeight'] self.imageWidth = configFileContent['imageWidth']
34.875
59
0.698925
25
279
7.64
0.64
0
0
0
0
0
0
0
0
0
0
0
0.215054
279
8
60
34.875
0.872146
0
0
0
0
0
0.075
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.428571
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3ed5304c84ec79c59f7ad03780e20d83636a1751
493
py
Python
exec_ops/python/run.py
orm011/skyhookml
0cec9011ffbece3348cf56275f027c4b5b31b4d4
[ "MIT" ]
null
null
null
exec_ops/python/run.py
orm011/skyhookml
0cec9011ffbece3348cf56275f027c4b5b31b4d4
[ "MIT" ]
null
null
null
exec_ops/python/run.py
orm011/skyhookml
0cec9011ffbece3348cf56275f027c4b5b31b4d4
[ "MIT" ]
null
null
null
import sys sys.path.append('./python') import skyhook.common as lib import io import json import math import numpy import os import os.path import skimage.io import struct user_func = None # user_func will be defined by the exec call in meta_func def callback(*args): return user_func(*args) def meta_func(meta): global user_func # code should define a function "f" locals = {} exec(meta['Code'], None, locals) user_func = locals['f'] lib.run(callback, meta_func)
17.607143
57
0.720081
79
493
4.392405
0.518987
0.115274
0
0
0
0
0
0
0
0
0
0
0.186613
493
27
58
18.259259
0.865337
0.180527
0
0
0
0
0.032419
0
0
0
0
0
0
1
0.1
false
0
0.5
0.05
0.65
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3ed9543d76f8e0c91108d623c8ce3f5c3c426593
3,965
py
Python
MyUser/api/tests/allauth_login.py
mrvafa/blog-api
cef0773b3199bfb785126ce82567fd7fc78e6c89
[ "MIT" ]
null
null
null
MyUser/api/tests/allauth_login.py
mrvafa/blog-api
cef0773b3199bfb785126ce82567fd7fc78e6c89
[ "MIT" ]
null
null
null
MyUser/api/tests/allauth_login.py
mrvafa/blog-api
cef0773b3199bfb785126ce82567fd7fc78e6c89
[ "MIT" ]
null
null
null
from django.test import TestCase, override_settings from django.urls import reverse from rest_framework.test import APIClient from MyUser.models import User @override_settings(ACCOUNT_EMAIL_VERIFICATION='none') class TestAllAuthLogin(TestCase): def setUp(self): self.client = APIClient() self.user_1 = { 'username': 'user1', 'email': '[email protected]', 'password1': 'm2^CexxBmsNrBx\'+', 'password2': 'm2^CexxBmsNrBx\'+' } self.user_2 = User.objects.create(username='user2', email='[email protected]') self.user_2.set_password('!jX+2#~:SvX@mMz:') self.user_2.save() self.user_3 = User.objects.create(username='user3', email='[email protected]') def test_ok_login(self): res = self.client.post(reverse('rest_login'), data={'username': 'user2', 'password': '!jX+2#~:SvX@mMz:'}) self.assertEqual(200, res.status_code) def test_ok_get_profile(self): user_data = {'username': 'user2', 'password': '!jX+2#~:SvX@mMz:'} token = self.client.post(reverse('rest_login'), data=user_data).json() self.client.credentials(HTTP_AUTHORIZATION=f'Token {token["key"]}') res = self.client.get(reverse('rest_user_details')) self.assertEqual(200, res.status_code) def test_ok_get_profile_check_details(self): user_data = {'username': 'user2', 'password': '!jX+2#~:SvX@mMz:'} token = self.client.post(reverse('rest_login'), data=user_data).json() self.client.credentials(HTTP_AUTHORIZATION=f'Token {token["key"]}') res = self.client.get(reverse('rest_user_details')) result = res.json() self.assertEqual('', result['first_name']) self.assertEqual('', result['last_name']) self.assertEqual('user2', result['username']) self.assertFalse('password' in result) def test_edit_get_profile_first_name(self): user_data = {'username': 'user2', 'password': '!jX+2#~:SvX@mMz:'} token = self.client.post(reverse('rest_login'), data=user_data).json() self.client.credentials(HTTP_AUTHORIZATION=f'Token {token["key"]}') res = self.client.patch(reverse('rest_user_details'), data={'first_name': 'Ali', 'username': 'user2'}) result = res.json() self.assertEqual('Ali', result['first_name']) self.assertEqual('', result['last_name']) self.assertEqual('user2', result['username']) def test_edit_get_profile_last_name(self): user_data = {'username': 'user2', 'password': '!jX+2#~:SvX@mMz:'} token = self.client.post(reverse('rest_login'), data=user_data).json() self.client.credentials(HTTP_AUTHORIZATION=f'Token {token["key"]}') res = self.client.patch(reverse('rest_user_details'), data={'last_name': 'last_name', 'username': 'user2'}) result = res.json() self.assertEqual('', result['first_name']) self.assertEqual('last_name', result['last_name']) self.assertEqual('user2', result['username']) def test_check_editable_email(self): user_data = {'username': 'user2', 'password': '!jX+2#~:SvX@mMz:'} token = self.client.post(reverse('rest_login'), data=user_data).json() self.client.credentials(HTTP_AUTHORIZATION=f'Token {token["key"]}') res = self.client.patch(reverse('rest_user_details'), data={'email': '[email protected]', 'username': 'user2'}) result = res.json() self.assertEqual(User.objects.get(username='user2').email, result['email']) def test_check_change_username_taken(self): user_data = {'username': 'user2', 'password': '!jX+2#~:SvX@mMz:'} token = self.client.post(reverse('rest_login'), data=user_data).json() self.client.credentials(HTTP_AUTHORIZATION=f'Token {token["key"]}') res = self.client.patch(reverse('rest_user_details'), data={'username': 'user3'}) self.assertEqual(400, res.status_code)
50.189873
118
0.64691
491
3,965
5.044807
0.164969
0.080743
0.035527
0.045216
0.706096
0.691966
0.683488
0.633024
0.619298
0.619298
0
0.014715
0.177301
3,965
78
119
50.833333
0.744635
0
0
0.485294
0
0
0.233796
0
0
0
0
0
0.205882
1
0.117647
false
0.161765
0.058824
0
0.191176
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2