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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6c7e6cf386547801990f6d25c8effda1210fa9b1 | 521 | py | Python | Dictionary/relativeRanks.py | Abhimanyu210100/Leetcode | 2b0d8c9fa152cdf6e2dc8c1563c9cb25cd5ee697 | [
"MIT"
] | null | null | null | Dictionary/relativeRanks.py | Abhimanyu210100/Leetcode | 2b0d8c9fa152cdf6e2dc8c1563c9cb25cd5ee697 | [
"MIT"
] | null | null | null | Dictionary/relativeRanks.py | Abhimanyu210100/Leetcode | 2b0d8c9fa152cdf6e2dc8c1563c9cb25cd5ee697 | [
"MIT"
] | null | null | null | class Solution:
def findRelativeRanks(self, score: List[int]) -> List[str]:
sorted_score = sorted(score,reverse=True)
rankings = {}
for i in range(len(sorted_score)):
if i == 0: rankings[sorted_score[i]] = 'Gold Medal'
elif i == 1: rankings[sorted_score[i]] = 'Silver Medal'
elif i == 2: rankings[sorted_score[i]] = 'Bronze Medal'
else: rankings[sorted_score[i]] = str(i+1)
return [rankings[points] for points in score]
| 43.416667 | 67 | 0.575816 | 66 | 521 | 4.454545 | 0.454545 | 0.261905 | 0.258503 | 0.272109 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01087 | 0.293666 | 521 | 12 | 68 | 43.416667 | 0.788043 | 0 | 0 | 0 | 0 | 0 | 0.065134 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.3 | 0 | 0 | 0 | 0 | null | 1 | 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 | 3 |
6c8c04f1aa591bbc1a5fefd330b74bc19b79e47d | 164 | py | Python | apps/greencheck/urls.py | denning/admin-portal | 34a8e9f07f88c85c01ae1255517d889fb7951ba5 | [
"Apache-2.0"
] | 10 | 2020-11-23T22:47:26.000Z | 2022-01-28T16:26:50.000Z | apps/greencheck/urls.py | denning/admin-portal | 34a8e9f07f88c85c01ae1255517d889fb7951ba5 | [
"Apache-2.0"
] | 83 | 2020-05-17T20:25:50.000Z | 2022-03-29T18:11:50.000Z | apps/greencheck/urls.py | denning/admin-portal | 34a8e9f07f88c85c01ae1255517d889fb7951ba5 | [
"Apache-2.0"
] | 3 | 2020-11-30T00:13:45.000Z | 2021-06-11T13:42:04.000Z | from django.urls import path
from .views import GreencheckStatsView
urlpatterns = [
path("", GreencheckStatsView.as_view(), name="greencheck-stats-index"),
]
| 20.5 | 75 | 0.75 | 18 | 164 | 6.777778 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128049 | 164 | 7 | 76 | 23.428571 | 0.853147 | 0 | 0 | 0 | 0 | 0 | 0.134146 | 0.134146 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
669af12660b345464669380b528589babcbfea71 | 275 | py | Python | pesto/backend/celery/tasks.py | saromanov/pesto | b14e92ac8295400fb56d84d7d05d5450e7dc7d61 | [
"MIT"
] | null | null | null | pesto/backend/celery/tasks.py | saromanov/pesto | b14e92ac8295400fb56d84d7d05d5450e7dc7d61 | [
"MIT"
] | 15 | 2021-01-09T18:54:03.000Z | 2022-03-12T00:21:09.000Z | pesto/backend/celery/tasks.py | saromanov/pesto | b14e92ac8295400fb56d84d7d05d5450e7dc7d61 | [
"MIT"
] | null | null | null | import datetime
from .celery import celery
from backend.news import hot_topics
from backend.cache import sadd
from backend.utils import time_now_formatted
@celery.task(bind=True)
def store_hot_topics(a):
sadd(time_now_formatted('PESTO_SYSTEM_HOT_TOPICS'), hot_topics()) | 30.555556 | 69 | 0.821818 | 43 | 275 | 5 | 0.511628 | 0.167442 | 0.148837 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101818 | 275 | 9 | 69 | 30.555556 | 0.870445 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.625 | 0 | 0.75 | 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 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
669c157aec4594e0caeb946ae6567aa23fd20073 | 428 | py | Python | actions/migrations/0002_auto_20200907_1450.py | khicks01/assistant-bot-kyle | 2e7cbf06f8437994e3c3d095a490fb145e272ba8 | [
"MIT"
] | null | null | null | actions/migrations/0002_auto_20200907_1450.py | khicks01/assistant-bot-kyle | 2e7cbf06f8437994e3c3d095a490fb145e272ba8 | [
"MIT"
] | null | null | null | actions/migrations/0002_auto_20200907_1450.py | khicks01/assistant-bot-kyle | 2e7cbf06f8437994e3c3d095a490fb145e272ba8 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.1 on 2020-09-07 19:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('actions', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='slackpost',
name='time_stamp',
),
migrations.RemoveField(
model_name='slackpost',
name='user',
),
]
| 19.454545 | 47 | 0.556075 | 41 | 428 | 5.707317 | 0.707317 | 0.179487 | 0.222222 | 0.25641 | 0.367521 | 0.367521 | 0 | 0 | 0 | 0 | 0 | 0.066202 | 0.329439 | 428 | 21 | 48 | 20.380952 | 0.749129 | 0.10514 | 0 | 0.4 | 1 | 0 | 0.133858 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
66c767435832ce9c0812a248878be4c093bfe704 | 75 | py | Python | setup.py | sandipan1/rl_dobot | 2317c171f73ae6714c13a6e85cff3d894b242687 | [
"MIT"
] | 2 | 2018-11-09T19:31:46.000Z | 2020-01-28T11:20:08.000Z | setup.py | sandipan1/rl_dobot | 2317c171f73ae6714c13a6e85cff3d894b242687 | [
"MIT"
] | null | null | null | setup.py | sandipan1/rl_dobot | 2317c171f73ae6714c13a6e85cff3d894b242687 | [
"MIT"
] | 1 | 2021-01-10T09:36:25.000Z | 2021-01-10T09:36:25.000Z | from setuptools import setup
setup(name='rl_dobot',
version='0.1',
) | 15 | 28 | 0.68 | 11 | 75 | 4.545455 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032258 | 0.173333 | 75 | 5 | 29 | 15 | 0.774194 | 0 | 0 | 0 | 0 | 0 | 0.144737 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
66e057b87228e98f13d899bbe88191335c47856c | 10,764 | py | Python | autorun/autorun/varecof.py | sjklipp/autoio | e2b471e9c9dec933319c98a30d4d519ca5d47645 | [
"Apache-2.0"
] | null | null | null | autorun/autorun/varecof.py | sjklipp/autoio | e2b471e9c9dec933319c98a30d4d519ca5d47645 | [
"Apache-2.0"
] | 1 | 2022-02-15T19:35:14.000Z | 2022-02-15T19:35:14.000Z | autorun/autorun/varecof.py | sjklipp/autoio | e2b471e9c9dec933319c98a30d4d519ca5d47645 | [
"Apache-2.0"
] | 13 | 2020-06-24T05:21:11.000Z | 2021-05-05T19:58:30.000Z | """ Generate the information necessary to product the vrctst input files
"""
# import os
# import autofile
# import automol
# import varecof_io
# from phydat import phycon
# from autorun._run import run_script
# from autorun._run import from_input_string
#
#
# # Default names of input and output files
# INPUT_NAME = 'tst.inp'
# AUX_NAMES = (
# 'structure.inp',
# 'divsur.inp',
# 'lr_divsur.inp',
# 'molpro.inp',
# 'mol.tml',
# 'mc_flux.inp',
# 'convert.inp',
# 'machines',
# 'molpro.sh')
# POT_INPUT_NAMES = (
# '{}_corr.f'
# 'dummy_corr.f',
# 'pot_aux.f',
# 'makefile')
#
# # Names of strings, files that go into the input
# DUMMY_NAME = 'dummy_corr_'
# LIB_NAME = 'libcorrpot.so'
# EXE_NAME = 'molpro.sh'
# SPC_NAME = 'mol'
# GEOM_PTT = 'GEOMETRY_HERE'
# ENE_PTT = 'molpro_energy'
#
# # Default nmaes of output
# POT_OUTPUT_NAMES = (
# 'libcorrpot.so',)
#
# OUTPUT_NAMES = ('flux.out',)
# DIVSUR_OUTPUT_NAMES1 = ('divsur.out',)
#
#
# # Specialized runners
# def flux_file(script_str, run_dir):
# """ Calculate the flux file
# """
# # aux_dct=None,
# # input_name=INPUT_NAME, output_names=OUTPUT_NAMES):
# #
# # # output_strs = direct()
# #
# print(
# 'Generating flux file with TS N(E) from VaReCoF output...')
# run_script(script_str, run_dir)
# #
# # with open():
# # flux_str = fobj.read()
# #
# # return flux_str
#
#
# # General runners
# def direct(script_str, run_dir,
# aux_dct=None,
# input_name=INPUT_NAME, output_names=OUTPUT_NAMES):
# """ Builds all of the VaReCoF input and then returns the output strings
# """
#
# input_str, aux_dcr = _write_varecof_input()
#
# # Run VaReCoF
# output_strs = from_input_string(
# script_str, run_dir, input_str,
# aux_dct=aux_dct,
# input_name=input_name,
# output_names=output_names)
#
# return output_strs
#
#
# # Helpful runners for the more directly called ones
# def compile_potentials(vrc_path, mep_distances, potentials,
# bnd_frm_idxs, fortran_compiler,
# dist_restrict_idxs=(),
# pot_labels=(),
# pot_file_names=(),
# spc_name='mol'):
# """ use the MEP potentials to compile the correction potential .so file
# """
#
# # Change the coordinates of the MEP distances
# # mep_distances = [dist * phycon.BOHR2ANG for dist in mep_distances]
#
# # Build string Fortan src file containing correction potentials
# species_corr_str = varecof_io.writer.corr_potentials.species(
# mep_distances,
# potentials,
# bnd_frm_idxs,
# dist_restrict_idxs=dist_restrict_idxs,
# pot_labels=pot_labels,
# species_name=spc_name)
#
# # Build string dummy corr file where no correction used
# dummy_corr_str = varecof_io.writer.corr_potentials.dummy()
#
# # Build string for auxiliary file needed for spline fitting
# pot_aux_str = varecof_io.writer.corr_potentials.auxiliary()
#
# # Build string for makefile to compile corr pot file into .so file
# makefile_str = varecof_io.writer.corr_potentials.makefile(
# fortran_compiler, pot_file_names=pot_file_names)
#
# # Write all of the files needed to build the correction potential
# with open(os.path.join(vrc_path, spc_name+'_corr.f'), 'w') as corr_file:
# corr_file.write(species_corr_str)
# with open(os.path.join(vrc_path, 'dummy_corr.f'), 'w') as corr_file:
# corr_file.write(dummy_corr_str)
# with open(os.path.join(vrc_path, 'pot_aux.f'), 'w') as corr_file:
# corr_file.write(pot_aux_str)
# with open(os.path.join(vrc_path, 'makefile'), 'w') as corr_file:
# corr_file.write(makefile_str)
#
# # Compile the correction potential
# varecof_io.writer.corr_potentials.compile_corr_pot(vrc_path)
#
# # Maybe read the potential and return it, prob not needed
#
#
# def frame_oriented_structure(vrc_path, script_str, divsur_inp_str):
# """ get the divsur.out string containing divsur-frame geoms
# """
#
# # Have to to path with divsur.inp to run script (maybe can fix)
# os.chdir(vrc_path)
#
# # Run the VaReCoF utility script to get the divsur.out file
# # Contains the fragment geometries in the divsur-defined coord sys
# varecof_io.writer.util.divsur_frame_geom_script()
#
# # Read fragment geoms from divsur.out with coordinates in the divsurframe
# # with open(os.path.join(vrc_path, 'divsur.out'), 'r') as divsur_file:
# # output_string = divsur_file.read()
#
# # geoms = varecof_io.reader.__(output_string)
#
# # return geoms
#
#
# # STUFF FROM MECHDRIVER
# def _write_varecof_input(ref_zma, ts_info, ts_formula, high_mul,
# rct_ichs, rct_info, rct_zmas,
# active_space, mod_var_sp1_thy_info,
# npot, inf_sep_ene,
# min_idx, max_idx,
# vrc_dct, vrc_path, script_str):
# """ prepare all the input files for a vrc-tst calculation
# """
#
# r1dists_lr = vrc_dct['r1dists_lr']
# r1dists_sr = vrc_dct['r1dists_sr']
# r2dists_sr = vrc_dct['r2dists_sr']
# d1dists = vrc_dct['d1dists']
# d2dists = vrc_dct['d2dists']
# conditions = vrc_dct['conditions']
# nsamp_max = vrc_dct['nsamp_max']
# nsamp_min = vrc_dct['nsamp_min']
# flux_err = vrc_dct['flux_err']
# pes_size = vrc_dct['pes_size']
# base_name = vrc_dct['base_name']
# # exe_path = vrc_dct['exe_path']
#
# # Build geometries needed for the varecof run
# total_geom, frag_geoms, frag_geoms_wdummy = fragment_geometries(
# ref_zma, rct_zmas, min_idx, max_idx)
#
# # Set information for the pivot points needed in divsur.inp
# frames, npivots = build_pivot_frames(
# min_idx, max_idx, total_geom, frag_geoms, frag_geoms_wdummy)
# pivot_angles = calc_pivot_angles(frag_geoms, frag_geoms_wdummy, frames)
# pivot_xyzs = calc_pivot_xyzs(min_idx, max_idx, total_geom, frag_geoms)
#
# # Write the long- and short-range divsur input files
# lrdivsur_inp_str = varecof_io.writer.input_file.divsur(
# r1dists_lr, 1, 1, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0])
#
# # Write the short-range divsur files
# t1angs = [pivot_angles[0]] if pivot_angles[0] is not None else []
# t2angs = [pivot_angles[1]] if pivot_angles[1] is not None else []
# if automol.geom.is_atom(frag_geoms[0]):
# d1dists = []
# t1angs = []
# if automol.geom.is_atom(frag_geoms[1]):
# d2dists = []
# t2angs = []
# if automol.geom.is_linear(frag_geoms[0]):
# d1dists = [0.]
# t1angs = []
# if automol.geom.is_linear(frag_geoms[1]):
# d2dists = [0.]
# t2angs = []
# if all(npiv > 1 for npiv in npivots):
# r2dists = r2dists_sr
# else:
# r2dists = []
# ioprinter.warning_message('no r2dist')
#
# srdivsur_inp_str = varecof_io.writer.input_file.divsur(
# r1dists_sr, npivots[0], npivots[1], pivot_xyzs[0], pivot_xyzs[1],
# frame1=frames[0], frame2=frames[1],
# d1dists=d1dists, d2dists=d2dists,
# t1angs=t1angs, t2angs=t2angs,
# r2dists=r2dists,
# **conditions)
#
# # Build the structure input file string
# struct_inp_str = varecof_io.writer.input_file.structure(
# frag_geoms_wdummy[0], frag_geoms_wdummy[1])
#
# # Write the structure and divsur files to get the divsur out file
# inp = ((
# (struct_inp_str, 'structure.inp'), (srdivsur_inp_str, 'divsur.inp')))
# _write_varecof_inp(inp, vrc_path)
#
# # Obtain the divsur.out file with divsur-frame fragment geoms
# divsur_out_str = build_divsur_out_file(vrc_path, os.getcwd())
#
# # Write the tst.inp file
# faces, faces_symm = assess_face_symmetries(divsur_out_str)
# tst_inp_str = varecof_io.writer.input_file.tst(
# nsamp_max, nsamp_min, flux_err, pes_size,
# faces=faces, faces_symm=faces_symm)
#
# # Write the molpro executable and potential energy surface input string
# els_inp_str = varecof_io.writer.input_file.elec_struct(
# vrc_path, base_name, npot,
# dummy_name='dummy_corr_', lib_name='libcorrpot.so',
# exe_name='molpro.sh',
# geom_ptt='GEOMETRY_HERE', ene_ptt='molpro_energy')
#
# # Write the electronic structure template file
# tml_inp_str = _build_molpro_template_str(
# ref_zma, ts_info, ts_formula, high_mul,
# rct_ichs, rct_info,
# active_space, mod_var_sp1_thy_info,
# inf_sep_ene)
#
# # Write the mc_flux.inp input string
# mc_flux_inp_str = varecof_io.writer.input_file.mc_flux()
#
# # Write the convert.inp input string
# conv_inp_str = varecof_io.writer.input_file.convert()
#
# # Write machines file to set compute nodes
# machine_file_str = build_machinefile_str()
#
# # Collate the input strings and write the remaining files
# input_strs = (
# lrdivsur_inp_str, tst_inp_str,
# els_inp_str, tml_inp_str,
# mc_flux_inp_str, conv_inp_str,
# machine_file_str, script_str)
# input_names = (
# 'lr_divsur.inp', 'tst.inp',
# 'molpro.inp', 'mol.tml',
# 'mc_flux.inp', 'convert.inp',
# 'machines', 'molpro.sh')
# inp = tuple(zip(input_strs, input_names))
# _write_varecof_inp(inp, vrc_path)
#
#
# def _build_molpro_template_str(ref_zma, ts_info, ts_formula, high_mul,
# rct_ichs, rct_info,
# active_space, mod_var_sp1_thy_info,
# inf_sep_ene):
# """ Write the electronic structure template file
# """
#
# cas_kwargs = wfn.build_wfn(ref_zma, ts_info, ts_formula, high_mul,
# rct_ichs, rct_info,
# active_space, mod_var_sp1_thy_info)
#
# tml_inp_str = wfn.wfn_string(
# ts_info, mod_var_sp1_thy_info, inf_sep_ene, cas_kwargs)
#
# return tml_inp_str
#
#
# VRC_DCT = {
# 'fortran_compiler': 'gfortran',
# 'base_name': 'mol',
# 'spc_name': 'mol',
# 'memory': 4.0,
# 'r1dists_lr': [8., 6., 5., 4.5, 4.],
# 'r1dists_sr': [4., 3.8, 3.6, 3.4, 3.2, 3., 2.8, 2.6, 2.4, 2.2],
# 'r2dists_sr': [4., 3.8, 3.6, 3.4, 3.2, 3., 2.8, 2.6, 2.4, 2.2],
# 'd1dists': [0.01, 0.5, 1.],
# 'd2dists': [0.01, 0.5, 1.],
# 'conditions': {},
# 'nsamp_max': 2000,
# 'nsamp_min': 50,
# 'flux_err': 10,
# 'pes_size': 2,
# }
| 34.948052 | 79 | 0.620401 | 1,449 | 10,764 | 4.307798 | 0.183575 | 0.018263 | 0.03124 | 0.031721 | 0.329862 | 0.317526 | 0.262095 | 0.184076 | 0.143704 | 0.110381 | 0 | 0.018477 | 0.255853 | 10,764 | 307 | 80 | 35.061889 | 0.760799 | 0.937941 | 0 | null | 1 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd00f6cb87351247a7649d40c0143f1b9a2e718c | 2,768 | py | Python | src/lib/utils.py | snxfz947/EmailForwardingValidator | c2062fae0a7d9b55d33e8ed1577dd54ca9a2d62c | [
"MIT"
] | null | null | null | src/lib/utils.py | snxfz947/EmailForwardingValidator | c2062fae0a7d9b55d33e8ed1577dd54ca9a2d62c | [
"MIT"
] | 10 | 2019-06-13T07:33:27.000Z | 2019-07-18T03:35:20.000Z | src/lib/utils.py | snxfz947/email-forwarding-validator | c2062fae0a7d9b55d33e8ed1577dd54ca9a2d62c | [
"MIT"
] | null | null | null | import json
import os
def config_get_dev():
with open("../dev_config.json") as config_file:
return json.load(config_file)
def config_get_user():
with open("../user_config.json") as config_file:
return json.load(config_file)
def config_get_backup_size():
return config_get_user()["backup_size"]
def config_get_email_cycle_delay():
return config_get_user()["email_cycle_delay"]
def config_get_num_cycle():
return config_get_user()["num_cycle"]
def config_get_receiver_email():
return config_get_user()["receiver"]["test"]
def config_get_receiver_info_email():
return config_get_user()["receiver"]["info"]
def config_get_sender_gmail():
return config_get_user()["sender_gmail"]
def config_get_message_bodies():
return config_get_dev()["message_body"]
def config_get_repo_path():
return config_get_dev()["paths"]["repo_path"]
def config_get_python_invoker():
return config_get_dev()["python_invoker"]
def config_get_scopes():
return config_get_dev()["scopes"]
def config_get_subjects():
return config_get_dev()["subject"]
def config_get_verbosities():
return config_get_dev()["verbosity"]
def config_replace_cronjob_line(find_string, replace_string_with, contains=False):
f = open("../cronjob", "r")
lines = f.readlines()
f.close()
for i, line in enumerate(lines):
if (contains and find_string in line) or (line.rstrip("\n") == find_string):
lines[i] = replace_string_with + "\n"
f = open("../cronjob", "w")
contents = "".join(lines)
f.write(contents)
f.close()
return True
return False
def config_clear_user_config():
user_config = config_get_user()
user_config["receiver"]["test"] = "fill_this_in"
user_config["receiver"]["info"] = "fill_this_in"
user_config["sender_gmail"] = "fill_this_in"
with open("../user_config.json", "w") as config_file:
json.dump(user_config, config_file, indent=4, sort_keys=True)
def config_clear_receive_credentials():
new_config = {}
new_config["@note"] = "add receive credentials here"
with open("../receive/credentials-receive.json", "w") as config_file:
json.dump(new_config, config_file, indent=4, sort_keys=True)
def config_clear_send_credentials():
new_config = {}
new_config["@note"] = "add send credentials here"
with open("../send/credentials-send.json", "w") as config_file:
json.dump(new_config, config_file, indent=4, sort_keys=True)
def config_clear_cronjob_repo_path():
config_replace_cronjob_line("repo_path=", "{repo_path_cmd}", True)
def config_delete_tokens():
os.remove("../receive/token.json")
os.remove("../send/token.json")
| 25.163636 | 84 | 0.687861 | 381 | 2,768 | 4.635171 | 0.220472 | 0.137599 | 0.09513 | 0.064553 | 0.311438 | 0.271801 | 0.235561 | 0.180634 | 0.180634 | 0.180634 | 0 | 0.001311 | 0.173049 | 2,768 | 109 | 85 | 25.394495 | 0.770205 | 0 | 0 | 0.119403 | 0 | 0 | 0.174494 | 0.030708 | 0 | 0 | 0 | 0 | 0 | 1 | 0.298507 | false | 0 | 0.029851 | 0.179104 | 0.567164 | 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 | 1 | 0 | 0 | 3 |
dd1ac4acba4b4b56d1279eb5bae75cbd89ce33a6 | 2,232 | py | Python | server/web.py | xiaojieluo/dove-admin | 09e1c7c0e8b40cf0c677a867615b066805fb3f5d | [
"Apache-2.0"
] | 1 | 2021-11-07T20:21:57.000Z | 2021-11-07T20:21:57.000Z | server/web.py | xiaojieluo/dove-admin | 09e1c7c0e8b40cf0c677a867615b066805fb3f5d | [
"Apache-2.0"
] | null | null | null | server/web.py | xiaojieluo/dove-admin | 09e1c7c0e8b40cf0c677a867615b066805fb3f5d | [
"Apache-2.0"
] | null | null | null | from jinja2 import Environment, PackageLoader, TemplateNotFound
import jinja2
import yaml
import os
from sanic import response
import sqlite3
class Cache(object):
'''
刷新缓存
1. 更新 content 目录下的文件到数据库
dove 没有删除文件操作
'''
def __init__(self):
pass
def update(self):
pass
class Database(object):
'''sqlite3'''
def __init__(self, path=""):
# self.settings = settings
# self.filename = os.path.join(self.settings.get('path'), self.settings.get('filename'))
self.path = path
self.init()
def init(self):
'''
当数据库不存在时初始化数据库
'''
if not os.path.exists(self.path):
self.run('create table articles (id varchar(20) primary key, path varchar(30))')
@property
def connect(self):
return sqlite3.connect(self.path)
@property
def cursor(self):
return self.connect.cursor()
def __del__(self):
self.cursor.close()
self.connect.close()
def insert(self, sql):
return self.run(sql)
def run(self, sql):
'''运行 sql 语句'''
self.cursor.execute(sql)
return self.cursor.fetchall()
class Template(object):
'''
模板类
'''
def __init__(self):
self.env = Environment(loader=PackageLoader('server', 'templates'))
def render(self, tpl_name, **kw):
'''渲染模板'''
try:
template = self.env.get_template(tpl_name)
except TemplateNotFound:
template = jinja2.Template('oops, some error: {} not found'.format(tpl_name))
return template.render()
return template.render(**kw)
class Cookie(object):
'''sanic 的 cookie 封装'''
_keys = {
"expires": "expires",
"path": "Path",
"comment": "Comment",
"domain": "Domain",
"max-age": "Max-Age",
"secure": "Secure",
"httponly": "HttpOnly",
"version": "Version",
}
def __init__(self):
pass
def write(self, res, key, value, **kw):
''' 写入 cookies '''
# res =
# key = response.redirect('/')
res.cookies[key] = value
return res
def delete(self):
'''删除 cookie '''
pass
| 22.545455 | 96 | 0.557348 | 242 | 2,232 | 5.03719 | 0.396694 | 0.028712 | 0.045119 | 0.02461 | 0.029532 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007083 | 0.304211 | 2,232 | 98 | 97 | 22.77551 | 0.777849 | 0.12276 | 0 | 0.15 | 0 | 0 | 0.116541 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.233333 | false | 0.066667 | 0.1 | 0.05 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
dd23c3c6d343ec7d8ad43984661fd65965a50115 | 150 | py | Python | scify/__init__.py | DanielBok/scify | 9d4d31deb4379b9782e09f56fa39249a70f9e495 | [
"MIT"
] | 6 | 2019-04-06T09:07:36.000Z | 2020-12-27T19:05:16.000Z | scify/__init__.py | DanielBok/scify | 9d4d31deb4379b9782e09f56fa39249a70f9e495 | [
"MIT"
] | null | null | null | scify/__init__.py | DanielBok/scify | 9d4d31deb4379b9782e09f56fa39249a70f9e495 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Top-level package for scify."""
__author__ = """Daniel Bok"""
__email__ = 'daniel.bok@outlook.com'
__version__ = '0.1.0'
| 18.75 | 36 | 0.626667 | 20 | 150 | 4.1 | 0.85 | 0.219512 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031008 | 0.14 | 150 | 7 | 37 | 21.428571 | 0.604651 | 0.34 | 0 | 0 | 0 | 0 | 0.397849 | 0.236559 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 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 | 3 |
dd4cb22f0e4a6df802191e6e06978d922886e305 | 212 | py | Python | Python/UberX.py | israellp24/CursoPOOUber | 64895b4a8c4bfeb31c9b4f5df05401617c996a7c | [
"MIT"
] | null | null | null | Python/UberX.py | israellp24/CursoPOOUber | 64895b4a8c4bfeb31c9b4f5df05401617c996a7c | [
"MIT"
] | null | null | null | Python/UberX.py | israellp24/CursoPOOUber | 64895b4a8c4bfeb31c9b4f5df05401617c996a7c | [
"MIT"
] | null | null | null | from car import Car
class UberX(Car):
brand=str
model=str
def __init__(self, license, driver,brand,model):
super().__init__(license, driver)
self.brand=brand
self.model=model | 21.2 | 52 | 0.646226 | 28 | 212 | 4.607143 | 0.5 | 0.20155 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 212 | 10 | 53 | 21.2 | 0.811321 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0 | 0.625 | 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 | 1 | 0 | 0 | 3 |
dd56a6ad4d2c736e5b1595a14361de96d9a9cd35 | 527 | py | Python | python/merge-the-tools.py | gajubadge11/hackerrank-3 | 132a5019b7ed21507bb95b5063fa66c446b0eff7 | [
"MIT"
] | 21 | 2015-02-09T18:08:38.000Z | 2021-11-08T15:00:48.000Z | python/merge-the-tools.py | gajubadge11/hackerrank-3 | 132a5019b7ed21507bb95b5063fa66c446b0eff7 | [
"MIT"
] | 7 | 2020-04-12T23:00:19.000Z | 2021-01-30T23:44:24.000Z | python/merge-the-tools.py | gajubadge11/hackerrank-3 | 132a5019b7ed21507bb95b5063fa66c446b0eff7 | [
"MIT"
] | 27 | 2015-07-22T18:08:12.000Z | 2022-02-28T19:50:26.000Z | from collections import OrderedDict
def merge_the_tools(string, split_length):
splits = split_strings(string, split_length)
result = remove_repeats(splits)
print ("\n".join(result))
def split_strings(string, split_length):
return [string[i : i + split_length] for i in range(0, len(string), split_length)]
def remove_repeats(strings):
return ["".join(OrderedDict.fromkeys(string)) for string in strings]
if __name__ == '__main__':
string, k = input(), int(input())
merge_the_tools(string, k)
| 26.35 | 86 | 0.71537 | 72 | 527 | 4.944444 | 0.458333 | 0.154494 | 0.191011 | 0.106742 | 0.162921 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002262 | 0.16129 | 527 | 19 | 87 | 27.736842 | 0.803167 | 0 | 0 | 0 | 0 | 0 | 0.018975 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.083333 | 0.166667 | 0.5 | 0.083333 | 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 | 1 | 0 | 0 | 0 | 3 |
dd6b41f2840e438a8b58e7e0cf3bb845f00375c7 | 59 | py | Python | remo/remozilla/__init__.py | Mozilla-GitHub-Standards/6f6b18ac63685c6bf60fff95a3bbcc598378c77ceb14c7404172c570dd1e971d | 23ca8d46496b491fbdb2b8a72c91e75372932f23 | [
"BSD-3-Clause"
] | 27 | 2015-01-02T18:47:56.000Z | 2021-08-14T11:48:24.000Z | remo/remozilla/__init__.py | Mozilla-GitHub-Standards/6f6b18ac63685c6bf60fff95a3bbcc598378c77ceb14c7404172c570dd1e971d | 23ca8d46496b491fbdb2b8a72c91e75372932f23 | [
"BSD-3-Clause"
] | 450 | 2015-01-02T12:29:50.000Z | 2020-10-27T21:41:38.000Z | remo/remozilla/__init__.py | Mozilla-GitHub-Standards/6f6b18ac63685c6bf60fff95a3bbcc598378c77ceb14c7404172c570dd1e971d | 23ca8d46496b491fbdb2b8a72c91e75372932f23 | [
"BSD-3-Clause"
] | 81 | 2015-01-10T23:59:32.000Z | 2021-08-19T17:08:56.000Z | default_app_config = 'remo.remozilla.apps.RemozillaConfig'
| 29.5 | 58 | 0.847458 | 7 | 59 | 6.857143 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.050847 | 59 | 1 | 59 | 59 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0.59322 | 0.59322 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd924644b9849951633ba853327ac6a139edd7ec | 1,138 | py | Python | glint_backup/glintargparse.py | m-conklin/glint | a7923e2b1474b2c9bacbb56dc4e0dd955323d794 | [
"Apache-2.0"
] | 3 | 2015-08-04T03:59:32.000Z | 2017-01-11T06:18:13.000Z | glint_backup/glintargparse.py | m-conklin/glint | a7923e2b1474b2c9bacbb56dc4e0dd955323d794 | [
"Apache-2.0"
] | 6 | 2015-03-05T20:05:23.000Z | 2021-07-14T00:23:25.000Z | glint_backup/glintargparse.py | m-conklin/glint | a7923e2b1474b2c9bacbb56dc4e0dd955323d794 | [
"Apache-2.0"
] | 4 | 2015-03-31T23:21:10.000Z | 2018-09-18T22:21:37.000Z | '''
Created on Nov 20, 2014
@author: ronaldjosephdesmarais
'''
import argparse
class GlintArgumentParser:
parser=None
def __init__(self):
print "Init GlintArgumentParser"
self.parser = argparse.ArgumentParser(description='Glint\'s Backup Argument Parser')
def init_restore_arg_parser(self):
self.parser.add_argument("-c","--cfgfile",nargs=1,help="Required Configuration File for restore or uses default")
self.parser.add_argument("-v","--version",nargs=1,help="This Parameter is required or tool will fail")
self.parser.add_argument("-t","--tenant",nargs=1,help="Specify a tenant directory you wish to restore, rather than all tenants of a versioning")
self.parser.add_argument("-i","--image-name",nargs='*',help="Used with the --tenant option if you wish to restore a single image from a tenant")
self.parser.add_argument("-l","--list-images",action='store_true',help="Used with --tenant to list images in a tenant at the specifed --version")
def init_backup_arg_parser(self):
self.parser.add_argument("-cfgfile",nargs=1)
| 43.769231 | 153 | 0.692443 | 155 | 1,138 | 4.974194 | 0.509677 | 0.090791 | 0.101167 | 0.163424 | 0.088197 | 0.088197 | 0.088197 | 0 | 0 | 0 | 0 | 0.010718 | 0.180141 | 1,138 | 26 | 154 | 43.769231 | 0.815648 | 0 | 0 | 0 | 0 | 0.285714 | 0.416357 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.071429 | null | null | 0.071429 | 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 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd9aa90f9b9261c295afff0bef1b2de2f889f96b | 279 | py | Python | allhub/search/__init__.py | srinivasreddy/allhub | ff20858c9984da5c4edd5043c39eed3b6d5d693d | [
"Apache-2.0"
] | 2 | 2019-10-07T15:46:33.000Z | 2019-11-26T04:30:39.000Z | allhub/search/__init__.py | srinivasreddy/allhub | ff20858c9984da5c4edd5043c39eed3b6d5d693d | [
"Apache-2.0"
] | 1 | 2020-03-09T14:44:04.000Z | 2020-03-09T14:44:04.000Z | allhub/search/__init__.py | srinivasreddy/allhub | ff20858c9984da5c4edd5043c39eed3b6d5d693d | [
"Apache-2.0"
] | 2 | 2019-10-08T05:22:37.000Z | 2019-10-08T06:20:47.000Z | # flake8: NOQA
from .search import (
Order,
LabelSort,
CodeSort,
CommitSort,
IssueSort,
RepoSort,
UserSort,
SearchMixin as _SearchMixin,
)
from allhub.util import ConflictCheck
class SearchMixin(_SearchMixin, metaclass=ConflictCheck):
pass
| 15.5 | 57 | 0.698925 | 26 | 279 | 7.423077 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004673 | 0.232975 | 279 | 17 | 58 | 16.411765 | 0.897196 | 0.043011 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.076923 | 0.153846 | 0 | 0.230769 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
06bb2a4f87ae8461aa40975009e4564a7d9d9b82 | 4,641 | py | Python | main.py | prokan468/googleclassesautobot | 805d2caf8bbe446b1a70fdbd39e0afa45f5a5868 | [
"FSFAP"
] | 1 | 2022-01-13T14:13:19.000Z | 2022-01-13T14:13:19.000Z | main.py | prokan468/googleclassesautobot | 805d2caf8bbe446b1a70fdbd39e0afa45f5a5868 | [
"FSFAP"
] | null | null | null | main.py | prokan468/googleclassesautobot | 805d2caf8bbe446b1a70fdbd39e0afa45f5a5868 | [
"FSFAP"
] | null | null | null | import webbrowser
import pyautogui as magic
from datetime import datetime
import time
import sys
import yaml
sys.tracebacklimit=0
settings_path="setting.yaml"
with open(settings_path) as f:
settings = yaml.load(f, Loader=yaml.FullLoader)
alltimings = settings['alltimings']
timing = alltimings['starttime']
endtime = alltimings['endtime']
columns = alltimings['range']
google_meet = settings["google meets"]
link = google_meet["link"]
code = google_meet['code']
def preemeeting():
print('Going to enter the meeting')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('enter')
magic.press('tab')
magic.press('enter')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('enter')
waitingforend()
def preemeeting2():
print('Going to enter the meeting')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('enter')
magic.press('tab')
magic.press('enter')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('enter')
waitingforend()
def entermeeting():
blank = magic.locateCenterOnScreen('core\stream.png', confidence = 0.8)
magic.moveTo(blank)
magic.click()
magic.click()
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('enter')
time.sleep(10)
waiting()
def waiting():
wait = magic.locateCenterOnScreen('core\waiting-for-meeting.png', confidence = 0.8)
if wait == None:
preemeeting()
else:
magic.hotkey('ctrl', 'r')
print('Waiting for the meeting to be started by the teacher')
k = True
while k == True:
if wait == None:
preemeeting()
else:
magic.hotkey('ctrl', 'r')
time.sleep(15)
def googlemeets():
print('Waiting for the start time')
while True:
curr = datetime.now().strftime("%H:%M")
for now in timing:
if now == curr:
i = 0
while i <= columns:
if curr == timing[i]:
print(i)
break
i += 1
if link == [] and code == []:
webbrowser.get('windows-default').open('https://classroom.google.com')
time.sleep(15)
for z in range(0,3):
magic.press('tab')
if i == 0:
magic.press('enter')
else:
for b in range(0,i):
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('enter')
time.sleep(10)
entermeeting()
elif link == []:
webbrowser.get('windows-default').open('https://meet.google.com/')
time.sleep(15)
textbox= magic.locateCenterOnScreen('core\enter-meeting-id.png')
magic.moveTo(textbox)
magic.click()
magic.write(code[i])
magic.press('enter')
time.sleep(10)
preemeeting2()
elif code == []:
webbrowser.get('windows-default').open(link[i])
time.sleep(15)
preemeeting2()
else:
print('Please enter either the meeting code or the meeting link')
def waitingforend():
print('waiting for the end time')
while True:
curr2 = datetime.now().strftime("%H:%M")
for now2 in endtime:
if now2 == curr2:
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('tab')
magic.press('enter')
time.sleep(2)
magic.hotkey('alt', 'f4')
googlemeets()
else:
time.sleep(2)
googlemeets()
| 29.75 | 91 | 0.470373 | 455 | 4,641 | 4.786813 | 0.235165 | 0.206612 | 0.202938 | 0.272727 | 0.453627 | 0.435262 | 0.350321 | 0.350321 | 0.350321 | 0.312672 | 0 | 0.012672 | 0.40487 | 4,641 | 155 | 92 | 29.941935 | 0.775887 | 0 | 0 | 0.569343 | 0 | 0 | 0.138208 | 0.011815 | 0 | 0 | 0 | 0 | 0 | 1 | 0.043796 | false | 0 | 0.043796 | 0 | 0.087591 | 0.051095 | 0 | 0 | 0 | null | 1 | 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 | 3 |
06d1bbd1a1a8edfc7c07609952ce8ed9b2c3c8c7 | 702 | py | Python | examples/Keras_issue_14043.py | Ankuraxz/keras | f037c198f0f11121733d402e0020779faf2d10df | [
"MIT"
] | null | null | null | examples/Keras_issue_14043.py | Ankuraxz/keras | f037c198f0f11121733d402e0020779faf2d10df | [
"MIT"
] | null | null | null | examples/Keras_issue_14043.py | Ankuraxz/keras | f037c198f0f11121733d402e0020779faf2d10df | [
"MIT"
] | 1 | 2020-05-30T18:21:08.000Z | 2020-05-30T18:21:08.000Z | # After tensorflow 2, keras is being used in Backend
# comment shows an alternative way to run the command
#Documentation:- https://keras.io/api/datasets/cifar10/
# Version for your reference, Downgrade/ Ugrade/ Reinstall Accordingly
import keras
print(keras.__version__) #2.2.4 in my case
from keras.datasets import cifar10
(x_train,y_train), (x_test, y_test) = cifar10.load_data()
print(len(x_train))
print(x_train[0])
# Screenshot of Output, For Your Reference :-
# Using Tf2 :- Recommended
#pip install tensorflow
# from tensorflow.keras.datasets import cifar10
# (x_train,y_train), (x_test, y_test) = cifar10.load_data()
# print(len(x_train))
# print(x_train[0])
| 27 | 71 | 0.72792 | 105 | 702 | 4.695238 | 0.514286 | 0.073022 | 0.064909 | 0.105477 | 0.361055 | 0.361055 | 0.361055 | 0.361055 | 0.361055 | 0.361055 | 0 | 0.028912 | 0.162393 | 702 | 25 | 72 | 28.08 | 0.809524 | 0.676638 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0.5 | 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 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 3 |
06e91ab38261c33350d4ae06131c01a664ac03c0 | 27 | py | Python | backend/app/__init__.py | tamasf97/Platform | b5d69d051b6e8dc7d56f723146392c49db5e99c3 | [
"MIT"
] | 1 | 2019-09-22T10:21:17.000Z | 2019-09-22T10:21:17.000Z | backend/app/__init__.py | tamasf97/Platform | b5d69d051b6e8dc7d56f723146392c49db5e99c3 | [
"MIT"
] | 20 | 2019-09-26T13:54:12.000Z | 2022-02-26T18:07:34.000Z | backend/app/__init__.py | tamasf97/Platform | b5d69d051b6e8dc7d56f723146392c49db5e99c3 | [
"MIT"
] | 1 | 2019-09-20T09:50:01.000Z | 2019-09-20T09:50:01.000Z | __all__ = ['models', 'api'] | 27 | 27 | 0.592593 | 3 | 27 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 27 | 1 | 27 | 27 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0.321429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 3 |
06ea8004539700a4a43a76a2499ca8c1ad28ddfa | 398 | py | Python | Despliegue/server-agentes/traffic_light_agent.py | MarianaS8a/Bright | f8153471928afdc32a3dfaa2e4730443ae4949e2 | [
"MIT"
] | null | null | null | Despliegue/server-agentes/traffic_light_agent.py | MarianaS8a/Bright | f8153471928afdc32a3dfaa2e4730443ae4949e2 | [
"MIT"
] | null | null | null | Despliegue/server-agentes/traffic_light_agent.py | MarianaS8a/Bright | f8153471928afdc32a3dfaa2e4730443ae4949e2 | [
"MIT"
] | null | null | null | from mesa import Agent,Model
import time
class TrafficLightAgent(Agent):
def __init__(self, unique_id: int, model: Model) -> None:
super().__init__(unique_id, model)
self.lightColor = False
def turnGreen(self):
self.lightColor = True
def getLight(self):
return self.lightColor
def turnRed(self):
self.lightColor = False | 24.875 | 62 | 0.628141 | 45 | 398 | 5.333333 | 0.511111 | 0.233333 | 0.158333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.28392 | 398 | 16 | 63 | 24.875 | 0.842105 | 0 | 0 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0.083333 | 0.666667 | 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 | 1 | 0 | 0 | 3 |
66352e0784df7a8c77326bd6c439a286b016358f | 67 | py | Python | rtwilio/__init__.py | datamade/rapidsms-twilio | a9c1bdd1fce7c99ffbe7fb4b990cd641f5382b19 | [
"BSD-3-Clause"
] | 1 | 2019-03-04T10:00:39.000Z | 2019-03-04T10:00:39.000Z | rtwilio/__init__.py | datamade/rapidsms-twilio | a9c1bdd1fce7c99ffbe7fb4b990cd641f5382b19 | [
"BSD-3-Clause"
] | 1 | 2018-08-23T22:12:35.000Z | 2018-08-24T14:32:35.000Z | rtwilio/__init__.py | datamade/rapidsms-twilio | a9c1bdd1fce7c99ffbe7fb4b990cd641f5382b19 | [
"BSD-3-Clause"
] | null | null | null | "Twilio backend for the RapidSMS project."
__version__ = '1.0.1'
| 13.4 | 42 | 0.716418 | 10 | 67 | 4.4 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053571 | 0.164179 | 67 | 4 | 43 | 16.75 | 0.732143 | 0.597015 | 0 | 0 | 0 | 0 | 0.671642 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b0729d00a8745a6458588b812332d8ad159cacbf | 769 | py | Python | sphinxcontrib/traceables/utils.py | superzerg/sphinxcontrib-traceables | 8b5a9d2ccbc253bd409237d8895b8d3c5ad9fe7d | [
"Apache-2.0"
] | null | null | null | sphinxcontrib/traceables/utils.py | superzerg/sphinxcontrib-traceables | 8b5a9d2ccbc253bd409237d8895b8d3c5ad9fe7d | [
"Apache-2.0"
] | null | null | null | sphinxcontrib/traceables/utils.py | superzerg/sphinxcontrib-traceables | 8b5a9d2ccbc253bd409237d8895b8d3c5ad9fe7d | [
"Apache-2.0"
] | null | null | null | import re
from sphinx.util.texescape import escape
# =============================================================================
# Node visiting utilities.
def visit_passthrough(translator, node):
pass
def depart_passthrough(translator, node):
pass
passthrough = (visit_passthrough, depart_passthrough)
# =============================================================================
# Input checking utilities.
identifier_re = re.compile(r"^[^\d\W]\w*\Z")
def is_valid_traceable_attribute_name(input):
if identifier_re.match(input):
return True
else:
return False
# =============================================================================
# Latex-related utilities.
def latex_escape(text):
return escape(text)
| 20.236842 | 79 | 0.498049 | 67 | 769 | 5.552239 | 0.567164 | 0.064516 | 0.134409 | 0.155914 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.13394 | 769 | 37 | 80 | 20.783784 | 0.558559 | 0.401821 | 0 | 0.133333 | 0 | 0 | 0.028761 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0.333333 | 0.133333 | 0.066667 | 0.6 | 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 | 1 | 0 | 0 | 3 |
b08eb3bcc0631ae3a43fd313c302d7bbdef44029 | 50 | py | Python | incise/__init__.py | Exahilosys/incise | 77ad7be0332f0ee7586c1185aeac3162756f0c75 | [
"MIT"
] | null | null | null | incise/__init__.py | Exahilosys/incise | 77ad7be0332f0ee7586c1185aeac3162756f0c75 | [
"MIT"
] | null | null | null | incise/__init__.py | Exahilosys/incise | 77ad7be0332f0ee7586c1185aeac3162756f0c75 | [
"MIT"
] | null | null | null |
from .core import *
__all__ = (*core.__all__,)
| 8.333333 | 26 | 0.64 | 6 | 50 | 4 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 50 | 5 | 27 | 10 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
b09674c3e57bc227eba73f4fa3feb2352cd398e8 | 9,032 | py | Python | tests/test_server_utils.py | jecki/DHParser | c6c1bd7db2de85b5997a3640242f4f444532304e | [
"Apache-2.0"
] | 2 | 2020-12-25T19:37:42.000Z | 2021-03-26T04:59:12.000Z | tests/test_server_utils.py | jecki/DHParser | c6c1bd7db2de85b5997a3640242f4f444532304e | [
"Apache-2.0"
] | 6 | 2018-08-07T22:48:52.000Z | 2021-10-07T18:38:20.000Z | tests/test_server_utils.py | jecki/DHParser | c6c1bd7db2de85b5997a3640242f4f444532304e | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
"""test_server_utils.py - tests for utility-functions in the,
server-module of DHParse.
Author: Eckhart Arnold <arnold@badw.de>
Copyright 2020 Bavarian Academy of Sciences and Humanities
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.
"""
import asyncio
import concurrent.futures
import collections.abc
import json
import os
import sys
import traceback
scriptpath = os.path.dirname(__file__) or '.'
sys.path.append(os.path.abspath(os.path.join(scriptpath, '..')))
from DHParser.server import pp_json, ExecutionEnvironment, asyncio_run
from DHParser.toolkit import json_dumps, json_encode_string
class TestExecutionEnvironment:
def test_execenv(self):
def fault():
raise AssertionError
async def main():
loop = asyncio.get_running_loop() if sys.version_info >= (3, 7) \
else asyncio.get_event_loop()
env = ExecutionEnvironment(loop)
return await env.execute(None, fault, [])
result, rpc_error = asyncio_run(main())
json_str = '{"jsonrpc": "2.0", "error": {"code": %i, "message": %s}}' % \
(rpc_error[0], json_encode_string(rpc_error[1]))
assert json_str.find('Traceback') >= 0
class TestUtils:
data = ('{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":17666,'
'"rootPath":"/home/eckhart/Entwicklung/DHParser/examples/EBNF_fork","rootUri":'
'"file:///home/eckhart/Entwicklung/DHParser/examples/EBNF_fork","capabilities":'
'{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true},'
'"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":'
'{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":'
'{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,'
'26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,'
'"workspaceFolders":true},"textDocument":{"publishDiagnostics":'
'{"relatedInformation":true},"synchronization":{"dynamicRegistration":true,'
'"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":'
'{"dynamicRegistration":true,"contextSupport":true,"completionItem":'
'{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":'
'["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true},'
'"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,'
'19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":'
'["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,'
'"signatureInformation":{"documentationFormat":["markdown","plaintext"]}},'
'"definition":{"dynamicRegistration":true},"references":{"dynamicRegistration":'
'true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":'
'{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,'
'12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},'
'"hierarchicalDocumentSymbolSupport":true},"codeAction":{"dynamicRegistration":'
'true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix",'
'"refactor","refactor.extract","refactor.inline","refactor.rewrite","source",'
'"source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},'
'"formatting":{"dynamicRegistration":true},"rangeFormatting":'
'{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},'
'"rename":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":'
'true},"typeDefinition":{"dynamicRegistration":true},"implementation":'
'{"dynamicRegistration":true},"colorProvider":{"dynamicRegistration":true},'
'"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":'
'true}}},"trace":"off","workspaceFolders":[{"uri":'
'"file:///home/eckhart/Entwicklung/DHParser/examples/EBNF_fork",'
'"name":"EBNF_fork"}]}}')
expected = """{
"jsonrpc": "2.0",
"id": 0,
"method": "initialize",
"params": {
"processId": 17666,
"rootPath": "/home/eckhart/Entwicklung/DHParser/examples/EBNF_fork",
"rootUri": "file:///home/eckhart/Entwicklung/DHParser/examples/EBNF_fork",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {"documentChanges": true},
"didChangeConfiguration": {"dynamicRegistration": true},
"didChangeWatchedFiles": {"dynamicRegistration": true},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},
"executeCommand": {"dynamicRegistration": true},
"configuration": true,
"workspaceFolders": true},
"textDocument": {
"publishDiagnostics": {"relatedInformation": true},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": ["markdown","plaintext"],
"deprecatedSupport": true,
"preselectSupport": true},
"completionItemKind": {
"valueSet": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},
"hover": {
"dynamicRegistration": true,
"contentFormat": ["markdown","plaintext"]},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": ["markdown","plaintext"]}},
"definition": {"dynamicRegistration": true},
"references": {"dynamicRegistration": true},
"documentHighlight": {"dynamicRegistration": true},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},
"hierarchicalDocumentSymbolSupport": true},
"codeAction": {
"dynamicRegistration": true,
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": ["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},
"codeLens": {"dynamicRegistration": true},
"formatting": {"dynamicRegistration": true},
"rangeFormatting": {"dynamicRegistration": true},
"onTypeFormatting": {"dynamicRegistration": true},
"rename": {"dynamicRegistration": true},
"documentLink": {"dynamicRegistration": true},
"typeDefinition": {"dynamicRegistration": true},
"implementation": {"dynamicRegistration": true},
"colorProvider": {"dynamicRegistration": true},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true}}},
"trace": "off",
"workspaceFolders": [{
"uri": "file:///home/eckhart/Entwicklung/DHParser/examples/EBNF_fork",
"name": "EBNF_fork"}]}}"""
def test_pp_json(self):
obj = json.loads(self.data)
serialized = pp_json(obj)
assert sys.version_info < (3, 6) or serialized == self.expected, serialized
def test_pp_json_stacktrace(self):
try:
raise AssertionError()
except AssertionError:
tb = traceback.format_exc()
ppjsn = pp_json({'error' : tb}).replace('\\\\', '/')
expected = '{"error": "Traceback (most recent call last):"\n' \
' " File \\"$SCRIPTPATH/test_server_utils.py\\", ' \
'line 178, in test_pp_json_stacktrace"\n' \
' " raise AssertionError()"\n' \
' "AssertionError"\n ""}'.\
replace('$SCRIPTPATH', scriptpath.replace('\\', '/'), 1).replace('./', '')
# print(ppjsn)
# print(expected)
assert ppjsn == expected, '\n\n' + ppjsn + '\n\n' + expected
if __name__ == "__main__":
from DHParser.testing import runner
runner("", globals())
| 46.317949 | 146 | 0.618357 | 855 | 9,032 | 6.467836 | 0.316959 | 0.19132 | 0.02387 | 0.03255 | 0.685353 | 0.685353 | 0.685353 | 0.685353 | 0.685353 | 0.685353 | 0 | 0.041976 | 0.208702 | 9,032 | 194 | 147 | 46.556701 | 0.731776 | 0.08481 | 0 | 0.064103 | 0 | 0.070513 | 0.734044 | 0.475475 | 0 | 0 | 0 | 0 | 0.051282 | 1 | 0.025641 | false | 0 | 0.076923 | 0 | 0.134615 | 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 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b0969a57bcd5816bae7d71c69c0003b28daf366a | 757 | py | Python | app/app/constants.py | alasdair-macleod/demoappback | fedd555279a1e3b91172face7cec41eb158cbf0f | [
"MIT"
] | null | null | null | app/app/constants.py | alasdair-macleod/demoappback | fedd555279a1e3b91172face7cec41eb158cbf0f | [
"MIT"
] | 1 | 2019-01-16T15:45:31.000Z | 2019-01-16T15:45:31.000Z | app/app/constants.py | alasdair-macleod/demoappback | fedd555279a1e3b91172face7cec41eb158cbf0f | [
"MIT"
] | 1 | 2017-10-30T14:34:41.000Z | 2017-10-30T14:34:41.000Z | from enum import Enum
class Constants(Enum):
# errors in linear model creation
ERR_ERROR_DEG_FREEDOM = 'Error degrees of freedom must be positive. To achieve this increase smallest group size'
ERR_NOT_POSITIVE_DEFINITE = 'Sigma star is not positive definite.'
ERR_NOT_POSITIVE_DEFINITE_OUTCOME_CORRELATOINS = 'The outcome correlation matrix you have provided does not define a possible correlation matrix. The most common reasons for this are mistakes in data entry, using data from multiple sources or rounding errors.'
ERR_NO_DIFFERENCE = 'Your hypothesis and means have been chosen such that there is no difference. As such power can be no greater than your type one error rate. Please change either your hypothesis or your means.'
| 75.7 | 264 | 0.797886 | 116 | 757 | 5.094828 | 0.672414 | 0.055838 | 0.096447 | 0.07445 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.17041 | 757 | 9 | 265 | 84.111111 | 0.941083 | 0.040951 | 0 | 0 | 0 | 0.333333 | 0.722376 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 1 | 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 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b09f2cf04c3ef409e3ac0f86c9e862fd7bee63f6 | 101 | py | Python | nexradaws/__init__.py | peterdhansen/nexradaws | 0658efc5ec95d113a9d87fed3feb71b35293bec4 | [
"MIT"
] | 28 | 2018-04-28T19:18:06.000Z | 2021-12-01T00:19:30.000Z | nexradaws/__init__.py | peterdhansen/nexradaws | 0658efc5ec95d113a9d87fed3feb71b35293bec4 | [
"MIT"
] | 10 | 2017-06-30T19:33:20.000Z | 2021-07-27T22:39:52.000Z | nexradaws/__init__.py | peterdhansen/nexradaws | 0658efc5ec95d113a9d87fed3feb71b35293bec4 | [
"MIT"
] | 7 | 2018-10-21T17:39:55.000Z | 2021-02-14T01:55:18.000Z | __author__ = 'Aaron Anderson'
__version__ = "1.1"
from .nexradawsinterface import NexradAwsInterface
| 25.25 | 50 | 0.811881 | 10 | 101 | 7.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022222 | 0.108911 | 101 | 3 | 51 | 33.666667 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.168317 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
b0d53858ed56ca6fdaa871c838b188222bd05aed | 151 | py | Python | Algo201/problem_of_the_class/python/tile.py | oat431/HomeworkCollection | 12359eab28416b93f7da00c59fcc44b4e9b7723a | [
"Unlicense"
] | 3 | 2020-01-23T08:43:42.000Z | 2021-01-22T15:31:09.000Z | Algo201/problem_of_the_class/python/tile.py | oat431/HomeworkCollection | 12359eab28416b93f7da00c59fcc44b4e9b7723a | [
"Unlicense"
] | 1 | 2020-10-08T16:30:24.000Z | 2020-10-12T09:06:55.000Z | Algo201/problem_of_the_class/python/tile.py | oat431/HomeworkCollection | 12359eab28416b93f7da00c59fcc44b4e9b7723a | [
"Unlicense"
] | 3 | 2020-01-13T14:57:01.000Z | 2021-09-22T07:16:49.000Z | def fill_tile(n):
if n == 0 or n == 1 or n == 2:
return 1
return fill_tile(n-1) + fill_tile(n-2) + fill_tile(n-3)
print(fill_tile(8))
| 25.166667 | 59 | 0.569536 | 32 | 151 | 2.53125 | 0.40625 | 0.493827 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072072 | 0.264901 | 151 | 5 | 60 | 30.2 | 0.657658 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.6 | 0.2 | 0 | 0 | 0 | null | 1 | 1 | 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 | 3 |
b0d6059b89638c50e61bd0733c6e460946fadf95 | 607 | py | Python | app.py | ynajem/thenano245 | 795c037ba609eb92432f5a98dffc86c3f422c66f | [
"MIT"
] | null | null | null | app.py | ynajem/thenano245 | 795c037ba609eb92432f5a98dffc86c3f422c66f | [
"MIT"
] | null | null | null | app.py | ynajem/thenano245 | 795c037ba609eb92432f5a98dffc86c3f422c66f | [
"MIT"
] | null | null | null | from flask import Flask, render_template, request, redirect
app = Flask(__name__)
@app.route("/")
def root():
return "Hello, World!"
@app.route("/index.html")
@app.route("/index.php")
def home():
return redirect("/")
@app.route("/user/<username>")
def user_template(username):
return render_template("user.html", name=username)
@app.route("/json")
def data():
return {
"name": "NAJEM UNESS",
"email": "y.najem@gmail.com"
}
@app.route("/submit", methods=['POST', 'GET'])
def submit():
if(request.method == "POST"):
return request.form
return "No data has benn sent!"
| 17.342857 | 59 | 0.642504 | 80 | 607 | 4.7875 | 0.5 | 0.125326 | 0.067885 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158155 | 607 | 34 | 60 | 17.852941 | 0.749511 | 0 | 0 | 0 | 0 | 0 | 0.235585 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0.043478 | 0.173913 | 0.521739 | 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 | 1 | 0 | 0 | 3 |
b0ec8ad6732f3d250c40f03edbf53ddba5f39bd9 | 1,626 | py | Python | tests/test_markup.py | stesla/enview | 7963ad3027a72ad7bbf927f5963425a26a6e3201 | [
"MIT"
] | null | null | null | tests/test_markup.py | stesla/enview | 7963ad3027a72ad7bbf927f5963425a26a6e3201 | [
"MIT"
] | null | null | null | tests/test_markup.py | stesla/enview | 7963ad3027a72ad7bbf927f5963425a26a6e3201 | [
"MIT"
] | null | null | null | from enview.markup import parse, Text
def test_parse_empty():
assert parse('') == []
def test_parse_plain():
assert parse('plaintext') == [Text('plaintext')]
def test_parse_low_colors():
assert parse('some\x1b[36;44mcolor') == [Text('some'), Text('color', bg='#000080', fg='#008080')]
def test_parse_high_colors():
assert parse('some\x1b[96;104mcolor') == [Text('some'), Text('color', bg='#0000ff', fg='#00ffff')]
def test_parse_256_low():
assert parse('\x1b[38;5;1;48;5;2mword') == [Text('word', bg='#008000', fg='#800000')]
def test_parse_256_high():
assert parse('\x1b[38;5;8;48;5;9mword') == [Text('word', bg='#ff0000', fg='#808080')]
def test_parse_color_cube():
assert parse('\x1b[38;5;16mword') == [Text('word', fg='#000000')]
assert parse('\x1b[38;5;42mword') == [Text('word', fg='#00d787')]
def test_parse_grayscale():
assert parse('\x1b[38;5;243mword') == [Text('word', fg='#767676')]
def test_parse_reset():
assert parse('foo\x1b[31mbar\x1b[0mbaz') == [Text('foo'), Text('bar', fg='#800000'), Text('baz')]
def test_parse_bold():
assert parse('\x1b[1mfoo') == [Text('foo', bold=True)]
def test_parse_multiple_sequences():
assert parse('\x1b[1m\x1b[33mfoo') == [Text('foo', bold=True, fg='#808000')]
def test_html_plain():
assert Text('foo').to_html() == 'foo'
def test_html_all_attributes():
assert Text('foo', bg='#808000', fg='#800000', bold=True).to_html() == \
'<span style="background-color: #808000; color: #800000; font-weight: bold">foo</span>'
def test_html_escaped():
assert Text('<title>').to_html() == '<title>'
| 35.347826 | 102 | 0.635916 | 236 | 1,626 | 4.220339 | 0.322034 | 0.098394 | 0.13253 | 0.080321 | 0.171687 | 0 | 0 | 0 | 0 | 0 | 0 | 0.11213 | 0.127921 | 1,626 | 45 | 103 | 36.133333 | 0.590268 | 0 | 0 | 0 | 0 | 0.032258 | 0.295818 | 0.070726 | 0 | 0 | 0 | 0 | 0.483871 | 1 | 0.451613 | true | 0 | 0.032258 | 0 | 0.483871 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7c05b8ab7c8a03b6e88574be7e154c820a0c2847 | 183 | py | Python | teamB/player.py | trun/redux | 462e8903da41961504b76932404447aafffc04aa | [
"MIT"
] | 2 | 2016-09-06T23:29:23.000Z | 2021-06-18T01:14:36.000Z | teamB/player.py | trun/redux | 462e8903da41961504b76932404447aafffc04aa | [
"MIT"
] | null | null | null | teamB/player.py | trun/redux | 462e8903da41961504b76932404447aafffc04aa | [
"MIT"
] | null | null | null | class RobotPlayer(object):
def __init__(self, rc):
self.rc = rc
def run(self):
while True:
print 'DO RE ME'
self.rc.yield_execution()
| 20.333333 | 37 | 0.535519 | 23 | 183 | 4.043478 | 0.695652 | 0.193548 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.360656 | 183 | 8 | 38 | 22.875 | 0.794872 | 0 | 0 | 0 | 0 | 0 | 0.043716 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.142857 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9fd3548047186b7d4847cbd7c5f64e3d2248cd7b | 626 | py | Python | boucanpy/db/factories/dns_record.py | bbhunter/boucanpy | 7d2fb105e7b1e90653a511534fb878bb62d02f17 | [
"MIT"
] | 34 | 2019-11-16T17:22:15.000Z | 2022-02-11T23:12:46.000Z | boucanpy/db/factories/dns_record.py | bbhunter/boucanpy | 7d2fb105e7b1e90653a511534fb878bb62d02f17 | [
"MIT"
] | 1 | 2021-02-09T09:34:55.000Z | 2021-02-10T21:46:20.000Z | boucanpy/db/factories/dns_record.py | bbhunter/boucanpy | 7d2fb105e7b1e90653a511534fb878bb62d02f17 | [
"MIT"
] | 9 | 2019-11-18T22:18:07.000Z | 2021-02-08T13:23:51.000Z | import random
import uuid
from factory import Faker, LazyFunction, SubFactory
from .base import BaseFactory, fake
from boucanpy.db.models.dns_record import DnsRecord
from boucanpy.dns.types import TYPES
from boucanpy.db.factories.dns_server import DnsServerFactory
from boucanpy.db.factories.zone import ZoneFactory
def random_record():
return f"@ IN A {fake.ipv4()}."
def random_sort():
return random.randint(0, 10)
class DnsRecordFactory(BaseFactory):
class Meta:
model = DnsRecord
record = LazyFunction(random_record)
sort = LazyFunction(random_sort)
zone = SubFactory(ZoneFactory)
| 24.076923 | 61 | 0.763578 | 79 | 626 | 5.974684 | 0.468354 | 0.101695 | 0.088983 | 0.097458 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007605 | 0.159744 | 626 | 25 | 62 | 25.04 | 0.889734 | 0 | 0 | 0 | 0 | 0 | 0.036741 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.444444 | 0.111111 | 0.944444 | 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 | 1 | 1 | 0 | 0 | 3 |
9fd64b2e8a850f076ce19d64b8aa5c0ef08e261d | 10,001 | py | Python | linkprediction/prediction_methods/prediction/similarity_indices.py | ESM-analytics/Tie-Prediction-Tool | 7c060a62c6c47e2d59e7df0870358d6663487817 | [
"MIT"
] | 1 | 2021-02-23T06:36:03.000Z | 2021-02-23T06:36:03.000Z | linkprediction/prediction_methods/prediction/similarity_indices.py | ESM-analytics/Tie-Prediction-Tool | 7c060a62c6c47e2d59e7df0870358d6663487817 | [
"MIT"
] | 1 | 2022-03-02T09:59:27.000Z | 2022-03-02T09:59:27.000Z | linkprediction/prediction_methods/prediction/similarity_indices.py | social-media-analytics-research/tie-prediction-tool | 7c060a62c6c47e2d59e7df0870358d6663487817 | [
"MIT"
] | null | null | null | from math import sqrt
from networkx import (
Graph, adamic_adar_index, common_neighbors, jaccard_coefficient,
preferential_attachment, resource_allocation_index, community,
shortest_path_length)
from .predictor import \
LinkPredictor
class AdamicAdar(LinkPredictor):
def predict(self, node_pairs):
predictions = adamic_adar_index(self.graph, node_pairs)
return list(predictions)
def __repr__(self):
return self.__str__()
def __str__(self):
return 'AdamicAdar'
class AdjustedRand(LinkPredictor):
def predict(self, node_pairs):
predictions = []
for node_pair in node_pairs:
uNeighborhood = self.graph.neighbors(node_pair[0])
vNeighborhood = self.graph.neighbors(node_pair[1])
uNeighborhood = list(uNeighborhood)
vNeighborhood = list(vNeighborhood)
intersectionNeighbors = list(common_neighbors(self.graph, node_pair[0], node_pair[1]))
unionNeighbors = set().union(uNeighborhood, vNeighborhood)
a = len(intersectionNeighbors)
b = len(unionNeighbors)
c = len(unionNeighbors)
d = len(self.graph) - len(unionNeighbors)
denominator = ((a+b) * (b+d)) + ((a+c) * (c+d))
predictions.append((node_pair[0], node_pair[1], 2*(a*d - b*c) / denominator
if denominator != 0 else 0))
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'AdjustedRand'
class CommonNeighbors(LinkPredictor):
def predict(self, node_pairs):
predictions = [(node_pair[0], node_pair[1],
len(list(common_neighbors(self.graph, node_pair[0], node_pair[1]))))
for node_pair in node_pairs]
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'CommonNeighbors'
class Jaccard(LinkPredictor):
def predict(self, node_pairs):
predictions = jaccard_coefficient(self.graph, node_pairs)
return list(predictions)
def __repr__(self):
return self.__str__()
def __str__(self):
return 'Jaccard'
class Salton(LinkPredictor):
def predict(self, node_pairs):
predictions = []
for node_pair in node_pairs:
uNeighborhood = self.graph.degree(node_pair[0])
vNeighborhood = self.graph.degree(node_pair[1])
intersection = common_neighbors(self.graph, node_pair[0], node_pair[1])
intersection = len(list(intersection))
denominator = sqrt(uNeighborhood * vNeighborhood)
predictions.append((node_pair[0], node_pair[1],
intersection / denominator if denominator != 0 else 0))
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'Salton'
class PreferentialAttachement(LinkPredictor):
def predict(self, node_pairs):
predictions = preferential_attachment(self.graph, node_pairs)
return list(predictions)
def __repr__(self):
return self.__str__()
def __str__(self):
return 'PreferentialAttachement'
class ResourceAllocation(LinkPredictor):
def predict(self, node_pairs):
predictions = resource_allocation_index(self.graph, node_pairs)
return list(predictions)
def __repr__(self):
return self.__str__()
def __str__(self):
return 'ResourceAllocation'
class SameCommunity(LinkPredictor):
def __init__(self, graph, iterations: int = 1):
super().__init__(graph)
if iterations < 1:
raise ValueError('Invalid iterations value. It must be greater '
'than or equal to 1!')
self.iterations = iterations
def predict(self, node_pairs):
communities_generator = community.girvan_newman(self.graph)
for i in range(self.iterations):
level_communities = next(communities_generator)
predictions = []
for node_pair in node_pairs:
uCommunityIndex = self._getCommunityIndex(node_pair[0], level_communities)
vCommunityIndex = self._getCommunityIndex(node_pair[1], level_communities)
predictions.append((node_pair[0], node_pair[1],
1 if (uCommunityIndex == vCommunityIndex and uCommunityIndex != -1) else 0))
return predictions
def _getCommunityIndex(self, node, communities):
index = -1
for community in communities:
if node in community:
index = communities.index(community)
return index
def __repr__(self):
return self.__str__()
def __str__(self):
return 'SameCommunity'
class ShortestPath(LinkPredictor):
def __init__(self, graph, method='dijkstra'):
super().__init__(graph)
self.method = method
def predict(self, node_pairs):
try:
predictions = [(node_pair[0], node_pair[1],
shortest_path_length(self.graph, node_pair[0], node_pair[1], method=self.method))
for node_pair in node_pairs]
except Exception:
raise ValueError('Error during shortest path calculation. Probably'
', the method does not exist!')
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'ShortestPath'
class TotalNeighbors(LinkPredictor):
def predict(self, node_pairs):
predictions = []
for node_pair in node_pairs:
uNeighborhood = self.graph.neighbors(node_pair[0])
vNeighborhood = self.graph.neighbors(node_pair[1])
uNeighborhood = list(uNeighborhood)
vNeighborhood = list(vNeighborhood)
predictions.append((node_pair[0], node_pair[1],
len(set().union(uNeighborhood, vNeighborhood))))
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'TotalNeighbors'
class UDegree(LinkPredictor):
def predict(self, node_pairs):
predictions = [(node_pair[0], node_pair[1], self.graph.degree(node_pair[0]))
for node_pair in node_pairs]
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'UDegree'
class VDegree(LinkPredictor):
def predict(self, node_pairs):
predictions = [(node_pair[0], node_pair[1], self.graph.degree(node_pair[1]))
for node_pair in node_pairs]
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'VDegree'
class Sorensen(LinkPredictor):
def predict(self, node_pairs):
predictions = []
for node_pair in node_pairs:
uNeighborhood = self.graph.degree(node_pair[0])
vNeighborhood = self.graph.degree(node_pair[1])
intersection = common_neighbors(self.graph, node_pair[0], node_pair[1])
intersection = len(list(intersection))
denominator = uNeighborhood + vNeighborhood
predictions.append((node_pair[0], node_pair[1],
2 * intersection / denominator if denominator != 0 else 0))
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'Sorensen'
class HubPromoted(LinkPredictor):
def predict(self, node_pairs):
predictions = []
for node_pair in node_pairs:
uNeighborhood = self.graph.degree(node_pair[0])
vNeighborhood = self.graph.degree(node_pair[1])
intersection = common_neighbors(self.graph, node_pair[0], node_pair[1])
intersection = len(list(intersection))
denominator = min(uNeighborhood, vNeighborhood)
predictions.append((node_pair[0], node_pair[1],
2 * intersection / denominator if denominator != 0 else 0))
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'HubPromoted'
class HubDepressed(LinkPredictor):
def predict(self, node_pairs):
predictions = []
for node_pair in node_pairs:
uNeighborhood = self.graph.degree(node_pair[0])
vNeighborhood = self.graph.degree(node_pair[1])
intersection = common_neighbors(self.graph, node_pair[0], node_pair[1])
intersection = len(list(intersection))
denominator = max(uNeighborhood, vNeighborhood)
predictions.append((node_pair[0], node_pair[1],
2 * intersection / denominator if denominator != 0 else 0))
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'HubDepressed'
class LeichtHolmeNewman(LinkPredictor):
def predict(self, node_pairs):
predictions = []
for node_pair in node_pairs:
uNeighborhood = self.graph.degree(node_pair[0])
vNeighborhood = self.graph.degree(node_pair[1])
intersection = common_neighbors(self.graph, node_pair[0], node_pair[1])
intersection = len(list(intersection))
denominator = uNeighborhood * vNeighborhood
predictions.append((node_pair[0], node_pair[1],
2 * intersection / denominator if denominator != 0 else 0))
return predictions
def __repr__(self):
return self.__str__()
def __str__(self):
return 'LeichtHolmeNewman'
| 31.351097 | 108 | 0.610939 | 1,029 | 10,001 | 5.60447 | 0.111759 | 0.097104 | 0.045258 | 0.045084 | 0.710248 | 0.687879 | 0.683891 | 0.639501 | 0.62875 | 0.616438 | 0 | 0.011671 | 0.29747 | 10,001 | 318 | 109 | 31.449686 | 0.809137 | 0 | 0 | 0.624454 | 0 | 0 | 0.033997 | 0.0023 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222707 | false | 0 | 0.0131 | 0.139738 | 0.519651 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
9ff8a2e188e1bf53ec7da9e5509b9d0ac0a1afb9 | 208 | py | Python | geotest.py | stephensheridan/ipregex | 99b899f17fee061381ba7be1daab872c64032f41 | [
"MIT"
] | null | null | null | geotest.py | stephensheridan/ipregex | 99b899f17fee061381ba7be1daab872c64032f41 | [
"MIT"
] | null | null | null | geotest.py | stephensheridan/ipregex | 99b899f17fee061381ba7be1daab872c64032f41 | [
"MIT"
] | null | null | null | import geoip2.database
reader = geoip2.database.Reader('GeoLite2-City.mmdb')
response = reader.city('128.101.101.101')
country = response.country.name
city = response.city.name
print country + " " + city
| 18.909091 | 53 | 0.740385 | 28 | 208 | 5.5 | 0.464286 | 0.181818 | 0.25974 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081967 | 0.120192 | 208 | 10 | 54 | 20.8 | 0.759563 | 0 | 0 | 0 | 0 | 0 | 0.163462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.166667 | null | null | 0.166667 | 1 | 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 | 3 |
b01f36a8ebedc544de96df576889d20713b69fb3 | 730 | py | Python | fabfile/prodreproc/__init__.py | omeyn/fabric | 9ac9f71ca139537c10ecec5d9b0674ce6876498c | [
"Apache-2.0"
] | null | null | null | fabfile/prodreproc/__init__.py | omeyn/fabric | 9ac9f71ca139537c10ecec5d9b0674ce6876498c | [
"Apache-2.0"
] | null | null | null | fabfile/prodreproc/__init__.py | omeyn/fabric | 9ac9f71ca139537c10ecec5d9b0674ce6876498c | [
"Apache-2.0"
] | null | null | null | from fabric.api import *
@task
@parallel
@roles('prod_reproc')
def stop():
sudo('sh -c "cd /home/crap/prod_reproc/bin && /home/crap/prod_reproc/bin/stop-processors.sh"')
@task
@parallel
@roles('prod_reproc')
def start_verbatim():
sudo('sh -c "cd /home/crap/prod_reproc/bin && /home/crap/prod_reproc/bin/start-processor-verbatim.sh"')
@task
@parallel
@roles('prod_reproc')
def start_interp():
sudo('sh -c "cd /home/crap/prod_reproc/bin && /home/crap/prod_reproc/bin/start-processor-interpreted.sh"')
@task
@parallel
@roles('prod_reproc')
def setup_dirs():
sudo('sh -c "chown -R crap.crap /home/crap/prod_reproc"')
@task
@parallel
@roles('prod_reproc')
def check_ps():
sudo('sh -c "ps aux | grep jav | grep cli"') | 23.548387 | 108 | 0.70411 | 116 | 730 | 4.293103 | 0.293103 | 0.240964 | 0.168675 | 0.253012 | 0.696787 | 0.696787 | 0.576305 | 0.512048 | 0.363454 | 0.363454 | 0 | 0 | 0.110959 | 730 | 31 | 109 | 23.548387 | 0.767334 | 0 | 0 | 0.576923 | 0 | 0.115385 | 0.573187 | 0.355677 | 0 | 0 | 0 | 0 | 0 | 1 | 0.192308 | true | 0 | 0.038462 | 0 | 0.230769 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b02a63a0bf3018db17431c852a9d3c16893dddf5 | 264 | py | Python | Python Class ---- Estrutura de Sequencial/Exercicio 4.py | DouglasCarvalhoPereira/Python-Class---Versionado | 03b8f5a8a69553f733056586988f9840040959d7 | [
"MIT"
] | 1 | 2021-08-22T13:40:20.000Z | 2021-08-22T13:40:20.000Z | Python Class ---- Estrutura de Sequencial/Exercicio 4.py | DouglasCarvalhoPereira/Python-Class---Versionado | 03b8f5a8a69553f733056586988f9840040959d7 | [
"MIT"
] | null | null | null | Python Class ---- Estrutura de Sequencial/Exercicio 4.py | DouglasCarvalhoPereira/Python-Class---Versionado | 03b8f5a8a69553f733056586988f9840040959d7 | [
"MIT"
] | null | null | null | number_1 = int(input("Digite a nota 1: "))
number_2 = int(input("Digite a nota 1: "))
number_3 = int(input("Digite a nota 1: "))
number_4 = int(input("Digite a nota 1: "))
media = (number_1 + number_2 + number_3 + number_4) / 4
print("A média é {}.".format(media)) | 44 | 55 | 0.655303 | 48 | 264 | 3.4375 | 0.3125 | 0.193939 | 0.339394 | 0.363636 | 0.593939 | 0.593939 | 0.472727 | 0 | 0 | 0 | 0 | 0.058559 | 0.159091 | 264 | 6 | 56 | 44 | 0.684685 | 0 | 0 | 0 | 0 | 0 | 0.30566 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | null | 0 | 1 | 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 | 3 |
b02e4200a9be34c36beca8c85c7a600e38c7b4ac | 608 | py | Python | tests/test_basic.py | dongsam/dongsam | 76f5ba28881d23bfa53b30eec32f7aa885152d3c | [
"Apache-2.0"
] | null | null | null | tests/test_basic.py | dongsam/dongsam | 76f5ba28881d23bfa53b30eec32f7aa885152d3c | [
"Apache-2.0"
] | null | null | null | tests/test_basic.py | dongsam/dongsam | 76f5ba28881d23bfa53b30eec32f7aa885152d3c | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import pytest
from dongsam.basic import *
from dongsam import basic
word_type = {
0: 'eng',
1: 'kor',
2: 'chi'
}
class TestBasic:
def test_get_key_from_value(self):
assert get_key_from_value(word_type, 'kor') == 1
def test_get_key_from_value_not_exist(self):
assert get_key_from_value(word_type, 'kor2') == None
def test_basic_get_key_from_value(self):
assert basic.get_key_from_value(word_type, 'kor') == 1
def test_basic_list_get_key_from_value(self):
assert basic.struct.get_key_from_value(word_type, 'kor') == 1 | 22.518519 | 69 | 0.684211 | 95 | 608 | 3.978947 | 0.326316 | 0.126984 | 0.21164 | 0.31746 | 0.634921 | 0.621693 | 0.52381 | 0.365079 | 0.179894 | 0.179894 | 0 | 0.016495 | 0.202303 | 608 | 27 | 69 | 22.518519 | 0.762887 | 0.034539 | 0 | 0 | 0 | 0 | 0.037543 | 0 | 0 | 0 | 0 | 0 | 0.235294 | 1 | 0.235294 | false | 0 | 0.176471 | 0 | 0.470588 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b06d97f4035c09e1d0dcf565fe96acd02e88d0ce | 272 | py | Python | switch_inputs/__init__.py | Switch-Mexico/switch-inputs | e2afa96c40b516435c350d525119e4594f1b7eca | [
"MIT"
] | 1 | 2020-07-14T21:50:28.000Z | 2020-07-14T21:50:28.000Z | switch_inputs/__init__.py | Switch-Mexico/switch-inputs | e2afa96c40b516435c350d525119e4594f1b7eca | [
"MIT"
] | 14 | 2018-12-14T23:21:09.000Z | 2019-05-10T21:42:36.000Z | switch_inputs/__init__.py | Switch-Mexico/switch-inputs | e2afa96c40b516435c350d525119e4594f1b7eca | [
"MIT"
] | 1 | 2020-07-14T21:50:37.000Z | 2020-07-14T21:50:37.000Z | # This file is needed to impport the package
import os
import sys
# Append current folder to path
ROOT = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, ROOT)
from cli import main
def cli():
return main(obj={})
if __name__ == '__main__':
cli()
| 16 | 50 | 0.702206 | 43 | 272 | 4.162791 | 0.651163 | 0.067039 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004505 | 0.183824 | 272 | 16 | 51 | 17 | 0.801802 | 0.264706 | 0 | 0 | 0 | 0 | 0.040609 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0.111111 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
c6b966e26f94398045a39cd17945b313edf6d5d6 | 925 | py | Python | app/migrations/0012_auto_20200610_0323.py | taikhoangg003/django-dashboard-coreui | f0e8acac2428f0eb493b71c7e4010da35b4389f7 | [
"MIT"
] | null | null | null | app/migrations/0012_auto_20200610_0323.py | taikhoangg003/django-dashboard-coreui | f0e8acac2428f0eb493b71c7e4010da35b4389f7 | [
"MIT"
] | null | null | null | app/migrations/0012_auto_20200610_0323.py | taikhoangg003/django-dashboard-coreui | f0e8acac2428f0eb493b71c7e4010da35b4389f7 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.5 on 2020-06-10 03:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0011_auto_20200403_0950'),
]
operations = [
migrations.AddField(
model_name='padata',
name='fiveh_kwh',
field=models.FloatField(default=0, verbose_name='500 kWh'),
),
migrations.AddField(
model_name='padata',
name='onek_kwh',
field=models.FloatField(default=0, verbose_name='1000 kWh'),
),
migrations.AddField(
model_name='padata',
name='rating',
field=models.FloatField(default=0, verbose_name='Rating'),
),
migrations.AddField(
model_name='padata',
name='twok_kwh',
field=models.FloatField(default=0, verbose_name='2000 kWh'),
),
]
| 27.205882 | 72 | 0.564324 | 95 | 925 | 5.347368 | 0.442105 | 0.141732 | 0.181102 | 0.212598 | 0.635827 | 0.635827 | 0.490157 | 0.253937 | 0 | 0 | 0 | 0.072327 | 0.312432 | 925 | 33 | 73 | 28.030303 | 0.726415 | 0.048649 | 0 | 0.444444 | 1 | 0 | 0.125285 | 0.026196 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.037037 | 0 | 0.148148 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c6e9c90d26f4091c833ab0c68053e853ef8c94a3 | 397 | py | Python | dockerspawner/volumenamingstrategy.py | hydroshare/dockerspawner | 8667c92052da5aa89f18125b5aead00e87d0dbe0 | [
"BSD-3-Clause"
] | 2 | 2018-04-02T18:35:20.000Z | 2019-07-11T23:03:04.000Z | dockerspawner/volumenamingstrategy.py | hydroshare/dockerspawner | 8667c92052da5aa89f18125b5aead00e87d0dbe0 | [
"BSD-3-Clause"
] | 1 | 2016-12-02T06:20:26.000Z | 2016-12-02T06:20:26.000Z | dockerspawner/volumenamingstrategy.py | ny0011/dockerspawner-edit | f04c2ff7f88473b5766348769b471a6faf23d4a7 | [
"BSD-3-Clause"
] | 6 | 2015-02-12T08:44:34.000Z | 2021-01-07T00:15:07.000Z | def default_format_volume_name(template, spawner):
return template.format(username=spawner.user.name)
def escaped_format_volume_name(label_template, spawner):
"""Use this strategy if your usernames include illegal characters
for volume names and you do not use absolute paths in your volume
label template.
"""
return label_template.format(username=spawner.escaped_name)
| 36.090909 | 69 | 0.780856 | 54 | 397 | 5.574074 | 0.555556 | 0.129568 | 0.106312 | 0.192691 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153652 | 397 | 10 | 70 | 39.7 | 0.895833 | 0.36272 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.25 | 1 | 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 | 1 | 0 | 0 | 0 | 3 |
c6ebe1aead06f2bfb65632525a7be6de633db0d0 | 130 | py | Python | conf.py | qqqestion/TypingSpeedTest | 9dd926bbb7a233592ee6a44f24fdc01f6789dbca | [
"MIT"
] | null | null | null | conf.py | qqqestion/TypingSpeedTest | 9dd926bbb7a233592ee6a44f24fdc01f6789dbca | [
"MIT"
] | null | null | null | conf.py | qqqestion/TypingSpeedTest | 9dd926bbb7a233592ee6a44f24fdc01f6789dbca | [
"MIT"
] | null | null | null | import pygame
screen_width, screen_height = 800, 600
valid_literal = set([letter for letter in range(pygame.K_a, pygame.K_z)])
| 18.571429 | 73 | 0.761538 | 22 | 130 | 4.272727 | 0.772727 | 0.148936 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053571 | 0.138462 | 130 | 6 | 74 | 21.666667 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
c6f2e63c9f68b2c0431784c6482cdec780c83a6d | 1,499 | py | Python | votepredictapp/models.py | davidhammaker/votepredictbackend | 766467f85faf8a1d11da8c798b30904af9268504 | [
"MIT"
] | null | null | null | votepredictapp/models.py | davidhammaker/votepredictbackend | 766467f85faf8a1d11da8c798b30904af9268504 | [
"MIT"
] | null | null | null | votepredictapp/models.py | davidhammaker/votepredictbackend | 766467f85faf8a1d11da8c798b30904af9268504 | [
"MIT"
] | null | null | null | from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
class Question(models.Model):
content = models.CharField(max_length=128)
start_date = models.DateTimeField(default=timezone.now)
end_date = models.DateTimeField(default=timezone.now)
def __str__(self):
return self.content
class Answer(models.Model):
content = models.CharField(max_length=128)
question = models.ForeignKey(
Question, related_name="answers", on_delete=models.CASCADE
)
def __str__(self):
return self.content
class Reply(models.Model):
question = models.ForeignKey(
Question, related_name="replies", on_delete=models.CASCADE
)
user = models.ForeignKey(User, related_name="replies", on_delete=models.CASCADE)
def __str__(self):
return self.question.content
class Meta:
verbose_name_plural = "replies"
class Vote(models.Model):
reply = models.OneToOneField(Reply, related_name="vote", on_delete=models.CASCADE)
answer = models.ForeignKey(Answer, related_name="votes", on_delete=models.CASCADE)
def __str__(self):
return self.answer.content
class Prediction(models.Model):
reply = models.OneToOneField(
Reply, related_name="prediction", on_delete=models.CASCADE
)
answer = models.ForeignKey(
Answer, related_name="predictions", on_delete=models.CASCADE
)
def __str__(self):
return self.answer.content
| 26.767857 | 86 | 0.711141 | 179 | 1,499 | 5.731844 | 0.256983 | 0.075049 | 0.095517 | 0.143275 | 0.740741 | 0.740741 | 0.587719 | 0.489279 | 0.302144 | 0.222222 | 0 | 0.00493 | 0.188125 | 1,499 | 55 | 87 | 27.254545 | 0.838127 | 0 | 0 | 0.333333 | 0 | 0 | 0.038692 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.128205 | false | 0 | 0.076923 | 0.128205 | 0.769231 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c6fb85204187f87bd4fb2e567a82af73ca5c3cf8 | 33 | py | Python | testing/resources/test_pmatrixprint.py | timgates42/processing.py | 78a237922c2a928b83f4ad579dbf8d32c0099890 | [
"Apache-2.0"
] | 1,224 | 2015-01-01T22:09:23.000Z | 2022-03-29T19:43:56.000Z | testing/resources/test_pmatrixprint.py | timgates42/processing.py | 78a237922c2a928b83f4ad579dbf8d32c0099890 | [
"Apache-2.0"
] | 253 | 2015-01-14T03:45:51.000Z | 2022-02-08T01:18:19.000Z | testing/resources/test_pmatrixprint.py | timgates42/processing.py | 78a237922c2a928b83f4ad579dbf8d32c0099890 | [
"Apache-2.0"
] | 225 | 2015-01-13T18:38:33.000Z | 2022-03-30T20:27:39.000Z | a = PMatrix3D()
a.print()
exit()
| 8.25 | 15 | 0.606061 | 5 | 33 | 4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035714 | 0.151515 | 33 | 3 | 16 | 11 | 0.678571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 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 | 3 |
05a30171ac5b391b88e7545cd59437cf908dae30 | 1,095 | py | Python | tabular/src/autogluon/tabular/models/lr/lr_preprocessing_utils.py | huibinshen/autogluon | 18c182c90df89762a916128327a6792b8887c5c6 | [
"Apache-2.0"
] | null | null | null | tabular/src/autogluon/tabular/models/lr/lr_preprocessing_utils.py | huibinshen/autogluon | 18c182c90df89762a916128327a6792b8887c5c6 | [
"Apache-2.0"
] | null | null | null | tabular/src/autogluon/tabular/models/lr/lr_preprocessing_utils.py | huibinshen/autogluon | 18c182c90df89762a916128327a6792b8887c5c6 | [
"Apache-2.0"
] | null | null | null | from sklearn.base import BaseEstimator, TransformerMixin
from autogluon.features.generators import OneHotEncoderFeatureGenerator
class OheFeaturesGenerator(BaseEstimator, TransformerMixin):
def __init__(self):
self._feature_names = []
self._encoder = None
def fit(self, X, y=None):
self._encoder = OneHotEncoderFeatureGenerator(max_levels=10000, verbosity=0)
self._encoder.fit(X)
self._feature_names = self._encoder.features_out
return self
def transform(self, X, y=None):
return self._encoder.transform_ohe(X)
def get_feature_names(self):
return self._feature_names
class NlpDataPreprocessor(BaseEstimator, TransformerMixin):
def __init__(self, nlp_cols):
self.nlp_cols = nlp_cols
def fit(self, X, y=None):
return self
def transform(self, X, y=None):
X = X[self.nlp_cols].copy()
for c in self.nlp_cols:
X[c] = X[c].astype(str).fillna(' ')
X = X.apply(' '.join, axis=1).str.replace('[ ]+', ' ', regex=True)
return X.values.tolist()
| 28.815789 | 84 | 0.661187 | 134 | 1,095 | 5.186567 | 0.380597 | 0.079137 | 0.034532 | 0.057554 | 0.345324 | 0.152518 | 0.092086 | 0.092086 | 0 | 0 | 0 | 0.008264 | 0.226484 | 1,095 | 37 | 85 | 29.594595 | 0.812279 | 0 | 0 | 0.230769 | 0 | 0 | 0.006393 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.269231 | false | 0 | 0.076923 | 0.115385 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
05adb400d2e5cb2e9c40f33b8685d930aa54399f | 6,650 | py | Python | tests/pdf/text/test_mark_line_labels.py | alexgorji/musurgia | 81d37afbf1ac70348002a93299db228b5ed4a591 | [
"MIT"
] | null | null | null | tests/pdf/text/test_mark_line_labels.py | alexgorji/musurgia | 81d37afbf1ac70348002a93299db228b5ed4a591 | [
"MIT"
] | 45 | 2020-02-24T19:37:00.000Z | 2021-04-06T16:13:56.000Z | tests/pdf/text/test_mark_line_labels.py | alexgorji/musurgia | 81d37afbf1ac70348002a93299db228b5ed4a591 | [
"MIT"
] | null | null | null | from pathlib import Path
from musurgia.pdf.line import HorizontalLineSegment, HorizontalSegmentedLine, VerticalSegmentedLine
from musurgia.pdf.pdf import Pdf
from musurgia.unittest import TestCase
path = Path(__file__)
class TestMarkLineLabels(TestCase):
def setUp(self) -> None:
self.pdf = Pdf()
self.ls = HorizontalLineSegment(length=20)
def test_draw_above(self):
ml = self.ls.start_mark_line
ml.add_text_label('first text label above')
ml.add_text_label('second text label above')
ml.add_text_label('third text label above')
self.ls.relative_x = 10
self.ls.relative_y = 20
with self.file_path(path, 'draw_above', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
self.pdf.draw_ruler('h')
self.pdf.draw_ruler('v')
self.ls.draw(self.pdf)
self.pdf.write(pdf_path)
def test_draw_one_above(self):
ml = self.ls.start_mark_line
ml.length = 20
ml.add_text_label('first text label above')
with self.file_path(path, 'draw_one_above', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
# self.pdf.draw_ruler('h')
# self.pdf.draw_ruler('v')
self.pdf.translate(30, 30)
self.ls.draw(self.pdf)
self.pdf.write(pdf_path)
def test_draw_below(self):
ml = self.ls.start_mark_line
ml.add_text_label('first text label below', placement='below')
ml.add_text_label('second text label below', placement='below')
self.ls.relative_x = 10
self.ls.relative_y = 20
with self.file_path(path, 'draw_below', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
self.pdf.draw_ruler('h')
self.pdf.draw_ruler('v')
self.ls.draw(self.pdf)
self.pdf.write(pdf_path)
def test_draw_left(self):
ml = self.ls.start_mark_line
ml.add_text_label('first text label left', placement='left')
ml.add_text_label('second text label left left left', placement='left')
ml.add_text_label('third text label left left left', placement='left')
ml.left_text_labels[1].font.size = 8
self.ls.relative_x = 40
self.ls.relative_y = 10
with self.file_path(path, 'draw_left', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
self.pdf.draw_ruler('h')
self.pdf.draw_ruler('v')
self.ls.draw(self.pdf)
self.pdf.write(pdf_path)
def test_different_sizes(self):
ml = self.ls.start_mark_line
ml.add_text_label('first text label above', font_size=7)
ml.add_text_label('second text label above', font_size=8)
ml.add_text_label('third text label above', font_size=9)
with self.file_path(path, 'different_sizes', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
self.pdf.draw_ruler('h')
self.pdf.draw_ruler('v')
self.pdf.translate(10, 20)
self.ls.draw(self.pdf)
self.pdf.write(pdf_path)
def test_font_size_8(self):
ml = self.ls.start_mark_line
ml.add_text_label('first text label above', font_size=8, bottom_margin=2)
ml.add_text_label('second text label above', font_size=8, bottom_margin=4)
ml.add_text_label('third text label above', font_size=8)
with self.file_path(path, 'font_size_8', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
self.pdf.draw_ruler('h')
self.pdf.draw_ruler('v')
self.pdf.translate(10, 20)
self.ls.draw(self.pdf)
self.pdf.write(pdf_path)
def test_below_with_different_mark_line_lengths(self):
hsl = HorizontalSegmentedLine(lengths=[10, 15, 20])
hsl.segments[0].start_mark_line.length = 6
hsl.segments[0].start_mark_line.add_label(1, placement='below', font_size=8)
hsl.segments[1].start_mark_line.add_label(2, placement='below', font_size=8)
hsl.segments[2].start_mark_line.add_label(3, placement='below', font_size=8)
with self.file_path(path, 'below_with_different_mark_line_lengths', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
self.pdf.draw_ruler('h')
self.pdf.draw_ruler('v')
self.pdf.translate(10, 10)
hsl.draw(self.pdf)
self.pdf.write(pdf_path)
def test_vertical_with_left_text_labels(self):
vsl = VerticalSegmentedLine(lengths=[10, 15, 20])
vsl.segments[0].start_mark_line.length = 6
vsl.segments[0].start_mark_line.add_label(1, placement='left', font_size=8)
vsl.segments[1].start_mark_line.add_label(2, placement='left', font_size=8)
vsl.segments[2].start_mark_line.add_label(3, placement='left', font_size=8)
with self.file_path(path, 'vertical_with_left_text_labels', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
self.pdf.draw_ruler('h')
self.pdf.draw_ruler('v')
self.pdf.translate(10, 10)
vsl.draw(self.pdf)
self.pdf.write(pdf_path)
def test_draw_above_with_different_bottom_margins(self):
ml = self.ls.start_mark_line
ml.add_text_label('first text label above', bottom_margin=2)
ml.add_text_label('second text label above', bottom_margin=4)
ml.add_text_label('third text label above', bottom_margin=15)
self.ls.relative_x = 10
self.ls.relative_y = 40
with self.file_path(path, 'draw_above_with_different_bottom_margins', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
self.pdf.draw_ruler('h')
self.pdf.draw_ruler('v')
self.ls.draw(self.pdf)
self.pdf.write(pdf_path)
def test_left_position(self):
ml = self.ls.start_mark_line
# print(ml.get_relative_position())
# print(ml.get_height())
left_l = ml.add_text_label('left one', placement='left')
# print(left_l.get_relative_position())
left_l = ml.add_text_label('left two', placement='left')
left_l = ml.add_text_label('left three', placement='left')
left_l = ml.add_text_label('left four', placement='left')
with self.file_path(path, 'left_position', 'pdf') as pdf_path:
self.pdf.translate_page_margins()
self.pdf.draw_ruler('h')
self.pdf.draw_ruler('v')
self.pdf.translate(30, 30)
self.ls.draw(self.pdf)
self.pdf.write(pdf_path)
| 42.356688 | 99 | 0.634887 | 962 | 6,650 | 4.129938 | 0.086279 | 0.100428 | 0.049836 | 0.077523 | 0.835137 | 0.797131 | 0.75107 | 0.673798 | 0.61037 | 0.514473 | 0 | 0.018759 | 0.246466 | 6,650 | 156 | 100 | 42.628205 | 0.774097 | 0.021654 | 0 | 0.503759 | 0 | 0 | 0.116769 | 0.016615 | 0 | 0 | 0 | 0 | 0 | 1 | 0.082707 | false | 0 | 0.030075 | 0 | 0.120301 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 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 | 3 |
05d1cc25626e8ac2b5cde975a6726f9e1813d6a8 | 22,116 | py | Python | Multi_Agent/QMIX&Rule-based/cityflow_env.py | hrushikeshjadhav9/Multi-Commander | 08cdd24e282c122b8c9758ff0cb92cb600cbbbba | [
"Apache-2.0"
] | 79 | 2019-07-25T02:40:59.000Z | 2022-03-11T02:26:09.000Z | Multi_Agent/QMIX&Rule-based/cityflow_env.py | hrushikeshjadhav9/Multi-Commander | 08cdd24e282c122b8c9758ff0cb92cb600cbbbba | [
"Apache-2.0"
] | 10 | 2019-07-26T12:12:34.000Z | 2021-03-02T12:08:20.000Z | Multi_Agent/QMIX&Rule-based/cityflow_env.py | hrushikeshjadhav9/Multi-Commander | 08cdd24e282c122b8c9758ff0cb92cb600cbbbba | [
"Apache-2.0"
] | 23 | 2019-07-26T12:10:57.000Z | 2022-03-10T07:30:39.000Z | import cityflow
import pandas as pd
import os
import json
import math
import numpy as np
import itertools
# from sim_setting import sim_setting_control
class CityFlowEnv(object):
def __init__(self,
lane_phase_info,
intersection_id='xxx',
num_step=1500,
thread_num=1,
cityflow_config_file='examples/config_1x1.json',
replay_data_path='./replay'
):
# cityflow_config['rlTrafficLight'] = rl_control # use RL to control the light or not
self.eng = cityflow.Engine(cityflow_config_file, thread_num=thread_num)
self.num_step = num_step
self.state_size = None
self.lane_phase_info = lane_phase_info # "intersection_1_1"
self.intersection_id = intersection_id
self.start_lane = self.lane_phase_info[self.intersection_id]['start_lane']
self.end_lane = self.lane_phase_info[self.intersection_id]['end_lane']
self.phase_list = self.lane_phase_info[self.intersection_id]["phase"]
self.phase_startLane_mapping = self.lane_phase_info[self.intersection_id]["phase_startLane_mapping"]
self.replay_data_path = replay_data_path
self.current_phase = {self.intersection_id:self.phase_list[0]}
self.current_phase_time = {self.intersection_id:0}
self.yellow_time = 5
self.state_store_i = 0
self.get_state() # set self.state_size
self.phase_log = []
def reset(self):
self.eng.reset()
def step(self, next_phase):
if self.current_phase[self.intersection_id] == next_phase:
self.current_phase_time[self.intersection_id] += 1
else:
self.current_phase[self.intersection_id] = next_phase
self.current_phase_time[self.intersection_id] = 1
self.eng.set_tl_phase(self.intersection_id, self.current_phase[self.intersection_id]) # set phase of traffic light
self.eng.next_step()
self.phase_log.append(self.current_phase[self.intersection_id])
return self.get_state(), self.get_reward() # return next_state and reward
def get_state(self):
intersection_info = self.intersection_info(self.intersection_id)
state_dict = intersection_info['start_lane_vehicle_count']
return_state = [state_dict[key] for key in sorted(state_dict.keys())] + [intersection_info['current_phase'][self.intersection_id]]
return self.preprocess_state(return_state)
def preprocess_state(self, state):
return_state = np.array(state)
if self.state_size is None:
self.state_size = len(return_state.flatten())
return_state = np.reshape(return_state, [1, self.state_size])
return return_state
def intersection_info(self, id_):
'''
info of intersection 'id_'
'''
state = {}
get_lane_vehicle_count = self.eng.get_lane_vehicle_count()
get_lane_waiting_vehicle_count = self.eng.get_lane_waiting_vehicle_count()
get_lane_vehicles = self.eng.get_lane_vehicles()
vehicle_speed = self.eng.get_vehicle_speed()
state['start_lane_vehicle_count'] = {lane: get_lane_vehicle_count[lane] for lane in self.start_lane[id_]}
state['end_lane_vehicle_count'] = {lane: get_lane_vehicle_count[lane] for lane in self.end_lane[id_]}
state['start_lane_waiting_vehicle_count'] = {lane: get_lane_waiting_vehicle_count[lane] for lane in self.start_lane[id_]}
state['end_lane_waiting_vehicle_count'] = {lane: get_lane_waiting_vehicle_count[lane] for lane in self.end_lane[id_]}
state['start_lane_vehicles'] = {lane: get_lane_vehicles[lane] for lane in self.start_lane[id_]}
state['end_lane_vehicles'] = {lane: get_lane_vehicles[lane] for lane in self.end_lane[id_]}
state['start_lane_speed'] = {lane: np.sum(list(map(lambda vehicle:vehicle_speed[vehicle], get_lane_vehicles[lane]))) / (get_lane_vehicle_count[lane]+1e-5) for lane in self.start_lane[id_]} # compute start lane mean speed
state['end_lane_speed'] = {lane: np.sum(list(map(lambda vehicle:vehicle_speed[vehicle], get_lane_vehicles[lane]))) / (get_lane_vehicle_count[lane]+1e-5) for lane in self.end_lane[id_]} # compute end lane mean speed
state['current_phase'] = self.current_phase[id_]
state['current_phase_time'] = self.current_phase_time[id_]
return state
# def get_reward(self):
# '''
# max vehicle count of the lanes, *-1
# '''
# lane_vehicle_count = self.eng.get_lane_vehicles()
# for key in lane_vehicle_count.keys():
# lane_vehicle_count[key] = len(lane_vehicle_count[key])
# reward = -1 * max(list(lane_vehicle_count.values()))
# return reward
# def get_reward(self):
# '''
# max vehicle count of all start lanes
# '''
# start_lane_vehicle_count = {lane: self.eng.get_lane_vehicle_count()[lane] for lane in self.start_lane}
# reward = -1 * np.mean(list(start_lane_vehicle_count.values()))
# return reward
# def get_reward(self):
# '''
# max waiting vehicle count of the lanes, *-1
# '''
# lane_waiting_vehicle_count = self.eng.get_lane_waiting_vehicle_count()
# lane_waiting_vehicle_count_list = list(lane_waiting_vehicle_count.values())
# reward = -1 * ( sum(lane_waiting_vehicle_count_list)/len(lane_waiting_vehicle_count_list) )
# return reward
def get_reward(self):
'''
mean speed of start lanes
'''
intersection_info = self.intersection_info(self.intersection_id)
start_lane_vehicles = intersection_info["start_lane_vehicle_count"]
start_lane_vehicles = list(itertools.chain(*start_lane_vehicles))
vehicle_speed = self.eng.get_vehicle_speed()
start_lane_vehicles_speed = [vehicle_speed[v] for v in start_lane_vehicles]
reward = sum(start_lane_vehicles_speed)/(len(start_lane_vehicles_speed) + 1e-5) * 100
return reward
def _get_pressure(self):
return [self.dic_lane_waiting_vehicle_count_current_step[lane] for lane in self.list_entering_lanes] + \
[-self.dic_lane_waiting_vehicle_count_current_step[lane] for lane in self.list_exiting_lanes]
# def get_reward(self):
# # reward function
# lane_waiting_vehicle_count = self.eng.get_lane_vehicle_count()
# lane_waiting_vehicle_count_list = list(lane_waiting_vehicle_count.values())
# reward = -1 * max(lane_waiting_vehicle_count_list)
# return reward
def get_score(self):
lane_waiting_vehicle_count = self.eng.get_lane_waiting_vehicle_count()
reward = -1 * sum(list(lane_waiting_vehicle_count.values()))
metric = (1/(1 + math.exp(-1 * reward))) / self.num_step
return metric
# return 0
def log(self):
if not os.path.exists(self.replay_data_path):
os.makedirs(self.replay_data_path)
# self.eng.print_log(self.config['replay_data_path'] + "/replay_roadnet.json",
# self.config['replay_data_path'] + "/replay_flow.json")
df = pd.DataFrame({self.intersection_id: self.phase_log[:self.num_step]})
df.to_csv(os.path.join(self.replay_data_path, 'signal_plan.txt'), index=None)
class CityFlowEnvM(object):
'''
multi inersection cityflow environment
'''
def __init__(self,
lane_phase_info,
intersection_id,
num_step=2000,
thread_num=1,
cityflow_config_file='example/config_1x2.json'
):
self.eng = cityflow.Engine(cityflow_config_file, thread_num=thread_num)
self.num_step = num_step
self.intersection_id = intersection_id # list, [intersection_id, ...]
self.state_size = None
self.lane_phase_info = lane_phase_info # "intersection_1_1"
self.current_phase = {}
self.current_phase_time = {}
self.start_lane = {}
self.end_lane = {}
self.phase_list = {}
self.phase_startLane_mapping = {}
self.intersection_lane_mapping = {} #{id_:[lanes]}
for id_ in self.intersection_id:
self.start_lane[id_] = self.lane_phase_info[id_]['start_lane']
self.end_lane[id_] = self.lane_phase_info[id_]['end_lane']
self.phase_startLane_mapping[id_] = self.lane_phase_info[id_]["phase_startLane_mapping"]
self.phase_list[id_] = self.lane_phase_info[id_]["phase"]
self.current_phase[id_] = self.phase_list[id_][0]
self.current_phase_time[id_] = 0
self.get_state() # set self.state_size
def reset(self):
self.eng.reset()
def step(self, action):
'''
action: {intersection_id: phase, ...}
'''
for id_, a in action.items():
if self.current_phase[id_] == a:
self.current_phase_time[id_] += 1
else:
self.current_phase[id_] = a
self.current_phase_time[id_] = 1
self.eng.set_tl_phase(id_, self.current_phase[id_]) # set phase of traffic light
self.eng.next_step()
return self.get_state(), self.get_reward()
def get_state(self):
state = {id_: self.get_state_(id_) for id_ in self.intersection_id}
return state
def get_state_(self, id_):
state = self.intersection_info(id_)
state_dict = state['start_lane_waiting_vehicle_count']
sorted_keys = sorted(state_dict.keys())
return_state = [state_dict[key] for key in sorted_keys] + [state['current_phase']]
return self.preprocess_state(return_state)
def intersection_info(self, id_):
'''
info of intersection 'id_'
'''
state = {}
# state['lane_vehicle_count'] = self.eng.get_lane_vehicle_count() # {lane_id: lane_count, ...}
# state['start_lane_vehicle_count'] = {lane: self.eng.get_lane_vehicle_count()[lane] for lane in self.start_lane[id_]}
# state['lane_waiting_vehicle_count'] = self.eng.get_lane_waiting_vehicle_count() # {lane_id: lane_waiting_count, ...}
# state['lane_vehicles'] = self.eng.get_lane_vehicles() # {lane_id: [vehicle1_id, vehicle2_id, ...], ...}
# state['vehicle_speed'] = self.eng.get_vehicle_speed() # {vehicle_id: vehicle_speed, ...}
# state['vehicle_distance'] = self.eng.get_vehicle_distance() # {vehicle_id: distance, ...}
# state['current_time'] = self.eng.get_current_time()
get_lane_vehicle_count = self.eng.get_lane_vehicle_count()
get_lane_waiting_vehicle_count = self.eng.get_lane_waiting_vehicle_count()
get_lane_vehicles = self.eng.get_lane_vehicles()
vehicle_speed = self.eng.get_vehicle_speed()
state['start_lane_vehicle_count'] = {lane: get_lane_vehicle_count[lane] for lane in self.start_lane[id_]}
state['end_lane_vehicle_count'] = {lane: get_lane_vehicle_count[lane] for lane in self.end_lane[id_]}
state['start_lane_waiting_vehicle_count'] = {lane: get_lane_waiting_vehicle_count[lane] for lane in self.start_lane[id_]}
state['end_lane_waiting_vehicle_count'] = {lane: get_lane_waiting_vehicle_count[lane] for lane in self.end_lane[id_]}
state['start_lane_vehicles'] = {lane: get_lane_vehicles[lane] for lane in self.start_lane[id_]}
state['end_lane_vehicles'] = {lane: get_lane_vehicles[lane] for lane in self.end_lane[id_]}
state['start_lane_speed'] = {lane: np.sum(list(map(lambda vehicle:vehicle_speed[vehicle], get_lane_vehicles[lane]))) / (get_lane_vehicle_count[lane]+1e-5) for lane in self.start_lane[id_]} # compute start lane mean speed
state['end_lane_speed'] = {lane: np.sum(list(map(lambda vehicle:vehicle_speed[vehicle], get_lane_vehicles[lane]))) / (get_lane_vehicle_count[lane]+1e-5) for lane in self.end_lane[id_]} # compute end lane mean speed
state['current_phase'] = self.current_phase[id_]
state['current_phase_time'] = self.current_phase_time[id_]
return state
def preprocess_state(self, state):
return_state = np.array(state)
if self.state_size is None:
self.state_size = len(return_state.flatten())
return_state = np.reshape(return_state, [1, self.state_size])
return return_state
def get_reward(self):
reward = {id_: self.get_reward_(id_) for id_ in self.intersection_id}
return reward
# def get_reward_(self, id_):
# '''
# every agent/intersection's reward
# '''
# state = self.intersection_info(id_)
# start_lane_waiting_vehicle_count = state['start_lane_waiting_vehicle_count']
# reward = -1 * np.sum(list(start_lane_waiting_vehicle_count.values()))
# return reward
def get_reward_(self, id_):
'''
every agent/intersection's reward
'''
state = self.intersection_info(id_)
start_lane_speed = state['start_lane_speed']
reward = np.mean(list(start_lane_speed.values())) * 100
return reward
def get_score(self):
score = {id_: self.get_score_(id_) for id_ in self.intersection_id}
return score
def get_score_(self, id_):
state = self.intersection_info(id_)
start_lane_waiting_vehicle_count = state['start_lane_waiting_vehicle_count']
end_lane_waiting_vehicle_count = state['end_lane_waiting_vehicle_count']
x = -1 * np.sum(list(start_lane_waiting_vehicle_count.values()) + list(end_lane_waiting_vehicle_count.values()))
score = ( 1/(1 + np.exp(-1 * x)) )/self.num_step
return score
import ray
from ray.rllib.env.multi_agent_env import MultiAgentEnv
from gym.spaces import Discrete, Box
class CityFlowEnvRay(MultiAgentEnv):
'''
multi inersection cityflow environment, for the Ray framework
'''
observation_space = Box(0.0*np.ones((13,)), 100*np.ones((13,)))
action_space = Discrete(8) # num of agents
def __init__(self, config):
print("init")
self.eng = cityflow.Engine(config["cityflow_config_file"], thread_num=config["thread_num"])
# self.eng = config["eng"][0]
self.num_step = config["num_step"]
self.intersection_id = config["intersection_id"] # list, [intersection_id, ...]
self.num_agents = len(self.intersection_id)
self.state_size = None
self.lane_phase_info = config["lane_phase_info"] # "intersection_1_1"
self.congestion_thres = 30
self.current_phase = {}
self.current_phase_time = {}
self.start_lane = {}
self.end_lane = {}
self.phase_list = {}
self.phase_startLane_mapping = {}
self.intersection_lane_mapping = {} #{id_:[lanes]}
for id_ in self.intersection_id:
self.start_lane[id_] = self.lane_phase_info[id_]['start_lane']
self.end_lane[id_] = self.lane_phase_info[id_]['end_lane']
self.phase_startLane_mapping[id_] = self.lane_phase_info[id_]["phase_startLane_mapping"]
self.phase_list[id_] = self.lane_phase_info[id_]["phase"]
self.current_phase[id_] = self.phase_list[id_][0]
self.current_phase_time[id_] = 0
self.get_state() # set self.state_size
self.num_actions = len(self.phase_list[self.intersection_id[0]])
# self.observation_space = Box(np.ones(0.0*(self.state_size,)), 20.0*np.ones((self.state_size)))
# self.action_space = Discrete(self.num_actions) # num of agents
self.count = 0
self.done = False
self.congestion = False
self.reset()
def reset(self):
self.eng.reset()
self.done = False
self.congestion = False
self.count = 0
return {id_:np.zeros((self.state_size,)) for id_ in self.intersection_id}
def step(self, action):
'''
action: {intersection_id: phase, ...}
'''
# print("action:", action)
for id_, a in action.items():
if self.current_phase[id_] == self.phase_list[id_][a]:
self.current_phase_time[id_] += 1
else:
self.current_phase[id_] = self.phase_list[id_][a]
self.current_phase_time[id_] = 1
self.eng.set_tl_phase(id_, self.current_phase[id_]) # set phase of traffic light
# print("after action:", action)
self.eng.next_step()
self.count += 1
state = self.get_state()
reward = self.get_reward()
self.congestion = self.compute_congestion()
self.done = {id_:False for id_ in self.intersection_id}
self.done['__all__'] = False
if self.count >= self.num_step:
self.done = {id_:True for id_ in self.intersection_id}
self.done['__all__'] = True
# for id_ in self.intersection_id:
# reward[id_] = 0
else:
for id_ in self.intersection_id:
if self.congestion[id_]:
self.done[id_] = True
reward[id_] = -1*50*(self.num_step-self.count) # if congestion, return a large penaty
if all(list(self.congestion.values())) is True:
self.done['__all__'] = True
else:
self.done['__all__'] = False
return state, reward, self.done, {}
def compute_congestion(self):
intersection_info = {}
for id_ in self.intersection_id:
intersection_info[id_] = self.intersection_info(id_)
congestion = {id_:False for id_ in self.intersection_id}
for id_ in self.intersection_id:
if np.max(list(intersection_info[id_]["start_lane_waiting_vehicle_count"].values())) > self.congestion_thres:
congestion[id_] = True
return congestion
def get_state(self):
state = {id_: self.get_state_(id_) for id_ in self.intersection_id}
return state
def get_state_(self, id_):
state = self.intersection_info(id_)
state_dict = state['start_lane_waiting_vehicle_count']
sorted_keys = sorted(state_dict.keys())
return_state = [state_dict[key] for key in sorted_keys] + [state['current_phase']]
return self.preprocess_state(return_state)
def intersection_info(self, id_):
'''
info of intersection 'id_'
'''
state = {}
get_lane_vehicle_count = self.eng.get_lane_vehicle_count()
get_lane_waiting_vehicle_count = self.eng.get_lane_waiting_vehicle_count()
get_lane_vehicles = self.eng.get_lane_vehicles()
get_vehicle_speed = self.eng.get_vehicle_speed()
# print(self.intersection_id)
# print(id_)
# print("start lane", self.start_lane)
# print("get_lane_vehicle_count key length:", get_lane_vehicle_count)
# print("engine:", self.eng)
# print("get_lane_waiting_vehicle_count:", get_lane_waiting_vehicle_count)
# print("get_lane_vehicles:", get_lane_vehicles)
# print("vehicle_speed:", vehicle_speed)
state['start_lane_vehicle_count'] = {lane: get_lane_vehicle_count[lane] for lane in self.start_lane[id_]}
state['end_lane_vehicle_count'] = {lane: get_lane_vehicle_count[lane] for lane in self.end_lane[id_]}
# state['start_lane_vehicle_count'] = {}
# state['end_lane_vehicle_count'] = {}
state['start_lane_waiting_vehicle_count'] = {lane: get_lane_waiting_vehicle_count[lane] for lane in self.start_lane[id_]}
state['end_lane_waiting_vehicle_count'] = {lane: get_lane_waiting_vehicle_count[lane] for lane in self.end_lane[id_]}
state['start_lane_vehicles'] = {lane: get_lane_vehicles[lane] for lane in self.start_lane[id_]}
state['end_lane_vehicles'] = {lane: get_lane_vehicles[lane] for lane in self.end_lane[id_]}
state['start_lane_speed'] = {lane: np.sum(list(map(lambda v:get_vehicle_speed[v], get_lane_vehicles[lane])))/(len(get_lane_vehicles[lane])+1e-5) for lane in self.start_lane[id_]} # compute start lane mean speed
state['end_lane_speed'] = {lane: np.sum(list(map(lambda v:get_vehicle_speed[v], get_lane_vehicles[lane])))/(len(get_lane_vehicles[lane])+1e-5) for lane in self.end_lane[id_]} # compute end lane mean speed
state['current_phase'] = self.current_phase[id_]
state['current_phase_time'] = self.current_phase_time[id_]
return state
def preprocess_state(self, state):
return_state = np.array(state)
if self.state_size is None:
self.state_size = len(return_state.flatten())
return_state = np.reshape(np.array(return_state), [1, self.state_size]).flatten()
return return_state
def get_reward(self):
reward = {id_: self.get_reward_(id_) for id_ in self.intersection_id}
mean_global_sum = np.mean(list(reward.values()))
return reward
# reward = {id_:mean_global_sum for id_ in self.intersection_id}
# return reward
def get_reward_(self, id_):
'''
every agent/intersection's reward
'''
state = self.intersection_info(id_)
temp = state['start_lane_waiting_vehicle_count']
reward = -1 * np.mean(list(temp.values()))
return reward
def get_score(self):
score = {id_: self.get_score_(id_) for id_ in self.intersection_id}
return score
def get_score_(self, id_):
state = self.intersection_info(id_)
start_lane_waiting_vehicle_count = state['start_lane_waiting_vehicle_count']
end_lane_waiting_vehicle_count = state['end_lane_waiting_vehicle_count']
x = -1 * np.sum(list(start_lane_waiting_vehicle_count.values()) + list(end_lane_waiting_vehicle_count.values()))
score = ( 1/(1 + np.exp(-1 * x)) )/self.num_step
return score | 45.134694 | 228 | 0.653147 | 2,929 | 22,116 | 4.557528 | 0.060772 | 0.089894 | 0.08113 | 0.096487 | 0.799461 | 0.765975 | 0.726122 | 0.680575 | 0.6381 | 0.602742 | 0 | 0.006266 | 0.235033 | 22,116 | 490 | 229 | 45.134694 | 0.782776 | 0.185838 | 0 | 0.679487 | 0 | 0 | 0.072397 | 0.041822 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105769 | false | 0 | 0.032051 | 0.003205 | 0.240385 | 0.003205 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
05d82e700b8327a8c2adb66928a6d4fbc7eac1c3 | 190 | py | Python | build/externals/build_python-geoip/examples/domain.py | adityaddy/GSoC_CernVM-FS | cd4dd6937eb4b862f1128a236d394e4734db0b75 | [
"Apache-2.0",
"BSD-3-Clause"
] | 20 | 2015-05-08T02:43:27.000Z | 2018-03-08T11:08:17.000Z | build/externals/build_python-geoip/examples/domain.py | adityaddy/GSoC_CernVM-FS | cd4dd6937eb4b862f1128a236d394e4734db0b75 | [
"Apache-2.0",
"BSD-3-Clause"
] | 5 | 2015-05-06T23:43:04.000Z | 2015-08-13T19:14:37.000Z | build/externals/build_python-geoip/examples/domain.py | adityaddy/GSoC_CernVM-FS | cd4dd6937eb4b862f1128a236d394e4734db0b75 | [
"Apache-2.0",
"BSD-3-Clause"
] | 3 | 2015-07-07T18:44:07.000Z | 2018-10-26T19:36:50.000Z | #!/usr/bin/python
from __future__ import print_function
import GeoIP
gi = GeoIP.open("/usr/local/share/GeoIP/GeoIPDomain.dat", GeoIP.GEOIP_STANDARD)
print(gi.org_by_addr("24.24.24.24"))
| 19 | 79 | 0.763158 | 31 | 190 | 4.419355 | 0.645161 | 0.087591 | 0.087591 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045977 | 0.084211 | 190 | 9 | 80 | 21.111111 | 0.741379 | 0.084211 | 0 | 0 | 0 | 0 | 0.283237 | 0.219653 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0.5 | 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 | 1 | 0 | 3 |
05db6fc04a2b8ec0e1762e4ba10feede6d5affcf | 559 | py | Python | lambdata_davidvollendroff/df_utils.py | jamesluttringer2019/lambdata | 06917aeb761f774b8ce23d6639e32d0511d9d78d | [
"MIT"
] | null | null | null | lambdata_davidvollendroff/df_utils.py | jamesluttringer2019/lambdata | 06917aeb761f774b8ce23d6639e32d0511d9d78d | [
"MIT"
] | null | null | null | lambdata_davidvollendroff/df_utils.py | jamesluttringer2019/lambdata | 06917aeb761f774b8ce23d6639e32d0511d9d78d | [
"MIT"
] | null | null | null | """
Utility functions for working with DataFrames
"""
import pandas
import numpy as np
TEST_DF = pandas.DataFrame([1,2,3])
class O:
"""
A square shaped block for my PyTetris game.
"""
def __init__(self):
self.type = "O"
self.color = (255, 255, 0)
mold = np.zeros([24, 10]) # framework for falling piece
mold[1, 4:6] = 1 # placing 1s where the piece begins
mold[2, 4:6] = 1
self.position = mold
self.position = [self.position, self.position, self.position, self.position]
| 23.291667 | 84 | 0.593918 | 78 | 559 | 4.192308 | 0.615385 | 0.220183 | 0.195719 | 0.293578 | 0.183486 | 0.183486 | 0.183486 | 0.183486 | 0 | 0 | 0 | 0.057644 | 0.286225 | 559 | 23 | 85 | 24.304348 | 0.761905 | 0.271914 | 0 | 0 | 0 | 0 | 0.002611 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.166667 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 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 | 3 |
05eadfeb5ed4fb8d547a68bfc985b80bd5d3e0d0 | 171 | py | Python | holobot/sdk/exceptions/authorization_error.py | rexor12/holobot | 89b7b416403d13ccfeee117ef942426b08d3651d | [
"MIT"
] | 1 | 2021-05-24T00:17:46.000Z | 2021-05-24T00:17:46.000Z | holobot/sdk/exceptions/authorization_error.py | rexor12/holobot | 89b7b416403d13ccfeee117ef942426b08d3651d | [
"MIT"
] | 41 | 2021-03-24T22:50:09.000Z | 2021-12-17T12:15:13.000Z | holobot/sdk/exceptions/authorization_error.py | rexor12/holobot | 89b7b416403d13ccfeee117ef942426b08d3651d | [
"MIT"
] | null | null | null | class AuthorizationError(Exception):
def __init__(self, user_id: int):
super().__init__(f"Unauthorized access from the user with the identifier '{user_id}'.")
| 42.75 | 95 | 0.725146 | 22 | 171 | 5.181818 | 0.772727 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157895 | 171 | 3 | 96 | 57 | 0.791667 | 0 | 0 | 0 | 0 | 0 | 0.385965 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
05fce7dd26ecfad36483a445613370d3a4e7bdd9 | 293 | py | Python | exercises from lesson/5.py | mo1cy/goiteens-python3-rudiy | 9b46855fef17397207db1cbdbbd981ae57d2f316 | [
"MIT"
] | null | null | null | exercises from lesson/5.py | mo1cy/goiteens-python3-rudiy | 9b46855fef17397207db1cbdbbd981ae57d2f316 | [
"MIT"
] | null | null | null | exercises from lesson/5.py | mo1cy/goiteens-python3-rudiy | 9b46855fef17397207db1cbdbbd981ae57d2f316 | [
"MIT"
] | null | null | null | first_day = 500 #accounts deleted
pair_user = 50 #hrn
odd_user = 40 #hrn
profit = 500 #hrn
pair_users = 250 * pair_user #hrn
odd_users = 250 * odd_user #hrn
total_loss_of_deleted_users = pair_users + odd_users
total_loss = profit - total_loss_of_deleted_users
print("total loss:" ,total_loss)
| 29.3 | 52 | 0.774744 | 50 | 293 | 4.16 | 0.36 | 0.216346 | 0.105769 | 0.173077 | 0.221154 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063745 | 0.143345 | 293 | 9 | 53 | 32.555556 | 0.76494 | 0.105802 | 0 | 0 | 0 | 0 | 0.042969 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | null | 1 | 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 | 3 |
af2928d0ba54eb234e44c8bfdfdf9ed47ab69b7c | 1,718 | py | Python | mailchimp3/entities/interest.py | klaviyo/python-mailchimp | b1f5ac2d56567dc4f9619082c597c29229a0c28f | [
"MIT"
] | null | null | null | mailchimp3/entities/interest.py | klaviyo/python-mailchimp | b1f5ac2d56567dc4f9619082c597c29229a0c28f | [
"MIT"
] | null | null | null | mailchimp3/entities/interest.py | klaviyo/python-mailchimp | b1f5ac2d56567dc4f9619082c597c29229a0c28f | [
"MIT"
] | 1 | 2020-08-07T13:35:14.000Z | 2020-08-07T13:35:14.000Z | from __future__ import unicode_literals
from ..baseapi import BaseApi
class Interest(BaseApi):
def __init__(self, *args, **kwargs):
super(Interest, self).__init__(*args, **kwargs)
self.endpoint = 'lists'
def all(self, list_id, category_id, **kwargs):
"""
returns the interests for the category.
"""
return self._mc_client._get(
url=self._build_path(list_id, 'interest-categories', category_id, 'interests'),
**kwargs
)
def create(self, list_id, category_id, data):
"""
creates a new interest, or Group Name.
"""
return self._mc_client._post(
url=self._build_path(list_id, 'interest-categories', category_id, 'interests'), data=data)
def get(self, list_id, category_id, interest_id):
"""
returns information about a specific interest category, or Group Title.
"""
return self._mc_client._get(
url=self._build_path(list_id, 'interest-categories', category_id, 'interests', interest_id))
def update(self, list_id, category_id, interest_id, data):
"""
returns information about a specific interest category, or Group Title.
"""
return self._mc_client._patch(
url=self._build_path(list_id, 'interest-categories', category_id, 'interests', interest_id),
data=data)
def delete(self, list_id, category_id, interest_id):
"""
returns information about a specific interest category, or Group Title.
"""
return self._mc_client._delete(
url=self._build_path(list_id, 'interest-categories', category_id, 'interests', interest_id))
| 35.791667 | 104 | 0.635623 | 204 | 1,718 | 5.039216 | 0.235294 | 0.058366 | 0.048638 | 0.087549 | 0.69358 | 0.654669 | 0.654669 | 0.625486 | 0.625486 | 0.625486 | 0 | 0 | 0.254366 | 1,718 | 47 | 105 | 36.553191 | 0.802498 | 0.171711 | 0 | 0.166667 | 0 | 0 | 0.110941 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.083333 | 0 | 0.583333 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
af3011bca01347cc0d9aeccbd73219cef2f4d6b6 | 67,139 | py | Python | pysnmp-with-texts/DOCS-SUBMGT3-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/DOCS-SUBMGT3-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/DOCS-SUBMGT3-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 DOCS-SUBMGT3-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DOCS-SUBMGT3-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:45:55 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, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint")
DocsL2vpnIfList, clabProjDocsis = mibBuilder.importSymbols("CLAB-DEF-MIB", "DocsL2vpnIfList", "clabProjDocsis")
docsIf3CmtsCmRegStatusId, docsIf3CmtsCmRegStatusEntry = mibBuilder.importSymbols("DOCS-IF3-MIB", "docsIf3CmtsCmRegStatusId", "docsIf3CmtsCmRegStatusEntry")
InetPortNumber, InetAddressPrefixLength, InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetPortNumber", "InetAddressPrefixLength", "InetAddressType", "InetAddress")
SnmpTagList, = mibBuilder.importSymbols("SNMP-TARGET-MIB", "SnmpTagList")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
Counter32, ObjectIdentity, Gauge32, NotificationType, Counter64, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, MibIdentifier, TimeTicks, Unsigned32, iso, Integer32, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "ObjectIdentity", "Gauge32", "NotificationType", "Counter64", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "MibIdentifier", "TimeTicks", "Unsigned32", "iso", "Integer32", "IpAddress")
MacAddress, TimeStamp, TextualConvention, DisplayString, TruthValue, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "MacAddress", "TimeStamp", "TextualConvention", "DisplayString", "TruthValue", "RowStatus")
docsSubmgt3Mib = ModuleIdentity((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10))
docsSubmgt3Mib.setRevisions(('2015-06-03 00:00', '2014-04-03 00:00', '2011-06-23 00:00', '2010-06-11 00:00', '2009-01-21 00:00', '2007-05-18 00:00', '2006-12-07 17:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: docsSubmgt3Mib.setRevisionsDescriptions(('Revised Version includes ECN OSSIv3.0-N-15.1311-2', 'Revised Version includes ECNs OSSIv3.0-N-13.1125-2 and published as I23', 'Revised Version includes ECNs OSSIv3.0-N-11.0996-1 and published as I15', 'Revised Version includes ECNs OSSIv3.0-N-10.0906-2 OSSIv3.0-N-10.0921-4 and published as I12', 'Revised Version includes ECNs OSSIv3.0-N-08.0651-3 OSSIv3.0-N-08.0700-4 and published as I08', 'Revised Version includes ECNs OSSIv3.0-N-07.0445-3 OSSIv3.0-N-07.0444-3 OSSIv3.0-N-07.0441-4 and published as I03', 'Initial version, published as part of the CableLabs OSSIv3.0 specification CM-SP-OSSIv3.0-I01-061207 Copyright 1999-2009 Cable Television Laboratories, Inc. All rights reserved.',))
if mibBuilder.loadTexts: docsSubmgt3Mib.setLastUpdated('201506030000Z')
if mibBuilder.loadTexts: docsSubmgt3Mib.setOrganization('Cable Television Laboratories, Inc.')
if mibBuilder.loadTexts: docsSubmgt3Mib.setContactInfo(' Postal: Cable Television Laboratories, Inc. 858 Coal Creek Circle Louisville, Colorado 80027-9750 U.S.A. Phone: +1 303-661-9100 Fax: +1 303-661-9199 E-mail: mibs@cablelabs.com')
if mibBuilder.loadTexts: docsSubmgt3Mib.setDescription('This MIB module contains the management objects for the CMTS control of the IP4 and IPv6 traffic with origin and destination to CMs and/or CPEs behind the CM.')
docsSubmgt3MibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1))
docsSubmgt3Base = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1))
docsSubmgt3BaseCpeMaxIpv4Def = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1023)).clone(16)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseCpeMaxIpv4Def.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseCpeMaxIpv4Def.setDescription("This attribute represents the maximum number of IPv4 Addresses allowed for the CM's CPEs if not signaled in the registration process.")
docsSubmgt3BaseCpeMaxIpv6AddressesDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1023)).clone(16)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseCpeMaxIpv6AddressesDef.setStatus('deprecated')
if mibBuilder.loadTexts: docsSubmgt3BaseCpeMaxIpv6AddressesDef.setDescription("This attribute represents the maximum number of IPv6 prefixes or addresses allowed for the CM's CPEs if not signaled in the registration process. All IPv6 addresses, including Link-Local and any address with a scope greater than 1 are counted against the docsSubmgt3BaseCpeMaxIpv6AddressesDef.")
docsSubmgt3BaseCpeMaxIpv6PrefixesDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 15), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1023)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseCpeMaxIpv6PrefixesDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseCpeMaxIpv6PrefixesDef.setDescription("This attribute represents the maximum number of IPv6 IA_PDs (delegated prefixes) allowed for the CM's CPEs if not signaled during the registration process. IPv6 IA_PDs are counted against the CpeMaxIpv6PrefixesDef. This contrasts with the CpeMaxIPv4AddressesDef addresses, rather than IPv4 subnets, allowed by default per CM. Because this attribute only counts IA_PDs against the default, IA_NA addresses and Link-Local addresses are not counted against this default limit.")
docsSubmgt3BaseCpeActiveDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 3), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseCpeActiveDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseCpeActiveDef.setDescription('This attribute represents the default value for enabling Subscriber Management filters and controls in the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BaseCpeLearnableDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 4), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseCpeLearnableDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseCpeLearnableDef.setDescription('This attribute represents the default value for enabling the CPE learning process for the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BaseSubFilterDownDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseSubFilterDownDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseSubFilterDownDef.setDescription('This attribute represents the default value for the subscriber (CPE) downstream filter group for the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BaseSubFilterUpDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseSubFilterUpDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseSubFilterUpDef.setDescription('This attribute represents the default value for the subscriber (CPE) upstream filter group for the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BaseCmFilterDownDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseCmFilterDownDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseCmFilterDownDef.setDescription('This attribute represents the default value for the CM stack downstream filter group applying to the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BaseCmFilterUpDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseCmFilterUpDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseCmFilterUpDef.setDescription('This attribute represents the default value for the CM stack upstream filter group applying to the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BasePsFilterDownDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BasePsFilterDownDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BasePsFilterDownDef.setDescription('This attribute represents the default value for the PS or eRouter downstream filter group for the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BasePsFilterUpDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 10), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BasePsFilterUpDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BasePsFilterUpDef.setDescription('This attribute represents the default value for the PS or eRouter upstream filter group for the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BaseMtaFilterDownDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseMtaFilterDownDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseMtaFilterDownDef.setDescription('This attribute represents the default value for the MTA, DVA, SG, or TEA downstream filter group for the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BaseMtaFilterUpDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseMtaFilterUpDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseMtaFilterUpDef.setDescription('This attribute represents the default value for the MTA, DVA, SG, or TEA upstream filter group for the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BaseStbFilterDownDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 13), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseStbFilterDownDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseStbFilterDownDef.setDescription('This attribute represents the default value for the STB or CableCARD downstream filter group for the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3BaseStbFilterUpDef = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 1, 14), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3BaseStbFilterUpDef.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3BaseStbFilterUpDef.setDescription('This attribute represents the default value for the STB or CableCARD upstream filter group for the CM if the parameter is not signaled in the DOCSIS Registration process.')
docsSubmgt3CpeCtrlTable = MibTable((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 2), )
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlTable.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlTable.setDescription('This object maintains per-CM traffic policies enforced by the CMTS. The CMTS acquires the CM traffic policies through the CM registration process, or in the absence of some or all of those parameters, from the Base object. The CM information and controls are meaningful and used by the CMTS, but only after the CM is operational.')
docsSubmgt3CpeCtrlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 2, 1), )
docsIf3CmtsCmRegStatusEntry.registerAugmentions(("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeCtrlEntry"))
docsSubmgt3CpeCtrlEntry.setIndexNames(*docsIf3CmtsCmRegStatusEntry.getIndexNames())
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlEntry.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlEntry.setDescription('The conceptual row of docsSubmgt3CpeCtrlTable. The CMTS does not persist the instances of the CpeCtrl object across reinitializations.')
docsSubmgt3CpeCtrlMaxCpeIpv4 = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1023))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlMaxCpeIpv4.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I26-150305, Subscriber Management TLVs section in the Common Radio Frequency Interface Encodings Annex.')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlMaxCpeIpv4.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlMaxCpeIpv4.setDescription("This attribute represents the number of simultaneous IP v4 addresses permitted for CPE connected to the CM. When the MaxCpeIpv4 attribute is set to zero (0), all Ipv4 CPE traffic from the CM is dropped. The CMTS configures this attribute with whichever of the 'Subscriber Management CPE IPv4 List' or 'Subscriber Management Control-Max_CpeIPv4' signaled encodings is greater, or in the absence of all of those provisioning parameters, with the CpeMaxIp v4Def from the Base object. This limit applies to learned and DOCSIS-provisioned entries but not to entries added through some administrative process at the CMTS. Note that this attribute is only meaningful when the Active attribute of the CM is set to 'true'.")
docsSubmgt3CpeCtrlMaxCpeIpv6Addresses = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 2, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1023))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlMaxCpeIpv6Addresses.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I26-150305, Subscriber Management TLVs section in the Common Radio Frequency Interface Encodings Annex.')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlMaxCpeIpv6Addresses.setStatus('deprecated')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlMaxCpeIpv6Addresses.setDescription("This attribute represents the maximum number of simultaneous IPv6 prefixes and addresses that are permitted for CPEs connected to the CM. When the MaxCpeIpv6Prefix is set to zero (0), all IPv6 CPE traffic from the CM is dropped. The CMTS configures this attribute with whichever of the ('Subscriber Management CPE IPv6 List (TLV 67)' plus 'Subscriber Management CPE IPv6 Prefix List (TLV 61)') or ('Subscriber Management Control Max CPE IPv6 Addresses (TLV 63)') signaled encodings is greater, or in the absence of all of those provisioning parameters, with the MaxIpv6AddressDef from the Base object. This limit applies to learned and DOCSIS-provisioned entries but not to entries added through some administrative process at the CMTS. Note that this attribute is only meaningful when the Active attribute of the CM is set to 'true'. All IPv6 addresses, including Link-Local and any address with a scope greater than 1 are counted against the docsSubmgt3CpeCtrlMaxCpeIpv6Addresses.")
docsSubmgt3CpeCtrlMaxCpeIpv6Prefixes = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 2, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1023))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlMaxCpeIpv6Prefixes.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I04-070518, Subscriber Management TLVs section in the Common Radio Frequency Interface Encodings Annex.')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlMaxCpeIpv6Prefixes.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlMaxCpeIpv6Prefixes.setDescription("This attribute represents the maximum number of simultaneous IPv6 IA_PDs (delegated prefixes) that are permitted for CPEs connected to the CM.When the MaxCpeIpv6Prefixes is set to zero (0), all IPv6 CPE traffic from the CM is dropped. The CMTS configures this attribute with whichever of the ('Subscriber Management CPE IPv6 List (TLV 67)' plus 'Subscriber Management CPE IPv6 Prefix List (TLV 61) ') or ('Subscriber Management Control Max CPE IPv6 Addresses (TLV 63)') signaled encodings is greater, or in the absence of all of those provisioning parameters, with the MaxIpv6PrefixesDef from the Base object. This limit applies to learned and DOCSIS-provisioned entries but not to entries added through some administrative process at the CMTS. Note that this attribute is only meaningful when the Active attribute of the CM is set to 'true'. IPv6 IA_PDs s are counted against the CpeCtrlMaxCpeIpv6Prefixes in order to limit the number of simultaneous IA_PDs permitted for the CMs CPEs.")
docsSubmgt3CpeCtrlActive = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 2, 1, 3), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlActive.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I26-150305, Subscriber Management Control section in the Common Radio Frequency Interface Encodings Annex.')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlActive.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlActive.setDescription("This attribute controls the application of subscriber management to this CM. If this is set to 'true', CMTS-based CPE control is active, and all the actions required by the various filter policies and controls apply at the CMTS. If this is set to false, no subscriber management filtering is done at the CMTS (but other filters may apply). If not set through DOCSIS provisioning, this object defaults to the value of the Active attribute of the Base object.")
docsSubmgt3CpeCtrlLearnable = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 2, 1, 4), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlLearnable.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I26-150305, Subscriber Management Control section in the Common Radio Frequency Interface Encodings Annex.')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlLearnable.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlLearnable.setDescription("This attribute controls whether the CMTS may learn (and pass traffic for) CPE IP addresses associated with a CM. If this is set to 'true', the CMTS may learn up to the CM MaxCpeIp value less any DOCSIS-provisioned entries related to this CM. The nature of the learning mechanism is not specified here. If not set through DOCSIS provisioning, this object defaults to the value of the CpeLearnableDef attribute from the Base object. Note that this attribute is only meaningful if docsSubMgtCpeControlActive is 'true' to enforce a limit in the number of CPEs learned. CPE learning is always performed for the CMTS for security reasons.")
docsSubmgt3CpeCtrlReset = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 2, 1, 5), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlReset.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlReset.setDescription("If set to 'true', this attribute commands the CMTS to delete the instances denoted as 'learned' addresses in the CpeIp object. This attribute always returns false on read.")
docsSubmgt3CpeCtrlLastReset = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 2, 1, 6), TimeStamp()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlLastReset.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeCtrlLastReset.setDescription("This attribute represents the system Up Time of the last set to 'true' of the Reset attribute of this instance. Zero if never reset.")
docsSubmgt3CpeIpTable = MibTable((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 3), )
if mibBuilder.loadTexts: docsSubmgt3CpeIpTable.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeIpTable.setDescription("This object defines the list of IP Addresses behind the CM known by the CMTS. If the Active attribute of the CpeCtrl object associated with a CM is set to 'true' and the CMTS receives an IP packet from a CM that contains a source IP address that does not match one of the CPE IP addresses associated with this CM, one of two things occurs. If the number of CPE IPs is less than the MaxCpeIp of the CpeCtrl object for that CM, the source IP address is added to this object and the packet is forwarded; otherwise, the packet is dropped.")
docsSubmgt3CpeIpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 3, 1), ).setIndexNames((0, "DOCS-IF3-MIB", "docsIf3CmtsCmRegStatusId"), (0, "DOCS-SUBMGT3-MIB", "docsSubmgt3CpeIpId"))
if mibBuilder.loadTexts: docsSubmgt3CpeIpEntry.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeIpEntry.setDescription('The conceptual row of docsSubmgt3CpeIpTable.')
docsSubmgt3CpeIpId = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 1023)))
if mibBuilder.loadTexts: docsSubmgt3CpeIpId.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeIpId.setDescription("This attribute represents a unique identifier for a CPE IP of the CM. An instance of this attribute exists for each CPE provisioned in the 'Subscriber Management CPE IPv4 Table' or 'Subscriber Management CPE IPv6 Table' encodings. An entry is created either through the included CPE IP addresses in the provisioning object, or CPEs learned from traffic sourced from the CM.")
docsSubmgt3CpeIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 3, 1, 2), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: docsSubmgt3CpeIpAddrType.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeIpAddrType.setDescription('The type of Internet address of the Addr attribute, such as IPv4 or IPv6.')
docsSubmgt3CpeIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 3, 1, 3), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: docsSubmgt3CpeIpAddr.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeIpAddr.setDescription('This attribute represents the IP address either set from provisioning or learned via address gleaning of the DHCP exchange or some other means.')
docsSubmgt3CpeIpAddrPrefixLen = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 3, 1, 4), InetAddressPrefixLength()).setMaxAccess("readonly")
if mibBuilder.loadTexts: docsSubmgt3CpeIpAddrPrefixLen.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeIpAddrPrefixLen.setDescription('This attribute represents the prefix length associated with the IP prefix (IPv4 or IPv6) that is either set via provisioning or learned via address gleaning of the DHCP exchange or some other means. For IPv4 CPE addresses, this attribute generally reports the value 32 (32 bits) to indicate a unicast IPv4 address. For IPv6 CPE addresses, this attribute represents either a discrete IPv6 IA_NA unicast address (a value of 128 bits, equal to /128 prefix length) or a delegated prefix (IA_PD) and its associated length (such as 56 bits, equal to /56 prefix length).')
docsSubmgt3CpeIpLearned = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 3, 1, 5), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: docsSubmgt3CpeIpLearned.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeIpLearned.setDescription("This attribute is set to 'true' when the IP address was learned from IP packets sent upstream rather than via the CM provisioning process.")
docsSubmgt3CpeIpType = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("cpe", 1), ("ps", 2), ("mta", 3), ("stb", 4), ("tea", 5), ("erouter", 6), ("dva", 7), ("sg", 8), ("card", 9)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: docsSubmgt3CpeIpType.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3CpeIpType.setDescription("This attribute represents the type of CPE based on the following classification below: 'cpe' Regular CPE clients. 'ps' CableHome Portal Server (PS) 'mta' PacketCable Multimedia Terminal Adapter (MTA) 'stb' Digital Set-top Box (STB). 'tea' T1 Emulation adapter (TEA) 'erouter' Embedded Router (eRouter) 'dva' Digital Voice Adapter (DVA) 'sg' Security Gateway (SG) 'card' CableCARD")
docsSubmgt3GrpTable = MibTable((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4), )
if mibBuilder.loadTexts: docsSubmgt3GrpTable.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I26-150305, Subscriber Management TLVs section in the Common Radio Frequency Interface Encodings Annex.')
if mibBuilder.loadTexts: docsSubmgt3GrpTable.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpTable.setDescription('This object defines the set of downstream and upstream filter groups that the CMTS applies to traffic associated with that CM.')
docsSubmgt3GrpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1), )
docsIf3CmtsCmRegStatusEntry.registerAugmentions(("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpEntry"))
docsSubmgt3GrpEntry.setIndexNames(*docsIf3CmtsCmRegStatusEntry.getIndexNames())
if mibBuilder.loadTexts: docsSubmgt3GrpEntry.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpEntry.setDescription('The conceptual row of docsSubmgt3GrpTable. The CMTS does not persist the instances of the Grp object across reinitializations.')
docsSubMgt3GrpUdcGroupIds = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 1), SnmpTagList().clone(hexValue="")).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubMgt3GrpUdcGroupIds.setStatus('current')
if mibBuilder.loadTexts: docsSubMgt3GrpUdcGroupIds.setDescription("This attribute represents the filter group(s) associated with the CM signaled 'Upstream Drop Classifier Group ID' encodings during the registration process. UDC Group IDs are integer values and this attribute reports them as decimal numbers that are space-separated. The zero-length string indicates that the CM didn't signal UDC Group IDs. This attribute provides two functions: - Communicate the CM the configured UDC Group ID(s), irrespective of the CM being provisioned to filter upstream traffic based on IP Filters or UDCs. - Optionally, and with regards to the CMTS, if the value of the attribute UdcSentInReqRsp is 'true', indicates that the filtering rules associated with the Subscriber Management Group ID(s) will be sent during registration to the CM. It is vendor specific whether the CMTS updates individual CM UDCs after registration when rules are changed in the Grp object.")
docsSubMgt3GrpUdcSentInRegRsp = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubMgt3GrpUdcSentInRegRsp.setStatus('current')
if mibBuilder.loadTexts: docsSubMgt3GrpUdcSentInRegRsp.setDescription("This attribute represents the CMTS upstream filtering status for this CM. The value 'true' indicates that the CMTS has sent UDCs to the CM during registration process. In order for a CMTS to send UDCs to a CM, the CMTS MAC Domain needed to be enabled via the MAC Domain attribute SendUdcRulesEnabled and the CM had indicated the UDC capability support during the registration process. The value 'false' indicates that the CMTS was not enabled to sent UDCs to the CMs in the MAC Domain, or the CM does not advertised UDC support in its capabilities encodings, or both. Since the CMTS capability to sent UDCs to CMs during the registration process is optional, the CMTS is not required to implement the value 'true'.")
docsSubmgt3GrpSubFilterDs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpSubFilterDs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpSubFilterDs.setDescription("This attribute represents the filter group applied to traffic destined for subscriber's CPE attached to the referenced CM (attached to CM CPE interfaces). This value corresponds to the 'Subscriber Downstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the SubFilterDownDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic destined to hosts attached to this CM.")
docsSubmgt3GrpSubFilterUs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpSubFilterUs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpSubFilterUs.setDescription("This attribute represents the filter group applied to traffic originating from subscriber's CPE attached to the referenced CM (attached to CM CPE interfaces). This value corresponds to the 'Subscriber Upstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the SubFilterUpDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic originating from hosts attached to this CM.")
docsSubmgt3GrpCmFilterDs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpCmFilterDs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpCmFilterDs.setDescription("This attribute represents the filter group applied to traffic destined for the CM itself. This value corresponds to the 'CM Downstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the CmFilterDownDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic destined to the CM.")
docsSubmgt3GrpCmFilterUs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpCmFilterUs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpCmFilterUs.setDescription("This attribute represents the filter group applied to traffic originating from the CM itself. This value corresponds to the 'Subscriber Upstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the SubFilterUpDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic originating from this CM.")
docsSubmgt3GrpPsFilterDs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpPsFilterDs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpPsFilterDs.setDescription("This attribute represents the filter group applied to traffic destined to the Embedded CableHome Portal Services Element or the Embedded Router on the referenced CM. This value corresponds to the 'PS Downstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the SubFilterDownDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic destined to the Embedded CableHome Portal Services Element or Embedded Router on this CM.")
docsSubmgt3GrpPsFilterUs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpPsFilterUs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpPsFilterUs.setDescription("This attribute represents the filter group applied to traffic originating from the Embedded CableHome Portal Services Element or Embedded Router on the referenced CM. This value corresponds to the 'PS Upstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the SubFilterUpDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic originating from the Embedded CableHome Portal Services Element or Embedded Router on this CM.")
docsSubmgt3GrpMtaFilterDs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpMtaFilterDs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpMtaFilterDs.setDescription("This attribute represents the filter group applied to traffic destined to the Embedded PacketCable Multimedia Terminal Adapter, Embedded PacketCable 2.0 Digital Voice Adaptor, Embedded PacketCable Security, Monitoring, and Automation Gateway, or Embedded T1/E1 TDM Emulation Adapter on the referenced CM. This value corresponds to the 'MTA Downstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the SubFilterDownDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic destined to the Embedded PacketCable Multimedia Terminal Adapter, Embedded PacketCable 2.0 Digital Voice Adaptor, Embedded PacketCable Security, Monitoring, and Automation Gateway, or Embedded T1/E1 TDM Emulation Adapter on this CM.")
docsSubmgt3GrpMtaFilterUs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 10), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpMtaFilterUs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpMtaFilterUs.setDescription("This attribute represents the filter group applied to traffic originating from the Embedded PacketCable Multimedia Terminal Adapter, Embedded PacketCable 2.0 Digital Voice Adaptor, Embedded PacketCable Security, Monitoring, and Automation Gateway, or Embedded T1/E1 TDM Emulation Adapter on the referenced CM. This value corresponds to the 'MTA Upstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the SubFilterUpDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic originating from the Embedded PacketCable Multimedia Terminal Adapter, Embedded PacketCable 2.0 Digital Voice Adaptor, Embedded PacketCable Security, Monitoring, and Automation Gateway, or Embedded T1/E1 TDM Emulation Adapter on this CM.")
docsSubmgt3GrpStbFilterDs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpStbFilterDs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpStbFilterDs.setDescription("This attribute represents the filter group applied to traffic destined for the Embedded Set-Top Box or CableCARD on the referenced CM. This value corresponds to the 'STB Downstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the SubFilterDownDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic destined to the Embedded Set-Top Box or CableCARD on this CM.")
docsSubmgt3GrpStbFilterUs = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 4, 1, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1024))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: docsSubmgt3GrpStbFilterUs.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3GrpStbFilterUs.setDescription("This attribute represents the filter group applied to traffic originating from the Embedded Set-Top Box or CableCARD on the referenced CM. This value corresponds to the 'STB Upstream Group' value of the 'Subscriber Management Filter Groups' encoding signaled during the CM registration or in its absence, to the SubFilterUpDef attribute of the Base object. The value zero or a filter group ID not configured in the CMTS means no filtering is applied to traffic originating from the Embedded Set-Top Box or CableCARD on this CM.")
docsSubmgt3FilterGrpTable = MibTable((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5), )
if mibBuilder.loadTexts: docsSubmgt3FilterGrpTable.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpTable.setDescription("This object describes a set of filter or classifier criteria. Classifiers are assigned by group to the individual CMs. That assignment is made via the 'Subscriber Management TLVs' encodings sent upstream from the CM to the CMTS during registration or in their absence, default values configured in the CMTS. A Filter Group ID (GrpId) is a set of rules that correspond to the expansion of a UDC Group ID into UDC individual classification rules. The Filter Group Ids are generated whenever the CMTS is configured to send UDCs during the CM registration process. Implementation of L2 classification criteria is optional for the CMTS; LLC/MAC upstream and downstream filter criteria can be ignored during the packet matching process.")
docsSubmgt3FilterGrpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1), ).setIndexNames((0, "DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpGrpId"), (0, "DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpRuleId"))
if mibBuilder.loadTexts: docsSubmgt3FilterGrpEntry.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpEntry.setDescription('The conceptual row of docsSubmgt3FilterGrpTable. The CMTS persists all instances of the FilterGrp object across reinitializations.')
docsSubmgt3FilterGrpGrpId = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024)))
if mibBuilder.loadTexts: docsSubmgt3FilterGrpGrpId.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpGrpId.setDescription('This key is an identifier for a set of classifiers known as a filter group. Each CM may be associated with several filter groups for its upstream and downstream traffic, one group per target end point on the CM as defined in the Grp object. Typically, many CMs share a common set of filter groups.')
docsSubmgt3FilterGrpRuleId = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: docsSubmgt3FilterGrpRuleId.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpRuleId.setDescription('This key represents an ordered classifier identifier within the group. Filters are applied in order if the Priority attribute is not supported.')
docsSubmgt3FilterGrpAction = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("permit", 1), ("deny", 2))).clone('permit')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpAction.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpAction.setDescription("This attribute represents the action to take upon this filter matching. 'permit' means to stop the classification matching and accept the packet for further processing. 'deny' means to drop the packet.")
docsSubmgt3FilterGrpPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpPriority.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpPriority.setDescription('This attribute defines the order in which classifiers are compared against packets. The higher the value, the higher the priority.')
docsSubmgt3FilterGrpIpTosLow = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1).clone(hexValue="00")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpTosLow.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I26-150305. RFC 791. RFC 3260. RFC 3168.')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpTosLow.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpTosLow.setDescription('This attribute represents the low value of a range of ToS (Type of Service) octet values. This object is defined as an 8-bit octet as per the DOCSIS Specification for packet classification. The IP ToS octet, as originally defined in RFC 791, has been superseded by the 6-bit Differentiated Services Field (DSField, RFC 3260) and the 2-bit Explicit Congestion Notification Field (ECN field, RFC 3168).')
docsSubmgt3FilterGrpIpTosHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1).clone(hexValue="00")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpTosHigh.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I26-150305. RFC 791. RFC 3260. RFC 3168.')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpTosHigh.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpTosHigh.setDescription('This attribute represents the high value of a range of ToS octet values. This object is defined as an 8-bit octet as per the DOCSIS Specification for packet classification. The IP ToS octet, as originally defined in RFC 791, has been superseded by the 6-bit Differentiated Services Field (DSField, RFC 3260) and the 2-bit Explicit Congestion Notification Field (ECN field, RFC 3168).')
docsSubmgt3FilterGrpIpTosMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1).clone(hexValue="00")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpTosMask.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpTosMask.setDescription('This attribute represents the mask value that is bitwise ANDed with ToS octet in an IP packet, and the resulting value is used for range checking of IpTosLow and IpTosHigh.')
docsSubmgt3FilterGrpIpProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 257)).clone(256)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpProtocol.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpIpProtocol.setDescription('This attribute represents the value of the IP Protocol field required for IP packets to match this rule. The value 256 matches traffic with any IP Protocol value. The value 257 by convention matches both TCP and UDP.')
docsSubmgt3FilterGrpInetAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 9), InetAddressType().clone('unknown')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetAddrType.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetAddrType.setDescription('The type of the Internet address for InetSrcAddr, InetSrcMask, InetDestAddr, and InetDestMask.')
docsSubmgt3FilterGrpInetSrcAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 10), InetAddress().clone(hexValue="")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetSrcAddr.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetSrcAddr.setDescription("This attribute specifies the value of the IP Source Address required for packets to match this rule. An IP packet matches the rule when the packet's IP Source Address bitwise ANDed with the InetSrcMask value equals the InetSrcAddr value. The address type of this object is specified by the InetAddressType attribute.")
docsSubmgt3FilterGrpInetSrcMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 11), InetAddress().clone(hexValue="")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetSrcMask.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetSrcMask.setDescription("This attribute represents which bits of a packet's IP Source Address are compared to match this rule. An IP packet matches the rule when the packet's IP Source Address bitwise ANDed with the InetSrcMask value equals the InetSrcAddr value. The address type of this object is specified by InetAddrType.")
docsSubmgt3FilterGrpInetDestAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 12), InetAddress().clone(hexValue="")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetDestAddr.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetDestAddr.setDescription("This attribute specifies the value of the IP Destination Address required for packets to match this rule. An IP packet matches the rule when the packet's IP Destination Address bitwise ANDed with the InetSrcMask value equals the InetDestAddr value. The address type of this object is specified by the InetAddrType attribute.")
docsSubmgt3FilterGrpInetDestMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 13), InetAddress().clone(hexValue="")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetDestMask.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpInetDestMask.setDescription("This attribute represents which bits of a packet's IP Destination Address are compared to match this rule. An IP packet matches the rule when the packet's IP Destination Address bitwise ANDed with the InetDestMask value equals the InetDestAddr value. The address type of this object is specified by InetAddrType.")
docsSubmgt3FilterGrpSrcPortStart = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 14), InetPortNumber()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpSrcPortStart.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpSrcPortStart.setDescription('This attribute represents the low-end inclusive range of TCP/UDP source port numbers to which a packet is compared. This attribute is irrelevant for non-TCP/UDP IP packets.')
docsSubmgt3FilterGrpSrcPortEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 15), InetPortNumber().clone(65535)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpSrcPortEnd.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpSrcPortEnd.setDescription('This attribute represents the high-end inclusive range of TCP/UDP source port numbers to which a packet is compared. This attribute is irrelevant for non-TCP/UDP IP packets.')
docsSubmgt3FilterGrpDestPortStart = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 16), InetPortNumber()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpDestPortStart.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpDestPortStart.setDescription('This attribute represents the low-end inclusive range of TCP/UDP destination port numbers to which a packet is compared. This attribute is irrelevant for non-TCP/UDP IP packets.')
docsSubmgt3FilterGrpDestPortEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 17), InetPortNumber().clone(65535)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpDestPortEnd.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpDestPortEnd.setDescription('This attribute represents the high-end inclusive range of TCP/UDP destination port numbers to which a packet is compared. This attribute is irrelevant for non-TCP/UDP IP packets.')
docsSubmgt3FilterGrpDestMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 18), MacAddress().clone(hexValue="000000000000")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpDestMacAddr.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpDestMacAddr.setDescription('This attribute represents the criteria to match against an Ethernet packet MAC address bitwise ANDed with DestMacMask.')
docsSubmgt3FilterGrpDestMacMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 19), MacAddress().clone(hexValue="000000000000")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpDestMacMask.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpDestMacMask.setDescription('An Ethernet packet matches an entry when its destination MAC address bitwise ANDed with the DestMacMask attribute equals the value of the DestMacAddr attribute.')
docsSubmgt3FilterGrpSrcMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 20), MacAddress().clone(hexValue="FFFFFFFFFFFF")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpSrcMacAddr.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpSrcMacAddr.setDescription('This attribute represents the value to match against an Ethernet packet source MAC address.')
docsSubmgt3FilterGrpEnetProtocolType = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 0), ("ethertype", 1), ("dsap", 2), ("mac", 3), ("all", 4))).clone('none')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpEnetProtocolType.setReference('RFC1042 Sub-Network Access Protocol (SNAP) encapsulation formats.')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpEnetProtocolType.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpEnetProtocolType.setDescription("This attribute indicates the format of the layer 3 protocol ID in the Ethernet packet. A value of 'none' means that the rule does not use the layer 3 protocol type as a matching criteria. A value of 'ethertype' means that the rule applies only to frames that contain an EtherType value. EtherType values are contained in packets using the DEC-Intel-Xerox (DIX) encapsulation or the RFC 1042 Sub-Network Access Protocol (SNAP) encapsulation formats. A value of 'dsap' means that the rule applies only to frames using the IEEE802.3 encapsulation format with a Destination Service Access Point (DSAP) other than 0xAA (which is reserved for SNAP). A value of 'mac' means that the rule applies only to MAC management messages for MAC management messages. A value of 'all' means that the rule matches all Ethernet packets. If the Ethernet frame contains an 802.1P/Q Tag header (i.e., EtherType 0x8100), this attribute applies to the embedded EtherType field within the 802.1p/Q header. The value 'mac' is only used for passing UDCs to CMs during Registration. The CMTS ignores filter rules that include the value of this attribute set to 'mac' for CMTS enforced upstream and downstream subscriber management filter group rules.")
docsSubmgt3FilterGrpEnetProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 22), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpEnetProtocol.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpEnetProtocol.setDescription("This attribute represents the Ethernet protocol type to be matched against the packets. For EnetProtocolType set to 'none', this attribute is ignored when considering whether a packet matches the current rule. If the attribute EnetProtocolType is 'ethertype', this attribute gives the 16-bit value of the EtherType that the packet must match in order to match the rule. If the attribute EnetProtocolType is 'dsap', the lower 8 bits of this attribute's value must match the DSAP octet of the packet in order to match the rule. If the Ethernet frame contains an 802.1p/Q Tag header (i.e., EtherType 0x8100), this attribute applies to the embedded EtherType field within the 802.1p/Q header.")
docsSubmgt3FilterGrpUserPriLow = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 23), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpUserPriLow.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpUserPriLow.setDescription('This attribute applies only to Ethernet frames using the 802.1p/Q tag header (indicated with EtherType 0x8100). Such frames include a 16-bit Tag that contains a 3-bit Priority field and a 12-bit VLAN number. Tagged Ethernet packets must have a 3-bit Priority field within the range of PriLow to PriHigh in order to match this rule.')
docsSubmgt3FilterGrpUserPriHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 24), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7)).clone(7)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpUserPriHigh.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpUserPriHigh.setDescription('This attribute applies only to Ethernet frames using the 802.1p/Q tag header (indicated with EtherType 0x8100). Such frames include a 16-bit Tag that contains a 3-bit Priority field and a 12-bit VLAN number. Tagged Ethernet packets must have a 3-bit Priority field within the range of PriLow to PriHigh in order to match this rule.')
docsSubmgt3FilterGrpVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 25), Unsigned32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 4094), ))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpVlanId.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpVlanId.setDescription('This attribute applies only to Ethernet frames using the 802.1p/Q tag header. Tagged packets must have a VLAN Identifier that matches the value in order to match the rule.')
docsSubmgt3FilterGrpClassPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 26), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpClassPkts.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpClassPkts.setDescription('This attribute counts the number of packets that have been classified (matched) using this rule entry. This includes all packets delivered to a Service Flow maximum rate policing function, whether or not that function drops the packets. Discontinuities in the value of this counter can occur at re-initialization of the managed system, and at other times as indicated by the value of ifCounterDiscontinuityTime for the CM MAC Domain interface.')
docsSubmgt3FilterGrpFlowLabel = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 27), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1048575))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpFlowLabel.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I26-150305, IPv6 Flow Label section in the Common Radio Frequency Interface Encodings Annex.')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpFlowLabel.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpFlowLabel.setDescription('This attribute represents the Flow Label field in the IPv6 header to be matched by the classifier. The value zero indicates that the Flow Label is not specified as part of the classifier and is not matched against packets.')
docsSubmgt3FilterGrpCmInterfaceMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 28), DocsL2vpnIfList()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpCmInterfaceMask.setReference('DOCSIS 3.0 MAC and Upper Layer Protocols Interface Specification CM-SP-MULPIv3.0-I26-150305, CM Interface Mask (CMIM) Encoding section in the Common Radio Frequency Interface Encodings Annex.')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpCmInterfaceMask.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpCmInterfaceMask.setDescription('This attribute represents a bit-mask of the CM in-bound interfaces to which this classifier applies. This attribute only applies to upstream Drop Classifiers being sent to CMs during the registration process.')
docsSubmgt3FilterGrpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 1, 5, 1, 29), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: docsSubmgt3FilterGrpRowStatus.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3FilterGrpRowStatus.setDescription('The conceptual row status of this object.')
docsSubmgt3MibConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 2))
docsSubmgt3MibCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 2, 1))
docsSubmgt3MibGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 2, 2))
docsSubmgt3Compliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 2, 1, 1)).setObjects(("DOCS-SUBMGT3-MIB", "docsSubmgt3Group"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
docsSubmgt3Compliance = docsSubmgt3Compliance.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3Compliance.setDescription('The compliance statement for devices that implement the DOCSIS Subscriber Management 3 MIB.')
docsSubmgt3Group = ObjectGroup((1, 3, 6, 1, 4, 1, 4491, 2, 1, 10, 2, 2, 1)).setObjects(("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseCpeMaxIpv4Def"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseCpeMaxIpv6PrefixesDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseCpeActiveDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseCpeLearnableDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseSubFilterDownDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseSubFilterUpDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseCmFilterDownDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseCmFilterUpDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BasePsFilterDownDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BasePsFilterUpDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseMtaFilterDownDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseMtaFilterUpDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseStbFilterDownDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3BaseStbFilterUpDef"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeCtrlMaxCpeIpv4"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeCtrlMaxCpeIpv6Prefixes"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeCtrlActive"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeCtrlLearnable"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeCtrlReset"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeCtrlLastReset"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeIpAddrType"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeIpAddr"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeIpAddrPrefixLen"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeIpLearned"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3CpeIpType"), ("DOCS-SUBMGT3-MIB", "docsSubMgt3GrpUdcGroupIds"), ("DOCS-SUBMGT3-MIB", "docsSubMgt3GrpUdcSentInRegRsp"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpSubFilterDs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpSubFilterUs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpCmFilterDs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpCmFilterUs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpPsFilterDs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpPsFilterUs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpMtaFilterDs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpMtaFilterUs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpStbFilterDs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3GrpStbFilterUs"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpAction"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpPriority"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpIpTosLow"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpIpTosHigh"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpIpTosMask"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpIpProtocol"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpInetAddrType"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpInetSrcAddr"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpInetSrcMask"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpInetDestAddr"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpInetDestMask"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpSrcPortStart"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpSrcPortEnd"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpDestPortStart"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpDestPortEnd"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpDestMacAddr"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpDestMacMask"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpSrcMacAddr"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpEnetProtocolType"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpEnetProtocol"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpUserPriLow"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpUserPriHigh"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpVlanId"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpClassPkts"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpFlowLabel"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpCmInterfaceMask"), ("DOCS-SUBMGT3-MIB", "docsSubmgt3FilterGrpRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
docsSubmgt3Group = docsSubmgt3Group.setStatus('current')
if mibBuilder.loadTexts: docsSubmgt3Group.setDescription('Group of objects implemented in the CMTS.')
mibBuilder.exportSymbols("DOCS-SUBMGT3-MIB", docsSubmgt3CpeCtrlMaxCpeIpv6Addresses=docsSubmgt3CpeCtrlMaxCpeIpv6Addresses, docsSubmgt3BaseSubFilterDownDef=docsSubmgt3BaseSubFilterDownDef, docsSubmgt3CpeIpLearned=docsSubmgt3CpeIpLearned, docsSubmgt3FilterGrpTable=docsSubmgt3FilterGrpTable, docsSubmgt3FilterGrpGrpId=docsSubmgt3FilterGrpGrpId, docsSubmgt3BaseCpeActiveDef=docsSubmgt3BaseCpeActiveDef, docsSubmgt3FilterGrpPriority=docsSubmgt3FilterGrpPriority, docsSubmgt3MibGroups=docsSubmgt3MibGroups, docsSubmgt3FilterGrpDestMacAddr=docsSubmgt3FilterGrpDestMacAddr, docsSubmgt3BaseCpeMaxIpv4Def=docsSubmgt3BaseCpeMaxIpv4Def, docsSubmgt3GrpCmFilterUs=docsSubmgt3GrpCmFilterUs, PYSNMP_MODULE_ID=docsSubmgt3Mib, docsSubmgt3BaseCmFilterUpDef=docsSubmgt3BaseCmFilterUpDef, docsSubMgt3GrpUdcSentInRegRsp=docsSubMgt3GrpUdcSentInRegRsp, docsSubmgt3BaseMtaFilterUpDef=docsSubmgt3BaseMtaFilterUpDef, docsSubmgt3GrpPsFilterDs=docsSubmgt3GrpPsFilterDs, docsSubmgt3Base=docsSubmgt3Base, docsSubmgt3FilterGrpCmInterfaceMask=docsSubmgt3FilterGrpCmInterfaceMask, docsSubmgt3GrpCmFilterDs=docsSubmgt3GrpCmFilterDs, docsSubmgt3FilterGrpEntry=docsSubmgt3FilterGrpEntry, docsSubmgt3FilterGrpSrcMacAddr=docsSubmgt3FilterGrpSrcMacAddr, docsSubmgt3MibObjects=docsSubmgt3MibObjects, docsSubmgt3CpeIpId=docsSubmgt3CpeIpId, docsSubmgt3CpeCtrlTable=docsSubmgt3CpeCtrlTable, docsSubmgt3CpeIpAddr=docsSubmgt3CpeIpAddr, docsSubmgt3CpeCtrlEntry=docsSubmgt3CpeCtrlEntry, docsSubmgt3BaseStbFilterDownDef=docsSubmgt3BaseStbFilterDownDef, docsSubmgt3GrpPsFilterUs=docsSubmgt3GrpPsFilterUs, docsSubmgt3FilterGrpAction=docsSubmgt3FilterGrpAction, docsSubmgt3BaseCpeMaxIpv6PrefixesDef=docsSubmgt3BaseCpeMaxIpv6PrefixesDef, docsSubmgt3FilterGrpInetDestAddr=docsSubmgt3FilterGrpInetDestAddr, docsSubmgt3CpeCtrlMaxCpeIpv4=docsSubmgt3CpeCtrlMaxCpeIpv4, docsSubmgt3CpeCtrlReset=docsSubmgt3CpeCtrlReset, docsSubmgt3BaseCpeMaxIpv6AddressesDef=docsSubmgt3BaseCpeMaxIpv6AddressesDef, docsSubmgt3CpeIpTable=docsSubmgt3CpeIpTable, docsSubmgt3FilterGrpClassPkts=docsSubmgt3FilterGrpClassPkts, docsSubmgt3FilterGrpIpTosMask=docsSubmgt3FilterGrpIpTosMask, docsSubmgt3Compliance=docsSubmgt3Compliance, docsSubmgt3FilterGrpDestPortEnd=docsSubmgt3FilterGrpDestPortEnd, docsSubmgt3BaseStbFilterUpDef=docsSubmgt3BaseStbFilterUpDef, docsSubmgt3CpeIpType=docsSubmgt3CpeIpType, docsSubmgt3GrpEntry=docsSubmgt3GrpEntry, docsSubmgt3FilterGrpDestMacMask=docsSubmgt3FilterGrpDestMacMask, docsSubmgt3FilterGrpInetDestMask=docsSubmgt3FilterGrpInetDestMask, docsSubmgt3FilterGrpEnetProtocolType=docsSubmgt3FilterGrpEnetProtocolType, docsSubmgt3FilterGrpIpTosHigh=docsSubmgt3FilterGrpIpTosHigh, docsSubmgt3BasePsFilterUpDef=docsSubmgt3BasePsFilterUpDef, docsSubmgt3FilterGrpIpProtocol=docsSubmgt3FilterGrpIpProtocol, docsSubmgt3CpeCtrlMaxCpeIpv6Prefixes=docsSubmgt3CpeCtrlMaxCpeIpv6Prefixes, docsSubmgt3MibConformance=docsSubmgt3MibConformance, docsSubmgt3CpeIpAddrPrefixLen=docsSubmgt3CpeIpAddrPrefixLen, docsSubmgt3FilterGrpFlowLabel=docsSubmgt3FilterGrpFlowLabel, docsSubmgt3FilterGrpSrcPortEnd=docsSubmgt3FilterGrpSrcPortEnd, docsSubmgt3FilterGrpInetAddrType=docsSubmgt3FilterGrpInetAddrType, docsSubmgt3FilterGrpUserPriLow=docsSubmgt3FilterGrpUserPriLow, docsSubmgt3CpeCtrlActive=docsSubmgt3CpeCtrlActive, docsSubmgt3GrpSubFilterDs=docsSubmgt3GrpSubFilterDs, docsSubmgt3FilterGrpEnetProtocol=docsSubmgt3FilterGrpEnetProtocol, docsSubmgt3FilterGrpVlanId=docsSubmgt3FilterGrpVlanId, docsSubmgt3FilterGrpDestPortStart=docsSubmgt3FilterGrpDestPortStart, docsSubmgt3CpeCtrlLastReset=docsSubmgt3CpeCtrlLastReset, docsSubmgt3BasePsFilterDownDef=docsSubmgt3BasePsFilterDownDef, docsSubmgt3Mib=docsSubmgt3Mib, docsSubmgt3GrpSubFilterUs=docsSubmgt3GrpSubFilterUs, docsSubmgt3Group=docsSubmgt3Group, docsSubmgt3FilterGrpRuleId=docsSubmgt3FilterGrpRuleId, docsSubmgt3FilterGrpInetSrcMask=docsSubmgt3FilterGrpInetSrcMask, docsSubmgt3BaseCpeLearnableDef=docsSubmgt3BaseCpeLearnableDef, docsSubmgt3GrpMtaFilterUs=docsSubmgt3GrpMtaFilterUs, docsSubmgt3BaseSubFilterUpDef=docsSubmgt3BaseSubFilterUpDef, docsSubmgt3GrpMtaFilterDs=docsSubmgt3GrpMtaFilterDs, docsSubmgt3FilterGrpSrcPortStart=docsSubmgt3FilterGrpSrcPortStart, docsSubmgt3GrpTable=docsSubmgt3GrpTable, docsSubmgt3FilterGrpUserPriHigh=docsSubmgt3FilterGrpUserPriHigh, docsSubmgt3FilterGrpIpTosLow=docsSubmgt3FilterGrpIpTosLow, docsSubmgt3FilterGrpRowStatus=docsSubmgt3FilterGrpRowStatus, docsSubmgt3BaseMtaFilterDownDef=docsSubmgt3BaseMtaFilterDownDef, docsSubmgt3CpeIpEntry=docsSubmgt3CpeIpEntry, docsSubmgt3CpeCtrlLearnable=docsSubmgt3CpeCtrlLearnable, docsSubmgt3FilterGrpInetSrcAddr=docsSubmgt3FilterGrpInetSrcAddr, docsSubmgt3BaseCmFilterDownDef=docsSubmgt3BaseCmFilterDownDef, docsSubMgt3GrpUdcGroupIds=docsSubMgt3GrpUdcGroupIds, docsSubmgt3CpeIpAddrType=docsSubmgt3CpeIpAddrType, docsSubmgt3GrpStbFilterUs=docsSubmgt3GrpStbFilterUs, docsSubmgt3MibCompliances=docsSubmgt3MibCompliances, docsSubmgt3GrpStbFilterDs=docsSubmgt3GrpStbFilterDs)
| 233.121528 | 4,926 | 0.808666 | 8,328 | 67,139 | 6.517891 | 0.100504 | 0.038024 | 0.066543 | 0.006264 | 0.516479 | 0.420129 | 0.394871 | 0.380796 | 0.367108 | 0.355649 | 0 | 0.052978 | 0.102861 | 67,139 | 287 | 4,927 | 233.933798 | 0.848206 | 0.004856 | 0 | 0.010791 | 0 | 0.302158 | 0.517379 | 0.038336 | 0 | 0 | 0.000419 | 0 | 0 | 1 | 0 | false | 0.007194 | 0.035971 | 0 | 0.035971 | 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 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
af3f87580b1b7148fd0f4b175c9291651129ec9b | 452 | py | Python | pyleecan/Methods/Elmer/Section/__setitem__.py | IrakozeFD/pyleecan | 5a93bd98755d880176c1ce8ac90f36ca1b907055 | [
"Apache-2.0"
] | 95 | 2019-01-23T04:19:45.000Z | 2022-03-17T18:22:10.000Z | pyleecan/Methods/Elmer/Section/__setitem__.py | IrakozeFD/pyleecan | 5a93bd98755d880176c1ce8ac90f36ca1b907055 | [
"Apache-2.0"
] | 366 | 2019-02-20T07:15:08.000Z | 2022-03-31T13:37:23.000Z | pyleecan/Methods/Elmer/Section/__setitem__.py | IrakozeFD/pyleecan | 5a93bd98755d880176c1ce8ac90f36ca1b907055 | [
"Apache-2.0"
] | 74 | 2019-01-24T01:47:31.000Z | 2022-02-25T05:44:42.000Z | # -*- coding: utf-8 -*-
def __setitem__(self, key, value):
"""Called to implement assignment to self[key]."""
if isinstance(value, tuple):
self._statements.__setitem__(key, value[0])
if len(tuple) >= 1:
self._comments.__setitem__(key, value[1])
else:
self._comments.__setitem__(key, None)
else:
self._statements.__setitem__(key, value)
self._comments.__setitem__(key, None)
| 30.133333 | 54 | 0.612832 | 52 | 452 | 4.769231 | 0.423077 | 0.201613 | 0.181452 | 0.266129 | 0.443548 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011765 | 0.247788 | 452 | 14 | 55 | 32.285714 | 0.717647 | 0.14823 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | null | 1 | 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 | 3 |
af464e5ec0f0975399c78f095f471d321778800e | 106 | py | Python | NotebookManage/notebook/apps.py | ahriknow/ahriknow | 817b5670c964e01ffe19ed182ce0a7b42e17ce09 | [
"MIT"
] | null | null | null | NotebookManage/notebook/apps.py | ahriknow/ahriknow | 817b5670c964e01ffe19ed182ce0a7b42e17ce09 | [
"MIT"
] | 3 | 2021-03-19T01:28:43.000Z | 2021-04-08T19:57:19.000Z | NotebookManage/notebook/apps.py | ahriknow/ahriknow | 817b5670c964e01ffe19ed182ce0a7b42e17ce09 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class NotebookConfig(AppConfig):
name = 'NotebookManage.notebook'
| 17.666667 | 36 | 0.783019 | 11 | 106 | 7.545455 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141509 | 106 | 5 | 37 | 21.2 | 0.912088 | 0 | 0 | 0 | 0 | 0 | 0.216981 | 0.216981 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
af6a91448f547cabeb702497f5f3f2609332ab50 | 144 | py | Python | srcs/types/Defines.py | Cardiox12/TheExecutor | 4168857ff0cfd0d5829347adc2180fd16c264419 | [
"MIT"
] | 7 | 2020-11-17T12:23:48.000Z | 2022-02-20T16:33:00.000Z | srcs/types/Defines.py | Cardiox12/TheExecutor | 4168857ff0cfd0d5829347adc2180fd16c264419 | [
"MIT"
] | 8 | 2020-11-17T07:10:00.000Z | 2021-01-31T12:31:04.000Z | srcs/types/Defines.py | Cardiox12/TheExecutor | 4168857ff0cfd0d5829347adc2180fd16c264419 | [
"MIT"
] | null | null | null | from enum import Enum
BACKTICKS = "```"
NEWLINE = "\n"
RUN_CMD = "!run"
class RunnerDefs(Enum):
WORKDIR = "/runner"
RESOURCES = "/resources" | 16 | 25 | 0.659722 | 17 | 144 | 5.529412 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 144 | 9 | 25 | 16 | 0.783333 | 0 | 0 | 0 | 0 | 0 | 0.17931 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.571429 | 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 | 1 | 0 | 0 | 3 |
af8e515475437e7b8b42656cd9d0d81394ed640b | 670 | py | Python | metricbeat/tests/system/test_logstash.py | tyrocca/beats | 4c5daa89da0271580c0cb7302a9ca94d3b7c91ec | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | metricbeat/tests/system/test_logstash.py | tyrocca/beats | 4c5daa89da0271580c0cb7302a9ca94d3b7c91ec | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | metricbeat/tests/system/test_logstash.py | tyrocca/beats | 4c5daa89da0271580c0cb7302a9ca94d3b7c91ec | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import os
import metricbeat
import unittest
import time
class Test(metricbeat.BaseTest):
COMPOSE_SERVICES = ['logstash']
FIELDS = ['logstash']
@unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test")
def test_node(self):
"""
logstash node metricset test
"""
self.check_metricset("logstash", "node", self.get_hosts(), self.FIELDS + ["process"])
@unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test")
def test_node_stats(self):
"""
logstash node_stats metricset test
"""
self.check_metricset("logstash", "node_stats", self.get_hosts(), self.FIELDS)
| 26.8 | 93 | 0.668657 | 71 | 670 | 6.140845 | 0.338028 | 0.110092 | 0.12844 | 0.178899 | 0.619266 | 0.518349 | 0.518349 | 0.321101 | 0.321101 | 0.321101 | 0 | 0 | 0.210448 | 670 | 24 | 94 | 27.916667 | 0.824197 | 0.09403 | 0 | 0.153846 | 0 | 0 | 0.151786 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.307692 | 0 | 0.692308 | 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 | 1 | 0 | 0 | 3 |
afb02281ebe492d7bcb97ca68f1f23d9c4d10b9b | 432 | py | Python | utils/__init__.py | lmartak/amt-wavenet | 9717eb35f317994372cfd1c76b1546d21272fb67 | [
"MIT"
] | 9 | 2018-10-07T01:36:35.000Z | 2021-12-29T23:44:24.000Z | utils/__init__.py | lmartak/amt-wavenet | 9717eb35f317994372cfd1c76b1546d21272fb67 | [
"MIT"
] | null | null | null | utils/__init__.py | lmartak/amt-wavenet | 9717eb35f317994372cfd1c76b1546d21272fb67 | [
"MIT"
] | 3 | 2018-11-15T13:32:08.000Z | 2020-02-15T22:58:19.000Z | from .filesystem import find_files
from .piano_roll import (roll_encode, roll_decode, get_roll_index,
roll_subsample)
from .metrics import calc_stats, calc_metrics, metrics_empty_dict
from .loggers import write_metrics, write_images, write_audio
from .renderers import (plot_eval, plot_estim, plot_certainty,
roll2audio)
from .settings import Trainer, save_run_config, flush_n_close
| 48 | 66 | 0.752315 | 57 | 432 | 5.333333 | 0.614035 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002882 | 0.196759 | 432 | 8 | 67 | 54 | 0.873199 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.75 | 0 | 0.75 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
afb4af796d3153f5268afde708ea154d16c82d06 | 773 | py | Python | source/code_decode.py | IskatelApelsinov/PasswordManager-Sneaky-Pass | 6bc56d4cbccd3eb84a0cacbede97f16f317d1954 | [
"Unlicense"
] | null | null | null | source/code_decode.py | IskatelApelsinov/PasswordManager-Sneaky-Pass | 6bc56d4cbccd3eb84a0cacbede97f16f317d1954 | [
"Unlicense"
] | null | null | null | source/code_decode.py | IskatelApelsinov/PasswordManager-Sneaky-Pass | 6bc56d4cbccd3eb84a0cacbede97f16f317d1954 | [
"Unlicense"
] | null | null | null | import hashlib
import os
class Cripta(object):
def __init__(self):
#mchs_project
super(Cripta, self).__init__()
def shifr_salt(self, passwd):
# Add a user
salt = ''
# for letter in username:
# salt += str(ord(letter))
# print(salt)
# salt = hex(int(salt))
# print(salt)
# salt = os.urandom(32)
# print(salt)
salt = passwd.encode(encoding='utf-8')
#print(salt)
key = hashlib.pbkdf2_hmac('sha256', passwd.encode('utf-8'), salt, 100000)
#print(key)
return key
def hasher(self, passwd):
salt = passwd.encode(encoding='utf-8')
key = hashlib.sha1(salt).hexdigest()
return key | 24.935484 | 82 | 0.522639 | 87 | 773 | 4.517241 | 0.482759 | 0.091603 | 0.099237 | 0.122137 | 0.142494 | 0.142494 | 0 | 0 | 0 | 0 | 0 | 0.031873 | 0.350582 | 773 | 31 | 83 | 24.935484 | 0.750996 | 0.228978 | 0 | 0.285714 | 0 | 0 | 0.03777 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0.357143 | 0.142857 | 0 | 0.571429 | 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 | 1 | 0 | 0 | 3 |
afc81ec22fd48fc4ebb5c1c12e9dafac91ea5c13 | 76 | py | Python | coding/unique_paths/starter.py | alexanderywang/tech-interview-questions | a0098eda33db73d10787e198d1f105532ea32c09 | [
"MIT"
] | null | null | null | coding/unique_paths/starter.py | alexanderywang/tech-interview-questions | a0098eda33db73d10787e198d1f105532ea32c09 | [
"MIT"
] | null | null | null | coding/unique_paths/starter.py | alexanderywang/tech-interview-questions | a0098eda33db73d10787e198d1f105532ea32c09 | [
"MIT"
] | null | null | null | class Solution:
def distinctPaths(self, m: int, n: int) -> int:
| 25.333333 | 51 | 0.578947 | 10 | 76 | 4.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.289474 | 76 | 3 | 52 | 25.333333 | 0.814815 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
afd3c65838a96a24c94f5de67a01d5375d8075cf | 312 | py | Python | AutotestWebD/apps/myadmin/service/TeamPermissionRelationService.py | yangjourney/sosotest | 2e88099a829749910ca325253c9b1a2e368d21a0 | [
"MIT"
] | 422 | 2019-08-18T05:04:20.000Z | 2022-03-31T06:49:19.000Z | AutotestWebD/apps/myadmin/service/TeamPermissionRelationService.py | LinSongJian1985/sosotest | 091863dee531b5726650bb63efd6f169267cbeb4 | [
"MIT"
] | 10 | 2019-10-24T09:55:38.000Z | 2021-09-29T17:28:43.000Z | AutotestWebD/apps/myadmin/service/TeamPermissionRelationService.py | LinSongJian1985/sosotest | 091863dee531b5726650bb63efd6f169267cbeb4 | [
"MIT"
] | 202 | 2019-08-18T05:04:27.000Z | 2022-03-30T05:57:18.000Z | from all_models.models import TbAdminTeamPermissionRelation
class TeamPermissionRelationService(object):
@staticmethod
def updateTeamPermission(teamPermissionData):
tbModel = TbAdminTeamPermissionRelation.objects.filter(id=teamPermissionData["id"])
tbModel.update(**teamPermissionData)
| 34.666667 | 91 | 0.801282 | 23 | 312 | 10.826087 | 0.73913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 312 | 8 | 92 | 39 | 0.912088 | 0 | 0 | 0 | 0 | 0 | 0.00641 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.5 | 0 | 1 | 0 | 1 | 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 | 3 |
bb60899abe1223f0e1df35b8e83211f95e7cc02e | 6,924 | py | Python | madpy/tests/test_checks.py | seismomomo/madpy | ab2ce2a94e189e03fcbd2c79d578480c6a3a5025 | [
"MIT"
] | 1 | 2021-10-30T23:29:05.000Z | 2021-10-30T23:29:05.000Z | madpy/tests/test_checks.py | seismomomo/madpy | ab2ce2a94e189e03fcbd2c79d578480c6a3a5025 | [
"MIT"
] | null | null | null | madpy/tests/test_checks.py | seismomomo/madpy | ab2ce2a94e189e03fcbd2c79d578480c6a3a5025 | [
"MIT"
] | null | null | null | import obspy
import unittest
import numpy as np
import madpy.checks as ch
import madpy.tests.testdata.config as cfg
class TestChecks(unittest.TestCase):
def test_check_config(self):
class Measurements: pass
self.assertRaises(AttributeError, ch.check_config, Measurements())
self.assertIsNone(ch.check_config(cfg.Amplitude()))
cfg.Amplitude.noise_phase = 'Pn'
self.assertRaises(AssertionError, ch.check_config, cfg.Amplitude())
cfg.Amplitude.noise_phase = 'P'
cfg.Amplitude.amp_factor = -2.
self.assertRaises(AssertionError, ch.check_config, cfg.Amplitude())
cfg.Amplitude.plot = 'Yes'
self.assertRaises(AssertionError, ch.check_config, cfg.Amplitude())
cfg.Amplitude.plot = False
cfg.Amplitude.signal_window_begin = 50.
self.assertRaises(AssertionError, ch.check_config, cfg.Amplitude())
cfg.Amplitude.signal_window_begin = -1
cfg.Amplitude.save_figure = True
self.assertRaises(AssertionError, ch.check_config, cfg.Amplitude())
cfg.Amplitude.save_figure = False
self.assertIsNone(ch.check_config(cfg.Duration()))
cfg.Duration.signal_phase = 'Sg'
self.assertRaises(AssertionError, ch.check_config, cfg.Duration())
cfg.Duration.signal_phase = 'S'
cfg.Duration.moving_average_window = -2
self.assertRaises(AssertionError, ch.check_config, cfg.Duration())
cfg.moving_average_window = 2
cfg.threshold_type = 'pre-p noise'
self.assertRaises(AssertionError, ch.check_config, cfg.Duration())
cfg.threshold_type = 'noise'
cfg.plot = True
cfg.save_figure = True
cfg.figure_path = ''
self.assertRaises(AssertionError, ch.check_config, cfg.Duration())
cfg.plot = False
cfg.save_figure = False
def test_check_waveform(self):
st = obspy.read('testdata/*.mseed')
for tr in st:
tr.stats.o = obspy.UTCDateTime('2020-10-10T13:05:00.00')
tr.stats.p = 10.
self.assertRaises(AttributeError, ch.check_config, tr)
tr.stats.s = 20.
self.assertIsNone(ch.check_stats(tr))
tr.stats.o = '2020-10-10T13:05:00.00'
self.assertRaises(AssertionError, ch.check_stats, tr)
tr.stats.o = obspy.UTCDateTime('2020-10-10T13:05:00.00')
def test_check_datagaps(self):
st = obspy.read('testdata/*.mseed')
for tr in st:
self.assertIsNone(ch.check_datagaps(tr))
n = int(len(tr.data) * 0.25)
tr.data = tr.data[0:n]
self.assertRaises(AssertionError, ch.check_datagaps, tr)
def test_check_window(self):
st = obspy.read('testdata/*.mseed')
for tr in st:
starttime = obspy.UTCDateTime('2020-10-10T13:05:00.00')
endtime = obspy.UTCDateTime('2020-10-10T13:07:00.00')
self.assertIsNone(ch.check_window(tr, starttime, endtime))
starttime = obspy.UTCDateTime('2020-10-10T13:04:00.00')
self.assertRaises(AssertionError, ch.check_window, tr, starttime, endtime)
endtime = obspy.UTCDateTime('2020-10-10T13:08:00.00')
self.assertRaises(AssertionError, ch.check_window, tr, starttime, endtime)
def test_check_amplitude(self):
self.assertIsNone(ch.check_amplitude(0.5))
self.assertRaises(ValueError, ch.check_amplitude, np.nan)
self.assertRaises(ValueError, ch.check_amplitude, np.inf)
self.assertRaises(ValueError, ch.check_amplitude, -np.inf)
self.assertRaises(ValueError, ch.check_amplitude, -0.5)
self.assertRaises(ValueError, ch.check_amplitude, None)
self.assertRaises(ValueError, ch.check_amplitude, True)
self.assertRaises(ValueError, ch.check_amplitude, {'test': 'dict'})
self.assertRaises(ValueError, ch.check_amplitude, ['list', 5])
def test_check_fitting_window_end(self):
i_max0 = 20000
i_end0 = np.arange(500, 5005)
dt = 0.01
sp = 10
self.assertIsNone(ch.check_fitting_window_end(i_end0, i_max0, dt, sp))
i_end1 = []
self.assertRaises(AssertionError, ch.check_fitting_window_end, i_end1, i_max0, dt, sp)
i_max1 = 2
self.assertRaises(AssertionError, ch.check_fitting_window_end, i_end0, i_max1, dt, sp)
def test_check_plottype(self):
self.assertIsNone(ch.check_plottype('linear'))
self.assertIsNone(ch.check_plottype('log'))
self.assertRaises(AssertionError, ch.check_plottype, 2)
self.assertRaises(AssertionError, ch.check_plottype, 'fourier')
def test_check_duration_index(self):
cross = np.arange(0, 10, dtype=float)
self.assertIsNone(ch.check_duration_index(cross))
self.assertRaises(AssertionError, ch.check_duration_index, [])
def test_check_cc(self):
cc = np.array([
[0.1, 0.8, 0.5, 0.9],
[0.9, 0.1, 0.8, 0.5],
[0.5, 0.9, 0.1, 0.8],
[0.8, 0.5, 0.9, 0.1]
])
self.assertIsNone(ch.check_cc(cc, 1, 2))
self.assertRaises(AssertionError, ch.check_cc, cc.astype(int), 1, 2)
self.assertRaises(AssertionError, ch.check_cc, cc[0:3, :], 1, 2)
self.assertRaises(AssertionError, ch.check_cc, cc[:, 0:3], 1, 2)
cc[1, 2] = np.nan
self.assertRaises(AssertionError, ch.check_cc, cc, 1, 2)
cc[1, 2] = np.inf
self.assertRaises(AssertionError, ch.check_cc, cc, 1, 2)
cc[1, 2] = -np.inf
self.assertRaises(AssertionError, ch.check_cc, cc, 1, 2)
cc[1, 2] = 0
self.assertRaises(AssertionError, ch.check_cc, cc, 1, 2)
cc[1, 2] = -10
self.assertRaises(AssertionError, ch.check_cc, cc, 1, 2)
cc[1, 2] = 25
self.assertRaises(AssertionError, ch.check_cc, cc, 1, 2)
def test_check_coda(self):
x0 = np.arange(0, 100)
y0 = np.arange(0, 100)
x1 = np.arange(0, 100, dtype=float)
y1 = np.arange(0, 100, dtype=float)
self.assertRaises(AssertionError, ch.check_coda, x0, y1)
self.assertRaises(AssertionError, ch.check_coda, x1, y0)
self.assertRaises(AssertionError, ch.check_coda, x0, y0)
x2, y2 = ch.check_coda(x1, y1)
self.assertEqual(len(x2), 100)
self.assertEqual(len(y2), 100)
x2[5:10] = np.nan
self.assertRaises(AssertionError, ch.check_coda, x2, y1)
y2[60:72] = np.nan
x3, y3 = ch.check_coda(x1, y2)
self.assertEqual(len(x3), 88)
self.assertEqual(len(y3), 88)
if __name__ == '__main__':
unittest.main() | 40.023121 | 94 | 0.612218 | 878 | 6,924 | 4.687927 | 0.15262 | 0.091837 | 0.225948 | 0.241011 | 0.708212 | 0.653547 | 0.508017 | 0.450923 | 0.434159 | 0.301992 | 0 | 0.058048 | 0.266031 | 6,924 | 173 | 95 | 40.023121 | 0.751869 | 0 | 0 | 0.179856 | 0 | 0 | 0.037978 | 0.022238 | 0 | 0 | 0 | 0 | 0.402878 | 1 | 0.071942 | false | 0.007194 | 0.035971 | 0 | 0.122302 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bb71fecd02bd2d157d2d49ff64e1f7291efdb92b | 235 | py | Python | ftdnn/__init__.py | kwasnydam/Factorized-TDNN | 2535648d9c922680d026d3a998e4a457f98cb875 | [
"MIT"
] | null | null | null | ftdnn/__init__.py | kwasnydam/Factorized-TDNN | 2535648d9c922680d026d3a998e4a457f98cb875 | [
"MIT"
] | null | null | null | ftdnn/__init__.py | kwasnydam/Factorized-TDNN | 2535648d9c922680d026d3a998e4a457f98cb875 | [
"MIT"
] | null | null | null | from .models import FTDNN, TDNN, DenseReLU, DenseSigmoid, DenseSoftmax, TDNNAgePaper, DenseLogits
__all__ = [
'FTDNN',
'DenseReLU',
'DenseSigmoid',
'DenseSoftmax',
'TDNN',
'TDNNAgePaper',
'DenseLogits'
] | 21.363636 | 97 | 0.651064 | 18 | 235 | 8.277778 | 0.611111 | 0.281879 | 0.442953 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221277 | 235 | 11 | 98 | 21.363636 | 0.814208 | 0 | 0 | 0 | 0 | 0 | 0.275424 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.1 | 0 | 1 | 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 | 3 |
bb74687b23c6ee042f7e8cb1c177ead4575661a9 | 371 | py | Python | feincms/module/medialibrary/__init__.py | mjl/feincms | fe147ec0fcf779f812e35a31f30ee29ccd7088fd | [
"BSD-3-Clause"
] | null | null | null | feincms/module/medialibrary/__init__.py | mjl/feincms | fe147ec0fcf779f812e35a31f30ee29ccd7088fd | [
"BSD-3-Clause"
] | null | null | null | feincms/module/medialibrary/__init__.py | mjl/feincms | fe147ec0fcf779f812e35a31f30ee29ccd7088fd | [
"BSD-3-Clause"
] | null | null | null | # ------------------------------------------------------------------------
# ------------------------------------------------------------------------
import logging
# ------------------------------------------------------------------------
logger = logging.getLogger("feincms.medialibrary")
# ------------------------------------------------------------------------
| 30.916667 | 74 | 0.145553 | 7 | 371 | 7.714286 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048518 | 371 | 11 | 75 | 33.727273 | 0.152975 | 0.784367 | 0 | 0 | 0 | 0 | 0.266667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bb99543812de0b5b968715ed5c363ddf0ff3757a | 560 | py | Python | src/pyrin/database/orm/query/exceptions.py | wilsonGmn/pyrin | 25dbe3ce17e80a43eee7cfc7140b4c268a6948e0 | [
"BSD-3-Clause"
] | null | null | null | src/pyrin/database/orm/query/exceptions.py | wilsonGmn/pyrin | 25dbe3ce17e80a43eee7cfc7140b4c268a6948e0 | [
"BSD-3-Clause"
] | null | null | null | src/pyrin/database/orm/query/exceptions.py | wilsonGmn/pyrin | 25dbe3ce17e80a43eee7cfc7140b4c268a6948e0 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
orm query exceptions module.
"""
from pyrin.core.exceptions import CoreException
class ORMQueryException(CoreException):
"""
orm query exception.
"""
pass
class ORMQueryBusinessException(ORMQueryException):
"""
orm query business exception.
"""
pass
class ColumnsOutOfScopeError(ORMQueryBusinessException):
"""
columns out of scope error.
"""
pass
class EfficientCountIsNotPossibleError(ORMQueryException):
"""
efficient count is not possible error.
"""
pass
| 16 | 58 | 0.671429 | 47 | 560 | 8 | 0.638298 | 0.06383 | 0.095745 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002304 | 0.225 | 560 | 34 | 59 | 16.470588 | 0.864055 | 0.301786 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.444444 | 0.111111 | 0 | 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 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
bba61ab8446599a99d677f4df7adb9557f265f62 | 1,664 | py | Python | source/miniworldmaker/__init__.py | teerasanqq/miniworldmaker | 6cb7394ff615763ab71194e8e5626ac6989b337e | [
"MIT"
] | null | null | null | source/miniworldmaker/__init__.py | teerasanqq/miniworldmaker | 6cb7394ff615763ab71194e8e5626ac6989b337e | [
"MIT"
] | null | null | null | source/miniworldmaker/__init__.py | teerasanqq/miniworldmaker | 6cb7394ff615763ab71194e8e5626ac6989b337e | [
"MIT"
] | null | null | null | import miniworldmaker.tokens.token
import miniworldmaker.tokens.actor
from miniworldmaker.tokens import token
import miniworldmaker.containers.container as container
import miniworldmaker.windows.miniworldwindow as window
import miniworldmaker.tools.db_manager as db_manager
from miniworldmaker import boards
from miniworldmaker.tokens.token import Token
from miniworldmaker.tokens.actor import Actor
from miniworldmaker.boards.tiled_board import TiledBoard
from miniworldmaker.boards.pixel_board import PixelBoard
from miniworldmaker.boards.board import Board
from miniworldmaker.containers.toolbar import Toolbar
from miniworldmaker.containers.event_console import EventConsole
from miniworldmaker.containers.select_token_type_toolbar import SelectTokenTypeToolbar
from miniworldmaker.containers.console import Console
from miniworldmaker.containers.color_console import ColorConsole
from miniworldmaker.containers.actionbar import ActionBar
from miniworldmaker.containers.toolbar_widgets import *
from miniworldmaker.containers.active_actor_toolbar import ActiveActorToolbar
from miniworldmaker.boards.board_position import BoardPosition
__all__ = ['Token',
'Actor',
'TiledBoard',
'SelectTokenTypeToolbar',
'PixelBoard',
'Toolbar',
'Board',
'ToolbarLabel',
'ToolbarButton',
'SaveButton',
'LoadButton',
'Console',
'EventConsole',
'ActionBar',
'ActiveActorToolbar',
'ColorConsole',
'BoardPosition',
'CounterLabel',
'TimeLabel',
'FPSLabel',
]
| 37.818182 | 86 | 0.743389 | 152 | 1,664 | 8.026316 | 0.289474 | 0.236066 | 0.183607 | 0.05082 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.194712 | 1,664 | 43 | 87 | 38.697674 | 0.910448 | 0 | 0 | 0 | 0 | 0 | 0.125601 | 0.013221 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
bbb7455ae74ab825994938ff02b97b364cef5117 | 35 | py | Python | ezored/app/__init__.py | archive-repository/ezored-udemy | 87d8120cf3a81e204daa1fad6036deec82f85789 | [
"MIT"
] | null | null | null | ezored/app/__init__.py | archive-repository/ezored-udemy | 87d8120cf3a81e204daa1fad6036deec82f85789 | [
"MIT"
] | null | null | null | ezored/app/__init__.py | archive-repository/ezored-udemy | 87d8120cf3a81e204daa1fad6036deec82f85789 | [
"MIT"
] | null | null | null | """modules"""
__all__ = ["const"]
| 8.75 | 19 | 0.542857 | 3 | 35 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 35 | 3 | 20 | 11.666667 | 0.5 | 0.2 | 0 | 0 | 0 | 0 | 0.227273 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 3 |
bbcad3fcaa1f45d6f2504ab61c0dc1af14087674 | 105 | py | Python | np/reference/ch7code/bessel0.py | focusunsink/study_python | 322326642db54df8725793d70a95d21ac40b6507 | [
"MIT"
] | null | null | null | np/reference/ch7code/bessel0.py | focusunsink/study_python | 322326642db54df8725793d70a95d21ac40b6507 | [
"MIT"
] | null | null | null | np/reference/ch7code/bessel0.py | focusunsink/study_python | 322326642db54df8725793d70a95d21ac40b6507 | [
"MIT"
] | null | null | null | import numpy as np
from pylab import *
x = np.linspace(0, 4, 100)
vals = np.i0(x)
plot(x, vals)
show()
| 11.666667 | 26 | 0.647619 | 21 | 105 | 3.238095 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 0.2 | 105 | 8 | 27 | 13.125 | 0.738095 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
bbda7818d35b52798b4e5b16fd0ae9cf7f60df9d | 138 | py | Python | dashboard/__init__.py | R-Ramachandran/Impact-of-taxation-on-Indian-economy | 13343571dda376cddfd41ab32ae6a61660ec8c9c | [
"MIT"
] | null | null | null | dashboard/__init__.py | R-Ramachandran/Impact-of-taxation-on-Indian-economy | 13343571dda376cddfd41ab32ae6a61660ec8c9c | [
"MIT"
] | null | null | null | dashboard/__init__.py | R-Ramachandran/Impact-of-taxation-on-Indian-economy | 13343571dda376cddfd41ab32ae6a61660ec8c9c | [
"MIT"
] | null | null | null | from flask import Flask
app = Flask(__name__)
app.config['SECRET_KEY'] = 'fac5f35dc32ba113029dad3eb831d7d1'
from dashboard import routes | 23 | 61 | 0.811594 | 16 | 138 | 6.6875 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138211 | 0.108696 | 138 | 6 | 62 | 23 | 0.731707 | 0 | 0 | 0 | 0 | 0 | 0.302158 | 0.230216 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
bbdf74abfbbfa35507d593cabf4c7b7793230e56 | 183 | py | Python | check_path.py | ShaneKilloran/ChessEngine | b567be76fed706e314ab320b9f4033157f6afb42 | [
"MIT"
] | null | null | null | check_path.py | ShaneKilloran/ChessEngine | b567be76fed706e314ab320b9f4033157f6afb42 | [
"MIT"
] | null | null | null | check_path.py | ShaneKilloran/ChessEngine | b567be76fed706e314ab320b9f4033157f6afb42 | [
"MIT"
] | null | null | null | import pickle
import utils
from MiniMax import MiniMax
from Node import Node
pickle_in = open("root.pickle","rb")
root = pickle.load(pickle_in)
mm = MiniMax(root)
mm.minimax(root)
| 15.25 | 36 | 0.759563 | 29 | 183 | 4.724138 | 0.413793 | 0.116788 | 0.189781 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136612 | 183 | 11 | 37 | 16.636364 | 0.867089 | 0 | 0 | 0 | 0 | 0 | 0.071038 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bbfe56e6d05c8bde9598bce8a50ff412615aace3 | 922 | py | Python | agent/indy_catalyst_agent/messaging/proofs/messages/proof_request.py | TelegramSam/indy-catalyst | 476f5a773d90d8b50960b49e63b823bd13325d4a | [
"Apache-2.0"
] | null | null | null | agent/indy_catalyst_agent/messaging/proofs/messages/proof_request.py | TelegramSam/indy-catalyst | 476f5a773d90d8b50960b49e63b823bd13325d4a | [
"Apache-2.0"
] | null | null | null | agent/indy_catalyst_agent/messaging/proofs/messages/proof_request.py | TelegramSam/indy-catalyst | 476f5a773d90d8b50960b49e63b823bd13325d4a | [
"Apache-2.0"
] | null | null | null | """
A proof request content message.
"""
from marshmallow import Schema, fields, post_load
from ...agent_message import AgentMessage
from ...message_types import MessageTypes
class ProofRequest(AgentMessage):
def __init__(self, proof_request_json: str):
self.proof_request_json = proof_request_json
@property
# Avoid clobbering builtin property
def _type(self):
return MessageTypes.PROOF_REQUEST.value
@classmethod
def deserialize(cls, obj):
return ProofRequestSchema().load(obj)
def serialize(self):
return ProofRequestSchema().dump(self)
class ProofRequestSchema(Schema):
# Avoid clobbering builtin property
_type = fields.Str(data_key="@type", required=True)
proof_request_json = fields.Str(required=True)
@post_load
def make_model(self, data: dict) -> ProofRequest:
del data["_type"]
return ProofRequest(**data)
| 24.918919 | 55 | 0.711497 | 105 | 922 | 6.038095 | 0.428571 | 0.113565 | 0.100946 | 0.063091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196312 | 922 | 36 | 56 | 25.611111 | 0.855601 | 0.109544 | 0 | 0 | 0 | 0 | 0.012315 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0.142857 | 0.142857 | 0.761905 | 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 | 1 | 0 | 0 | 3 |
a541057d244d64d3694cd35ba9caca50a4f9b806 | 69 | py | Python | rating/__init__.py | LinuxOSsk/Shakal-NG | c4091c7972cffd86f64aa9f9a058d2907a56e5eb | [
"MIT"
] | 10 | 2016-02-06T15:40:30.000Z | 2018-09-27T15:15:13.000Z | rating/__init__.py | LinuxOSsk/Shakal-NG | c4091c7972cffd86f64aa9f9a058d2907a56e5eb | [
"MIT"
] | 94 | 2016-02-04T18:39:36.000Z | 2022-01-20T05:25:00.000Z | rating/__init__.py | LinuxOSsk/Shakal-NG | c4091c7972cffd86f64aa9f9a058d2907a56e5eb | [
"MIT"
] | 8 | 2016-05-10T20:29:53.000Z | 2021-02-07T00:50:31.000Z | # -*- coding: utf-8 -*-
default_app_config = 'rating.apps.AppConfig'
| 23 | 44 | 0.681159 | 9 | 69 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016393 | 0.115942 | 69 | 2 | 45 | 34.5 | 0.721311 | 0.304348 | 0 | 0 | 0 | 0 | 0.456522 | 0.456522 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a5619426eab7a73e3013ce01f973639b1c943c08 | 101 | py | Python | python/euler28.py | zhouxiumin/projecteuler | 1db55ab1876f61c1978d2f0b5bfc476f68276e77 | [
"Apache-2.0"
] | null | null | null | python/euler28.py | zhouxiumin/projecteuler | 1db55ab1876f61c1978d2f0b5bfc476f68276e77 | [
"Apache-2.0"
] | null | null | null | python/euler28.py | zhouxiumin/projecteuler | 1db55ab1876f61c1978d2f0b5bfc476f68276e77 | [
"Apache-2.0"
] | null | null | null | #coding=utf-8
length=1001+1
result=1
for t in range(3,length,2):
result+=4*t*t-6*t+6
print result
| 11.222222 | 27 | 0.693069 | 24 | 101 | 2.916667 | 0.666667 | 0.057143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 0.128713 | 101 | 8 | 28 | 12.625 | 0.659091 | 0.118812 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a56bb00d97b0ff0179aa14c9b3bb9611ac222b49 | 154 | py | Python | homeassistant/components/trend/__init__.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 30,023 | 2016-04-13T10:17:53.000Z | 2020-03-02T12:56:31.000Z | homeassistant/components/trend/__init__.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 31,101 | 2020-03-02T13:00:16.000Z | 2022-03-31T23:57:36.000Z | homeassistant/components/trend/__init__.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 11,956 | 2016-04-13T18:42:31.000Z | 2020-03-02T09:32:12.000Z | """A sensor that monitors trends in other components."""
from homeassistant.const import Platform
DOMAIN = "trend"
PLATFORMS = [Platform.BINARY_SENSOR]
| 22 | 56 | 0.772727 | 19 | 154 | 6.210526 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12987 | 154 | 6 | 57 | 25.666667 | 0.880597 | 0.324675 | 0 | 0 | 0 | 0 | 0.05102 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
3c02c391180a32f0d05d6f333a07e4fc434b7827 | 727 | py | Python | Aula35/controller/frameworkfe_controller.py | marcelabbc07/TrabalhosPython | 91734d13110e4dee12a532dfd7091e36394a6449 | [
"MIT"
] | null | null | null | Aula35/controller/frameworkfe_controller.py | marcelabbc07/TrabalhosPython | 91734d13110e4dee12a532dfd7091e36394a6449 | [
"MIT"
] | null | null | null | Aula35/controller/frameworkfe_controller.py | marcelabbc07/TrabalhosPython | 91734d13110e4dee12a532dfd7091e36394a6449 | [
"MIT"
] | null | null | null | from dao.squad_dao import SquadDao
from model.squad import Squad
from controller.squad_controller import SquadController
class FrameworkFrontEndController:
dao=FrameworkFrontEndDao()
squad_controller=SquadController()
def listar_todos(self):
return self.dao.listar_todos()
def buscar_por_id(self,id):
return self.dao.buscar_por_id(id)
def salvar(self,frameworkfrontend:FrameworkFrontEnd):
frameworkfrontend.squad.id=self.squad_controller.salvar(squad.frameworkfrontend)
return self.dao.salvar(frameworkfrontend)
def alterar(self,frameworkfrontend:FrameworkFrontEnd):
self.dao.alterar(frameworkfrontend)
def deletar(self,id):
self.dao.deletar(id) | 31.608696 | 88 | 0.759285 | 82 | 727 | 6.609756 | 0.280488 | 0.064576 | 0.071956 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15956 | 727 | 23 | 89 | 31.608696 | 0.88707 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294118 | false | 0 | 0.176471 | 0.117647 | 0.823529 | 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 | 1 | 0 | 0 | 3 |
3c1027f6641f4a0a25c05bcbccfd842f58cb8a2f | 376 | py | Python | basic_input.py | Wrbrgrgl/python-with-dad | 7fbb5811c2ce217f085943acb298b9fffb6850a5 | [
"BSD-2-Clause"
] | null | null | null | basic_input.py | Wrbrgrgl/python-with-dad | 7fbb5811c2ce217f085943acb298b9fffb6850a5 | [
"BSD-2-Clause"
] | null | null | null | basic_input.py | Wrbrgrgl/python-with-dad | 7fbb5811c2ce217f085943acb298b9fffb6850a5 | [
"BSD-2-Clause"
] | null | null | null | #!python
""" playing with some basic inut and output """
import sys
# arguments = set(sys.argv)
# print "Passed in {} arguments, with {} unique ones, they are :".format(len(sys.argv)), len(arguments))
my_peoples = set()
print "Passed in {} arguments, they are:".format(len(sys.argv) - 1)
for arg in xrange(1, len(sys.argv)):
arguments.add(sys.argv[arg])
print arguments
| 28.923077 | 104 | 0.68617 | 58 | 376 | 4.431034 | 0.5 | 0.136187 | 0.116732 | 0.171206 | 0.178988 | 0.178988 | 0 | 0 | 0 | 0 | 0 | 0.00625 | 0.148936 | 376 | 12 | 105 | 31.333333 | 0.796875 | 0.361702 | 0 | 0 | 0 | 0 | 0.173684 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.166667 | 0.166667 | null | null | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3c2197f5a51a7e675848cc56f6cdab7aed5d568a | 199 | py | Python | chapter2/wok/master/wok/core/cmd/constants.py | chris-zen/phd-thesis | 1eefdff8e7ca1910304e27ae42551dc64496b101 | [
"Unlicense"
] | 1 | 2015-12-22T00:53:18.000Z | 2015-12-22T00:53:18.000Z | chapter2/wok/master/wok/core/cmd/constants.py | chris-zen/phd-thesis | 1eefdff8e7ca1910304e27ae42551dc64496b101 | [
"Unlicense"
] | null | null | null | chapter2/wok/master/wok/core/cmd/constants.py | chris-zen/phd-thesis | 1eefdff8e7ca1910304e27ae42551dc64496b101 | [
"Unlicense"
] | null | null | null | # Environment variables
ENV_PROJECT_PATH = "PROJECT_PATH"
ENV_FLOW_PATH = "FLOW_PATH"
ENV_SCRIPT_PATH = "SCRIPT_PATH"
ENV_PLATFORM_SCRIPT_PATH = "PLATFORM_SCRIPT_PATH"
# Contexts
CTX_EXEC = "exec" | 19.9 | 49 | 0.80402 | 28 | 199 | 5.178571 | 0.392857 | 0.275862 | 0.248276 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110553 | 199 | 10 | 50 | 19.9 | 0.819209 | 0.150754 | 0 | 0 | 0 | 0 | 0.335329 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 3 |
3c5e1fa56ce2a4427b8f2fd88cbd54aa530e4f3c | 302 | py | Python | moneyland/settings_prod.py | namlook/moneyland | ca9a4b8adba4e27b3ac275cd5ba6727c73805ff4 | [
"MIT"
] | 1 | 2016-06-29T20:31:50.000Z | 2016-06-29T20:31:50.000Z | moneyland/settings_prod.py | namlook/moneyland | ca9a4b8adba4e27b3ac275cd5ba6727c73805ff4 | [
"MIT"
] | null | null | null | moneyland/settings_prod.py | namlook/moneyland | ca9a4b8adba4e27b3ac275cd5ba6727c73805ff4 | [
"MIT"
] | null | null | null | from .settings import *
DEBUG = False
ALLOWED_HOSTS = ["*"]
STATIC_ROOT = "/home/moneyland/moneyland/public"
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.NoopCompressor'
PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.NoopCompressor'
| 27.454545 | 66 | 0.788079 | 30 | 302 | 7.766667 | 0.7 | 0.154506 | 0.248927 | 0.369099 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082781 | 302 | 10 | 67 | 30.2 | 0.841155 | 0 | 0 | 0 | 0 | 0 | 0.536424 | 0.443709 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3c6135d517b54629430a1001d46799559b1fb309 | 195 | py | Python | backend_final/apartacho/properties/apps.py | cenavia/skylynx | 6286294a8cd57279e3c176d8fcae656cef4b40a8 | [
"MIT"
] | 3 | 2020-04-29T18:07:40.000Z | 2020-05-20T20:52:52.000Z | backend_final/apartacho/properties/apps.py | cenavia/Apartacho | 6286294a8cd57279e3c176d8fcae656cef4b40a8 | [
"MIT"
] | 53 | 2020-05-13T03:27:41.000Z | 2022-03-12T00:32:46.000Z | backend_final/apartacho/properties/apps.py | cenavia/Apartacho | 6286294a8cd57279e3c176d8fcae656cef4b40a8 | [
"MIT"
] | 2 | 2020-05-16T05:34:45.000Z | 2020-06-11T14:47:50.000Z | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class PropertiesConfig(AppConfig):
name = 'apartacho.properties'
verbose_name = _("Properties")
| 24.375 | 54 | 0.779487 | 22 | 195 | 6.727273 | 0.727273 | 0.135135 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14359 | 195 | 7 | 55 | 27.857143 | 0.886228 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
3c6941b72937010bb0203492bfbb49a2882c7ceb | 188 | py | Python | Advance_Python/Class_&_Objects/constructor_overriding.py | siddharth-143/Python | 293f4643a3a13e3b82d23fd8922db54dbb0f12bc | [
"MIT"
] | null | null | null | Advance_Python/Class_&_Objects/constructor_overriding.py | siddharth-143/Python | 293f4643a3a13e3b82d23fd8922db54dbb0f12bc | [
"MIT"
] | null | null | null | Advance_Python/Class_&_Objects/constructor_overriding.py | siddharth-143/Python | 293f4643a3a13e3b82d23fd8922db54dbb0f12bc | [
"MIT"
] | null | null | null | class A:
def __init__(self):
print('base class constructor ')
class B(A):
def __init__(self):
super().__init__()
print('child class constructor ')
b1=B()
| 17.090909 | 41 | 0.585106 | 23 | 188 | 4.26087 | 0.521739 | 0.081633 | 0.163265 | 0.244898 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007353 | 0.276596 | 188 | 10 | 42 | 18.8 | 0.713235 | 0 | 0 | 0.25 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0.25 | 1 | 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 | 3 |
3c6edc503a8ea317294756a0afbef9c1fdf9cbd9 | 673 | py | Python | nmrtools/__init__.py | bjrnfrdnnd/panel-test | 4609a259e749825b2a2012d8a7e48ed8e8a78deb | [
"MIT"
] | null | null | null | nmrtools/__init__.py | bjrnfrdnnd/panel-test | 4609a259e749825b2a2012d8a7e48ed8e8a78deb | [
"MIT"
] | 1 | 2019-07-26T22:12:19.000Z | 2019-10-31T17:48:51.000Z | nmrtools/__init__.py | bjrnfrdnnd/panel-test | 4609a259e749825b2a2012d8a7e48ed8e8a78deb | [
"MIT"
] | 1 | 2019-09-19T11:54:45.000Z | 2019-09-19T11:54:45.000Z | """
nmrtools
========
The nmrtools package provides tools for simulating nuclear magnetic resonance
(NMR) spectra.
The API is still in flux. Currently, it includes the following modules:
* dnmr: for modeling Dynamic NMR systems
* firstorder: for modeling first-order spectra
* math: core math routines for handling NMR data
* partial: uses non-quantum-mechanical solutions for common second-order
NMR patterns
* plt: convenience plotting routines for NMR results
* qm: quantum-mechanical second-order simulation of spin systems (currently
capped at 11 nuclei)
Currently, only spin-1/2 nuclei are accommodated.
"""
from ._classes import Multiplet, SpinSystem, Spectrum
| 29.26087 | 77 | 0.784547 | 92 | 673 | 5.728261 | 0.717391 | 0.041746 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006957 | 0.145617 | 673 | 22 | 78 | 30.590909 | 0.909565 | 0.904903 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
3c72d74fb15907413ad18b4d74a39b572390d6fc | 901 | py | Python | foil/patterns.py | portfoliome/foil | b66d8cf4ab048a387d8c7a033b47e922ed6917d6 | [
"MIT"
] | 30 | 2016-10-03T04:04:26.000Z | 2021-03-16T17:40:11.000Z | foil/patterns.py | portfoliome/foil | b66d8cf4ab048a387d8c7a033b47e922ed6917d6 | [
"MIT"
] | 11 | 2017-01-01T17:49:51.000Z | 2017-12-14T18:13:20.000Z | foil/patterns.py | portfoliome/foil | b66d8cf4ab048a387d8c7a033b47e922ed6917d6 | [
"MIT"
] | null | null | null | """
Pattern matching utilities.
"""
import re
from functools import wraps
from typing import Iterable
def match_subgroup(sequence, pattern):
"""Yield the sub-group element dictionary that match a regex pattern."""
for element in sequence:
match = re.match(pattern, element)
if match:
yield match.groupdict()
def match_group(choices: Iterable) -> str:
return '|'.join(choices)
def add_regex_start_end(pattern_function):
"""Decorator for adding regex pattern start and end characters."""
@wraps(pattern_function)
def func_wrapper(*args, **kwargs):
return r'^{}$'.format(pattern_function(*args, **kwargs))
return func_wrapper
def tokenize_group_pattern(name, choices):
pattern = match_group(choices)
return tokenize_pattern(name, pattern)
def tokenize_pattern(name, pattern):
return '(?P<%s>%s)' % (name, pattern)
| 22.525 | 76 | 0.692564 | 112 | 901 | 5.4375 | 0.4375 | 0.073892 | 0.055829 | 0.085386 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.193119 | 901 | 39 | 77 | 23.102564 | 0.837689 | 0.172031 | 0 | 0 | 0 | 0 | 0.020604 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.15 | 0.15 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
3c971030ca69928a207bdacfe2fe27f999cfb0b8 | 210 | py | Python | sample_config.py | naushadzaman/CoinBaseBot | 3cc97b98203770431ef0cb7b50f03c061184db5e | [
"Unlicense",
"MIT"
] | null | null | null | sample_config.py | naushadzaman/CoinBaseBot | 3cc97b98203770431ef0cb7b50f03c061184db5e | [
"Unlicense",
"MIT"
] | null | null | null | sample_config.py | naushadzaman/CoinBaseBot | 3cc97b98203770431ef0cb7b50f03c061184db5e | [
"Unlicense",
"MIT"
] | null | null | null | config = {
"coinbase":{
"Key": "",
"Secret": ""
},
"twilio":{
"Key": "",
"Secret": "",
"from": "+12223334444",
"to_list": ["+12223334444"],
},
"bittrex":{
"Key" : "",
"Secret" : ""
}
}
| 12.352941 | 30 | 0.414286 | 15 | 210 | 5.733333 | 0.666667 | 0.313953 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140127 | 0.252381 | 210 | 16 | 31 | 13.125 | 0.407643 | 0 | 0 | 0.3125 | 0 | 0 | 0.395238 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 3 |
b1c4bedd0d66ecc25e2cb93962b85bef017bbb0f | 399 | py | Python | ssm/simulation/sim_modules/noise.py | sflis/SSM-analysis | 317db8b296fd189832b9344b0429ea6016e35999 | [
"BSD-3-Clause"
] | null | null | null | ssm/simulation/sim_modules/noise.py | sflis/SSM-analysis | 317db8b296fd189832b9344b0429ea6016e35999 | [
"BSD-3-Clause"
] | 7 | 2019-02-26T21:11:29.000Z | 2019-09-08T09:48:13.000Z | ssm/simulation/sim_modules/noise.py | sflis/SSM-analysis | 317db8b296fd189832b9344b0429ea6016e35999 | [
"BSD-3-Clause"
] | 1 | 2019-07-16T09:45:05.000Z | 2019-07-16T09:45:05.000Z | from ssm.core.pchain import ProcessingModule
import numpy as np
class Noise(ProcessingModule):
def __init__(self, resp_key="response", name="Noise"):
super().__init__(name)
self.resp_key = resp_key
def configure(self, config):
pass
def run(self, frame):
frame[self.resp_key] += np.random.normal(scale=0.01 * frame[self.resp_key])
return frame
| 24.9375 | 83 | 0.66416 | 54 | 399 | 4.666667 | 0.555556 | 0.138889 | 0.174603 | 0.126984 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009646 | 0.220551 | 399 | 15 | 84 | 26.6 | 0.800643 | 0 | 0 | 0 | 0 | 0 | 0.032581 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0.090909 | 0.181818 | 0 | 0.636364 | 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 | 1 | 0 | 0 | 3 |
591609290d555e45bb19aaafe9f75cabe9c52b31 | 501 | py | Python | practice0/for_loops_examples.py | DeercoderPractice/python | 4a32cc8922f47baea390e8167e34f185f67ae0fd | [
"MIT"
] | null | null | null | practice0/for_loops_examples.py | DeercoderPractice/python | 4a32cc8922f47baea390e8167e34f185f67ae0fd | [
"MIT"
] | null | null | null | practice0/for_loops_examples.py | DeercoderPractice/python | 4a32cc8922f47baea390e8167e34f185f67ae0fd | [
"MIT"
] | null | null | null | #! /usr/bin/python
# Samples Python/PYgames
# Print 'Hi' 10 times
for i in range(10):
print("Hi")
for i in range(5):
print("Hello")
print ("There")
for i in range(5):
print("Hello")
print("There")
for i in range(10):
print(i)
for i in range(1, 11):
print(i)
for i in range(10, 0, -1):
print(i)
for i in [2, 6, 4, 2, 6, 7, 4]:
print(i)
for i in range(3):
print("a")
for j in range(3):
print("b")
a = 0
for i in range(10):
a = a + 1
print(a)
| 13.540541 | 31 | 0.536926 | 97 | 501 | 2.773196 | 0.278351 | 0.133829 | 0.200743 | 0.327138 | 0.643123 | 0.542751 | 0.27881 | 0.27881 | 0.27881 | 0.27881 | 0 | 0.077778 | 0.281437 | 501 | 36 | 32 | 13.916667 | 0.669444 | 0.11976 | 0 | 0.541667 | 0 | 0 | 0.054795 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 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 | 1 | 0 | 3 |
591d85cf3edfee7d97bb7765c5cc2a5cd2e2e2f2 | 93 | py | Python | app.py | ron2618/ruangkomik | bccb09deebc1d4931a56699be59e9f83cc1b90b7 | [
"MIT"
] | 3 | 2020-06-28T14:05:38.000Z | 2020-08-17T19:30:43.000Z | app.py | ron2618/ruangkomik | bccb09deebc1d4931a56699be59e9f83cc1b90b7 | [
"MIT"
] | 1 | 2020-08-17T15:25:25.000Z | 2020-08-18T03:52:13.000Z | app.py | ron2618/ruangkomik | bccb09deebc1d4931a56699be59e9f83cc1b90b7 | [
"MIT"
] | 1 | 2021-01-30T08:56:28.000Z | 2021-01-30T08:56:28.000Z | from flask import Flask
from lib.router import Router
app = Flask(__name__)
Router.run(app) | 15.5 | 29 | 0.784946 | 15 | 93 | 4.6 | 0.533333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.139785 | 93 | 6 | 30 | 15.5 | 0.8625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
591e2a0f680014996ebaf54192117362ca418432 | 133 | py | Python | django_oidc_user/apps.py | montudor/django-cross-project-tools | d02133f3947b5885ce340ff38846355bbc6dde15 | [
"MIT"
] | 7 | 2017-10-31T10:25:00.000Z | 2020-04-02T05:53:27.000Z | django_oidc_user/apps.py | montudor/django-oidc-user | d02133f3947b5885ce340ff38846355bbc6dde15 | [
"MIT"
] | null | null | null | django_oidc_user/apps.py | montudor/django-oidc-user | d02133f3947b5885ce340ff38846355bbc6dde15 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class DjangoOIDCUserConfig(AppConfig):
name = 'django_oidc_user'
verbose_name = 'User Accounts'
| 22.166667 | 38 | 0.804511 | 16 | 133 | 6.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.120301 | 133 | 5 | 39 | 26.6 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0.218045 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 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 | 1 | 0 | 0 | 3 |
59236e2fa5de2db6294e6866f2c37e40ca310446 | 358 | py | Python | util.py | alspitz/esc_test | 4078609e3a84923b9cdbfdea8daf9814364fa9c8 | [
"MIT"
] | 1 | 2021-12-28T08:38:04.000Z | 2021-12-28T08:38:04.000Z | util.py | alspitz/esc_test | 4078609e3a84923b9cdbfdea8daf9814364fa9c8 | [
"MIT"
] | null | null | null | util.py | alspitz/esc_test | 4078609e3a84923b9cdbfdea8daf9814364fa9c8 | [
"MIT"
] | null | null | null | import numpy as np
def filter_nan(ts, vs):
good_vs = np.logical_not(np.isnan(vs))
return ts[good_vs], vs[good_vs]
def first_that(f, arr):
for i, v in enumerate(arr):
if f(v):
return i
return None
def first_nonzero(arr):
return first_that(lambda x: x, arr)
def first_greater_than(val, arr):
return first_that(lambda x: x > val, arr)
| 19.888889 | 43 | 0.684358 | 67 | 358 | 3.492537 | 0.462687 | 0.076923 | 0.068376 | 0.153846 | 0.222222 | 0.222222 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0.195531 | 358 | 17 | 44 | 21.058824 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0.076923 | 0.153846 | 0.769231 | 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 | 1 | 0 | 0 | 3 |
3ca1bbb0b7d509f5bb818f9085d55cc21f39bd74 | 412 | py | Python | accelerator/models/partner_application_interest.py | masschallenge/django-accelerator | 8af898b574be3b8335edc8961924d1c6fa8b5fd5 | [
"MIT"
] | 6 | 2017-06-14T19:34:01.000Z | 2020-03-08T07:16:59.000Z | accelerator/models/partner_application_interest.py | masschallenge/django-accelerator | 8af898b574be3b8335edc8961924d1c6fa8b5fd5 | [
"MIT"
] | 160 | 2017-06-20T17:12:13.000Z | 2022-03-30T13:53:12.000Z | accelerator/models/partner_application_interest.py | masschallenge/django-accelerator | 8af898b574be3b8335edc8961924d1c6fa8b5fd5 | [
"MIT"
] | null | null | null | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
import swapper
from accelerator_abstract.models import BasePartnerApplicationInterest
class PartnerApplicationInterest(BasePartnerApplicationInterest):
class Meta(BasePartnerApplicationInterest.Meta):
swappable = swapper.swappable_setting(
BasePartnerApplicationInterest.Meta.app_label,
"PartnerApplicationInterest")
| 29.428571 | 70 | 0.788835 | 31 | 412 | 10.387097 | 0.677419 | 0.217391 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011494 | 0.15534 | 412 | 13 | 71 | 31.692308 | 0.913793 | 0.121359 | 0 | 0 | 0 | 0 | 0.072423 | 0.072423 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 3 |
3cb4bb3261a05b84d850e3c0087a7af38acc3a76 | 109 | py | Python | ml_skeleton_py/model/__init__.py | ChaoYan/drl4rec | 81aebc1598cc913a9512920422b3bb463762e003 | [
"MIT"
] | 92 | 2020-10-26T11:19:32.000Z | 2022-03-18T02:14:59.000Z | ml_skeleton_py/model/__init__.py | ChaoYan/drl4rec | 81aebc1598cc913a9512920422b3bb463762e003 | [
"MIT"
] | 3 | 2021-01-29T13:42:26.000Z | 2022-02-15T09:29:12.000Z | ml_skeleton_py/model/__init__.py | ChaoYan/drl4rec | 81aebc1598cc913a9512920422b3bb463762e003 | [
"MIT"
] | 12 | 2020-10-26T19:06:10.000Z | 2022-03-18T04:14:17.000Z | """Model package."""
from .train import train
from .predict import predict
__all__ = ["train", "predict"]
| 13.625 | 30 | 0.688073 | 13 | 109 | 5.461538 | 0.538462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155963 | 109 | 7 | 31 | 15.571429 | 0.771739 | 0.12844 | 0 | 0 | 0 | 0 | 0.134831 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
3cc28275a8c0417f440bf63626cdcaee1319a9a4 | 627 | py | Python | explorebg/home/views.py | bvoytash/Quiz-Application | 279a029b8e40513642bf002387f813d680a74ed7 | [
"MIT"
] | null | null | null | explorebg/home/views.py | bvoytash/Quiz-Application | 279a029b8e40513642bf002387f813d680a74ed7 | [
"MIT"
] | null | null | null | explorebg/home/views.py | bvoytash/Quiz-Application | 279a029b8e40513642bf002387f813d680a74ed7 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
# @method_decorator(cache_page(60 * 10), name='dispatch')
class HomePageView(TemplateView):
template_name = 'home/home.html'
# @method_decorator(cache_page(60 * 10), name='dispatch')
class CauseView(TemplateView):
template_name = 'home/cause.html'
def handler404(request, exception):
return render(request, 'error_404.html', status=404)
def handler500(request):
return render(request, 'error_500.html', status=500)
| 27.26087 | 57 | 0.773525 | 81 | 627 | 5.864198 | 0.432099 | 0.084211 | 0.063158 | 0.101053 | 0.189474 | 0.189474 | 0.189474 | 0.189474 | 0.189474 | 0 | 0 | 0.046931 | 0.116427 | 627 | 22 | 58 | 28.5 | 0.810469 | 0.177033 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 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 | 1 | 1 | 0 | 0 | 3 |
3cd33490215a7f535ad4cb98426cfc3398cf04ee | 96 | py | Python | Analysis/apps.py | psymen145/OVS-django-fe | 1823e8b42c17276d6b50a63dddd9b04a21c2038c | [
"MIT"
] | null | null | null | Analysis/apps.py | psymen145/OVS-django-fe | 1823e8b42c17276d6b50a63dddd9b04a21c2038c | [
"MIT"
] | null | null | null | Analysis/apps.py | psymen145/OVS-django-fe | 1823e8b42c17276d6b50a63dddd9b04a21c2038c | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class AnalysisConfig(AppConfig):
name = 'Analysis'
| 16 | 34 | 0.71875 | 10 | 96 | 6.9 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208333 | 96 | 5 | 35 | 19.2 | 0.907895 | 0 | 0 | 0 | 0 | 0 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
3cd5f61b0f8be2d614d0d38cddc9a51ae05a3286 | 139 | py | Python | DiscordOAuth2/urls.py | IamEinstein/django-bank | 16f98755787e18ecd9dee6783b0af26ca200446f | [
"MIT"
] | 1 | 2021-04-22T17:20:44.000Z | 2021-04-22T17:20:44.000Z | DiscordOAuth2/urls.py | IamEinstein/django-bank | 16f98755787e18ecd9dee6783b0af26ca200446f | [
"MIT"
] | 27 | 2021-06-10T20:43:59.000Z | 2022-03-28T11:41:30.000Z | DiscordOAuth2/urls.py | IamEinstein/djank | 16f98755787e18ecd9dee6783b0af26ca200446f | [
"MIT"
] | null | null | null | from django.urls import path
from .views import *
app_name = "discord"
urlpatterns = [
path('', LoginView.as_view(), name="verify")
]
| 17.375 | 48 | 0.683453 | 18 | 139 | 5.166667 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165468 | 139 | 7 | 49 | 19.857143 | 0.801724 | 0 | 0 | 0 | 0 | 0 | 0.093525 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
3cdc23ff096b142557213635989b59206252106f | 181 | py | Python | xcx_interface/route/menu_r.py | linjingheng-dev/python_service | c44d92a4c82f52228617dbabdbb1a57b6ad6de57 | [
"Apache-2.0"
] | 8 | 2021-08-08T07:47:31.000Z | 2021-08-17T12:09:32.000Z | xcx_interface/route/menu_r.py | linjingheng-dev/python_service | c44d92a4c82f52228617dbabdbb1a57b6ad6de57 | [
"Apache-2.0"
] | 1 | 2021-07-31T10:16:19.000Z | 2021-07-31T10:16:19.000Z | xcx_interface/route/menu_r.py | linjingheng-dev/python_service | c44d92a4c82f52228617dbabdbb1a57b6ad6de57 | [
"Apache-2.0"
] | 1 | 2021-12-01T15:32:47.000Z | 2021-12-01T15:32:47.000Z | from django.urls import path
from xcx_interface.controller.menu.menu_msg import getMenuList
urlpatterns = [
# 获取菜单列表
path('getMenuList', getMenuList, name='getMenuList')
]
| 22.625 | 62 | 0.762431 | 21 | 181 | 6.47619 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.143646 | 181 | 7 | 63 | 25.857143 | 0.877419 | 0.033149 | 0 | 0 | 0 | 0 | 0.127168 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
3cef09f2c093811f2f4d3ab07e418eda37b8fff5 | 22 | py | Python | test/functional/ltm/__init__.py | yuanfm/f5-common-python | 7d6588d56323e7065fec929ff00020081f9d6ade | [
"Apache-2.0"
] | null | null | null | test/functional/ltm/__init__.py | yuanfm/f5-common-python | 7d6588d56323e7065fec929ff00020081f9d6ade | [
"Apache-2.0"
] | null | null | null | test/functional/ltm/__init__.py | yuanfm/f5-common-python | 7d6588d56323e7065fec929ff00020081f9d6ade | [
"Apache-2.0"
] | null | null | null | __author__ = 'wormke'
| 11 | 21 | 0.727273 | 2 | 22 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 22 | 1 | 22 | 22 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 3 |
a71cf960c806a5b6b0d80133279573354e781012 | 359 | py | Python | devBlag/admin.py | tehsmeely/DjangaeScaffold | 813be0971344744c54a7e923ab9bd9337f77d5f6 | [
"Apache-2.0"
] | 1 | 2015-05-10T12:25:31.000Z | 2015-05-10T12:25:31.000Z | devBlag/admin.py | tehsmeely/devBlag | 813be0971344744c54a7e923ab9bd9337f77d5f6 | [
"Apache-2.0"
] | null | null | null | devBlag/admin.py | tehsmeely/devBlag | 813be0971344744c54a7e923ab9bd9337f77d5f6 | [
"Apache-2.0"
] | null | null | null | from django.contrib import admin
# Register your models here.
from .models import \
Post, Resource_image, Resource_code, Resource_download, Project, Developer
admin.site.register(Post)
admin.site.register(Project)
admin.site.register(Developer)
admin.site.register(Resource_image)
admin.site.register(Resource_code)
admin.site.register(Resource_download)
| 23.933333 | 74 | 0.824513 | 48 | 359 | 6.041667 | 0.354167 | 0.186207 | 0.351724 | 0.258621 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08078 | 359 | 14 | 75 | 25.642857 | 0.878788 | 0.072423 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.222222 | 0 | 0.222222 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a727ca56bf40c197ae04014e5d4bef1acaf30dff | 532 | py | Python | eveonline-assistant/users/models.py | wengole/eveonline-assistant | 35041952509bd347c5c9458630404726d7ddd5d8 | [
"BSD-3-Clause"
] | 1 | 2016-07-01T03:15:16.000Z | 2016-07-01T03:15:16.000Z | eveonline-assistant/users/models.py | wengole/eveonline-assistant | 35041952509bd347c5c9458630404726d7ddd5d8 | [
"BSD-3-Clause"
] | null | null | null | eveonline-assistant/users/models.py | wengole/eveonline-assistant | 35041952509bd347c5c9458630404726d7ddd5d8 | [
"BSD-3-Clause"
] | null | null | null | from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
def has_apikeys(self):
"""
Does this user have an API Keys registered
:return: :rtype: bool
"""
return self.api_keys.count() > 0
def has_disabled_characters(self):
"""
Does this user have characters that aren't yet added
:return: :rtype: bool
"""
return self.characters.filter(enabled=False).count() > 0
def __unicode__(self):
return self.username | 23.130435 | 64 | 0.612782 | 63 | 532 | 5.047619 | 0.587302 | 0.09434 | 0.075472 | 0.100629 | 0.283019 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005305 | 0.291353 | 532 | 23 | 65 | 23.130435 | 0.838196 | 0.265038 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0 | 0.125 | 0.125 | 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 | 1 | 0 | 0 | 3 |
5973d49f1ac676f5a0f3cab86d31c48bf08be908 | 1,794 | py | Python | omsdk/http/sdkwsman.py | DanielFroehlich/omsdk | 475d925e4033104957fdc64480fe8f9af0ab6b8a | [
"Apache-2.0"
] | 61 | 2018-02-21T00:02:20.000Z | 2022-01-26T03:47:19.000Z | omsdk/http/sdkwsman.py | DanielFroehlich/omsdk | 475d925e4033104957fdc64480fe8f9af0ab6b8a | [
"Apache-2.0"
] | 31 | 2018-03-24T05:43:39.000Z | 2022-03-16T07:10:37.000Z | omsdk/http/sdkwsman.py | DanielFroehlich/omsdk | 475d925e4033104957fdc64480fe8f9af0ab6b8a | [
"Apache-2.0"
] | 25 | 2018-03-13T10:06:12.000Z | 2022-01-26T03:47:21.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved.
# Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
#
# 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.
#
# Authors: Vaideeswaran Ganesan
#
import sys
from omsdk.http.sdkwsmanbase import WsManProtocolBase
from omsdk.http.sdkhttpep import HttpEndPoint, HttpEndPointOptions
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
class WsManProtocol(WsManProtocolBase):
def __init__(self, ipaddr, creds, pOptions):
if PY2:
super(WsManProtocol, self).__init__(ipaddr, creds, pOptions)
else:
super().__init__(ipaddr, creds, pOptions)
headers = {
'Content-Type': 'application/soap+xml;charset=UTF-8'
}
self.proto = HttpEndPoint(ipaddr, creds, pOptions, headers)
def _proto_connect(self):
self.proto.connect()
def _proto_ship_payload(self, payload):
return self.proto.ship_payload(payload)
def _proto_endpoint(self):
return self.proto.endpoint
def _proto_reset(self):
return self.proto.reset()
| 33.222222 | 83 | 0.688963 | 231 | 1,794 | 5.251082 | 0.541126 | 0.049464 | 0.062655 | 0.019786 | 0.039571 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012903 | 0.222408 | 1,794 | 53 | 84 | 33.849057 | 0.855914 | 0.449833 | 0 | 0 | 0 | 0 | 0.050439 | 0.037281 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0.130435 | 0.130435 | 0.521739 | 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 | 1 | 0 | 0 | 3 |
598815eb319b51eeb940d15d5bef8ba875ad8ba9 | 24,574 | py | Python | runtime/stdlib/json.py | cheery/lever | 6fa8cd6afec440b32232f87236b0457fb8bfb8b1 | [
"MIT"
] | 136 | 2015-12-18T21:11:59.000Z | 2022-02-21T19:47:36.000Z | runtime/stdlib/json.py | cheery/lever | 6fa8cd6afec440b32232f87236b0457fb8bfb8b1 | [
"MIT"
] | 1 | 2021-05-07T11:17:02.000Z | 2021-05-07T18:15:07.000Z | runtime/stdlib/json.py | cheery/lever | 6fa8cd6afec440b32232f87236b0457fb8bfb8b1 | [
"MIT"
] | 13 | 2016-03-06T18:27:17.000Z | 2020-06-18T14:27:32.000Z | ## Just the JSON decoder, because I only need a decoder for now.
#from rpython.rlib.unicodedata import unicodedb_6_2_0 as unicodedb
from rpython.rlib.listsort import make_timsort_class
from rpython.rlib import rfile
from rpython.rlib.rstring import UnicodeBuilder
from rpython.rlib.objectmodel import specialize, always_inline
from space import *
from space import numbers
from stdlib import fs
import space
import pathobj
import os
module = Module(u'json', {}, frozen=True)
def builtin(deco):
def _deco_(fn):
name = fn.__name__.rstrip('_').decode('utf-8')
module.setattr_force(name, Builtin(deco(fn), name))
return fn
return _deco_
@builtin(signature(Object, Object, Dict, optional=1))
def write_file(pathname, obj, config):
name = pathobj.os_stringify(pathname).encode('utf-8')
try:
fd = rfile.create_file(name, "wb")
try:
# TODO: sort of defeats the purpose of
# incremental encoder.
fd.write(configured_stringify(obj, config).encode('utf-8'))
fd.write('\n')
finally:
fd.close()
except IOError as error:
message = os.strerror(error.errno).decode('utf-8')
raise OldError(u"%s: %s" % (pathobj.stringify(pathname), message))
return null
@builtin(signature(Object, Dict, optional=1))
def write_string(obj, config):
return space.String(configured_stringify(obj, config))
def configured_stringify(obj, config):
if config is None:
ub = UnicodeBuilder()
quick_stringify(ub, obj)
return ub.build()
margin = space.to_int(get_config(config, u"margin", space.Integer(80)))
scan = Scanner(Printer(margin))
scan.indent = space.to_int(get_config(config, u"indent", space.Integer(2)))
scan.sort_keys = space.is_true(get_config(config, u"sort_keys", space.false))
stringify(scan, obj)
scan.finish()
return scan.printer.result.build()
def get_config(config, text, default):
return config.data.get(space.String(text), default)
def quick_stringify(ub, obj):
if isinstance(obj, space.Dict):
ub.append(u"{")
more = False
for key, value in obj.data.iteritems():
if not isinstance(key, String):
raise unwind(LError(
u"json supports only strings as keys: "
+ key.repr()))
if more:
ub.append(u",")
ub.append(escape_string(key.string))
ub.append(u':')
quick_stringify(ub, value)
more = True
ub.append(u"}")
elif isinstance(obj, space.List):
ub.append(u"[")
more = False
for item in obj.contents:
if more:
ub.append(u",")
quick_stringify(ub, item)
more = True
ub.append(u"]")
elif isinstance(obj, space.String):
ub.append(escape_string(obj.string))
elif isinstance(obj, space.Integer):
ub.append(numbers.integer_to_string(obj.value, 10))
elif isinstance(obj, space.Float):
ub.append(numbers.float_to_string(obj.number))
elif obj is space.null:
ub.append(u"null")
elif obj is space.true:
ub.append(u"true")
elif obj is space.false:
ub.append(u"false")
else:
raise unwind(LError(u"no handler for: " + obj.repr()))
def stringify(scan, obj):
if isinstance(obj, space.Dict):
scan.left().text(u"{").blank(u"", scan.indent)
more = False
if scan.sort_keys:
pairs = []
for key, value in obj.data.iteritems():
if not isinstance(key, String):
raise unwind(LError(
u"json supports only strings as keys: "
+ key.repr()))
pairs.append((key, value))
sorter = JSONKeySort(pairs, len(pairs))
sorter.sort()
for key, value in sorter.list:
if more:
scan.text(u",").blank(u" ", scan.indent)
scan.left()
scan.text(escape_string(key.string)+u': ')
stringify(scan, value)
scan.right()
more = True
else:
for key, value in obj.data.iteritems():
if not isinstance(key, String):
raise unwind(LError(
u"json supports only strings as keys: "
+ key.repr()))
if more:
scan.text(u",").blank(u" ", scan.indent)
scan.left()
scan.text(escape_string(key.string)+u': ')
stringify(scan, value)
scan.right()
more = True
scan.blank(u"", 0).text(u"}").right()
elif isinstance(obj, space.List):
scan.left().text(u"[").blank(u"", scan.indent)
more = False
for item in obj.contents:
if more:
scan.text(u",").blank(u" ", scan.indent)
stringify(scan, item)
more = True
scan.blank(u"", 0).text(u"]").right()
elif isinstance(obj, space.String):
scan.text(escape_string(obj.string))
elif isinstance(obj, space.Integer):
scan.text(numbers.integer_to_string(obj.value, 10))
elif isinstance(obj, space.Float):
scan.text(numbers.float_to_string(obj.number))
elif obj is space.null:
scan.text(u"null")
elif obj is space.true:
scan.text(u"true")
elif obj is space.false:
scan.text(u"false")
else:
raise unwind(LError(u"no handler for: " + obj.repr()))
TimSort = make_timsort_class()
class JSONKeySort(TimSort):
def lt(self, a, b):
return a[0].string < b[0].string
# This is the easiest point of failure in your stringifier program.
def escape_string(string):
out = UnicodeBuilder()
out.append(u'"')
for ch in string:
n = ord(ch)
if 0x20 <= n and n <= 0x7E or 0xFF < n: # remove the last part in cond if you don't want
if ch == u'\\': # unicode printed out for some reason.
ch = u'\\\\'
elif ch == u'"':
ch = u'\\"'
else:
a = u"0123456789abcdef"[n >> 12]
b = u"0123456789abcdef"[n >> 8 & 15]
c = u"0123456789abcdef"[n >> 4 & 15]
d = u"0123456789abcdef"[n & 15]
ch = u'u' + a + b + c + d
ch = u'\\' + character_escapes.get(n, ch)
out.append(ch)
out.append(u'"')
return out.build()
character_escapes = {8: u'b', 9: u't', 10: u'n', 12: u'f', 13: u'r'}
# The scanner runs three line widths before the printer and checks how many
# spaces the blanks and groups take. This allows the printer determine
# whether the line or grouping should be broken into multiple lines.
class Scanner(object):
def __init__(self, printer):
self.printer = printer
self.stream = []
self.stack = []
self.lastblank = None
self.left_total = 1
self.right_total = 1 # makes sure we won't treat the first
# item differently than others.
self.sort_keys = False
self.indent = 2
def left(self):
return self.scan(Left())
def right(self):
return self.scan(Right())
def blank(self, text, indent):
return self.scan(Blank(text, indent))
def text(self, text):
return self.scan(Text(text))
def scan(self, x):
if isinstance(x, Left):
x.size = -self.right_total
self.stack.append(x)
elif isinstance(x, Right):
if len(self.stack) > 0:
self.stack.pop().size += self.right_total
elif isinstance(x, Blank):
if self.lastblank is not None:
self.lastblank.size += self.right_total
self.lastblank = x
x.size = -self.right_total
self.right_total += len(x.text)
elif isinstance(x, Text):
self.right_total += len(x.text)
self.stream.append(x)
while len(self.stream) > 0 and self.right_total - self.left_total > 3*self.printer.margin:
self.left_total += self.printer.scan(self.stream.pop(0))
return self
def finish(self):
if self.lastblank is not None: # Well.. of course.
self.lastblank.size += self.right_total # I didn't figure this out earlier.
while len(self.stream) > 0:
self.printer.scan(self.stream.pop(0))
# Printer keeps the track of layout during printing.
class Printer:
def __init__(self, margin):
self.margin = margin
self.layout = Layout(None, margin, False)
self.spaceleft = margin
self.spaces = margin
self.result = UnicodeBuilder()
def scan(self, x):
if isinstance(x, Left):
self.layout = Layout(self.layout,
self.spaces, x.size < 0 or self.spaceleft < x.size)
elif isinstance(x, Right):
if self.layout.parent:
self.layout = self.layout.parent
elif isinstance(x, Blank):
if x.size < 0 or self.spaceleft < x.size or self.layout.force_break:
self.spaces = self.layout.spaces - x.indent
self.spaceleft = self.spaces
self.result.append(u'\n' + u' '*(self.margin - self.spaces))
else:
self.result.append(x.text)
self.spaceleft -= len(x.text)
elif isinstance(x, Text):
self.result.append(x.text)
self.spaceleft -= len(x.text)
return len(x)
# These small objects are scanner and printer internals.
class Layout(object):
def __init__(self, parent, spaces, force_break):
self.parent = parent
self.spaces = spaces
self.force_break = force_break
# These objects are mutated by the scanner, so they cannot be
# reused. Users of the pretty printer should not create them themselves.
class ScannerToken:
def __len__(self):
return 0
class Text(ScannerToken):
def __init__(self, text):
self.text = text
def __len__(self):
return len(self.text)
class Left(ScannerToken):
def __init__(self):
self.size = 0
class Right(ScannerToken):
pass
class Blank(ScannerToken):
def __init__(self, text, indent=0):
self.text = text
self.indent = indent
self.size = 0
def __len__(self):
return len(self.text)
@builtin(signature(Object))
def read_file(path):
sobj = fs.read_file([path])
assert isinstance(sobj, String)
return read_string(sobj)
@builtin(signature(String))
def read_string(string):
stack = []
ctx = ParserContext()
state = 0x00
for ch in string.string:
cat = catcode[min(ord(ch), 0x7E)]
state = parse_char(cat, ch, stack, state, ctx)
state = parse_char(catcode[32], u' ', stack, state, ctx)
if state != 0x00:
raise unwind(LError(u"JSON decode error: truncated"))
if len(ctx.ds) != 1:
raise unwind(LError(u"JSON decode error: too many objects"))
return ctx.ds.pop()
class ParserContext:
def __init__(self):
self.ds = [] # data stack
self.ss = UnicodeBuilder() # string stack
self.es = UnicodeBuilder() # escape stack
@always_inline
def parse_char(cat, ch, stack, state, ctx):
while True:
code = states[state][cat]
action = code >> 8 & 0xFF
code = code & 0xFF
if action == 0xFF and code == 0xFF:
raise unwind(LError(u"JSON decode error: syntax"))
elif action >= 0x80: # shift
stack.append(gotos[state])
action -= 0x80
if action > 0:
decode_json(action, ch, ctx)
if code == 0xFF:
state = stack.pop()
else:
state = code
return state
@always_inline
def decode_json(action, ch, ctx):
if action == 0x1: # push list
ctx.ds.append(space.List([]))
# Push object to ds
elif action == 0x2: # push object
ctx.ds.append(space.Dict())
elif action == 0x3: # pop & append
val = ctx.ds.pop()
top = ctx.ds[len(ctx.ds)-1]
assert isinstance(top, List) # we can trust this.
top.contents.append(val)
elif action == 0x4: # pop pop & setitem
val = ctx.ds.pop()
key = ctx.ds.pop()
top = ctx.ds[len(ctx.ds)-1]
assert isinstance(top, Dict) # again..
top.data[key] = val
elif action == 0x5: # push null
ctx.ds.append(space.null)
elif action == 0x6: # push true
ctx.ds.append(space.true)
elif action == 0x7: # push false
ctx.ds.append(space.false)
elif action == 0x8: # push string
val = ctx.ss.build()
ctx.ds.append(space.String(val))
ctx.ss = UnicodeBuilder()
ctx.es = UnicodeBuilder()
elif action == 0x9:
val = int(ctx.ss.build().encode('utf-8')) # push int
ctx.ds.append(space.Integer(val))
ctx.ss = UnicodeBuilder()
elif action == 0xA:
val = float(ctx.ss.build().encode('utf-8')) # push float
ctx.ds.append(space.Float(val))
ctx.ss = UnicodeBuilder()
elif action == 0xB: # push ch to ss
ctx.ss.append(ch)
elif action == 0xC: # push ch to es
ctx.es.append(ch)
elif action == 0xD: # push escape
ctx.ss.append(unichr(escape_characters[ch]))
elif action == 0xE: # push unicode point
ctx.ss.append(unichr(int(ctx.es.build().encode('utf-8'), 16)))
ctx.es = UnicodeBuilder()
else: # This is very unlikely to happen.
assert False, "JSON decoder bug"
# Non-trivial escape characters. At worst you can
# 'switch' or 'if/else' them into do_action -function.
escape_characters = {'b': 8, 't': 9, 'n': 10, 'f': 12, 'r': 13}
# generated by build_tables.py program: http://github.com/cheery/json_algorithm
states = [
[ 0xffff, 0x0000, 0x801a, 0xffff, 0xffff, 0x8b29, 0xffff, 0xffff, 0x8b28, 0x8b22, 0xffff, 0xffff, 0xffff, 0x810e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x8009, 0xffff, 0x8001, 0xffff, 0xffff, 0x8005, 0xffff, 0x8212, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0002, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0003, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0004, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, 0x05ff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0006, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0007, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0008, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, 0x06ff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x000a, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x000b, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x000c, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x000d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, ],
[ 0xffff, 0x000e, 0x801a, 0xffff, 0xffff, 0x8b29, 0xffff, 0xffff, 0x8b28, 0x8b22, 0xffff, 0xffff, 0xffff, 0x810e, 0xffff, 0x0011, 0xffff, 0xffff, 0xffff, 0x8009, 0xffff, 0x8001, 0xffff, 0xffff, 0x8005, 0xffff, 0x8212, 0xffff, ],
[ 0xffff, 0x000f, 0xffff, 0xffff, 0x0310, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0311, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0x0010, 0x801a, 0xffff, 0xffff, 0x8b29, 0xffff, 0xffff, 0x8b28, 0x8b22, 0xffff, 0xffff, 0xffff, 0x810e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x8009, 0xffff, 0x8001, 0xffff, 0xffff, 0x8005, 0xffff, 0x8212, 0xffff, ],
[ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, ],
[ 0xffff, 0x0012, 0x801a, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0019, ],
[ 0xffff, 0x0013, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0014, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0x0014, 0x801a, 0xffff, 0xffff, 0x8b29, 0xffff, 0xffff, 0x8b28, 0x8b22, 0xffff, 0xffff, 0xffff, 0x810e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x8009, 0xffff, 0x8001, 0xffff, 0xffff, 0x8005, 0xffff, 0x8212, 0xffff, ],
[ 0xffff, 0x0015, 0xffff, 0xffff, 0x0416, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0419, ],
[ 0xffff, 0x0016, 0x801a, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0x0017, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0018, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0x0018, 0x801a, 0xffff, 0xffff, 0x8b29, 0xffff, 0xffff, 0x8b28, 0x8b22, 0xffff, 0xffff, 0xffff, 0x810e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x8009, 0xffff, 0x8001, 0xffff, 0xffff, 0x8005, 0xffff, 0x8212, 0xffff, ],
[ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, ],
[ 0x0b1a, 0x0b1a, 0x0021, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x001b, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, 0x0b1a, ],
[ 0xffff, 0xffff, 0x0b1a, 0xffff, 0xffff, 0xffff, 0xffff, 0x0b1a, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0b1a, 0xffff, 0xffff, 0x0d1a, 0xffff, 0x0d1a, 0xffff, 0x0d1a, 0x0d1a, 0xffff, 0x0d1a, 0x801c, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0c1d, 0x0c1d, 0xffff, 0x0c1d, 0x0c1d, 0xffff, 0xffff, 0xffff, 0x0c1d, 0x0c1d, 0x0c1d, 0x0c1d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0c1e, 0x0c1e, 0xffff, 0x0c1e, 0x0c1e, 0xffff, 0xffff, 0xffff, 0x0c1e, 0x0c1e, 0x0c1e, 0x0c1e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0c1f, 0x0c1f, 0xffff, 0x0c1f, 0x0c1f, 0xffff, 0xffff, 0xffff, 0x0c1f, 0x0c1f, 0x0c1f, 0x0c1f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0c20, 0x0c20, 0xffff, 0x0c20, 0x0c20, 0xffff, 0xffff, 0xffff, 0x0c20, 0x0c20, 0x0c20, 0x0c20, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, 0x0eff, ],
[ 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, 0x08ff, ],
[ 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x0b23, 0x09ff, 0x0b22, 0x0b22, 0x09ff, 0x09ff, 0x0b25, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x0b25, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0b24, 0x0b24, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0b24, 0x0b24, 0x0aff, 0x0aff, 0x0b25, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0b25, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, ],
[ 0xffff, 0xffff, 0xffff, 0x0b26, 0xffff, 0x0b26, 0xffff, 0xffff, 0x0b27, 0x0b27, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0b27, 0x0b27, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
[ 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0b27, 0x0b27, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, 0x0aff, ],
[ 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x0b23, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x0b25, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x0b25, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, 0x09ff, ],
[ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0b28, 0x0b22, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, ],
]
gotos = [0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 255, 15, 255, 19, 255, 21, 255, 23, 255, 21, 255, 255, 26, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
catcode = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 0, 0, 0, 16, 17, 11, 11, 18, 19, 0, 0, 0, 0, 0, 20, 0, 21, 0, 0, 0, 22, 23, 24, 25, 0, 0, 0, 0, 0, 26, 0, 27, 0]
| 53.890351 | 415 | 0.627289 | 3,170 | 24,574 | 4.822397 | 0.12776 | 0.482763 | 0.639367 | 0.773991 | 0.626218 | 0.594492 | 0.562766 | 0.52332 | 0.499182 | 0.463466 | 0 | 0.140155 | 0.242777 | 24,574 | 455 | 416 | 54.008791 | 0.681374 | 0.055913 | 0 | 0.2975 | 0 | 0 | 0.01965 | 0 | 0 | 0 | 0.308789 | 0.002198 | 0.01 | 1 | 0.0775 | false | 0.0025 | 0.025 | 0.025 | 0.18 | 0.015 | 0 | 0 | 0 | null | 1 | 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 | 3 |
59935cf5ac5bcac69943752420da843164790d60 | 636 | py | Python | employee-management/models/company.py | desitomato/flask-docker | 03dadddfbda478180554f3364e91af41b72dce87 | [
"MIT"
] | null | null | null | employee-management/models/company.py | desitomato/flask-docker | 03dadddfbda478180554f3364e91af41b72dce87 | [
"MIT"
] | null | null | null | employee-management/models/company.py | desitomato/flask-docker | 03dadddfbda478180554f3364e91af41b72dce87 | [
"MIT"
] | null | null | null | from db import db
class CompanyModel(db.Model):
__tablename__ = 'company'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
employee = db.relationship('EmployeeModel', lazy='dynamic')
def __init__(self, name):
self.name = name
def json(self):
return {'id': self.id, 'name': self.name}
@classmethod
def find_by_name(cls, name):
return cls.query.filter_by(name=name).first()
def save_to_db(self):
db.session.add(self)
db.session.commit()
def delete_from_db(self):
db.session.delete(self)
db.session.commit() | 23.555556 | 63 | 0.628931 | 86 | 636 | 4.465116 | 0.465116 | 0.0625 | 0.135417 | 0.078125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004115 | 0.235849 | 636 | 27 | 64 | 23.555556 | 0.786008 | 0 | 0 | 0.105263 | 0 | 0 | 0.051805 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0.052632 | 0.105263 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
59d8a1ab364f363e952024048093b2c910a3c6f3 | 1,126 | py | Python | server/athenian/api/models/web/invitation_link.py | athenianco/athenian-api | dd5556101a8c49703d6b0516e4268b9e8d8eda5b | [
"RSA-MD"
] | 9 | 2020-10-11T22:12:03.000Z | 2022-02-26T02:16:45.000Z | server/athenian/api/models/web/invitation_link.py | athenianco/athenian-api | dd5556101a8c49703d6b0516e4268b9e8d8eda5b | [
"RSA-MD"
] | 246 | 2019-12-05T06:37:30.000Z | 2022-03-29T10:00:07.000Z | server/athenian/api/models/web/invitation_link.py | athenianco/athenian-api | dd5556101a8c49703d6b0516e4268b9e8d8eda5b | [
"RSA-MD"
] | 5 | 2019-12-04T22:38:05.000Z | 2021-02-26T00:50:04.000Z | from athenian.api.models.web.base_model_ import Model
class InvitationLink(Model):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit the class manually.
"""
openapi_types = {"url": str}
attribute_map = {"url": "url"}
def __init__(self, url: str = None):
"""InvitationLink - a model defined in OpenAPI
:param url: The url of this InvitationLink.
"""
self._url = url
@property
def url(self) -> str:
"""Gets the url of this InvitationLink.
Invitation URL. Users are supposed to click it and become regular account members.
:return: The url of this InvitationLink.
"""
return self._url
@url.setter
def url(self, url: str):
"""Sets the url of this InvitationLink.
Invitation URL. Users are supposed to click it and become regular account members.
:param url: The url of this InvitationLink.
"""
if url is None:
raise ValueError("Invalid value for `url`, must not be `None`")
self._url = url
| 26.809524 | 96 | 0.62167 | 144 | 1,126 | 4.784722 | 0.444444 | 0.050798 | 0.058055 | 0.087083 | 0.409289 | 0.371553 | 0.371553 | 0.272859 | 0.272859 | 0.272859 | 0 | 0 | 0.28508 | 1,126 | 41 | 97 | 27.463415 | 0.855901 | 0.479574 | 0 | 0.142857 | 1 | 0 | 0.106339 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.071429 | 0 | 0.571429 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
59ebe22e486f4d486abb233797c8be04a0cfce18 | 614 | py | Python | backend/app/crud/crud_user.py | Ian-Almeida/survey-site | e7846b800f2f3033c0fe9009cdb47568390e5f6d | [
"MIT"
] | null | null | null | backend/app/crud/crud_user.py | Ian-Almeida/survey-site | e7846b800f2f3033c0fe9009cdb47568390e5f6d | [
"MIT"
] | null | null | null | backend/app/crud/crud_user.py | Ian-Almeida/survey-site | e7846b800f2f3033c0fe9009cdb47568390e5f6d | [
"MIT"
] | null | null | null | from .base import CRUDBase
from app.models.user import User, UserCreate, UserUpdate, UserInDB
from pymongo.database import Database
from ..core.auth import get_password_hash
class CRUDUser(CRUDBase[User, UserCreate, UserUpdate]):
def create(self, db: Database, data_in: UserCreate):
to_create = UserInDB(**data_in.__dict__, hashed_password=get_password_hash(data_in.password))
new = db.User.insert_one(to_create.dict(by_alias=True))
if not new:
return None
return db.User.find_one({"_id": new.inserted_id})
crud_user = CRUDUser(User, UserCreate, UserUpdate)
| 29.238095 | 101 | 0.73127 | 84 | 614 | 5.107143 | 0.5 | 0.097902 | 0.167832 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.17101 | 614 | 20 | 102 | 30.7 | 0.842829 | 0 | 0 | 0 | 0 | 0 | 0.004886 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0.166667 | 0.333333 | 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 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
ab7e65e01f133c1c62ef82cc6a830a29d2a3019b | 172 | py | Python | setup.py | thiagokokada/nix-cage | b831a0197efe69ae552182318f553e651474ff96 | [
"Unlicense"
] | 1 | 2021-12-09T05:03:44.000Z | 2021-12-09T05:03:44.000Z | setup.py | thiagokokada/nix-cage | b831a0197efe69ae552182318f553e651474ff96 | [
"Unlicense"
] | null | null | null | setup.py | thiagokokada/nix-cage | b831a0197efe69ae552182318f553e651474ff96 | [
"Unlicense"
] | null | null | null | import setuptools
setuptools.setup(
name="nix-cage",
version="0.1",
description="Sandboxed environments with bwarp and nix-shell",
scripts=["nix-cage"],
)
| 19.111111 | 66 | 0.680233 | 21 | 172 | 5.571429 | 0.809524 | 0.119658 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014085 | 0.174419 | 172 | 8 | 67 | 21.5 | 0.809859 | 0 | 0 | 0 | 0 | 0 | 0.383721 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.142857 | 0 | 0.142857 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ab83afca730c810d46e175c0589087ad541bda1b | 3,257 | py | Python | dci/identity.py | redhat-cip/dci-control-server | 6dee30e7b8770fde2466f2b09554d299a3f3db4d | [
"Apache-2.0"
] | 17 | 2016-09-02T09:21:29.000Z | 2021-09-27T11:33:58.000Z | dci/identity.py | redhat-cip/dci-control-server | 6dee30e7b8770fde2466f2b09554d299a3f3db4d | [
"Apache-2.0"
] | 80 | 2015-12-09T09:29:26.000Z | 2021-01-06T08:24:22.000Z | dci/identity.py | redhat-cip/dci-control-server | 6dee30e7b8770fde2466f2b09554d299a3f3db4d | [
"Apache-2.0"
] | 10 | 2015-09-29T21:34:53.000Z | 2021-09-27T11:34:01.000Z | # -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Red Hat, Inc
#
# 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.
import uuid
class Identity:
def __init__(self, user_info):
self.id = user_info.get('id')
self.password = user_info.get('password', None)
self.name = user_info.get('name', None)
self.fullname = user_info.get('fullname', None)
self.timezone = user_info.get('timezone', None)
self.email = user_info.get('email', None)
self.sso_username = user_info.get('sso_username', None)
self.etag = user_info.get('etag', None)
self._is_user = user_info.get('is_user', False)
self.api_secret = user_info.get('api_secret', '')
self._is_remoteci = user_info.get('is_remoteci', False)
self._is_feeder = user_info.get('is_feeder', False)
# user_info['teams'] = {'<team-id1>': {'id': <id>,
# 'name': <name>,
# 'etag': <etag>,
# '<team-id2>: {...}}
self.teams = user_info.get('teams', {})
self.teams_ids = list(self.teams.keys())
self._is_super_admin = user_info.get('is_super_admin', False)
self._is_read_only_user = user_info.get('is_read_only_user', False)
self._is_epm_user = user_info.get('is_epm_user', False)
def is_super_admin(self):
"""Ensure the user is SUPER_ADMIN."""
return self._is_super_admin
def is_not_super_admin(self):
"""Ensure the user is not SUPER_ADMIN."""
return not self.is_super_admin()
def is_epm(self):
"""Ensure the user is EPM"""
return self._is_epm_user or self.is_super_admin()
def is_not_epm(self):
"""Ensure the user is not EPM"""
return not self.is_epm()
def is_read_only_user(self):
"""Check if the user is a rh employee."""
return self._is_read_only_user
def is_not_read_only_user(self):
"""Check if the user is not a read only user."""
return not self.is_read_only_user()
def is_in_team(self, team_id):
"""Test if user is in team"""
if self.is_super_admin() or self.is_epm():
return True
team_id = uuid.UUID(str(team_id))
return team_id in self.teams
def is_not_in_team(self, team_id):
"""Test if user is not in team"""
return not self.is_in_team(team_id)
def is_user(self):
return self._is_user
def is_remoteci(self):
return self._is_remoteci
def is_not_remoteci(self):
return not self.is_remoteci()
def is_feeder(self):
return self._is_feeder
def is_not_feeder(self):
return not self.is_feeder()
| 31.621359 | 75 | 0.621431 | 475 | 3,257 | 4.010526 | 0.24 | 0.066142 | 0.092388 | 0.040945 | 0.250919 | 0.180052 | 0.142782 | 0.062992 | 0.062992 | 0 | 0 | 0.004587 | 0.26374 | 3,257 | 102 | 76 | 31.931373 | 0.789825 | 0.312558 | 0 | 0 | 0 | 0 | 0.061927 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.020408 | 0.020408 | 0.102041 | 0.612245 | 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 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.