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
97678f96eb58a15cf993ddeb3a83d03e026f412c
1,035
py
Python
nfv/nfv-vim/nfv_vim/tables/_system_table.py
SidneyAn/nfv
5f0262a5b6ea4be59f977b9c587c483cbe0e373d
[ "Apache-2.0" ]
2
2020-02-07T19:01:36.000Z
2022-02-23T01:41:46.000Z
nfv/nfv-vim/nfv_vim/tables/_system_table.py
SidneyAn/nfv
5f0262a5b6ea4be59f977b9c587c483cbe0e373d
[ "Apache-2.0" ]
1
2021-01-14T12:02:25.000Z
2021-01-14T12:02:25.000Z
nfv/nfv-vim/nfv_vim/tables/_system_table.py
SidneyAn/nfv
5f0262a5b6ea4be59f977b9c587c483cbe0e373d
[ "Apache-2.0" ]
2
2021-01-13T08:39:21.000Z
2022-02-09T00:21:55.000Z
# # Copyright (c) 2015-2016 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # from nfv_vim import database from nfv_vim.tables._table import Table _system_table = None class SystemTable(Table): """ System Table """ def __init__(self): super(SystemTable, self).__init__() def _persist_value(self, value): database.database_system_add(value) def _unpersist_value(self, key): database.database_system_delete(key) def tables_get_system_table(): """ Get the system table """ return _system_table def system_table_initialize(): """ Initialize the system table """ global _system_table _system_table = SystemTable() _system_table.persist = False systems = database.database_system_get_list() for system in systems: _system_table[system.name] = system _system_table.persist = True def system_table_finalize(): """ Finalize the system table """ global _system_table del _system_table
18.482143
50
0.681159
124
1,035
5.306452
0.387097
0.267477
0.072948
0.06079
0.094225
0.094225
0
0
0
0
0
0.012531
0.228986
1,035
55
51
18.818182
0.81203
0.16715
0
0.086957
0
0
0
0
0
0
0
0
0
1
0.26087
false
0
0.086957
0
0.434783
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
976b9e3b867f145ea3e26423273854ab636a3e4a
439
py
Python
cs_131b/0_week/absolutely_nothing.py
kimberleejohnson/python-study
5dc08007a1bc18c91e32879a0e9d5cad1bd1cdd3
[ "MIT" ]
null
null
null
cs_131b/0_week/absolutely_nothing.py
kimberleejohnson/python-study
5dc08007a1bc18c91e32879a0e9d5cad1bd1cdd3
[ "MIT" ]
null
null
null
cs_131b/0_week/absolutely_nothing.py
kimberleejohnson/python-study
5dc08007a1bc18c91e32879a0e9d5cad1bd1cdd3
[ "MIT" ]
null
null
null
# This is a comment! ''' This isn't technically a comment, but no program can execute between the quotes, and it's fun! ''' """ Same goes here! """ # I am so excited for everything we will learn in this course. # 🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍 # To any of my fellow peers reading this, have you heard of pyLadies? # There's a Slack channel and a former meetup group in SF. # It doesn't look like much is happening now, but study groups would be great!
29.266667
79
0.694761
78
439
4.051282
0.807692
0.050633
0
0
0
0
0
0
0
0
0
0
0.205011
439
15
79
29.266667
0.873926
0.897494
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
976c2348978bef6fa8d0df120008584e26b09a77
147
py
Python
model/Cart.py
crippledfaith/shop
fb6a520170968e9f90d4d70c3f6a4e793b105e84
[ "Apache-2.0" ]
null
null
null
model/Cart.py
crippledfaith/shop
fb6a520170968e9f90d4d70c3f6a4e793b105e84
[ "Apache-2.0" ]
null
null
null
model/Cart.py
crippledfaith/shop
fb6a520170968e9f90d4d70c3f6a4e793b105e84
[ "Apache-2.0" ]
null
null
null
from model.BaseModel import BaseModel class Cart(BaseModel): def __init__(self): super().__init__() self.sale_id = ""
13.363636
37
0.612245
16
147
5.0625
0.75
0.197531
0
0
0
0
0
0
0
0
0
0
0.278912
147
10
38
14.7
0.764151
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
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
0
1
0
0
2
9776f381f2c7798d4b5d09f824b6a26772926a6e
670
py
Python
python_codes/rot13.py
RudranshPratapSingh/my-other-codes
a6450820fd20d0700aee310af00bafb959534de2
[ "MIT" ]
1
2020-12-02T04:01:34.000Z
2020-12-02T04:01:34.000Z
python_codes/rot13.py
RudranshPratapSingh/my-other-codes
a6450820fd20d0700aee310af00bafb959534de2
[ "MIT" ]
null
null
null
python_codes/rot13.py
RudranshPratapSingh/my-other-codes
a6450820fd20d0700aee310af00bafb959534de2
[ "MIT" ]
null
null
null
# coded in python3 # video : text = input("Enter your text : ") check = True etext = "" for chars in text: if(ord(chars)) <= 90 and ord(chars) <= 65: if((ord(chars) + 13) > 90): x = 64 + ((ord(chars) + 13) - 90) else: x = ord(chars) + 13 elif(ord(chars) <= 122 and ord(chars) >= 97): if (ord(chars) + 13 > 122): x = 96 + ((ord(chars) + 13) - 122) else: x = ord(chars) + 13 elif(ord(chars) == 32): x = 32 else: check = False break etext = str(etext) + chr(x) if(check == False): print("Invalid Characters found") else: print(etext)
23.103448
49
0.474627
89
670
3.573034
0.393258
0.27673
0.188679
0.075472
0.169811
0.169811
0.169811
0.169811
0
0
0
0.093458
0.361194
670
28
50
23.928571
0.649533
0.038806
0
0.25
0
0
0.065728
0
0
0
0
0
0
1
0
false
0
0
0
0
0.083333
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
97838cc2b02b373e081b58cb4a569d120be2e4d5
563
py
Python
src/utilities/calibrator/pic16f15356_device_information_area.py
pete-restall/Cluck2Sesame
4a2e749d3e94178fb96501d92d3008cae0a07005
[ "MIT" ]
2
2016-10-04T05:13:22.000Z
2017-11-18T12:07:31.000Z
src/utilities/calibrator/pic16f15356_device_information_area.py
pete-restall/Cluck2Sesame
4a2e749d3e94178fb96501d92d3008cae0a07005
[ "MIT" ]
null
null
null
src/utilities/calibrator/pic16f15356_device_information_area.py
pete-restall/Cluck2Sesame
4a2e749d3e94178fb96501d92d3008cae0a07005
[ "MIT" ]
null
null
null
class Pic16f15356DeviceInformationArea: def __init__(self, address, dia): if len(dia) != 32: raise ValueError('dia', f'PIC16F15356 DIA is 32 words but received {len(dia)} words') self._address = address self._raw = dia.copy() self._device_id = ''.join(['{:04x}'.format(id_byte) for id_byte in dia[0x00:0x09]]) self._fvra2x = dia[0x19] @property def address(self): return self._address @property def raw(self): return self._raw.copy() @property def device_id(self): return self._device_id @property def fvra2x(self): return self._fvra2x
25.590909
88
0.715808
82
563
4.707317
0.414634
0.11399
0.145078
0
0
0
0
0
0
0
0
0.066806
0.149201
563
21
89
26.809524
0.73904
0
0
0.25
0
0
0.117229
0
0
0
0.021314
0
0
1
0.3125
false
0
0
0.25
0.375
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
9785df24cb1e33cbd743f136da97162effcf2bc0
5,409
py
Python
tomso/utils.py
warrickball/tomso
842c4287a827c252ef0b25f443370ab71900c77a
[ "MIT" ]
3
2018-09-26T10:32:46.000Z
2021-07-16T09:59:55.000Z
tomso/utils.py
warrickball/tomso
842c4287a827c252ef0b25f443370ab71900c77a
[ "MIT" ]
2
2018-09-26T11:32:46.000Z
2020-12-11T13:13:37.000Z
tomso/utils.py
warrickball/tomso
842c4287a827c252ef0b25f443370ab71900c77a
[ "MIT" ]
2
2018-12-11T14:32:49.000Z
2021-04-07T06:03:01.000Z
"""Utility functions used by other modules.""" import numpy as np import gzip from .constants import sigma_SB from .constants import GMsun, Rsun, Dnu_sun # adiabatic from .constants import Lsun, nu_max_sun, Teff_sun # full def integrate(y, x): """Integral of `y` over `x`, computed using the trapezoidal rule. i.e. :math:`\\int _{x[0]} ^x y(x') dx'`.""" dz = 0.5*(y[1:]+y[:-1])*np.diff(x) return np.hstack((0., np.cumsum(dz))) def complement(y, x): """Complement of integral of `y` over `x`, computed using the trapezoidal rule. i.e. :math:`\\int _x^{x[-1]}y(x') dx'`.""" z = integrate(y, x) return z[-1] - z def regularize(y0=0.0, x0=1e-12): def regularizer(f): def regularized_f(s): with np.errstate(divide='ignore', invalid='ignore'): y = f(s) y[s.x < x0] = y0 return y return regularized_f return regularizer def tomso_open(filename, *args, **kwargs): """Wrapper function to open files ending with `.gz` with built-in `gzip` module or paths starting with `http` using `urllib.request.urlopen`, otherwise use normal open. `.gz` and normal modes take the same arguments as `open` and `gzip.open` and return a file object.""" if filename.startswith('http'): from urllib.request import urlopen return urlopen(filename) elif filename.lower().endswith('.gz'): return gzip.open(filename, *args, **kwargs) else: return open(filename, *args, **kwargs) def load_mesa_gyre(filename, mesa_or_gyre): """Most MESA and GYRE output files both adhere to a similar columned ASCII format, so it makes more sense to have one implementation for reading them, rather than re-implementing it in each submodule. """ with tomso_open(filename, 'rb') as f: lines = f.readlines() if mesa_or_gyre == 'mesa': header = np.genfromtxt(lines[1:3], names=True, dtype=None, encoding='utf-8') elif mesa_or_gyre == 'gyre': # the GYRE header might be empty try: header = np.genfromtxt(lines[2:4], names=True, dtype=None, encoding='utf-8') except IndexError: header = None else: raise ValueError("mesa_or_gyre must be either 'mesa' or 'gyre', not %s" % mesa_or_gyre) data = np.genfromtxt(lines[5:], names=True, dtype=None, encoding='utf-8') return header, data def get_Teff(L, R): """Determine the effective temperature `Teff` for a given luminosity `L` and radius `R`, both in cgs units.""" return (L/(4.*np.pi*R**2*sigma_SB))**0.25 class AdiabaticStellarModel(object): """Base stellar model class that defines properties that are computed the same way in all stellar model formats for which only adiabatic frequencies can be calculated.""" def __str__(self): return '\n'.join([ '%s' % type(self), 'M %9.3e g %7.3f Msun' % (self.M, self.G*self.M/GMsun), 'R %9.3e cm %8.3f Rsun' % (self.R, self.R/Rsun), 'Dnu %9.1f uHz %7.3f Dnu_sun' % (self.Dnu, self.Dnu_factor) ]) @property def Dnu_factor(self): return (self.G*self.M/GMsun/self.R**3*Rsun**3)**0.5 @property def Dnu(self): return self.Dnu_factor*Dnu_sun @property @regularize() def g(self): return self.G*self.m/self.r**2 @property def dP_dr(self): return -self.rho*self.g @property @regularize(y0=np.inf) def Hp(self): return -self.P/self.dP_dr @property @regularize() def drho_dr(self): return -self.rho*(1/self.Gamma_1/self.Hp + self.AA/self.r) @property @regularize(y0=np.inf) def Hrho(self): return -self.rho/self.drho_dr @property def n_eff(self): return 1/(self.Hrho/self.Hp-1) @property def cs2(self): return self.Gamma_1*self.P/self.rho @property def cs(self): return self.cs2**0.5 @property def N(self): y = np.full(len(self.x), 0.) y[self.N2>0] = self.N2[self.N2>0]**0.5 return y @property @regularize(y0=np.inf) def S2_1(self): return 2.*self.cs2/self.r**2 @property def S_1(self): return self.S2_1**0.5 class FullStellarModel(AdiabaticStellarModel): """Base stellar model class that defines properties that are computed the same way in all stellar model formats for which both adiabatic and non-adiabatic frequencies can be calculated.""" def __str__(self): return super(FullStellarModel, self).__str__() + '\n' + \ '\n'.join([ 'L %9.3e erg/s %8.3f Lsun' % (self.L, self.L/Lsun), 'Teff %7i K %7.3f Teff_sun' % (self.Teff, self.Teff/Teff_sun), 'nu_max %7i uHz %7.3f nu_max_sun' % (self.nu_max, self.nu_max_factor)]) @property def Teff(self): return get_Teff(self.L, self.R) @property def nu_max_factor(self): return self.G*self.M/GMsun/(self.R/Rsun)**2/(self.Teff/Teff_sun)**0.5 @property def nu_max(self): return self.nu_max_factor*nu_max_sun @property def Gamma_2(self): return 1.0/(1.0-self.grad_a) @property def Gamma_3(self): return 1. + (1.-1./self.Gamma_2)*self.Gamma_1 @property def grad_r(self): return 3*self.kappa*self.P*self.L_r/(64.*np.pi*sigma_SB*self.G*self.m*self.T**4)
30.559322
102
0.614716
834
5,409
3.894484
0.278177
0.061576
0.051724
0.015394
0.248153
0.20936
0.17734
0.149631
0.149631
0.118227
0
0.025698
0.244592
5,409
176
103
30.732955
0.769212
0.226474
0
0.275229
0
0
0.069414
0
0
0
0
0
0
1
0.266055
false
0
0.055046
0.183486
0.486239
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
97b695eeabd0994b6733d3b9ec23a25579ed1382
896
py
Python
viper/cli.py
curtisma/conda-virtuoso
46c07341432d36436a6a59358ad364b7240b6015
[ "MIT" ]
2
2021-09-19T02:56:04.000Z
2022-03-09T07:30:58.000Z
viper/cli.py
curtisma/conda-virtuoso
46c07341432d36436a6a59358ad364b7240b6015
[ "MIT" ]
13
2021-09-16T05:17:51.000Z
2022-01-25T07:36:08.000Z
viper/cli.py
curtisma/conda-virtuoso
46c07341432d36436a6a59358ad364b7240b6015
[ "MIT" ]
null
null
null
""" Command line interface for viper """ import click from .docs import docs as docs_internal from .cdslib import add_library, include_cdslib @click.group() def virt(): """ Cadence virtuoso command-line utilities """ pass @virt.command() def docs(): docs_internal() @virt.group() def cdslib(): """Edit a *.cdslib file""" pass @cdslib.command() @click.argument("cds_path") @click.argument("library_name") @click.argument("library_path") def add(): """ Add a library """ add_library(cds_path, library_name, library_path) @cdslib.command() @click.argument("cds_path") @click.argument("include_file_path") @click.option('-s','--soft') def include(): """ Include another cds.lib file in the current one. :return: """ include_cdslib(cds_path, include_file_path, soft) if __name__ == '__main__': virt(auto_envvar_prefix='VIRT')
18.666667
53
0.672991
116
896
4.956897
0.37931
0.113043
0.062609
0.090435
0.16
0.16
0.16
0.16
0
0
0
0
0.174107
896
47
54
19.06383
0.777027
0.184152
0
0.230769
0
0
0.115097
0
0
0
0
0
0
1
0.192308
true
0.076923
0.115385
0
0.307692
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
2
97cb288a655f8069b49f38cc90b8e4f6f76f7c17
5,523
py
Python
fastinference/models/nn/Activations.py
njru8cjo/fastinference
a3ea755eb91ea386f4c23a7ed4ddbc4e7a180ade
[ "MIT" ]
11
2021-10-04T14:58:42.000Z
2022-02-24T14:52:11.000Z
fastinference/models/nn/Activations.py
njru8cjo/fastinference
a3ea755eb91ea386f4c23a7ed4ddbc4e7a180ade
[ "MIT" ]
1
2022-02-17T12:49:38.000Z
2022-02-17T12:49:38.000Z
fastinference/models/nn/Activations.py
njru8cjo/fastinference
a3ea755eb91ea386f4c23a7ed4ddbc4e7a180ade
[ "MIT" ]
5
2021-11-03T03:02:07.000Z
2022-02-27T01:21:58.000Z
import numpy as np from .Layer import Layer class Sign(): """Sign Layer f(x) = 1 for x > 0 f(x) = 0 for x = 0 f(x) = -1 for x < 0 Attributes: input_shape = [N, C, H, W]: The shape of the input tensor output_shape = [N, C, H, W]: The shape of the resulting output tensor, must match the input shape """ def __init__(self, graph, node, input_shape): super().__init__(input_shape, input_shape, "sign") # self.input_shape = get_tensor_shape(graph, node.output[0]) # self.output_shape = input_shape # self.name = "sign" class Sigmoid(Layer): """Sigmoid activation f(x) = 1 / (1 + exp(-x)) Attributes: input_shape = [N, C, H, W]: The shape of the input tensor output_shape = [N, C, H, W]: The shape of the resulting output tensor, must match the input shape """ def __init__(self, graph, node, input_shape): super().__init__(input_shape, input_shape, "sigmoid") class Relu(Layer): """Rectified Linear Unit f(x) = max(0, x) Attributes: input_shape = [N, C, H, W]: The shape of the input tensor output_shape = [N, C, H, W]: The shape of the resulting output tensor, must match the input shape """ def __init__(self, graph, node, input_shape): super().__init__(input_shape, input_shape, "relu") class LeakyRelu(Layer): """Leaky Rectified Linear Unit f(x) = alpha * x for x < 0 f(x) = x for x >= 0 Attributes: input_shape = [N, C, H, W]: The shape of the input tensor output_shape = [N, C, H, W]: The shape of the resulting output tensor, must match the input shape alpha: Coefficient of leakage """ def __init__(self, graph, node, input_shape): super().__init__(input_shape, input_shape, "leakyrelu") class Step(Layer): """Step Layer f(x) = high for x > threshold f(x) = high for x = threshold and threshold_is_high f(x) = low for x = threshold and not threshold_is_high f(x) = low for x < threshold This is the Activation Layer in a binary neural net as it has only two distinct outputs (in comparison to the three outputs of Sign Layers). There is no official support for Step Layers in ONNX. To generate a net with Step Layers, use the following ONNX structure: Greater + Where or Less + Where The code generator will convert this into a Step Layer if the binary argument is passed. Example in PyTorch: x = torch.where(x > 0, torch.tensor([1.0]), torch.tensor([-1.0])) When a BatchNormalization Layer follows directly afterwards, the scales and biases are embedded as thresholds of the Step Layer. The following holds since x is an integer: x * s - b > 0 x > int(b / s) The output is directly packed into ints of size binary_word_size. This is done by setting each bit individually. The following sets the c'th leftmost bit to 1 or 0: output |= (1U << ((binary_word_size-1) - c % binary_word_size)) output &= ~(1U << ((binary_word_size-1) - c % binary_word_size)) Attributes: input_shape = [N, C, H, W]: The shape of the input tensor output_shape = [N, C, H, W]: The shape of the resulting output tensor, must match the input shape threshold: The threshold, can be scalar or numpy array low: Value selected at indices where x < threshold high: Value selected at indices where x > threshold threshold_is_high: Whether high value is selected where x = threshold """ def __init__(self, input_shape, threshold, low, high): super().__init__(input_shape, input_shape, "step") self.threshold = threshold self.low = low self.high = high self.threshold_is_high = True # class Softmax(Layer): # """Softmax (normalized exponential) # To combat numerical issues when doing softmax computation, a common trick is used that shifts # the input vector by subtracting the maximum element in it from all elements. # z = x - max(x) # numerator = np.exp(z) # denominator = np.sum(numerator) # softmax = numerator/denominator # Attributes: # output_shape = [N, D]: The dimension of the output tensor # """ # def __init__(self, output_shape): # self.input_shape = self.output_shape = output_shape # def render(self, backend, **kwargs): # code_init = '' # code_alloc = super(Softmax, self).render('alloc', output_shape=self.output_shape, backend=backend, **kwargs) # code_predict = super(Softmax, self).render('softmax', output_size=self.output_shape[1], backend=backend,**kwargs) # return code_init, code_alloc, code_predict # def output_type(self, input_type, backend): # return 'float' class LogSoftmax(Layer): """Log of Softmax To combat numerical issues when doing softmax computation, a common trick is used that shifts the input vector by subtracting the maximum element in it from all elements. z = x - max(x) numerator = np.exp(z) denominator = np.sum(numerator) softmax = numerator/denominator logsoftmax = np.log(softmax) Attributes: output_shape = [N, D]: The dimension of the output tensor """ def __init__(self, graph, node, input_shape): super().__init__(input_shape, input_shape, "logsoftmax")
35.403846
123
0.637335
785
5,523
4.329936
0.219108
0.091203
0.020594
0.023536
0.53604
0.511621
0.488673
0.466902
0.466902
0.447485
0
0.006176
0.267065
5,523
156
124
35.403846
0.833498
0.751584
0
0.208333
0
0
0.035647
0
0
0
0
0
0
1
0.25
false
0
0.083333
0
0.583333
0
0
0
0
null
0
0
0
0
0
0
0
0
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
97cc8129b5e0eaedc29f0145925261bdd49ee464
741
py
Python
runtests.py
vasantharajr/AirMapSDK-Embedded
a1cc41bad46d9dfba98d7d01e04cb54a38987bf8
[ "Apache-2.0" ]
7
2016-10-20T17:50:40.000Z
2021-11-28T00:44:39.000Z
runtests.py
vasantharajr/AirMapSDK-Embedded
a1cc41bad46d9dfba98d7d01e04cb54a38987bf8
[ "Apache-2.0" ]
1
2017-01-31T19:40:35.000Z
2017-01-31T19:40:35.000Z
runtests.py
isabella232/AirMapSDK-Embedded
a1cc41bad46d9dfba98d7d01e04cb54a38987bf8
[ "Apache-2.0" ]
3
2016-12-03T00:17:59.000Z
2021-03-26T12:17:58.000Z
from test.unit import test_access, test_statusapi, test_createflightapi, test_telemetryapi import sys testFail = 0 ret = test_access.test_start() if ret == 1: print "Access Test Failed..." testFail = 1 else: print "Pass: Access Test" ret = test_statusapi.test_start() if ret == 1: print "Status Test Failed..." testFail = 1 else: print "Pass: Status Test" ret = test_createflightapi.test_start() if ret == 1: print "Create Flight Test Failed..." testFail = 1 else: print "Pass: Create Flight Test" ret = test_telemetryapi.test_start() if ret == 1: print "Telemetry Test Failed..." testFail = 1 else: print "Pass: Telemetry Test" if testFail == 0: print "Final: **All Tests Passed**" else: print "Final: **Test Failed**"
19
90
0.708502
107
741
4.794393
0.252336
0.097466
0.08577
0.109162
0.405458
0.405458
0.249513
0
0
0
0
0.016234
0.168691
741
38
91
19.5
0.816558
0
0
0.419355
0
0
0.298246
0
0
0
0
0
0
0
null
null
0.16129
0.064516
null
null
0.322581
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
97ce18707b7c76857b00671bd45426129aeabac5
5,118
py
Python
pyplex/glfw/contants.py
pyplex/pyplex
66e19acb3efd1a8a69d28022edcb0b6ad5cb6b11
[ "MIT" ]
5
2018-01-17T09:08:38.000Z
2020-09-20T20:38:51.000Z
pyplex/glfw/contants.py
pyplex/pyplex
66e19acb3efd1a8a69d28022edcb0b6ad5cb6b11
[ "MIT" ]
null
null
null
pyplex/glfw/contants.py
pyplex/pyplex
66e19acb3efd1a8a69d28022edcb0b6ad5cb6b11
[ "MIT" ]
null
null
null
import enum VERSION_MAJOR = 3 VERSION_MINOR = 2 VERSION_REVISION = 1 FOCUSED = 0x00020001 ICONIFIED = 0x00020002 RESIZABLE = 0x00020003 VISIBLE = 0x00020004 DECORATED = 0x00020005 AUTO_ICONIFY = 0x00020006 FLOATING = 0x00020007 MAXIMIZED = 0x00020008 RED_BITS = 0x00021001 GREEN_BITS = 0x00021002 BLUE_BITS = 0x00021003 ALPHA_BITS = 0x00021004 DEPTH_BITS = 0x00021005 STENCIL_BITS = 0x00021006 ACCUM_RED_BITS = 0x00021007 ACCUM_GREEN_BITS = 0x00021008 ACCUM_BLUE_BITS = 0x00021009 ACCUM_ALPHA_BITS = 0x0002100A AUX_BUFFERS = 0x0002100B STEREO = 0x0002100C SAMPLES = 0x0002100D SRGB_CAPABLE = 0x0002100E REFRESH_RATE = 0x0002100F DOUBLEBUFFER = 0x00021010 CLIENT_API = 0x00022001 CONTEXT_VERSION_MAJOR = 0x00022002 CONTEXT_VERSION_MINOR = 0x00022003 CONTEXT_REVISION = 0x00022004 CONTEXT_ROBUSTNESS = 0x00022005 OPENGL_FORWARD_COMPAT = 0x00022006 OPENGL_DEBUG_CONTEXT = 0x00022007 OPENGL_PROFILE = 0x00022008 CONTEXT_RELEASE_BEHAVIOR = 0x00022009 CONTEXT_NO_ERROR = 0x0002200A CONTEXT_CREATION_API = 0x0002200B NO_API = 0 OPENGL_API = 0x00030001 OPENGL_ES_API = 0x00030002 NO_ROBUSTNESS = 0 NO_RESET_NOTIFICATION = 0x00031001 LOSE_CONTEXT_ON_RESET = 0x00031002 OPENGL_ANY_PROFILE = 0 OPENGL_CORE_PROFILE = 0x00032001 OPENGL_COMPAT_PROFILE = 0x00032002 CURSOR = 0x00033001 STICKY_KEYS = 0x00033002 STICKY_MOUSE_BUTTONS = 0x00033003 ANY_RELEASE_BEHAVIOR = 0 RELEASE_BEHAVIOR_FLUSH = 0x00035001 RELEASE_BEHAVIOR_NONE = 0x00035002 NATIVE_CONTEXT_API = 0x00036001 EGL_CONTEXT_API = 0x00036002 CONNECTED = 0x00040001 DISCONNECTED = 0x00040002 DONT_CARE = -1 class PrettyPrintIntEnum(enum.IntEnum): def __format__(self, format_spec): return self.__str__() class PrettyPrintIntFlag(enum.IntFlag): def __format__(self, format_spec): return self.__str__() class Key(PrettyPrintIntEnum): UNKNOWN = -1 SPACE = 32 APOSTROPHE = 39 COMMA = 44 MINUS = 45 PERIOD = 46 SLASH = 47 D0 = 48 D1 = 49 D2 = 50 D3 = 51 D4 = 52 D5 = 53 D6 = 54 D7 = 55 D8 = 56 D9 = 57 SEMICOLON = 59 EQUAL = 61 A = 65 B = 66 C = 67 D = 68 E = 69 F = 70 G = 71 H = 72 I = 73 J = 74 K = 75 L = 76 M = 77 N = 78 O = 79 P = 80 Q = 81 R = 82 S = 83 T = 84 U = 85 V = 86 W = 87 X = 88 Y = 89 Z = 90 LEFT_BRACKET = 91 BACKSLASH = 92 RIGHT_BRACKET = 93 GRAVE_ACCENT = 96 WORLD_1 = 161 WORLD_2 = 162 ESCAPE = 256 ENTER = 257 TAB = 258 BACKSPACE = 259 INSERT = 260 DELETE = 261 RIGHT = 262 LEFT = 263 DOWN = 264 UP = 265 PAGE_UP = 266 PAGE_DOWN = 267 HOME = 268 END = 269 CAPS_LOCK = 280 SCROLL_LOCK = 281 NUM_LOCK = 282 PRINT_SCREEN = 283 PAUSE = 284 F1 = 290 F2 = 291 F3 = 292 F4 = 293 F5 = 294 F6 = 295 F7 = 296 F8 = 297 F9 = 298 F10 = 299 F11 = 300 F12 = 301 F13 = 302 F14 = 303 F15 = 304 F16 = 305 F17 = 306 F18 = 307 F19 = 308 F20 = 309 F21 = 310 F22 = 311 F23 = 312 F24 = 313 F25 = 314 KP_0 = 320 KP_1 = 321 KP_2 = 322 KP_3 = 323 KP_4 = 324 KP_5 = 325 KP_6 = 326 KP_7 = 327 KP_8 = 328 KP_9 = 329 KP_DECIMAL = 330 KP_DIVIDE = 331 KP_MULTIPLY = 332 KP_SUBTRACT = 333 KP_ADD = 334 KP_ENTER = 335 KP_EQUAL = 336 LEFT_SHIFT = 340 LEFT_CONTROL = 341 LEFT_ALT = 342 LEFT_SUPER = 343 RIGHT_SHIFT = 344 RIGHT_CONTROL = 345 RIGHT_ALT = 346 RIGHT_SUPER = 347 MENU = 348 class Button(PrettyPrintIntEnum): B1 = 0 B2 = 1 B3 = 2 B4 = 3 B5 = 4 B6 = 5 B7 = 6 B8 = 7 LEFT = B1 RIGHT = B2 MIDDLE = B3 class Joystick(PrettyPrintIntEnum): JOYSTICK_1 = 0 JOYSTICK_2 = 1 JOYSTICK_3 = 2 JOYSTICK_4 = 3 JOYSTICK_5 = 4 JOYSTICK_6 = 5 JOYSTICK_7 = 6 JOYSTICK_8 = 7 JOYSTICK_9 = 8 JOYSTICK_10 = 9 JOYSTICK_11 = 10 JOYSTICK_12 = 11 JOYSTICK_13 = 12 JOYSTICK_14 = 13 JOYSTICK_15 = 14 JOYSTICK_16 = 15 class Action(PrettyPrintIntEnum): RELEASE = 0 PRESS = 1 REPEAT = 2 class Modifiers(PrettyPrintIntFlag): SHIFT = 0x0001 CONTROL = 0x0002 ALT = 0x0004 SUPER = 0x0008 class ConnectionEvent(PrettyPrintIntFlag): CONNECTED = 0x00040001 DISCONNECTED = 0x00040002 class CursorMode(PrettyPrintIntFlag): NORMAL = 0x00034001 HIDDEN = 0x00034002 DISABLED = 0x00034003 class CursorShape(PrettyPrintIntFlag): ARROW = 0x00036001 IBEAM = 0x00036002 CROSSHAIR = 0x00036003 HAND = 0x00036004 HRESIZE = 0x00036005 VRESIZE = 0x00036006 class Error(enum.IntEnum): NOT_INITIALIZED = 0x00010001 NO_CURRENT_CONTEXT = 0x00010002 INVALID_ENUM = 0x00010003 INVALID_VALUE = 0x00010004 OUT_OF_MEMORY = 0x00010005 API_UNAVAILABLE = 0x00010006 VERSION_UNAVAILABLE = 0x00010007 PLATFORM_ERROR = 0x00010008 FORMAT_UNAVAILABLE = 0x00010009 NO_WINDOW_CONTEXT = 0x0001000A
18.543478
42
0.652403
656
5,118
4.858232
0.655488
0.018826
0.019454
0.02573
0.02573
0.02573
0.02573
0.02573
0.02573
0
0
0.303724
0.291716
5,118
276
43
18.543478
0.575448
0
0
0.032
0
0
0
0
0
0
0.143387
0
0
1
0.008
false
0
0.004
0.008
0.768
0
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
0
0
0
0
1
0
0
2
8ad91da038614971fd2f8a054486756b08f7d8a4
51
py
Python
travy/example_config.py
ribal-aladeeb/Simple-Camera
a4d664b0878e8e86e126c45fb0df9f5aa62ce5b3
[ "Apache-2.0" ]
null
null
null
travy/example_config.py
ribal-aladeeb/Simple-Camera
a4d664b0878e8e86e126c45fb0df9f5aa62ce5b3
[ "Apache-2.0" ]
2
2019-01-11T17:06:29.000Z
2019-01-19T04:05:56.000Z
travy/example_config.py
YannCedric/Simple-Camera
a4d664b0878e8e86e126c45fb0df9f5aa62ce5b3
[ "Apache-2.0" ]
2
2020-01-16T07:21:51.000Z
2020-03-19T20:41:48.000Z
#rename file to config.py token = "YOUR TOKEN HERE"
25.5
25
0.745098
9
51
4.222222
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.156863
51
2
26
25.5
0.883721
0.470588
0
0
0
0
0.555556
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
8ae046390839602a6171d49a813ea57477f3cfde
5,329
py
Python
plums/dataflow/io/tile/_format/ptype.py
alexandreMayerowitz/playground-plums
a6be79e4c30c7abcbade5581f052a4e8035a2057
[ "MIT" ]
null
null
null
plums/dataflow/io/tile/_format/ptype.py
alexandreMayerowitz/playground-plums
a6be79e4c30c7abcbade5581f052a4e8035a2057
[ "MIT" ]
null
null
null
plums/dataflow/io/tile/_format/ptype.py
alexandreMayerowitz/playground-plums
a6be79e4c30c7abcbade5581f052a4e8035a2057
[ "MIT" ]
2
2021-02-03T12:37:53.000Z
2022-03-09T03:48:12.000Z
try: from functools import lru_cache except ImportError: from backports.functools_lru_cache import lru_cache from .utils import ConversionFunction from .channels import channels_register, Channel class ptype(object): # noqa: N801 """The *pixel-type* of a given image: A representation of its spectral base. As each actual pixel are stored as vectors, understanding of the base used is compulsory to decode a given pixel vector, the *pixel-type* class describes the way a given pixel is stored as a vector of *channel* values (e.g. *RGB*, *BGR*, *HSL*, *XYZ* etc...). Args: string (str): A string description of the *pixel-type* as a list of channel characters (*e.g.* ``'RGB'``, ``'rgY'``, ``'bgr'``, ``'y'``...). """ def __init__(self, string): self._channels = tuple(channels_register[item]() for item in string) def __repr__(self): """Return a pythonic representation or a *pixel-type*.""" return 'ptype(\'{}\')'.format(''.join(channel.__short_name__ for channel in self._channels)) def __str__(self): """Return a human readable representation or a *pixel-type*.""" return ''.join(channel.__short_name__ for channel in self._channels) def __hash__(self): """Compute the *pixel-type* python hash as the has of its |Channel| vector.""" return hash(self._channels) def __getitem__(self, index): """Get the i-th |Channel| from the *pixel-type* |Channel| vector.""" return self._channels[index] def __len__(self): """Get the dimension number of the |Channel| space of the *pixel-type*.""" return len(self._channels) def __eq__(self, other): """Return whether 2 |ptype| instances have the same |Channel| vector, thus describing the same *pixel-type*.""" try: return self._channels == tuple(channel for channel in other) except TypeError: return NotImplemented def __ne__(self, other): """Return whether 2 |ptype| do not have the same |Channel| vector, thus not describing the same *pixel-type*.""" return not self == other @staticmethod def _find_secondary_in_primary(secondary_list, primary_list): len_primary, len_secondary = len(primary_list), len(secondary_list) i, last = 0, len_primary - len_secondary + 1 while True: try: found = primary_list.index(secondary_list[0], i, last) # find first elem in secondary_list except ValueError: return None if primary_list[found:found + len_secondary] == secondary_list: return found, found + len_secondary else: i = found + 1 def __contains__(self, channels): """Return whether the *pixel-type* |Channel| vector contains a given |Channel| or |Channel| "sub-vector".""" return self.slice(channels) is not None def contains(self, channels): """Return whether the *pixel-type* |Channel| vector contains a given |Channel| or |Channel| "sub-set".""" return self.index(channels) is not None def slice(self, channels): """Compute the *pixel-type* |channel| vector slice of a given sub-vector. Args: channels (tuple, |Channel|): Either a single |Channel| or a tuple of |Channel| assumed to be a sub-vector of the *pixel-type* |Channel| vector. Returns: (int, int) or ``None``: The slice of the |Channel| vector corresponding to the input or ``None`` if it is not contained in the |Channel| vector. """ if isinstance(channels, Channel): channels = channels, return self._find_secondary_in_primary(channels, self._channels) def index(self, channels): """Compute the *pixel-type* |channel| indices of a given sub-set. Args: channels (tuple, |Channel|): Either a single |Channel| or a tuple of |Channel| assumed to be a sub-set of the *pixel-type* |Channel| vector. Returns: (int, ) or ``None``: The indices of the |Channel| corresponding to the input or ``None`` if it is not contained in the |Channel| vector. """ if isinstance(channels, Channel): channels = channels, try: return tuple(self._channels.index(channel) for channel in channels) except ValueError: return None @lru_cache(maxsize=10) def get_conversion_fn_to(self, destination_ptype): """Compute the conversion function from self to another ptype. Args: destination_ptype (|ptype|): The destination ptype object. Returns: callable: A conversion function to move from one ptype to another. """ return ConversionFunction(self, destination_ptype) RGB = rgb = ptype('RGB') # Pixel stored as *Red*-*Green*-*Blue* channels. RGBA = rgba = ptype('RGBA') # Pixel stored as *Red*-*Green*-*Blue*-*Alpha* channels. BGR = bgr = ptype('BGR') # Pixel stored as *Blue*-*Green*-*Red* channels. BGRA = bgra = ptype('BGRA') # Pixel stored as *Blue*-*Green*-*Red*-*Alpha* channels. GREY = grey = Y = y = ptype('Y') # Pixel stored as a single *Grey* channels.
40.067669
120
0.628823
681
5,329
4.787078
0.226138
0.044172
0.044172
0.040798
0.366871
0.330061
0.245399
0.222086
0.199387
0.199387
0
0.002787
0.259336
5,329
132
121
40.371212
0.823157
0.469694
0
0.193548
0
0
0.008963
0
0
0
0
0
0
1
0.225806
false
0
0.080645
0
0.580645
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
8af05789cab384fef209cd7272c9b4bd7e1541b0
405
py
Python
moderator/tests/models.py
mpyatishev/djmoderator
0d532bef4b40cecbcc297f0cda1dc0aeba3d676c
[ "MIT" ]
null
null
null
moderator/tests/models.py
mpyatishev/djmoderator
0d532bef4b40cecbcc297f0cda1dc0aeba3d676c
[ "MIT" ]
null
null
null
moderator/tests/models.py
mpyatishev/djmoderator
0d532bef4b40cecbcc297f0cda1dc0aeba3d676c
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from django.db import models class Model(models.Model): name = models.CharField(max_length=255) class ModelFK(models.Model): name = models.CharField(max_length=255) parent = models.ForeignKey(Model, related_name="modelfk") class ModelM2M(models.Model): name = models.CharField(max_length=255) first = models.ManyToManyField(Model, related_name='second')
22.5
64
0.723457
52
405
5.538462
0.442308
0.114583
0.15625
0.21875
0.4375
0.4375
0.4375
0.4375
0
0
0
0.031792
0.145679
405
17
65
23.823529
0.800578
0.051852
0
0.333333
0
0
0.034031
0
0
0
0
0
0
1
0
false
0
0.111111
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
8af362a9d5b5f087b21f2756bc9ebb0e15db2f6a
1,585
py
Python
pypertrail/saved_searches.py
astrolox/pypertrail
9cd8dd64821433487ea93e0eb3ce6b54f79fc237
[ "MIT" ]
15
2016-10-06T22:55:19.000Z
2020-12-04T09:52:32.000Z
pypertrail/saved_searches.py
kwent/pypertrail
9cd8dd64821433487ea93e0eb3ce6b54f79fc237
[ "MIT" ]
2
2017-08-04T09:04:08.000Z
2020-11-21T09:26:03.000Z
pypertrail/saved_searches.py
astrolox/pypertrail
9cd8dd64821433487ea93e0eb3ce6b54f79fc237
[ "MIT" ]
3
2018-10-05T22:11:26.000Z
2020-02-20T01:55:30.000Z
from .api import API import requests class SavedSearch(API): def list(self): r = requests.get('{0}/{1}'.format(self.base_uri, 'searches.json'), headers=self.headers) return self.return_response(r) def show(self, saved_search_id): r = requests.get('{0}/{1}/{2}{3}'.format(self.base_uri, 'searches', saved_search_id, '.json'), headers=self.headers) return self.return_response(r) def create(self, payload=None): r = requests.post('{0}/{1}'.format(self.base_uri, 'searches.json'), headers=self.headers, params=payload) return self.return_response(r) def update(self, saved_search_id, payload=None): r = requests.put('{0}/{1}/{2}{3}'.format(self.base_uri, 'searches', saved_search_id, '.json'), headers=self.headers, params=payload) return self.return_response(r) def delete(self, saved_search_id): r = requests.delete('{0}/{1}/{2}{3}'.format(self.base_uri, 'searches', saved_search_id, '.json'), headers=self.headers) return self.return_response(r)
39.625
77
0.440379
151
1,585
4.476821
0.231788
0.097633
0.115385
0.12574
0.769231
0.747041
0.670118
0.670118
0.670118
0.670118
0
0.018182
0.444795
1,585
39
78
40.641026
0.75
0
0
0.53125
0
0
0.076341
0
0
0
0
0
0
1
0.15625
false
0
0.0625
0
0.40625
0
0
0
0
null
0
0
0
0
1
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
8afb55d9b72e76faf06d7107b5fd25871691e390
361
py
Python
emit_main/test/conftest.py
emit-sds/emit-main
7c2f6feacc68b8a962309d8a3a7f6decc571c69d
[ "Apache-2.0" ]
1
2022-02-11T17:05:52.000Z
2022-02-11T17:05:52.000Z
emit_main/test/conftest.py
emit-sds/emit-main
7c2f6feacc68b8a962309d8a3a7f6decc571c69d
[ "Apache-2.0" ]
null
null
null
emit_main/test/conftest.py
emit-sds/emit-main
7c2f6feacc68b8a962309d8a3a7f6decc571c69d
[ "Apache-2.0" ]
null
null
null
""" This config file allows pytest to pass arguments into tests Author: Winston Olson-Duvall, winston.olson-duvall@jpl.nasa.gov """ from pytest import fixture def pytest_addoption(parser): parser.addoption( "--config_path", action="store" ) @fixture() def config_path(request): return request.config.getoption("--config_path")
18.05
63
0.703601
45
361
5.555556
0.644444
0.12
0.144
0
0
0
0
0
0
0
0
0
0.180055
361
19
64
19
0.844595
0.34349
0
0
0
0
0.135371
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0.111111
0.444444
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
8affa5bc2b45b6bbaa5c1c822b1c498984fb7bdb
167
py
Python
python/048-self-powers.py
timschlechter/project-euler
8986863231cc2d7d6ad1922c5009b96d329712e4
[ "MIT" ]
null
null
null
python/048-self-powers.py
timschlechter/project-euler
8986863231cc2d7d6ad1922c5009b96d329712e4
[ "MIT" ]
null
null
null
python/048-self-powers.py
timschlechter/project-euler
8986863231cc2d7d6ad1922c5009b96d329712e4
[ "MIT" ]
null
null
null
from functools import reduce powers = map(lambda x: x**x, range(1, 1001)) summation = reduce(lambda x, y: x + y, powers) last10 = str(summation)[-10:] print(last10)
20.875
46
0.688623
27
167
4.259259
0.62963
0.121739
0
0
0
0
0
0
0
0
0
0.078014
0.155689
167
7
47
23.857143
0.737589
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
c10b65d1af2890255ceb7a5bef994f69a9db3798
506
py
Python
qqbot/model/announce.py
wzpan/botpy
3c112d2f429342bf0d3480dbf3fb6677aa2b486a
[ "MIT" ]
1
2022-03-30T13:04:32.000Z
2022-03-30T13:04:32.000Z
qqbot/model/announce.py
wzpan/botpy
3c112d2f429342bf0d3480dbf3fb6677aa2b486a
[ "MIT" ]
null
null
null
qqbot/model/announce.py
wzpan/botpy
3c112d2f429342bf0d3480dbf3fb6677aa2b486a
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- class Announce: def __init__(self, data=None): self.guild_id: str = "" self.channel_id: str = "" self.message_id: str = "" if data: self.__dict__ = data class CreateAnnounceRequest: def __init__(self, channel_id: str, message_id: str): self.channel_id = channel_id self.message_id = message_id class CreateChannelAnnounceRequest: def __init__(self, message_id: str): self.message_id = message_id
23
57
0.626482
61
506
4.737705
0.311475
0.217993
0.124567
0.110727
0.349481
0
0
0
0
0
0
0.002703
0.268775
506
21
58
24.095238
0.778378
0.041502
0
0.142857
0
0
0
0
0
0
0
0
0
1
0.214286
false
0
0
0
0.428571
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
c119ef903768815c911ddf123ea3ce4c3bf04181
342
py
Python
实例学习Numpy与Matplotlib/matplotlib入门例子.py
shao1chuan/pythonbook
cd9877d04e1e11422d38cc051e368d3d9ce2ab45
[ "MulanPSL-1.0" ]
95
2020-10-11T04:45:46.000Z
2022-02-25T01:50:40.000Z
实例学习Numpy与Matplotlib/matplotlib入门例子.py
shao1chuan/pythonbook
cd9877d04e1e11422d38cc051e368d3d9ce2ab45
[ "MulanPSL-1.0" ]
null
null
null
实例学习Numpy与Matplotlib/matplotlib入门例子.py
shao1chuan/pythonbook
cd9877d04e1e11422d38cc051e368d3d9ce2ab45
[ "MulanPSL-1.0" ]
30
2020-11-05T09:01:00.000Z
2022-03-08T05:58:55.000Z
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 2 * np.pi, 50) y = np.sin(x) # plt.plot(x, y) # plt.show() # plt.plot(x, y) # plt.plot(x, y * 2) # plt.title("sin(x) & 2sin(x)") # plt.show() plt.plot(x, y, label="sin(x)") plt.plot(x, y * 2, label="2sin(x)") # plt.legend() plt.legend(loc='best bbbbbbbbbb') plt.show()
18
35
0.605263
68
342
3.044118
0.352941
0.169082
0.193237
0.217391
0.333333
0.280193
0
0
0
0
0
0.027682
0.154971
342
19
36
18
0.688581
0.330409
0
0
0
0
0.126697
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
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
c12ef57dd5ed6fb1b549eb6c8d6d0eb7da4bd9e4
447
py
Python
chargebee/models/site_migration_detail.py
koordinates/chargebee-python
8c3e8309484cc45375e5585ff931696da94ac2fa
[ "MIT" ]
28
2015-09-16T01:52:44.000Z
2022-01-13T21:38:55.000Z
chargebee/models/site_migration_detail.py
koordinates/chargebee-python
8c3e8309484cc45375e5585ff931696da94ac2fa
[ "MIT" ]
45
2015-01-22T15:41:23.000Z
2022-03-31T11:12:49.000Z
chargebee/models/site_migration_detail.py
koordinates/chargebee-python
8c3e8309484cc45375e5585ff931696da94ac2fa
[ "MIT" ]
23
2017-01-10T15:41:48.000Z
2022-03-21T14:16:54.000Z
import json from chargebee.model import Model from chargebee import request from chargebee import APIError class SiteMigrationDetail(Model): fields = ["entity_id", "other_site_name", "entity_id_at_other_site", "migrated_at", "entity_type", \ "status"] @staticmethod def list(params=None, env=None, headers=None): return request.send_list_request('get', request.uri_path("site_migration_details"), params, env, headers)
29.8
113
0.749441
58
447
5.534483
0.568966
0.121495
0.11838
0
0
0
0
0
0
0
0
0
0.143177
447
14
114
31.928571
0.83812
0
0
0
0
0
0.223714
0.100671
0
0
0
0
0
1
0.1
false
0
0.4
0.1
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
c13e884682ceee597e7c082102bcfe5b1fd9d33c
389
py
Python
code/backend/tests/test_products.py
ndhngoc91/COMP90082_S1_TO_2021
91cc5d039df3b4d271b100a9afec99897a9501a2
[ "MIT" ]
2
2021-08-22T05:10:27.000Z
2021-11-08T12:57:27.000Z
code/backend/tests/test_products.py
ndhngoc91/COMP90082_S1_TO_2021
91cc5d039df3b4d271b100a9afec99897a9501a2
[ "MIT" ]
null
null
null
code/backend/tests/test_products.py
ndhngoc91/COMP90082_S1_TO_2021
91cc5d039df3b4d271b100a9afec99897a9501a2
[ "MIT" ]
1
2021-08-21T19:51:33.000Z
2021-08-21T19:51:33.000Z
# implement test cases for the Product router import pytest import json @pytest.fixture(autouse=True, scope="function") def run_around_tests(): setup() yield teardown() def setup(): pass def teardown(): pass def test_get_all_products(test_app): response = test_app.get("/products") assert response.status_code == 200 assert len(response.json()) > 0
15.56
47
0.691517
52
389
5.019231
0.653846
0.05364
0
0
0
0
0
0
0
0
0
0.012862
0.200514
389
24
48
16.208333
0.826367
0.11054
0
0.133333
0
0
0.049419
0
0
0
0
0
0.133333
1
0.266667
false
0.133333
0.133333
0
0.4
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
c13f566bd7155be4b712fd3326b7f1dde6216e4f
465
py
Python
django_factories/other_class_factories.py
danie1k/django-factories
fe21a30a9b09f4d5a69312ad912fd5ac989faed0
[ "BSD-3-Clause" ]
null
null
null
django_factories/other_class_factories.py
danie1k/django-factories
fe21a30a9b09f4d5a69312ad912fd5ac989faed0
[ "BSD-3-Clause" ]
null
null
null
django_factories/other_class_factories.py
danie1k/django-factories
fe21a30a9b09f4d5a69312ad912fd5ac989faed0
[ "BSD-3-Clause" ]
null
null
null
__all__ = ['class_in_class_factory'] def class_in_class_factory(parent_class, name, bases=None, **fields): if not (isinstance(bases, tuple) or bases is None): raise TypeError('`bases` must be tuple.') fields['__module__'] = '{parent_class_module_name}.{parent_class_name}'.format( parent_class_module_name=parent_class.__module__, parent_class_name=parent_class.__name__, ) return type(name, bases or (object, ), fields)
33.214286
83
0.713978
61
465
4.868852
0.409836
0.259259
0.20202
0.127946
0.215488
0.215488
0
0
0
0
0
0
0.167742
465
13
84
35.769231
0.767442
0
0
0
0
0
0.215054
0.146237
0
0
0
0
0
1
0.111111
false
0
0
0
0.222222
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
c15c8e84a39e3f4ebb21798135a4f6dce8fb337d
3,086
py
Python
test_password_meter.py
Layto888/password-meter-py
a865a05ec5e78b1a239dcd77215c1825e7a32199
[ "MIT" ]
5
2017-07-02T19:36:32.000Z
2021-06-06T11:21:34.000Z
test_password_meter.py
Layto888/password-meter-py
a865a05ec5e78b1a239dcd77215c1825e7a32199
[ "MIT" ]
1
2019-10-21T17:11:58.000Z
2021-06-01T22:41:55.000Z
test_password_meter.py
Layto888/password-meter-py
a865a05ec5e78b1a239dcd77215c1825e7a32199
[ "MIT" ]
null
null
null
import pytest from password_meter import Password from constants import ALL, USE_LETTERS, USE_DIGITS, USE_PUNCTATIONS # set up fixture @pytest.fixture(scope='module') def password(): pswd = Password(':abcdX01J!b#') yield pswd def test_attributes(password): assert isinstance(password, Password) assert isinstance(password.password, str) assert password.len == 12 assert password.nupper == 2 assert password.nlower == 5 assert password.ndigit == 2 assert password.symbol == 3 assert password.requirement == 5 def test_middle_ns(password): assert password._middle_ns() / 2 == 3 def test_only_letters(password): assert password._only_letters() == 0 def test_only_digits(password): assert password._only_digits() == 0 def test_consecutive_letter(password): assert password._consecutive_letter() / -2 == 3 def test_consecutive_digit(password): assert password._consecutive_digit() / -2 == 1 def test_check_sequential(password): assert password._check_sequential() / -3 == 2 def test_global_score(password): password._global_score() assert password.score >= 100.0 # test specifications types def test_random_password_spec(password): assert ALL == USE_LETTERS + USE_DIGITS + USE_PUNCTATIONS # new find safe password test with cases: passwd, score = Password().find(8, spec=USE_DIGITS) assert len(passwd) == 8 s_digits = sum(c.isdigit() for c in passwd) assert s_digits == 8 passwd, score = Password().find(8, spec=USE_LETTERS) s_letters = sum(c.isalpha() for c in passwd) assert s_letters == 8 assert score > 5.0 and score < 100.0 # test special cases password def test_specials_cases_password(): special_pass = Password('') assert special_pass.len == 0 assert special_pass.nupper == 0 assert special_pass.nlower == 0 assert special_pass.ndigit == 0 assert special_pass.symbol == 0 assert special_pass.requirement == 0 # score compute part A and B special_pass._compute_addition() assert special_pass.score == 0 special_pass._compute_deduction() assert special_pass.score == 0 special_pass._global_score() assert special_pass.score == 0 # only digits special_pass = Password('0123456789') assert special_pass._only_digits() == -10.0 assert special_pass._consecutive_digit() == -18.0 assert special_pass._check_sequential() == -24.0 # only letters special_pass = Password('ABCDefcbAARk') assert special_pass._only_letters() == - 12.0 assert special_pass._consecutive_letter() == -20.0 assert special_pass._check_sequential() == -6.0 def test_repetitive_chars2(): """ test complexe function _repetitive_chars2 """ passwd = Password('axbxcxdxexfx') assert passwd._repetitive_chars2() == 0 passwd = Password('abbbbb01b') assert passwd._repetitive_chars2() == -16 passwd = Password('000000013xbv11') assert passwd._repetitive_chars2() == -37 passwd = Password('Oharrrrrrrrrrrrrrrrg!') assert passwd._repetitive_chars2() == -100
28.841121
67
0.710629
394
3,086
5.314721
0.236041
0.110315
0.121777
0.077364
0.219198
0.146132
0.096466
0
0
0
0
0.038599
0.185677
3,086
106
68
29.113208
0.794668
0.066105
0
0.041667
0
0
0.033461
0.00732
0
0
0
0
0.541667
1
0.166667
false
0.875
0.041667
0
0.208333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
1
0
0
0
0
0
2
c162f5d2f814fc86c8bb6ad6c9ab6906cdcc8455
408
py
Python
lymph/testing/nose2.py
MislavStipetic/lymph
aa36a688380e5665fdea31fda76b4a0cf35b6fc0
[ "Apache-2.0" ]
89
2015-03-01T11:39:55.000Z
2022-01-31T22:00:15.000Z
lymph/testing/nose2.py
MislavStipetic/lymph
aa36a688380e5665fdea31fda76b4a0cf35b6fc0
[ "Apache-2.0" ]
214
2015-01-02T23:48:49.000Z
2020-01-14T10:47:37.000Z
lymph/testing/nose2.py
MislavStipetic/lymph
aa36a688380e5665fdea31fda76b4a0cf35b6fc0
[ "Apache-2.0" ]
36
2015-01-13T13:44:15.000Z
2021-09-15T17:55:41.000Z
from __future__ import absolute_import import logging from nose2.events import Plugin log = logging.getLogger('nose2.plugins.lymph') class LymphPlugin(Plugin): """ Initializes the lymph framework before tests are run """ configSection = 'lymph' def createTests(self, event): log.info("Initializing lymph framework") import lymph.monkey lymph.monkey.patch()
19.428571
56
0.698529
46
408
6.086957
0.652174
0.1
0
0
0
0
0
0
0
0
0
0.00625
0.215686
408
20
57
20.4
0.86875
0.127451
0
0
0
0
0.152941
0
0
0
0
0
0
1
0.1
false
0
0.4
0
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
1
0
1
0
0
2
c16c27384446f91c7a7df4aa03b9a4a28419dde0
280
py
Python
NumberGuesser.py
MaxHartel/NumberGuesser
0abe8c6fa19bd2b7f910c7934a0e0b847094feeb
[ "MIT" ]
null
null
null
NumberGuesser.py
MaxHartel/NumberGuesser
0abe8c6fa19bd2b7f910c7934a0e0b847094feeb
[ "MIT" ]
null
null
null
NumberGuesser.py
MaxHartel/NumberGuesser
0abe8c6fa19bd2b7f910c7934a0e0b847094feeb
[ "MIT" ]
null
null
null
import random rand = random.randint(0,100) while True: inputX = input("Enter a number") inputX = int(inputX) if(inputX > rand): print("Too High") if(inputX < rand): print("Too Low") if(inputX == rand): print("Good Job") break;
20
36
0.557143
36
280
4.333333
0.611111
0.153846
0.230769
0.326923
0.25641
0
0
0
0
0
0
0.020408
0.3
280
13
37
21.538462
0.77551
0
0
0
0
0
0.132616
0
0
0
0
0
0
1
0
false
0
0.083333
0
0.083333
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
c16eb1ddb129becd8565a11fa0ff9c975ba59fc3
357
py
Python
pytpp/attributes/log_filter.py
Venafi/pytpp
42af655b2403b8c9447c86962abd4aaa0201f646
[ "MIT" ]
4
2022-02-04T23:58:55.000Z
2022-02-15T18:53:08.000Z
pytpp/attributes/log_filter.py
Venafi/pytpp
42af655b2403b8c9447c86962abd4aaa0201f646
[ "MIT" ]
null
null
null
pytpp/attributes/log_filter.py
Venafi/pytpp
42af655b2403b8c9447c86962abd4aaa0201f646
[ "MIT" ]
null
null
null
from pytpp.attributes._helper import IterableMeta, Attribute from pytpp.attributes.log_channel import LogChannelAttributes class LogFilterAttributes(LogChannelAttributes, metaclass=IterableMeta): __config_class__ = "Log Filter" filter_ids = Attribute('Filter IDs') filter_severity = Attribute('Filter Severity') log_channel = Attribute('Log Channel')
35.7
72
0.826331
38
357
7.5
0.447368
0.105263
0.133333
0
0
0
0
0
0
0
0
0
0.095238
357
9
73
39.666667
0.882353
0
0
0
0
0
0.128852
0
0
0
0
0
0
1
0
false
0
0.285714
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
c17ba91b6eb327e7efe20742be1330903741437d
696
py
Python
locan/gui/__init__.py
super-resolution/Locan
94ed7759f7d7ceddee7c7feaabff80010cfedf30
[ "BSD-3-Clause" ]
8
2021-11-25T20:05:49.000Z
2022-03-27T17:45:00.000Z
locan/gui/__init__.py
super-resolution/Locan
94ed7759f7d7ceddee7c7feaabff80010cfedf30
[ "BSD-3-Clause" ]
4
2021-12-15T22:39:20.000Z
2022-03-11T17:35:34.000Z
locan/gui/__init__.py
super-resolution/Locan
94ed7759f7d7ceddee7c7feaabff80010cfedf30
[ "BSD-3-Clause" ]
1
2022-03-22T19:53:13.000Z
2022-03-22T19:53:13.000Z
""" User interfaces. This module provides functions and classes for using graphical user interfaces (GUI). Functions provide a GUI based on QT if the QT backend and appropriate python bindings are available. Supported bindings are found in the enum class `locan.QtBindings`. The configuration variable `locan.QT_BINDING` declares which python binding to use if several are installed. If an environment variable `QT_API` is defined it takes precedence over `locan.QT_BINDING`. If neither `locan.QT_BINDING` nor `QT_API` is defined, qtpy will choose the binding. Submodules: ----------- .. autosummary:: :toctree: ./ io """ from .io import * __all__ = [] __all__.extend(io.__all__)
23.2
85
0.752874
99
696
5.121212
0.636364
0.04142
0.08284
0.055227
0
0
0
0
0
0
0
0
0.159483
696
29
86
24
0.866667
0.899425
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
1
0
0
0
0
2
c181c1f2aeaf3656347d6359b34e82466720a0f0
1,909
py
Python
backend/api/tests/test_load_ops_data.py
amichard/zeva
19ba22b07946674cc31a48c632aceca594a53e1a
[ "Apache-2.0" ]
null
null
null
backend/api/tests/test_load_ops_data.py
amichard/zeva
19ba22b07946674cc31a48c632aceca594a53e1a
[ "Apache-2.0" ]
null
null
null
backend/api/tests/test_load_ops_data.py
amichard/zeva
19ba22b07946674cc31a48c632aceca594a53e1a
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # pylint: disable=no-member,invalid-name,duplicate-code import importlib import logging from collections import namedtuple from django.test import TestCase class TestLoadOpsData(TestCase): """ Execute specified operational scripts to validate that they work """ ScriptDefinition = namedtuple( 'ScriptDefinition', ('file', 'args', 'skip'), defaults=('', False,) ) scripts = [ ScriptDefinition( 'api.fixtures.operational.0000_add_government_organization' ), ScriptDefinition( 'api.fixtures.operational.0001_add_vehicle_makes' ), ScriptDefinition( 'api.fixtures.operational.0002_add_vehicle_classes' ), ScriptDefinition( 'api.fixtures.operational.0003_add_vehicle_fuel_types' ), ScriptDefinition( 'api.fixtures.operational.0004_add_model_years' ), ScriptDefinition( 'api.fixtures.operational.0005_add_organizations' ), ScriptDefinition( 'api.fixtures.test.0001_add_plugin_hybrid_vehicles' ), ScriptDefinition( 'api.fixtures.test.0002_add_battery_electric_vehicles' ), ] logger = logging.getLogger('zeva.test') def testOperationalScripts(self): for script in self.scripts: if not script.skip: with self.subTest('testing operational script {file}'.format( file=script.file )): logging.info('loading script: {file}'.format( file=script.file )) loaded = importlib.import_module(script.file) instance = loaded.script_class(script.file, script.args) instance.check_run_preconditions() instance.run()
31.816667
77
0.594552
168
1,909
6.577381
0.5
0.137557
0.195475
0.206335
0.054299
0.054299
0
0
0
0
0
0.025172
0.313253
1,909
59
78
32.355932
0.817696
0.073861
0
0.375
0
0
0.27984
0.227299
0
0
0
0
0
1
0.020833
false
0
0.104167
0
0.208333
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
c185e048dc4886bb52a9876c6481c0ebcf601a77
1,677
py
Python
Chapter04/cnn/basics.py
PacktPublishing/Neural-Network-Programming-with-TensorFlow
6ab03d8bfc8b23217968e7f71b656e3afc8bd7a0
[ "MIT" ]
26
2017-11-17T18:56:16.000Z
2022-03-03T13:25:44.000Z
Chapter04/cnn/basics.py
PacktPublishing/Neural-Network-Programming-with-TensorFlow
6ab03d8bfc8b23217968e7f71b656e3afc8bd7a0
[ "MIT" ]
2
2021-08-25T14:50:10.000Z
2022-02-09T23:30:51.000Z
Chapter04/cnn/basics.py
PacktPublishing/Neural-Network-Programming-with-TensorFlow
6ab03d8bfc8b23217968e7f71b656e3afc8bd7a0
[ "MIT" ]
22
2017-11-16T05:16:38.000Z
2022-01-03T20:10:04.000Z
import tensorflow as tf import numpy as np def main(): # setup-only-ignore sess = tf.InteractiveSession() image_batch = tf.constant([ [ # First Image [[255, 0, 0], [255, 0, 0], [0, 255, 0]], [[255, 0, 0], [255, 0, 0], [0, 255, 0]] ], [ # First Image [[0, 0, 0], [0, 255, 0], [0, 255, 0]], [[0, 0, 0], [0, 255, 0], [0, 255, 0]] ], [ # Second Image [[0, 0, 255], [0, 0, 255], [0, 0, 255]], [[0, 0, 255], [0, 0, 255], [0, 0, 255]] ] ]) print(image_batch.get_shape()) print(sess.run(image_batch)[0][0][0]) i = tf.constant([ [ [1.0, 1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 0.0, 0.0] ] ]) k = tf.constant([ [ [[1.0, 0.0, 1.0]], [[0.0, 1.0, 0.0]], [[1.0, 0.0, 1.0]] ] ]) kernel = tf.reshape(k, [3, 3, 1, 1], name='kernel') image = tf.reshape(i, [1, 4, 5, 1], name='image') conv2d = tf.nn.conv2d(image, kernel, strides=[1, 1, 1, 1], padding='VALID') res = tf.squeeze(tf.nn.conv2d(image, kernel, [1, 1, 1, 1], "VALID")) # VALID means no padding with tf.Session() as sess: print sess.run(res) #tensor_out = sess.run(conv2d) #print(tensor_out) lower_right_image_pixel = sess.run(input_batch)[0][1][1] lower_right_kernel_pixel = sess.run(conv2d)[0][1][1] if __name__ == '__main__': main()
27.95
79
0.415623
249
1,677
2.714859
0.204819
0.156805
0.133136
0.100592
0.275148
0.213018
0.213018
0.207101
0.207101
0.118343
0
0.167792
0.381634
1,677
60
80
27.95
0.484089
0.073345
0
0.111111
0
0
0.018746
0
0
0
0
0
0
0
null
null
0
0.044444
null
null
0.066667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
c19392f70699347a257fa3153ab269b3faa89422
79
py
Python
backend/fms_core/template_importer/row_handlers/sample_qc/__init__.py
c3g/freezeman
bc4b6c8a2876e888ce41b7d14127cc22bc2b2143
[ "W3C" ]
2
2021-07-31T13:20:08.000Z
2021-09-28T13:18:55.000Z
backend/fms_core/template_importer/row_handlers/sample_qc/__init__.py
c3g/freezeman
bc4b6c8a2876e888ce41b7d14127cc22bc2b2143
[ "W3C" ]
71
2021-03-12T22:08:19.000Z
2022-03-25T15:24:40.000Z
backend/fms_core/template_importer/row_handlers/sample_qc/__init__.py
c3g/freezeman
bc4b6c8a2876e888ce41b7d14127cc22bc2b2143
[ "W3C" ]
null
null
null
from .sample import SampleQCRowHandler __all__ = [ "SampleQCRowHandler", ]
15.8
38
0.746835
6
79
9.166667
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.164557
79
5
39
15.8
0.833333
0
0
0
0
0
0.225
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
c19458c176cd079b9feeb51b3b17ea368d862156
185
py
Python
MainLibPython/JsonHelper.py
emacslisp/pythonlib
5f299b24c3c4ea56fed48ed71d4a4c826e1cb36b
[ "Apache-2.0" ]
null
null
null
MainLibPython/JsonHelper.py
emacslisp/pythonlib
5f299b24c3c4ea56fed48ed71d4a4c826e1cb36b
[ "Apache-2.0" ]
null
null
null
MainLibPython/JsonHelper.py
emacslisp/pythonlib
5f299b24c3c4ea56fed48ed71d4a4c826e1cb36b
[ "Apache-2.0" ]
null
null
null
import json class JsonHelper: def indentJson(self, jsonStr): jsonObject = json.loads(jsonStr) return json.dumps(jsonObject, sort_keys=True, indent=4, separators=(',', ': '))
26.428571
83
0.702703
22
185
5.863636
0.818182
0
0
0
0
0
0
0
0
0
0
0.006369
0.151351
185
6
84
30.833333
0.815287
0
0
0
0
0
0.016216
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.8
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
c1a086751b0b56a7f9ca05b577cff4bf8698dab4
371
py
Python
0304.Range Sum Query 2D - Immutable/test.py
zhlinh/leetcode
6dfa0a4df9ec07b2c746a13c8257780880ea04af
[ "Apache-2.0" ]
null
null
null
0304.Range Sum Query 2D - Immutable/test.py
zhlinh/leetcode
6dfa0a4df9ec07b2c746a13c8257780880ea04af
[ "Apache-2.0" ]
null
null
null
0304.Range Sum Query 2D - Immutable/test.py
zhlinh/leetcode
6dfa0a4df9ec07b2c746a13c8257780880ea04af
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- from solution import NumMatrix matrix = [[3, 0, 1, 4, 2], [5, 6, 3, 2, 1], [1, 2, 0, 1, 5], [4, 1, 0, 1, 7], [1, 0, 3, 0, 5]] numMatrix = NumMatrix(matrix) print(numMatrix.sumRegion(2, 1, 4, 3)) print(numMatrix.sumRegion(1, 1, 2, 2)) print(numMatrix.sumRegion(1, 2, 2, 4))
23.1875
38
0.506739
61
371
3.081967
0.360656
0.031915
0.367021
0.255319
0
0
0
0
0
0
0
0.142857
0.283019
371
15
39
24.733333
0.56391
0.113208
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.1
0
0.1
0.3
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
c1d53d3cc1b5a5a9f331f03b0a0e8a4894db6cea
2,666
py
Python
functions/helpers/errors.py
haynieresearch/unusual_options_activity
f87619244bf72e603032bf5f66963b5a692bace2
[ "Apache-2.0" ]
null
null
null
functions/helpers/errors.py
haynieresearch/unusual_options_activity
f87619244bf72e603032bf5f66963b5a692bace2
[ "Apache-2.0" ]
null
null
null
functions/helpers/errors.py
haynieresearch/unusual_options_activity
f87619244bf72e603032bf5f66963b5a692bace2
[ "Apache-2.0" ]
null
null
null
#********************************************************** #* CATEGORY SOFTWARE #* GROUP MARKET DATA #* AUTHOR LANCE HAYNIE <LANCE@HAYNIEMAIL.COM> #* DATE 2020-10-20 #* PURPOSE UNUSUAL OPTIONS ACTIVITY #* FILE ERRORS.PY #********************************************************** #* MODIFICATIONS #* 2020-10-20 - LHAYNIE - INITIAL VERSION #********************************************************** #UNUSUAL OPTIONS ACTIVITY #Copyright 2020 Haynie IPHC, LLC #Developed by Haynie Research & Development, LLC #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License.# #You may obtain a copy of the License at #http://www.apache.org/licenses/LICENSE-2.0 #Unless required by applicable law or agreed to in writing, software #distributed under the License is distributed on an "AS IS" BASIS, #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #See the License for the specific language governing permissions and #limitations under the License. import pyppeteer class HttpErrors: def handle_errors(response): if response.status_code in [200, 201]: return elif 400 <= response.status_code < 500: raise HttpClientError(response.status_code, response.url) elif 500 <= response.status_code < 600: raise HttpServerError(response.status_code, response.url) def handle_render_errors(render_func, **kwargs): try: render_func(**kwargs) except pyppeteer.errors.TimeoutError: raise TimeoutError(msg='Timeout exceeded, try increasing the timeout value.') class InvalidTimeoutValue(Exception): """Raise when timeout value is invalid""" def __init__(self, val): super(InvalidTimeoutValue, self).__init__(f'Timeout value cannot be empty and/or less than 1: {val}') class TimeoutError(Exception): """Raise on timeout""" def __init__(self, msg=''): super(TimeoutError, self).__init__(msg) class HttpClientError(Exception): """Raise on client error exception""" def __init__(self, status_code, url): super(HttpClientError, self).__init__(f'Client Error while fetching {url} with status code {status_code}') class HttpServerError(Exception): """Raise on server error exception""" def __init__(self, status_code, url): super(HttpServerError, self).__init__(f'Server Error while fetching {url} with status code {status_code}') class ParsingError(Exception): """Raises when parsing table heading and body""" def __init__(self, msg=''): super(ParsingError, self).__init__(f'Parsing error: {msg}') class MissingParserType(Exception): """Raise when missing parser class""" def __init__(self): super(MissingParserType, self).__init__()
37.027778
108
0.708552
335
2,666
5.453731
0.438806
0.060208
0.036125
0.017515
0.154351
0.101806
0.101806
0.101806
0.101806
0.054735
0
0.018479
0.127157
2,666
71
109
37.549296
0.766652
0.443736
0
0.125
0
0
0.177747
0
0
0
0
0
0
1
0.25
false
0
0.03125
0
0.53125
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
c1d6668056f110c8a2e633807bedb961e5aebfe8
585
py
Python
mlcomp/parallelm/common/buff_to_lines.py
lisapm/mlpiper
74ad5ae343d364682cc2f8aaa007f2e8a1d84929
[ "Apache-2.0" ]
7
2019-04-08T02:31:55.000Z
2021-11-15T14:40:49.000Z
mlcomp/parallelm/common/buff_to_lines.py
lisapm/mlpiper
74ad5ae343d364682cc2f8aaa007f2e8a1d84929
[ "Apache-2.0" ]
31
2019-02-22T22:23:26.000Z
2021-08-02T17:17:06.000Z
mlcomp/parallelm/common/buff_to_lines.py
lisapm/mlpiper
74ad5ae343d364682cc2f8aaa007f2e8a1d84929
[ "Apache-2.0" ]
8
2019-03-15T23:46:08.000Z
2020-02-06T09:16:02.000Z
class BufferToLines(object): def __init__(self): self._acc_buff = "" self._last_line = "" self._in_middle_of_line = False def add(self, buff): self._acc_buff += buff.decode() self._in_middle_of_line = False if self._acc_buff[-1] == '\n' else True def lines(self): lines = self._acc_buff.split('\n') up_to_index = len(lines) - 2 if self._in_middle_of_line else len(lines) - 1 self._acc_buff = lines[-1] if self._in_middle_of_line else "" for iii in range(up_to_index): yield lines[iii]
30.789474
83
0.613675
88
585
3.670455
0.363636
0.108359
0.170279
0.173375
0.291022
0.291022
0.148607
0
0
0
0
0.009346
0.268376
585
18
84
32.5
0.745327
0
0
0
0
0
0.006849
0
0
0
0
0
0
1
0.214286
false
0
0
0
0.285714
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
c1da183dc12587113207c6d92f2597542e28bfb0
125
py
Python
saltant/version.py
saltant-org/saltant-py
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
[ "MIT" ]
null
null
null
saltant/version.py
saltant-org/saltant-py
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
[ "MIT" ]
null
null
null
saltant/version.py
saltant-org/saltant-py
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
[ "MIT" ]
null
null
null
"""Contains name, version, and description.""" NAME = "saltant-py" VERSION = "0.4.0" DESCRIPTION = "saltant SDK for Python"
20.833333
46
0.688
17
125
5.058824
0.705882
0
0
0
0
0
0
0
0
0
0
0.028037
0.144
125
5
47
25
0.775701
0.32
0
0
0
0
0.468354
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
c1e78db39b9293d47d1aca0443c1c403366ec0a9
336
py
Python
packages/jet_bridge_base/jet_bridge_base/messages.py
bokal2/jet-bridge
dddc4f55c2d5a28c02ce9515dffc750e3887450f
[ "MIT" ]
1,247
2019-01-10T22:22:08.000Z
2022-03-29T20:54:32.000Z
packages/jet_bridge_base/jet_bridge_base/messages.py
bokal2/jet-bridge
dddc4f55c2d5a28c02ce9515dffc750e3887450f
[ "MIT" ]
12
2019-03-15T20:06:14.000Z
2022-01-07T10:28:20.000Z
packages/jet_bridge_base/jet_bridge_base/messages.py
bokal2/jet-bridge
dddc4f55c2d5a28c02ce9515dffc750e3887450f
[ "MIT" ]
130
2019-02-26T17:36:53.000Z
2022-03-17T22:46:27.000Z
GET_ACTION_LIST = 'get_action_list' EXECUTE_ACTION = 'execute_action' GET_FIELD_OPTIONS = 'get_field_options' GET_ELEMENT_STATUS = 'get_element_status' message_handlers = {} def add_handler(message_name, func): message_handlers[message_name] = func def get_handler(message_name): return message_handlers.get(message_name)
21
45
0.800595
46
336
5.347826
0.347826
0.178862
0.105691
0.146341
0
0
0
0
0
0
0
0
0.116071
336
15
46
22.4
0.828283
0
0
0
0
0
0.191045
0
0
0
0
0
0
1
0.222222
false
0
0
0.111111
0.333333
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
c1ef7e819e29408f1248eb8cf88bb0732cdda7d3
465
py
Python
download-package/PythonExercises/ex015.py
MCLeitao/Python-Exercises
b24758ac6f95584ef03c320cc442c12a6fad2bd9
[ "MIT" ]
null
null
null
download-package/PythonExercises/ex015.py
MCLeitao/Python-Exercises
b24758ac6f95584ef03c320cc442c12a6fad2bd9
[ "MIT" ]
null
null
null
download-package/PythonExercises/ex015.py
MCLeitao/Python-Exercises
b24758ac6f95584ef03c320cc442c12a6fad2bd9
[ "MIT" ]
null
null
null
# Write a program that asks the number of kilometers a car has driven and the number of days it has been hired. # Calculate the price to pay, knowing that the car costs US$ 60 per day and US$ 0.15 per km driven. k = float(input('Enter how many kilometers the car has traveled: ')) d = float(input('Enter how many days the car has been rented: ')) t = (k * 0.15) + (d * 60) print('The total rental of the car is {}US${:.2f}{}'.format('\033[1;31;40m', t, '\033[m'))
58.125
111
0.68172
90
465
3.522222
0.566667
0.07571
0.069401
0.113565
0.138801
0
0
0
0
0
0
0.058201
0.187097
465
7
112
66.428571
0.780423
0.445161
0
0
0
0
0.611765
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
de02164fccb68242ed4a7b93d2d9462b419df145
1,012
py
Python
symbol.py
thetaprimeio/flyingking-checkers
96da039aa2e408b12eec78a5004dd38d2f05ace8
[ "MIT" ]
null
null
null
symbol.py
thetaprimeio/flyingking-checkers
96da039aa2e408b12eec78a5004dd38d2f05ace8
[ "MIT" ]
null
null
null
symbol.py
thetaprimeio/flyingking-checkers
96da039aa2e408b12eec78a5004dd38d2f05ace8
[ "MIT" ]
null
null
null
asci = """ ╔════╗╔╗ ╔╗ ╔═══╗ ╔══╗╔═══╗ ╔═══╗╔╗ ╔╗╔═╗ ║╔╗╔╗║║║ ╔╝╚╗ ║╔═╗║ ╚╣╠╝║╔═╗║ ║╔══╝║║ ║║║╔╝ ╚╝║║╚╝║╚═╗╔══╗╚╗╔╝╔══╗ ║╚═╝║╔═╗╔╗╔╗╔╗╔══╗ ║║ ║║ ║║ ╔═╗ ║╚══╗║║ ╔╗ ╔╗╔╗╔═╗ ╔══╗ ║╚╝╝ ╔╗╔═╗ ╔══╗ ║║ ║╔╗║║╔╗║ ║║ ╚ ╗║ ║╔══╝║╔╝╠╣║╚╝║║╔╗║ ║║ ║║ ║║ ╚═╝ ║╔══╝║║ ║║ ║║╠╣║╔╗╗║╔╗║ ║╔╗║ ╠╣║╔╗╗║╔╗║ ╔╝╚╗ ║║║║║║═╣ ║╚╗║╚╝╚╗║║ ║║ ║║║║║║║║═╣╔╗╔╣╠╗║╚═╝║ ╔═╗ ╔╝╚╗ ║╚╗║╚═╝║║║║║║║║╚╝║ ║║║╚╗║║║║║║║╚╝║ ╚══╝ ╚╝╚╝╚══╝ ╚═╝╚═══╝╚╝ ╚╝ ╚╝╚╩╩╝╚══╝╚╝╚══╝╚═══╝ ╚═╝ ╚══╝ ╚═╝╚═╗╔╝╚╝╚╝╚╝╚═╗║ ╚╝╚═╝╚╝╚╝╚╝╚═╗║ ╔═╝║ ╔═╝║ ╔═╝║ ╚══╝ ╚══╝ ╚══╝ ▄▀▀ █▄█ ██▀ ▄▀▀ █▄▀ ██▀ █▀▄ ▄▀▀ ▄▀▄ █ ▀█▀ █▀▄ ▄▀▄ █ █▄ █ ██▀ █▀▄ ▀▄▄ █ █ █▄▄ ▀▄▄ █ █ █▄▄ █▀▄ ▄██ █▀█ █ █ █▀▄ █▀█ █ █ ▀█ █▄▄ █▀▄ """
72.285714
106
0.003953
103
1,012
5.058252
0.543689
0.03071
0.023033
0.03071
0
0
0
0
0
0
0
0
0.478261
1,012
13
107
77.846154
0.007576
0
0
0
0
0
0.986166
0.063241
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
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
de0348ca9bc6b522e746cbbe2f2a9029bea33210
2,556
py
Python
haystack/backends/dummy_backend.py
mcroydon/django-haystack
bdb0151cb85dc3a1b2bafcf9f5f410c9653a4ac5
[ "BSD-3-Clause" ]
1
2016-05-09T12:26:20.000Z
2016-05-09T12:26:20.000Z
haystack/backends/dummy_backend.py
mcroydon/django-haystack
bdb0151cb85dc3a1b2bafcf9f5f410c9653a4ac5
[ "BSD-3-Clause" ]
null
null
null
haystack/backends/dummy_backend.py
mcroydon/django-haystack
bdb0151cb85dc3a1b2bafcf9f5f410c9653a4ac5
[ "BSD-3-Clause" ]
null
null
null
""" A fake backend for dummying during tests. """ import datetime from django.db import models from haystack.backends import BaseSearchBackend, BaseSearchQuery from haystack.constants import FILTER_SEPARATOR from haystack.models import SearchResult class DummySearchResult(SearchResult): dm = type('DummyModel', (object,), {}) def _get_object(self): return self.dm() def _set_object(self, obj): pass def _get_model(self): return self.dm def _set_model(self, obj): pass def content_type(self): return u"%s.%s" % (self.app_label, self.module_name) class SearchBackend(BaseSearchBackend): def update(self, indexer, iterable): pass def remove(self, obj): pass def clear(self, models): pass def search(self, query_string, sort_by=None, start_offset=0, end_offset=None, fields=[], highlight=False): if query_string == 'content__exact hello AND content__exact world': return { 'results': [DummySearchResult('haystack', 'dummymodel', 1, 1.5)], 'hits': 1, } return { 'results': [], 'hits': 0, } def prep_value(self, db_field, value): return value def more_like_this(self, model_instance): return { 'results': [], 'hits': 0 } class SearchQuery(BaseSearchQuery): def __init__(self, backend=None): super(SearchQuery, self).__init__(backend=backend) self.backend = backend or SearchBackend() def build_query(self): filters = [] for the_filter in self.query_filters: filter_list = [] if the_filter.is_and(): filter_list.append("AND") elif the_filter.is_not(): filter_list.append("NOT") elif the_filter.is_or(): filter_list.append("OR") filter_list.append(FILTER_SEPARATOR.join((the_filter.field, the_filter.filter_type))) filter_list.append(the_filter.value) if not len(filters): del(filter_list[0]) filters.append(" ".join(filter_list)) query = " ".join(filters) if self.order_by: query = "%s ORDER BY %s" % (query, ", ".join(self.order_by)) return query def clean(self, query_fragment): return query_fragment
26.350515
110
0.565336
277
2,556
5
0.34657
0.057762
0.057762
0.030325
0.031769
0.031769
0
0
0
0
0
0.004678
0.330986
2,556
96
111
26.625
0.805263
0.016041
0
0.151515
0
0
0.054647
0
0
0
0
0
0
1
0.212121
false
0.075758
0.075758
0.090909
0.484848
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
a9c4f7a863a238f325490e8bb2c4f36b6463e0f0
67
py
Python
1002.py
heltonricardo/URI
160cca22d94aa667177c9ebf2a1c9864c5e55b41
[ "MIT" ]
6
2021-04-13T00:33:43.000Z
2022-02-10T10:23:59.000Z
1002.py
heltonricardo/URI
160cca22d94aa667177c9ebf2a1c9864c5e55b41
[ "MIT" ]
null
null
null
1002.py
heltonricardo/URI
160cca22d94aa667177c9ebf2a1c9864c5e55b41
[ "MIT" ]
3
2021-03-23T18:42:24.000Z
2022-02-10T10:24:07.000Z
r = float(input()) a = r * r * 3.14159 print('A={:.4f}'.format(a))
16.75
27
0.522388
13
67
2.692308
0.692308
0
0
0
0
0
0
0
0
0
0
0.125
0.164179
67
3
28
22.333333
0.5
0
0
0
0
0
0.119403
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
a9cd438d188e21a7dfc68691d19c29be199f68db
1,836
py
Python
PyPoE/ui/__init__.py
Gloorf/PyPoE
23e60e0914a1a669764a552f762d2b2064203e75
[ "MIT" ]
247
2015-07-06T19:39:11.000Z
2022-03-30T13:11:03.000Z
PyPoE/ui/__init__.py
Gloorf/PyPoE
23e60e0914a1a669764a552f762d2b2064203e75
[ "MIT" ]
121
2015-09-01T23:50:22.000Z
2021-08-23T21:06:47.000Z
PyPoE/ui/__init__.py
Gloorf/PyPoE
23e60e0914a1a669764a552f762d2b2064203e75
[ "MIT" ]
109
2015-09-09T06:37:56.000Z
2022-03-20T16:06:33.000Z
""" UI Code Overview =============================================================================== +----------+------------------------------------------------------------------+ | Path | PyPoE/ui/__init__.py | +----------+------------------------------------------------------------------+ | Version | 1.0.0a0 | +----------+------------------------------------------------------------------+ | Revision | $Id: a9cd438d188e21a7dfc68691d19c29be199f68db $ | +----------+------------------------------------------------------------------+ | Author | Omega_K2 | +----------+------------------------------------------------------------------+ Description =============================================================================== Agreement =============================================================================== See PyPoE/LICENSE """ # ============================================================================= # Imports # ============================================================================= # Python # 3rd-party # self from PyPoE.ui.ggpk_viewer import GGPKViewerMainWindow from PyPoE.ui.launchpad import launchpad_main # ============================================================================= # Globals # ============================================================================= __all__ = [] _apps = [GGPKViewerMainWindow] # ============================================================================= # Entry point # ============================================================================= def main(*args, **kwargs): launchpad_main(_apps, *args, **kwargs) if __name__ == '__main__': main()
32.210526
79
0.204793
61
1,836
5.803279
0.704918
0.059322
0.062147
0
0
0
0
0
0
0
0
0.019468
0.160675
1,836
57
80
32.210526
0.210253
0.839869
0
0
0
0
0.028986
0
0
0
0
0
0
1
0.125
false
0
0.25
0
0.375
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a9df176c0ed713e3cddce7c43a695bb1378443c0
823
py
Python
learn/notebook.py
murakrishn/aima-python
5686c87bcfd3eb23be4a55d3e69762c98d88be23
[ "MIT" ]
null
null
null
learn/notebook.py
murakrishn/aima-python
5686c87bcfd3eb23be4a55d3e69762c98d88be23
[ "MIT" ]
null
null
null
learn/notebook.py
murakrishn/aima-python
5686c87bcfd3eb23be4a55d3e69762c98d88be23
[ "MIT" ]
null
null
null
from ast import Import from inspect import getsource import ipywidgets as widgets import matplotlib.pyplot as plt import networkx as nx import numpy as np from IPython.display import HTML from IPython.display import display from PIL import Image from matplotlib import lines # ---------------------------------------------------------------------- # Magic words def psource(*functions): """Print the pseudocode for the given algorithms""" source_code = '\n\n'.join(getsource(fn) for fn in functions) # print(source_code) try: from pygments.formatters import HtmlFormatter from pygments.lexers import PythonLexer from pygments import highlight display(HTML(highlight(source_code, PythonLexer(), HtmlFormatter(full=True)))) except ImportError: print(source_code)
31.653846
86
0.682868
98
823
5.693878
0.5
0.071685
0.064516
0.086022
0
0
0
0
0
0
0
0
0.17497
823
26
87
31.653846
0.821797
0.17983
0
0
0
0
0.005988
0
0
0
0
0
0
1
0.052632
false
0
0.736842
0
0.789474
0.052632
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
a9ea04f5f071c7e8e4f777207f4e9928ee49d868
277
py
Python
experiments/messaging/http/http_client.py
chartbeat-labs/wade
91923ed10bee4b2f084b156b31d4e4700bf2326c
[ "Apache-2.0" ]
16
2016-01-27T22:07:51.000Z
2020-04-26T01:23:05.000Z
experiments/messaging/http/http_client.py
chartbeat-labs/wade
91923ed10bee4b2f084b156b31d4e4700bf2326c
[ "Apache-2.0" ]
4
2016-02-03T22:00:39.000Z
2016-02-29T18:33:02.000Z
experiments/messaging/http/http_client.py
chartbeat-labs/wade
91923ed10bee4b2f084b156b31d4e4700bf2326c
[ "Apache-2.0" ]
4
2016-01-27T22:30:09.000Z
2019-02-17T02:02:18.000Z
import time import requests if __name__ == '__main__': num = 10000 s = requests.Session() st_time = time.time() for i in xrange(num): s.get('http://127.0.0.1:8088/') diff_time = time.time() - st_time print num / diff_time, "requests / sec"
17.3125
43
0.599278
41
277
3.756098
0.585366
0.207792
0.155844
0
0
0
0
0
0
0
0
0.072816
0.256318
277
15
44
18.466667
0.674757
0
0
0
0
0
0.15942
0
0
0
0
0
0
0
null
null
0
0.2
null
null
0.1
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
a9ed49fcbe30270e1bc48cb1dbe0513fa398d66b
818
py
Python
mod/database.py
404neko/bridge
56ed1095aff88b997107f42fd7a4b39d0b92aea7
[ "MIT" ]
null
null
null
mod/database.py
404neko/bridge
56ed1095aff88b997107f42fd7a4b39d0b92aea7
[ "MIT" ]
null
null
null
mod/database.py
404neko/bridge
56ed1095aff88b997107f42fd7a4b39d0b92aea7
[ "MIT" ]
null
null
null
from peewee import * database = MySQLDatabase('shortlink', **{'host': '106.185.40.164', 'password': 'AlexprprHaoqiao', 'port': 3306, 'user': 'root'}) class BaseModel(Model): class Meta: database = database class Pool(BaseModel): #data = TextField(null=False) time = DateTimeField(null=True) url = TextField(null=False) uid = TextField(null=False) title = TextField(null=False) content = TextField(null=False) #did = CharField(null=False) class Meta: db_table = 'pool' class Record(BaseModel): time = DateTimeField(null=False) ip = TextField(null=False) ua = TextField(null=False) referer = TextField(null=False) class Meta: db_table = 'record' if __name__ == '__main__': Pool.create_table(True) Record.create_table(True)
23.371429
128
0.654034
95
818
5.505263
0.473684
0.172084
0.275335
0.068834
0.095602
0.095602
0
0
0
0
0
0.02322
0.210269
818
35
129
23.371429
0.786378
0.067237
0
0.130435
0
0
0.104987
0
0
0
0
0
0
1
0
false
0.043478
0.043478
0
0.695652
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
a9f31d04658b06313ec151cdf48ee8a69f7d6a60
1,145
py
Python
tools/grit/grit/format/interface.py
JoKaWare/WTL-DUI
89fd6f4ed7e6a4ce85f9af29c40de0d9a85ca8b2
[ "BSD-3-Clause" ]
19
2015-03-30T09:49:58.000Z
2020-01-17T20:05:12.000Z
tools/grit/grit/format/interface.py
jjzhang166/WTL-DUI
89fd6f4ed7e6a4ce85f9af29c40de0d9a85ca8b2
[ "BSD-3-Clause" ]
1
2015-12-31T06:08:27.000Z
2015-12-31T06:08:27.000Z
tools/grit/grit/format/interface.py
jjzhang166/WTL-DUI
89fd6f4ed7e6a4ce85f9af29c40de0d9a85ca8b2
[ "BSD-3-Clause" ]
11
2015-06-01T06:18:03.000Z
2020-05-10T07:18:53.000Z
#!/usr/bin/env python # Copyright (c) 2012 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. '''Base classes for item formatters and file formatters. ''' import re class ItemFormatter(object): """Base class for a formatter that knows how to format a single item.""" def Format(self, item, lang='', output_dir='.'): """Format the start of this item. Returns a Unicode string representing 'item' in the format known by this item formatter, for the language 'lang'. Args: item: anything. lang: 'en' output_dir: '.' Returns: A unicode string. """ return '' def FormatEnd(self, item, lang='', output_dir='.'): """Format the end of this item. Returns a Unicode string representing the closure of 'item' in the format known by this item formatter, for the language 'lang'. Called (optionally) after the children of item have been formatted. Args: item: anything lang: 'en' output_dir: '.' Returns: A unicode string. """ return ''
23.854167
76
0.652402
158
1,145
4.702532
0.468354
0.048452
0.080754
0.113055
0.506057
0.506057
0.506057
0.425303
0.309556
0.309556
0
0.004651
0.248908
1,145
47
77
24.361702
0.859302
0.737991
0
0.333333
0
0
0.010152
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
e7051544d72cc51a84e114c6f95ef49033855fe8
330
py
Python
models/model.py
MarLisiecki/asm_tree_drawer
31528e76cf9ff239ddd4385fd71e4bf4ee0c3e63
[ "MIT" ]
null
null
null
models/model.py
MarLisiecki/asm_tree_drawer
31528e76cf9ff239ddd4385fd71e4bf4ee0c3e63
[ "MIT" ]
null
null
null
models/model.py
MarLisiecki/asm_tree_drawer
31528e76cf9ff239ddd4385fd71e4bf4ee0c3e63
[ "MIT" ]
null
null
null
from dataclasses import dataclass # Mnemonic model which contains root label, target label, name of jump as mnemonic (e.g. jnp) and jump_type, which is # the description of jump (e.g. Jump if not equal) @dataclass(frozen=True) class Mnemonic: name: str jump_type: str target_label: str root: str
27.5
117
0.693939
50
330
4.52
0.6
0.097345
0
0
0
0
0
0
0
0
0
0
0.239394
330
11
118
30
0.900398
0.49697
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.142857
0
0.857143
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
e72da99e34d29a403f8928cc9a39320753ff4f43
1,090
py
Python
setup.py
gbtami/gbulb
a2d73a1aaf0fb0408deb546af0028eec842eaa1f
[ "Apache-2.0" ]
null
null
null
setup.py
gbtami/gbulb
a2d73a1aaf0fb0408deb546af0028eec842eaa1f
[ "Apache-2.0" ]
1
2020-06-11T14:59:20.000Z
2020-06-11T15:36:48.000Z
setup.py
gbtami/gbulb
a2d73a1aaf0fb0408deb546af0028eec842eaa1f
[ "Apache-2.0" ]
1
2020-02-27T23:10:53.000Z
2020-02-27T23:10:53.000Z
#!/usr/bin/env python try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='gbulb', version='0.6.1', description='GLib event loop for tulip (PEP 3156)', author='Nathan Hoad', author_email='nathan@getoffmalawn.com', license='Apache 2.0', url='http://github.com/nathan-hoad/gbulb', packages=['gbulb'], long_description="""Gbulb is a python library that implements a PEP 3156 interface for the GLib main event loop. It is designed to be used together with the tulip reference implementation.""", classifiers=[ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: POSIX", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules", ], python_requires='>3.5' )
34.0625
196
0.643119
129
1,090
5.410853
0.627907
0.108883
0.143266
0.148997
0
0
0
0
0
0
0
0.027348
0.22844
1,090
31
197
35.16129
0.802616
0.018349
0
0
0
0.037037
0.602432
0.021515
0
0
0
0
0
1
0
true
0
0.111111
0
0.111111
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
0
0
0
0
0
0
1
0
0
0
0
0
0
2
e730bc3fbfd38821bf3551e776a6b0fb822ff3a1
1,633
py
Python
algorithms/ML/supervised/knn.py
agdenadel/python-algorithms
28c298e2bc311c609f39a9f1c75a5abc9cc66b8a
[ "MIT" ]
null
null
null
algorithms/ML/supervised/knn.py
agdenadel/python-algorithms
28c298e2bc311c609f39a9f1c75a5abc9cc66b8a
[ "MIT" ]
null
null
null
algorithms/ML/supervised/knn.py
agdenadel/python-algorithms
28c298e2bc311c609f39a9f1c75a5abc9cc66b8a
[ "MIT" ]
null
null
null
from collections import Counter class KNN: """ Implements K Nearest Neighbors classifier. """ def __init__(self, k, distance_function): """ Args: k (int): The number of neighbors used for voting distance_function (function(point, point)): A function used to compute the distance between two points """ self.k = k self.distance_function = distance_function @staticmethod def vote(nearest_neighbors): """ Returns the most common label among the k nearest neighbors Args: nearest_neighbors (iterable): The k nearest neighbors """ labels = Counter(map(lambda x: x.label, nearest_neighbors)) winning_label = max(labels, key=labels.get) return winning_label def predict(self, test_value, training_set): """ Predicts label for a point using the k nearest neighbors algorithm. Args: test_value: training_set: """ nearest_neighbors = sorted(training_set, key=lambda x: self.distance_function(test_value.coordinate, x.coordinate))[0:self.k] return self.vote(nearest_neighbors) def predict_multiple(self, test_values, training_set): """ Predicts labels for multiple points using the k nearest neighbors algorithm. Args: test_values (iterable): training_set (iterable): """ return map(lambda test_value: self.predict(test_value, training_set), test_values)
32.66
120
0.602572
178
1,633
5.353933
0.342697
0.167891
0.089192
0.083945
0.088143
0.088143
0.088143
0.088143
0
0
0
0.000904
0.322719
1,633
50
121
32.66
0.860759
0.353337
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.0625
0
0.5625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
e73bf37fe11519cc201138caf5dd314b0e59280f
246
py
Python
Mundo 1/ex029.py
othiagomanhaes/Python
8cfe6d50e31f6c9ff886e3961051cc4cbfb8569e
[ "MIT" ]
null
null
null
Mundo 1/ex029.py
othiagomanhaes/Python
8cfe6d50e31f6c9ff886e3961051cc4cbfb8569e
[ "MIT" ]
null
null
null
Mundo 1/ex029.py
othiagomanhaes/Python
8cfe6d50e31f6c9ff886e3961051cc4cbfb8569e
[ "MIT" ]
null
null
null
vel = int(input('Qual foi a velocidade do carro? ')) if vel > 80: print('Seu carro está acima da velocidade permitida que é 80km/h!!') multa = (vel - 80) * 7 print('Você será multado em R${} reais'.format(multa)) print('Boa viagem!')
35.142857
72
0.646341
40
246
3.975
0.8
0.062893
0
0
0
0
0
0
0
0
0
0.035714
0.203252
246
6
73
41
0.77551
0
0
0
0
0
0.54065
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
e74171b70498da7835d5b1cf3fdde8365a86d3ad
1,183
py
Python
cloudrail/knowledge/rules/aws/non_context_aware/iam_no_human_users_rule.py
my-devops-info/cloudrail-knowledge
b7c1bbd6fe1faeb79c105a01c0debbe24d031a0e
[ "MIT" ]
null
null
null
cloudrail/knowledge/rules/aws/non_context_aware/iam_no_human_users_rule.py
my-devops-info/cloudrail-knowledge
b7c1bbd6fe1faeb79c105a01c0debbe24d031a0e
[ "MIT" ]
null
null
null
cloudrail/knowledge/rules/aws/non_context_aware/iam_no_human_users_rule.py
my-devops-info/cloudrail-knowledge
b7c1bbd6fe1faeb79c105a01c0debbe24d031a0e
[ "MIT" ]
null
null
null
from typing import Dict, List from cloudrail.knowledge.context.aws.aws_environment_context import AwsEnvironmentContext from cloudrail.knowledge.rules.aws.aws_base_rule import AwsBaseRule from cloudrail.knowledge.rules.base_rule import Issue from cloudrail.knowledge.rules.rule_parameters.base_paramerter import ParameterType class IamNoHumanUsersRule(AwsBaseRule): def execute(self, env_context: AwsEnvironmentContext, parameters: Dict[ParameterType, any]) -> List[Issue]: issues_list: List[Issue] = [] for user in env_context.users: if any(user.name == login_profile.name and user.account == login_profile.account for login_profile in env_context.users_login_profile): issues_list.append(Issue(f'The {user.get_type()} `{user.get_friendly_name()}` has console access, ' f'and so is considered human', user, user)) return issues_list def get_id(self) -> str: return "non_car_iam_no_human_users" def should_run_rule(self, environment_context: AwsEnvironmentContext) -> bool: return bool(environment_context.users and environment_context.users_login_profile)
51.434783
147
0.742181
149
1,183
5.66443
0.402685
0.07109
0.104265
0.095972
0
0
0
0
0
0
0
0
0.177515
1,183
22
148
53.772727
0.86742
0
0
0
0
0
0.103973
0.045647
0
0
0
0
0
1
0.176471
false
0
0.294118
0.117647
0.705882
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
e7511f8270f75b24221d1d0cbcb03ce52d8033c7
4,194
py
Python
lianjiahouse/lianjiahouse/spiders/lianjia.py
Liu-Yichuan/-
eb3d1655cce3d2064f31f9420880bef6280a6dbd
[ "Apache-2.0" ]
4
2020-09-16T07:55:08.000Z
2021-12-06T16:05:44.000Z
lianjiahouse/lianjiahouse/spiders/lianjia.py
Liu-Yichuan/-
eb3d1655cce3d2064f31f9420880bef6280a6dbd
[ "Apache-2.0" ]
null
null
null
lianjiahouse/lianjiahouse/spiders/lianjia.py
Liu-Yichuan/-
eb3d1655cce3d2064f31f9420880bef6280a6dbd
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- #import scrapy # class LianjiaSpider(scrapy.Spider): # name = 'lianjia' # allowed_domains = [''https://sy.lianjia.com/ershoufang/''] # start_urls = ['http://'https://sy.lianjia.com/ershoufang/'/'] # # def parse(self, response): # pass from scrapy import Request from scrapy.spiders import Spider from lianjiahouse.items import LianjiahouseItem class house_chart(Spider): name = 'lianjia' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36', } def start_requests(self): start_url = 'https://sy.lianjia.com/ershoufang/' yield Request(url=start_url,headers=self.headers) def parse(self, response): house_list = response.xpath('//div[@class="info clear"]/div[@class="title"]/a/@href') for node in house_list: href = node.extract() yield Request(url=href,headers=self.headers,callback=self.parse1) #实现翻页 for i in range(11): if i != 0 and i != 1: next_url = 'https://sy.lianjia.com/ershoufang/pg%d' % i if next_url: yield Request(url=next_url,headers=self.headers,callback=self.parse) def parse1(self,response): item = LianjiahouseItem() item['totalprice'] = response.xpath('//div[@class="price "]/span[@class="total"]/text()').extract()[0] item['price'] = response.xpath('//div[@class="unitPrice"]/span[@class="unitPriceValue"]/text()').extract()[0] item['house_model'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[1]/text()').extract()[0] item['floor'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[2]/text()').extract()[0] item['area'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[3]/text()').extract()[0] item['structure'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[4]/text()').extract()[0] item['space_in'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[5]/text()').extract()[0] item['build_type'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[6]/text()').extract()[0] item['build_head'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[7]/text()').extract()[0] item['build_struc'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[8]/text()').extract()[0] item['decorate'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[9]/text()').extract()[0] item['proportion'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[10]/text()').extract()[0] item['heating_meth'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[11]/text()').extract()[0] item['elevator'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[12]/text()').extract()[0] item['year_pro'] = response.xpath('//div[@class="base"]/div[@class="content"]/ul/li[13]/text()').extract()[0] item['time'] = response.xpath('//div[@class="transaction"]/div[@class="content"]/ul/li[1]/span[2]/text()').extract()[0] item['trans'] = response.xpath('//div[@class="transaction"]/div[@class="content"]/ul/li[2]/span[2]/text()').extract()[0] item['last_trans'] = response.xpath('//div[@class="transaction"]/div[@class="content"]/ul/li[3]/span[2]/text()').extract()[0] item['usage'] = response.xpath('//div[@class="transaction"]/div[@class="content"]/ul/li[4]/span[2]/text()').extract()[0] item['build_pro'] = response.xpath('//div[@class="transaction"]/div[@class="content"]/ul/li[5]/span[2]/text()').extract()[0] item['belonging'] = response.xpath('//div[@class="transaction"]/div[@class="content"]/ul/li[6]/span[2]/text()').extract()[0] item['mortgaga_info'] = response.xpath('//div[@class="transaction"]/div[@class="content"]/ul/li[7]/span[2]/text()').extract()[0] item['room_parts'] = response.xpath('//div[@class="transaction"]/div[@class="content"]/ul/li[8]/span[2]/text()').extract()[0] yield item
64.523077
139
0.607535
564
4,194
4.478723
0.223404
0.145685
0.152019
0.199525
0.567696
0.480206
0.391924
0.391924
0.391924
0.391924
0
0.025208
0.139247
4,194
65
140
64.523077
0.674515
0.063901
0
0
0
0.468085
0.486466
0.375128
0
0
0
0
0
1
0.06383
false
0
0.06383
0
0.191489
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
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
e75b59d33523dde01a3913d32191191f014f87f2
593
py
Python
ABC/abc001-abc050/abc032/a.py
KATO-Hiro/AtCoder
cbbdb18e95110b604728a54aed83a6ed6b993fde
[ "CC0-1.0" ]
2
2020-06-12T09:54:23.000Z
2021-05-04T01:34:07.000Z
ABC/abc001-abc050/abc032/a.py
KATO-Hiro/AtCoder
cbbdb18e95110b604728a54aed83a6ed6b993fde
[ "CC0-1.0" ]
961
2020-06-23T07:26:22.000Z
2022-03-31T21:34:52.000Z
ABC/abc001-abc050/abc032/a.py
KATO-Hiro/AtCoder
cbbdb18e95110b604728a54aed83a6ed6b993fde
[ "CC0-1.0" ]
null
null
null
'''input 97 89 20000 25899 10 5 8 10 97 89 8634 17266 97 89 8633 8633 100 100 101 200 1 1 1 1 1 1 20000 20000 100 100 20000 20000 12 8 25 48 2 3 8 12 2 2 2 2 ''' # -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem A if __name__ == '__main__': a = int(input()) b = int(input()) n = int(input()) # See: # https://beta.atcoder.jp/contests/abc032/submissions/2264731 for i in range(n, 30000 + 1): if i % a == 0 and i % b == 0: print(i) exit()
7.906667
66
0.48398
92
593
3.032609
0.543478
0.035842
0.043011
0.043011
0.021505
0
0
0
0
0
0
0.352273
0.406408
593
74
67
8.013514
0.440341
0.48398
0
0
0
0
0.036364
0
0
0
0
0
0
1
0
false
0
0
0
0
0.125
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
e76dd747e199cd130685c17c41e7e62cfab210ba
849
py
Python
catalog/migrations/0018_auto_20190809_1907.py
esalascolas/blog_diari
43f6d22db745a38559fc2dcb8ea52c39a9d28753
[ "MIT" ]
null
null
null
catalog/migrations/0018_auto_20190809_1907.py
esalascolas/blog_diari
43f6d22db745a38559fc2dcb8ea52c39a9d28753
[ "MIT" ]
13
2020-02-11T22:06:44.000Z
2022-02-10T08:23:36.000Z
catalog/migrations/0018_auto_20190809_1907.py
esalascolas/blog_diari
43f6d22db745a38559fc2dcb8ea52c39a9d28753
[ "MIT" ]
null
null
null
# Generated by Django 2.0.1 on 2019-08-09 17:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('catalog', '0017_remove_trip_route_trip_image'), ] operations = [ migrations.AlterField( model_name='plannedtrip', name='hero_image', field=models.ImageField(blank=True, help_text='Imatge hero', upload_to='plannedtrip'), ), migrations.AlterField( model_name='planstatusupdate', name='day_image', field=models.ImageField(blank=True, upload_to='plannedtripDay'), ), migrations.AlterField( model_name='redactor', name='hero_image', field=models.ImageField(blank=True, help_text='Imatge hero', upload_to='redactor'), ), ]
29.275862
98
0.608952
87
849
5.758621
0.517241
0.11976
0.149701
0.173653
0.345309
0.345309
0.275449
0.275449
0.275449
0.275449
0
0.030794
0.273263
849
28
99
30.321429
0.781199
0.053004
0
0.363636
1
0
0.198254
0.041147
0
0
0
0
0
1
0
false
0
0.045455
0
0.181818
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
e76f7f390c533fc963121728f5eae3cc5c96820f
161
py
Python
pylite/__init__.py
dariubs/pylite
79258a07b8d84e7df802fc57721bb339b2f589c5
[ "MIT" ]
12
2019-12-04T19:00:44.000Z
2021-08-21T10:16:09.000Z
pylite/__init__.py
dariubs/simplite.py
79258a07b8d84e7df802fc57721bb339b2f589c5
[ "MIT" ]
1
2020-11-30T18:18:08.000Z
2020-11-30T18:18:08.000Z
pylite/__init__.py
dariubs/pylite
79258a07b8d84e7df802fc57721bb339b2f589c5
[ "MIT" ]
4
2019-06-29T16:21:31.000Z
2020-05-03T08:15:04.000Z
# -*- coding: utf-8 -*- """ pylite ~~~~~~~~~ :copyright: (c) 2014 by Dariush Abbasi. :license: MIT, see LICENSE for more details. """ __version__ = "0.1.0"
16.1
45
0.57764
21
161
4.238095
0.904762
0
0
0
0
0
0
0
0
0
0
0.061069
0.186335
161
9
46
17.888889
0.618321
0.770186
0
0
0
0
0.2
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
e78e555e6bbded5983da12da7c36b56b1a6626bb
2,292
py
Python
preapp/technologies/react.py
najaco/preapp
6206d4cee68f9b6a63d4e1661c7c439012fc5ce0
[ "MIT" ]
null
null
null
preapp/technologies/react.py
najaco/preapp
6206d4cee68f9b6a63d4e1661c7c439012fc5ce0
[ "MIT" ]
null
null
null
preapp/technologies/react.py
najaco/preapp
6206d4cee68f9b6a63d4e1661c7c439012fc5ce0
[ "MIT" ]
null
null
null
from preapp.hooks import action_hook from preapp.node import Node from preapp.utils.miscellaneous import bash from preapp.utils.githubio import commit_and_push from preapp.utils import __assets_directory__ import os from preapp.utils.fileio import ( append_file_to_file, copy_file, delete_file, file_to_text, ) @action_hook("framework", "web_frontend", "react") def setup(): project_name: str = Node.get_full_response()["metadata"]["name"] if not Node.get_full_response()["github"]["use"]: bash(f"npx create-react-app {project_name}") else: github_username: str = Node.get_full_response()["github_credentials"]["username"] github_auth: str = "" if "password" in Node.get_full_response()["github_credentials"]: github_auth = Node.get_full_response()["github_credentials"]["password"] if "oauth_token" in Node.get_full_response()["github_credentials"]: github_auth = Node.get_full_response()["github_credentials"]["oauth_token"] bash(f"cd {project_name} && npx create-react-app website") # gitignore_file_path: str = f"{os.getcwd()}/{project_name}/website/.gitignore" # append_file_to_file(gitignore_file_path, f"{os.getcwd()}/{project_name}/.gitignore") # delete_file(gitignore_file_path) commit_and_push( "Initialized React", project_name, github_username, github_auth, directory=project_name, ) @action_hook("github_actions", "web_frontend", "react") def setup_actions(): project_name: str = Node.get_full_response()["metadata"]["name"] github_username: str = Node.get_full_response()["github_credentials"]["username"] github_auth: str = "" if "password" in Node.get_full_response()["github_credentials"]: github_auth = Node.get_full_response()["github_credentials"]["password"] if "oauth_token" in Node.get_full_response()["github_credentials"]: github_auth = Node.get_full_response()["github_credentials"]["oauth_token"] copy_file( f"{__assets_directory__}/react/nodejs.yml", f"{os.getcwd()}/{project_name}/.github/workflows/nodejs.yml", ) commit_and_push( "Setup Github Actions", project_name, github_username, github_auth, directory=project_name, )
39.517241
100
0.704188
289
2,292
5.224913
0.217993
0.060265
0.094702
0.163576
0.59404
0.50596
0.50596
0.50596
0.50596
0.37351
0
0
0.163613
2,292
57
101
40.210526
0.787689
0.085079
0
0.363636
0
0
0.276636
0.045867
0
0
0
0
0
1
0.045455
false
0.090909
0.159091
0
0.204545
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
e7964796b9ab80b4e2528d64eedc12992d2ed334
244
py
Python
Estudos/110exercicios/Exercicios/ex064b.py
romuloferraz/Python
2e20e7483cf9ea74b0b514f253034002bb56807f
[ "MIT" ]
null
null
null
Estudos/110exercicios/Exercicios/ex064b.py
romuloferraz/Python
2e20e7483cf9ea74b0b514f253034002bb56807f
[ "MIT" ]
null
null
null
Estudos/110exercicios/Exercicios/ex064b.py
romuloferraz/Python
2e20e7483cf9ea74b0b514f253034002bb56807f
[ "MIT" ]
null
null
null
num = cont = 0 s = 0 num = int(input('Digite um número [999 para PARAR]: ')) while num != 999: s = s + num cont += 1 num = int(input('Digite um número [999 para PARAR]: ')) print(f'Você digitou {cont} números e a soma deles é {s}')
27.111111
59
0.598361
43
244
3.395349
0.55814
0.09589
0.150685
0.232877
0.506849
0.506849
0.506849
0.506849
0.506849
0
0
0.065217
0.245902
244
8
60
30.5
0.728261
0
0
0.25
0
0
0.483607
0
0
0
0
0
0
1
0
false
0
0
0
0
0.125
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
e79b3c18a95ca266ee267d88b501327646e581de
614
py
Python
search/linear_search.py
thalysonrodrigues/data-structures
b3540f3115cc117f79085b5c7173e1a8d7845dc9
[ "MIT" ]
1
2021-03-16T19:59:28.000Z
2021-03-16T19:59:28.000Z
search/linear_search.py
thalysonalexr/data-structures
b3540f3115cc117f79085b5c7173e1a8d7845dc9
[ "MIT" ]
null
null
null
search/linear_search.py
thalysonalexr/data-structures
b3540f3115cc117f79085b5c7173e1a8d7845dc9
[ "MIT" ]
null
null
null
def busca_linear_recursiva(elemento, l, idx=0): if elemento == l[idx]: return idx if idx == len(l)-1: return -1 return busca_linear_recursiva(elemento, l, idx + 1) def busca_linear(elemento, l): for i, e in enumerate(l): if elemento == e: return i return -1 if __name__ == '__main__': l = [44, 12, 43, 8, 99, 13, 1, -1, 4] i = busca_linear_recursiva(int(input('Elemento: ')), l) print('---- * LINEAR SEARCH * ----') if i != -1: print('Elemento encontrado! Posição %d.' % i) else: print('O elemento não está na lista.')
26.695652
59
0.558632
88
614
3.727273
0.443182
0.137195
0.182927
0.170732
0.195122
0.195122
0
0
0
0
0
0.045662
0.286645
614
23
60
26.695652
0.703196
0
0
0.105263
0
0
0.172358
0
0
0
0
0
0
1
0.105263
false
0
0
0
0.368421
0.157895
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
e7b4bd1ed3947f14d23317feb8bbd170a4181fc5
335
py
Python
Chapter5/py016.py
vztpv/Python-Study
a41e4e916cf264360ecdc3b59929246c672c87c4
[ "MIT" ]
null
null
null
Chapter5/py016.py
vztpv/Python-Study
a41e4e916cf264360ecdc3b59929246c672c87c4
[ "MIT" ]
null
null
null
Chapter5/py016.py
vztpv/Python-Study
a41e4e916cf264360ecdc3b59929246c672c87c4
[ "MIT" ]
null
null
null
# 5-5 Problems print(all([1, 2, abs(-3)-3])) print(chr(ord('a')) == 'a') x = [1, -2, 3, -5, 8, -3] print(list(filter(lambda val: val > 0, x))) x = hex(234) print(int(x, 16)) x = [1, 2, 3, 4] print(list(map(lambda a: a * 3, x))) x = [-8, 2, 7, 5, -3, 5, 0, 1] print(max(x) + min(x)) x = 17 / 3 print(round(x, 4))
17.631579
44
0.468657
71
335
2.211268
0.408451
0.038217
0.038217
0.050955
0
0
0
0
0
0
0
0.138889
0.247761
335
19
45
17.631579
0.484127
0.035821
0
0
0
0
0.006579
0
0
0
0
0
0
1
0
false
0
0
0
0
0.583333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
e7c157fc1833580f9f4150cafbc927deaa86d6a5
722
py
Python
data_management_scripts/group_age_data.py
skoskjei/ResNet_age_emotion
40ded5f744f0110ecac452cb57c5a90626b8fb79
[ "MIT" ]
null
null
null
data_management_scripts/group_age_data.py
skoskjei/ResNet_age_emotion
40ded5f744f0110ecac452cb57c5a90626b8fb79
[ "MIT" ]
null
null
null
data_management_scripts/group_age_data.py
skoskjei/ResNet_age_emotion
40ded5f744f0110ecac452cb57c5a90626b8fb79
[ "MIT" ]
null
null
null
import glob, os import shutil olddir = os.getcwd() newdir = olddir + "\\face_age_add_age_and_emotion_done" os.chdir(newdir) for file in glob.glob("*.png"): if file.startswith("072_") or file.startswith("073_") or file.startswith("074_") or file.startswith("075_") or file.startswith("076_") or file.startswith("077_") or file.startswith("078_"): #change to 1 filenamesplit = file.split("_") filenamept2 = filenamesplit[1] filenamept3 = filenamesplit[2] newfilename = "25" + "_" + str(filenamept2) + "_" + str(filenamept3) destfile = olddir + "\\face_age_add_age_and_emotion_really_done_now_finito\\" + newfilename shutil.move(file, destfile)
40.111111
194
0.663435
89
722
5.101124
0.494382
0.215859
0.211454
0.070485
0.127753
0.127753
0.127753
0
0
0
0
0.051903
0.199446
722
18
195
40.111111
0.733564
0.015235
0
0
0
0
0.184438
0.129683
0.076923
0
0
0
0
1
0
false
0
0.153846
0
0.153846
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
e7c7b7d251f6586fc103736bb9561d3612819084
209
py
Python
Crie um algoritmo que leia um numeor e mostre o seu dobro e seu triplo e raiz quadrada.py
Thiago251/Codigos_Python
566be04310cd87b6df718746581eba0da2f0293d
[ "MIT" ]
null
null
null
Crie um algoritmo que leia um numeor e mostre o seu dobro e seu triplo e raiz quadrada.py
Thiago251/Codigos_Python
566be04310cd87b6df718746581eba0da2f0293d
[ "MIT" ]
null
null
null
Crie um algoritmo que leia um numeor e mostre o seu dobro e seu triplo e raiz quadrada.py
Thiago251/Codigos_Python
566be04310cd87b6df718746581eba0da2f0293d
[ "MIT" ]
null
null
null
n = int(input('Digite um numero: ')) print('O dobro de n é:', n**2 ) print('O triplo de n é: ', n ** 3 ) print('A raiz quadrada de n é:', n ** (1/2 )) print('A raiz quadrada de n é {:.3f}' .format(n ** (1/2)))
41.8
58
0.555024
44
209
2.636364
0.454545
0.103448
0.137931
0.12931
0.37931
0.37931
0.37931
0
0
0
0
0.041916
0.200957
209
5
58
41.8
0.652695
0
0
0
0
0
0.485714
0
0
0
0
0
0
1
0
false
0
0
0
0
0.8
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
e7d3e6b1568d90231951fbf8fa56f99f113dc472
997
py
Python
heltour/tournament/migrations/0047_auto_20160802_2258.py
lenguyenthanh/heltour
13018b1905539de0b273370a76f6aa1d1ebbb01a
[ "MIT" ]
null
null
null
heltour/tournament/migrations/0047_auto_20160802_2258.py
lenguyenthanh/heltour
13018b1905539de0b273370a76f6aa1d1ebbb01a
[ "MIT" ]
null
null
null
heltour/tournament/migrations/0047_auto_20160802_2258.py
lenguyenthanh/heltour
13018b1905539de0b273370a76f6aa1d1ebbb01a
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-02 22:58 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tournament', '0046_auto_20160802_2113'), ] operations = [ migrations.AlterField( model_name='round', name='number', field=models.PositiveIntegerField(verbose_name='round number'), ), migrations.AlterField( model_name='season', name='start_date', field=models.DateTimeField(blank=True, null=True), ), migrations.AlterField( model_name='team', name='name', field=models.CharField(max_length=255, verbose_name='team name'), ), migrations.AlterField( model_name='team', name='number', field=models.PositiveIntegerField(verbose_name='team number'), ), ]
27.694444
77
0.585757
97
997
5.845361
0.536082
0.141093
0.176367
0.204586
0.306878
0.306878
0.183422
0
0
0
0
0.049929
0.296891
997
35
78
28.485714
0.758916
0.067202
0
0.428571
1
0
0.118662
0.024811
0
0
0
0
0
1
0
false
0
0.071429
0
0.178571
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
99b4205d6f4167841d99deb57ea4a9a25aa6bcbb
231
py
Python
yt/frontends/gdf/api.py
aemerick/yt
984484616d75c6d7603e71b9d45c5d617705a0e5
[ "BSD-3-Clause-Clear" ]
null
null
null
yt/frontends/gdf/api.py
aemerick/yt
984484616d75c6d7603e71b9d45c5d617705a0e5
[ "BSD-3-Clause-Clear" ]
null
null
null
yt/frontends/gdf/api.py
aemerick/yt
984484616d75c6d7603e71b9d45c5d617705a0e5
[ "BSD-3-Clause-Clear" ]
null
null
null
from .data_structures import \ GDFGrid, \ GDFHierarchy, \ GDFDataset from .fields import \ GDFFieldInfo add_gdf_field = GDFFieldInfo.add_field from .io import \ IOHandlerGDFHDF5 from . import tests
16.5
38
0.688312
24
231
6.458333
0.625
0.193548
0
0
0
0
0
0
0
0
0
0.005814
0.255411
231
13
39
17.769231
0.895349
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
99b5c95489cbab0d2154e8450efb039c6f06013a
20,930
py
Python
language_identification.py
honeybhardwaj/Language_Identification
1b74f898be5402b0c1a13debf595736a3f57d7e7
[ "MIT" ]
4
2021-03-25T15:49:56.000Z
2021-12-15T09:10:04.000Z
language_identification.py
honeybhardwaj/Language_Identification
1b74f898be5402b0c1a13debf595736a3f57d7e7
[ "MIT" ]
null
null
null
language_identification.py
honeybhardwaj/Language_Identification
1b74f898be5402b0c1a13debf595736a3f57d7e7
[ "MIT" ]
3
2021-03-28T16:13:00.000Z
2021-07-16T10:27:25.000Z
# -*- coding: utf-8 -*- """language_identification.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/14nWthI6ULAXAdK0KcmNdQiwa22c1Yk37 ## Importing Libraries """ import warnings warnings.filterwarnings("ignore") from mpl_toolkits.mplot3d import Axes3D from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt # plotting import numpy as np import seaborn as sns import pandas as pd import re from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score,confusion_matrix from sklearn.feature_extraction.text import CountVectorizer from sklearn.preprocessing import LabelEncoder """## Loading Dataset""" dataset=pd.read_csv("/content/drive/MyDrive/dataset.csv") dataset.head() # Distribution graphs (histogram/bar graph) of column data def plotPerColumnDistribution(df, nGraphShown, nGraphPerRow): nunique = df.nunique() df = df[[col for col in df if nunique[col] > 1 and nunique[col] < 50]] # For displaying purposes, pick columns that have between 1 and 50 unique values nRow, nCol = df.shape columnNames = list(df) nGraphRow = (nCol + nGraphPerRow - 1) / nGraphPerRow plt.figure(num = None, figsize = (6 * nGraphPerRow, 8 * nGraphRow), dpi = 80, facecolor = 'w', edgecolor = 'k') for i in range(min(nCol, nGraphShown)): plt.subplot(nGraphRow, nGraphPerRow, i + 1) columnDf = df.iloc[:, i] if (not np.issubdtype(type(columnDf.iloc[0]), np.number)): valueCounts = columnDf.value_counts() valueCounts.plot.bar() else: columnDf.hist() plt.ylabel('counts') plt.xticks(rotation = 90) plt.title(f'{columnNames[i]} (column {i})') plt.tight_layout(pad = 1.0, w_pad = 1.0, h_pad = 1.0) plt.show() plotPerColumnDistribution(dataset, 10, 5) """## Data Preprocessing this will be doing following: * Splitting X and Y * Encoding Y * Cleaning and Lowering Text """ # Splitting X and Y x,y = dataset["Text"],dataset["language"] # Encoding Y #encoder = LabelEncoder() #y = encoder.fit_transform(y) print(y[:10]) print(len(np.unique(y))) # Cleaning and lowering text def cleanLower(texts): # This regular expression pattern means everything except alphabetical characters pattern = "^[a-zA-Z]" cleanText = [] for text in texts: # re.sub(pattern) means replace everything with a space except alphabetical characters cleanText.append(re.sub(pattern," ",text).lower()) return cleanText x = cleanLower(x) x[:4] """## test train splitting""" #split the data into train and test set from sklearn.model_selection import train_test_split train_features, test_features, train_labels, test_labels = train_test_split(x, y, test_size=0.20, random_state=5) print('lenght of training data = ',len(train_features)) print('lenght of test data = ', len(test_features)) """## Feature Extraction""" from sklearn.feature_extraction.text import* from sklearn import preprocessing from sklearn.preprocessing import LabelEncoder #uni gram uni_vector = CountVectorizer( strip_accents='unicode', analyzer='word', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(1,1), max_features=1000) bag_of_words_uni = uni_vector.fit_transform(train_features) #bigram bi_vector = CountVectorizer( strip_accents='unicode', analyzer='word', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(2,2), max_features=1000) bag_of_words_bi = bi_vector.fit_transform(train_features) #trigram tri_vector = CountVectorizer( strip_accents='unicode', analyzer='word', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(3,3), max_features=1000) bag_of_words_tri = tri_vector.fit_transform(train_features) #3chargram char3_vector = CountVectorizer( strip_accents='unicode', analyzer='char', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(3,3), max_features=1000) bag_of_words_char3 = char3_vector.fit_transform(train_features) #4chargram char4_vector = CountVectorizer( strip_accents='unicode', analyzer='char', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(4,4), max_features=1000) bag_of_words_char4 = char4_vector.fit_transform(train_features) #5chargram char5_vector = CountVectorizer( strip_accents='unicode', analyzer='char', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(5,5), max_features=1000) bag_of_words_char5 = char5_vector.fit_transform(train_features) #6chargram char6_vector = CountVectorizer( strip_accents='unicode', analyzer='char', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(6,6), max_features=1000) bag_of_words_char6 = char6_vector.fit_transform(train_features) #7chargram char7_vector = CountVectorizer( strip_accents='unicode', analyzer='char', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(7,7), max_features=1000) bag_of_words_char7 = char7_vector.fit_transform(train_features) #8chargram char8_vector = CountVectorizer( strip_accents='unicode', analyzer='char', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(1,1), max_features=1000) bag_of_words_char8 = char8_vector.fit_transform(train_features) #9chargram char9_vector = CountVectorizer( strip_accents='unicode', analyzer='char', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(9,9), max_features=1000) bag_of_words_char9 = char9_vector.fit_transform(train_features) #10chargram char10_vector = CountVectorizer( strip_accents='unicode', analyzer='char', token_pattern=r'\w{1,}', stop_words=None, ngram_range=(10,10), max_features=1000) bag_of_words_char10 = char10_vector.fit_transform(train_features) # Get feature names uni_feature_names = uni_vector.get_feature_names() bi_feature_names = bi_vector.get_feature_names() tri_feature_names = tri_vector.get_feature_names() char3_feature_names = char3_vector.get_feature_names() char4_feature_names = char4_vector.get_feature_names() char5_feature_names = char5_vector.get_feature_names() char6_feature_names = char6_vector.get_feature_names() char7_feature_names = char7_vector.get_feature_names() char8_feature_names = char8_vector.get_feature_names() char9_feature_names = char9_vector.get_feature_names() char10_feature_names = char10_vector.get_feature_names() uni_train_features=pd.DataFrame(bag_of_words_uni.toarray(), columns=uni_feature_names) uni_train_features[:5] bi_train_features=pd.DataFrame(bag_of_words_bi.toarray(), columns=bi_feature_names) tri_train_features=pd.DataFrame(bag_of_words_tri.toarray(), columns=tri_feature_names) char3_train_features=pd.DataFrame(bag_of_words_char3.toarray(), columns=char3_feature_names) char4_train_features=pd.DataFrame(bag_of_words_char4.toarray(), columns=char4_feature_names) char5_train_features=pd.DataFrame(bag_of_words_char5.toarray(), columns=char5_feature_names) char6_train_features=pd.DataFrame(bag_of_words_char6.toarray(), columns=char6_feature_names) char7_train_features=pd.DataFrame(bag_of_words_char7.toarray(), columns=char7_feature_names) char8_train_features=pd.DataFrame(bag_of_words_char8.toarray(), columns=char8_feature_names) char9_train_features=pd.DataFrame(bag_of_words_char9.toarray(), columns=char9_feature_names) char10_train_features=pd.DataFrame(bag_of_words_char10.toarray(), columns=char10_feature_names) """## training data on ml models * Random Forest * Linear SVC * Logistic Regression """ from sklearn.ensemble import RandomForestClassifier #apply RandomForestClassifier on train dataset rfc_uni = RandomForestClassifier() rfc_uni.fit(uni_train_features, train_labels); rfc_bi = RandomForestClassifier() rfc_bi.fit(bi_train_features, train_labels); rfc_tri = RandomForestClassifier() rfc_tri.fit(tri_train_features, train_labels); rfc_char3 = RandomForestClassifier() rfc_char3.fit(char3_train_features, train_labels); rfc_char4 = RandomForestClassifier() rfc_char4.fit(char4_train_features, train_labels); rfc_char5 = RandomForestClassifier() rfc_char5.fit(char5_train_features, train_labels); rfc_char6 = RandomForestClassifier() rfc_char6.fit(char6_train_features, train_labels); rfc_char7 = RandomForestClassifier() rfc_char7.fit(char7_train_features, train_labels); rfc_char8 = RandomForestClassifier() rfc_char8.fit(char8_train_features, train_labels); rfc_char9 = RandomForestClassifier() rfc_char9.fit(char9_train_features, train_labels); rfc_char10 = RandomForestClassifier() rfc_char10.fit(char10_train_features, train_labels); from sklearn.svm import LinearSVC #apply LinearSVC() on train dataset lsvc_uni = LinearSVC() lsvc_uni.fit(uni_train_features, train_labels); lsvc_bi = LinearSVC() lsvc_bi.fit(bi_train_features, train_labels); lsvc_tri = LinearSVC() lsvc_tri.fit(tri_train_features, train_labels); lsvc_char3 = LinearSVC() lsvc_char3.fit(char3_train_features, train_labels); lsvc_char4 = LinearSVC() lsvc_char4.fit(char4_train_features, train_labels); lsvc_char5 = LinearSVC() lsvc_char5.fit(char5_train_features, train_labels); lsvc_char6 = LinearSVC() lsvc_char6.fit(char6_train_features, train_labels); lsvc_char7 = LinearSVC() lsvc_char7.fit(char7_train_features, train_labels); lsvc_char8 = LinearSVC() lsvc_char8.fit(char8_train_features, train_labels); lsvc_char9 = LinearSVC() lsvc_char9.fit(char9_train_features, train_labels); lsvc_char10 = LinearSVC() lsvc_char10.fit(char10_train_features, train_labels); from sklearn.linear_model import LogisticRegression #apply LogisticRegression() on train dataset lr_uni = LogisticRegression() lr_uni.fit(uni_train_features, train_labels); lr_bi = LogisticRegression() lr_bi.fit(bi_train_features, train_labels); lr_tri = LogisticRegression() lr_tri.fit(tri_train_features, train_labels); lr_char3 = LogisticRegression() lr_char3.fit(char3_train_features, train_labels); lr_char4 = LogisticRegression() lr_char4.fit(char4_train_features, train_labels); lr_char5 = LogisticRegression() lr_char5.fit(char5_train_features, train_labels); lr_char6 = LogisticRegression() lr_char6.fit(char6_train_features, train_labels); lr_char7 = LogisticRegression() lr_char7.fit(char7_train_features, train_labels); lr_char8 = LogisticRegression() lr_char8.fit(char8_train_features, train_labels); lr_char9 = LogisticRegression() lr_char9.fit(char9_train_features, train_labels); lr_char10 = LogisticRegression() lr_char10.fit(char10_train_features, train_labels); """## testing model""" uni_test_features = uni_vector.transform(test_features) uni_test_features=pd.DataFrame(uni_test_features.toarray(), columns=uni_feature_names) uni_test_features[:5] bi_test_features = bi_vector.transform(test_features) bi_test_features=pd.DataFrame(bi_test_features.toarray(), columns=bi_feature_names) tri_test_features = tri_vector.transform(test_features) tri_test_features=pd.DataFrame(tri_test_features.toarray(), columns=tri_feature_names) char3_test_features = char3_vector.transform(test_features) char3_test_features=pd.DataFrame(char3_test_features.toarray(), columns=char3_feature_names) char4_test_features = char4_vector.transform(test_features) char4_test_features=pd.DataFrame(char4_test_features.toarray(), columns=char4_feature_names) char5_test_features = char5_vector.transform(test_features) char5_test_features=pd.DataFrame(char5_test_features.toarray(), columns=char5_feature_names) char6_test_features = char6_vector.transform(test_features) char6_test_features=pd.DataFrame(char6_test_features.toarray(), columns=char6_feature_names) char7_test_features = char7_vector.transform(test_features) char7_test_features=pd.DataFrame(char7_test_features.toarray(), columns=char7_feature_names) char8_test_features = char8_vector.transform(test_features) char8_test_features=pd.DataFrame(char8_test_features.toarray(), columns=char8_feature_names) char9_test_features = char9_vector.transform(test_features) char9_test_features=pd.DataFrame(char9_test_features.toarray(), columns=char9_feature_names) char10_test_features = char10_vector.transform(test_features) char10_test_features=pd.DataFrame(char10_test_features.toarray(), columns=char10_feature_names) """## Evaluation using test data on ml algorithms""" from sklearn.metrics import accuracy_score # random forest predictions_uni_rfc = rfc_uni.predict(uni_test_features) #prediction uni_rfc = accuracy_score(test_labels, predictions_uni_rfc) #accuracy predictions_bi_rfc = rfc_bi.predict(bi_test_features) #prediction bi_rfc = accuracy_score(test_labels, predictions_bi_rfc) #accuracy predictions_tri_rfc = rfc_tri.predict(tri_test_features) #prediction tri_rfc = accuracy_score(test_labels, predictions_tri_rfc) #accuracy predictions_char3_rfc = rfc_char3.predict(char3_test_features) #prediction char3_rfc = accuracy_score(test_labels, predictions_char3_rfc) #accuracy predictions_char4_rfc = rfc_char4.predict(char4_test_features) #prediction char4_rfc = accuracy_score(test_labels, predictions_char4_rfc) #accuracy predictions_char5_rfc = rfc_char5.predict(char5_test_features) #prediction char5_rfc = accuracy_score(test_labels, predictions_char5_rfc) #accuracy predictions_char6_rfc = rfc_char6.predict(char6_test_features) #prediction char6_rfc = accuracy_score(test_labels, predictions_char6_rfc) #accuracy predictions_char7_rfc = rfc_char7.predict(char7_test_features) #prediction char7_rfc = accuracy_score(test_labels, predictions_char7_rfc) #accuracy predictions_char8_rfc = rfc_char8.predict(char8_test_features) #prediction char8_rfc = accuracy_score(test_labels, predictions_char8_rfc) #accuracy predictions_char9_rfc = rfc_char9.predict(char9_test_features) #prediction char9_rfc = accuracy_score(test_labels, predictions_char9_rfc) #accuracy predictions_char10_rfc = rfc_char10.predict(char10_test_features) #prediction char10_rfc = accuracy_score(test_labels, predictions_char10_rfc) #accuracy # linear SVC predictions_uni_lsvc= lsvc_uni.predict(uni_test_features) #prediction uni_lsvc = accuracy_score(test_labels, predictions_uni_lsvc) #accuracy predictions_bi_lsvc = lsvc_bi.predict(bi_test_features) #prediction bi_lsvc = accuracy_score(test_labels, predictions_bi_lsvc) #accuracy predictions_tri_lsvc = lsvc_tri.predict(tri_test_features) #prediction tri_lsvc = accuracy_score(test_labels, predictions_tri_lsvc) #accuracy predictions_char3_lsvc = lsvc_char3.predict(char3_test_features) #prediction char3_lsvc = accuracy_score(test_labels, predictions_char3_lsvc) #accuracy predictions_char4_lsvc = lsvc_char4.predict(char4_test_features) #prediction char4_lsvc = accuracy_score(test_labels, predictions_char4_lsvc) #accuracy predictions_char5_lsvc = lsvc_char5.predict(char5_test_features) #prediction char5_lsvc = accuracy_score(test_labels, predictions_char5_lsvc) #accuracy predictions_char6_lsvc = lsvc_char6.predict(char6_test_features) #prediction char6_lsvc = accuracy_score(test_labels, predictions_char6_lsvc) #accuracy predictions_char7_lsvc = lsvc_char7.predict(char7_test_features) #prediction char7_lsvc = accuracy_score(test_labels, predictions_char7_lsvc) #accuracy predictions_char8_lsvc = lsvc_char8.predict(char8_test_features) #prediction char8_lsvc = accuracy_score(test_labels, predictions_char8_lsvc) #accuracy predictions_char9_lsvc = lsvc_char9.predict(char9_test_features) #prediction char9_lsvc = accuracy_score(test_labels, predictions_char9_lsvc) #accuracy predictions_char10_lsvc = lsvc_char10.predict(char10_test_features) #prediction char10_lsvc = accuracy_score(test_labels, predictions_char10_lsvc) #accuracy # Logistic regressiom predictions_uni_lr = lr_uni.predict(uni_test_features) #prediction uni_lr = accuracy_score(test_labels, predictions_uni_lr) #accuracy predictions_bi_lr = lr_bi.predict(bi_test_features) #prediction bi_lr = accuracy_score(test_labels, predictions_bi_lr) #accuracy predictions_tri_lr = lr_tri.predict(tri_test_features) #prediction tri_lr = accuracy_score(test_labels, predictions_tri_lr) #accuracy predictions_char3_lr = lr_char3.predict(char3_test_features) #prediction char3_lr = accuracy_score(test_labels, predictions_char3_lr) #accuracy predictions_char4_lr = lr_char4.predict(char4_test_features) #prediction char4_lr = accuracy_score(test_labels, predictions_char4_lr) #accuracy predictions_char5_lr = lr_char5.predict(char5_test_features) #prediction char5_lr = accuracy_score(test_labels, predictions_char5_lr) #accuracy predictions_char6_lr = lr_char6.predict(char6_test_features) #prediction char6_lr = accuracy_score(test_labels, predictions_char6_lr) #accuracy predictions_char7_lr = lr_char7.predict(char7_test_features) #prediction char7_lr = accuracy_score(test_labels, predictions_char7_lr) #accuracy predictions_char8_lr = lr_char8.predict(char8_test_features) #prediction char8_lr = accuracy_score(test_labels, predictions_char8_lr) #accuracy predictions_char9_lr = lr_char9.predict(char9_test_features) #prediction char9_lr = accuracy_score(test_labels, predictions_char9_lr) #accuracy predictions_char10_lr = lr_char10.predict(char10_test_features) #prediction char10_lr = accuracy_score(test_labels, predictions_char10_lr) #accuracy """## selection of best model""" !pip install prettytable from prettytable import PrettyTable from astropy.table import Table, Column Model_Table = PrettyTable() Model_Table.field_names = [" ", " Random forest Classififier ", " Linear SVC "," Logistic Regression "] Model_Table.add_row([" Uni Gram ", round(uni_rfc,2),round(uni_lsvc,2),round(uni_lr,2)]) Model_Table.add_row([" Bi Gram ", round(bi_rfc,2),round(bi_lsvc,2),round(bi_lr,2)]) Model_Table.add_row([" Tri Gram ", round(tri_rfc,2),round(tri_lsvc,2),round(tri_lr,2)]) Model_Table.add_row([" 3 Char Gram ", round(char3_rfc,2),round(char3_lsvc,2),round(char3_lr,2)]) Model_Table.add_row([" 4 Char Gram ", round(char4_rfc,2),round(char4_lsvc,2),round(char4_lr,2)]) Model_Table.add_row([" 5 Char Gram ", round(char5_rfc,2),round(char5_lsvc,2),round(char5_lr,2)]) Model_Table.add_row([" 6 Char Gram ", round(char6_rfc,2),round(char6_lsvc,2),round(char6_lr,2)]) Model_Table.add_row([" 7 Char Gram ", round(char7_rfc,2),round(char7_lsvc,2),round(char7_lr,2)]) Model_Table.add_row([" 8 Char Gram ", round(char8_rfc,2),round(char8_lsvc,2),round(char8_lr,2)]) Model_Table.add_row([" 9 Char Gram ", round(char9_rfc,2),round(char9_lsvc,2),round(char9_lr,2)]) Model_Table.add_row([" 10 Char Gram ", round(char10_rfc,2),round(char10_lsvc,2),round(char10_lr,2)]) print("Detailed performance of all models:") print(Model_Table) Best_Model = PrettyTable() Best_Model.field_names = [" ", " Random forest Classififier ", " Linear SVC "," Logistic Regression "] Best_Model.add_row([" Uni Gram ", round(uni_rfc,2),round(uni_lsvc,2),round(uni_lr,2)]) Best_Model.add_row([" 3 Char Gram ", round(char3_rfc,2),round(char3_lsvc,2),round(char3_lr,2)]) Best_Model.add_row([" 8 Char Gram ", round(char8_rfc,2),round(char8_lsvc,2),round(char8_lr,2)]) print("Best Model") print(Best_Model) """## application phase saving model""" features = uni_vector.transform(x) target=y #apply random forest on train dataset model=rfc_uni.fit(features, target); import pickle filename = 'unigram_model.sav' pickle.dump(model, open(filename, 'wb'))
41.86
155
0.740325
2,712
20,930
5.350664
0.107301
0.066157
0.044518
0.054579
0.540969
0.495831
0.318035
0.119633
0.113431
0.098132
0
0.031586
0.165026
20,930
499
156
41.943888
0.798753
0.066269
0
0.026667
1
0
0.040313
0.001811
0
0
0
0
0
0
null
null
0
0.076667
null
null
0.026667
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
99c740c864ac8f17dc5a2661453594e375f82b2a
951
py
Python
main.py
SupernovaXTS/DylanRowanEV3
4a0ad689efcc284df4f5b2aae65934b7ca266e52
[ "MIT" ]
null
null
null
main.py
SupernovaXTS/DylanRowanEV3
4a0ad689efcc284df4f5b2aae65934b7ca266e52
[ "MIT" ]
null
null
null
main.py
SupernovaXTS/DylanRowanEV3
4a0ad689efcc284df4f5b2aae65934b7ca266e52
[ "MIT" ]
null
null
null
#!/usr/bin/env pybricks-micropython from pybricks.hubs import EV3Brick from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor, InfraredSensor, UltrasonicSensor, GyroSensor) from pybricks.parameters import Port, Stop, Direction, Button, Color from pybricks.tools import wait, StopWatch, DataLog from pybricks.robotics import DriveBase from pybricks.media.ev3dev import SoundFile, ImageFile # This program requires LEGO EV3 MicroPython v2.0 or higher. # Click "Open user guide" on the EV3 extension tab for more information. # Create your objects here. ev3 = EV3Brick() # Write your program here. US = UltrasonicSensor(Port.S1) LeftMotor = Motor(port.A, positive_direction=Direction.CLOCKWISE, gears=None) RightMotor = Motor(port.B, positive_direction=Direction.CLOCKWISE, gears=None) drive = Drivebase(LeftMotor,RightMotor,60,200) for x in range(4) drive.straight(1000) drive.stop() drive.turn(90)
35.222222
78
0.767613
123
951
5.918699
0.634146
0.098901
0.071429
0.096154
0.120879
0.120879
0
0
0
0
0
0.02716
0.148265
951
27
79
35.222222
0.871605
0.226078
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.375
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
2
99cedaac536f56fed7c80a3dae488f31828d8e72
158
py
Python
Meus_dessafios/Exercicios2021/ex005.py
DiegoSilvaHoffmann/Curso-de-Python
62824bbd3ed42b256fda77acd49536ec7cf23b29
[ "MIT" ]
null
null
null
Meus_dessafios/Exercicios2021/ex005.py
DiegoSilvaHoffmann/Curso-de-Python
62824bbd3ed42b256fda77acd49536ec7cf23b29
[ "MIT" ]
null
null
null
Meus_dessafios/Exercicios2021/ex005.py
DiegoSilvaHoffmann/Curso-de-Python
62824bbd3ed42b256fda77acd49536ec7cf23b29
[ "MIT" ]
null
null
null
n1 = int(input('Digite qualquer numero: ')) a = n1 - 1 p = n1 + 1 print('O numero escolhido é {}, seu anterior é {}, e seu posterior é {}.'.format(n1, a, p))
31.6
91
0.607595
28
158
3.428571
0.642857
0.0625
0
0
0
0
0
0
0
0
0
0.047619
0.202532
158
4
92
39.5
0.714286
0
0
0
0
0
0.563291
0
0
0
0
0
0
1
0
false
0
0
0
0
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
99d3be44aaba7542cb9be61be07abe0d24a85036
1,049
py
Python
python/challenge_3/tests/test_ch3.py
star-fangled-nut/ui-automation-week
c177dc3a13bed5a88764141b82c38a53bb50e796
[ "Apache-2.0" ]
4
2021-02-01T13:10:16.000Z
2021-04-14T19:56:53.000Z
python/challenge_3/tests/test_ch3.py
star-fangled-nut/ui-automation-week
c177dc3a13bed5a88764141b82c38a53bb50e796
[ "Apache-2.0" ]
null
null
null
python/challenge_3/tests/test_ch3.py
star-fangled-nut/ui-automation-week
c177dc3a13bed5a88764141b82c38a53bb50e796
[ "Apache-2.0" ]
6
2021-02-07T20:44:16.000Z
2021-02-23T17:12:00.000Z
""" Welcome to UI Automation Challenge 3 For this challenge the focus is improving the assertion for an existing UI automation test. Rather than asserting on the DOM's state, update the the test below to do a visual check of the page. Once you've completed the sample check. Create your own example check. > Remember, Pylenium is just a wrapper of Selenium, so you already have access to Selenium! """ import pytest from pylenium.driver import Pylenium from python.challenge_3.pages.home_page import HomePage @pytest.fixture def home(py): py.visit("https://automationintesting.online/"); return HomePage(py) def test_check_the_home_page_data(home: HomePage): img_url = home.get_hotel_logo().get_attribute('src') assert "https://www.mwtestconsultancy.co.uk/img/rbp-logo.png" == img_url assert home.get_room_images().should().have_length(1) assert home.get_map_image_count().should().have_length(28) def test_your_turn(py: Pylenium, home: HomePage): """ Create your own demonstration of a visual check """ pass
33.83871
91
0.759771
164
1,049
4.731707
0.560976
0.027062
0.030928
0
0
0
0
0
0
0
0
0.005599
0.148713
1,049
30
92
34.966667
0.863382
0.42326
0
0
0
0
0.152284
0
0
0
0
0
0.214286
1
0.214286
false
0.071429
0.214286
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
1
0
1
0
0
0
0
0
2
99d8e0ee506f27621ae6d02cd86373d7ec069b49
87
py
Python
uri_juego/punto1011.py
SebasBaquero/taller1-algoritmo
950cfd8bd8541cd9108eb28f52b8b098e044b408
[ "MIT" ]
null
null
null
uri_juego/punto1011.py
SebasBaquero/taller1-algoritmo
950cfd8bd8541cd9108eb28f52b8b098e044b408
[ "MIT" ]
null
null
null
uri_juego/punto1011.py
SebasBaquero/taller1-algoritmo
950cfd8bd8541cd9108eb28f52b8b098e044b408
[ "MIT" ]
null
null
null
r= int(input()) pi= 3.14159 sphere= (4/3)* pi* pow(r,3) print("VOLUME = %.3f" %sphere)
17.4
30
0.586207
17
87
3
0.705882
0
0
0
0
0
0
0
0
0
0
0.133333
0.137931
87
4
31
21.75
0.546667
0
0
0
0
0
0.149425
0
0
0
0
0
0
1
0
false
0
0
0
0
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
99e04192f3d30576e05945c5227712f7bbb3b09d
535
py
Python
pysql/constants/core/constraints.py
jha-hitesh/pysql
ad7c7e4e7e65a97e4dc15cda395678e0c09b02ab
[ "MIT" ]
null
null
null
pysql/constants/core/constraints.py
jha-hitesh/pysql
ad7c7e4e7e65a97e4dc15cda395678e0c09b02ab
[ "MIT" ]
null
null
null
pysql/constants/core/constraints.py
jha-hitesh/pysql
ad7c7e4e7e65a97e4dc15cda395678e0c09b02ab
[ "MIT" ]
null
null
null
class CoreConstraintConstants: core_constraint_slots = ( "table", "constraint_name", "constraint_definition", "UNIQUE", "PRIMARY_KEY", "FOREIGN_KEY", "REFERENCES", "CHECK", "DEFAULT", "FOR" ) core_constraint_default_values = { "table": None, "constraint_name": None, "constraint_definition": "", "UNIQUE": (), "PRIMARY_KEY": (), "FOREIGN_KEY": None, "REFERENCES": None, "CHECK": (), "DEFAULT": None, "FOR": None }
26.75
61
0.543925
43
535
6.465116
0.418605
0.100719
0.18705
0.23741
0.330935
0.330935
0.330935
0
0
0
0
0
0.300935
535
19
62
28.157895
0.743316
0
0
0
0
0
0.35206
0.078652
0
0
0
0
0
1
0
false
0
0
0
0.166667
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
99e469f0bd7e1ee843301029a9f284f53cceeed1
3,226
py
Python
headlock/address_space/__init__.py
mrh1997/headlock
720ede7e02681d6466b27ae7fb3958ef8c4a238c
[ "MIT" ]
2
2017-11-09T13:49:57.000Z
2020-03-07T01:29:37.000Z
headlock/address_space/__init__.py
mrh1997/headlock
720ede7e02681d6466b27ae7fb3958ef8c4a238c
[ "MIT" ]
4
2017-12-22T12:27:34.000Z
2020-03-31T07:42:07.000Z
headlock/address_space/__init__.py
mrh1997/headlock
720ede7e02681d6466b27ae7fb3958ef8c4a238c
[ "MIT" ]
null
null
null
""" This is for headlock internal use only! """ from typing import Tuple, Callable import abc from collections.abc import ByteString class MemoryManagementError(Exception): """ This exception occurs, when if memory allocation/release failed. """ class AddressSpace: """ An address space provides an interface to running C code at ABI (not API!) layer. This class is only the abstract base class. Descendants have to implement the communication between this python process/machine and some specific kind of "running code" (i.e. an OS user process, an OS kernel or an embedded system running on a remote machine). This class is not responsible to instanciate C code or stop it! The the code has to be loaded somewhere else and a handle/ID has to be passed to the constructor of the subclass. """ def __init__(self): self.bridgepool = {} def _register_memory_block(self, address, len): pass @abc.abstractmethod def find_memory_block(self, address:int) -> Tuple[int, int]: """ returns the start address and the length of the memory block which contains this address. raises ValueError if no containing memory block exists """ @abc.abstractmethod def read_memory(self, address:int, length:int) -> bytes: """ Reads a specific amount of Memory (in bytes) of the address space. The caller has to ensure that the specified memory range is valid, otherwise the connected process could crash """ @abc.abstractmethod def write_memory(self, address:int, data:ByteString): """ Writes a specific amount of Memory (in bytes) to the address space. The caller has to ensure that the specified memory range is valid, otherwise the connected process could crash """ @abc.abstractmethod def alloc_memory(self, length:int) -> int: """ Allocated length bytes of contiguous memory and returns a reference to it. """ @abc.abstractmethod def get_symbol_adr(self, symbol_name:str) -> int: """ returns the address of a specific symbol. Symbol may be a global variable or a function. """ @abc.abstractmethod def get_symbol_name(self, adr:int) -> str: """ returns the name of a symbol or raises ValueError is adr does not refer to a valid C symbol """ @abc.abstractmethod def invoke_c_func(self, func_adr:int, c_sig:str, args_adr:int, retval_adr:int) -> bytes: """ invokes a piece of C code via the bridge for signature of name "c_sig". """ @abc.abstractmethod def create_c_callback(self, c_sig:str, pyfunc:Callable[[int, int], None]) -> int: """ Creates a new C function pointer of signature 'c_sig'. Everytime this function is called, the call is bridged and forwarded to pyfunc. Returns the address of the created C callback. """ @abc.abstractmethod def close(self): """ Close the connection to the addressspace. """
31.320388
78
0.641042
426
3,226
4.788732
0.375587
0.075
0.088235
0.021569
0.182353
0.153922
0.153922
0.12451
0.12451
0.12451
0
0
0.287973
3,226
103
79
31.320388
0.888115
0.520769
0
0.310345
0
0
0
0
0
0
0
0
0
1
0.37931
false
0.034483
0.103448
0
0.551724
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
99e72c9ddc9461817e32a7f394cb94ec115be553
67
py
Python
cms/__init__.py
umarmughal824/bootcamp-ecommerce
681bcc788a66867b8f240790c0ed33680b73932b
[ "BSD-3-Clause" ]
2
2018-06-20T19:37:03.000Z
2021-01-06T09:51:40.000Z
cms/__init__.py
mitodl/bootcamp-ecommerce
ba7d6aefe56c6481ae2a5afc84cdd644538b6d50
[ "BSD-3-Clause" ]
1,226
2017-02-23T14:52:28.000Z
2022-03-29T13:19:54.000Z
cms/__init__.py
umarmughal824/bootcamp-ecommerce
681bcc788a66867b8f240790c0ed33680b73932b
[ "BSD-3-Clause" ]
3
2017-03-20T03:51:27.000Z
2021-03-19T15:54:31.000Z
"""Initialize cms app""" default_app_config = "cms.apps.CMSConfig"
22.333333
41
0.746269
9
67
5.333333
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.089552
67
2
42
33.5
0.786885
0.268657
0
0
0
0
0.418605
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
99f07fca2c855b566511a0147923614aa1a1eac4
152
py
Python
scheduler/app.py
zj-myidea/MYIDEA
901389a779329603d141f0641c8d2bae423f1d6b
[ "BSD-2-Clause" ]
null
null
null
scheduler/app.py
zj-myidea/MYIDEA
901389a779329603d141f0641c8d2bae423f1d6b
[ "BSD-2-Clause" ]
null
null
null
scheduler/app.py
zj-myidea/MYIDEA
901389a779329603d141f0641c8d2bae423f1d6b
[ "BSD-2-Clause" ]
null
null
null
from agent import Agent if __name__=='__main__': agent = Agent() try: agent.start() except Exception as e: agent.shutdown()
19
26
0.605263
18
152
4.666667
0.722222
0
0
0
0
0
0
0
0
0
0
0
0.289474
152
8
27
19
0.777778
0
0
0
0
0
0.052288
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
820b292abf75bb61e657c0cb248e9945a582ab26
1,526
py
Python
categorical_embedder/embedders/core/vae/concrete/concrete_utils.py
erelcan/categorical-embedder
376b8779500af2aa459c879f8e525f2ef25d6b31
[ "Apache-2.0" ]
3
2020-12-19T10:52:58.000Z
2021-06-08T09:06:44.000Z
ts_embedder/embedders/core/vae/concrete/concrete_utils.py
erelcan/ts-embedder
2fe73c70aa8a7bb8a232b3a66730b55d30db4694
[ "Apache-2.0" ]
null
null
null
ts_embedder/embedders/core/vae/concrete/concrete_utils.py
erelcan/ts-embedder
2fe73c70aa8a7bb8a232b3a66730b55d30db4694
[ "Apache-2.0" ]
null
null
null
from keras import backend as K def compute_kl_normal(z_mean, z_log_var): # KL divergence between N(0,1) and N(z_mean, exp(z_log_var)) kl_per_sample = 0.5 * (K.sum(K.square(z_mean) + K.exp(z_log_var) - 1 - z_log_var, axis=1)) return K.mean(kl_per_sample) def compute_kl_discrete(distributions): # KL divergence between a uniform distribution over distributions of the categories. # Re-consider whether you need a modified version of KL-div for ELBO! num_of_categories = K.int_shape(distributions)[1] dist_sum = K.sum(distributions * K.log(K.constant(1.0 / num_of_categories) + K.epsilon()), axis=1) dist_neg_entropy = K.sum(distributions * K.log(distributions + K.epsilon()), axis=1) return K.mean(dist_neg_entropy - dist_sum) def sample_concrete(alpha, temperature): # Sample from a concrete distribution given alpha and temperature uniform = K.random_uniform(shape=K.shape(alpha)) gumbel = - K.log(- K.log(uniform + K.epsilon()) + K.epsilon()) logits = (K.log(alpha + K.epsilon()) + gumbel) / temperature return K.softmax(logits) def sample_normal(z_mean, z_log_var): # Sample from a normal distribution with mean z_mean and variance z_log_var epsilon = K.random_normal(shape=K.shape(z_mean), mean=0, stddev=1) return z_mean + K.exp(z_log_var / 2) * epsilon def concrete_sampler(temperature=0.1): return lambda alpha: sample_concrete(alpha, temperature) def normal_sampler(): return lambda z_tuple: sample_normal(z_tuple[0], z_tuple[1])
39.128205
102
0.722805
250
1,526
4.208
0.28
0.03327
0.046578
0.028517
0.134981
0.064639
0.030418
0
0
0
0
0.014085
0.162516
1,526
38
103
40.157895
0.809077
0.227392
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.047619
0.095238
0.619048
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
8214c4772f2b4cb0fd774778e36319286f3ba0db
5,569
py
Python
pythonlibs/mantis/trade/command.py
adoggie/Tibet.6
3c53060edafd80b9c4dafa10699a68d86a410c66
[ "MIT" ]
22
2019-10-28T07:28:12.000Z
2022-03-19T15:36:41.000Z
pythonlibs/mantis/trade/command.py
adoggie/Tibet.6
3c53060edafd80b9c4dafa10699a68d86a410c66
[ "MIT" ]
1
2019-11-07T04:54:14.000Z
2019-11-07T07:12:48.000Z
pythonlibs/mantis/trade/command.py
adoggie/Tibet.6
3c53060edafd80b9c4dafa10699a68d86a410c66
[ "MIT" ]
13
2019-10-28T07:29:07.000Z
2021-11-03T06:53:12.000Z
# coding: utf-8 from vnpy.trader.vtObject import * from mantis.fundamental.flask.webapi import CallReturn # class Command(object): # def __init__(self,name): # self.name = name class StartTradeAdapter(object): """请求TradeAdapter服务启动 场景: 调度服务器或者runner请求launcher启动tradeAdapter服务进程 """ NAME = 'start_trade_adapter' def __init__(self): pass class KeepAlive(object): """请求指定服务器保持运行,服务 A依赖B的运行,A定时发送此消息到B系统,B接收到保持自己服务器运行,否则B自行结束""" NAME = 'keepalive' def __init__(self): pass class ServiceStatusBroadcast(object): """服务器定时广播自己的运行状态 pub-channel """ NAME = 'service_status_broadcast' def __init__(self): self.service_id = '' # self.service_type = '' self.http = '' # 服务器运行的web管理接口地址 class SendOrder(VtOrderReq): NAME = 'send_order' def __init__(self): VtOrderReq.__init__(self) class Result(object): def __init__(self): self.value = [] #订单id列表 def assign(self,data): if isinstance(data.get('result'),list): self.value = data.get('result') return self class CancelOrder(VtCancelOrderReq): """取消订单""" NAME = 'cancel_order' def __init__(self): VtCancelOrderReq.__init__(self) self.order_id = '' class Result(object): def __init__(self): self.value = False def assign(self,data): if data.get('result'): self.value = VtOrderData() self.value.__dict__ = data.get('result') return self class CancelAllOrders(object): """取消所有订单""" NAME = 'cancel_all_orders' class SellOrCoverAllTrades(object): """平仓所持有的仓位(平金、平⬅昨)""" NAME = 'sell_or_cover_all_trades' # class StopOrderRequest(Vt) class TradeAdapterResponseData(object): def __init__(self): self.account = '' # 期货、股票账户名称 self.product = '' # 期货还是股票 feture/stock class OnPositionData(VtPositionData,TradeAdapterResponseData): NAME = 'on_position_data' def __init__(self): VtPositionData.__init__(self) TradeAdapterResponseData.__init__(self) class OnOrderData(VtOrderData,TradeAdapterResponseData): NAME = 'on_order_data' def __init__(self): VtOrderData.__init__(self) TradeAdapterResponseData.__init__(self) class OnTradeData(VtTradeData,TradeAdapterResponseData): NAME = 'on_trade_data' def __init__(self): VtTradeData.__init__(self) TradeAdapterResponseData.__init__(self) class OnAccountData(VtAccountData,TradeAdapterResponseData): NAME = 'on_account_data' def __init__(self): VtAccountData.__init__(self) TradeAdapterResponseData.__init__(self) class GetOrder(object): NAME = 'get_order' def __init__(self): self.order_id = '' class Result(object): def __init__(self): self.value = None def assign(self,data): if data.get('result'): self.value = VtOrderData() self.value.__dict__ = data.get('result') return self class GetAllWorkingOrders(object): NAME = 'get_all_working_orders' def __init__(self): pass class Result(object): def __init__(self): self.value = [] def assign(self,data): if isinstance(data.get('result'),list): for r in data.get('result'): order = VtOrderData() order.__dict__ = r self.value.append(order) return self class GetAllOrders(GetAllWorkingOrders): NAME = 'get_all_orders' def __init__(self): GetAllWorkingOrders.__init__(self) class GetAllTrades(object): NAME = 'get_all_trades' def __init__(self): pass class Result(object): def __init__(self): self.value = [] def assign(self,data): if isinstance(data.get('result'),list): for r in data.get('result'): trade = VtTradeData() trade.__dict__ = r self.value.append(trade) return self class GetAllPositions(object): NAME = 'get_all_positions' def __init__(self): pass class Result(object): def __init__(self): self.value = [] def assign(self,data): if isinstance(data.get('result'),list): for r in data.get('result'): pos = VtPositionData() pos.__dict__ = r self.value.append(pos) return self class GetAllAccounts(object): NAME = 'get_all_accounts' def __init__(self): pass class Result(object): def __init__(self): self.value = [] def assign(self,data): if isinstance(data.get('result'),list): for r in data.get('result'): account = VtAccountData() account.__dict__ = r self.value.append(account) return self class StrategyLogContent(object): """ 策略日志级别 """ NAME = 'strategy_log_content' def __init__(self): self.strategy_id = '' self.datetime = '' self.timestamp = 0 self.service_type = '' self.service_id = '' self.text = '' self.level = '' @property def plainText(self): return 'Time:{}|Strategy:{}|Text:{}'.format(self.timestamp,self.strategy_id,self.text)
26.14554
94
0.588975
549
5,569
5.593807
0.234973
0.093781
0.089547
0.053728
0.390101
0.344188
0.276457
0.276457
0.264409
0.264409
0
0.000515
0.302747
5,569
212
95
26.268868
0.790111
0.064105
0
0.529412
0
0
0.076878
0.018879
0
0
0
0
0
1
0.20915
false
0.039216
0.013072
0.006536
0.562092
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
82213f046561e68f8641178deb1971f238462375
293
py
Python
tests/test_home.py
twyle/flask-api-template
0ad87b13f5bd715c82526fc76ea41710ea75030c
[ "MIT" ]
null
null
null
tests/test_home.py
twyle/flask-api-template
0ad87b13f5bd715c82526fc76ea41710ea75030c
[ "MIT" ]
25
2022-03-19T14:09:00.000Z
2022-03-20T09:12:34.000Z
tests/test_home.py
twyle/flask-api-template
0ad87b13f5bd715c82526fc76ea41710ea75030c
[ "MIT" ]
null
null
null
import pytest from api import app @pytest.fixture def client(): return app.test_client() def test_home(client): resp = client.get('/api') assert resp.status_code == 200 def test_home_bad_http_method(client): resp = client.post('/api') assert resp.status_code == 405
15.421053
38
0.692833
43
293
4.534884
0.511628
0.071795
0.112821
0.194872
0.235897
0
0
0
0
0
0
0.025316
0.191126
293
18
39
16.277778
0.797468
0
0
0
0
0
0.027304
0
0
0
0
0
0.181818
1
0.272727
false
0
0.181818
0.090909
0.545455
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
822d83646b1b060682343567ef96b99aa237310e
183
py
Python
percivaltts/__init__.py
gillesdegottex/percival-tts
b0cae5ff4fb58b9bc4964be8da5e5f9566abeec9
[ "Apache-2.0" ]
2
2018-04-16T12:27:43.000Z
2019-07-22T18:37:07.000Z
percivaltts/__init__.py
gillesdegottex/percival-tts
b0cae5ff4fb58b9bc4964be8da5e5f9566abeec9
[ "Apache-2.0" ]
29
2018-02-22T14:23:06.000Z
2018-04-05T14:07:35.000Z
percivaltts/__init__.py
gillesdegottex/percival
b0cae5ff4fb58b9bc4964be8da5e5f9566abeec9
[ "Apache-2.0" ]
1
2018-09-05T03:45:08.000Z
2018-09-05T03:45:08.000Z
# This version number has to be updated for each release # (../setup.py reads this file to obtain the version number of the packages) __version__ = '2.0.0' from percivaltts import *
30.5
76
0.748634
30
183
4.433333
0.766667
0.195489
0
0
0
0
0
0
0
0
0
0.019868
0.174863
183
5
77
36.6
0.860927
0.704918
0
0
0
0
0.098039
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
8235f8b992e581700bc1a8b67788ef755b04d1fe
614
py
Python
Python/oib-validation.py
IMilja/oib-validation
fe98afeafe4dd5aac33db0455553966717d875c6
[ "MIT" ]
null
null
null
Python/oib-validation.py
IMilja/oib-validation
fe98afeafe4dd5aac33db0455553966717d875c6
[ "MIT" ]
null
null
null
Python/oib-validation.py
IMilja/oib-validation
fe98afeafe4dd5aac33db0455553966717d875c6
[ "MIT" ]
null
null
null
class oib (object): def CheckOIB(self,oib=""): if (len(oib) != 11): return False if not oib.isdigit(): return False a = 10 for i in range(0,10): a = a + int(oib[i:i+1]) a = a % 10 if a == 0: a = 10 a *= 2 a = a % 11 kontrolni = 11 - a if kontrolni == 10: kontrolni = 0 return kontrolni == int(oib[10:11]) if __name__ == "__main__": o = oib() print o.CheckOIB("ovdje upisi oib")
21.172414
44
0.379479
72
614
3.125
0.416667
0.04
0
0
0
0
0
0
0
0
0
0.082508
0.506515
614
28
45
21.928571
0.660066
0
0
0.190476
0
0
0.039249
0
0
0
0
0
0
0
null
null
0
0
null
null
0.047619
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
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
8239dc55c37a6189499182dac81a50b85ca14a32
2,792
py
Python
integration_tests/test_hardware_wallet.py
zanglang/chain-main
9ccea4d7585cba72e708bf516c41715d1d52f9ad
[ "Apache-2.0" ]
1
2021-07-29T14:29:36.000Z
2021-07-29T14:29:36.000Z
integration_tests/test_hardware_wallet.py
zanglang/chain-main
9ccea4d7585cba72e708bf516c41715d1d52f9ad
[ "Apache-2.0" ]
null
null
null
integration_tests/test_hardware_wallet.py
zanglang/chain-main
9ccea4d7585cba72e708bf516c41715d1d52f9ad
[ "Apache-2.0" ]
null
null
null
import time from pathlib import Path import pytest from .utils import cluster_fixture, get_ledger pytestmark = pytest.mark.ledger @pytest.fixture(scope="module") def cluster(worker_index, pytestconfig, tmp_path_factory): "override cluster fixture for this test module" ledger = get_ledger() ledger.start() try: yield from cluster_fixture( Path(__file__).parent / "configs/ledger.yaml", worker_index, tmp_path_factory.mktemp("data"), quiet=pytestconfig.getoption("supervisord-quiet"), ) finally: ledger.stop() def test_ledger_transfer(cluster): """ check simple transfer tx success - send 1cro from hw to reserve """ reserve_addr = cluster.address("reserve") hw_addr = cluster.address("hw") reserve_balance = cluster.balance(reserve_addr) hw_balance = cluster.balance(hw_addr) tx = cluster.transfer_from_ledger("hw", reserve_addr, "1cro") print("transfer tx", tx["txhash"]) assert tx["logs"] == [ { "events": [ { "attributes": [ {"key": "action", "value": "send"}, {"key": "sender", "value": hw_addr}, {"key": "module", "value": "bank"}, ], "type": "message", }, { "attributes": [ {"key": "recipient", "value": reserve_addr}, {"key": "sender", "value": hw_addr}, {"key": "amount", "value": "100000000basecro"}, ], "type": "transfer", }, ], "log": "", "msg_index": 0, } ] assert cluster.balance(hw_addr) == hw_balance - 100000000 assert cluster.balance(reserve_addr) == reserve_balance + 100000000 def test_wallet_name_for_ledger(cluster): def check_account(name): cluster.create_account_ledger(name, 0) address = cluster.address(name) assert len(address) > 0 cluster.delete_account(name) time.sleep(1) cluster.delete_account("hw") names = [ "normalwallet", "abc 1", # there should be a `\` before `&` and `)` or the terminal will # trade them as one part of command r"\&a\)bcd*^", "钱對중ガジÑá", # a very long name "this_is_a_very_long_long_long_long_long_long_\ long_long_long_long_long_long_long_long_name", # a very complex name "1 abc &abcd*^ 钱對중ガジÑá long_long_long_long_long_\ long_long_long_long_long_long_long_name", ] for name in names: print("name: ", name) check_account(name)
29.389474
71
0.548352
293
2,792
4.976109
0.372014
0.131687
0.18107
0.219479
0.108368
0.108368
0.076818
0.076818
0.076818
0.076818
0
0.018777
0.332378
2,792
94
72
29.702128
0.763412
0.087034
0
0.09589
0
0
0.132582
0
0
0
0
0
0.054795
1
0.054795
false
0
0.054795
0
0.109589
0.027397
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
823f28c32d2bd546b4cbff92817ad336d78d019e
1,537
py
Python
src/python3_learn_video/os_module.py
HuangHuaBingZiGe/GitHub-Demo
f3710f73b0828ef500343932d46c61d3b1e04ba9
[ "Apache-2.0" ]
null
null
null
src/python3_learn_video/os_module.py
HuangHuaBingZiGe/GitHub-Demo
f3710f73b0828ef500343932d46c61d3b1e04ba9
[ "Apache-2.0" ]
null
null
null
src/python3_learn_video/os_module.py
HuangHuaBingZiGe/GitHub-Demo
f3710f73b0828ef500343932d46c61d3b1e04ba9
[ "Apache-2.0" ]
null
null
null
""" 模块是一个包含所有你定义的函数和变量的文件,其后缀名是.py 模块可以被别的程序引入,以使用该模块中的函数等功能 OS:Operation System 操作系统 """ import os print('-------------------------------') print(os.getcwd()) # 获取当前的目录位置 print('-------------------------------') os.chdir('E:\\') # 改变当前目录位置 print(os.getcwd()) print('-------------------------------') print(os.listdir('E:\\')) # 打印当前目录下包含的文件和文件夹 print('-------------------------------') # os.mkdir('E:\\A') # 创建文件夹 # os.mkdir('E:\\A\\B') # 创建已存在的级联文件夹 # os.makedirs('E:\\B\\C') # 创建级联文件夹 # os.makedirs('E:\\B\\A') # 创建级联文件夹 # os.system('cmd') # 打开cmd # os.system('calc') # 打开计算器 print(os.curdir) # 当前路径 print(os.listdir(os.curdir)) # 查看当前路径下的文件和文件夹 print('-------------------------------') print(os.path.basename('E:\\oracle\\hosts')) # 去除路径返回文件名 print('-------------------------------') print(os.path.dirname('E:\\oracle\\hosts')) # 去除文件名返回路径 print('-------------------------------') print(os.path.join('A', 'B', 'C')) print(os.path.join(r'C:\\', 'A', 'B', 'C')) print(os.path.split('E:\\A\\SEXY.AVI')) print(os.path.split('E:\\A\\B\\C')) print('-------------------------------') print(os.path.splitext('E:\\A\\SEXY.AVI')) # 获取后缀 print('-------------------------------') print(os.path.getatime('E:\\test.txt')) import time print(time.gmtime(os.path.getatime('E:\\test.txt'))) print('-------------------------------') print(time.localtime(os.path.getatime('E:\\test.txt'))) print('-------------------------------') print(time.localtime(os.path.getmtime('E:\\test.txt'))) print('-------------------------------')
26.964912
57
0.476252
173
1,537
4.231214
0.312139
0.143443
0.120219
0.10929
0.233607
0.233607
0.131148
0.131148
0.131148
0.131148
0
0
0.071568
1,537
56
58
27.446429
0.512964
0.221861
0
0.451613
0
0
0.438837
0.318221
0
0
0
0
0
1
0
true
0
0.064516
0
0.064516
0.903226
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
0
1
0
2
4132a073c27ca3eda748f275ea77ed4c9d307c94
255
py
Python
djangozmq/tests/simpletasks.py
lahim/django-zmq
086d030e87e774b8da8f21eb96a2919d272e88f2
[ "MIT" ]
null
null
null
djangozmq/tests/simpletasks.py
lahim/django-zmq
086d030e87e774b8da8f21eb96a2919d272e88f2
[ "MIT" ]
9
2019-09-10T18:24:55.000Z
2022-02-10T13:24:27.000Z
djangozmq/tests/simpletasks.py
lahim/django-zmq
086d030e87e774b8da8f21eb96a2919d272e88f2
[ "MIT" ]
1
2021-11-15T21:30:56.000Z
2021-11-15T21:30:56.000Z
def foo_task(): print('Foo task is running...') print('Foo task completed.') return True def sum_task(arg_1: int, arg_2: int): print('Sum task is running...') result = arg_1 + arg_2 print('Sum task completed.') return result
21.25
37
0.627451
39
255
3.948718
0.384615
0.136364
0.155844
0
0
0
0
0
0
0
0
0.020513
0.235294
255
11
38
23.181818
0.769231
0
0
0
0
0
0.321569
0
0
0
0
0
0
1
0.222222
false
0
0
0
0.444444
0.444444
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
0
1
0
2
41332490a94698437b4a87e9d6fc01c6cbc8a637
659
py
Python
tests/base_tests/expression_tests/test_evaluate.py
lycantropos/symba
279bf86311d50fde55d17c843391f9f83ea31ddf
[ "MIT" ]
2
2021-03-15T12:23:15.000Z
2022-03-26T21:20:54.000Z
tests/base_tests/expression_tests/test_evaluate.py
lycantropos/symba
279bf86311d50fde55d17c843391f9f83ea31ddf
[ "MIT" ]
null
null
null
tests/base_tests/expression_tests/test_evaluate.py
lycantropos/symba
279bf86311d50fde55d17c843391f9f83ea31ddf
[ "MIT" ]
null
null
null
from numbers import Real from hypothesis import given from symba.base import Expression from . import strategies @given(strategies.definite_expressions) def test_basic(expression: Expression) -> None: result = expression.evaluate() assert isinstance(result, Real) @given(strategies.definite_expressions) def test_commutation_with_abs(expression: Expression) -> None: result = expression.evaluate() assert abs(result) == abs(expression).evaluate() @given(strategies.definite_expressions) def test_commutation_with_neg(expression: Expression) -> None: result = expression.evaluate() assert -result == (-expression).evaluate()
23.535714
62
0.766313
73
659
6.780822
0.328767
0.181818
0.193939
0.206061
0.636364
0.636364
0.553535
0.226263
0
0
0
0
0.135053
659
27
63
24.407407
0.868421
0
0
0.375
0
0
0
0
0
0
0
0
0.1875
1
0.1875
false
0
0.25
0
0.4375
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
4148e8e876b1d470c83ea099fc60e41be16774ad
80
py
Python
examples/old_examples/basic_example.py
ahuang11/ahh
59f124c3aa04cde58db0ec2e81025eb63a92404e
[ "MIT" ]
6
2016-09-01T03:43:20.000Z
2018-02-15T00:49:29.000Z
examples/old_examples/basic_example.py
ahuang11/ahh
59f124c3aa04cde58db0ec2e81025eb63a92404e
[ "MIT" ]
33
2017-10-21T19:03:52.000Z
2020-10-19T15:05:50.000Z
examples/old_examples/basic_example.py
ahuang11/ahh
59f124c3aa04cde58db0ec2e81025eb63a92404e
[ "MIT" ]
2
2016-10-14T18:45:39.000Z
2020-02-02T12:23:20.000Z
from ahh import vis x = [1, 2, 3, 4] y = [5, 6, 7, 8] vis.plot_line(x, y)
13.333333
20
0.5
19
80
2.052632
0.842105
0
0
0
0
0
0
0
0
0
0
0.142857
0.3
80
5
21
16
0.553571
0
0
0
0
0
0
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
4148fdc5d64445f429e56e204a83fc4b549ab167
6,956
py
Python
tests/test_models.py
chgans/django-google-dork
c8735f2d2a9740844001cf4430263ea79827102f
[ "BSD-2-Clause" ]
1
2019-07-21T02:32:03.000Z
2019-07-21T02:32:03.000Z
tests/test_models.py
chgans/django-google-dork
c8735f2d2a9740844001cf4430263ea79827102f
[ "BSD-2-Clause" ]
null
null
null
tests/test_models.py
chgans/django-google-dork
c8735f2d2a9740844001cf4430263ea79827102f
[ "BSD-2-Clause" ]
null
null
null
from django.test import TestCase from django.db import IntegrityError from django.core.exceptions import ValidationError from django_google_dork.models import SearchEngine, Campaign, Dork, Run, Result class TestCampaign(TestCase): def setUp(self): pass def test_name_not_empty(self): with self.assertRaises(ValidationError): c = Campaign.objects.create(name="") c.full_clean() def test_name_is_stripped(self): c = Campaign.objects.create(name=" test ") c.full_clean() self.assertEqual(c.name, "test") def test_name_is_long_enough(self): with self.assertRaises(ValidationError): c = Campaign.objects.create(name="t"*3) c.full_clean() def test_name_is_short_enough(self): with self.assertRaises(ValidationError): c = Campaign.objects.create(name="t"*33) c.full_clean() def test_name_is_unique(self): with self.assertRaises(IntegrityError): Campaign.objects.create(name="test") Campaign.objects.create(name="test") def test_run_set(self): e = SearchEngine.objects.create(hostname="google.fr") c = Campaign.objects.create(name="campaign") d = Dork.objects.create(campaign=c, query="query") n = 3 for i in range(n): r = Run.objects.create(dork=d, engine=e) self.assertEqual(c.run_set.count(), n) self.assertEqual(c.run_set.last(), r) self.assertEqual(c.run_set.last(), d.run_set.last()) def test_result_set(self): e = SearchEngine.objects.create(hostname="google.fr") c = Campaign.objects.create(name="campaign") d = Dork.objects.create(campaign=c, query="query") r = Run.objects.create(dork=d, engine=e) n = 3 for i in range(n): s = Result.objects.create(title="title%d" % (i), summary="summary", url="http://some.where/path") r.result_set.add(s) self.assertEqual(c.result_set.count(), n) self.assertEqual(c.result_set.last(), s) self.assertEqual(c.result_set.last(), r.result_set.last()) class TestDork(TestCase): def setUp(self): pass def test_campaign_not_null(self): with self.assertRaises(IntegrityError): d = Dork.objects.create() d.full_clean() def test_query_not_null(self): c = Campaign.objects.create(name="c") with self.assertRaises(IntegrityError): d = Dork.objects.create(campaign=c, query=None) def test_query_not_empty(self): c = Campaign.objects.create(name="c") with self.assertRaises(ValidationError): d = Dork.objects.create(campaign=c, query="") d.full_clean() def test_query_is_stripped(self): c = Campaign.objects.create(name="c") d = Dork.objects.create(campaign=c, query=" test ") d.full_clean() self.assertEqual(d.query, "test") def test_query_is_long_enough(self): c=Campaign.objects.create(name="c") with self.assertRaises(ValidationError): d = Dork.objects.create(campaign=c, query="t"*0) d.full_clean() def test_query_is_short_enough(self): c = Campaign.objects.create(name="c") with self.assertRaises(ValidationError): d=Dork.objects.create(campaign=c, query="t"*257) d.full_clean() def test_campaign_and_query_00(self): c0 = Campaign.objects.create(name="c0") c1 = Campaign.objects.create(name="c1") Dork.objects.create(campaign=c0, query="test0") Dork.objects.create(campaign=c1, query="test1") def test_campaign_and_query_01(self): c0 = Campaign.objects.create(name="c0") c1 = Campaign.objects.create(name="c1") Dork.objects.create(campaign=c0, query="test") Dork.objects.create(campaign=c1, query="test") def test_campaign_and_query_10(self): c = Campaign.objects.create(name="c") Dork.objects.create(campaign=c, query="test0") Dork.objects.create(campaign=c, query="test1") def test_campaign_and_query_11(self): c = Campaign.objects.create(name="c") Dork.objects.create(campaign=c, query="test") with self.assertRaises(IntegrityError): Dork.objects.create(campaign=c, query="test") def test_result_set(self): e = SearchEngine.objects.create(hostname="google.fr") c = Campaign.objects.create(name="campaign") d = Dork.objects.create(campaign=c, query="query") r = Run.objects.create(dork=d, engine=e) for i in range(3): s = Result.objects.create(title="title%d" % i, summary="summary", url="http://some.where/path") r.result_set.add(s) self.assertEqual(d.result_set.count(), 3) self.assertEqual(d.result_set.last(), s) self.assertEqual(d.result_set.last(), r.result_set.last()) class TestRun(TestCase): def setUp(self): pass def test_create_dork_not_empty(self): e = SearchEngine.objects.create(hostname="google.fr") with self.assertRaises(IntegrityError): Run.objects.create(engine=e) def test_create_engine_not_empty(self): c = Campaign.objects.create(name="campaign") d = Dork.objects.create(campaign=c, query="query") with self.assertRaises(IntegrityError): Run.objects.create(dork=d) def test_create_wo_results(self): e = SearchEngine.objects.create(hostname="google.fr") c = Campaign.objects.create(name="campaign") d = Dork.objects.create(campaign=c, query="query") r = Run.objects.create(dork=d, engine=e) # result_set doen't contains 2 identical result # This is actually enforced by Django itself! def test_result_uniqness(self): e = SearchEngine.objects.create(hostname="google.fr") c = Campaign.objects.create(name="campaign") d = Dork.objects.create(campaign=c, query="query") r = Run.objects.create(dork=d, engine=e) s = Result.objects.create(title="title", summary="summary", url="http://some.where/path") r.result_set.add(s) r.result_set.add(s) self.assertEqual(r.result_set.count(), 1) class TestResult(TestCase): def setUp(self): pass def create_result(self): r = Result.objects.create(title="title", summary="summary", url="http://some.where/path") return r def test_uniqness(self): r = self.create_result() with self.assertRaises(IntegrityError): self.create_result()
36.418848
79
0.609977
866
6,956
4.778291
0.112009
0.188497
0.116723
0.138956
0.813678
0.769212
0.690913
0.565491
0.487434
0.487434
0
0.007204
0.261645
6,956
190
80
36.610526
0.798481
0.012795
0
0.558442
0
0
0.051719
0
0
0
0
0
0.162338
1
0.181818
false
0.025974
0.025974
0
0.24026
0
0
0
0
null
0
0
0
1
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
4154d8d60ee9fcb304dfd74b89b4915e68520767
297
py
Python
Service_3/application/routes.py
emmanuelagyapong/SFIA-2
26b56da04fce778f9a1c47187bcda0de316bc5e6
[ "Unlicense" ]
null
null
null
Service_3/application/routes.py
emmanuelagyapong/SFIA-2
26b56da04fce778f9a1c47187bcda0de316bc5e6
[ "Unlicense" ]
null
null
null
Service_3/application/routes.py
emmanuelagyapong/SFIA-2
26b56da04fce778f9a1c47187bcda0de316bc5e6
[ "Unlicense" ]
1
2020-07-21T13:59:13.000Z
2020-07-21T13:59:13.000Z
from application import app from flask import render_template, request import random @app.route('/buildingfullname2', methods=['GET']) def secondname(): list2=['benson', 'hesketh', 'ahmed', 'jennifer', 'oskar'] response2=list2[random.randint(0, len(list2)-1)] return response2
22.846154
61
0.703704
35
297
5.942857
0.771429
0
0
0
0
0
0
0
0
0
0
0.031621
0.148148
297
13
62
22.846154
0.790514
0
0
0
0
0
0.174497
0
0
0
0
0
0
1
0.125
false
0
0.375
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
417bc34f67e5a524598bfd1540a511f3121fda52
8,733
py
Python
Schedule/accounts/serializers.py
f0rdream/party-time
3b596043627383859042a6e70167e4304bab9a92
[ "MIT" ]
null
null
null
Schedule/accounts/serializers.py
f0rdream/party-time
3b596043627383859042a6e70167e4304bab9a92
[ "MIT" ]
null
null
null
Schedule/accounts/serializers.py
f0rdream/party-time
3b596043627383859042a6e70167e4304bab9a92
[ "MIT" ]
null
null
null
from django.contrib.contenttypes.models import ContentType from django.urls import reverse_lazy from rest_framework.fields import BooleanField, NullBooleanField from rest_framework_jwt.serializers import JSONWebTokenSerializer from tasks.models import Task from .models import UserProfile,upload_location from django.contrib.auth.models import User, Permission from rest_framework.serializers import ( CharField, EmailField, ImageField, HyperlinkedIdentityField, ModelSerializer, SerializerMethodField, ValidationError ) class UserProfileDetailSerializer(ModelSerializer): user = SerializerMethodField() email = SerializerMethodField() picture = ImageField(use_url=True) class Meta: model = UserProfile fields = [ 'user', 'real_name', 'description', 'email', 'user_stu_id', 'school', 'picture', 'phone_number', ] def get_user(self, obj): return str(obj.user.username) def get_email(self, obj): return str(obj.user.email) def get_picture(self, obj): try: picture = obj.picture.url except: picture = None return picture class UserUpdateSerializer(ModelSerializer): """ Serializer to update user profile """ user = SerializerMethodField() email = SerializerMethodField() picture = ImageField(use_url=True, allow_empty_file=True, allow_null=True) class Meta: model = UserProfile fields = [ 'user', 'real_name', 'email', 'description', 'user_stu_id', 'phone_number', 'school', 'picture', ] read_only_fields = [ 'user', 'email', ] def get_user(self, obj): return str(obj.user.username) def get_email(self, obj): return str(obj.user.email) def get_picture(self, obj): try: picture = obj.picture.url except: picture = None return picture def update(self, instance, validated_data): if validated_data['picture'] is None and instance.picture is not None: validated_data['picture'] = instance.picture return super(UserUpdateSerializer, self).update(instance, validated_data) class UserProfileCreateSerializer(ModelSerializer): user = SerializerMethodField() # email = SerializerMethodField() class Meta: model = UserProfile fields = [ 'user', # 'email', 'user_stu_id', 'real_name', 'description', 'phone_number', 'school', ] def get_user(self, obj): return str(obj.user.username) class UserCreateSerializer(ModelSerializer): email = EmailField(label='Email Address') password = CharField(label='Password', write_only=True, style={'input_type': 'password'}) password_confirm = CharField(label='Confirm Password', write_only=True, style={'input_type': 'password'}) user_profile = UserProfileCreateSerializer(write_only=True) profile = UserProfileCreateSerializer(read_only=True) class Meta: model = User fields = [ 'username', 'email', 'password', 'password_confirm', 'user_profile', 'profile', ] extra_kwargs = { "password": {"write_only": True} } def validate(self, attrs): print attrs del attrs['password_confirm'] return attrs # def validate_password_confirm(self, value): # data = self.get_initial() # password = data.get('password') # password_confirm = data.get('password_confirm') # if password != password_confirm: # raise ValidationError("The password is not confirmed") # return value def validate_email(self, value): data = self.get_initial() email = data.get('email') user_queryset = User.objects.filter(email=email) if user_queryset.exists(): raise ValidationError("This email has been registered.") return value def validate_username(self, value): data = self.get_initial() username = data.get('username') if len(username) < 9: raise ValidationError("The username must be more than 9 digits.") user_qs = User.objects.filter(username=username) if user_qs.exists(): raise ValidationError("The username has been registered.") return value def create_user_profile(self,user_obj , profile_data): real_name = profile_data['real_name'] student_id = profile_data['user_stu_id'] school = profile_data['school'] user_profile = UserProfile(user=user_obj, real_name=real_name, user_stu_id=student_id, school=school) user_profile.save() def create(self, validated_data): # print validated_data username = validated_data['username'] email = validated_data['email'] password = validated_data['password'] user_obj = User(username=username, email=email) user_obj.set_password(password) user_obj.save() # user_obj.is_active = False # content_type = ContentType.objects.get_for_model(Task) # permission_to_add = Permission.objects.get(codename="add_task", # content_type=content_type) # permission_to_change = Permission.objects.get(codename="change_task", # content_type=content_type) # permission_to_delete = Permission.objects.get(codename="delete_task", # content_type=content_type) # user_obj.user_permissions.add(permission_to_add, permission_to_change, permission_to_delete) print "succeed create a user" self.create_user_profile(user_obj, validated_data['user_profile']) return user_obj class UserSearchSerializer(ModelSerializer): """ search for user registered """ picture = SerializerMethodField(read_only=True) class Meta: model = User fields = [ 'id', 'username', 'picture', ] def get_picture(self, obj): username = obj.username try: user = User.objects.get(username=username) user_profile = UserProfile.objects.get(user=user) try: picture = user_profile.picture.url except: picture = None return picture except User.DoesNotExist: return None except UserProfile.DoesNotExist: return None class UserLoginSerializer(ModelSerializer): token = CharField(read_only=True, allow_blank=True) username = CharField() remembered = BooleanField(write_only=True, required=False) password = CharField(style={'input_type': 'password'}) picture = SerializerMethodField(read_only=True) # password = PasswordField() class Meta: model = User fields = [ 'username', 'password', 'token', 'remembered', 'picture', ] extra_kwargs = { "password": {"write_only": True} } def validate(self, data): return data def get_picture(self, obj): username = obj['username'] try: user = User.objects.get(username=username) user_profile = UserProfile.objects.get(user=user) try: picture = user_profile.picture.url except: picture = None return picture except User.DoesNotExist: return None except UserProfile.DoesNotExist: return None class LoadUserPictureSerializer(ModelSerializer): picture = SerializerMethodField() class Meta: model = UserProfile fields = [ 'picture' ] def get_picture(self, obj): return obj.picture.url class UserAddGroupSerializer(ModelSerializer): """ Serializer to add and remove group. """ class Meta: model = User fields = [ 'groups', ]
29.11
102
0.578152
815
8,733
6.022086
0.177914
0.026895
0.02282
0.0163
0.393236
0.356968
0.29075
0.275265
0.243073
0.173798
0
0.000344
0.334249
8,733
299
103
29.207358
0.843825
0.110157
0
0.551111
0
0
0.08914
0
0
0
0
0
0
0
null
null
0.057778
0.035556
null
null
0.008889
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
4189ebce3b587d5d121a8faac4d08a070bfc045c
422
py
Python
python_parser_api/src/routes.py
FaceandControl/genshin-parser
b18700ad9f6561d763a128df77d3b977fd23fd37
[ "MIT" ]
null
null
null
python_parser_api/src/routes.py
FaceandControl/genshin-parser
b18700ad9f6561d763a128df77d3b977fd23fd37
[ "MIT" ]
null
null
null
python_parser_api/src/routes.py
FaceandControl/genshin-parser
b18700ad9f6561d763a128df77d3b977fd23fd37
[ "MIT" ]
null
null
null
from src import api from src.resources.main import Main from src.resources.character import Сharacter from src.resources.characters import Сharacters # # Declarations of app routes in type of rest web-architecture # # routes api.add_resource(Main, '/', strict_slashes=False) api.add_resource(Сharacter, '/<ln>/character/<name>', strict_slashes=False) api.add_resource(Сharacters, '/<ln>/characters', strict_slashes=False)
35.166667
75
0.796209
59
422
5.59322
0.440678
0.084848
0.145455
0.127273
0.193939
0.193939
0
0
0
0
0
0
0.092417
422
12
76
35.166667
0.861619
0.156398
0
0
0
0
0.110795
0.0625
0
0
0
0
0
1
0
true
0
0.571429
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
41b1bdae0490a6de481f61f0363f93cb35c1aea9
1,864
py
Python
utils.py
EliorBenYosef/data-science
117e5254f63e482c02aff394780bbdc205d492a3
[ "MIT" ]
null
null
null
utils.py
EliorBenYosef/data-science
117e5254f63e482c02aff394780bbdc205d492a3
[ "MIT" ]
null
null
null
utils.py
EliorBenYosef/data-science
117e5254f63e482c02aff394780bbdc205d492a3
[ "MIT" ]
null
null
null
import numpy as np import matplotlib.pyplot as plt def plot_hist_sum(data, r_labels, ylabel, xlabel, title, x_tick_labels=None, adjacent_bars=True): """ plots Histogram of sum plots multiple bars """ n_rows = len(r_labels) total_bars_width = 0.8 bar_width = total_bars_width / n_rows # bins = np.linspace(1, d, d) bins = np.arange(data.shape[1]) + 1 # d = data.shape[1] fig, ax = plt.subplots(figsize=(10, 6)) for i in range(n_rows): if adjacent_bars: ax.bar(x=bins + (i * bar_width) - total_bars_width / 2 + bar_width / 2, height=data[i], width=bar_width, align='center', label=r_labels[i]) else: # overlapping\superimposed bars ax.bar(x=bins, height=data[i], alpha=0.75, width=total_bars_width, align='center', label=r_labels[i]) ax.legend(loc='best') ax.set_ylabel(ylabel) ax.set_xlabel(xlabel) ax.set_xticks(bins) if x_tick_labels is not None: ax.set_xticklabels(x_tick_labels) ax.set_title(title) def plot_hist_count(data, r_labels, ylabel, xlabel, title, x_tick_labels=None, adjacent_bars=True): """ plots Histogram of count """ n_rows = len(r_labels) total_bars_width = 0.8 bar_width = total_bars_width / n_rows # bins = np.linspace(1, d, d) bins = np.arange(data.shape[1]) + 1 # d = data.shape[1] fig, ax = plt.subplots(figsize=(10, 6)) if adjacent_bars: ax.hist(x=data, bins=bins, label=r_labels) else: # overlapping\superimposed bars for i in range(n_rows): # alpha=0.5 ax.hist(x=data[i], bins=bins, alpha=0.5, label=r_labels[i]) ax.legend(loc='best') ax.set_ylabel(ylabel) ax.set_xlabel(xlabel) ax.set_xticks(bins) if x_tick_labels is not None: ax.set_xticklabels(x_tick_labels) ax.set_title(title)
31.59322
113
0.642167
300
1,864
3.786667
0.24
0.044014
0.058099
0.066901
0.729754
0.685739
0.65757
0.617958
0.617958
0.617958
0
0.018815
0.23015
1,864
58
114
32.137931
0.772822
0.123391
0
0.769231
0
0
0.012555
0
0
0
0
0
0
1
0.051282
false
0
0.051282
0
0.102564
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
41c0e0c72524f09f1f567700371524de838cae79
393
py
Python
backend/users/admin.py
madarconsulting/django-twitter-spark
aac2cbf1b697a3eec3e7a20f0dc0c30ebfeab6c8
[ "MIT" ]
8
2019-07-19T13:50:59.000Z
2021-09-01T03:39:23.000Z
backend/users/admin.py
madarconsulting/django-twitter-spark
aac2cbf1b697a3eec3e7a20f0dc0c30ebfeab6c8
[ "MIT" ]
22
2019-11-11T15:56:04.000Z
2022-03-24T03:29:57.000Z
backend/users/admin.py
madarconsulting/django-twitter-spark
aac2cbf1b697a3eec3e7a20f0dc0c30ebfeab6c8
[ "MIT" ]
3
2019-12-14T04:59:11.000Z
2021-09-01T03:39:28.000Z
from django.contrib import admin # Register your models here. from api.models import (User,Dictionary,CustomDictionary,Topic,Search, WordRoot,SocialNetworkAccounts) admin.site.register(User) admin.site.register(Dictionary) admin.site.register(CustomDictionary) admin.site.register(Topic) admin.site.register(Search) admin.site.register(WordRoot) admin.site.register(SocialNetworkAccounts)
26.2
70
0.834606
48
393
6.833333
0.375
0.192073
0.362805
0
0
0
0
0
0
0
0
0
0.063613
393
14
71
28.071429
0.891304
0.066158
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.2
0
0.2
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
41c14081a7c6761500ead5314ac65338343a04f0
728
py
Python
notes/code/twitter/trump_tweets.py
adamreevesman/msds692
ad1317c0e688f1a7c135d6933e9942068724b761
[ "MIT" ]
null
null
null
notes/code/twitter/trump_tweets.py
adamreevesman/msds692
ad1317c0e688f1a7c135d6933e9942068724b761
[ "MIT" ]
null
null
null
notes/code/twitter/trump_tweets.py
adamreevesman/msds692
ad1317c0e688f1a7c135d6933e9942068724b761
[ "MIT" ]
null
null
null
import tweepy def loadkeys(filename): """" load parrt's keys/tokens from CSV file with form consumer_key, consumer_secret, access_token, access_token_secret """ with open(filename) as f: items = f.readline().strip().split(', ') return items consumer_key, consumer_secret, \ access_token, access_token_secret \ = loadkeys("/Users/parrt/Dropbox/licenses/twitter.csv") auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth) user = api.get_user('realDonaldTrump') print "followers", user.followers_count for status in tweepy.Cursor(api.user_timeline, id='realDonaldTrump').items(100): print status
26.962963
80
0.737637
96
728
5.385417
0.510417
0.148936
0.131528
0.170213
0.259188
0.205029
0.205029
0.205029
0.205029
0
0
0.004847
0.149725
728
27
81
26.962963
0.830372
0
0
0
0
0
0.137815
0.068908
0
0
0
0
0
0
null
null
0
0.066667
null
null
0.133333
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
41c63abb535ee35ebba61ee250c2ecab6948e7ba
3,539
py
Python
hard-gists/2787060/snippet.py
jjhenkel/dockerizeme
eaa4fe5366f6b9adf74399eab01c712cacaeb279
[ "Apache-2.0" ]
21
2019-07-08T08:26:45.000Z
2022-01-24T23:53:25.000Z
hard-gists/2787060/snippet.py
jjhenkel/dockerizeme
eaa4fe5366f6b9adf74399eab01c712cacaeb279
[ "Apache-2.0" ]
5
2019-06-15T14:47:47.000Z
2022-02-26T05:02:56.000Z
hard-gists/2787060/snippet.py
jjhenkel/dockerizeme
eaa4fe5366f6b9adf74399eab01c712cacaeb279
[ "Apache-2.0" ]
17
2019-05-16T03:50:34.000Z
2021-01-14T14:35:12.000Z
# -*- coding:UTF8 -*- #1.概念: # 正则表达式(或 RE)是一种小型的、高度专业化的编程语言, # (在Python中)它内嵌在Python中,并通过 re 模块实现。使用这个小型语言, # 你可以为想要匹配的相应字符串集指定规则;该字符串集可能包含英文语句、email # 地址、TeX命令或任何你想搞定的东西。然后你可以问诸如“这个字符串匹配 # 该模式吗?”或“在这个字符串中是否有部分匹配该模式呢?”。你也可以使用 RE # 以各种方式来修改或分割字符串。 # # 正则表达式语言相对小型和受限(功能有限),因此并非所有字符串处理都能用 # 正则表达式完成。当然也有些任务可以用正则表达式完成,不过最终表达式会变 # 得异常复杂。碰到这些情形时,编写 Python 代码进行处理可能反而更好;尽管 # Python 代码比一个精巧的正则表达式要慢些,但它更易理解。 # #2.在正则表达式中, 如下的字符是具有特殊含义的 # . (所有字符) ^ $ *(0-N次) +(1-N次) ? (0-1次) { } [ ] \ | ( ) # 1)."[" 和 "]"。它们常用来指定一个字符类别,所谓字符类别就是你想匹配的一个字符集 # 2).其它地方的"^"只会简单匹配 "^"字符本身。例[^5] 将匹配除 "5" 之外的任意字符。 # 3).反斜杠后面可以加不同的字符以表示不同特殊意义。它也可以用于取消所有的元字符 # #3.RE 函数用法: # findall(rule , target [,flag] ) 在目标字符串中查找符合规则的字符串。 # match() 决定 RE 是否在字符串刚开始的位置匹配 # search() 扫描字符串,找到这个 RE 匹配的位置 # findall() 找到 RE 匹配的所有子串,并把它们作为一个列表返回 # finditer() 找到 RE 匹配的所有子串,并把它们作为一个迭代器返回 # group() 返回被 RE 匹配的字符串 # start() 返回匹配开始的位置 # end() 返回匹配结束的位置 # span() 返回一个元组包含匹配 (开始,结束) 的位置 # compile( rule [,flag] )将正则规则编译成一个Pattern对象,以供接下来使用第一个参数 # # 是规则式,第二个参数是规则选项。(使用compile加速) # #4 : 含义: # 预定义转义字符集: “\d” “\w” “\s” 等等,它们是以字符’\’开头,后面接一个特定 # #字符的形式,用来指示一个预定义好的含义 # # ‘^’ 和’$’ 匹配字符串开头和结尾 # ‘.’ 匹配所有字符 除\n以外 # ‘\d’ 匹配数字 # ‘\D’ 匹配非数字 # ‘\w’ 匹配字母和数字 # ‘\W’ 匹配非英文字母和数字 # ‘\s’ 匹配间隔符 # ‘\S’ 匹配非间隔符 # ‘\A’ 匹配字符串开头 # ‘\Z’ 匹配字符串结尾 # ‘\b’ 只用以匹配单词的词首和词尾。单词被定义为一个字母数字序列,因此词尾就 # # 是用空白符或非字母数字符来标示的。(退格) # ‘\B’,它正好同 \b 相反,只在当前位置不在单词边界时匹配。 #5.前向界定与后向界定: # ‘(?<=…)’ 前向界定:括号中’…’代表你希望匹配的字符串的前面应该出现的字符串。 # ‘(?=…)’后向界定 :括号中的’…’代表你希望匹配的字符串后面应该出现的字符串 # ‘(?<!..)’前向非界定 :只有当你希望的字符串前面不是’…’的内容时才匹配 # ‘(?!...)’后向非界定 :只有当你希望的字符串后面不跟着’…’内容时才匹配。 #6.组的基本知识: # ‘(‘’)’ 无命名组 [a-z]+(\d+)[a-z]+ # ‘(?P<name>…)’ 命名组 (?P<g1>[a-z]+)\d+(?P=g1) # ‘(?P=name)’ 调用已匹配的命名组 # ‘\number’通过序号调用已匹配的组正则式中的每个组都有一个序号,序号是按组 # #从左到右,从1开始的数字,你可以通过下面的形式来调用已匹配的组 # ( r"(\d+)([a-z]+)(\d+)(\2)(\1)" ) import sys reload(sys) sys.setdefaultencoding('utf-8') import rhinoscriptsyntax as rs # 正则表达式 import re str1 = "abc \\ 123 456" print re.findall("\\\\",str1) # 不用r和用r的区 print re.findall(r"\d\Z",str1) # 用"r"来定义规则字符串 p = re.compile('(a)b') m = p.match('ab') print m.group() s = "aaa1 22 gg 333 ccc 4444 pppp 55555 666" print re.findall(r"\b\d{3}\b",s) print re.findall(r"\b\d{2,4}\b",s) s2 = "aaa111aaa , bbb222 , 333ccc" print re.findall( r"(?<=[a-z]+)\d+(?=[a-z]+)",s2 ) print re.findall( r"\d+(?=[a-z]+)",s2 ) ## 目标 前面是a-z 1-多次、中间数字1-9 1-多次 print re.findall(r"\d+(?!\w+)",s2) #无命名组 print re.findall(r"[a-z]+(\d+)[a-z]+",s2) # 只返回()里面的 s3 = 'aaa111aaa,bbb222,333ccc,444ddd444,555eee666,fff777ggg,hhh888hhh' print re.findall(r"([a-z]+)\d+([a-z]+)",s3) #返回括号里面的 #‘(?P<name>…)’ 命名组 print re.findall( r"(?P<g1>[a-z]+)\d+(?P=g1)",s3 ) #找出被中间夹有数字的前后同样的字母 print re.findall(r"([a-z]+)\d+\1",s3) s4 = "111aaa222aaa111,333bbb444bb33" print re.findall( r"(\d+)([a-z]+)(\d+)(\2)(\1)", s4 ) #数字、字母、数字、字母、数字相对称 print re.compile(r"(\d+)([a-z]+)(\d+)(\2)(\1)").findall(s4) #compile( rule [,flag] ) 使用compile加速 s5 = "111,222,aaa,bbb,ccc333,444ddd" print re.compile(r"\d+\b").findall(s5) # \退格 匹配一个位于开头的数字,没有使用M选项 s6 = "123 456\n789 012\n345 678" print re.compile(r"^\d+",re.M).findall(s6) # 匹配位于(M/多行)开头的数字 rcm=re.compile(r"\d+$")# 对于’$’来说,没有使用M选项,它将匹配最后一个行尾的数字,即’678’,加上以后,就能匹配三个行尾的数字456 012和678了. print re.compile(r"\d+$",re.M).findall(s6) #
29.991525
91
0.587737
483
3,539
4.356108
0.488613
0.053232
0.079848
0.078422
0.147338
0.115494
0.099335
0.057034
0.057034
0.020913
0
0.060912
0.188189
3,539
117
92
30.247863
0.66307
0.630687
0
0
0
0
0.372533
0.181743
0
0
0
0
0
0
null
null
0
0.09375
null
null
0.53125
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
41cee06d65e081783f71b53fff425a032527d5df
1,327
py
Python
snekcord/objects/user.py
asleep-cult/snekcord
04302b0c65bad01c00fb047df3040d3234773689
[ "MIT" ]
9
2021-07-26T00:25:51.000Z
2022-02-23T16:00:10.000Z
snekcord/objects/user.py
asleep-cult/snekcord
04302b0c65bad01c00fb047df3040d3234773689
[ "MIT" ]
37
2021-05-29T16:16:22.000Z
2022-02-13T13:57:25.000Z
snekcord/objects/user.py
asleep-cult/snekcord
04302b0c65bad01c00fb047df3040d3234773689
[ "MIT" ]
4
2021-06-02T16:45:41.000Z
2022-02-10T14:57:16.000Z
import enum from .base import BaseObject from .. import json __all__ = ('UserFlags', 'PremiumType', 'User') class UserFlags(enum.IntFlag): NONE = 0 STAFF = 1 << 0 PARTNER = 1 << 1 HYPESQUAD = 1 << 2 BUG_HUNTER_LEVEL_1 = 1 << 3 HYPESQUAD_ONLINE_HOUSE_1 = 1 << 6 HYPESQUAD_ONLINE_HOUSE_2 = 1 << 7 HYPESQUAD_ONLINE_HOUSE_3 = 1 << 8 PREMIUM_EARLY_SUPPORTER = 1 << 9 TEAM_PSUEDO_USER = 1 << 10 BUG_HUNTER_LEVEL_2 = 1 << 14 VERIFIED_BOT = 1 << 16 VERIFIED_DEVELOPER = 1 << 17 CERTIFIED_MODERATOR = 1 << 18 BOT_HTTP_INTERACTIONS = 1 << 19 class PremiumType(enum.IntEnum): NONE = 0 NITRO_CLASSIC = 1 NITRO = 2 class User(BaseObject): name = json.JSONField('username') discriminator = json.JSONField('discriminator') avatar = json.JSONField('avatar') bot = json.JSONField('bot') system = json.JSONField('system') mfa_enabled = json.JSONField('mfa_enabled') banner = json.JSONField('banner') accent_color = json.JSONField('accent_color') locale = json.JSONField('locale') verified = json.JSONField('verified') email = json.JSONField('email') flags = json.JSONField('flags', UserFlags) premium_type = json.JSONField('premium_type', PremiumType) public_flags = json.JSONField('public_flags', UserFlags)
27.645833
62
0.666918
166
1,327
5.108434
0.39759
0.214623
0.070755
0
0
0
0
0
0
0
0
0.041227
0.214017
1,327
47
63
28.234043
0.771812
0
0
0.051282
0
0
0.10324
0
0
0
0
0
0
1
0
false
0
0.076923
0
0.974359
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
68ba6868d9de9aa129a3f435e14fa74451010d5a
505
py
Python
gallery/search_indexes.py
mingyuchoo/myartworks
9404dad4b9ee0047049a1a0196cb9ac32ce520d7
[ "MIT" ]
1
2016-08-16T06:34:36.000Z
2016-08-16T06:34:36.000Z
gallery/search_indexes.py
mingyuchoo/myartworks
9404dad4b9ee0047049a1a0196cb9ac32ce520d7
[ "MIT" ]
null
null
null
gallery/search_indexes.py
mingyuchoo/myartworks
9404dad4b9ee0047049a1a0196cb9ac32ce520d7
[ "MIT" ]
null
null
null
import datetime from haystack import indexes from .models import Portfolio class PortfolioIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) writer = indexes.CharField(model_attr='writer') created_date = indexes.DateTimeField(model_attr='created_date') def get_model(self): return Portfolio def index_queryset(self, using=None): return self.get_model().objects.filter(created_date__lte=datetime.datetime.now())
33.666667
89
0.764356
62
505
6.048387
0.564516
0.088
0
0
0
0
0
0
0
0
0
0
0.140594
505
15
89
33.666667
0.864055
0
0
0
0
0
0.035573
0
0
0
0
0
0
1
0.181818
false
0
0.272727
0.181818
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
68c2804c261cb3395f497ea7356388228acca5b2
104
py
Python
output/models/saxon_data/open/open035_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
1
2021-08-14T17:59:21.000Z
2021-08-14T17:59:21.000Z
output/models/saxon_data/open/open035_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
4
2020-02-12T21:30:44.000Z
2020-04-15T20:06:46.000Z
output/models/saxon_data/open/open035_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
null
null
null
from output.models.saxon_data.open.open035_xsd.open035 import BookStore __all__ = [ "BookStore", ]
17.333333
71
0.759615
13
104
5.615385
0.846154
0
0
0
0
0
0
0
0
0
0
0.066667
0.134615
104
5
72
20.8
0.744444
0
0
0
0
0
0.086538
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
68c6f1b34b6e4cfeab1a63860b03607b490cb0e0
252
py
Python
main.py
Gaoyifei1011/AmapProgram
d45a27abf9f508d922f37abc34f00da6d0aab4a0
[ "MIT" ]
1
2021-05-19T02:48:49.000Z
2021-05-19T02:48:49.000Z
main.py
Gaoyifei1011/AmapProgram
d45a27abf9f508d922f37abc34f00da6d0aab4a0
[ "MIT" ]
1
2021-05-18T16:01:56.000Z
2021-05-20T02:14:52.000Z
main.py
Gaoyifei1011/AmapProgram
d45a27abf9f508d922f37abc34f00da6d0aab4a0
[ "MIT" ]
1
2021-06-04T06:39:57.000Z
2021-06-04T06:39:57.000Z
import sys from PyQt5 import QtWidgets from LoginMainWindow import LoginMainWindow if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) loginWindow = LoginMainWindow() loginWindow.show() sys.exit(app.exec_())
21
44
0.706349
26
252
6.5
0.615385
0
0
0
0
0
0
0
0
0
0
0.005
0.206349
252
11
45
22.909091
0.84
0
0
0
0
0
0.033195
0
0
0
0
0
0
1
0
false
0
0.375
0
0.375
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
1
0
0
0
0
2
68d3da6cc68cf283b53b3b77966baa6ebf303b7f
247
py
Python
HackerRank/Python3/listComprension.py
santoshgawande/DS-Algorithms
eb1de229fd3336d862bd4787295f208a4424d0bb
[ "Apache-2.0" ]
null
null
null
HackerRank/Python3/listComprension.py
santoshgawande/DS-Algorithms
eb1de229fd3336d862bd4787295f208a4424d0bb
[ "Apache-2.0" ]
null
null
null
HackerRank/Python3/listComprension.py
santoshgawande/DS-Algorithms
eb1de229fd3336d862bd4787295f208a4424d0bb
[ "Apache-2.0" ]
null
null
null
if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) nlist = [[i,j,k] for i in range(0, x+1) for j in range(0, y+1) for k in range(0, z+1) if (i+j+k) > n or (i+j+k)< n] print(nlist)
35.285714
119
0.510121
52
247
2.269231
0.384615
0.271186
0.076271
0.067797
0
0
0
0
0
0
0
0.032967
0.263158
247
7
120
35.285714
0.615385
0
0
0
0
0
0.032258
0
0
0
0
0
0
1
0
false
0
0
0
0
0.142857
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
68e5b9e8269ed15f6fe60de3ea6abf29fde863fa
513
py
Python
gpio.py
bengoodwyn/waterbot
e51f290c5f2e50a3b01cc20651a7a6b70c43c8b0
[ "MIT" ]
null
null
null
gpio.py
bengoodwyn/waterbot
e51f290c5f2e50a3b01cc20651a7a6b70c43c8b0
[ "MIT" ]
null
null
null
gpio.py
bengoodwyn/waterbot
e51f290c5f2e50a3b01cc20651a7a6b70c43c8b0
[ "MIT" ]
null
null
null
import os def __run_or_die(cmd): if 0 != os.system(cmd): raise Exception("Failed to run {}".format(cmd)) gpio_cmd = os.getenv("GPIO_COMMAND", "gpio") def mode_out(pin): cmd = "{} mode {} out".format(gpio_cmd, pin) __run_or_die(cmd) def mode_in(pin): cmd = "{} mode {} in".format(gpio_cmd, pin) __run_or_die(cmd) def on(pin): cmd = "{} write {} 0".format(gpio_cmd, pin) __run_or_die(cmd) def off(pin): cmd = "{} write {} 1".format(gpio_cmd, pin) __run_or_die(cmd)
21.375
55
0.614035
84
513
3.416667
0.309524
0.087108
0.139373
0.191638
0.407666
0.407666
0.407666
0.407666
0.313589
0
0
0.007389
0.208577
513
23
56
22.304348
0.699507
0
0
0.235294
0
0
0.165692
0
0
0
0
0
0
1
0.294118
false
0
0.058824
0
0.352941
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
ec044b1d51f76e78f5ae0c52f05400e0ebc6634d
923
py
Python
Python Assignments/Python Assignment 6/Assignment6_3.py
Suryakant-Kamble/Python
6c82205f6fdd511e01bf109aaa2e75da53fb1cea
[ "MIT" ]
null
null
null
Python Assignments/Python Assignment 6/Assignment6_3.py
Suryakant-Kamble/Python
6c82205f6fdd511e01bf109aaa2e75da53fb1cea
[ "MIT" ]
null
null
null
Python Assignments/Python Assignment 6/Assignment6_3.py
Suryakant-Kamble/Python
6c82205f6fdd511e01bf109aaa2e75da53fb1cea
[ "MIT" ]
null
null
null
class Arithmetic: def __init__(self): self.value1 = 0 self.value2 = 0 def Accept(self, no1, no2): self.value1 = no1 self.value2 = no2 def Addition(self): result = self.value1 + self.value2 print("Addition is = ", result) def Subtraction(self): result = self.value1 - self.value2 print("Subtraction is = ", result) def Multiplication(self): result = self.value1 * self.value2 print("Multiplication is = ", result) def Division(self): result = self.value1 / self.value2 print("Division is = ", result) def main(): a = int(input("Enter value1 : ")) b = int(input("Enter value2 = ")) obj = Arithmetic() obj.Accept(a, b) obj.Addition() obj.Subtraction() obj.Multiplication() obj.Division() if __name__ == '__main__': main()
23.075
46
0.551463
100
923
4.97
0.27
0.120724
0.112676
0.160966
0.28169
0.28169
0.28169
0
0
0
0
0.032103
0.325027
923
39
47
23.666667
0.76565
0
0
0
0
0
0.116516
0
0
0
0
0
0
1
0.233333
false
0
0
0
0.266667
0.133333
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
ec242099b667abe9316e5298f285dea3894ccdf1
478
py
Python
facebook/modules/profile/user/admin.py
fabiangermann/django-facebook-graph
e63039c94a50f293ae79e8ecda24a9c7d1b61c68
[ "Apache-2.0" ]
1
2015-09-24T00:36:28.000Z
2015-09-24T00:36:28.000Z
facebook/modules/profile/user/admin.py
fabiangermann/django-facebook-graph
e63039c94a50f293ae79e8ecda24a9c7d1b61c68
[ "Apache-2.0" ]
null
null
null
facebook/modules/profile/user/admin.py
fabiangermann/django-facebook-graph
e63039c94a50f293ae79e8ecda24a9c7d1b61c68
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin from facebook.modules.base import AdminBase from .models import User class UserAdmin(AdminBase): list_display = ('id', 'profile_link', '_email', 'access_token', 'user', '_name', 'created', 'updated',) readonly_fields = ('friends', '_name', '_locale', '_username', '_first_name', '_last_name', '_link', '_birthday', '_email', '_location', '_gender', '_graph') search_fields = ('id', '_name') admin.site.register(User, UserAdmin)
34.142857
161
0.694561
55
478
5.654545
0.690909
0
0
0
0
0
0
0
0
0
0
0
0.127615
478
13
162
36.769231
0.745803
0
0
0
0
0
0.320084
0
0
0
0
0
0
1
0
false
0
0.375
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
0
0
1
0
1
0
0
2
6b521d8e07f3cade2d1200e8918244586be7d2b6
721
py
Python
kubeflow/utils/kaggle.py
GalaxyIT/kubeflow-utils
911ef63df2e5b635960387390e7be397a293d83b
[ "Apache-2.0" ]
null
null
null
kubeflow/utils/kaggle.py
GalaxyIT/kubeflow-utils
911ef63df2e5b635960387390e7be397a293d83b
[ "Apache-2.0" ]
null
null
null
kubeflow/utils/kaggle.py
GalaxyIT/kubeflow-utils
911ef63df2e5b635960387390e7be397a293d83b
[ "Apache-2.0" ]
null
null
null
import json from pathlib import Path class Kaggle: def login(self, username, apikey): kaggle_json = Kaggle.__generate_kaggle_json_string(username, apikey) Kaggle.__save_kaggle_json(kaggle_json) @staticmethod def __generate_kaggle_json_string(username, apikey): data = { "username": username, "key": apikey } return json.dumps(data) @staticmethod def __save_kaggle_json(json_str): kaggle_path = Path.home().joinpath('.kaggle') if not kaggle_path.exists(): kaggle_path.mkdir(parents=True) with open(str(kaggle_path.joinpath('kaggle.json')), 'w+') as kaggle_json: print(json_str, file=kaggle_json)
27.730769
81
0.65742
86
721
5.186047
0.406977
0.201794
0.089686
0.107623
0.170404
0.170404
0
0
0
0
0
0
0.241331
721
25
82
28.84
0.815356
0
0
0.105263
1
0
0.042996
0
0
0
0
0
0
1
0.157895
false
0
0.105263
0
0.368421
0.052632
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
6b5ba2d44148c5c2ef3d2a547d1822bd946eb722
422
py
Python
setup.py
panta/sample-n-files
dfa0928ec61e11b67ce15680478997e24dd00b64
[ "Apache-2.0" ]
null
null
null
setup.py
panta/sample-n-files
dfa0928ec61e11b67ce15680478997e24dd00b64
[ "Apache-2.0" ]
null
null
null
setup.py
panta/sample-n-files
dfa0928ec61e11b67ce15680478997e24dd00b64
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python from setuptools import setup, find_packages setup( name="sample-n-files", version="1.0", author="Marco Pantaleoni", description="Randomly sample N files from a directory.", py_modules=['sample_n_files'], install_requires=[ 'Click' ], entry_points=''' [console_scripts] sample-n-files=sample_n_files:cli ''', packages=find_packages() )
21.1
60
0.64218
51
422
5.117647
0.666667
0.1341
0.229885
0
0
0
0
0
0
0
0
0.006098
0.222749
422
19
61
22.210526
0.789634
0.047393
0
0
0
0
0.413965
0.082294
0
0
0
0
0
1
0
true
0
0.0625
0
0.0625
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
6b6aab5b1338487503c587746e4c1c1b8fcc7102
259
py
Python
SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Metrics.py
dvzrv/softlayer-python
9a5f6c6981bcc370084537b4d1769383499ce90d
[ "MIT" ]
126
2015-01-05T05:09:22.000Z
2021-07-02T00:16:35.000Z
SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Metrics.py
dvzrv/softlayer-python
9a5f6c6981bcc370084537b4d1769383499ce90d
[ "MIT" ]
969
2015-01-05T15:55:31.000Z
2022-03-31T19:55:20.000Z
SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Metrics.py
dvzrv/softlayer-python
9a5f6c6981bcc370084537b4d1769383499ce90d
[ "MIT" ]
176
2015-01-22T11:23:40.000Z
2022-02-11T13:16:58.000Z
getMappingUsageMetrics = [ { "names": [ "TotalBandwidth", "TotalHits", "HitRatio" ], "totals": [ "0.0", "0", "0.0" ], "type": "TOTALS" } ]
16.1875
29
0.305019
13
259
6.076923
0.615385
0.101266
0.113924
0.101266
0
0
0
0
0
0
0
0.042017
0.540541
259
15
30
17.266667
0.621849
0
0
0.133333
0
0
0.227799
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
1
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
6b74c37ed0e549fee8d1a6b238cbee95f182541d
210
py
Python
src/utils/readfile/config.py
umimori13/mai-bot
90e10f6488942809d4ca5ef342f403b683dbc904
[ "MIT" ]
null
null
null
src/utils/readfile/config.py
umimori13/mai-bot
90e10f6488942809d4ca5ef342f403b683dbc904
[ "MIT" ]
null
null
null
src/utils/readfile/config.py
umimori13/mai-bot
90e10f6488942809d4ca5ef342f403b683dbc904
[ "MIT" ]
null
null
null
from pydantic import BaseSettings class Config(BaseSettings): # Your Config Here dir_name = "src" data_dir_name = "data" config_dir_name = "config" class Config: extra = "ignore"
17.5
33
0.657143
25
210
5.32
0.56
0.157895
0
0
0
0
0
0
0
0
0
0
0.261905
210
11
34
19.090909
0.858065
0.07619
0
0
0
0
0.098958
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.857143
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
0
1
0
0
2