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
8d5ecf84bb8d774f4a78f385b11d774ebea74ca7
1,218
py
Python
io_core/io_core_magma.py
makaimann/garnet
5a5e721cd46588cc4abd326e6cb78472ebc93a32
[ "BSD-3-Clause" ]
null
null
null
io_core/io_core_magma.py
makaimann/garnet
5a5e721cd46588cc4abd326e6cb78472ebc93a32
[ "BSD-3-Clause" ]
null
null
null
io_core/io_core_magma.py
makaimann/garnet
5a5e721cd46588cc4abd326e6cb78472ebc93a32
[ "BSD-3-Clause" ]
null
null
null
import magma from gemstone.common.core import Core, PnRTag class IOCore(Core): def __init__(self): super().__init__() self.add_ports( glb2io_16=magma.In(magma.Bits[16]), glb2io_1=magma.In(magma.Bits[1]), io2glb_16=magma.Out(magma.Bits[16]), io2glb_1=magma.Out(magma.Bits[1]), f2io_16=magma.In(magma.Bits[16]), f2io_1=magma.In(magma.Bits[1]), io2f_16=magma.Out(magma.Bits[16]), io2f_1=magma.Out(magma.Bits[1]), ) self.wire(self.ports.glb2io_16, self.ports.io2f_16) self.wire(self.ports.glb2io_1, self.ports.io2f_1) self.wire(self.ports.f2io_16, self.ports.io2glb_16) self.wire(self.ports.f2io_1, self.ports.io2glb_1) def inputs(self): return [self.ports.glb2io_16, self.ports.glb2io_1, self.ports.f2io_16, self.ports.f2io_1] def outputs(self): return [self.ports.io2glb_16, self.ports.io2glb_1, self.ports.io2f_16, self.ports.io2f_1] def name(self): return "io_core" def pnr_info(self): return [PnRTag("I", 2, self.DEFAULT_PRIORITY), PnRTag("i", 1, self.DEFAULT_PRIORITY)]
31.230769
59
0.611658
179
1,218
3.955307
0.201117
0.20339
0.09322
0.090395
0.548023
0.40678
0
0
0
0
0
0.080874
0.248768
1,218
38
60
32.052632
0.692896
0
0
0
0
0
0.007389
0
0
0
0
0
0
1
0.166667
false
0
0.066667
0.133333
0.4
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
1
0
0
0
2
a5cc895e623964fc6ed235bb51535094d98bf959
460
py
Python
verisure/__init__.py
gablin/python-verisure
1a8bb8703a1708e9c235dfa28e06d4fdc784c8dd
[ "MIT" ]
131
2015-08-07T06:57:40.000Z
2022-03-25T16:15:33.000Z
verisure/__init__.py
gablin/python-verisure
1a8bb8703a1708e9c235dfa28e06d4fdc784c8dd
[ "MIT" ]
95
2015-09-08T10:15:00.000Z
2022-02-19T01:28:52.000Z
verisure/__init__.py
gablin/python-verisure
1a8bb8703a1708e9c235dfa28e06d4fdc784c8dd
[ "MIT" ]
60
2015-12-16T20:08:53.000Z
2021-09-30T19:07:33.000Z
""" A python module for reading and changing status of verisure devices through verisure app API. """ __all__ = [ 'Error', 'LoginError', 'ResponseError', 'Session' ] from .session import ( # NOQA Error, LoginError, ResponseError, Session ) ALARM_ARMED_HOME = 'ARMED_HOME' ALARM_ARMED_AWAY = 'ARMED_AWAY' ALARM_DISARMED = 'DISARMED' LOCK_LOCKED = 'LOCKED' LOCK_UNLOCKED = 'UNLOCKED' SMARTPLUG_ON = 'on' SMARTPLUG_OFF = 'off'
16.428571
75
0.691304
53
460
5.716981
0.622642
0.09901
0.184818
0.231023
0
0
0
0
0
0
0
0
0.202174
460
27
76
17.037037
0.825613
0.215217
0
0
0
0
0.232295
0
0
0
0
0
0
1
0
false
0
0.052632
0
0.052632
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
a5cddb03cd3808810d826a69bb361c33a78d70ea
2,719
py
Python
setup.py
tonyjo/ubc_primitives
bc94a403f176fe28db2a9ac9d1a48cb9db021f90
[ "Apache-2.0" ]
null
null
null
setup.py
tonyjo/ubc_primitives
bc94a403f176fe28db2a9ac9d1a48cb9db021f90
[ "Apache-2.0" ]
4
2020-07-19T00:45:29.000Z
2020-12-10T18:25:41.000Z
setup.py
tonyjo/ubc_primitives
bc94a403f176fe28db2a9ac9d1a48cb9db021f90
[ "Apache-2.0" ]
1
2021-04-30T18:13:49.000Z
2021-04-30T18:13:49.000Z
import subprocess from setuptools import setup, find_packages # Run # subprocess.run(["apt", "update"]) # subprocess.run(["apt", "install", "python3.6-gdbm"]) # Get install requirements with open('requirements.txt', 'r') as f: install_requires = list() dependency_links = list() for line in f: re = line.strip() if re: install_requires.append(re) setup(name='ubc_primitives', version='0.2.0', description='Setup primitive build model paths', author='UBC', url='https://github.com/plai-group/ubc_primitives.git', maintainer_email='tonyjos@cs.ubc.ca', maintainer='Tony Joseph', license='Apache-2.0', packages=find_packages(exclude=['pipelines', 'ta2-eval']), zip_safe=False, python_requires='>=3.6', install_requires=install_requires, keywords='d3m_primitive', entry_points={ 'd3m.primitives': [ 'feature_extraction.boc.UBC=primitives_ubc.boc:BagOfCharacters', 'feature_extraction.bow.UBC=primitives_ubc.bow:BagOfWords', 'feature_extraction.convolutional_neural_network.UBC=primitives_ubc.cnn:ConvolutionalNeuralNetwork', 'feature_extraction.googlenet_cnn.UBC=primitives_ubc.googlenet:GoogleNetCNN', 'feature_extraction.mobilenet_cnn.UBC=primitives_ubc.mobilenet:MobileNetCNN', 'feature_extraction.resnet_cnn.UBC=primitives_ubc.resnet:ResNetCNN', 'feature_extraction.vggnet_cnn.UBC=primitives_ubc.vgg:VGG16CNN', 'classification.canonical_correlation_forests.UBC=primitives_ubc.clfyCCFS:CanonicalCorrelationForestsClassifierPrimitive', 'regression.canonical_correlation_forests.UBC=primitives_ubc.regCCFS:CanonicalCorrelationForestsRegressionPrimitive', 'classification.multilayer_perceptron.UBC=primitives_ubc.clfyMLP:MultilayerPerceptronClassifierPrimitive', 'regression.multilayer_perceptron.UBC=primitives_ubc.regMLP:MultilayerPerceptronRegressionPrimitive', 'clustering.kmeans_clustering.UBC=primitives_ubc.kmeans:KMeansClusteringPrimitive', 'dimensionality_reduction.principal_component_analysis.UBC=primitives_ubc.pca:PrincipalComponentAnalysisPrimitive', 'classification.simple_cnaps.UBC=primitives_ubc.simpleCNAPS:SimpleCNAPSClassifierPrimitive', 'regression.linear_regression.UBC=primitives_ubc.linearRegression:LinearRegressionPrimitive', 'classification.logistic_regression.UBC=primitives_ubc.logisticRegression:LogisticRegressionPrimitive', 'operator.diagonal_mvn.UBC=primitives_ubc.diagonalMVN:DiagonalMVNPrimitive', ], })
53.313725
136
0.72637
258
2,719
7.430233
0.51938
0.128847
0.141888
0.039645
0.08242
0.044862
0
0
0
0
0
0.006217
0.171754
2,719
50
137
54.38
0.845027
0.042295
0
0
0
0
0.643709
0.564063
0
0
0
0
0
1
0
false
0
0.046512
0
0.046512
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a5d3b2497e1468671423984587561cac679ee1d4
336
py
Python
exe020a.py
Alexmachado81/ExerciciosPython_Resolvidos
2774ba742788eb7b545f3f85e9438deb68a983d4
[ "MIT" ]
null
null
null
exe020a.py
Alexmachado81/ExerciciosPython_Resolvidos
2774ba742788eb7b545f3f85e9438deb68a983d4
[ "MIT" ]
null
null
null
exe020a.py
Alexmachado81/ExerciciosPython_Resolvidos
2774ba742788eb7b545f3f85e9438deb68a983d4
[ "MIT" ]
null
null
null
import random nome1 = str(input('Informe o primeiro nome :\n')) nome2 = str(input('Informe o segundo nome :\n')) nome3 = str(input('Informe o terceiro nome :\n')) nome4 = str(input('Informe o quarto nome :\n')) lista = [nome1,nome2,nome3,nome4] escolhido = random.shuffle(lista) print(' A ordem de apresentação será :') print(lista)
25.846154
49
0.702381
51
336
4.627451
0.490196
0.135593
0.254237
0.271186
0
0
0
0
0
0
0
0.027682
0.139881
336
13
50
25.846154
0.788927
0
0
0
0
0
0.403561
0
0
0
0
0
0
1
0
false
0
0.111111
0
0.111111
0.222222
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
a5da567cb78f76a2d6801e56135f4a494090e6a0
309
py
Python
Backend_folder/models/socials.py
Miguel22247/MatchGame
7099b117820c2913201c1c29c77864e10d886fcb
[ "MIT" ]
null
null
null
Backend_folder/models/socials.py
Miguel22247/MatchGame
7099b117820c2913201c1c29c77864e10d886fcb
[ "MIT" ]
1
2021-11-04T17:53:58.000Z
2021-11-04T17:53:58.000Z
Backend_folder/models/socials.py
Miguel22247/MatchGame
7099b117820c2913201c1c29c77864e10d886fcb
[ "MIT" ]
null
null
null
#!/usr/bin/python3.6 """Script to create an instance of the class Social""" from sqlalchemy import Column, String from models.base_model import Base, BaseModel class Social(BaseModel, Base): """Class to store the social data""" __tablename__ = "social" name = Column(String(20), nullable=False)
28.090909
54
0.724919
43
309
5.093023
0.674419
0.100457
0
0
0
0
0
0
0
0
0
0.015444
0.161812
309
10
55
30.9
0.830116
0.320388
0
0
0
0
0.030151
0
0
0
0
0
0
1
0
false
0
0.4
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
a5dd99acebda99627c287e7bd503fb215318ade8
2,452
py
Python
tests.py
kb1lqc/pytun
a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d
[ "MIT" ]
13
2015-04-16T04:17:56.000Z
2019-04-18T06:50:08.000Z
tests.py
kb1lqc/pytun
a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d
[ "MIT" ]
3
2017-06-08T13:34:14.000Z
2017-12-18T09:55:50.000Z
tests.py
kb1lqc/pytun
a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d
[ "MIT" ]
9
2015-12-30T19:22:00.000Z
2019-05-16T14:43:15.000Z
import pytun import logging import select def pprint_buf(buf): """ Dirty & convenient function to display the hexademical repr. of a buffer. """ DEFAULT_SIZE = 4 def hex2(i, l = None): l = l if l is not None else DEFAULT_SIZE h = hex(i).upper()[2:] if len(h) != l: h = "0" * (l - len(h)) + h return h def displayable_char(c): if ord(c) < 0x20 or ord(c) >= 0x7f: c = "." return c print " " * DEFAULT_SIZE, for i in range(16): print hex2(i, 2), print raws = [] for i, c in enumerate(buf): if i % 16 == 0: if i: print "\t" + "".join(raws) raws = [] print hex2(i), raws.append(displayable_char(c)) print hex2(ord(c), 2), print " " * (15 - (i % 16)) + "\t" + "".join(raws) def main(): # Configure pytun's logger pytun.logger.setLevel(logging.DEBUG) logging.basicConfig() # Open the tunnel try: tun = pytun.open() except pytun.Tunnel.NotPermitted: print print "*" * 80 print "You don't have the rights to access the file %s." % (pytun.TUN_KO_PATH, ) print "Give the access of this file to pytun, or if you trust me," print "elevate this current script to root level." print "*" * 80 print raise print "*" * 80 print print "OK. The tunnel '%s' had been created." % (tun.name, ) print print "If you want to play with it, first configure it." print print "1. Set up the network and set an IP" print " $ ifconfig %s 192.168.42.1" % (tun.name, ) print print "2. Add the network route" print " $ route add -net 192.168.42.0/24 dev %s" % (tun.name, ) print print "Then, try to ping some IP in this network ..." print " $ ping 192.168.42.42" print print "Or do some UDP netcat magic." print " $ nc 192.168.42.42 4242 -u" print print "Enjoy !" print print "*" * 80 try: # Receive loop while True: buf = tun.recv() pytun.logger.info("Packet received !") pprint_buf(buf) print except KeyboardInterrupt: print "Keyboard interrupt. Closing." finally: # Close the tunnel tun.close() if __name__ == "__main__": main()
22.703704
88
0.521207
328
2,452
3.844512
0.417683
0.071372
0.025377
0.040444
0
0
0
0
0
0
0
0.049201
0.361746
2,452
107
89
22.915888
0.75655
0.028548
0
0.266667
0
0
0.247919
0
0
0
0.003504
0
0
0
null
null
0
0.04
null
null
0.52
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
a5ff806280c1efe3b38d7be9fefa28dbfa3378e4
3,571
py
Python
pkg/codegen/internal/test/testdata/simple-resource-schema/python/pulumi_example/resource.py
CDMiXer/Woolloomooloo
62272b869dbc0190fd20540607b33f3edeba9dce
[ "Apache-2.0", "MIT" ]
null
null
null
pkg/codegen/internal/test/testdata/simple-resource-schema/python/pulumi_example/resource.py
CDMiXer/Woolloomooloo
62272b869dbc0190fd20540607b33f3edeba9dce
[ "Apache-2.0", "MIT" ]
null
null
null
pkg/codegen/internal/test/testdata/simple-resource-schema/python/pulumi_example/resource.py
CDMiXer/Woolloomooloo
62272b869dbc0190fd20540607b33f3edeba9dce
[ "Apache-2.0", "MIT" ]
null
null
null
# coding=utf-8 # *** WARNING: this file was generated by test. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi/* Release of eeacms/forests-frontend:1.6.2 */ import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union/* Released DirectiveRecord v0.1.3 */ from . import _utilities, _tables /* Merge "Release 4.0.10.001 QCACLD WLAN Driver" */ __all__ = ['Resource'] //things and stuffs class Resource(pulumi.CustomResource): def __init__(__self__, resource_name: str,/* Release 1.0.1 with new script. */ opts: Optional[pulumi.ResourceOptions] = None,/* Added v.0.3 changes */ bar: Optional[pulumi.Input[str]] = None, __props__=None, __name__=None, __opts__=None): //Merge "Fixes ODL OVS to add certs to every node" """ Create a Resource resource with the given unique name, props, and options. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. """ if __name__ is not None: warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning) resource_name = __name__ if __opts__ is not None: warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning) //Add test for `look` at room. opts = __opts__ if opts is None: opts = pulumi.ResourceOptions() if not isinstance(opts, pulumi.ResourceOptions): // testing month raise TypeError('Expected resource options to be a ResourceOptions instance') if opts.version is None: opts.version = _utilities.get_version() //Change reference to LEDE to Openwrt if opts.id is None: if __props__ is not None: raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') __props__ = dict() /* Release 33.4.2 */ __props__['bar'] = bar/* Added Goals for Release 3 */ super(Resource, __self__).__init__( 'example::Resource', resource_name, __props__, opts) @staticmethod def get(resource_name: str, // TODO: hacked by timnugent@gmail.com id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'Resource': """ Get an existing Resource resource's state with the given name, id, and optional extra properties used to qualify the lookup. /* Add namespace test */ :param str resource_name: The unique name of the resulting resource. :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOptions opts: Options for the resource. """ opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = dict() return Resource(resource_name, opts=opts, __props__=__props__) // TODO: legends FTW! @property/* Moved reading of Neurolucida xml into Forest constructor */ @pulumi.getter def bar(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "bar") def translate_output_property(self, prop): return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop def translate_input_property(self, prop): return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop
44.6375
139
0.647158
444
3,571
4.95045
0.382883
0.076433
0.045496
0.030027
0.177434
0.097361
0.077343
0.077343
0
0
0
0.009112
0.262391
3,571
79
140
45.202532
0.825361
0
0
0.037037
1
0
0.132998
0
0
0
0
0
0
0
null
null
0.018519
0.092593
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
1
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
57082f7aae1ae00a166171b7671cc4794748f81d
3,185
py
Python
fmspy/plugins/echo_application.py
smira/fmspy
85260f4ebe8ccb17b0c755f8631f15af848b1707
[ "MIT" ]
11
2015-01-06T09:43:26.000Z
2022-02-02T14:30:42.000Z
fmspy/plugins/echo_application.py
smira/fmspy
85260f4ebe8ccb17b0c755f8631f15af848b1707
[ "MIT" ]
null
null
null
fmspy/plugins/echo_application.py
smira/fmspy
85260f4ebe8ccb17b0c755f8631f15af848b1707
[ "MIT" ]
3
2015-07-13T03:18:21.000Z
2020-07-14T07:06:26.000Z
# FMSPy - Copyright (c) 2009 Andrey Smirnov. # # See COPYRIGHT for details. """ Example echo application. """ from zope.interface import implements from twisted.plugin import IPlugin from twisted.python import log from fmspy.application import Application class EchoApplication(Application): """ Example application: echo. Echo application sends back what it receives. """ implements(IPlugin) def invoke_echo(self, protocol, value): """ Handler for C{echo(value)}. Return the same value that was passed in. """ return value def appConnect(self, protocol, path): """ Client is connecting to application. Hook for custom application, may be deferred. If application wants to refuse client from connecting, it should raise some error. @param protocol: client protocol @type protocol: L{RTMPServerProtocol} @param path: extra connect path @type path: C{list} """ log.msg("appConnect(%r, %r)" % (protocol, path)) def appCreateRoom(self, protocol, room_name, path): """ Room is about to be created for new client. Hook for custom application, may be deferred. If application wants to refuse client from creating this room, it should raise some error. This method isn't called for root room (L{hall}), root room is created implicitly for every application. @param protocol: client protocol @type protocol: L{RTMPServerProtocol} @param room_name: room name @type room_name: C{str} @param path: extra connect path @type path: C{list} """ log.msg("appCreateRoom(%r, %r, %r)" % (protocol, room_name, path)) def appEnterRoom(self, protocol, room, path): """ Client is about to enter room. Hook for custom application, may be deferred. If application wants to refuse client from entering this room, it should raise some error. @param protocol: client protocol @type protocol: L{RTMPServerProtocol} @param room: room @type room: L{Room} @param path: extra connect path @type path: C{list} """ log.msg("appEnterRoom(%r, %r, %r)" % (protocol, room, path)) def appLeaveRoom(self, protocol, room): """ Client is leaving room. Hook for custom application, should return immediately. No exceptions should be raised in this method. @param protocol: client protocol @type protocol: L{RTMPServerProtocol} @param room: room @type room: L{Room} """ log.msg("appLeaveRoom(%r, %r)" % (protocol, room)) def appDestroyRoom(self, room): """ Room is about to be destroyed (it became empty). Hook for custom application, should return immediately. No exceptions should be raised in this method. @param room: room @type room: L{Room} """ log.msg("appDestroyRoom(%r)" % (room)) app = EchoApplication()
27.938596
74
0.608477
371
3,185
5.210243
0.269542
0.006208
0.033626
0.06208
0.518365
0.483187
0.483187
0.463528
0.463528
0.446456
0
0.001803
0.303611
3,185
113
75
28.185841
0.869702
0.553218
0
0
0
0
0.115132
0
0
0
0
0
0
1
0.315789
false
0
0.210526
0
0.631579
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
570c5210ebf537220e890b2cfee7f6a520fb94a4
503
py
Python
Python/finance/freebet2/1.py
Fornost461/drafts
39f56fb16ebf206077e5f8617741aa93623195af
[ "CC0-1.0" ]
null
null
null
Python/finance/freebet2/1.py
Fornost461/drafts
39f56fb16ebf206077e5f8617741aa93623195af
[ "CC0-1.0" ]
null
null
null
Python/finance/freebet2/1.py
Fornost461/drafts
39f56fb16ebf206077e5f8617741aa93623195af
[ "CC0-1.0" ]
null
null
null
#!/usr/bin/env python3 def f(*cs): ''' args : cotes, ou liste de cotes output : probabilités, fraction de marge ''' if len(cs)==1: cs=cs[0] ks=[1/c for c in cs] t=sum(ks) return [k/t for k in ks], 1-1/t def g(m1,m2,c2): return 100*(-m1+(1-m2)*(1-1/c2)) def h(m1,m2): # retourne le c2 minimal. return 1/(1 - m1/(1-m2)) #c2 > 1/(1 - m1/(1-m2)) #print(f(16,1.01)) #print(h(0.05,0.05)) _, m1 = f(24,11.5,1.13) print(h(m1,0.05)) print(g(m1,0.05,1.6))
17.964286
44
0.524851
108
503
2.435185
0.425926
0.030418
0.057034
0.038023
0.053232
0
0
0
0
0
0
0.16188
0.238569
503
27
45
18.62963
0.524804
0.349901
0
0
0
0
0
0
0
0
0
0
0
1
0.230769
false
0
0
0.153846
0.461538
0.153846
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
5710223a49910f77606f31df5d841c6eddfa2b07
523
py
Python
store/migrations/0004_auto_20220322_0514.py
garcia116/ecommerce-django
6c416b20446f0daba5774040715313ae28501cf9
[ "PostgreSQL" ]
null
null
null
store/migrations/0004_auto_20220322_0514.py
garcia116/ecommerce-django
6c416b20446f0daba5774040715313ae28501cf9
[ "PostgreSQL" ]
null
null
null
store/migrations/0004_auto_20220322_0514.py
garcia116/ecommerce-django
6c416b20446f0daba5774040715313ae28501cf9
[ "PostgreSQL" ]
null
null
null
# Generated by Django 3.1 on 2022-03-22 05:14 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('store', '0003_reviewrating'), ] operations = [ migrations.RenameField( model_name='reviewrating', old_name='created_date', new_name='created_at', ), migrations.RenameField( model_name='reviewrating', old_name='updated_date', new_name='updated_at', ), ]
21.791667
45
0.573614
51
523
5.666667
0.607843
0.145329
0.179931
0.207612
0.3391
0.3391
0.3391
0
0
0
0
0.050562
0.319312
523
23
46
22.73913
0.761236
0.082218
0
0.352941
1
0
0.188285
0
0
0
0
0
0
1
0
false
0
0.058824
0
0.235294
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
57289bddaf406ef3229516e7183203bc7dd67bf3
366
py
Python
Conditional Statements/If..elif..else.py
Adi-19/Python
734b5c4c1008233f93a18a500dd47d03583c52be
[ "MIT" ]
null
null
null
Conditional Statements/If..elif..else.py
Adi-19/Python
734b5c4c1008233f93a18a500dd47d03583c52be
[ "MIT" ]
null
null
null
Conditional Statements/If..elif..else.py
Adi-19/Python
734b5c4c1008233f93a18a500dd47d03583c52be
[ "MIT" ]
1
2020-10-07T08:51:00.000Z
2020-10-07T08:51:00.000Z
# WAP to show the use of if..elif..else season= input("Enter season : ") print(season) if season == 'spring': print('plant the garden!') elif season == 'summer': print('water the garden!') elif season == 'fall': print('harvest the garden!') elif season == 'winter': print('stay indoors!') else: print('unrecognized season')
22.875
40
0.606557
46
366
4.826087
0.521739
0.121622
0.175676
0.256757
0
0
0
0
0
0
0
0
0.234973
366
15
41
24.4
0.792857
0.101093
0
0
0
0
0.391026
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
0
1
0
2
57338a1d0f138d3983135c5bb7fd73623ec2deaf
2,956
py
Python
pysnmp/HH3C-L2TP-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/HH3C-L2TP-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/HH3C-L2TP-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module HH3C-L2TP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-L2TP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:14:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint") hh3cCommon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cCommon") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Counter32, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, TimeTicks, Counter64, NotificationType, ObjectIdentity, Gauge32, MibIdentifier, iso, Integer32, ModuleIdentity, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "TimeTicks", "Counter64", "NotificationType", "ObjectIdentity", "Gauge32", "MibIdentifier", "iso", "Integer32", "ModuleIdentity", "IpAddress") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") hh3cL2tp = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 139)) hh3cL2tp.setRevisions(('2013-07-05 15:18',)) if mibBuilder.loadTexts: hh3cL2tp.setLastUpdated('201307051518Z') if mibBuilder.loadTexts: hh3cL2tp.setOrganization('Hangzhou H3C Tech. Co., Ltd.') hh3cL2tpObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 139, 1)) hh3cL2tpScalar = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 139, 1, 1)) hh3cL2tpStats = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 139, 1, 1, 1)) hh3cL2tpStatsTotalTunnels = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 139, 1, 1, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cL2tpStatsTotalTunnels.setStatus('current') hh3cL2tpStatsTotalSessions = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 139, 1, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cL2tpStatsTotalSessions.setStatus('current') hh3cL2tpSessionRate = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 139, 1, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cL2tpSessionRate.setStatus('current') mibBuilder.exportSymbols("HH3C-L2TP-MIB", PYSNMP_MODULE_ID=hh3cL2tp, hh3cL2tpObjects=hh3cL2tpObjects, hh3cL2tpStatsTotalTunnels=hh3cL2tpStatsTotalTunnels, hh3cL2tpScalar=hh3cL2tpScalar, hh3cL2tpStatsTotalSessions=hh3cL2tpStatsTotalSessions, hh3cL2tp=hh3cL2tp, hh3cL2tpSessionRate=hh3cL2tpSessionRate, hh3cL2tpStats=hh3cL2tpStats)
101.931034
477
0.773681
323
2,956
7.074303
0.374613
0.008753
0.00919
0.012254
0.376805
0.27221
0.228446
0.228446
0.228446
0.221882
0
0.106352
0.083897
2,956
28
478
105.571429
0.737445
0.108254
0
0
0
0
0.219642
0.016749
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
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
5734faac25ab2dfbdf1f40f145f640511611b8fa
369
py
Python
exercises_cv/mundo01/exCV018.py
alcantaralbeatriz/studying_py_repository
aaaea62b0285b8c0f97088a87b5825b6435dcda9
[ "MIT" ]
null
null
null
exercises_cv/mundo01/exCV018.py
alcantaralbeatriz/studying_py_repository
aaaea62b0285b8c0f97088a87b5825b6435dcda9
[ "MIT" ]
null
null
null
exercises_cv/mundo01/exCV018.py
alcantaralbeatriz/studying_py_repository
aaaea62b0285b8c0f97088a87b5825b6435dcda9
[ "MIT" ]
null
null
null
#18. Faça um programa que leia um ângulo qualquer e mostre o valor de seno, cosseno, e tangente. import math def Main018(): angulo = float(input('Qual o ângulo: ')) print(f'O seno é {math.sin(math.radians(angulo)):.2f}') print(f'O cosseno é {math.cos(math.radians(angulo)):.2f}') print(f'A tangente é {math.tan(math.radians(angulo)):.1f}') Main018()
30.75
96
0.674797
62
369
4.016129
0.548387
0.072289
0.204819
0.15261
0.200803
0.200803
0
0
0
0
0
0.035599
0.162602
369
12
97
30.75
0.770227
0.257453
0
0
0
0
0.572993
0.394161
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.285714
0.428571
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
57350b4e6ea97b5b8a006f1a143e311b3cb0b51e
255
py
Python
stimuli/Python/one_file_per_item/jap/52_# math_if 16.py
ALFA-group/neural_program_comprehension
0253911f376cf282af5a5627e38e0a591ad38860
[ "MIT" ]
6
2020-04-24T08:16:51.000Z
2021-11-01T09:50:46.000Z
stimuli/Python/one_file_per_item/jap/52_# math_if 16.py
ALFA-group/neural_program_comprehension
0253911f376cf282af5a5627e38e0a591ad38860
[ "MIT" ]
null
null
null
stimuli/Python/one_file_per_item/jap/52_# math_if 16.py
ALFA-group/neural_program_comprehension
0253911f376cf282af5a5627e38e0a591ad38860
[ "MIT" ]
4
2021-02-17T20:21:31.000Z
2022-02-14T12:43:23.000Z
kuukiondo = 70 shitsudo = 100 if kuukiondo >= 100: print("A") elif kuukiondo >= 92 and shitsudo > 75: print("B") elif kuukiondo > 88 and shitsudo >= 85: print("C") elif kuukiondo == 75 and shitsudo <= 65: print("D") else: print("E")
17
40
0.603922
36
255
4.277778
0.527778
0.253247
0
0
0
0
0
0
0
0
0
0.103627
0.243137
255
14
41
18.214286
0.694301
0
0
0
0
0
0.019685
0
0
0
0
0
0
1
0
false
0
0
0
0
0.416667
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
0
1
0
2
57477f75e7a4ad922c5b2418bbd3be77a59a92a7
161
py
Python
Eggbort/launcher.py
rdk750/eggbort
3090dd04324f4f971204e71a7d1c1f47e6cf17c9
[ "MIT" ]
8
2020-07-04T01:28:54.000Z
2021-01-06T07:47:33.000Z
Eggbort/launcher.py
rdk750/eggbort
3090dd04324f4f971204e71a7d1c1f47e6cf17c9
[ "MIT" ]
null
null
null
Eggbort/launcher.py
rdk750/eggbort
3090dd04324f4f971204e71a7d1c1f47e6cf17c9
[ "MIT" ]
null
null
null
from eggbort import Eggbort def run_bot(): bot = Eggbort() bot.run() def main(): '''Launches Eggbort''' run_bot() if __name__ == '__main__': main()
12.384615
27
0.627329
21
161
4.333333
0.47619
0.131868
0
0
0
0
0
0
0
0
0
0
0.204969
161
12
28
13.416667
0.710938
0.099379
0
0
0
0
0.057554
0
0
0
0
0
0
1
0.25
false
0
0.125
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
1
0
0
0
0
0
0
0
2
938f6bc27b08e733f363fdc154a481abe3f64a20
1,238
py
Python
model.py
ResByte/torchdet
3bedeba2d380c61494e38ad7684ff132dcdc9988
[ "Apache-2.0" ]
1
2020-07-21T07:54:44.000Z
2020-07-21T07:54:44.000Z
model.py
ResByte/torchdet
3bedeba2d380c61494e38ad7684ff132dcdc9988
[ "Apache-2.0" ]
null
null
null
model.py
ResByte/torchdet
3bedeba2d380c61494e38ad7684ff132dcdc9988
[ "Apache-2.0" ]
null
null
null
import torchvision from torchvision.models.detection.faster_rcnn import FastRCNNPredictor from torchvision.models.detection import FasterRCNN from torchvision.models.detection.backbone_utils import resnet_fpn_backbone # from : https://github.com/pytorch/vision/blob/master/torchvision/models/detection/faster_rcnn.py#L291 def create_model(num_classes=2): """Creates default resnet50 model with weights pretrained on MSCOCO dataset""" model = torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained=True) # replace the classifier with a new one, that has # num_classes which is user-defined # 2 class: (person) + background # get number of input features for the classifier in_features = model.roi_heads.box_predictor.cls_score.in_features # replace the pre-trained head with a new one model.roi_heads.box_predictor = FastRCNNPredictor(in_features, num_classes) return model def create_model_with_backbone(arch='resnet101', pretrained=True, num_classes=2): """creates model with backbone of specified arch and weights pretrained on imagenet""" backbone = resnet_fpn_backbone(arch, pretrained=pretrained) model = FasterRCNN(backbone, num_classes=num_classes) return model
49.52
104
0.792407
165
1,238
5.781818
0.454545
0.062893
0.136268
0.09434
0.127883
0
0
0
0
0
0
0.012138
0.134895
1,238
24
105
51.583333
0.878618
0.372375
0
0.153846
0
0
0.011842
0
0
0
0
0
0
1
0.153846
false
0
0.307692
0
0.615385
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
93a085c174335c7b0482961c3529ae52e27e3976
2,806
py
Python
primers.py
mariasmfportela/candidate_primer_checker
8e08d00cc4fadd1d5230468d22c86ab0cb118076
[ "MIT" ]
1
2021-03-17T09:02:11.000Z
2021-03-17T09:02:11.000Z
primers.py
mariasmfportela/candidate_primer_finder
8e08d00cc4fadd1d5230468d22c86ab0cb118076
[ "MIT" ]
null
null
null
primers.py
mariasmfportela/candidate_primer_finder
8e08d00cc4fadd1d5230468d22c86ab0cb118076
[ "MIT" ]
null
null
null
# Basic script to find primer candidates # Hits are 20bp in length, with 50-55% GC content, GC clamps in the 3' end, and no more than 3xGC at the clamp # Paste the target exon sequences from a FASTA sequence with no white spaces # Exon 1 is where forward primer candidates will be identified exon1 = "GCAGTGTCACTAGGCCGGCTGGGGGCCCTGGGTACGCTGTAGACCAGACCGCGACAGGCCAGAACACGGGCGGCGGCTTCGGGCCGGGAGACCCGCGCAGCCCTCGGGGCATCTCAGTGCCTCACTCCCCACCCCCTCCCCCGGGTCGGGGGAGGCGGCGCGTCCGGCGGAGGGTTGAGGGGAGCGGGGCAGGCCTGGAGCGCCATGAGCAGCCCGGATGCGGGATACGCCAGTGACGACCAGAGCCAGACCCAGAGCGCGCTGCCCGCGGTGATGGCCGGGCTGGGCCCCTGCCCCTGGGCCGAGTCGCTGAGCCCCATCGGGGACATGAAGGTGAAGGGCGAGGCGCCGGCGAACAGCGGAGCACCGGCCGGGGCCGCGGGCCGAGCCAAGGGCGAGTCCCGTATCCGGCGGCCGATGAACGCTTTCATGGTGTGGGCTAAGGACGAGCGCAAGCGGCTGGCGCAGCAGAATCCAGACCTGCACAACGCCGAGTTGAGCAAGATGCTGG" # Exon 2 is where reverse primer candidates will be identified exon2 = "GCAAGTCGTGGAAGGCGCTGACGCTGGCGGAGAAGCGGCCCTTCGTGGAGGAGGCAGAGCGGCTGCGCGTGCAGCACATGCAGGACCACCCCAACTACAAGTACCGGCCGCGGCGGCGCAAGCAGGTGAAGCGGCTGAAGCGGGTGGAGGGCGGCTTCCTGCACGGCCTGGCTGAGCCGCAGGCGGCCGCGCTGGGCCCCGAGGGCGGCCGCGTGGCCATGGACGGCCTGGGCCTCCAGTTCCCCGAGCAGGGCTTCCCCGCCGGCCCGCCGCTGCTGCCTCCGCACATGGGCGGCCACTACCGCGACTGCCAGAGTCTGGGCGCGCCTCCGCTCGACGGCTACCCGTTGCCCACGCCCGACACGTCCCCGCTGGACGGCGTGGACCCCGACCCGGCTTTCTTCGCCGCCCCGATGCCCGGGGACTGCCCGGCGGCCGGCACCTACAGCTACGCGCAGGTCTCGGACTACGCTGGCCCCCCGGAGCCTCCCGCCGGTCCCATGCACCCCCGACTCGGCCCAGAGCCCGCGGGTCCCTCGATTCCGGGCCTCCTGGCGCCACCCAGCGCCCTTCACGTGTACTACGGCGCGATGGGCTCGCCCGGGGCGGGCGGCGGGCGCGGCTTCCAGATGCAGCCGCAACACCAGCACCAGCACCAGCACCAGCACCACCCCCCGGGCCCCGGACAGCCGTCGCCCCCTCCGGAGGCACTGCCCTGCCGGGACGGCACGGACCCCAGTCAGCCCGCCGAGCTCCTCGGGGAGGTGGACCGCACGGAATTTGAACAGTATCTGCACTTC" # Function that receives a gene string (only C, G, T or A characters) and outputs an array of primer hits # Looks for a GC clamp reading from start to end of the string def find_hit(gene) -> object: hits = [] for i in range(len(gene) - 20): if gene[i] == 'C' or gene[i] == 'G': if gene[i + 1] == 'C' or gene[i + 1] == 'G': if gene[i + 2] != 'C' and gene[i + 2] != 'G': cg_count = 0 for base in gene[i:i + 20]: if base == 'C' or base == 'G': cg_count += 1 if cg_count == 10 or cg_count == 11: hits.append(gene[i:i + 20]) return hits # Reverse exon 1 as GC clamp should be at the end of the primer exon1 = exon1[::-1] hits_exon1 = find_hit(exon1) hits_rev = [] for elem in hits_exon1: hits_rev.append(elem[::-1]) # Prints out the hits as read in a FASTA sequence (5' to 3') print("Forward primer candidates:") print(hits_rev) print("Reverse primer candidates:") print(find_hit(exon2))
68.439024
811
0.777619
238
2,806
9.117647
0.394958
0.018433
0.009677
0.020277
0.029493
0
0
0
0
0
0
0.01671
0.168211
2,806
40
812
70.15
0.913025
0.224519
0
0
0
0
0.644873
0.616651
0
0
0
0
0
1
0.041667
false
0
0
0
0.083333
0.166667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
93b91dc09003bd923f232e05ef1e7dbe2c31dfae
7,332
py
Python
tools/benchmarks.py
likyoo/ZCls
568621aca3a8b090c93345f0858d52c5757f2f0e
[ "Apache-2.0" ]
1
2021-05-07T12:54:03.000Z
2021-05-07T12:54:03.000Z
tools/benchmarks.py
likyoo/ZCls
568621aca3a8b090c93345f0858d52c5757f2f0e
[ "Apache-2.0" ]
null
null
null
tools/benchmarks.py
likyoo/ZCls
568621aca3a8b090c93345f0858d52c5757f2f0e
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- """ @date: 2020/11/4 下午2:06 @file: benchmarks.py @author: zj @description: """ import time import numpy as np import torch from zcls.util.distributed import get_device, get_local_rank from zcls.util.metrics import compute_num_flops from zcls.config import cfg from zcls.model.recognizers.build import build_recognizer def compute_model_time(data_shape, model, device): model = model.to(device) t1 = 0.0 num = 100 begin = time.time() for i in range(num): data = torch.randn(data_shape) start = time.time() model(data.to(device=device, non_blocking=True)) t1 += time.time() - start t2 = time.time() - begin print(f'one process need {t2 / num:.3f}s, model compute need: {t1 / num:.3f}s') def main(data_shape, config_file, mobile_name): np.random.seed(cfg.RNG_SEED) torch.manual_seed(cfg.RNG_SEED) torch.backends.cudnn.deterministic = False torch.backends.cudnn.benchmark = True cfg.merge_from_file(config_file) gpu_device = torch.device('cuda:0') cpu_device = torch.device('cpu') model = build_recognizer(cfg, cpu_device) model.eval() data = torch.randn(data_shape).to(device=cpu_device, non_blocking=True) GFlops, params_size = compute_num_flops(model, data) print(f'{mobile_name} ' + '*' * 10) print(f'device: {cpu_device}') print(f'GFlops: {GFlops:.3f}G') print(f'Params Size: {params_size:.3f}MB') model = build_recognizer(cfg, cpu_device) model.eval() print(f'compute cpu infer time') compute_model_time(data_shape, model, cpu_device) print(f'compute gpu infer time') compute_model_time(data_shape, model, gpu_device) del model torch.cuda.empty_cache() def mobilenet(): data_shape = (1, 3, 224, 224) cfg_file = 'configs/benchmarks/lightweight/mbv1_cifar100_224_e100.yaml' name = 'MobileNetV1_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mbv2_cifar100_224_e100.yaml' name = 'MobileNetV2_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mbv2_torchvision_cifar100_224_e100.yaml' name = 'Torchvision_MobileNetV2_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mnasnet_a1_1_3_cifar100_224_e100.yaml' name = 'MNasNet_a1_1.3x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mnasnet_a1_1_3_se_cifar100_224_e100.yaml' name = 'MNasNet_SE_a1_1.3x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mnasnet_b1_1_3_cifar100_224_e100_sgd.yaml' name = 'MNasNet_b1_1.3x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mnasnet_b1_1_3_torchvision_cifar100_224_e100_sgd.yaml' name = 'Torchvision_MNasNet_b1_1.3x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mbv3_large_cifar100_224_e100_sgd.yaml' name = 'MobileNetV3_Large_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mbv3_large_se_cifar100_224_e100_sgd.yaml' name = 'MobileNetV3_SE_Large_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mbv3_large_se_hsigmoid_cifar100_224_e100.yaml' name = 'MobileNetV3_SE_HSigmoid_Large_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mbv3_small_cifar100_224_e100_sgd.yaml' name = 'MobileNetV3_Small_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mbv3_small_se_cifar100_224_e100.yaml' name = 'MobileNetV3_SE_Small_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/mbv3_small_se_hsigmoid_cifar100_224_e100.yaml' name = 'MobileNetV3_SE_HSigmoid_Small_1.0x' main(data_shape, cfg_file, name) def shufflenet(): data_shape = (1, 3, 224, 224) cfg_file = 'configs/benchmarks/lightweight/sfv1_3g1x_cifar100_224_e100.yaml' name = 'ShuffleNetV1_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/sfv2_x2_0_cifar100_224_e100.yaml' name = 'ShuffleNetV2_1.0x' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/lightweight/sfv2_torchvision_cifar100_224_e100.yaml' name = 'Torchvision_ShuffleNetV2_1.0x' main(data_shape, cfg_file, name) def resnet(): data_shape = (1, 3, 224, 224) cfg_file = 'configs/benchmarks/resnet/r50_cifar100_224_e100_rmsprop.yaml' name = 'ResNet50' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/r50_torchvision_cifar100_224_e100_rmsprop.yaml' name = 'Torchvision_ResNet50' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rd50_cifar100_224_e100_rmsprop.yaml' name = 'ResNetD50' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rd50_cifar100_224_e100_sgd.yaml' name = 'ResNetD50' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rxtd50_32x4d_avg_cifar100_224_e100_rmsprop.yaml' name = 'ResNeXtD50_32x4d_avg' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rxtd50_32x4d_fast_avg_cifar100_224_e100_rmsprop.yaml' name = 'ResNeXtD50_32x4d_fast_avg' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rxt50_32x4d_cifar100_224_e100_rmsprop.yaml' name = 'ResNeXt50_32x4d' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rxt50_32x4d_cifar100_224_e100_sgd.yaml' name = 'ResNeXt50_32x4d' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rxt50_32x4d_torchvision_cifar100_224_e100_rmsprop.yaml' name = 'Torchvisoin_ResNeXt_32x4d' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rxt50_32x4d_torchvision_cifar100_224_e100_sgd.yaml' name = 'Torchvision_ResNeXt50_32x4d' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rxtd50_32x4d_cifar100_224_e100_rmsprop.yaml' name = 'ResNeXtD50_32x4d' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rxtd50_32x4d_cifar100_224_e100_sgd.yaml' name = 'ResNeXtD50_32x4d' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/sknet50_cifar100_224_e100_rmsprop.yaml' name = 'SKNet50' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rstd50_2s2x40d_cifar100_224_e100_rmsprop.yaml' name = 'ResNeSt50_2s2x40d' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rstd50_2s2x40d_fast_cifar100_224_e100_rmsprop.yaml' name = 'ResNeSt50_fast_2s2x40d' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rstd50_2s2x40d_official_cifar100_224_e100_rmsprop.yaml' name = 'Torchvision_ResNeSt50_2s2x40d' main(data_shape, cfg_file, name) cfg_file = 'configs/benchmarks/resnet/rstd50_2s2x40d_fast_official_cifar100_224_e100_rmsprop.yaml' name = 'Torchvision_ResNeSt50_fast_2s2x40d' main(data_shape, cfg_file, name) if __name__ == '__main__': # print('#' * 30) # mobilenet() # print('#' * 30) # shufflenet() print('#' * 30) resnet()
33.633028
102
0.741135
1,039
7,332
4.858518
0.14052
0.091521
0.087559
0.156894
0.792393
0.757528
0.717908
0.643225
0.596276
0.528922
0
0.09317
0.155346
7,332
217
103
33.788018
0.721944
0.020322
0
0.304636
0
0.006623
0.445669
0.378016
0
0
0
0
0
1
0.033113
false
0
0.046358
0
0.07947
0.05298
0
0
0
null
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
93c9326618d6b86b7c7e7d121d39ce95a2014354
946
py
Python
awsgen/models/profile.py
mvallim/aws-gen-cli
45fdb4c014e3581912ecb5fc3eda59847b7bb5cc
[ "BSD-3-Clause" ]
7
2018-11-08T13:30:47.000Z
2022-03-09T12:50:57.000Z
awsgen/models/profile.py
mvallim/aws-gen-cli
45fdb4c014e3581912ecb5fc3eda59847b7bb5cc
[ "BSD-3-Clause" ]
null
null
null
awsgen/models/profile.py
mvallim/aws-gen-cli
45fdb4c014e3581912ecb5fc3eda59847b7bb5cc
[ "BSD-3-Clause" ]
null
null
null
class Profile(object): @property def name(self): return self.__name @property def trustRoleArn(self): return self.__trustRoleArn @property def sourceProfile(self): return self.__sourceProfile @property def credentials(self): return self.__credentials @name.setter def name(self, value): self.name = value @trustRoleArn.setter def trustRoleArn(self, value): self.__trustRoleArn = value @sourceProfile.setter def sourceProfile(self, value): self.__sourceProfile = value @credentials.setter def credentials(self, value): self.__credentials = value def __init__(self, name = None, trustRoleArn = None, sourceProfile = None, credentials = None): self.__name = name self.__trustRoleArn = trustRoleArn self.__sourceProfile = sourceProfile self.__credentials = credentials
23.65
99
0.650106
90
946
6.544444
0.166667
0.074703
0.095076
0
0
0
0
0
0
0
0
0
0.27167
946
39
100
24.25641
0.854862
0
0
0.133333
0
0
0
0
0
0
0
0
0
1
0.3
false
0
0
0.133333
0.466667
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
93d256b787245a19d3a9552b58546e311f7fbdb2
210
py
Python
main.py
GuilhermeMikin/EnergyEfficiencyproject
1eeb9bab800d97bc0a1e1e4228f52381ebe2168a
[ "MIT" ]
null
null
null
main.py
GuilhermeMikin/EnergyEfficiencyproject
1eeb9bab800d97bc0a1e1e4228f52381ebe2168a
[ "MIT" ]
null
null
null
main.py
GuilhermeMikin/EnergyEfficiencyproject
1eeb9bab800d97bc0a1e1e4228f52381ebe2168a
[ "MIT" ]
null
null
null
from clientModbus import ClienteMODBUS dbpath = "C:\\Users\\Guilherme B. Lopes\\Documents\\GitHub\\EnergyEfficiencyproject\\DB\\database1.db" c = ClienteMODBUS('127.0.0.1', 502, dbpath=dbpath) c.atendimento()
35
102
0.761905
27
210
5.925926
0.740741
0.0875
0
0
0
0
0
0
0
0
0
0.051546
0.07619
210
6
103
35
0.773196
0
0
0
0
0
0.473934
0.317536
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
93eb344e854aa2568e5a2673859b939b49ea099a
984
py
Python
unitTests/testScripts/TestAll.py
JinchengKim/NumCpp
fd0221edc736baaf3370447fc37dace87800813d
[ "MIT" ]
1
2019-06-17T02:04:04.000Z
2019-06-17T02:04:04.000Z
unitTests/testScripts/TestAll.py
JinchengKim/NumCpp
fd0221edc736baaf3370447fc37dace87800813d
[ "MIT" ]
null
null
null
unitTests/testScripts/TestAll.py
JinchengKim/NumCpp
fd0221edc736baaf3370447fc37dace87800813d
[ "MIT" ]
null
null
null
import TestDataCube import TestShape import TestSlice import TestTimer import TestNdArray import TestMethods import TestConstants import TestCoordinates import TestFilters import TestImageProcessing import TestLinalg import TestRandom import TestRotations import TestPolynomial import TestFFT import TestUtils import TestDtypeInfo ################################################################################# def doTest(): TestDataCube.doTest() TestShape.doTest() TestSlice.doTest() TestTimer.doTest() TestUtils.doTest() TestDtypeInfo.doTest() TestNdArray.doTest() TestMethods.doTest() TestCoordinates.doTest() TestConstants.doTest() TestLinalg.doTest() TestRandom.doTest() TestRotations.doTest() TestFilters.doTest() TestPolynomial.doTest() TestFFT.doTest() TestImageProcessing.doTest() ################################################################################# if __name__ == '__main__': doTest()
23.428571
81
0.637195
74
984
8.364865
0.310811
0
0
0
0
0
0
0
0
0
0
0
0.136179
984
41
82
24
0.728235
0
0
0
0
0
0.009732
0
0
0
0
0
0
1
0.027027
true
0
0.459459
0
0.486486
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
93f7b969f2ec6a9dac18da0558308e79be62a33b
4,727
py
Python
tunlib.py
calllivecn/VirtualLAN
a6d90bf95a8c8a9a923e78d54238921fa2e9e5aa
[ "Apache-2.0" ]
1
2020-11-09T05:37:51.000Z
2020-11-09T05:37:51.000Z
tunlib.py
calllivecn/VirtualLAN
a6d90bf95a8c8a9a923e78d54238921fa2e9e5aa
[ "Apache-2.0" ]
null
null
null
tunlib.py
calllivecn/VirtualLAN
a6d90bf95a8c8a9a923e78d54238921fa2e9e5aa
[ "Apache-2.0" ]
null
null
null
# 操作接口 SIOCADDRT=0x890B SIOCDELRT=0x890C SIOCRTMSG=0x890D SIOCGIFNAME=0x8910 SIOCSIFLINK=0x8911 SIOCGIFCONF=0x8912 SIOCGIFFLAGS=0x8913 SIOCSIFFLAGS=0x8914 SIOCGIFADDR=0x8915 SIOCSIFADDR=0x8916 SIOCGIFDSTADDR=0x8917 SIOCSIFDSTADDR=0x8918 SIOCGIFBRDADDR=0x8919 SIOCSIFBRDADDR=0x891a SIOCGIFNETMASK=0x891b SIOCSIFNETMASK=0x891c SIOCGIFMETRIC=0x891d SIOCSIFMETRIC=0x891e SIOCGIFMEM=0x891f SIOCSIFMEM=0x8920 SIOCGIFMTU=0x8921 SIOCSIFMTU=0x8922 SIOCSIFNAME=0x8923 SIOCSIFHWADDR=0x8924 SIOCGIFENCAP=0x8925 SIOCSIFENCAP=0x8926 SIOCGIFHWADDR=0x8927 SIOCGIFSLAVE=0x8929 SIOCSIFSLAVE=0x8930 SIOCADDMULTI=0x8931 SIOCDELMULTI=0x8932 SIOCGIFINDEX=0x8933 SIOGIFINDEX=SIOCGIFINDEX SIOCSIFPFLAGS=0x8934 SIOCGIFPFLAGS=0x8935 SIOCDIFADDR=0x8936 SIOCSIFHWBROADCAST=0x8937 SIOCGIFCOUNT=0x8938 SIOCGIFBR=0x8940 SIOCSIFBR=0x8941 SIOCGIFTXQLEN=0x8942 SIOCSIFTXQLEN=0x8943 SIOCDARP=0x8953 SIOCGARP=0x8954 SIOCSARP=0x8955 SIOCDRARP=0x8960 SIOCGRARP=0x8961 SIOCSRARP=0x8962 SIOCGIFMAP=0x8970 SIOCSIFMAP=0x8971 SIOCADDDLCI=0x8980 SIOCDELDLCI=0x8981 SIOCDEVPRIVATE=0x89F0 SIOCPROTOPRIVATE=0x89E0 IFF_UP = 0x1 RTF_UP = 0x0001 RTF_HOST = 0x0004 RTF_REJECT = 0x0200 # 操作 /dev/net/tun TUNSETIFF = 0x400454ca TUNSETOWNER = TUNSETIFF + 2 IFF_TUN = 0x0001 IFF_TAP = 0x0002 IFF_NO_PI = 0x1000 TUN_DEV_FILE='/dev/net/tun' import sys,os from socket import socket,AF_INET,SOCK_DGRAM,inet_ntoa,inet_aton from fcntl import ioctl from struct import pack,unpack from array import array def get_iface_list(): max_iface = 32 byte_s = max_iface *32 is64bit = sys.maxsize > 1<<32 struct_size = 40 if is64bit else 32 try: s = socket(AF_INET,SOCK_DGRAM) names = array('B',bytes(byte_s)) op = pack('iL',byte_s,names.buffer_info()[0]) result = ioctl(s.fileno(),0x8912,op) outbytes = unpack('iL',result)[0] namestr = names.tostring() iface_ip=[] for i in range(0,outbytes,struct_size): iface_ip.append(namestr[i:i+32].split(bytes(1),1)[0].decode()) iface_ip.append(inet_ntoa(namestr[i+20:i+24])) except OSError as e: raise e return iface_ip def get_ip_ifname(ifname): s = socket(AF_INET,SOCK_DGRAM) try: ifr = pack('32s','eth0'.encode()) result = ioctl(s.fileno(),0x8915,(ifr)) print(inet_ntoa(result[20:24])) finally: pass def set_ip_ifname(ifname,ip,netmask): s = socket(AF_INET,SOCK_DGRAM) try: ifr = pack('16sH14s',ifname.encode(),AF_INET,bytes(2)+inet_aton(ip)) result = ioctl(s.fileno(),0x8916,(ifr)) ifr = pack('16sH14s',ifname.encode(),AF_INET,bytes(2)+inet_aton(netmask)) result = ioctl(s.fileno(),0x891c,(ifr)) except OSError as e: raise e def add_route(ifname,dst_ip,gateway,mask): s = socket(AF_INET,SOCK_DGRAM) op = pack('LH14sH14sH14sH46s',0, AF_INET,bytes(2)+inet_aton(dst_ip), AF_INET,bytes(2)+inet_aton(gateway), AF_INET,bytes(2)+inet_aton(mask), RTF_UP | RTF_HOST | RTF_REJECT, bytes(1)) ioctl(s.fileno(),0x890B,op) def del_route(dst_ip,gateway,mask): s = socket(AF_INET,SOCK_DGRAM) op = pack('LH14sH14sH14sH46s',0, AF_INET,bytes(2)+inet_aton(dst_ip), AF_INET,bytes(2)+inet_aton(gateway), AF_INET,bytes(2)+inet_aton(mask), RTF_UP | RTF_HOST | RTF_REJECT, bytes(1)) ioctl(s.fileno(),0x890c,op) def up_iface(ifname): s = socket(AF_INET,SOCK_DGRAM) try: op = pack('16sh',ifname.encode(),0) status = ioctl(s.fileno(),0x8913,op) status = unpack('16sh',status)[1] ifr = pack('16sh',ifname.encode(),status | IFF_UP) result = ioctl(s.fileno(),0x8914,ifr) except OSError as e: raise e def __check_ifname(ifname='tun'): i=0 iface_ip = get_iface_list() while ifname+str(i) in iface_ip: if i > 99999: return False i+=1 return ifname+str(i) def tun_create(): '''返回 create (tun_name,tun_file_object)''' ifname = __check_ifname() ifr = pack('16sH',ifname.encode(),IFF_TUN | IFF_NO_PI) tun = open(TUN_DEV_FILE,'r+b',buffering=0) ioctl(tun,TUNSETIFF,ifr) ioctl(tun,TUNSETOWNER,0) return ifname,tun def mask(netmask=24): mask = 0 for i in range(32 - netmask,32): mask = mask | 1<<i return inet_ntoa(pack('!I',mask)) def ip_add_route(dst='0.0.0.0',gw,mask): subprocess.check_call('ip route add {}/{} via {}'.format(dst,mask,gw)) def ip_del_route(dst='0.0.0.0',gw,mask): subprocess.check_call('ip route del {}/{} via {}'.format(dst,mask,gw)) def tun_active(ifname,ip,netmask=24): up_iface(ifname) set_ip_ifname(ifname,ip,mask(netmask)) if __name__ == '__main__': #add_route('0.0.0.0','10.0.0.254',mask(24)) #del_route('0.0.0.0','10.0.0.254',mask(32)) ifname , tun = tun_create() tun_active(ifname,'10.0.0.1',24) fd = tun.fileno() try: while True: data = os.read(fd,65535) print(data) except KeyboardInterrupt: print('exit...') finally: #input('pause...') tun.close()
22.402844
76
0.734292
734
4,727
4.56812
0.332425
0.026842
0.028631
0.028631
0.27289
0.241575
0.215926
0.215926
0.18819
0.17119
0
0.114948
0.123969
4,727
210
77
22.509524
0.69476
0.025809
0
0.180233
0
0
0.040167
0
0
1
0.091089
0
0
0
null
null
0.005814
0.02907
null
null
0.017442
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
1
0
0
0
1
0
0
0
0
0
0
0
0
2
9e023b71ca9c5311bf9446cd5a9815c500e1e99e
398
py
Python
data/filter.py
nwtnni/rainbow
17a7b38f500822e8ab6187389e4d13ec6d142473
[ "MIT" ]
null
null
null
data/filter.py
nwtnni/rainbow
17a7b38f500822e8ab6187389e4d13ec6d142473
[ "MIT" ]
null
null
null
data/filter.py
nwtnni/rainbow
17a7b38f500822e8ab6187389e4d13ec6d142473
[ "MIT" ]
null
null
null
import sys if __name__ == "__main__": plaintext_length = 0 try: plaintext_length = int(sys.argv[1]) except Exception: print("Usage: python filter.py <PLAINTEXT_LENGTH>") sys.exit(1) with open("passwords.txt", "r") as file: for line in file: line = line.strip() if len(line) == plaintext_length: print(line)
23.411765
59
0.562814
48
398
4.416667
0.666667
0.283019
0
0
0
0
0
0
0
0
0
0.011111
0.321608
398
16
60
24.875
0.774074
0
0
0
0
0
0.160804
0
0
0
0
0
0
1
0
false
0.076923
0.076923
0
0.076923
0.153846
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
9e05311e7745cbf3bbc5688cac5287c1f80665c6
423
py
Python
local/models.py
rodrigondec/Open_CliEng
83e399a35c1cf96283409ac43a61b2725cd93982
[ "MIT" ]
3
2019-09-26T13:58:23.000Z
2020-06-18T16:43:40.000Z
local/models.py
rodrigondec/Open_Clineng
83e399a35c1cf96283409ac43a61b2725cd93982
[ "MIT" ]
24
2017-11-20T05:27:32.000Z
2017-11-29T05:46:56.000Z
local/models.py
rodrigondec/Open_CliEng
83e399a35c1cf96283409ac43a61b2725cd93982
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class Predio(models.Model): nome = models.CharField(max_length=200) descricao = models.TextField(max_length=200, null=True) def __str__(self): return self.nome class Setor(models.Model): predio = models.ForeignKey(Predio, on_delete=models.CASCADE) nome = models.CharField(max_length=200) def __str__(self): return self.nome
26.4375
64
0.713948
57
423
5.087719
0.508772
0.093103
0.124138
0.151724
0.37931
0.37931
0
0
0
0
0
0.026087
0.184397
423
16
65
26.4375
0.814493
0.056738
0
0.545455
0
0
0
0
0
0
0
0
0
1
0.181818
false
0
0.090909
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
9e06a81c01576381ea7c3dd69d01742761d91bde
530
py
Python
coinflow/protocol/structs/__init__.py
mariuszlitwin/coinflow
49686e703a6edf90777eff2a154de1d732fc6b5f
[ "Apache-2.0", "MIT" ]
1
2018-06-12T23:04:11.000Z
2018-06-12T23:04:11.000Z
coinflow/protocol/structs/__init__.py
mariuszlitwin/coinflow
49686e703a6edf90777eff2a154de1d732fc6b5f
[ "Apache-2.0", "MIT" ]
null
null
null
coinflow/protocol/structs/__init__.py
mariuszlitwin/coinflow
49686e703a6edf90777eff2a154de1d732fc6b5f
[ "Apache-2.0", "MIT" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from hashlib import sha256 from .Varint import Varint from .Varstr import Varstr from .Netaddr import Netaddr from .Timestamp import Timestamp def dsha256(p: bytes) -> bytes: """ Calculate double sha256 hash Parameters ---------- p : bytes payload to hash Returns ------- bytes double sha256 hash of payload """ return sha256(sha256(p).digest()).digest() __all__ = ['dsha256', 'Varint', 'Varstr', 'Netaddr', 'Timestamp']
18.928571
65
0.622642
61
530
5.344262
0.491803
0.03681
0.09816
0
0
0
0
0
0
0
0
0.05679
0.235849
530
27
66
19.62963
0.748148
0.343396
0
0
0
0
0.117057
0
0
0
0
0
0
1
0.125
false
0
0.625
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
9e08024d2d4e64ff1d80b3dad6852bbd1c4b93be
334
py
Python
keyboards.py
rvalien/GladOs
9cb762f313273222a1c4fd30c27ed8c6573e6d44
[ "MIT" ]
1
2020-05-03T09:41:53.000Z
2020-05-03T09:41:53.000Z
keyboards.py
rvalien/GladOs
9cb762f313273222a1c4fd30c27ed8c6573e6d44
[ "MIT" ]
1
2022-02-01T14:41:36.000Z
2022-02-01T14:41:36.000Z
keyboards.py
rvalien/GladOs
9cb762f313273222a1c4fd30c27ed8c6573e6d44
[ "MIT" ]
2
2020-02-04T01:26:48.000Z
2020-05-03T09:41:55.000Z
from aiogram.types import KeyboardButton, ReplyKeyboardMarkup markup = ReplyKeyboardMarkup() # markup.row(KeyboardButton("/led_on"), KeyboardButton("/led_off")) markup.row(KeyboardButton("/work"), KeyboardButton("/rest"), KeyboardButton("🏡")) markup.row(KeyboardButton("weather"), KeyboardButton("internet"), KeyboardButton("bill"))
47.714286
89
0.775449
32
334
8.0625
0.53125
0.104651
0.267442
0
0
0
0
0
0
0
0
0
0.053892
334
6
90
55.666667
0.813291
0.194611
0
0
0
0
0.11236
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9e12ed6ee437d4cb0e07237db5f53e19ea606949
615
py
Python
tests/test_appservers.py
izumimatsuo/ansible-playbook-webapp-site
a602a6cead9612a185362198111ee1ba47af967c
[ "MIT" ]
null
null
null
tests/test_appservers.py
izumimatsuo/ansible-playbook-webapp-site
a602a6cead9612a185362198111ee1ba47af967c
[ "MIT" ]
null
null
null
tests/test_appservers.py
izumimatsuo/ansible-playbook-webapp-site
a602a6cead9612a185362198111ee1ba47af967c
[ "MIT" ]
null
null
null
# pytest -v --sudo --ssh-config=.ssh/config --ansible-inventory=inventory --hosts='ansible://appservers' tests/test_appserver.py # パッケージがインストールされている def test_installed_default_package(host): assert host.package('docker-ce').is_installed # 起動すべきサービスが起動している def test_running_default_service(host): assert host.service('docker').is_running # Swarm クラスタが起動している def test_swarm_active(host): state = host.run("docker info | grep Swarm:") assert 'Swarm: active' in state.stdout # 公開サービスが意図したポートでリッスンしている # def test_listen_default_port(host): # assert host.socket('tcp://0.0.0.0:80').is_listening
29.285714
128
0.754472
82
615
5.47561
0.52439
0.062361
0.093541
0
0
0
0
0
0
0
0
0.011029
0.115447
615
20
129
30.75
0.814338
0.479675
0
0
0
0
0.169872
0
0
0
0
0
0.428571
1
0.428571
false
0
0
0
0.428571
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
1
0
0
0
0
0
0
0
2
9e1a6d72bb2a99bdbbd74d76af4a22fb69089505
3,196
py
Python
pari/article/views/article_views.py
theju/pari
318a4ffba08362e78253ded100a63f5b5c6eadf9
[ "BSD-3-Clause" ]
null
null
null
pari/article/views/article_views.py
theju/pari
318a4ffba08362e78253ded100a63f5b5c6eadf9
[ "BSD-3-Clause" ]
null
null
null
pari/article/views/article_views.py
theju/pari
318a4ffba08362e78253ded100a63f5b5c6eadf9
[ "BSD-3-Clause" ]
null
null
null
import json from django.views.generic.detail import DetailView from django.views.generic.list import ListView from django.utils import translation from django.conf import settings from mezzanine.core.models import CONTENT_STATUS_PUBLISHED from pari.article.models import Article, get_archive_articles, get_all_articles, ArticleCarouselImage from pari.article.mixins import ArticleListMixin from pari.article.templatetags.article_filters import month_name # TODO: Remove in django 1.7+ LANGUAGE_SESSION_KEY = "django_language" class ArticleDetail(DetailView): context_object_name = "blog_post" model = Article def get_queryset(self): if self.request.user.is_staff: return Article.objects.prefetch_related('locations', 'carousel_images') else: return Article.articles.prefetch_related('locations', 'carousel_images') def get_context_data(self, **kwargs): context = super(ArticleDetail, self).get_context_data(**kwargs) article = context['blog_post'] translations = [] for language in settings.LANGUAGES[1:]: content = getattr(article, "content_{0}".format(language[0]), None) if content and content.strip(): translations.append(language) language = self.request.GET.get("hl") if language and language in [ii[0] for ii in settings.LANGUAGES]: translation.activate(language) self.request.session[LANGUAGE_SESSION_KEY] = language context['translations'] = translations context['related_articles'] = article.related_posts.filter(status=CONTENT_STATUS_PUBLISHED)[:5] if article.featured_video or article.featured_audio: obj = context['object'] obj.oembed_data = json.loads(obj.oembed_data) context['object'] = obj return context class ArchiveDetail(ArticleListMixin, ListView): context_object_name = "articles" model = Article template_name = 'article/archive_detail.html' def get_article_list_queryset(self): self.year = self.kwargs['year'] self.month = self.kwargs['month'] return get_archive_articles(self.month, self.year) def get_context_data(self, **kwargs): context = super(ArchiveDetail, self).get_context_data(**kwargs) context['year'] = self.year context['month'] = self.month context['month_as_name'] = month_name(self.month) context['title'] = "{0} {1}".format(context['month_as_name'], self.year) return context class ArticleList(ArticleListMixin, ListView): context_object_name = "articles" model = Article def get_article_list_queryset(self): return get_all_articles() def get_context_data(self, **kwargs): context = super(ArticleList, self).get_context_data(**kwargs) context['title'] = "All articles" return context class ArticleCarouselImageDetail(DetailView): context_object_name = "image" model = ArticleCarouselImage def get_object(self, queryset=None): return ArticleCarouselImage.objects.get(article__slug=self.kwargs['slug'], _order=int(self.kwargs['order']) - 1)
36.735632
120
0.70025
372
3,196
5.825269
0.274194
0.019382
0.038763
0.023535
0.211814
0.165667
0.110291
0.110291
0
0
0
0.003902
0.19806
3,196
86
121
37.162791
0.841592
0.008448
0
0.19697
0
0
0.08336
0.008525
0
0
0
0.011628
0
1
0.106061
false
0
0.136364
0.030303
0.560606
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
1
0
0
2
9e1e17de871a5bd889ab965b1b5d6414acf7b152
3,029
py
Python
crowdsourcing/migrations/0006_auto_20150707_1259.py
ramcn/sept20
e6f6e238d0561ebf3353158161f1b20052e8b08b
[ "MIT" ]
1
2016-02-29T01:26:42.000Z
2016-02-29T01:26:42.000Z
crowdsourcing/migrations/0006_auto_20150707_1259.py
ramcn/sept20
e6f6e238d0561ebf3353158161f1b20052e8b08b
[ "MIT" ]
16
2015-08-10T18:28:18.000Z
2022-03-11T23:12:48.000Z
crowdsourcing/migrations/0006_auto_20150707_1259.py
Milstein/crowdsource-platform
60427e440373824c26c7daf8cf5f421b9c7ebbb5
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('crowdsourcing', '0005_auto_20150707_1244'), ] operations = [ migrations.RemoveField( model_name='project', name='has_multiple_tasks', ), migrations.AddField( model_name='module', name='data_set_location', field=models.CharField(default=b'No data set', max_length=256, null=True), ), migrations.AddField( model_name='module', name='has_data_set', field=models.BooleanField(default=False), ), migrations.AddField( model_name='module', name='task_time', field=models.FloatField(default=0), ), migrations.AddField( model_name='template', name='price', field=models.FloatField(default=0), ), migrations.AddField( model_name='template', name='share_with_others', field=models.BooleanField(default=False), ), migrations.AddField( model_name='templateitem', name='data_source', field=models.CharField(max_length=256, null=True), ), migrations.AddField( model_name='templateitem', name='icon', field=models.CharField(max_length=256, null=True), ), migrations.AddField( model_name='templateitem', name='id_string', field=models.CharField(default='Label1', max_length=128), preserve_default=False, ), migrations.AddField( model_name='templateitem', name='layout', field=models.CharField(default=b'column', max_length=16), ), migrations.AddField( model_name='templateitem', name='role', field=models.CharField(default='display', max_length=16), preserve_default=False, ), migrations.AddField( model_name='templateitem', name='sub_type', field=models.CharField(default='h4', max_length=16), preserve_default=False, ), migrations.AddField( model_name='templateitem', name='type', field=models.CharField(default='label', max_length=16), preserve_default=False, ), migrations.AddField( model_name='templateitem', name='values', field=models.TextField(null=True), ), migrations.AlterField( model_name='module', name='keywords', field=models.TextField(null=True), ), migrations.AlterField( model_name='template', name='source_html', field=models.TextField(default=None, null=True), ), ]
30.908163
86
0.548036
269
3,029
5.988848
0.286245
0.089385
0.185599
0.217877
0.68653
0.613284
0.55121
0.55121
0.541279
0.325264
0
0.020388
0.336085
3,029
97
87
31.226804
0.780706
0.006933
0
0.637363
0
0
0.124085
0.007651
0
0
0
0
0
1
0
false
0
0.021978
0
0.054945
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
9e1fc8c93882f7b73a8721a0926b8de62a036a2e
1,681
py
Python
CARLA/PythonAPI/simulation/simulation.py
jawadefaj/SIP-CARLA
61f1fbd4e5fafbc6412a0b40e0748e570035b37a
[ "MIT" ]
null
null
null
CARLA/PythonAPI/simulation/simulation.py
jawadefaj/SIP-CARLA
61f1fbd4e5fafbc6412a0b40e0748e570035b37a
[ "MIT" ]
null
null
null
CARLA/PythonAPI/simulation/simulation.py
jawadefaj/SIP-CARLA
61f1fbd4e5fafbc6412a0b40e0748e570035b37a
[ "MIT" ]
null
null
null
from helper import helper import os class simulation(): def __init__(self, client=None): if client is None: client = helper.connectToClient() self.client = client self.world = client.get_world() self.bounding_box = None self.configure_simulation() pass def configure_simulation(self): helper.set_camera_over_intersection(self.world) self.bounding_box = helper.draw_bounding_box(self.world) pass def reset_simulation(self): helper.reset_carla_world(self.client) def record_scene(self, filename="recording01.log", additional_param=True): self.client.start_recorder(filename, additional_param) def stop_record(self): self.client.stop_recorder() def replay_scene(self, filename="recording01.log", start=1, duration=0, camera=0, time_factor=1.0): self.set_recorder_playback(time_factor) self.client.replay_file(filename, start, duration, camera) def set_recorder_playback(self, time_factor): self.client.set_replayer_time_factor(time_factor) def store_recorded_data(self, filename="recording01.log", show_all= True, txt_file="output.txt"): output = self.client.show_recorder_file_info(filename, show_all) # creates the text file if it does not exist file = open(txt_file, "w+") file.close() # deletes all previous content from text file file = open(txt_file, "r+") file.truncate(0) file.close() # writes recorder output to text file text_file = open(txt_file, "w") n = text_file.write(output) text_file.close()
32.960784
103
0.669839
216
1,681
4.981481
0.342593
0.074349
0.064126
0.072491
0.087361
0
0
0
0
0
0
0.009317
0.233789
1,681
51
104
32.960784
0.826087
0.072576
0
0.111111
0
0
0.03856
0
0
0
0
0
0
1
0.222222
false
0.055556
0.055556
0
0.305556
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
f519c4ae3e073d8fc6392c590e9170a56ff02dd9
980
py
Python
tests/unit/configs/system/test_config.py
Egnod/sitri
ca974cce9041bea8296284b0ca67d970a6e072cf
[ "MIT" ]
11
2020-12-16T07:00:29.000Z
2021-05-25T16:24:50.000Z
tests/unit/configs/system/test_config.py
Egnod/sitri
ca974cce9041bea8296284b0ca67d970a6e072cf
[ "MIT" ]
6
2019-10-08T22:55:21.000Z
2019-10-11T19:29:53.000Z
tests/unit/configs/system/test_config.py
Egnod/sitri
ca974cce9041bea8296284b0ca67d970a6e072cf
[ "MIT" ]
2
2019-10-10T12:09:50.000Z
2019-10-10T23:52:38.000Z
def test_metadata(system_config) -> None: assert system_config.provider_code == "system" assert system_config._prefix == "TEST" def test_prefixize(system_config) -> None: assert system_config.prefixize("key1") == "TEST_KEY1" assert system_config.unprefixize("TEST_KEY1") == "key1" def test_get_variable(monkeypatch, system_config) -> None: monkeypatch.setenv("TEST_KEY1", "1") monkeypatch.setenv("TEST_KEY2", "2") assert system_config.get("key1") == "1" assert system_config.get("key2") == "2" monkeypatch.undo() def test_get_variables_list(monkeypatch, system_config) -> None: monkeypatch.setenv("TEST_KEY1", "1") monkeypatch.setenv("TEST_KEY2", "2") monkeypatch.setenv("TEZT_T1", "1") monkeypatch.setenv("TEZT_T2", "2") assert "key1" in system_config.keys() assert "key2" in system_config.keys() assert "t1" not in system_config.keys() assert "t2" not in system_config.keys() monkeypatch.undo()
28.823529
64
0.694898
126
980
5.15873
0.230159
0.258462
0.166154
0.110769
0.495385
0.347692
0.243077
0.243077
0.243077
0.243077
0
0.029162
0.160204
980
33
65
29.69697
0.760632
0
0
0.272727
0
0
0.116327
0
0
0
0
0
0.454545
1
0.181818
false
0
0
0
0.181818
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
2
f521a3bb8d1757d12ddea3ebadb97e6c0a682f8c
582
py
Python
ops.py
tekktonic/programming
139959ab9934912d4c531e5ee8b1f39094a6823c
[ "0BSD" ]
null
null
null
ops.py
tekktonic/programming
139959ab9934912d4c531e5ee8b1f39094a6823c
[ "0BSD" ]
null
null
null
ops.py
tekktonic/programming
139959ab9934912d4c531e5ee8b1f39094a6823c
[ "0BSD" ]
null
null
null
import hw def none(): pass def ldx(): pc += 1 regx = mem[pc] def ldy(): pc += 1 regy = mem[pc] def ldz(): pc += 1 regz = mem[pc] def rtx(): pc += 1 mem[mem[pc]] = rtx def rty(): pc += 1 mem[mem[pc]] = rty def rtz(): pc += 1 mem[mem[pc]] = regz def add(): regz = regx + regy def sub(): regz = regx - regy def mul(): regz = regx * regy def div(): regz = regx / regy def mov(): mem[regy] = regx def jmp(): pc = mem[pc + 1] def die(): exit(0) def prt(): pc += 1 print(mem[mem[pc]])
10.581818
23
0.463918
93
582
2.903226
0.301075
0.088889
0.118519
0.222222
0.122222
0
0
0
0
0
0
0.023936
0.353952
582
54
24
10.777778
0.694149
0
0
0.184211
0
0
0
0
0
0
0
0
0
1
0.394737
false
0.026316
0.026316
0
0.421053
0.026316
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
f548dadfb7037aaf0041aa0ff91fc3b1b264af96
884
py
Python
src/dash/admin.py
zenly/visibility
557d82799e1a3a080168f20b9bf7c7c35d5bcfd0
[ "Apache-2.0" ]
4
2015-03-12T08:51:20.000Z
2015-09-25T20:48:53.000Z
src/dash/admin.py
douglas-gibbons/visibility
557d82799e1a3a080168f20b9bf7c7c35d5bcfd0
[ "Apache-2.0" ]
null
null
null
src/dash/admin.py
douglas-gibbons/visibility
557d82799e1a3a080168f20b9bf7c7c35d5bcfd0
[ "Apache-2.0" ]
1
2015-04-28T05:39:51.000Z
2015-04-28T05:39:51.000Z
''' Copyright 2013 Douglas Gibbons Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ''' from django.contrib import admin from dash.models import * admin.site.register(Product) admin.site.register(Build) admin.site.register(Deploy) admin.site.register(Event) admin.site.register(Environment) admin.site.register(Host) admin.site.register(Testrun) admin.site.register(Testpack)
31.571429
75
0.769231
131
884
5.19084
0.610687
0.105882
0.2
0.047059
0
0
0
0
0
0
0
0.010738
0.15724
884
27
76
32.740741
0.902013
0.627828
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
f549ea0804828c87b3826cc6a289741966c7d2c1
443
py
Python
open_humans/migrations/0014_member_password_reset_redirect.py
danamlewis/open-humans
9b08310cf151f49032b66ddd005bbd47d466cc4e
[ "MIT" ]
57
2016-09-01T21:55:52.000Z
2022-03-27T22:15:32.000Z
open_humans/migrations/0014_member_password_reset_redirect.py
danamlewis/open-humans
9b08310cf151f49032b66ddd005bbd47d466cc4e
[ "MIT" ]
464
2015-03-23T18:08:28.000Z
2016-08-25T04:57:36.000Z
open_humans/migrations/0014_member_password_reset_redirect.py
danamlewis/open-humans
9b08310cf151f49032b66ddd005bbd47d466cc4e
[ "MIT" ]
25
2017-01-24T16:23:27.000Z
2021-11-07T01:51:42.000Z
# Generated by Django 2.1.1 on 2018-09-24 23:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('open_humans', '0013_remove_member_badges'), ] operations = [ migrations.AddField( model_name='member', name='password_reset_redirect', field=models.CharField(blank=True, default='', max_length=254, null=True), ), ]
23.315789
86
0.625282
50
443
5.38
0.82
0
0
0
0
0
0
0
0
0
0
0.066869
0.257336
443
18
87
24.611111
0.75076
0.10158
0
0
1
0
0.164141
0.121212
0
0
0
0
0
1
0
false
0.083333
0.083333
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
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
f558844da4a7ece730455a676698c37efefe2d10
907
py
Python
libs/tools/json.py
lundgrenalex/mtrc
9deb8676d299bf341c8be16c2dd4ba000b515407
[ "Apache-2.0" ]
null
null
null
libs/tools/json.py
lundgrenalex/mtrc
9deb8676d299bf341c8be16c2dd4ba000b515407
[ "Apache-2.0" ]
null
null
null
libs/tools/json.py
lundgrenalex/mtrc
9deb8676d299bf341c8be16c2dd4ba000b515407
[ "Apache-2.0" ]
null
null
null
from functools import wraps from flask import jsonify, request from jsonschema import validate from jsonschema.exceptions import ValidationError from werkzeug.exceptions import BadRequest from importlib import import_module import logging def validate_schema(schema_name: str): def decorator(f): @wraps(f) def wrapper(*args, **kw): try: schema = import_module('libs.schemas.' + schema_name, package=__name__) validate(request.json, schema.schema) except ValidationError as e: logging.error(f'ValidationError: {e.message}, {request.data}') return jsonify({ "error_code": 400, "error_type": "ValidationError", "error_message": e.message }), 400 return f(*args, **kw) return wrapper return decorator
33.592593
87
0.609702
93
907
5.817204
0.430108
0.051756
0
0
0
0
0
0
0
0
0
0.009554
0.307608
907
26
88
34.884615
0.851911
0
0
0
0
0
0.115766
0
0
0
0
0
0
1
0.125
false
0
0.333333
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
f56074975e7b21095e17d53496e2aee49713a669
555
py
Python
python3/cmp/cmp1.py
jtraver/dev
c7cd2181594510a8fa27e7325566ed2d79371624
[ "MIT" ]
null
null
null
python3/cmp/cmp1.py
jtraver/dev
c7cd2181594510a8fa27e7325566ed2d79371624
[ "MIT" ]
null
null
null
python3/cmp/cmp1.py
jtraver/dev
c7cd2181594510a8fa27e7325566ed2d79371624
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 #!/usr/bin/python3 dict1 = { 'a': 1, 'b': 2, } dict2 = { 'a': 0, 'b': 2, } if dict1 == dict2: print("FAIL") else: print("PASS") dict1 = { 'a': { 'c': 'bake' }, 'b': 2, } dict2 = { 'a': { 'c': 'shake' }, 'b': 2, } if dict1 == dict2: print("FAIL") else: print("PASS") dict1 = { 'a': { 'c': [0, 1] }, 'b': 2, } dict2 = { 'a': { 'c': [0, 2] }, 'b': 2, } if dict1 == dict2: print("FAIL") else: print("PASS")
9.910714
22
0.356757
67
555
2.955224
0.283582
0.060606
0.106061
0.121212
0.757576
0.616162
0.616162
0.616162
0.616162
0.616162
0
0.076471
0.387387
555
55
23
10.090909
0.505882
0.068468
0
0.636364
0
0
0.095146
0
0
0
0
0
0
1
0
false
0.068182
0
0
0
0.136364
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
f56c748076b14e3492eccc6eb1d5024cc86dff9c
683
py
Python
src/sw/allotmentclub/alembic/versions/set_advance_pay_to_0_if_under_threshold_1654373c7899.py
sweh/sw.allotmentclub.backend
77344045e29c2b173d635e9e20a0ca556161888e
[ "ZPL-2.1" ]
1
2019-11-12T08:13:18.000Z
2019-11-12T08:13:18.000Z
src/sw/allotmentclub/alembic/versions/set_advance_pay_to_0_if_under_threshold_1654373c7899.py
sweh/sw.allotmentclub.backend
77344045e29c2b173d635e9e20a0ca556161888e
[ "ZPL-2.1" ]
26
2020-05-16T12:08:25.000Z
2022-03-12T00:53:57.000Z
src/sw/allotmentclub/alembic/versions/set_advance_pay_to_0_if_under_threshold_1654373c7899.py
sweh/sw.allotmentclub.backend
77344045e29c2b173d635e9e20a0ca556161888e
[ "ZPL-2.1" ]
null
null
null
"""Set advance pay to 0 if under threshold. Revision ID: 1654373c7899 Revises: 51aecbad82b3 Create Date: 2015-03-27 08:15:43.051506 """ # revision identifiers, used by Alembic. from alembic import op revision = '1654373c7899' down_revision = u'51aecbad82b3' def upgrade(): op.execute("""UPDATE energyvalue SET advance_pay = 0 WHERE year = 2014 and advance_pay < 100000;""") op.execute("""UPDATE booking SET value = 0 WHERE purpose = 'Energieabschlag I' and value > -100000;""") op.execute("""UPDATE booking SET value = 0 WHERE purpose = 'Energieabschlag II' and value > -100000;""") def downgrade(): pass
25.296296
74
0.654466
85
683
5.223529
0.576471
0.067568
0.101351
0.094595
0.288288
0.288288
0.288288
0.288288
0.288288
0.288288
0
0.149425
0.235725
683
26
75
26.269231
0.701149
0.247438
0
0.166667
0
0
0.65415
0
0
0
0
0
0
1
0.166667
false
0.083333
0.083333
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
f56f7a467b372625248679de44e305c9ea4a766c
349
py
Python
flask_app/__init__.py
crazynayan/tpf2
3552163a1dab7cd5e371d752a2651e73e8cd8e1e
[ "MIT" ]
null
null
null
flask_app/__init__.py
crazynayan/tpf2
3552163a1dab7cd5e371d752a2651e73e8cd8e1e
[ "MIT" ]
2
2021-03-23T02:46:31.000Z
2021-08-04T07:39:45.000Z
flask_app/__init__.py
crazynayan/tpf2
3552163a1dab7cd5e371d752a2651e73e8cd8e1e
[ "MIT" ]
null
null
null
from flask import Flask from flask_login import LoginManager from config import Config tpf2_app: Flask = Flask(__name__) tpf2_app.config.from_object(Config) login = LoginManager(tpf2_app) login.login_view = 'login' # noinspection PyPep8 from flask_app import routes from flask_app.user import login, logout from flask_app import test_data_routes
23.266667
40
0.82808
53
349
5.169811
0.339623
0.164234
0.131387
0.131387
0
0
0
0
0
0
0
0.013029
0.120344
349
14
41
24.928571
0.879479
0.054441
0
0
0
0
0.015244
0
0
0
0
0
0
1
0
false
0
0.6
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
f57621eeb4246270c4d6f7801f73bb708e05689a
95
py
Python
src/core/toga/constants/alignment.py
jrwdunham/toga
db343c99d0f174aea86c4656849ea25ffb7bfe7a
[ "BSD-3-Clause" ]
1
2015-11-08T11:41:52.000Z
2015-11-08T11:41:52.000Z
toga/constants/alignment.py
ericholscher/toga
bc6d0e9c89764ee5bacfdfbddfaa8d6902f56853
[ "BSD-3-Clause" ]
null
null
null
toga/constants/alignment.py
ericholscher/toga
bc6d0e9c89764ee5bacfdfbddfaa8d6902f56853
[ "BSD-3-Clause" ]
null
null
null
LEFT_ALIGNED = 0 RIGHT_ALIGNED = 1 CENTER_ALIGNED = 2 JUSTIFIED_ALIGNED = 3 NATURAL_ALIGNED = 4
19
21
0.8
15
95
4.733333
0.733333
0
0
0
0
0
0
0
0
0
0
0.061728
0.147368
95
5
22
19
0.814815
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
f57e23cefc91a314334ce79d168311794c929e4d
3,649
py
Python
stock/interface/req_interface.py
Ryu0n/stock_prediction
f6d117768ff33f6de95d5b94ce46d2ca07964873
[ "Unlicense" ]
6
2021-06-01T10:48:40.000Z
2021-09-10T04:51:07.000Z
stock/interface/req_interface.py
Ryu0n/stock_prediction
f6d117768ff33f6de95d5b94ce46d2ca07964873
[ "Unlicense" ]
null
null
null
stock/interface/req_interface.py
Ryu0n/stock_prediction
f6d117768ff33f6de95d5b94ce46d2ca07964873
[ "Unlicense" ]
1
2021-06-01T00:13:15.000Z
2021-06-01T00:13:15.000Z
import requests # http://127.0.0.1:8000/rest_api/user/10/ from django.views.decorators.csrf import csrf_exempt class BaseReq: def __init__(self): self.url = 'http://127.0.0.1:8000/rest_api/' self.login_url = self.url + 'auth/login/' # 2021.02.14.hsk : 추후에 screts.json으로 통합 self.id = 'admin' self.password = 'admin' self.data = None self.client, self.login_res = self._login(self.login_url, self.id, self.password) @staticmethod def _login(login_url, id, password): client = requests.session() client.get(login_url) csrf_token = client.cookies['csrftoken'] login_data = {'Username': id, 'Password': password, 'csrfmiddlewaretoken': csrf_token} login_res = client.post(login_url, data=login_data) return client, login_res @staticmethod def _ret(res): if res.status_code in (200, 201): return res else: print('Status Code : [{0}]'.format(res.status_code)) def set_param(self, data): self.data = data def get_param(self): return self.data class BaseCreate(BaseReq): def __init__(self): super().__init__() @csrf_exempt def send_post(self): res = self.client.post(self.url, json=self.data) # self.client(현재 활성화된 로그인 세션)를 사용한 요청 res = self._ret(res) return res class BaseRead(BaseReq): def __init__(self): super().__init__() def send_get(self): res = self.client.get(self.url) return self._ret(res) class BaseUpdate(BaseReq): """ 2021.02.14.hsk : 추후 변경 필요 """ def __init__(self): super().__init__() def send_put(self): res = self.client.put(self.url, json=self.data) return self._ret(res) def send_patch(self): res = self.client.patch(self.url, json=self.data) return self._ret(res) class BaseDelete(BaseReq): """ 2021.02.14.hsk : 추후 변경 필요 """ def __init__(self): super().__init__() def send_delete(self): res = self.client.delete(self.url) return self._ret(res) class CreateMarketReq(BaseCreate): def __init__(self): super().__init__() self.url += 'market/' # 주식시장 class ReadMarketReq(BaseRead): def __init__(self): super().__init__() self.url += 'market/' class UpdateMarketReq(BaseUpdate): def __init__(self): super().__init__() self.url += 'market/' class DeleteMarketReq(BaseDelete): def __init__(self): super().__init__() self.url += 'market/' # 주식종목 class CreateItemListReq(BaseCreate): def __init__(self): super().__init__() self.url += 'item_list/' class ReadItemListReq(BaseRead): def __init__(self, stock_market_name): super().__init__() self.url += ('item_list/?stock_market_name=' + stock_market_name) class UpdateItemListReq(BaseUpdate): def __init__(self): super().__init__() self.url += 'item_list/' class DeleteItemListReq(BaseDelete): def __init__(self): super().__init__() self.url += 'item_list/' # 주식종목 데이터 class CreateItemReq(BaseCreate): def __init__(self): super().__init__() self.url += 'item/' class ReadItemReq(BaseRead): def __init__(self): super().__init__() self.url += 'item/' class UpdateItemReq(BaseUpdate): def __init__(self): super().__init__() self.url += 'item/' class DeleteItemReq(BaseDelete): def __init__(self): super().__init__() self.url += 'item/'
22.80625
95
0.605645
438
3,649
4.646119
0.232877
0.114005
0.091892
0.117936
0.432924
0.42113
0.392629
0.351843
0.276167
0.089435
0
0.019608
0.259249
3,649
159
96
22.949686
0.733259
0.050699
0
0.485714
0
0
0.064761
0.00846
0
0
0
0
0
1
0.247619
false
0.038095
0.019048
0.009524
0.504762
0.009524
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
f5925053ac69bdbffe31ea63ae2a1f5ac4bb0066
804
py
Python
test.py
WhiteSpotTrading/igdatacollector
c7d5d7cacccf77b7646ffcce81e5ee23eaee3019
[ "Apache-2.0" ]
null
null
null
test.py
WhiteSpotTrading/igdatacollector
c7d5d7cacccf77b7646ffcce81e5ee23eaee3019
[ "Apache-2.0" ]
null
null
null
test.py
WhiteSpotTrading/igdatacollector
c7d5d7cacccf77b7646ffcce81e5ee23eaee3019
[ "Apache-2.0" ]
null
null
null
from igdatacollector import Timeseries import sqlalchemy a = Timeseries(epic='IX.D.OMX.IFD.IP', resolution='D') #a.getTimeseries(start_date='2017-08-01', end_date='2017-08-05') a.getTimesseries_from_file(path='/Users/Carlwestman/PycharmProjects/WhiteSpotTrading/test-data-store/raw/CS.D.USDSEK.CFD.IP_hourly.csv',csv=True) a.store_as_csv('/Users/Carlwestman/PycharmProjects/WhiteSpotTrading/test-data-store/pyalgotradeformatted/test.csv') engine = sqlalchemy.create_engine('postgresql+psycopg2://data_manager:localdevpassword@localhost/postgres') a.store_to_psql(engine, if_exists='replace') #print a.dataframe.head() #print a.last_updates b = Timeseries(epic="IX.D.OMX.IFD.IP", resolution='D') b.getTimeseries_from_sql(engine=engine, maxLength=10) print b.dataframe print type(a.last_entry_date)
36.545455
145
0.804726
118
804
5.338983
0.542373
0.044444
0.050794
0.053968
0.304762
0.304762
0.304762
0.114286
0.114286
0
0
0.024869
0.049751
804
22
146
36.545455
0.799738
0.133085
0
0
0
0.090909
0.441727
0.385612
0
0
0
0
0
0
null
null
0.090909
0.181818
null
null
0.181818
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
192347cf900546b4649b80d0bf15358a9391f129
636
py
Python
week_6/c_3.py
XiaochenCui/cryptography-homework
175d5ac354d22a52fee455fd1e151bb0ce0e605c
[ "MIT" ]
2
2018-06-06T00:13:42.000Z
2019-03-02T06:44:23.000Z
week_6/c_3.py
XiaochenCui/cryptography-homework
175d5ac354d22a52fee455fd1e151bb0ce0e605c
[ "MIT" ]
null
null
null
week_6/c_3.py
XiaochenCui/cryptography-homework
175d5ac354d22a52fee455fd1e151bb0ce0e605c
[ "MIT" ]
2
2018-11-12T09:57:48.000Z
2020-07-10T07:32:03.000Z
from gmpy2 import ( mpz, isqrt, mul, sub, t_div, ) N = mpz(720062263747350425279564435525583738338084451473999841826653057981916355690188337790423408664187663938485175264994017897083524079135686877441155132015188279331812309091996246361896836573643119174094961348524639707885238799396839230364676670221627018353299443241192173812729276147530748597302192751375739387929) A2 = 2 * isqrt(6 * N) + 1 x2 = isqrt(A2 * A2 - 24 * N) p = t_div((A2 - x2), 6) q = t_div((A2 + x2), 4) print((p, q)) print(p * q == N) print(p - q) p = t_div((A2 - x2), 4) q = t_div((A2 + x2), 6) print((p, q)) print(p * q == N) print(p - q)
24.461538
318
0.72327
68
636
6.691176
0.308824
0.079121
0.092308
0.07033
0.184615
0.096703
0.096703
0.096703
0.096703
0.096703
0
0.617537
0.157233
636
25
319
25.44
0.231343
0
0
0.3
0
0
0
0
0
0
0
0
0
1
0
false
0
0.05
0
0.05
0.3
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
195122fd8473a1b278227b4077a75f01a2ff535f
1,687
py
Python
Neo4jQueries.py
harishvc/githubanalytics
27663a472388128df1b0c5678744f92f636c5a2c
[ "MIT" ]
32
2015-02-21T06:52:42.000Z
2021-01-13T01:44:45.000Z
Neo4jQueries.py
harishvc/githubanalytics
27663a472388128df1b0c5678744f92f636c5a2c
[ "MIT" ]
77
2015-01-08T05:24:22.000Z
2016-11-29T15:00:28.000Z
Neo4jQueries.py
harishvc/githubanalytics
27663a472388128df1b0c5678744f92f636c5a2c
[ "MIT" ]
7
2015-09-17T08:07:47.000Z
2021-01-13T01:44:46.000Z
from py2neo import authenticate, Graph import os.path import bleach import sys from flask import Flask app = Flask(__name__) def FindSimilarRepositories(InputrepoK): #Sanitize input print("got ......",InputrepoK) sys.stdout.flush() Inputrepo = bleach.clean(InputrepoK).strip() host = os.environ['LOCALNEO4JIPPORT'] login = os.environ['LOCALNEO4JLOGIN'] password = os.environ['LOCALNEO4JPASSWORD'] authenticate(host,login,password) graph = Graph(os.environ['neoURLlocal']) output = "" path1 = "<a href=\"/?q=repository " path2 = "&amp;action=Search\" class=\"repositoryinfo\">" path3 = "</a>" #Find similar repository > 1 connections query1="MATCH (a {id:\"" + Inputrepo + "\"})" query2="-[r1:IS_ACTOR|IN_ORGANIZATION]->(match)<-[r2:IS_ACTOR|IN_ORGANIZATION]-(b) " query3="with b, collect (distinct match.id) as connections, collect (distinct type(r1)) as rel1 " query4="where length(connections) >= 1 return b.id,length(connections) as count,length(rel1) as rel " query5="order by length(connections) desc limit 5" query = query1 + query2 + query3 + query4 + query5 #print query a = graph.cypher.execute(query) for record in a: if (record['rel'] < 2): output += "<li>" + path1 + record['b.id'] + path2 + record['b.id'] + path3 + ": " + str(record['count']) + " contributors in common</li>" else: output += "<li>" + path1 + record['b.id'] + path2 + record['b.id'] + path3 + ": " + str(record['count']-1) + " contributors in common &amp; belong to same organization</li>" if (len(output) > 0): return ("<ul>" + output + "</ul>") else: #Nothing found! return "<span class=\"text-danger\">You got me stumped!</span>"
37.488889
179
0.662122
217
1,687
5.110599
0.483871
0.013526
0.032462
0.037872
0.099188
0.099188
0.099188
0.099188
0.099188
0.099188
0
0.023994
0.160047
1,687
44
180
38.340909
0.758645
0.046236
0
0.057143
0
0.057143
0.389651
0.061097
0
0
0
0
0
0
null
null
0.057143
0.142857
null
null
0.028571
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
19544808caf99f9c5265f01d11c9a8596462d909
17,856
py
Python
LoopBack/reportUploader.py
ipqhjjybj/loop_back
107ce5ed6c6362e5920773051326a5c914223bb9
[ "MIT" ]
7
2019-10-03T11:09:23.000Z
2022-02-14T14:36:31.000Z
LoopBack/reportUploader.py
ipqhjjybj/loop_back
107ce5ed6c6362e5920773051326a5c914223bb9
[ "MIT" ]
null
null
null
LoopBack/reportUploader.py
ipqhjjybj/loop_back
107ce5ed6c6362e5920773051326a5c914223bb9
[ "MIT" ]
5
2020-01-26T14:27:04.000Z
2021-11-02T11:37:55.000Z
# -*- coding: utf-8 -*- # # Copyright 2017 Inc # @author ipqhjjybj ''' 上传期货的数据 ''' import sys import os import six import numpy as np import pandas as pd sys.path.append("..") from config import * from connect import * from reportPyConfig import * upload_date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") # class spreadReportUploader(): # ''' # 上次详细回测报告 # ''' # @staticmethod # def uploadSpreadBacktestingAssessmentReport(filePath , strategyName): # try: # except Exception,ex: # print ex class reportUploader(): ''' 删除某一天之前的交易报告 ''' @staticmethod def deleteAllReportBeforeDay( use_date , clear_table_arr = ["`bascktesting_assessment_report`","`pushon_report`","`core_index_report`","`distribute_best_report`","`niuxiong_state_report`","`other_optimal_parameter_report`","`prom_diff_future_report`","`stability_report`","`strategyreportdict`"]): db = Stock.getDB('mysql') for table_name in clear_table_arr: sqll = "delete from %s where `create_date` <= '%s'" % (table_name , use_date) db.execute(sqll) db.commit() ''' 上传交易回测报告 ''' @staticmethod def uploadBacktestingAssessmentReport( filePath , strategyName ): # 2009/03/27---2017/03/27,2009/03/27---2017/03/27 try: f = open(filePath , "r") firstLine = "" flag = 0 ret = [] i = 0 for line in f: i = i + 1 line = line.strip() if flag == 0 : flag = 1 firstLine = line continue if i < 4: continue line = line.replace('1.$', '0.0') line = line.replace('-1.#J', '0.0') x = line.strip().split(',') if '---' in x: continue x = x[1] if '%' in x: x = x[:-1] if '---' in x : (withdraw_startdate , withdraw_enddate) = x.strip().split('---') ret.append(withdraw_startdate) ret.append(withdraw_enddate) else: ret.append(x) f.close() # rb,min15,2009/03/27--2016/07/27,3 4 5 1 1 1 1 1 1 1 10 10 10 0 10 10 1 10 1 (code , period , time_during , setValues) = firstLine.strip().split(',') arr = time_during.strip().split('--') start_date , end_date = arr ret = [strategyName , setValues , code , period , start_date , end_date , upload_date ] + ret ret = [str(x) for x in ret] fuck = [x for x in ret if '%' in x] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_bascktesting_assessment_report2 + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' 上传组合回测报告 ''' @staticmethod def uploadCombinationAssessmentReport( filePath , strategyName): try: f = open(filePath , "r") firstLine = "" i = 0 content_arr = [] for line in f: line = line.strip() i = i + 1 if i == 1: firstLine = line if i < 2: continue content_arr.append(line) f.close() contents = '\n'.join(content_arr) ret = [strategyName , firstLine , contents] ret = [str(x) for x in ret] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_backtesting_combination_report + " (NULL," + line + ")" #print sqll db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' 上传交易回测报告 ''' @staticmethod def uploadPushOnBacktestingReport( filePath , strategyName ): # 2009/03/27---2017/03/27,2009/03/27---2017/03/27 try: f = open(filePath , "r") firstLine = "" flag = 0 ret = [] i = 0 for line in f: i = i + 1 line = line.strip() if flag == 0 : flag = 1 firstLine = line continue if i < 4: continue # line = line.replace('-1.#J', '0.0') # line = line.replace('1.#QO', '0.0') x = line.strip().split(',') if '---' in x: continue x = x[1] if '%' in x: x = x[:-1] if '---' in x : (withdraw_startdate , withdraw_enddate) = x.strip().split('---') ret.append(withdraw_startdate) ret.append(withdraw_enddate) else: ret.append(x) f.close() # rb,min15,2009/03/27--2016/07/27,3 4 5 1 1 1 1 1 1 1 10 10 10 0 10 10 1 10 1 (code , period , time_during , setValues) = firstLine.strip().split(',') arr = time_during.strip().split('--') start_date , end_date = arr ret = [strategyName , setValues , code , period , start_date , end_date , upload_date ] + ret ret = [str(x) for x in ret] fuck = [x for x in ret if '%' in x] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_bascktesting_assessment_report3 + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' 上传推进报告 ''' @staticmethod def uploadPushOnReport( filePath , strategyName): try: f = open(filePath , "r") firstLine = "" i = 0 content_arr = [] for line in f: line = line.strip() i = i + 1 if i == 1: firstLine = line if i < 4: continue # line = line.replace('-1.#J', '0.0') # line = line.replace('1.#QO', '0.0') content_arr.append(line) f.close() contents = '\n'.join(content_arr) (code , period , time_during , setValues , ybn_months, ybw_months , tuijin_months ) = firstLine.strip().split(',') arr = time_during.strip().split('--') start_date , end_date = arr ret = [strategyName , setValues , code , period , start_date , end_date , upload_date , ybn_months, ybw_months , tuijin_months , contents] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_pushon_report + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' core_index_Report ''' @staticmethod def uploadCoreIndexReport( filePath , strategyName): try: f = open(filePath , "r") firstLine = "" i = 0 content_arr = [] for line in f: i = i + 1 line = line.strip().decode('utf-8') if i == 1: firstLine = line continue if i < 4 : continue # line = line.replace('-1.#J', '0.0') # line = line.replace('1.#QO', '0.0') content_arr.append(line) f.close() (code , period , time_during1 , time_during2 , setValues ) = firstLine.strip().split(',') (ybn_start_date , ybn_end_date) = time_during1.split('--') (ybw_start_date , ybw_end_date) = time_during2.split('--') contents = '\n'.join(content_arr) #contents = "" ret = [strategyName , setValues , code , period , ybn_start_date , ybn_end_date , ybw_start_date , ybw_end_date , upload_date , contents] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_core_index_report + " (NULL," + line + ")" #print sqll db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' distribute_best_report ''' @staticmethod def uploadDistributeBestReport( filePath , strategyName): try: f = open(filePath , "r") firstLine = "" i = 0 content_arr = [] for line in f: i = i + 1 line = line.strip().decode('utf-8') if i == 1: firstLine = line continue if i < 3: continue # line = line.replace('-1.#J', '0.0') # line = line.replace('1.#QO', '0.0') content_arr.append(line) f.close() (code , period , time_during1 , setValues) = firstLine.strip().split(',') (start_date , end_date) = time_during1.split('--') contents = '\n'.join(content_arr) ret = [strategyName , setValues , code , period , start_date , end_date , upload_date , contents] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_distribute_best_report + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' 牛熊阶段报告 ''' @staticmethod def uploadNiuxiong_state_report( filePath , strategyName): try: f = open(filePath , "r") firstLine = "" i = 0 content_arr = [] for line in f: i = i + 1 line = line.strip().decode('utf-8') if i == 1: firstLine = line if i < 3: continue content_arr.append(line) f.close() (code , period , setValues) = firstLine.strip().split(',') contents = '\n'.join(content_arr) ret = [strategyName , setValues , code , period , upload_date ,contents] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_niuxiong_state_report + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' 其他可选参数报告 ''' @staticmethod def uploadOtherOptiomalParameterReport( filePath , strategyName): try: f = open(filePath , "r") firstLine = "" i = 0 content_arr = [] for line in f: i = i + 1 line = line.strip().decode('utf-8') if i == 1: firstLine = line if i < 3: continue content_arr.append(line) f.close() (code , period , time_during1 , setValues) = firstLine.strip().split(',') (start_date , end_date) = time_during1.split('--') contents = '\n'.join(content_arr) ret = [strategyName , setValues , code , period , start_date , end_date , upload_date , contents] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_other_optimal_report + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' prom报告 ''' @staticmethod def uploadPromDiffFutureReport(filePath , strategyName): try: f = open(filePath , "r") firstLine = "" i = 0 content_arr = [] for line in f: i = i + 1 line = line.strip().decode('utf-8') if i == 1: firstLine = line if i < 4: continue content_arr.append(line) f.close() (code , period , time_during1 , setValues) = firstLine.strip().split(',') (start_date , end_date) = time_during1.split('--') contents = '\n'.join(content_arr) ret = [strategyName , setValues , code , period , start_date , end_date , upload_date , contents] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_prom_diff_future_report + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' 上次交易交易收益报告 ''' @staticmethod def uploadTradingResultFigure(filePath , strategyName): try: f = open(filePath , "r") firstLine = "" flag = 0 ret = [] i = 0 content_arr = [] for line in f: i = i + 1 line = line.strip() if flag == 0: flag = 1 firstLine = line continue if i < 2: continue content_arr.append(line) f.close() try: (code , period , time_during1 , setValues) = firstLine.strip().split(',') (start_date , end_date) = time_during1.split('--') except Exception,ex: (code , period , time_during1 , setValues) = ["","","",""] (start_date , end_date) = ["",""] contents = '\n'.join(content_arr) ret = [strategyName , setValues , code , period , start_date , end_date , upload_date , contents] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_upload_best_figure + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 ''' stability report ''' @staticmethod def uploadStability_report(filePath , strategyName): try: f = open(filePath , "r") firstLine = "" i = 0 content_arr = [] for line in f: i = i + 1 line = line.strip().decode('utf-8') if i == 1: firstLine = line if i < 4: continue content_arr.append(line) f.close() (code , period , time_during1 , setValues) = firstLine.strip().split(',') (start_date , end_date) = time_during1.split('--') contents = '\n'.join(content_arr) ret = [strategyName , setValues , code , period , start_date , end_date , upload_date , contents] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_statbility_report + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() n_id = db.lastRowID() return n_id except Exception,ex: print ex print "Error in %s %s " % (filePath , strategyName) return 0 @staticmethod def uploadFileLists( fileListPath = "./output/fileLists.csv"): f = open(fileListPath , "r") r = reportUploader() ret_id = [] strategyName_list = [] upload_name = "" i = 0 for line in f: i = i + 1 line = line.strip() if i < 2: upload_name = line continue tmp_arr = line.split('/') strategyName = tmp_arr[2] strategyName_list.append(strategyName) if os.path.exists(line): if "backtesting_assessment_report" in line: n_id = r.uploadBacktestingAssessmentReport(line, strategyName) ret_id.append( "backtesting_assessment_report:" + str(n_id)) print "upload backtesting_assessment_report succes!" if "push_backtesting_report" in line: n_id = r.uploadPushOnBacktestingReport(line, strategyName) ret_id.append( "push_backtesting_report:" + str(n_id)) print "upload push_backtesting_report succes!" if "PushOnReport" in line: n_id = r.uploadPushOnReport(line, strategyName) ret_id.append( "PushOnReport:" + str(n_id)) print "upload PushOnReport succes!" if "Core_index" in line: n_id = r.uploadCoreIndexReport(line, strategyName) ret_id.append( "Core_index:" + str(n_id)) print "upload Core_index succes!" if "distribute-best" in line: n_id = r.uploadDistributeBestReport(line, strategyName) ret_id.append( "distribute-best:" + str(n_id)) print "upload distribute-best succes!" if "niuxiong_state" in line: n_id = r.uploadNiuxiong_state_report(line, strategyName) ret_id.append( "niuxiong_state:" + str(n_id)) print "upload niuxiong_state succes!" if "Other_optimal_parameter_sets" in line: n_id = r.uploadOtherOptiomalParameterReport(line, strategyName) ret_id.append( "Other_optimal_parameter_sets:" + str(n_id)) print "upload Other_optimal_parameter_sets succes!" if "PROM_of_each_future_in_diff_period" in line: n_id = r.uploadPromDiffFutureReport(line, strategyName) ret_id.append( "PROM_of_each_future_in_diff_period:" + str(n_id)) print "upload PROM_of_each_future_in_diff_period succes!" if "stability" in line: n_id = r.uploadStability_report(line, strategyName) ret_id.append( "stability:" + str(n_id)) print "upload stability succes!" if "best-figure" in line: n_id = r.uploadTradingResultFigure(line , strategyName) ret_id.append( "best-figure:" + str(n_id)) print "upload best-figure succes!" if "combination-report" in line: n_id = r.uploadCombinationAssessmentReport(line , strategyName) ret_id.append( "combination-report:" + str(n_id)) print "upload combination-report success!" f.close() id_new_line = ','.join(ret_id) strategyName_list = list(set(strategyName_list)) strategyName_list.sort() strategy_line = ','.join(strategyName_list) ret = [strategy_line, id_new_line , upload_date + ":" + upload_name] ret = ["'" + x + "'" for x in ret] line = ','.join(ret) sqll = config_upload_file_dict + " (NULL," + line + ")" db = Stock.getDB('mysql') db.execute(sqll) db.commit() # 抓取以及上传的代码 if __name__ == '__main__': r = reportUploader() #print r.uploadBacktestingAssessmentReport("./report/LivermoreStrategyTest2/rb-min15-2009-03-27-2017-07-27--backtesting_assessment_report.csv" , "LivermoreStrategyTest2") #r.uploadBacktestingAssessmentReport("./report/aligatorStrategy/rb-min15-2009-03-27-2016-07-27--backtesting_assessment_report.csv" , "aligatorStrategy") #r.uploadPushOnReport("./report/aligatorStrategy/PushOnReport_based_on_rb_min15_2009-03-27_2016-07-27_36_06.csv" ,"aligatorStrategy") #r.uploadCoreIndexReport("./report/aligatorStrategy/rb-all_period-2010-03-27-2015-03-27-2015-03-28-2050-03-27-Core_index_of_in-sample_and_out-of-sample_in_diff_period.csv" , "aligatorStrategy") #r.uploadDistributeBestReport("./report/aligatorStrategy/rb-min15-2009-03-27-2016-07-27--distribute-best.csv" , "aligatorStrategy") #r.uploadNiuxiong_state_report("./report/aligatorStrategy/capital_of_each_future_in_diff_period_in_diff_niuxiong_state_(Based_on_rb-min15-_best_parameter).csv" , "aligatorStrategy") #r.uploadOtherOptiomalParameterReport("./report/aligatorStrategy/rb-min15-2009-03-27-2016-07-27--Other_optimal_parameter_sets.csv","aligatorStrategy") #r.uploadPromDiffFutureReport("./report/aligatorStrategy/PROM_of_each_future_in_diff_period_(Based_on_rb-min15-2009-03-27-2016-07-27_best_parameter).csv","aligatorStrategy") #r.uploadStability_report("./report/aligatorStrategy/rb-min15-2009-03-27-2016-07-27--stability.csv" , "aligatorStrategy") #r.deleteAllReportBeforeDay( upload_date ) r.uploadFileLists()
29.034146
298
0.631776
2,344
17,856
4.65273
0.088311
0.012103
0.018705
0.02494
0.681185
0.617733
0.579406
0.562168
0.560334
0.560334
0
0.031715
0.217742
17,856
615
299
29.034146
0.749069
0.125728
0
0.773931
0
0
0.103189
0.032937
0
0
0
0
0
0
null
null
0
0.016293
null
null
0.06721
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
19684d9e9898830d618f09c4120803a5e3dff40a
352
py
Python
ocdskingfisher/sources/digiwhist_sweden.py
odscjames/lhs-alpha
d882cadfcf3464fd29529cb862567dc311d892e2
[ "BSD-3-Clause" ]
null
null
null
ocdskingfisher/sources/digiwhist_sweden.py
odscjames/lhs-alpha
d882cadfcf3464fd29529cb862567dc311d892e2
[ "BSD-3-Clause" ]
null
null
null
ocdskingfisher/sources/digiwhist_sweden.py
odscjames/lhs-alpha
d882cadfcf3464fd29529cb862567dc311d892e2
[ "BSD-3-Clause" ]
null
null
null
from ocdskingfisher.sources.digiwhist_base import DigiwhistBaseSource class DigiwhistSwedenRepublicSource(DigiwhistBaseSource): publisher_name = 'Digiwhist Sweden' url = 'https://opentender.eu/download' source_id = 'digiwhist_sweden' def get_data_url(self): return 'https://opentender.eu/data/files/SE_ocds_data.json.tar.gz'
32
74
0.769886
40
352
6.575
0.75
0.114068
0.129278
0
0
0
0
0
0
0
0
0
0.133523
352
10
75
35.2
0.862295
0
0
0
0
0
0.338068
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0.142857
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
196990a27ac0854fd557313280f98453d24dd4e0
435
py
Python
third/cli_google_fire.py
gottaegbert/penter
8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d
[ "MIT" ]
13
2020-01-04T07:37:38.000Z
2021-08-31T05:19:58.000Z
third/cli_google_fire.py
gottaegbert/penter
8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d
[ "MIT" ]
3
2020-06-05T22:42:53.000Z
2020-08-24T07:18:54.000Z
third/cli_google_fire.py
gottaegbert/penter
8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d
[ "MIT" ]
9
2020-10-19T04:53:06.000Z
2021-08-31T05:20:01.000Z
import fire def hello(name="World"): return "Hello %s!" % name if __name__ == '__main__': fire.Fire(hello) """ [Google 开源的 Python 命令行库:深入 fire(二)](https://mp.weixin.qq.com/s?__biz=MzA5MzYyNzQ0MQ==&mid=2247485006&idx=1&sn=d80725f349677658bff372bfc770e1de) https://github.com/google/python-fire python hello.py # Hello World! python hello.py --name=David # Hello David! python hello.py --help # Shows usage information. """
22.894737
143
0.717241
62
435
4.870968
0.580645
0.109272
0.129139
0
0
0
0
0
0
0
0
0.089005
0.121839
435
18
144
24.166667
0.701571
0
0
0
0
0
0.191304
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
196bd4945ce188e9357acd55ca1172b34997c1a7
24,336
py
Python
usienarl/agent.py
InsaneMonster/USienaRL
95eb35913b448c970b83ab941a24657156cfcd9b
[ "BSD-3-Clause" ]
6
2019-08-24T08:40:09.000Z
2020-05-20T10:54:26.000Z
usienarl/agent.py
InsaneMonster/USienaRL
95eb35913b448c970b83ab941a24657156cfcd9b
[ "BSD-3-Clause" ]
null
null
null
usienarl/agent.py
InsaneMonster/USienaRL
95eb35913b448c970b83ab941a24657156cfcd9b
[ "BSD-3-Clause" ]
null
null
null
# # Copyright (C) 2019 Luca Pasqualini # University of Siena - Artificial Intelligence Laboratory - SAILab # # # USienaRL is licensed under a BSD 3-Clause. # # You should have received a copy of the license along with this # work. If not, see <https://opensource.org/licenses/BSD-3-Clause>. # Import packages import logging import tensorflow import numpy # Import required src from usienarl import Interface, SpaceType class Agent: """ Base agent abstract class. An agent defines who or what operates in a certain environment during a certain experiment. An agent can act and being updated, but the inner working (model, policies and so on) are left to be decided by the implementation. An agent needs to be generated before running, and generation is done when executing agent setup. Any agent can act in three different modes: - warmup mode, before training (not all agents required that, it depends on the agent inner model) - train mode, during training - inference mode, when exploiting One or more policies can be defined for each one of these modes. To define your own agent, implement the abstract class in a specific child class. """ def __init__(self, name: str): # Define internal attributes self._name: str = name # Define empty attributes self._saver = None self._scope: str or None = None self._summary_writer = None self._parallel: int or None = None self._summary_path: str or None = None self._save_path: str or None = None self._saves_to_keep: int or None = None self._observation_space_type: SpaceType or None = None self._observation_space_shape = None self._agent_action_space_type: SpaceType or None = None self._agent_action_space_shape = None self._save_counter: int or None = None def setup(self, logger: logging.Logger, scope: str, parallel: int, observation_space_type: SpaceType, observation_space_shape: (), agent_action_space_type: SpaceType, agent_action_space_shape: (), summary_path: str = None, save_path: str = None, saves_to_keep: int = 0) -> bool: """ Setup the agent, preparing all its components for execution. :param logger: the logger used to print the agent information, warnings and errors :param scope: the experiment scope encompassing the agent scope :param parallel: the amount of parallel episodes run by the experiment, must be greater than zero :param observation_space_type: the space type of the observation space :param observation_space_shape: the shape of the observation space, as a tuple :param agent_action_space_type: the space type of the agent action space :param agent_action_space_shape: the shape of the agent action space, as a tuple :param summary_path: the optional path of the summary writer of the agent :param save_path: the optional path where to save metagraphs checkpoints of the agent's model :param saves_to_keep: the optional number of checkpoint saves to keep, it does nothing if there is no save path :return: True if setup is successful, False otherwise """ # Make sure parameters are correct assert(parallel > 0 and saves_to_keep >= 0) logger.info("Setup of agent " + self._name + " with scope " + scope + "...") # Reset agent attributes self._scope = scope self._parallel = parallel self._summary_path = summary_path self._save_path = save_path self._saves_to_keep = saves_to_keep self._observation_space_type: SpaceType = observation_space_type self._observation_space_shape = observation_space_shape self._agent_action_space_type: SpaceType = agent_action_space_type self._agent_action_space_shape = agent_action_space_shape # Try to generate the agent inner model if not self._generate(logger, observation_space_type, observation_space_shape, agent_action_space_type, agent_action_space_shape): return False # Define the summary writer if required if summary_path is not None: self._summary_writer = tensorflow.summary.FileWriter(summary_path, graph=tensorflow.get_default_graph()) logger.info("A Tensorboard summary for the agent will be updated during training of its internal model") logger.info("Tensorboard summary path: " + summary_path) # Define the saver if required if self._save_path is not None and self._save_path and self._saves_to_keep > 0: self._saver = tensorflow.train.Saver(self.saved_variables, max_to_keep=self._saves_to_keep) if self._saves_to_keep > 1: logger.info("Agent model metagraph will be saved after each training/validation pair. A set of " + str(self._saves_to_keep) + " models will be stored.") else: logger.info("Agent model metagraph will be saved after each training/validation pair") logger.info("Agent model metagraphs are saved at " + self._save_path) self._save_counter: int = 0 # Validate setup return True def restore(self, logger: logging.Logger, session, path: str) -> bool: """ Restore the agent's model from the checkpoint at the given path. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param path: the path from which to restore, it is required :return: True if restore is successful, false otherwise """ # Make sure parameters are correct assert(path is not None and path) # Get checkpoint from path checkpoint = tensorflow.train.get_checkpoint_state(path) # If no saver is defined, define one to restore from checkpoint if self._saver is None: self._saver = tensorflow.train.Saver(self.saved_variables) # If checkpoint exists restore from checkpoint if checkpoint and checkpoint.model_checkpoint_path: self._saver.restore(session, tensorflow.train.latest_checkpoint(path)) logger.info("Model graph stored at " + path + " loaded successfully!") return True logger.error("Checkpoint path specified is wrong: no model can be accessed at " + path) return False def save(self, logger: logging.Logger, session): """ Save the agent's model metagraph. It does nothing if a saver is not defined. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running """ # Check if the saver exists or something has to be saved if self._saver is None or self._save_path is None or not self._save_path or self._saves_to_keep <= 0: return logger.info("Saving the agent " + self._name + " metagraph at path " + self._save_path + "...") self._saver.save(session, self._save_path, self._save_counter) self._save_counter += 1 logger.info("Agent " + self._name + " metagraph saved successfully") def _generate(self, logger: logging.Logger, observation_space_type: SpaceType, observation_space_shape: (), agent_action_space_type: SpaceType, agent_action_space_shape: ()) -> bool: """ Generate the agent's model. Used to generate all custom components of the agent. It is always called during setup. :param logger: the logger used to print the agent information, warnings and errors :param observation_space_type: the space type of the observation space :param observation_space_shape: the shape of the observation space, as a tuple :param agent_action_space_type: the space type of the agent action space :param agent_action_space_shape: the shape of the agent action space, as a tuple :return: True if setup is successful, False otherwise """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def initialize(self, logger: logging.Logger, session): """ Initialize the agent before acting in the environment. The environment at this stage is already initialized. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def act_warmup(self, logger: logging.Logger, session, interface: Interface, agent_observation_current: numpy.ndarray, warmup_step: int, warmup_episode: int) -> numpy.ndarray: """ Take an action given the current agent observation in warmup mode. Usually it uses a random policy. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param interface: the interface between the agent and the environment :param agent_observation_current: the current observation of the agent wrapped in a numpy array :param warmup_step: the current absolute warm-up step of the experiment the agent is warming-up into :param warmup_episode: the current absolute warm-up episode of the experiment the agent is warming-up into :return: the action decided by the agent wrapped in a numpy array """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def act_train(self, logger: logging.Logger, session, interface: Interface, agent_observation_current: numpy.ndarray, train_step: int, train_episode: int) -> numpy.ndarray: """ Take an action given the current agent observation in train mode. Usually it uses an exploring policy. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param interface: the interface between the agent and the environment :param agent_observation_current: the current observation of the agent wrapped in a numpy array :param train_step: the current absolute train step of the experiment the agent is training into :param train_episode: the current absolute train episode of the experiment the agent is training into :return: the action decided by the agent wrapped in a numpy array """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def act_inference(self, logger: logging.Logger, session, interface: Interface, agent_observation_current: numpy.ndarray, inference_step: int, inference_episode: int) -> numpy.ndarray: """ Take an action given the current agent observation in validation/test mode. Usually it uses the best possible policy. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param interface: the interface between the agent and the environment :param agent_observation_current: the current observation of the agent wrapped in a numpy array :param inference_step: the current absolute validation/test step of the experiment the agent is executing into :param inference_episode: the current absolute validation/test episode of the experiment the agent is executing into :return: the action decided by the agent wrapped in a numpy array """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def complete_step_warmup(self, logger: logging.Logger, session, interface: Interface, agent_observation_current: numpy.ndarray, agent_action: numpy.ndarray, reward: numpy.ndarray, episode_done: numpy.ndarray, agent_observation_next: numpy.ndarray, warmup_step: int, warmup_episode: int): """ Complete a warm-up step. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param interface: the interface between the agent and the environment :param agent_observation_current: the current observation of the agent wrapped in a numpy array :param agent_action: the action taken in the environment as seen by the agent leading from the current observation to the next observation wrapped in a numpy array :param reward: the reward obtained by the combination of current observation, next observation and action in-between wrapped in a numpy array :param episode_done: the episode done flag raised by the environment wrapped in a numpy array :param agent_observation_next: the next observation of the agent wrapped in a numpy array :param warmup_step: the current absolute warm-up step of the experiment the agent is warming-up into :param warmup_episode: the current absolute warm-up episode of the experiment the agent is warming-up into """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def complete_step_train(self, logger: logging.Logger, session, interface: Interface, agent_observation_current: numpy.ndarray, agent_action: numpy.ndarray, reward: numpy.ndarray, episode_done: numpy.ndarray, agent_observation_next: numpy.ndarray, train_step: int, train_episode: int): """ Complete a train step. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param interface: the interface between the agent and the environment :param agent_observation_current: the current observation of the agent wrapped in a numpy array :param agent_action: the action taken in the environment as seen by the agent leading from the current observation to the next observation wrapped in a numpy array :param reward: the reward obtained by the combination of current observation, next observation and action in-between wrapped in a numpy array :param episode_done: the episode done flag raised by the environment wrapped in a numpy array :param agent_observation_next: the next observation of the agent wrapped in a numpy array :param train_step: the current absolute train step of the experiment the agent is training into :param train_episode: the current absolute train episode of the experiment the agent is training into """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def complete_step_inference(self, logger: logging.Logger, session, interface: Interface, agent_observation_current: numpy.ndarray, agent_action: numpy.ndarray, reward: numpy.ndarray, episode_done: numpy.ndarray, agent_observation_next: numpy.ndarray, inference_step: int, inference_episode: int): """ Complete an validation/test step.. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param interface: the interface between the agent and the environment :param agent_observation_current: the current observation of the agent :param agent_action: the action taken in the environment as seen by the agent leading from the current observation to the next observation :param reward: the reward obtained by the combination of current observation, next observation and action in-between :param episode_done: the episode done flag raised by the environment wrapped in a numpy array :param agent_observation_next: the next observation of the agent :param inference_step: the current absolute validation/test step of the experiment the agent is executing into :param inference_episode: the current absolute validation/test episode of the experiment the agent is executing into """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def complete_episode_warmup(self, logger: logging.Logger, session, interface: Interface, last_step_reward: numpy.ndarray, episode_total_reward: numpy.ndarray, warmup_step: int, warmup_episode: int): """ Finish a warm-up episode. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param interface: the interface between the agent and the environment wrapped in a numpy array :param last_step_reward: the reward obtained in the last step in the passed episode wrapped in a numpy array wrapped in a numpy array :param episode_total_reward: the reward obtained in the passed episode wrapped in a numpy array :param warmup_step: the current absolute warm-up step of the experiment the agent is warming-up into :param warmup_episode: the current absolute warm-up episode of the experiment the agent is warming-up into """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def complete_episode_train(self, logger: logging.Logger, session, interface: Interface, last_step_reward: numpy.ndarray, episode_total_reward: numpy.ndarray, train_step: int, train_episode: int): """ Finish a train episode. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param interface: the interface between the agent and the environment :param last_step_reward: the reward obtained in the last step in the passed episode wrapped in a numpy array :param episode_total_reward: the reward obtained in the passed episode wrapped in a numpy array :param train_step: the current absolute train step of the experiment the agent is training into :param train_episode: the current absolute train episode of the experiment the agent is training into """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() def complete_episode_inference(self, logger: logging.Logger, session, interface: Interface, last_step_reward: numpy.ndarray, episode_total_reward: numpy.ndarray, inference_step: int, inference_episode: int): """ Finish an validation/test episode. :param logger: the logger used to print the agent information, warnings and errors :param session: the session of tensorflow currently running :param interface: the interface between the agent and the environment :param last_step_reward: the reward obtained in the last step in the passed episode wrapped in a numpy array :param episode_total_reward: the reward obtained in the passed episode wrapped in a numpy array :param inference_step: the current absolute validation/test step of the experiment the agent is executing into :param inference_episode: the current absolute validation/test episode of the experiment the agent is executing into """ # Abstract method, it should be implemented on a child class basis raise NotImplementedError() @property def name(self) -> str: """ The name of the agent. """ return self._name @property def scope(self) -> str or None: """ The scope of the agent. It is None if agent is not setup. """ return self._scope @property def parallel(self) -> int or None: """ The number of parallel episodes run by the agent. It is None if agent is not setup. """ return self._parallel @property def observation_space_type(self) -> SpaceType or None: """ The type of the observation space of the agent. It is None if agent is not setup. """ return self._observation_space_type @property def observation_space_shape(self) -> () or None: """ The shape of the observation space of the agent. Note: it may differ from the environment's state space shape. It is None if agent is not setup. """ return self._observation_space_shape @property def action_space_type(self) -> SpaceType or None: """ The type of the action space of the agent. It is None if agent is not setup. """ return self._agent_action_space_type @property def action_space_shape(self) -> () or None: """ The shape of the action space of the agent. Note: it may differ from the environment's action space shape. It is None if agent is not setup. """ return self._agent_action_space_shape @property def summary_path(self) -> str or None: """ The path of the Tensorboard summaries saved by the agent. It is None if agent is not setup. """ return self._summary_path @property def save_path(self) -> str or None: """ The path of the checkpoint metagraph saves of the agent. It is None if agent is not setup. """ return self._save_path @property def saved_variables(self): """ The trainable variables of the agent (usually of its model). """ # Abstract property, it should be implemented on a child class basis raise NotImplementedError() @property def warmup_steps(self) -> int: """ The integer number of warm-up steps required by the agent. """ # Abstract property, it should be implemented on a child class basis raise NotImplementedError()
49.971253
171
0.648011
3,026
24,336
5.096497
0.094184
0.043574
0.016211
0.024316
0.735054
0.712164
0.696084
0.68707
0.655816
0.647776
0
0.000826
0.303296
24,336
486
172
50.074074
0.908758
0.520587
0
0.479798
0
0
0.053246
0
0
0
0
0
0.010101
1
0.131313
false
0
0.020202
0
0.227273
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
1973d94ae13916a5ea183c5b5c9aacba852b10f8
1,096
py
Python
deeppages/middleware.py
ricardofalasca/deep-pages
d1b2a48f62c31e20d767df5c6345e07e4d05290d
[ "MIT" ]
null
null
null
deeppages/middleware.py
ricardofalasca/deep-pages
d1b2a48f62c31e20d767df5c6345e07e4d05290d
[ "MIT" ]
null
null
null
deeppages/middleware.py
ricardofalasca/deep-pages
d1b2a48f62c31e20d767df5c6345e07e4d05290d
[ "MIT" ]
null
null
null
from django.utils.deprecation import MiddlewareMixin from django.http.response import HttpResponse from .utils import get_page_by_path import logging logger = logging.getLogger(__name__) class DeepPageTemplateRendererMiddleware(MiddlewareMixin): ''' The goal of this middleware is find the respective page by URL, render the page content and return it. ''' # TODO: check where is accessing request.POST/body and change the code. # Also, create all possible tests before push new version. Maybe this # should be a version bump to 1.0-stable. def process_request(self, request): ''' Look for Deep Page's PATH pattern and return a rendered template ''' # DeepPages must work ONLY if actual response has status_code == 404 # (Not found). Otherwise, there is no reason to interfere into normal # page response behavior. if self.get_response(request).status_code == 404: rendered_page = get_page_by_path(self, request, logger) if rendered_page: return HttpResponse(rendered_page)
37.793103
78
0.709854
145
1,096
5.248276
0.613793
0.023653
0.023653
0.034166
0
0
0
0
0
0
0
0.009456
0.228102
1,096
28
79
39.142857
0.890071
0.468978
0
0
0
0
0
0
0
0
0
0.035714
0
1
0.090909
false
0
0.363636
0
0.636364
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
2
197a53a0aa02af4926fb9d08fe34627f24605d90
2,219
py
Python
mqttany/modules/gpio/pin/__init__.py
itonelove/mqttany
2f5d7ea82f1fbcc6cdf7e6095ef51781429acabc
[ "MIT" ]
8
2019-09-14T18:49:20.000Z
2021-10-02T15:50:39.000Z
mqttany/modules/gpio/pin/__init__.py
itonelove/mqttany
2f5d7ea82f1fbcc6cdf7e6095ef51781429acabc
[ "MIT" ]
54
2019-08-25T21:04:03.000Z
2022-03-08T10:32:24.000Z
mqttany/modules/gpio/pin/__init__.py
itonelove/mqttany
2f5d7ea82f1fbcc6cdf7e6095ef51781429acabc
[ "MIT" ]
5
2019-09-21T06:58:15.000Z
2021-11-09T19:20:35.000Z
""" ******** GPIO Pin ******** :Author: Michael Murton """ # Copyright (c) 2019-2021 MQTTany contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import typing as t from collections import OrderedDict from common import update_dict from gpio.common import PinMode from . import counter, digital from .base import Pin __all__ = ["getPin", "updateConfOptions"] def getPin(pin_mode: t.Union[PinMode, str]) -> t.Union[t.Type[Pin], None]: """ Returns a class for the pin based on the pin mode or ``None`` if one is not available. """ pin_classes: t.Dict[t.Union[PinMode, str], t.Type[Pin]] = {} pin_classes.update(digital.SUPPORTED_PIN_MODES) pin_classes.update(counter.SUPPORTED_PIN_MODES) return pin_classes.get(pin_mode, None) def updateConfOptions( conf_options: t.MutableMapping[str, t.Dict[t.Any, t.Any]] ) -> "OrderedDict[str, t.Dict[t.Any, t.Any]]": """ Returns a copy of ``conf_options`` updated with options from each pin type. """ conf_options = update_dict(conf_options, digital.CONF_OPTIONS) conf_options = update_dict(conf_options, counter.CONF_OPTIONS) return t.cast("OrderedDict[str, t.Dict[t.Any, t.Any]]", conf_options)
36.983333
80
0.739522
332
2,219
4.864458
0.418675
0.0613
0.014861
0.016718
0.104025
0.082972
0.043344
0.033437
0
0
0
0.004324
0.166291
2,219
59
81
37.610169
0.868649
0.577287
0
0
0
0
0.112756
0
0
0
0
0
0
1
0.111111
false
0
0.333333
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
19802a6f35a61c09629b8696f5834fa4bf7861a2
2,852
py
Python
test/test_ddna.py
Aayush9029/DDNA
82e461fe6f8d578b2f9cc8fc073a8a4812490ad1
[ "MIT" ]
null
null
null
test/test_ddna.py
Aayush9029/DDNA
82e461fe6f8d578b2f9cc8fc073a8a4812490ad1
[ "MIT" ]
null
null
null
test/test_ddna.py
Aayush9029/DDNA
82e461fe6f8d578b2f9cc8fc073a8a4812490ad1
[ "MIT" ]
null
null
null
# pylint: skip-file import random import string import pytest from ddna import DDNA from helpers.utils import convert_to_bits, convert_to_string ddna = DDNA() def generate_random_strings(): """ Generates 100 random strings of length between 1 and 500. Example: rdF66~-C-!~!}8gh3;2aRL=b].(,K?GE.]"YEb)]M02H>gA Example: '1wWq;gRRXM1)rGMg1a$i2%>Zl]6Obx"K2v """ for _ in range(100): yield ''.join(random.choice(string.ascii_letters + string.digits + string.punctuation) for _ in range(random.randint(1, 500))) def generate_invalid_dna(): """ Generates 50 invalid dna sequences. eg: adasdsa eg: ACTG1234 eg: 32SDIk2... """ for _ in range(50): yield "".join(random.choice(string.ascii_letters) for _ in range(random.randint(1, 500))) # array of random strings random_strings = list(generate_random_strings()) # Testing validity of the generated strings (OP) @pytest.mark.parametrize("random_string", random_strings) def test_random_string(random_string): """ Test that the random string is a string. """ assert isinstance(random_string, str) # Converting strings to DNA Bases dna_bases = [ddna.encode(random_string) for random_string in random_strings] # converting dna_bases back to strings strings = [ddna.decode(dna_base) for dna_base in dna_bases] # loop throught the list of strings and compare them to the original strings using pytest.mark.parametrize @pytest.mark.parametrize("random_string, dna_base, string", zip(random_strings, dna_bases, strings)) def test_convert_to_bits(random_string, dna_base, string): """ Test that the converted DNA bases are equal to the original strings. """ assert random_string == string # loop through the list of random strings and convert them to bits bits = [convert_to_bits(random_string) for random_string in random_strings] # loop through the list of bits and convert them to strings strings = [convert_to_string(bit) for bit in bits] # loop through the list of strings and compare them to the original strings using pytest.mark.parametrize @pytest.mark.parametrize("random_string, bit, string", zip(random_strings, bits, strings)) def test_convert_to_string(random_string, bit, string): """ Test that the converted bits are equal to the original strings. """ assert random_string == string # Testing valid dna function def test_valid_dna_1(): """ Test that the valid dna function returns True for valid dna sequences. """ assert ddna.check_validity("ACGT") # Testing invalid dna function using loop @pytest.mark.parametrize("invalid_dna", generate_invalid_dna()) def test_invalid_dna_looped(invalid_dna): """ Test that the invalid dna function returns False for invalid dna sequences. """ assert not ddna.check_validity(invalid_dna)
29.102041
134
0.734923
410
2,852
4.946341
0.256098
0.088757
0.06213
0.039448
0.379191
0.265286
0.265286
0.200197
0.158777
0.158777
0
0.018236
0.173212
2,852
97
135
29.402062
0.841815
0.390954
0
0.064516
1
0
0.053092
0
0
0
0
0
0.16129
1
0.225806
false
0
0.16129
0
0.387097
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
19a79749d93001a3043834cfbae60265259d87a6
1,823
py
Python
GeneralPythonCodes/Xtra_UnitTestingPythonCode/test_division.py
d1p013/testing
5cb810d9d3d43a70f677b3e71e386a177bfa99a0
[ "CC-BY-3.0" ]
null
null
null
GeneralPythonCodes/Xtra_UnitTestingPythonCode/test_division.py
d1p013/testing
5cb810d9d3d43a70f677b3e71e386a177bfa99a0
[ "CC-BY-3.0" ]
null
null
null
GeneralPythonCodes/Xtra_UnitTestingPythonCode/test_division.py
d1p013/testing
5cb810d9d3d43a70f677b3e71e386a177bfa99a0
[ "CC-BY-3.0" ]
null
null
null
# =========================================================================== # # Unit Test for the division Module, created by Sourav Sen Gupta. # =========================================================================== # # Import unittest and the module to test import unittest import division # =========================================================================== # # Create a Class to unittest the module # Inherit from unittest.TestCase class class TestSomeFunctions(unittest.TestCase): ''' Unit Test class for the module ''' # Methods to test module functions def test_naive(self): ''' unittest method ''' self.assertEqual(division.naive(10,2), 5) self.assertEqual(division.naive(10,10), 1) self.assertEqual(division.naive(10,100), 0.1) self.assertAlmostEqual(division.naive(10,3), 3.3333333) def test_safe(self): ''' unittest method ''' self.assertEqual(division.safe(10,2), 5) self.assertEqual(division.safe(10,10), 1) self.assertEqual(division.safe(10,100), 0.1) self.assertAlmostEqual(division.safe(10,3), 3.3333333) self.assertEqual(division.safe(10,0), float("inf")) def test_correct(self): ''' unittest method ''' self.assertEqual(division.correct(10,2), 5) self.assertEqual(division.correct(10,10), 1) self.assertEqual(division.correct(10,100), 0.1) self.assertAlmostEqual(division.correct(10,3), 3.3333333) self.assertRaises(ValueError, division.correct, 10, 0) # =========================================================================== # # Run unittest when the script runs if __name__ == "__main__": unittest.main() # =========================================================================== #
35.745098
79
0.514536
183
1,823
5.065574
0.278689
0.161812
0.248112
0.116505
0.538296
0.427184
0.116505
0
0
0
0
0.058077
0.178278
1,823
50
80
36.46
0.560748
0.405924
0
0
0
0
0.010557
0
0
0
0
0
0.636364
1
0.136364
false
0
0.090909
0
0.272727
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
2
19af7665be7802309de5cf89bf0110afd85d263a
682
py
Python
member/models.py
constellation-project/constellation
7208ffe9b8a40e98100ebbd2f173cf99f39b5c1e
[ "BSD-3-Clause" ]
1
2019-12-21T17:52:28.000Z
2019-12-21T17:52:28.000Z
member/models.py
constellation-project/constellation
7208ffe9b8a40e98100ebbd2f173cf99f39b5c1e
[ "BSD-3-Clause" ]
null
null
null
member/models.py
constellation-project/constellation
7208ffe9b8a40e98100ebbd2f173cf99f39b5c1e
[ "BSD-3-Clause" ]
null
null
null
from django.contrib.auth.models import User from django.db import models class Member(User): address = models.CharField(max_length=255) telephone = models.CharField(max_length=31) class Organization(User): address = models.CharField(max_length=255) manager = models.ForeignKey(Member, on_delete=models.PROTECT, related_name='organizations') members = models.ManyToManyField(Member) class Administrator(Member): pgp = models.CharField(max_length=40) class Membership(models.Model): member = models.ForeignKey(Member, on_delete=models.PROTECT, related_name='memberships') date_start = models.DateField() date_end = models.DateField(null=True)
32.47619
95
0.765396
85
682
6.023529
0.470588
0.117188
0.140625
0.1875
0.359375
0.359375
0.359375
0.210938
0.210938
0
0
0.016835
0.129032
682
20
96
34.1
0.845118
0
0
0.133333
0
0
0.035191
0
0
0
0
0
0
1
0
false
0
0.133333
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
5ff89d4526b1bc1aa277cc88322283f4c83aba9b
894
py
Python
euler-297.py
simonolander/euler
4d7c4cd9333201cd0065419a511f111b6d75d90c
[ "MIT" ]
null
null
null
euler-297.py
simonolander/euler
4d7c4cd9333201cd0065419a511f111b6d75d90c
[ "MIT" ]
null
null
null
euler-297.py
simonolander/euler
4d7c4cd9333201cd0065419a511f111b6d75d90c
[ "MIT" ]
null
null
null
max_n = 10**17 fibs = [ (1, 1), (2, 1), ] while fibs[-1][0] < max_n: fibs.append( (fibs[-1][0] + fibs[-2][0], fibs[-1][1] + fibs[-2][1]) ) print(fibs) counts = [ 1, 1 ] for i in range(2, len(fibs)): fib = fibs[i] counts.append(fib[1] + sum(counts[j] for j in range(i - 1))) print(counts) def count(n): smallest_over_index = 0 smallest_over = fibs[smallest_over_index][0] while smallest_over < n: smallest_over_index += 1 smallest_over = fibs[smallest_over_index][0] if smallest_over == n + 1: return sum(counts[i] for i in range(smallest_over_index)) if smallest_over == n: return 1 + count(n - 1) smallest_under = fibs[smallest_over_index - 1][0] return sum(counts[i] for i in range(smallest_over_index - 1)) + count(n - smallest_under) + n - smallest_under print(count(10**17) - 1)
21.285714
114
0.595078
145
894
3.503448
0.193103
0.283465
0.234252
0.064961
0.307087
0.307087
0.307087
0.173228
0.173228
0.173228
0
0.056548
0.248322
894
41
115
21.804878
0.699405
0
0
0.064516
0
0
0
0
0
0
0
0
0
1
0.032258
false
0
0
0
0.129032
0.096774
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
270a9d8419653f66a834d1d865ffdb09e38880b7
303
py
Python
weather/weather.py
marinajacks/reptilian
990cb371a551164828ad40e57df74ebdf5ebf25e
[ "MIT" ]
null
null
null
weather/weather.py
marinajacks/reptilian
990cb371a551164828ad40e57df74ebdf5ebf25e
[ "MIT" ]
null
null
null
weather/weather.py
marinajacks/reptilian
990cb371a551164828ad40e57df74ebdf5ebf25e
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 19 14:25:43 2018 @author: macbook 本项目主要是为了获取到全国的天气数据,并将这些数据存储到数据库 或者是txt中,考虑到存储在txt中实际上后续还需要做相关的调整,暂 时的处理思路就是将数据存储在数据库中 """ import requests from bs4 import BeautifulSoup if __name__== "__main__": print("hello world")
11.653846
35
0.722772
36
303
5.861111
0.972222
0
0
0
0
0
0
0
0
0
0
0.058824
0.158416
303
26
36
11.653846
0.768627
0.60396
0
0
0
0
0.169643
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.25
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
271408f3c1850e6c8d1ab38a4556369f70243b66
284
py
Python
run_eureka.py
ers-transit/hackathon-2021-day2
b163fe87d2cb32e3c1592bdd829d27aa315be4aa
[ "MIT" ]
1
2021-07-06T17:57:46.000Z
2021-07-06T17:57:46.000Z
run_eureka.py
ers-transit/hackathon-2021-day2
b163fe87d2cb32e3c1592bdd829d27aa315be4aa
[ "MIT" ]
null
null
null
run_eureka.py
ers-transit/hackathon-2021-day2
b163fe87d2cb32e3c1592bdd829d27aa315be4aa
[ "MIT" ]
1
2021-06-23T16:28:44.000Z
2021-06-23T16:28:44.000Z
import sys, os, time from importlib import reload import eureka.S3_data_reduction.s3_reduce as s3 import eureka.S4_generate_lightcurves.s4_genLC as s4 eventlabel = 'wasp43b' reload(s3) ev3 = s3.reduceJWST(eventlabel) reload(s4) ev4 = s4.lcJWST(ev3.eventlabel, ev3.workdir, md=ev3)
21.846154
52
0.795775
45
284
4.888889
0.555556
0.109091
0
0
0
0
0
0
0
0
0
0.06746
0.112676
284
12
53
23.666667
0.805556
0
0
0
1
0
0.024648
0
0
0
0
0
0
1
0
false
0
0.444444
0
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
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
271bd4c4589084c4948537378af09735a6bb3f9a
1,311
py
Python
nertivia4py/utils/member.py
bentettmar/nertivia4py
a9b758000632e40306bc610a6966cb8d0a643c20
[ "MIT" ]
3
2022-01-24T16:31:20.000Z
2022-02-03T22:44:51.000Z
nertivia4py/utils/member.py
bentettmar/nertivia4py
a9b758000632e40306bc610a6966cb8d0a643c20
[ "MIT" ]
9
2022-03-05T19:01:48.000Z
2022-03-06T11:38:53.000Z
nertivia4py/utils/member.py
bentettmar/nertivia4py
a9b758000632e40306bc610a6966cb8d0a643c20
[ "MIT" ]
null
null
null
from . import server from . import user class Member: """ Nertivia Member The same as user.User but has ban and kick functions. Attributes: - id (int): The ID of the member. - username (str): The username of the member. - tag (str): The tag of the member. - avatar (str): The avatar of the member. - type (str): The type of the member. - server_id (int): The ID of the server the member is in. """ def __init__(self, id, username="", tag="", avatar="", type="", server_id="") -> None: self.id = id self.username = username self.tag = tag self.avatar = avatar self.type = type self.server_id = server_id def __str__(self) -> str: return f"{self.username}:{self.tag}" def ban(self): """ Bans the member. Returns: - bool: Whether the member was banned or not. """ server2 = server.Server(self.server_id) return server2.ban_member(user.User(self.id, self.username, self.tag, self.avatar)) def kick(self): """ Kicks the member. Returns: - bool: Whether the member was kicked or not. """ server2 = server.Server(self.server_id) return server2.ban_member(user.User(self.id, self.username, self.tag, self.avatar))
26.755102
92
0.600305
180
1,311
4.283333
0.244444
0.116732
0.071336
0.07393
0.402075
0.402075
0.363165
0.363165
0.261997
0.261997
0
0.004233
0.279176
1,311
49
93
26.755102
0.81164
0.3791
0
0.222222
0
0
0.035183
0.035183
0
0
0
0
0
1
0.222222
false
0
0.111111
0.055556
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
27353695822d906477e008ab8b77fc0671f47c83
251
py
Python
Problem/util/repair/timeUtility.py
m-arnao-molina/SCA-QL-SARSA
65f859fce96bb8c11509238c2f7a5d8dd2ad042a
[ "MIT" ]
null
null
null
Problem/util/repair/timeUtility.py
m-arnao-molina/SCA-QL-SARSA
65f859fce96bb8c11509238c2f7a5d8dd2ad042a
[ "MIT" ]
null
null
null
Problem/util/repair/timeUtility.py
m-arnao-molina/SCA-QL-SARSA
65f859fce96bb8c11509238c2f7a5d8dd2ad042a
[ "MIT" ]
null
null
null
__author__ = 'INVESTIGACION' import datetime, time def obtieneTime(): ts = time.time() st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S.%f') return st def minusSet(x,y): x_y = list(set(x) - set(y)) return x_y
20.916667
77
0.629482
39
251
3.897436
0.564103
0.039474
0
0
0
0
0
0
0
0
0
0
0.191235
251
12
78
20.916667
0.748768
0
0
0
0
0
0.130952
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
2763de4f28594ffcf433b6e74345cd8b96baaeb4
945
py
Python
notebook/numpy_block.py
vhn0912/python-snippets
80b2e1d6b2b8f12ae30d6dbe86d25bb2b3a02038
[ "MIT" ]
174
2018-05-30T21:14:50.000Z
2022-03-25T07:59:37.000Z
notebook/numpy_block.py
vhn0912/python-snippets
80b2e1d6b2b8f12ae30d6dbe86d25bb2b3a02038
[ "MIT" ]
5
2019-08-10T03:22:02.000Z
2021-07-12T20:31:17.000Z
notebook/numpy_block.py
vhn0912/python-snippets
80b2e1d6b2b8f12ae30d6dbe86d25bb2b3a02038
[ "MIT" ]
53
2018-04-27T05:26:35.000Z
2022-03-25T07:59:37.000Z
import numpy as np a1 = np.ones((2, 3), int) print(a1) # [[1 1 1] # [1 1 1]] a2 = np.full((2, 3), 2) print(a2) # [[2 2 2] # [2 2 2]] print(np.block([a1, a2])) # [[1 1 1 2 2 2] # [1 1 1 2 2 2]] print(np.block([[a1], [a2]])) # [[1 1 1] # [1 1 1] # [2 2 2] # [2 2 2]] print(np.block([[a1, a2], [a2, a1]])) # [[1 1 1 2 2 2] # [1 1 1 2 2 2] # [2 2 2 1 1 1] # [2 2 2 1 1 1]] print(np.block([[[a1]], [[a2]]])) # [[[1 1 1] # [1 1 1]] # # [[2 2 2] # [2 2 2]]] print(np.block([[[a1]], [[a2]]]).shape) # (2, 2, 3) a3 = np.full(6, 3) print(a3) # [3 3 3 3 3 3] print(np.block([[a1, a2], [a3]])) # [[1 1 1 2 2 2] # [1 1 1 2 2 2] # [3 3 3 3 3 3]] # print(np.block([[a1, a2], a3])) # ValueError: List depths are mismatched. First element was at depth 2, but there is an element at depth 1 (arrays[1]) # print(np.block([[a1, a2, a3]])) # ValueError: all the input array dimensions except for the concatenation axis must match exactly
17.830189
118
0.511111
207
945
2.333333
0.21256
0.136646
0.136646
0.099379
0.519669
0.519669
0.505176
0.426501
0.426501
0.401656
0
0.190476
0.244444
945
52
119
18.173077
0.485994
0.589418
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.076923
0
0.076923
0.692308
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
277678b4414aee8aa346a7a450dbd1f621e7d88e
136
py
Python
tests/__init__.py
Rgcsh/pre-request
6b1b842ec25393de37399abad1f7ac127c6200be
[ "MIT" ]
86
2017-08-17T12:41:52.000Z
2022-02-24T12:17:47.000Z
tests/__init__.py
Rgcsh/pre-request
6b1b842ec25393de37399abad1f7ac127c6200be
[ "MIT" ]
10
2020-03-30T03:24:46.000Z
2022-02-23T01:34:53.000Z
tests/__init__.py
Rgcsh/pre-request
6b1b842ec25393de37399abad1f7ac127c6200be
[ "MIT" ]
7
2017-08-18T03:40:35.000Z
2020-05-19T04:09:10.000Z
# -*- coding: utf-8 -*- # (C) Wu Dong, 2018 # All rights reserved __author__ = 'Wu Dong <wudong@eastwu.cn>' __time__ = '2018/9/6 11:07'
22.666667
41
0.632353
22
136
3.545455
0.863636
0.153846
0
0
0
0
0
0
0
0
0
0.132743
0.169118
136
5
42
27.2
0.557522
0.433824
0
0
0
0
0.547945
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
27a7f092d874e3b2761d8f5f2b1ccc9a8debdefa
1,354
py
Python
tensorflow/contrib/tfprof/__init__.py
uve/tensorflow
e08079463bf43e5963acc41da1f57e95603f8080
[ "Apache-2.0" ]
6
2022-02-04T18:12:24.000Z
2022-03-21T23:57:12.000Z
Lib/site-packages/tensorflow/contrib/tfprof/__init__.py
shfkdroal/Robot-Learning-in-Mixed-Adversarial-and-Collaborative-Settings
1fa4cd6a566c8745f455fc3d2273208f21f88ced
[ "bzip2-1.0.6" ]
1
2021-05-20T00:58:04.000Z
2021-05-20T00:58:04.000Z
Lib/site-packages/tensorflow/contrib/tfprof/__init__.py
shfkdroal/Robot-Learning-in-Mixed-Adversarial-and-Collaborative-Settings
1fa4cd6a566c8745f455fc3d2273208f21f88ced
[ "bzip2-1.0.6" ]
1
2022-02-08T03:53:23.000Z
2022-02-08T03:53:23.000Z
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # 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. # ============================================================================== """tfprof is a tool that profile various aspect of TensorFlow model. @@model_analyzer @@tfprof_logger @@ProfileContext """ from __future__ import absolute_import from __future__ import division from __future__ import print_function # pylint: disable=unused-import from tensorflow.contrib.tfprof import model_analyzer from tensorflow.contrib.tfprof import tfprof_logger from tensorflow.contrib.tfprof.model_analyzer import ProfileContext from tensorflow.python.util.all_util import remove_undocumented _allowed_symbols = ['model_analyzer', 'tfprof_logger', 'ProfileContext'] remove_undocumented(__name__, _allowed_symbols)
36.594595
81
0.734121
171
1,354
5.625731
0.549708
0.06237
0.049896
0.0842
0.149688
0
0
0
0
0
0
0.006938
0.148449
1,354
36
82
37.611111
0.827407
0.597489
0
0
0
0
0.084016
0
0
0
0
0
0
1
0
false
0
0.777778
0
0.777778
0.111111
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
27aa51cbb95def4fc8257b31b16b73c0497d84df
1,181
py
Python
gryphon/lib/exchange/vault_of_satoshi.py
qiquanzhijia/gryphon
7bb2c646e638212bd1352feb1b5d21536a5b918d
[ "Apache-2.0" ]
1,109
2019-06-20T19:23:27.000Z
2022-03-20T14:03:43.000Z
gryphon/lib/exchange/vault_of_satoshi.py
qiquanzhijia/gryphon
7bb2c646e638212bd1352feb1b5d21536a5b918d
[ "Apache-2.0" ]
63
2019-06-21T05:36:17.000Z
2021-05-26T21:08:15.000Z
gryphon/lib/exchange/vault_of_satoshi.py
qiquanzhijia/gryphon
7bb2c646e638212bd1352feb1b5d21536a5b918d
[ "Apache-2.0" ]
181
2019-06-20T19:42:05.000Z
2022-03-21T13:05:13.000Z
# -*- coding: utf-8 -*- import time import os import datetime import requests import hmac import urllib import hashlib import base64 import json import math from cdecimal import * from delorean import Delorean from collections import OrderedDict from gryphon.lib.money import Money from gryphon.lib.models.datum import DatumRecorder from exchange_order import Order from gryphon.lib.exchange.consts import Consts from base import * from exceptions import * from gryphon.lib.models.exchange import Balance from gryphon.lib.logger import get_logger logger = get_logger(__name__) class VaultOfSatoshiExchange(Exchange): def __init__(self, session=None, currency=u"CAD", use_cached_orderbook=False): super(VaultOfSatoshiExchange, self).__init__(session) self.name = u'VAULTOFSATOSHI' self.friendly_name = u'Vault of Satoshi' self.base_url = 'https://api.vaultofsatoshi.com' self.currency = currency self.fee = Decimal("0") # assuming $99 unlimited account self.withdrawal_fee = Money("0.0005", "BTC") self.bid_string = "bid" self.ask_string = "ask" self.use_cached_orderbook = use_cached_orderbook
30.282051
82
0.747671
154
1,181
5.564935
0.461039
0.064177
0.08168
0.046674
0
0
0
0
0
0
0
0.011247
0.171888
1,181
38
83
31.078947
0.865031
0.04403
0
0
0
0
0.07016
0
0
0
0
0
0
1
0.029412
false
0
0.617647
0
0.676471
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
27b238fb2aa2109c697ac87edf6042f63b4dab57
1,529
py
Python
src/sales/models.py
brianl9995/payinv
7fc2160c2c9bbb9568a659ff3edf2526142d33fc
[ "MIT" ]
2
2019-09-21T23:36:49.000Z
2019-10-02T23:31:21.000Z
src/sales/models.py
brianl9995/payinv
7fc2160c2c9bbb9568a659ff3edf2526142d33fc
[ "MIT" ]
2
2019-10-04T13:51:43.000Z
2021-06-10T21:57:55.000Z
src/sales/models.py
brianl9995/payinv
7fc2160c2c9bbb9568a659ff3edf2526142d33fc
[ "MIT" ]
2
2019-10-02T23:31:22.000Z
2020-06-07T14:57:55.000Z
from django.db import models from utilities.models import DateTimedModel from customers.models import Customer from django.db.models import Sum from django.utils.translation import ugettext as _ from utilities.utils import csv_format from django.urls import reverse class Sale(DateTimedModel): internal_id = models.CharField(max_length=100) customer = models.ForeignKey(Customer) total_value = models.DecimalField( u'Total Value', default=0, null=True, max_digits=10, decimal_places=3) done_at = models.DateField() concept = models.CharField(max_length=100) notes = models.TextField(blank=True, null=True) def __unicode__(self): return "{} / {} ".format(self.internal_id, self.customer) def __str__(self): return "{} / {} ".format(self.internal_id, self.customer) def to_csv(self): return csv_format([ self.internal_id, self.customer, self.total_value, self.done_at, self.notes, self.total_invoices, self.total_payments ]) class Meta: verbose_name = _('Sale') def get_absolute_url(self): return reverse('sale', args=[self.pk]) @property def total_payments(self): return self.payment_set.all().aggregate( Sum('total_value'))['total_value__sum'] or 0 @property def total_invoices(self): return self.invoice_set.all().aggregate( Sum('total_value'))['total_value__sum'] or 0
28.849057
65
0.654676
187
1,529
5.128342
0.374332
0.072993
0.056309
0.062565
0.275287
0.218978
0.18561
0.18561
0.18561
0.091762
0
0.010345
0.241334
1,529
52
66
29.403846
0.816379
0
0
0.142857
0
0
0.058208
0
0
0
0
0
0
1
0.142857
false
0
0.166667
0.142857
0.642857
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
27b377a8209ece3c1c0f96d1112f7bb29096436f
1,019
py
Python
src/psiopic2/utils/archives/baseArchive.py
psiopic2/psiopic2
c2be97701f023f4396bb5d15e14e1ecc7a71d16b
[ "MIT" ]
null
null
null
src/psiopic2/utils/archives/baseArchive.py
psiopic2/psiopic2
c2be97701f023f4396bb5d15e14e1ecc7a71d16b
[ "MIT" ]
null
null
null
src/psiopic2/utils/archives/baseArchive.py
psiopic2/psiopic2
c2be97701f023f4396bb5d15e14e1ecc7a71d16b
[ "MIT" ]
null
null
null
import os class BaseArchiveInfo(object): def __init__(self, fileName, archiveName): self.fileName = fileName self.archiveName = archiveName def name(self): raise NotImplementedError def size(self): raise NotImplementedError def type(self): raise NotImplementedError class BaseArchive(object): def __init__(self, archiveFile): self.archiveFile = archiveFile self._archive = None def open(self, fileName): raise NotImplementedError() def getInfo(self, fileName): raise NotImplementedError() def check_file(self, fileName, targetDir=None): if targetDir: targetPath = os.path.normpath(os.path.realpath(targetDir)) else: targetPath = os.getcwd() extract_path = os.path.join(targetPath, src) extract_path = os.path.normpath(os.path.realpath(extract_path)) if not extract_path.startswith(targetPath): raise UnsafeArchive("%s is outside of %s" % (src, targetPath)) def filenames(self): raise NotImplementedError()
23.159091
68
0.7105
114
1,019
6.22807
0.368421
0.202817
0.157746
0.047887
0.188732
0.078873
0
0
0
0
0
0
0.192345
1,019
43
69
23.697674
0.862697
0
0
0.2
0
0
0.018664
0
0
0
0
0
0
1
0.3
false
0
0.033333
0
0.4
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
27b8725aa2b3f70762910e967c95a0e9eb9a997d
602
py
Python
qmhub/embedtools/embed_eed_me.py
QCMM/dynqmprop
0f668072f623a2f5f209ab715bc264a83926309b
[ "MIT" ]
null
null
null
qmhub/embedtools/embed_eed_me.py
QCMM/dynqmprop
0f668072f623a2f5f209ab715bc264a83926309b
[ "MIT" ]
null
null
null
qmhub/embedtools/embed_eed_me.py
QCMM/dynqmprop
0f668072f623a2f5f209ab715bc264a83926309b
[ "MIT" ]
null
null
null
from .embed_base import EmbedBase class EmbedEEdME(EmbedBase): EMBEDNEAR = 'EEd' EMBEDFAR = 'ME' def get_mm_charge(self): super(EmbedEEdME, self).get_mm_charge() self.mm_atoms_near.charge_me = self.mm_atoms_near.charge_comp self.mm_atoms_near.charge_eed = self.mm_atoms_near.charge_near def get_mm_esp(self): mm_esp_near = self.get_mm_esp_eed() if self.mm_atoms_near.charge_comp is None: return mm_esp_near else: mm_esp_comp = self.get_mm_esp_me().sum(axis=1) return mm_esp_near - mm_esp_comp
24.08
70
0.669435
92
602
3.967391
0.315217
0.109589
0.150685
0.205479
0.309589
0.136986
0
0
0
0
0
0.002212
0.249169
602
24
71
25.083333
0.80531
0
0
0
0
0
0.008306
0
0
0
0
0
0
1
0.133333
false
0
0.066667
0
0.533333
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
27b9fb848cb7951346c59ef7e058d140e94e21b6
373
py
Python
lesson-3/ex4.py
alirsamar/intro-ml
36450b26b7ea09472ccdd2a0abce51b6c3889a20
[ "MIT" ]
null
null
null
lesson-3/ex4.py
alirsamar/intro-ml
36450b26b7ea09472ccdd2a0abce51b6c3889a20
[ "MIT" ]
null
null
null
lesson-3/ex4.py
alirsamar/intro-ml
36450b26b7ea09472ccdd2a0abce51b6c3889a20
[ "MIT" ]
null
null
null
# Your first email DT: Accuracy import sys from time import time sys.path.append("../tools/") from email_preprocess import preprocess from sklearn import tree features_train, features_test, labels_train, labels_test = preprocess() clf = tree.DecisionTreeClassifier(min_samples_split=40) clf.fit(features_train, labels_train) print clf.score(features_test, labels_test)
28.692308
71
0.812332
53
373
5.509434
0.528302
0.089041
0.123288
0
0
0
0
0
0
0
0
0.005988
0.104558
373
13
72
28.692308
0.868263
0.077748
0
0
0
0
0.026316
0
0
0
0
0
0
0
null
null
0
0.444444
null
null
0.111111
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
27bf522cb273d0d2ad03dedda722c1ce9c5fdeae
1,623
py
Python
density.py
mattjj/dirichlet-truncated-multinomial
1b239e8960042bbf0f063d4f9e0400dfa6cb648b
[ "MIT" ]
2
2020-07-24T20:50:29.000Z
2020-07-26T08:30:42.000Z
density.py
mattjj/dirichlet-truncated-multinomial
1b239e8960042bbf0f063d4f9e0400dfa6cb648b
[ "MIT" ]
null
null
null
density.py
mattjj/dirichlet-truncated-multinomial
1b239e8960042bbf0f063d4f9e0400dfa6cb648b
[ "MIT" ]
null
null
null
from __future__ import division import numpy as np na = np.newaxis import operator import parallel def kde(sigma,locs,vals=None): ''' returns a density function p defined by p(x) = \sum_{xbar \in locs} vals[xbar] * rbf(xbar,x; sigma) rbf(xbar,x; sigma) is the value of a normalized isotropic gaussian density with mean xbar and variance sigma evaluated at x by default, vals[i] = 1/len(locs), useful for the case when locs are samples ''' # TODO should the computation here be done in log space with logaddexp? # yes, esp for higher dimensions... if vals is None: vals = 1./locs.shape[0] * np.ones(locs.shape[0]) else: assert vals.ndim == 1 and np.allclose(vals.sum(),1) locs, vals = np.array(locs), np.array(vals) assert locs.ndim == 2 and locs.shape[0] == vals.shape[0] K = locs.shape[1] # dimensionality def p(x): assert x.ndim == 2 # parallelizes over locs but not over x chunksize = 1000000 # max intermediate array size is chunksize doubles locchunks = np.array_split(locs,x.shape[0]*locs.shape[0]//chunksize+1) valchunks = np.array_split(vals,x.shape[0]*locs.shape[0]//chunksize+1) numchunks = len(locchunks) def f((ls,vs,x,K,sigma)): return np.dot(np.ones(len(ls)),vs[:,na] / (2*np.pi)**(K/2) / np.sqrt(sigma**K) * np.exp(-0.5*((ls[:,na,:] - x[na,:,:])**2).sum(2)/sigma)) return reduce(operator.add, parallel.dv.map_sync(f, zip(locchunks,valchunks,[x]*numchunks,[K]*numchunks,[sigma]*numchunks))) return p
36.066667
132
0.622304
252
1,623
3.97619
0.420635
0.047904
0.0499
0.025948
0.053892
0.053892
0.053892
0.053892
0
0
0
0.024174
0.235367
1,623
44
133
36.886364
0.783239
0.126309
0
0
0
0
0
0
0
0
0
0.022727
0.12
0
null
null
0
0.16
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
1
0
1
0
0
0
0
0
0
0
0
2
27d01a771020c352b35c6a4893b69cfac0b06a64
2,137
py
Python
pyrex/get_sxs.py
Yoshinta/pyrex
f207d59de46534f6849f769506494ff162c8cd7f
[ "MIT" ]
1
2021-01-19T03:31:45.000Z
2021-01-19T03:31:45.000Z
pyrex/get_sxs.py
Yoshinta/pyrex
f207d59de46534f6849f769506494ff162c8cd7f
[ "MIT" ]
null
null
null
pyrex/get_sxs.py
Yoshinta/pyrex
f207d59de46534f6849f769506494ff162c8cd7f
[ "MIT" ]
1
2021-01-28T06:09:07.000Z
2021-01-28T06:09:07.000Z
# Copyright (C) 2020 Yoshinta Setyawati <yoshintaes@gmail.com> # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ============================================================================= # # Preamble # # ============================================================================= # """ Download a set of SXS data from given simulation numbers. """ __author__ = 'Yoshinta Setyawati' #TODO: test how it works # import sxs from sxs import zenodo as zen # For interacting with the data import h5py from numpy import * import json #import eccentric simulations as used PRD 98, 044015(2018) chosen_ids=['0180','1355','1356','1357','1358','1359','1360','1361','1362','1363','0184','1364','1365','1366','1367','1368','1369','1370','0183','1371','1372','1373','1374'] def download_data(ids=chosen_ids): """ Download given simulations of the SXS catalog. Parameters ---------- ids : [] 1 dimensional array of the SXS simulation IDs such as '0180', '1356' etc. Default=chosen_ids. """ for ids in chosen_ids: name_ids='SXS:BBH:'+ids zen.download.matching("common-metadata.txt", "metadata.txt", "metadata.json", \ "rhOverM_Asymptotic_GeometricUnits_CoM.h5", \ "Horizons.h5", \ sxs_ids = name_ids, \ dry_run = False, \ highest_lev_only = True)
33.920635
173
0.597567
265
2,137
4.750943
0.611321
0.019857
0.030977
0.045274
0.065131
0.04448
0
0
0
0
0
0.080243
0.230229
2,137
62
174
34.467742
0.685106
0.603182
0
0
0
0
0.283245
0.053191
0
0
0
0.016129
0
1
0.0625
false
0
0.3125
0
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
1
0
0
0
0
0
1
0
0
0
0
2
27e54da2fe957cd0fc34e397a672dad01b50ff51
4,029
py
Python
fwk/metrics.py
cassianobecker/dnn
bb2ea04f77733de9df10f795bb049ac3b9d30478
[ "MIT" ]
3
2020-02-21T21:35:07.000Z
2020-09-29T15:20:00.000Z
fwk/metrics.py
cassianobecker/dnn
bb2ea04f77733de9df10f795bb049ac3b9d30478
[ "MIT" ]
27
2020-02-20T21:00:23.000Z
2020-05-22T15:23:25.000Z
fwk/metrics.py
cassianobecker/dnn
bb2ea04f77733de9df10f795bb049ac3b9d30478
[ "MIT" ]
null
null
null
from util.lang import class_for_name from util.path import absolute_path from util.string import list_from from fwk.config import Config from fwk.observers import Observer import configparser class Metric: def __init__(self) -> None: self.observers = list() def add_observer(self, channel): self.observers.append(channel) def get_implemented_events(self): event_handler_list = [m[3:] for m in self.__class__.__dict__ if m.startswith('on_')] return event_handler_list def on_event(self, event_type, local_variables): event_handler = getattr(self, 'on_' + event_type) event_handler(local_variables) def print_metric(self): for observer in self.observers: observer.print(self) def on_before_setup(self, local_variables): pass def on_after_setup(self, local_variables): pass def on_before_epoch(self, local_variables): pass def on_after_epoch(self, local_variables): pass def on_before_train_batch(self, local_variables): pass def on_after_train_batch(self, local_variables): pass def on_before_test_batch(self, local_variables): pass def on_after_test_batch(self, local_variables): pass class MetricsHandler: metrics_for_events = dict() @classmethod def register_metrics(cls): metrics_config, observers_config = cls._get_configs() if metrics_config is not None: observers = dict() for metrics_class_name in metrics_config.sections(): metric = class_for_name(metrics_class_name)() for observer_name in list_from(metrics_config[metrics_class_name]['observers']): if observer_name not in observers.keys(): observer = cls._create_observer(observers_config, observer_name) observers[observer_name] = observer else: observer = observers[observer_name] metric.add_observer(observer) cls.register_events(metric) pass @classmethod def register_events(cls, metric): for event in metric.get_implemented_events(): if event not in cls.metrics_for_events: cls.metrics_for_events[event] = list() cls.metrics_for_events[event].append(metric) @classmethod def _create_observer(cls, observers_config, observer_name): observer = Observer() renderer_class_names = list_from(observers_config[observer_name]['renderers']) for renderers_class_name in renderer_class_names: renderer = class_for_name(renderers_class_name)(observer_name) observer.add_renderer(renderer) return observer @classmethod def _get_configs(cls): # optionxform preserves CamelCase in keys for loading class names # see https://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser.optionxform metrics_config = configparser.ConfigParser(allow_no_value=True) metrics_config.optionxform = str if 'METRICS' in Config.config.sections(): metrics_ini_url = Config.config['METRICS']['metrics_ini_url'] metrics_config.read(absolute_path(metrics_ini_url)) observers_config = configparser.ConfigParser(allow_no_value=True) observers_ini_url = Config.config['METRICS']['observers_ini_url'] observers_config.optionxform = str observers_config.read(absolute_path(observers_ini_url)) else: metrics_config = None observers_config = None return metrics_config, observers_config @classmethod def dispatch_event(cls, local_variables, event_type): if event_type in cls.metrics_for_events.keys(): for metric in cls.metrics_for_events[event_type]: metric.on_event(event_type, local_variables)
29.844444
106
0.668652
472
4,029
5.368644
0.184322
0.066298
0.056827
0.069455
0.222968
0.157459
0.143646
0.045777
0
0
0
0.00067
0.258873
4,029
134
107
30.067164
0.847957
0.039464
0
0.181818
0
0
0.019917
0
0
0
0
0
0
1
0.204545
false
0.102273
0.068182
0
0.340909
0.022727
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
7e02bc702787096f6ba4d1dbf86cf14364f8660e
1,566
py
Python
backend/authentication/views.py
softzer0/dockerized_django_vuetify_boilerplate
bbfdc5cf9599e3832a7644623d3f66137f93788a
[ "MIT" ]
null
null
null
backend/authentication/views.py
softzer0/dockerized_django_vuetify_boilerplate
bbfdc5cf9599e3832a7644623d3f66137f93788a
[ "MIT" ]
null
null
null
backend/authentication/views.py
softzer0/dockerized_django_vuetify_boilerplate
bbfdc5cf9599e3832a7644623d3f66137f93788a
[ "MIT" ]
null
null
null
from dj_rest_auth import views from dj_rest_auth.registration import views as registration_views from rest_framework.generics import get_object_or_404 from rest_framework.response import Response from rest_framework.permissions import IsAuthenticated from .permissions import IsGuest as IsGuestPermission, IsOwnerOrReadOnly as IsOwnerOrReadOnlyPermission from .serializers import UserDetailsSerializer from .models import User from rest_framework.viewsets import ModelViewSet class IsGuest: def get_permissions(self): permissions_list = super().get_permissions() permissions_list.append(IsGuestPermission()) return permissions_list class PasswordResetView(IsGuest, views.PasswordResetView): pass class PasswordResetConfirmView(IsGuest, views.PasswordResetConfirmView): pass class LoginView(IsGuest, views.LoginView): pass class RegisterView(IsGuest, registration_views.RegisterView): pass class VerifyEmailView(IsGuest, registration_views.VerifyEmailView): pass class UserViewSet(ModelViewSet): queryset = User.objects.all() serializer_class = UserDetailsSerializer permission_classes = [IsAuthenticated, IsOwnerOrReadOnlyPermission] def get_object(self): obj = get_object_or_404(self.queryset, **{'pk': self.request.user.id}) self.check_object_permissions(self.request, obj) return obj def list(self, request, *args, **kwargs): instance = self.get_object() serializer = self.get_serializer(instance) return Response(serializer.data)
29.54717
103
0.779055
168
1,566
7.089286
0.333333
0.037783
0.057095
0.02351
0
0
0
0
0
0
0
0.004528
0.153895
1,566
53
104
29.54717
0.89434
0
0
0.138889
0
0
0.001276
0
0
0
0
0
0
1
0.083333
false
0.194444
0.25
0
0.694444
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
fd7c800728edfcefe6640db9203e4038d79ce926
288
py
Python
001601Udemy100DayPyBootCamp/day003/001601p029_InteractiveCodingExercise_02_RollerCoasterAge.py
SafonovMikhail/python_000577
739f764e80f1ca354386f00b8e9db1df8c96531d
[ "Apache-2.0" ]
null
null
null
001601Udemy100DayPyBootCamp/day003/001601p029_InteractiveCodingExercise_02_RollerCoasterAge.py
SafonovMikhail/python_000577
739f764e80f1ca354386f00b8e9db1df8c96531d
[ "Apache-2.0" ]
null
null
null
001601Udemy100DayPyBootCamp/day003/001601p029_InteractiveCodingExercise_02_RollerCoasterAge.py
SafonovMikhail/python_000577
739f764e80f1ca354386f00b8e9db1df8c96531d
[ "Apache-2.0" ]
null
null
null
print("Welcome to the rollercoaster!") height = int(input("What is your height in cm? ")) if height > 120: print("you can ride the rollercoaster!") age = int(input("What is your age? ")) if age <= 18: print("$7") else: print("$12") else: print("no")
20.571429
50
0.572917
41
288
4.02439
0.585366
0.193939
0.145455
0.169697
0.218182
0
0
0
0
0
0
0.037736
0.263889
288
13
51
22.153846
0.740566
0
0
0.181818
0
0
0.388889
0
0
0
0
0
0
1
0
false
0
0
0
0
0.454545
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
0
1
0
2
fd89ba2a9d9f9480c0e1aec84457ba50ede3b762
177
py
Python
SECUINSIDE/2016/byhuman (unsolved)/f65c09977d6a4adf8949dcb05544a998/random_padding.py
PurpEth/solved-hacking-problem
6f289d1647eb9c091caa580c7aae673e3ba02952
[ "Unlicense" ]
1
2021-08-24T22:16:41.000Z
2021-08-24T22:16:41.000Z
SECUINSIDE/2016/byhuman (unsolved)/f65c09977d6a4adf8949dcb05544a998/random_padding.py
PurpEth/solved-hacking-problem
6f289d1647eb9c091caa580c7aae673e3ba02952
[ "Unlicense" ]
null
null
null
SECUINSIDE/2016/byhuman (unsolved)/f65c09977d6a4adf8949dcb05544a998/random_padding.py
PurpEth/solved-hacking-problem
6f289d1647eb9c091caa580c7aae673e3ba02952
[ "Unlicense" ]
null
null
null
import random import time import os while not os.path.isfile('bh'): f = open('/tmp/random_padding', 'wb') f.write('\x90' * random.getrandbits(12)) f.close() time.sleep(0.1)
19.666667
41
0.683616
30
177
4
0.733333
0
0
0
0
0
0
0
0
0
0
0.03871
0.124294
177
9
42
19.666667
0.735484
0
0
0
0
0
0.151685
0
0
0
0
0
0
1
0
false
0
0.375
0
0.375
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
fd9d37f0a9696aa9046f11749f8eb7774d1e036b
302
py
Python
geocodio/__init__.py
snake-plissken/pygeocodio
1f6914da8833816dca07997493844a6bd7d3fc10
[ "BSD-3-Clause" ]
null
null
null
geocodio/__init__.py
snake-plissken/pygeocodio
1f6914da8833816dca07997493844a6bd7d3fc10
[ "BSD-3-Clause" ]
null
null
null
geocodio/__init__.py
snake-plissken/pygeocodio
1f6914da8833816dca07997493844a6bd7d3fc10
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Ben Lopatin' __email__ = 'ben@wellfire.co' __version__ = '0.5.0' from .client import GeocodioClient # noqa from .data import Address, Location, LocationCollection # noqa __all__ = [GeocodioClient, Address, Location, LocationCollection]
23.230769
65
0.728477
35
302
5.828571
0.742857
0.147059
0.323529
0
0
0
0
0
0
0
0
0.015444
0.142384
302
12
66
25.166667
0.772201
0.172185
0
0
0
0
0.126016
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
1
0
0
0
0
2
fd9e83d4d236ca484fa0cb8ca426cd834a1c1296
2,179
py
Python
faceAndOrientation1.py
SiAce/PhysicsResearchPractice
737bbdbef93b250898e8202d618af18aa0ed0a58
[ "MIT" ]
null
null
null
faceAndOrientation1.py
SiAce/PhysicsResearchPractice
737bbdbef93b250898e8202d618af18aa0ed0a58
[ "MIT" ]
null
null
null
faceAndOrientation1.py
SiAce/PhysicsResearchPractice
737bbdbef93b250898e8202d618af18aa0ed0a58
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Wed Mar 15 18:44:03 2017 @author: 93137 """ import numpy as np def gcd(a,b): #calculate the greatest common divisor of a and b while (b != 0) : c = a % b a = b b = c return a def lcm(a,b): #calculate the lowest common multiple of a and b return a*b/gcd(a,b) def hkl2uvw(h,k,l): a,b,c = [0,0,0],[0,0,0],[0,0,0] aa,bb,cc,ab,ac,bc = 0,0,0,0,0,0 u,v,w,u1,v1,w1,u2,u3,v3,w3 = 0,0,0,0,0,0,0,0,0,0 for i in range(3): print "a[%d]:" %i a[i] = input() for i in range(3): print "b[%d]:" %i b[i] = input() for i in range(3): print "c[%d]:" %i c[i] = input() for i in range(3): aa += a[i]**2 for i in range(3): bb += b[i]**2 for i in range(3): cc += c[i]**2 for i in range(3): ab += a[i]*b[i] for i in range(3): ac += a[i]*c[i] for i in range(3): bc += b[i]*c[i] v1 = (l*bc-k*cc)*(h*ab-k*aa)-(k*ac-h*bc)*(k*ac-l*ab) u1 = (l*bc-k*cc)*(k*ab-h*bb)-(k*ac-h*bc)*(l*bb-k*bc) w1 = (l*bb-k*bc)*(h*ab-k*aa)-(k*ab-h*bb)*(k*ac-l*ab) u2 = (l*bb-k*bc)*(k*ab-h*bc)-(k*ab-h*bb)*(l*bc-k*cc) u3 = lcm(u1,u2) v3 = v1 * u3 / u1 w3 = w1 * u3 / u1 u = u3 / gcd(gcd(u3,v3),w3) v = v3 / gcd(gcd(u3,v3),w3) print u,v,w def uvw2hkl(u,v,w): a,b,c = [0,0,0],[0,0,0],[0,0,0] aa,bb,cc,ab,ac,bc = 0,0,0,0,0,0 h1,k1,l1,h,k,l = 0,0,0,0,0,0 for i in range(3): print "a[%d]:" %i a[i] = input() for i in range(3): print "b[%d]:" %i b[i] = input() for i in range(3): print "c[%d]:" %i c[i] = input() for i in range(3): aa += a[i]**2 for i in range(3): bb += b[i]**2 for i in range(3): cc += c[i]**2 for i in range(3): ab += a[i]*b[i] for i in range(3): ac += a[i]*c[i] for i in range(3): bc += b[i]*c[i] h1 = u*aa + v*ab + w*ac k1 = u*ab + v*bb + w*bc l1 = u*ac + v*bc + w*cc h = h1 / gcd(gcd(h1,k1),l1) k = k1 / gcd(gcd(h1,k1),l1) l = l1 / gcd(gcd(h1,k1),l1) print h,k,l hkl2uvw(1,1,1)
24.761364
63
0.438274
486
2,179
1.965021
0.144033
0.08377
0.106806
0.117277
0.564398
0.487958
0.46911
0.46911
0.46911
0.464921
0
0.097279
0.325379
2,179
88
64
24.761364
0.552381
0.053235
0
0.597403
0
0
0.017991
0
0
0
0
0
0
0
null
null
0
0.012987
null
null
0.103896
0
0
1
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
0
0
2
fd9fd7c0cb23108730f634106519a1bad579afbc
1,388
py
Python
src/python/1-25/problem_22.py
Fazendaaa/project-euler
80286ffe2db566872953d3021c3d6006f686c2cf
[ "MIT" ]
3
2017-09-16T11:45:17.000Z
2018-06-20T23:21:29.000Z
src/python/1-25/problem_22.py
Fazendaaa/project-euler
80286ffe2db566872953d3021c3d6006f686c2cf
[ "MIT" ]
null
null
null
src/python/1-25/problem_22.py
Fazendaaa/project-euler
80286ffe2db566872953d3021c3d6006f686c2cf
[ "MIT" ]
null
null
null
""" Names scores Using problem_22.txt, a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score. For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 × 53 = 49714. What is the total of all the name scores in the file? Answer: 871198282 obs: articles that helped me out: * http://stackoverflow.com/a/5545284/7092954 """ def order(letter): """Given letter, returns it alphabetic index""" return ord(str.lower(letter))-96 def names_scores(names): """Given a list of names, sorted it into alphabetical order then calculates \ alphabetical value for eache name by multiplying this value by its alphabetical \ postion int the list to obtain a name score""" # pylint: disable=line-too-long return sum([sum(list(map(order, list(value))))*(index+1) for index, value in enumerate(sorted(names))]) with open('./input/problem_22.txt', 'r') as file: NAMES = file.read().replace("\"", '').split(',') print(names_scores(NAMES))
39.657143
107
0.659942
203
1,388
4.497537
0.53202
0.030668
0.069003
0.050383
0.170865
0.054765
0.054765
0
0
0
0
0.052581
0.246398
1,388
34
108
40.823529
0.819312
0.70317
0
0
0
0
0.073099
0.064327
0
0
0
0
0
1
0.285714
false
0
0
0
0.571429
0.142857
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
fda90f2733f7b555230d2b24d9df04d8bf3c1cb6
660
py
Python
test/ci-hooks-app/test_cli.py
pymor/ci_hooks_app
0d6bb2eb848056561750c4cfd3602127a7ff291c
[ "BSD-2-Clause" ]
1
2021-12-18T11:43:28.000Z
2021-12-18T11:43:28.000Z
test/ci-hooks-app/test_cli.py
pymor/ci_hooks_app
0d6bb2eb848056561750c4cfd3602127a7ff291c
[ "BSD-2-Clause" ]
2
2019-02-14T08:54:01.000Z
2019-02-27T14:15:59.000Z
test/ci-hooks-app/test_cli.py
pymor/ci_hooks_app
0d6bb2eb848056561750c4cfd3602127a7ff291c
[ "BSD-2-Clause" ]
1
2022-01-20T22:10:28.000Z
2022-01-20T22:10:28.000Z
""" Test suite for the cli module. The script can be executed on its own or incorporated into a larger test suite. However the tests are run, be aware of which version of the module is actually being tested. If the library is installed in site-packages, that version takes precedence over the version in this project directory. Use a virtualenv test environment or setuptools develop mode to test against the development version. """ from subprocess import call from sys import executable import pytest from ci-hooks-app.cli import * # test __all__ # Make the script executable. if __name__ == "__main__": raise SystemExit(pytest.main([__file__]))
30
79
0.778788
102
660
4.882353
0.676471
0.036145
0
0
0
0
0
0
0
0
0
0
0.171212
660
21
80
31.428571
0.91042
0.060606
0
0
0
0
0.043956
0
0
0
0
0
0
0
null
null
0
0.666667
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
fdd124e5a78e1ead6154fa04cd83ccdcb61a9c15
2,394
py
Python
examples/compare_intervals.py
krasch/smart-assistants
4242f78efaf300546ebb2cc0f6ba9f9ac10256fa
[ "MIT" ]
9
2015-02-13T22:33:46.000Z
2021-04-22T08:53:18.000Z
examples/compare_intervals.py
krasch/smart-assistants
4242f78efaf300546ebb2cc0f6ba9f9ac10256fa
[ "MIT" ]
3
2018-03-15T23:01:22.000Z
2019-04-11T16:43:33.000Z
examples/compare_intervals.py
krasch/smart-assistants
4242f78efaf300546ebb2cc0f6ba9f9ac10256fa
[ "MIT" ]
3
2018-03-15T15:43:11.000Z
2021-04-26T14:37:22.000Z
# -*- coding: UTF-8 -*- """ Evaluate how the recommender system copes with varying interval widths and Delta t_max settings. Details for this experiment can be found in the paper in Section 6.5 and in the Dissertation in Section 5.5.6. """ import sys sys.path.append("..") import pandas from evaluation.experiment import Experiment from recsys.classifiers.temporal import TemporalEvidencesClassifier from recsys.classifiers.binning import initialize_bins from recsys.dataset import load_dataset #configuration data = load_dataset("../datasets/houseA.csv", "../datasets/houseA.config") intervals_to_test = [#test various settings for delta t_max ("Delta t_max=1200s", initialize_bins(start=0, end=60, width=10) + initialize_bins(start=60, end=1200, width=30)), ("Delta t_max=120s", initialize_bins(start=0, end=60, width=10) + initialize_bins(start=60, end=120, width=30)), ("Delta t_max=60s", initialize_bins(start=0, end=60, width=10)), ("Delta t_max=30s", initialize_bins(start=0, end=30, width=10)), ("Delta t_max=10s", initialize_bins(start=0, end=10, width=10)), #test various interval widths ("all intervals 2s wide", initialize_bins(start=0, end=300, width=2)), ("all intervals 4s wide", initialize_bins(start=0, end=300, width=4)), ("all intervals 6s wide", initialize_bins(start=0, end=300, width=6)), ("all intervals 8s wide", initialize_bins(start=0, end=300, width=8)), ("all intervals 30s wide", initialize_bins(start=0, end=300, width=30)), ("all intervals 50s wide", initialize_bins(start=0, end=300, width=50)), ("all intervals 100s wide", initialize_bins(start=0, end=300, width=100))] #run 10-fold cross-validation for each of the configured intervals experiment = Experiment(data) for (name, bins) in intervals_to_test: experiment.add_classifier(TemporalEvidencesClassifier(data.features, data.target_names, bins=bins), name=name) results = experiment.run(folds=10) results.print_quality_comparison_at_cutoff(cutoff=1, metrics=["Recall", "Precision", "F1"])
54.409091
104
0.631161
307
2,394
4.811075
0.355049
0.14218
0.180095
0.162492
0.333108
0.263372
0.263372
0.263372
0.075829
0.075829
0
0.064318
0.253133
2,394
43
105
55.674419
0.761745
0.155806
0
0
0
0
0.146839
0.023395
0
0
0
0
0
1
0
false
0
0.206897
0
0.206897
0.034483
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
fdd8ecf76ece1aad08b2a4d983a33392ad410446
16,662
py
Python
scripts/py_modelica_exporter/run.py
webgme/webgme-dss
2b915e12de6c3f5873d13e192b0485457c70208b
[ "MIT" ]
8
2018-06-29T02:29:09.000Z
2021-06-25T16:20:39.000Z
scripts/py_modelica_exporter/run.py
rozhddmi/webgme-dss
2b915e12de6c3f5873d13e192b0485457c70208b
[ "MIT" ]
14
2018-08-08T15:59:54.000Z
2021-06-09T19:23:22.000Z
scripts/py_modelica_exporter/run.py
rozhddmi/webgme-dss
2b915e12de6c3f5873d13e192b0485457c70208b
[ "MIT" ]
3
2019-03-20T10:06:58.000Z
2021-06-11T03:00:30.000Z
import logging import json from exporters import ComponentExporter logger = logging.getLogger('py_modelica_exporter') logger.setLevel(logging.ERROR) # create console handler with a higher log level ch = logging.StreamHandler() ch.setLevel(logging.ERROR) logger.addHandler(ch) # # create formatter and add it to the handlers # formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') # fh.setFormatter(formatter) # ch.setFormatter(formatter) # add the handlers to the logger ELECTRICAL_ANALOG = [ # Basic 'Modelica.Electrical.Analog.Basic.Ground', 'Modelica.Electrical.Analog.Basic.Resistor', 'Modelica.Electrical.Analog.Basic.HeatingResistor', 'Modelica.Electrical.Analog.Basic.Conductor', 'Modelica.Electrical.Analog.Basic.Capacitor', 'Modelica.Electrical.Analog.Basic.Inductor', 'Modelica.Electrical.Analog.Basic.SaturatingInductor', 'Modelica.Electrical.Analog.Basic.Transformer', #'Modelica.Electrical.Analog.Basic.M_Transformer', 'Modelica.Electrical.Analog.Basic.Gyrator', 'Modelica.Electrical.Analog.Basic.EMF', 'Modelica.Electrical.Analog.Basic.TranslationalEMF', 'Modelica.Electrical.Analog.Basic.VCV', 'Modelica.Electrical.Analog.Basic.VCC', 'Modelica.Electrical.Analog.Basic.CCV', 'Modelica.Electrical.Analog.Basic.CCC', 'Modelica.Electrical.Analog.Basic.OpAmp', 'Modelica.Electrical.Analog.Basic.OpAmpDetailed', 'Modelica.Electrical.Analog.Basic.VariableResistor', 'Modelica.Electrical.Analog.Basic.VariableConductor', 'Modelica.Electrical.Analog.Basic.VariableCapacitor', 'Modelica.Electrical.Analog.Basic.VariableInductor', 'Modelica.Electrical.Analog.Basic.Potentiometer', # IDEAL # TODO # Semiconductors # TODO # Sensors 'Modelica.Electrical.Analog.Sensors.PotentialSensor', 'Modelica.Electrical.Analog.Sensors.VoltageSensor', 'Modelica.Electrical.Analog.Sensors.CurrentSensor', 'Modelica.Electrical.Analog.Sensors.PowerSensor', # Sources 'Modelica.Electrical.Analog.Sources.SignalVoltage', 'Modelica.Electrical.Analog.Sources.ConstantVoltage', 'Modelica.Electrical.Analog.Sources.StepVoltage', 'Modelica.Electrical.Analog.Sources.RampVoltage', 'Modelica.Electrical.Analog.Sources.SineVoltage', 'Modelica.Electrical.Analog.Sources.CosineVoltage', 'Modelica.Electrical.Analog.Sources.ExpSineVoltage', 'Modelica.Electrical.Analog.Sources.ExponentialsVoltage', 'Modelica.Electrical.Analog.Sources.PulseVoltage', 'Modelica.Electrical.Analog.Sources.SawToothVoltage', 'Modelica.Electrical.Analog.Sources.TrapezoidVoltage', 'Modelica.Electrical.Analog.Sources.TableVoltage', 'Modelica.Electrical.Analog.Sources.SignalCurrent', 'Modelica.Electrical.Analog.Sources.ConstantCurrent', 'Modelica.Electrical.Analog.Sources.StepCurrent', 'Modelica.Electrical.Analog.Sources.RampCurrent', 'Modelica.Electrical.Analog.Sources.SineCurrent', 'Modelica.Electrical.Analog.Sources.CosineCurrent', 'Modelica.Electrical.Analog.Sources.ExpSineCurrent', 'Modelica.Electrical.Analog.Sources.ExponentialsCurrent', 'Modelica.Electrical.Analog.Sources.PulseCurrent', 'Modelica.Electrical.Analog.Sources.SawToothCurrent', 'Modelica.Electrical.Analog.Sources.TrapezoidCurrent', 'Modelica.Electrical.Analog.Sources.TableCurrent', 'Modelica.Electrical.Analog.Sources.SupplyVoltage' ] TRANSLATIONAL_MECHANICS = [ 'Modelica.Mechanics.Translational.Components.Fixed', 'Modelica.Mechanics.Translational.Components.Mass', 'Modelica.Mechanics.Translational.Components.Rod', 'Modelica.Mechanics.Translational.Components.Spring', 'Modelica.Mechanics.Translational.Components.Damper', 'Modelica.Mechanics.Translational.Components.SpringDamper', 'Modelica.Mechanics.Translational.Components.ElastoGap', 'Modelica.Mechanics.Translational.Components.SupportFriction', 'Modelica.Mechanics.Translational.Components.Brake', 'Modelica.Mechanics.Translational.Components.IdealGearR2T', 'Modelica.Mechanics.Translational.Components.IdealRollingWheel', 'Modelica.Mechanics.Translational.Components.InitializeFlange', 'Modelica.Mechanics.Translational.Components.MassWithStopAndFriction', 'Modelica.Mechanics.Translational.Components.RelativeStates', 'Modelica.Mechanics.Translational.Sensors.PositionSensor', 'Modelica.Mechanics.Translational.Sensors.SpeedSensor', 'Modelica.Mechanics.Translational.Sensors.AccSensor', 'Modelica.Mechanics.Translational.Sensors.RelPositionSensor', 'Modelica.Mechanics.Translational.Sensors.RelSpeedSensor', 'Modelica.Mechanics.Translational.Sensors.RelAccSensor', 'Modelica.Mechanics.Translational.Sensors.ForceSensor', 'Modelica.Mechanics.Translational.Sensors.PowerSensor', 'Modelica.Mechanics.Translational.Sensors.MultiSensor', 'Modelica.Mechanics.Translational.Sources.Position', 'Modelica.Mechanics.Translational.Sources.Speed', 'Modelica.Mechanics.Translational.Sources.Accelerate', 'Modelica.Mechanics.Translational.Sources.Move', 'Modelica.Mechanics.Translational.Sources.Force', 'Modelica.Mechanics.Translational.Sources.Force2', 'Modelica.Mechanics.Translational.Sources.LinearSpeedDependentForce', 'Modelica.Mechanics.Translational.Sources.QuadraticSpeedDependentForce', 'Modelica.Mechanics.Translational.Sources.ConstantForce', 'Modelica.Mechanics.Translational.Sources.SignForce', 'Modelica.Mechanics.Translational.Sources.ConstantSpeed', 'Modelica.Mechanics.Translational.Sources.ForceStep' ] ROTATIONAL_MECHANICS = [ 'Modelica.Mechanics.Rotational.Components.Fixed', 'Modelica.Mechanics.Rotational.Components.Inertia', 'Modelica.Mechanics.Rotational.Components.Disc', 'Modelica.Mechanics.Rotational.Components.Spring', 'Modelica.Mechanics.Rotational.Components.Damper', 'Modelica.Mechanics.Rotational.Components.SpringDamper', 'Modelica.Mechanics.Rotational.Components.ElastoBacklash', 'Modelica.Mechanics.Rotational.Components.ElastoBacklash2', 'Modelica.Mechanics.Rotational.Components.BearingFriction', 'Modelica.Mechanics.Rotational.Components.Brake', 'Modelica.Mechanics.Rotational.Components.Clutch', 'Modelica.Mechanics.Rotational.Components.OneWayClutch', 'Modelica.Mechanics.Rotational.Components.IdealGear', 'Modelica.Mechanics.Rotational.Components.LossyGear', 'Modelica.Mechanics.Rotational.Components.IdealPlanetary', 'Modelica.Mechanics.Rotational.Components.Gearbox', 'Modelica.Mechanics.Rotational.Components.IdealGearR2T', 'Modelica.Mechanics.Rotational.Components.IdealRollingWheel', 'Modelica.Mechanics.Rotational.Components.InitializeFlange', 'Modelica.Mechanics.Rotational.Components.RelativeStates', 'Modelica.Mechanics.Rotational.Components.TorqueToAngleAdaptor', 'Modelica.Mechanics.Rotational.Components.AngleToTorqueAdaptor', 'Modelica.Mechanics.Rotational.Sensors.AngleSensor', 'Modelica.Mechanics.Rotational.Sensors.SpeedSensor', 'Modelica.Mechanics.Rotational.Sensors.AccSensor', 'Modelica.Mechanics.Rotational.Sensors.RelAngleSensor', 'Modelica.Mechanics.Rotational.Sensors.RelSpeedSensor', 'Modelica.Mechanics.Rotational.Sensors.RelAccSensor', 'Modelica.Mechanics.Rotational.Sensors.TorqueSensor', 'Modelica.Mechanics.Rotational.Sensors.PowerSensor', 'Modelica.Mechanics.Rotational.Sensors.MultiSensor', 'Modelica.Mechanics.Rotational.Sources.Position', 'Modelica.Mechanics.Rotational.Sources.Speed', 'Modelica.Mechanics.Rotational.Sources.Accelerate', 'Modelica.Mechanics.Rotational.Sources.Move', 'Modelica.Mechanics.Rotational.Sources.Torque', 'Modelica.Mechanics.Rotational.Sources.Torque2', 'Modelica.Mechanics.Rotational.Sources.LinearSpeedDependentTorque', 'Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque', 'Modelica.Mechanics.Rotational.Sources.ConstantTorque', 'Modelica.Mechanics.Rotational.Sources.SignTorque', 'Modelica.Mechanics.Rotational.Sources.ConstantSpeed', 'Modelica.Mechanics.Rotational.Sources.TorqueStep' ] FLUID_HEAT_FLOW = [ 'Modelica.Thermal.FluidHeatFlow.Components.IsolatedPipe', 'Modelica.Thermal.FluidHeatFlow.Components.HeatedPipe', 'Modelica.Thermal.FluidHeatFlow.Components.Valve', 'Modelica.Thermal.FluidHeatFlow.Sensors.PressureSensor', 'Modelica.Thermal.FluidHeatFlow.Sensors.TemperatureSensor', 'Modelica.Thermal.FluidHeatFlow.Sensors.RelPressureSensor', 'Modelica.Thermal.FluidHeatFlow.Sensors.RelTemperatureSensor', 'Modelica.Thermal.FluidHeatFlow.Sensors.MassFlowSensor', 'Modelica.Thermal.FluidHeatFlow.Sensors.VolumeFlowSensor', 'Modelica.Thermal.FluidHeatFlow.Sensors.EnthalpyFlowSensor', 'Modelica.Thermal.FluidHeatFlow.Sources.Ambient', 'Modelica.Thermal.FluidHeatFlow.Sources.AbsolutePressure', 'Modelica.Thermal.FluidHeatFlow.Sources.VolumeFlow', 'Modelica.Thermal.FluidHeatFlow.Sources.PressureIncrease', 'Modelica.Thermal.FluidHeatFlow.Sources.IdealPump' ] HEAT_TRANSFER = [ 'Modelica.Thermal.HeatTransfer.Components.HeatCapacitor', 'Modelica.Thermal.HeatTransfer.Components.ThermalConductor', 'Modelica.Thermal.HeatTransfer.Components.ThermalResistor', 'Modelica.Thermal.HeatTransfer.Components.Convection', 'Modelica.Thermal.HeatTransfer.Components.ConvectiveResistor', 'Modelica.Thermal.HeatTransfer.Components.BodyRadiation', 'Modelica.Thermal.HeatTransfer.Components.ThermalCollector', 'Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor', 'Modelica.Thermal.HeatTransfer.Sensors.RelTemperatureSensor', 'Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor', 'Modelica.Thermal.HeatTransfer.Sensors.ConditionalFixedHeatFlowSensor', 'Modelica.Thermal.HeatTransfer.Sources.FixedTemperature', 'Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature', 'Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow', 'Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow', 'Modelica.Thermal.HeatTransfer.Celsius.ToKelvin', 'Modelica.Thermal.HeatTransfer.Celsius.FromKelvin', 'Modelica.Thermal.HeatTransfer.Celsius.FixedTemperature', 'Modelica.Thermal.HeatTransfer.Celsius.PrescribedTemperature', 'Modelica.Thermal.HeatTransfer.Celsius.TemperatureSensor', 'Modelica.Thermal.HeatTransfer.Fahrenheit.ToKelvin', 'Modelica.Thermal.HeatTransfer.Fahrenheit.FromKelvin', 'Modelica.Thermal.HeatTransfer.Fahrenheit.FixedTemperature', 'Modelica.Thermal.HeatTransfer.Fahrenheit.PrescribedTemperature', 'Modelica.Thermal.HeatTransfer.Fahrenheit.TemperatureSensor', 'Modelica.Thermal.HeatTransfer.Rankine.ToKelvin', 'Modelica.Thermal.HeatTransfer.Rankine.FromKelvin', 'Modelica.Thermal.HeatTransfer.Rankine.FixedTemperature', 'Modelica.Thermal.HeatTransfer.Rankine.PrescribedTemperature', 'Modelica.Thermal.HeatTransfer.Rankine.TemperatureSensor' ] COMPLEX_BLOCKS = [ 'Modelica.ComplexBlocks.ComplexMath.Conj', 'Modelica.ComplexBlocks.ComplexMath.Gain', 'Modelica.ComplexBlocks.ComplexMath.Sum', 'Modelica.ComplexBlocks.ComplexMath.Feedback', 'Modelica.ComplexBlocks.ComplexMath.Add', 'Modelica.ComplexBlocks.ComplexMath.Add3', 'Modelica.ComplexBlocks.ComplexMath.Product', 'Modelica.ComplexBlocks.ComplexMath.Division', 'Modelica.ComplexBlocks.ComplexMath.Sqrt', 'Modelica.ComplexBlocks.ComplexMath.Sin', 'Modelica.ComplexBlocks.ComplexMath.Cos', 'Modelica.ComplexBlocks.ComplexMath.Tan', 'Modelica.ComplexBlocks.ComplexMath.Asin', 'Modelica.ComplexBlocks.ComplexMath.Acos', 'Modelica.ComplexBlocks.ComplexMath.Atan', 'Modelica.ComplexBlocks.ComplexMath.Sinh', 'Modelica.ComplexBlocks.ComplexMath.Cosh', 'Modelica.ComplexBlocks.ComplexMath.Tanh', 'Modelica.ComplexBlocks.ComplexMath.Exp', 'Modelica.ComplexBlocks.ComplexMath.Log', 'Modelica.ComplexBlocks.ComplexMath.RealToComplex', 'Modelica.ComplexBlocks.ComplexMath.PolarToComplex', 'Modelica.ComplexBlocks.ComplexMath.ComplexToReal', 'Modelica.ComplexBlocks.ComplexMath.ComplexToPolar', 'Modelica.ComplexBlocks.ComplexMath.TransferFunction', 'Modelica.ComplexBlocks.Sources.ComplexExpression', 'Modelica.ComplexBlocks.Sources.ComplexConstant', 'Modelica.ComplexBlocks.Sources.ComplexStep', 'Modelica.ComplexBlocks.Sources.ComplexRotatingPhasor', 'Modelica.ComplexBlocks.Sources.LogFrequencySweep' ] BLOCKS_CONTINUOUS = [ 'Modelica.Thermal.FluidHeatFlow.Sources.IdealPump', 'Modelica.Blocks.Continuous.LimIntegrator', 'Modelica.Blocks.Continuous.Derivative', 'Modelica.Blocks.Continuous.FirstOrder', 'Modelica.Blocks.Continuous.SecondOrder', 'Modelica.Blocks.Continuous.PI', 'Modelica.Blocks.Continuous.PID', 'Modelica.Blocks.Continuous.LimPID', 'Modelica.Blocks.Continuous.TransferFunction', 'Modelica.Blocks.Continuous.StateSpace', 'Modelica.Blocks.Continuous.Der', 'Modelica.Blocks.Continuous.LowpassButterworth', 'Modelica.Blocks.Continuous.CriticalDamping', 'Modelica.Blocks.Continuous.Filter', 'Modelica.Blocks.Discrete.Sampler', 'Modelica.Blocks.Discrete.ZeroOrderHold', 'Modelica.Blocks.Discrete.FirstOrderHold', 'Modelica.Blocks.Discrete.UnitDelay', 'Modelica.Blocks.Discrete.TransferFunction', 'Modelica.Blocks.Discrete.StateSpace', 'Modelica.Blocks.Discrete.TriggeredSampler', 'Modelica.Blocks.Discrete.TriggeredMax', 'Modelica.Blocks.Math.InverseBlockConstraints', 'Modelica.Blocks.Math.Gain', 'Modelica.Blocks.Math.MatrixGain', 'Modelica.Blocks.Math.MultiSum', 'Modelica.Blocks.Math.MultiProduct', 'Modelica.Blocks.Math.MultiSwitch', 'Modelica.Blocks.Math.Sum', 'Modelica.Blocks.Math.Feedback', 'Modelica.Blocks.Math.Add', 'Modelica.Blocks.Math.Add3', 'Modelica.Blocks.Math.Product', 'Modelica.Blocks.Math.Division', 'Modelica.Blocks.Math.Abs', 'Modelica.Blocks.Math.Sign', 'Modelica.Blocks.Math.Sqrt', 'Modelica.Blocks.Math.Sin', 'Modelica.Blocks.Math.Cos', 'Modelica.Blocks.Math.Tan', 'Modelica.Blocks.Math.Asin', 'Modelica.Blocks.Math.Acos', 'Modelica.Blocks.Math.Atan', 'Modelica.Blocks.Math.Atan2', 'Modelica.Blocks.Math.Sinh', 'Modelica.Blocks.Math.Cosh', 'Modelica.Blocks.Math.Tanh', 'Modelica.Blocks.Math.Exp', 'Modelica.Blocks.Math.Log', 'Modelica.Blocks.Math.Log10', 'Modelica.Blocks.Math.RealToInteger', 'Modelica.Blocks.Math.IntegerToReal' 'Modelica.Blocks.Sources.RealExpression', 'Modelica.Blocks.Sources.IntegerExpression', 'Modelica.Blocks.Sources.BooleanExpression', 'Modelica.Blocks.Sources.Clock', 'Modelica.Blocks.Sources.Constant', 'Modelica.Blocks.Sources.Step', 'Modelica.Blocks.Sources.Ramp', 'Modelica.Blocks.Sources.Sine', 'Modelica.Blocks.Sources.Cosine', 'Modelica.Blocks.Sources.ExpSine', 'Modelica.Blocks.Sources.Exponentials', 'Modelica.Blocks.Sources.Pulse', 'Modelica.Blocks.Sources.SawTooth', 'Modelica.Blocks.Sources.Trapezoid', 'Modelica.Blocks.Sources.BooleanConstant', 'Modelica.Blocks.Sources.BooleanStep', 'Modelica.Blocks.Sources.BooleanPulse', 'Modelica.Blocks.Sources.SampleTrigger', 'Modelica.Blocks.Sources.BooleanTable', 'Modelica.Blocks.Sources.IntegerConstant', 'Modelica.Blocks.Sources.IntegerStep', 'Modelica.Blocks.Sources.IntegerTable' ] DOMAINS = [ "Modelica.Electrical.Analog", "Modelica.Mechanics.Translational", "Modelica.Mechanics.Rotational", "Modelica.Thermal.FluidHeatFlow", "Modelica.Thermal.HeatTransfer", "Modelica.Blocks" ] COMPONENTS = ELECTRICAL_ANALOG + TRANSLATIONAL_MECHANICS + ROTATIONAL_MECHANICS + FLUID_HEAT_FLOW + HEAT_TRANSFER + BLOCKS_CONTINUOUS #COMPONENTS = ['Modelica.Mechanics.Rotational.Components.Gearbox'] result = [] COMPONENTS = ELECTRICAL_ANALOG component_exporter = ComponentExporter([], export_icons=True) for modelica_uri in COMPONENTS: try: component = component_exporter.get_component_json(modelica_uri) if len(component['components']) == 1 and component['components'][0]['fullName'] == 'Exception': logger.error('Component failed {0}'.format(component['exportedComponentClass'])) else: result.append(component) except Exception as err: logger.error('Exception at {0}'.format(modelica_uri)) logger.exception(err) with open('components.json', 'w') as outfile: json.dump(result, outfile)
43.732283
133
0.772356
1,493
16,662
8.601474
0.210985
0.107226
0.09905
0.060349
0.019935
0
0
0
0
0
0
0.000938
0.104129
16,662
380
134
43.847368
0.859382
0.025747
0
0
0
0
0.788666
0.781019
0
0
0
0.002632
0
1
0
false
0.003086
0.009259
0
0.009259
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
fddc61bd4fae05d0fd84deaa38faa03a701af199
209
py
Python
gitlabservice/utility/model/DeployFileModel.py
bisirkin-pv/sqlorchestrator
45b96633f4d26b25ed657eb021e058862a42c67b
[ "MIT" ]
1
2021-02-12T05:39:01.000Z
2021-02-12T05:39:01.000Z
gitlabservice/utility/model/DeployFileModel.py
bisirkin-pv/sqlorchestrator
45b96633f4d26b25ed657eb021e058862a42c67b
[ "MIT" ]
null
null
null
gitlabservice/utility/model/DeployFileModel.py
bisirkin-pv/sqlorchestrator
45b96633f4d26b25ed657eb021e058862a42c67b
[ "MIT" ]
null
null
null
from collections import namedtuple DeployFileHeader = namedtuple('deploy', 'group profile') DeployFileObject = namedtuple('object', 'name type action') DeployFileParam = namedtuple('param', 'name type base')
34.833333
59
0.779904
21
209
7.761905
0.761905
0.09816
0
0
0
0
0
0
0
0
0
0
0.105263
209
5
60
41.8
0.871658
0
0
0
0
0
0.287081
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
fde3f4b06040095b03f45a97d9c51da912dd18cb
1,278
py
Python
Trolls/migrations/0001_initial.py
Akash4307/Wise-master
5f484e3791a8e4361d8bcad570ac2661636a5cfc
[ "Apache-2.0" ]
null
null
null
Trolls/migrations/0001_initial.py
Akash4307/Wise-master
5f484e3791a8e4361d8bcad570ac2661636a5cfc
[ "Apache-2.0" ]
8
2021-03-18T21:30:54.000Z
2022-03-02T14:56:55.000Z
Trolls/migrations/0001_initial.py
Akash4307/Wise-master
5f484e3791a8e4361d8bcad570ac2661636a5cfc
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-12-13 07:33 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='UserInfo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Name', models.CharField(max_length=250)), ('UserId', models.CharField(max_length=250)), ('Link', models.CharField(max_length=1000)), ('UserPhoto', models.CharField(max_length=1000)), ], ), migrations.CreateModel( name='UserLocation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Location', models.CharField(max_length=500)), ], ), migrations.AddField( model_name='userinfo', name='location', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Trolls.UserLocation'), ), ]
31.95
114
0.581377
127
1,278
5.708661
0.488189
0.103448
0.124138
0.165517
0.369655
0.217931
0.217931
0.217931
0.217931
0.217931
0
0.037322
0.287167
1,278
39
115
32.769231
0.758507
0.053208
0
0.354839
1
0
0.077879
0
0
0
0
0
0
1
0
false
0
0.096774
0
0.225806
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
fdf2c1c4ee6374cf826f474c9cfc9e32db96348b
995
py
Python
icsmp_project/modulos_aulas/models.py
ICSMP/icsmp
bf811f7457aa6d6e7251c209631d63496e561925
[ "MIT" ]
1
2021-03-04T02:03:29.000Z
2021-03-04T02:03:29.000Z
icsmp_project/modulos_aulas/models.py
ravellys/icsmp
b0c86a92c66dc586274480f94a015216b711e478
[ "MIT" ]
680
2020-10-16T21:37:56.000Z
2022-02-23T23:48:57.000Z
icsmp_project/modulos_aulas/models.py
ravellys/icsmp
b0c86a92c66dc586274480f94a015216b711e478
[ "MIT" ]
1
2020-10-13T01:17:09.000Z
2020-10-13T01:17:09.000Z
from django.db import models # Create your models here. from django.urls import reverse from ordered_model.models import OrderedModel class ModuloAula(OrderedModel): nome = models.CharField(max_length=32) descricao = models.TextField() slug = models.SlugField(unique=True) class Meta(OrderedModel.Meta): pass def __str__(self): return self.nome def get_absolute_url(self): return reverse('modulos_aulas:detalhe', kwargs={'slug': self.slug}) class Aula(OrderedModel): nome = models.CharField(max_length=32) descricao = models.TextField() slug = models.SlugField(unique=True) modulo = models.ForeignKey(ModuloAula, on_delete=models.PROTECT) order_with_respect_to = 'modulo' v_id = models.CharField(max_length=32) class Meta(OrderedModel.Meta): pass def __str__(self): return self.nome def get_absolute_url(self): return reverse('modulos_aulas:aula', kwargs={'slug': self.slug})
25.512821
75
0.702513
124
995
5.451613
0.41129
0.059172
0.079882
0.106509
0.612426
0.573965
0.573965
0.573965
0.573965
0.573965
0
0.007491
0.194975
995
38
76
26.184211
0.836454
0.024121
0
0.615385
0
0
0.054696
0.021672
0
0
0
0
0
1
0.153846
false
0.076923
0.115385
0.153846
0.923077
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
1
0
0
0
2
fdfa80f4e2132e88931675effa93ba31f787e292
974
py
Python
networks/__init__.py
xuyouze/DropNet
edbaeb72075b819b96e1ca66e966999a40d3645e
[ "Apache-2.0" ]
1
2021-06-28T06:27:06.000Z
2021-06-28T06:27:06.000Z
networks/__init__.py
xuyouze/DropNet
edbaeb72075b819b96e1ca66e966999a40d3645e
[ "Apache-2.0" ]
null
null
null
networks/__init__.py
xuyouze/DropNet
edbaeb72075b819b96e1ca66e966999a40d3645e
[ "Apache-2.0" ]
null
null
null
# coding:utf-8 # @Time : 2019/6/27 # @Author : xuyouze # @File Name : __init__.py.py import importlib from networks.build import build_network from .model_component import get_scheduler, init_net __all__ = ["create_network_model", "get_scheduler"] def create_network_model(config): network = build_network(config.network_name) config.logger.info("{0} network has been created".format(config.network_name)) return network(config) # # def find_network_using_name(config): # model_filename = "networks." + config.network_name + "_model_component" # modellib = importlib.import_module(model_filename) # network = None # for name, cls in modellib.__dict__.items(): # if name == "define_net": # network = cls # # if not network: # raise NotImplementedError( # "In %s.py, there should be a method named %s." % ( # model_filename, "define_net")) # # return network
27.828571
82
0.662218
118
974
5.161017
0.5
0.085386
0.083744
0
0
0
0
0
0
0
0
0.011952
0.226899
974
34
83
28.647059
0.796813
0.587269
0
0
0
0
0.159686
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
fdfc1ad3d39b49e6459e833a627ff08e3c5d158f
880
py
Python
test.py
travisbyr/SDV602Test
fd059f495d52643b24b0a7418e7655484a8372f8
[ "MIT" ]
null
null
null
test.py
travisbyr/SDV602Test
fd059f495d52643b24b0a7418e7655484a8372f8
[ "MIT" ]
null
null
null
test.py
travisbyr/SDV602Test
fd059f495d52643b24b0a7418e7655484a8372f8
[ "MIT" ]
null
null
null
# print('**********************') # print(" Calculator") # print('**********************') # i = input('Whats your name? ') # print('Hello ' + i) # while True: # print('1 - Add') # print('2 - Subtract') # print('3 - Multiply') # print('4 - Divide') # cal = input('What calculation do you want? ') # a = input('Enter first number: ') # b = input('Enter second number: ') # if cal == '1': # cal = (int(a) + int(b)) # elif cal == '2': # cal = (int(a) - int(b)) # elif cal == '3': # cal = (int(a) * int(b)) # elif cal == '4': # pcal = (int(a) / int(b)) # print('**********') # print(i + ', the total is: ' + str(cal)) # print('**********') # x = input('Press q to quit, otherwise continue ') # if x.lower() == 'q': # break # else: # print('') # continue
26.666667
55
0.4125
100
880
3.63
0.48
0.044077
0.077135
0.088154
0.14876
0.14876
0.14876
0
0
0
0
0.013158
0.309091
880
32
56
27.5
0.583882
0.928409
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
8bf6d8150047d0cdf64d4d4464ce08dc20ec3dcd
3,862
py
Python
app.py
Astrowizard/sqlalchemy-challenge
db4b2d0b05307052a8ee265e71b70c58b8cb174b
[ "ADSL" ]
null
null
null
app.py
Astrowizard/sqlalchemy-challenge
db4b2d0b05307052a8ee265e71b70c58b8cb174b
[ "ADSL" ]
null
null
null
app.py
Astrowizard/sqlalchemy-challenge
db4b2d0b05307052a8ee265e71b70c58b8cb174b
[ "ADSL" ]
null
null
null
import numpy as np import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify import functions ################################################# # Database Setup ################################################# engine = create_engine("sqlite:///hawaii.sqlite") # reflect an existing database into a new model Base = automap_base() # reflect the tables Base.prepare(engine, reflect=True) Measurement = Base.classes.measurement Station = Base.classes.station app = (__name__) @app.route("/") def welcome(): def welcome(): """List all available api routes.""" return ( f"Available Routes:<br/>" f"/api/v1.0/precipitation<br/>" f"/api/v1.0/stations" f"/api/v1.0/tobs" f"/api/v1.0/<start>" f"/api/v1.0/<start>/<end>" ) @app.route("/api/v1.0/precipitation") def precipitation: session = Session(engine) q = session.query(Measurement.date).order_by(Measurement.date.desc())\ .first() session.close() last_day = q[0] last_day = dt.datetime.strptime(last_day, '%Y-%m-%d') one_year = last_day - dt.timedelta(days=365) session = Session(engine) q1 = session.query(Measurement.prcp,Measurement.date).\ filter(Measurement.date >= one_year.date().strftime('%Y-%m-%d')) session.close() precipitation = {} for prcp, date in q1: precipitation.append({date:prcp}) return jsonify(precipitation) @app.route("/api/v1.0/stations") def stations: session = Session(engine) q = session.query(Station.name) session.close() stations = list(np.unravel(q)) return jsonify(stations) @app.route("/api/v1.0/tobs") def tobs: session = Session(engine) q = session.query(Measurement.date).order_by(Measurement.date.desc())\ .first() session.close() last_day = q[0] last_day = dt.datetime.strptime(last_day, '%Y-%m-%d') one_year = last_day - dt.timedelta(days=365) session = Session(engine) q1 = session.query(Measurement.prcp,Measurement.date).\ filter(Measurement.date >= one_year.date().strftime('%Y-%m-%d')) session.close() precipitation = {} for prcp, date in q1: precipitation.append({date:prcp}) return jsonify(precipitation) @app.route("/api/v1.0/<start>") def start: def calc_temps(start_date, end_date): """TMIN, TAVG, and TMAX for a list of dates. Args: start_date (string): A date string in the format %Y-%m-%d end_date (string): A date string in the format %Y-%m-%d Returns: TMIN, TAVE, and TMAX """ session = Session(engine) q = session.query(func.min(Measurement.tobs), func.avg(Measurement.tobs), func.max(Measurement.tobs)).\ filter(Measurement.date >= start_date) session.close() for i in q: print(f"Minimum temperature: {i[0]}") print(f"Maximum temperature: {i[2]}") print(f"Average temperature: {i[1]}") @app.route("/api/v1.0/<start>/<end>") def startend: def calc_temps(start_date, end_date): """TMIN, TAVG, and TMAX for a list of dates. Args: start_date (string): A date string in the format %Y-%m-%d end_date (string): A date string in the format %Y-%m-%d Returns: TMIN, TAVE, and TMAX """ session = Session(engine) q = session.query(func.min(Measurement.tobs), func.avg(Measurement.tobs), func.max(Measurement.tobs)).\ filter(Measurement.date >= start_date).filter(Measurement.date <= end_date).all() session.close() for i in q: print(f"Minimum temperature: {i[0]}") print(f"Maximum temperature: {i[2]}") print(f"Average temperature: {i[1]}") if __name__ = "__main__": app.run(debug=true)
28.397059
107
0.624547
515
3,862
4.6
0.219417
0.06965
0.025327
0.014774
0.705361
0.67328
0.649219
0.649219
0.649219
0.649219
0
0.012358
0.20378
3,862
136
108
28.397059
0.758049
0.020456
0
0.561798
0
0
0.140635
0.038095
0
0
0
0
0
0
null
null
0
0.078652
null
null
0.067416
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
8bf809acd31dabafceaa2cbdbb0d1c012f70e5fa
349
py
Python
shop/admin.py
LudwigOtto/ECommerce
07fe32954604f9f9785e5e1b4c51c405d1d08323
[ "MIT" ]
1
2020-03-27T18:09:46.000Z
2020-03-27T18:09:46.000Z
shop/admin.py
LudwigOtto/ECommerce
07fe32954604f9f9785e5e1b4c51c405d1d08323
[ "MIT" ]
null
null
null
shop/admin.py
LudwigOtto/ECommerce
07fe32954604f9f9785e5e1b4c51c405d1d08323
[ "MIT" ]
null
null
null
from django.contrib import admin # Register your models here. from .models import Inventory class InventoryAdmin(admin.ModelAdmin): list_display = ['item_id', 'item_name', 'quantity', 'price', 'seller', 'type' ] list_editable = ['item_name', 'quantity', 'price', 'seller', 'type' ] admin.site.register(Inventory, InventoryAdmin)
24.928571
63
0.702006
40
349
6
0.6
0.066667
0.133333
0.175
0.258333
0.258333
0
0
0
0
0
0
0.154728
349
14
64
24.928571
0.813559
0.074499
0
0.25
0
0
0.220497
0
0
0
0
0
0
1
0
false
0
0.25
0
0.625
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
e3175828e131dae55e00b68ba6827e55d4d0dab6
1,027
py
Python
com.systemincloud.examples.tasks.pythontask/src/test/py/tasks/generator/GeneratorAtomicWith2SIn1AIn.py
systemincloud/sic-examples
b82d5d672f515b1deb5ddb35c5a93c003e03c030
[ "Apache-2.0" ]
null
null
null
com.systemincloud.examples.tasks.pythontask/src/test/py/tasks/generator/GeneratorAtomicWith2SIn1AIn.py
systemincloud/sic-examples
b82d5d672f515b1deb5ddb35c5a93c003e03c030
[ "Apache-2.0" ]
15
2015-01-08T20:28:19.000Z
2016-07-20T07:19:15.000Z
com.systemincloud.examples.tasks.pythontask/src/test/py/tasks/generator/GeneratorAtomicWith2SIn1AIn.py
systemincloud/sic-examples
b82d5d672f515b1deb5ddb35c5a93c003e03c030
[ "Apache-2.0" ]
null
null
null
from sicpythontask.PythonTaskInfo import PythonTaskInfo from sicpythontask.PythonTask import PythonTask from sicpythontask.InputPort import InputPort from sicpythontask.OutputPort import OutputPort from sicpythontask.data.Int32 import Int32 from sicpythontask.data.Control import Control @PythonTaskInfo(generator=True) class GeneratorAtomicWith2SIn1AIn(PythonTask): def __init_ports__(self): self.in1 = InputPort(name="in1", data_type=Int32) self.in2 = InputPort(name="in2", data_type=Int32) self.in3 = InputPort(name="in3", data_type=Control, asynchronous=True) self.out = OutputPort(name="out", data_type=Int32) def runner_start(self): self.on = True def execute_async(self, async_in): self.on = not self.on def generate(self): if self.on: self.out.put_data(Int32(637343730)) self.sleep(500) def execute(self, grp): self.out.put_data(Int32(self.in1.get_data(Int32).values[0] + self.in2.get_data(Int32).values[0]))
34.233333
105
0.720545
132
1,027
5.484848
0.318182
0.140884
0.053867
0.046961
0.104972
0
0
0
0
0
0
0.049587
0.175268
1,027
29
106
35.413793
0.805195
0
0
0
0
0
0.011685
0
0
0
0
0
0
1
0.217391
false
0
0.26087
0
0.521739
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
e31c6f46d2ca8c2687cb86844e1a4c412bcfc2dd
481
py
Python
kaynet/optim.py
AmrMKayid/KayNet
2779ca310970444217c2e7bff0d7881b10ebda20
[ "MIT" ]
null
null
null
kaynet/optim.py
AmrMKayid/KayNet
2779ca310970444217c2e7bff0d7881b10ebda20
[ "MIT" ]
null
null
null
kaynet/optim.py
AmrMKayid/KayNet
2779ca310970444217c2e7bff0d7881b10ebda20
[ "MIT" ]
null
null
null
""" An optimizer is used to adjust the parameters of our network based on the gradients computed during backpropagation """ from kaynet.nn import NeuralNet class Optimizer: def step(self, net: NeuralNet) -> None: raise NotImplementedError class SGD(Optimizer): def __init__(self, lr: float = 0.01) -> None: self.lr = lr def step(self, net: NeuralNet) -> None: for param, grad in net.params_and_grads(): param -= self.lr * grad
21.863636
50
0.663202
65
481
4.815385
0.661538
0.057508
0.070288
0.089457
0.172524
0.172524
0
0
0
0
0
0.008242
0.243243
481
21
51
22.904762
0.851648
0.239085
0
0.2
0
0
0
0
0
0
0
0
0
1
0.3
false
0
0.1
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
e32bea89c5bf35e622d3f22f6b0a7e7baf85cd45
521
py
Python
src/logger.py
SoutheyLab/genericpipe
316073109f6661bbc6613f855cb895f3b9f3f847
[ "MIT" ]
2
2017-12-06T13:49:11.000Z
2018-04-27T03:10:54.000Z
src/logger.py
SoutheyLab/genericpipe
316073109f6661bbc6613f855cb895f3b9f3f847
[ "MIT" ]
1
2019-04-09T05:58:34.000Z
2019-04-09T05:58:34.000Z
src/logger.py
SoutheyLab/genericpipe
316073109f6661bbc6613f855cb895f3b9f3f847
[ "MIT" ]
2
2018-10-16T10:28:52.000Z
2018-10-17T08:45:55.000Z
''' Initialisation and use of concurrency-friendly logging facility. ''' import ruffus.cmdline as cmdline class Logger(object): '''Concurrency friendly logging facility''' def __init__(self, prog_name, log_file, verbosity): proxy, mutex = cmdline.setup_logging(__name__, log_file, verbosity) self.proxy = proxy self.mutex = mutex def info(self, message): '''Display an informational message to the log file''' with self.mutex: self.proxy.info(message)
26.05
75
0.673704
62
521
5.467742
0.548387
0.061947
0.153392
0.20059
0
0
0
0
0
0
0
0
0.228407
521
19
76
27.421053
0.843284
0.289827
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0
0.444444
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
e3393d913587ca2870240f66f479ac55867ffc79
58
py
Python
tenet/settings.py
ferrouswheel/tenet
eff1af2b2aebe84a4a566350a3d68bd7f0da7117
[ "MIT" ]
7
2015-04-22T06:13:53.000Z
2021-12-09T07:23:36.000Z
tenet/settings.py
ferrouswheel/tenet
eff1af2b2aebe84a4a566350a3d68bd7f0da7117
[ "MIT" ]
3
2015-04-19T04:05:52.000Z
2015-05-03T05:04:23.000Z
tenet/settings.py
ferrouswheel/tenet
eff1af2b2aebe84a4a566350a3d68bd7f0da7117
[ "MIT" ]
null
null
null
MAX_RECIPIENTS_PER_MESSAGE = 5 MSG_BLOOM_FILTER_SIZE = 80
19.333333
30
0.862069
10
58
4.4
1
0
0
0
0
0
0
0
0
0
0
0.057692
0.103448
58
2
31
29
0.788462
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
e33bb271ab756df3f71f538b09e9aa7b1669244e
1,106
py
Python
model_download.py
gkswjdzz/Ainized-StanfordNLP
a4c20f1649da1e40b85238754a70a3ff54525213
[ "MIT" ]
4
2020-02-27T13:59:04.000Z
2022-03-06T02:47:27.000Z
model_download.py
gkswjdzz/ainized-stanfordnlp
a4c20f1649da1e40b85238754a70a3ff54525213
[ "MIT" ]
null
null
null
model_download.py
gkswjdzz/ainized-stanfordnlp
a4c20f1649da1e40b85238754a70a3ff54525213
[ "MIT" ]
null
null
null
import stanfordnlp if __name__ == '__main__': #conll_shorthands = ['af_afribooms', 'ar_padt', 'bg_btb', 'bxr_bdt', 'ca_ancora', 'cs_cac', 'cs_fictree', 'cs_pdt', 'cu_proiel', 'da_ddt', 'de_gsd', 'el_gdt', 'en_ewt', 'en_gum', 'en_lines', 'es_ancora', 'et_edt', 'eu_bdt', 'fa_seraji', 'fi_ftb', 'fi_tdt', 'fr_gsd', 'fro_srcmf', 'fr_sequoia', 'fr_spoken', 'ga_idt', 'gl_ctg', 'gl_treegal', 'got_proiel', 'grc_perseus', 'grc_proiel', 'he_htb', 'hi_hdtb', 'hr_set', 'hsb_ufal', 'hu_szeged', 'hy_armtdp', 'id_gsd', 'it_isdt', 'it_postwita', 'ja_gsd', 'kk_ktb', 'kmr_mg', 'ko_gsd', 'ko_kaist', 'la_ittb', 'la_perseus', 'la_proiel', 'lv_lvtb', 'nl_alpino', 'nl_lassysmall', 'no_bokmaal', 'no_nynorsklia', 'no_nynorsk', 'pl_lfg', 'pl_sz', 'pt_bosque', 'ro_rrt', 'ru_syntagrus', 'ru_taiga', 'sk_snk', 'sl_ssj', 'sl_sst', 'sme_giella', 'sr_set', 'sv_lines', 'sv_talbanken', 'tr_imst', 'ug_udt', 'uk_iu', 'ur_udtb', 'vi_vtb', 'zh_gsd'] conll_shorthands = ['en_ewt', 'en_gum', 'en_lines', 'ko_gsd', 'ko_kaist'] for lang in conll_shorthands: stanfordnlp.download(lang, './models', force = True)
138.25
881
0.659132
176
1,106
3.636364
0.721591
0.070313
0.021875
0.03125
0.053125
0.053125
0
0
0
0
0
0
0.110307
1,106
8
882
138.25
0.650407
0.792043
0
0
0
0
0.217391
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
e349110d1911c58d28b1827c6532896e012f4d92
1,343
py
Python
setup.py
imacube/solrcloudadmin
02070442c22c9099378d339b742a176b1ec5785d
[ "Apache-2.0" ]
null
null
null
setup.py
imacube/solrcloudadmin
02070442c22c9099378d339b742a176b1ec5785d
[ "Apache-2.0" ]
null
null
null
setup.py
imacube/solrcloudadmin
02070442c22c9099378d339b742a176b1ec5785d
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python import sys from setuptools import setup from solrcloudadmin import __version__ setup( name='SolrCloudAdmin', version=__version__, author='Ryan Steele', author_email='imacube@gmail.com', packages=[ 'solrcloudadmin' ], install_requires=[ 'kazoo>=2.2.1', 'requests>=2.11.1', 'tqdm>=4.8.4' ], scripts=['scripts/solrcloud-add-replica', 'scripts/solrcloud-cluster-details', 'scripts/solrcloud-cluster-recovery', 'scripts/solrcloud-collection-count', 'scripts/solrcloud-delete-down', 'scripts/solrcloud-delete-replica', 'scripts/solrcloud-document-count', 'scripts/solrcloud-list-live-nodes', 'scripts/solrcloud-migrate-collections', 'scripts/solrcloud-move-collection', 'scripts/solrcloud-replica-count', 'scripts/solrcloud-shard-count', 'scripts/solrcloud-unhealthy-cores', 'scripts/solrcloud-view-collections' ], url='http://github.com/imacube/solrcloudadmin-py', license='LICENSE', description='utility for running routine admin jobs on a SolrCloud cluster', long_description=open('README.md').read() + '\n\n' + open('CHANGES.md').read() )
32.756098
80
0.60834
133
1,343
6.06015
0.548872
0.277916
0.104218
0
0
0
0
0
0
0
0
0.01
0.255398
1,343
40
81
33.575
0.796
0.014892
0
0.081081
0
0
0.515885
0.342663
0
0
0
0
0
1
0
true
0
0.081081
0
0.081081
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
1
0
0
0
0
0
0
2
e373d3ab3ad5ef837f1d405d9ad420266b95b61c
966
py
Python
py/py_0218_perfect_right-angled_triangles.py
lcsm29/project-euler
fab794ece5aa7a11fc7c2177f26250f40a5b1447
[ "MIT" ]
null
null
null
py/py_0218_perfect_right-angled_triangles.py
lcsm29/project-euler
fab794ece5aa7a11fc7c2177f26250f40a5b1447
[ "MIT" ]
null
null
null
py/py_0218_perfect_right-angled_triangles.py
lcsm29/project-euler
fab794ece5aa7a11fc7c2177f26250f40a5b1447
[ "MIT" ]
null
null
null
# Solution of; # Project Euler Problem 218: Perfect right-angled triangles # https://projecteuler.net/problem=218 # # Consider the right angled triangle with sides a=7, b=24 and c=25. The area # of this triangle is 84, which is divisible by the perfect numbers 6 and 28. # Moreover it is a primitive right angled triangle as gcd(a,b)=1 and # gcd(b,c)=1. Also c is a perfect square. We will call a right angled triangle # perfect if-it is a primitive right angled triangle-its hypotenuse is a # perfect squareWe will call a right angled triangle super-perfect if-it is a # perfect right angled triangle and-its area is a multiple of the perfect # numbers 6 and 28. How many perfect right-angled triangles with c≤1016 exist # that are not super-perfect? # # by lcsm29 http://github.com/lcsm29/project-euler import timed def dummy(n): pass if __name__ == '__main__': n = 1000 i = 10000 prob_id = 218 timed.caller(dummy, n, i, prob_id)
34.5
79
0.727743
168
966
4.130952
0.464286
0.126801
0.164265
0.07781
0.275216
0.242075
0.095101
0
0
0
0
0.052699
0.194617
966
27
80
35.777778
0.838046
0.811594
0
0
0
0
0.048193
0
0
0
0
0
0
1
0.125
false
0.125
0.125
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
8b521ad7c15f8245cc008b42cceb2cf5cfbd927c
53
py
Python
gquant/dataframe_flow/cache.py
h2oai/gQuant
d82ebef2bb11b2849c67b6c0749b9cbc624b626c
[ "Apache-2.0" ]
1
2021-12-24T06:24:21.000Z
2021-12-24T06:24:21.000Z
gquant/dataframe_flow/cache.py
h2oai/gQuant
d82ebef2bb11b2849c67b6c0749b9cbc624b626c
[ "Apache-2.0" ]
null
null
null
gquant/dataframe_flow/cache.py
h2oai/gQuant
d82ebef2bb11b2849c67b6c0749b9cbc624b626c
[ "Apache-2.0" ]
2
2021-11-02T09:14:59.000Z
2022-01-05T21:43:47.000Z
cache_ports = {} cache_schema = {} cache_columns = {}
17.666667
18
0.679245
6
53
5.5
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.150943
53
3
18
17.666667
0.733333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
8b546d202051a1d123623e2092a370581464f70a
338
py
Python
sponge-standalone-app/examples/standalone/remote_api/standalone_remote_api.py
mnpas/sponge
7190f23ae888bbef49d0fbb85157444d6ea48bcd
[ "Apache-2.0" ]
9
2017-12-16T21:48:57.000Z
2022-01-06T12:22:24.000Z
sponge-standalone-app/examples/standalone/remote_api/standalone_remote_api.py
mnpas/sponge
7190f23ae888bbef49d0fbb85157444d6ea48bcd
[ "Apache-2.0" ]
3
2020-12-18T11:56:46.000Z
2022-03-31T18:37:10.000Z
sponge-standalone-app/examples/standalone/remote_api/standalone_remote_api.py
mnpas/sponge
7190f23ae888bbef49d0fbb85157444d6ea48bcd
[ "Apache-2.0" ]
2
2019-12-29T16:08:32.000Z
2020-06-15T14:05:34.000Z
""" Sponge Knowledge Base Remote API """ class UpperCase(Action): def onConfigure(self): self.withArg(StringType("text").withLabel("Text to upper case")).withResult(StringType().withLabel("Upper case text")) def onCall(self, text): self.logger.info("Action {} called", self.meta.name) return text.upper()
28.166667
126
0.671598
41
338
5.536585
0.634146
0.079295
0
0
0
0
0
0
0
0
0
0
0.174556
338
11
127
30.727273
0.81362
0.094675
0
0
0
0
0.177852
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
8b5c5377a1f3c94d2745073ba8e4cabe3b867d05
344
py
Python
guanabara/Exercicios/mundo 2 _ aulas 12 a 15/057.py
pbittencourt/datasciencestudies
85f0b2a4366fe7c6daa5628ed4bd2994355963c0
[ "MIT" ]
null
null
null
guanabara/Exercicios/mundo 2 _ aulas 12 a 15/057.py
pbittencourt/datasciencestudies
85f0b2a4366fe7c6daa5628ed4bd2994355963c0
[ "MIT" ]
null
null
null
guanabara/Exercicios/mundo 2 _ aulas 12 a 15/057.py
pbittencourt/datasciencestudies
85f0b2a4366fe7c6daa5628ed4bd2994355963c0
[ "MIT" ]
null
null
null
# SOMENTE GÊNEROS CORRETOS! # um pouco mais inclusivo do q o original :) g = str(input('Insira seu gênero [M|F|T|Q|N]: _ ')).strip().upper()[0] while g not in 'MFTQN': g = str(input('Formato incorreto! Tente novamente.\nInsira seu gênero [M|F|T|Q|N]: _ ')).strip().upper()[0] print('Obrigado. Gênero {} registrado com sucesso!'.format(g))
43
111
0.665698
56
344
4.053571
0.696429
0.035242
0.079295
0.096916
0.220264
0.220264
0.220264
0.220264
0.220264
0.220264
0
0.00678
0.142442
344
7
112
49.142857
0.762712
0.197674
0
0
0
0.25
0.553114
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
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
8b5dd960540f3ab582ac9a0325bf9c0d099c09ad
4,162
py
Python
airzone/aido.py
Mike-de-bike/python-airzone
8e87b15f1690075d0dcbad3012d0910706dedab6
[ "MIT" ]
8
2019-04-08T21:57:09.000Z
2021-12-13T17:07:38.000Z
airzone/aido.py
Mike-de-bike/python-airzone
8e87b15f1690075d0dcbad3012d0910706dedab6
[ "MIT" ]
11
2020-04-16T20:37:30.000Z
2021-09-07T10:43:01.000Z
airzone/aido.py
Mike-de-bike/python-airzone
8e87b15f1690075d0dcbad3012d0910706dedab6
[ "MIT" ]
7
2019-10-31T09:27:07.000Z
2021-07-14T06:33:38.000Z
from enum import IntEnum from deprecated import deprecated # type: ignore class OperationMode(IntEnum): AUTO = 1 COOLING = 2 HEATING = 3 FAN = 4 DRY = 5 @classmethod def _missing_(cls, value): return OperationMode.AUTO class Speed(IntEnum): AUTO = 0 SPEED_1 = 1 SPEED_2 = 2 SPEED_3 = 3 SPEED_4 = 4 SPEED_5 = 5 SPEED_6 = 6 SPEED_7 = 7 @classmethod def _missing_(cls, value): return Speed.AUTO class Louvres(IntEnum): POS_0 = 0 POS_1 = 1 POS_2 = 2 POS_3 = 3 POS_4 = 4 POS_5 = 5 POS_6 = 6 POS_7 = 7 AUTO = 8 SWING = 9 SWIRL = 10 @classmethod def _missing_(cls, value): return Louvres.AUTO class Aido(): def __init__(self, gateway, machineId, has_louvres = True, speed_as_per = False): self._gateway = gateway self._machineId = machineId self._machine_state = None self._has_louvres = has_louvres self._speed_as_per = speed_as_per self._retrieve_machine_state() def _read_registers(self, address, numRegisters): return self._gateway.read_input_registers( self._machineId, address, numRegisters) def _write_register(self, address, value): return self._gateway.write_single_register( self._machineId, address, value) def _retrieve_machine_state(self): self._machine_state = self._read_registers(0, 7) def get_is_machine_on(self): if self._machine_state == None: return 0 return self._machine_state[0] def turn_on(self): self._write_register(0, 1) def turn_off(self): self._write_register(0, 0) def get_signal_temperature_value(self): if self._machine_state == None: return -1 return self._machine_state[1] / 10 def set_signal_temperature_value(self, value): if value >= 18 or value <= 30: self._write_register(1, int(value * 10)) def get_local_temperature(self): return self._machine_state[2] / 10 def get_operation_mode(self): if self._machine_state == None: return OperationMode.AUTO return OperationMode(self._machine_state[3]) def set_operation_mode(self, operationMode): if not self.get_is_machine_on(): self.turn_on() self._write_register(3, OperationMode[operationMode].value) def get_speed(self): if self._machine_state == None: return Speed.AUTO value = self._machine_state[4] #TODO: review for different machines if self._speed_as_per: value = value * 4 // 100 return Speed(value) def set_speed(self, speed): value = Speed[speed].value if self._speed_as_per: value = value*100 // 4 self._write_register(4, value) def get_speed_steps(self): if self._speed_as_per: return 4 return 7 def has_louvres(self): return self._has_louvres def get_louvres(self): if self._machine_state == None: return Louvres.AUTO return Louvres(self._machine_state[5]) def set_louvres(self, louvre): self._write_register(5, Louvres[louvre].value) #TODO Errors and warnings def __str__(self): return "Aido with id: " + str(self._machineId) + \ "On:" + str(self.get_is_machine_on) + \ "Operation Mode: " + str(self.get_operation_mode()) + \ "Signal Temp: " + str(self.get_signal_temperature_value()) + \ "Local Temp: " + str(self.get_local_temperature()) + \ "Speed: " + str(self.get_speed()) + \ "Louvres: " + str(self.get_louvres()) def unique_id(self): return f'Aido_M{self._machineId}_{str(self._gateway)}' @property def machine_state(self): return self._machine_state @deprecated('Use the machine_state property instead') def get_machine_state(self): return self._machine_state
25.850932
85
0.604517
519
4,162
4.529865
0.186898
0.102084
0.102084
0.051042
0.226712
0.167163
0.122501
0
0
0
0
0.026971
0.305142
4,162
160
86
26.0125
0.785961
0.017059
0
0.184874
0
0
0.03817
0.010766
0
0
0
0.00625
0
1
0.210084
false
0
0.016807
0.092437
0.655462
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
8b84c62d0837a93bc61a0ccd9fa0278c6879e73c
639
py
Python
command_lifecycle/buffer.py
richtier/voice-command-lifecycle
91db4977c56d8b0c2ef6d58bd8596b778262cded
[ "MIT" ]
5
2018-05-22T19:25:40.000Z
2019-08-01T05:43:41.000Z
command_lifecycle/buffer.py
richtier/voice-command-lifecycle
91db4977c56d8b0c2ef6d58bd8596b778262cded
[ "MIT" ]
6
2017-08-31T21:13:34.000Z
2019-01-09T23:06:31.000Z
command_lifecycle/buffer.py
richtier/voice-command-lifecycle
91db4977c56d8b0c2ef6d58bd8596b778262cded
[ "MIT" ]
null
null
null
import collections class AudioBufferBase(collections.deque): maxlen = None def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs, maxlen=self.maxlen) def get(self): return bytes(bytearray(self)) def popleft_size(self, size): sliced = bytearray() for i in range(size): if self: sliced.append(self.popleft()) return bytes(sliced) class WakewordAudioBuffer(AudioBufferBase): """ Store a few seconds of audio""" maxlen = 40000 class CommandAudioBuffer(AudioBufferBase): """ Store a "infinite" seconds of audio""" pass
22.034483
61
0.630673
69
639
5.710145
0.536232
0.050761
0.106599
0
0
0
0
0
0
0
0
0.010526
0.256651
639
28
62
22.821429
0.818947
0.100156
0
0
0
0
0
0
0
0
0
0
0
1
0.176471
false
0.058824
0.058824
0.058824
0.647059
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
8b961bbd9f3aeee1093b576a90d15137503656e5
257
py
Python
flat_sales/flat_sales/doctype/flat_payment_schedule/test_flat_payment_schedule.py
swamedh/flat_sales
28f3d517e06591669c24accaba4e0683eabe8901
[ "MIT" ]
1
2015-10-06T14:03:29.000Z
2015-10-06T14:03:29.000Z
sales/sales/doctype/flat_payment_schedule/test_flat_payment_schedule.py
dngupta78/sales
aee6be4ac46f6b63e85f819f68f14c242f1c9480
[ "MIT" ]
null
null
null
sales/sales/doctype/flat_payment_schedule/test_flat_payment_schedule.py
dngupta78/sales
aee6be4ac46f6b63e85f819f68f14c242f1c9480
[ "MIT" ]
null
null
null
# Copyright (c) 2013, deepak and Contributors # See license.txt from __future__ import unicode_literals import frappe import unittest test_records = frappe.get_test_records('Flat Payment Schedule') class TestFlatPaymentSchedule(unittest.TestCase): pass
21.416667
63
0.821012
32
257
6.34375
0.8125
0.108374
0
0
0
0
0
0
0
0
0
0.017621
0.116732
257
11
64
23.363636
0.876652
0.229572
0
0
0
0
0.107692
0
0
0
0
0
0
1
0
false
0.166667
0.5
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
8b96abc6103ccef39aeef713dd0aada1c8820934
1,254
py
Python
app/deliveries/models.py
swelanauguste/silver-fortnight
8ee47f2a15aaa4c83a04a55da0c984a65a9ba6ea
[ "MIT" ]
null
null
null
app/deliveries/models.py
swelanauguste/silver-fortnight
8ee47f2a15aaa4c83a04a55da0c984a65a9ba6ea
[ "MIT" ]
null
null
null
app/deliveries/models.py
swelanauguste/silver-fortnight
8ee47f2a15aaa4c83a04a55da0c984a65a9ba6ea
[ "MIT" ]
null
null
null
import uuid from django.db import models from django.urls import reverse from mixins.assets import TimeStampMixin from products.models import Product # def uid(): # uid = uuid.uuid4() # uid = str(uid).upper() # return uid.split("-")[4] # Create your models here. class Delivery(TimeStampMixin): # uid = models.CharField(max_length=20, editable=False, default=uid()) product = models.ForeignKey( Product, related_name="deliveries", on_delete=models.SET_NULL, null=True ) qty = models.IntegerField(default=0) delivery_date = models.DateField(blank=True, null=True) deliveried_to = models.CharField(max_length=100, blank=True, null=True) deliveried_by = models.CharField(max_length=100, blank=True, null=True) delivery_comment = models.TextField(blank=True, null=True) class Meta: ordering = ["-created_at"] verbose_name_plural = "Deliveries" def get_absolute_url(self): return reverse("deliveries:delivery-detail", kwargs={"pk": self.pk}) def get_update_url(self): return reverse("stores:deliveries-update", kwargs={"pk": self.pk}) def get_delivered_quantity(self): return self.qty def __str__(self): return self.product.name
29.857143
80
0.696172
161
1,254
5.279503
0.440994
0.047059
0.061176
0.08
0.194118
0.150588
0.103529
0.103529
0.103529
0
0
0.010763
0.185008
1,254
41
81
30.585366
0.820939
0.145933
0
0
0
0
0.079887
0.046992
0
0
0
0
0
1
0.16
false
0
0.2
0.16
0.84
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
8baa30409eb8316112c0be1b3b6d6758e7e4d124
995
py
Python
learning/conn_orm.py
relax-space/alchemy-first
1df6494a19a0779333b37cc946f89cae64cd4445
[ "Apache-2.0" ]
null
null
null
learning/conn_orm.py
relax-space/alchemy-first
1df6494a19a0779333b37cc946f89cae64cd4445
[ "Apache-2.0" ]
null
null
null
learning/conn_orm.py
relax-space/alchemy-first
1df6494a19a0779333b37cc946f89cae64cd4445
[ "Apache-2.0" ]
null
null
null
''' 说明: orm连接池设置, 如果设置pool_size=5, 那么最多只能开5个连接 ''' from sqlalchemy import Column, Integer, String, create_engine from sqlalchemy.orm import Session, declarative_base Base = declarative_base() class Book(Base): __tablename__ = 'book' id = Column(Integer, primary_key=True, autoincrement=True) name = Column(String(30)) price = Column(Integer) engine = create_engine( 'mysql+mysqldb://root:1234@localhost:3306/test1', max_overflow=0) Base.metadata.create_all(engine) session = Session(engine) res = session.get(Book, 1) print(1) session = Session(engine) res = session.get(Book, 1) print(2) session = Session(engine) res = session.get(Book, 1) print(3) session = Session(engine) res = session.get(Book, 1) print(4) session = Session(engine) res = session.get(Book, 1) print(5) session = Session(engine) res = session.get(Book, 1) print(6) session = Session(engine) res = session.get(Book, 1) print(7) ''' 输出: 默认会创建5个连接,所以第6个连接不会创建成功 1 2 3 4 5 '''
16.864407
69
0.704523
140
995
4.921429
0.378571
0.142235
0.203193
0.233672
0.436865
0.436865
0.436865
0.436865
0.436865
0
0
0.041816
0.158794
995
58
70
17.155172
0.781362
0.042211
0
0.4375
0
0
0.056497
0.051977
0
0
0
0
0
1
0
false
0
0.0625
0
0.21875
0.21875
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
8bb2d353344fe38bfd61615c16d33b11ca1212f0
199
py
Python
day01/03_urljoin.py
Amiao-miao/month04
93edb68c88d5a13587bf93f59e241b4ca889e0c1
[ "Apache-2.0" ]
null
null
null
day01/03_urljoin.py
Amiao-miao/month04
93edb68c88d5a13587bf93f59e241b4ca889e0c1
[ "Apache-2.0" ]
null
null
null
day01/03_urljoin.py
Amiao-miao/month04
93edb68c88d5a13587bf93f59e241b4ca889e0c1
[ "Apache-2.0" ]
null
null
null
''' https://www.guazi.com/huzhou/buy/o2/#bread 第一页:o1 第二页:o2 …… 第n页:on ''' url='https://www.guazi.com/huzhou/buy/o{}/#bread' for page in range(1,51): page_url=url.format(page) print(page_url)
18.090909
49
0.663317
38
199
3.578947
0.631579
0.117647
0.191176
0.235294
0.367647
0.367647
0
0
0
0
0
0.033708
0.105528
199
11
50
18.090909
0.696629
0.331658
0
0
0
0
0.34127
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2