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
3381bce7b28f53feb9789c93d7c88a32fa091141
351
py
Python
tests/conftest.py
roshni-b/cidc-cli
c457a6389da040e964eb8dc919a93fd002df0fdb
[ "MIT" ]
2
2019-04-05T17:31:13.000Z
2020-04-20T23:47:54.000Z
tests/conftest.py
roshni-b/cidc-cli
c457a6389da040e964eb8dc919a93fd002df0fdb
[ "MIT" ]
16
2019-02-19T14:38:04.000Z
2021-06-16T18:07:51.000Z
tests/conftest.py
roshni-b/cidc-cli
c457a6389da040e964eb8dc919a93fd002df0fdb
[ "MIT" ]
3
2020-09-10T01:54:17.000Z
2022-02-15T17:55:01.000Z
#!/usr/bin/env python """ Configuration file for pytest. """ __author__ = "Lloyd McCarthy" __license__ = "MIT" import sys from os.path import abspath, dirname import pytest from click.testing import CliRunner PACKAGE_PATH = abspath(dirname(dirname(__file__))) sys.path.insert(0, PACKAGE_PATH) @pytest.fixture def runner(): return CliRunner()
16.714286
50
0.752137
46
351
5.434783
0.652174
0.112
0
0
0
0
0
0
0
0
0
0.003289
0.133903
351
20
51
17.55
0.819079
0.145299
0
0
0
0
0.058219
0
0
0
0
0
0
1
0.090909
false
0
0.363636
0.090909
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3386295c4d12ed25121e563f298caaf00b67c09f
3,174
py
Python
chainer/functions/connection/dilated_convolution_2d.py
Evanc123/chainer
929af7189b1271683200aa9b0ba6da2dd3dee110
[ "MIT" ]
null
null
null
chainer/functions/connection/dilated_convolution_2d.py
Evanc123/chainer
929af7189b1271683200aa9b0ba6da2dd3dee110
[ "MIT" ]
2
2019-05-14T15:45:01.000Z
2019-05-15T07:12:49.000Z
chainer/functions/connection/dilated_convolution_2d.py
Evanc123/chainer
929af7189b1271683200aa9b0ba6da2dd3dee110
[ "MIT" ]
null
null
null
from chainer.functions.connection import convolution_2d def dilated_convolution_2d(x, W, b=None, stride=1, pad=0, dilate=1, cover_all=False): """Two-dimensional dilated convolution function. This is an implementation of two-dimensional dilated convolution in ConvNets. It takes three variables: the input image ``x``, the filter weight ``W``, and the bias vector ``b``. .. note:: You can also perform dilated convolution by passing ``dilate`` argument to :class:`chainer.functions.convolution_2d`. The functionality is the same. Notation: here is a notation for dimensionalities. - :math:`n` is the batch size. - :math:`c_I` and :math:`c_O` are the number of the input and output, respectively. - :math:`h` and :math:`w` are the height and width of the input image, respectively. - :math:`k_H` and :math:`k_W` are the height and width of the filters, respectively. Args: x (~chainer.Variable): Input variable of shape :math:`(n, c_I, h, w)`. W (~chainer.Variable): Weight variable of shape :math:`(c_O, c_I, k_H, k_W)`. b (~chainer.Variable): Bias variable of length :math:`c_O` (optional). stride (int or pair of ints): Stride of filter applications. ``stride=s`` and ``stride=(s, s)`` are equivalent. pad (int or pair of ints): Spatial padding width for input arrays. ``pad=p`` and ``pad=(p, p)`` are equivalent. dilate (int or pair of ints): Dilation factor of filter applications. ``dilate=d`` and ``dilate=(d, d)`` are equivalent. cover_all (bool): If ``True``, all spatial locations are convoluted into some output pixels. It may make the output size larger. Returns: ~chainer.Variable: Output variable. The two-dimensional dilated convolution function is defined as follows. Then the ``DilatedConvolution2D`` function computes correlations between filters and patches of size :math:`(k_H, k_W)` in ``x``. Patches here are extracted at intervals of the dilation factor. Note that correlation here is equivalent to the inner product between expanded vectors. Patches are extracted at intervals of the dilation factor and at positions shifted by multiples of ``stride`` from the first position ``-pad`` for each spatial axis. The right-most (or bottom-most) patches do not run over the padded spatial size. Let :math:`(s_Y, s_X)` be the stride of filter application, :math:`(p_H, p_W)` the spatial padding size, and :math:`(d_Y, d_X)` the dilation factor of filter application. Then, the output size :math:`(h_O, w_O)` is determined by the following equations: .. math:: h_O &= (h + 2p_H - k_H - (k_H - 1) * (d_Y - 1)) / s_Y + 1,\\\\ w_O &= (w + 2p_W - k_W - (k_W - 1) * (d_X - 1)) / s_X + 1. If the bias vector is given, then it is added to all spatial locations of the output of convolution. """ return convolution_2d.convolution_2d(x, W, b, stride, pad, cover_all, dilate=dilate)
44.083333
79
0.643982
470
3,174
4.261702
0.321277
0.014978
0.031453
0.047928
0.146281
0.067898
0.067898
0.067898
0
0
0
0.007152
0.251103
3,174
71
80
44.704225
0.835507
0.836169
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
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
0
0
0
0
1
0
0
2
33874751bbafdac9ff9f33f279e2efc7cc9af3e1
1,167
py
Python
tests/issues/issue_271.py
wjlei1990/radical.saga
de022ea4fb29d95e8acffff8a68aa8648de807d4
[ "MIT" ]
12
2019-04-13T21:41:45.000Z
2021-08-03T09:43:25.000Z
tests/issues/issue_271.py
wjlei1990/radical.saga
de022ea4fb29d95e8acffff8a68aa8648de807d4
[ "MIT" ]
103
2019-04-10T14:23:41.000Z
2022-03-15T19:43:56.000Z
tests/issues/issue_271.py
wjlei1990/radical.saga
de022ea4fb29d95e8acffff8a68aa8648de807d4
[ "MIT" ]
7
2019-07-11T07:59:56.000Z
2022-02-02T22:28:24.000Z
import os import sys import radical.saga as saga def main(): """This code fails consistently after 16 copy opertaions: Copied file 0 Copied file 1 Copied file 2 Copied file 3 Copied file 4 Copied file 5 Copied file 6 Copied file 7 Copied file 8 Copied file 9 Copied file 10 Copied file 11 Copied file 12 Copied file 13 Copied file 14 Copied file 15 """ try: for t in range(0, 32): f = saga.filesystem.File("sftp://login1.stampede.tacc.utexas.edu//etc/passwd") f.copy("file://localhost//tmp/passwd-%s" % t) print("Copied file %s" % t) f.close() return 0 except saga.SagaException as ex: # Catch all saga exceptions print("An exception occured: (%s) %s " % (ex.type, (str(ex)))) # Trace back the exception. That can be helpful for debugging. print(" \n*** Backtrace:\n %s" % ex.traceback) return -1 if __name__ == "__main__": sys.exit(main())
24.3125
90
0.520994
147
1,167
4.081633
0.55102
0.283333
0
0
0
0
0
0
0
0
0
0.042135
0.389889
1,167
47
91
24.829787
0.800562
0.319623
0
0
0
0
0.263605
0.137755
0
0
0
0
0
1
0.058824
false
0.117647
0.176471
0
0.352941
0.176471
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
0
0
1
0
0
0
0
0
2
339daa726b474f0d3df5b3d46cc5751b1a39f304
12,424
py
Python
pyemm/ElementProperties.py
drix00/pyelectronmicroscopymodeling
6a6d3bd174a8d6092332b59cae55c6b71dbba6d9
[ "Apache-2.0" ]
null
null
null
pyemm/ElementProperties.py
drix00/pyelectronmicroscopymodeling
6a6d3bd174a8d6092332b59cae55c6b71dbba6d9
[ "Apache-2.0" ]
1
2020-06-18T00:00:45.000Z
2020-06-18T00:00:45.000Z
pyemm/ElementProperties.py
drix00/pyelectronmicroscopymodeling
6a6d3bd174a8d6092332b59cae55c6b71dbba6d9
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python """ """ # Script information for the file. __author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)" __version__ = "" __date__ = "" __copyright__ = "Copyright (c) 2007 Hendrix Demers" __license__ = "" # Subversion informations for the file. __svnRevision__ = "$Revision: 2146 $" __svnDate__ = "$Date: 2011-01-03 07:32:06 -0500 (Mon, 03 Jan 2011) $" __svnId__ = "$Id: ElementProperties.py 2146 2011-01-03 12:32:06Z hdemers $" # Standard library modules. import math # Third party modules. # Local modules. # Globals and constants variables. g_AvogadroNumber_atom_mol = 6.02205E23 g_elementSymbol = [ "H" , "He" , "Li" , "Be" , "B" , "C" , "N" , "O" , "F" , "Ne" , "Na" , "Mg" , "Al" , "Si" , "P" , "S" , "Cl" , "Ar" , "K" , "Ca" , "Sc" , "Ti" , "V" , "Cr" , "Mn" , "Fe" , "Co" , "Ni" , "Cu" , "Zn" , "Ga" , "Ge" , "As" , "Se" , "Br" , "Kr" , "Rb" , "Sr" , "Y" , "Zr" , "Nb" , "Mo" , "Tc" , "Ru" , "Rh" , "Pd" , "Ag" , "Cd" , "In" , "Sn" , "Sb" , "Te" , "I" , "Xe" , "Cs" , "Ba" , "La" , "Ce" , "Pr" , "Nd" , "Pm" , "Sm" , "Eu" , "Gd" , "Tb" , "Dy" , "Ho" , "Er" , "Tm" , "Yb" , "Lu" , "Hf" , "Ta" , "W" , "Re" , "Os" , "Ir" , "Pt" , "Au" , "Hg" , "Tl" , "Pb" , "Bi" , "Po" , "At" , "Rn" , "Fr" , "Ra" , "Ac" , "Th" , "Pa" , "U" , "Np" , "Pu" , "Am" , "Cm" , "Bk" , "Cf" , "Es" , "Fm" , "Md" , "No" , "Lr" , "Unq" , "Unp" , "Unh"] g_elementName = [ "Hydrogen" , "Helium" , "Lithium" , "Beryllium" , "Boron" , "Carbon" , "Nitrogen" , "Oxygen" , "Fluorine" , "Neon" , "Sodium" , "Magnesium" , "Aluminium" , "Silicon" , "Phosphorus" , "Sulfur" , "Chlorine" , "Argon" , "Potassium" , "Calcium" , "Scandium" , "Titanium" , "Vanadium" , "Chromium" , "Manganese" , "Iron" , "Cobalt" , "Nickel" , "Copper" , "Zinc" , "Gallium" , "Germanium" , "Arsenic" , "Selenium" , "Bromine" , "Krypton" , "Rubidium" , "Strontium" , "Yttrium" , "Zirconium" , "Niobium" , "Molybdenum" , "Technetium" , "Ruthenium" , "Rhodium" , "Palladium" , "Silver" , "Cadmium" , "Indium" , "Tin" , "Antimony" , "Tellurium" , "Iodine" , "Xenon" , "Cesium" , "Barium" , "Lanthanum" , "Cerium" , "Praseodymium" , "Neodymium" , "Promethium" , "Samarium" , "Europium" , "Gadolinium" , "Terbium" , "Dysprosium" , "Holmium" , "Erbium" , "Thulium" , "Ytterbium" , "Lutetium" , "Hafnium" , "Tantalum" , "Tungsten" , "Rhenium" , "Osmium" , "Iridium" , "Platinum" , "Gold" , "Mercury" , "Thallium" , "Lead" , "Bismuth" , "Polonium" , "Astatine" , "Radon" , "Francium" , "Radium" , "Actinium" , "Thorium" , "Protactinium" , "Uranium" , "Neptunium" , "Plutonium" , "Americium" , "Curium" , "Berkelium" , "Californium" , "Einsteinium" , "Fermium" , "Mendelevium" , "Nobelium" , "Lawrencium" , "Unnilquadium" , "Unnilpentium" , "Unnilhexium"] """ * Mass density of element in atomic number order. * * For elment H to Cm (1--96). * * In \f$ \gram\per\centi\meter^{3} \f$. * * From: Tableau periodique des elements, Sargent-Welch scientifique Canada * Limitee. * * @note Element Z = 85 and 87 set to 1 for the calculation. """ g_massDensity_g_cm3 = [ 0.0899, 0.1787, 0.5300, 1.8500, 2.3400, 2.6200, 1.2510, 1.4290, 1.6960, 0.9010, 0.9700, 1.7400, 2.7000, 2.3300, 1.8200, 2.0700, 3.1700, 1.7840, 0.8600, 1.5500, 3.0000, 4.5000, 5.8000, 7.1900, 7.4300, 7.8600, 8.9000, 8.9000, 8.9600, 7.1400, 5.9100, 5.3200, 5.7200, 4.8000, 3.1200, 3.7400, 1.5300, 2.6000, 4.5000, 6.4900, 8.5500, 10.200, 11.500, 12.200, 12.400, 12.000, 10.500, 8.6500, 7.3100, 7.3000, 6.6800, 6.2400, 4.9200, 5.8900, 1.8700, 3.5000, 6.7000, 6.7800, 6.7700, 7.0000, 6.4750, 7.5400, 5.2600, 7.8900, 8.2700, 8.5400, 8.8000, 9.0500, 9.3300, 6.9800, 9.8400, 13.100, 16.600, 19.300, 21.000, 22.400, 22.500, 21.400, 19.300, 13.530, 11.850, 11.400, 9.8000, 9.4000, 1.0000, 9.9100, 1.0000, 5.0000, 10.070, 11.700, 15.400, 18.900, 20.400, 19.800, 13.600, 13.511 ] """ * Atomic weight of element in atomic number order. * * For element H to Sg (1--106). * * Unit \f$ \gram\per\mole \f$. * * From: Tableau periodique des elements, Sargent-Welch scientifique Canada * Limitee. """ g_atomicMass_g_mol = [ 1.0079000, 4.0026000, 6.9410000, 9.0121800, 10.810000, 12.011000, 14.006700, 15.999400, 18.998403, 20.179000, 22.989770, 24.305000, 26.981540, 28.085500, 30.973760, 32.060000, 35.453000, 39.948000, 39.098300, 40.080000, 44.955900, 47.900000, 50.941500, 51.996000, 54.938000, 55.847000, 58.933200, 58.700000, 63.546000, 65.380000, 69.720000, 72.590000, 74.921600, 78.960000, 79.904000, 83.800000, 85.467800, 87.620000, 88.905600, 91.220000, 92.906400, 95.940000, 98.000000, 101.07000, 102.90550, 106.40000, 107.86800, 112.41000, 114.82000, 118.69000, 121.75000, 127.60000, 126.90450, 131.30000, 132.90540, 137.33000, 138.90550, 140.12000, 140.90770, 144.24000, 145.00000, 150.40000, 151.96000, 157.25000, 158.92540, 162.50000, 164.93040, 167.26000, 168.93420, 173.04000, 174.96700, 178.49000, 180.94790, 183.85000, 186.20700, 190.20000, 192.22000, 195.09000, 196.96650, 200.59000, 204.37000, 207.20000, 208.98040, 209.00000, 210.00000, 222.00000, 223.00000, 226.02540, 227.02780, 232.03810, 231.03590, 238.02900, 237.04820, 244.00000, 243.00000, 247.00000, 247.00000, 251.00000, 252.00000, 257.00000, 258.00000, 259.00000, 260.00000, 261.00000, 262.00000, 263.00000 ] """ * Fermi energy of element in atomic number order. * * For element H to Lr (1--103). * From: CASINO source code, DOS version. * * @todo Add units. """ g_FermiEnergy = [ 1.000, 1.000, 4.700, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 3.100, 1.000, 1.000, 0.555, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 7.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 5.500, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 5.500, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 0.000, 1.000, 1.000, 1.000, 1.000 ] """ * Fermi wavelength of element in atomic number order. * * For element H to Lr (1--103). * From: CASINO source code, DOS version. * * @todo Add units. """ g_kFermi = [ 7.00E7, 7.00E7, 1.10E8, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 9.00E7, 7.00E7, 7.00E7, 4.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 1.35E8, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 1.19E8, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 1.19E8, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 7.00E7, 0.00E0, 7.00E7, 7.00E7, 7.00E7, 7.00E7 ] """ * Plasmon energy of element in atomic number order. * * For element H to Lr (1--103). * From: CASINO source code, DOS version. * * @todo Add units. """ g_plasmonEnergy = [ 15.0, 15.0, 7.10, 18.7, 22.7, 15.0, 15.0, 15.0, 15.0, 15.0, 5.70, 10.3, 15.0, 16.7, 15.0, 15.0, 15.0, 15.0, 3.70, 8.80, 14.0, 17.9, 21.8, 24.9, 21.6, 23.0, 20.9, 20.7, 19.3, 17.2, 13.8, 16.2, 15.0, 15.0, 15.0, 15.0, 3.41, 8.00, 12.5, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 19.2, 15.0, 13.4, 15.2, 17.0, 11.4, 15.0, 2.90, 7.20, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 13.3, 15.0, 15.0, 14.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 35.0, 15.0, 15.0, 15.0, 13.0, 14.2, 15.0, 15.0, 15.0, 15.0, 15.0, 25.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0 ] def getMassDensity_g_cm3(atomicNumber): index = atomicNumber - 1 return g_massDensity_g_cm3[index] def getAtomicMass_g_mol(atomicNumber): index = atomicNumber - 1 return g_atomicMass_g_mol[index] def getFermiEnergy_eV(atomicNumber): index = atomicNumber - 1 return g_FermiEnergy[index] def getKFermi_eV(atomicNumber): index = atomicNumber - 1 return g_kFermi[index] def getPlasmonEnergy_eV(atomicNumber): index = atomicNumber - 1 return g_plasmonEnergy[index] def getMeanIonizationEnergy_eV(atomicNumber): """ * Get the mean ionization potential from the atomic number. * * In \f$ \electronvolt \f$. * * @param[in] atomicNumber Atomic number. """ if atomicNumber <= 13.0: Value = 11.5 * atomicNumber else: if math.pow(atomicNumber, 0.19) > 0.0: Value = 9.76 * atomicNumber + 58.8 / math.pow(atomicNumber, 0.19) else: Value = 0.0 return Value def getKRatioCorrection(atomicNumber): """ * Get the constant k ratio correction needed by the mean ionization potential * from the atomic number. * * @param[in] atomicNumber Atomic number. """ Value = 0.734 * math.pow(atomicNumber, 0.037); return Value def getKRatioCorrectionMonsel(atomicNumber, workFunction_keV): """ /// K value as defined by Monsel. /// Used in DE/DS calculation. Casino uses K Gauvin,but for low energy, /// JR Lowney says that this one is more appropriate (and by experience, /// it is effectively better for the secondary yield). /// <p> NOTE : Depends on J (ionisation potential). So it must already be calculated before. /// @param element Element for whom we want to calculate the K value. /// @return The K value of the element passed in argument """ value = (0.8576 - (workFunction_keV + 1.0e-3) / getMeanIonizationEnergy_eV(atomicNumber)) return value def computeAtomicDensity_atom_cm3(massDensity_g_cm3, atomicMass_g_mol): """ * Compute the atomic density. * * \f[ * n_{i} = \frac{N_{A} \rho_{i}}{A_{i}} * \f] * where * - \f$ n_{i} \f$ is the atomic density in \f$ \mathrm{atoms}\per\centi\meter^{3} \f$ * - \f$ N_{A} \f$ is the Avogadro number in \f$ \mathrm{atoms}\per\mole \f$ * - \f$ \rho_{i} \f$ is the mass density in \f$ \gram\per\centi\meter^{3} \f$ * - \f$ A_{i} \f$ is the atomic mass in \f$ \gram\per\mole \f$ * * \param[in] massDensity_g_cm3 * \param[in] atomicMass_g_mol """ return g_AvogadroNumber_atom_mol * massDensity_g_cm3 / atomicMass_g_mol def getSymbol(atomicNumber): index = int(atomicNumber - 1) return g_elementSymbol[index] def getName(atomicNumber): index = atomicNumber - 1 return g_elementName[index] def getAtomicNumberBySymbol(symbol): try: return g_elementSymbol.index(symbol.capitalize()) + 1 except ValueError: raise ValueError('Invalid symbol: ' + symbol) def getAtomicNumberByName(name): try: return g_elementName.index(name.capitalize()) + 1 except ValueError: raise ValueError('Invalid name: ' + name) def getAtomicNumber(atomicNumber=None, name=None, symbol=None): if atomicNumber != None: return int(atomicNumber) elif name != None: return getAtomicNumberByName(name) elif symbol != None: return getAtomicNumberBySymbol(symbol) def runAtomicNumberSymbol(): atomicNumbers = range(1, 92 + 1, 1) for atomicNumber in atomicNumbers: symbol = getSymbol(atomicNumber) print("%s" % (symbol)) if __name__ == '__main__': #pragma: no cover runAtomicNumberSymbol()
31.532995
93
0.579845
1,940
12,424
3.660309
0.362371
0.054077
0.08872
0.099141
0.324039
0.292635
0.266441
0.231798
0.208281
0.20138
0
0.274153
0.23519
12,424
393
94
31.613232
0.473164
0.111075
0
0.104089
0
0.003717
0.128169
0.003143
0
0
0
0.007634
0
1
0.055762
false
0
0.003717
0
0.118959
0.003717
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
33a6ca66e0f098738724507ff6893baa04f6cc03
992
py
Python
src/production_file.py
AfricasVoices/Project-ICRAF
daa53a405df1572d6815acc551c07cd80bc86953
[ "MIT" ]
null
null
null
src/production_file.py
AfricasVoices/Project-ICRAF
daa53a405df1572d6815acc551c07cd80bc86953
[ "MIT" ]
15
2019-03-18T13:20:17.000Z
2020-06-16T11:54:58.000Z
src/production_file.py
AfricasVoices/Project-ICRAF
daa53a405df1572d6815acc551c07cd80bc86953
[ "MIT" ]
null
null
null
from core_data_modules.traced_data.io import TracedDataCSVIO from src.lib import PipelineConfiguration class ProductionFile(object): @staticmethod #TODO: Generate production file per episode def generate(data, production_csv_output_path): production_keys = ["uid"] for plan in PipelineConfiguration.RQA_CODING_PLANS: if plan.raw_field not in production_keys: production_keys.append(plan.raw_field) for plan in PipelineConfiguration.FOLLOW_UP_CODING_PLANS: if plan.raw_field not in production_keys: production_keys.append(plan.raw_field) for plan in PipelineConfiguration.DEMOGS_CODING_PLANS: if plan.raw_field not in production_keys: production_keys.append(plan.raw_field) with open(production_csv_output_path, "w") as f: TracedDataCSVIO.export_traced_data_iterable_to_csv(data, f, headers=production_keys) return data
41.333333
96
0.707661
121
992
5.512397
0.421488
0.167916
0.107946
0.134933
0.431784
0.431784
0.431784
0.431784
0.431784
0.431784
0
0
0.237903
992
23
97
43.130435
0.882275
0.042339
0
0.333333
1
0
0.004215
0
0
0
0
0.043478
0
1
0.055556
false
0
0.111111
0
0.277778
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
1
0
0
0
0
0
0
0
0
0
0
2
33adba1bef88a691d7afb350d40b7e88bf5c35ff
1,730
py
Python
tests/BaseTestClass.py
mihudec/netcm
380786793e35206cae923e613458be9eb9f0a02e
[ "MIT" ]
null
null
null
tests/BaseTestClass.py
mihudec/netcm
380786793e35206cae923e613458be9eb9f0a02e
[ "MIT" ]
null
null
null
tests/BaseTestClass.py
mihudec/netcm
380786793e35206cae923e613458be9eb9f0a02e
[ "MIT" ]
1
2021-08-09T06:33:28.000Z
2021-08-09T06:33:28.000Z
import sys import pathlib import unittest import yaml from net_models.models.BaseModels import BaseNetModel, VendorIndependentBaseModel from net_models.utils import get_logger class TestBaseNetModel(unittest.TestCase): LOGGER = get_logger(name="NetCm-Tests", verbosity=5) TEST_CLASS = BaseNetModel def test_subclasses_basemodel(self): self.assertTrue(issubclass(self.TEST_CLASS, BaseNetModel)) def test_has_dict_method(self): self.assertTrue(hasattr(self.TEST_CLASS, "__dict__")) def test_has_validators(self): self.assertTrue(hasattr(self.TEST_CLASS, "__validators__")) def load_yaml(self, path: pathlib.Path): return yaml.safe_load(path.read_text()) class TestVendorIndependentBase(TestBaseNetModel): TEST_CLASS = VendorIndependentBaseModel RESOURCE_DIR = pathlib.Path(__file__).resolve().parent.joinpath("resources") def test_has_resource_dir(self): # print(f"RESOURCE_DIR for {model.__class__.__name__}: {model.RESOURCE_DIR}") self.assertIsInstance(self.RESOURCE_DIR, pathlib.Path) def get_resource_yaml(self): resource_files = [x for x in self.RESOURCE_DIR.joinpath("data").iterdir() if x.is_file and x.suffix in [".yml"] and x.stem.startswith(self.__class__.__name__)] return resource_files def test_load_yaml(self): resource_files = self.get_resource_yaml() for resource_file in resource_files: with self.subTest(msg=resource_file.stem): test_data = self.load_yaml(path=resource_file) test_obj = self.TEST_CLASS.parse_obj(test_data) self.assertIsInstance(test_obj, BaseNetModel) if __name__ == '__main__': unittest.main()
35.306122
167
0.727168
215
1,730
5.460465
0.330233
0.045997
0.044293
0.040886
0.112436
0.064736
0.064736
0
0
0
0
0.000702
0.176301
1,730
49
168
35.306122
0.823158
0.043353
0
0
0
0
0.035067
0
0
0
0
0
0.147059
1
0.205882
false
0
0.176471
0.029412
0.617647
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
33baf6a45bf01ece18040b38b4ade97b7e433cad
2,131
py
Python
web_logic/user_manipulator.py
teddy4445/lecture_website_app_generator
cd5d3b290ad1bbb7e1b1791de84163a85a237969
[ "MIT" ]
4
2020-08-26T08:30:14.000Z
2020-11-11T14:47:04.000Z
web_logic/user_manipulator.py
teddy4445/lecture_website_app_generator
cd5d3b290ad1bbb7e1b1791de84163a85a237969
[ "MIT" ]
34
2020-08-26T14:39:40.000Z
2020-12-16T15:24:03.000Z
web_logic/user_manipulator.py
lecture-developer/lecture_website_app_generator
cd5d3b290ad1bbb7e1b1791de84163a85a237969
[ "MIT" ]
2
2020-08-17T08:31:27.000Z
2020-08-29T20:06:51.000Z
import zipfile import sys import os from web_logic.github_pages_manager import GithubPagesManager def create_new_user(user_name) -> None: # TODO: insert user to DB pass manager = GithubPagesManager() dir_path = '\\'.join([manager.users_websites_folder, user_name]) try: # create new folder for the user in the users directory os.mkdir(dir_path) # download template code into the user's directory manager.login(user_name='username', password='password') manager.download_template(dir_path) file_path = '' # get the zip file path for file in os.listdir(dir_path): if file.endswith('.zip'): file_path = '\\'.join([dir_path, file]) if file_path != '': # extract files from zip with zipfile.ZipFile(file_path, 'r') as zip_ref: zip_ref.extractall(dir_path) os.remove(file_path) # get data from user # TODO: get the data from the user data = {'f1.txt': 'dude', 'f2.txt': 'dude2'} # update local user's directory for file_name, content in data.items(): # create the path to the file inside the user's directory file_path = '/'.join([dir_path, file_name]) with open(file_path, 'w') as f: f.write(content) # TODO: continue to git... pass except Exception as e: print(e, file=sys.stderr) def update_user_data(user_name): # get the path to folder of the user from the users directory dir_path = '/'.join([GithubPagesManager.users_websites_folder, user_name]) # get data from user # TODO: get the data from the user data = {'f1.txt': 'dude3', 'f2.txt': 'dude21'} # update local user's directory for file_name, content in data.items(): # create the path to the file inside the user's directory file_path = '/'.join([dir_path, file_name]) with open(file_path, 'w') as f: f.write(content) print(f'file updated: {f.name}') # TODO: continue to git... pass
30.014085
78
0.60535
290
2,131
4.306897
0.282759
0.064051
0.056045
0.040833
0.428343
0.351481
0.333066
0.333066
0.333066
0.333066
0
0.005295
0.290943
2,131
70
79
30.442857
0.82131
0.26138
0
0.297297
0
0
0.061657
0
0
0
0
0.014286
0
1
0.054054
false
0.108108
0.108108
0
0.162162
0.054054
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
1
0
0
0
0
0
2
33c542fcfdf590fbe09ccf67068ebbb02520a7e1
4,981
py
Python
characters/models.py
Guilehm/marvel-api
3bbdc22eedca4fcd0aa7305d8ee261966a207cdd
[ "MIT" ]
null
null
null
characters/models.py
Guilehm/marvel-api
3bbdc22eedca4fcd0aa7305d8ee261966a207cdd
[ "MIT" ]
35
2019-02-13T23:05:01.000Z
2019-02-19T23:49:49.000Z
characters/models.py
Guilehm/marvel-api
3bbdc22eedca4fcd0aa7305d8ee261966a207cdd
[ "MIT" ]
null
null
null
from django.contrib.postgres.fields import JSONField from django.db import models from marvel.settings import BASE_URL class Character(models.Model): id = models.CharField(primary_key=True, max_length=50) name = models.CharField(max_length=255) description = models.TextField(null=True, blank=True) resource_uri = models.URLField(null=True, blank=True) data = JSONField(null=True, blank=True) comics = models.ManyToManyField( 'characters.Comic', related_name='characters', blank=True, through='CharacterComic', through_fields=('character', 'comic') ) series = models.ManyToManyField( 'characters.Series', related_name='characters', blank=True, through='CharacterSeries', through_fields=('character', 'series') ) events = models.ManyToManyField( 'characters.Event', related_name='characters', blank=True, through='CharacterEvent', through_fields=('character', 'event') ) stories = models.ManyToManyField( 'characters.Story', related_name='characters', blank=True, through='CharacterStory', through_fields=('character', 'story') ) date_added = models.DateTimeField(auto_now_add=True) date_changed = models.DateTimeField(auto_now=True) def __str__(self): return f'{self.name}' def get_resource_uri(self, resource_name, api_version='v1'): base_url = BASE_URL.format(api_version=api_version) return f'{base_url}characters/{self.id}/{resource_name}' @property def thumbnail_url(self): try: thumb = self.data['thumbnail'] path, extension = thumb.values() filename = path.rpartition('/')[-1] if filename != 'image_not_available': return f"{path}.{extension}" except (IndexError, TypeError): return class CharacterComic(models.Model): character = models.ForeignKey('characters.Character', on_delete=models.CASCADE) comic = models.ForeignKey('characters.Comic', on_delete=models.CASCADE) date_added = models.DateTimeField(auto_now_add=True) date_changed = models.DateTimeField(auto_now=True) class CharacterSeries(models.Model): character = models.ForeignKey('characters.Character', on_delete=models.CASCADE) series = models.ForeignKey('characters.Series', on_delete=models.CASCADE) date_added = models.DateTimeField(auto_now_add=True) date_changed = models.DateTimeField(auto_now=True) class CharacterEvent(models.Model): character = models.ForeignKey('characters.Character', on_delete=models.CASCADE) event = models.ForeignKey('characters.Event', on_delete=models.CASCADE) date_added = models.DateTimeField(auto_now_add=True) date_changed = models.DateTimeField(auto_now=True) class CharacterStory(models.Model): character = models.ForeignKey('characters.Character', on_delete=models.CASCADE) story = models.ForeignKey('characters.Story', on_delete=models.CASCADE) date_added = models.DateTimeField(auto_now_add=True) date_changed = models.DateTimeField(auto_now=True) class Comic(models.Model): id = models.CharField(primary_key=True, max_length=50) name = models.CharField(max_length=255) resource_uri = models.URLField(null=True, blank=True) data = JSONField(null=True, blank=True) date_added = models.DateTimeField(auto_now_add=True) date_changed = models.DateTimeField(auto_now=True) def __str__(self): return f'{self.name}' class Series(models.Model): id = models.CharField(primary_key=True, max_length=50) name = models.CharField(max_length=255) resource_uri = models.URLField(null=True, blank=True) data = JSONField(null=True, blank=True) date_added = models.DateTimeField(auto_now_add=True) date_changed = models.DateTimeField(auto_now=True) def __str__(self): return f'{self.name}' class Meta: verbose_name_plural = 'series' class Event(models.Model): id = models.CharField(primary_key=True, max_length=50) name = models.CharField(max_length=255) resource_uri = models.URLField(null=True, blank=True) data = JSONField(null=True, blank=True) date_added = models.DateTimeField(auto_now_add=True) date_changed = models.DateTimeField(auto_now=True) def __str__(self): return f'{self.name}' class Story(models.Model): id = models.CharField(primary_key=True, max_length=50) name = models.CharField(max_length=255, null=True, blank=True) type = models.CharField(max_length=255) resource_uri = models.URLField(null=True, blank=True) data = JSONField(null=True, blank=True) date_added = models.DateTimeField(auto_now_add=True) date_changed = models.DateTimeField(auto_now=True) def __str__(self): return f'{self.name}' class Meta: verbose_name_plural = 'stories'
32.555556
83
0.699257
593
4,981
5.671164
0.153457
0.101695
0.123104
0.139161
0.683021
0.683021
0.639013
0.639013
0.639013
0.639013
0
0.007402
0.186308
4,981
152
84
32.769737
0.822354
0
0
0.530435
0
0
0.105802
0.009235
0
0
0
0
0
1
0.06087
false
0
0.026087
0.043478
0.704348
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
33dd7e158265316c5e2b9da0d326d6d615f85df5
1,003
py
Python
online_cognacy_ident/tests/test_evaluation.py
Anaphory/online_cognacy_ident
7a986af497e42871ac208d773a009bd844bc10d8
[ "MIT" ]
1
2017-11-19T10:35:39.000Z
2017-11-19T10:35:39.000Z
online_cognacy_ident/tests/test_evaluation.py
Anaphory/online_cognacy_ident
7a986af497e42871ac208d773a009bd844bc10d8
[ "MIT" ]
6
2017-11-18T20:21:28.000Z
2019-01-10T10:56:02.000Z
online_cognacy_ident/tests/test_evaluation.py
Anaphory/online_cognacy_ident
7a986af497e42871ac208d773a009bd844bc10d8
[ "MIT" ]
1
2019-01-08T23:48:36.000Z
2019-01-08T23:48:36.000Z
from string import ascii_lowercase from unittest import TestCase from hypothesis.strategies import lists, sampled_from from hypothesis import given from online_cognacy_ident.evaluation import calc_b_cubed, calc_f_score from online_cognacy_ident.tests.test_dataset import clusters class EvaluationTestCase(TestCase): @given(lists(sampled_from(ascii_lowercase), min_size=1)) def test_calc_b_cubed_on_identical_lists(self, labels): self.assertEqual(calc_b_cubed(labels, labels), (1.0, 1.0, 1.0,)) @given(lists(sampled_from(ascii_lowercase), min_size=5, max_size=5), lists(sampled_from(ascii_lowercase), min_size=5, max_size=5)) def test_calc_b_cubed_is_in_range(self, labels_a, labels_b): res = calc_b_cubed(labels_a, labels_b) for item in res: self.assertTrue(0.0 <= item <= 1.0) @given(clusters()) def test_calc_f_score_on_identical_clusters(self, clusters): self.assertEqual(calc_f_score(clusters, clusters), 1.0)
34.586207
73
0.750748
152
1,003
4.625
0.309211
0.035562
0.071124
0.089616
0.246088
0.197724
0.197724
0.197724
0.130868
0.130868
0
0.020095
0.15653
1,003
28
74
35.821429
0.810875
0
0
0
0
0
0
0
0
0
0
0
0.157895
1
0.157895
false
0
0.315789
0
0.526316
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
33ea363b3c84d03ae6312d2d62e46e73e96799ad
75
py
Python
test/python/WMCore_t/Agent_t/__init__.py
khurtado/WMCore
f74e252412e49189a92962945a94f93bec81cd1e
[ "Apache-2.0" ]
21
2015-11-19T16:18:45.000Z
2021-12-02T18:20:39.000Z
test/python/WMCore_t/Agent_t/__init__.py
khurtado/WMCore
f74e252412e49189a92962945a94f93bec81cd1e
[ "Apache-2.0" ]
5,671
2015-01-06T14:38:52.000Z
2022-03-31T22:11:14.000Z
test/python/WMCore_t/Agent_t/__init__.py
khurtado/WMCore
f74e252412e49189a92962945a94f93bec81cd1e
[ "Apache-2.0" ]
67
2015-01-21T15:55:38.000Z
2022-02-03T19:53:13.000Z
#!/usr/bin/env python """ _Agent_t_ Agent test methods """ __all__ = []
7.5
21
0.626667
10
75
4
0.9
0
0
0
0
0
0
0
0
0
0
0
0.186667
75
9
22
8.333333
0.655738
0.666667
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
33ec2f71761cd188cfa0f6d156a728a4aaf29ccd
19,945
py
Python
bip_utils/coin_conf/coins_conf.py
3rdIteration/bip_utils
84abeff9158618a0ecf9a059c19fd1a3d882e724
[ "MIT" ]
null
null
null
bip_utils/coin_conf/coins_conf.py
3rdIteration/bip_utils
84abeff9158618a0ecf9a059c19fd1a3d882e724
[ "MIT" ]
null
null
null
bip_utils/coin_conf/coins_conf.py
3rdIteration/bip_utils
84abeff9158618a0ecf9a059c19fd1a3d882e724
[ "MIT" ]
null
null
null
# Copyright (c) 2021 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. """Module with generic coins configuration for all other modules.""" # Imports from bip_utils.coin_conf.coin_conf import CoinConf from bip_utils.utils.conf import CoinNames # Bitcoin constants used by different coins # Main net _BTC_P2PKH_NET_VER_MN: bytes = b"\x00" _BTC_P2SH_NET_VER_MN: bytes = b"\x05" _BTC_P2WPKH_HRP_MN: str = "bc" _BTC_P2WPKH_WIT_VER_MN: int = 0 _BTC_P2TR_HRP_MN: str = "bc" _BTC_P2TR_WIT_VER_MN: int = 1 _BTC_WIF_NET_VER_MN: bytes = b"\x80" # Test net _BTC_P2PKH_NET_VER_TN: bytes = b"\x6f" _BTC_P2SH_NET_VER_TN: bytes = b"\xc4" _BTC_P2WPKH_HRP_TN: str = "tb" _BTC_P2WPKH_WIT_VER_TN: int = 0 _BTC_P2TR_HRP_TN: str = "tb" _BTC_P2TR_WIT_VER_TN: int = 1 _BTC_WIF_NET_VER_TN: bytes = b"\xef" class CoinsConf: """Class container for coins configuration.""" # Configuration for Acala Acala: CoinConf = CoinConf( coin_name=CoinNames("Acala", "ACA"), params={ "addr_ss58_format": 10, }, ) # Configuration for Akash Network AkashNetwork: CoinConf = CoinConf( coin_name=CoinNames("Akash Network", "AKT"), params={ "addr_hrp": "akash", }, ) # Configuration for Algorand Algorand: CoinConf = CoinConf( coin_name=CoinNames("Algorand", "ALGO"), params={}, ) # Configuration for Avax C-Chain AvaxCChain: CoinConf = CoinConf( coin_name=CoinNames("Avax C-Chain", "AVAX"), params={}, ) # Configuration for Avax P-Chain AvaxPChain: CoinConf = CoinConf( coin_name=CoinNames("Avax P-Chain", "AVAX"), params={ "addr_hrp": "avax", "addr_prefix": "P-", }, ) # Configuration for Avax X-Chain AvaxXChain: CoinConf = CoinConf( coin_name=CoinNames("Avax X-Chain", "AVAX"), params={ "addr_hrp": "avax", "addr_prefix": "X-", }, ) # Configuration for Band Protocol BandProtocol: CoinConf = CoinConf( coin_name=CoinNames("Band Protocol", "BAND"), params={ "addr_hrp": "band", }, ) # Configuration for Bifrost Bifrost: CoinConf = CoinConf( coin_name=CoinNames("Bifrost", "BNC"), params={ "addr_ss58_format": 6, }, ) # Configuration for Binance Chain BinanceChain: CoinConf = CoinConf( coin_name=CoinNames("Binance Chain", "BNB"), params={ "addr_hrp": "bnb", }, ) # Configuration for Binance Smart Chain BinanceSmartChain: CoinConf = CoinConf( coin_name=CoinNames("Binance Smart Chain", "BNB"), params={}, ) # Configuration for Bitcoin main net BitcoinMainNet: CoinConf = CoinConf( coin_name=CoinNames("Bitcoin", "BTC"), params={ "p2pkh_net_ver": _BTC_P2PKH_NET_VER_MN, "p2sh_net_ver": _BTC_P2SH_NET_VER_MN, "p2wpkh_hrp": _BTC_P2WPKH_HRP_MN, "p2wpkh_wit_ver": _BTC_P2WPKH_WIT_VER_MN, "p2tr_hrp": _BTC_P2TR_HRP_MN, "p2tr_wit_ver": _BTC_P2TR_WIT_VER_MN, "wif_net_ver": _BTC_WIF_NET_VER_MN, }, ) # Configuration for Bitcoin test net BitcoinTestNet: CoinConf = CoinConf( coin_name=CoinNames("Bitcoin TestNet", "BTC"), params={ "p2pkh_net_ver": _BTC_P2PKH_NET_VER_TN, "p2sh_net_ver": _BTC_P2SH_NET_VER_TN, "p2wpkh_hrp": _BTC_P2WPKH_HRP_TN, "p2wpkh_wit_ver": _BTC_P2WPKH_WIT_VER_TN, "p2tr_hrp": _BTC_P2TR_HRP_TN, "p2tr_wit_ver": _BTC_P2TR_WIT_VER_MN, "wif_net_ver": _BTC_WIF_NET_VER_TN, }, ) # Configuration for Bitcoin Cash main net BitcoinCashMainNet: CoinConf = CoinConf( coin_name=CoinNames("Bitcoin Cash", "BCH"), params={ "p2pkh_std_hrp": "bitcoincash", "p2pkh_std_net_ver": _BTC_P2PKH_NET_VER_MN, "p2pkh_legacy_net_ver": _BTC_P2PKH_NET_VER_MN, "p2sh_std_hrp": "bitcoincash", "p2sh_std_net_ver": b"\x08", "p2sh_legacy_net_ver": _BTC_P2SH_NET_VER_MN, "wif_net_ver": _BTC_WIF_NET_VER_MN, }, ) # Configuration for Bitcoin Cash test net BitcoinCashTestNet: CoinConf = CoinConf( coin_name=CoinNames("Bitcoin Cash TestNet", "BCH"), params={ "p2pkh_std_hrp": "bchtest", "p2pkh_std_net_ver": b"\x00", "p2pkh_legacy_net_ver": _BTC_P2PKH_NET_VER_TN, "p2sh_std_hrp": "bchtest", "p2sh_std_net_ver": b"\x08", "p2sh_legacy_net_ver": _BTC_P2SH_NET_VER_TN, "wif_net_ver": _BTC_WIF_NET_VER_TN, }, ) # Configuration for Bitcoin Cash Simple Ledger Protocol main net BitcoinCashSlpMainNet: CoinConf = CoinConf( coin_name=CoinNames("Bitcoin Cash SLP", "SLP"), params={ "p2pkh_std_hrp": "simpleledger", "p2pkh_std_net_ver": b"\x00", "p2pkh_legacy_net_ver": _BTC_P2PKH_NET_VER_MN, "p2sh_std_hrp": "simpleledger", "p2sh_std_net_ver": b"\x08", "p2sh_legacy_net_ver": _BTC_P2SH_NET_VER_MN, "wif_net_ver": _BTC_WIF_NET_VER_MN, }, ) # Configuration for Bitcoin Cash Simple Ledger Protocol test net BitcoinCashSlpTestNet: CoinConf = CoinConf( coin_name=CoinNames("Bitcoin Cash SLP TestNet", "SLP"), params={ "p2pkh_std_hrp": "slptest", "p2pkh_std_net_ver": b"\x00", "p2pkh_legacy_net_ver": _BTC_P2PKH_NET_VER_TN, "p2sh_std_hrp": "slptest", "p2sh_std_net_ver": b"\x08", "p2sh_legacy_net_ver": _BTC_P2SH_NET_VER_TN, "wif_net_ver": _BTC_WIF_NET_VER_TN, }, ) # Configuration for Bitcoin SV main net BitcoinSvMainNet: CoinConf = CoinConf( coin_name=CoinNames("BitcoinSV", "BSV"), params={ "p2pkh_net_ver": _BTC_P2PKH_NET_VER_MN, "p2sh_net_ver": _BTC_P2SH_NET_VER_MN, "wif_net_ver": _BTC_WIF_NET_VER_MN, }, ) # Configuration for Bitcoin SV test net BitcoinSvTestNet: CoinConf = CoinConf( coin_name=CoinNames("BitcoinSV TestNet", "BSV"), params={ "p2pkh_net_ver": _BTC_P2PKH_NET_VER_TN, "p2sh_net_ver": _BTC_P2SH_NET_VER_TN, "wif_net_ver": _BTC_WIF_NET_VER_TN, }, ) # Configuration for Celo Celo: CoinConf = CoinConf( coin_name=CoinNames("Celo", "CELO"), params={}, ) # Configuration for Certik Certik: CoinConf = CoinConf( coin_name=CoinNames("Certik", "CTK"), params={ "addr_hrp": "certik", }, ) # Configuration for ChainX ChainX: CoinConf = CoinConf( coin_name=CoinNames("ChainX", "PCX"), params={ "addr_ss58_format": 44, }, ) # Configuration for Chihuahua Chihuahua: CoinConf = CoinConf( coin_name=CoinNames("Chihuahua", "HUAHUA"), params={ "addr_hrp": "chihuahua", }, ) # Configuration for Cosmos Cosmos: CoinConf = CoinConf( coin_name=CoinNames("Cosmos", "ATOM"), params={ "addr_hrp": "cosmos", }, ) # Configuration for Dash main net DashMainNet: CoinConf = CoinConf( coin_name=CoinNames("Dash", "DASH"), params={ "p2pkh_net_ver": b"\x4c", "p2sh_net_ver": b"\x10", "wif_net_ver": b"\xcc", }, ) # Configuration for Dash test net DashTestNet: CoinConf = CoinConf( coin_name=CoinNames("Dash TestNet", "DASH"), params={ "p2pkh_net_ver": b"\x8c", "p2sh_net_ver": b"\x13", "wif_net_ver": _BTC_WIF_NET_VER_TN, }, ) # Configuration for Dogecoin main net DogecoinMainNet: CoinConf = CoinConf( coin_name=CoinNames("Dogecoin", "DOGE"), params={ "p2pkh_net_ver": b"\x1e", "p2sh_net_ver": b"\x16", "wif_net_ver": b"\x9e", }, ) # Configuration for Dogecoin test net DogecoinTestNet: CoinConf = CoinConf( coin_name=CoinNames("Dogecoin TestNet", "DOGE"), params={ "p2pkh_net_ver": b"\x71", "p2sh_net_ver": _BTC_P2SH_NET_VER_TN, "wif_net_ver": b"\xf1", }, ) # Configuration for eCash main net EcashMainNet: CoinConf = CoinConf( coin_name=CoinNames("eCash", "XEC"), params={ "p2pkh_std_hrp": "ecash", "p2pkh_std_net_ver": b"\x00", "p2pkh_legacy_net_ver": _BTC_P2PKH_NET_VER_MN, "p2sh_std_hrp": "ecash", "p2sh_std_net_ver": b"\x08", "p2sh_legacy_net_ver": _BTC_P2SH_NET_VER_MN, "wif_net_ver": _BTC_WIF_NET_VER_MN, }, ) # Configuration for eCash test net EcashTestNet: CoinConf = CoinConf( coin_name=CoinNames("eCash TestNet", "XEC"), params={ "p2pkh_std_hrp": "ectest", "p2pkh_std_net_ver": b"\x00", "p2pkh_legacy_net_ver": _BTC_P2PKH_NET_VER_TN, "p2sh_std_hrp": "ectest", "p2sh_std_net_ver": b"\x08", "p2sh_legacy_net_ver": _BTC_P2SH_NET_VER_TN, "wif_net_ver": _BTC_WIF_NET_VER_TN, }, ) # Configuration for Edgeware Edgeware: CoinConf = CoinConf( coin_name=CoinNames("Edgeware", "EDG"), params={ "addr_ss58_format": 7, }, ) # Configuration for Elrond Elrond: CoinConf = CoinConf( coin_name=CoinNames("Elrond eGold", "eGLD"), params={ "addr_hrp": "erd", }, ) # Configuration for Eos Eos: CoinConf = CoinConf( coin_name=CoinNames("EOS", "EOS"), params={ "addr_prefix": "EOS", }, ) # Configuration for Ethereum Ethereum: CoinConf = CoinConf( coin_name=CoinNames("Ethereum", "ETH"), params={ "addr_prefix": "0x", }, ) # Configuration for Ethereum Classic EthereumClassic: CoinConf = CoinConf( coin_name=CoinNames("Ethereum Classic", "ETC"), params={}, ) # Configuration for Fantom Opera FantomOpera: CoinConf = CoinConf( coin_name=CoinNames("Fantom Opera", "FTM"), params={}, ) # Configuration for Filecoin Filecoin: CoinConf = CoinConf( coin_name=CoinNames("Filecoin", "FIL"), params={ "addr_prefix": "f", }, ) # Configuration for generic Substrate coin GenericSubstrate: CoinConf = CoinConf( coin_name=CoinNames("Generic Substrate", ""), params={ "addr_ss58_format": 42, }, ) # Configuration for Harmony One HarmonyOne: CoinConf = CoinConf( coin_name=CoinNames("Harmony One", "ONE"), params={ "addr_hrp": "one", }, ) # Configuration for Huobi Chain HuobiChain: CoinConf = CoinConf( coin_name=CoinNames("Huobi Token", "HT"), params={}, ) # Configuration for IRISnet IrisNet: CoinConf = CoinConf( coin_name=CoinNames("IRIS Network", "IRIS"), params={ "addr_hrp": "iaa", }, ) # Configuration for Karura Karura: CoinConf = CoinConf( coin_name=CoinNames("Karura", "KAR"), params={ "addr_ss58_format": 8, }, ) # Configuration for Kava Kava: CoinConf = CoinConf( coin_name=CoinNames("Kava", "KAVA"), params={ "addr_hrp": "kava", }, ) # Configuration for Kusama Kusama: CoinConf = CoinConf( coin_name=CoinNames("Kusama", "KSM"), params={ "addr_ss58_format": 2, }, ) # Configuration for Litecoin main net LitecoinMainNet: CoinConf = CoinConf( coin_name=CoinNames("Litecoin", "LTC"), params={ "p2pkh_std_net_ver": b"\x30", "p2pkh_depr_net_ver": _BTC_P2PKH_NET_VER_MN, "p2sh_std_net_ver": b"\x32", "p2sh_depr_net_ver": _BTC_P2SH_NET_VER_MN, "p2wpkh_hrp": "ltc", "p2wpkh_wit_ver": _BTC_P2WPKH_WIT_VER_MN, "wif_net_ver": b"\xb0", }, ) # Configuration for Litecoin test net LitecoinTestNet: CoinConf = CoinConf( coin_name=CoinNames("Litecoin TestNet", "LTC"), params={ "p2pkh_std_net_ver": b"\x6f", "p2pkh_depr_net_ver": _BTC_P2PKH_NET_VER_TN, "p2sh_std_net_ver": b"\x3a", "p2sh_depr_net_ver": _BTC_P2SH_NET_VER_TN, "p2wpkh_hrp": "tltc", "p2wpkh_wit_ver": _BTC_P2WPKH_WIT_VER_TN, "wif_net_ver": _BTC_WIF_NET_VER_TN, }, ) # Configuration for Monero main net MoneroMainNet: CoinConf = CoinConf( coin_name=CoinNames("Monero", "XMR"), params={ "addr_net_ver": b"\x12", "addr_int_net_ver": b"\x13", "subaddr_net_ver": b"\x2a", }, ) # Configuration for Monero stage net MoneroStageNet: CoinConf = CoinConf( coin_name=CoinNames("Monero StageNet", "XMR"), params={ "addr_net_ver": b"\x18", "addr_int_net_ver": b"\x19", "subaddr_net_ver": b"\x24", }, ) # Configuration for Monero test net MoneroTestNet: CoinConf = CoinConf( coin_name=CoinNames("Monero TestNet", "XMR"), params={ "addr_net_ver": b"\x35", "addr_int_net_ver": b"\x36", "subaddr_net_ver": b"\x3f", }, ) # Configuration for Moonbeam Moonbeam: CoinConf = CoinConf( coin_name=CoinNames("Moonbeam", "GLMR"), params={ "addr_ss58_format": 1284, }, ) # Configuration for Moonriver Moonriver: CoinConf = CoinConf( coin_name=CoinNames("Moonriver", "MOVR"), params={ "addr_ss58_format": 1285, }, ) # Configuration for Nano Nano: CoinConf = CoinConf( coin_name=CoinNames("Nano", "NANO"), params={ "addr_prefix": "nano_", }, ) # Configuration for Near Protocol NearProtocol: CoinConf = CoinConf( coin_name=CoinNames("Near Protocol", "NEAR"), params={}, ) # Configuration for Neo Neo: CoinConf = CoinConf( coin_name=CoinNames("NEO", "NEO"), params={ "addr_ver": b"\x17", }, ) # Configuration for Nine Chronicles Gold NineChroniclesGold: CoinConf = CoinConf( coin_name=CoinNames("NineChroniclesGold", "NCG"), params={}, ) # Configuration for OKEx Chain OkexChain: CoinConf = CoinConf( coin_name=CoinNames("OKExChain", "OKT"), params={ "addr_hrp": "ex", }, ) # Configuration for Ontology Ontology: CoinConf = CoinConf( coin_name=CoinNames("Ontology", "ONT"), params={ "addr_ver": b"\x17", }, ) # Configuration for Osmosis Osmosis: CoinConf = CoinConf( coin_name=CoinNames("Osmosis", "OSMO"), params={ "addr_hrp": "osmo", }, ) # Configuration for Phala Phala: CoinConf = CoinConf( coin_name=CoinNames("Phala Network", "PHA"), params={ "addr_ss58_format": 30, }, ) # Configuration for Plasm Plasm: CoinConf = CoinConf( coin_name=CoinNames("Plasm Network", "PLM"), params={ "addr_ss58_format": 5, }, ) # Configuration for Polkadot Polkadot: CoinConf = CoinConf( coin_name=CoinNames("Polkadot", "DOT"), params={ "addr_ss58_format": 0, }, ) # Configuration for Polygon Polygon: CoinConf = CoinConf( coin_name=CoinNames("Polygon", "MATIC"), params={}, ) # Configuration for Ripple Ripple: CoinConf = CoinConf( coin_name=CoinNames("Ripple", "XRP"), params={ "p2pkh_net_ver": _BTC_P2PKH_NET_VER_MN, }, ) # Configuration for Secret Network SecretNetwork: CoinConf = CoinConf( coin_name=CoinNames("Secret Network", "SCRT"), params={ "addr_hrp": "secret", }, ) # Configuration for Solana Solana: CoinConf = CoinConf( coin_name=CoinNames("Solana", "SOL"), params={}, ) # Configuration for Sora Sora: CoinConf = CoinConf( coin_name=CoinNames("Sora", "XOR"), params={ "addr_ss58_format": 69, }, ) # Configuration for Stafi Stafi: CoinConf = CoinConf( coin_name=CoinNames("Stafi", "FIS"), params={ "addr_ss58_format": 20, }, ) # Configuration for Stellar Stellar: CoinConf = CoinConf( coin_name=CoinNames("Stellar", "XLM"), params={}, ) # Configuration for Terra Terra: CoinConf = CoinConf( coin_name=CoinNames("Terra", "LUNA"), params={ "addr_hrp": "terra", }, ) # Configuration for Tezos Tezos: CoinConf = CoinConf( coin_name=CoinNames("Tezos", "XTZ"), params={}, ) # Configuration for Theta Theta: CoinConf = CoinConf( coin_name=CoinNames("Theta Network", "THETA"), params={}, ) # Configuration for Tron Tron: CoinConf = CoinConf( coin_name=CoinNames("Tron", "TRX"), params={ "addr_prefix": b"\x41", }, ) # Configuration for VeChain VeChain: CoinConf = CoinConf( coin_name=CoinNames("VeChain", "VET"), params={}, ) # Configuration for Verge Verge: CoinConf = CoinConf( coin_name=CoinNames("Verge", "XVG"), params={ "p2pkh_net_ver": b"\x1e", "wif_net_ver": b"\x9e", }, ) # Configuration for Zcash main net ZcashMainNet: CoinConf = CoinConf( coin_name=CoinNames("Zcash", "ZEC"), params={ "p2pkh_net_ver": b"\x1c\xb8", "p2sh_net_ver": b"\x1c\xbd", "wif_net_ver": _BTC_WIF_NET_VER_MN, }, ) # Configuration for Zcash test net ZcashTestNet: CoinConf = CoinConf( coin_name=CoinNames("Zcash TestNet", "ZEC"), params={ "p2pkh_net_ver": b"\x1d\x25", "p2sh_net_ver": b"\x1c\xba", "wif_net_ver": _BTC_WIF_NET_VER_TN, }, ) # Configuration for Zilliqa Zilliqa: CoinConf = CoinConf( coin_name=CoinNames("Zilliqa", "ZIL"), params={ "addr_hrp": "zil", }, )
28.01264
79
0.57829
2,173
19,945
4.988955
0.171652
0.071396
0.140208
0.16825
0.522553
0.33032
0.219721
0.190019
0.161332
0.144636
0
0.019588
0.306342
19,945
711
80
28.052039
0.764004
0.177087
0
0.25947
0
0
0.204306
0
0
0
0
0
0
1
0
true
0
0.003788
0
0.149621
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
1
0
0
0
0
0
0
2
33f6ee4df6c705ead005ed79390cb0b327d71e64
4,881
py
Python
test.py
pricingassistant/pa_string_distance
5280f04262d1c165ad75052b0bb1bd2251963266
[ "BSD-2-Clause" ]
null
null
null
test.py
pricingassistant/pa_string_distance
5280f04262d1c165ad75052b0bb1bd2251963266
[ "BSD-2-Clause" ]
null
null
null
test.py
pricingassistant/pa_string_distance
5280f04262d1c165ad75052b0bb1bd2251963266
[ "BSD-2-Clause" ]
null
null
null
from pa_string_distance import pa_string_distance import timeit import pytest def string_compare(s1, s2): return { "ratio": 1 - pa_string_distance(s1, s2) } def test_string_compare(): # Change this for performance tests for _ in range(10000): assert 1 == string_compare("boite de trucs", "boite de trucs")["ratio"] # repeats assert 1 == string_compare("boite de trucs trucs", "boite de trucs")["ratio"] assert 1 == string_compare("boite de trucs trucs", "boite de trucs boite")["ratio"] # punctuation assert 1 == string_compare("boite de trucs trucs.", " Boite de trucs boite, boite!")["ratio"] assert 1 == string_compare("Finish line", "Finish-line")["ratio"] partial_match = string_compare("super boite de trucs", "boite de trucs")["ratio"] assert partial_match < 1 partial_double_match = string_compare("super boite de trucs", "mega boite de trucs")["ratio"] assert partial_double_match < partial_match partial_double_match_larger = string_compare("vraiment super boite de trucs", "mega boite de trucs")["ratio"] partial_double_match_larger < partial_double_match mismatch = string_compare("vraiment super", "mega bien")["ratio"] assert mismatch < partial_double_match_larger assert mismatch < 0.1 zero = string_compare("e", "a")["ratio"] assert zero == 0 # empty strings assert 0 == string_compare("", "")["ratio"] assert 0 == string_compare(" ", "")["ratio"] assert 0 == string_compare(", ", "")["ratio"] assert 0 == string_compare(", ", " ")["ratio"] assert 0 == string_compare(" ", " ")["ratio"] assert 0 == string_compare(",", " ")["ratio"] assert 0 == string_compare(" , ", " , ,,,")["ratio"] assert 0 == string_compare("", "a")["ratio"] assert 0 == string_compare(",", "a")["ratio"] assert 0 == string_compare(", ", "a, ")["ratio"] assert 0 == string_compare(" ", "R22")["ratio"] # Numerical mis-spellings are not allowed assert 0 == string_compare("R19", "R20")["ratio"] assert 0 == string_compare("405L", "406L")["ratio"] assert 0 == string_compare("Peugeot", "R22")["ratio"] assert 0 == string_compare("Citroen", "R22")["ratio"] assert 0 == string_compare("PeugeotCitroen", "R22")["ratio"] # Really different strings shouldn't match at all either assert 0.01 > string_compare("renault", "peugeot")["ratio"] assert 0 == string_compare("Cabriolet", "R")["ratio"] # Somewhat close strings assert 0 < string_compare("peugot", "peugeot")["ratio"] < string_compare("xxxxxxxpeugot", "xxxxxxxpeugeot")["ratio"] # Grouping assert 0 < string_compare("PG 38", "PG38")["ratio"] assert string_compare("PG 38", "PG38")["ratio"] > string_compare("PG 38", "PG 39")["ratio"] assert 0 < string_compare("PG38", "PG-38")["ratio"] assert string_compare("PG38", "PG-38")["ratio"] > string_compare("PG38", "PG38 Other")["ratio"] assert 0 < string_compare("PG-38", "PG38 Other")["ratio"] assert string_compare("PG-38", "PG38 Other")["ratio"] < string_compare("PG38", "PG38 Other")["ratio"] assert 0 < string_compare("R20 Cabriolet", "R-20")["ratio"] assert string_compare("R20 Cabriolet", "R-20")["ratio"] < string_compare("R20 Cabriolet", "R20")["ratio"] assert 0 < string_compare("Finish line", "Finishline")["ratio"] assert 1 > string_compare("Finish line", "Finishline")["ratio"] assert string_compare("Finish line", "Finishline")["ratio"] > string_compare("Line Finish", "Finishline")["ratio"] assert string_compare("Finish line", "Finishline")["ratio"] > string_compare("Finish Leopard", "Finishline")["ratio"] # Also work by 3 assert string_compare("Finish line leftover", "FinishlineLeftover")["ratio"] > string_compare("Finish Leopard Leftover", "FinishlineLeftover")["ratio"] assert string_compare("Finish line leftover", "FinishlineLeftover")["ratio"] > 0.8 # Close string to an existing pair is preferred assert string_compare("words word", "words")["ratio"] > string_compare("words wxyz", "words")["ratio"] # Repeats increase the matching score assert string_compare("one one one one one two three four", "one two three")["ratio"] > string_compare("one two three four", "one two three")["ratio"] assert string_compare("one one one one one two three four", "one one two three")["ratio"] > string_compare("one one one one one two three four", "one two three")["ratio"] # Special characters assert string_compare(u"K\xe4rcher", "KARCHER")["ratio"] > 0.95 assert string_compare(u'Thing \xd8 4,60 - 1,20m', u'Thing 4.60 , 1.20m')["ratio"] == 1 assert string_compare(u'G\xd8rdon', u'Gordon')["ratio"] == 1 # If exactly 20% of the string matches, score should be ~= 0.2 assert 0.15 < string_compare("one two thr fou fiv", "one six sev eig ten")["ratio"] < 0.25
45.194444
174
0.659291
638
4,881
4.904389
0.219436
0.261745
0.095558
0.147012
0.580377
0.537232
0.477469
0.345158
0.2969
0.272611
0
0.035829
0.170867
4,881
107
175
45.616822
0.737336
0.076009
0
0.092308
0
0
0.332963
0
0
0
0
0
0.769231
1
0.030769
false
0
0.046154
0.015385
0.092308
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
1
0
0
0
0
0
0
0
0
0
2
33f8626c82c065913e8ff0908529d0fa7ef64fc7
74
py
Python
moai/checkpoint/lightning/__init__.py
tzole1155/moai
d1afb3aaf8ddcd7a1c98b84d6365afb846ae3180
[ "Apache-2.0" ]
10
2021-04-02T11:21:33.000Z
2022-01-18T18:32:32.000Z
moai/checkpoint/lightning/__init__.py
tzole1155/moai
d1afb3aaf8ddcd7a1c98b84d6365afb846ae3180
[ "Apache-2.0" ]
1
2022-03-22T20:10:55.000Z
2022-03-24T13:11:02.000Z
moai/checkpoint/lightning/__init__.py
tzole1155/moai
d1afb3aaf8ddcd7a1c98b84d6365afb846ae3180
[ "Apache-2.0" ]
3
2021-05-16T20:47:40.000Z
2021-12-01T21:15:36.000Z
from moai.checkpoint.lightning.noop import NoOp __all__ = [ "NoOp", ]
14.8
47
0.702703
9
74
5.333333
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.175676
74
5
48
14.8
0.786885
0
0
0
0
0
0.053333
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
33f9dcd34964853bfb274f2070abf8f23180c714
805
py
Python
services/web/apps/inv/platform/views.py
xUndero/noc
9fb34627721149fcf7064860bd63887e38849131
[ "BSD-3-Clause" ]
1
2019-09-20T09:36:48.000Z
2019-09-20T09:36:48.000Z
services/web/apps/inv/platform/views.py
ewwwcha/noc
aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb
[ "BSD-3-Clause" ]
null
null
null
services/web/apps/inv/platform/views.py
ewwwcha/noc
aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # inv.platform application # ---------------------------------------------------------------------- # Copyright (C) 2007-2018 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # NOC modules from noc.lib.app.extdocapplication import ExtDocApplication from noc.inv.models.platform import Platform from noc.core.translation import ugettext as _ class PlatformApplication(ExtDocApplication): """ Platform application """ title = "Platform" menu = [_("Setup"), _("Platforms")] model = Platform query_fields = ["full_name__icontains", "name__icontains", "description__icontains"] default_ordering = ["full_name"]
32.2
88
0.525466
65
805
6.307692
0.661538
0.05122
0
0
0
0
0
0
0
0
0
0.012821
0.12795
805
24
89
33.541667
0.571225
0.443478
0
0
0
0
0.207059
0.051765
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
33fc62ad8280532584220ab078e7a0c1feb615dd
789
py
Python
learn_flask/app.py
Carsten-Leue/learn-flask
06682f1e46a09df991b8ccaa0273f82ae8c9bf25
[ "MIT" ]
null
null
null
learn_flask/app.py
Carsten-Leue/learn-flask
06682f1e46a09df991b8ccaa0273f82ae8c9bf25
[ "MIT" ]
null
null
null
learn_flask/app.py
Carsten-Leue/learn-flask
06682f1e46a09df991b8ccaa0273f82ae8c9bf25
[ "MIT" ]
null
null
null
from typing import Callable from flask import Flask, jsonify, request from .encoder import CustomJSONEncoder from .models import DeviceAttributes from .iplink import IpLink from .controllers import show_devices, show_device from logging import Logger def create_app(fct: Callable[[Logger], IpLink]): app = Flask(__name__) app.json_encoder = CustomJSONEncoder iplink = fct(app.logger) @app.route('/') def app_show_devices(): return jsonify(show_devices(iplink)) @app.route('/<string:name>') def app_show_device(name: str): return jsonify(show_device(iplink, name)) @app.route('/<string:name>', methods=['POST']) def app_add_device(name: str): print(request) return jsonify(show_device(iplink, name)) return app
26.3
50
0.707224
100
789
5.41
0.32
0.073937
0.09427
0.066543
0.121996
0.121996
0
0
0
0
0
0
0.185044
789
29
51
27.206897
0.841369
0
0
0.090909
0
0
0.041825
0
0
0
0
0
0
1
0.181818
false
0
0.318182
0.090909
0.681818
0.045455
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
d5088ca8c6cd2bd1a847fb2a1be8c947f8c30989
515
py
Python
vault.py
mirtec001/vault
f6f3846e12c88050e6be74fca55631eed4cfb135
[ "MIT" ]
null
null
null
vault.py
mirtec001/vault
f6f3846e12c88050e6be74fca55631eed4cfb135
[ "MIT" ]
null
null
null
vault.py
mirtec001/vault
f6f3846e12c88050e6be74fca55631eed4cfb135
[ "MIT" ]
null
null
null
from lock import Lock from menu import Menu def main(): is_locked = True quit = False while not quit: if is_locked: is_locked = Lock().unlock() else: Menu().main_menu() menu_navigator = int(input(">> ")) if menu_navigator == 1: Menu().view_vault() if menu_navigator == 2: Menu().add_item() if menu_navigator == 4: quit = True if __name__ == "__main__": main()
22.391304
46
0.491262
57
515
4.122807
0.473684
0.221277
0.191489
0
0
0
0
0
0
0
0
0.00974
0.401942
515
23
47
22.391304
0.753247
0
0
0
0
0
0.021318
0
0
0
0
0
0
1
0.052632
false
0
0.105263
0
0.157895
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d516259b8b6e2523d6837185ae9193ce8a02854c
3,474
py
Python
module1-introduction-to-sql/rpg_db_notes.py
John-G-Thomas/DS-Unit-3-Sprint-2-SQL-and-Databases
63996452fa705f1f032a94e4809bf5a7a692df2a
[ "MIT" ]
null
null
null
module1-introduction-to-sql/rpg_db_notes.py
John-G-Thomas/DS-Unit-3-Sprint-2-SQL-and-Databases
63996452fa705f1f032a94e4809bf5a7a692df2a
[ "MIT" ]
null
null
null
module1-introduction-to-sql/rpg_db_notes.py
John-G-Thomas/DS-Unit-3-Sprint-2-SQL-and-Databases
63996452fa705f1f032a94e4809bf5a7a692df2a
[ "MIT" ]
null
null
null
import sqlite3 """ Create a connextion """ conn = sqlite3.connect('rpg_db.sqlite3') """ Select statement """ curs = conn.cursor() query = 'SELECT * FROM armory_item;' curs.execute(query) results = curs.fetchall() """ rpg_exmple.py """ import sqlite3 def connect_to_db(db_name='rpg_db.sqlite3'): return sqlite3.connect(db_name) def execute_query(cursor, query): cursor.execute(query) return cursor.fetchall() GET_CHARACTERS = """ SELECT * FROM charactercreator_character; """ if __name__ == '__main__': conn = connect_to_db() curs = conn.cursor() results = execute_query(curs, GET_CHARACTERS) print(results) """ Query log: """ SELECT * FROM charactercreator_character; SELECT COUNT(*) FROM charactercreator_character; SELECT COUNT(DISTINCT name) FROM charactercreator_character; """ Selecting columns: """ SELECT character_id, name FROM charactercreator_character; """ Limiting rows: """ SELECT character_id, name FROM charactercreator_character LIMIT 10; """ Filtering rows with confitions: """ SELECT character_id, name FROM charactercreator_character WHERE character_id > 50; SELECT character_id, name FROM charactercreator_character WHERE character_id > 50 AND character_id < 55; """ Equivalent: """ SELECT character_id, name FROM charactercreator_character WHERE character_id BETWEEN 51 AND 54; General theme - often more than one way to do it! """ Let's figure out what the duplicate character names are """ SELECT name, COUNT(*) FROM charactercreator_character GROUP BY name; """ Our first business query! """ """ Let's figure out what the duplicate character names are SELECT - how we choose which columns to get WHERE - how we set conditions on the rows to be returned LIMIT - when we only want a certain number of rows ORDER - when we want to sort the output JOIN - when we need data from multiple tables combined """ """ A first join """ SELECT * FROM charactercreator_character INNER JOIN charactercreator_fighter ON character_id = character_ptr_id WHERE character_id = 1; """ Non-inner joins introduce missing values! """ SELECT character_id, name, rage FROM charactercreator_character LEFT JOIN charactercreator_fighter ON character_id = character_ptr_id; """ Explicit inner join: """ SELECT character_id, name, rage FROM charactercreator_character INNER JOIN charactercreator_fighter ON character_id = character_ptr_id WHERE character_id BETWEEN 40 and 50; """ Equivalent implicit join: """ SELECT character_id, name, rage FROM charactercreator_character, charactercreator_fighter WHERE character_id = character_ptr_id AND character_id BETWEEN 40 and 50; """ Queries result in tables that can be queried! (Silly example but can be useful) """ SELECT * FROM (SELECT * FROM charactercreator_character); """ Sometimes you need to join >2 tables... This is where I particularly like implicit joins """ SELECT cc.character_id, cc.name, ai.item_id, ai.name FROM charactercreator_character AS cc, armory_item AS ai, charactercreator_character_inventory AS cci WHERE cc.character_id = cci.character_id AND ai.item_id = cci.item_id; """ Use a subquery to make a temp table to query from """ SELECT character_id, COUNT(DISTINCT item_id) FROM (SELECT cc.character_id, cc.name AS character_name, ai.item_id, ai.name AS item_name FROM charactercreator_character AS cc, armory_item AS ai, charactercreator_character_inventory AS cci WHERE cc.character_id = cci.character_id AND ai.item_id = cci.item_id) GROUP BY 1 ORDER BY 2 DESC;
24.814286
74
0.776626
497
3,474
5.243461
0.289738
0.109747
0.189179
0.101305
0.504605
0.464313
0.419417
0.381044
0.360322
0.306216
0
0.010037
0.139609
3,474
140
75
24.814286
0.861827
0
0
0.347222
0
0
0.045146
0.010787
0
0
0
0
0
0
null
null
0
0.027778
null
null
0.013889
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
1d28ba4a4b641d471bfe7b5b208be215c1c5af29
1,157
py
Python
domains/views.py
kevchentw/foxdomain
51f32fdfc37204ae2c6cb84460b0c3ceb7a05a60
[ "MIT" ]
null
null
null
domains/views.py
kevchentw/foxdomain
51f32fdfc37204ae2c6cb84460b0c3ceb7a05a60
[ "MIT" ]
null
null
null
domains/views.py
kevchentw/foxdomain
51f32fdfc37204ae2c6cb84460b0c3ceb7a05a60
[ "MIT" ]
null
null
null
from django.shortcuts import render from rest_framework import generics from rest_framework.permissions import IsAdminUser from rest_framework.permissions import IsAuthenticated from rest_framework.permissions import AllowAny from .permissions import IsOwner from .permissions import IsAdminOrReadOnly from .serializers import DomainSerializer from .models import Domain from .serializers import SubDomainSerializer from .models import SubDomain class DomainList(generics.ListAPIView): """ A view to list all domain. Permission: Public """ queryset = Domain.objects.all() serializer_class = DomainSerializer permission_classes = (AllowAny,) class DomainCreate(generics.CreateAPIView): """ A view to create domain. Permission: Admin """ queryset = Domain.objects.all() serializer_class = DomainSerializer permission_classes = (IsAdminUser,) class SubDomainCreate(generics.CreateAPIView): """ A view to create subdomain. Permission: Authenticated User """ queryset = SubDomain.objects.all() serializer_class = SubDomainSerializer permission_classes = (IsAuthenticated,)
28.219512
54
0.765774
117
1,157
7.487179
0.350427
0.097032
0.077626
0.09589
0.358447
0.242009
0.164384
0.164384
0.164384
0
0
0
0.168539
1,157
40
55
28.925
0.910603
0.127053
0
0.173913
0
0
0
0
0
0
0
0
0
1
0
false
0
0.478261
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
1d28d2bb2dc04a5c6f8fbb4449cf8b17f3da9a85
748
py
Python
py_hcl/dsl/branch.py
zhongzc/py-hcl
5a2be0208f915377a1dae12509f1af016df6412b
[ "MIT" ]
null
null
null
py_hcl/dsl/branch.py
zhongzc/py-hcl
5a2be0208f915377a1dae12509f1af016df6412b
[ "MIT" ]
null
null
null
py_hcl/dsl/branch.py
zhongzc/py-hcl
5a2be0208f915377a1dae12509f1af016df6412b
[ "MIT" ]
null
null
null
import py_hcl.core.stmt.branch as cb from py_hcl.core.expr import HclExpr class when(object): def __init__(self, cond_expr: HclExpr): self.cond_expr = cond_expr def __enter__(self): cb.do_when_enter(self.cond_expr) def __exit__(self, exc_type, exc_val, exc_tb): cb.do_when_exit() class else_when(object): def __init__(self, cond_expr: HclExpr): self.cond_expr = cond_expr def __enter__(self): cb.do_else_when_enter(self.cond_expr) def __exit__(self, exc_type, exc_val, exc_tb): cb.do_else_when_exit() class otherwise(object): def __enter__(self): cb.do_otherwise_enter() def __exit__(self, exc_type, exc_val, exc_tb): cb.do_otherwise_exit()
22.666667
50
0.683155
115
748
3.869565
0.234783
0.14382
0.161798
0.094382
0.676404
0.640449
0.640449
0.640449
0.640449
0.640449
0
0
0.216578
748
32
51
23.375
0.759386
0
0
0.47619
0
0
0
0
0
0
0
0
0
1
0.380952
false
0
0.095238
0
0.619048
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
0
0
0
2
1d29017f4511910f0174405b87a2a8e0e9617ca9
2,054
py
Python
app/project/routes.py
caulagi/shakuni
f027810bc72b55da302d6672cd64fdf7c92f1661
[ "MIT" ]
null
null
null
app/project/routes.py
caulagi/shakuni
f027810bc72b55da302d6672cd64fdf7c92f1661
[ "MIT" ]
null
null
null
app/project/routes.py
caulagi/shakuni
f027810bc72b55da302d6672cd64fdf7c92f1661
[ "MIT" ]
null
null
null
""" project.routes Bind the api's to the endpoints """ from flask.ext.restful import Api from flask import render_template, g import urllib, hashlib # Set your variables here #from users.api import * def routes_init(application): @application.errorhandler(404) def page_not_found(e): return render_template('404.html'), 404 @application.errorhandler(401) def unauthorized(e): return render_template('401.html'), 401 @application.errorhandler(403) def forbidden(e): return render_template('403.html', error=e.description), 403 @application.errorhandler(500) def forbidden(e): return render_template('500.html'), 500 @application.route("/") def index(): if g.user: size = 120 gravatar_url = "http://www.gravatar.com/avatar/" + hashlib.md5(g.user.email.lower()).hexdigest() + "?" gravatar_url += urllib.urlencode({'d': 'retro', 's':str(size)}) g.user.gravatar_url = gravatar_url return render_template("index.html", user=g.user) @application.route("/about") def about(): return render_template("about.html") @application.route("/faq") def faq(): return render_template("faq.html") import app.users.controllers as users_controller users_controller.init(application) application.register_blueprint(users_controller.users_blueprint, url_prefix="/users") import app.groups.controllers as groups_controller groups_controller.init(application) application.register_blueprint(groups_controller.groups_blueprint, url_prefix="/groups") import app.matches.controllers as matches_controller matches_controller.init(application) application.register_blueprint(matches_controller.matches_blueprint, url_prefix="/matches") import app.bets.controllers as bets_controller bets_controller.init(application) application.register_blueprint(bets_controller.bets_blueprint, url_prefix="/bets") api = Api(application) return api
31.121212
114
0.704479
244
2,054
5.770492
0.29918
0.079545
0.099432
0.059659
0.197443
0.197443
0
0
0
0
0
0.023838
0.183057
2,054
65
115
31.6
0.815256
0.046251
0
0.045455
0
0
0.069744
0
0
0
0
0
0
1
0.181818
false
0
0.159091
0.136364
0.522727
0.090909
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
1d2c8cfdfba0fe6e68b2b9783c5f048e8690aa72
2,730
py
Python
proj03_guessing_game/proj03.py
miashi201/VsaProj1
851383b773cf1b2e356c5c7de7165c68b4a3cb2a
[ "MIT" ]
null
null
null
proj03_guessing_game/proj03.py
miashi201/VsaProj1
851383b773cf1b2e356c5c7de7165c68b4a3cb2a
[ "MIT" ]
null
null
null
proj03_guessing_game/proj03.py
miashi201/VsaProj1
851383b773cf1b2e356c5c7de7165c68b4a3cb2a
[ "MIT" ]
null
null
null
# Name: Elizabeth Sims and Mia shines # Date: 7/10/18 import random """ proj 03: Guessing Game Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. Keep the game going until the user types exit. Keep track of how many guesses the user has taken, and when the game ends, print this out. """ #define variables first_loop = True points = 0 #loop while first_loop == True: second_loop = True random_number = random.randint(1, 9) guess_number = 0 print "I'm thinking of a number between 1 and 9. Can you guess my number?" max_guesses = int(raw_input("How many guesses do you want? ")) while second_loop == True: if guess_number == max_guesses: print "You are out of guesses! The number was " + str(random_number) + "." second_loop = False print "You have " + str(points) + " points." play_again = raw_input("Would you like to play again? (y/n)") if play_again == "n": first_loop = False print "Game ended." else: user_input = raw_input("Enter a number, or 'exit' to end the game: ") try: int(user_input) if int(user_input) < 1 or int(user_input) > 9: print "That is not a number between 1 and 9!" elif int(user_input) > random_number: print "Your number is too high!" guess_number = guess_number + 1 elif int(user_input) < random_number: print "Your number is too low!" guess_number = guess_number + 1 elif int(user_input) == random_number: guess_number = guess_number + 1 print "Congratulations, you guessed my number!", "You used", guess_number, "guesses." second_loop = False points = points + 1 if points == 1: print "You have " + str(points) + " point." else: print "You have " + str(points) + " points." play_again = raw_input("Would you like to play again? (y/n)" ) if play_again == "n": first_loop = False print "Game ended." except ValueError: if str(user_input) == "exit" or "Exit": print "Game ended." first_loop = False second_loop = False else: print "That is not a valid answer!"
40.147059
105
0.532234
342
2,730
4.125731
0.315789
0.070163
0.051028
0.036145
0.366407
0.301914
0.274982
0.274982
0.274982
0.274982
0
0.015569
0.388278
2,730
67
106
40.746269
0.829341
0.025275
0
0.42
1
0
0.219628
0
0
0
0
0
0
0
null
null
0
0.02
null
null
0.26
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
1
0
0
0
0
0
0
0
0
2
1d34f74f427a0516ceda729deadc0d3b32821d10
635
py
Python
src/torchphysics/problem/spaces/__init__.py
TomF98/torchphysics
b509385b623516e9475870ab2ca81fef1924dea4
[ "Apache-2.0" ]
203
2021-11-10T10:33:29.000Z
2022-03-26T09:05:12.000Z
src/torchphysics/problem/spaces/__init__.py
DKreuter/torchphysics
775d9aca71752a568f1fca972c958b99107f3b7c
[ "Apache-2.0" ]
3
2022-01-07T19:57:00.000Z
2022-03-10T08:04:49.000Z
src/torchphysics/problem/spaces/__init__.py
DKreuter/torchphysics
775d9aca71752a568f1fca972c958b99107f3b7c
[ "Apache-2.0" ]
16
2021-09-30T08:35:37.000Z
2022-03-16T13:12:22.000Z
"""Contains the Spaces and Points classes. Spaces It's purpose is to define variable names and dimensions that can be used in functions, domains, models and more. Points The ``Points`` object is a central part of TorchPhysics. They consit of a PyTorch-Tensor and a space. ``Points`` store data in a tensor with 2-axis, the first corresponding the batch-dimension in a batch of multiple points. The second axis collects the space dimensionalities. """ from .space import (Space, R1, R2, R3) from .points import Points from .functionspace import FunctionSpace
33.421053
90
0.688189
89
635
4.910112
0.606742
0.04119
0
0
0
0
0
0
0
0
0
0.008475
0.256693
635
19
91
33.421053
0.917373
0.724409
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
0
1
0
0
0
0
2
1d82f23690d8eeb6b0853706af4e58450c3a0838
314
py
Python
client_code/EmailDisplayForm/RowTemplate1/__init__.py
benlawraus/pyDALAnvilWorks
8edc67b0fbe65bdcc0ef6fd2424f55046cacba7c
[ "MIT" ]
6
2021-11-14T22:49:40.000Z
2022-03-26T17:40:40.000Z
client_code/EmailDisplayForm/RowTemplate1/__init__.py
benlawraus/pyDALAnvilWorks
8edc67b0fbe65bdcc0ef6fd2424f55046cacba7c
[ "MIT" ]
null
null
null
client_code/EmailDisplayForm/RowTemplate1/__init__.py
benlawraus/pyDALAnvilWorks
8edc67b0fbe65bdcc0ef6fd2424f55046cacba7c
[ "MIT" ]
1
2022-01-31T01:18:32.000Z
2022-01-31T01:18:32.000Z
from ._anvil_designer import RowTemplate1Template class RowTemplate1(RowTemplate1Template): def __init__(self, **properties): # Set Form properties and Data Bindings. self.init_components(**properties) # Any code you write here will run when the form opens. # testing `item`
28.545455
63
0.703822
35
314
6.114286
0.828571
0
0
0
0
0
0
0
0
0
0
0.012346
0.226115
314
10
64
31.4
0.868313
0.340764
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
1d9dbf8b000ae0cc7e5e5f481d9ea5dc1e0ff6dd
446
py
Python
model_config.py
dimagrshk/opt_flow_attack
6bfad92abcf3eaae1a6ca05b865be072361636ed
[ "Apache-2.0" ]
null
null
null
model_config.py
dimagrshk/opt_flow_attack
6bfad92abcf3eaae1a6ca05b865be072361636ed
[ "Apache-2.0" ]
null
null
null
model_config.py
dimagrshk/opt_flow_attack
6bfad92abcf3eaae1a6ca05b865be072361636ed
[ "Apache-2.0" ]
null
null
null
MODELS = { "pwc": ( 'configs/pwcnet/pwcnet_ft_4x1_300k_sintel_final_384x768.py', 'checkpoints/pwcnet_ft_4x1_300k_sintel_final_384x768.pth' ), "flownetc": ( 'configs/flownet/flownetc_8x1_sfine_sintel_384x448.py', 'checkpoints/flownetc_8x1_sfine_sintel_384x448.pth' ), "raft": ( "configs/raft/raft_8x2_100k_mixed_368x768.py", "checkpoints/raft_8x2_100k_mixed_368x768.pth" ) }
31.857143
69
0.683857
53
446
5.226415
0.433962
0.140794
0.079422
0.108303
0.613718
0.238267
0.238267
0
0
0
0
0.169014
0.204036
446
14
70
31.857143
0.611268
0
0
0.142857
0
0
0.702461
0.668904
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1da56ac8d085091a240e8d143a5b83886cd54a6f
1,648
py
Python
migrations/versions/79a1a8f844e4_added_basic_stich_clone_qc_columns.py
charlestondance/amoslims
c1d051db3e88a92644446744a9027c5699f52b02
[ "MIT" ]
null
null
null
migrations/versions/79a1a8f844e4_added_basic_stich_clone_qc_columns.py
charlestondance/amoslims
c1d051db3e88a92644446744a9027c5699f52b02
[ "MIT" ]
7
2020-03-24T15:56:29.000Z
2022-01-13T00:48:15.000Z
migrations/versions/79a1a8f844e4_added_basic_stich_clone_qc_columns.py
charlestondance/amoslims
c1d051db3e88a92644446744a9027c5699f52b02
[ "MIT" ]
null
null
null
"""added basic stich clone qc columns Revision ID: 79a1a8f844e4 Revises: e466f84812fa Create Date: 2017-06-05 17:58:49.231834 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '79a1a8f844e4' down_revision = 'e466f84812fa' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('basic_stitch_clone', sa.Column('stitch_qc1', sa.String(length=64), nullable=True)) op.add_column('basic_stitch_clone', sa.Column('stitch_qc2', sa.String(length=64), nullable=True)) op.add_column('basic_stitch_clone', sa.Column('stitch_qc3', sa.String(length=64), nullable=True)) op.create_index(op.f('ix_basic_stitch_clone_stitch_qc1'), 'basic_stitch_clone', ['stitch_qc1'], unique=False) op.create_index(op.f('ix_basic_stitch_clone_stitch_qc2'), 'basic_stitch_clone', ['stitch_qc2'], unique=False) op.create_index(op.f('ix_basic_stitch_clone_stitch_qc3'), 'basic_stitch_clone', ['stitch_qc3'], unique=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_basic_stitch_clone_stitch_qc3'), table_name='basic_stitch_clone') op.drop_index(op.f('ix_basic_stitch_clone_stitch_qc2'), table_name='basic_stitch_clone') op.drop_index(op.f('ix_basic_stitch_clone_stitch_qc1'), table_name='basic_stitch_clone') op.drop_column('basic_stitch_clone', 'stitch_qc3') op.drop_column('basic_stitch_clone', 'stitch_qc2') op.drop_column('basic_stitch_clone', 'stitch_qc1') # ### end Alembic commands ###
42.25641
113
0.745752
242
1,648
4.743802
0.264463
0.172474
0.250871
0.229965
0.719512
0.646341
0.646341
0.511324
0.438153
0.38676
0
0.05
0.114078
1,648
38
114
43.368421
0.736301
0.191748
0
0
0
0
0.403089
0.148263
0
0
0
0
0
1
0.1
false
0
0.1
0
0.2
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d5262a6fc96421d43f5b56640b4e33f5d4ceae8b
136
py
Python
python/cursoemvideo-python/01-mundo-1-e-mundo-2/tabuada v2.0.py
Alex4gtx/estudos
cf5908c543be1b112157b1c95f3d987484ff2505
[ "MIT" ]
null
null
null
python/cursoemvideo-python/01-mundo-1-e-mundo-2/tabuada v2.0.py
Alex4gtx/estudos
cf5908c543be1b112157b1c95f3d987484ff2505
[ "MIT" ]
null
null
null
python/cursoemvideo-python/01-mundo-1-e-mundo-2/tabuada v2.0.py
Alex4gtx/estudos
cf5908c543be1b112157b1c95f3d987484ff2505
[ "MIT" ]
null
null
null
numb = int(input('Digite um numero para ver sua tabuada: ')) for n in range(1, 11): print('{} x {} = {}'.format(numb, n, numb * n))
34
60
0.580882
23
136
3.434783
0.826087
0.126582
0
0
0
0
0
0
0
0
0
0.027778
0.205882
136
3
61
45.333333
0.703704
0
0
0
0
0
0.375
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d5292b18bbdcde0f2d3c02cfe72a62dd2683938b
463
py
Python
src/website/urls.py
ihabhussein/django-template
d2b3d5c04088757f26693bb20ca3dede305459d3
[ "BSD-2-Clause" ]
null
null
null
src/website/urls.py
ihabhussein/django-template
d2b3d5c04088757f26693bb20ca3dede305459d3
[ "BSD-2-Clause" ]
null
null
null
src/website/urls.py
ihabhussein/django-template
d2b3d5c04088757f26693bb20ca3dede305459d3
[ "BSD-2-Clause" ]
null
null
null
from django.conf import settings from django.urls import path, include from django.conf.urls.static import static from django.contrib import admin from django.views.generic import RedirectView urlpatterns = [ path('admin/', admin.site.urls), path('accounts/', include('django.contrib.auth.urls')), path('/.well-known/change-password', RedirectView.as_view(url='password_change')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
30.866667
86
0.764579
62
463
5.629032
0.451613
0.143266
0.080229
0
0
0
0
0
0
0
0
0
0.107991
463
14
87
33.071429
0.845036
0
0
0
0
0
0.177106
0.112311
0
0
0
0
0
1
0
false
0.1
0.5
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
d53d9151f70f83e0d5f3ba15a3b5ee4df2048e41
67
py
Python
test/scripts/test_sim_run.py
avicennax/magesim-tbc2
942e24dd186639f52f15e049239acbc3ab0308d7
[ "MIT" ]
null
null
null
test/scripts/test_sim_run.py
avicennax/magesim-tbc2
942e24dd186639f52f15e049239acbc3ab0308d7
[ "MIT" ]
null
null
null
test/scripts/test_sim_run.py
avicennax/magesim-tbc2
942e24dd186639f52f15e049239acbc3ab0308d7
[ "MIT" ]
null
null
null
from magesim.simulation import Sim s = Sim() s.run() s.print_log()
13.4
34
0.716418
12
67
3.916667
0.75
0.170213
0
0
0
0
0
0
0
0
0
0
0.134328
67
5
35
13.4
0.810345
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d555a329d04b99cc54dc6952e18a6842fdcdd3f1
1,031
py
Python
src/urh/ui/actions/InsertBitsAndPauses.py
awesome-archive/urh
c8c3aabc9d637ca660d8c72c3d8372055e0f3ec7
[ "Apache-2.0" ]
1
2017-06-21T02:37:16.000Z
2017-06-21T02:37:16.000Z
src/urh/ui/actions/InsertBitsAndPauses.py
dspmandavid/urh
30643c1a68634b1c97eb9989485a4e96a3b038ae
[ "Apache-2.0" ]
null
null
null
src/urh/ui/actions/InsertBitsAndPauses.py
dspmandavid/urh
30643c1a68634b1c97eb9989485a4e96a3b038ae
[ "Apache-2.0" ]
null
null
null
import copy from PyQt5.QtWidgets import QUndoCommand from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer from urh.signalprocessing.ProtocolAnalyzerContainer import ProtocolAnalyzerContainer class InsertBitsAndPauses(QUndoCommand): def __init__(self, proto_analyzer_container: ProtocolAnalyzerContainer, index: int, pa: ProtocolAnalyzer): super().__init__() self.proto_analyzer_container = proto_analyzer_container self.proto_analyzer = pa self.index = index if self.index == -1 or self.index > len(self.proto_analyzer_container.messages): self.index = len(self.proto_analyzer_container.messages) self.setText("Insert Bits at index {0:d}".format(self.index)) self.orig_messages = copy.deepcopy(self.proto_analyzer_container.messages) def redo(self): self.proto_analyzer_container.insert_protocol_analyzer(self.index, self.proto_analyzer) def undo(self): self.proto_analyzer_container.messages = self.orig_messages
39.653846
110
0.761397
117
1,031
6.452991
0.333333
0.172185
0.202649
0.24106
0.34702
0.177483
0.127152
0.127152
0.127152
0
0
0.003464
0.160039
1,031
25
111
41.24
0.86836
0
0
0
0
0
0.025218
0
0
0
0
0
0
1
0.166667
false
0
0.222222
0
0.444444
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d5585c7c9ec82a5d812b1ae0ecf788ae2d023b15
14,963
py
Python
CodeGenerator/Generators/EntityGenerator.py
Cooolrik/ISD
c06afd5a2f4e7d2fe21ba3c77e60595c1bd24ade
[ "MIT" ]
null
null
null
CodeGenerator/Generators/EntityGenerator.py
Cooolrik/ISD
c06afd5a2f4e7d2fe21ba3c77e60595c1bd24ade
[ "MIT" ]
null
null
null
CodeGenerator/Generators/EntityGenerator.py
Cooolrik/ISD
c06afd5a2f4e7d2fe21ba3c77e60595c1bd24ade
[ "MIT" ]
null
null
null
# ISD Copyright (c) 2021 Ulrik Lindahl # Licensed under the MIT license # https://github.com/Cooolrik/ISD/blob/main/LICENSE import CodeGeneratorHelpers as hlp import Entities as ents def CreateEntityHeader(entity): lines = [] lines.append('// ISD Copyright (c) 2021 Ulrik Lindahl') lines.append('// Licensed under the MIT license https://github.com/Cooolrik/ISD/blob/main/LICENSE') lines.append('') lines.append('#pragma once') lines.append('') lines.append('#include "ISD_Types.h"') # list dependences that needs to be included in the header for dep in entity.Dependencies: if dep.IncludeInHeader: lines.append(f'#include "ISD_{dep.Name}.h"') lines.append('') lines.append('namespace ISD') lines.append(' {') # list dependences that only needs a forward reference in the header for dep in entity.Dependencies: if not dep.IncludeInHeader: lines.append(f' class {dep.Name};') lines.append(f' class {entity.Name}') lines.append(' {') lines.append(' public:') # list typedefs of templates if len(entity.Templates) > 0: for typ in entity.Templates: lines.append(typ.Declaration) lines.append('') lines.append(' class MF;') lines.append(' friend MF;') lines.append('') lines.append(f' {entity.Name}() = default;') lines.append(f' {entity.Name}( const {entity.Name} &rval );') lines.append(f' {entity.Name} &operator=( const {entity.Name} &rval );') lines.append(f' {entity.Name}( {entity.Name} &&rval ) = default;') lines.append(f' {entity.Name} &operator=( {entity.Name} &&rval ) = default;') lines.append(f' ~{entity.Name}() = default;') lines.append('') lines.append(' // value compare operators') lines.append(f' bool operator==( const {entity.Name} &rval ) const;') lines.append(f' bool operator!=( const {entity.Name} &rval ) const;') lines.append('') lines.append(' protected:') # list variables in entity for var in entity.Variables: if var.IsSimpleBaseType: lines.append(f' {var.TypeString} v_{var.Name} = {{}};') else: lines.append(f' {var.TypeString} v_{var.Name};') lines.append('') lines.append(' public:') # create accessor ref for variables, const and non-const versions for var in entity.Variables: lines.append(f' // accessor for referencing variable {var.Name}') lines.append(f' const {var.TypeString} & {var.Name}() const {{ return this->v_{var.Name}; }}') lines.append(f' {var.TypeString} & {var.Name}() {{ return this->v_{var.Name}; }}') lines.append('') lines.append(' };') lines.append('') lines.append(' class EntityWriter;') lines.append(' class EntityReader;') lines.append(' class EntityValidator;') lines.append('') lines.append(f' class {entity.Name}::MF') lines.append(' {') lines.append(' public:') lines.append(f' static void Clear( {entity.Name} &obj );') lines.append(f' static void DeepCopy( {entity.Name} &dest, const {entity.Name} *source );') lines.append(f' static bool Equals( const {entity.Name} *lvar, const {entity.Name} *rvar );') lines.append('') lines.append(f' static bool Write( const {entity.Name} &obj, EntityWriter &writer );') lines.append(f' static bool Read( {entity.Name} &obj, EntityReader &reader );') lines.append('') lines.append(f' static bool Validate( const {entity.Name} &obj, EntityValidator &validator );') lines.append(' };') lines.append('') # ctors and copy operator code lines.append(f' inline {entity.Name}::{entity.Name}( const {entity.Name} &rval )') lines.append(' {') lines.append(' MF::DeepCopy( *this , &rval );') lines.append(' }') lines.append('') lines.append(f' inline {entity.Name} &{entity.Name}::operator=( const {entity.Name} &rval )') lines.append(' {') lines.append(' MF::DeepCopy( *this , &rval );') lines.append(' return *this;') lines.append(' }') lines.append('') lines.append(f' inline bool {entity.Name}::operator==( const {entity.Name} &rval ) const') lines.append(' {') lines.append(' return MF::Equals( this, &rval );') lines.append(' }') lines.append('') lines.append(f' inline bool {entity.Name}::operator!=( const {entity.Name} &rval ) const') lines.append(' {') lines.append(' return !(MF::Equals( this, &rval ));') lines.append(' }') lines.append('') lines.append(' };') hlp.write_lines_to_file(f"../ISD/ISD_{entity.Name}.h",lines) def ImplementClearCall(entity,var): lines = [] lines.append('') lines.append(f' // clear variable "{var.Name}"') # clear all values, base values and Entities base_type,base_variant = hlp.get_base_type_variant(var.Type) if base_type is not None: # we have a base type, add the write code directly if var.Optional: lines.append(f' obj.v_{var.Name}.reset();') else: lines.append(f' obj.v_{var.Name} = {{}};') else: lines.append(f' {var.Type}::MF::Clear( obj.v_{var.Name} );') return lines def ImplementDeepCopyCall(entity,var): lines = [] lines.append('') lines.append(f' // copy variable "{var.Name}"') # clear all base values, Entities will clear themselves # deep copy all values if var.IsBaseType: # we have a base type, add the copy code directly lines.append(f' dest.v_{var.Name} = source->v_{var.Name};') else: # this is an entity type if var.Optional: lines.append(f' if( source->v_{var.Name}.has_value() )') lines.append(' {') lines.append(f' dest.v_{var.Name}.set();') lines.append(f' {var.Type}::MF::DeepCopy( dest.v_{var.Name}.value() , &(source->v_{var.Name}.value()) );') lines.append(' }') lines.append(f' else') lines.append(' {') lines.append(f' dest.v_{var.Name}.reset();') lines.append(' }') else: lines.append(f' {var.Type}::MF::DeepCopy( dest.v_{var.Name} , &(source->v_{var.Name}) );') return lines def ImplementEqualsCall(entity,var): lines = [] lines.append(f' // check variable "{var.Name}"') # do we have a base type or entity? if var.IsBaseType: # we have a base type, do the compare directly lines.append(f' if( lvar->v_{var.Name} != rvar->v_{var.Name} )') lines.append(f' return false;') else: # not a base type, so an entity. check entity if var.Optional: lines.append(f' if( !{entity.Name}::{var.Type}::MF::Equals(') lines.append(f' lvar->v_{var.Name}.has_value() ? &lvar->v_{var.Name}.value() : nullptr, ') lines.append(f' rvar->v_{var.Name}.has_value() ? &rvar->v_{var.Name}.value() : nullptr') lines.append(f' ) )') lines.append(' return false;') else: lines.append(f' if( !{entity.Name}::{var.Type}::MF::Equals( &lvar->v_{var.Name} , &rvar->v_{var.Name} ) )') lines.append(' return false;') lines.append('') return lines def ImplementWriterCall(entity,var): lines = [] # do we have a base type or entity? if var.IsBaseType: # we have a base type, add the write code directly lines.append(f' // write variable "{var.Name}"') lines.append(f' success = writer.Write<{var.TypeString}>( ISDKeyMacro("{var.Name}") , obj.v_{var.Name} );') lines.append(f' if( !success )') lines.append(f' return false;') lines.append('') else: # not a base type, so an entity. add a block lines.append(f' // write section "{var.Name}"') lines.append(f' success = (section_writer = writer.BeginWriteSection( ISDKeyMacro("{var.Name}") ));') lines.append(' if( !success )') lines.append(' return false;') if var.Optional: lines.append(f' if( obj.v_{var.Name}.has_value() )') lines.append(' {') lines.append(f' if( !{entity.Name}::{var.Type}::MF::Write( obj.v_{var.Name}.value(), *section_writer ) )') lines.append(' return false;') lines.append(' }') else: lines.append(f' if( !{entity.Name}::{var.Type}::MF::Write( obj.v_{var.Name}, *section_writer ) )') lines.append(' return false;') lines.append(' writer.EndWriteSection( section_writer );') lines.append(' section_writer = nullptr;') lines.append('') return lines def ImplementReaderCall(entity,var): lines = [] if var.Optional: value_can_be_null = "true" else: value_can_be_null = "false" # do we have a base type or entity? if var.IsBaseType: # we have a base type, add the read code directly lines.append(f' // read variable "{var.Name}"') lines.append(f' success = reader.Read<{var.TypeString}>( ISDKeyMacro("{var.Name}") , obj.v_{var.Name} );') lines.append(f' if( !success )') lines.append(f' return false;') lines.append('') else: # not a base type, so an entity. add a block lines.append(f' // read section "{var.Name}"') lines.append(f' std::tie(section_reader,success) = reader.BeginReadSection( ISDKeyMacro("{var.Name}") , {value_can_be_null} );') lines.append(' if( !success )') lines.append(' return false;') lines.append(' if( section_reader )') lines.append(' {') if var.Optional: lines.append(f' obj.v_{var.Name}.set();') lines.append(f' if( !{entity.Name}::{var.Type}::MF::Read( obj.v_{var.Name}.value(), *section_reader ) )') else: lines.append(f' if( !{entity.Name}::{var.Type}::MF::Read( obj.v_{var.Name}, *section_reader ) )') lines.append(' return false;') lines.append(' reader.EndReadSection( section_reader );') lines.append(' section_reader = nullptr;') lines.append(' }') if var.Optional: lines.append(' else') lines.append(f' obj.v_{var.Name}.reset();') lines.append('') return lines def ImplementValidatorCall(entity,var): lines = [] # clear all values, base values and Entities base_type,base_variant = hlp.get_base_type_variant(var.Type) if base_type is None: lines.append(f' // validate variable "{var.Name}"') if var.Optional: lines.append(f' if( obj.v_{var.Name}.has_value() )') lines.append(' {') lines.append(f' success = {var.Type}::MF::Validate( obj.v_{var.Name}.value() , validator );') lines.append(' if( !success )') lines.append(' return false;') lines.append(' }') else: lines.append(f' success = {var.Type}::MF::Validate( obj.v_{var.Name} , validator );') lines.append(' if( !success )') lines.append(' return false;') lines.append('') return lines def CreateEntitySource(entity): lines = [] lines.append('// ISD Copyright (c) 2021 Ulrik Lindahl') lines.append('// Licensed under the MIT license https://github.com/Cooolrik/ISD/blob/main/LICENSE') lines.append('') lines.append(f'#include "ISD_Types.h"') lines.append(f'#include "ISD_EntityWriter.h"') lines.append(f'#include "ISD_EntityReader.h"') lines.append(f'#include "ISD_EntityValidator.h"') lines.append('') lines.append(f'#include "ISD_{entity.Name}.h"') # include dependences that were forward referenced in the header for dep in entity.Dependencies: if not dep.IncludeInHeader: lines.append(f'#include "ISD_{dep.Name}.h"') lines.append('') lines.append('namespace ISD') lines.append(' {') # check if there are entities in the variable list vars_have_entity = False for var in entity.Variables: base_type,base_variant = hlp.get_base_type_variant(var.Type) if base_type is None: vars_have_entity = True break # clear code lines.append(f' void {entity.Name}::MF::Clear( {entity.Name} &obj )') lines.append(' {') lines.append(' // direct clear calls on variables and Entities') for var in entity.Variables: lines.extend(ImplementClearCall(entity,var)) lines.append(' }') lines.append('') # deep copy code lines.append(f' void {entity.Name}::MF::DeepCopy( {entity.Name} &dest, const {entity.Name} *source )') lines.append(' {') lines.append(' // just call Clear if source is nullptr') lines.append(' if( !source )') lines.append(' {') lines.append(' MF::Clear( dest );') lines.append(' return;') lines.append(' }') for var in entity.Variables: lines.extend(ImplementDeepCopyCall(entity,var)) lines.append(' }') lines.append('') # equals code lines.append(f' bool {entity.Name}::MF::Equals( const {entity.Name} *lvar, const {entity.Name} *rvar )') lines.append(' {') lines.append(' // early out if pointers are equal') lines.append(' if( lvar == rvar )') lines.append(' return true;') lines.append('') lines.append(' // early out if one of the pointers is nullptr') lines.append(' if( !lvar || !rvar )') lines.append(' return false;') lines.append('') for var in entity.Variables: lines.extend(ImplementEqualsCall(entity,var)) lines.append(' return true;') lines.append(' }') lines.append('') # writer code lines.append(f' bool {entity.Name}::MF::Write( const {entity.Name} &obj, EntityWriter &writer )') lines.append(' {') lines.append(' bool success = true;') if vars_have_entity: lines.append(' EntityWriter *section_writer = nullptr;') lines.append('') for var in entity.Variables: lines.extend(ImplementWriterCall(entity,var)) lines.append(' return true;') lines.append(' }') lines.append('') # reader code lines.append(f' bool {entity.Name}::MF::Read( {entity.Name} &obj, EntityReader &reader )') lines.append(' {') lines.append(' bool success = true;') if vars_have_entity: lines.append(' EntityReader *section_reader = nullptr;') lines.append('') for var in entity.Variables: lines.extend(ImplementReaderCall(entity,var)) lines.append(' return true;') lines.append(' }') lines.append('') # validator code lines.append(f' bool {entity.Name}::MF::Validate( const {entity.Name} &obj, EntityValidator &validator )') lines.append(' {') lines.append(' bool success = true;') lines.append('') for var in entity.Variables: lines.extend(ImplementValidatorCall(entity,var)) lines.append(' return true;') lines.append(' }') lines.append('') lines.append(' };') hlp.write_lines_to_file(f"../ISD/ISD_{entity.Name}.cpp",lines) def run(): for entity in ents.Entities: CreateEntityHeader(entity) CreateEntitySource(entity)
36.584352
137
0.610239
1,883
14,963
4.793415
0.096123
0.274208
0.109018
0.13162
0.775759
0.715489
0.649125
0.603922
0.507755
0.445934
0
0.001112
0.218806
14,963
408
138
36.67402
0.771067
0.082203
0
0.580442
0
0.082019
0.510585
0.109286
0
0
0
0
0
1
0.028391
false
0
0.006309
0
0.053628
0
0
0
0
null
1
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
0
0
0
0
2
d559271b88067f1b332818a736955504517b1537
4,846
py
Python
tests/fixtures/project_django/app.py
nappex/freezeyt
67ead4552ae402cedfcf4ee8ec76fb8a07850724
[ "MIT" ]
7
2020-09-23T15:27:09.000Z
2022-03-20T19:31:41.000Z
tests/fixtures/project_django/app.py
nappex/freezeyt
67ead4552ae402cedfcf4ee8ec76fb8a07850724
[ "MIT" ]
160
2020-07-06T17:58:35.000Z
2022-03-30T13:06:07.000Z
tests/fixtures/project_django/app.py
nappex/freezeyt
67ead4552ae402cedfcf4ee8ec76fb8a07850724
[ "MIT" ]
10
2020-07-06T18:05:10.000Z
2022-03-12T21:20:11.000Z
import os from werkzeug.middleware.shared_data import SharedDataMiddleware from demo_project.wsgi import application as django_wsgi_app app = SharedDataMiddleware(django_wsgi_app, { '/static': os.path.join(os.path.dirname(__file__), 'static') }) freeze_config = {'extra_pages': ['/extra/']} expected_dict = { 'index.html': b"\n <html>\n <head>\n " + b"<title>Hello world app</title>\n </head>\n <body>\n" + b" <h3>Hello world! This is a home page of app.</h3>\n" + b" <div>\n <a href='/second_page.html'>LINK" + b"</a> to second page.\n </div>\n </body>\n" + b" </html>\n ", 'second_page.html': b'\n <html>\n <head>\n ' + b'<title>Hello world app</title>\n </head>\n ' + b'<body>\n <h3>Second page !!!</h3>\n <div>\n' + b' <a href="/third_page/">LINK</a> to third page.\n' + b' </div>\n </body>\n </html>\n ', 'third_page': { 'index.html': b'\n <html>\n <head>\n ' + b'<title>Hello world app</title>\n </head>\n ' + b'<body>\n <h3>Third page !!!</h3>\n ' + b'<div>\n <a href="/image_page/">LINK</a> to page ' + b'with smile.png\n </div>\n <div>\n' + b" <a href='/'>LINK</a> to home page.\n" + b' </div>\n </body>\n </html>\n ' }, 'image_page': { 'index.html': b'\n <html>\n <head>\n ' + b'<title>Hello world app</title>\n </head>\n' + b' <body>\n <h3>Image page !!!</h3>\n' + b' <div>\n \n ' + b'<img src="/static/demo_app/smile.png" alt="smile">\n' + b' </div>\n <div>\n ' + b'<a href="/">HOME</a> back to index page.\n </div>\n' + b' <div>\n ' + b'<a href="/third_page/">BACK</a> back to third page.\n' + b' </div>\n </body>\n </html>\n ' }, 'extra': { 'index.html': b'\n <html>\n <head>\n ' + b'<title>Hello world app</title>\n </head>\n' + b' <body>\n <h3>Hello world! This ' + b'is a extra page of app.</h3>\n <div>\n' + b' Theres is no any link to this page in app.\n' + b' </div>\n </body>\n </html>\n ' }, 'static': { 'demo_app': { 'smile.png': b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x08\x00\x00\x00\x08\x08\x06\x00\x00\x00\xc4\x0f\xbe\x8b\x00\x00\x01\x85iCCPICC profile\x00\x00(\x91}\x91=H\xc3@\x1c\xc5_[\xa5\xa5T\x14,"\xe2\x90\xa1:Y\x10\xbfp\xd4*\x14\xa1B\xa8\x15Zu0\xb9\xf4Ch\xd2\x90\xa4\xb88\n\xae\x05\x07?\x16\xab\x0e.\xce\xba:\xb8\n\x82\xe0\x07\x88\x93\xa3\x93\xa2\x8b\x94\xf8\xbf\xa4\xd0"\xc6\x83\xe3~\xbc\xbb\xf7\xb8{\x07\xf8\xebe\xa6\x9a\x1d\xa3\x80\xaaYF:\x99\x10\xb2\xb9\x15!\xf8\x8a\x10\xc2\xe8\xc1$\xfa$f\xea\xb3\xa2\x98\x82\xe7\xf8\xba\x87\x8f\xafwq\x9e\xe5}\xee\xcf\xd1\xa5\xe4M\x06\xf8\x04\xe2\x19\xa6\x1b\x16\xf1:\xf1\xd4\xa6\xa5s\xde\'\x8e\xb2\x92\xa4\x10\x9f\x13\x8f\x18tA\xe2G\xae\xcb.\xbfq.:\xec\xe7\x99Q#\x93\x9e#\x8e\x12\x0b\xc56\x96\xdb\x98\x95\x0c\x95x\x828\xa6\xa8\x1a\xe5\xfb\xb3.+\x9c\xb78\xab\xe5*k\xde\x93\xbf0\x92\xd7\x96\x97\xb8Ns\x10I,`\x11"\x04\xc8\xa8b\x03eX\x88\xd3\xaa\x91b"M\xfb\t\x0f\xff\x80\xe3\x17\xc9%\x93k\x03\x8c\x1c\xf3\xa8@\x85\xe4\xf8\xc1\xff\xe0w\xb7fa|\xccM\x8a$\x80\xce\x17\xdb\xfe\x18\x02\x82\xbb@\xa3f\xdb\xdf\xc7\xb6\xdd8\x01\x02\xcf\xc0\x95\xd6\xf2W\xea\xc0\xf4\'\xe9\xb5\x96\x16;\x02\xba\xb7\x81\x8b\xeb\x96&\xef\x01\x97;@\xff\x93.\x19\x92#\x05h\xfa\x0b\x05\xe0\xfd\x8c\xbe)\x07\xf4\xde\x02\xe1U\xb7\xb7\xe6>N\x1f\x80\x0cu\x95\xba\x01\x0e\x0e\x81\xe1"e\xafy\xbc;\xd4\xde\xdb\xbfg\x9a\xfd\xfd\x00z~r\xaa\x113\xb8=\x00\x00\x00\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\x00\x00\tpHYs\x00\x00.#\x00\x00.#\x01x\xa5?v\x00\x00\x00\x07tIME\x07\xe4\x08\n\x107\x0euUv\xd2\x00\x00\x00\x19tEXtComment\x00Created with GIMPW\x81\x0e\x17\x00\x00\x00eIDAT\x18\xd3}\xcf\xb1\r\x83P\x10\x03\xd0\xf7\xbf\x18\x83&]\xb2\x05\x15\x15M\xf6HA\xc1 \x14\xec\x91\x9ea`\x14(\xf8QN\x11\xc4\x8d\xed\xbb\x93\xe5K\x0et\xa8\xb1\xf9b\xc5\x0c\x8dk\xb4\x19\xf7b\xdea1\x15\xbe\xe50|\x06\xfd*\x9c\xe2A\x7f\x92\xa0\n\xc5F\x0c\xc81\x01\xda?%\x9b\xf4\x11x\xfc\xbc\xb9`\xde\x01Qk\x0c\xd9>\xf6\x12\xa2\x00\x00\x00\x00IEND\xaeB`\x82', }, }, }
67.305556
1,935
0.517128
784
4,846
3.167092
0.354592
0.020942
0.039871
0.025373
0.225131
0.196939
0.190093
0.153041
0.146597
0.138542
0
0.150965
0.272802
4,846
71
1,936
68.253521
0.553632
0
0
0.25
0
0.033333
0.695832
0.334915
0
0
0
0
0
1
0
false
0
0.05
0
0.05
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d5604b64db4d3f320f8d3028c22641d0b46395b6
193
py
Python
dmrg101/utils/tridiagonal_solver/example_9_13.py
chanul13/hubbard_dimer
0a1eefdf4cb5cc5f80bd3348d045a90890f51b6c
[ "MIT" ]
42
2015-02-11T03:08:04.000Z
2022-03-28T14:54:39.000Z
dmrg101/utils/tridiagonal_solver/example_9_13.py
liangjj/dmrg101
aaf3913f5a616dc84c4100efbeb819648973c582
[ "MIT" ]
1
2015-03-05T22:47:13.000Z
2015-03-05T22:47:13.000Z
dmrg101/utils/tridiagonal_solver/example_9_13.py
iglpdc/dmrg101
aaf3913f5a616dc84c4100efbeb819648973c582
[ "MIT" ]
10
2015-04-29T02:33:05.000Z
2021-09-09T02:36:13.000Z
#!/usr/bin/env python from numpy import ones from tridiagonal_solver import * n = 300 d = ones((n))*2.0 c = ones((n-1))*(-1.0) evals, evecs = tridiagonal_solver(d,c) print evals print evecs
17.545455
39
0.689119
35
193
3.742857
0.571429
0.259542
0
0
0
0
0
0
0
0
0
0.04908
0.15544
193
10
40
19.3
0.754601
0.103627
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.25
null
null
0.25
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
1
0
0
0
0
0
0
0
0
2
d56203bf344b0493d8ba766a755a1deacb432f64
2,410
py
Python
src-el/Parisa-wizard/einputdiff.py
EulerProject/EulerX
49e63e6a27be97ab30832180a47d214494388e15
[ "MIT" ]
15
2016-02-17T20:48:29.000Z
2021-03-05T20:38:05.000Z
src-el/Parisa-wizard/einputdiff.py
eddy7896/EulerX
49e63e6a27be97ab30832180a47d214494388e15
[ "MIT" ]
16
2015-02-05T18:38:48.000Z
2021-06-14T11:38:36.000Z
src-el/Parisa-wizard/einputdiff.py
eddy7896/EulerX
49e63e6a27be97ab30832180a47d214494388e15
[ "MIT" ]
4
2016-01-26T03:24:52.000Z
2020-01-09T07:57:15.000Z
# Euler Input diff (einputdiff) receives filename as input and outputs diff files # showing the difference between the pair of files with this filename in the current # directory # It also generates a csv file called "sum.csv" in the current directory that lists # all of the cleanTax files in the current directory and their timestamps # __author__ = "Parisa Kianmajd" #__version__ = "1.0.2" import difflib import sys import os import csv import re def diff(f1,f2,t,c): filename = {f1:"", f2: ""} diff = difflib.ndiff(open(f1).readlines(), open(f2).readlines()) for f in [f1,f2]: if "/" in f: filename[f] = f.split("/")[-1] else: filename[f] = f out = open('diff_' + str(c) + "_" + filename[f1] , "w") out.write('File #1: ' + f1 + ' Timestamp #1:' + t[0] + '\n') out.write('File #2: ' + f2 + 'Timestamp #2:' + t[1] + '\n') out.write('\n') try: while 1: out.write(diff.next(),) except: pass out.close() def einputdiff(): filesList = list() compareList = list() try: arg1 = sys.argv[1] except IndexError: print 'Usage: diff.py <arg1>' sys.exit(1) filename = sys.argv[1] for root, dirs, files in os.walk('.'): for name in files: if name.endswith('.txt'): if root != '.': fpath = os.path.join(root, name) timestamp = fpath.split('./')[1].split('/')[1].split('/')[0] timestamp = timestamp[:timestamp.find(":") + 6] filesList.append([fpath,timestamp]) if name == filename: compareList.append([fpath,timestamp]) with open('sum.csv',"w") as reportFile: writer = csv.writer(reportFile, delimiter=',') writer.writerow (['User', 'Filename', 'TimeStamp']) for n in filesList: user = n[0].split("/")[1] if ":" in user: user = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(n[0])), '..')).split("/")[-1] writer.writerow([user, n[0],n[1]]) i = 0 c = 1 while i < len(compareList) - 1: time = (compareList[i][1], compareList[i+1][1]) diff(compareList[i][0],compareList[i+1][0],time,c) i += 2 c += 1 einputdiff()
29.753086
113
0.524481
305
2,410
4.111475
0.340984
0.023923
0.028708
0.050239
0
0
0
0
0
0
0
0.029003
0.313278
2,410
80
114
30.125
0.728701
0.156846
0
0.034483
1
0
0.062778
0
0
0
0
0
0
0
null
null
0.017241
0.086207
null
null
0.017241
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
1
0
0
0
0
0
0
0
0
2
d56349cf25ede5ff613c649773fd18c6a6bf93e6
1,211
py
Python
main/tables.py
nucluster/us_states
26cca38990b9afb6a2b8cc4d1365409428793c6d
[ "MIT" ]
null
null
null
main/tables.py
nucluster/us_states
26cca38990b9afb6a2b8cc4d1365409428793c6d
[ "MIT" ]
null
null
null
main/tables.py
nucluster/us_states
26cca38990b9afb6a2b8cc4d1365409428793c6d
[ "MIT" ]
null
null
null
import django_tables2 as tables from django.utils.html import format_html from .models import State class ImageColumnFlag(tables.Column): def render(self, value): return format_html( '<a href="/media/{0}"><img src="/media/{0}.png" width="100" ' 'height="66" alt="{0}"/>', value) class ImageColumnSeal(tables.Column): def render(self, value): return format_html( '<a href="/media/{0}"><img src="/media/{0}.png" width="50" ' 'height="50" alt="{0}" />', value) class StateTable(tables.Table): id = tables.Column(verbose_name='#', attrs={"th": {"style": "font-size: 32px"}, "td": {"style": "font-weight: bold"}} ) flag_image = ImageColumnFlag() seal_image = ImageColumnSeal() def render_ratification(self, value): return value class Meta: model = State attrs = {"class": "table table-striped table-bordered"} fields = ('id', 'name', 'zip_code', 'capital', 'largest_city', 'ratification', 'population', 'total_area', 'land_area', 'water_area', 'flag_image', 'seal_image')
32.72973
74
0.559868
134
1,211
4.947761
0.492537
0.036199
0.067873
0.063348
0.232278
0.232278
0.232278
0.232278
0.232278
0.232278
0
0.020595
0.278282
1,211
36
75
33.638889
0.737986
0
0
0.142857
0
0.071429
0.29232
0.036334
0
0
0
0
0
1
0.107143
false
0
0.107143
0.107143
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
0
0
0
0
1
1
0
0
2
d56c608ffa705a06fadac613c22c7f74d51ed1bd
541
py
Python
clases/novena.py
PythonCisco/clase
6e18715012ce72385637b7f09a0a9c810165f1af
[ "MIT" ]
null
null
null
clases/novena.py
PythonCisco/clase
6e18715012ce72385637b7f09a0a9c810165f1af
[ "MIT" ]
null
null
null
clases/novena.py
PythonCisco/clase
6e18715012ce72385637b7f09a0a9c810165f1af
[ "MIT" ]
null
null
null
""" git igualdad e identidad excepciones operadores binarios """ # excepcionew # out of bounds exception # keyerror # excepcion para mejor validación de entrada # excepcion para continuar en un error (keyerror en mi piano) """ << (bit shift) (desplazamiento de bit a la izquierda) 011011 110110 101100 011000 >> (right bit shift) (desplazamiento de bit a la derecha) 1001 0100 0010 ~ (complemento) 1100 0011 1010101111000 0101010000111 & (bitwise and) 1001 1010 & 1000 | (bitwise or) 1001 1010 | 1011 ^ (xor) 1001 1010 ^ 0011 """
10.607843
61
0.728281
72
541
5.472222
0.722222
0.060914
0.111675
0.121827
0.152284
0.152284
0.152284
0
0
0
0
0.240909
0.186691
541
50
62
10.82
0.654545
0.378928
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
d56f15f8b28a5685d54a048c3783a785e5f7c317
2,965
py
Python
wyze_sdk/api/base.py
RebelTat/wyze-sdk
249b1df71e80c97fc2e5fb5977431b887f7361c2
[ "Unlicense" ]
132
2021-05-03T12:33:58.000Z
2022-03-31T18:03:26.000Z
wyze_sdk/api/base.py
RebelTat/wyze-sdk
249b1df71e80c97fc2e5fb5977431b887f7361c2
[ "Unlicense" ]
51
2021-05-01T20:24:20.000Z
2022-03-30T20:37:05.000Z
wyze_sdk/api/base.py
RebelTat/wyze-sdk
249b1df71e80c97fc2e5fb5977431b887f7361c2
[ "Unlicense" ]
21
2021-05-05T14:01:38.000Z
2022-03-29T02:58:39.000Z
import logging from abc import ABCMeta from typing import Optional, Sequence from wyze_sdk.errors import WyzeClientConfigurationError from wyze_sdk.service import (ApiServiceClient, EarthServiceClient, GeneralApiServiceClient, PlatformServiceClient, ScaleServiceClient, VenusServiceClient, WyzeResponse) class BaseClient(object, metaclass=ABCMeta): def __init__( self, token: str = None, user_id: str = None, base_url: Optional[str] = None, logger: logging.Logger = logging.getLogger(__name__), **kwargs, ): if token is None: raise WyzeClientConfigurationError("client is not logged in") self._token = token.strip() self._user_id = user_id self._base_url = base_url self._logger = logger def _platform_client(self) -> PlatformServiceClient: return BaseClient._service_client(PlatformServiceClient, token=self._token, base_url=self._base_url) def _api_client(self) -> ApiServiceClient: return BaseClient._service_client(ApiServiceClient, token=self._token, base_url=self._base_url) @staticmethod def _service_client(cls, *, token: str, base_url: Optional[str] = None, **kwargs) -> "BaseClient": """Create a service client to execute the API call to Wyze. Args: cls (class): The target service client. e.g. 'PlatformServiceClient' token (str): The access token. base_url (Optional[str]): The base url of the service. Returns: (BaseClient) A new pre-configured client for interacting with the target service. """ return cls( token=token, **{{'base_url': base_url}, kwargs} if base_url is not None else kwargs, ) def _earth_client(self) -> EarthServiceClient: return BaseClient._service_client(EarthServiceClient, token=self._token, base_url=self._base_url) def _general_api_client(self) -> GeneralApiServiceClient: return GeneralApiServiceClient( token=self._token, **{'base_url': self._base_url} if self._base_url else {}, user_id=self._user_id, ) def _scale_client(self) -> ScaleServiceClient: return BaseClient._service_client(ScaleServiceClient, token=self._token, base_url=self._base_url) def _venus_client(self) -> VenusServiceClient: return BaseClient._service_client(VenusServiceClient, token=self._token, base_url=self._base_url) def _create_user_event(self, pid: str, event_id: str, event_type: int) -> WyzeResponse: self._general_api_client().post_user_event(pid=pid, event_id=event_id, event_type=event_type) def _list_devices(self, **kwargs) -> Sequence[dict]: return self._api_client().get_object_list()["data"]["device_list"]
40.067568
108
0.659359
328
2,965
5.655488
0.262195
0.083019
0.047439
0.058221
0.133693
0.109973
0.109973
0.109973
0.075472
0
0
0
0.251602
2,965
73
109
40.616438
0.835962
0.117369
0
0
0
0
0.025296
0
0
0
0
0
0
1
0.204082
false
0
0.102041
0.142857
0.489796
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
d5836450cf7613039af7f7f6ad9dcd054a00ddac
7,261
py
Python
Test/quizdnn.py
Shakil-1501/TSAI
d553f0a81d52d24f4c25db2cd5427efbadae31d0
[ "MIT" ]
null
null
null
Test/quizdnn.py
Shakil-1501/TSAI
d553f0a81d52d24f4c25db2cd5427efbadae31d0
[ "MIT" ]
null
null
null
Test/quizdnn.py
Shakil-1501/TSAI
d553f0a81d52d24f4c25db2cd5427efbadae31d0
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """QuizDNN.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1ozIOE_4mtW7BCkuslZdVu1OyL0AMeufy """ from datetime import datetime print("Current Date/Time: ", datetime.now()) import torch import torchvision import torchvision.transforms as transforms import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Sequential(nn.Conv2d(in_channels=3,out_channels=16,kernel_size=(3,3),padding=1), nn.ReLU(), nn.BatchNorm2d(num_features=16), nn.Conv2d(16,32,3, padding = 1), nn.ReLU(), nn.BatchNorm2d(num_features=32) ) self.maxpool1 = nn.Sequential( nn.MaxPool2d(2,2) ) self.conv2 = nn.Sequential(nn.Conv2d(in_channels=32,out_channels=64,kernel_size=(3,3),padding=1), nn.ReLU(), nn.BatchNorm2d(num_features=64), nn.Conv2d(64,64,3,padding = 1), nn.ReLU(), nn.BatchNorm2d(num_features=64), nn.Conv2d(in_channels=64,out_channels=128,kernel_size=(3,3),padding=1), nn.ReLU(), nn.BatchNorm2d(num_features=128) ) self.maxpool2 = nn.Sequential( nn.MaxPool2d(2,2) ) self.conv3 = nn.Sequential(nn.Conv2d(in_channels=128,out_channels=128,kernel_size=(3,3),padding=1), nn.ReLU(), nn.BatchNorm2d(num_features=128), nn.Conv2d(128,128,3,padding = 1), nn.ReLU(), nn.BatchNorm2d(num_features=128), nn.Conv2d(128,10,3,padding = 1), nn.ReLU(), nn.BatchNorm2d(num_features = 10) ) self.gap = nn.Sequential( nn.AvgPool2d(kernel_size=8)) self.fc = nn.Sequential( nn.Linear( 128,10) ) def forward(self, x): x = self.conv1(x) x = self.maxpool1(x) x = self.conv2(x) x = self.maxpool2(x) x = self.conv3(x) x = self.gap(x) #x = self.fc(x) x = x.view(-1, 10) return F.log_softmax(x) !pip install torchsummary from torchsummary import summary use_cuda = torch.cuda.is_available() device = torch.device("cuda" if use_cuda else "cpu") net = Net().to(device) summary(net, input_size=(3, 32, 32)) # Commented out IPython magic to ensure Python compatibility. # %matplotlib inline import torchvision import torchvision.transforms as transforms transform = transforms.Compose( [transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) train_transform = transforms.Compose( [transforms.RandomHorizontalFlip(p=0.5), transforms.RandomCrop(32, padding=2), transforms.ColorJitter(brightness=0.1, contrast=0.1,saturation=0.1,hue=0.1), #transforms.RandomRotation( degrees = 7 ), transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) trainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform = train_transform) trainloader = torch.utils.data.DataLoader(trainset, batch_size = 30, shuffle=True, num_workers = 4) testset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=transform) testloader = torch.utils.data.DataLoader(testset, batch_size = 30, shuffle=False, num_workers = 4) classes = ('plane', 'car', 'bird', 'cat','deer', 'dog', 'frog', 'horse', 'ship', 'truck') import matplotlib.pyplot as plt import numpy as np # functions to show an image def imshow(img): img = img / 2 + 0.5 # unnormalize npimg = img.numpy() plt.imshow(np.transpose(npimg, (1, 2, 0))) # get some random training images dataiter = iter(trainloader) images, labels = dataiter.next() # show images imshow(torchvision.utils.make_grid(images)) # print labels print(' '.join('%5s' % classes[labels[j]] for j in range(4))) import torch.optim as optim from torch.optim.lr_scheduler import StepLR criterion = nn.CrossEntropyLoss() optimizer = optim.SGD(net.parameters(), lr=0.001, momentum=0.9 , weight_decay = 0.001 ) scheduler= StepLR(optimizer,step_size=5,gamma=0.1) print("Device : ", device) for epoch in range(10): # loop over the dataset multiple times running_loss = 0.0 for i, data in enumerate(trainloader, 0): # get the inputs inputs, labels = data[0].to(device) , data[1].to(device) # zero the parameter gradients optimizer.zero_grad() # forward + backward + optimize outputs = net(inputs) loss = criterion(outputs, labels) loss.backward() optimizer.step() # print statistics running_loss += loss.item() if i % 300 == 299: # print every 2000 mini-batches print('[%d, %5d] loss: %.3f' %(epoch + 1, i + 1, running_loss / 300)) running_loss = 0.0 correct = 0 total = 0 with torch.no_grad(): for data in testloader: images, labels = data[0].to(device) , data[1].to(device) outputs = net(images) _, predicted = torch.max(outputs.data, 1) total += labels.size(0) correct += (predicted == labels).sum().item() print('Accuracy of the network on the 10000 test images: %d %%' % (100 * correct / total)) class_correct = list(0. for i in range(10)) class_total = list(0. for i in range(10)) with torch.no_grad(): for data in testloader: images, labels = data[0].to(device) , data[1].to(device) outputs = net(images) _, predicted = torch.max(outputs, 1) c = (predicted == labels).squeeze() for i in range(4): label = labels[i] class_correct[label] += c[i].item() class_total[label] += 1 for i in range(10): print('Accuracy of %5s : %2d %%' % ( classes[i], 100 * class_correct[i] / class_total[i]))
37.045918
115
0.511913
806
7,261
4.537221
0.300248
0.007657
0.008203
0.010938
0.321575
0.31802
0.272081
0.215751
0.215751
0.185671
0
0.056214
0.372814
7,261
195
116
37.235897
0.746816
0.056328
0
0.25
1
0
0.028507
0
0
0
0
0
0
0
null
null
0
0.095588
null
null
0.044118
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
1
0
0
0
0
0
0
0
0
2
d58600723a985cd64f1bf8e33ee08163ad502d30
31,079
py
Python
python/textmining-0.65/textmining/blacklist.py
dataesr/scanr-backend
39681be69b9a96b4a07b9410754c897cd5b65c24
[ "MIT" ]
null
null
null
python/textmining-0.65/textmining/blacklist.py
dataesr/scanr-backend
39681be69b9a96b4a07b9410754c897cd5b65c24
[ "MIT" ]
3
2020-06-18T15:06:10.000Z
2021-05-07T16:29:50.000Z
plugins/textmining/textmining/blacklist.py
reseachalps/Search-Engine
1cd1e83902119938ffd412394b09dce92d082500
[ "MIT" ]
null
null
null
class Blacklist: def __init__(self): """ Initializes a set of blaclisted words """ self.bl = set() self.words = """ janvier février mars avril mai juin juillet août septembre octobre novembre notamment décembre ai accueil ad ads adsense ainsi alors amp après au aujourd auquel aurait auraient aussi autour autre autres aux auxquels avec avait avoir car ccedil ce ceci cela ces cet cette chaque comme dans de depuis des deux devant donc dont du début eacute ecirc egrave elle elles en encore entre es est et gt hui il ils je la le laquelle lequel les leur leurs lui ma mais me mes mieux moins mon même nbsp ne ni notre nous on or ou où par pas peu peut plus plusieurs plutôt pour pr puis qu quand que quel quelle quelles quelque quels qui quoi quot sa se selon sera ses si son sous sur ta tandis tant tel tels tes ton tous tout toute toutes très tu un une vers voici vous votre à at site sont fait lien faire moi ça ca aucun être etre ont nos c'est suis sans vos voir grand ici bonne ca pm bon d'un d'une été var là del était el chez petite passe fois www post http flash pays fr en be info lire note liens lien page pages envoyer article articles annuaire adresse recommander rédigé redige tags net recherche gratuit contact google posté poste bienvenue clic rss org index results result error online email mail ajouter suite billet commentaire commentaires fil répondre blog blogs permanent publié publie strong span style color trackback trackbacks permalien archives archive message messages rétroliens rétrolien écrit an _blank href hps can class line else our am write search home click country if was are here not free from we my posted about more have news new your with as comments comment of that is to the she he they them their thus it its did you may might must will in all and by for yes no us this com аз ако ала бе без беше би бивш бивша бившо бил била били било благодаря близо бъдат бъде бъдеш бъда бъдете бяха беше бях бяхме във вас ваш ваша ваше вашо вашето вашата вашите вече ви вие винаги все всеки всички всичко всяка всяко във въпреки върху ги главен главна главно го година години годишен годишно годишна годишното годишната да дали два двама двамата две двете ден днес дни до добра добре добро добрата доброто добър докато докога дори досега доста друг друга други другата другите едва един една единият едната еднаква еднакви еднаквите еднакъв еднаквият едно ето за зад заедно заради засега затова защо защото из или им как каква какво каквато каквото какъв какъвто както какъв като кога когато кое което които кой който колко колкото коя която къде където към лесен лесно лесна лесни лесното лесните лесната лесният ли лош лоша лошо лоши лошият лошата лошите лошото май малко малка ме между мек мен месец ми много мнозина момент момента му на над назад най напред например нас не него нещо нея ни ние никой нито нищо но някои някой някоя някое няколко обаче около освен особено от отгоре отново още пак пo повечe повечето под поне поради после почти пред преди през при пък първа първатапърви пършият първо първото пъти са сам само се сега си скоро след следващ сме според сред срещу сте съм със също тази така такива такъв там твой те тези ти то това тогава този той толкова точно три трябва тук тъй тя тях утре хиляди часа че често чрез ще щом як abaft able aboard about above according accordingly across actually adj afore aforesaid after afterwards again against agin ago ain aint albeit all allow allows almost alone along alongside already also although always amid amidst among amongst and anent another any anybody anyhow anyone anything anyway anyways anywhere apart appear appreciate appropriate april are aren around aside ask asking aslant associated athwart august available away awfully back bad barring became because become becomes becoming been before beforehand behind being believe below beneath beside besides best better between betwixt beyond big both brief but came can cannot cant cause causes certain certainly changes circa clearly close com come comes comwww concerning consequently consider considering contain containing contains corresponding cos could couldn couldst course currently date december definitely described despite did didn different difficult does doesn doing don done down downwards during durst each easy edu eight either else elsewhere empty enough entirely ere especially etc even ever every everybody everyone everything everywhere exactly example examples except excepting failing false far february few fifth first five followed following follows for former formerly forth four friday from full further furthermore get gets getting given gives goes going gone gonna good got gotta gotten greetings had hadn happens hardly has hasn hast hath have haven having he hello help hence her here here hereafter hereby herein hereupon hers herself him himself his hither hopefully how how howbeit however ignored immediate inasmuch inc indeed indicate indicated indicates inner inside insofar instantly instead into inward isn its itself january july june just keep keeps kept know known knows last lately later latter latterly least left less lest let like liked likely likewise little long look looking looks ltd mainly many march may maybe mayn mean meanwhile merely mid midst might mightn miss monday more moreover most mostly much must mustn myself name namely near nearly necessary need needn needs neither never nevertheless new next nine no-one nobody non none noone nor normally not nothing notwithstanding nought novel november now nowhere obviously october off often okay old once onceone one ones oneself only onto open other others otherwise ought oughtn our ours ourselves out outside over overall own particular particularly past per perhaps placed please plus possible presumably probably provides qua que quite rather ready really reasonably regarding regardless regards relatively respectively right said same sans saturday saw say saying says second secondly see seeing seem seemed seeming seems seen self selves sensible sent september serious seriously seven several shall shalt shan she shed shell short should should shouldn since six some somebody somehow someone something sometime sometimes somewhat somewhere soon sorry specified specify specifying still sub such sunday sup sure take taken takes taking tall tell ten tends than thank thanks thanx that thats the thee their theirs them themselves then thence there thereafter thereby therefor therefore therein theres thereupon these they thine thing things think third this tho thorough thoroughly those thou though three thro through throughout thru thursday thus thyself till together too took toward towards tried tries true truly try trying tuesday twice two under underneath unfortunately unless unlike unlikely until unto upon use used useful uses using usually uucp value various versus very via viz want wants was wasn way we wednesday welcome well went were weren wert what whatever whatsoever when whence whencesoever whenever whensoever where whereafter whereas whereat whereby wherefrom wherein whereinto whereof whereon whereto whereunto whereupon wherever wherewith whether which whichever whichsoever while whilst whither who whoever whole whom whomever whomsoever whore whose whoso whosoever why will willing wish with within without won wonder wont would wouldn wouldst xauthor xcal xnote xother xsubj year yes yet you your yours yourself yourselves zero ahogy ahol aki akik akkor alatt által általában amely amelyek amelyekben amelyeket amelyet amelynek ami amit amolyan amíg amikor át abban ahhoz annak arra arról az azok azon azt azzal azért aztán azután azonban bár be belül benne cikk cikkek cikkeket csak de e eddig egész egy egyes egyetlen egyéb egyik egyre ekkor el elég ellen elõ elõször elõtt elsõ én éppen ebben ehhez emilyen ennek erre ez ezt ezek ezen ezzel ezért és fel felé hanem hiszen hogy hogyan igen így illetve ill ilyen ilyenkor ison ismét itt jó jól jobban kell kellett keresztül keressünk ki kívül között közül legalább lehet lehetett legyen lenne lenni lesz lett maga magát majd majd már más másik meg még mellett mert mely melyek mi mit míg miért milyen mikor minden mindent mindenki mindig mint mintha mivel most nagy nagyobb nagyon ne néha nekem neki nem néhány nélkül nincs olyan ott össze õ õk õket pedig persze rá s saját sem semmi sok sokat sokkal számára szemben szerint szinte talán tehát teljes tovább továbbá több úgy ugyanis új újabb újra után utána utolsó vagy vagyis valaki valami valamint való vagyok van vannak volt voltam voltak voltunk vissza vele viszont volna aby ale bardziej bardzo bez bo bowiem co czy czyli dla dlatego do gdy gdzie go ich im innych iż jak jako jednak jego jej jeszcze jeśli już kiedy kilka która które którego której który których którym którzy lub mi między mnie można na nad nam nas naszego naszych nawet nich nie nim niż od oraz po pod poza przed przede przez przy również się sobie swoje ta tak takie także tam te tego tej ten też to tu tych tylko tym we wiele wielu więc wszystkich wszystkim wszystko właśnie za zawsze ze że acá actualmente acuerdo adelante además adrede afirmó agregó ahí ahora ajena ajenas ajeno ajenos algo algún alguna algunas alguno algunos allá allí alrededor ambos añadió antano ante anterior antes apenas aproximadamente aquel aquella aquellas aquello aquellos aquí arribaabajo aseguró así aún aunque ayer bajo bastante bien breve buen buena buenas bueno buenos cada casi cerca cierta ciertas cierto ciertos cinco claro comentó cómo con conmigo conocer considera consideró consigo contigo contra cosas creo cual cuales cualquier cualquiera cualquieras cuán cuando cuanta cuantas cuanto cuantos cuatro cuenta dado dan dar debajo debe deben debido decir dejar dejó del delante demás demasiada demasiadas demasiado demasiados dentro deprisa desde despacio después detras dia dias dice dicen dicho dieron diferente diferentes dijeron dijo dio donde dos durante ejemplo ella ellas ello ellos embargo encima encuentra enfrente enseguida entonces entre era erais éramos eran eras eres esa esas ese eso esos ésta estaba estabais estábamos estaban estabas estad estada estadas estado estados estáis estamos están estando estar estará estarán estarás estaré estaréis estaremos estaría estaríais estaríamos estarían estarías éstas éste esté estéis estemos estén estés esto éstos estoy estuve estuviera estuvierais estuviéramos estuvieran estuvieras estuvieron estuviese estuvieseis estuviésemos estuviesen estuvieses estuvimos estuviste estuvisteis estuvo excepto existe existen explicó expresó fin final fue fuera fuerais fuéramos fueran fueras fueron fuese fueseis fuésemos fuesen fueses fui fuimos fuiste fuisteis gran grandes habéis haber había habíais habíamos habían habías habida habidas habido habidos habiendo habla hablan habrá habrán habrás habré habréis habremos habría habríais habríamos habrían habrías hace hacen hacer hacerlo hacia haciendo han has hasta hay haya hayáis hayamos hayan hayas hecho hemos hicieron hizo horas hoy hube hubiera hubierais hubiéramos hubieran hubieras hubieron hubiese hubieseis hubiésemos hubiesen hubieses hubimos hubiste hubisteis hubo igual incluso indicó informó jamás junto juntos lado las lejos les llegó lleva llevar los luego lugar mal manera manifestó más mayor mediante medio mejor mencionó menos menudo mía mias mientras mío mios mis misma mismas mismo mismos momento mucha muchas muchísima muchísimas muchísimo muchísimos mucho muchos muy nada nadie ningún ninguna ningunas ninguno ningunos nos nosotras nosotros nuestra nuestras nuestro nuestros nueva nuevas nuevo nuevos nunca ocho otra otras otro otros pais para parece parecer parte partir pasada pasado peor pero pesar poca pocas poco pocos podemos podrá podrán podría podrían poner por porque posible primer primera primero primeros principalmente pronto propia propias propio propios próximo próximos pudo pueda puede pueden pues qeu qué quedó queremos querer quién quienes quienesquiera quienquiera quiere quiza quizas raras realizado realizar realizó repente respecto salvo sea seáis seamos sean seas según segunda segundo seis señaló sentid sentida sentidas sentido sentidos ser será serán serás seré seréis seremos sería seríais seríamos serían serías sido siempre siendo siente siete sigue siguiente sin sino sintiendo sobre sois sola solamente solas sólo solos somos son soy soyos sra sres sta supuesto sus suya suyas suyo suyos tal tales también tampoco tan tanta tantas tanto tantos tarde temprano tendrá tendrán tendrás tendré tendréis tendremos tendría tendríais tendríamos tendrían tendrías tened tenéis tenemos tener tenga tengáis tengamos tengan tengas tengo tenía teníais teníamos tenían tenías tenida tenidas tenido tenidos teniendo tercera tiene tienen tienes toda todas todavía todo todos tomar total tras trata través tres tus tuve tuviera tuvierais tuviéramos tuvieran tuvieras tuvieron tuviese tuvieseis tuviésemos tuviesen tuvieses tuvimos tuviste tuvisteis tuvo tuya tuyas tuyo tuyos última últimas último últimos una unas uno unos usted ustedes vamos van varias varios veces ver vez vosostras vosostros vosotras vosotros vuestra vuestras vuestro vuestros aby ac ackoli ackoli ahoj ale ale alespon anebo ani ano asi aspon at avšak až ba behem bez beze blízko bohužel brzo brezen breznu bud bude budeme budeš budete budou budu byl byla byli bylo byly bys co cau cem cemu cerven cervenci cervenec cervnu cí ctrnáct ctvrtek ctvrtka ctyri dál dále daleko dekovat dekujeme dekuji den deset devatenáct devet díky dle do dobrý docela dokonce doprostred duben dubnu dva dvacet dvanáct dve hodne chce chceme chceš chcete chci chtejí chtít já jak jakému jakmile jaký jakými jde je jeden jedenáct jedna jednak jedno jednou jedou jeho její jejich jejích jejím jelikož jemu jen jenom jenž jestli jestlipak jestliže ješte ji jí jich jím jimi jiná jinací jinak jinde jiné jinému jiný jsem jsi jsme jsou jste kam každá každé každému každý každým kde kdo kdy kdyby kdyby kdybych kdybychom kdybys kdybyste když ke kéž koho kolem kolik komu konce krome která které kterému který kterými kterí kudy kveten kvetnu kvuli leden lednu listopad listopadu má mají málo mám máme máš máte mé me mezi mí mimo mít mne mnou moc mohl mohou moje moji možná muj musí muže my mých mým na nad nade nám námi naproti napríc nás náš naše naši našich ne ne nebo nebot nebyl nebyla nebyli nebyly neco necemu necím nedelá nedelají nedelám nedeláme nedeláš nedeláte nedele nedeli nej nejak nejaká nejaké nejakého nejakému nejaký nejen nejsi nekde nekdo nekdy nekoho nekolikátý nekom nekomu nekterá nekteré nekterého nekterému nekterý nekým nemají nemáme nemáte nemel nemu není než nežli ní nic nicemu nicí nich nich nijakému nijaký nikdo nikdy nikoho nikomu ním nimi nula nýbrž oba obcas obema obou oboum od ode okolo on ona onen oni oním ono onomu ony oproti osm osmnáct ovšem pak pátek pátku patnáct pet po pod podle pondelí porád potom pozde pro proc prosím prosinci prosinec proste proti proto protože prece pred pres prestože pri rovne ríjen ríjnu sám sama samému sami samo samy samým samými se sebe sedm sedm sedmnáct si skoro skrz smejí smí snad sobota sobotu soboty spolu srpen srpnu sta sté sto streda stredu stredy svoje svoji svuj svých šest šestnáct ta tady tak tak takhle taková takové takovému takový takovým taky tam tamhle tamto te tebe tebou tebou ted teda tedy ten tenhle tento tentýž ti tím tímhle tímto tisíc tisíce to tobe tohle tomu tomuto totiž toto trošku treba trebaže tri trináct tudíž tvá tvé tvoje tvoji tvuj tvuj tvých tvým tvými ty týž únor únoru urcite úterý už vám vámi vás váš vaše vaši vašich ve vecer vedle veškerému veškerý veškerým vlastne však všechen všechno všem všem všemu všichni vším vubec vy vždy vždyt za zac zajisté zárí zatímco zatímco ze žádná žádné žádného žádnému žádnou žádný žádným že olen olet on olemme olette ovat ole oli olisi olisit olisin olisimme olisitte olisivat olit olin olimme olitte olivat ollut olleet en et ei emme ette eivät minä minun minut minua minussa minusta minuun minulla minulta minulle sinä sinun sinut sinua sinussa sinusta sinuun sinulla sinulta sinulle hän hänen hänet häntä hänessä hänestä häneen hänellä häneltä hänelle me meidän meidät meitä meissä meistä meihin meillä meiltä meille te teidän teidät teitä teissä teistä teihin teillä teiltä teille he heidän heidät heitä heissä heistä heihin heillä heiltä heille tämä tämän tätä tässä tästä tähän tallä tältä tälle tänä täksi tuo tuon tuotä tuossa tuosta tuohon tuolla tuolta tuolle tuona tuoksi se sen sitä siinä siitä siihen sillä siltä sille sinä siksi nämä näiden näitä näissä näistä näihin näillä näiltä näille näinä näiksi nuo noiden noita noissa noista noihin noilla noilta noille noina noiksi ne niiden niitä niissä niistä niihin niillä niiltä niille niinä niiksi kuka kenen kenet ketä kenessä kenestä keneen kenellä keneltä kenelle kenenä keneksi ketkä keiden ketkä keitä keissä keistä keihin keillä keiltä keille keinä keiksi mikä minkä minkä mitä missä mistä mihin millä miltä mille minä miksi mitkä joka jonka jota jossa josta johon jolla jolta jolle jona joksi jotka joiden joita joissa joista joihin joilla joilta joille joina joiksi että ja jos koska kuin mutta niin sekä sillä tai vaan vai vaikka kanssa mukaan noin poikki yli kun niin nyt itse abbastanza abbia abbiamo abbiano abbiate abbiomo accidenti adesso affinchè affinche agl agli ahime alcuna alcuni alcuno all alla alle allo altri altrimenti altro altrui anche ancora anni anno ansa anzichè assai attesa avanti avemmo avendo avente aver avere avesse avessero avessi avessimo aveste avesti avete aveva avevamo avevano avevate avevi avevo avrà avrai avranno avrebbe avrebbero avrei avremmo avremo avreste avresti avrete avrò avuta avute avuti avuto basta bene benissimo bensì berlusconi brava bravo casa caso cento certa certe certi certo che che chi chi chicchessia chinque chiunque ciascuna ciascuno cima cio cioe circa citta codesta codeste codesti codesto cogli coi col colei coll coloro colui come comunque con concernente consiglio contro contro cortesia cos cosa cosa cosi cui dachè dagl dagli dai dal dall dalla dalle dallo davanti degl degli dei del del dell della delle dello dentro detto deve dice dietro dila dire dirimpetto dopo dov dove dove dovra due dunque dunque durante ebbe ebbero ebbi ecco egli ella eppure era erano eravamo eravate eri ero esse essendo esser essere essi faccia facciamo facciano facciate faccio facemmo facendo facesse facessero facessi facessimo faceste facesti faceva facevamo facevano facevate facevi facevo fai fanno farà farai faranno fare farebbe farebbero farei faremmo faremo fareste faresti farete farò fatto favore fece fecero feci fin finalmente finche fine fino forse fosse fossero fossi fossimo foste fosti fra frattanto fui fummo fuori furono gia giacchè giacche giorni giorno gli gliela gliele glieli glielo gliene governo grande grazie gruppo hai hanno i ieri improvviso infatti inoltre insieme intanto intorno invece invere la lavoro le lei lontano loro lui lungo macche magari mai male malgrado malissimo medesimo mediante meglio meno mentre mesi mezzo mia mie miei mieri mila miliardi milioni ministro mio moltissimo molto mondo nazionale neanche negl negli nei nel nell nella nelle nelle nello nemmeno neppure nessuna nessuno niente noi non nonchè nondimeno nondimeno nondimento nostra nostre nostri nostro nostro nulla nuovo oggi ogni ognuna ognuno oltre onde oppure ora ore osi ossia ovvero paese parecchi parecchie parecchio parte partendo peccato peggio per perchè perché perciò percio perfino pero perque persone piedi pieno piglia più pochissimo poco poi poiche poichè press prima primo proprio puo purchè pure purtroppo qualche qualcuna qualcuno quale quali qualsiani qualunque quand quando quando quanta quante quanti quanto quantunque quasi quattro quel quella quelle quelli quello quest questa queste questi questo qui quindi riecco saltro salvo sarà sarai saranno sarebbe sarebbero sarei saremmo saremo sareste saresti sarete sarò scopo scorso sebbene secondo seguente sei sempre sennonchè senza senza sia siamo siano siate siccome siete solito solo sono soppra sopra sotto sta stai stando stanno starà starai staranno starebbe starebbero starei staremmo staremo stareste staresti starete starò stata state stati stato stava stavamo stavano stavate stavi stavo stemmo stesse stessero stessi stessimo stesso steste stesti stette stettero stetti stia stiamo stiano stiate sto stresso sua subito successivo sue sugl sugli sui sul sull sulla sulla sulle sulle sullo suo suoi talchè tale talvolta tanto tempo torino tra tranne trannefino tre troppo tua tue tuo tuo tuoi tutta tuttavia tuttavia tutte tutti tutto uguali una uno uomo uori vale varia varie vario verso via vicino vise visto vita voi volta vostra vostre vostri vostro abaixo adeus adiante agora ainda além algo algumas alguns ali ano anos antes aos apenas apoio após aquela aquelas aquele aqueles aqui aquilo área assim até atras através baixo bastante bem boa boas bom bonito bons breve cada catorze cedo cento certamente certeza certo cima cinco coisa com como conselho contra custa dão daquela daquelas daquele daqueles dar das debaixo dela delas demais dentro depois depressa desde dessa dessas desse desses desta destas deste destes devagar dez dezanove dezasseis dezassete dezoito dia diante direito dois dos doze duas dúvida ela elas êle eles embora entre essa essas esse esses esta estas este estes exemplo falta favor fim final for geral grande grandes grupo hoje hora horas isso isto junto lado lhes local logo longe lugar maior maioria mais mal mas máximo meio menor menos mês meses meu meus mil minha minhas momento muito muitos nada não naquela naquelas naquele naqueles nas nem nenhuma nessa nessas nesse nesses nesta nestas neste nestes ninguem nível noite nome nós nossa nossas nosso nossos nova novas nove novo novos num numa número nunca obra obrigada obrigado oitava oitavo oito onde ontem onze outra outras outro outros para parece parte paucas pela pelas pelo pelos perto pode ponto pontos por porque posição possível possivelmente posso pouca pouco poucos primeira primeiras primeiro primeiros própria próprias próprio próprios próxima próximas próximo próximos quáis qual quando quanto quarta quarto quatro que quem queremas questão quinta quinto quinze relação são segunda segundo seis seja sejam sejamos sem sempre sete sétima sétimo seu seus sexta sexto sim sistema sob sobre sois sua suas tal talvez também tanta tantas tanto tão tarde teu teus toda todas todo todos trabalho três treze tua tuas tudo uma umas uns vagarosamente vários vez vezes vinte você vocês vos vossa vossas vosso vossos zero och det att en jag hon som han på den med var sig för så till är men ett om hade de av icke mig du henne då sin nu har inte hans honom skulle hennes där min man ej vid kunde något från ut när efter upp vi dem vara vad över än dig kan sina här ha mot alla under någon eller allt mycket sedan ju denna själv detta åt utan varit hur ingen mitt ni bli blev oss din dessa några deras blir mina samma vilken er sådan vår blivit dess inom mellan sådant varför varje vilka ditt vem vilket sitta sådana vart dina vars vårt våra ert era vilkas aan aangaande aangezien achter achterna afgelopen aldaar aldus alhoewel alias alle allebei alleen alles als alsnog altijd altoos ander andere anders anderszins behalve behoudens beide beiden ben beneden bent bepaald betreffende bij binnen binnenin boven bovenal bovendien bovengenoemd bovenstaand bovenvermeld buiten daar daarheen daarin daarna daarnet daarom daarop daarvanlangs dan dat der deze die dikwijls dit doch doen door doorgaand dus echter een eens eer eerdat eerder eerlang eerst elk elke enig enigszins enkel erdoor even eveneens evenwel gauw gedurende geen gehad gekund geleden gelijk gemoeten gemogen geweest gewoon gewoonweg haar had hadden hare heb hebben hebt heeft hem hen het hier hierbeneden hierboven hij hoe hoewel hun hunne iemand iets ikzelf inmiddels inzake jezelf jij jijzelf jou jouw jouwe juist jullie kan klaar kon konden krachtens kunnen kunt later liever maar mag meer men met mezelf mij mijn mijnent mijner mijzelf misschien mocht mochten moest moesten moet moeten mogen naar nadat net niet niets noch nog nogal ofschoon omdat omhoog omlaag omstreeks omtrent omver onder ondertussen ongeveer ons onszelf onze ook opnieuw opzij over overeind overigens pas precies reeds rond rondom sedert sinds sindsdien slechts sommige spoedig steeds tamelijk tegen tenzij terwijl thans tijdens toch toen toenmaals toenmalig tot totdat tussen uit uitgezonderd vaak van vandaan vanuit vanwege veel veeleer verder vervolgens vol volgens voor vooraf vooral vooralsnog voorbij voordat voordezen voordien voorheen voorop vooruit vrij vroeg waar waarom wanneer want waren was wat weer weg wegens wel weldra welk welke werd wezen wie wiens wier wij wijzelf wil worden wordt zal zelf zelfs zich zichzelf zij zijn zijne zodra zonder zou zouden zowat zulke zullen zult aber ach acht achte achten achter achtes alle allein allem allen aller allerdings alles allgemeinen als also ander andere anderem anderen anderer anderes anderm andern anderr anders auch auf aus ausser ausserdem außer außerdem bald bei beide beiden beim beispiel bekannt bereits besonders besser besten bin bis bisher bist bißchen dabei dadurch dafür dagegen daher dahin dahinter damals damit danach daneben dank dann daran darauf daraus darf darfst darin darum darunter darüber das dasein daselbst dass dasselbe davon davor dazu dazwischen daß dein deine deinem deinen deiner deines dem dementsprechend demgegenüber demgemäss demgemäß demselben demzufolge den denen denn denselben der deren derer derjenige derjenigen dermassen dermaßen derselbe derselben des deshalb desselben dessen deswegen dich die diejenige diejenigen dienstag dies diese dieselbe dieselben diesem diesen dieser dieses dir doch donnerstag dort drei drin dritte dritten dritter drittes durch durchaus durfte durften dürfen dürft eben ebenso ehe ehrlich eigen eigene eigenen eigener eigenes ein einander eine einem einen einer eines einig einige einigem einigen einiger einiges einmal eins elf ende endlich entlang entweder ernst erst erste ersten erster erstes etwa etwas euch euer eure eurem euren eurer eures freitag früher fünf fünfte fünften fünfter fünftes für fürs gab ganz ganze ganzen ganzer ganzes gar gedurft gegen gegenüber gehabt gehen geht gekannt gekonnt gemacht gemocht gemusst genau genug gerade gern gesagt geschweige gewesen gewollt geworden gibt ging gleich gott gross grosse grossen grosser grosses groß große großen großer großes gut gute guter gutes hab habe haben habt hast hat hatte hatten heisst her herein herum heute hier hin hinter hintern hoch hätte hätten ich ihm ihn ihnen ihr ihre ihrem ihren ihrer ihres immer indem infolgedessen ins irgend ist jahr jahre jahren jede jedem jeden jeder jedermann jedermanns jedes jedesmal jedoch jemand jemandem jemanden jene jenem jenen jener jenes jetzt kam kann kannst kaum kein keine keinem keinen keiner keines kleine kleinen kleiner kleines kommen kommt konnte konnten kurz können könnt könnte lang lange leicht leide lieber los machen macht machte mag magst mahn man manche manchem manchen mancher manches mann mehr mein meine meinem meinen meiner meines mensch menschen mich mir mit mittel mittwoch mochte mochten montag morgen muss musst musste mussten muß müssen müsst möchte mögen möglich mögt nach nachdem nahm natürlich neben nein neue neuen neun neunte neunten neunter neuntes nicht nichts nie niemand niemandem niemanden noch nun nur nämlich oben ober obgleich oder offen oft ohne ordnung paar recht rechte rechten rechter rechtes richtig rund sache sagt sagte sah samstag satt schlecht schluss schon sechs sechste sechsten sechster sechstes sehr sei seid seien sein seine seinem seinen seiner seines seit seitdem selbst sich sie sieben siebente siebenten siebenter siebentes sind sogar solang solch solche solchem solchen solcher solches soll sollen sollte sollten sondern sonntag sonst soviel soweit sowie später statt tag tage tagen tat teil tel tritt trotzdem tun uhr und und? uns unse unsem unsen unser unsere unserem unseren unserer unseres unses unsre unsrem unsren unsrer unsres unter vergangenen viel viele vielem vielen vielleicht vier vierte vierten vierter viertes vom von vor wahr? wann war waren warst wart warum was weg wegen weil weit weiter weitere weiteren weiteres welche welchem welchen welcher welches wem wen wenig wenige weniger weniges wenigstens wenn wer werde werden werdet weshalb wessen wie wieder will willst wir wird wirklich wirst wohl wollen wollt wollte wollten womit worden wurde wurden würde würden während währenddem währenddessen wäre wären über überhaupt übrigens zehn zehnte zehnten zehnter zehntes zeit zuerst zugleich zum zunächst zur zurück zusammen zwanzig zwar zwei zweite zweiten zweiter zweites zwischen zwischens zwölf og jeg det at en et den til er som på de med han av ikke ikkje der så var meg seg men ett har om vi min mitt ha hadde hun nå over da ved fra du ut sin dem oss opp man kan hans hvor eller hva skal selv sjøl her alle vil bli ble blei blitt kunne inn når være kom noen noe ville dere som deres kun ja etter ned skulle denne for deg si sine sitt mot å meget hvorfor dette disse uten hvordan ingen din ditt blir samme hvilken hvilke sånn inni mellom vår hver hvem vors hvis både bare enn fordi før mange også slik vært være båe begge siden dykk dykkar dei deira deires deim di då eg ein eit eitt elles honom hjå ho hoe henne hennar hennes hoss hossen ikkje ingi inkje korleis korso kva kvar kvarhelst kven kvi kvifor me medan mi mine mykje no nokon noka nokor noko nokre si sia sidan so somt somme um upp vere vore verte vort varte vart un despre dupa înainte tot toţi aproape asemenea una şi răspuns oricare oricine oricui oriunde sunt este ca întreabă întrebare la rau fi pentru fiind între mare apropo dar de poate zi ziua zile făcut fă face jos fiecare etc altfel departe găseşte pentru ia bun are având ea aici iei lui acum eu dacă în doar ştie şti mare mic mult poate multe nevoie niciodată nou noutăţi nu not nimic de frecvent batrân pornit oprit odată doar oops sau altul alta afară pagina pune întrebare întrebări întrebat citat decât recent spus văzut spune vede trebui trebuia deci câţiva ceva cândva undeva curând adevarat acela acel acesta aceasta aceştia lor ei atunci acolo prin timp spre tot sub sus utilizatori versiune foarte via vrea vreau fost cale noi mers ce când unde care cine larg cu fără da înca tu lol aan af al alles als altijd andere ben bij daar dan dat de der deze die dit doch doen door dus een eens en er ge geen geweest haar had heb hebben heeft hem het hier hij hoe hun iemand iets ik in is ja je kan kon kunnen maar me meer men met mij mijn moet na naar niet niets nog nu of om omdat ons ook op over reeds te tegen toch toen tot u uit uw van veel voor want waren was wat we wel werd wezen wie wij wil worden zal ze zei zelf zich zij zijn zo zonder zou """ self._make_bl() def _make_bl(self): words = self.words.split('\n') for w in words: w = w.strip() self.bl.add( w )
6.228257
41
0.835612
5,015
31,079
5.17667
0.893719
0.00104
0.001387
0.001156
0
0
0
0
0
0
0
0
0.162747
31,079
4,989
42
6.229505
0.997694
0.001191
0
0.180012
0
0
0.992683
0
0
1
0
0
0
1
0.000401
false
0.000201
0
0
0.000602
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
2
d593aa20c0d454fc001963dd13357c95ff3ddb2c
1,149
py
Python
app/menubar.py
Ahmedelsayed518/UV-Visible-GUI
637cacf26b8f3842ba6e7547134f334b88b5322e
[ "MIT" ]
null
null
null
app/menubar.py
Ahmedelsayed518/UV-Visible-GUI
637cacf26b8f3842ba6e7547134f334b88b5322e
[ "MIT" ]
null
null
null
app/menubar.py
Ahmedelsayed518/UV-Visible-GUI
637cacf26b8f3842ba6e7547134f334b88b5322e
[ "MIT" ]
null
null
null
from tkinter import * from tkinter import ttk class menubar(Frame): def __init__(self, parent, controller, root): Frame.__init__(self, parent) self.controller = controller self.root = root menubar = Menu(self.root) file = Menu(menubar, tearoff=0) edit = Menu(menubar, tearoff=0) #file menu########### file.add_command(label="New") file.add_command(label="Open") file.add_command(label="Save") file.add_command(label="Save as...") file.add_command(label="Close") file.add_separator() file.add_command(label="Exit") menubar.add_cascade(label="File", menu=file) ####################### #Edit menu############# edit.add_command(label="Undo") edit.add_separator() edit.add_command(label="Cut") edit.add_command(label="Copy") edit.add_command(label="Paste") edit.add_command(label="Delete") edit.add_command(label="Select All") menubar.add_cascade(label="Edit", menu=edit) root.config(menu=menubar)
32.828571
52
0.56658
130
1,149
4.823077
0.284615
0.191388
0.287081
0.181818
0.073365
0
0
0
0
0
0
0.002401
0.275022
1,149
35
53
32.828571
0.7503
0.015666
0
0
0
0
0.064635
0
0
0
0
0
0
1
0.037037
false
0
0.074074
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
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d5a7eaad2ca3f57bf69ca5f2eb5a47623af754a4
743
py
Python
lambdas.py
christian1607/python
6077cb2c87d31428d7fa4b98804742055def57be
[ "Apache-2.0" ]
null
null
null
lambdas.py
christian1607/python
6077cb2c87d31428d7fa4b98804742055def57be
[ "Apache-2.0" ]
null
null
null
lambdas.py
christian1607/python
6077cb2c87d31428d7fa4b98804742055def57be
[ "Apache-2.0" ]
null
null
null
sum = lambda a,b : a + b print("suma: "+ str(sum(1,2))) # Map lambdas names = ["Christian", "yamile", "Anddy", "Lucero", "Evelyn"] names = map(lambda name:name.upper(),names) print(list(names)) def decrement_list (*vargs): return list(map(lambda number: number - 1,vargs)) print(decrement_list(1,2,3)) #all def is_all_strings(lst): return all(type(l) == str for l in lst) print(is_all_strings(['2',3])) #sorted numbers = [2,3,5,1,8,3,7,9,4] print(numbers) print(sorted(numbers)) print(sorted(numbers,reverse=True)) print(numbers) def extremes(ass): return min (ass),max(ass) print(extremes([1,2,3,4,5])) print(extremes("alcatraz")) print(extremes([1,2,3,4,5])) print(all(n%2==0 for n in [10, 2, 0, 4, 4, 4, 40]))
17.27907
60
0.648721
132
743
3.606061
0.393939
0.021008
0.018908
0.105042
0.096639
0.096639
0.096639
0.096639
0
0
0
0.059561
0.141319
743
43
61
17.27907
0.68652
0.026918
0
0.181818
0
0
0.065278
0
0
0
0
0
0
1
0.136364
false
0
0
0.136364
0.272727
0.545455
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
1
0
2
d5ad8f184cd220311a80ef9b817330aba06dc345
239
py
Python
app/main.py
DECODEproject/decidim-pilot-connector
8dd66025b28761da2684dad17fdc391a8e7f75da
[ "Apache-2.0" ]
null
null
null
app/main.py
DECODEproject/decidim-pilot-connector
8dd66025b28761da2684dad17fdc391a8e7f75da
[ "Apache-2.0" ]
null
null
null
app/main.py
DECODEproject/decidim-pilot-connector
8dd66025b28761da2684dad17fdc391a8e7f75da
[ "Apache-2.0" ]
1
2019-08-27T00:48:09.000Z
2019-08-27T00:48:09.000Z
from fastapi import FastAPI app = FastAPI(title="DECIDIM Pilot connector", description="Mission: connect DDDC to Chainspace", version="0.0.1",) @app.get("/") def root(): return {"message": "Hello World"}
21.727273
64
0.615063
28
239
5.25
0.857143
0
0
0
0
0
0
0
0
0
0
0.016484
0.238494
239
10
65
23.9
0.791209
0
0
0
0
0
0.343096
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0.142857
0.428571
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
2
63362738e692bfd0bddc71b189ce88879a2f72e4
424
py
Python
src/wired_components/scanner/models.py
pauleveritt/wired_components
a9072d5fc48680d5ff895887842ffd0f06bc0081
[ "MIT" ]
1
2019-09-15T12:30:44.000Z
2019-09-15T12:30:44.000Z
src/wired_components/scanner/models.py
pauleveritt/wired_components
a9072d5fc48680d5ff895887842ffd0f06bc0081
[ "MIT" ]
null
null
null
src/wired_components/scanner/models.py
pauleveritt/wired_components
a9072d5fc48680d5ff895887842ffd0f06bc0081
[ "MIT" ]
null
null
null
from dataclasses import dataclass from types import ModuleType from venusian import Scanner from wired import ServiceRegistry from zope.interface import Interface, implementer class IScanner(Interface): """ A decorator scanner """ def scan(target: ModuleType) -> None: """ Look in a module for decorators """ @implementer(IScanner) @dataclass class WiredScanner(Scanner): registry: ServiceRegistry
21.2
49
0.754717
47
424
6.808511
0.595745
0
0
0
0
0
0
0
0
0
0
0
0.17217
424
19
50
22.315789
0.911681
0.122642
0
0
0
0
0
0
0
0
0
0
0
1
0.090909
false
0
0.454545
0
0.818182
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
63426f8f97bf48d44f1d5e598b9e8d63f6c2b4ec
5,523
py
Python
IReporter/models.py
OwinoLucas/I-Reporter
d84048522c48585fc544496f18d3d404eef16f1e
[ "Unlicense" ]
null
null
null
IReporter/models.py
OwinoLucas/I-Reporter
d84048522c48585fc544496f18d3d404eef16f1e
[ "Unlicense" ]
6
2021-03-30T13:52:30.000Z
2021-09-08T02:13:04.000Z
IReporter/models.py
OwinoLucas/I-Reporter
d84048522c48585fc544496f18d3d404eef16f1e
[ "Unlicense" ]
2
2020-06-17T17:15:46.000Z
2020-07-01T19:15:22.000Z
from __future__ import unicode_literals from django.db import models from django.utils import timezone import datetime from cloudinary.models import CloudinaryField,CloudinaryResource from django.utils import timezone from django.db import transaction from django.contrib.auth.models import (AbstractBaseUser, PermissionsMixin, BaseUserManager) import jwt from datetime import datetime, timedelta from django.conf import settings from cloudinary_storage.storage import VideoMediaCloudinaryStorage,MediaCloudinaryStorage from cloudinary_storage.validators import validate_video # Create your models here. class UserManager(BaseUserManager): def _create_user(self, email, password, **extra_fields): """ Creates and saves a User with the given email,and password. """ if not email: raise ValueError('The given email must be set') try: with transaction.atomic(): user = self.model(email=email, **extra_fields) user.set_password(password) user.save(using=self._db) return user except: raise def create_user(self, email, password=None, **extra_fields): extra_fields.setdefault('is_staff', False) extra_fields.setdefault('is_superuser', False) return self._create_user(email, password, **extra_fields) def create_superuser(self, email, password, **extra_fields): extra_fields.setdefault('is_staff', True) extra_fields.setdefault('is_superuser', True) return self._create_user(email, password=password, **extra_fields) class User(AbstractBaseUser, PermissionsMixin): """ An abstract base class implementing a fully featured User model with admin-compliant permissions. """ email = models.EmailField(max_length=40, unique=True) first_name = models.CharField(max_length=30, blank=True) last_name = models.CharField(max_length=30, blank=True) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) date_joined = models.DateTimeField(default=timezone.now) objects = UserManager() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['first_name', 'last_name'] def save(self, *args, **kwargs): super(User, self).save(*args, **kwargs) return self def generate_token(self,*args): dt = datetime.now() + timedelta(days=60) token = jwt.encode({ 'id': self.pk, 'email': self.email, 'exp': int(dt.strftime('%s')) }, settings.SECRET_KEY, algorithm='HS256') return token.decode('utf-8') class Profile(models.Model): ''' profile class to define profile objects ''' user=models.OneToOneField(User,on_delete=models.CASCADE) profile_picture=CloudinaryField('picture',blank=True) bio=models.CharField(max_length=100,blank=True) contacts=models.CharField(max_length=30,blank=True) def __str__(self): return self.user class Tag(models.Model): ''' profile class to define tag object ''' tag_name = models.CharField(max_length=100) def __str__(self): return self.tag_name class InterventionRecord(models.Model): ''' profile class to define InterventionRecord objects ''' STATUS=( ('Under Investigation','Under Investigation'), ('rejected','rejected'), ('resolved','resolved') ) title=models.CharField(max_length=50,blank=False) description=models.TextField(blank=True, null=True) time_of_creation=models.DateTimeField(auto_now_add=True) time_last_edit=models.DateTimeField(auto_now=True) status=models.CharField(max_length=20,choices=STATUS, blank=True, null=True ,default="waiting") latitude = models.CharField(max_length=200, blank=True,null=True) longitude = models.CharField(max_length=200,blank=True,null=True) image=models.ImageField(upload_to='images/interventionimages/',blank=True,null=True,storage=MediaCloudinaryStorage(),max_length=100000, default="media/images/intervention_default_ozvizh.jpg") videos=models.FileField(upload_to='videos/',blank=True,null=True,storage=VideoMediaCloudinaryStorage(),validators=[validate_video]) user=models.ForeignKey(User,on_delete=models.CASCADE) tags=models.ManyToManyField(Tag,blank=True) def __str__(self): return self.title class Meta: ordering = ["-pk"] class Flag(models.Model): ''' profile class to define FlagRecord objects ''' STATUS=[ ('Under Investigation','Under Investigation'), ('rejected','rejected'), ('resolved','resolved') ] title = models.CharField(max_length=100) description=models.TextField() created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) latitude = models.DecimalField(max_digits=9, decimal_places=6, default='') longitude = models.DecimalField(max_digits=9, decimal_places=6, default='') tags=models.ManyToManyField(Tag) image=models.ImageField(upload_to='images/flagimages/',blank=True,storage=MediaCloudinaryStorage()) videos=models.FileField(upload_to='videos/',blank=True,storage=VideoMediaCloudinaryStorage(),validators=[validate_video]) user=models.ForeignKey(User,on_delete=models.CASCADE) def __str__(self): return self.title class Meta: verbose_name_plural = "Flags" ordering = ["-pk"]
36.098039
195
0.699077
637
5,523
5.902669
0.299843
0.033511
0.047872
0.06383
0.457447
0.365957
0.263298
0.225532
0.164362
0.114894
0
0.009609
0.189752
5,523
152
196
36.335526
0.830615
0.063733
0
0.186916
0
0
0.07501
0.013818
0
0
0
0
0
1
0.084112
false
0.056075
0.121495
0.037383
0.71028
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
634cb5675af0793e512fca5765da42da552eb36e
3,866
py
Python
interface/K12edu/common/picture_list_code.py
aoruilin/SeleniumBase
304fd7a23661ebf561da47d4cd8f7365dba519ca
[ "MIT" ]
null
null
null
interface/K12edu/common/picture_list_code.py
aoruilin/SeleniumBase
304fd7a23661ebf561da47d4cd8f7365dba519ca
[ "MIT" ]
null
null
null
interface/K12edu/common/picture_list_code.py
aoruilin/SeleniumBase
304fd7a23661ebf561da47d4cd8f7365dba519ca
[ "MIT" ]
null
null
null
def author_picture(): author_picture_list = [ "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "2ca50ff2ca024a75a893b80257458104.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "f3b24a5e1d534ba49b36f4ac36ce4f09.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "e7c07866de6f4cb0bccac1baad568d93.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "9c405d8ba8824dcab891b483afbea2bb.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "8800fb7a237740779f17b8ac57defa57.png" ] return author_picture_list def work_picture(): work_picture_list = [ "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "4a60ada1fc0f478ca109f9fe49419328.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "20595550fe6e4830bcc8a03f2f7d4b9c.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "83c57efc02d74c7687bcbe62b06b5245.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "330d96fde0644196bc9a87276782b1f0.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "19e2e5ad971a4bf4af25d2b62b428854.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "26b333ce54724623aeb1d83f68b4b512.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "3734093298344d09834fd4897100530f.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "8005c7f2b69a4111ad5351c5dec8f022.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "8800fb7a237740779f17b8ac57defa57.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "4b3f7fdef342445fb2941dbb15a7eed0.jpg" ] return work_picture_list def turtle_code(): code = """import turtle t = turtle.Turtle() screen = turtle.Screen() screen.bgpic('userupload/sucai/3702/20200218/58eb54f9753d1.jpg') t.begin_fill() turtle.colormode(255) t.forward(150) t.right(90) t.forward(170) t.right(90) t.forward(150) t.right(90) t.forward(170) t.fillcolor(250, 255, 230) t.end_fill() t.right(30) t.begin_fill() t.fillcolor(255, 120, 60) t.forward(150) t.right(120) t.forward(150) t.end_fill() print('abc')""" return code def wrong_code(): code = "import turtle\n\n" \ "t = turtle.Turtle()\n" \ "t.forward(150)\n" \ "print(abc)\n" return code def pygame_code(): code = """import pygame from pygame.locals import * background_image = 'userupload/sucai/3702/20200118/bgimg.jpg' mouse_image = 'userupload/sucai/3702/20200224/Snipaste_2019-07-23_17-44-01.png' pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) pygame.display.set_caption('hello world') background = pygame.image.load(background_image) mouse_cursor = pygame.image.load(mouse_image) while True: screen.blit(background, (0, 0)) x, y = pygame.mouse.get_pos() x -= mouse_cursor.get_width()/2 y -= mouse_cursor.get_height()/2 screen.blit(mouse_cursor, (x, y)) pygame.display.update() """ return code def multiple_files_code(file_name, content): main_code = f"from {file_name} import hello\n\na = hello()\nprint(a)\n\n" file_code = f"def hello():\n s = '{content}'\n\n return s" return main_code, file_code def three_dimensional_code(): code = """import cadquery as cq model = cq.Workplane("XY") model = model.box(10, 20, 30) show_model(model, cq) """ return code def robot_code(): code = 'import robot\n\n' \ 'r=robot.robot()\n' \ 'r.up(1)\n' \ 'r.nod(1)\n' return code
29.738462
79
0.684946
472
3,866
5.516949
0.275424
0.046083
0.069124
0.126728
0.387481
0.378264
0.378264
0.378264
0.378264
0.37212
0
0.219633
0.167356
3,866
129
80
29.968992
0.589313
0
0
0.333333
0
0.009524
0.738489
0.265391
0
0
0
0
0
1
0.07619
false
0
0.066667
0
0.219048
0.028571
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
636523433092fd9b10c0e40ebaf99ca55bc863c6
3,174
py
Python
contrib/play/tripler.py
Rosencrantz/aleph
47ac45fa72607e1ab16c7c30690013a7d00be116
[ "MIT" ]
1,213
2017-03-15T08:10:52.000Z
2022-03-29T13:57:44.000Z
contrib/play/tripler.py
Rosencrantz/aleph
47ac45fa72607e1ab16c7c30690013a7d00be116
[ "MIT" ]
1,374
2017-03-14T18:23:10.000Z
2022-03-31T18:42:20.000Z
contrib/play/tripler.py
Rosencrantz/aleph
47ac45fa72607e1ab16c7c30690013a7d00be116
[ "MIT" ]
217
2017-03-17T12:04:22.000Z
2022-03-20T11:17:16.000Z
from banal import ensure_list from rdflib import Namespace, ConjunctiveGraph, URIRef, Literal from rdflib.namespace import FOAF, DC, RDF, RDFS, SKOS from followthemoney import model from pprint import pprint from elasticsearch import Elasticsearch from elasticsearch.helpers import scan es = Elasticsearch() collection_index = "aleph-collection-v1" entity_index = "aleph-entity-v1" HOST = "https://data.occrp.org" ALEPH = Namespace("%s/#/ns/" % HOST) FTM = Namespace("urn:ftm:") SCHEMA = Namespace("%s/#/ftm/" % HOST) def export_entity(ctx, entity): g = ConjunctiveGraph() if "Document" in entity["schemata"]: uri = URIRef("%s/documents/%s" % (HOST, entity["id"])) if entity.get("title"): g.add((uri, DC.title, Literal(entity.get("title")), ctx)) g.add((uri, ALEPH.fileName, Literal(entity.get("file_name")), ctx)) g.add((uri, ALEPH.mimeType, Literal(entity.get("mime_type")), ctx)) # TODO DC dates, author etc. # parent else: uri = URIRef("%s/entities/%s" % (HOST, entity["id"])) if entity.get("name"): g.add((uri, SKOS.prefLabel, Literal(entity.get("name")), ctx)) for name in entity.get("names", []): g.add((uri, RDFS.label, Literal(name), ctx)) for schema in entity["schemata"]: g.add((uri, RDF.type, FTM[schema], ctx)) for country in entity.get("countries", []): if len(country) != 2: continue country = URIRef("iso-3166-1:%s" % country) g.add((uri, ALEPH.country, country, ctx)) for phone in entity.get("phones", []): phone = URIRef("tel:%s" % phone) g.add((uri, ALEPH.phone, phone, ctx)) for email in entity.get("emails", []): email = URIRef("mailto:%s" % email) g.add((uri, ALEPH.email, email, ctx)) schema = model[entity["schema"]] properties = entity.get("properties", {}) for name, values in properties.items(): prop = schema.get(name) pred = "%s#%s" % (prop.schema.name, name) pred = FTM[pred] for value in ensure_list(values): g.add((uri, pred, Literal(value), ctx)) print g.serialize(format="nquads") def export_collection(collection): g = ConjunctiveGraph() domain = URIRef(HOST) ctx = URIRef("%s/collections/%s" % (HOST, collection["id"])) g.add((ctx, RDFS.label, Literal(collection["label"]), domain)) g.add((ctx, ALEPH.foreignId, Literal(collection["foreign_id"]), domain)) # print g.serialize(format='nquads') # pprint(collection) q = { "query": {"term": {"collection_id": collection["id"]}}, "_source": {"exclude": ["text"]}, } for row in scan(es, index=entity_index, query=q): entity = row["_source"] entity["id"] = row["_id"] export_entity(ctx, entity) def export_collections(): q = {"query": {"match_all": {}}, "size": 9999} res = es.search(index=collection_index, body=q) for hit in res["hits"]["hits"]: collection = hit["_source"] collection["id"] = hit["_id"] export_collection(collection) if __name__ == "__main__": export_collections()
33.0625
76
0.60586
400
3,174
4.7325
0.2825
0.025357
0.036978
0.031696
0.069731
0.025357
0.025357
0
0
0
0
0.00485
0.220542
3,174
95
77
33.410526
0.760307
0.02741
0
0.027397
0
0
0.126217
0
0
0
0
0.010526
0
0
null
null
0
0.09589
null
null
0.027397
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
639374a2fec0e28ae70c8723b9cd6213ed48136a
1,954
py
Python
misc_utils.py
MurreyCode/pytorch_deep_reinforcement_learning
ff084cf61224c6abeda4848f892d14c61e3b470d
[ "MIT" ]
null
null
null
misc_utils.py
MurreyCode/pytorch_deep_reinforcement_learning
ff084cf61224c6abeda4848f892d14c61e3b470d
[ "MIT" ]
null
null
null
misc_utils.py
MurreyCode/pytorch_deep_reinforcement_learning
ff084cf61224c6abeda4848f892d14c61e3b470d
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- from collections import namedtuple import random Transition = namedtuple('Transition', ('state', 'action', 'next_state', 'reward', 'done')) # courtesy of the torch tutorial <3 import numpy as np def one_hot(a, num_classes): return np.squeeze(np.eye(num_classes)[a.reshape(-1)]) class Memory(object): def __init__(self, capacity): self.capacity = capacity self.memory = [] self.position = 0 def push(self, *args): """Saves a transition.""" if len(self.memory) < self.capacity: self.memory.append(None) self.memory[self.position] = Transition(*args) self.position = (self.position + 1) % self.capacity def sample(self, batch_size): return random.sample(self.memory, batch_size) def __len__(self): return len(self.memory) class LinearSchedule(object): def __init__(self, schedule_timesteps, final_p, initial_p=1.0): """Linear interpolation between initial_p and final_p over schedule_timesteps. After this many timesteps pass final_p is returned. Parameters ---------- schedule_timesteps: int Number of timesteps for which to linearly anneal initial_p to final_p initial_p: float initial output value final_p: float final output value """ self.schedule_timesteps = schedule_timesteps self.final_p = final_p self.initial_p = initial_p self.p = self.initial_p @property def value(self): return self.p def reset(self): self.p = self.initial_p def update(self, t): """See Schedule.value""" if self.p > self.final_p: fraction = min(float(t) / self.schedule_timesteps, 1.0) self.p = self.initial_p + fraction * (self.final_p - self.initial_p)
26.767123
80
0.611566
244
1,954
4.721311
0.372951
0.069444
0.052083
0.056424
0.075521
0
0
0
0
0
0
0.006415
0.281986
1,954
72
81
27.138889
0.814683
0.229273
0
0.055556
0
0
0.029475
0
0
0
0
0
0
1
0.25
false
0
0.083333
0.111111
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
63a2dad53d571759e226d5c99caad8f989042557
979
py
Python
tests/test_open_selecter_view.py
anosillus/thank-you_letter_generator
cfa650e0708fe5c594b7165276eecaa22e31aca5
[ "MIT" ]
null
null
null
tests/test_open_selecter_view.py
anosillus/thank-you_letter_generator
cfa650e0708fe5c594b7165276eecaa22e31aca5
[ "MIT" ]
null
null
null
tests/test_open_selecter_view.py
anosillus/thank-you_letter_generator
cfa650e0708fe5c594b7165276eecaa22e31aca5
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- # File name: test_open_selecter_view.py # First Edit: 2021-03-25 # Last Change: 2021-03-25 __description__ = "" __author__ = "@anosillus" __license__ = "MIT" __email__ = "anosillus@gmail.com" __status__ = "Production" import logging import itertools import os from collections import Counter from dataclasses import dataclass from typing import Callable from typing import Final from typing import NamedTuple from typing import TypedDict from typing import Union from logzero import logger import logzero from logzero import setup_logger from src.log_settings import DEFAULT_LOG_SETTINGS from src.open_selecter_view import * logger = setup_logger(name=__name__, **DEFAULT_LOG_SETTINGS) logzero.loglevel(logging.INFO) def test_main(): assert 5 == 5 logger.debug("hello") logger.info("info") logger.warning("warning") logger.error("error") # vim: ft=python ts=4 sw=4 sts=4 tw=88 fenc=utf-8 ff=unix si et:
21.755556
64
0.759959
142
979
4.978873
0.535211
0.070721
0.113154
0
0
0
0
0
0
0
0
0.029869
0.145046
979
44
65
22.25
0.814815
0.194076
0
0
0
0
0.08046
0
0
0
0
0
0.035714
1
0.035714
false
0
0.535714
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
0
0
0
1
0
1
0
0
2
63a4d1764f11470ace0a0b5e26791a6fa519b58b
429
py
Python
config.py
Alissonfelipe1234/atrium
7fcbd994dbedda7bbdbce8ab7ca5d1b178e72940
[ "MIT" ]
null
null
null
config.py
Alissonfelipe1234/atrium
7fcbd994dbedda7bbdbce8ab7ca5d1b178e72940
[ "MIT" ]
null
null
null
config.py
Alissonfelipe1234/atrium
7fcbd994dbedda7bbdbce8ab7ca5d1b178e72940
[ "MIT" ]
null
null
null
import os from os import environ class Config(object): basedir = os.path.abspath(os.path.dirname(__file__)) SECRET_KEY = 'key' class ProductionConfig(Config): DEBUG = False SESSION_COOKIE_HTTPONLY = True REMEMBER_COOKIE_HTTPONLY = True REMEMBER_COOKIE_DURATION = 3600 class DebugConfig(Config): DEBUG = True config_dict = { 'Production': ProductionConfig, 'Debug': DebugConfig }
16.5
59
0.703963
48
429
6.041667
0.5625
0.041379
0.124138
0.17931
0.2
0
0
0
0
0
0
0.011834
0.212121
429
25
60
17.16
0.846154
0
0
0
0
0
0.041958
0
0
0
0
0
0
1
0
false
0
0.125
0
0.75
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
0
0
1
0
0
2
63a79af1220c6999b725178a5d6bffd25f53f71c
1,477
py
Python
mypyc/test/test_rarray.py
ooprathamm/mypy
1ac9c77bb0b5b95a9b3ee8936ac74a52e6e641ac
[ "PSF-2.0" ]
null
null
null
mypyc/test/test_rarray.py
ooprathamm/mypy
1ac9c77bb0b5b95a9b3ee8936ac74a52e6e641ac
[ "PSF-2.0" ]
null
null
null
mypyc/test/test_rarray.py
ooprathamm/mypy
1ac9c77bb0b5b95a9b3ee8936ac74a52e6e641ac
[ "PSF-2.0" ]
null
null
null
"""Unit tests for RArray types.""" import unittest from mypyc.common import PLATFORM_SIZE from mypyc.ir.rtypes import ( RArray, int_rprimitive, bool_rprimitive, compute_rtype_alignment, compute_rtype_size ) class TestRArray(unittest.TestCase): def test_basics(self) -> None: a = RArray(int_rprimitive, 10) assert a.item_type == int_rprimitive assert a.length == 10 def test_str_conversion(self) -> None: a = RArray(int_rprimitive, 10) assert str(a) == 'int[10]' assert repr(a) == '<RArray <RPrimitive builtins.int>[10]>' def test_eq(self) -> None: a = RArray(int_rprimitive, 10) assert a == RArray(int_rprimitive, 10) assert a != RArray(bool_rprimitive, 10) assert a != RArray(int_rprimitive, 9) def test_hash(self) -> None: assert hash(RArray(int_rprimitive, 10)) == hash(RArray(int_rprimitive, 10)) assert hash(RArray(bool_rprimitive, 5)) == hash(RArray(bool_rprimitive, 5)) def test_alignment(self) -> None: a = RArray(int_rprimitive, 10) assert compute_rtype_alignment(a) == PLATFORM_SIZE b = RArray(bool_rprimitive, 55) assert compute_rtype_alignment(b) == 1 def test_size(self) -> None: a = RArray(int_rprimitive, 9) assert compute_rtype_size(a) == 9 * PLATFORM_SIZE b = RArray(bool_rprimitive, 3) assert compute_rtype_size(b) == 3
34.348837
89
0.635748
189
1,477
4.756614
0.243386
0.159066
0.211346
0.155729
0.467186
0.347052
0.242492
0.200222
0.082314
0
0
0.029091
0.255247
1,477
42
90
35.166667
0.788182
0.018957
0
0.125
0
0
0.03212
0
0
0
0
0
0.40625
1
0.1875
false
0
0.09375
0
0.3125
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
2
63b4838b841b5b36941643a2f1d485634336192e
334
py
Python
vcflat/__main__.py
arontommi/VCFlat
f707d8e564ec30c65e063eea305aa30cf698cc86
[ "MIT" ]
4
2019-11-29T12:59:12.000Z
2020-01-28T15:30:44.000Z
vcflat/__main__.py
arontommi/VCFlat
f707d8e564ec30c65e063eea305aa30cf698cc86
[ "MIT" ]
1
2022-01-04T22:58:58.000Z
2022-01-04T22:58:58.000Z
vcflat/__main__.py
arontommi/VCFlat
f707d8e564ec30c65e063eea305aa30cf698cc86
[ "MIT" ]
1
2020-01-28T15:31:29.000Z
2020-01-28T15:31:29.000Z
import sys from vcflat.cli import vcflat as cli """ vcfflat.__main__ ~~~~~~~~~~~~~~~~~~~~~ The main entry point for the command line interface. Invoke as ``vcflat`` (if installed) or ``python -m vcflat`` (no install required). """ if __name__ == "__main__": # exit using whatever exit code the CLI returned sys.exit(cli())
20.875
52
0.661677
46
334
4.543478
0.652174
0
0
0
0
0
0
0
0
0
0
0
0.173653
334
15
53
22.266667
0.757246
0.137725
0
0
0
0
0.076923
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
0
1
0
0
0
0
2
63b542041f855d909d6bb04c7c77bcc1d0fa8d3b
116
py
Python
yolooverlay.py
shyamsunder0072/CensorLabel
5075c227012b0955e4ff7968c59ef626561470e2
[ "MIT" ]
1
2020-05-12T05:39:29.000Z
2020-05-12T05:39:29.000Z
yolooverlay.py
shyamsunder0072/CensorLabel
5075c227012b0955e4ff7968c59ef626561470e2
[ "MIT" ]
null
null
null
yolooverlay.py
shyamsunder0072/CensorLabel
5075c227012b0955e4ff7968c59ef626561470e2
[ "MIT" ]
null
null
null
path = 'home/sample.mp4' akhil = [] akhil = path.split(".") video = akhil[0].split("/") print(video[len(video)-1])
16.571429
27
0.612069
17
116
4.176471
0.647059
0
0
0
0
0
0
0
0
0
0
0.029412
0.12069
116
7
28
16.571429
0.666667
0
0
0
0
0
0.145299
0
0
0
0
0
0
1
0
false
0
0
0
0
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
891fc98462e0b352b66162bf9e6b62fe37f65276
27,491
py
Python
pysnmp-with-texts/HPN-ICF-FC-PSM-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/HPN-ICF-FC-PSM-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/HPN-ICF-FC-PSM-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 HPN-ICF-FC-PSM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-FC-PSM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:38:51 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) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint") HpnicfFcNameIdOrZero, = mibBuilder.importSymbols("HPN-ICF-FC-TC-MIB", "HpnicfFcNameIdOrZero") hpnicfSan, = mibBuilder.importSymbols("HPN-ICF-VSAN-MIB", "hpnicfSan") ifDescr, InterfaceIndexOrZero, InterfaceIndex = mibBuilder.importSymbols("IF-MIB", "ifDescr", "InterfaceIndexOrZero", "InterfaceIndex") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Counter64, NotificationType, Bits, Gauge32, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, MibIdentifier, IpAddress, TimeTicks, Integer32, ModuleIdentity, iso, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "NotificationType", "Bits", "Gauge32", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "MibIdentifier", "IpAddress", "TimeTicks", "Integer32", "ModuleIdentity", "iso", "Counter32") TruthValue, RowStatus, TextualConvention, TimeStamp, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "RowStatus", "TextualConvention", "TimeStamp", "DisplayString") hpnicfFcPsm = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8)) hpnicfFcPsm.setRevisions(('2013-10-17 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hpnicfFcPsm.setRevisionsDescriptions(('HPN-ICF-FC-PSM-MIB module is for managing the implementation of FC port security.',)) if mibBuilder.loadTexts: hpnicfFcPsm.setLastUpdated('201310170000Z') if mibBuilder.loadTexts: hpnicfFcPsm.setOrganization('') if mibBuilder.loadTexts: hpnicfFcPsm.setContactInfo('') if mibBuilder.loadTexts: hpnicfFcPsm.setDescription('This MIB contains the objects for FC port security.') hpnicfFcPsmNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0)) hpnicfFcPsmObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1)) hpnicfFcPsmScalarObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 1)) hpnicfFcPsmConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2)) hpnicfFcPsmStats = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3)) class HpnicfFcPsmPortBindDevType(TextualConvention, Integer32): description = 'The types of the instance of hpnicfFcPsmLoginDev, including nWWN(Node World Wide Name), pWWN(Port World Wide Name), sWWN(Switch World Wide Name), and wildCard.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4)) namedValues = NamedValues(("nWWN", 1), ("pWWN", 2), ("sWWN", 3), ("wildCard", 4)) class HpnicfFcPsmClearEntryType(TextualConvention, Integer32): description = 'This object when set to clearStatic, results in port bind static entries being cleared on this VSAN(Virtual Storage Area Networks). This object when set to clearAutoLearn, results in port bind auto-learnt entries being cleared on this VSAN. This object when set to clearAll, results in all of the port bind entries being cleared on this VSAN. No action is taken if this object is set to noop. The value of this object when read is always noop.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4)) namedValues = NamedValues(("clearStatic", 1), ("clearAutoLearn", 2), ("clearAll", 3), ("noop", 4)) hpnicfFcPsmNotifyEnable = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmNotifyEnable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmNotifyEnable.setDescription('Whether to generate the notification or not depends on the object.') hpnicfFcPsmEnableTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1), ) if mibBuilder.loadTexts: hpnicfFcPsmEnableTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableTable.setDescription('Enable or disable the port security feature on a specified VSAN.') hpnicfFcPsmEnableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmEnableEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableEntry.setDescription('Detailed information about the port security.') hpnicfFcPsmEnableVsanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4095))) if mibBuilder.loadTexts: hpnicfFcPsmEnableVsanIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableVsanIndex.setDescription('The ID of VSAN on this entry.') hpnicfFcPsmEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("enable", 1), ("enableWithAutoLearn", 2), ("disable", 3), ("noop", 4))).clone('noop')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmEnable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnable.setDescription('When set to enable, the port security is on, the value of hpnicfFcPsmEnableState will be true. When set to enableWithAutoLearn, the port security is on with auto-learning, the value of hpnicfFcPsmEnableState will be true. When set to disable, the port security is off, the value of hpnicfFcPsmEnableState will be false. The noop means no action. The value of this object when read is always noop.') hpnicfFcPsmEnableState = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 3), TruthValue().clone('false')).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnableState.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableState.setDescription('The state of the port security. When the value is true, it means the port security is on, while the false means the port security is off.') hpnicfFcPsmConfigTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2), ) if mibBuilder.loadTexts: hpnicfFcPsmConfigTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmConfigTable.setDescription('A table that contains the configured entries.') hpnicfFcPsmConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"), (0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmIndex")) if mibBuilder.loadTexts: hpnicfFcPsmConfigEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmConfigEntry.setDescription('Detailed information about each configuration.') hpnicfFcPsmIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 32768))) if mibBuilder.loadTexts: hpnicfFcPsmIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmIndex.setDescription('The index of this entry.') hpnicfFcPsmLoginDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 2), HpnicfFcPsmPortBindDevType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFcPsmLoginDevType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginDevType.setDescription('This represents the type of the instance of hpnicfFcPsmLoginDev, which includes nWWN, pWWN, sWWN, and wildCard.') hpnicfFcPsmLoginDev = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 3), HpnicfFcNameIdOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFcPsmLoginDev.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginDev.setDescription('The logging-in device name, which is decided by the hpnicfFcPsmLoginDevType object. It represents node WWN when the value of hpnicfFcPsmLoginDevType is nWWN. It represents port WWN when the value of hpnicfFcPsmLoginDevType is pWWN. It represents switch WWN when the value of hpnicfFcPsmLoginDevType is sWWN. It represents any device when the value of hpnicfFcPsmLoginDevType is wildCard, and the value of the instance of this object should be zero-length string. The value of this object should not be invalid when hpnicfFcPsmRowStatus is set to createAndGo or active.') hpnicfFcPsmLoginPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 4), InterfaceIndexOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFcPsmLoginPoint.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginPoint.setDescription('The address of the port on the local switch through which the instance of hpnicfFcPsmLoginDev can log in. It represents ifindex when the value is not zero. It represents any port when the value is zero.') hpnicfFcPsmRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFcPsmRowStatus.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmRowStatus.setDescription('Entry status. When creating a new instance of this table, the following objects should be set simultaneously: hpnicfFcPsmLoginDevType, h3cFcPsmLoginDev, hpnicfFcPsmLoginPoint, hpnicfFcPsmRowStatus. If hpnicfFcPsmLoginDevType is set to wildCard, the value of the instance of hpnicfFcPsmLoginDev should be zero-length string. The value of hpnicfFcPsmLoginDevType and hpnicfFcPsmLoginPoint cannot be set to wildCard and zero at the same time.') hpnicfFcPsmEnfTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3), ) if mibBuilder.loadTexts: hpnicfFcPsmEnfTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfTable.setDescription('The FC port security enforced table. It contains not only the configured policies, but also the learning ones learnt by the switch itself.') hpnicfFcPsmEnfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"), (0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnfIndex")) if mibBuilder.loadTexts: hpnicfFcPsmEnfEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfEntry.setDescription('Detailed information about the FC port security enforced policy.') hpnicfFcPsmEnfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 32768))) if mibBuilder.loadTexts: hpnicfFcPsmEnfIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfIndex.setDescription('The index of this entry.') hpnicfFcPsmEnfLoginDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 2), HpnicfFcPsmPortBindDevType()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDevType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDevType.setDescription('This represents the type of the instance of hpnicfFcPsmEnfLoginDev, which includes nWWN, pWWN, sWWN, and wildCard.') hpnicfFcPsmEnfLoginDev = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 3), HpnicfFcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDev.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDev.setDescription('The logging-in device name, which is decided by the hpnicfFcPsmEnfLoginDevType object. It represents node WWN when the value of hpnicfFcPsmEnfLoginDevType is nWWN. It represents port WWN when the value of hpnicfFcPsmEnfLoginDevType is pWWN. It represents switch WWN when the value of hpnicfFcPsmEnfLoginDevType is sWWN. It represents any device when the value of hpnicfFcPsmEnfLoginDevType is wildCard, and the value of the instance of this object should be zero-length string.') hpnicfFcPsmEnfLoginPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 4), InterfaceIndexOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginPoint.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginPoint.setDescription('The address of the port on the local switch through which the instance of hpnicfFcPsmEnfLoginDev can log in. It represents ifindex when the value is not zero. It represents any port when the value is zero.') hpnicfFcPsmEnfEntryType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("learning", 1), ("learnt", 2), ("static", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnfEntryType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfEntryType.setDescription('When the value is learning, it represents the entry is learnt by the switch itself temporarily and will be deleted when the device log out. When the value is learnt, it represents the entry is learnt by the switch permanently. When the value is static, it represents the entry is configured.') hpnicfFcPsmCopyToConfigTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4), ) if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigTable.setDescription('Specifies whether to copy the entries from enforced table to the ones on configured table.') hpnicfFcPsmCopyToConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigEntry.setDescription('Detailed information about the operation.') hpnicfFcPsmCopyToConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("copy", 1), ("noop", 2))).clone('noop')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfig.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfig.setDescription('When the object is set to copy, the learned entries will be copied on to the configured table on this VSAN, while the noop means no operation. The value of this object when read is always noop.') hpnicfFcPsmAutoLearnTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5), ) if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnTable.setDescription('This table shows whether the auto-learning is enabled or not on specific VSANs.') hpnicfFcPsmAutoLearnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEntry.setDescription('Detailed information about the auto-learning.') hpnicfFcPsmAutoLearnEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEnable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEnable.setDescription('This object is set to true to enable, or false to disable auto-learning on the local switch. When set to true, the switch can learn the devices that have already logged in as learning entries on the enforced table, while the false can stop the learning operation with the learning entries transformed to learnt ones.') hpnicfFcPsmClearTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6), ) if mibBuilder.loadTexts: hpnicfFcPsmClearTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearTable.setDescription('This table is used for cleaning specific entries in enforced table.') hpnicfFcPsmClearEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmClearEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearEntry.setDescription('Detailed information about the cleaning options.') hpnicfFcPsmClearType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1, 1), HpnicfFcPsmClearEntryType().clone('noop')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmClearType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearType.setDescription('This object when set to clearStatic, results in port bind static entries being cleared on this VSAN. This object when set to clearAutoLearn, results in auto-learnt entries being cleared on this VSAN. This object when set to clearAll, results in all of the port bind entries being cleared on this VSAN. No action is taken if this object is set to noop. The value of this object when read is always noop.') hpnicfFcPsmClearIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmClearIntf.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearIntf.setDescription('The object specifies the interface on which the entries will be cleared. If the object is zero or not set, it means the specified entries on all interfaces will be cleared.') hpnicfFcPsmStatsTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1), ) if mibBuilder.loadTexts: hpnicfFcPsmStatsTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmStatsTable.setDescription('This table contains statistics of devices, which had been allowed or denied to log into the switch.') hpnicfFcPsmStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmStatsEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmStatsEntry.setDescription('Detailed information about the statistics.') hpnicfFcPsmAllowedLogins = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmAllowedLogins.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAllowedLogins.setDescription('The number of requests that have been allowed on the specified VSAN.') hpnicfFcPsmDeniedLogins = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmDeniedLogins.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmDeniedLogins.setDescription('The number of requests that have been denied on the specified VSAN.') hpnicfFcPsmStatsClear = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("clear", 1), ("noop", 2))).clone('noop')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmStatsClear.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmStatsClear.setDescription('The statistics on this VSAN will be cleared if this object is set to clear. No action is taken if this object is set to noop. The value of this object when read is always noop.') hpnicfFcPsmViolationTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2), ) if mibBuilder.loadTexts: hpnicfFcPsmViolationTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmViolationTable.setDescription('This table maintains the information about the violations happened, containing at most 1024 items. When the number exceeds 1024, the earliest item will be over-written.') hpnicfFcPsmViolationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"), (0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmViolationIndex")) if mibBuilder.loadTexts: hpnicfFcPsmViolationEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmViolationEntry.setDescription('Detailed information about the violation.') hpnicfFcPsmViolationIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))) if mibBuilder.loadTexts: hpnicfFcPsmViolationIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmViolationIndex.setDescription('The index of this entry. The entry is uniquely distinguished by WWN, WWN type and ifindex where the login was denied.') hpnicfFcPsmLoginPWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 2), HpnicfFcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginPWWN.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginPWWN.setDescription('The pWWN of the device whose FLOGI(Fabric Login) request had been denied. If the device is an n-node, the value of the instance of hpnicfFcPsmLoginSWWN should be zero-length string.') hpnicfFcPsmLoginNWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 3), HpnicfFcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginNWWN.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginNWWN.setDescription('The nWWN of the device whose FLOGI request had been denied. If the device is an n-node, the value of the instance of hpnicfFcPsmLoginSWWN should be zero-length string.') hpnicfFcPsmLoginSWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 4), HpnicfFcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginSWWN.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginSWWN.setDescription('The sWWN of the device whose FLOGI request had been denied. If the device is a switch, the values of the instance of hpnicfFcPsmLoginPWWN and hpnicfFcPsmLoginNWWN should be zero-length string.') hpnicfFcPsmLoginIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 5), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginIntf.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginIntf.setDescription('The ifindex of the port where the login was denied.') hpnicfFcPsmLoginTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 6), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginTime.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginTime.setDescription('Specifies the value of SysUpTime when the last denied login happened.') hpnicfFcPsmLoginCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginCount.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginCount.setDescription('The number of times for a certain nWWN/pWWN or sWWN had been denied to log into an interface of the local device.') hpnicfFcPsmFPortDenyNotify = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0, 1)).setObjects(("IF-MIB", "ifDescr"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginPWWN"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginIntf"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginTime")) if mibBuilder.loadTexts: hpnicfFcPsmFPortDenyNotify.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmFPortDenyNotify.setDescription('Notifies that a FLOGI is denied on an F port of the local device.') hpnicfFcPsmEPortDenyNotify = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0, 2)).setObjects(("IF-MIB", "ifDescr"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginSWWN"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginIntf"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginTime")) if mibBuilder.loadTexts: hpnicfFcPsmEPortDenyNotify.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEPortDenyNotify.setDescription('Notifies that a switch is denied on an E port of the local device.') mibBuilder.exportSymbols("HPN-ICF-FC-PSM-MIB", hpnicfFcPsmClearIntf=hpnicfFcPsmClearIntf, hpnicfFcPsmStats=hpnicfFcPsmStats, hpnicfFcPsmClearType=hpnicfFcPsmClearType, hpnicfFcPsmLoginDevType=hpnicfFcPsmLoginDevType, hpnicfFcPsmClearTable=hpnicfFcPsmClearTable, hpnicfFcPsmEnfIndex=hpnicfFcPsmEnfIndex, hpnicfFcPsmConfiguration=hpnicfFcPsmConfiguration, hpnicfFcPsmStatsTable=hpnicfFcPsmStatsTable, hpnicfFcPsmConfigTable=hpnicfFcPsmConfigTable, hpnicfFcPsmEnable=hpnicfFcPsmEnable, hpnicfFcPsmLoginPWWN=hpnicfFcPsmLoginPWWN, hpnicfFcPsmEnfTable=hpnicfFcPsmEnfTable, hpnicfFcPsmLoginTime=hpnicfFcPsmLoginTime, hpnicfFcPsmEnfLoginPoint=hpnicfFcPsmEnfLoginPoint, hpnicfFcPsmClearEntry=hpnicfFcPsmClearEntry, hpnicfFcPsmIndex=hpnicfFcPsmIndex, HpnicfFcPsmPortBindDevType=HpnicfFcPsmPortBindDevType, hpnicfFcPsmCopyToConfigEntry=hpnicfFcPsmCopyToConfigEntry, hpnicfFcPsmLoginNWWN=hpnicfFcPsmLoginNWWN, hpnicfFcPsm=hpnicfFcPsm, hpnicfFcPsmAutoLearnTable=hpnicfFcPsmAutoLearnTable, hpnicfFcPsmEnfEntryType=hpnicfFcPsmEnfEntryType, hpnicfFcPsmEnfLoginDevType=hpnicfFcPsmEnfLoginDevType, hpnicfFcPsmEnableVsanIndex=hpnicfFcPsmEnableVsanIndex, hpnicfFcPsmViolationTable=hpnicfFcPsmViolationTable, hpnicfFcPsmLoginPoint=hpnicfFcPsmLoginPoint, hpnicfFcPsmScalarObjects=hpnicfFcPsmScalarObjects, hpnicfFcPsmViolationIndex=hpnicfFcPsmViolationIndex, hpnicfFcPsmLoginDev=hpnicfFcPsmLoginDev, hpnicfFcPsmNotifyEnable=hpnicfFcPsmNotifyEnable, hpnicfFcPsmDeniedLogins=hpnicfFcPsmDeniedLogins, hpnicfFcPsmCopyToConfig=hpnicfFcPsmCopyToConfig, hpnicfFcPsmObjects=hpnicfFcPsmObjects, hpnicfFcPsmEnfEntry=hpnicfFcPsmEnfEntry, hpnicfFcPsmViolationEntry=hpnicfFcPsmViolationEntry, hpnicfFcPsmConfigEntry=hpnicfFcPsmConfigEntry, PYSNMP_MODULE_ID=hpnicfFcPsm, hpnicfFcPsmEnfLoginDev=hpnicfFcPsmEnfLoginDev, hpnicfFcPsmLoginIntf=hpnicfFcPsmLoginIntf, hpnicfFcPsmEnableTable=hpnicfFcPsmEnableTable, hpnicfFcPsmEnableEntry=hpnicfFcPsmEnableEntry, hpnicfFcPsmFPortDenyNotify=hpnicfFcPsmFPortDenyNotify, hpnicfFcPsmNotifications=hpnicfFcPsmNotifications, hpnicfFcPsmAutoLearnEnable=hpnicfFcPsmAutoLearnEnable, hpnicfFcPsmLoginCount=hpnicfFcPsmLoginCount, hpnicfFcPsmAllowedLogins=hpnicfFcPsmAllowedLogins, hpnicfFcPsmEnableState=hpnicfFcPsmEnableState, hpnicfFcPsmAutoLearnEntry=hpnicfFcPsmAutoLearnEntry, hpnicfFcPsmRowStatus=hpnicfFcPsmRowStatus, hpnicfFcPsmLoginSWWN=hpnicfFcPsmLoginSWWN, hpnicfFcPsmStatsEntry=hpnicfFcPsmStatsEntry, hpnicfFcPsmStatsClear=hpnicfFcPsmStatsClear, hpnicfFcPsmCopyToConfigTable=hpnicfFcPsmCopyToConfigTable, HpnicfFcPsmClearEntryType=HpnicfFcPsmClearEntryType, hpnicfFcPsmEPortDenyNotify=hpnicfFcPsmEPortDenyNotify)
151.049451
2,618
0.779601
3,474
27,491
6.168682
0.109672
0.054316
0.095054
0.009706
0.49692
0.34419
0.320859
0.3035
0.279841
0.264536
0
0.059115
0.105307
27,491
181
2,619
151.883978
0.812165
0.012004
0
0.023392
0
0.140351
0.346531
0.028248
0
0
0
0
0
1
0
false
0
0.052632
0
0.111111
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
894549937c49b6b1be8ad951fd21f0d03e9d2e51
15,897
py
Python
test.py
seevibes/chromium-language-detector
b8ce61beba66b33dce52949c70036a977d0b1b50
[ "BSD-3-Clause" ]
3
2016-07-07T13:44:35.000Z
2017-11-23T07:30:05.000Z
test.py
mzsanford/matt-chromium-compact-language-detector
29b411abd7ed502ea5a5ca2747884cb7540deef8
[ "BSD-3-Clause" ]
null
null
null
test.py
mzsanford/matt-chromium-compact-language-detector
29b411abd7ed502ea5a5ca2747884cb7540deef8
[ "BSD-3-Clause" ]
null
null
null
# coding=utf-8 # Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import cld import unittest import sys from testData import * VERBOSE = False # MKM: ported from FullTests in compact_lang_det_unittest_small.cc class TestCLD(unittest.TestCase): langsSeen = set() detLangsSeen = set() def runOne(self, expectedLangName, s, shouldBeReliable=True): if VERBOSE: print print 'Test: %s [%d bytes]' % (expectedLangName, len(s)) detectedLangName, detectedLangCode, isReliable, textBytesFound, details = cld.detect(s, pickSummaryLanguage=True, removeWeakMatches=False) if VERBOSE: print ' detected: %s' % detectedLangName print ' reliable: %s' % (isReliable != 0) print ' textBytes: %s' % textBytesFound print ' details: %s' % str(details) self.langsSeen.add(expectedLangName) for tup in details: self.detLangsSeen.add(tup[0]) print ' %d langs; %d ever detected' % (len(self.langsSeen), len(self.detLangsSeen)) if False: if expectedLangName == 'YIDDISH': l = list(self.detLangsSeen) l.sort() for i, name in enumerate(l): print ' PyTuple_SET_ITEM(pyDetLangs, %d, PyString_FromString("%s"));' % (i, name) self.assertEquals(expectedLangName, detectedLangName, '%s != %s; details: %s' % (detectedLangName, expectedLangName, str(details))) self.assertTrue(not shouldBeReliable or isReliable) def testAFRIKAANS(self): self.runOne('AFRIKAANS', kTeststr_af_Latn) # def testAFAR(self): # self.runOne('AFAR', kTeststr_aa_Latn) # def testABKHAZIAN(self): # self.runOne('ABKHAZIAN', kTeststr_ab_Cyrl) def testAMHARIC(self): self.runOne('AMHARIC', kTeststr_am_Ethi) def testARABIC(self): self.runOne('ARABIC', kTeststr_ar_Arab) # def testASSAMESE(self): # self.runOne('ASSAMESE', kTeststr_as_Beng) # def testAYMARA(self): # self.runOne('AYMARA', kTeststr_ay_Latn) # AZERBAIJANI Arab & Cyrl removed 2008.05.27. Just AZERBAIJANI Latn left # def testAZERBAIJANI(self): # self.runOne('AZERBAIJANI', kTeststr_az_Arab) # Missing data: az-Cyrl def testAZERBAIJANI2(self): self.runOne('AZERBAIJANI', kTeststr_az_Latn) # def testBASHKIR(self): # self.runOne('BASHKIR', kTeststr_ba_Cyrl) def testBELARUSIAN(self): self.runOne('BELARUSIAN', kTeststr_be_Cyrl) def testBULGARIAN(self): self.runOne('BULGARIAN', kTeststr_bg_Cyrl) # def testBIHARI(self): # self.runOne('BIHARI', kTeststr_bh_Deva) # def testBISLAMA(self): # self.runOne('BISLAMA', kTeststr_bi_Latn) def testBENGALI(self): self.runOne('BENGALI', kTeststr_bn_Beng) def testTIBETAN(self): self.runOne('TIBETAN', kTeststr_bo_Tibt) # def testBRETON(self): # self.runOne('BRETON', kTeststr_br_Latn) def testSERBIAN(self): self.runOne('SERBIAN', kTeststr_bs_Cyrl) # NOTE: Not BOSNIAN def testCROATIAN(self): self.runOne('CROATIAN', kTeststr_bs_Latn) # NOTE: Not BOSNIAN def testCATALAN(self): self.runOne('CATALAN', kTeststr_ca_Latn) def testCHEROKEE(self): self.runOne('CHEROKEE', kTeststr_chr_Cher) # def testCORSICAN(self): # self.runOne('CORSICAN', kTeststr_co_Latn) # No CREOLES_AND_PIDGINS_ENGLISH_BASED # No CREOLES_AND_PIDGINS_FRENCH_BASED # No CREOLES_AND_PIDGINS_OTHER # No CREOLES_AND_PIDGINS_PORTUGUESE_BASED def testCZECH(self): self.runOne('CZECH', kTeststr_cs_Latn) def testWELSH(self): self.runOne('WELSH', kTeststr_cy_Latn) def testDANISH(self): self.runOne('DANISH', kTeststr_da_Latn) def testGERMAN(self): self.runOne('GERMAN', kTeststr_de_Latn) def testDHIVEHI(self): self.runOne('DHIVEHI', kTeststr_dv_Thaa) # def testDZONGKHA(self): # self.runOne('DZONGKHA', kTeststr_dz_Tibt) def testGREEK(self): self.runOne('GREEK', kTeststr_el_Grek) def testENGLISH(self): self.runOne('ENGLISH', kTeststr_en_Latn) def testENGLISH2(self): self.runOne('ENGLISH', kTeststr_en) # def testESPERANTO(self): # self.runOne('ESPERANTO', kTeststr_eo_Latn) def testSPANISH(self): self.runOne('SPANISH', kTeststr_es_Latn) def testESTONIAN(self): self.runOne('ESTONIAN', kTeststr_et_Latn) def testBASQUE(self): self.runOne('BASQUE', kTeststr_eu_Latn) def testPERSIAN(self): self.runOne('PERSIAN', kTeststr_fa_Arab) def testFINNISH(self): self.runOne('FINNISH', kTeststr_fi_Latn) # def testFIJIAN(self): # self.runOne('FIJIAN', kTeststr_fj_Latn) # def testFAROESE(self): # self.runOne('FAROESE', kTeststr_fo_Latn) def testFRENCH(self): self.runOne('FRENCH', kTeststr_fr_Latn) # def testFRISIAN(self): # self.runOne('FRISIAN', kTeststr_fy_Latn) def testIRISH(self): self.runOne('IRISH', kTeststr_ga_Latn) # def testSCOTS_GAELIC(self): # self.runOne('SCOTS_GAELIC', kTeststr_gd_Latn) # def testGALICIAN(self): # self.runOne('GALICIAN', kTeststr_gl_Latn) def testGALICIAN2(self): self.runOne('GALICIAN', kTeststr_gl_Latn2) # def testGUARANI(self): # self.runOne('GUARANI', kTeststr_gn_Latn) def testGUJARATI(self): self.runOne('GUJARATI', kTeststr_gu_Gujr) # def testMANX(self): # self.runOne('MANX', kTeststr_gv_Latn) # def testHAUSA(self): # self.runOne('HAUSA', kTeststr_ha_Latn) def testHINDI(self): self.runOne('HINDI', kTeststr_hi_Deva) def testHINDI2(self): self.runOne('HINDI', kTeststr_ks) def testCROATIAN2(self): self.runOne('CROATIAN', kTeststr_hr_Latn, shouldBeReliable=False) # NOTE: now CROATIAN def testHAITIAN_CREOLE(self): self.runOne('HAITIAN_CREOLE', kTeststr_ht_Latn) def testHUNGARIAN(self): self.runOne('HUNGARIAN', kTeststr_hu_Latn) def testARMENIAN(self): self.runOne('ARMENIAN', kTeststr_hy_Armn) # def testINTERLINGUA(self): # self.runOne('INTERLINGUA', kTeststr_ia_Latn) def testMALAY(self): self.runOne('MALAY', kTeststr_id_Latn) # def testINTERLINGUE(self): # self.runOne('INTERLINGUE', kTeststr_ie_Latn) # def testINUPIAK(self): # self.runOne('INUPIAK', kTeststr_ik_Latn) def testICELANDIC(self): self.runOne('ICELANDIC', kTeststr_is_Latn) def testITALIAN(self): self.runOne('ITALIAN', kTeststr_it_Latn) def testINUKTITUT(self): self.runOne('INUKTITUT', kTeststr_iu_Cans) def testHEBREW(self): self.runOne('HEBREW', kTeststr_iw_Hebr) def testJAPANESE(self): self.runOne('Japanese', kTeststr_ja_Hani) # def testJAVANESE(self): # self.runOne('JAVANESE', kTeststr_jw_Latn) def testGEORGIAN(self): self.runOne('GEORGIAN', kTeststr_ka_Geor) # def testKHASI(self): # self.runOne('KHASI', kTeststr_kha_Latn) # def testKAZAKH(self): # self.runOne('KAZAKH', kTeststr_kk_Arab) # def testKAZAKH2(self): # self.runOne('KAZAKH', kTeststr_kk_Cyrl) # def testKAZAKH3(self): # self.runOne('KAZAKH', kTeststr_kk_Latn) # def testGREENLANDIC(self): # self.runOne('GREENLANDIC', kTeststr_kl_Latn) def testKHMER(self): self.runOne('KHMER', kTeststr_km_Khmr) def testKANNADA(self): self.runOne('KANNADA', kTeststr_kn_Knda) def testKOREAN(self): self.runOne('Korean', kTeststr_ko_Hani) # def testKASHMIRI(self): # self.runOne('KASHMIRI', kTeststr_ks_Deva) # KURDISH Latn removed 2008.05.27. Just KURDISH Arab left # def testKURDISH(self): # self.runOne('KURDISH', kTeststr_ku_Arab) # def testKURDISH2(self): # self.runOne('KURDISH', kTeststr_ku_Latn) # def testKYRGYZ(self): # self.runOne('KYRGYZ', kTeststr_ky_Arab) # def testKYRGYZ2(self): # self.runOne('KYRGYZ', kTeststr_ky_Cyrl) # def testLATIN(self): # self.runOne('LATIN', kTeststr_la_Latn) # def testLUXEMBOURGISH(self): # self.runOne('LUXEMBOURGISH', kTeststr_lb_Latn) # def testGANDA(self): # self.runOne('GANDA', kTeststr_lg_Latn) # def testLINGALA(self): # self.runOne('LINGALA', kTeststr_ln_Latn) def testLAOTHIAN(self): self.runOne('LAOTHIAN', kTeststr_lo_Laoo) def testLITHUANIAN(self): self.runOne('LITHUANIAN', kTeststr_lt_Latn) def testLATVIAN(self): self.runOne('LATVIAN', kTeststr_lv_Latn) # def testMALAGASY(self): # self.runOne('MALAGASY', kTeststr_mg_Latn) # def testMAORI(self): # self.runOne('MAORI', kTeststr_mi_Latn) def testMACEDONIAN(self): self.runOne('MACEDONIAN', kTeststr_mk_Cyrl) def testMALAYALAM(self): self.runOne('MALAYALAM', kTeststr_ml_Mlym) # def testMONGOLIAN(self): # self.runOne('MONGOLIAN', kTeststr_mn_Cyrl) # def testMOLDAVIAN(self): # self.runOne('MOLDAVIAN', kTeststr_mo_Cyrl) # def testMARATHI(self): # self.runOne('MARATHI', kTeststr_mr_Deva) def testMALAY2(self): self.runOne('MALAY', kTeststr_ms_Latn) def testMALAY3(self): self.runOne('MALAY', kTeststr_ms_Latn2) def testMALAY4(self): self.runOne('MALAY', kTeststr_ms_Latn3) def testMALTESE(self): self.runOne('MALTESE', kTeststr_mt_Latn) # def testBURMESE(self): # self.runOne('BURMESE', kTeststr_my_Latn) def testBURMESE2(self): self.runOne('BURMESE', kTeststr_my_Mymr) # def testNAURU(self): # self.runOne('NAURU', kTeststr_na_Latn) # def testNEPALI(self): # self.runOne('NEPALI', kTeststr_ne_Deva) def testDUTCH(self): self.runOne('DUTCH', kTeststr_nl_Latn) #def testNORWEGIAN_N(self): # self.runOne('NORWEGIAN_N', kTeststr_nn_Latn) def testNORWEGIAN(self): self.runOne('NORWEGIAN', kTeststr_no_Latn) # def testOCCITAN(self): # self.runOne('OCCITAN', kTeststr_oc_Latn) # def testOROMO(self): # self.runOne('OROMO', kTeststr_om_Latn) def testORIYA(self): self.runOne('ORIYA', kTeststr_or_Orya) def testPUNJABI(self): self.runOne('PUNJABI', kTeststr_pa_Guru) def testPOLISH(self): self.runOne('POLISH', kTeststr_pl_Latn) # def testPASHTO(self): # self.runOne('PASHTO', kTeststr_ps_Arab) def testPORTUGUESE(self): self.runOne('PORTUGUESE', kTeststr_pt_BR) # NOTE: not PORTUGUESE_B # nor PORTUGUESE_P # def testQUECHUA(self): # self.runOne('QUECHUA', kTeststr_qu_Latn) # def testRHAETO_ROMANCE(self): # self.runOne('RHAETO_ROMANCE', kTeststr_rm_Latn) # def testRUNDI(self): # self.runOne('RUNDI', kTeststr_rn_Latn) def testROMANIAN(self): self.runOne('ROMANIAN', kTeststr_ro_Latn) def testRUSSIAN(self): self.runOne('RUSSIAN', kTeststr_ru_Cyrl) # def testKINYARWANDA(self): # self.runOne('KINYARWANDA', kTeststr_rw_Latn) # def testSANSKRIT(self): # self.runOne('SANSKRIT', kTeststr_sa_Deva) # def testSANSKRIT2(self): # self.runOne('SANSKRIT', kTeststr_sa_Latn) # def testSCOTS(self): # self.runOne('SCOTS', kTeststr_sco_Latn) # def testSINDHI(self): # self.runOne('SINDHI', kTeststr_sd_Arab) # def testSANGO(self): # self.runOne('SANGO', kTeststr_sg_Latn) # No SERBO_CROATIAN (sh) def testSINHALESE(self): self.runOne('SINHALESE', kTeststr_si_Sinh) # def testLIMBU(self): # self.runOne('LIMBU', kTeststr_sit_NP) def testSLOVAK(self): self.runOne('SLOVAK', kTeststr_sk_Latn) def testSLOVENIAN(self): self.runOne('SLOVENIAN', kTeststr_sl_Latn) # def testSAMOAN(self): # self.runOne('SAMOAN', kTeststr_sm_Latn) # def testSHONA(self): # self.runOne('SHONA', kTeststr_sn_Latn) # def testSOMALI(self): # self.runOne('SOMALI', kTeststr_so_Latn) def testALBANIAN(self): self.runOne('ALBANIAN', kTeststr_sq_Latn) def testSERBIAN2(self): self.runOne('SERBIAN', kTeststr_sr_Cyrl) # NOTE: now SERBIAN def testCROATIAN3(self): self.runOne('CROATIAN', kTeststr_sr_Latn) # NOTE: Not SERBIAN def testCROATIAN4(self): self.runOne('CROATIAN', kTeststr_sr_ME_Latn) # NOTE: not SERBIAN nor MONTENEGRIN # def testSISWANT(self): # self.runOne('SISWANT', kTeststr_ss_Latn) # def testSESOTHO(self): # self.runOne('SESOTHO', kTeststr_st_Latn) # def testSUNDANESE(self): # self.runOne('SUNDANESE', kTeststr_su_Latn) def testSWEDISH(self): self.runOne('SWEDISH', kTeststr_sv_Latn) def testSWAHILI(self): self.runOne('SWAHILI', kTeststr_sw_Latn) def testSYRIAC(self): self.runOne('SYRIAC', kTeststr_syr_Syrc) def testTAMIL(self): self.runOne('TAMIL', kTeststr_ta_Taml) def testTELUGU(self): self.runOne('TELUGU', kTeststr_te_Telu) # Tajik Arab removed 2008.05.27. Just Tajik Cyrl left # def testTAJIK(self): # self.runOne('TAJIK', kTeststr_tg_Arab) # def testTAJIK2(self): # self.runOne('TAJIK', kTeststr_tg_Cyrl) def testTHAI(self): self.runOne('THAI', kTeststr_th_Thai) # def testTIGRINYA(self): # self.runOne('TIGRINYA', kTeststr_ti_Ethi) # def testTURKMEN(self): # self.runOne('TURKMEN', kTeststr_tk_Cyrl) # def testTURKMEN2(self): # self.runOne('TURKMEN', kTeststr_tk_Latn) def testTAGALOG(self): self.runOne('TAGALOG', kTeststr_tl_Latn) # def testTSWANA(self): # self.runOne('TSWANA', kTeststr_tn_Latn) # def testTONGA(self): # self.runOne('TONGA', kTeststr_to_Latn) def testTURKISH(self): self.runOne('TURKISH', kTeststr_tr_Latn) # def testTSONGA(self): # self.runOne('TSONGA', kTeststr_ts_Latn) # def testTATAR(self): # self.runOne('TATAR', kTeststr_tt_Cyrl) # def testTATAR2(self): # self.runOne('TATAR', kTeststr_tt_Latn) # def testTWI(self): # self.runOne('TWI', kTeststr_tw_Latn) # def testUIGHUR(self): # self.runOne('UIGHUR', kTeststr_ug_Arab) # def testUIGHUR2(self): # self.runOne('UIGHUR', kTeststr_ug_Cyrl) # def testUIGHUR3(self): # self.runOne('UIGHUR', kTeststr_ug_Latn) def testUKRAINIAN(self): self.runOne('UKRAINIAN', kTeststr_uk_Cyrl) def testURDU(self): self.runOne('URDU', kTeststr_ur_Arab) # def testUZBEK(self): # self.runOne('UZBEK', kTeststr_uz_Arab) # def testUZBEK2(self): # self.runOne('UZBEK', kTeststr_uz_Cyrl) # def testUZBEK3(self): # self.runOne('UZBEK', kTeststr_uz_Latn) def testVIETNAMESE(self): self.runOne('VIETNAMESE', kTeststr_vi_Latn) # def testVOLAPUK(self): # self.runOne('VOLAPUK', kTeststr_vo_Latn) # def testWOLOF(self): # self.runOne('WOLOF', kTeststr_wo_Latn) # def testXHOSA(self): # self.runOne('XHOSA', kTeststr_xh_Latn) def testYIDDISH(self): self.runOne('YIDDISH', kTeststr_yi_Hebr) # def testYORUBA(self): # self.runOne('YORUBA', kTeststr_yo_Latn) # Zhuang Hani removed 2008.05.13. Just Zhuang Latn left # def testZHUANG(self): # self.runOne('ZHUANG', kTeststr_za_Hani) # def testZHUANG2(self): # self.runOne('ZHUANG', kTeststr_za_Latn) def testCHINESE(self): self.runOne('Chinese', kTeststr_zh_Hani) def testCHINESE_T(self): self.runOne('ChineseT', kTeststr_zh_TW) def testINDONESIAN(self): self.runOne('INDONESIAN', kTeststr_id) # def testZULU(self): # self.runOne('ZULU', kTeststr_zu_Latn) # No TG_UNKNOWN_LANGUAGE # No UNKNOWN_LANGUAGE if __name__ == '__main__': unittest.main() # Langs that claim to be covered (in compact_lang_det_generated_deltaoctachrome.cc) yet don't have test coverage or the test fails: # GALICIAN (commented out test fails: detects spanish) # ZHUANG (two commented out tests fail) # LIMBU (test fails)
26.853041
142
0.677549
1,917
15,897
5.411581
0.33542
0.134953
0.236167
0.008483
0.135338
0.106034
0
0
0
0
0
0.005248
0.196893
15,897
591
143
26.898477
0.807316
0.442159
0
0.009901
0
0
0.094133
0.006353
0
0
0
0
0.009901
0
null
null
0
0.019802
null
null
0.039604
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
89558147a91c60c70fe1f9cf0585fd04213f42b7
189
py
Python
Part 1/Chapter 8/exercise_8.4.py
kg55555/pypractice
1867f001b3d2a7174ea00d7b9e2fa22e9f1877ef
[ "MIT" ]
null
null
null
Part 1/Chapter 8/exercise_8.4.py
kg55555/pypractice
1867f001b3d2a7174ea00d7b9e2fa22e9f1877ef
[ "MIT" ]
null
null
null
Part 1/Chapter 8/exercise_8.4.py
kg55555/pypractice
1867f001b3d2a7174ea00d7b9e2fa22e9f1877ef
[ "MIT" ]
null
null
null
def make_shirt(size='Large', message='I love Python'): print(f"The size of the shirt is {size} and the message is {message}") make_shirt() make_shirt('m') make_shirt('xs', "I'm okay")
27
74
0.687831
34
189
3.705882
0.529412
0.285714
0
0
0
0
0
0
0
0
0
0
0.142857
189
6
75
31.5
0.777778
0
0
0
0
0
0.470899
0
0
0
0
0
0
1
0.2
false
0
0
0
0.2
0.2
0
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
2
89630010eb6252857090251e31ea40c8f72228e9
899
py
Python
info.py
moreati/ava-python
4baa4c21dec7d31d0b6e3fcbe44ff5587cb85706
[ "MIT" ]
null
null
null
info.py
moreati/ava-python
4baa4c21dec7d31d0b6e3fcbe44ff5587cb85706
[ "MIT" ]
null
null
null
info.py
moreati/ava-python
4baa4c21dec7d31d0b6e3fcbe44ff5587cb85706
[ "MIT" ]
null
null
null
# ava-python : A Python implementation of the AVA API # Author: https://github.com/zefonseca/ # License MIT import avapython import jsrpc caller = avapython.get_caller() def getBlockchainID(alias): data = { "alias": alias } ret = caller("info.getBlockchainID", data) return ret["blockchainID"] def getNetworkID(): data = {} ret = caller("info.getNetworkID", data) return ret["networkID"] def getNetworkName(): data = {} ret = caller("info.getNetworkName", data) return ret["networkName"] def getNodeID(): data = {} ret = caller("info.getNodeID", data) return ret["nodeID"] def getNodeVersion(): data = {} ret = caller("info.getNodeVersion", data) return ret["version"] def peers(): data = {} ret = caller("info.peers", data) return ret["peers"]
15.77193
53
0.591769
93
899
5.709677
0.387097
0.101695
0.146893
0.160075
0
0
0
0
0
0
0
0
0.273637
899
57
54
15.77193
0.81317
0.112347
0
0.172414
0
0
0.193711
0
0
0
0
0
0
1
0.206897
false
0
0.068966
0
0.482759
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
8968db4d72d7df7ff978b17022044e4e9637234c
852
py
Python
SocialAPI/TwitterAPI/ApoyoTwitter.py
garnachod/ConcursoPolicia
f123595afc697ddfa862114a228d7351e2f8fd73
[ "Apache-2.0" ]
null
null
null
SocialAPI/TwitterAPI/ApoyoTwitter.py
garnachod/ConcursoPolicia
f123595afc697ddfa862114a228d7351e2f8fd73
[ "Apache-2.0" ]
null
null
null
SocialAPI/TwitterAPI/ApoyoTwitter.py
garnachod/ConcursoPolicia
f123595afc697ddfa862114a228d7351e2f8fd73
[ "Apache-2.0" ]
null
null
null
from DBbridge.ConsultasGeneral import ConsultasGeneral class ApoyoTwitter(object): """docstring for ApoyoTwitter""" def __init__(self): super(ApoyoTwitter, self).__init__() self.consultas = ConsultasGeneral() def getLastTweetCollected(self, screen_name=None, identificador=-1): if screen_name is not None: return self.consultas.getLastTweetCollectedScreenName(screen_name) else: return self.consultas.getLastTweetCollectedIdentificador(identificador) def setLastUserTweet(self, maximo, screen_name=None, identificador=-1): if screen_name is not None: return self.consultas.setLastTweetCollectedScreenName(screen_name, maximo) else: return self.consultas.setLastTweetCollectedIdentificador(identificador, maximo) def getUserIDByScreenName(self, screen_name): return self.consultas.getUserIDByScreenName(screen_name)
37.043478
82
0.81338
87
852
7.781609
0.367816
0.118168
0.140325
0.079764
0.200886
0.200886
0.200886
0.200886
0.200886
0.200886
0
0.002621
0.10446
852
23
83
37.043478
0.884666
0.030516
0
0.235294
0
0
0
0
0
0
0
0
0
1
0.235294
false
0
0.058824
0.058824
0.647059
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
897a66bd0f2d2688c0516b2f61538aa27928070a
695
py
Python
novmpy.py
j0hnBlk/NoVmpy
2e5fe99ba3f35e973fc4c971f5da39714115248e
[ "BSD-3-Clause" ]
187
2022-02-02T05:07:12.000Z
2022-03-31T07:49:29.000Z
novmpy.py
j0hnBlk/NoVmpy
2e5fe99ba3f35e973fc4c971f5da39714115248e
[ "BSD-3-Clause" ]
1
2022-02-06T05:06:11.000Z
2022-02-07T20:24:55.000Z
novmpy.py
j0hnBlk/NoVmpy
2e5fe99ba3f35e973fc4c971f5da39714115248e
[ "BSD-3-Clause" ]
32
2022-02-02T08:45:27.000Z
2022-03-29T05:41:40.000Z
# idapython fix <= 7.6 # DO NOT REMOVE ME import sys sys.stdout.encoding = 'utf-8' # for test # ida_loader.load_plugin('F:/NoVmpy/novmpy.py') import idaapi NOVMPY_VERSION = "0.1" class NoVmpyPlugin(idaapi.plugin_t): flags = 0 comment = "" help = "" wanted_name = "NoVmpy" wanted_hotkey = "" def __init__(self): super(NoVmpyPlugin, self).__init__() def init(self): from novmpy.ui import UIManager self.ui = UIManager() return idaapi.PLUGIN_KEEP def run(self, args): pass def term(self): from novmpy.handler import vm_handlers vm_handlers.clear() def PLUGIN_ENTRY(): return NoVmpyPlugin()
17.375
47
0.630216
89
695
4.719101
0.606742
0.057143
0.052381
0
0
0
0
0
0
0
0
0.01165
0.258993
695
39
48
17.820513
0.803884
0.132374
0
0
0
0
0.023411
0
0
0
0
0
0
1
0.217391
false
0.043478
0.173913
0.043478
0.73913
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
897db96a565dde216ca64632c5bb30d28194b8d1
162
py
Python
src/atcoder/abc012/b/sol_1.py
kagemeka/competitive-programming
c70fe481bcd518f507b885fc9234691d8ce63171
[ "MIT" ]
1
2021-07-11T03:20:10.000Z
2021-07-11T03:20:10.000Z
src/atcoder/abc012/b/sol_1.py
kagemeka/competitive-programming
c70fe481bcd518f507b885fc9234691d8ce63171
[ "MIT" ]
39
2021-07-10T05:21:09.000Z
2021-12-15T06:10:12.000Z
src/atcoder/abc012/b/sol_1.py
kagemeka/competitive-programming
c70fe481bcd518f507b885fc9234691d8ce63171
[ "MIT" ]
null
null
null
import typing def main() -> typing.NoReturn: n = int(input()) h, n = divmod(n, 60 ** 2) m, s = divmod(n, 60) print(f'{h:02}:{m:02}:{s:02}') main()
13.5
32
0.518519
29
162
2.896552
0.586207
0.166667
0.214286
0
0
0
0
0
0
0
0
0.08871
0.234568
162
12
33
13.5
0.58871
0
0
0
0
0
0.122699
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.285714
0.142857
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
0
0
0
0
0
2
89875b1dada22d7fa6e362f88cc1ef770f75f4db
3,154
py
Python
test.py
niroo96/Toy-Robot-Challenge
72f70643a085c5c430a5ddd16ed897c4a8c37cb9
[ "MIT" ]
null
null
null
test.py
niroo96/Toy-Robot-Challenge
72f70643a085c5c430a5ddd16ed897c4a8c37cb9
[ "MIT" ]
1
2019-06-28T03:44:03.000Z
2019-09-19T14:40:57.000Z
test.py
niroo96/Toy-Robot-Challenge
72f70643a085c5c430a5ddd16ed897c4a8c37cb9
[ "MIT" ]
null
null
null
# Code by Niroo Arjuna from unittest import TestCase from classes.robot import Robot class Test(TestCase): #Test to ensure that toy robot is placed within the board boundaries def test_placetest(self): robot = Robot() robot.place(2, 2, "EAST") self.assertEqual(robot.report(), "(2, 2, EAST)") # more than board bounds robot.place(1, 6, "NORTH") self.assertNotEqual(robot.report(), "(1, 6, NORTH)") robot.place(0, 0, "NORTH") self.assertEqual(robot.report(), "(0, 0, NORTH)") #Enusre that the toy robot doesn't not move out of bounds def test_movetest(self): robot = Robot() robot.place(1, 2, "WEST") robot.move() self.assertEqual(robot.report(), "(0, 2, WEST)") # shouldn't go more in west direction robot.move() self.assertEqual(robot.report(), "(0, 2, WEST)") #Ensure that the toy robot turns right def test_righttest(self): robot = Robot() robot.place(0, 3, "EAST") # turn around full circle robot.right() self.assertEqual(robot.report(), "(0, 3, SOUTH)") robot.right() self.assertEqual(robot.report(), "(0, 3, WEST)") robot.right() self.assertEqual(robot.report(), "(0, 3, NORTH)") robot.right() self.assertEqual(robot.report(), "(0, 3, EAST)") #Esnures that the toy robot turns left def test_lefttest(self): robot = Robot() robot.place(4, 4, "EAST") # turn around full circle robot.left() self.assertEqual(robot.report(), "(4, 4, NORTH)") robot.left() self.assertEqual(robot.report(), "(4, 4, WEST)") robot.left() self.assertEqual(robot.report(), "(4, 4, SOUTH)") robot.left() self.assertEqual(robot.report(), "(4, 4, EAST)") #Testing example case 1 def test_example1(self): robot = Robot() robot.place(0, 0, "NORTH") self.assertEqual(robot.report(), "(0, 0, NORTH)") robot.move() self.assertEqual(robot.report(), "(0, 1, NORTH)") robot.report() self.assertEqual(robot.report(), "(0, 1, NORTH)") #Testing example case 2 def test_example2(self): robot = Robot() robot.place(0, 0, "NORTH") self.assertEqual(robot.report(), "(0, 0, NORTH)") robot.left() self.assertEqual(robot.report(), "(0, 0, WEST)") robot.report() self.assertEqual(robot.report(), "(0, 0, WEST)") #Testing example case 3 def test_example3(self): robot = Robot() robot.place(1, 2, "EAST") self.assertEqual(robot.report(), "(1, 2, EAST)") robot.move() self.assertEqual(robot.report(), "(2, 2, EAST)") robot.move() self.assertEqual(robot.report(), "(3, 2, EAST)") robot.left() self.assertEqual(robot.report(), "(3, 2, NORTH)") robot.move() self.assertEqual(robot.report(), "(3, 3, NORTH)") robot.report() self.assertEqual(robot.report(), "(3, 3, NORTH)") # Code by Niroo Arjuna
25.642276
72
0.560875
389
3,154
4.529563
0.179949
0.174801
0.272418
0.354143
0.6958
0.645857
0.562997
0.368899
0.153235
0.106697
0
0.032527
0.278694
3,154
123
73
25.642276
0.741978
0.130311
0
0.6
0
0
0.129304
0
0
0
0
0
0.357143
1
0.1
false
0
0.028571
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
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
899a7d3796a351a1e7c371824cfd61394bcdb96a
2,936
py
Python
credentials_Test.py
Kiptoo462/Password-Locker
f579e6d2025d74618d9049549f63a8983c0cdf68
[ "MIT" ]
null
null
null
credentials_Test.py
Kiptoo462/Password-Locker
f579e6d2025d74618d9049549f63a8983c0cdf68
[ "MIT" ]
null
null
null
credentials_Test.py
Kiptoo462/Password-Locker
f579e6d2025d74618d9049549f63a8983c0cdf68
[ "MIT" ]
null
null
null
import unittest from credentials import Credentials import pyperclip class TestCredentials(unittest.TestCase): def setUp(self): ''' setup before a test is run ''' self.new_cred = Credentials("GitHub", "kiptoovictor462.com", "Dskl321") def tearDown(self): ''' clear list before any test is run ''' Credentials.cred_list = [] #check initialization def test_init(self): ''' check if instances initialize as expected ''' self.assertEqual(self.new_cred.account, "GitHub") self.assertEqual(self.new_cred.email, "kiptoovictor462.com") self.assertEqual(self.new_cred.passlock, "Dskl321") #7th test def test_save_credentials(self): ''' check if credentials can be saved ''' self.new_cred.save_cred() self.assertEqual(len(Credentials.cred_list),1) #8th test_saving multiple credentials def test_saving_multiple_creds(self): ''' check if users can store multiple credentials ''' self.new_cred.save_cred() test_cred = Credentials("Twitter", "testuser","password") test_cred.save_cred() self.assertEqual(len(Credentials.cred_list),2) #9th test_deleting credentials def test_delete_credentials(self): ''' test if you can delete credentials test ''' self.new_cred.save_cred() test_cred = Credentials("Twitter", "testuser","password") test_cred.save_cred() self.new_cred.delete_cred() self.assertEqual(len(Credentials.cred_list), 1) #10th test_search for credentials def test_search_for_cred(self): ''' test if credentials can be searched for ''' self.new_cred.save_cred() test_cred = Credentials("Twitter", "testuser","password") test_cred.save_cred() find_cred= Credentials.find_account("Twitter") self.assertEqual(find_cred.account, test_cred.account) #11th test_confirm accounts credentials def test_confirm_cred_exists(self): ''' confirm that credentials actually exists ''' self.new_cred.save_cred() test_cred = Credentials("Twitter", "testuser","password") test_cred.save_cred() cred_exists = Credentials.cred_exists("Twitter") self.assertTrue(cred_exists) #test 12th_Display credentials def test_display_credentials(self): ''' test if all credentials can be displayed ''' self.assertEqual(Credentials.display_cred(), Credentials.cred_list) #copy password test 13th def test_copy_password(self): ''' test whether generated password can be copied ''' self.new_cred.save_cred() Credentials.copy_passlock("Dskl321") self.assertEqual(self.new_cred.passlock, pyperclip.paste())
27.961905
79
0.637943
329
2,936
5.486322
0.246201
0.046537
0.07313
0.049862
0.325208
0.281994
0.244321
0.244321
0.220499
0.175069
0
0.013395
0.262602
2,936
105
80
27.961905
0.820323
0.206403
0
0.363636
0
0
0.084568
0
0
0
0
0
0.227273
1
0.227273
false
0.181818
0.068182
0
0.318182
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
9823ef7d2309b9db4ccd8d9941d172f80eac4048
10,664
py
Python
tools/evaluate.py
hanswenzel/opticks
b75b5929b6cf36a5eedeffb3031af2920f75f9f0
[ "Apache-2.0" ]
11
2020-07-05T02:39:32.000Z
2022-03-20T18:52:44.000Z
tools/evaluate.py
hanswenzel/opticks
b75b5929b6cf36a5eedeffb3031af2920f75f9f0
[ "Apache-2.0" ]
null
null
null
tools/evaluate.py
hanswenzel/opticks
b75b5929b6cf36a5eedeffb3031af2920f75f9f0
[ "Apache-2.0" ]
4
2020-09-03T20:36:32.000Z
2022-01-19T07:42:21.000Z
#!/usr/bin/python # # Copyright (c) 2019 Opticks Team. All Rights Reserved. # # This file is part of Opticks # (see https://bitbucket.org/simoncblyth/opticks). # # 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. # """ NB lldb.frame and frame are not the same INTERACTIVE:: >>> from opticks.tools.evaluate import EV ; self = EV(lldb.frame.FindVariable("this")) WITHIN BREAKPOINT FUNC:: self = EV(frame.FindVariable("this")) :: (lldb) fr v (CRandomEngine *) this = 0x0000000110025c70 (lldb) script Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D. >>> from opticks.tools.evaluate import EV ; self = EV(lldb.frame.FindVariable("this")) >>> self.v.keys ['CLHEP::HepRandomEngine', 'm_g4', 'm_ctx', 'm_ok', 'm_mask', 'm_masked', 'm_path', 'm_alignlevel', 'm_seed', 'm_internal', 'm_skipdupe', 'm_locseq', 'm_curand', 'm_curand_index', 'm_curand_ni', 'm_curand_nv', 'm_current_record_flat_count', 'm_current_step_flat_count', 'm_offset', 'm_offset_count', 'm_flat', 'm_location', 'm_sequence', 'm_cursor', 'm_cursor_old'] >>> self.v(".m_ctx._step_id") (int) _step_id = 0 >>> self.ev(".m_ctx._step_id") 0 >>> self.ev(".m_ctx") OrderedDict([('_ok', 'ptr'), ('_pindex', 0), ('_print', True), ('_dbgrec', False), ('_dbgseq', False), ('_dbgzero', False), ('_photons_per_g4event', 10000), ('_steps_per_photon', 10), ('_gen', 4096), ('_record_max', 1), ('_bounce_max', 9), ('_ok_event_init', True), ('_event', 'ptr'), ('_event_id', 0), ('_event_total', 1), ('_event_track_count', 1), ('_track', 'ptr'), ('_process_manager', 'ptr'), ('_track_id', 0), ('_track_total', 1), ('_track_step_count', 1), ('_parent_id', -1), ('_optical', True), ('_pdg_encoding', 0), ('_primary_id', -2), ('_photon_id', 0), ('_reemtrack', False), ('_record_id', 0), ('_record_fraction', 0.0), ('_rejoin_count', 0), ('_primarystep_count', 1), ('_stage', OrderedDict()), ('_debug', False), ('_other', False), ('_dump', False), ('_dump_count', 0), ('_step', 'ptr'), ('_noZeroSteps', 0), ('_step_id', 0), ('_step_total', 1), ('_step_origin', OrderedDict([('dx', 11.291412353515625), ('dy', -34.645111083984375), ('dz', -449.8999938964844)]))]) >>> self.v(".m_ctx") (CG4Ctx &) m_ctx = 0x0000000110025af0: { _ok = 0x000000010c735c40 _pindex = 0 _print = true _dbgrec = false _dbgseq = false _dbgzero = false _photons_per_g4event = 10000 _steps_per_photon = 10 _gen = 4096 _record_max = 1 """ from collections import OrderedDict from opticks.tools.lldb_ import lldb def rsplit(r): return map(lambda _:_.lstrip().rstrip(),r.split("\n")) class EV(object): def __init__(self, v=None): self.e = Evaluate() self.v = v def _set_v(self, v): if type(v) is Value or type(v) is None: self._v = v else: self._v = Value(v) pass def _get_v(self): return self._v v = property(_get_v, _set_v) def v_(self, k): if self.v is None: return None return self.v(k) def ev(self, k): if self.v is None: return None return self.e(self.v(k)) class Value(object): """ >>> from opticks.tools.evaluate import Value, Evaluate ; e = Evaluate() ; v = Value(lldb.frame.FindVariable("this")) >>> v (CRandomEngine *) this = 0x000000010f7e2470 >>> v.keys ['CLHEP::HepRandomEngine', 'm_g4', 'm_ctx', 'm_ok', 'm_mask', 'm_masked', 'm_path', 'm_alignlevel', 'm_seed', 'm_internal', 'm_skipdupe', 'm_locseq', 'm_curand', 'm_curand_index', 'm_curand_ni', 'm_curand_nv', 'm_current_record_flat_count', 'm_current_step_flat_count', 'm_flat', 'm_location', 'm_sequence', 'm_cursor'] >>> v("m_location") (std::__1::string) m_location = "OpBoundary;" >>> e(v("m_location")) 'OpBoundary;' >>> ef = e.evaluate_frame(lldb.frame) """ def __init__(self, v): self.v = v def _get_keys(self): nc = self.v.GetNumChildren() return [self.v.GetChildAtIndex(i).GetName() for i in range(nc)] keys = property(_get_keys) def __call__(self, k ): if k[0] == ".": vv = self.v.GetValueForExpressionPath(k) else: vv = self.v.GetChildMemberWithName(k) pass return Value(vv) def __repr__(self): return str(self.v) def __str__(self): return "\n".join( map(repr,map(self, self.keys) )) class Evaluate(object): """ NB : holds no "domain" state """ SKIPS = rsplit(r""" char ** """) NOT_CANONICAL = rsplit(r""" std::__1::string """) # canonical type for std::string is giant basic_string monstrosity, so dont use it for classify E_ATOM = "ATOM" E_SKIP = "SKIP" E_PTR = "PTR" E_COMP = "COMP" E_ENUM = "ENUM" @classmethod def classify(cls, v): tn = v.GetTypeName() t = v.GetType() pt = t.IsPointerType() lem = len(t.enum_members) if tn in cls.ATOMS: et = cls.E_ATOM elif tn in cls.SKIPS: et = cls.E_SKIP elif lem > 0: et = cls.E_ENUM elif pt: et = cls.E_PTR else: et = cls.E_COMP pass return et def __init__(self, error=None, opt=""): if error is None: error = lldb.SBError() pass self.error = error self.opt = opt def __call__(self, v ): if type(v) is Value: vv = v.v else: vv = v pass return self.evaluate(vv) def evaluate_frame(self, f): ef = OrderedDict() vls = f.get_all_variables() for v in vls: k = v.GetName() e = self.evaluate(v) ef[k] = e if "f" in self.opt: te = type(e) print "(f) %(k)10s : %(e)15s : %(te)15s " % locals() pass pass return ef def evaluate(self, v): et = self.classify(v) k = v.GetName() nc = v.GetNumChildren() tn = v.GetTypeName() if "e" in self.opt: print "(e) %(k)10s : %(tn)15s : %(nc)4d : %(et)s " % locals() pass if et == self.E_ATOM: e = self.evaluate_atom(v) elif et == self.E_ENUM: e = v.GetValue() elif et == self.E_SKIP: e = "skp" elif et == self.E_PTR: e = "ptr" elif et == self.E_COMP: e = self.evaluate_comp(v) else: assert 0 pass return e def evaluate_comp(self, o): eo = OrderedDict() nc = o.GetNumChildren() for i in range(nc): v = o.GetChildAtIndex(i) k = v.GetName() eo[k] = self.evaluate(v) if "c" in self.opt: te = type(e) print "(c) %(k)10s : %(e)15s : %(te)15s " % locals() pass pass return eo ATOMS = rsplit(r""" bool char int long long long unsigned char unsigned int unsigned long unsigned long long float double std::__1::string const char * """) def atom_typename(self, v): t = v.GetType() vtn = v.GetTypeName() if vtn in self.NOT_CANONICAL: tn = vtn else: ct = t.GetCanonicalType() ctn = ct.GetName() tn = ctn pass return tn def evaluate_atom(self, v): """ :param v: SBValue :return: python equivalent or "?" if unhandled """ nc = v.GetNumChildren() k = v.GetName() tn = self.atom_typename(v) sz = v.GetByteSize() d = v.GetData() error = self.error if tn == "unsigned int": assert sz == 4 e = v.GetValueAsUnsigned() elif tn == "int": assert sz == 4 e = v.GetValueAsSigned() elif tn == "long" or tn == "long long": assert sz == 8 e = d.GetSignedInt64(error, 0) elif tn == "unsigned long" or tn == "unsigned long long": assert sz == 8 e = d.GetUnsignedInt64(error, 0) elif tn == "float": assert sz == 4 offset = 0 e = d.GetFloat(error, offset) elif tn == "double": assert sz == 8 offset = 0 e = d.GetDouble(error, offset) elif tn == "bool": assert sz == 1 offset = 0 e = d.GetUnsignedInt8(error, offset) assert e == 0 or e == 1 e = e == 1 elif tn == "unsigned char": assert sz == 1 offset = 0 e = d.GetUnsignedInt8(error, offset) elif tn == "char": assert sz == 1 offset = 0 e = d.GetSignedInt8(error, offset) elif tn == "std::__1::string": s = v.GetSummary() e = s[1:-1] # unquote #offset = 1 #e = d.GetString(error, offset) # offset 1 avoids "\x16hello" # hmm kinda dodgy, the string is actually composite with one child # sometimes gives blanks # #e = v.GetFrame().EvaluateExpression("%s.c_str()" % k) elif tn == "const char *": tt = v.GetType().GetPointeeType() assert tt.GetName() == "const char" sz = tt.GetByteSize() assert sz == 1 ptr = v.GetValueAsUnsigned() e = v.GetFrame().GetThread().GetProcess().ReadCStringFromMemory(ptr,256, error) else: e = "?" pass te = str(type(e)) fmt = "(a) %(k)10s : %(tn)30s : %(nc)4d : %(sz)4d : %(e)15s : %(te)10s : %(v)40s " if "a" in self.opt: print fmt % locals() pass return e if __name__ == '__main__': pass
27.413882
985
0.526632
1,338
10,664
4.005232
0.248879
0.022392
0.005598
0.008397
0.23176
0.22131
0.216085
0.187722
0.18287
0.170927
0
0.034155
0.330083
10,664
388
986
27.484536
0.715985
0.093773
0
0.288288
0
0.009009
0.090643
0
0
0
0
0
0.058559
0
null
null
0.067568
0.009009
null
null
0.018018
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
982b0cf63f7f27e4c9190b484bcf78242863c88b
2,183
py
Python
project_euler/python/058.py
hacktoolkit/code_challenges
d71f8362496a72963a53abba7bcc9dd4d35a2920
[ "MIT" ]
10
2015-01-31T09:04:45.000Z
2022-01-08T04:09:48.000Z
project_euler/python/058.py
hacktoolkit/code_challenges
d71f8362496a72963a53abba7bcc9dd4d35a2920
[ "MIT" ]
3
2016-05-16T07:37:01.000Z
2016-05-18T14:14:16.000Z
project_euler/python/058.py
hacktoolkit/code_challenges
d71f8362496a72963a53abba7bcc9dd4d35a2920
[ "MIT" ]
6
2015-02-06T06:00:00.000Z
2020-02-13T16:13:48.000Z
"""http://projecteuler.net/problem=058 Spiral primes Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed. 37 36 35 34 33 32 31 38 17 16 15 14 13 30 39 18 5 4 3 12 29 40 19 6 1 2 11 28 41 20 7 8 9 10 27 42 21 22 23 24 25 26 43 44 45 46 47 48 49 It is interesting to note that the odd squares lie along the bottom right diagonal, but what is more interesting is that 8 out of the 13 numbers lying along both diagonals are prime; that is, a ratio of 8/13 ~= 62%. If one complete new layer is wrapped around the spiral above, a square spiral with side length 9 will be formed. If this process is continued, what is the side length of the square spiral for which the ratio of primes along both diagonals first falls below 10%? Solution by jontsai <hello@jontsai.com> """ from utils import * EXPECTED_ANSWER = 26241 # this problem is similar to 028 # # observe that for generating a number spiral square as demonstrated here: # dimension is always n x n, where n % 2 == 1 (n is always odd) # (n - 1) / 2 = distance from the center to any corner or midpoint on the edges target_ratio = 0.1 minimum_length = 7 n = 1 ratio = 1 diagonals = 0 diagonal_primes = 0 while n < minimum_length or ratio > target_ratio: #diagonals = 1 + ((n - 1) / 2) * 4 num_cells = n * n distance = n - 1 bottom_right = num_cells if distance > 0: diagonals += 4 bottom_left = bottom_right - distance top_left = bottom_left - distance top_right = top_left - distance # bottom right is always a square, so not a prime if primality(bottom_left): diagonal_primes += 1 else: pass if primality(top_left): diagonal_primes += 1 else: pass if primality(top_right): diagonal_primes += 1 else: pass else: diagonals += 1 ratio = float(diagonal_primes) / diagonals #print n, ratio if n >= minimum_length and ratio <= target_ratio: break else: n += 2 answer = n print 'Expected: %s, Answer: %s' % (EXPECTED_ANSWER, answer)
29.106667
261
0.656436
354
2,183
3.977401
0.460452
0.049716
0.03196
0.040483
0.112926
0.096591
0.058239
0.058239
0.058239
0
0
0.08679
0.28218
2,183
74
262
29.5
0.811742
0.154833
0
0.289474
0
0
0.024096
0
0
0
0
0
0
0
null
null
0.078947
0.026316
null
null
0.026316
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
982e4a17009631d8d51b21908e481ffbd98d354f
426
py
Python
by-session/class-921/week5/quiz_in.py
amiraliakbari/sharif-mabani-python
5d14a08d165267fe71c28389ddbafe29af7078c5
[ "MIT" ]
2
2015-04-29T20:59:35.000Z
2018-09-26T13:33:43.000Z
by-session/class-921/week5/quiz_in.py
amiraliakbari/sharif-mabani-python
5d14a08d165267fe71c28389ddbafe29af7078c5
[ "MIT" ]
null
null
null
by-session/class-921/week5/quiz_in.py
amiraliakbari/sharif-mabani-python
5d14a08d165267fe71c28389ddbafe29af7078c5
[ "MIT" ]
null
null
null
def abc(s1, s2): return s1 in s2 def abc2(s1, s2): for i in range(0, len(s2)): if s2[i:i+len(s1)] == s1: return True else: return False def abc3(s1, s2): for i in range(0, len(s2)): for j in range(0, len(s1)): if s2[i + j] != s1[j]: break else: return True else: return False print abc2("ello1", "Hello World!")
20.285714
35
0.469484
67
426
2.985075
0.343284
0.06
0.12
0.165
0.46
0.21
0.21
0.21
0.21
0
0
0.089147
0.394366
426
21
36
20.285714
0.686047
0
0
0.5
0
0
0.039813
0
0
0
0
0
0
0
null
null
0
0
null
null
0.055556
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
9838e9fd8e5b5cf9c106e0c73957b0c76c732c47
988
py
Python
components/mlserve/mlpm/solver.py
autoai-org/AIFlow
2368f0e1f8df78cce568266e3c88e493eff1ac89
[ "Apache-2.0" ]
82
2018-09-09T10:07:22.000Z
2019-09-22T17:02:45.000Z
components/mlserve/mlpm/solver.py
autoai-org/AIFlow
2368f0e1f8df78cce568266e3c88e493eff1ac89
[ "Apache-2.0" ]
531
2018-09-24T13:04:41.000Z
2019-09-20T09:56:00.000Z
components/mlserve/mlpm/solver.py
autoai-org/CVPM
2368f0e1f8df78cce568266e3c88e493eff1ac89
[ "MIT" ]
16
2018-09-30T17:08:46.000Z
2019-07-11T02:38:55.000Z
# Copyright (c) 2021 Xiaozhe Yao # # coding:utf-8 from mlpm.server import aidserver, run_server class Solver(object): def __init__(self, pretrained_toml=None): self._isReady = False self.bundle = None self._hyperparameters = {} self._enable_train = False self.server = aidserver if hasattr(self.__class__, 'train') and callable( getattr(self.__class__, 'train')): self._enable_train = True @property def enable_train(self): return self._enable_train @property def is_ready(self): return self._isReady @property def hyperparamters(self): return self._hyperparameters def ready(self): self._isReady = True def start(self, port=None): print('Server will run on port: ' + str(port)) run_server(self, port) def infer(self, data): raise NotImplementedError def change(self): raise NotImplementedError
23.52381
57
0.62753
112
988
5.285714
0.455357
0.074324
0.076014
0
0
0
0
0
0
0
0
0.007052
0.282389
988
42
58
23.52381
0.827927
0.043522
0
0.172414
0
0
0.037155
0
0
0
0
0
0
1
0.275862
false
0
0.034483
0.103448
0.448276
0.034483
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
983a0806df5319032fe889841175488e57c5043b
1,466
py
Python
examples/align.py
JohnVillalovos/subaligner
41bd00b4661b4ba35bdd2915e89fc368dcc7663a
[ "MIT" ]
227
2020-01-05T18:47:15.000Z
2022-03-19T20:19:33.000Z
examples/align.py
JohnVillalovos/subaligner
41bd00b4661b4ba35bdd2915e89fc368dcc7663a
[ "MIT" ]
43
2019-12-16T09:15:38.000Z
2022-03-21T10:39:40.000Z
examples/align.py
JohnVillalovos/subaligner
41bd00b4661b4ba35bdd2915e89fc368dcc7663a
[ "MIT" ]
9
2020-11-16T03:33:11.000Z
2022-03-11T22:12:38.000Z
import os from subaligner.predictor import Predictor from subaligner.subtitle import Subtitle if __name__ == "__main__": examples_dir = os.path.dirname(os.path.abspath(__file__)) output_dir = os.path.join(examples_dir, "tmp") os.makedirs(output_dir, exist_ok=True) video_file_path = os.path.join(examples_dir, "..", "tests/subaligner/resource/test.mp4") srt_file_path = os.path.join(examples_dir, "..", "tests/subaligner/resource/test.srt") predictor = Predictor() subs, audio_file_path, voice_probabilities, frame_rate = predictor.predict_single_pass(video_file_path, srt_file_path) aligned_subtitle_path = os.path.join(output_dir, "test_aligned_1.srt") Subtitle.export_subtitle(srt_file_path, subs, aligned_subtitle_path) print("Aligned subtitle saved to: {}".format(aligned_subtitle_path)) log_loss = predictor.get_log_loss(voice_probabilities, subs) print("Alignment finished with overall loss: {}".format(log_loss)) subs_list, subs, voice_probabilities, frame_rate = predictor.predict_dual_pass(video_file_path, srt_file_path, stretch=False) aligned_subtitle_path = os.path.join(output_dir, "test_aligned_2.srt") Subtitle.export_subtitle(srt_file_path, subs_list, aligned_subtitle_path) print("Aligned subtitle saved to: {}".format(aligned_subtitle_path)) log_loss = predictor.get_log_loss(voice_probabilities, subs) print("Alignment finished with overall loss: {}".format(log_loss))
52.357143
129
0.772169
203
1,466
5.197044
0.275862
0.068246
0.108057
0.053081
0.749763
0.729858
0.648341
0.595261
0.519431
0.519431
0
0.002318
0.117326
1,466
27
130
54.296296
0.812983
0
0
0.272727
0
0
0.175307
0.046385
0
0
0
0
0
1
0
false
0.090909
0.136364
0
0.136364
0.181818
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
1
0
0
0
0
0
2
984d8879311ca7fe731cca0df15c540035927675
1,303
py
Python
app/schemas/submarine_exploration.py
shambarick/mogship-core
874c21db26d25ce1917e215d1cc085ca5e9f96cb
[ "MIT" ]
null
null
null
app/schemas/submarine_exploration.py
shambarick/mogship-core
874c21db26d25ce1917e215d1cc085ca5e9f96cb
[ "MIT" ]
null
null
null
app/schemas/submarine_exploration.py
shambarick/mogship-core
874c21db26d25ce1917e215d1cc085ca5e9f96cb
[ "MIT" ]
null
null
null
from typing import Dict, Optional from pydantic import BaseModel, Field from .exploration import ExplorationDistance, ExplorationUnlock class SurveillanceBreakpoint(BaseModel): mid: int high: int class RetrievalBreakpoint(BaseModel): norm: int optim: int class SubmarineSectorBreakpoints(BaseModel): surveillance: SurveillanceBreakpoint retrieval: RetrievalBreakpoint favor: int class SubmarineMap(BaseModel): id: int image: int name_en: str name_fr: str name_ja: str name_de: str class SubmarineSector(BaseModel): id: int rank: int map: SubmarineMap name_en: str name_fr: str name_ja: str name_de: str shortname_en: str shortname_fr: str shortname_ja: str shortname_de: str lettername_en: str lettername_fr: str lettername_ja: str lettername_de: str isExplorable: bool ceruleumTankReq: int stars: int expReward: int surveyRange: int surveyDistance: int coordX: int coordY: int coordZ: int unlockedBy: Optional[int] unlocks: Optional[ExplorationUnlock] = None breakpoints: Optional[SubmarineSectorBreakpoints] toDestination: Optional[Dict[str, ExplorationDistance]] = Field(example={ "1": { "distance": 25000, "range": 13 } })
21.016129
120
0.703761
142
1,303
6.34507
0.408451
0.046615
0.031077
0.028857
0.079911
0.079911
0.079911
0.079911
0.079911
0.079911
0
0.007944
0.227168
1,303
61
121
21.360656
0.886792
0
0
0.204082
0
0
0.010744
0
0
0
0
0
0
1
0
true
0
0.061224
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
2
9876ce70165ca91ba3ef9a7376af6b4baadb5147
450
py
Python
migrations/174-remove-tags-from-documents.py
storagebot/kitsune
613ba2ca09104f330ab77088b452391169096249
[ "BSD-3-Clause" ]
2
2019-08-19T17:08:47.000Z
2019-10-05T11:37:02.000Z
migrations/174-remove-tags-from-documents.py
taliasman/kitsune
f8085205eef143011adb4c52d1f183da06c1c58e
[ "BSD-3-Clause" ]
null
null
null
migrations/174-remove-tags-from-documents.py
taliasman/kitsune
f8085205eef143011adb4c52d1f183da06c1c58e
[ "BSD-3-Clause" ]
null
null
null
from django.contrib.contenttypes.models import ContentType from taggit.models import TaggedItem from wiki.models import Document def run(): # Get content_type_id for Document. content_type = ContentType.objects.get_for_model(Document) # Get all instances of tags that point at a Document tags = TaggedItem.objects.filter(content_type=content_type) print 'Deleting %d tags.' % tags.count() tags.delete() print 'Done!'
26.470588
63
0.746667
61
450
5.393443
0.57377
0.133739
0
0
0
0
0
0
0
0
0
0
0.173333
450
16
64
28.125
0.884409
0.186667
0
0
0
0
0.060606
0
0
0
0
0
0
0
null
null
0
0.333333
null
null
0.222222
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
2
9881a9bbd9cc1ccf46df13d16ed4b30f1348ba5e
279
py
Python
engine/args/server/start_server.py
wezzyofficial/discord_soft
1fdbeffa2b4511a95e147fd7bac09a83d1546a7b
[ "MIT" ]
null
null
null
engine/args/server/start_server.py
wezzyofficial/discord_soft
1fdbeffa2b4511a95e147fd7bac09a83d1546a7b
[ "MIT" ]
null
null
null
engine/args/server/start_server.py
wezzyofficial/discord_soft
1fdbeffa2b4511a95e147fd7bac09a83d1546a7b
[ "MIT" ]
null
null
null
from engine import console from engine.functions import handler from engine.web_server import WebServer @handler.arg(name='server', description='Запускаем процесс "сервер" (на сервере).') def _(): console.log('(MANAGER): Инициализация процесса "сервер"..') WebServer()
27.9
83
0.749104
33
279
6.272727
0.666667
0.144928
0
0
0
0
0
0
0
0
0
0
0.125448
279
10
84
27.9
0.848361
0
0
0
0
0
0.321429
0
0
0
0
0
0
1
0.142857
true
0
0.428571
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
0
1
0
1
0
0
0
0
2
9885baff2dc8ea9d074faa563144dadd2452ab07
822
py
Python
ADT102/AnotherThirdAssignment/Queue.py
oat431/HomeworkCollection
12359eab28416b93f7da00c59fcc44b4e9b7723a
[ "Unlicense" ]
3
2020-01-23T08:43:42.000Z
2021-01-22T15:31:09.000Z
ADT102/AnotherThirdAssignment/Queue.py
oat431/HomeworkCollection
12359eab28416b93f7da00c59fcc44b4e9b7723a
[ "Unlicense" ]
1
2020-10-08T16:30:24.000Z
2020-10-12T09:06:55.000Z
ADT102/ADTassignmentButwithpython/Queue.py
oat431/HomeworkCollection
12359eab28416b93f7da00c59fcc44b4e9b7723a
[ "Unlicense" ]
3
2020-01-13T14:57:01.000Z
2021-09-22T07:16:49.000Z
class Queue: qu = [] size = 0 front = 0 rear = 0 def __init__(self, size): self.size = size def en_queue(self, data): self.qu.append(data) self.size = self.size + 1 self.rear = self.rear + 1 def de_queue(self): temp = self.qu[self.front] del self.qu[self.front] self.rear = self.rear - 1 self.size = self.size - 1 return temp def de_que_all(self): while not self.is_empty(): print(self.de_queue().__str__()) def get_front(self): return self.qu[self.front] def get_rear(self): return self.qu[-1] def is_full(self): return self.rear == self.get_size() def is_empty(self): return self.rear == 0 def get_size(self): return self.size
20.55
44
0.546229
118
822
3.635593
0.237288
0.130536
0.16317
0.111888
0.158508
0
0
0
0
0
0
0.016484
0.335766
822
39
45
21.076923
0.769231
0
0
0
0
0
0
0
0
0
0
0
0
1
0.3
false
0
0
0.166667
0.666667
0.033333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
988c486d6d22373e3663b394c8cd38c068d8485c
179
py
Python
Chapter8/study8_10.py
nicuo/Python3
4cee68030eab62eca92c0a72d2a3d79d92764072
[ "CNRI-Python" ]
null
null
null
Chapter8/study8_10.py
nicuo/Python3
4cee68030eab62eca92c0a72d2a3d79d92764072
[ "CNRI-Python" ]
null
null
null
Chapter8/study8_10.py
nicuo/Python3
4cee68030eab62eca92c0a72d2a3d79d92764072
[ "CNRI-Python" ]
null
null
null
import sqlalchemy conn = sqlalchemy.create_engine('sqlite:///books.db') sql = 'select title from book order by title asc' rows = conn.execute(sql) for row in rows: print(row)
25.571429
53
0.731844
28
179
4.642857
0.785714
0
0
0
0
0
0
0
0
0
0
0
0.150838
179
6
54
29.833333
0.855263
0
0
0
0
0
0.329609
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.166667
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
98b2c68286b0525c5081e4d60802764eb2337f94
1,011
py
Python
todo/views.py
trevenue44/whats-next
991f8b10d16b6906e6448654408f76e65eb86c03
[ "MIT" ]
null
null
null
todo/views.py
trevenue44/whats-next
991f8b10d16b6906e6448654408f76e65eb86c03
[ "MIT" ]
null
null
null
todo/views.py
trevenue44/whats-next
991f8b10d16b6906e6448654408f76e65eb86c03
[ "MIT" ]
null
null
null
from django.shortcuts import redirect, render from django.contrib.auth.decorators import login_required from django.views.generic import ListView from .models import TodoItem # @login_required() # def home(request): # context = { # "todo_items": TodoItem.objects.all(), # } # return render(request, "todo/home.html", context=context) class TodoItemListView(ListView): model = TodoItem template_name = "todo/home.html" # <app_name>_<viewtype>.html context_object_name = "todo_items" def get_queryset(self): return TodoItem.objects.filter(author=self.request.user) @login_required() def add_todo_item(request): content = request.POST["content"] if content: new_todo_item = TodoItem(content=content, author=request.user) new_todo_item.save() return redirect("todo-home") @login_required() def delete_todo_item(request, todo_item_id): todo_item = TodoItem(id=todo_item_id) todo_item.delete() return redirect("todo-home")
26.605263
70
0.716123
128
1,011
5.453125
0.382813
0.091691
0.068768
0.063037
0.051576
0
0
0
0
0
0
0
0.170129
1,011
37
71
27.324324
0.831943
0.1909
0
0.181818
0
0
0.060494
0
0
0
0
0.027027
0
1
0.136364
false
0
0.181818
0.045455
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
1
0
0
0
0
0
0
0
1
0
0
2
7f306202548927c9ddeb2fb7581616cc2b5f9fcd
3,525
py
Python
5.Reconstruction using FFT descriptors/main.py
MengHao666/Digital-Image-Processing-algorithms
8a2d24d6360f3c088fbc7128092decf655c16843
[ "MIT" ]
4
2020-05-23T01:15:37.000Z
2022-01-08T11:14:32.000Z
5.Reconstruction using FFT descriptors/main.py
MengHao666/Digital-Image-Processing-algorithms
8a2d24d6360f3c088fbc7128092decf655c16843
[ "MIT" ]
null
null
null
5.Reconstruction using FFT descriptors/main.py
MengHao666/Digital-Image-Processing-algorithms
8a2d24d6360f3c088fbc7128092decf655c16843
[ "MIT" ]
null
null
null
import numpy as np import matplotlib.pyplot as plt my_contour1 = np.asarray( [[41, 41], [43, 41, ], [45, 41, ], [47, 41], [49, 41], [51, 41], [53, 41], [55, 41], [57, 41], [59, 41], [61, 41], [63, 41], [65, 41], [67, 41], [69, 41], [71, 41], # 41列 [73, 41], [73, 43], [73, 45], [73, 47], [73, 49], [73, 51], [73, 53], [73, 55], [73, 57], # 73行 [73, 59], [73, 61], [73, 63], [73, 65], [73, 67], [73, 69], [73, 71], [73, 73], [71, 73], [69, 73], [67, 73], [65, 73], [63, 73], [61, 73], [59, 73], [57, 73], [55, 73], # 73行 [53, 73], [51, 73], [49, 73], [47, 73], [45, 73], [43, 73], [41, 73], [41, 71], [41, 69], [41, 67], [41, 65], [41, 63], [41, 61], [41, 59], [41, 57], [41, 55], # 41行 [41, 53], [41, 51], [41, 49], [41, 47], [41, 45], [41, 43] ]) my_contour2 = np.asarray([ [73, 41], [73, 43], [73, 45], [73, 47], [73, 49], [73, 51], [73, 53], [73, 55], [73, 57], # 73行 [73, 59], [73, 61], [73, 63], [73, 65], [73, 67], [73, 69], [73, 71], [73, 73], [71, 73], [69, 73], [67, 73], [65, 73], [63, 73], [61, 73], [59, 73], [57, 73], [55, 73], # 73行 [53, 73], [51, 73], [49, 73], [47, 73], [45, 73], [43, 73], [41, 73], [41, 71], [41, 69], [41, 67], [41, 65], [41, 63], [41, 61], [41, 59], [41, 57], [41, 55], # 41行 [41, 53], [41, 51], [41, 49], [41, 47], [41, 45], [41, 43], [41, 41], [43, 41, ], [45, 41, ], [47, 41], [49, 41], [51, 41], [53, 41], [55, 41], [57, 41], [59, 41], [61, 41], [63, 41], [65, 41], [67, 41], [69, 41], [71, 41], # 41列 ]) def DFT(sig): N = sig.shape[0] contours_complex = np.empty(N, dtype=complex) contours_complex = sig[:, 0] + sig[:, 1] * 1j # 横坐标作为实数部分 V = np.array([[np.exp(-1j * 2 * np.pi * v * y / N) for v in range(N)] for y in range(N)]) return contours_complex.dot(V) def reconstruct(au, M): N = au.shape[0] # print("N=", N) res = np.zeros(N, dtype=complex) for k in range(N): for u in range(M): res[k] += au[u] * np.exp(1j * 2 * np.pi * u * k / M) res[k] /= N # print("res=", res) # print("res_=", np.stack((res.real, res.imag), -1)) return np.stack((res.real, res.imag), -1) def plotarray(q, length=100): img = np.zeros((length, length)) for i in range(length): for j in range(length): img[i][j] = 255 for m in range(q.shape[0]): # print(q[m][0]) # print(q[m][1]) img[int(q[m][0])][int(q[m][1])] = 0 return img # print("my_contour.shape=", my_contour2.shape) # 进行离散傅立叶变换 fd = DFT(my_contour1) # print("fd2=", fd2) plot_contour1 = plotarray(my_contour1) res64 = plotarray(reconstruct(fd, 64)) res63 = plotarray(reconstruct(fd, 63)) res50 = plotarray(reconstruct(fd, 50)) res32 = plotarray(reconstruct(fd, 32)) res16 = plotarray(reconstruct(fd, 16)) res8 = plotarray(reconstruct(fd, 8)) res4 = plotarray(reconstruct(fd, 4)) plt.figure() plt.subplots_adjust(wspace=0, hspace=1) # 调整子图间距 plt.subplot(421) plt.imshow(plot_contour1, cmap='gray') plt.title('Original Image') plt.subplot(422) plt.imshow(res64, cmap='gray') plt.title('M=64') plt.subplot(423) plt.imshow(res63, cmap='gray') plt.title('M=63') plt.subplot(424) plt.imshow(res50, cmap='gray') plt.title('M=50') plt.subplot(425) plt.imshow(res32, cmap='gray') plt.title('M=32') plt.subplot(426) plt.imshow(res16, cmap='gray') plt.title('M=16') plt.subplot(427) plt.imshow(res8, cmap='gray') plt.title('M=8') plt.subplot(428) plt.imshow(res4, cmap='gray') plt.title('M=4') plt.show()
29.621849
101
0.522837
608
3,525
3.009868
0.189145
0.043716
0.048087
0.069945
0.395082
0.330055
0.31694
0.292896
0.292896
0.292896
0
0.228468
0.212766
3,525
118
102
29.872881
0.430991
0.067518
0
0.175
0
0
0.022032
0
0
0
0
0
0
1
0.0375
false
0
0.025
0
0.1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
7f316e8b987565ce47d163b9f5f37e87f76d6453
144
py
Python
solo/__init__.py
helenst/django-solo
b5618fb0b016197c49a58973c3bd6dfbb2176bb5
[ "CC-BY-3.0" ]
39
2015-06-10T23:18:07.000Z
2021-10-21T04:29:06.000Z
solo/__init__.py
helenst/django-solo
b5618fb0b016197c49a58973c3bd6dfbb2176bb5
[ "CC-BY-3.0" ]
2
2016-08-22T12:38:10.000Z
2017-01-26T18:37:33.000Z
solo/__init__.py
helenst/django-solo
b5618fb0b016197c49a58973c3bd6dfbb2176bb5
[ "CC-BY-3.0" ]
26
2015-06-10T22:09:15.000Z
2021-06-27T15:45:15.000Z
"""django-solo helps working with singletons: things like global settings that you want to edit from the admin site. """ __version__ = '1.0.5'
28.8
116
0.743056
23
144
4.478261
1
0
0
0
0
0
0
0
0
0
0
0.024793
0.159722
144
4
117
36
0.826446
0.784722
0
0
0
0
0.208333
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
7f3a4cdfcafd777edc899f6d7ecaca78ea8fde77
1,022
py
Python
tfquery/utils.py
mazen160/tfquery
ddc145d7bf04f002c8ea49079fbc688106fc1485
[ "MIT" ]
262
2021-04-28T11:38:53.000Z
2022-03-16T12:31:14.000Z
tfquery/utils.py
mazen160/tfquery
ddc145d7bf04f002c8ea49079fbc688106fc1485
[ "MIT" ]
2
2021-05-12T07:30:25.000Z
2021-09-19T11:29:22.000Z
tfquery/utils.py
mazen160/tfquery
ddc145d7bf04f002c8ea49079fbc688106fc1485
[ "MIT" ]
12
2021-04-28T17:15:08.000Z
2022-02-12T10:30:45.000Z
#!/usr/env python3 from os import listdir from os.path import isfile from os.path import join import json import logging import tfquery.tfstate as tfstate from tfquery.sql_handler import SQLHandler def get_all_tfstates(dir): onlyfiles = [join(dir, f) for f in listdir(dir) if isfile(join(dir, f))] output = [] for i in onlyfiles: if i.endswith(".tfstate"): output.append(i) return output def import_tfstate(db_path, tfstate_file): logging.basicConfig(format='%(message)s') log = logging.getLogger("tfquery") log.info(f"[i] tfstate file: {tfstate_file}") resources = tfstate.parse_resources(tfstate_file, detailed=True) s = SQLHandler(hide_attributes=True, db_path=db_path, tfstate_file=tfstate_file) log.info(f"[i] DB Path: {s.db_path}") s.create_table(resources) s.insert_resources(resources) log.info(f"[+] Imported {len(resources)} resources from {tfstate_file}.") def beautify_json(j): return json.dumps(j, indent=4, sort_keys=True)
27.621622
84
0.709393
150
1,022
4.7
0.4
0.10922
0.034043
0.04539
0
0
0
0
0
0
0
0.002358
0.170254
1,022
36
85
28.388889
0.829009
0.016634
0
0
0
0
0.141434
0
0
0
0
0
0
1
0.115385
false
0
0.346154
0.038462
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
7f4f3ad13342e342b3ea71da21080551f6989e87
275
py
Python
tests/SampleApps/python/flask-app/app.py
samruddhikhandale/Oryx
9031b36c02967bb4000645950680572a8a76fa56
[ "MIT" ]
403
2019-05-07T23:40:45.000Z
2022-03-31T11:14:07.000Z
tests/SampleApps/python/flask-app/app.py
samruddhikhandale/Oryx
9031b36c02967bb4000645950680572a8a76fa56
[ "MIT" ]
514
2019-05-07T17:00:14.000Z
2022-03-31T20:09:16.000Z
tests/SampleApps/python/flask-app/app.py
samruddhikhandale/Oryx
9031b36c02967bb4000645950680572a8a76fa56
[ "MIT" ]
108
2019-05-07T23:40:47.000Z
2022-03-30T00:15:19.000Z
from flask import Flask from datetime import datetime from flask import current_app app = Flask(__name__) @app.route("/") def hello(): return "Hello World! " + str(datetime.now()) @app.route("/applicationpath") def applicationPath(): return current_app.root_path
18.333333
48
0.730909
36
275
5.388889
0.472222
0.092784
0.154639
0
0
0
0
0
0
0
0
0
0.149091
275
14
49
19.642857
0.82906
0
0
0
0
0
0.109489
0
0
0
0
0
0
1
0.2
false
0
0.3
0.2
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
0
0
0
0
1
1
0
0
2
7f57dd1bf0c3f313bfcee872bee91f10fbf6272c
1,087
py
Python
backend/account_app/admin.py
michaeljarizala/django-react-app-boilerplate
2a5e8a57f21a5a411d47032f8e55afdba99db603
[ "MIT" ]
null
null
null
backend/account_app/admin.py
michaeljarizala/django-react-app-boilerplate
2a5e8a57f21a5a411d47032f8e55afdba99db603
[ "MIT" ]
5
2021-03-30T13:45:26.000Z
2021-09-22T19:16:06.000Z
backend/account_app/admin.py
michaeljarizala/django-react-app-boilerplate
2a5e8a57f21a5a411d47032f8e55afdba99db603
[ "MIT" ]
null
null
null
from datetime import datetime from django.contrib import admin from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.utils import timezone from django.utils.text import slugify from django.urls import reverse from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from django.shortcuts import get_object_or_404 from django.contrib.auth.models import Permission from django.contrib import admin from django.db.models import Q # IMPORT MODELS from django_summernote.admin import SummernoteModelAdmin from django.contrib.auth.models import User from account_app.models import ( Module, Role, Object, Operation, Permission, RoleAssignment, PermissionAssignment, RoleModule, ModuleObject ) admin.site.register(Module) admin.site.register(Role) admin.site.register(Object) admin.site.register(Operation) admin.site.register(Permission) admin.site.register(RoleAssignment) admin.site.register(PermissionAssignment) admin.site.register(RoleModule) admin.site.register(ModuleObject)
28.605263
64
0.820607
139
1,087
6.366906
0.323741
0.146893
0.172881
0.071186
0.160452
0.160452
0.085876
0
0
0
0
0.003115
0.114075
1,087
38
65
28.605263
0.915888
0.01196
0
0.058824
0
0
0
0
0
0
0
0
0
1
0
true
0
0.441176
0
0.441176
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
0
1
0
0
0
0
2
7f57f6c832b3711e423cec6abd7c42e0c01e4580
1,381
py
Python
api/db/redis_mq.py
Latent-Lxx/dazhou-dw
902b4b625cda4c9e4eb205017b8955b81f37a0b5
[ "MIT" ]
null
null
null
api/db/redis_mq.py
Latent-Lxx/dazhou-dw
902b4b625cda4c9e4eb205017b8955b81f37a0b5
[ "MIT" ]
null
null
null
api/db/redis_mq.py
Latent-Lxx/dazhou-dw
902b4b625cda4c9e4eb205017b8955b81f37a0b5
[ "MIT" ]
1
2022-02-11T04:44:37.000Z
2022-02-11T04:44:37.000Z
# !/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2021/7/1 下午4:19 # @Author : Latent # @Email : latentsky@gmail.com # @File : kafka.py # @Software: PyCharm # @class : 用于redis 的消息队列 -->生产消费者 import redis class RedisMQ(object): def __init__(self): self.redis_mq = redis.Redis(host='127.0.0.1', port='6379', db=1, decode_responses=True, charset='UTF-8', encoding='UTF-8',health_check_interval=30) # ==> 1. Producer def redis_push(self, name: str, push_msg: dict): try: self.redis_mq.lpush(name, str(push_msg)) return 'ok' except Exception as e: print('==> redis入队列出现问题:', e) return None # ==> 2.Consumer def redis_pop(self, name: str): try: pop_value = self.redis_mq.rpop(name) return pop_value except Exception as e: print('==> redis出队出现问题', e) return None # ==> 3.查询队列的长度 def redis_len(self, name:str): count = self.redis_mq.llen(name) return count # ==> 4.获取所有的key def redis_getkey(self): keys = self.redis_mq.scan_iter() return list(keys) # ==> 5.清空队列 def redis_delete(self, redis_key): self.redis_mq.delete(redis_key) return 'ok' # ==> 6.url 去重集合 def redis_set(self, msg): pass
23.016667
112
0.553222
177
1,381
4.169492
0.531073
0.085366
0.089431
0.03794
0.062331
0
0
0
0
0
0
0.033578
0.30992
1,381
59
113
23.40678
0.740818
0.19189
0
0.266667
0
0
0.053832
0
0
0
0
0
0
1
0.233333
false
0.033333
0.033333
0
0.533333
0.066667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
7f71298cc0436308ca50419cc723723f87f78117
2,610
py
Python
Code/3-numpy/sales_data.py
Flor91/Data-Science
f67ec537341e8b2d8213a56ef8ee63028e46e1b2
[ "MIT" ]
2
2020-10-06T12:59:39.000Z
2021-11-08T10:58:14.000Z
Code/3-numpy/sales_data.py
Flor91/Data-Science
f67ec537341e8b2d8213a56ef8ee63028e46e1b2
[ "MIT" ]
null
null
null
Code/3-numpy/sales_data.py
Flor91/Data-Science
f67ec537341e8b2d8213a56ef8ee63028e46e1b2
[ "MIT" ]
null
null
null
""" Leer los datos del archivo /M1/CLASE_03/Data/sales_data_sample_excercise.csv Este archivo tiene algunos datos numéricos y otros de tipo cadena de caracteres. Las columnas son: ORDERNUMBER: int, id de la orden SALES: float, monto abonado MONTH_ID: int, mes YEAR_ID: int, año PRODUCTLINE: str, producto COUNTRY: str, país de venta ¿Recuerdan que todos los elementos de una instancia de ndarray deben ser del mismo tipo? Entonces vamos a leer el archivo y crear una instancia de ndarray de tipo cadena de caracteres. ¿Qué pasaría si intentáramos crear una instancia de tipo int? ¿Y de tipo float? """ import numpy as np import seaborn as sns file = "Data/sales_data_sample_excercise.csv" data_str = np.genfromtxt(file, delimiter="\t", skip_header=True, dtype=str) print("\nSring dtype") print(data_str) data_int = np.genfromtxt(file, delimiter="\t", skip_header=True, dtype=int) print("\nInt dtype") print(data_int) data_float = np.genfromtxt(file, delimiter="\t", skip_header=True, dtype=float) print("\nFloat dtype") print(data_float) data = np.genfromtxt(file, delimiter="\t", skip_header=True) print("\nNo specified dtype") print(data) # Crear un array numérico que tenga como valores las columna SALES y otro array de str que tenga como valores la columna COUNTRY sales = data_float[:, 1] print(sales) country = data_str[:, -1] print(country) # Sobre los datos de precios de ventas (columna SALES) calcular: # mínimo máximo promedio cantidad suma print(f"\nPrecio minimo sales: {sales.min()}") print(f"Precio máximo sales: {sales.max()}") print(f"Precio promedio sales: {sales.mean()}") print(f"Precio cantidad sales: {len(sales)}") print(f"Precio suma sales: {sales.sum()}") print("\n¿Cuántas ventas se hicieron en USA?") usa_mask = country == "USA" usa_sales = sales[usa_mask] print(usa_sales.sum()) print( "\n¿Cuáles son los precios de las 5 ventas que están en las filas 6 a 10 del dataset?" ) print(sales[6:11]) print(f"Precio media sales: {sales.mean()}") print(f"Precio mediana sales: {np.median(sales)}") print(f"Precio desvio sales: {sales.std()}") print(f"Precio rango sales: {sales.max() - sales.min()}") def distribution_plotter(data, label): sns.set(rc={"figure.figsize": (10, 7)}) sns.set_style("white") dist = sns.distplot(data, hist_kws={"alpha": 0.2}, kde_kws={"linewidth": 5}) dist.set_title("Distribucion de " + label + "\n", fontsize=16) random_generator = np.random.default_rng(1234) birthday = random_generator.integers(low=1, high=366, size=30) distribution_plotter(birthday, "Cumple")
29
184
0.721456
411
2,610
4.510949
0.411192
0.029126
0.05178
0.053937
0.19795
0.155879
0.094391
0.094391
0.072816
0
0
0.013532
0.150575
2,610
89
185
29.325843
0.820478
0.318391
0
0
0
0.021739
0.345393
0.02035
0
0
0
0.011236
0
1
0.021739
false
0
0.043478
0
0.065217
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
1
0
0
0
0
0
0
0
0
1
0
2
7f72495eb33702816868ba5a2c0729d27e0d1c58
297
py
Python
Ago-Dic-2019/Ricardo_Romero_Medina/Practica1/Practica_7-5.py
Arbupa/DAS_Sistemas
52263ab91436b2e5a24ce6f8493aaa2e2fe92fb1
[ "MIT" ]
41
2017-09-26T09:36:32.000Z
2022-03-19T18:05:25.000Z
Ago-Dic-2019/Ricardo_Romero_Medina/Practica1/Practica_7-5.py
Arbupa/DAS_Sistemas
52263ab91436b2e5a24ce6f8493aaa2e2fe92fb1
[ "MIT" ]
67
2017-09-11T05:06:12.000Z
2022-02-14T04:44:04.000Z
Ago-Dic-2019/Ricardo_Romero_Medina/Practica1/Practica_7-5.py
Arbupa/DAS_Sistemas
52263ab91436b2e5a24ce6f8493aaa2e2fe92fb1
[ "MIT" ]
210
2017-09-01T00:10:08.000Z
2022-03-19T18:05:12.000Z
edad=input("¿Que edad tienes?") edad=int(edad) while True: if edad < 3: print("Su boleto es gratis") break elif edad >= 3 and edad <=12: print("Su boleto tiene un valor de $10") break else: print("Su boleto tiene un valor de $15") break
22.846154
48
0.555556
45
297
3.688889
0.577778
0.126506
0.23494
0.216867
0.325301
0.325301
0.325301
0
0
0
0
0.040404
0.333333
297
13
49
22.846154
0.792929
0
0
0.25
0
0
0.328859
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
7f96a59f040c6fd76c549ef1233f0a9ff9e61ddc
2,690
py
Python
pysnmp/HH3C-LOCAL-AAA-SERVER-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/HH3C-LOCAL-AAA-SERVER-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/HH3C-LOCAL-AAA-SERVER-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module HH3C-LOCAL-AAA-SERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-LOCAL-AAA-SERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:15:00 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) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion", "ValueRangeConstraint") hh3cCommon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cCommon") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") ObjectIdentity, Integer32, Counter32, Unsigned32, IpAddress, MibIdentifier, NotificationType, Counter64, iso, Bits, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Integer32", "Counter32", "Unsigned32", "IpAddress", "MibIdentifier", "NotificationType", "Counter64", "iso", "Bits", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Gauge32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") hh3cLocAAASvr = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 141)) hh3cLocAAASvr.setRevisions(('2013-07-06 09:45',)) if mibBuilder.loadTexts: hh3cLocAAASvr.setLastUpdated('201307060945Z') if mibBuilder.loadTexts: hh3cLocAAASvr.setOrganization('Hangzhou H3C Tech. Co., Ltd.') hh3cLocAAASvrControl = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 1)) hh3cLocAAASvrTables = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 2)) hh3cLocAAASvrTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3)) hh3cLocAAASvrTrapPrex = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3, 0)) hh3cLocAAASvrBillExportFailed = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3, 0, 1)) if mibBuilder.loadTexts: hh3cLocAAASvrBillExportFailed.setStatus('current') mibBuilder.exportSymbols("HH3C-LOCAL-AAA-SERVER-MIB", hh3cLocAAASvrControl=hh3cLocAAASvrControl, PYSNMP_MODULE_ID=hh3cLocAAASvr, hh3cLocAAASvrTrap=hh3cLocAAASvrTrap, hh3cLocAAASvr=hh3cLocAAASvr, hh3cLocAAASvrTrapPrex=hh3cLocAAASvrTrapPrex, hh3cLocAAASvrBillExportFailed=hh3cLocAAASvrBillExportFailed, hh3cLocAAASvrTables=hh3cLocAAASvrTables)
103.461538
477
0.784015
285
2,690
7.392982
0.421053
0.076412
0.008543
0.011391
0.353109
0.229236
0.229236
0.229236
0.229236
0.222117
0
0.089365
0.080669
2,690
25
478
107.6
0.762636
0.127881
0
0
0
0
0.235772
0.029525
0
0
0
0
0
1
0
false
0
0.388889
0
0.388889
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
7f9accb8b3916772bc6eb70fd49fa86c3cc74ca0
540
py
Python
ex/parser/scanner_command_shell.py
trishume/VintageousPlus
1dd62435138234979fe5bb413e1731119b017daf
[ "MIT" ]
6
2017-04-01T05:30:08.000Z
2017-04-05T14:17:40.000Z
ex/parser/scanner_command_shell.py
trishume/VintageousPlus
1dd62435138234979fe5bb413e1731119b017daf
[ "MIT" ]
1
2017-04-04T06:47:13.000Z
2017-04-04T14:26:32.000Z
ex/parser/scanner_command_shell.py
trishume/VintageousPlus
1dd62435138234979fe5bb413e1731119b017daf
[ "MIT" ]
null
null
null
from .state import EOF from .tokens import TokenEof from .tokens_base import TOKEN_COMMAND_SHELL from .tokens_base import TokenOfCommand from VintageousPlus import ex @ex.command('shell', 'shell') class TokenShell(TokenOfCommand): def __init__(self, *args, **kwargs): super().__init__({}, TOKEN_COMMAND_SHELL, 'shell', *args, **kwargs) self.target_command = 'ex_shell' def scan_command_shell(state): state.expect(EOF) return None, [TokenShell(), TokenEof()]
27
50
0.661111
61
540
5.557377
0.42623
0.141593
0.082596
0.117994
0
0
0
0
0
0
0
0
0.231481
540
19
51
28.421053
0.816867
0
0
0
0
0
0.042593
0
0
0
0
0
0
1
0.133333
false
0
0.333333
0
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
0
0
0
1
0
1
0
0
2
7f9de0a10187d7a59e41725118cf47b024757f4f
1,512
py
Python
warg/decorators/hashing.py
cnheider/warg
4bcc5d3e86dd843773ca6cbca21bcab3b8ae84eb
[ "Apache-2.0" ]
1
2018-11-30T09:14:28.000Z
2018-11-30T09:14:28.000Z
warg/decorators/hashing.py
aivclab/warg
4bcc5d3e86dd843773ca6cbca21bcab3b8ae84eb
[ "Apache-2.0" ]
49
2019-04-02T12:06:10.000Z
2019-08-31T14:30:12.000Z
warg/decorators/hashing.py
cnHeider/warg
4bcc5d3e86dd843773ca6cbca21bcab3b8ae84eb
[ "Apache-2.0" ]
1
2020-10-01T00:18:12.000Z
2020-10-01T00:18:12.000Z
import copy DictProxyType = type(object.__dict__) __all__ = ["make_hash"] def make_hash(o): """ Makes a hash from a dictionary, list, tuple or set to any level, that contains only other hashable types (including any lists, tuples, sets, and dictionaries). In the case where other kinds of objects (like classes) need to be hashed, pass in a collection of object attributes that are pertinent. For example, a class can be hashed in this fashion: make_hash([cls.__dict__, cls.__name__]) A function can be hashed like so: make_hash([fn.__dict__, fn.__code__])""" if isinstance(o, DictProxyType): o2 = {} for k, v in o.items(): if not k.startswith("__"): o2[k] = v o = o2 if isinstance(o, (set, tuple, list)): return hash(tuple([make_hash(e) for e in o])) if not isinstance(o, dict): return hash(o) new_o = copy.deepcopy(o) for k, v in new_o.items(): new_o[k] = make_hash(v) return hash(tuple(frozenset(sorted(new_o.items())))) if __name__ == "__main__": print(hash(1)) print(make_hash(1)) print(make_hash(1)) print(make_hash({1})) print(make_hash([1])) print(make_hash({1})) print(make_hash({1, 2})) print(make_hash([1, 2])) print(make_hash((1, 2))) print(make_hash({4})) print(make_hash("1")) print(make_hash({"2": 2})) print(make_hash({"2": 3})) print(make_hash({"3": 2})) print(make_hash({"3": 3}))
26.526316
79
0.608466
231
1,512
3.731602
0.359307
0.185615
0.211137
0.146172
0.185615
0.185615
0.185615
0.154292
0.154292
0.154292
0
0.021911
0.24537
1,512
56
80
27
0.733567
0.308862
0
0.117647
0
0
0.023857
0
0
0
0
0
0
1
0.029412
false
0
0.029412
0
0.147059
0.441176
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
0
0
0
0
0
0
1
0
2
f68d17d7299ac799101ffa6cca72435999a5d7d2
1,036
py
Python
rpython/translator/jvm/test/test_unicode.py
kantai/passe-pypy-taint-tracking
b60a3663f8fe89892dc182c8497aab97e2e75d69
[ "MIT" ]
2
2016-07-06T23:30:20.000Z
2017-05-30T15:59:31.000Z
rpython/translator/jvm/test/test_unicode.py
kantai/passe-pypy-taint-tracking
b60a3663f8fe89892dc182c8497aab97e2e75d69
[ "MIT" ]
null
null
null
rpython/translator/jvm/test/test_unicode.py
kantai/passe-pypy-taint-tracking
b60a3663f8fe89892dc182c8497aab97e2e75d69
[ "MIT" ]
2
2020-07-09T08:14:22.000Z
2021-01-15T18:01:25.000Z
import py from rpython.translator.jvm.test.runtest import JvmTest from rpython.rtyper.test.test_runicode import BaseTestRUnicode # ====> ../../../rpython/test/test_runicode.py class TestJvmUnicode(JvmTest, BaseTestRUnicode): EMPTY_STRING_HASH = 0 def test_unichar_const(self): def fn(): return u'\u03b1' assert self.interpret(fn, []) == u'\u03b1' def test_unichar_eq(self): py.test.skip("JVM doesn't support unicode for command line arguments") test_unichar_ord = test_unichar_eq test_unichar_hash = test_unichar_eq test_char_unichar_eq = test_unichar_eq test_char_unichar_eq_2 = test_unichar_eq def test_getitem_exc(self): py.test.skip('fixme!') def test_unicode_constant(self): const = u''.join(map(unichr, range(0, 256))) const = const + u'\ufffd' def fn(): return const res = self.interpret(fn, []) assert res == const def test_strformat_unicode_arg(self): py.test.skip('fixme!')
28.777778
78
0.662162
138
1,036
4.724638
0.391304
0.134969
0.099693
0.064417
0.150307
0.092025
0.092025
0
0
0
0
0.014963
0.225869
1,036
35
79
29.6
0.798005
0.042471
0
0.153846
0
0
0.084848
0
0
0
0
0
0.076923
1
0.269231
false
0
0.115385
0.076923
0.692308
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
f69343a676b873183067ddb3ba34a74a85ecba56
145
py
Python
Python/pythonProject/exercise/ex048.py
JoaoMoreira2002/Linguagens-de-programacao
b91a902188428238a567c8f52b2ac9028378c4df
[ "MIT" ]
null
null
null
Python/pythonProject/exercise/ex048.py
JoaoMoreira2002/Linguagens-de-programacao
b91a902188428238a567c8f52b2ac9028378c4df
[ "MIT" ]
null
null
null
Python/pythonProject/exercise/ex048.py
JoaoMoreira2002/Linguagens-de-programacao
b91a902188428238a567c8f52b2ac9028378c4df
[ "MIT" ]
null
null
null
soma = 0 for c in range(0, 6): x = int(input('Digite 6 números número')) if x % 2 != 0: soma = x + soma print(x) print(soma)
18.125
45
0.524138
26
145
2.923077
0.615385
0
0
0
0
0
0
0
0
0
0
0.061224
0.324138
145
7
46
20.714286
0.714286
0
0
0
0
0
0.158621
0
0
0
0
0
0
1
0
false
0
0
0
0
0.285714
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
f69fe5feaebf5157cf5127877da8650195254fcf
523
py
Python
Week_1 read files.py
GoreNetwork/Class_1
87b053baa6d3beb6a4b909149b6b3c6f49a97119
[ "Apache-2.0" ]
null
null
null
Week_1 read files.py
GoreNetwork/Class_1
87b053baa6d3beb6a4b909149b6b3c6f49a97119
[ "Apache-2.0" ]
null
null
null
Week_1 read files.py
GoreNetwork/Class_1
87b053baa6d3beb6a4b909149b6b3c6f49a97119
[ "Apache-2.0" ]
null
null
null
import yaml import json from pprint import pprint as pp def read_and_print_yaml_file(file): with open(file) as f: new_list = yaml.load(f) print("YAML Print: \n") print(yaml.dump(new_list, default_flow_style = False)) print("\n\n") def read_and_print_json_file(file): with open (file) as f: new_list = json.load(f) print("JSON print: \n") pp(new_list) print("\n\n") read_and_print_yaml_file('my_list.yml') read_and_print_json_file('my_list.json')
19.37037
56
0.648184
86
523
3.662791
0.302326
0.088889
0.152381
0.095238
0.419048
0.190476
0.190476
0.190476
0.190476
0
0
0
0.231358
523
26
57
20.115385
0.783582
0
0
0.235294
0
0
0.118712
0
0
0
0
0
0
0
null
null
0
0.176471
null
null
0.588235
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
2
f6bd9e9472a39de7576227bf7d9a5bcd05e93f95
9,697
py
Python
ocean/v1alpha/notification_pb2.py
vulpemventures/gdk-ocean
5691e61f1cee99ae23203d069ac6043f1a18f96a
[ "MIT" ]
null
null
null
ocean/v1alpha/notification_pb2.py
vulpemventures/gdk-ocean
5691e61f1cee99ae23203d069ac6043f1a18f96a
[ "MIT" ]
null
null
null
ocean/v1alpha/notification_pb2.py
vulpemventures/gdk-ocean
5691e61f1cee99ae23203d069ac6043f1a18f96a
[ "MIT" ]
1
2022-02-07T08:45:27.000Z
2022-02-07T08:45:27.000Z
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: ocean/v1alpha/notification.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() from ocean.v1alpha import types_pb2 as ocean_dot_v1alpha_dot_types__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n ocean/v1alpha/notification.proto\x12\rocean.v1alpha\x1a\x19ocean/v1alpha/types.proto\"]\n\x1fTransactionNotificationsRequest\x12:\n\x0b\x61\x63\x63ount_key\x18\x01 \x01(\x0b\x32\x19.ocean.v1alpha.AccountKeyR\naccountKey\"\xef\x01\n TransactionNotificationsResponse\x12:\n\x0b\x61\x63\x63ount_key\x18\x01 \x01(\x0b\x32\x19.ocean.v1alpha.AccountKeyR\naccountKey\x12\x12\n\x04txid\x18\x02 \x01(\tR\x04txid\x12\x39\n\nevent_type\x18\x03 \x01(\x0e\x32\x1a.ocean.v1alpha.TxEventTypeR\teventType\x12@\n\rblock_details\x18\x04 \x01(\x0b\x32\x1b.ocean.v1alpha.BlockDetailsR\x0c\x62lockDetails\"W\n\x19UtxosNotificationsRequest\x12:\n\x0b\x61\x63\x63ount_key\x18\x01 \x01(\x0b\x32\x19.ocean.v1alpha.AccountKeyR\naccountKey\"\xbe\x01\n\x1aUtxosNotificationsResponse\x12:\n\x0b\x61\x63\x63ount_key\x18\x01 \x01(\x0b\x32\x19.ocean.v1alpha.AccountKeyR\naccountKey\x12\'\n\x04utxo\x18\x02 \x01(\x0b\x32\x13.ocean.v1alpha.UtxoR\x04utxo\x12;\n\nevent_type\x18\x03 \x01(\x0e\x32\x1c.ocean.v1alpha.UtxoEventTypeR\teventType\"\x87\x01\n\x11\x41\x64\x64WebhookRequest\x12\x1a\n\x08\x65ndpoint\x18\x01 \x01(\tR\x08\x65ndpoint\x12>\n\nevent_type\x18\x02 \x01(\x0e\x32\x1f.ocean.v1alpha.WebhookEventTypeR\teventType\x12\x16\n\x06secret\x18\x03 \x01(\tR\x06secret\"$\n\x12\x41\x64\x64WebhookResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\"&\n\x14RemoveWebhookRequest\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\"\x17\n\x15RemoveWebhookResponse\"U\n\x13ListWebhooksRequest\x12>\n\nevent_type\x18\x01 \x01(\x0e\x32\x1f.ocean.v1alpha.WebhookEventTypeR\teventType\"U\n\x14ListWebhooksResponse\x12=\n\x0cwebhook_info\x18\x01 \x03(\x0b\x32\x1a.ocean.v1alpha.WebhookInfoR\x0bwebhookInfo\"X\n\x0bWebhookInfo\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n\x08\x65ndpoint\x18\x02 \x01(\tR\x08\x65ndpoint\x12\x1d\n\nis_secured\x18\x03 \x01(\x08R\tisSecured2\x8f\x04\n\x13NotificationService\x12}\n\x18TransactionNotifications\x12..ocean.v1alpha.TransactionNotificationsRequest\x1a/.ocean.v1alpha.TransactionNotificationsResponse0\x01\x12k\n\x12UtxosNotifications\x12(.ocean.v1alpha.UtxosNotificationsRequest\x1a).ocean.v1alpha.UtxosNotificationsResponse0\x01\x12S\n\nAddWebhook\x12 .ocean.v1alpha.AddWebhookRequest\x1a!.ocean.v1alpha.AddWebhookResponse\"\x00\x12\\\n\rRemoveWebhook\x12#.ocean.v1alpha.RemoveWebhookRequest\x1a$.ocean.v1alpha.RemoveWebhookResponse\"\x00\x12Y\n\x0cListWebhooks\x12\".ocean.v1alpha.ListWebhooksRequest\x1a#.ocean.v1alpha.ListWebhooksResponse\"\x00\x42\xde\x01\n\x11\x63om.ocean.v1alphaB\x11NotificationProtoP\x01Zagithub.com/vulpemventures/ocean/api-spec/protobuf/ocean/v1alpha/gen/go/ocean/v1alpha;oceanv1alpha\xa2\x02\x03OXX\xaa\x02\rOcean.V1alpha\xca\x02\rOcean\\V1alpha\xe2\x02\x19Ocean\\V1alpha\\GPBMetadata\xea\x02\x0eOcean::V1alphab\x06proto3') _TRANSACTIONNOTIFICATIONSREQUEST = DESCRIPTOR.message_types_by_name['TransactionNotificationsRequest'] _TRANSACTIONNOTIFICATIONSRESPONSE = DESCRIPTOR.message_types_by_name['TransactionNotificationsResponse'] _UTXOSNOTIFICATIONSREQUEST = DESCRIPTOR.message_types_by_name['UtxosNotificationsRequest'] _UTXOSNOTIFICATIONSRESPONSE = DESCRIPTOR.message_types_by_name['UtxosNotificationsResponse'] _ADDWEBHOOKREQUEST = DESCRIPTOR.message_types_by_name['AddWebhookRequest'] _ADDWEBHOOKRESPONSE = DESCRIPTOR.message_types_by_name['AddWebhookResponse'] _REMOVEWEBHOOKREQUEST = DESCRIPTOR.message_types_by_name['RemoveWebhookRequest'] _REMOVEWEBHOOKRESPONSE = DESCRIPTOR.message_types_by_name['RemoveWebhookResponse'] _LISTWEBHOOKSREQUEST = DESCRIPTOR.message_types_by_name['ListWebhooksRequest'] _LISTWEBHOOKSRESPONSE = DESCRIPTOR.message_types_by_name['ListWebhooksResponse'] _WEBHOOKINFO = DESCRIPTOR.message_types_by_name['WebhookInfo'] TransactionNotificationsRequest = _reflection.GeneratedProtocolMessageType('TransactionNotificationsRequest', (_message.Message,), { 'DESCRIPTOR' : _TRANSACTIONNOTIFICATIONSREQUEST, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.TransactionNotificationsRequest) }) _sym_db.RegisterMessage(TransactionNotificationsRequest) TransactionNotificationsResponse = _reflection.GeneratedProtocolMessageType('TransactionNotificationsResponse', (_message.Message,), { 'DESCRIPTOR' : _TRANSACTIONNOTIFICATIONSRESPONSE, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.TransactionNotificationsResponse) }) _sym_db.RegisterMessage(TransactionNotificationsResponse) UtxosNotificationsRequest = _reflection.GeneratedProtocolMessageType('UtxosNotificationsRequest', (_message.Message,), { 'DESCRIPTOR' : _UTXOSNOTIFICATIONSREQUEST, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.UtxosNotificationsRequest) }) _sym_db.RegisterMessage(UtxosNotificationsRequest) UtxosNotificationsResponse = _reflection.GeneratedProtocolMessageType('UtxosNotificationsResponse', (_message.Message,), { 'DESCRIPTOR' : _UTXOSNOTIFICATIONSRESPONSE, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.UtxosNotificationsResponse) }) _sym_db.RegisterMessage(UtxosNotificationsResponse) AddWebhookRequest = _reflection.GeneratedProtocolMessageType('AddWebhookRequest', (_message.Message,), { 'DESCRIPTOR' : _ADDWEBHOOKREQUEST, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.AddWebhookRequest) }) _sym_db.RegisterMessage(AddWebhookRequest) AddWebhookResponse = _reflection.GeneratedProtocolMessageType('AddWebhookResponse', (_message.Message,), { 'DESCRIPTOR' : _ADDWEBHOOKRESPONSE, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.AddWebhookResponse) }) _sym_db.RegisterMessage(AddWebhookResponse) RemoveWebhookRequest = _reflection.GeneratedProtocolMessageType('RemoveWebhookRequest', (_message.Message,), { 'DESCRIPTOR' : _REMOVEWEBHOOKREQUEST, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.RemoveWebhookRequest) }) _sym_db.RegisterMessage(RemoveWebhookRequest) RemoveWebhookResponse = _reflection.GeneratedProtocolMessageType('RemoveWebhookResponse', (_message.Message,), { 'DESCRIPTOR' : _REMOVEWEBHOOKRESPONSE, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.RemoveWebhookResponse) }) _sym_db.RegisterMessage(RemoveWebhookResponse) ListWebhooksRequest = _reflection.GeneratedProtocolMessageType('ListWebhooksRequest', (_message.Message,), { 'DESCRIPTOR' : _LISTWEBHOOKSREQUEST, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.ListWebhooksRequest) }) _sym_db.RegisterMessage(ListWebhooksRequest) ListWebhooksResponse = _reflection.GeneratedProtocolMessageType('ListWebhooksResponse', (_message.Message,), { 'DESCRIPTOR' : _LISTWEBHOOKSRESPONSE, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.ListWebhooksResponse) }) _sym_db.RegisterMessage(ListWebhooksResponse) WebhookInfo = _reflection.GeneratedProtocolMessageType('WebhookInfo', (_message.Message,), { 'DESCRIPTOR' : _WEBHOOKINFO, '__module__' : 'ocean.v1alpha.notification_pb2' # @@protoc_insertion_point(class_scope:ocean.v1alpha.WebhookInfo) }) _sym_db.RegisterMessage(WebhookInfo) _NOTIFICATIONSERVICE = DESCRIPTOR.services_by_name['NotificationService'] if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\021com.ocean.v1alphaB\021NotificationProtoP\001Zagithub.com/vulpemventures/ocean/api-spec/protobuf/ocean/v1alpha/gen/go/ocean/v1alpha;oceanv1alpha\242\002\003OXX\252\002\rOcean.V1alpha\312\002\rOcean\\V1alpha\342\002\031Ocean\\V1alpha\\GPBMetadata\352\002\016Ocean::V1alpha' _TRANSACTIONNOTIFICATIONSREQUEST._serialized_start=78 _TRANSACTIONNOTIFICATIONSREQUEST._serialized_end=171 _TRANSACTIONNOTIFICATIONSRESPONSE._serialized_start=174 _TRANSACTIONNOTIFICATIONSRESPONSE._serialized_end=413 _UTXOSNOTIFICATIONSREQUEST._serialized_start=415 _UTXOSNOTIFICATIONSREQUEST._serialized_end=502 _UTXOSNOTIFICATIONSRESPONSE._serialized_start=505 _UTXOSNOTIFICATIONSRESPONSE._serialized_end=695 _ADDWEBHOOKREQUEST._serialized_start=698 _ADDWEBHOOKREQUEST._serialized_end=833 _ADDWEBHOOKRESPONSE._serialized_start=835 _ADDWEBHOOKRESPONSE._serialized_end=871 _REMOVEWEBHOOKREQUEST._serialized_start=873 _REMOVEWEBHOOKREQUEST._serialized_end=911 _REMOVEWEBHOOKRESPONSE._serialized_start=913 _REMOVEWEBHOOKRESPONSE._serialized_end=936 _LISTWEBHOOKSREQUEST._serialized_start=938 _LISTWEBHOOKSREQUEST._serialized_end=1023 _LISTWEBHOOKSRESPONSE._serialized_start=1025 _LISTWEBHOOKSRESPONSE._serialized_end=1110 _WEBHOOKINFO._serialized_start=1112 _WEBHOOKINFO._serialized_end=1200 _NOTIFICATIONSERVICE._serialized_start=1203 _NOTIFICATIONSERVICE._serialized_end=1730 # @@protoc_insertion_point(module_scope)
69.264286
2,806
0.837785
1,003
9,697
7.793619
0.21336
0.076756
0.039913
0.033773
0.258795
0.200972
0.195088
0.195088
0.175387
0.164641
0
0.066985
0.050119
9,697
139
2,807
69.76259
0.781674
0.108075
0
0.215686
1
0.04902
0.369958
0.31166
0
0
0
0
0
1
0
false
0
0.058824
0
0.058824
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
f6c9dda278d27fd68dd586fa55c38b237c03e8a2
1,697
py
Python
tests/conftest.py
numberly/flask-stupe
1aabda272d84c0f651c6302cb5eefe11c46567ef
[ "MIT" ]
35
2018-03-23T08:51:51.000Z
2020-08-24T05:18:55.000Z
tests/conftest.py
numberly/flask-stupe
1aabda272d84c0f651c6302cb5eefe11c46567ef
[ "MIT" ]
25
2018-03-23T08:59:04.000Z
2020-01-03T10:22:45.000Z
tests/conftest.py
numberly/flask-stupe
1aabda272d84c0f651c6302cb5eefe11c46567ef
[ "MIT" ]
5
2018-04-02T08:43:58.000Z
2019-09-29T15:54:21.000Z
import json import os import pymongo import pytest from flask_stupe.app import Stupeflask @pytest.fixture def app(): return Stupeflask(__name__) @pytest.fixture def client(app): return app.test_client() # ramnes: shamelessly stolen from Flask # https://github.com/pallets/flask/blob/0.12.1/tests/conftest.py#L18-L23 @pytest.fixture def test_apps(monkeypatch): monkeypatch.syspath_prepend( os.path.abspath(os.path.join( os.path.dirname(__file__), "test_apps") ) ) # ramnes: we're just inheriting from pymongo.cursor.Cursor so that paginate can # understand it's not a function to decorate class Cursor(pymongo.cursor.Cursor): def __init__(self, data): self.data = data def __del__(self): pass def skip(self, skip): del self.data[:skip] return self.data def limit(self, limit): del self.data[limit:] return self.data def sort(self, sort): self.sort_data = sort for sort_key, order in reversed(sort): def get_key(d): if hasattr(self, "collation_data"): return d.get(sort_key, 0).lower() return d.get(sort_key, 0) self.data = sorted(self.data, key=get_key) if order == -1: self.data.reverse() return self.data def collation(self, collation): self.collation_data = collation return self.sort(self.sort_data) def count(self): return len(self.data) def clone(self): return Cursor(self.data) def response_to_dict(response): data = response.get_data() return json.loads(data.decode("utf-8"))
22.038961
79
0.626989
227
1,697
4.54185
0.39207
0.093113
0.053346
0.049467
0.073715
0.034918
0
0
0
0
0
0.009646
0.266942
1,697
76
80
22.328947
0.819132
0.134355
0
0.12
0
0
0.019139
0
0
0
0
0
0
1
0.26
false
0.02
0.1
0.08
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
0
0
0
1
0
0
2
f6cd9ac1cc5a21efbc20f5274450636986c1aaf8
1,009
py
Python
tests/test_pomo.py
kthy/wren
62e9439ea82a1d984f07fa8cd00421e0e640196f
[ "MIT" ]
1
2021-06-04T07:15:02.000Z
2021-06-04T07:15:02.000Z
tests/test_pomo.py
kthy/wren
62e9439ea82a1d984f07fa8cd00421e0e640196f
[ "MIT" ]
9
2021-02-20T22:33:05.000Z
2021-04-12T17:35:48.000Z
tests/test_pomo.py
pyxy-dk/wren
62e9439ea82a1d984f07fa8cd00421e0e640196f
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Test the gettext manipulation methods.""" from os import remove from os.path import exists from fixtures import fixture_wowsdir # pylint: disable=unused-import from wren.pomo import backup_original_mo, restore_original_mo LC = "res/texts/en/LC_MESSAGES" def test_backup_original_mo(wowsdir): """Test the backup_original_mo method.""" assert exists(wowsdir) assert exists(f"{wowsdir}/{LC}/global.mo") assert not exists(f"{wowsdir}/{LC}/global.mo.original") backup_original_mo(wowsdir, "en") assert exists(f"{wowsdir}/{LC}/global.mo") assert exists(f"{wowsdir}/{LC}/global.mo.original") def test_restore_original_mo(wowsdir): """Test the restore_original_mo method""" assert not exists(f"{wowsdir}/{LC}/global.mo.original") backup_original_mo(wowsdir, "en") remove(f"{wowsdir}/{LC}/global.mo") assert not exists(f"{wowsdir}/{LC}/global.mo") restore_original_mo(wowsdir, "en") assert exists(f"{wowsdir}/{LC}/global.mo")
31.53125
69
0.710605
145
1,009
4.793103
0.255172
0.129496
0.115108
0.184173
0.543885
0.47482
0.47482
0.428777
0.402878
0.402878
0
0.001145
0.134787
1,009
31
70
32.548387
0.79496
0.161546
0
0.368421
0
0
0.300362
0.293124
0
0
0
0
0.421053
1
0.105263
false
0
0.210526
0
0.315789
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
1
0
0
0
0
0
0
0
0
0
2
f6e26515d61da611c29ef2926475fb41d2b6ada2
235
py
Python
map.py
ounes/Projet-tfidf-python
72ced47ecdc9ff2c4e70ae8c40aed1c39e30e8d5
[ "Apache-2.0" ]
null
null
null
map.py
ounes/Projet-tfidf-python
72ced47ecdc9ff2c4e70ae8c40aed1c39e30e8d5
[ "Apache-2.0" ]
null
null
null
map.py
ounes/Projet-tfidf-python
72ced47ecdc9ff2c4e70ae8c40aed1c39e30e8d5
[ "Apache-2.0" ]
null
null
null
import sys, re, os for line in sys.stdin: line = line.strip() line = re.sub('[^a-z]',' ',line) customKey, count = line.split('\t',1) word, filename = customKey.split(';',1) print '%s;%s\t%s' % (filename,word,count)
29.375
45
0.578723
37
235
3.675676
0.567568
0
0
0
0
0
0
0
0
0
0
0.010638
0.2
235
8
45
29.375
0.712766
0
0
0
0
0
0.080508
0
0
0
0
0
0
0
null
null
0
0.142857
null
null
0.142857
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
1
0
0
0
0
0
0
0
0
2
f6ea07c272d03f414c134fd912535ed38569aaea
853
py
Python
python/tvm/autotvm/task/__init__.py
weberlo/tvm
e4b9f986dab8c48ba109a52106565fc4be6b67c4
[ "Apache-2.0" ]
2
2020-06-24T03:16:34.000Z
2020-06-24T03:16:36.000Z
python/tvm/autotvm/task/__init__.py
ganzhiliang/tvm
b076cad542524cb3744149d953c341b5815f6474
[ "Apache-2.0" ]
4
2020-12-04T21:00:38.000Z
2022-01-22T12:49:30.000Z
python/tvm/autotvm/task/__init__.py
ganzhiliang/tvm
b076cad542524cb3744149d953c341b5815f6474
[ "Apache-2.0" ]
1
2019-09-20T07:05:27.000Z
2019-09-20T07:05:27.000Z
"""Task is a tunable composition of template functions. Tuner takes a tunable task and optimizes the joint configuration space of all the template functions in the task. This module defines the task data structure, as well as a collection(zoo) of typical tasks of interest. """ from .task import Task, create, register, template, get_config, args_to_workload from .space import ConfigSpace, ConfigEntity from .code_hash import attach_code_hash, attach_code_hash_to_arg from .dispatcher import dispatcher, DispatchContext, ApplyConfig, ApplyHistoryBest, \ FallbackContext, clear_fallback_cache, ApplyGraphBest from .topi_integration import register_topi_compute, register_topi_schedule from .nnvm_integration import extract_from_graph, extract_from_multiple_graph from .relay_integration import extract_from_program, extract_from_multiple_program
47.388889
85
0.84408
118
853
5.855932
0.542373
0.063676
0.040521
0.081042
0
0
0
0
0
0
0
0
0.113716
853
17
86
50.176471
0.914021
0.317702
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.875
0
0.875
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
f6f53663eccbe089a4826a98587556015e23f911
2,382
py
Python
glimslib/simulation_helpers/math_linear_elasticity.py
danielabler/glimslib
3d345bf3ed2d364e83a00ad9297dd5f81d7193db
[ "MIT" ]
null
null
null
glimslib/simulation_helpers/math_linear_elasticity.py
danielabler/glimslib
3d345bf3ed2d364e83a00ad9297dd5f81d7193db
[ "MIT" ]
5
2019-01-05T01:38:05.000Z
2019-06-03T16:49:27.000Z
glimslib/simulation_helpers/math_linear_elasticity.py
danielabler/glimslib
3d345bf3ed2d364e83a00ad9297dd5f81d7193db
[ "MIT" ]
3
2019-12-28T16:01:48.000Z
2022-01-20T08:44:01.000Z
from ufl import Identity from glimslib.fenics_local import * # -- youngs modulus, poisson ration -> mu, lambda def compute_mu(young_modulus, poisson_ratio): return young_modulus / (2.0 * (1.0 + poisson_ratio)) def compute_lambda(young_modulus, poisson_ratio): return young_modulus * poisson_ratio / ((1.0 + poisson_ratio) * (1.0 - 2.0 * poisson_ratio)) def compute_strain(displacement): return sym(grad(displacement)) def compute_stress(displacement, mu, lmbda): return 2.0 * mu * compute_strain(displacement) + \ lmbda * tr(compute_strain(displacement)) * Identity(len(displacement)) def compute_pressure_from_stress_tensor(stress_tensor): pressure = 1.0/3.0*tr(stress_tensor) return pressure def u_norm(u): return inner(u,u)**0.5 def compute_total_jacobian(displacement): return det(Identity(len(displacement)) + grad(displacement)) def compute_growth_induced_jacobian(growth_induced_strain, dim): return det(Identity(dim) + growth_induced_strain) def compute_growth_induced_strain(conc_field, coupling_constant, dim): return conc_field * coupling_constant * Identity(dim) def compute_deviatoric_stress_tensor(stress_tensor, dim): return stress_tensor - (1. / 3.) * tr(stress_tensor) * Identity(dim) def compute_van_mises_stress(stress_tensor, dim): dev_stress = compute_deviatoric_stress_tensor(stress_tensor, dim) return sqrt(3. / 2. * inner(dev_stress, dev_stress)) def first_invariant(self, tensor): """ First invariant is trace of tensor. """ return tr(tensor) def second_invariant(self, tensor): """ Second invariant is 1/2*( trace(T)^2 - trace(T^2) ) """ return 0.5*(tr(tensor)*tr(tensor) - tr(tensor*tensor)) def third_invariant(self, tensor): """ Third invariant is determinant """ return det(tensor) def compute_eigenvalues(self, tensor): """ check example https://fenicsproject.org/olddocs/dolfin/1.3.0/python/demo/documented/eigenvalue/python/documentation.html """ pass def compute_concentration_deformed(concentration, displacement, coupling_constant, dim): jac_total = compute_total_jacobian(displacement) strain_growth = compute_growth_induced_strain(concentration, coupling_constant, dim) jac_growth = compute_growth_induced_jacobian(strain_growth, dim) return concentration * jac_growth / jac_total
33.549296
110
0.739715
314
2,382
5.359873
0.251592
0.071301
0.047534
0.042781
0.136661
0.109329
0.109329
0.059418
0
0
0
0.015354
0.152393
2,382
71
111
33.549296
0.818227
0.120907
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0.025
0.05
0.225
0.825
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
100e3d433e6cbc6076926ab92453b0bbfb814e23
382
py
Python
rn/validation.py
vikneswaran20/rn
33e0bfaf58bb8a5ec54c6d010035693b35e9909d
[ "BSD-3-Clause" ]
null
null
null
rn/validation.py
vikneswaran20/rn
33e0bfaf58bb8a5ec54c6d010035693b35e9909d
[ "BSD-3-Clause" ]
null
null
null
rn/validation.py
vikneswaran20/rn
33e0bfaf58bb8a5ec54c6d010035693b35e9909d
[ "BSD-3-Clause" ]
null
null
null
import click def validate_range(ctx, param, value): if value[0] >= value[1]: raise click.BadParameter('The given lower range should be lesser than upper range') return value def validate_precision(ctx, param, value): if value is not None and value > 10: raise click.BadParameter('The precision should be less than or equal to 10') return value
23.875
91
0.696335
57
382
4.631579
0.561404
0.083333
0.098485
0.113636
0.151515
0
0
0
0
0
0
0.020339
0.227749
382
15
92
25.466667
0.874576
0
0
0.222222
0
0
0.269634
0
0
0
0
0
0
1
0.222222
false
0
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
1
0
0
0
0
1
0
0
2
63daadf022a06c37f29fd2363e0a6d21e5f70146
2,164
py
Python
leetcode/license_Key_Formatting.py
Aithosa/Notes
c20f2b96af498571e08cd71ce4a0fde8b8cf772c
[ "MIT" ]
3
2018-12-25T13:34:27.000Z
2019-10-03T05:02:18.000Z
leetcode/license_Key_Formatting.py
YellingF/Notes
8da93d406b71345cca11159e41ef4111107dd73d
[ "MIT" ]
null
null
null
leetcode/license_Key_Formatting.py
YellingF/Notes
8da93d406b71345cca11159e41ef4111107dd73d
[ "MIT" ]
1
2018-11-25T22:48:31.000Z
2018-11-25T22:48:31.000Z
# 我的,无法全通过 class Solution: def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ lists = [] s = '' for ele in S: if ele.isalnum(): lists.append(ele.upper()) for _ in lists: count = K while(count > 0): s += lists.pop() count -= 1 if count == 0: s += '-' if s[-1] == '-': s = s[:len(s)-1] return s[::-1] # 找到的答案 class Solution: def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ formatted = [] key = S.replace('-', '').upper() i = len(key) - K while(i>=0): formatted.append(key[i:i+K]) i -= K if i != -K: formatted.append(key[:i+K]) return '-'.join(formatted[::-1]) # 同等级 class Solution: def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ a_s = ''.join(S.upper().split('-')) length = len(a_s) r = [] first = length % K if length %K != 0 else K r.append(a_s[:first]) for i in range(first, length, K): r.append(a_s[i:i+K]) return '-'.join(r) # 依次快 class Solution: def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ S=S.replace('-','').upper() if len(S)%K: S='#'*(K-len(S)%K)+S return '-'.join(S[x:x+K] for x in range(0,len(S),K)).replace('#','') class Solution: def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ a_s = ''.join(S.upper().split('-')) length = len(a_s) r = [] first = length % K if length %K != 0 else K r.append(a_s[:first]) for i in range(first, length, K): r.append(a_s[i:i+K]) return '-'.join(r)
23.521739
76
0.406192
266
2,164
3.270677
0.165414
0.02069
0.091954
0.206897
0.645977
0.645977
0.645977
0.645977
0.645977
0.645977
0
0.00885
0.425601
2,164
92
77
23.521739
0.69107
0.098429
0
0.481481
0
0
0.006845
0
0
0
0
0
0
1
0.092593
false
0
0
0
0.277778
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
63dedcd1205110627eb557af3fdccee54ae8fa10
2,772
py
Python
videodata.py
AkBKukU/DemonetizationDetection
d98eb651d377f78228ef20e7d47d8dd0b53e948f
[ "MIT" ]
9
2018-02-06T20:09:48.000Z
2021-07-23T14:46:08.000Z
videodata.py
AkBKukU/DemonetizationDetection
d98eb651d377f78228ef20e7d47d8dd0b53e948f
[ "MIT" ]
null
null
null
videodata.py
AkBKukU/DemonetizationDetection
d98eb651d377f78228ef20e7d47d8dd0b53e948f
[ "MIT" ]
3
2018-02-16T01:55:32.000Z
2019-05-26T12:05:18.000Z
#!/usr/bin/python class VideoData(object): percent_confidence_limit = 25 def __init__(self): # Standard Data self._video_id = None self._title = None self._description = None self._published = None # Metrics self._date_start = None self._date_end = None self._views = None self._monetizedPlaybacks = None self._estimatedRevenue = None self._estimatedMinutesWatched = None self._percent = None self._percent_confidence = None @property def id(self): return self._video_id @id.setter def id(self, value): self._video_id = value @property def title(self): return self._title @title.setter def title(self, value): self._title = value @property def description(self): return self._description @description.setter def description(self, value): self._descrioption = value @property def published(self): return self._published @published.setter def published(self, value): self._published = value @property def date_start(self): return self._date_start @date_start.setter def date_start(self, value): self._date_start = value @property def date_end(self): return self._date_end @date_end.setter def date_end(self, value): self._date_end = value @property def views(self): return self._views @views.setter def views(self, value): self._views = value @property def monetizedPlaybacks(self): return self._monetizedPlaybacks @monetizedPlaybacks.setter def monetizedPlaybacks(self, value): self._monetizedPlaybacks = value @property def estimatedRevenue(self): return self._estimatedRevenue @estimatedRevenue.setter def estimatedRevenue(self, value): self._estimatedRevenue = value @property def estimatedMinutesWatched(self): return self._estimatedMinutesWatched @estimatedMinutesWatched.setter def estimatedMinutesWatched(self, value): self._estimatedMinutesWatched = value @property def percent(self): if self._percent is None and self.views > 0: self._percent = self._monetizedPlaybacks / self._views self._percent_confidence = self._views / \ self.percent_confidence_limit else: self._percent = 0 self._percent_confidence = 0 return self._percent @percent.setter def percent(self, value): return self._percent @property def percent_confidence(self): return self._percent_confidence
22.176
66
0.634199
285
2,772
5.919298
0.136842
0.07706
0.091286
0.023711
0.035566
0
0
0
0
0
0
0.002547
0.291847
2,772
124
67
22.354839
0.856852
0.013709
0
0.153846
0
0
0
0
0
0
0
0
0
1
0.263736
false
0
0
0.131868
0.428571
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
63e836bbde06a603311afde96eeb49e33bb3127f
585
py
Python
RPi.GPIO_BP/test/event_detect.py
k0staa/ProjectRobot
5dc897a6e3890f5b025c93abb6bf8a3748f4da04
[ "Unlicense", "MIT" ]
null
null
null
RPi.GPIO_BP/test/event_detect.py
k0staa/ProjectRobot
5dc897a6e3890f5b025c93abb6bf8a3748f4da04
[ "Unlicense", "MIT" ]
null
null
null
RPi.GPIO_BP/test/event_detect.py
k0staa/ProjectRobot
5dc897a6e3890f5b025c93abb6bf8a3748f4da04
[ "Unlicense", "MIT" ]
null
null
null
#!/usr/bin/env python import RPi.GPIO as GPIO import time from threading import Timer SWITCH_PIN = 10 GPIO.setmode(GPIO.BOARD) GPIO.setup(SWITCH_PIN,GPIO.IN,GPIO.PUD_DOWN) print "\n value_%d = %d\n" %(SWITCH_PIN,GPIO.input(SWITCH_PIN)) GPIO.add_event_detect(SWITCH_PIN, GPIO.RISING,bouncetime=200) # add rising edge detection on a channel switchcount = 0 while switchcount < 2: if GPIO.event_detected(SWITCH_PIN): switchcount += 1 print 'Button pressed',switchcount print "\n value_%d = %d\n" %(SWITCH_PIN,GPIO.input(SWITCH_PIN)) GPIO.remove_event_detect(SWITCH_PIN)
26.590909
103
0.757265
95
585
4.484211
0.494737
0.190141
0.183099
0.056338
0.211268
0.211268
0.211268
0.211268
0.211268
0.211268
0
0.015625
0.124786
585
21
104
27.857143
0.816406
0.100855
0
0.133333
0
0
0.09542
0
0
0
0
0
0
0
null
null
0
0.2
null
null
0.2
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
63fb0573aee01557133f9033806f06f48ca4f117
324
py
Python
Curso Python/Mundo 1/Modulo3/Desafios/Desafio2/des022.py
catabimbas/Curso-Python
72549952db77fa9b0ea3746b83f94592e3fdeb30
[ "MIT" ]
null
null
null
Curso Python/Mundo 1/Modulo3/Desafios/Desafio2/des022.py
catabimbas/Curso-Python
72549952db77fa9b0ea3746b83f94592e3fdeb30
[ "MIT" ]
null
null
null
Curso Python/Mundo 1/Modulo3/Desafios/Desafio2/des022.py
catabimbas/Curso-Python
72549952db77fa9b0ea3746b83f94592e3fdeb30
[ "MIT" ]
null
null
null
nome = str(input('Digite o seu nome completo: ')) nomelista = nome.split() print('O nome em maiúscula: {}'.format(nome.upper())) print('O nome em minúscula: {}'.format(nome.lower())) print('O total de letras são {} letras'.format(len(nome.replace(' ', '')))) print('O primeiro nome tem {} letras'.format(len(nomelista[0])))
46.285714
75
0.67284
48
324
4.541667
0.520833
0.110092
0.091743
0.110092
0
0
0
0
0
0
0
0.003472
0.111111
324
6
76
54
0.753472
0
0
0
0
0
0.416667
0
0
0
0
0
0
1
0
false
0
0
0
0
0.666667
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
0
0
0
1
0
2
12041bb4c8c172c7a8516ee1a933b53c4a56bca9
129
py
Python
pycoview/__init__.py
suddensleep/pycoview
997b8b6b061c31b998ee3715930102df37b1b5f1
[ "MIT" ]
null
null
null
pycoview/__init__.py
suddensleep/pycoview
997b8b6b061c31b998ee3715930102df37b1b5f1
[ "MIT" ]
null
null
null
pycoview/__init__.py
suddensleep/pycoview
997b8b6b061c31b998ee3715930102df37b1b5f1
[ "MIT" ]
null
null
null
"""Top-level package for pycoview.""" __author__ = """John Gilling""" __email__ = 'suddensleep@gmail.com' __version__ = '0.1.0'
21.5
37
0.689922
16
129
4.8125
0.9375
0
0
0
0
0
0
0
0
0
0
0.026316
0.116279
129
5
38
25.8
0.649123
0.24031
0
0
0
0
0.413043
0.228261
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1207c12108cc05c8f3dbe01109afe217669399f0
199
py
Python
BaekJoon Online Judge/step/3-For-Loop/[15553] fast_A_plus_B.py
TyeolRik/CodingProblems
5dcc371eb0f47d3ee2638416516aa7733555f088
[ "MIT" ]
null
null
null
BaekJoon Online Judge/step/3-For-Loop/[15553] fast_A_plus_B.py
TyeolRik/CodingProblems
5dcc371eb0f47d3ee2638416516aa7733555f088
[ "MIT" ]
null
null
null
BaekJoon Online Judge/step/3-For-Loop/[15553] fast_A_plus_B.py
TyeolRik/CodingProblems
5dcc371eb0f47d3ee2638416516aa7733555f088
[ "MIT" ]
null
null
null
# https://www.acmicpc.net/problem/15552 import sys a = int(sys.stdin.readline().rstrip()) b = [] for i in range(a): b.append(sys.stdin.readline().split()) print(int(b[i][0]) + int(b[i][1]))
22.111111
42
0.61809
35
199
3.514286
0.657143
0.130081
0.260163
0
0
0
0
0
0
0
0
0.040698
0.135678
199
9
43
22.111111
0.674419
0.18593
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.166667
0
0
0
null
0
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
2
1234411ca64cf9aa5a9e159d0684f9681511df22
2,100
py
Python
NeuralNetwork.py
Aklaran/neural-net-playground
44651b95b863ef3cd9dca41a60c09554f9ec1b41
[ "MIT" ]
null
null
null
NeuralNetwork.py
Aklaran/neural-net-playground
44651b95b863ef3cd9dca41a60c09554f9ec1b41
[ "MIT" ]
null
null
null
NeuralNetwork.py
Aklaran/neural-net-playground
44651b95b863ef3cd9dca41a60c09554f9ec1b41
[ "MIT" ]
null
null
null
import numpy as np class NeuralNetwork: def __init__(self, layerSizes): # shape of each weight matrix, which correspond to the relative sizes of # the adjacent layers which the weights connect weightShapes = [(height, width) for height, width in zip(layerSizes[1:],layerSizes[:-1])] # Weights determine the slope of each decision boundary. # list containing the actual weights of each neural connection # initialized as random numbers in a normal distribution, # divided by the square of the size of the layer to normalize for large layer sizes. # Normalization is done to ensure the inputs correspond to large slopes in activation function. # Large slopes means the network will learn faster (not sure why) # These weights will change as the network discovers the correct function. self.weights = [np.random.standard_normal(shape)/shape[1]**.5 for shape in weightShapes] # Biases allow translation of decision boundaries. # Must be added in every layer except input layer, # stored as a column vector of the same size as the layer. # initialized to a zero vector self.biases = [np.zeros((size,1)) for size in layerSizes[1:]] # feed the input through the network # output the networks perdictions def predict(self, activation): # iterate through each layer as represented by the weight connections between layers # and associated biases for weight, bias in zip(self.weights, self.biases): # calculate the activation for this layer by multiplying the current weight matrix # by the previous activation and adding the bias. # At first iteration, activation is just the inputs. activation = self.activation(np.matmul(weight, activation) + bias) return activation # activation function, which allows the network to make non-linear decision boundaries. @staticmethod def activation(x): # returns a simple sigmoid function return 1/(1+np.exp(-x))
51.219512
103
0.689524
278
2,100
5.190647
0.456835
0.01386
0
0
0
0
0
0
0
0
0
0.005102
0.253333
2,100
41
104
51.219512
0.915179
0.6
0
0
0
0
0
0
0
0
0
0
0
1
0.230769
false
0
0.076923
0.076923
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
12384056a6bce1e3a5c37dd793fed23971e30a14
463
py
Python
todo/models.py
arthtyagi/gettit
26047f85a7cf0a5f380cde4e18f9bcc88bb27db6
[ "MIT" ]
6
2020-05-30T18:10:08.000Z
2021-11-30T14:39:41.000Z
todo/models.py
arthtyagi/gettit
26047f85a7cf0a5f380cde4e18f9bcc88bb27db6
[ "MIT" ]
18
2020-06-21T12:04:47.000Z
2022-01-13T02:57:16.000Z
todo/models.py
arthtyagi/gettit
26047f85a7cf0a5f380cde4e18f9bcc88bb27db6
[ "MIT" ]
1
2020-08-30T01:42:54.000Z
2020-08-30T01:42:54.000Z
from django.db import models from django.urls import reverse from django.contrib.auth.models import User class Todo(models.Model): title = models.CharField(max_length=30) user = models.ForeignKey(User, on_delete=models.CASCADE) content= models.CharField(max_length=450,blank=True) created = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title def get_absolute_url(self): return reverse('todo:detail', kwargs={'pk': self.pk})
28.9375
57
0.779698
69
463
5.072464
0.594203
0.085714
0.102857
0.137143
0
0
0
0
0
0
0
0.012077
0.105832
463
15
58
30.866667
0.833333
0
0
0
0
0
0.028078
0
0
0
0
0
0
1
0.166667
false
0
0.25
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
0
1
1
0
0
2