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
b9fc1a5811f8cb9a19d87886bf89f5af3562cfe0
245
py
Python
evaluation_dgl_resnet/models/__init__.py
MuawizChaudhary/STARTUP
03f39b34a4ec232f132173b4a1e67ea04165e52b
[ "MIT" ]
null
null
null
evaluation_dgl_resnet/models/__init__.py
MuawizChaudhary/STARTUP
03f39b34a4ec232f132173b4a1e67ea04165e52b
[ "MIT" ]
null
null
null
evaluation_dgl_resnet/models/__init__.py
MuawizChaudhary/STARTUP
03f39b34a4ec232f132173b4a1e67ea04165e52b
[ "MIT" ]
null
null
null
from .resnet import * from .dataparallel_wrapper import * from .resnet10 import ResNet10 from .resnet12 import Resnet12 from .vgg import vgg11 from .dgl import VGGn from .resnet_dgl import ResNet10_dgl from .resnet_double import ResNet10_double
27.222222
42
0.828571
35
245
5.657143
0.342857
0.151515
0
0
0
0
0
0
0
0
0
0.065728
0.130612
245
8
43
30.625
0.86385
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
6a1d83a97903f098db516ea0ea5d80fb3fe9814c
21,463
py
Python
conans/test/functional/command/export_test.py
akemimadoka/conan
272be061082ddf73f1f5d71bf98f50273d7f3cba
[ "MIT" ]
null
null
null
conans/test/functional/command/export_test.py
akemimadoka/conan
272be061082ddf73f1f5d71bf98f50273d7f3cba
[ "MIT" ]
null
null
null
conans/test/functional/command/export_test.py
akemimadoka/conan
272be061082ddf73f1f5d71bf98f50273d7f3cba
[ "MIT" ]
null
null
null
import os import stat import textwrap import unittest from parameterized import parameterized from conans.model.manifest import FileTreeManifest from conans.model.ref import ConanFileReference from conans.paths import CONANFILE, CONAN_MANIFEST from conans.test.utils.cpp_test_files import cpp_hello_conan_files from conans.test.utils.tools import TestClient, GenConanfile from conans.test.utils.tools import create_local_git_repo from conans.util.files import load, save class ExportSettingsTest(unittest.TestCase): def test_basic(self): client = TestClient() conanfile = """ from conans import ConanFile class TestConan(ConanFile): name = "Hello" version = "1.2" settings = {"os": ["Linux"]} """ files = {CONANFILE: conanfile} client.save(files) client.run("export . lasote/stable") self.assertIn("WARN: Conanfile doesn't have 'license'", client.out) client.run("install Hello/1.2@lasote/stable -s os=Windows", assert_error=True) self.assertIn("'Windows' is not a valid 'settings.os' value", client.out) self.assertIn("Possible values are ['Linux']", client.out) def export_without_full_reference_test(self): client = TestClient() client.save({"conanfile.py": """from conans import ConanFile class MyPkg(ConanFile): pass """}) client.run("export . lasote/stable", assert_error=True) self.assertIn("conanfile didn't specify name", client.out) client.save({"conanfile.py": """from conans import ConanFile class MyPkg(ConanFile): name="Lib" """}) client.run("export . lasote/stable", assert_error=True) self.assertIn("conanfile didn't specify version", client.out) client.save({"conanfile.py": """from conans import ConanFile class MyPkg(ConanFile): pass """}) client.run("export . lib/1.0@lasote/channel") self.assertIn("lib/1.0@lasote/channel: A new conanfile.py version was exported", client.out) client.save({"conanfile.py": """from conans import ConanFile class MyPkg(ConanFile): name="Lib" version="1.0" """}) client.run("export . lasote", assert_error=True) self.assertIn("Invalid parameter 'lasote', specify the full reference or user/channel", client.out) def test_export_read_only(self): client = TestClient() conanfile = """ from conans import ConanFile class TestConan(ConanFile): name = "Hello" version = "1.2" exports = "file1.txt" exports_sources = "file2.txt" """ ref = ConanFileReference.loads("Hello/1.2@lasote/stable") export_path = client.cache.package_layout(ref).export() export_src_path = client.cache.package_layout(ref).export_sources() files = {CONANFILE: conanfile, "file1.txt": "", "file2.txt": ""} client.save(files) mode1 = os.stat(os.path.join(client.current_folder, "file1.txt")).st_mode mode2 = os.stat(os.path.join(client.current_folder, "file2.txt")).st_mode os.chmod(os.path.join(client.current_folder, "file1.txt"), mode1 &~ stat.S_IWRITE) os.chmod(os.path.join(client.current_folder, "file2.txt"), mode2 &~ stat.S_IWRITE) client.run("export . lasote/stable") self.assertEqual(load(os.path.join(export_path, "file1.txt")), "") self.assertEqual(load(os.path.join(export_src_path, "file2.txt")), "") with self.assertRaises(IOError): save(os.path.join(export_path, "file1.txt"), "") with self.assertRaises(IOError): save(os.path.join(export_src_path, "file2.txt"), "") self.assertIn("WARN: Conanfile doesn't have 'license'", client.out) files = {CONANFILE: conanfile, "file1.txt": "file1", "file2.txt": "file2"} os.chmod(os.path.join(client.current_folder, "file1.txt"), mode1 | stat.S_IWRITE) os.chmod(os.path.join(client.current_folder, "file2.txt"), mode2 | stat.S_IWRITE) client.save(files) client.run("export . lasote/stable") self.assertEqual(load(os.path.join(export_path, "file1.txt")), "file1") self.assertEqual(load(os.path.join(export_src_path, "file2.txt")), "file2") client.run("install Hello/1.2@lasote/stable --build=missing") self.assertIn("Hello/1.2@lasote/stable: Generating the package", client.out) files = {CONANFILE: conanfile, "file1.txt": "", "file2.txt": ""} client.save(files) os.chmod(os.path.join(client.current_folder, "file1.txt"), mode1 &~ stat.S_IWRITE) os.chmod(os.path.join(client.current_folder, "file2.txt"), mode2 &~ stat.S_IWRITE) client.run("export . lasote/stable") self.assertEqual(load(os.path.join(export_path, "file1.txt")), "") self.assertEqual(load(os.path.join(export_src_path, "file2.txt")), "") client.run("install Hello/1.2@lasote/stable --build=Hello") self.assertIn("Hello/1.2@lasote/stable: Generating the package", client.out) def test_code_parent(self): """ when referencing the parent, the relative folder "sibling" will be kept """ base = """ from conans import ConanFile class TestConan(ConanFile): name = "Hello" version = "1.2" exports = "../*.txt" """ for conanfile in (base, base.replace("../*.txt", "../sibling*")): client = TestClient() files = {"recipe/conanfile.py": conanfile, "sibling/file.txt": "Hello World!"} client.save(files) client.current_folder = os.path.join(client.current_folder, "recipe") client.run("export . lasote/stable") ref = ConanFileReference("Hello", "1.2", "lasote", "stable") export_path = client.cache.package_layout(ref).export() content = load(os.path.join(export_path, "sibling/file.txt")) self.assertEqual("Hello World!", content) def test_code_sibling(self): # if provided a path with slash, it will use as a export base client = TestClient() conanfile = """ from conans import ConanFile class TestConan(ConanFile): name = "Hello" version = "1.2" exports = "../sibling/*.txt" """ files = {"recipe/conanfile.py": conanfile, "sibling/file.txt": "Hello World!"} client.save(files) client.current_folder = os.path.join(client.current_folder, "recipe") client.run("export . lasote/stable") ref = ConanFileReference("Hello", "1.2", "lasote", "stable") export_path = client.cache.package_layout(ref).export() content = load(os.path.join(export_path, "file.txt")) self.assertEqual("Hello World!", content) def test_code_several_sibling(self): # if provided a path with slash, it will use as a export base client = TestClient() conanfile = """ from conans import ConanFile class TestConan(ConanFile): name = "Hello" version = "1.2" exports_sources = "../test/src/*", "../cpp/*", "../include/*" """ files = {"recipe/conanfile.py": conanfile, "test/src/file.txt": "Hello World!", "cpp/file.cpp": "Hello World!", "include/file.h": "Hello World!"} client.save(files) client.current_folder = os.path.join(client.current_folder, "recipe") client.run("export . lasote/stable") ref = ConanFileReference("Hello", "1.2", "lasote", "stable") export_path = client.cache.package_layout(ref).export_sources() self.assertEqual(sorted(['file.txt', 'file.cpp', 'file.h']), sorted(os.listdir(export_path))) @parameterized.expand([("myconanfile.py", ), ("Conanfile.py", )]) def test_filename(self, filename): client = TestClient() conanfile = """ from conans import ConanFile class TestConan(ConanFile): name = "Hello" version = "1.2" """ client.save({filename: conanfile}) client.run("export %s lasote/stable" % filename) self.assertIn("Hello/1.2@lasote/stable: A new conanfile.py version was exported", client.out) ref = ConanFileReference("Hello", "1.2", "lasote", "stable") export_path = client.cache.package_layout(ref).export() conanfile = load(os.path.join(export_path, "conanfile.py")) self.assertIn('name = "Hello"', conanfile) manifest = load(os.path.join(export_path, "conanmanifest.txt")) self.assertIn('conanfile.py: cac514c81a0af0d87fa379b0bf16fbaa', manifest) def test_exclude_basic(self): client = TestClient() conanfile = """ from conans import ConanFile class TestConan(ConanFile): name = "Hello" version = "1.2" exports = "*.txt", "!*file1.txt" exports_sources = "*.cpp", "!*temp.cpp" """ client.save({CONANFILE: conanfile, "file.txt": "", "file1.txt": "", "file.cpp": "", "file_temp.cpp": ""}) client.run("export . lasote/stable") ref = ConanFileReference("Hello", "1.2", "lasote", "stable") export_path = client.cache.package_layout(ref).export() exports_sources_path = client.cache.package_layout(ref).export_sources() self.assertTrue(os.path.exists(os.path.join(export_path, "file.txt"))) self.assertFalse(os.path.exists(os.path.join(export_path, "file1.txt"))) self.assertTrue(os.path.exists(os.path.join(exports_sources_path, "file.cpp"))) self.assertFalse(os.path.exists(os.path.join(exports_sources_path, "file_temp.cpp"))) def test_exclude_folders(self): client = TestClient() conanfile = """ from conans import ConanFile class TestConan(ConanFile): name = "Hello" version = "1.2" exports = "*.txt", "!*/temp/*" """ client.save({CONANFILE: conanfile, "file.txt": "", "any/temp/file1.txt": "", "other/sub/file2.txt": ""}) client.run("export . lasote/stable") ref = ConanFileReference("Hello", "1.2", "lasote", "stable") export_path = client.cache.package_layout(ref).export() self.assertTrue(os.path.exists(os.path.join(export_path, "file.txt"))) self.assertFalse(os.path.exists(os.path.join(export_path, "any/temp/file1.txt"))) self.assertTrue(os.path.exists(os.path.join(export_path, "other/sub/file2.txt"))) class ExportTest(unittest.TestCase): def setUp(self): self.client = TestClient() self.files = cpp_hello_conan_files("Hello0", "0.1") self.ref = ConanFileReference("Hello0", "0.1", "lasote", "stable") self.client.save(self.files) self.client.run("export . lasote/stable") def test_basic(self): """ simple registration of a new conans """ reg_path = self.client.cache.package_layout(self.ref).export() manif = FileTreeManifest.load(self.client.cache.package_layout(self.ref).export()) self.assertIn('%s: A new conanfile.py version was exported' % str(self.ref), self.client.out) self.assertIn('%s: Folder: %s' % (str(self.ref), reg_path), self.client.out) self.assertTrue(os.path.exists(reg_path)) for name in list(self.files.keys()): self.assertTrue(os.path.exists(os.path.join(reg_path, name))) expected_sums = {'hello.cpp': '4f005274b2fdb25e6113b69774dac184', 'main.cpp': '0479f3c223c9a656a718f3148e044124', 'CMakeLists.txt': '10d907c160c360b28f6991397a5aa9b4', 'conanfile.py': '355949fbf0b4fc32b8f1c5a338dfe1ae', 'executable': '68b329da9893e34099c7d8ad5cb9c940', 'helloHello0.h': '9448df034392fc8781a47dd03ae71bdd'} self.assertEqual(expected_sums, manif.file_sums) def test_case_sensitive(self): self.files = cpp_hello_conan_files("hello0", "0.1") self.ref = ConanFileReference("hello0", "0.1", "lasote", "stable") self.client.save(self.files) self.client.run("export . lasote/stable", assert_error=True) self.assertIn("ERROR: Cannot export package with same name but different case", self.client.out) def test_export_filter(self): content = """ from conans import ConanFile class OpenSSLConan(ConanFile): name = "openssl" version = "2.0.1" """ save(os.path.join(self.client.current_folder, CONANFILE), content) self.client.run("export . lasote/stable") ref = ConanFileReference.loads('openssl/2.0.1@lasote/stable') reg_path = self.client.cache.package_layout(ref).export() self.assertEqual(sorted(os.listdir(reg_path)), [CONANFILE, CONAN_MANIFEST]) content = """ from conans import ConanFile class OpenSSLConan(ConanFile): name = "openssl" version = "2.0.1" exports = ('*.txt', '*.h') """ save(os.path.join(self.client.current_folder, CONANFILE), content) self.client.run("export . lasote/stable") self.assertEqual(sorted(os.listdir(reg_path)), ['CMakeLists.txt', CONANFILE, CONAN_MANIFEST, 'helloHello0.h']) # Now exports being a list instead a tuple content = """ from conans import ConanFile class OpenSSLConan(ConanFile): name = "openssl" version = "2.0.1" exports = ['*.txt', '*.h'] """ save(os.path.join(self.client.current_folder, CONANFILE), content) self.client.run("export . lasote/stable") self.assertEqual(sorted(os.listdir(reg_path)), ['CMakeLists.txt', CONANFILE, CONAN_MANIFEST, 'helloHello0.h']) def test_export_the_same_code(self): file_list = self._create_packages_and_builds() # Export the same conans # Do not adjust cpu_count, it is reusing a cache client2 = TestClient(self.client.cache_folder, cpu_count=False) files2 = cpp_hello_conan_files("Hello0", "0.1") client2.save(files2) client2.run("export . lasote/stable") reg_path2 = client2.cache.package_layout(self.ref).export() digest2 = FileTreeManifest.load(client2.cache.package_layout(self.ref).export()) self.assertNotIn('A new Conan version was exported', client2.out) self.assertNotIn('Cleaning the old builds ...', client2.out) self.assertNotIn('Cleaning the old packs ...', client2.out) self.assertNotIn('All the previous packs were cleaned', client2.out) self.assertIn('%s: A new conanfile.py version was exported' % str(self.ref), self.client.out) self.assertIn('%s: Folder: %s' % (str(self.ref), reg_path2), self.client.out) self.assertTrue(os.path.exists(reg_path2)) for name in list(files2.keys()): self.assertTrue(os.path.exists(os.path.join(reg_path2, name))) expected_sums = {'hello.cpp': '4f005274b2fdb25e6113b69774dac184', 'main.cpp': '0479f3c223c9a656a718f3148e044124', 'CMakeLists.txt': '10d907c160c360b28f6991397a5aa9b4', 'conanfile.py': '355949fbf0b4fc32b8f1c5a338dfe1ae', 'executable': '68b329da9893e34099c7d8ad5cb9c940', 'helloHello0.h': '9448df034392fc8781a47dd03ae71bdd'} self.assertEqual(expected_sums, digest2.file_sums) for f in file_list: self.assertTrue(os.path.exists(f)) def test_export_a_new_version(self): self._create_packages_and_builds() # Export an update of the same conans # Do not adjust cpu_count, it is reusing a cache client2 = TestClient(self.client.cache_folder, cpu_count=False) files2 = cpp_hello_conan_files("Hello0", "0.1") files2[CONANFILE] = "# insert comment\n %s" % files2[CONANFILE] client2.save(files2) client2.run("export . lasote/stable") reg_path3 = client2.cache.package_layout(self.ref).export() digest3 = FileTreeManifest.load(client2.cache.package_layout(self.ref).export()) self.assertIn('%s: A new conanfile.py version was exported' % str(self.ref), self.client.out) self.assertIn('%s: Folder: %s' % (str(self.ref), reg_path3), self.client.out) self.assertTrue(os.path.exists(reg_path3)) for name in list(files2.keys()): self.assertTrue(os.path.exists(os.path.join(reg_path3, name))) expected_sums = {'hello.cpp': '4f005274b2fdb25e6113b69774dac184', 'main.cpp': '0479f3c223c9a656a718f3148e044124', 'CMakeLists.txt': '10d907c160c360b28f6991397a5aa9b4', 'conanfile.py': 'ad17cf00b3142728b03ac37782b9acd9', 'executable': '68b329da9893e34099c7d8ad5cb9c940', 'helloHello0.h': '9448df034392fc8781a47dd03ae71bdd'} self.assertEqual(expected_sums, digest3.file_sums) # for f in file_list: # self.assertFalse(os.path.exists(f)) def _create_packages_and_builds(self): reg_builds = self.client.cache.package_layout(self.ref).builds() reg_packs = self.client.cache.package_layout(self.ref).packages() folders = [os.path.join(reg_builds, '342525g4f52f35f'), os.path.join(reg_builds, 'ew9o8asdf908asdf80'), os.path.join(reg_packs, '342525g4f52f35f'), os.path.join(reg_packs, 'ew9o8asdf908asdf80')] file_list = [] for f in folders: for name, content in {'file1.h': 'asddfasdf', 'file1.dll': 'asddfasdf'}.items(): file_path = os.path.join(f, name) save(file_path, content) file_list.append(file_path) return file_list class ExportMetadataTest(unittest.TestCase): conanfile = textwrap.dedent(""" from conans import ConanFile class Lib(ConanFile): revision_mode = "{revision_mode}" """) summary_hash = "bfe8b4a6a2a74966c0c4e0b34705004a" def test_revision_mode_hash(self): t = TestClient() t.save({'conanfile.py': self.conanfile.format(revision_mode="hash")}) ref = ConanFileReference.loads("name/version@user/channel") t.run("export . {}".format(ref)) meta = t.cache.package_layout(ref, short_paths=False).load_metadata() self.assertEqual(meta.recipe.revision, self.summary_hash) def test_revision_mode_scm(self): path, rev = create_local_git_repo( files={'conanfile.py': self.conanfile.format(revision_mode="scm")}) t = TestClient(current_folder=path) ref = ConanFileReference.loads("name/version@user/channel") t.run("export . {}".format(ref)) meta = t.cache.package_layout(ref, short_paths=False).load_metadata() self.assertEqual(meta.recipe.revision, rev) def test_revision_mode_invalid(self): conanfile = self.conanfile.format(revision_mode="auto") t = TestClient() t.save({'conanfile.py': conanfile}) ref = ConanFileReference.loads("name/version@user/channel") t.run("export . {}".format(ref), assert_error=True) self.assertIn("ERROR: Revision mode should be one of 'hash' (default) or 'scm'", t.out) def test_export_no_params(self): client = TestClient() client.save({"conanfile.py": GenConanfile().with_name("lib").with_version("1.0")}) client.run('export .') client.cache.package_layout(ConanFileReference.loads("lib/1.0@")).export() self.assertIn("lib/1.0: A new conanfile.py version was exported", client.out) # Do it twice client.run('export . ') self.assertIn("lib/1.0: The stored package has not changed", client.out) def export_with_name_and_version_test(self): client = TestClient() client.save({"conanfile.py": GenConanfile()}) client.run('export . lib/1.0@') self.assertIn("lib/1.0: A new conanfile.py version was exported", client.out) def export_with_only_user_channel_test(self): """This should be the recommended way and only from Conan 2.0""" client = TestClient() client.save({"conanfile.py": GenConanfile().with_name("lib").with_version("1.0")}) client.run('export . @user/channel') self.assertIn("lib/1.0@user/channel: A new conanfile.py version was exported", client.out) def export_conflict_no_user_channel_test(self): client = TestClient() client.save({"conanfile.py": GenConanfile()}) client.run('export . pkg/0.1@user/channel') self.assertIn("pkg/0.1@user/channel: A new conanfile.py version was exported", client.out) client.run('export . pkg/0.1@other/stable') self.assertIn("pkg/0.1@other/stable: A new conanfile.py version was exported", client.out) client.run('export . pkg/0.1@') self.assertIn("pkg/0.1: A new conanfile.py version was exported", client.out) client.run('export . Pkg/0.1@', assert_error=True) self.assertIn("ERROR: Cannot export package with same name but different case", client.out)
42.66998
99
0.627964
2,521
21,463
5.243554
0.103134
0.025418
0.031016
0.028595
0.772903
0.737877
0.70497
0.668507
0.643846
0.604433
0
0.039561
0.23212
21,463
502
100
42.75498
0.762514
0.026557
0
0.557971
0
0
0.300968
0.060098
0
0
0
0
0.176329
1
0.055556
false
0.004831
0.067633
0
0.137681
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6a2d3791ab8facdcac004465943b9db976047b77
2,518
py
Python
research/tcn/utils/luatables.py
jdavidagudelo/tensorflow-models
6f019beec73b01861363bf717706e27f4210b979
[ "Apache-2.0" ]
1
2021-05-17T01:42:29.000Z
2021-05-17T01:42:29.000Z
research/tcn/utils/luatables.py
jdavidagudelo/tensorflow-models
6f019beec73b01861363bf717706e27f4210b979
[ "Apache-2.0" ]
null
null
null
research/tcn/utils/luatables.py
jdavidagudelo/tensorflow-models
6f019beec73b01861363bf717706e27f4210b979
[ "Apache-2.0" ]
null
null
null
# Copyright 2017 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. # ============================================================================== # pylint: disable=line-too-long,g-explicit-length-test """A convenience class replicating some lua table syntax with a python dict. In general, should behave like a dictionary except that we can use dot notation to access keys. Users should be careful to only provide keys suitable for instance variable names. Nota bene: do not use the key "keys" since it will collide with the method keys. Usage example: >>> t = T(a=5,b='kaw', c=T(v=[],x=33)) >>> t.a 5 >>> t.z = None >>> print t T(a=5, z=None, c=T(x=33, v=[]), b='kaw') >>> t2 = T({'h':'f','x':4}) >>> t2 T(h='f', x=4) >>> t2['x'] 4 """ class T(object): """Class for emulating lua tables.""" def __init__(self, *args, **kwargs): if len(args) > 1 or (len(args) == 1 and len(kwargs) > 0): errmsg = '''constructor only allows a single dict as a positional argument or keyword arguments''' raise ValueError(errmsg) if len(args) == 1 and isinstance(args[0], dict): self.__dict__.update(args[0]) else: self.__dict__.update(kwargs) def __repr__(self): fmt = ', '.join('%s=%s' for i in range(len(self.__dict__))) kwargstr = fmt % tuple( x for tup in self.__dict__.items() for x in [str(tup[0]), repr(tup[1])]) return 'T(' + kwargstr + ')' def __getitem__(self, key): return self.__dict__[key] def __setitem__(self, key, val): self.__dict__[key] = val def __delitem__(self, key): del self.__dict__[key] def __iter__(self): return iter(self.__dict__) def __len__(self): return len(self.__dict__) def keys(self): # Needed for dict(T( ... )) to work. return self.__dict__.keys() def iteritems(self): return [(k, self.__dict__.get(k)) for k in self.__dict__]
31.08642
84
0.621128
372
2,518
4
0.478495
0.064516
0.006048
0.021505
0.010753
0.010753
0.010753
0
0
0
0
0.014788
0.221207
2,518
80
85
31.475
0.744008
0.522637
0
0
0
0
0.084255
0
0
0
0
0
0
1
0.310345
false
0
0
0.172414
0.551724
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
6a337eeea0d21ff73313c09b728f9aba96c7bab7
211
py
Python
weedi/tests/__init__.py
weenect/weedi
bc0b714f13bd84e9c8d0e27ff4673f815bfa35d2
[ "MIT" ]
null
null
null
weedi/tests/__init__.py
weenect/weedi
bc0b714f13bd84e9c8d0e27ff4673f815bfa35d2
[ "MIT" ]
null
null
null
weedi/tests/__init__.py
weenect/weedi
bc0b714f13bd84e9c8d0e27ff4673f815bfa35d2
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # # (c) 2016 Hareau SAS / Weenect, https://www.weenect.com # # This file is part of the weedi library # # MIT License : https://raw.githubusercontent.com/weenect/weedi/master/LICENSE.txt
26.375
82
0.691943
31
211
4.709677
0.806452
0
0
0
0
0
0
0
0
0
0
0.027624
0.14218
211
7
83
30.142857
0.779006
0.92891
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
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
dbff0d49d11fc26833da99770658c70305c531da
2,928
py
Python
models.py
sardonicscallop/canteenmanager
0c88812f1637a3e61b9643396d176056bd48d099
[ "MIT" ]
null
null
null
models.py
sardonicscallop/canteenmanager
0c88812f1637a3e61b9643396d176056bd48d099
[ "MIT" ]
null
null
null
models.py
sardonicscallop/canteenmanager
0c88812f1637a3e61b9643396d176056bd48d099
[ "MIT" ]
null
null
null
import datetime from random import seed, randrange from decimal import Decimal from app import db from werkzeug.security import check_password_hash, generate_password_hash class Client(db.Model): id = db.Column(db.Numeric(5), primary_key=True, autoincrement=False) name = db.Column(db.String(20), nullable=False) surname = db.Column(db.String(20), nullable=False) pesel = db.Column(db.Numeric(11), unique=True) passport_no = db.Column(db.String(10)) st_class = db.Column(db.String) subscriptions = db.relationship('Subscription', backref='client', lazy=True) def __init__(self, name, surname, pesel, passport_no, st_class): seed() self.id = Decimal(randrange(100000)) self.name = name self.surname = surname self.pesel = pesel self.passport_no = passport_no self.st_class = st_class def new_id(self): self.id = Decimal(randrange(100000)) class Subscription(db.Model): id = db.Column(db.Integer, primary_key=True) client_id = db.Column(db.Numeric(10), db.ForeignKey('client.id'), nullable=False) date_since = db.Column(db.Date, nullable=False) date_due = db.Column(db.Date, nullable=False) datetime_last_used = db.Column(db.DateTime) type = db.Column(db.Integer, nullable=False) payments = db.relationship('Payment', backref='subscription', lazy=True) class SubscriptionType(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, nullable=False) length = db.Column(db.Date) price = db.Column(db.Numeric(4, 2), nullable=False) class StudentClass(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, nullable=False) profile = db.Column(db.String) head_teacher = db.Column(db.String) class Payment(db.Model): id = db.Column(db.Integer, primary_key=True) subscription_id = db.Column(db.Integer, db.ForeignKey('subscription.id'), nullable=False) amount = db.Column(db.Numeric(4, 2), nullable=False) datetime = db.Column(db.DateTime, default=datetime.datetime.utcnow) class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(20), nullable=False) password = db.Column(db.String, nullable=False) # role = db.Column(db.Integer, db.ForeignKey('userrole.id'), nullable=False) name = db.Column(db.String, nullable=False) created_on = db.Column(db.DateTime, nullable=False) last_login = db.Column(db.DateTime) def set_password(self, password): self.password = generate_password_hash(password, method='sha256') def check_password(self, password): return check_password_hash(self.password, password) # class UserRole(db.Model): # id = db.Column(db.Integer, primary_key=True) # name = db.Column(db.String, nullable=False) # users = db.relationship('User', backref='userrole', lazy=True)
36.6
93
0.701161
408
2,928
4.936275
0.203431
0.131082
0.163853
0.095333
0.390765
0.349057
0.262661
0.200099
0.168322
0.168322
0
0.013104
0.165984
2,928
79
94
37.063291
0.81163
0.089139
0
0.175439
1
0
0.025207
0
0
0
0
0
0
1
0.070175
false
0.157895
0.087719
0.017544
0.842105
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
3
e00bf8ce85814358ccc4431d417ed2d9b500ab09
1,036
py
Python
src/labelselect.py
hockeybuggy/twitter-sentiment
0ce39f7d2dd5d2e06d122e8b3f8ba7751bcfce24
[ "MIT" ]
1
2017-04-29T00:53:03.000Z
2017-04-29T00:53:03.000Z
src/labelselect.py
hockeybuggy/twitter-sentiment
0ce39f7d2dd5d2e06d122e8b3f8ba7751bcfce24
[ "MIT" ]
null
null
null
src/labelselect.py
hockeybuggy/twitter-sentiment
0ce39f7d2dd5d2e06d122e8b3f8ba7751bcfce24
[ "MIT" ]
2
2015-03-30T02:54:47.000Z
2018-02-24T02:54:08.000Z
#!/usr/bin/env python # File : labelselect.py # Author : Douglas Anderson # Description: Selects the label to keep import re def __call__(tokens, labels): if labels == "pnn": return selectPosNeuNeg(tokens) elif labels == "pn": return selectPosNeg(tokens) def selectPosNeuNeg(tokens): selected_tokens = [] for t in tokens: if t.label == "positive": selected_tokens.append(t) elif t.label == "neutral": selected_tokens.append(t) elif t.label == "objective" or t.label == "objective-OR-neutral": t.label = "neutral" # Coerce the labels to neutral selected_tokens.append(t) elif t.label == "negative": selected_tokens.append(t) return selected_tokens def selectPosNeg(tokens): selected_tokens = [] for t in tokens: if t.label == "positive": selected_tokens.append(t) elif t.label == "negative": selected_tokens.append(t) return selected_tokens
27.263158
73
0.608108
120
1,036
5.133333
0.333333
0.227273
0.194805
0.204545
0.538961
0.538961
0.538961
0.538961
0.465909
0.465909
0
0
0.285714
1,036
37
74
28
0.832432
0.140927
0
0.592593
0
0
0.090498
0
0
0
0
0
0
1
0.111111
false
0
0.037037
0
0.296296
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
e01e2f758600e3e256cf5aba2a7f315050e8bd99
761
py
Python
test/helper_test.py
n1tram1/Liburing
736963bf7c9a5f305d12d1c6bdc44ddfde8e1cb4
[ "CC0-1.0" ]
null
null
null
test/helper_test.py
n1tram1/Liburing
736963bf7c9a5f305d12d1c6bdc44ddfde8e1cb4
[ "CC0-1.0" ]
null
null
null
test/helper_test.py
n1tram1/Liburing
736963bf7c9a5f305d12d1c6bdc44ddfde8e1cb4
[ "CC0-1.0" ]
null
null
null
import math import liburing def test_time_convert(): # int test assert liburing.time_convert(1) == (1, 0) # float test assert liburing.time_convert(1.5) == (1, 500_000_000) assert liburing.time_convert(1.05) == (1, 50_000_000) # float weirdness test result = liburing.time_convert(1.005) assert result[0] == 1 assert math.isclose(result[1], 5_000_000, abs_tol=1) result = liburing.time_convert(1.0005) assert result[0] == 1 assert math.isclose(result[1], 500_000, abs_tol=1) def test_probe(): op = liburing.probe() for name, bo in op.items(): assert isinstance(name, str) assert isinstance(bo, bool) assert op['IORING_OP_NOP'] is True assert op.get('IORING_OP_LAST') is None
26.241379
57
0.663601
118
761
4.101695
0.347458
0.136364
0.196281
0.206612
0.442149
0.280992
0.157025
0.157025
0.157025
0
0
0.095318
0.214192
761
28
58
27.178571
0.714047
0.052562
0
0.105263
0
0
0.037657
0
0
0
0
0
0.578947
1
0.105263
false
0
0.105263
0
0.210526
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
e029889d2086e49b9ba851ab855a504d49cc1718
61
py
Python
policykit/policyengine/__init__.py
ArnSch/policykit
96962f54d1c195ea2e264f393d33611186c4781d
[ "MIT" ]
78
2020-05-08T17:25:38.000Z
2022-01-13T05:44:50.000Z
policykit/policyengine/__init__.py
ArnSch/policykit
96962f54d1c195ea2e264f393d33611186c4781d
[ "MIT" ]
302
2020-02-20T07:04:30.000Z
2022-02-25T17:44:23.000Z
policykit/policyengine/__init__.py
ArnSch/policykit
96962f54d1c195ea2e264f393d33611186c4781d
[ "MIT" ]
13
2020-04-17T19:44:26.000Z
2022-02-25T17:18:04.000Z
default_app_config = 'policyengine.apps.policyEngineConfig'
20.333333
59
0.852459
6
61
8.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.065574
61
2
60
30.5
0.877193
0
0
0
0
0
0.6
0.6
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
e03008897f093562b2290fbfd502d3a663578b44
9,990
py
Python
tests/acceptance/test_base.py
jsoucheiron/aiocache
baf50df567a33c14213252d35165fdfe2b2900b7
[ "BSD-3-Clause" ]
null
null
null
tests/acceptance/test_base.py
jsoucheiron/aiocache
baf50df567a33c14213252d35165fdfe2b2900b7
[ "BSD-3-Clause" ]
null
null
null
tests/acceptance/test_base.py
jsoucheiron/aiocache
baf50df567a33c14213252d35165fdfe2b2900b7
[ "BSD-3-Clause" ]
null
null
null
import pytest import asyncio from aiocache import RedisCache, SimpleMemoryCache, MemcachedCache from aiocache.base import _Conn class TestCache: """ This class ensures that all caches behave the same way and have the minimum functionality. To add a new cache just create the fixture for the new cache and add id as a param for the cache fixture """ @pytest.mark.asyncio async def test_setup(self, cache): assert cache.namespace == "test" @pytest.mark.asyncio async def test_get_missing(self, cache): assert await cache.get(pytest.KEY) is None assert await cache.get(pytest.KEY, default=1) == 1 @pytest.mark.asyncio async def test_get_existing(self, cache): await cache.set(pytest.KEY, "value") assert await cache.get(pytest.KEY) == "value" @pytest.mark.asyncio async def test_multi_get(self, cache): await cache.set(pytest.KEY, "value") assert await cache.multi_get([pytest.KEY, pytest.KEY_1]) == ["value", None] @pytest.mark.asyncio async def test_delete_missing(self, cache): assert await cache.delete(pytest.KEY) == 0 @pytest.mark.asyncio async def test_delete_existing(self, cache): await cache.set(pytest.KEY, 'value') assert await cache.delete(pytest.KEY) == 1 assert await cache.get(pytest.KEY) is None @pytest.mark.asyncio async def test_set(self, cache): assert await cache.set(pytest.KEY, 'value') is True @pytest.mark.asyncio async def test_multi_set(self, cache): pairs = [(pytest.KEY, "value"), [pytest.KEY_1, "random_value"]] assert await cache.multi_set(pairs) is True assert await cache.multi_get([pytest.KEY, pytest.KEY_1]) == ["value", "random_value"] @pytest.mark.asyncio async def test_multi_set_with_ttl(self, cache): pairs = [(pytest.KEY, "value"), [pytest.KEY_1, "random_value"]] assert await cache.multi_set(pairs, ttl=1) is True await asyncio.sleep(1.1) assert await cache.multi_get([pytest.KEY, pytest.KEY_1]) == [None, None] @pytest.mark.asyncio async def test_set_with_ttl(self, cache): await cache.set(pytest.KEY, 'value', ttl=1) await asyncio.sleep(1.1) assert await cache.get(pytest.KEY) is None @pytest.mark.asyncio async def test_add_missing(self, cache): assert await cache.add(pytest.KEY, 'value', ttl=1) is True @pytest.mark.asyncio async def test_add_existing(self, cache): await cache.set(pytest.KEY, 'value') is True with pytest.raises(ValueError): await cache.add(pytest.KEY, 'value') @pytest.mark.asyncio async def test_exists_missing(self, cache): assert await cache.exists(pytest.KEY) is False @pytest.mark.asyncio async def test_exists_existing(self, cache): await cache.set(pytest.KEY, 'value') assert await cache.exists(pytest.KEY) is True @pytest.mark.asyncio async def test_increment_missing(self, cache): assert await cache.increment(pytest.KEY, delta=2) == 2 assert await cache.increment(pytest.KEY_1, delta=-2) == -2 @pytest.mark.asyncio async def test_increment_existing(self, cache): await cache.set(pytest.KEY, 2) assert await cache.increment(pytest.KEY, delta=2) == 4 assert await cache.increment(pytest.KEY, delta=1) == 5 assert await cache.increment(pytest.KEY, delta=-3) == 2 @pytest.mark.asyncio async def test_increment_typeerror(self, cache): await cache.set(pytest.KEY, 'value') with pytest.raises(TypeError): assert await cache.increment(pytest.KEY) @pytest.mark.asyncio async def test_expire_existing(self, cache): await cache.set(pytest.KEY, 'value') assert await cache.expire(pytest.KEY, 1) is True await asyncio.sleep(1.1) assert await cache.exists(pytest.KEY) is False @pytest.mark.asyncio async def test_expire_with_0(self, cache): await cache.set(pytest.KEY, 'value', 1) assert await cache.expire(pytest.KEY, 0) is True await asyncio.sleep(1.1) assert await cache.exists(pytest.KEY) is True @pytest.mark.asyncio async def test_expire_missing(self, cache): assert await cache.expire(pytest.KEY, 1) is False @pytest.mark.asyncio async def test_clear(self, cache): await cache.set(pytest.KEY, 'value') await cache.clear() assert await cache.exists(pytest.KEY) is False @pytest.mark.asyncio async def test_close_pool_only_clears_resources(self, cache): await cache.set(pytest.KEY, 'value') await cache.close() assert await cache.set(pytest.KEY, "value") is True assert await cache.get(pytest.KEY) == "value" @pytest.mark.asyncio async def test_single_connection(self, cache): async with cache.get_connection() as conn: assert isinstance(conn, _Conn) assert await conn.set(pytest.KEY, "value") is True assert await conn.get(pytest.KEY) == "value" class TestMemoryCache: @pytest.mark.asyncio async def test_accept_explicit_args(self): with pytest.raises(TypeError): SimpleMemoryCache(random_attr="wtf") @pytest.mark.asyncio async def test_set_float_ttl(self, memory_cache): await memory_cache.set(pytest.KEY, "value", ttl=0.1) await asyncio.sleep(0.15) assert await memory_cache.get(pytest.KEY) is None @pytest.mark.asyncio async def test_multi_set_float_ttl(self, memory_cache): pairs = [(pytest.KEY, "value"), [pytest.KEY_1, "random_value"]] assert await memory_cache.multi_set(pairs, ttl=0.1) is True await asyncio.sleep(0.15) assert await memory_cache.multi_get([pytest.KEY, pytest.KEY_1]) == [None, None] @pytest.mark.asyncio async def test_raw(self, memory_cache): await memory_cache.raw("setdefault", "key", "value") assert await memory_cache.raw("get", "key") == "value" assert list(await memory_cache.raw("keys")) == ["key"] @pytest.mark.asyncio async def test_clear_with_namespace_memory(self, memory_cache): await memory_cache.set(pytest.KEY, "value", namespace="test") await memory_cache.clear(namespace="test") assert await memory_cache.exists(pytest.KEY, namespace="test") is False class TestMemcachedCache: @pytest.mark.asyncio async def test_accept_explicit_args(self): with pytest.raises(TypeError): MemcachedCache(random_attr="wtf") @pytest.mark.asyncio async def test_set_too_long_key(self, memcached_cache): with pytest.raises(TypeError) as exc_info: await memcached_cache.set('a' * 2000, 'value') assert str(exc_info.value).startswith('aiomcache error: invalid key') @pytest.mark.asyncio async def test_set_float_ttl_fails(self, memcached_cache): with pytest.raises(TypeError) as exc_info: await memcached_cache.set(pytest.KEY, 'value', ttl=0.1) assert str(exc_info.value) == 'aiomcache error: exptime not int: 0.1' @pytest.mark.asyncio async def test_multi_set_float_ttl(self, memcached_cache): with pytest.raises(TypeError) as exc_info: pairs = [(pytest.KEY, 'value'), [pytest.KEY_1, 'random_value']] assert await memcached_cache.multi_set(pairs, ttl=0.1) is True assert str(exc_info.value) == 'aiomcache error: exptime not int: 0.1' @pytest.mark.asyncio async def test_raw(self, memcached_cache): await memcached_cache.raw("set", b"key", b"value") assert await memcached_cache.raw("get", b"key") == "value" assert await memcached_cache.raw("prepend", b"key", b"super") is True assert await memcached_cache.raw("get", b"key") == "supervalue" @pytest.mark.asyncio async def test_clear_with_namespace_memcached(self, memcached_cache): await memcached_cache.set(pytest.KEY, 'value', namespace='test') with pytest.raises(ValueError): await memcached_cache.clear(namespace="test") assert await memcached_cache.exists(pytest.KEY, namespace="test") is True @pytest.mark.asyncio async def test_close(self, memcached_cache): await memcached_cache.set(pytest.KEY, "value") await memcached_cache._close() assert memcached_cache.client._pool._pool.qsize() == 0 class TestRedisCache: @pytest.mark.asyncio async def test_accept_explicit_args(self): with pytest.raises(TypeError): RedisCache(random_attr="wtf") @pytest.mark.asyncio async def test_float_ttl(self, redis_cache): await redis_cache.set(pytest.KEY, "value", ttl=0.1) await asyncio.sleep(0.15) assert await redis_cache.get(pytest.KEY) is None @pytest.mark.asyncio async def test_multi_set_float_ttl(self, redis_cache): pairs = [(pytest.KEY, "value"), [pytest.KEY_1, "random_value"]] assert await redis_cache.multi_set(pairs, ttl=0.1) is True await asyncio.sleep(0.15) assert await redis_cache.multi_get([pytest.KEY, pytest.KEY_1]) == [None, None] @pytest.mark.asyncio async def test_raw(self, redis_cache): await redis_cache.raw("set", "key", "value") assert await redis_cache.raw("get", "key") == "value" assert await redis_cache.raw("keys", "k*") == ["key"] @pytest.mark.asyncio async def test_clear_with_namespace_redis(self, redis_cache): await redis_cache.set(pytest.KEY, "value", namespace="test") await redis_cache.clear(namespace="test") assert await redis_cache.exists(pytest.KEY, namespace="test") is False @pytest.mark.asyncio async def test_close(self, redis_cache): await redis_cache.set(pytest.KEY, "value") await redis_cache._close() assert redis_cache._pool.size == 0
36.863469
94
0.671972
1,378
9,990
4.729318
0.090711
0.100813
0.106951
0.138407
0.853307
0.827221
0.738377
0.669633
0.539205
0.477981
0
0.009679
0.214014
9,990
270
95
37
0.820301
0.01952
0
0.416667
0
0
0.053116
0
0
0
0
0
0.27451
1
0
false
0
0.019608
0
0.039216
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
e043287af8baef9fe39d3959de2891661479782a
3,810
py
Python
src/node_point.py
ZhongkaiLiu/AlgorithmVisualizer
0f1d812adf1e12b1c9d5e824e9589c71a448a720
[ "MIT" ]
1
2019-12-05T23:50:06.000Z
2019-12-05T23:50:06.000Z
src/node_point.py
ZhongkaiLiu/AlgorithmVisualizer
0f1d812adf1e12b1c9d5e824e9589c71a448a720
[ "MIT" ]
null
null
null
src/node_point.py
ZhongkaiLiu/AlgorithmVisualizer
0f1d812adf1e12b1c9d5e824e9589c71a448a720
[ "MIT" ]
null
null
null
from panel import Panel from line import Line class Node(object): # bind Node with a screen object def __init__(self, x, y, color, screen, nid): if (not isinstance(screen, Panel)): raise ValueError("screen must be an object of class Panel!") else: self.id = nid self.x = x self.y = y self.color = color self.screen = screen # draw a point Node on screen, BUT no refresh, need refresh to display later def draw(self): # print("when draw node, node {}, color is {}".format(self.id, self.color)) self.screen.draw_point(self.x, self.y, self.color) # draw this Node on screen, AND immediately refresh to display def draw_refresh(self): self.draw() self.screen.refresh() def change_color(self, color): self.color = color # return ((x1, y1), (x2, y2)) when connect this node to another node def connection_position(self, node): x1 = self.x y1 = self.y x2 = node.x y2 = node.y if (x1 == x2): if y2 < y1: return ((x1, y1 - 1), (x2, y2 + 1)) else: return ((x1, y1 + 1), (x2, y2 - 1)) elif (y1 == y2): if x2 < x1: return ((x1 - 1, y1), (x2 + 1, y2)) else: return ((x1 + 1, y1), (x2 - 1, y2)) elif (abs(x2 - x1) == abs(y2 - y1)): if x2 > x1: if y2 > y1: return ((x1 + 1, y1 + 1), (x2 - 1, y2 - 1)) elif y2 < y1: return ((x1 + 1, y1 - 1), (x2 - 1, y2 + 1)) elif x2 < x1: if y2 > y1: return ((x1 - 1, y1 + 1), (x2 + 1, y2 - 1)) elif y2 < y1: return ((x1 - 1, y1 - 1), (x2 + 1, y2 + 1)) # return an instance of class Line that connects two cross nodes def line_connect_to(self, node, color): ((x1, y1), (x2, y2)) = self.connection_position(node) return Line(x1, y1, x2, y2, color, self.screen) def get_id(self): return self.id # TreeNode inherited from class Node # TreeNode has parent, children class TreeNode(Node): def __init__(self, x, y, color, screen, nid): super().__init__(x, y, color, screen, nid) self.parent = None self.line = None self.left = None self.right = None def set_children(self, left, right): self.left = left self.right = right def set_left(self, left): self.left = left def set_right(self, right): self.right = right def get_children(self): return (self.left, self.right) def get_left(self): return self.left def get_right(self): return self.right def set_parent(self, parent): self.parent = parent def get_parent(self): return self.parent # For each TreeNode, it has only one line from parent to it def set_line(self, line): self.line = line def get_line(self): return self.line def isLeaf(self): return self.left == None and self.right == None def isRoot(self): return self.parent == None class GraphNode(Node): def __init__(self, x, y, node_color, edge_color, screen, nid): super().__init__(x, y, node_color, screen, nid) # self.neighbors = set() self.edges = {} self.visited = False def mark_visited(self): self.visited = True def new_edge_to(self, node, edge_color): return self.line_connect_to(node, edge_color) def add_neighbor(self, node, edge): # self.neighbors.add(node) self.edges[node] = edge def get_edges(self): return self.edges
28.014706
83
0.534908
520
3,810
3.823077
0.180769
0.050302
0.06338
0.033199
0.154427
0.144366
0.133803
0.083501
0.056338
0.056338
0
0.038725
0.349344
3,810
135
84
28.222222
0.763211
0.141995
0
0.157895
0
0
0.012281
0
0
0
0
0
0
1
0.263158
false
0
0.021053
0.105263
0.515789
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
e04ca2518d074acc6685ce898585dbec0b5804f1
835
py
Python
com/install/absInstaller/AbsInstaller.py
hao707822882/Bichon
54092e69c9316ee592ee392dc85e1f7fd0c47b68
[ "Apache-2.0" ]
null
null
null
com/install/absInstaller/AbsInstaller.py
hao707822882/Bichon
54092e69c9316ee592ee392dc85e1f7fd0c47b68
[ "Apache-2.0" ]
null
null
null
com/install/absInstaller/AbsInstaller.py
hao707822882/Bichon
54092e69c9316ee592ee392dc85e1f7fd0c47b68
[ "Apache-2.0" ]
null
null
null
#! /usr/bin/env python # --coding:utf-8-- # coding: utf-8 # ━━━━━━神兽出没━━━━━━ #    ┏┓   ┏┓ #   ┏┛┻━━━┛┻┓ #   ┃       ┃ #   ┃   ━   ┃ #   ┃ ┳┛ ┗┳ ┃ #   ┃       ┃ #   ┃   ┻   ┃ #   ┃       ┃ #   ┗━┓   ┏━┛ #     ┃   ┃神兽保佑, 永无BUG! #     ┃   ┃Code is far away from bug with the animal protecting #     ┃   ┗━━━┓ #     ┃       ┣┓ #     ┃       ┏┛ #     ┗┓┓┏━┳┓┏┛ #      ┃┫┫ ┃┫┫ #      ┗┻┛ ┗┻┛ # ━━━━━━感觉萌萌哒━━━━━━# Module Desc:clover # User: z.mm | 2428922347@qq.com # Date: 2015/12/21 # Time: 15:16 __author__ = 'Administrator' from abc import ABCMeta, abstractmethod class AbsInstaller(object): __metaclass__ = ABCMeta def __init__(self): pass @abstractmethod def install(self): pass def getInfo(self,cmd,statue,info): return {'cmd':cmd,'statue':statue,'info':info}
18.152174
64
0.435928
114
835
3.947368
0.640351
0.044444
0.026667
0
0
0
0
0
0
0
0
0.043876
0.34491
835
45
65
18.555556
0.599634
0.554491
0
0.181818
0
0
0.075362
0
0
0
0
0
0
1
0.272727
false
0.181818
0.090909
0.090909
0.636364
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
e0535f291da64ac5666b087853ce00939e4963f5
1,278
py
Python
pykin/utils/error_utils.py
jdj2261/pykin
da952b8ec023382b8a324d1095b0cfd675c7452b
[ "MIT" ]
14
2021-08-09T06:59:10.000Z
2022-03-09T13:05:46.000Z
pykin/utils/error_utils.py
jdj2261/pykin
da952b8ec023382b8a324d1095b0cfd675c7452b
[ "MIT" ]
null
null
null
pykin/utils/error_utils.py
jdj2261/pykin
da952b8ec023382b8a324d1095b0cfd675c7452b
[ "MIT" ]
4
2021-12-13T03:23:36.000Z
2022-03-09T11:34:29.000Z
class NotFoundError(Exception): """ Class of custom Exception about Not Found Args: data (all types): input data """ def __init__(self, data): self.data = data def __str__(self): return f"Not Found {self.data}, please check the name again" class CollisionError(Exception): """ Class of custom Exception about Collision Args: data (all types): input data """ def __init__(self, data): self.data = data def __str__(self): return f"Check the collision.. {self.data}, please check settings again" class LimitJointError(Exception): """ Class of custom Exception about Collision Args: data (all types): input data """ def __init__(self, *data): self.data = data def __str__(self): return f"Check the joints.. {self.data}, please check current joints setting again" class OriValueError(Exception): """ Class of custom Exception about Orientation Value Args: data (all types): input data """ def __init__(self, data): self.data = data def __str__(self): return "Expecting the shape of the orientation to be (3,), (3,3), or (4,), instead got:""{}".format(self.data)
23.666667
118
0.611111
156
1,278
4.801282
0.282051
0.128171
0.085447
0.11749
0.604806
0.604806
0.508678
0.508678
0.508678
0.508678
0
0.004372
0.284038
1,278
53
119
24.113208
0.814208
0.262128
0
0.55
0
0.05
0.31331
0
0
0
0
0
0
1
0.4
false
0
0
0.2
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
e0698d808ad344b9aac6ca12e1957fc862272b40
614
py
Python
02 Algorithms/Lecture 8/floyd_warshall.py
ksetdekov/HSE_DS
619d5b84f9d9e97b58ca1f12c5914ec65456c2c8
[ "MIT" ]
1
2020-09-26T18:48:11.000Z
2020-09-26T18:48:11.000Z
02 Algorithms/Lecture 8/floyd_warshall.py
ksetdekov/HSE_DS
619d5b84f9d9e97b58ca1f12c5914ec65456c2c8
[ "MIT" ]
null
null
null
02 Algorithms/Lecture 8/floyd_warshall.py
ksetdekov/HSE_DS
619d5b84f9d9e97b58ca1f12c5914ec65456c2c8
[ "MIT" ]
null
null
null
def floyd_warshall(start): d = [float("Inf") for i in range(n)] dist = [[graph[j][i] for i in range(n)] for j in range(n)] for k in range(n): for i in range(n): for j in range(n): dist[i][j] = min(dist[i][j], dist[j][k] + dist[k][j]) return dist if __name__ == "__main__": n, m = map(int, input().split()) graph = [[float("Inf") for i in range (n)] for j in range(n)] for i in range(n): graph[i][i] = 0 for i in range(m): u, v, c = map(int, input().split()) graph[u][v] = c # for line in floyd_warshall(0):
29.238095
69
0.5
109
614
2.724771
0.284404
0.23569
0.242424
0.222222
0.555556
0.414141
0.414141
0.319865
0.262626
0.262626
0
0.004751
0.314332
614
21
70
29.238095
0.700713
0.04886
0
0.125
0
0
0.024014
0
0
0
0
0
0
1
0.0625
false
0
0
0
0.125
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0ed185df5d8a73c6e9eb5584c9110c52b62bfc83
262
py
Python
cmyui/osu/__init__.py
coverosu/cmyui_pkg
4904a9e726869c973b61cdff1e4ef5cfb3370060
[ "MIT" ]
null
null
null
cmyui/osu/__init__.py
coverosu/cmyui_pkg
4904a9e726869c973b61cdff1e4ef5cfb3370060
[ "MIT" ]
null
null
null
cmyui/osu/__init__.py
coverosu/cmyui_pkg
4904a9e726869c973b61cdff1e4ef5cfb3370060
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """\ Wrappers for multiple types of osu! related files. Source: https://github.com/cmyui/cmyui_pkg :copyright: (c) 2020 cmyui :license: MIT, see LICENSE for details. """ from .beatmap import * from .replay import * from .api import *
17.466667
50
0.687023
37
262
4.837838
0.783784
0.111732
0
0
0
0
0
0
0
0
0
0.022831
0.164122
262
14
51
18.714286
0.794521
0.706107
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
0ee8e73ee88db9813f030ece9f9e1326c2d1e00d
11,643
py
Python
tests/sentry/integrations/bitbucket_server/test_integration.py
pierredup/sentry
0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80
[ "BSD-3-Clause" ]
null
null
null
tests/sentry/integrations/bitbucket_server/test_integration.py
pierredup/sentry
0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80
[ "BSD-3-Clause" ]
null
null
null
tests/sentry/integrations/bitbucket_server/test_integration.py
pierredup/sentry
0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80
[ "BSD-3-Clause" ]
null
null
null
from __future__ import absolute_import import responses from requests.exceptions import ReadTimeout from sentry.integrations.bitbucket_server import BitbucketServerIntegrationProvider from sentry.models import Identity, IdentityProvider, Integration, OrganizationIntegration from sentry.testutils import IntegrationTestCase from .testutils import EXAMPLE_PRIVATE_KEY class BitbucketServerIntegrationTest(IntegrationTestCase): provider = BitbucketServerIntegrationProvider def test_config_view(self): resp = self.client.get(self.init_path) assert resp.status_code == 200 resp = self.client.get(self.setup_path) assert resp.status_code == 200 self.assertContains(resp, "Connect Sentry") self.assertContains(resp, "Submit</button>") @responses.activate def test_validate_url(self): # Start pipeline and go to setup page. self.client.get(self.setup_path) # Submit credentials data = { "url": "bitbucket.example.com/", "verify_ssl": False, "consumer_key": "sentry-bot", "private_key": EXAMPLE_PRIVATE_KEY, } resp = self.client.post(self.setup_path, data=data) assert resp.status_code == 200 self.assertContains(resp, "Enter a valid URL") @responses.activate def test_validate_private_key(self): responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/request-token", status=503, ) # Start pipeline and go to setup page. self.client.get(self.setup_path) # Submit credentials data = { "url": "https://bitbucket.example.com/", "verify_ssl": False, "consumer_key": "sentry-bot", "private_key": "hot-garbage", } resp = self.client.post(self.setup_path, data=data) assert resp.status_code == 200 self.assertContains( resp, "Private key must be a valid SSH private key encoded in a PEM format." ) @responses.activate def test_validate_consumer_key_length(self): # Start pipeline and go to setup page. self.client.get(self.setup_path) # Submit credentials data = { "url": "bitbucket.example.com/", "verify_ssl": False, "consumer_key": "x" * 201, "private_key": EXAMPLE_PRIVATE_KEY, } resp = self.client.post(self.setup_path, data=data) assert resp.status_code == 200 self.assertContains(resp, "Consumer key is limited to 200") @responses.activate def test_authentication_request_token_timeout(self): timeout = ReadTimeout("Read timed out. (read timeout=30)") responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/request-token", body=timeout, ) # Start pipeline and go to setup page. self.client.get(self.setup_path) # Submit credentials data = { "url": "https://bitbucket.example.com/", "verify_ssl": False, "consumer_key": "sentry-bot", "private_key": EXAMPLE_PRIVATE_KEY, } resp = self.client.post(self.setup_path, data=data) assert resp.status_code == 200 self.assertContains(resp, "Setup Error") self.assertContains(resp, "request token from Bitbucket") self.assertContains(resp, "Timed out") @responses.activate def test_authentication_request_token_fails(self): responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/request-token", status=503, ) # Start pipeline and go to setup page. self.client.get(self.setup_path) # Submit credentials data = { "url": "https://bitbucket.example.com/", "verify_ssl": False, "consumer_key": "sentry-bot", "private_key": EXAMPLE_PRIVATE_KEY, } resp = self.client.post(self.setup_path, data=data) assert resp.status_code == 200 self.assertContains(resp, "Setup Error") self.assertContains(resp, "request token from Bitbucket") @responses.activate def test_authentication_request_token_redirect(self): responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/request-token", status=200, content_type="text/plain", body="oauth_token=abc123&oauth_token_secret=def456", ) # Start pipeline self.client.get(self.init_path) # Submit credentials data = { "url": "https://bitbucket.example.com/", "verify_ssl": False, "consumer_key": "sentry-bot", "private_key": EXAMPLE_PRIVATE_KEY, } resp = self.client.post(self.setup_path, data=data) assert resp.status_code == 302 redirect = ( "https://bitbucket.example.com/plugins/servlet/oauth/authorize?oauth_token=abc123" ) assert redirect == resp["Location"] @responses.activate def test_authentication_access_token_failure(self): responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/request-token", status=200, content_type="text/plain", body="oauth_token=abc123&oauth_token_secret=def456", ) responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/access-token", status=500, content_type="text/plain", body="<html>it broke</html>", ) # Get config page resp = self.client.get(self.init_path) assert resp.status_code == 200 # Submit credentials data = { "url": "https://bitbucket.example.com/", "verify_ssl": False, "consumer_key": "sentry-bot", "private_key": EXAMPLE_PRIVATE_KEY, } resp = self.client.post(self.setup_path, data=data) assert resp.status_code == 302 assert resp["Location"] resp = self.client.get(self.setup_path + "?oauth_token=xyz789") assert resp.status_code == 200 self.assertContains(resp, "Setup Error") self.assertContains(resp, "access token from Bitbucket") def install_integration(self): # Get config page resp = self.client.get(self.setup_path) assert resp.status_code == 200 # Submit credentials data = { "url": "https://bitbucket.example.com/", "verify_ssl": False, "consumer_key": "sentry-bot", "private_key": EXAMPLE_PRIVATE_KEY, } resp = self.client.post(self.setup_path, data=data) assert resp.status_code == 302 assert resp["Location"] resp = self.client.get(self.setup_path + "?oauth_token=xyz789") assert resp.status_code == 200 return resp @responses.activate def test_authentication_verifier_expired(self): responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/request-token", status=200, content_type="text/plain", body="oauth_token=abc123&oauth_token_secret=def456", ) responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/access-token", status=404, content_type="text/plain", body="oauth_error=token+expired", ) # Try getting the token but it has expired for some reason, # perhaps a stale reload/history navigate. resp = self.install_integration() self.assertContains(resp, "Setup Error") self.assertContains(resp, "access token from Bitbucket") @responses.activate def test_authentication_success(self): responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/request-token", status=200, content_type="text/plain", body="oauth_token=abc123&oauth_token_secret=def456", ) responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/access-token", status=200, content_type="text/plain", body="oauth_token=valid-token&oauth_token_secret=valid-secret", ) responses.add( responses.POST, "https://bitbucket.example.com/rest/webhooks/1.0/webhook", status=204, body="", ) self.install_integration() integration = Integration.objects.get() assert integration.name == "sentry-bot" assert integration.metadata["domain_name"] == "bitbucket.example.com" assert integration.metadata["base_url"] == "https://bitbucket.example.com" assert integration.metadata["verify_ssl"] is False org_integration = OrganizationIntegration.objects.get( integration=integration, organization=self.organization ) assert org_integration.config == {} idp = IdentityProvider.objects.get(type="bitbucket_server") identity = Identity.objects.get( idp=idp, user=self.user, external_id="bitbucket.example.com:sentry-bot" ) assert identity.data["consumer_key"] == "sentry-bot" assert identity.data["access_token"] == "valid-token" assert identity.data["access_token_secret"] == "valid-secret" assert identity.data["private_key"] == EXAMPLE_PRIVATE_KEY @responses.activate def test_setup_external_id_length(self): responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/request-token", status=200, content_type="text/plain", body="oauth_token=abc123&oauth_token_secret=def456", ) responses.add( responses.POST, "https://bitbucket.example.com/plugins/servlet/oauth/access-token", status=200, content_type="text/plain", body="oauth_token=valid-token&oauth_token_secret=valid-secret", ) responses.add( responses.POST, "https://bitbucket.example.com/rest/webhooks/1.0/webhook", status=204, body="", ) # Start pipeline and go to setup page. self.client.get(self.setup_path) # Submit credentials data = { "url": "https://bitbucket.example.com/", "verify_ssl": False, "consumer_key": "a-very-long-consumer-key-that-when-combined-with-host-would-overflow", "private_key": EXAMPLE_PRIVATE_KEY, } resp = self.client.post(self.setup_path, data=data) assert resp.status_code == 302 redirect = ( "https://bitbucket.example.com/plugins/servlet/oauth/authorize?oauth_token=abc123" ) assert redirect == resp["Location"] resp = self.client.get(self.setup_path + "?oauth_token=xyz789") assert resp.status_code == 200 integration = Integration.objects.get(provider="bitbucket_server") assert ( integration.external_id == "bitbucket.example.com:a-very-long-consumer-key-that-when-combine" )
35.281818
99
0.608692
1,242
11,643
5.560386
0.12963
0.067188
0.079786
0.083406
0.779178
0.723719
0.703736
0.679409
0.661454
0.661454
0
0.017198
0.280855
11,643
329
100
35.389058
0.807596
0.046208
0
0.665414
0
0.007519
0.268224
0.052689
0
0
0
0
0.165414
1
0.045113
false
0
0.026316
0
0.082707
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0ee9bf5557924bce4aa76d3e930d324f0bc91bf9
1,286
py
Python
examples/academic/bakery/run.py
Noxsense/mCRL2
dd2fcdd6eb8b15af2729633041c2dbbd2216ad24
[ "BSL-1.0" ]
61
2018-05-24T13:14:05.000Z
2022-03-29T11:35:03.000Z
examples/academic/bakery/run.py
Noxsense/mCRL2
dd2fcdd6eb8b15af2729633041c2dbbd2216ad24
[ "BSL-1.0" ]
229
2018-05-28T08:31:09.000Z
2022-03-21T11:02:41.000Z
examples/academic/bakery/run.py
Noxsense/mCRL2
dd2fcdd6eb8b15af2729633041c2dbbd2216ad24
[ "BSL-1.0" ]
28
2018-04-11T14:09:39.000Z
2022-02-25T15:57:39.000Z
import os # Not all of the below terminate! os.system('mcrl22lps -v bakery.mcrl2 bakery.lps') os.system('lps2pbes -v -f nodeadlock.mcf bakery.lps bakery.nodeadlock.pbes') # os.system('pbes2bool -v -s2 -rjitty bakery.nodeadlock.pbes') Does not terminate. os.system('lps2pbes -v -f request_can_eventually_enter.mcf bakery.lps bakery.request_can_eventually_enter.pbes') # os.system('pbes2bool -v -s3 -rjitty bakery.request_can_eventually_enter.pbes') Does not terminate. os.system('lps2pbes -v -f request_must_eventually_enter.mcf bakery.lps bakery.request_must_eventually_enter.pbes') # os.system('pbes2bool -v -s3 -rjitty bakery.request_must_eventually_enter.pbes') Does not terminate. os.system('lps2pbes -v -f mutual_exclusion.mcf bakery.lps bakery.mutual_exclusion.pbes') # os.system('pbes2bool -v -s3 -rjitty bakery.mutual_exclusion.pbes') Does not terminate. os.system('lps2pbes -v -f always_can_get_number.mcf bakery.lps bakery.always_can_get_number.pbes') #os.system('pbes2bool -v -s3 -rjitty bakery.always_can_get_number.pbes') Does not terminate. os.system('lps2pbes -v -f get_at_least_number_circulating.mcf bakery.lps bakery.get_at_least_number_circulating.pbes') # os.system('pbes2bool -v -s3 -rjitty bakery.get_at_least_number_circulating.pbes') Does not terminate.
58.454545
118
0.799378
202
1,286
4.881188
0.183168
0.105477
0.103448
0.103448
0.735294
0.667343
0.610548
0.464503
0.35497
0.27789
0
0.017857
0.085537
1,286
21
119
61.238095
0.820578
0.46112
0
0
0
0
0.823358
0.484672
0
0
0
0
0
1
0
true
0
0.125
0
0.125
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
1
0
0
0
0
0
0
3
0eee8ad89acbfb958e6c333d0007a92b212e5118
879
py
Python
src/main/java/ro/ubb/dp1819/examples/behavioural/command/domain/Rental.py
Laura87510/ubb.dp.1819
4fff0194cea401bf5c4c141e68fe6e0b81eea715
[ "MIT" ]
1
2020-03-22T21:37:41.000Z
2020-03-22T21:37:41.000Z
src/main/java/ro/ubb/dp1819/examples/behavioural/command/domain/Rental.py
Laura87510/ubb.dp.1819
4fff0194cea401bf5c4c141e68fe6e0b81eea715
[ "MIT" ]
null
null
null
src/main/java/ro/ubb/dp1819/examples/behavioural/command/domain/Rental.py
Laura87510/ubb.dp.1819
4fff0194cea401bf5c4c141e68fe6e0b81eea715
[ "MIT" ]
49
2019-03-01T12:18:30.000Z
2019-05-23T06:43:28.000Z
from datetime import date class Rental: def __init__(self, rentalId, start, end, client, car): self._id = rentalId self._client = client self._car = car self._start = start self._end = end @property def id(self): return self._id @property def client(self): return self._client @property def car(self): return self._car @property def start(self): return self._start @property def end(self): return self._end def __len__(self): return (self._end - self._start).days + 1 def __repr__(self): return str(self) def __str__(self): return "Rental: " + str(self.id) + "\nCar: " + str(self.car) + "\nClient: " + str(self.client) + "\nPeriod: " + self.start.strftime("%Y-%m-%d") + " to " + self.end.strftime("%Y-%m-%d")
21.975
192
0.565415
110
879
4.263636
0.272727
0.170576
0.179104
0.072495
0
0
0
0
0
0
0
0.001623
0.299204
879
39
193
22.538462
0.75974
0
0
0.172414
0
0
0.062571
0
0
0
0
0
0
1
0.310345
false
0
0.034483
0.275862
0.655172
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0efe309c495fff4d35e7acd0d1c9fac459b86d8f
349
py
Python
torch_geometric/transforms/normalize_features.py
moritzblum/pytorch_geometric
0e3845b8171f4d43591fe4f5e1fc249514867b9b
[ "MIT" ]
1
2021-09-02T07:31:55.000Z
2021-09-02T07:31:55.000Z
torch_geometric/transforms/normalize_features.py
benedekrozemberczki/pytorch_geometric
20e50c8dc0f216cfaba099e65695a9f568c023e8
[ "MIT" ]
null
null
null
torch_geometric/transforms/normalize_features.py
benedekrozemberczki/pytorch_geometric
20e50c8dc0f216cfaba099e65695a9f568c023e8
[ "MIT" ]
1
2021-08-25T08:06:57.000Z
2021-08-25T08:06:57.000Z
from torch_geometric.transforms import BaseTransform class NormalizeFeatures(BaseTransform): r"""Row-normalizes node features to sum-up to one.""" def __call__(self, data): data.x = data.x / data.x.sum(1, keepdim=True).clamp(min=1) return data def __repr__(self): return '{}()'.format(self.__class__.__name__)
29.083333
66
0.679083
46
349
4.782609
0.673913
0.068182
0.081818
0.090909
0
0
0
0
0
0
0
0.007092
0.191977
349
11
67
31.727273
0.77305
0.131805
0
0
0
0
0.013468
0
0
0
0
0
0
1
0.25
false
0
0.125
0.125
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0efeb4fcf3dc1a96155323b6ef160d865ab2e713
38,763
py
Python
tests/test_exchange_wrapper.py
ztomsy/ztom
6cfb5e411c47678d3e6ab37aa98ff07803437854
[ "MIT" ]
33
2019-05-02T13:22:59.000Z
2022-03-19T22:29:20.000Z
tests/test_exchange_wrapper.py
ztomsy/ztom
6cfb5e411c47678d3e6ab37aa98ff07803437854
[ "MIT" ]
1
2021-02-11T06:17:05.000Z
2021-02-11T06:17:05.000Z
tests/test_exchange_wrapper.py
ztomsy/ztom
6cfb5e411c47678d3e6ab37aa98ff07803437854
[ "MIT" ]
11
2019-11-20T06:53:47.000Z
2021-09-16T16:14:09.000Z
# -*- coding: utf-8 -*- from .context import ztom import unittest import copy import datetime import time class ExchageWrapperTestSuite(unittest.TestCase): def test_create_wrapped(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") self.assertEqual(exchange.get_exchange_wrapper_id(), "binance") self.assertEqual(exchange._ccxt.id, "binance") def test_create_wrapped2(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("kucoin") self.assertEqual(exchange.get_exchange_wrapper_id(), "kucoin") self.assertEqual(exchange._ccxt.id, "kucoin") def test_create_generic(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("bitfinex") self.assertEqual(exchange.get_exchange_wrapper_id(), "generic") self.assertEqual(exchange._ccxt.id, "bitfinex") @unittest.skip def test_online_fetch_ticker_wrapped(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") self.assertEqual(exchange.fetch_tickers()["ETH/BTC"]["last"], None) @unittest.skip def test_fetch_ticker_generic(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("kucoin") self.assertIsNot(exchange.fetch_tickers()["ETH/BTC"]["last"], None) def test_load_markets_from_file(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") markets = exchange.load_markets_from_json_file("test_data/markets_binance.json") self.assertEqual(markets["ETH/BTC"]["active"], True) def test_load_tickers_from_csv(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") tickers = exchange.load_tickers_from_csv("test_data/tickers_binance.csv") self.assertEqual(len(tickers), 3) self.assertEqual(tickers[2]["ETH/BTC"]["ask"], 0.082975) def test_init_offline_mode(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") self.assertEqual(exchange.offline, True) self.assertEqual(exchange._offline_tickers[2]["ETH/BTC"]["ask"], 0.082975) self.assertEqual(exchange._offline_markets["ETH/BTC"]["active"], True) def test_offline_tickers_fetch(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") tickers = list() for _ in exchange._offline_tickers: tickers.append(exchange._offline_fetch_tickers()) self.assertEqual(len(tickers), 3) self.assertEqual(tickers[0]["ETH/BTC"]["bidVolume"], 10.011) self.assertEqual(tickers[1]["ETH/BTC"]["bidVolume"], 10.056) self.assertEqual(tickers[2]["ETH/BTC"]["bidVolume"], 10) with self.assertRaises(ztom.ExchangeWrapperOfflineFetchError) as cm: exchange._offline_fetch_tickers() e = cm.exception self.assertEqual(type(e), ztom.ExchangeWrapperOfflineFetchError) def test_offline_load_markets(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") markets = exchange._offline_load_markets() self.assertEqual(markets["ETH/BTC"]["active"], True) exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") with self.assertRaises(ztom.ExchangeWrapperOfflineFetchError) as cm: exchange._offline_load_markets() e = cm.exception self.assertEqual(type(e), ztom.ExchangeWrapperOfflineFetchError) def test_offline_mode(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") markets = exchange.load_markets() tickers = exchange.fetch_tickers() self.assertEqual(tickers["ETH/BTC"]["bidVolume"], 10.011) self.assertEqual(len(tickers), len(markets)) def test_get_results_from_trades(self): """ getting trades from file """ exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") # type: ztom.ccxtExchangeWrapper exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv", "test_data/orders_kucoin_multi.json") exchange.offline_load_trades_from_file("test_data/orders_trades_kucoin.json") # sell order order = ztom.TradeOrder.create_limit_order_from_start_amount("ETH/BTC", "ETH", 0.5, "BTC", 0.06633157807472399) om = ztom.OrderManagerFok(order) om.fill_order(exchange) result = exchange.get_trades_results(order) self.assertEqual(result["filled"], 0.5) self.assertEqual(result["cost"], 0.03685088) self.assertEqual(result["dest_amount"], 0.03685088) self.assertEqual(result["src_amount"], 0.5) self.assertGreaterEqual(result["price"], 0.03685088 / 0.5) order.side = "buy" result = exchange.get_trades_results(order) self.assertEqual(result["filled"], 0.5) self.assertEqual(result["cost"], 0.03685088) self.assertEqual(result["dest_amount"], 0.5) self.assertEqual(result["src_amount"], 0.03685088) self.assertGreaterEqual(result["price"], 0.03685088 / 0.5) def test_precision(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") exchange.load_markets() symbol = "ETH/BTC" # amount precision =3, price_precision = 6 self.assertEqual(1.399, exchange.amount_to_precision(symbol, 1.399)) self.assertEqual(1.399, exchange.amount_to_precision(symbol, 1.3999)) self.assertEqual(1.399, exchange.price_to_precision(symbol, 1.399)) self.assertEqual(1.3999, exchange.price_to_precision(symbol, 1.3999)) self.assertEqual(1.123457, exchange.price_to_precision(symbol, 1.123456789)) exchange.markets["ETH/BTC"] = None # default precisions for price and amount 8 self.assertEqual(1.12345678, exchange.amount_to_precision(symbol, 1.123456789)) self.assertEqual(1.12345678, exchange.amount_to_precision(symbol, 1.123456789)) @unittest.skip def test_precision_online(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.load_markets() symbol = "GNT/ETH" self.assertEqual(exchange.amount_to_precision(symbol, 1.3999999), exchange._ccxt.amount_to_precision(symbol, 1.3999999)) self.assertEqual(exchange.price_to_precision(symbol, 1.123456789), exchange._ccxt.price_to_precision(symbol, 1.123456789) ) def test_create_order_book_array_from_ticker(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") exchange.load_markets() exchange.fetch_tickers() ob_array = exchange._create_order_book_array_from_ticker(exchange.tickers["ETH/USDT"]) self.assertEqual(ob_array["asks"], [[682.82, 99999999]]) self.assertEqual(ob_array["bids"], [[682.5, 99999999]]) def test_create_order_offline_data(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") exchange.load_markets() exchange.fetch_tickers() order = ztom.TradeOrder.create_limit_order_from_start_amount("ETH/BTC", "ETH", 0.5, "BTC", 0.06633157807472399) o = exchange.create_order_offline_data(order, 10) self.assertEqual(exchange.price_to_precision(order.symbol, order.price), exchange.price_to_precision(order.symbol, o["create"]["price"])) self.assertEqual(exchange.amount_to_precision(order.symbol, order.amount), exchange.amount_to_precision(order.symbol, o["create"]["amount"])) self.assertEqual(exchange.price_to_precision(order.symbol, order.amount_dest), exchange.price_to_precision(order.symbol, o["updates"][-1]["cost"])) exchange._offline_order = o exchange._offline_trades = o["trades"] om = ztom.OrderManagerFok(order) om.fill_order(exchange) self.assertEqual(0.5, order.filled) result = exchange.get_trades_results(order) # self.assertEqual(result["filled"], 0.5) self.assertEqual(result["cost"], exchange.price_to_precision(order.symbol, order.cost)) self.assertEqual(result["dest_amount"], exchange.price_to_precision(order.symbol, order.cost)) # self.assertEqual(result["src_amount"], 0.5) self.assertGreaterEqual(result["price"], order.price) def test_create_order_offline_data_zero_fill_updates(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") # type: ztom.ccxtExchangeWrapper exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") exchange.load_markets() exchange.fetch_tickers() order = ztom.TradeOrder.create_limit_order_from_start_amount("ETH/BTC", "ETH", 0.5, "BTC", 0.06633157807472399) # zero_fill_updates > 0 < updates_to_fill o = exchange.create_order_offline_data(order, 10, 5) for i in range(0, 5): self.assertEqual(0, o["updates"][i]["filled"]) self.assertEqual(0, o["updates"][i]["cost"]) self.assertListEqual(list(), o["updates"][i]["trades"]) self.assertEqual(0.1, o["updates"][5]["filled"]) self.assertEqual(0.2, o["updates"][6]["filled"]) self.assertEqual(0.3, o["updates"][7]["filled"]) self.assertEqual(0.4, o["updates"][8]["filled"]) self.assertEqual(0.5, o["updates"][9]["filled"]) exchange._offline_order = o exchange._offline_trades = o["trades"] self.assertEqual(len(o["updates"]), 10) om = ztom.OrderManagerFok(order) om.fill_order(exchange) self.assertEqual(0.5, order.filled) result = exchange.get_trades_results(order) self.assertEqual(result["cost"], exchange.price_to_precision(order.symbol, order.cost)) self.assertEqual(result["dest_amount"], exchange.price_to_precision(order.symbol, order.cost)) self.assertGreaterEqual(result["price"], order.price) # zero_fill_updates == updates_to_fill order = ztom.TradeOrder.create_limit_order_from_start_amount("ETH/BTC", "ETH", 0.5, "BTC", 0.06633157807472399) # zero_fill_updates > 0 < updates_to_fill o = exchange.create_order_offline_data(order, 10, 10) self.assertEqual(len(o["updates"]), 10) for u in o["updates"]: self.assertEqual(0, u["filled"]) self.assertEqual(0, u["cost"]) self.assertListEqual(u["trades"], list()) # zero_fill_updates == updates_to_fill order = ztom.TradeOrder.create_limit_order_from_start_amount("ETH/BTC", "ETH", 0.5, "BTC", 0.06633157807472399) # zero_fill_updates > updates_to_fill o = exchange.create_order_offline_data(order, 10, 10) self.assertEqual(len(o["updates"]), 10) for u in o["updates"]: self.assertEqual("open", u["status"]) self.assertEqual(0, u["filled"]) self.assertEqual(0, u["cost"]) self.assertListEqual(u["trades"], list()) # zero_fill_updates = 0 o = exchange.create_order_offline_data(order, 10, 0) self.assertEqual(len(o["updates"]), 10) for u in o["updates"]: self.assertLess(0, u["filled"]) def test_multiple_offline_orders(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") exchange.load_markets() exchange.fetch_tickers() # at this point order has not id, because order should receive it's id from the exchange order = ztom.TradeOrder.create_limit_order_from_start_amount("ETH/BTC", "ETH", 0.5, "BTC", 0.06633157807472399) int_order_id = exchange.add_offline_order_data(order, 1) self.assertEqual(0, exchange._offline_orders_data[int_order_id]["_offline_order_update_index"]) self.assertEqual("open", exchange._offline_orders_data[int_order_id]["_offline_order"]["create"]["status"]) self.assertEqual(int_order_id, order.internal_id) order2 = ztom.TradeOrder.create_limit_order_from_start_amount("USD/RUB", "RUB", 70, "USD", 70) exchange.add_offline_order_data(order2, 4) resp_order1 = exchange.place_limit_order(order) resp_order2 = exchange.place_limit_order(order2) self.assertEqual(resp_order1["amount"], order.amount) self.assertEqual(resp_order2["amount"], order2.amount) resp1 = exchange.get_order_update(order) resp2 = exchange.get_order_update(order2) resp2 = exchange.get_order_update(order2) resp2 = exchange.get_order_update(order2) order.update_order_from_exchange_resp(resp1) order2.update_order_from_exchange_resp(resp2) order2.update_order_from_exchange_resp(resp2) self.assertEqual(1, exchange._offline_orders_data[order.internal_id]["_offline_order_update_index"]) self.assertEqual(3, exchange._offline_orders_data[order2.internal_id]["_offline_order_update_index"]) self.assertEqual("closed", order.status) self.assertEqual(0.5, order.filled) self.assertEqual("open", order2.status) resp2 = exchange.cancel_order(order2) order2.update_order_from_exchange_resp(resp2) self.assertEqual("canceled", order2.status) self.assertEqual(3 / 4, order2.filled) def test_offline_get_trades_from_order_offline_data(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") # type: ztom.ccxtExchangeWrapper exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") exchange.load_markets() exchange.fetch_tickers() # at this point order has not id, because order should receive it's id from the exchange order = ztom.TradeOrder.create_limit_order_from_start_amount("ETH/BTC", "ETH", 0.5, "BTC", 0.06633157807472399) exchange.add_offline_order_data(order, 2) resp_order1 = exchange.place_limit_order(order) self.assertNotIn("trades", resp_order1) resp = exchange.get_order_update(order) self.assertIn("trades", resp) self.assertEqual(0.5 / 2, resp["trades"][0]["amount"]) resp = exchange.get_order_update(order) self.assertEqual(2* (0.5 / 2), resp["filled"]) self.assertIn("trades", resp) self.assertEqual(0.5 / 2, resp["trades"][0]["amount"]) self.assertEqual(0.5 / 2, resp["trades"][1]["amount"]) # check trades after order is filled resp_trades = exchange.get_trades(order) self.assertEqual(0.5 / 2, resp_trades[0]["amount"]) self.assertEqual(0.5 / 2, resp_trades[1]["amount"]) resp_trades = exchange.get_trades(order) self.assertEqual(0.5 / 2, resp_trades[0]["amount"]) self.assertEqual(0.5 / 2, resp_trades[1]["amount"]) def test_get_trades_if_not_in_order_data(self): """ in this case trades are not returned via get_trades method. This mode for exchange wrapper could be set by exchange.trades_in_offline_order_update = False """ exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") # type: ztom.ccxtExchangeWrapper self.assertEqual(True, exchange.trades_in_offline_order_update) exchange.trades_in_offline_order_update = False exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") exchange.load_markets() exchange.fetch_tickers() # at this point order has not id, because order should receive it's id from the exchange order = ztom.TradeOrder.create_limit_order_from_start_amount("ETH/BTC", "ETH", 0.5, "BTC", 0.06633157807472399) exchange.add_offline_order_data(order, 2) resp_order1 = exchange.place_limit_order(order) self.assertNotIn("trades", resp_order1) resp = exchange.get_order_update(order) order.update_order_from_exchange_resp(resp) self.assertNotIn("trades", resp) self.assertEqual(0, len(order.trades)) resp = exchange.get_order_update(order) order.update_order_from_exchange_resp(resp) self.assertEqual(2* (0.5 / 2), resp["filled"]) self.assertNotIn("trades", resp) # check trades after order is filled resp_trades = exchange.get_trades(order) self.assertEqual(0.5 / 2, resp_trades[0]["amount"]) self.assertEqual(0.5 / 2, resp_trades[1]["amount"]) resp_trades = exchange.get_trades(order) self.assertEqual(0.5 / 2, resp_trades[0]["amount"]) self.assertEqual(0.5 / 2, resp_trades[1]["amount"]) # update order with the trades responce order.update_order_from_exchange_resp({"trades": resp_trades}) self.assertEqual(2, len(order.trades)) results_from_trades = exchange.get_trades_results(order) self.assertEqual(order.filled, results_from_trades["filled"]) def test_offline_order_book_fetch(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") offline_order_books = dict() offline_order_books["USD/RUR"] = list() offline_order_books["USD/RUR"].append({"bids": [[70, 1.1], [69, 2.1], [60, 3.1]], "asks": [[71, 1.2], [72, 2.2], [73, 3.2]]}) offline_order_books["USD/RUR"].append({"bids": [[70, 4.1], [69, 5.1], [60, 6.1]], "asks": [[71, 4.2], [72, 5.2], [73, 6.2]]}) offline_order_books["USD/RUR"].append({"bids": [[70, 7.1], [69, 8.1], [60, 9.1]], "asks": [[71, 7.2], [72, 8.2], [73, 9.2]]}) offline_order_books["EUR/RUR"] = list() offline_order_books["EUR/RUR"].append({"bids": [[75, 11.1], [74, 12.1], [70, 13.1]], "asks": [[76, 11.2], [77, 12.2], [78, 13.2]]}) offline_order_books["EUR/RUR"].append({"bids": [[75, 14.1], [74, 15.1], [70, 16.1]], "asks": [[76, 14.2], [77, 15.2], [78, 16.2]]}) offline_order_books["EUR/RUR"].append({"bids": [[76, 17.1], [73, 18.1], [70, 19.1]], "asks": [[72, 17.2], [73, 18.2], [74, 19.2]]}) exchange._offline_order_books = copy.copy(offline_order_books) self.assertDictEqual(offline_order_books["USD/RUR"][0], exchange.fetch_order_book("USD/RUR")) self.assertDictEqual(offline_order_books["USD/RUR"][1], exchange.fetch_order_book("USD/RUR")) self.assertDictEqual(offline_order_books["EUR/RUR"][0], exchange.fetch_order_book("EUR/RUR")) self.assertDictEqual(offline_order_books["USD/RUR"][2], exchange.fetch_order_book("USD/RUR")) self.assertDictEqual(offline_order_books["EUR/RUR"][1], exchange.fetch_order_book("EUR/RUR")) # testing exception if no order books lef for symbol with self.assertRaises(ztom.ExchangeWrapperOfflineFetchError) as cm: exchange.fetch_order_book("USD/RUR") e = cm.exception self.assertEqual(type(e), ztom.ExchangeWrapperOfflineFetchError) # stil order book is available for other symbol self.assertDictEqual(offline_order_books["EUR/RUR"][2], exchange.fetch_order_book("EUR/RUR")) # try to fetch non available OB with self.assertRaises(ztom.ExchangeWrapperOfflineFetchError) as cm: exchange.fetch_order_book("ETH/BTC") e = cm.exception self.assertEqual(type(e), ztom.ExchangeWrapperOfflineFetchError) self.assertIn("ETH/BTC", e.args[0]) def test_offline_order_books_load_from_file(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") file_name = "test_data/order_books.csv" order_books = exchange.load_offline_order_books_from_csv(file_name) self.assertIn("ETH/BTC", order_books) self.assertIn("FUEL/BTC", order_books) self.assertIn("FUEL/ETH", order_books) self.assertIn("WAVES/BTC", order_books) self.assertIn("WAVES/ETH", order_books) self.assertIn("ZRX/ETH", order_books) self.assertIn("ZRX/BTC", order_books) self.assertEqual(6, len(order_books["ETH/BTC"])) self.assertEqual(1, len(order_books["WAVES/ETH"])) self.assertEqual(10, len(order_books["ETH/BTC"][0]["asks"])) self.assertEqual(10, len(order_books["ETH/BTC"][0]["bids"])) self.assertEqual(10, len(order_books["ETH/BTC"][4]["asks"])) self.assertEqual(10, len(order_books["ETH/BTC"][4]["bids"])) self.assertEqual(0.092306, order_books["ETH/BTC"][4]["asks"][0][0]) self.assertEqual(0.00133205, order_books["ZRX/ETH"][1]["asks"][2][0]) ob = exchange.fetch_order_book("WAVES/ETH") self.assertEqual(0.008239, ob["bids"][2][0]) def test_offline_order_books_async(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") # type: ztom.ccxtExchangeWrapper exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") # exchange.init_async_exchange() exchange.fetch_tickers() file_name = "test_data/order_books.csv" exchange.load_offline_order_books_from_csv(file_name) order_books = exchange.get_order_books_async(["ETH/BTC", "WAVES/ETH", "AMB/ETH"]) # AMB/ETH taken from tickers self.assertEqual(10, len(order_books[0]["asks"])) self.assertEqual(False, order_books[0]["from_ticker"]) self.assertEqual(0.008239, order_books[1]["bids"][2][0]) self.assertEqual(0.00064991, order_books[2]["asks"][0][0]) self.assertEqual(99999999, order_books[2]["asks"][0][1]) self.assertEqual(True, order_books[2]["from_ticker"]) def test_online_order_books_async(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") # type: ztom.ccxtExchangeWrapper # exchange.set_offline_mode("test_data/markets_binance.json", "test_data/tickers_binance.csv") exchange.init_async_exchange() exchange.fetch_tickers() # file_name = "test_data/order_books.csv" # exchange.load_offline_order_books_from_csv(file_name) order_books = exchange.get_order_books_async(["ETH/BTC", "WAVES/ETH", "AMB/ETH"]) # AMB/ETH taken from tickers self.assertIn('asks', order_books[0]) self.assertIn('asks', order_books[1]) self.assertIn('asks', order_books[1]) # self.assertEqual(10, len(order_books[0]["asks"])) # self.assertEqual(False, order_books[0]["from_ticker"]) # # self.assertEqual(0.008239, order_books[1]["bids"][2][0]) # # self.assertEqual(0.00064991, order_books[2]["asks"][0][0]) # self.assertEqual(99999999, order_books[2]["asks"][0][1]) # self.assertEqual(True, order_books[2]["from_ticker"]) def test_fetch_order_book(self): e = ztom.ccxtExchangeWrapper.load_from_id("binance") # type: ztom.ccxtExchangeWrapper e.load_markets() ob = e.fetch_order_book("ETH/BTC") self.assertIn("asks", ob) self.assertIn("bids", ob) def test_fetch_markets_if_markets_were_not_loaded(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") # type: ztom.ccxtExchangeWrapper # force offline mode exchange.offline = True exchange._offline_markets = { "BTC/USDC": {"active": True} } exchange._offline_tickers[0] = {"BTC/USDC": {"ask": 222}} tickers = exchange.fetch_tickers() self.assertDictEqual({"BTC/USDC": {"active": True}}, exchange.markets) self.assertDictEqual({"BTC/USDC": {"ask": 222}}, tickers) self.assertDictEqual({"BTC/USDC": {"ask": 222}}, exchange.tickers) self.assertNotIn("USDC/BTC", tickers) def test_filter_active_markets_and_tickers(self): exchange = ztom.ccxtExchangeWrapper.load_from_id("binance") # type: ztom.ccxtExchangeWrapper # force offline mode exchange.offline = True # "active" attribute presents exchange._offline_markets = {"USDC/BTC": {"active": False}, "BTC/USDC": {"active": True} } exchange._offline_tickers[0] = {"USDC/BTC": {"ask": 111}, "BTC/USDC": {"ask": 222}} markets = exchange.load_markets() tickers = exchange.fetch_tickers() self.assertDictEqual({"BTC/USDC": {"active": True}}, markets) self.assertDictEqual({"BTC/USDC": {"active": True}}, exchange.markets) self.assertDictEqual({"BTC/USDC": {"ask": 222}}, tickers) self.assertDictEqual({"BTC/USDC": {"ask": 222}}, exchange.tickers) self.assertNotIn("USDC/BTC", tickers) # second tickers fetch - no active markets for tickers exchange._offline_tickers[1] = {"USD/RUR": {"ask": 666}} tickers = exchange.fetch_tickers() self.assertDictEqual({}, tickers) # 3rd fetch - single ticker exchange._offline_tickers[2] = {"USD/RUR": {"ask": 666}, "BTC/USDC": {"ask": 333}} tickers = exchange.fetch_tickers("USD/RUR") self.assertDictEqual({}, tickers) # no active markets exchange._offline_markets = {"USD/RUB": {"bid": 666}} exchange.load_markets() # with self.assertRaises(Exception) as e: # markets = exchange.get_markets() # # self.assertEqual(type(e.exception), ztom.ExchangeWrapperError) # self.assertEqual(e.exception.args[0], "No active markets") exchange._offline_tickers[3] = {"USD/RUR": {"ask": 666}, "BTC/USDC": {"ask": 333}} tickers = exchange.fetch_tickers() self.assertEqual({}, tickers) def test_throttle_override_by_wrapper_throttle(self): ew = ztom.ccxtExchangeWrapper("binance") ew.enable_requests_throttle() self.assertEqual(60, ew.requests_throttle.period) self.assertEqual(100, ew.requests_throttle.requests_per_period) self.assertDictEqual({ "single": 1, "load_markets": 1, "fetch_tickers": 1, "fetch_ticker": 1, "fetch_order_book": 1, "create_order": 1, "fetch_order": 1, "cancel_order": 1, "fetch_my_trades": 1, "fetch_balance": 1}, ew.requests_throttle.request_weights) # ztom.exchanges.binance.REQUEST_TYPE_WIGHTS.update({"fetch_tickers": 10, "modify": 666}) ew = ztom.ccxtExchangeWrapper.load_from_id("binance") ew.enable_requests_throttle() self.assertEqual(60, ew.requests_throttle.period) self.assertEqual(1200, ew.requests_throttle.requests_per_period) self.assertEqual(ew.requests_throttle.request_weights["fetch_tickers"], 2) # self.assertEqual(ew.requests_throttle.request_weights["modify"], 666) def test_throttle_override_default_on_init(self): ew = ztom.ccxtExchangeWrapper.load_from_id("binance") ew.enable_requests_throttle(10, 100, {"load_markets": 40}) self.assertEqual(10, ew.requests_throttle.period) self.assertEqual(100, ew.requests_throttle.requests_per_period) self.assertDictEqual({ "single": 1, "load_markets": 40, "fetch_tickers": 2, "fetch_ticker": 1, "fetch_order_book": 1, "create_order": 1, "fetch_order": 1, "cancel_order": 1, "fetch_my_trades": 1, "fetch_balance": 5}, ew.requests_throttle.request_weights) ew = ztom.ccxtExchangeWrapper("binance") ew.enable_requests_throttle(4, 444) self.assertEqual(4, ew.requests_throttle.period) self.assertEqual(444, ew.requests_throttle.requests_per_period) self.assertDictEqual(ew.REQUEST_TYPE_WIGHTS, ew.requests_throttle.request_weights) def test_throttle_generic(self): ew = ztom.ccxtExchangeWrapper("binance") ew.set_offline_mode("test_data/markets.json", "test_data/tickers.csv") ew.enable_requests_throttle() self.assertEqual(ew.requests_throttle.period, 60) self.assertEqual(ew.requests_throttle.requests_per_period, 100) markets_timestamp = datetime.datetime.timestamp(datetime.datetime.now()) time.sleep(0.1) ew.load_markets() self.assertEqual(1, len(ew.requests_throttle.requests_current_period)) # self.assertAlmostEqual(ew.requests_throttle.requests_current_period[0]["timestamp"], markets_timestamp, 2) time_diff = ew.requests_throttle.requests_current_period[0]["timestamp"] - markets_timestamp self.assertAlmostEqual(0.1, time_diff, 2) time.sleep(0.1) sleep = ew.requests_throttle.sleep_time() self.assertAlmostEqual(0.6 - 0.1, sleep, 2) def test_throttle_all_request_types(self): ew = ztom.ccxtExchangeWrapper("binance") ew.set_offline_mode("test_data/markets.json", "test_data/tickers.csv") ew.set_offline_balance( {'free': { 'BTC': 1, 'USD': 123.00}, "BTC": {"free": 1}, "USDT": {"free": 123} } ) ew.enable_requests_throttle() ew.load_markets() self.assertEqual(1, len(ew.requests_throttle.requests_current_period)) ew.fetch_tickers() self.assertEqual(2, len(ew.requests_throttle.requests_current_period)) ew.fetch_order_book("ETH/BTC") self.assertEqual(3, len(ew.requests_throttle.requests_current_period)) order = ztom.TradeOrder("limit", "ETH/BTC", 1, "buy", ew.tickers["ETH/BTC"]["bid"]) ew.add_offline_order_data(order) ew.place_limit_order(order) self.assertEqual(4, len(ew.requests_throttle.requests_current_period)) ew.get_order_update(order) self.assertEqual(5, len(ew.requests_throttle.requests_current_period)) ew.get_trades(order) self.assertEqual(6, len(ew.requests_throttle.requests_current_period)) ew.cancel_order(order) self.assertEqual(7, len(ew.requests_throttle.requests_current_period)) ew.fetch_free_balance() self.assertEqual(8, len(ew.requests_throttle.requests_current_period)) self.assertEqual("load_markets", ew.requests_throttle.requests_current_period[0]["request_type"]) self.assertEqual("fetch_tickers", ew.requests_throttle.requests_current_period[1]["request_type"]) self.assertEqual("fetch_order_book", ew.requests_throttle.requests_current_period[2]["request_type"]) self.assertEqual("create_order", ew.requests_throttle.requests_current_period[3]["request_type"]) self.assertEqual("fetch_order", ew.requests_throttle.requests_current_period[4]["request_type"]) self.assertEqual("fetch_my_trades", ew.requests_throttle.requests_current_period[5]["request_type"]) self.assertEqual("cancel_order", ew.requests_throttle.requests_current_period[6]["request_type"]) self.assertEqual("fetch_balance", ew.requests_throttle.requests_current_period[7]["request_type"]) self.assertEqual(8, ew.requests_throttle.total_requests_current_period) # 2nd round ew.load_markets() self.assertEqual(9, len(ew.requests_throttle.requests_current_period)) ew.fetch_tickers() self.assertEqual(10, len(ew.requests_throttle.requests_current_period)) ew.fetch_order_book("ETH/BTC") self.assertEqual(11, len(ew.requests_throttle.requests_current_period)) order = ztom.TradeOrder("limit", "ETH/BTC", 1, "buy", ew.tickers["ETH/BTC"]["bid"]) ew.add_offline_order_data(order) ew.place_limit_order(order) self.assertEqual(12, len(ew.requests_throttle.requests_current_period)) ew.get_order_update(order) self.assertEqual(13, len(ew.requests_throttle.requests_current_period)) ew.get_trades(order) self.assertEqual(14, len(ew.requests_throttle.requests_current_period)) ew.cancel_order(order) self.assertEqual(15, len(ew.requests_throttle.requests_current_period)) ew.fetch_free_balance() self.assertEqual(16, len(ew.requests_throttle.requests_current_period)) self.assertEqual("load_markets", ew.requests_throttle.requests_current_period[8]["request_type"]) self.assertEqual("fetch_tickers", ew.requests_throttle.requests_current_period[9]["request_type"]) self.assertEqual("fetch_order_book", ew.requests_throttle.requests_current_period[10]["request_type"]) self.assertEqual("create_order", ew.requests_throttle.requests_current_period[11]["request_type"]) self.assertEqual("fetch_order", ew.requests_throttle.requests_current_period[12]["request_type"]) self.assertEqual("fetch_my_trades", ew.requests_throttle.requests_current_period[13]["request_type"]) self.assertEqual("cancel_order", ew.requests_throttle.requests_current_period[14]["request_type"]) self.assertEqual("fetch_balance", ew.requests_throttle.requests_current_period[15]["request_type"]) self.assertEqual(16, ew.requests_throttle.total_requests_current_period) def test_throttle_control_no_sleep(self): ew = ztom.ccxtExchangeWrapper("binance") ew.set_offline_mode("test_data/markets.json", "test_data/tickers.csv") ew.set_offline_balance( {'free': { 'BTC': 1, 'USD': 123.00}, "BTC": {"free": 1}, "USDT": {"free": 123} } ) ew._offline_tickers = list() for i in range(0,1000): ew._offline_tickers.append({"BTC/USDT" :{"ask": 3500+i*0.01, "bid":3400+i*0.01}}) ew.enable_requests_throttle(60, 100) ew.load_markets() sleep_time = ew.requests_throttle.sleep_time() time.sleep(sleep_time) for i in range(0, 99): tickers = ew.fetch_tickers() self.assertAlmostEqual(0.6*(i+1), ew.requests_throttle.sleep_time(), 1) self.assertEqual(100, len(ew.requests_throttle.requests_current_period)) self.assertEqual(100, len(ew.requests_throttle.requests_current_period)) def test_throttle_control_sleep(self): ew = ztom.ccxtExchangeWrapper("binance") ew.set_offline_mode("test_data/markets.json", "test_data/tickers.csv") ew.set_offline_balance( {'free': { 'BTC': 1, 'USD': 123.00}, "BTC": {"free": 1}, "USDT": {"free": 123} } ) ew._offline_tickers = list() for i in range(0,1000): ew._offline_tickers.append({"BTC/USDT" :{"ask": 3500+i*0.01, "bid":3400+i*0.01}}) ew.enable_requests_throttle(0.5, 10) ew.load_markets() time.sleep(ew.requests_throttle.sleep_time()) for i in range(2, 11): tickers = ew.fetch_tickers() self.assertEqual(i, ew.requests_throttle.total_requests_current_period) sleep_time = ew.requests_throttle.sleep_time() print("Periods since start: {}".format(ew.requests_throttle.periods_since_start)) print("Request num {}".format(i)) print("Sleeping for {}".format(sleep_time)) # self.assertAlmostEqual(0.1, sleep_time, 1) time.sleep(sleep_time) ######### for i in range(11, 41): tickers = ew.fetch_tickers() print("Request num {}".format(i)) self.assertEqual(((i-1) // ew.requests_throttle.requests_per_period), ew.requests_throttle.periods_since_start) if i % (ew.requests_throttle.periods_since_start * ew.requests_throttle.requests_per_period) != 0: self.assertEqual( i % (ew.requests_throttle.periods_since_start * ew.requests_throttle.requests_per_period), ew.requests_throttle.total_requests_current_period ) else: self.assertEqual(i / (ew.requests_throttle.periods_since_start+1), ew.requests_throttle.total_requests_current_period) sleep_time = ew.requests_throttle.sleep_time() print("Periods since start: {}".format(ew.requests_throttle.periods_since_start)) print("Sleeping for {}".format(sleep_time)) print("Requests current period {}".format(ew.requests_throttle.total_requests_current_period)) # self.assertAlmostEqual(0.1, sleep_time, 1) time.sleep(sleep_time) # ew.requests_throttle.update() # self.assertEqual(20, len(ew.requests_throttle.requests_current_period)) # self.assertAlmostEqual(0.9, ew.requests_throttle._current_period_time, 1) if __name__ == '__main__': unittest.main()
42.784768
119
0.648711
4,654
38,763
5.144822
0.062742
0.110884
0.057133
0.04995
0.819871
0.787254
0.730246
0.676036
0.624165
0.55943
0
0.038629
0.222635
38,763
905
120
42.832044
0.755982
0.074065
0
0.520868
0
0
0.116594
0.036796
0
0
0
0
0.367279
1
0.055092
false
0
0.008347
0
0.065109
0.011686
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
160cd258fe5ec19d0578f0447c3851481ad9d20f
3,462
py
Python
python/federatedml/secureprotol/affine.py
hubert-he/FATE
6758e150bd7ca7d6f788f9a7a8c8aea7e6500363
[ "Apache-2.0" ]
3,787
2019-08-30T04:55:10.000Z
2022-03-31T23:30:07.000Z
python/federatedml/secureprotol/affine.py
JavaGreenHands/FATE
ea1e94b6be50c70c354d1861093187e523af32f2
[ "Apache-2.0" ]
1,439
2019-08-29T16:35:52.000Z
2022-03-31T11:55:31.000Z
python/federatedml/secureprotol/affine.py
JavaGreenHands/FATE
ea1e94b6be50c70c354d1861093187e523af32f2
[ "Apache-2.0" ]
1,179
2019-08-29T16:18:32.000Z
2022-03-31T12:55:38.000Z
# # Copyright 2019 The FATE 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. # import random import math from federatedml.secureprotol.affine_encoder import AffineEncoder from federatedml.secureprotol import gmpy_math class AffineCipher(object): def __init__(self): pass @staticmethod def generate_keypair(key_size=2048, encode_precision=2 ** 100, a_ratio=None, b_ratio=None): n = random.SystemRandom().getrandbits(key_size) if a_ratio is None: a_ratio = random.SystemRandom().random() if b_ratio is None: b_ratio = random.SystemRandom().random() while True: a = random.SystemRandom().getrandbits(int(key_size * a_ratio)) if math.gcd(n, a) == 1: break b = random.SystemRandom().getrandbits(max(1, int(key_size * b_ratio))) return AffineCipherKey(a, b, n, encode_precision) class AffineCipherKey(object): def __init__(self, a, b, n, encode_precision=2 ** 100): self.a = a self.b = b self.n = n self.a_inv = self.mod_inverse() self.affine_encoder = AffineEncoder(mult=encode_precision) def encrypt(self, plaintext): return self.raw_encrypt(self.affine_encoder.encode(plaintext)) def decrypt(self, ciphertext): return self.affine_encoder.decode(self.raw_decrypt(ciphertext), ciphertext.multiplier) def raw_encrypt(self, plaintext): return AffineCiphertext((self.a * plaintext + self.b) % self.n) def raw_decrypt(self, ciphertext): plaintext = (self.a_inv * (ciphertext.cipher % self.n - ciphertext.multiplier * self.b)) % self.n if plaintext / self.n > 0.9: return plaintext - self.n return plaintext def mod_inverse(self): return gmpy_math.invert(self.a, self.n) class AffineCiphertext(object): def __init__(self, cipher, multiplier=1): self.cipher = cipher self.multiplier = multiplier def __add__(self, other): if isinstance(other, AffineCiphertext): return AffineCiphertext(self.cipher + other.cipher, self.multiplier + other.multiplier) elif type(other) is int and other == 0: return self else: raise TypeError("Addition only supports AffineCiphertext and initialization with int zero") def __radd__(self, other): return self.__add__(other) def __mul__(self, other): if type(other) is int: return AffineCiphertext(self.cipher * other, self.multiplier * other) else: raise TypeError("Multiplication only supports int.") def __rmul__(self, other): return self.__mul__(other) def __sub__(self, other): return self + (other * -1) def __rsub__(self, other): return other + (self * -1) def __truediv__(self, other): return self.__mul__(1 / other)
33.288462
105
0.662334
437
3,462
5.057208
0.327231
0.032579
0.033937
0.034389
0.069683
0
0
0
0
0
0
0.011077
0.24379
3,462
104
106
33.288462
0.833079
0.168689
0
0.030303
0
0
0.036688
0
0
0
0
0
0
1
0.242424
false
0.015152
0.060606
0.136364
0.575758
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
161676bbe88a28f732f298cdea844c810f864775
236
py
Python
assignment4/reducer.py
IITDU-BSSE06/ads-demystifying-the-logs-shuvo0619
eba37bf06d6afc59be9922af07f816df06edc23f
[ "MIT" ]
null
null
null
assignment4/reducer.py
IITDU-BSSE06/ads-demystifying-the-logs-shuvo0619
eba37bf06d6afc59be9922af07f816df06edc23f
[ "MIT" ]
null
null
null
assignment4/reducer.py
IITDU-BSSE06/ads-demystifying-the-logs-shuvo0619
eba37bf06d6afc59be9922af07f816df06edc23f
[ "MIT" ]
null
null
null
import sys path = {} for line in sys.stdin: file_hits = line.strip() if file_hits in path: path[file_hits] += 1 else: path[file_hits] = 1 count, max_hits_path = max(zip(path.values(), path.keys())) print count
15.733333
60
0.631356
38
236
3.763158
0.5
0.223776
0.167832
0.181818
0
0
0
0
0
0
0
0.011111
0.237288
236
14
61
16.857143
0.783333
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.1
null
null
0.1
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
162964bb64be1ec739a1d42de3e1d2278c6a0dea
3,929
py
Python
CattleManagement/Cattle.py
Mrunmoy/cattle-management
3ee902e9ce70df99bdbb11d5193d567c09a94b92
[ "MIT" ]
null
null
null
CattleManagement/Cattle.py
Mrunmoy/cattle-management
3ee902e9ce70df99bdbb11d5193d567c09a94b92
[ "MIT" ]
null
null
null
CattleManagement/Cattle.py
Mrunmoy/cattle-management
3ee902e9ce70df99bdbb11d5193d567c09a94b92
[ "MIT" ]
null
null
null
from datetime import datetime, date DEFAULT_RFID = 111111111111 class Cattle: def __init__(self, rfid, dob, sex, cattle_type, date_purchased, desexed=False): self._rfid = rfid self._dob = datetime.strptime(dob, "%d %m %Y") self._sex = sex self._type = cattle_type self._date_purchased = datetime.strptime(date_purchased, "%d %m %Y") self._desexed = desexed self._date_sold = 0 self._cost_price = 0 self._sold_price = 0 self._food_units_per_day = 0 self._food_cost_per_unit = 0 self._vaccination_date = None self._shed_id = None self._date_of_death = None self._mother = None self._father = None self._children = [] self._produce = [] self._medicine = [] self._disease = [] self._vet_visit_date = [] self._genetics = [] def rfid(self): return self._rfid def set_rfid(self, rfid): self._rfid = rfid def genetics(self): return self._genetics def set_genetics(self, genetics): self._genetics.append(genetics) def add_medicine(self, med): self._medicine.append(med) def medicine(self): return self._medicine def add_disease(self, dis): self._disease.append(dis) def diseases(self): return self._disease def set_vet_visit(self, dt): self._vet_visit_date.append(dt) def vet_visit_dates(self): return self._vet_visit_date def sex(self): return self._sex def type(self): return self._type def set_mother(self, mom): self._mother = mom moms_genetics = mom.genetics() for ea in moms_genetics: self._genetics.append(ea) def set_father(self, dad): self._father = dad dads_genetics = dad.genetics() for ea in dads_genetics: self._genetics.append(ea) def add_child(self, child): self._children.append(child) def produce(self): return self._produce def add_produce(self, produce_type): self._produce.append(produce_type) def remove_produce(self, produce_type): self._produce.remove(produce_type) def food_consumed_per_day(self): return self._food_units_per_day def set_food_consumed_per_day(self, units_per_day): self._food_units_per_day = units_per_day def food_cost_per_day(self): return self._food_units_per_day * self._food_cost_per_unit def set_food_cost(self, cost_per_unit): self._food_cost_per_unit = cost_per_unit def dob(self): return self._dob def age(self): today = date.today() age = today.year - self._dob.year - ((today.month, today.day) < (self._dob.month, self._dob.day)) return age def set_date_of_death(self, dt): self._date_of_death = datetime.strptime(dt, "%d %m %Y") def survival_days(self): num_days = self._date_of_death - self._dob return num_days.days def desexed(self): return self._desexed def set_desexed(self, status): self._desexed = status def shed_id(self): return self._shed_id def set_shed(self, shed): self._shed_id = shed def purchased_date(self): return self._date_purchased def purchase_price(self): return self._cost_price def set_purchase_price(self, price): self._cost_price = price def sold_date(self): return self._date_sold def set_sold_date(self, dt): self._date_sold = dt def sold_price(self): return self._sold_price def set_sold_price(self, price): self._sold_price = price def vaccination_date(self): return self._vaccination_date def set_vaccination_date(self, dt): self._vaccination_date = datetime.strptime(dt, "%d %m %Y")
25.348387
105
0.632731
524
3,929
4.383588
0.141221
0.078363
0.109708
0.027862
0.184589
0.104484
0.030475
0.030475
0.030475
0
0
0.005971
0.275388
3,929
155
106
25.348387
0.800843
0
0
0.035398
0
0
0.008142
0
0
0
0
0
0
1
0.353982
false
0
0.00885
0.159292
0.548673
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
1629c74ba65d8cc0dacf3d256659db6dc350f5b3
551
py
Python
IPython/testing/plugin/simple.py
pyarnold/ipython
c4797f7f069d0a974ddfa1e4251c7550c809dba0
[ "BSD-3-Clause-Clear" ]
1
2020-12-18T01:07:55.000Z
2020-12-18T01:07:55.000Z
IPython/testing/plugin/simple.py
pyarnold/ipython
c4797f7f069d0a974ddfa1e4251c7550c809dba0
[ "BSD-3-Clause-Clear" ]
null
null
null
IPython/testing/plugin/simple.py
pyarnold/ipython
c4797f7f069d0a974ddfa1e4251c7550c809dba0
[ "BSD-3-Clause-Clear" ]
null
null
null
"""Simple example using doctests. This file just contains doctests both using plain python and IPython prompts. All tests should be loaded by nose. """ from __future__ import print_function def pyfunc(): """Some pure python tests... >>> pyfunc() 'pyfunc' >>> import os >>> 2+3 5 >>> for i in range(3): ... print(i, end=' ') ... print(i+1, end=' ') ... 0 1 1 2 2 3 """ return 'pyfunc' def ipyfunc2(): """Some pure python tests... >>> 1+1 2 """ return 'pyfunc2'
15.305556
77
0.54265
72
551
4.083333
0.611111
0.054422
0.095238
0.129252
0
0
0
0
0
0
0
0.041885
0.306715
551
35
78
15.742857
0.727749
0.638838
0
0
0
0
0.104839
0
0
0
0
0
0
1
0.4
true
0
0.2
0
1
0.2
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
1
0
0
0
1
0
0
3
1670bf286795717793fbb97bccc978c2b820c461
425
py
Python
netapp_ocum/objects/cluster_test.py
djtaylor/python-netapp-uom
e16f5b56460217b66c8dc82adb8a69bca401a23b
[ "MIT" ]
null
null
null
netapp_ocum/objects/cluster_test.py
djtaylor/python-netapp-uom
e16f5b56460217b66c8dc82adb8a69bca401a23b
[ "MIT" ]
null
null
null
netapp_ocum/objects/cluster_test.py
djtaylor/python-netapp-uom
e16f5b56460217b66c8dc82adb8a69bca401a23b
[ "MIT" ]
null
null
null
import unittest from netapp_ocum.objects.cluster import NetApp_OCUM_Cluster class NetApp_OCUM_Object_Cluster_Test(unittest.TestCase): """Tests for `netapp_ocum/objects/cluster.py`.""" def test_cluster_instance(self): """ Test creating an instance of `NetApp_OCUM_Cluster` """ cluster = NetApp_OCUM_Cluster({ 'id': 1 }) self.assertIsInstance(cluster, NetApp_OCUM_Cluster)
32.692308
66
0.708235
51
425
5.588235
0.45098
0.245614
0.238596
0.168421
0
0
0
0
0
0
0
0.002924
0.195294
425
12
67
35.416667
0.830409
0.221176
0
0
0
0
0.006289
0
0
0
0
0
0.125
1
0.125
false
0
0.25
0
0.5
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1675b301553faba6f909377150b8f672d5b111d0
1,969
py
Python
Exercicios/Cap_1/bigdigits.py
gguilherme42/Programacao_em_Pyhton3
249843198e56ed89d4d848249a0ed301810b4ce3
[ "MIT" ]
null
null
null
Exercicios/Cap_1/bigdigits.py
gguilherme42/Programacao_em_Pyhton3
249843198e56ed89d4d848249a0ed301810b4ce3
[ "MIT" ]
null
null
null
Exercicios/Cap_1/bigdigits.py
gguilherme42/Programacao_em_Pyhton3
249843198e56ed89d4d848249a0ed301810b4ce3
[ "MIT" ]
null
null
null
Zero = [' *** ', ' * * ', '* *', '* *', '* *', ' * * ', ' *** ' ] One = [' * ', ' ** ', ' * ', ' * ', ' * ', ' * ', ' *** '] Two = [' *** ', '* *', '* * ', ' * ', ' * ', '* ', '*******' ] Three = [' *** ', ' * *', ' *', ' *** ', ' *', ' * *', ' *** ' ] Four = [' * ', ' ** ', ' * * ', '* * ', '******', ' * ', ' * '] Five = ['*******', '* ', '* ', '****** ', ' *', ' *', '****** '] Six = [' *** ', '* ', '* ', '**** ', '* *', '* *', ' *** '] Seven = [' *****', ' *', ' * ', ' * ', ' * ', '* ', '* '] Eight = [' *** ', '* *', '* *', ' *** ', '* *', '* *', ' *** '] Nine = [' ****', ' * *', ' * *', ' ****', ' *', ' *', ' *'] digitlist = [Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine] inputDigits = str(input('Digite os números de 0 à 9: ')).strip() # um digito é composto por 7 linhas (rows) for row in range(7): line = "" for column in range(len(inputDigits)): # pega o n número da string, que é o input number = int(inputDigits[column]) # pega o digito da lista de digitos de acordo com o número do input digit = digitlist[number] # pega uma parte do digito e substitui a string de '*' pelo número atual do input line += digit[row].replace('*', f'{number}') + " " print(line)
20.946809
88
0.221432
106
1,969
4.113208
0.584906
0.03211
0.045872
0.068807
0.183486
0.183486
0.183486
0.183486
0.183486
0.183486
0
0.004479
0.54647
1,969
93
89
21.172043
0.483763
0.115795
0
0.707317
0
0
0.29371
0
0
0
0
0
0
1
0
false
0
0
0
0
0.012195
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
167dca60c223aefb1b6384f87a24cbd17c60010b
3,034
py
Python
tests/test_request.py
ngseer/pydantic-jsonapi
80fa3096df52f5338845c088a07bda8a9211f48c
[ "MIT" ]
null
null
null
tests/test_request.py
ngseer/pydantic-jsonapi
80fa3096df52f5338845c088a07bda8a9211f48c
[ "MIT" ]
null
null
null
tests/test_request.py
ngseer/pydantic-jsonapi
80fa3096df52f5338845c088a07bda8a9211f48c
[ "MIT" ]
null
null
null
from pytest import raises from pydantic import ValidationError from pydantic_jsonapi import JsonApiRequest from tests.helpers import ItemModel class TestJsonApiRequest: def test_attributes_as_dict(self): DictRequest = JsonApiRequest('item', dict) obj_to_validate = { 'data': {'type': 'item', 'attributes': {}} } my_request_obj = DictRequest(**obj_to_validate) assert my_request_obj.dict() == obj_to_validate def test_attributes_as_item_model(self): ItemRequest = JsonApiRequest('item', ItemModel) obj_to_validate = { 'data': { 'type': 'item', 'attributes': { 'name': 'apple', 'quantity': 10, 'price': 1.20 } } } my_request_obj = ItemRequest(**obj_to_validate) assert my_request_obj.dict() == obj_to_validate def test_attributes_as_item_model__empty_dict(self): ItemRequest = JsonApiRequest('item', ItemModel) obj_to_validate = { 'data': { 'type': 'item', 'attributes': {} } } with raises(ValidationError) as e: ItemRequest(**obj_to_validate) assert e.value.errors() == [ {'loc': ('data', 'attributes', 'name'), 'msg': 'field required', 'type': 'value_error.missing'}, {'loc': ('data', 'attributes', 'quantity'), 'msg': 'field required', 'type': 'value_error.missing'}, {'loc': ('data', 'attributes', 'price'), 'msg': 'field required', 'type': 'value_error.missing'} ] def test_type_invalid_string(self): MyRequest = JsonApiRequest('item', dict) obj_to_validate = { 'data': {'type': 'not_an_item', 'attributes': {}} } with raises(ValidationError) as e: MyRequest(**obj_to_validate) assert e.value.errors() == [ { 'loc': ('data', 'type'), 'msg': "unexpected value; permitted: 'item'", 'type': 'value_error.const', 'ctx': {'given': 'not_an_item', 'permitted': ('item',)}, }, ] def test_attributes_required(self): MyRequest = JsonApiRequest('item', dict) obj_to_validate = { 'data': {'type': 'item', 'attributes': None} } with raises(ValidationError) as e: MyRequest(**obj_to_validate) assert e.value.errors() == [ {'loc': ('data', 'attributes'), 'msg': 'value is not a valid dict', 'type': 'type_error.dict'}, ] def test_data_required(self): MyRequest = JsonApiRequest('item', dict) obj_to_validate = { 'data': None } with raises(ValidationError) as e: MyRequest(**obj_to_validate) assert e.value.errors() == [ {'loc': ('data',), 'msg': 'value is not a valid dict', 'type': 'type_error.dict'}, ]
33.711111
112
0.533949
293
3,034
5.296928
0.215017
0.045103
0.117268
0.065722
0.732603
0.718428
0.718428
0.667526
0.667526
0.667526
0
0.002432
0.322347
3,034
89
113
34.089888
0.752432
0
0
0.368421
0
0
0.189519
0
0
0
0
0
0.078947
1
0.078947
false
0
0.052632
0
0.144737
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
16879cd80a8fcaa53027fbaf639c98f9d6ab9fd3
304
py
Python
autograd/extend.py
gautam1858/autograd
8d7acaf79e33139b4ebfedf7da0602a965b47c63
[ "MIT" ]
6,119
2015-03-10T03:55:58.000Z
2022-03-31T11:54:19.000Z
autograd/extend.py
EnjoyLifeFund/Debian_py36_packages
1985d4c73fabd5f08f54b922e73a9306e09c77a5
[ "BSD-3-Clause", "BSD-2-Clause", "MIT" ]
523
2015-03-10T11:59:23.000Z
2022-03-05T15:31:59.000Z
autograd/extend.py
EnjoyLifeFund/Debian_py36_packages
1985d4c73fabd5f08f54b922e73a9306e09c77a5
[ "BSD-3-Clause", "BSD-2-Clause", "MIT" ]
949
2015-03-11T20:04:20.000Z
2022-03-31T12:13:11.000Z
# Exposes API for extending autograd from .tracer import Box, primitive, register_notrace, notrace_primitive from .core import (SparseObject, VSpace, vspace, VJPNode, JVPNode, defvjp_argnums, defvjp_argnum, defvjp, defjvp_argnums, defjvp_argnum, defjvp, def_linear)
50.666667
71
0.720395
34
304
6.235294
0.676471
0
0
0
0
0
0
0
0
0
0
0
0.217105
304
5
72
60.8
0.890756
0.111842
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
168a5eefc3a544176cebc8039d19617c2f496282
94
py
Python
src/15_For_Loops/03_for.py
UltiRequiem/W3Schools-Python-Exercises
34d10d48d7ce7b9e50466cd8537a8aece0426ce8
[ "MIT" ]
5
2021-05-29T23:30:50.000Z
2022-01-15T16:35:20.000Z
src/15_For_Loops/03_for.py
UltiRequiem/W3Schools-Python-Exercises
34d10d48d7ce7b9e50466cd8537a8aece0426ce8
[ "MIT" ]
null
null
null
src/15_For_Loops/03_for.py
UltiRequiem/W3Schools-Python-Exercises
34d10d48d7ce7b9e50466cd8537a8aece0426ce8
[ "MIT" ]
4
2021-03-18T17:48:06.000Z
2021-07-22T19:32:36.000Z
# Use the range function to loop through a code set 6 times. for x in range(6): print(x)
18.8
60
0.680851
19
94
3.368421
0.842105
0
0
0
0
0
0
0
0
0
0
0.028169
0.244681
94
4
61
23.5
0.873239
0.617021
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
1
0
3
16b4fb04f22781f088bf0edeec885640fff6ae64
360
py
Python
app/ecommerce/views.py
fxavier/moz-marketplace-api
a9323e4df6a1340be25972a61ed9a26d799fd2df
[ "MIT" ]
null
null
null
app/ecommerce/views.py
fxavier/moz-marketplace-api
a9323e4df6a1340be25972a61ed9a26d799fd2df
[ "MIT" ]
null
null
null
app/ecommerce/views.py
fxavier/moz-marketplace-api
a9323e4df6a1340be25972a61ed9a26d799fd2df
[ "MIT" ]
null
null
null
from rest_framework import viewsets, mixins from core.models import Category, Provider, Product from . import serializers class ProductViewSet(viewsets.GenericViewSet, mixins.ListModelMixin): queryset = Product.objects.all() serializer_class = serializers.ProductSerializer def get_queryset(self): return self.queryset.filter(pk=None)
25.714286
69
0.780556
40
360
6.95
0.7
0
0
0
0
0
0
0
0
0
0
0
0.147222
360
13
70
27.692308
0.905537
0
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0.375
0.125
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
3
16be308adebf34b3a62305e50d8bd715f5e92f0f
251
py
Python
Practica3_Matias.py
mbermejo1/PracticasSF2
0dd57b24c658cb75f0783776d9178f13180563fe
[ "MIT" ]
null
null
null
Practica3_Matias.py
mbermejo1/PracticasSF2
0dd57b24c658cb75f0783776d9178f13180563fe
[ "MIT" ]
null
null
null
Practica3_Matias.py
mbermejo1/PracticasSF2
0dd57b24c658cb75f0783776d9178f13180563fe
[ "MIT" ]
null
null
null
print("\n\t\t-----> Welcome to Matias list changer <-----\t\t\n") listn = [1,2,3,4,5,6,7,8,9,10] print(f"\nThis is the list without changes ===> {listn}\n") listn[4] *= 2 listn[7] *= 2 listn[9] *= 2 print(f"\nThis is the modified list ===> {listn}\n")
35.857143
65
0.589641
51
251
2.901961
0.509804
0.027027
0.148649
0.175676
0.216216
0
0
0
0
0
0
0.077982
0.131474
251
7
66
35.857143
0.600917
0
0
0
0
0
0.583333
0
0
0
0
0
0
1
0
false
0
0
0
0
0.428571
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
16f00eb30367bc3ddac25ee94f046a9115424084
196
py
Python
Shared/Microcontroller/constants.py
atfinke/RX
3261a97c2d576abf914f8e0c5cef17d596fcf8c7
[ "MIT" ]
null
null
null
Shared/Microcontroller/constants.py
atfinke/RX
3261a97c2d576abf914f8e0c5cef17d596fcf8c7
[ "MIT" ]
null
null
null
Shared/Microcontroller/constants.py
atfinke/RX
3261a97c2d576abf914f8e0c5cef17d596fcf8c7
[ "MIT" ]
null
null
null
class Constants: FW_VERSION = 4 LIGHT_TRANSITION_DURATION = 320 FAST_RECONNECT_WAIT_TIME_BEFORE_RESETING_LIGHTS = 5 HEARTBEAT_INTERVAL = 120 HEARTBEAT_MAX_RESPONSE_TIME = 5
19.6
55
0.765306
25
196
5.48
0.88
0
0
0
0
0
0
0
0
0
0
0.057692
0.204082
196
9
56
21.777778
0.820513
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
bc4e80320d099cf17f5204bad028e2f26ffbf91d
1,100
py
Python
app01/tests.py
pscly/web_homework
9876626a397d9a7c214fa33694c4078d15863fb1
[ "MulanPSL-1.0" ]
null
null
null
app01/tests.py
pscly/web_homework
9876626a397d9a7c214fa33694c4078d15863fb1
[ "MulanPSL-1.0" ]
3
2020-12-21T08:14:10.000Z
2020-12-24T11:23:00.000Z
app01/tests.py
pscly/web_h1
079af5c14b4b1d32da4245540768f76d3c1cce4f
[ "MulanPSL-1.0" ]
null
null
null
from django.test import TestCase # Create your tests here. import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web_homework.settings") import django django.setup() from app01 import models # 一对多 # # user_obj = models.User.objects.filter(username='pscly').first() # print(user_obj.username) # pscly # models.Files.objects.create(file_name='a1', user) # file_obj = models.Files.objects.all() # # file_obj_count = file_obj.count() # file_obj_count_ye, file_obj_count_yu = (file_obj_count // 6) + 1, file_obj_count % 6 # print(file_obj_count_ye, file_obj_count_yu) # file_obj_count_ye, file_obj_count_yu = divmod(file_obj_count, 6) # print(file_obj_count_ye, file_obj_count_yu) # objs = models.Files.objects.order_by('-file_date').filter(user=35) # for i in objs: # print(i.file_name) # 多对多 for i in range(5): username = input(":>>") password = '123' user_obj = models.User(username=username, password=password) user_obj.save()
28.205128
90
0.668182
156
1,100
4.371795
0.365385
0.143695
0.228739
0.082111
0.269795
0.269795
0.234604
0.234604
0.211144
0.211144
0
0.014977
0.210909
1,100
39
91
28.205128
0.770737
0.540909
0
0
0
0
0.117043
0.088296
0
0
0
0
0
1
0
false
0.153846
0.384615
0
0.384615
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
1
1
0
0
0
0
3
bc5b20fddce40e5420ec6dab5cdfbc0447c67baa
128
py
Python
tweets_etl/constants.py
brendanartley/NHL-Event-Detection
2bee965d81549de61649c7e918beb16f132f1ec3
[ "MIT" ]
null
null
null
tweets_etl/constants.py
brendanartley/NHL-Event-Detection
2bee965d81549de61649c7e918beb16f132f1ec3
[ "MIT" ]
null
null
null
tweets_etl/constants.py
brendanartley/NHL-Event-Detection
2bee965d81549de61649c7e918beb16f132f1ec3
[ "MIT" ]
null
null
null
TWITTER_DIR = "twitter_data" TWITTER_RAW_DIR = "raw" TWITTER_PARQUET_DIR = "parquet" TWITTER_RAW_SCHEMA = "twitter_schema.json"
25.6
42
0.804688
18
128
5.222222
0.388889
0.212766
0
0
0
0
0
0
0
0
0
0
0.09375
128
5
42
25.6
0.810345
0
0
0
0
0
0.317829
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
bc670635c9a7cfb78f2f81db5f8411be24e7973b
103
py
Python
Python/desafios/d10.py
prazerfelipe/Python
b1f4c768b1823d34898935bbd037ae43711c79e1
[ "MIT" ]
null
null
null
Python/desafios/d10.py
prazerfelipe/Python
b1f4c768b1823d34898935bbd037ae43711c79e1
[ "MIT" ]
null
null
null
Python/desafios/d10.py
prazerfelipe/Python
b1f4c768b1823d34898935bbd037ae43711c79e1
[ "MIT" ]
null
null
null
c= 10 d= c/5 print('Você tem na carteira {} e a quantia de dolar que você pode obter é {}'.format(c,d))
34.333333
90
0.669903
23
103
3
0.826087
0
0
0
0
0
0
0
0
0
0
0.035714
0.184466
103
3
90
34.333333
0.785714
0
0
0
0
0
0.663462
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
bc7ac596a91fca271c4da4c3aff379d7ff034525
1,040
py
Python
temporalis/sun.py
builderjer/temporalis
2088080597b4aedd7ec83f3c5b8a726c29ab9b08
[ "Apache-2.0" ]
2
2020-04-10T12:35:49.000Z
2020-04-10T20:01:53.000Z
temporalis/sun.py
JarbasAl/pyweather
9a623a4a1acbbdc8c1957028d6e428b94a2e89aa
[ "Apache-2.0" ]
1
2021-08-09T12:58:26.000Z
2021-08-09T12:58:26.000Z
temporalis/sun.py
JarbasAl/pyweather
9a623a4a1acbbdc8c1957028d6e428b94a2e89aa
[ "Apache-2.0" ]
1
2021-04-27T16:47:23.000Z
2021-04-27T16:47:23.000Z
import pendulum from astral import LocationInfo from astral.sun import sun from temporalis.location import get_timezone from temporalis.time import now_utc def get_sun_times(lat, lon, date=None): date = date or now_utc() tz = get_timezone(lat, lon) city = LocationInfo("Some city", "Some location", tz, lat, lon) s = sun(city.observer, date=date) # inject timezone data tz = pendulum.timezone(tz) for k in s: s[k] = tz.datetime(s[k].year, s[k].month, s[k].day, s[k].hour, s[k].minute, s[k].second) return s def get_dawn(lat, lon, date=None): return get_sun_times(lat, lon, date)["dawn"] def get_sunrise(lat, lon, date=None): return get_sun_times(lat, lon, date)["sunrise"] def get_noon(lat, lon, date=None): return get_sun_times(lat, lon, date)["noon"] def get_sunset(lat, lon, date=None): return get_sun_times(lat, lon, date)["sunset"] def get_dusk(lat, lon, date=None): return get_sun_times(lat, lon, date)["dusk"]
26
63
0.648077
166
1,040
3.933735
0.259036
0.119449
0.168453
0.128637
0.346095
0.346095
0.313936
0.313936
0.313936
0.313936
0
0
0.219231
1,040
39
64
26.666667
0.804187
0.019231
0
0
0
0
0.046169
0
0
0
0
0
0
1
0.230769
false
0
0.192308
0.192308
0.653846
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
bc86669694cb3b28e17561f53dc7316f3077b5cd
2,207
py
Python
openmc/particle_restart.py
johnnyliu27/openmc
d7359f151cc9eece99fb155e80f73a1b3393f7f7
[ "MIT" ]
null
null
null
openmc/particle_restart.py
johnnyliu27/openmc
d7359f151cc9eece99fb155e80f73a1b3393f7f7
[ "MIT" ]
null
null
null
openmc/particle_restart.py
johnnyliu27/openmc
d7359f151cc9eece99fb155e80f73a1b3393f7f7
[ "MIT" ]
null
null
null
import h5py import openmc.checkvalue as cv _VERSION_PARTICLE_RESTART = 2 class Particle(object): """Information used to restart a specific particle that caused a simulation to fail. Parameters ---------- filename : str Path to the particle restart file Attributes ---------- current_batch : int The batch containing the particle generations_per_batch : int Number of generations per batch current_generation : int The generation containing the particle n_particles : int Number of particles per generation run_mode : int Type of simulation (criticality or fixed source) id : long Identifier of the particle type : int Particle type (1 = neutron, 2 = photon, 3 = electron, 4 = positron) weight : float Weight of the particle energy : float Energy of the particle in eV xyz : list of float Position of the particle uvw : list of float Directional cosines of the particle """ def __init__(self, filename): self._f = h5py.File(filename, 'r') # Ensure filetype and version are correct cv.check_filetype_version(self._f, 'particle restart', _VERSION_PARTICLE_RESTART) @property def current_batch(self): return self._f['current_batch'].value @property def current_generation(self): return self._f['current_generation'].value @property def energy(self): return self._f['energy'].value @property def generations_per_batch(self): return self._f['generations_per_batch'].value @property def id(self): return self._f['id'].value @property def type(self): return self._f['type'].value @property def n_particles(self): return self._f['n_particles'].value @property def run_mode(self): return self._f['run_mode'].value.decode() @property def uvw(self): return self._f['uvw'].value @property def weight(self): return self._f['weight'].value @property def xyz(self): return self._f['xyz'].value
23.731183
82
0.623924
268
2,207
4.977612
0.30597
0.048726
0.115442
0.123688
0.051724
0
0
0
0
0
0
0.00447
0.29044
2,207
92
83
23.98913
0.847382
0.389216
0
0.268293
0
0
0.091803
0.017213
0
0
0
0
0
1
0.292683
false
0
0.04878
0.268293
0.634146
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
bc893c138817d93ed810580b826991ad1c31d49f
237
py
Python
clickohtest/api.py
Wladyk/basic-api-endpoints
3e75e3a2797551d383ef160f12c0ac90f2f0333f
[ "MIT" ]
1
2022-02-28T22:51:03.000Z
2022-02-28T22:51:03.000Z
clickohtest/api.py
Wladyk/basic-api-endpoints
3e75e3a2797551d383ef160f12c0ac90f2f0333f
[ "MIT" ]
null
null
null
clickohtest/api.py
Wladyk/basic-api-endpoints
3e75e3a2797551d383ef160f12c0ac90f2f0333f
[ "MIT" ]
null
null
null
from rest_framework import routers from clickoh import viewsets router = routers.DefaultRouter() router.register(r'product', viewsets.ProductViewset, basename="product") router.register(r'order', viewsets.OrderViewset, basename="order")
39.5
72
0.818565
28
237
6.892857
0.571429
0.145078
0.15544
0
0
0
0
0
0
0
0
0
0.07173
237
5
73
47.4
0.877273
0
0
0
0
0
0.101266
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
bc8a69bbf1287b51ea903212a23b7f6322785628
1,213
py
Python
src/heatmap.py
CMU-IDS-2021/fp--05839-jpark-etatum-shuang
5b7679c030b132262d7c41760a90922a7aab2ba6
[ "BSD-3-Clause" ]
null
null
null
src/heatmap.py
CMU-IDS-2021/fp--05839-jpark-etatum-shuang
5b7679c030b132262d7c41760a90922a7aab2ba6
[ "BSD-3-Clause" ]
1
2021-05-05T05:59:30.000Z
2021-05-05T14:34:05.000Z
src/heatmap.py
CMU-IDS-2021/fp--05839-jpark-etatum-shuang
5b7679c030b132262d7c41760a90922a7aab2ba6
[ "BSD-3-Clause" ]
1
2021-05-02T07:43:13.000Z
2021-05-02T07:43:13.000Z
import pandas as pd import streamlit as st from src.utils import generate_heatmap def heatmap_chart(): # headers and stuff st.header("Part 3: Heatmap of Airbnb occupancy rate") # generate second chart st.markdown("Now comes the interesting part, what are the occupancy rate of Airbnb housing? " "The following heatmap will tell you about it.") st.markdown("The heatmap below shows a obvious trend of drop in occupancy rate. " "Especially the comparision between the year 2015/2016 and 2020/2021, heatmap are much more yellow in " "previous years and blue in recent years, which could be the outcome of Covid-19.") chart1 = generate_heatmap() st.plotly_chart(chart1) st.header("Analysis") st.markdown("The low spectrum indicated close to max occupancy while high referenced vacancy. We were able to see that the occupancy rates average around 0.45 - 0.75. In 2020 - 2021, we saw the occupancy rate was slightly lower than average likely due to macroeconomic drivers (e.g COVID-19), though the impact was minimal. These rates are important to analyze so we can get an understanding of the demand for rental properties, which can indicate high conversion into short term rentals.") pass
48.52
491
0.771641
195
1,213
4.779487
0.630769
0.055794
0.034335
0
0
0
0
0
0
0
0
0.036816
0.171476
1,213
24
492
50.541667
0.890547
0.032152
0
0
1
0.066667
0.764304
0
0
0
0
0
0
1
0.066667
false
0.066667
0.266667
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
1
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
bc975a87034c8fffe7a687af022c485d27619d34
173
py
Python
folders/platzi-sellings/pv.py
angelopassaro/Hacktoberfest-1
21f90f5d49efba9b1a27f4d9b923f5017ab43f0e
[ "Apache-2.0" ]
1
2020-10-06T01:20:07.000Z
2020-10-06T01:20:07.000Z
folders/platzi-sellings/pv.py
angelopassaro/Hacktoberfest-1
21f90f5d49efba9b1a27f4d9b923f5017ab43f0e
[ "Apache-2.0" ]
null
null
null
folders/platzi-sellings/pv.py
angelopassaro/Hacktoberfest-1
21f90f5d49efba9b1a27f4d9b923f5017ab43f0e
[ "Apache-2.0" ]
null
null
null
import click from clients import commands as clients_commands @click.group() @click.pass_context def cli(ctx): ctx.obj = {} cli.add_command(clients_commands.all)
15.727273
48
0.745665
25
173
5
0.64
0.24
0
0
0
0
0
0
0
0
0
0
0.156069
173
11
49
15.727273
0.856164
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0.142857
0.285714
0
0.428571
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
bc9d0ca0d37b49f74566512170cd2973b786ff1d
682
py
Python
plugin/AssemblerSPAdes/bin/SPAdes-2.5.1-Linux/share/spades/joblib2/testing.py
konradotto/TS
bf088bd8432b1e3f4b8c8c083650a30d9ef2ae2e
[ "Apache-2.0" ]
125
2015-01-22T05:43:23.000Z
2022-03-22T17:15:59.000Z
plugin/AssemblerSPAdes/bin/SPAdes-2.5.1-Linux/share/spades/joblib2/testing.py
konradotto/TS
bf088bd8432b1e3f4b8c8c083650a30d9ef2ae2e
[ "Apache-2.0" ]
59
2015-02-10T09:13:06.000Z
2021-11-11T02:32:38.000Z
plugin/AssemblerSPAdes/bin/SPAdes-2.5.1-Linux/share/spades/joblib2/testing.py
konradotto/TS
bf088bd8432b1e3f4b8c8c083650a30d9ef2ae2e
[ "Apache-2.0" ]
98
2015-01-17T01:25:10.000Z
2022-03-18T17:29:42.000Z
############################################################################ # Copyright (c) 2011-2013 Saint-Petersburg Academic University # All Rights Reserved # See file LICENSE for details. ############################################################################ """ Helper for testing. """ import sys import warnings import os.path def warnings_to_stdout(): """ Redirect all warnings to stdout. """ showwarning_orig = warnings.showwarning def showwarning(msg, cat, fname, lno, file=None, line=0): showwarning_orig(msg, cat, os.path.basename(fname), line, sys.stdout) warnings.showwarning = showwarning #warnings.simplefilter('always')
26.230769
77
0.552786
66
682
5.651515
0.590909
0.032172
0.085791
0
0
0
0
0
0
0
0
0.015358
0.140762
682
25
78
27.28
0.62116
0.293255
0
0
0
0
0
0
0
0
0
0
0
1
0.25
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
1
0
0
1
0
1
0
0
3
bca2bd929d502f207cc8e76e466ff8c45adbe0ad
671
py
Python
pool/partial.py
lehmansoft/lehman-pool-reference
a54088d78fae93a0733507b336bdd908891bc8cc
[ "Apache-2.0" ]
1
2021-09-14T09:20:53.000Z
2021-09-14T09:20:53.000Z
pool/partial.py
lehmansoft/lehman-pool-reference
a54088d78fae93a0733507b336bdd908891bc8cc
[ "Apache-2.0" ]
null
null
null
pool/partial.py
lehmansoft/lehman-pool-reference
a54088d78fae93a0733507b336bdd908891bc8cc
[ "Apache-2.0" ]
1
2021-09-01T06:22:41.000Z
2021-09-01T06:22:41.000Z
from dataclasses import dataclass from blspy import G1Element from chia.pools.pool_wallet_info import PoolState from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.coin_spend import CoinSpend from chia.util.ints import uint64 from chia.util.streamable import streamable, Streamable @dataclass(frozen=True) @streamable class PartialRecord(Streamable): launcher_id: bytes32 timestamp: uint64 difficulty: uint64 challenge: str pool_contract_puzzle_hash: str plot_public_key: str size: uint64 proof: str sp_hash: str end_of_sub_slot: bool harvester_id: str valid:bool invalid_error:str
26.84
60
0.770492
90
671
5.555556
0.588889
0.08
0.052
0
0
0
0
0
0
0
0
0.023636
0.180328
671
25
61
26.84
0.885455
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.304348
0
0.913043
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
1
0
0
3
bcaf439e55f41b054ed3abcfecdc94974e2e7146
239
py
Python
retrobiocat_web/main.py
ihayhurst/RetroBioCat
d674897459c0ab65faad5ed3017c55cf51bcc020
[ "MIT" ]
9
2020-12-01T16:33:02.000Z
2022-01-19T20:02:42.000Z
retrobiocat_web/main.py
ihayhurst/RetroBioCat
d674897459c0ab65faad5ed3017c55cf51bcc020
[ "MIT" ]
4
2020-10-02T14:38:32.000Z
2021-08-02T09:23:58.000Z
retrobiocat_web/main.py
ihayhurst/RetroBioCat
d674897459c0ab65faad5ed3017c55cf51bcc020
[ "MIT" ]
6
2021-01-14T07:48:36.000Z
2022-03-20T17:34:27.000Z
from retrobiocat_web.app.app import create_app import os production_mode = os.environ.get('PRODUCTION') or False main_app = create_app(use_talisman=production_mode) if __name__ == '__main__': main_app.run(debug=not production_mode)
23.9
55
0.794979
36
239
4.805556
0.583333
0.242775
0
0
0
0
0
0
0
0
0
0
0.112971
239
9
56
26.555556
0.816038
0
0
0
0
0
0.075314
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
bccec9fee740bd758f23a07862a9d9f79fd4fbc8
2,385
py
Python
test_scenario.py
Hegberg/Alpha-Beta-Battlesnake
a3b77d4543464a9ae4cd19b4d3ae8fbb632da45b
[ "MIT" ]
null
null
null
test_scenario.py
Hegberg/Alpha-Beta-Battlesnake
a3b77d4543464a9ae4cd19b4d3ae8fbb632da45b
[ "MIT" ]
null
null
null
test_scenario.py
Hegberg/Alpha-Beta-Battlesnake
a3b77d4543464a9ae4cd19b4d3ae8fbb632da45b
[ "MIT" ]
null
null
null
import time import os from algorithms.get_move import get_move if __name__ == '__main__': start = time.time() #Killed self going left data = {'game': {'id': '22aa4c5b-b139-40ff-8de6-e2531fa0fbf9', 'ruleset': {'name': 'standard', 'version': 'v1.0.13'}, 'timeout': 500}, 'turn': 164, 'board': {'height': 11, 'width': 11, 'snakes': [{'id': 'gs_6tXpdVmCf7VrQtxtk4RcwYTc', 'name': 'Git Adder (2)', 'latency': '75', 'health': 90, 'body': [{'x': 3, 'y': 7}, {'x': 3, 'y': 6}, {'x': 3, 'y': 5}, {'x': 4, 'y': 5}, {'x': 5, 'y': 5}, {'x': 6, 'y': 5}, {'x': 7, 'y': 5}, {'x': 8, 'y': 5}, {'x': 9, 'y': 5}, {'x': 10, 'y': 5}, {'x': 10, 'y': 6}, {'x': 10, 'y': 7}, {'x': 9, 'y': 7}, {'x': 9, 'y': 8}], 'head': {'x': 3, 'y': 7}, 'length': 14, 'shout': ''}, {'id': 'gs_D8Y8PhF8cJ87xgytkbvw6ptH', 'name': 'Head Hunter', 'latency': '71', 'health': 95, 'body': [{'x': 0, 'y': 4}, {'x': 0, 'y': 3}, {'x': 0, 'y': 2}, {'x': 0, 'y': 1}, {'x': 1, 'y': 1}, {'x': 2, 'y': 1}, {'x': 3, 'y': 1}, {'x': 4, 'y': 1}, {'x': 5, 'y': 1}, {'x': 6, 'y': 1}, {'x': 7, 'y': 1}, {'x': 8, 'y': 1}, {'x': 8, 'y': 2}, {'x': 8, 'y': 3}, {'x': 7, 'y': 3}, {'x': 6, 'y': 3}, {'x': 5, 'y': 3}], 'head': {'x': 0, 'y': 4}, 'length': 17, 'shout': ''}, {'id': 'gs_m4m7ybyjk9gm4YRHPB3Wx8WK', 'name': 'Shielded_Woodland', 'latency': '242', 'health': 54, 'body': [{'x': 1, 'y': 5}, {'x': 1, 'y': 4}, {'x': 2, 'y': 4}, {'x': 2, 'y': 5}, {'x': 2, 'y': 6}, {'x': 1, 'y': 6}], 'head': {'x': 1, 'y': 5}, 'length': 6, 'shout': ''}], 'food': [{'x': 6, 'y': 2}, {'x': 4, 'y': 0}, {'x': 10, 'y': 10}, {'x': 2, 'y': 9}], 'hazards': []}, 'you': {'id': 'gs_m4m7ybyjk9gm4YRHPB3Wx8WK', 'name': 'Shielded_Woodland', 'latency': '242', 'health': 54, 'body': [{'x': 1, 'y': 5}, {'x': 1, 'y': 4}, {'x': 2, 'y': 4}, {'x': 2, 'y': 5}, {'x': 2, 'y': 6}, {'x': 1, 'y': 6}], 'head': {'x': 1, 'y': 5}, 'length': 6, 'shout': ''}} move = get_move(data) end = time.time() elapsed_time = end - start if (move == 'left'): print("Test Scenario Failed surviving: " + str(elapsed_time)) elif(elapsed_time > 0.450): print('move: ' + str(move)) print("Test Scenario Failed by time: " + str(elapsed_time)) else: print("Test Scenario passed with time: " + str(elapsed_time)) start = time.time() print("---------------------------------") print("Time elsapsed: " + str(elapsed_time))
88.333333
1,722
0.446122
374
2,385
2.783422
0.243316
0.026897
0.034582
0.01537
0.246878
0.21902
0.21902
0.21902
0.21902
0.21902
0
0.097208
0.189099
2,385
27
1,723
88.333333
0.441055
0.009224
0
0.105263
0
0
0.301312
0.074905
0
0
0
0
0
1
0
false
0.052632
0.157895
0
0.157895
0.315789
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
bcdddd747d2000020cc78454c2ce315e1e5e3d54
299
py
Python
guesslang/__init__.py
FiniteStateInc/guesslang
22f7c6f28a71a2c95fec6825eacaa2f693cb4a6f
[ "MIT" ]
null
null
null
guesslang/__init__.py
FiniteStateInc/guesslang
22f7c6f28a71a2c95fec6825eacaa2f693cb4a6f
[ "MIT" ]
null
null
null
guesslang/__init__.py
FiniteStateInc/guesslang
22f7c6f28a71a2c95fec6825eacaa2f693cb4a6f
[ "MIT" ]
null
null
null
""" Guesslang: a machine learning program that guesses the programming language of a given source file. """ from guesslang.config import config_logging # noqa: F401 from guesslang.guesser import Guess # noqa: F401 from guesslang.utils import GuesslangError # noqa: F401 __version__ = '0.9.4'
23
75
0.765886
41
299
5.463415
0.682927
0.174107
0.107143
0.1875
0
0
0
0
0
0
0
0.047809
0.160535
299
12
76
24.916667
0.844622
0.444816
0
0
0
0
0.032258
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
bcf3b63dd62dad795ed0befc6b4734d3f11306fe
1,092
py
Python
app.py
taapp/harjoittelu_flask
5ef6d950e79ba0c1ad46d5c00e7e481d58c2c6c1
[ "MIT" ]
null
null
null
app.py
taapp/harjoittelu_flask
5ef6d950e79ba0c1ad46d5c00e7e481d58c2c6c1
[ "MIT" ]
null
null
null
app.py
taapp/harjoittelu_flask
5ef6d950e79ba0c1ad46d5c00e7e481d58c2c6c1
[ "MIT" ]
null
null
null
from flask import Flask from flask import redirect, render_template, request, session from flask_sqlalchemy import SQLAlchemy from dotenv import load_dotenv from os import getenv load_dotenv() app = Flask(__name__) app.secret_key = getenv("SECRET_KEY") app.config["SQLALCHEMY_DATABASE_URI"] = getenv("DATABASE_URL") db = SQLAlchemy(app) import routes # @app.route("/") # def index(): # return render_template("index.html") # @app.route("/areas") # def areas(): # return render_template("areas.html") # @app.route("/login",methods=["POST"]) # def login(): # username = request.form["username"] # password = request.form["password"] # # TODO: check username and password # sql = "SELECT 1 FROM users WHERE name=:username AND password=:password" # result = db.session.execute(sql, {"username":username, 'password':password}) # if result.fetchone(): # session["username"] = username # return redirect("/areas") # return redirect("/") # @app.route("/logout") # def logout(): # del session["username"] # return redirect("/")
26
82
0.673993
130
1,092
5.546154
0.376923
0.044383
0.041609
0
0
0
0
0
0
0
0
0.001106
0.172161
1,092
41
83
26.634146
0.79646
0.626374
0
0
0
0
0.116883
0.05974
0
0
0
0.02439
0
1
0
false
0
0.545455
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
1
0
0
3
bcf6861656c9a49e832fa67073fd00f7c9c82a20
2,076
py
Python
lib/exabgp/bgp/message/update/nlri/prefix.py
lochiiconnectivity/exabgp
2cb8a99af89969ff4b0b5561de6168a18179b704
[ "BSD-3-Clause" ]
null
null
null
lib/exabgp/bgp/message/update/nlri/prefix.py
lochiiconnectivity/exabgp
2cb8a99af89969ff4b0b5561de6168a18179b704
[ "BSD-3-Clause" ]
null
null
null
lib/exabgp/bgp/message/update/nlri/prefix.py
lochiiconnectivity/exabgp
2cb8a99af89969ff4b0b5561de6168a18179b704
[ "BSD-3-Clause" ]
null
null
null
# encoding: utf-8 """ path.py Created by Thomas Mangin on 2014-06-27. Copyright (c) 2009-2015 Exa Networks. All rights reserved. """ from exabgp.protocol.ip import IP from exabgp.protocol.ip import NoIP from exabgp.protocol.family import AFI from exabgp.protocol.family import SAFI from exabgp.bgp.message.update.nlri.nlri import NLRI from exabgp.bgp.message.update.nlri.cidr import CIDR from exabgp.bgp.message.update.nlri.qualifier.path import PathInfo class Prefix (CIDR,NLRI): __slots__ = ['path_info','nexthop','action'] def __init__ (self,afi,safi,packed,mask,nexthop,action,path=None): self.path_info = PathInfo.NOPATH if path is None else path self.nexthop = IP.unpack(nexthop) if nexthop else NoIP NLRI.__init__(self,afi,safi) CIDR.__init__(self,packed,mask) self.action = action def prefix (self): return "%s/%s%s" % (CIDR.getip(self),self.mask,str(self.path_info) if self.path_info is not PathInfo.NOPATH else '') def extensive (self): return "%s/%s%s next-hop %s" % (self.ip,self.mask,str(self.path_info) if self.path_info is not PathInfo.NOPATH else '',self.nexthop) def pack (self,addpath): if addpath or True: return self.path_info.pack() + CIDR.pack(self) if addpath else CIDR.pack(self) return CIDR.pack(self) if addpath else CIDR.pack(self) def json (self): return '"%s/%s": { %s }' % (CIDR.getip(self),self.mask,self.path_info.json()) def index (self): return self.pack(True) def __len__ (self): return CIDR.__len__(self) + len(self.path_info) def __str__ (self): nexthop = ' next-hop %s' % self.nexthop if self.nexthop else '' return "%s%s" % (self.prefix(),nexthop) @classmethod def unpack (cls,afi,safi,data,addpath,nexthop,action): labels,rd,path_identifier,mask,size,prefix,left = NLRI._nlri(afi,safi,data,action,addpath) nlri = cls(afi,safi,prefix,mask,nexthop,action) if path_identifier: nlri.path_info = PathInfo(None,None,path_identifier) return len(data) - len(left),nlri for safi in (SAFI.unicast, SAFI.multicast): for afi in (AFI.ipv4, AFI.ipv6): Prefix.register_nlri(afi,safi)
33.483871
134
0.732177
335
2,076
4.408955
0.253731
0.054164
0.064997
0.040623
0.317536
0.232905
0.17197
0.17197
0.17197
0.121869
0
0.010497
0.128131
2,076
61
135
34.032787
0.805525
0.05973
0
0
0
0
0.040638
0
0
0
0
0
0
1
0.219512
false
0
0.170732
0.121951
0.658537
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
bcf9a32ee7609b6f8f7b4f9fecb7fa537ac5efb2
1,912
py
Python
backend/backend.py
soonyenju/syflask
666ed1d8e92e048d24d6954393af49e93891946b
[ "MIT" ]
2
2018-11-07T08:36:01.000Z
2019-01-10T07:00:07.000Z
backend/backend.py
soonyenju/syflask
666ed1d8e92e048d24d6954393af49e93891946b
[ "MIT" ]
null
null
null
backend/backend.py
soonyenju/syflask
666ed1d8e92e048d24d6954393af49e93891946b
[ "MIT" ]
null
null
null
# coding: utf-8 from flask import (Flask, url_for, redirect, render_template) import config, os app = Flask(__name__) app.config.from_object(config) @app.route("/") def home(): return render_template("index.html") @app.route("/articles/") def articles(): return render_template("articles.html") @app.route("/articles/poem/") def poem(): return render_template("poem.html") @app.route("/articles/item/<id>/") def items(id): return redirect(url_for("articles")) print(f"{id}") @app.route("/codes/") def codes(): return render_template("codes.html") @app.route("/test/") def test(): return render_template("index_test.html") @app.route("/log/") def log(): return redirect(url_for("home")) @app.route("/log/<is_login>/") def index(is_login): index_params = { "note": "Student logs", "meta_info" : { "identity": "Student", "nantionality": "China" } } class Person(object): name = "John Doe" age = 18 def keys(self): return ('name', 'age') def __getitem__(self, item): return getattr(self, item) default_p = Person() if is_login == "1": class User_login(Person): name = u"陈士震" age = 22 def keys(self): return ('name', 'age') def __getitem__(self, item): return getattr(self, item) user = User_login() index_params["person"] = dict(user) return render_template("index.html", **index_params) else: index_params["person"] = dict(default_p) return render_template("index.html", **index_params) @app.route("/test2/") def test2(): return url_for("home") @app.route("/register/") def register(): return render_template("register.html") if __name__ == '__main__': app.run(host = "127.0.0.1", port = 3000)
21.727273
61
0.58682
232
1,912
4.62931
0.310345
0.074488
0.148976
0.09311
0.252328
0.191806
0.191806
0.117318
0.117318
0.117318
0
0.012517
0.247908
1,912
87
62
21.977011
0.734353
0.006799
0
0.153846
0
0
0.16816
0
0
0
0
0
0
1
0.215385
false
0
0.030769
0.184615
0.569231
0.015385
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
bcfe4e624e9e69d0ba7683fdf475fd6190bc1dc8
1,446
py
Python
plotly/table1.py
HeliosSource/website
1a90b01cd0f52fe82bd3451cc298890af7eddff6
[ "CC-BY-3.0" ]
null
null
null
plotly/table1.py
HeliosSource/website
1a90b01cd0f52fe82bd3451cc298890af7eddff6
[ "CC-BY-3.0" ]
null
null
null
plotly/table1.py
HeliosSource/website
1a90b01cd0f52fe82bd3451cc298890af7eddff6
[ "CC-BY-3.0" ]
null
null
null
import plotly.plotly as py import plotly.figure_factory as FF data_matrix = [['User', 'Language', 'Chart Type', '# of Views'], ['<a href="https://plot.ly/~empet/folder/home">empet</a>', '<a href="https://plot.ly/python/">Python</a>', '<a href="https://plot.ly/~empet/8614/">Network Graph</a>', 298], ['<a href="https://plot.ly/~Grondo/folder/home">Grondo</a>', '<a href="https://plot.ly/matlab/">Matlab</a>', '<a href="https://plot.ly/~Grondo/42/">Subplots</a>', 356], ['<a href="https://plot.ly/~Dreamshot/folder/home">Dreamshot</a>', '<a href="https://help.plot.ly/tutorials/">Web App</a>', '<a href="https://plot.ly/~Dreamshot/6575/_2014-us-city-populations/">Bubble Map</a>', 262], ['<a href="https://plot.ly/~FiveThirtyEight/folder/home">FiveThirtyEight</a>', '<a href="https://help.plot.ly/tutorials/">Web App</a>', '<a href="https://plot.ly/~FiveThirtyEight/30/">Scatter</a>', 692], ['<a href="https://plot.ly/~cpsievert/folder/home">cpsievert</a>', '<a href="https://plot.ly/r/">R</a>', '<a href="https://plot.ly/~cpsievert/1130/">Surface</a>', 302]] table = FF.create_table(data_matrix) py.plot(table, filename='table1')
53.555556
102
0.513831
180
1,446
4.1
0.327778
0.101626
0.203252
0.246612
0.509485
0.509485
0.143631
0.143631
0.143631
0.143631
0
0.033676
0.260719
1,446
27
103
53.555556
0.656688
0
0
0.08
0
0.04
0.604699
0
0
0
0
0
0
1
0
false
0
0.08
0
0.08
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
bcfebfe7f1474a20917113cad049c7baeaaf07ac
112
py
Python
python/tests/my_sum/__init__.py
imjoseangel/100DaysOfCode
bff90569033e2b02a56e893bd45727125962aeb3
[ "MIT" ]
1
2022-03-30T12:59:44.000Z
2022-03-30T12:59:44.000Z
python/tests/my_sum/__init__.py
imjoseangel/100DaysOfCode
bff90569033e2b02a56e893bd45727125962aeb3
[ "MIT" ]
null
null
null
python/tests/my_sum/__init__.py
imjoseangel/100DaysOfCode
bff90569033e2b02a56e893bd45727125962aeb3
[ "MIT" ]
3
2019-08-13T11:33:36.000Z
2022-03-08T22:00:09.000Z
# pylint: disable=W0622 def sum(arg): total = 0 for val in arg: total += val return total
12.444444
23
0.5625
16
112
3.9375
0.75
0.253968
0
0
0
0
0
0
0
0
0
0.068493
0.348214
112
8
24
14
0.794521
0.1875
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
4c01816d6ff46d046981ae5f38aecc3760013c3d
128
py
Python
staticassets/compilers/stylus.py
davidelias/django-staticassets
75d937c31f12053f42b8dd5c7742ef1ac125b40d
[ "MIT" ]
null
null
null
staticassets/compilers/stylus.py
davidelias/django-staticassets
75d937c31f12053f42b8dd5c7742ef1ac125b40d
[ "MIT" ]
null
null
null
staticassets/compilers/stylus.py
davidelias/django-staticassets
75d937c31f12053f42b8dd5c7742ef1ac125b40d
[ "MIT" ]
null
null
null
from .base import CommandCompiler class StylusCompiler(CommandCompiler): content_type = 'text/css' command = 'stylus'
18.285714
38
0.742188
13
128
7.230769
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.171875
128
6
39
21.333333
0.886792
0
0
0
0
0
0.109375
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
4c07bcbaf0c74ff9c625c7e25d95ccd30a3a60d2
319
py
Python
lambdata_keilayb/wallet.py
keilayb/lambdata-23
e8d4e55497931742d644fc563e9f0141d99209b0
[ "MIT" ]
null
null
null
lambdata_keilayb/wallet.py
keilayb/lambdata-23
e8d4e55497931742d644fc563e9f0141d99209b0
[ "MIT" ]
null
null
null
lambdata_keilayb/wallet.py
keilayb/lambdata-23
e8d4e55497931742d644fc563e9f0141d99209b0
[ "MIT" ]
null
null
null
class Wallet(): def __init__(self, initial_amount = 0): self.balance = initial_amount def spend_cash(self, amount): if self.balance < amount: print("insuffienct amount") else: self.balance -= amount def add_cash(self, amount): self.balance += amount
26.583333
43
0.592476
36
319
5.027778
0.444444
0.243094
0.281768
0
0
0
0
0
0
0
0
0.004525
0.30721
319
12
44
26.583333
0.81448
0
0
0
0
0
0.05625
0
0
0
0
0
0
1
0.3
false
0
0
0
0.4
0.1
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
1
0
0
0
0
0
0
0
3
4c14a74498c7ee6fa7126e63039df28ea08c1034
1,650
py
Python
tests/v1/test_change_widget_definition.py
MichaelTROEHLER/datadog-api-client-python
12c46626622fb1277bb1e172753b342c671348bd
[ "Apache-2.0" ]
null
null
null
tests/v1/test_change_widget_definition.py
MichaelTROEHLER/datadog-api-client-python
12c46626622fb1277bb1e172753b342c671348bd
[ "Apache-2.0" ]
null
null
null
tests/v1/test_change_widget_definition.py
MichaelTROEHLER/datadog-api-client-python
12c46626622fb1277bb1e172753b342c671348bd
[ "Apache-2.0" ]
null
null
null
# coding: utf-8 # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2019-Present Datadog, Inc. from __future__ import absolute_import import sys import unittest import datadog_api_client.v1 try: from datadog_api_client.v1.model import change_widget_definition_type except ImportError: change_widget_definition_type = sys.modules[ 'datadog_api_client.v1.model.change_widget_definition_type'] try: from datadog_api_client.v1.model import change_widget_request except ImportError: change_widget_request = sys.modules[ 'datadog_api_client.v1.model.change_widget_request'] try: from datadog_api_client.v1.model import widget_text_align except ImportError: widget_text_align = sys.modules[ 'datadog_api_client.v1.model.widget_text_align'] try: from datadog_api_client.v1.model import widget_time except ImportError: widget_time = sys.modules[ 'datadog_api_client.v1.model.widget_time'] from datadog_api_client.v1.model.change_widget_definition import ChangeWidgetDefinition class TestChangeWidgetDefinition(unittest.TestCase): """ChangeWidgetDefinition unit test stubs""" def setUp(self): pass def tearDown(self): pass def testChangeWidgetDefinition(self): """Test ChangeWidgetDefinition""" # FIXME: construct object with mandatory attributes with example values # model = ChangeWidgetDefinition() # noqa: E501 pass if __name__ == '__main__': unittest.main()
30.555556
108
0.762424
205
1,650
5.84878
0.395122
0.083403
0.133445
0.150125
0.33945
0.33945
0.336113
0.336113
0.225188
0.080067
0
0.014535
0.166061
1,650
53
109
31.132075
0.856831
0.256364
0
0.323529
0
0
0.163636
0.157025
0
0
0
0.018868
0
1
0.088235
false
0.088235
0.382353
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
1
1
0
0
0
0
3
4c15fbe3ff407abd5a1f8f19042e60d7979288f6
273
py
Python
transferencia/serializer.py
Danieli-Bauer/djangolivre
d06289cebe704463c0e0a639a93ff8debc73d687
[ "MIT" ]
null
null
null
transferencia/serializer.py
Danieli-Bauer/djangolivre
d06289cebe704463c0e0a639a93ff8debc73d687
[ "MIT" ]
1
2021-12-01T23:28:54.000Z
2021-12-01T23:28:54.000Z
transferencia/serializer.py
Danieli-Bauer/djangolivre
d06289cebe704463c0e0a639a93ff8debc73d687
[ "MIT" ]
4
2021-11-26T21:56:04.000Z
2021-11-30T23:35:43.000Z
from .models import Transacao from rest_framework import serializers class TransferenciaSerializer(serializers.ModelSerializer): class Meta: model = Transacao fields = ['id', 'remetente', 'destinatario', 'valor_transferido', 'data']
27.3
62
0.684982
24
273
7.708333
0.791667
0
0
0
0
0
0
0
0
0
0
0
0.227106
273
9
63
30.333333
0.876777
0
0
0
0
0
0.161172
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.571429
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
4c16d0e20219be2ab776a41c971451cebbbdc381
3,188
py
Python
venv/Lib/site-packages/google/cloud/bigquery/job/__init__.py
MuhammetALAPAN/Kaggle.com-Sql-BigQuery-Studies
b17568dd9cd074629a8789ca3c2fc351030f76a7
[ "MIT" ]
1
2021-08-10T16:43:07.000Z
2021-08-10T16:43:07.000Z
google/cloud/bigquery/job/__init__.py
grimmer0125/python-bigquery
e2cbcaa75a5da2bcd520d9116ead90b02d7326fd
[ "Apache-2.0" ]
null
null
null
google/cloud/bigquery/job/__init__.py
grimmer0125/python-bigquery
e2cbcaa75a5da2bcd520d9116ead90b02d7326fd
[ "Apache-2.0" ]
null
null
null
# Copyright 2015 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Define API Jobs.""" from google.cloud.bigquery.job.base import _AsyncJob from google.cloud.bigquery.job.base import _error_result_to_exception from google.cloud.bigquery.job.base import _DONE_STATE from google.cloud.bigquery.job.base import _JobConfig from google.cloud.bigquery.job.base import _JobReference from google.cloud.bigquery.job.base import ReservationUsage from google.cloud.bigquery.job.base import ScriptStatistics from google.cloud.bigquery.job.base import ScriptStackFrame from google.cloud.bigquery.job.base import UnknownJob from google.cloud.bigquery.job.copy_ import CopyJob from google.cloud.bigquery.job.copy_ import CopyJobConfig from google.cloud.bigquery.job.copy_ import OperationType from google.cloud.bigquery.job.extract import ExtractJob from google.cloud.bigquery.job.extract import ExtractJobConfig from google.cloud.bigquery.job.load import LoadJob from google.cloud.bigquery.job.load import LoadJobConfig from google.cloud.bigquery.job.query import _contains_order_by from google.cloud.bigquery.job.query import DmlStats from google.cloud.bigquery.job.query import QueryJob from google.cloud.bigquery.job.query import QueryJobConfig from google.cloud.bigquery.job.query import QueryPlanEntry from google.cloud.bigquery.job.query import QueryPlanEntryStep from google.cloud.bigquery.job.query import ScriptOptions from google.cloud.bigquery.job.query import TimelineEntry from google.cloud.bigquery.enums import Compression from google.cloud.bigquery.enums import CreateDisposition from google.cloud.bigquery.enums import DestinationFormat from google.cloud.bigquery.enums import Encoding from google.cloud.bigquery.enums import QueryPriority from google.cloud.bigquery.enums import SchemaUpdateOption from google.cloud.bigquery.enums import SourceFormat from google.cloud.bigquery.enums import WriteDisposition # Include classes previously in job.py for backwards compatibility. __all__ = [ "_AsyncJob", "_error_result_to_exception", "_DONE_STATE", "_JobConfig", "_JobReference", "ReservationUsage", "ScriptStatistics", "ScriptStackFrame", "UnknownJob", "CopyJob", "CopyJobConfig", "OperationType", "ExtractJob", "ExtractJobConfig", "LoadJob", "LoadJobConfig", "_contains_order_by", "DmlStats", "QueryJob", "QueryJobConfig", "QueryPlanEntry", "QueryPlanEntryStep", "ScriptOptions", "TimelineEntry", "Compression", "CreateDisposition", "DestinationFormat", "Encoding", "QueryPriority", "SchemaUpdateOption", "SourceFormat", "WriteDisposition", ]
37.069767
74
0.788896
395
3,188
6.288608
0.301266
0.128824
0.193237
0.296296
0.462963
0.462963
0.353462
0
0
0
0
0.002877
0.127666
3,188
85
75
37.505882
0.890327
0.19793
0
0
0
0
0.167061
0.010244
0
0
0
0
0
1
0
false
0
0.484848
0
0.484848
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
1
0
0
0
0
3
4c233d7d932919cbc31aebe9f83dd23ab8723059
1,053
py
Python
src/imgproc/font.py
GitMasato/imgproc
853b060453b9c51bf614b582d0429bcab82f057a
[ "MIT" ]
null
null
null
src/imgproc/font.py
GitMasato/imgproc
853b060453b9c51bf614b582d0429bcab82f057a
[ "MIT" ]
4
2021-04-20T23:23:12.000Z
2022-03-12T00:49:28.000Z
src/imgproc/font.py
GitMasato/imgproc
853b060453b9c51bf614b582d0429bcab82f057a
[ "MIT" ]
null
null
null
"""font module to manage available fonts """ import pprint from matplotlib import font_manager from typing import Dict, List, Optional class AvailableFontManager: """class of managing available font information""" @staticmethod def display_font_list(): f = sorted(list(set([f.name for f in font_manager.fontManager.ttflist]))) pprint.pprint(f, width=80, compact=True) def __init__(self): """constructor""" self.__font_dict = {f.name: f.fname for f in font_manager.fontManager.ttflist} def get_font_dict(self) -> Dict: return self.__font_dict def get_font_list(self) -> List[str]: return self.__font_dict.keys() def get_font_list_sorted(self) -> List[str]: return sorted(self.__font_dict.keys()) def get_font_file_list(self) -> List[str]: return self.__font_dict.values() def get_font_file_list_sorted(self) -> List[str]: return sorted(self.__font_dict.values()) def get_font_file(self, name: str) -> Optional[str]: return self.__font_dict[name] if name in self.__font_dict else None
28.459459
82
0.726496
156
1,053
4.589744
0.307692
0.100559
0.134078
0.100559
0.445531
0.410615
0.410615
0.273743
0.125698
0.125698
0
0.002252
0.156695
1,053
36
83
29.25
0.804054
0.089269
0
0
0
0
0
0
0
0
0
0
0
1
0.363636
false
0
0.136364
0.272727
0.818182
0.090909
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
4c54c4e3e889fb89668176c355e860f19065173f
505
py
Python
venv/lib/python3.6/site-packages/xero_python/payrollau/models/employee_status.py
6enno/FarmXero
881b1e6648e927631b276e66a4c5287e4de2cbc1
[ "MIT" ]
null
null
null
venv/lib/python3.6/site-packages/xero_python/payrollau/models/employee_status.py
6enno/FarmXero
881b1e6648e927631b276e66a4c5287e4de2cbc1
[ "MIT" ]
null
null
null
venv/lib/python3.6/site-packages/xero_python/payrollau/models/employee_status.py
6enno/FarmXero
881b1e6648e927631b276e66a4c5287e4de2cbc1
[ "MIT" ]
null
null
null
# coding: utf-8 """ Xero Payroll AU This is the Xero Payroll API for orgs in Australia region. # noqa: E501 Contact: api@xero.com Generated by: https://openapi-generator.tech """ import re # noqa: F401 from enum import Enum class EmployeeStatus(Enum): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. allowed enum values """ ACTIVE = "ACTIVE" TERMINATED = "TERMINATED"
17.413793
76
0.665347
67
505
5.014925
0.641791
0.142857
0.125
0.14881
0
0
0
0
0
0
0
0.018277
0.241584
505
28
77
18.035714
0.859008
0.653465
0
0
1
0
0.125
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
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
d5bb1a308b9b838826512a6d660e62757135f6c4
252
py
Python
Python/ex005.py
MarcosRibas/Projeto100Exercicios
15c16eb0d9c4182d93e4bb83e11acad0728f5ec9
[ "MIT" ]
null
null
null
Python/ex005.py
MarcosRibas/Projeto100Exercicios
15c16eb0d9c4182d93e4bb83e11acad0728f5ec9
[ "MIT" ]
null
null
null
Python/ex005.py
MarcosRibas/Projeto100Exercicios
15c16eb0d9c4182d93e4bb83e11acad0728f5ec9
[ "MIT" ]
null
null
null
#Ex005 Faça um programa que leia um número inteiro e mostre na tela o seu sucessor e seu antecessor. n = int(input('Digite um número inteiro: ')) a = n - 1 s = n + 1 print(f'O número que você digitou é {n} tendo seu antecessor {a} e seu sucessor {s}')
42
100
0.702381
49
252
3.612245
0.591837
0.090395
0.169492
0
0
0
0
0
0
0
0
0.024876
0.202381
252
5
101
50.4
0.855721
0.392857
0
0
0
0.25
0.664474
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d5d6344fbc17fa44132b3ac83d879022c6d36e6d
1,329
py
Python
pandas_ml/imbaccessors/base.py
matsavage/pandas-ml
794cddc8dc5d0a49fbc9734d826d9465078f376e
[ "BSD-3-Clause" ]
null
null
null
pandas_ml/imbaccessors/base.py
matsavage/pandas-ml
794cddc8dc5d0a49fbc9734d826d9465078f376e
[ "BSD-3-Clause" ]
null
null
null
pandas_ml/imbaccessors/base.py
matsavage/pandas-ml
794cddc8dc5d0a49fbc9734d826d9465078f376e
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python from pandas.util.decorators import cache_readonly from pandas_ml.core.accessor import _AccessorMethods class ImbalanceMethods(_AccessorMethods): """ Accessor to ``imblearn``. """ _module_name = 'imblearn' @property def under_sampling(self): """Property to access ``imblearn.under_sampling``""" return self._under_sampling @cache_readonly def _under_sampling(self): return _AccessorMethods(self._df, module_name='imblearn.under_sampling') @property def over_sampling(self): """Property to access ``imblearn.over_sampling``""" return self._over_sampling @cache_readonly def _over_sampling(self): return _AccessorMethods(self._df, module_name='imblearn.over_sampling') @property def combine(self): """Property to access ``imblearn.combine``""" return self._combine @cache_readonly def _combine(self): return _AccessorMethods(self._df, module_name='imblearn.combine') @property def ensemble(self): """Property to access ``imblearn.ensemble``""" return self._ensemble @cache_readonly def _ensemble(self): return _AccessorMethods(self._df, module_name='imblearn.ensemble')
26.058824
81
0.65538
137
1,329
6.065693
0.233577
0.078219
0.108303
0.09627
0.409146
0.341757
0.255114
0.255114
0.137184
0
0
0
0.240783
1,329
50
82
26.58
0.823588
0.165538
0
0.285714
0
0
0.084066
0.043988
0
0
0
0
0
1
0.285714
false
0
0.071429
0.142857
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
d5d7085dcb2f3694fcefe63bfeb059ab95cb384f
3,394
py
Python
edh_web_application/project/routes.py
epigraphic-database-heidelberg/website
1768ac1bd7d7d2a7e4cf518b4110344389e35e8c
[ "CC0-1.0" ]
1
2022-03-04T01:55:06.000Z
2022-03-04T01:55:06.000Z
edh_web_application/project/routes.py
epigraphic-database-heidelberg/website
1768ac1bd7d7d2a7e4cf518b4110344389e35e8c
[ "CC0-1.0" ]
106
2019-10-16T08:13:29.000Z
2021-09-06T09:35:51.000Z
edh_web_application/project/routes.py
epigraphic-database-heidelberg/website
1768ac1bd7d7d2a7e4cf518b4110344389e35e8c
[ "CC0-1.0" ]
null
null
null
from flask import render_template from . import bp_project from flask_babel import _ @bp_project.route('/projekt/konzept', strict_slashes=False) def show_project_concept_page(): return render_template('project/project_concept.html', title=_("Project"), subtitle=_("concept")) @bp_project.route('/projekt/inhalt/inschriften', strict_slashes=False) def show_project_content_inscriptions_page(): return render_template('project/project_content_inscriptions.html', title=_("Project"), subtitle=_("content - inscriptions")) @bp_project.route('/projekt/inhalt/fotos/fotographen', strict_slashes=False) def show_project_content_fotographers_page(): return render_template('project/project_content_fotographers.html', title=_("Project"), subtitle=_("content - fotographers")) @bp_project.route('/projekt/inhalt/fotos', strict_slashes=False) def show_project_content_fotos_page(): return render_template('project/project_content_fotos.html', title=_("Project"), subtitle=_("content - fotos")) @bp_project.route('/projekt/inhalt/geographie', strict_slashes=False) def show_project_content_geography_page(): return render_template('project/project_content_geography.html', title=_("Project"), subtitle=_("content - geography")) @bp_project.route('/projekt/inhalt/bibliographie', strict_slashes=False) def show_project_content_bibliography_page(): return render_template('project/project_content_bibliography.html', title=_("Project"), subtitle=_("content - bibliography")) @bp_project.route('/projekt/geschichte', strict_slashes=False) def show_project_history_page(): return render_template('project/project_history.html', title=_("Project"), subtitle=_("history")) @bp_project.route('/projekt/kooperationen', strict_slashes=False) def show_project_cooperations_page(): return render_template('project/project_cooperations.html', title=_("Project"), subtitle=_("cooperations")) @bp_project.route('/projekt/mitarbeiter', strict_slashes=False) def show_project_team_members_page(): return render_template('project/project_team_members.html', title=_("Project"), subtitle=_("research team members")) @bp_project.route('/projekt/externe_mitarbeiter', strict_slashes=False) def show_project_external_page(): return render_template('project/project_external_researchers.html', title=_("Project"), subtitle=_("external contributors")) @bp_project.route('/projekt/veranstaltungen', strict_slashes=False) def show_project_presentations_page(): return render_template('project/project_presentations.html', title=_("Project"), subtitle=_("presentations")) @bp_project.route('/projekt/veranstaltungen/refrigerium', strict_slashes=False) def show_project_presentations_refrigerium_page(): return render_template('project/project_presentations_refrigerium.html', title=_("Project"), subtitle=_("refrigerium")) @bp_project.route('/projekt/kontakt', strict_slashes=False) def show_project_contact_page(): return render_template('project/project_contact.html', title=_("Project"), subtitle=_("contact")) @bp_project.route('/projekt/provinzen', strict_slashes=False) def show_project_provinces_page(): return render_template('project/project_provinces.html', title=_("Project"), subtitle=_("provinces")) @bp_project.route('/links', strict_slashes=False) def links(): return render_template('project/links.html', title=_("Links"))
41.901235
129
0.791691
397
3,394
6.390428
0.133501
0.088293
0.082775
0.124162
0.589673
0.46827
0.275128
0
0
0
0
0
0.069534
3,394
80
130
42.425
0.803357
0
0
0
0
0
0.343649
0.218686
0
0
0
0
0
1
0.3125
true
0
0.0625
0.3125
0.6875
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
1
0
0
0
3
d5dd2ca3988da35c7474b49e0ec3dbdf7606fe39
3,846
py
Python
graph-test.py
WeiwenRen/PyHugeGraph
e09430da5a5b93fbafd1de02f8c4545bd1f0afd7
[ "Apache-2.0" ]
11
2018-09-06T10:36:02.000Z
2021-03-18T16:15:30.000Z
graph-test.py
WeiwenRen/PyHugeGraph
e09430da5a5b93fbafd1de02f8c4545bd1f0afd7
[ "Apache-2.0" ]
null
null
null
graph-test.py
WeiwenRen/PyHugeGraph
e09430da5a5b93fbafd1de02f8c4545bd1f0afd7
[ "Apache-2.0" ]
2
2019-12-09T07:21:04.000Z
2021-06-07T02:30:10.000Z
from neo4j.v1 import GraphDatabase from PyHugeGraph import PyHugeGraphClient if __name__ == '__main__': hg = PyHugeGraphClient.HugeGraphClient("http://loaclhost:8090", "hugegraph") print hg.graph print hg.get_all_graphs().response print hg.get_vertex_by_id("123").response print hg.get_all_vertelabels().response # print hg.GetAllGraphs().response # print hg.GetVersion().response # print hg.GetGraphInfo().response # print hg.CreatePropertyKey('testname', 'TEXT', 'SINGLE').response print hg.get_graph_allpropertykeys().response # print hg.GetGraphPropertykeysByName("testname").response # print hg.DeleteGraphPropertykeysByName("curltest").status_code # user_data = { # "min": 0, # "max": 100 # } # print hg.AddPropertykeyUserdata("age",user_data).response # print hg.DeletePropertykeyUserdata("age", {"min": 0}).response # ------------------------------------------ # data = { # "name": "person", # "id_strategy": "DEFAULT", # "properties": [ # "name", # "age" # ], # "primary_keys": [ # "name" # ], # "nullable_keys": [], # "enable_label_index": True # } # print hg.CreateVertexLabel(data).response # properties = ["reason",] # userdata = { # "super": "animal" # } # print hg.AddVertexLabelProperties("person",properties).response # print hg.AddVertexLabelUserdata("person",userdata).response # print hg.DeleteVertexLabelUserdata("person",userdata).response # print hg.GetVerteLabelByName("person").response # print hg.GetAllVerteLabels().response # ------------------------------------------ # data = { # "name": "created", # "source_label": "person", # "target_label": "person", # "frequency": "SINGLE", # "properties": [ # "time" # ], # "sort_keys": [], # "nullable_keys": [], # "enable_label_index": True # } # # print hg.CreateEdgeLabel(data).response # properties = [ # "type" # ] # nullable_keys = [ # "type" # ] # # print hg.AddEdgeLabelProperties("created", properties, nullable_keys).response # userdata = { # "min": "1970-01-01" # } # # print hg.AddEdgeLabelUserdata("created",userdata).response # # print hg.DeleteEdgeLabelUserdata("created",userdata).response # print hg.GetEdgeLabelByName("created").response # print hg.GetEdgeLabelByName("created").status_code # print hg.DeleteEdgeLabelByName("created").response # print hg.GetEdgeLabelByName("created").response # # print hg.GetAllEdgeLabels().response # print hg.GetVertexByCondition("character").response # print hg.GetVertexById("1:hydra").response # print hg.GetVertexByCondition("").response # print hg.GetVertexByPage(4, "AAuGMTpoeWRyYWcBEQAAAAA=").response # print hg.GetEdgeByCondition().response # print hg.GetEdgeByPage(3).response # print hg.GetEdgeByID("S1:pluto>4>>S2:tartarus").response # print hg.TraverserShortestPath("1:hercules", "1:pluto", "OUT", 2).response # print hg.TraverserKout("1:hercules", "OUT", 1).response # print hg.TraverserKneighbor("1:hercules", "OUT", 2).response # ids = ["1:jupiter", "1:cerberus", "2:tartarus", "1:alcmene", "1:hydra", "2:sky", "1:saturn", "1:pluto", # "1:hercules", "1:neptune", "1:nemean"] # print hg.TraverserVertices(ids).response # print hg.CreateVariables("title","test").response # print hg.UpdateVariables("title","testnew").response # print hg.GetAllVariables().response # print hg.GetVariablesByKey("title").response # print hg.DeleteVariables("title").response # print hg.GetAllVariables().response
38.46
109
0.615705
357
3,846
6.537815
0.35014
0.134961
0.224936
0.039417
0.170951
0.094259
0.080548
0.080548
0
0
0
0.015167
0.211388
3,846
99
110
38.848485
0.754369
0.763651
0
0
0
0
0.050184
0
0
0
0
0
0
0
null
null
0
0.222222
null
null
0.555556
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
3
d5def58ed8ae5297ff0b38f2f52c502ac0384151
268
py
Python
students/utilities/status_codes.py
soumith2105/vasv-stdin-backend
72472af0f4a9ea5d9d51f980d148badbb9252fe6
[ "MIT" ]
null
null
null
students/utilities/status_codes.py
soumith2105/vasv-stdin-backend
72472af0f4a9ea5d9d51f980d148badbb9252fe6
[ "MIT" ]
1
2022-02-21T15:09:06.000Z
2022-02-21T15:09:06.000Z
students/utilities/status_codes.py
soumith2105/vasv-stdin-backend
72472af0f4a9ea5d9d51f980d148badbb9252fe6
[ "MIT" ]
null
null
null
USER_ALREADY_EXISTS = "USER_ALREADY_EXISTS" USER_SIGNUP_SUCCESSFUL = "USER_SIGNUP_SUCCESSFUL" CREDENTIALS_INCORRECT = "CREDENTIALS_INCORRECT" USER_UNREGISTERED = "USER_UNREGISTERED" ROLL_NUMBER_REQUIRED = "ROLL_NUMBER_REQUIRED" PASSWORD_REQUIRED = "PASSWORD_REQUIRED"
38.285714
49
0.865672
30
268
7.133333
0.4
0.102804
0.158879
0.196262
0
0
0
0
0
0
0
0
0.067164
268
6
50
44.666667
0.856
0
0
0
0
0
0.432836
0.160448
0
0
0
0
0
1
0
false
0.166667
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
d5e7c5a2afd1b18ea60577fa337bc77185345574
501
py
Python
compilacion/analisis_semantico/Ast/instructions/printNode.py
Gusta2307/Football-Simulation-IA-SIM-COM-
8c29c5b1ef61708a4f8b34f5e0e00990aeecfacd
[ "MIT" ]
null
null
null
compilacion/analisis_semantico/Ast/instructions/printNode.py
Gusta2307/Football-Simulation-IA-SIM-COM-
8c29c5b1ef61708a4f8b34f5e0e00990aeecfacd
[ "MIT" ]
null
null
null
compilacion/analisis_semantico/Ast/instructions/printNode.py
Gusta2307/Football-Simulation-IA-SIM-COM-
8c29c5b1ef61708a4f8b34f5e0e00990aeecfacd
[ "MIT" ]
1
2022-02-07T04:47:15.000Z
2022-02-07T04:47:15.000Z
from compilacion.analisis_semantico.Ast.instruction import Instruction from compilacion.analisis_semantico.scope import Scope class PrintNode(Instruction): def __init__(self, expr) -> None: self.expr = expr def checkSemantic(self, scope: Scope) -> bool: return self.expr.checkSemantic(scope) def execute(self, scope: Scope): value = self.expr.evaluate(scope) return print(value) def visit(self, scope): return self.expr.visit(scope)
29.470588
70
0.690619
59
501
5.762712
0.389831
0.117647
0.135294
0.188235
0
0
0
0
0
0
0
0
0.215569
501
17
71
29.470588
0.86514
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0.166667
0.833333
0.083333
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
3
d5f9f7224e3279df2889778ce8cb84e5df90467b
736
py
Python
profiles/models.py
Amarpsp10/Adiscussion-forum
c2e0cdccdcbd4f7b9c16a2e4fa28e1c4abd0e6d0
[ "MIT" ]
null
null
null
profiles/models.py
Amarpsp10/Adiscussion-forum
c2e0cdccdcbd4f7b9c16a2e4fa28e1c4abd0e6d0
[ "MIT" ]
null
null
null
profiles/models.py
Amarpsp10/Adiscussion-forum
c2e0cdccdcbd4f7b9c16a2e4fa28e1c4abd0e6d0
[ "MIT" ]
null
null
null
from django.db import models from django.utils.translation import gettext_lazy as _ # Create your models here. def upload_to(instance, filename): return 'profile_images/{filename}'.format(filename=filename) class Profile(models.Model): username = models.CharField(max_length=50, unique=True) profile_img = models.ImageField(_("Image"), upload_to=upload_to, height_field=None, width_field=None, max_length=None, default='profile_images/default.jpg') name = models.CharField(max_length=50) company = models.CharField(max_length=50) about = models.CharField(max_length=100) location = models.CharField(max_length=50) def __str__(self): return self.username
33.454545
108
0.71875
94
736
5.404255
0.5
0.106299
0.177165
0.23622
0.204724
0
0
0
0
0
0
0.018212
0.179348
736
21
109
35.047619
0.822848
0.032609
0
0
0
0
0.078873
0.071831
0
0
0
0
0
1
0.142857
false
0
0.142857
0.142857
0.928571
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
1
1
0
0
3
9103fb16367f9a87912059e70c5129cb595d946b
617
py
Python
arus/tests/conftest.py
qutang/arus
ee422bbadc72635037944359d00475f698e8fc61
[ "MIT" ]
null
null
null
arus/tests/conftest.py
qutang/arus
ee422bbadc72635037944359d00475f698e8fc61
[ "MIT" ]
264
2019-09-25T14:15:39.000Z
2022-03-11T10:11:38.000Z
arus/tests/conftest.py
qutang/arus
ee422bbadc72635037944359d00475f698e8fc61
[ "MIT" ]
null
null
null
import pandas as pd import pytest from .. import dataset as ds @pytest.fixture(scope="module") def spades_lab_data(): return ds.load_dataset('spades_lab') @pytest.fixture(scope="module") def spades_lab_ds(): return ds.MHDataset(path=ds.get_dataset_path('spades_lab'), name='spades_lab', input_type=ds.InputType.MHEALTH_FORMAT) @pytest.fixture(scope="module") def single_mhealth_sensor(spades_lab_ds): sensor = spades_lab_ds.get_sensors(pid='SPADES_1', placement='DW')[0] sensor_file = sensor.paths[0] data = pd.read_csv(sensor_file, parse_dates=[0]) return data
25.708333
82
0.71799
91
617
4.604396
0.43956
0.150358
0.128878
0.171838
0.236277
0.171838
0.171838
0
0
0
0
0.007663
0.153971
617
23
83
26.826087
0.795019
0
0
0.1875
0
0
0.094003
0
0
0
0
0
0
1
0.1875
false
0
0.1875
0.125
0.5625
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
1
1
0
0
3
91383464cccf261407d909c702cbbc91bad41d76
1,412
py
Python
youtube/channelsearchparser.py
Glenpl/open_yt_api
aa439bafd25248509ff4301e48c15005abef17a4
[ "MIT" ]
4
2016-03-26T11:32:10.000Z
2017-05-05T20:13:06.000Z
youtube/channelsearchparser.py
Glenpl/open_yt_api
aa439bafd25248509ff4301e48c15005abef17a4
[ "MIT" ]
11
2016-03-25T10:57:29.000Z
2017-03-28T15:18:06.000Z
youtube/channelsearchparser.py
Glenpl/open_yt_api
aa439bafd25248509ff4301e48c15005abef17a4
[ "MIT" ]
2
2016-04-09T09:40:17.000Z
2016-04-14T09:18:18.000Z
from youtube.baseparser import BaseSearchParser from youtube.signatures import ChannelSignature class ChannelSearchParser(BaseSearchParser): _tile_class_name = 'yt-lockup-channel' def _parse_single_result(self, search_result): self._initialize_parser(repr(search_result)) return ChannelSignature(self._extract_id(), self._extract_name(), int(self._extract_videos_amount()), int(self._extract_subscriptions()), self._extract_thumbnail_url()) def _extract_id(self): return self._find_by_class('a', 'yt-uix-tile-link')['data-ytid'] def _extract_name(self): return str(self._find_by_class('a', 'yt-uix-tile-link').string) def _extract_videos_amount(self): try: return self._html_parser.select('.yt-lockup-meta-info li')[1].string.split(' ')[0] except IndexError: return '0' # no information means user has no uploaded videos def _extract_thumbnail_url(self): return self._find_by_class('span', 'yt-thumb-simple').img['src'] def _extract_subscriptions(self): count = self._find_by_class('span', 'yt-subscriber-count') rmnbs = self._remove_non_breaking_spaces return '0' if count is None else rmnbs(count['title']).replace(' ', '').replace(',', '')
40.342857
96
0.635977
164
1,412
5.158537
0.463415
0.065012
0.047281
0.070922
0.141844
0.141844
0.068558
0.068558
0.068558
0
0
0.003756
0.245751
1,412
34
97
41.529412
0.79061
0.033994
0
0
0
0
0.101322
0
0
0
0
0
0
1
0.230769
false
0
0.076923
0.115385
0.653846
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
914dd69562939486f93a4fbc29cb6c6d995271cf
219
py
Python
RestFramework 5/api/urls.py
LindaOuer/Django_Project
8c8be97accfb48346ab4837b283b1f5082744445
[ "MIT" ]
2
2020-04-10T09:57:45.000Z
2021-02-05T20:34:30.000Z
RestFramework 5/api/urls.py
LindaOuer/Django_Project
8c8be97accfb48346ab4837b283b1f5082744445
[ "MIT" ]
5
2021-03-30T13:04:32.000Z
2021-09-22T18:51:43.000Z
RestFramework 5/api/urls.py
LindaOuer/Django_Project
8c8be97accfb48346ab4837b283b1f5082744445
[ "MIT" ]
1
2020-05-08T01:35:20.000Z
2020-05-08T01:35:20.000Z
from django.urls import path from rest_framework.routers import SimpleRouter from . import views router = SimpleRouter() router.register('projects', views.ProjectViewSet, basename='projects') urlpatterns = router.urls
27.375
70
0.812785
26
219
6.807692
0.615385
0
0
0
0
0
0
0
0
0
0
0
0.100457
219
7
71
31.285714
0.898477
0
0
0
0
0
0.073059
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
914f0c07930cf78e8b4769a6f3b552863a4470b7
1,098
py
Python
0801-0900/0859-Max Stack/0859-Max Stack.py
jiadaizhao/LintCode
a8aecc65c47a944e9debad1971a7bc6b8776e48b
[ "MIT" ]
77
2017-12-30T13:33:37.000Z
2022-01-16T23:47:08.000Z
0801-0900/0859-Max Stack/0859-Max Stack.py
jxhangithub/LintCode-1
a8aecc65c47a944e9debad1971a7bc6b8776e48b
[ "MIT" ]
1
2018-05-14T14:15:40.000Z
2018-05-14T14:15:40.000Z
0801-0900/0859-Max Stack/0859-Max Stack.py
jxhangithub/LintCode-1
a8aecc65c47a944e9debad1971a7bc6b8776e48b
[ "MIT" ]
39
2017-12-07T14:36:25.000Z
2022-03-10T23:05:37.000Z
class MaxStack: def __init__(self): # do intialization if necessary self.St = [] self.maxSt = [] """ @param: number: An integer @return: nothing """ def push(self, x): # write your code here self.St.append(x) if not self.maxSt or x >= self.maxSt[-1]: self.maxSt.append(x) """ @return: An integer """ def pop(self): # write your code here val = self.St.pop() if val == self.maxSt[-1]: self.maxSt.pop() return val """ @return: An integer """ def top(self): # write your code here return self.St[-1] """ @return: An integer """ def peekMax(self): # write your code here return self.maxSt[-1] """ @return: An integer """ def popMax(self): # write your code here val = self.maxSt.pop() temp = [] while self.St[-1] != val: temp.append(self.St.pop()) self.St.pop() self.St.extend(temp) return val
19.607143
49
0.479053
130
1,098
4.015385
0.269231
0.091954
0.124521
0.162835
0.417625
0.226054
0.226054
0
0
0
0
0.007429
0.387067
1,098
55
50
19.963636
0.768202
0.12204
0
0.08
0
0
0
0
0
0
0
0.090909
0
1
0.24
false
0
0
0.08
0.44
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
1
0
0
1
0
0
0
0
0
0
0
3
e69779eeb7cb86cd22ac537523ac360507708ab9
545
py
Python
test_simple_one.py
mbv401920150/pytest
6526d7e98d752036e626978ab95581e0205be8bc
[ "MIT" ]
null
null
null
test_simple_one.py
mbv401920150/pytest
6526d7e98d752036e626978ab95581e0205be8bc
[ "MIT" ]
null
null
null
test_simple_one.py
mbv401920150/pytest
6526d7e98d752036e626978ab95581e0205be8bc
[ "MIT" ]
null
null
null
import pytest def test_print_testOne(testOne, fixture_testTwo, global_data): print('----\nSIMPLE TEST ONE!\n----') print(testOne) print(testOne) print(fixture_testTwo) print('{} + {} = {}'.format(global_data.VarOne, global_data.VarTwo, global_data.Sum())) print('{} + {} = {}'.format(10, 5, global_data.Div(10, 5))) print('Global Variable: {}'.format(global_data.GlobalVal)) assert global_data.GlobalVal == 10 global_data.GlobalVal = 55 assert global_data.GlobalVal == 55 # Assert assert global_data.Div(10, 5) == 2.0
34.0625
89
0.686239
73
545
4.931507
0.356164
0.277778
0.211111
0.083333
0.238889
0
0
0
0
0
0
0.03617
0.137615
545
16
90
34.0625
0.729787
0.011009
0
0.153846
0
0
0.13197
0
0
0
0
0
0.230769
1
0.076923
false
0
0.076923
0
0.153846
0.615385
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
1
0
3
e6bbd4ac88b4402f90b655a31f90849a2a21a973
854
py
Python
setup.py
Ankit-RealityEngines/api-python
3627048d31df5972c5777de2a1c1211ea06a8804
[ "MIT" ]
null
null
null
setup.py
Ankit-RealityEngines/api-python
3627048d31df5972c5777de2a1c1211ea06a8804
[ "MIT" ]
null
null
null
setup.py
Ankit-RealityEngines/api-python
3627048d31df5972c5777de2a1c1211ea06a8804
[ "MIT" ]
null
null
null
from setuptools import setup setup(name='abacusai', version='0.32.5', description='Abacus.AI Python Client Library', url='https://github.com/abacusai/api-python', author='Abacus.AI', author_email='dev@abacus.ai', license='MIT', packages=['abacusai'], install_requires=['packaging', 'requests', 'pandas', 'fastavro'], zip_safe=True, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Topic :: Utilities', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', ])
37.130435
71
0.578454
85
854
5.776471
0.635294
0.193483
0.254582
0.264766
0
0
0
0
0
0
0
0.022364
0.266979
854
22
72
38.818182
0.761981
0
0
0
0
0
0.538642
0
0
0
0
0
0
1
0
true
0
0.045455
0
0.045455
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
e6de6e220dcfdf2ef5ec491d42d9dd3a38b48da5
663
py
Python
src/yellowdog_client/model/split_provision_strategy.py
yellowdog/yellowdog-sdk-python-public
da69a7d6e45c92933e34fefcaef8b5d98dcd6036
[ "Apache-2.0" ]
null
null
null
src/yellowdog_client/model/split_provision_strategy.py
yellowdog/yellowdog-sdk-python-public
da69a7d6e45c92933e34fefcaef8b5d98dcd6036
[ "Apache-2.0" ]
null
null
null
src/yellowdog_client/model/split_provision_strategy.py
yellowdog/yellowdog-sdk-python-public
da69a7d6e45c92933e34fefcaef8b5d98dcd6036
[ "Apache-2.0" ]
null
null
null
from dataclasses import dataclass, field from typing import List, Optional, Set from .compute_provision_strategy import ComputeProvisionStrategy from .compute_source import ComputeSource @dataclass class SplitProvisionStrategy(ComputeProvisionStrategy): """Instructs YellowDog Compute to split the provision of computer machine instances as evenly as possible across the compute sources.""" type: str = field(default="co.yellowdog.platform.model.SplitProvisionStrategy", init=False) credentials: Optional[Set[str]] = field(default=None, init=False) sources: List[ComputeSource] """The compute sources to use for the compute requirement."""
44.2
140
0.79638
77
663
6.818182
0.571429
0.057143
0.064762
0
0
0
0
0
0
0
0
0
0.128205
663
14
141
47.357143
0.908305
0.196078
0
0
0
0
0.107296
0.107296
0
0
0
0
0
1
0
true
0
0.444444
0
0.888889
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
1
0
0
3
e6e2d30001d783dd3b717ffc069cb58fa5cc6983
126
py
Python
lab1/problem3.py
sarahmid/programming-bootcamp
6dc6ab0ecfac662eb9676956ab0ae799953e88ae
[ "MIT" ]
1
2020-11-06T03:29:24.000Z
2020-11-06T03:29:24.000Z
lab1/problem3.py
sarahmid/programming-bootcamp
6dc6ab0ecfac662eb9676956ab0ae799953e88ae
[ "MIT" ]
null
null
null
lab1/problem3.py
sarahmid/programming-bootcamp
6dc6ab0ecfac662eb9676956ab0ae799953e88ae
[ "MIT" ]
null
null
null
age = "25" name = "Wilfred" introduction = "Hello, my name is " + name + " and I am " + age + " years old." print introduction
31.5
79
0.626984
18
126
4.388889
0.777778
0
0
0
0
0
0
0
0
0
0
0.020408
0.222222
126
4
80
31.5
0.785714
0
0
0
0
0
0.377953
0
0
0
0
0
0
0
null
null
0
0
null
null
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
e6f5f650eb6c576a50e56b5ab83403d3a49b9092
19,028
py
Python
tests/test_iterfun.py
StefanGreve/iterfun
13377fc040d5a26f61f6891742d7ea31e9cb590b
[ "MIT" ]
null
null
null
tests/test_iterfun.py
StefanGreve/iterfun
13377fc040d5a26f61f6891742d7ea31e9cb590b
[ "MIT" ]
null
null
null
tests/test_iterfun.py
StefanGreve/iterfun
13377fc040d5a26f61f6891742d7ea31e9cb590b
[ "MIT" ]
null
null
null
import operator import unittest import pytest from src.iterfun import Iter class TestIter(unittest.TestCase): def test_iter_domain(self): iter = Iter([1, 4]) self.assertEqual(iter.domain, iter.image) self.assertNotEqual(iter.domain, iter.filter(lambda x: x % 2 == 0).image) def test_iter_image(self): self.assertEqual([1, 2, 3], Iter([1, 2, 3]).image) self.assertEqual([1, 2, 3, 4, 5], Iter([1, 5]).image) self.assertEqual([1, 5], Iter([1, 5], interval=False).image) self.assertEqual([2, 3, 4, 5, 6, 7, 8, 9], Iter((1, 10)).domain) def test_all(self): self.assertTrue(Iter([1, 2, 3]).all()) self.assertFalse(Iter([1, None, 3]).all()) self.assertTrue(Iter([]).all()) self.assertTrue(Iter([2, 4, 6]).all(lambda x: x % 2 == 0)) self.assertFalse(Iter([1, 2, 3]).all(lambda x: x % 2 == 0)) self.assertTrue(Iter([]).all(lambda: None)) def test_any(self): self.assertFalse(Iter([False, False, False]).any()) self.assertTrue(Iter([False, True, False]).any()) self.assertFalse(Iter([]).any()) self.assertFalse(Iter([2, 4, 6]).any(lambda x: x % 2 == 1)) self.assertTrue(Iter([1, 2, 3]).any(lambda x: x % 2 == 1)) self.assertFalse(Iter([]).any(lambda: None)) def test_at(self): self.assertEqual(2, Iter([2, 4, 6]).at(0)) self.assertEqual(6, Iter([2, 4, 6]).at(2)) self.assertEqual(6, Iter([2, 4, 6]).at(-1)) def test_at_throws(self): with pytest.raises(IndexError): self.assertEqual(None, Iter([2, 4, 6]).at(4)) def test_avg(self): self.assertEqual(5, Iter([0, 10]).avg()) def test_chunk_by(self): expected = [[1], [2, 2], [3], [4, 4, 6], [7, 7]] actual = Iter([1, 2, 2, 3, 4, 4, 6, 7, 7]).chunk_by(lambda x: x % 2 == 1).image self.assertEqual(expected, actual) def test_chunk_every(self): self.assertEqual([[1, 2], [3, 4], [5, 6]], Iter([1, 6]).chunk_every(2).image) self.assertEqual([[1, 2, 3], [3, 4, 5], [5, 6]], Iter([1, 6]).chunk_every(3, 2).image) self.assertEqual([[1, 2, 3], [3, 4, 5], [5, 6, 7]], Iter([1, 6]).chunk_every(3, 2, [7]).image) self.assertEqual([[1, 2, 3], [4]], Iter([1, 4]).chunk_every(3, 3, []).image) self.assertEqual([[1, 2, 3, 4]], Iter([1, 4]).chunk_every(10).image) self.assertEqual([[1, 2], [4, 5]], Iter([1, 5]).chunk_every(2, 3, []).image) @pytest.mark.xfail(raises=NotImplementedError, reason="TODO") def test_chunk_while(self): self.assertEqual([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]], Iter([1, 10]).chunk_while([], None, None)) def test_concat(self): self.assertEqual([1, 2, 3, 4, 5, 6], Iter([[1, 2, 3], [4, 5, 6]]).concat().image) self.assertEqual([1, [2], 3, 4, 5, 6], Iter([[1, [2], 3], [4], [5, 6]]).concat().image) self.assertEqual([1, 2, 3, 4, 5, 6, 7, 8, 9], Iter([[1, 4], [5, 6], [7, 9]]).concat().image) self.assertEqual([1, 2, 3, 8], Iter([(0, 4), (5, 6), (7, 9)]).concat().image) self.assertEqual([1, 2, 3, 4, 5, 6, 7, 8, 9], Iter([(0, 4), (3, 7), (6, 10)]).concat().image) def test_count(self): self.assertEqual(3, Iter([1, 3]).count()) self.assertEqual(2, Iter([1, 5]).count(lambda x: x % 2 == 0)) def test_count_until(self): self.assertEqual(5, Iter([1, 20]).count_until(5)) self.assertEqual(20, Iter([1, 20]).count_until(50)) self.assertTrue(Iter([1, 10]).count_until(10) == 10) self.assertTrue(Iter([1, 12]).count_until(10 + 1) > 10) self.assertTrue(Iter([1, 5]).count_until(10) < 10) self.assertTrue(Iter([1, 10]).count_until(10 + 1) == 10) self.assertEqual(7, Iter([1, 20]).count_until(7, lambda x: x % 2 == 0)) self.assertTrue(10, Iter([1, 20]).count_until(11, lambda x: x % 2 == 0)) def test_dedup(self): self.assertEqual([1, 2, 3, 2, 1], Iter([1, 2, 3, 3, 2, 1]).dedup().image) def test_dedup_by(self): self.assertEqual([5, 1, 3, 2], Iter([5, 1, 2, 3, 2, 1]).dedup_by(lambda x: x > 2).image) self.assertEqual([0, 3, 2], Iter([0, 1, 2, 3, 2, 1]).dedup_by(lambda x: x > 2).image) self.assertEqual([0, 4, 1, 2, 0, 3], Iter([0, 4, 9, 1, 2, 0, 3, 4, 9]).dedup_by(lambda x: x < 2).image) self.assertEqual([3, 2, 4, 1], Iter([3, 6, 7, 7, 2, 0, 1, 4, 1]).dedup_by(lambda x: x > 2).image) self.assertEqual([3, 2, 0], Iter([3, 6, 7, 7, 2, 0, 1, 4, 1]).dedup_by(lambda x: x == 2).image) def test_drop(self): self.assertEqual([3], Iter([1, 3]).drop(2).image) self.assertEqual([], Iter([1, 3]).drop(10).image) self.assertEqual([1, 2, 3], Iter([1, 3]).drop(0).image) self.assertEqual([1, 2], Iter([1, 3]).drop(-1).image) def test_drop_every(self): self.assertEqual([2, 4, 6, 8, 10], Iter([1, 10]).drop_every(2).image) self.assertEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], Iter([1, 10]).drop_every(0).image) self.assertEqual([], Iter([1, 3]).drop_every(1).image) def test_drop_while(self): self.assertEqual([3, 2, 1], Iter([1, 2, 3, 2, 1]).drop_while(lambda x: x < 3).image) def test_empty(self): self.assertTrue(Iter([]).empty()) self.assertTrue(Iter([0, 0]).empty()) self.assertFalse(Iter([1, 10]).empty()) def test_filter(self): self.assertEqual([2], Iter([1, 3]).filter(lambda x: x % 2 == 0).image) def test_find(self): self.assertEqual(3, Iter([2, 4]).find(lambda x: x % 2 == 1)) self.assertEqual(None, Iter([2, 4, 6]).find(lambda x: x % 2 == 1)) self.assertEqual(0, Iter([2, 4, 6]).find(lambda x: x % 2 == 1, default=0)) def test_find_index(self): self.assertEqual(None, Iter([2, 4, 6]).find_index(lambda x: x % 2 == 1)) self.assertEqual(1, Iter([2, 3, 4]).find_index(lambda x: x % 2 == 1)) def test_find_value(self): self.assertEqual(None, Iter([2, 4, 6]).find_value(lambda x: x % 2 == 1)) self.assertTrue(Iter([2, 3, 4]).find_value(lambda x: x % 2 == 1)) self.assertTrue(Iter([2, 3, 4]).find_value(lambda x: x % 2 == 1)) self.assertEqual("no bools!", Iter([1, 3]).find_value(lambda x: isinstance(x, bool), default="no bools!")) def test_flat_map(self): self.assertEqual([1, 2, 3, 4, 5, 6], Iter([(1, 3), (4, 6)], interval=False).flat_map(lambda x: Iter.range(list(x))).image) self.assertEqual([[1], [2], [3]], Iter([1, 2, 3]).flat_map(lambda x: [[x]]).image) @pytest.mark.xfail(raises=NotImplementedError, reason="TODO") def test_flat_map_reduce(self): pass def test_frequencies(self): self.assertEqual({1: 1, 2: 2, 3: 1, 4: 1, 5: 2, 6: 1}, Iter([1, 2, 2, 3, 4, 5, 5, 6]).frequencies().image) def test_frequencies_by(self): self.assertEqual({"aa": 2, "bb": 1, "cc": 1}, Iter(["aa", "aA", "bb", "cc"]).frequencies_by(str.lower).image) self.assertEqual({3: 2, 2: 2, 1: 1}, Iter(["aaa", "aA", "bbb", "cc", "c"]).frequencies_by(len).image) def test_group_by(self): self.assertEqual({3: ["ant", "cat"], 5: ["dingo"], 7: ["buffalo"]}, Iter(["ant", "buffalo", "cat", "dingo"]).group_by(len).image) self.assertEqual({3: ["a", "c"], 5: ["d"], 7: ["b"]}, Iter(["ant", "buffalo", "cat", "dingo"]).group_by(len, operator.itemgetter(0)).image) def test_intersperse(self): self.assertEqual([1, 0, 2, 0, 3], Iter([1, 3]).intersperse(0).image) self.assertEqual([1], Iter([1]).intersperse(0).image) self.assertEqual([], Iter([]).intersperse(0).image) def test_into(self): self.assertEqual([1, 2], Iter([1, 2]).into([]).image) self.assertEqual({'a': 1, 'b': 2}, Iter({'a': 1, 'b': 2}).into({}).image) self.assertEqual({'a': 1, 'b': 2}, Iter({'a': 1}).into({'b': 2}).image) def test_join(self): self.assertEqual('12345', Iter([1, 5]).join()) self.assertEqual('1,2,3,4,5', Iter([1, 5]).join(',')) def test_map(self): self.assertEqual([2, 4, 6], Iter([1, 3]).map(lambda x: 2 * x).image) self.assertEqual({'a': -1, 'b': -2}, Iter({'a': 1, 'b': 2}).map(lambda k, v: {k: -v}).image) self.assertEqual({'a': 2, 'b': 4}, Iter({'a': 1, 'b': 2}).map(lambda k, v: {k: 2 * v}).image) def test_map_every(self): self.assertEqual([1001, 2, 1003, 4, 1005, 6, 1007, 8, 1009, 10], Iter([1, 10]).map_every(2, lambda x: x+1000).image) self.assertEqual([1001, 2, 3, 1004, 5, 6, 1007, 8, 9, 1010], Iter([1, 10]).map_every(3, lambda x: x + 1000).image) self.assertEqual([1, 2, 3, 4, 5], Iter([1, 5]).map_every(0, lambda x: x + 1000).image) self.assertEqual([1001, 1002, 1003], Iter([1, 3]).map_every(1, lambda x: x + 1000).image) def test_map_intersperse(self): self.assertEqual([2, None, 4, None, 6], Iter([1, 3]).map_intersperse(None, lambda x: 2 * x).image) def test_map_join(self): self.assertEqual('246', Iter([1, 3]).map_join(lambda x: 2 * x)) self.assertEqual('2 = 4 = 6', Iter([1, 3]).map_join(lambda x: 2 * x, " = ")) def test_map_reduce(self): self.assertEqual(([2, 4, 6], 6), Iter([1, 3]).map_reduce(0, lambda x: 2 * x, operator.add).image) self.assertEqual(([1, 4, 9], 0), Iter([1, 3]).map_reduce(6, lambda x: x * x, operator.sub).image) def test_max(self): self.assertEqual(3, Iter([1, 3]).max()) self.assertEqual('you', Iter("you shall not pass".split()).max()) self.assertEqual('shall', Iter("you shall not pass".split()).max(len)) self.assertEqual('n/a', Iter([]).max(empty_fallback='n/a')) def test_member(self): self.assertTrue(Iter([1, 10]).member(5)) self.assertTrue(Iter([1, 10]).member(5.0)) self.assertTrue(Iter([1.0, 2.0, 3.0]).member(2)) self.assertTrue(Iter([1.0, 2.0, 3.0]).member(2.000)) self.assertFalse(Iter(['a', 'b', 'c']).member('d')) def test_max(self): self.assertEqual(1, Iter([1, 3]).min()) self.assertEqual('not', Iter("you shall not pass".split()).min()) self.assertEqual('you', Iter("you shall not pass".split()).min(len)) self.assertEqual('n/a', Iter([]).min(empty_fallback='n/a')) def test_min_max(self): self.assertEqual((1, 3), Iter([1, 3]).min_max()) self.assertEqual((None, None), Iter([]).min_max(empty_fallback=None)) self.assertEqual(('a', 'aaa'), Iter(["aaa", "a", "bb", "c", "ccc"]).min_max(len)) def test_product(self): self.assertEqual(24, Iter([2, 3, 4]).product()) self.assertEqual(24.0, Iter([2.0, 3.0, 4.0]).product()) def test_random(self): numbers = Iter.range([1, 100]) self.assertIn(Iter(numbers).random(), numbers) def test_range(self): self.assertEqual([1, 2, 3, 4, 5], Iter.range([1, 5])) self.assertEqual([2, 3, 4], Iter.range((1, 5))) def test_reduce(self): self.assertEqual(10, Iter([1, 4]).reduce(operator.add)) self.assertEqual(24, Iter([1, 4]).reduce(lambda x, acc: x * acc, acc=1)) def test_reduce_while(self): self.assertEqual(10, Iter([1, 100]).reduce_while(lambda x, acc: (True, x + acc) if x < 5 else (False, acc))) self.assertEqual(5050, Iter([1, 100]).reduce_while(lambda x, acc: (True, acc + x) if x > 0 else (False, acc))) self.assertEqual(0, Iter([1, 100]).reduce_while(lambda x, acc: (True, acc - x) if x % 2 == 0 else (False, acc), acc=2550)) def test_reject(self): self.assertEqual([1, 3], Iter([1, 3]).reject(lambda x: x % 2 == 0).image) def test_reverse(self): self.assertEqual([5, 4, 3, 2, 1], Iter([1, 5]).reverse().image) self.assertEqual([3, 2, 1, 4, 5, 6], Iter([1, 3]).reverse([4, 5, 6]).image) def test_reverse_slice(self): self.assertEqual([1, 2, 6, 5, 4, 3], Iter([1, 6]).reverse_slice(2, 4).image) self.assertEqual([1, 2, 6, 5, 4, 3, 7, 8, 9, 10], Iter([1, 10]).reverse_slice(2, 4).image) self.assertEqual([1, 2, 10, 9, 8, 7, 6, 5, 4, 3], Iter([1, 10]).reverse_slice(2, 30).image) def test_scan(self): self.assertEqual([1, 3, 6, 10, 15], Iter([1, 5]).scan(operator.add).image) self.assertEqual([1, 3, 6, 10, 15], Iter([1, 5]).scan(lambda x, y: x + y, acc=0).image) self.assertEqual([2, 4, 7, 11, 16], Iter([1, 5]).scan(operator.add, acc=1).image) def test_shorten(self): self.assertEqual("[1, 2, 3, 4, 5]", Iter.shorten(range(1, 6))) self.assertEqual("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ...]", Iter.shorten(range(1, 101), width=50)) def test_shuffle(self): iter = Iter([1, 10]).shuffle() self.assertTrue(iter.all(lambda x: x in Iter.range([1, 10]))) def test_slice(self): self.assertEqual([6, 7, 8, 9, 10, 11], Iter([1, 100]).slice([5, 10]).image) self.assertEqual([6, 7, 8, 9, 10], Iter([1, 10]).slice([5, 20]).image) self.assertEqual([26, 27, 28, 29, 30], Iter([1, 30]).slice([-5, -1]).image) self.assertEqual([7, 8, 9], Iter([1, 10]).slice([-4, -2]).image) self.assertEqual([7, 8, 9, 10], Iter([1, 10]).slice([-4, 100]).image) self.assertEqual([6, 7, 8, 9, 10], Iter([1, 10]).slice(5, 100).image) self.assertEqual([], Iter([1, 10]).slice(10, 5).image) self.assertEqual([], Iter([1, 10]).slice(-11, 5).image) def test_slide(self): self.assertEqual(['a', 'f', 'b', 'c', 'd', 'e', 'g'], Iter(list("abcdefg")).slide(5, 1).image, msg="Sliding a single element") self.assertEqual(['a', 'd', 'e', 'f', 'b', 'c', 'g'], Iter(list("abcdefg")).slide([3, 5], 1).image, msg="Slide a range of elements backward") self.assertEqual(['a', 'e', 'f', 'b', 'c', 'd', 'g'], Iter(list("abcdefg")).slide([1, 3], 5).image, msg="Slide a range of elements forward") self.assertEqual(['a', 'd', 'e', 'f', 'b', 'c', 'g'], Iter(list("abcdefg")).slide([-4, -2], 1).image, msg="Slide with negative indices (counting from the end)") self.assertEqual(['a', 'b', 'c', 'e', 'f', 'g', 'd'], Iter(list("abcdefg")).slide(3, -1).image, msg="Slide with negative indices (counting from the end)") self.assertEqual(['a', 'b', 'c', 'e', 'f', 'd', 'g'], Iter(list("abcdefg")).slide(3, -2).image, msg="Slide with negative indices (counting from the end)") def test_sorted(self): self.assertEqual([1, 2, 3], Iter([3, 1, 2]).sort().image) self.assertEqual([3, 2, 1], Iter([3, 1, 2]).sort(descending=True).image) def test_split(self): self.assertEqual([[1, 2], [3]], Iter([1, 3]).split(2).image) self.assertEqual([[1, 2, 3], []], Iter([1, 3]).split(10).image) self.assertEqual([[], [1, 2, 3]], Iter([1, 3]).split(0).image) self.assertEqual([[1, 2], [3]], Iter([1, 3]).split(-1).image) self.assertEqual([[1], [2, 3]], Iter([1, 3]).split(-2).image) self.assertEqual([[], [1, 2, 3]], Iter([1, 3]).split(-5).image) def test_split_while(self): self.assertEqual([[1, 2], [3, 4]], Iter([1, 4]).split_while(lambda x: x < 3).image) self.assertEqual([[], [1, 2, 3, 4]], Iter([1, 4]).split_while(lambda x: x < 0).image) self.assertEqual([[1, 2, 3, 4], []], Iter([1, 4]).split_while(lambda x: x > 0).image) def test_split_with(self): self.assertEqual([[4, 2, 0], [5, 3, 1]], Iter([0, 5]).reverse().split_with(lambda x: x % 2 == 0).image) self.assertEqual([{'b': -2, 'd': -3}, {'a': 1, 'c':1}], Iter({'a': 1, 'b': -2, 'c': 1, 'd': -3}).split_with(lambda k, v: v < 0).image) self.assertEqual([{}, {'a': 1, 'b': -2, 'c': 1, 'd': -3}], Iter({'a': 1, 'b': -2, 'c': 1, 'd': -3}).split_with(lambda k, v: v > 50).image) self.assertEqual([{}, {}], Iter({}).split_with(lambda k, v: v > 50).image) def test_sum(self): self.assertEqual(5050, Iter([1, 100]).sum()) def test_take(self): self.assertEqual([1, 2], Iter([1, 3]).take(2).image) self.assertEqual([1, 2, 3], Iter([1, 3]).take(10).image) self.assertEqual([], Iter([1, 3]).take(0).image) self.assertEqual([3], Iter([1, 3]).take(-1).image) def test_take_every(self): self.assertEqual([1, 3, 5, 7, 9], Iter([1, 10]).take_every(2).image) self.assertEqual([], Iter([1, 10]).take_every(0).image) self.assertEqual([1, 2, 3], Iter([1, 3]).take_every(1).image) def test_take_random(self): numbers = set(Iter.range([1, 100])) self.assertTrue(set(Iter([1, 100]).take_random(2).image).issubset(numbers)) def test_take_while(self): self.assertEqual([1, 2], Iter([1, 3]).take_while(lambda x: x < 3).image) def test_uniq(self): self.assertEqual([1, 2, 3], Iter([1, 2, 3, 3, 2, 1]).uniq().image) def test_unzip(self): self.assertEqual([['a', 'b', 'c'], [1, 2, 3]], Iter({'a': 1, 'b': 2, 'c': 3}).unzip().image) self.assertEqual([['a', 'b', 'c'], [1, 2, 3]], Iter([('a', 1), ('b', 2), ('c', 3)]).unzip().image) self.assertEqual([['a', 'b', 'c'], [1, 2, 3]], Iter([['a', 1], ['b', 2], ['c', 3]]).unzip().image) def test_with_index(self): self.assertEqual([('a', 0), ('b', 1), ('c', 2)], Iter(list("abc")).with_index().image) self.assertEqual([('a', 2), ('b', 3), ('c', 4)], Iter(list("abc")).with_index(2).image) self.assertEqual([(0, 'a'), (1, 'b'), (2, 'c')], Iter(list("abc")).with_index(lambda k, v: (v, k)).image) def test_zip(self): self.assertEqual([(1, 'a', "foo"), (2, 'b', "bar"), (3, 'c', "baz")], Iter([1, 3]).zip(list("abc"), ["foo", "bar", "baz"]).image) self.assertEqual([('a', 0), ('b', 1), ('c', 2)], Iter(list("abc")).zip(range(3)).image) self.assertEqual([('a', 0, 'd'), ('b', 1, 'e'), ('c', 2, 'f')], Iter(list("abc")).zip(range(3), list("def")).image) @pytest.mark.xfail(raises=NotImplementedError,reason='TODO') def test_zip_reduce(self): self.assertEqual([(1, 2, 3), (1, 2, 3)], Iter([[1, 1], [2, 2], [3, 3]]).zip_reduce([], lambda x, acc: tuple(x) + (acc,)).image) self.assertEqual([(1, {'a': 3}, 5), (2, {'b': 4}, 6)], Iter([]).zip_reduce([5, 6], lambda x, acc: tuple(x) + (acc,), [1, 2], {'a': 3, 'b': 4}).image) def test_zip_with(self): self.assertEqual([5, 7, 9], Iter([]).zip_with(operator.add, [1, 2, 3], [4, 5, 6]).image) self.assertEqual([5, 11], Iter([]).zip_with(lambda x, y, z: x + y + z, [1, 3], [3, 5], [1, 3]).image) self.assertEqual([5, 7], Iter([]).zip_with(operator.add, [1, 2], [4, 5, 6, 7]).image) def test_str(self): self.assertEqual("[1, 2, 3, 4, 5]", str(Iter([1, 5]))) self.assertEqual("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ...]", str(Iter([1, 100]))) def test_repr(self): self.assertEqual("Iter(domain=[1, 2, 3, 4, 5],image=[1, 2, 3, 4, 5])", repr(Iter([1, 5]))) self.assertEqual("Iter(domain=[1, 2, 3, 4, 5, ...],image=[1, 2, 3, 4, 5, ...])", repr(Iter([1, 50])))
53.449438
168
0.54835
3,126
19,028
3.28023
0.06334
0.241369
0.140433
0.077921
0.649893
0.552565
0.463136
0.381315
0.319778
0.264872
0
0.091448
0.202333
19,028
355
169
53.6
0.584135
0
0
0.021277
0
0.014184
0.050925
0
0
0
0
0
0.695035
1
0.248227
false
0.017731
0.014184
0
0.265957
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
1
0
0
0
0
0
0
0
3
fc1c8d0f1053420a5fa004bbda3462b7ee87a1eb
3,760
py
Python
sdk/arena-python-sdk/arenasdk/training/horovod_job_builder.py
thliang01/arena
8ec9325f4927744bb10483dac0b9399faf12ef12
[ "ECL-2.0", "Apache-2.0" ]
502
2018-08-30T13:27:12.000Z
2022-03-17T01:59:52.000Z
sdk/arena-python-sdk/arenasdk/training/horovod_job_builder.py
thliang01/arena
8ec9325f4927744bb10483dac0b9399faf12ef12
[ "ECL-2.0", "Apache-2.0" ]
718
2018-08-30T13:15:39.000Z
2022-03-18T12:07:32.000Z
sdk/arena-python-sdk/arenasdk/training/horovod_job_builder.py
xieydd/arena
b2cd6c5287e8bdba4b91116c660c8b308cf496cf
[ "ECL-2.0", "Apache-2.0" ]
155
2018-09-02T12:56:18.000Z
2022-03-07T07:06:59.000Z
#!/usr/bin/env python from __future__ import annotations from arenasdk.enums.types import TrainingJobType from arenasdk.fields.fields import * from arenasdk.training.job_builder import JobBuilder class HorovodJobBuilder(JobBuilder): def __init__(self): super().__init__(TrainingJobType.HorovodTrainingJob) def with_ssh_port(self,port: int) ->HorovodJobBuilder: self._options.append(StringField("--ssh-port",str(port))) return self def with_cpu(self,cpu: str) ->HorovodJobBuilder: self._options.append(StringField("--cpu",cpu)) return self def with_memory(self,memory: str) ->HorovodJobBuilder: self._options.append(StringField("--memory",memory)) return self def with_name(self,name: str) ->HorovodJobBuilder: super().with_name(name) return self def with_image(self,image: str) ->HorovodJobBuilder: super().with_image(image) return self def with_workers(self,count: int) ->HorovodJobBuilder: super().with_workers(count) return self def with_image_pull_secrets(self,secrets: List[str]) ->HorovodJobBuilder: super().with_image_pull_secrets(secrets) return self def with_gpus(self,count: int) ->HorovodJobBuilder: super().with_gpus(count) return self def with_envs(self,envs: Dict[str,str]) ->HorovodJobBuilder: super().with_envs(envs) return self def with_node_selectors(self,selectors: Dict[str, str]) ->HorovodJobBuilder: super().with_node_selectors(selectors) return self def with_tolerations(self,tolerations: List[str]) ->HorovodJobBuilder: super().with_tolerations(tolerations) return self def with_config_files(self,files: Dict[str, str]) ->HorovodJobBuilder: super().with_config_files(files) return self def with_annotations(self,annotions: Dict[str, str]) ->HorovodJobBuilder: super().with_annotations(annotions) return self def with_datas(self,datas: Dict[str,str]) ->HorovodJobBuilder: super().with_datas(datas) return self def with_data_dirs(self,data_dirs: Dict[str, str]) ->HorovodJobBuilder: super().with_data_dirs(data_dirs) return self def with_log_dir(self,dir: str) ->HorovodJobBuilder: super().with_log_dir(dir) return self def with_priority(self,priority: str) ->HorovodJobBuilder: super().with_priority(priority) return self def enable_rdma(self) ->HorovodJobBuilder: super().enable_rdma() return self def with_sync_image(self,image: str) ->HorovodJobBuilder: super().with_sync_image(image) return self def with_sync_mode(self,mode: str) ->HorovodJobBuilder: super().with_sync_mode(mode) return self def with_sync_source(self,source: str) ->HorovodJobBuilder: super().with_sync_source(source) return self def enable_tensorboard(self) ->HorovodJobBuilder: super().enable_tensorboard() return self def with_tensorboard_image(self,image: str) ->HorovodJobBuilder: super().with_tensorboard_image(image) return self def with_working_dir(self,dir: str) ->HorovodJobBuilder: super().with_working_dir(dir) return self def with_retry_count(self,count: int) ->HorovodJobBuilder: super().with_retry_count(count) return self def enable_coscheduling(self) ->HorovodJobBuilder: super().enable_coscheduling() return self def with_command(self,command: str) ->HorovodJobBuilder: super().with_command(command) return self
31.864407
80
0.672074
427
3,760
5.697892
0.156909
0.110974
0.138923
0.160707
0.434854
0.312372
0.08508
0
0
0
0
0
0.225532
3,760
117
81
32.136752
0.835508
0.005319
0
0.306818
0
0
0.006151
0
0
0
0
0
0
1
0.318182
false
0
0.045455
0
0.681818
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
1
0
0
3
fc2ae3284d634622819f2d38e2632ea030ec6f0a
66
py
Python
aiotruenas_client/websockets/__init__.py
colemamd/aiotruenas-client
26f754fcceadbacbfc87a19465d5a8d035e4bd00
[ "MIT" ]
11
2020-12-30T00:33:01.000Z
2022-01-25T07:56:55.000Z
aiotruenas_client/websockets/__init__.py
colemamd/aiotruenas-client
26f754fcceadbacbfc87a19465d5a8d035e4bd00
[ "MIT" ]
35
2020-09-29T07:45:49.000Z
2022-03-29T15:02:52.000Z
aiotruenas_client/websockets/__init__.py
colemamd/aiotruenas-client
26f754fcceadbacbfc87a19465d5a8d035e4bd00
[ "MIT" ]
3
2020-12-30T18:19:03.000Z
2021-09-18T17:32:22.000Z
from .machine import CachingMachine __all__ = ["CachingMachine"]
16.5
35
0.787879
6
66
8
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.121212
66
3
36
22
0.827586
0
0
0
0
0
0.212121
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
fc5397cbf60e8722c0a634072e619b155a9ccf38
167
py
Python
stop.py
haakon8855/zumo_bullfighter
d70172cde2015816ecc08e8dc384f35297397427
[ "MIT" ]
1
2020-01-17T18:00:38.000Z
2020-01-17T18:00:38.000Z
stop.py
haakon8855/zumo_bullfighter
d70172cde2015816ecc08e8dc384f35297397427
[ "MIT" ]
null
null
null
stop.py
haakon8855/zumo_bullfighter
d70172cde2015816ecc08e8dc384f35297397427
[ "MIT" ]
null
null
null
"""Stops the motors from running""" from dependencies.zumo_button import ZumoButton from motob import Motob Z = ZumoButton() M = Motob() M.operationalize(["S", 0])
16.7
47
0.730539
23
167
5.26087
0.695652
0
0
0
0
0
0
0
0
0
0
0.006993
0.143713
167
9
48
18.555556
0.839161
0.173653
0
0
0
0
0.007576
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
fc7627007265da7107b7998a6c9ff0add5ad5f3c
143
py
Python
wsgi/app/app.py
pdonorio/pocs
65ff2fecf1d3c8071a593aa698efdd10ef04f046
[ "MIT" ]
null
null
null
wsgi/app/app.py
pdonorio/pocs
65ff2fecf1d3c8071a593aa698efdd10ef04f046
[ "MIT" ]
null
null
null
wsgi/app/app.py
pdonorio/pocs
65ff2fecf1d3c8071a593aa698efdd10ef04f046
[ "MIT" ]
1
2021-08-05T15:37:23.000Z
2021-08-05T15:37:23.000Z
# -*- coding: utf-8 -*- """ For debugging purpose """ from myflask import app if __name__ == "__main__": app.run(port=5000, debug=True)
13
34
0.629371
19
143
4.315789
0.947368
0
0
0
0
0
0
0
0
0
0
0.043103
0.188811
143
10
35
14.3
0.663793
0.307692
0
0
0
0
0.087912
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
fc9239ea2c58eb56253408fb8a7b241a411f36a6
2,877
py
Python
accelbyte_py_sdk/api/leaderboard/models/__init__.py
AccelByte/accelbyte-python-sdk
dcd311fad111c59da828278975340fb92e0f26f7
[ "MIT" ]
null
null
null
accelbyte_py_sdk/api/leaderboard/models/__init__.py
AccelByte/accelbyte-python-sdk
dcd311fad111c59da828278975340fb92e0f26f7
[ "MIT" ]
1
2021-10-13T03:46:58.000Z
2021-10-13T03:46:58.000Z
accelbyte_py_sdk/api/leaderboard/models/__init__.py
AccelByte/accelbyte-python-sdk
dcd311fad111c59da828278975340fb92e0f26f7
[ "MIT" ]
null
null
null
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py """Auto-generated package that contains models used by the justice-leaderboard-service.""" __version__ = "2.15.5" __author__ = "AccelByte" __email__ = "dev@accelbyte.net" # pylint: disable=line-too-long from .models_archive_leaderboard_req import ModelsArchiveLeaderboardReq from .models_archive_leaderboard_signed_url_response import ModelsArchiveLeaderboardSignedURLResponse from .models_daily_config import ModelsDailyConfig from .models_delete_bulk_leaderboard_failed_resp import ModelsDeleteBulkLeaderboardFailedResp from .models_delete_bulk_leaderboards_req import ModelsDeleteBulkLeaderboardsReq from .models_delete_bulk_leaderboards_resp import ModelsDeleteBulkLeaderboardsResp from .models_get_all_leaderboard_configs_public_resp import ModelsGetAllLeaderboardConfigsPublicResp from .models_get_all_leaderboard_configs_resp import ModelsGetAllLeaderboardConfigsResp from .models_get_all_user_leaderboards_resp import ModelsGetAllUserLeaderboardsResp from .models_get_hidden_user_response import ModelsGetHiddenUserResponse from .models_get_leaderboard_config_public_resp import ModelsGetLeaderboardConfigPublicResp from .models_get_leaderboard_config_resp import ModelsGetLeaderboardConfigResp from .models_get_leaderboard_ranking_resp import ModelsGetLeaderboardRankingResp from .models_get_user_visibility_response import ModelsGetUserVisibilityResponse from .models_leaderboard_config_req import ModelsLeaderboardConfigReq from .models_monthly_config import ModelsMonthlyConfig from .models_pagination import ModelsPagination from .models_set_user_visibility_request import ModelsSetUserVisibilityRequest from .models_update_leaderboard_config_req import ModelsUpdateLeaderboardConfigReq from .models_update_user_point_admin_v1_request import ModelsUpdateUserPointAdminV1Request from .models_update_user_point_admin_v1_response import ModelsUpdateUserPointAdminV1Response from .models_user_leaderboard_ranking import ModelsUserLeaderboardRanking from .models_user_point import ModelsUserPoint from .models_user_ranking_response import ModelsUserRankingResponse from .models_user_ranking_response_detail import ModelsUserRankingResponseDetail from .models_weekly_config import ModelsWeeklyConfig from .response_error_response import ResponseErrorResponse from .v2_entry import V2Entry from .v2_get_all_leaderboard_configs_public_resp import V2GetAllLeaderboardConfigsPublicResp from .v2_get_leaderboard_config_public_resp import V2GetLeaderboardConfigPublicResp from .v2_get_public_leaderboard_ranking_response import V2GetPublicLeaderboardRankingResponse from .v2_pagination import V2Pagination
58.714286
101
0.906152
312
2,877
7.910256
0.391026
0.105348
0.042139
0.024311
0.170989
0.105348
0.058347
0
0
0
0
0.008197
0.067084
2,877
48
102
59.9375
0.911326
0.127911
0
0
1
0
0.012815
0
0
0
0
0
0
1
0
false
0
0.914286
0
0.914286
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
1
0
0
3
fc940244adfc67a9bd6197ac65a9203e94e72981
587
py
Python
src/python/palindromo.py
willisnou/Algoritmos-e-Estruturas-de-Dados
b70a2f692ccae948576177560e3628b9dece5aee
[ "MIT" ]
653
2015-06-07T14:45:40.000Z
2022-03-25T17:31:58.000Z
src/python/palindromo.py
willisnou/Algoritmos-e-Estruturas-de-Dados
b70a2f692ccae948576177560e3628b9dece5aee
[ "MIT" ]
64
2017-10-29T10:53:37.000Z
2022-03-14T23:49:18.000Z
src/python/palindromo.py
willisnou/Algoritmos-e-Estruturas-de-Dados
b70a2f692ccae948576177560e3628b9dece5aee
[ "MIT" ]
224
2015-06-07T14:46:00.000Z
2022-03-25T17:36:46.000Z
# A simple way to resolve the palindrome problem # Note: this example does not deal with punctuation def is_palindrome(content): processed_content = ''.join(content.lower().split()) return processed_content == processed_content[::-1] if __name__ == '__main__': assert is_palindrome('ovo') assert is_palindrome('osso') assert is_palindrome('Arara') assert is_palindrome('Amor a Roma') assert is_palindrome('O lobo ama o bolo') assert is_palindrome('A grama é amarga') assert not is_palindrome('Sentido') assert not is_palindrome('Algoritmos')
29.35
56
0.71891
78
587
5.153846
0.551282
0.268657
0.268657
0.104478
0
0
0
0
0
0
0
0.002066
0.175468
587
19
57
30.894737
0.828512
0.163543
0
0
0
0
0.165984
0
0
0
0
0
0.666667
1
0.083333
false
0
0
0
0.166667
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
fc9f8fbdfd99b50485834e8fdc245bfe5f7e0f7b
572
py
Python
features/scenes/main_scene.py
kirbycope/altunity-headspin-python
a2c272fa561cad7b2ed9c463f3060420dea48d6f
[ "MIT" ]
null
null
null
features/scenes/main_scene.py
kirbycope/altunity-headspin-python
a2c272fa561cad7b2ed9c463f3060420dea48d6f
[ "MIT" ]
null
null
null
features/scenes/main_scene.py
kirbycope/altunity-headspin-python
a2c272fa561cad7b2ed9c463f3060420dea48d6f
[ "MIT" ]
null
null
null
import test_data from altunityrunner import * # "Main" scene def btnRun(): """ The "Run!" `button`. """ return test_data.altUnityDriver.find_object(By.NAME, "StartButton") def btnPause(): """ The "||" (Pause) `button`. """ return test_data.altUnityDriver.find_object(By.NAME, "pauseButton") def open(): """ Opens _this_ scene. """ test_data.altUnityDriver.load_scene("Main") def start_run_then_pause(): """ Starts a run and then pauses after 10 seconds. """ time.sleep(2) btnRun().tap() time.sleep(10) btnPause().tap()
20.428571
71
0.645105
71
572
5.028169
0.549296
0.089636
0.184874
0.112045
0.280112
0.280112
0.280112
0.280112
0.280112
0
0
0.010776
0.188811
572
27
72
21.185185
0.758621
0.230769
0
0
0
0
0.062651
0
0
0
0
0
0
1
0.307692
true
0
0.153846
0
0.615385
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
0
0
3
5d88a88a28b673bdf534100ad725e3b0af2e68aa
1,166
py
Python
output/models/nist_data/list_pkg/token/schema_instance/nistschema_sv_iv_list_token_pattern_4_xsd/nistschema_sv_iv_list_token_pattern_4.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
1
2021-08-14T17:59:21.000Z
2021-08-14T17:59:21.000Z
output/models/nist_data/list_pkg/token/schema_instance/nistschema_sv_iv_list_token_pattern_4_xsd/nistschema_sv_iv_list_token_pattern_4.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
4
2020-02-12T21:30:44.000Z
2020-04-15T20:06:46.000Z
output/models/nist_data/list_pkg/token/schema_instance/nistschema_sv_iv_list_token_pattern_4_xsd/nistschema_sv_iv_list_token_pattern_4.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
null
null
null
from dataclasses import dataclass, field from typing import List __NAMESPACE__ = "NISTSchema-SV-IV-list-token-pattern-4-NS" @dataclass class NistschemaSvIvListTokenPattern4: class Meta: name = "NISTSchema-SV-IV-list-token-pattern-4" namespace = "NISTSchema-SV-IV-list-token-pattern-4-NS" value: List[str] = field( default_factory=list, metadata={ "pattern": r"\d{1,5}_([A-Z][a-z]{1,20}_){3}Street_([A-Z][a-z]{1,20}_){2},_[A-Z]{2}_17930-1652 \d{1,5}_([A-Z][a-z]{1,20}_){3}Street_([A-Z][a-z]{1,20}_){2},_[A-Z]{2}_19453 \d{1,5}_([A-Z][a-z]{1,20}_){3}Street_([A-Z][a-z]{1,20}_){2},_[A-Z]{2}_18434-1961 \d{1,5}_([A-Z][a-z]{1,20}_){4}Street_([A-Z][a-z]{1,20}_){2},_[A-Z]{2}_14405 \d{1,5}_([A-Z][a-z]{1,20}_){2}Street_([A-Z][a-z]{1,20}_){1},_[A-Z]{2}_15365 \d{1,5}_([A-Z][a-z]{1,20}_){3}Street_([A-Z][a-z]{1,20}_){2},_[A-Z]{2}_16114 \d{1,5}_([A-Z][a-z]{1,20}_){2}Street_([A-Z][a-z]{1,20}_){2},_[A-Z]{2}_14742 \d{1,5}_([A-Z][a-z]{1,20}_){5}Street_([A-Z][a-z]{1,20}_){2},_[A-Z]{2}_12190-1064 \d{1,5}_([A-Z][a-z]{1,20}_){3}Street_([A-Z][a-z]{1,20}_){2},_[A-Z]{2}_13082-1344", "tokens": True, } )
58.3
730
0.566895
254
1,166
2.370079
0.192913
0.149502
0.089701
0.119601
0.599668
0.599668
0.599668
0.548173
0.548173
0.375415
0
0.157239
0.105489
1,166
19
731
61.368421
0.419942
0
0
0
0
0.066667
0.714408
0.696398
0
0
0
0
0
1
0
false
0
0.133333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
5dc00a7af3c5f6d7b332c183bae2b26e38eaf79f
1,589
py
Python
company/contacts_api.py
thinkstack-co/ConnectPyse
ded8b426250aee352598f33ad08b7bcc3c6a3017
[ "MIT" ]
23
2017-01-24T05:44:05.000Z
2021-11-26T17:08:01.000Z
company/contacts_api.py
thinkstack-co/ConnectPyse
ded8b426250aee352598f33ad08b7bcc3c6a3017
[ "MIT" ]
10
2017-01-14T21:11:10.000Z
2019-06-16T21:10:29.000Z
company/contacts_api.py
thinkstack-co/ConnectPyse
ded8b426250aee352598f33ad08b7bcc3c6a3017
[ "MIT" ]
16
2017-01-24T02:28:19.000Z
2021-07-13T17:23:22.000Z
from ..cw_controller import CWController # Class for /company/contacts from . import contact class ContactsAPI(CWController): def __init__(self): self.module_url = 'company' self.module = 'contacts' self._class = contact.Contact super().__init__() # instance gets passed to parent object def get_contacts(self): return super()._get() def create_contact(self, a_contact): return super()._create(a_contact) def get_contacts_count(self): return super()._get_count() def get_contact_by_id(self, contact_id): return super()._get_by_id(contact_id) def delete_contact_by_id(self, contact_id): super()._delete_by_id(contact_id) def replace_contact(self, contact_id): pass def update_contact(self, contact_id, key, value): return super()._update(contact_id, key, value) def merge_contact(self, a_contact, target_contact_id): # return super()._merge(a_contact, target_contact_id) pass def validate_portal_credentials(self, a_contact): for comm_items in a_contact.communicationItems: if comm_items['defaultFlag'] and comm_items['communicationType'] == 'Email': email = comm_items['value'] break dict_post = {'email': email, 'password': a_contact.portalPassword} json_results = self.contacts.post(user_data=dict_post, user_headers=connectpyse.basic_auth) status_code = json_results.status_code return status_code
33.104167
100
0.657646
192
1,589
5.078125
0.338542
0.083077
0.053333
0.036923
0.129231
0.049231
0
0
0
0
0
0
0.249843
1,589
47
101
33.808511
0.817953
0.073631
0
0.060606
0
0
0.046479
0
0
0
0
0
0
1
0.30303
false
0.090909
0.060606
0.151515
0.575758
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
1
0
0
0
3
5dc81933596d3faed2c439de7fbec20c4d5885e0
812
py
Python
src/clikit/api/args/raw_args.py
finswimmer/clikit
206198eb60d53c5daefa715f8a93e1fe85ffcf7e
[ "MIT" ]
1
2020-08-07T16:09:57.000Z
2020-08-07T16:09:57.000Z
src/clikit/api/args/raw_args.py
finswimmer/clikit
206198eb60d53c5daefa715f8a93e1fe85ffcf7e
[ "MIT" ]
null
null
null
src/clikit/api/args/raw_args.py
finswimmer/clikit
206198eb60d53c5daefa715f8a93e1fe85ffcf7e
[ "MIT" ]
1
2020-01-08T18:44:26.000Z
2020-01-08T18:44:26.000Z
from typing import List from typing import Optional class RawArgs(object): """ The unparsed console arguments. """ @property def script_name(self): # type: () -> Optional[str] raise NotImplementedError() @property def tokens(self): # type: () -> List[str] raise NotImplementedError() def has_token(self, token): # type: (str) -> bool raise NotImplementedError() def to_string(self, script_name=True): # type: (bool) -> str raise NotImplementedError() @property def option_tokens(self): # type: () -> List[str] raise NotImplementedError() return list(itertools.takewhile(lambda arg: arg != "--", self.tokens)) def has_option_token(self, token): # type: (str) -> bool raise NotImplementedError()
26.193548
78
0.625616
86
812
5.825581
0.395349
0.287425
0.215569
0.139721
0.526946
0.37525
0.37525
0.195609
0
0
0
0
0.247537
812
30
79
27.066667
0.819967
0.199507
0
0.473684
0
0
0.00318
0
0
0
0
0
0
1
0.315789
false
0
0.105263
0
0.526316
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
5ddd83434c5ca85d5cd87005c434e9c4aa10956d
328
py
Python
pkgname/hello.py
dragonyanglong/test_use_template
38fdb17a51d8537120760e306ecb247988e59980
[ "CC0-1.0" ]
null
null
null
pkgname/hello.py
dragonyanglong/test_use_template
38fdb17a51d8537120760e306ecb247988e59980
[ "CC0-1.0" ]
null
null
null
pkgname/hello.py
dragonyanglong/test_use_template
38fdb17a51d8537120760e306ecb247988e59980
[ "CC0-1.0" ]
null
null
null
# import numpy as np def add(x, y): """ This function sums up two numbers. Parameters ---------- x : float The first number to be added. y : float The second number to be added. Returns ------- sum : float The sum of x and y. """ sum = x + y return sum
15.619048
38
0.493902
45
328
3.6
0.622222
0.148148
0.123457
0.185185
0
0
0
0
0
0
0
0
0.393293
328
20
39
16.4
0.81407
0.664634
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
5de1deb8b5153014a2ad43b86afa9d380ce893c1
167
py
Python
problem0502.py
kmarcini/Project-Euler-Python
d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3
[ "BSD-3-Clause" ]
null
null
null
problem0502.py
kmarcini/Project-Euler-Python
d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3
[ "BSD-3-Clause" ]
null
null
null
problem0502.py
kmarcini/Project-Euler-Python
d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3
[ "BSD-3-Clause" ]
null
null
null
########################### # # #502 Counting Castles - Project Euler # https://projecteuler.net/problem=502 # # Code by Kevin Marciniak # ###########################
18.555556
39
0.479042
14
167
5.714286
0.928571
0
0
0
0
0
0
0
0
0
0
0.040541
0.113772
167
8
40
20.875
0.5
0.580838
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
b90299c0c633bb5437de679ec01574f97a59c631
7,886
py
Python
src/stk/ea/selection/batch.py
stevenbennett96/stk
6e5af87625b83e0bfc7243bc42d8c7a860cbeb76
[ "MIT" ]
21
2018-04-12T16:25:24.000Z
2022-02-14T23:05:43.000Z
src/stk/ea/selection/batch.py
stevenbennett96/stk
6e5af87625b83e0bfc7243bc42d8c7a860cbeb76
[ "MIT" ]
8
2019-03-19T12:36:36.000Z
2020-11-11T12:46:00.000Z
src/stk/ea/selection/batch.py
stevenbennett96/stk
6e5af87625b83e0bfc7243bc42d8c7a860cbeb76
[ "MIT" ]
5
2018-08-07T13:00:16.000Z
2021-11-01T00:55:10.000Z
""" Batch ===== """ from collections import Counter class Batch: """ Represents a batch of molecule records. Batches can be compared, the comparison is based on their fitness values. Batches can also be iterated through, this iterates through all the records in the batch. Examples -------- *Sorting Batches by Fitness Value* Sorting batches causes them to be sorted by fitness value. .. testcode:: sorting-batches-by-fitness-value import stk record1 = stk.MoleculeRecord( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='BrCCBr', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ) record2 = stk.MoleculeRecord( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='BrCCBr', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ) record3 = stk.MoleculeRecord( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='BrCCBr', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ) batches = ( stk.Batch( records=(record1, ), fitness_values={record1: 1}, key_maker=stk.Inchi(), ), stk.Batch( records=(record2, ), fitness_values={record2: 2}, key_maker=stk.Inchi(), ), stk.Batch( records=(record3, ), fitness_values={record3: 3}, key_maker=stk.Inchi(), ), ) sorted_batches = sorted(batches) .. testcode:: sorting-batches-by-fitness-value :hide: assert ( sorted_batches[0] < sorted_batches[1] < sorted_batches[2] ) *Comparing Batches by Fitness Value* Comparison is also based on fitness value .. testcode:: comparing-batches-by-fitness-value import stk record1 = stk.MoleculeRecord( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='BrCCBr', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ) batch1 = stk.Batch( records=(record1, ), fitness_values={record1: 1}, key_maker=stk.Inchi(), ) record2 = stk.MoleculeRecord( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='BrCCBr', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ) batch2 = stk.Batch( records=(record2, ), fitness_values={record2: 2}, key_maker=stk.Inchi(), ) if batch1 < batch2: print('batch1 has a smaller fitness value than batch2.') .. testoutput:: comparing-batches-by-fitness-value :hide: batch1 has a smaller fitness value than batch2. *Iterating Through Molecule Records in a Batch* Batches can be iterated through to get the molecule records in the batch .. testcode:: iterating-through-molecule-records-in-a-batch import stk record1 = stk.MoleculeRecord( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='BrCCBr', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ) record2 = stk.MoleculeRecord( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='BrCCBr', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ) batch = stk.Batch( records=(record1, record2), fitness_values={record1: 1, record2: 2}, key_maker=stk.Inchi(), ) for record in batch: # Do stuff with record. pass """ __slots__ = ('_records', '_fitness_value', '_identity_key') def __init__(self, records, fitness_values, key_maker): """ Initialize a :class:`.Batch`. Parameters ---------- records : :class:`tuple` of :class:`.MoleculeRecord` The molecule records which are part of the batch. fitness_values : :class:`dict` Maps each :class:`.MoleculeRecord` in `records` to the fitness value which should be used for it. key_maker : :class:`.MoleculeKeyMaker` Used to make keys for molecules, which are used to determine the identity key of the batch. If two batches have the same molecule keys, the same number of times, they will have the same identity key. """ self._records = records self._fitness_value = sum(map(fitness_values.get, records)) molecules = (record.get_molecule() for record in records) self._identity_key = frozenset( Counter(map(key_maker.get_key, molecules)).items() ) def get_size(self): """ Get the number of molecules in the batch. Returns ------- :class:`int` The number of molecules in the batch. """ return len(self._records) def get_fitness_value(self): """ Get the fitness value of the batch. Returns ------- :class:`float` The fitness value. """ return self._fitness_value def get_identity_key(self): """ Get the identity key of the batch. If two batches hold the same molecules, the same number of times, they will have the same identity key. Returns ------- :class:`object` A hashable object which can be used to compare if two batches have the same identity. """ return self._identity_key def __iter__(self): return iter(self._records) def __getitem__(self, index): return self._records[index] def __eq__(self, other): return self._fitness_value == other._fitness_value def __gt__(self, other): return self._fitness_value > other._fitness_value def __ge__(self, other): return self._fitness_value >= other._fitness_value def __lt__(self, other): return self._fitness_value < other._fitness_value def __le__(self, other): return self._fitness_value <= other._fitness_value def __repr__(self): return f'Batch({self._fitness_value})' def __str__(self): return repr(self)
27.573427
70
0.512427
739
7,886
5.259811
0.190798
0.086442
0.03293
0.054026
0.585542
0.558528
0.530486
0.491124
0.471057
0.452534
0
0.009672
0.396906
7,886
285
71
27.670175
0.807611
0.705935
0
0
0
0
0.045324
0.020144
0
0
0
0
0
1
0.382353
false
0
0.029412
0.264706
0.823529
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
b90fc49f681d4a1764251864ef60b32c982e64b7
1,711
py
Python
crits/samples/urls.py
frbapolkosnik/crits
1278c034f2238e2fe34e65e32ce241128a014df2
[ "MIT" ]
22
2015-01-14T19:49:32.000Z
2022-01-26T12:18:52.000Z
crits/samples/urls.py
deadbits/crits
154097a1892e9d3960d6faaed4bd2e912a196a47
[ "MIT" ]
null
null
null
crits/samples/urls.py
deadbits/crits
154097a1892e9d3960d6faaed4bd2e912a196a47
[ "MIT" ]
6
2015-01-22T21:25:52.000Z
2021-04-12T23:24:14.000Z
from django.conf.urls import url urlpatterns = [ url(r'^upload/$', 'upload_file', prefix='crits.samples.views'), url(r'^upload/(?P<related_md5>\w+)/$', 'upload_file', prefix='crits.samples.views'), url(r'^upload_list/(?P<filename>[\S ]+)/(?P<md5s>.+)/$', 'view_upload_list', prefix='crits.samples.views'), url(r'^bulkadd/$', 'bulk_add_md5_sample', prefix='crits.samples.views'), url(r'^details/(?P<sample_md5>\w+)/$', 'detail', prefix='crits.samples.views'), url(r'^strings/(?P<sample_md5>\w+)/$', 'strings', prefix='crits.samples.views'), url(r'^stackstrings/(?P<sample_md5>\w+)/$', 'stackstrings', prefix='crits.samples.views'), url(r'^hex/(?P<sample_md5>\w+)/$', 'hex', prefix='crits.samples.views'), url(r'^xor/(?P<sample_md5>\w+)/$', 'xor', prefix='crits.samples.views'), url(r'^xor_searcher/(?P<sample_md5>\w+)/$', 'xor_searcher', prefix='crits.samples.views'), url(r'^unzip/(?P<md5>\w+)/$', 'unzip_sample', prefix='crits.samples.views'), url(r'^sources/$', 'sources', prefix='crits.samples.views'), url(r'^remove/(?P<md5>[\S ]+)$', 'remove_sample', prefix='crits.samples.views'), url(r'^list/$', 'samples_listing', prefix='crits.samples.views'), url(r'^list/(?P<option>\S+)/$', 'samples_listing', prefix='crits.samples.views'), url(r'^yarahits/list/$', 'yarahits_listing', prefix='crits.samples.views'), url(r'^yarahits/list/(?P<option>\S+)/$', 'yarahits_listing', prefix='crits.samples.views'), url(r'^set_filename/$', 'set_sample_filename', prefix='crits.samples.views'), url(r'^filenames/$', 'set_sample_filenames', prefix='crits.samples.views'), ]
74.391304
115
0.616598
227
1,711
4.524229
0.185022
0.074002
0.333009
0.425511
0.642648
0.615385
0.431353
0.268744
0.17332
0
0
0.007373
0.127995
1,711
22
116
77.772727
0.680965
0
0
0
0
0
0.603741
0.185272
0
0
0
0
0
1
0
false
0
0.045455
0
0.045455
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
f8d79f6cd7c33db2ddf15a764df382bbd104598e
216
py
Python
config/asgi.py
birkin/channels_exploration_project
21fdc294102f8931384d1759a3e8acb185dff8e1
[ "MIT" ]
null
null
null
config/asgi.py
birkin/channels_exploration_project
21fdc294102f8931384d1759a3e8acb185dff8e1
[ "MIT" ]
null
null
null
config/asgi.py
birkin/channels_exploration_project
21fdc294102f8931384d1759a3e8acb185dff8e1
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import channels.asgi os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") channel_layer = channels.asgi.get_channel_layer()
19.636364
66
0.782407
28
216
5.678571
0.714286
0.150943
0
0
0
0
0
0
0
0
0
0.005155
0.101852
216
10
67
21.6
0.814433
0.097222
0
0
0
0
0.19171
0.11399
0
0
0
0
0
1
0
false
0
0.6
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
f8fe8b2daf1d83ea2314065755524fab000d5bba
1,734
py
Python
tests/test_commands/test_setannoucements.py
Ahsoka/bdaybot
3aec9509119c28b294efdc0c76e8ee7fda7e8553
[ "MIT" ]
5
2021-01-21T07:49:50.000Z
2022-02-09T17:13:09.000Z
tests/test_commands/test_setannoucements.py
Ahsoka/bdaybot
3aec9509119c28b294efdc0c76e8ee7fda7e8553
[ "MIT" ]
22
2020-12-30T02:13:32.000Z
2022-02-24T05:52:54.000Z
tests/test_commands/test_setannoucements.py
Ahsoka/bdaybot
3aec9509119c28b294efdc0c76e8ee7fda7e8553
[ "MIT" ]
3
2021-02-02T05:21:14.000Z
2021-08-20T01:16:30.000Z
import re import pytest from bdaybot.tables import Guild @pytest.mark.asyncio async def test_setann(bot, session, channel, timeout): #invalid ann id invalid = "<#001>" await channel.send(f'test.setannouncements {invalid}') message = await bot.wait_for( 'message', timeout=timeout, check=lambda message: channel.guild.me in message.mentions ) assert 'not a valid TextChannel' in message.content, f'Message content: {message.content}' #voice channel invalid ="<#713095061180776501>" await channel.send(f'test.setannouncements {invalid}') message = await bot.wait_for( 'message', timeout=timeout, check=lambda message: channel.guild.me in message.mentions ) assert 'not a valid TextChannel' in message.content, f'Message content: {message.content}' #set announcements # TODO: Change channel.mention to a different channel await channel.send(f'test.setannouncements {channel.mention}') await bot.wait_for( 'message', timeout=timeout, check=lambda message: re.search(r'<#\d+>', message.content) ) guild = await session.get(Guild, channel.guild.id) assert channel.id == guild.announcements_id, f'SQLAnnouncements ID: {guild.announcements_id}' #reset guild.announcements_id = None await session.commit() #set blank annoucnements await channel.send(f'test.setannouncements') await bot.wait_for( 'message', timeout=timeout, check=lambda message: re.search(r'<#\d+>', message.content) ) guild = await session.get(Guild, channel.guild.id) assert channel.id == guild.announcements_id, f'SQLAnnouncements ID: {guild.announcements_id}'
36.125
97
0.684544
210
1,734
5.604762
0.27619
0.095157
0.084962
0.057774
0.739167
0.739167
0.676296
0.676296
0.676296
0.676296
0
0.015206
0.203576
1,734
47
98
36.893617
0.837075
0.071511
0
0.615385
0
0
0.245012
0.095387
0
0
0
0.021277
0.102564
1
0
false
0
0.076923
0
0.076923
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
1
0
0
0
0
0
0
0
0
0
0
3
5d1634d8cea313a5211bd79891a9dcdf485f067a
384
py
Python
src/models.py
weisrc/ellie
94d8c1ecaec790baa9a394f8dde1990d6a1defd0
[ "MIT" ]
1
2021-10-18T05:44:26.000Z
2021-10-18T05:44:26.000Z
src/models.py
weisrc/ellie
94d8c1ecaec790baa9a394f8dde1990d6a1defd0
[ "MIT" ]
null
null
null
src/models.py
weisrc/ellie
94d8c1ecaec790baa9a394f8dde1990d6a1defd0
[ "MIT" ]
null
null
null
import tensorflow_text import tensorflow_hub as hub import fasttext # import multi_rake # rake_model = multi_rake.Rake() fasttext_model = fasttext.load_model("models/fasttext.ftz") # def getkw(sample): # res = rake_model.apply(sample) # return [t[0] for t in res] def langid(sample): return fasttext_model.predict(sample)[0][0][-2:] embed = hub.load("models/use")
18.285714
59
0.71875
57
384
4.684211
0.473684
0.11985
0.097378
0
0
0
0
0
0
0
0
0.012308
0.153646
384
20
60
19.2
0.809231
0.346354
0
0
0
0
0.118367
0
0
0
0
0
0
1
0.142857
false
0
0.428571
0.142857
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
3
5d1e25a4e025b59132e902e37262c711d31d7b17
1,613
py
Python
opacus/lightning.py
RQuispeC/opacus
5c83d59fc169e93667946204f7a6859827a38ace
[ "Apache-2.0" ]
null
null
null
opacus/lightning.py
RQuispeC/opacus
5c83d59fc169e93667946204f7a6859827a38ace
[ "Apache-2.0" ]
null
null
null
opacus/lightning.py
RQuispeC/opacus
5c83d59fc169e93667946204f7a6859827a38ace
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Any, Optional import pytorch_lightning as pl import torch from opacus.data_loader import DPDataLoader class DPLightningDataModule(pl.LightningDataModule): def __init__( self, datamodule: pl.LightningDataModule, generator: Optional[torch.Generator] = None, ): super().__init__() self.datamodule = datamodule self.generator = generator def prepare_data(self) -> None: self.datamodule.prepare_data() def setup(self, stage: Optional[str] = None) -> None: self.datamodule.setup(stage) def train_dataloader(self): dataloader = self.datamodule.train_dataloader() return DPDataLoader.from_data_loader(dataloader, distributed=False) def val_dataloader(self): return self.datamodule.val_dataloader() def test_dataloader(self): return self.datamodule.test_dataloader() def predict_dataloader(self): return self.datamodule.predict_dataloader() def transfer_batch_to_device( self, batch: Any, device: torch.device, dataloader_idx: int ) -> Any: return self.datamodule.transfer_batch_to_device(batch, device, dataloader_idx) def on_before_batch_transfer(self, batch: Any, dataloader_idx: int) -> Any: return self.datamodule.on_before_batch_transfer(batch, dataloader_idx) def on_after_batch_transfer(self, batch: Any, dataloader_idx: int) -> Any: return self.datamodule.on_after_batch_transfer(batch, dataloader_idx)
32.26
86
0.716057
190
1,613
5.836842
0.310526
0.138864
0.108206
0.064923
0.302074
0.154193
0.154193
0.119026
0.119026
0.119026
0
0.000771
0.195908
1,613
49
87
32.918367
0.854279
0.055797
0
0
0
0
0
0
0
0
0
0
0
1
0.294118
false
0
0.117647
0.176471
0.647059
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
5d23a770c81346b619453154b936394fc1bcd87a
221
py
Python
jarbas/celery.py
R3DDY97/serenata-de-amor
8a323027cec91183c063e8f2c1ad779f7202156f
[ "MIT" ]
2
2019-03-26T06:33:14.000Z
2019-04-30T16:37:06.000Z
jarbas/celery.py
R3DDY97/serenata-de-amor
8a323027cec91183c063e8f2c1ad779f7202156f
[ "MIT" ]
1
2019-11-27T19:40:58.000Z
2019-11-27T19:40:58.000Z
jarbas/celery.py
R3DDY97/serenata-de-amor
8a323027cec91183c063e8f2c1ad779f7202156f
[ "MIT" ]
7
2019-11-27T19:15:07.000Z
2019-11-27T19:20:13.000Z
import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jarbas.settings') app = Celery('jarbas') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks()
22.1
66
0.791855
29
221
5.862069
0.586207
0
0
0
0
0
0
0
0
0
0
0
0.076923
221
9
67
24.555556
0.833333
0
0
0
0
0
0.312217
0.099548
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
5d42dd9b3a5fea8e5aa722e42120e9272459087b
1,081
py
Python
remove_empty_label.py
RachelBlin/ssd_keras
2a4b11eb16ee2b515d01d6c3f88dc0f050f40b3b
[ "Apache-2.0" ]
null
null
null
remove_empty_label.py
RachelBlin/ssd_keras
2a4b11eb16ee2b515d01d6c3f88dc0f050f40b3b
[ "Apache-2.0" ]
null
null
null
remove_empty_label.py
RachelBlin/ssd_keras
2a4b11eb16ee2b515d01d6c3f88dc0f050f40b3b
[ "Apache-2.0" ]
null
null
null
import os path_train_polar_labels = '/home/rblin/Images/BD_ITSC/train_polar/LABELS/' path_train_polar = '/home/rblin/Images/BD_ITSC/train_polar/PARAM_POLAR/' list_train_polar_labels = os.listdir(path_train_polar_labels) for i in list_train_polar_labels: f = open(path_train_polar_labels + i, 'r') content = f.read() if 'car' not in content and 'bike' not in content and 'motorbike' not in content and 'person' not in content: name = i.split('.') if os.path.exists(path_train_polar + 'RetinaNet_I/' + name[0] + '.png'): os.remove(path_train_polar + 'RetinaNet_I/' + name[0] + '.png') if os.path.exists(path_train_polar + 'RetinaNet_Params/' + name[0] + '.png'): os.remove(path_train_polar + 'RetinaNet_Params/' + name[0] + '.png') if os.path.exists(path_train_polar + 'RetinaNet_Stokes/' + name[0] + '.png'): os.remove(path_train_polar + 'RetinaNet_Stokes/' + name[0] + '.png') if os.path.exists(path_train_polar_labels + i): os.remove(path_train_polar_labels + i) f.close()
49.136364
113
0.665125
161
1,081
4.180124
0.242236
0.237741
0.249629
0.205052
0.631501
0.546805
0.546805
0.454681
0.36107
0.187221
0
0.006865
0.191489
1,081
21
114
51.47619
0.763158
0
0
0
0
0
0.219241
0.089732
0
0
0
0
0
1
0
false
0
0.055556
0
0.055556
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
5d612e20445d92fc577059836bc3433d55405ac9
35,156
py
Python
models_all_solvable2/syn30h.py
grossmann-group/pyomo-MINLP-benchmarking
714f0a0dffd61675649a805683c0627af6b4929e
[ "MIT" ]
7
2019-05-08T19:14:34.000Z
2021-12-24T00:00:40.000Z
models_all_solvable2/syn30h.py
grossmann-group/pyomo-MINLP-benchmarking
714f0a0dffd61675649a805683c0627af6b4929e
[ "MIT" ]
null
null
null
models_all_solvable2/syn30h.py
grossmann-group/pyomo-MINLP-benchmarking
714f0a0dffd61675649a805683c0627af6b4929e
[ "MIT" ]
2
2020-05-21T22:15:51.000Z
2020-06-02T23:02:08.000Z
# MINLP written by GAMS Convert at 05/15/20 00:51:25 # # Equation counts # Total E G L N X C B # 346 161 37 148 0 0 0 0 # # Variable counts # x b i s1s s2s sc si # Total cont binary integer sos1 sos2 scont sint # 229 199 30 0 0 0 0 0 # FX 0 0 0 0 0 0 0 0 # # Nonzero counts # Total const NL DLL # 795 735 60 0 # # Reformulation has removed 1 variable and 1 equation from pyomo.environ import * model = m = ConcreteModel() m.x2 = Var(within=Reals,bounds=(0,40),initialize=0) m.x3 = Var(within=Reals,bounds=(0,None),initialize=0) m.x4 = Var(within=Reals,bounds=(0,None),initialize=0) m.x5 = Var(within=Reals,bounds=(0,None),initialize=0) m.x6 = Var(within=Reals,bounds=(0,None),initialize=0) m.x7 = Var(within=Reals,bounds=(0,None),initialize=0) m.x8 = Var(within=Reals,bounds=(0,None),initialize=0) m.x9 = Var(within=Reals,bounds=(0,None),initialize=0) m.x10 = Var(within=Reals,bounds=(0,None),initialize=0) m.x11 = Var(within=Reals,bounds=(0,None),initialize=0) m.x12 = Var(within=Reals,bounds=(0,None),initialize=0) m.x13 = Var(within=Reals,bounds=(0,30),initialize=0) m.x14 = Var(within=Reals,bounds=(0,None),initialize=0) m.x15 = Var(within=Reals,bounds=(0,None),initialize=0) m.x16 = Var(within=Reals,bounds=(0,None),initialize=0) m.x17 = Var(within=Reals,bounds=(0,None),initialize=0) m.x18 = Var(within=Reals,bounds=(0,None),initialize=0) m.x19 = Var(within=Reals,bounds=(0,None),initialize=0) m.x20 = Var(within=Reals,bounds=(0,None),initialize=0) m.x21 = Var(within=Reals,bounds=(0,None),initialize=0) m.x22 = Var(within=Reals,bounds=(0,None),initialize=0) m.x23 = Var(within=Reals,bounds=(0,None),initialize=0) m.x24 = Var(within=Reals,bounds=(0,None),initialize=0) m.x25 = Var(within=Reals,bounds=(0,None),initialize=0) m.x26 = Var(within=Reals,bounds=(0,None),initialize=0) m.x27 = Var(within=Reals,bounds=(0,None),initialize=0) m.x28 = Var(within=Reals,bounds=(0,None),initialize=0) m.x29 = Var(within=Reals,bounds=(0,None),initialize=0) m.x30 = Var(within=Reals,bounds=(0,20),initialize=0) m.x31 = Var(within=Reals,bounds=(0,20),initialize=0) m.x32 = Var(within=Reals,bounds=(0,None),initialize=0) m.x33 = Var(within=Reals,bounds=(0,None),initialize=0) m.x34 = Var(within=Reals,bounds=(0,None),initialize=0) m.x35 = Var(within=Reals,bounds=(0,None),initialize=0) m.x36 = Var(within=Reals,bounds=(0,None),initialize=0) m.x37 = Var(within=Reals,bounds=(0,None),initialize=0) m.x38 = Var(within=Reals,bounds=(0,None),initialize=0) m.x39 = Var(within=Reals,bounds=(0,None),initialize=0) m.x40 = Var(within=Reals,bounds=(0,None),initialize=0) m.x41 = Var(within=Reals,bounds=(0,None),initialize=0) m.x42 = Var(within=Reals,bounds=(0,None),initialize=0) m.x43 = Var(within=Reals,bounds=(0,None),initialize=0) m.x44 = Var(within=Reals,bounds=(0,None),initialize=0) m.x45 = Var(within=Reals,bounds=(0,None),initialize=0) m.x46 = Var(within=Reals,bounds=(0,None),initialize=0) m.x47 = Var(within=Reals,bounds=(0,None),initialize=0) m.x48 = Var(within=Reals,bounds=(0,None),initialize=0) m.x49 = Var(within=Reals,bounds=(0,None),initialize=0) m.x50 = Var(within=Reals,bounds=(0,None),initialize=0) m.x51 = Var(within=Reals,bounds=(0,None),initialize=0) m.x52 = Var(within=Reals,bounds=(0,None),initialize=0) m.x53 = Var(within=Reals,bounds=(0,None),initialize=0) m.x54 = Var(within=Reals,bounds=(0,None),initialize=0) m.x55 = Var(within=Reals,bounds=(0,None),initialize=0) m.x56 = Var(within=Reals,bounds=(0,None),initialize=0) m.x57 = Var(within=Reals,bounds=(0,None),initialize=0) m.x58 = Var(within=Reals,bounds=(0,30),initialize=0) m.x59 = Var(within=Reals,bounds=(0,None),initialize=0) m.x60 = Var(within=Reals,bounds=(0,None),initialize=0) m.x61 = Var(within=Reals,bounds=(0,None),initialize=0) m.x62 = Var(within=Reals,bounds=(0,None),initialize=0) m.x63 = Var(within=Reals,bounds=(0,None),initialize=0) m.x64 = Var(within=Reals,bounds=(0,None),initialize=0) m.x65 = Var(within=Reals,bounds=(0,None),initialize=0) m.x66 = Var(within=Reals,bounds=(0,None),initialize=0) m.x67 = Var(within=Reals,bounds=(0,None),initialize=0) m.x68 = Var(within=Reals,bounds=(0,None),initialize=0) m.x69 = Var(within=Reals,bounds=(0,None),initialize=0) m.x70 = Var(within=Reals,bounds=(0,None),initialize=0) m.x71 = Var(within=Reals,bounds=(0,None),initialize=0) m.x72 = Var(within=Reals,bounds=(0,None),initialize=0) m.x73 = Var(within=Reals,bounds=(0,None),initialize=0) m.x74 = Var(within=Reals,bounds=(0,None),initialize=0) m.x75 = Var(within=Reals,bounds=(0,None),initialize=0) m.x76 = Var(within=Reals,bounds=(0,None),initialize=0) m.x77 = Var(within=Reals,bounds=(0,None),initialize=0) m.x78 = Var(within=Reals,bounds=(0,None),initialize=0) m.x79 = Var(within=Reals,bounds=(0,None),initialize=0) m.x80 = Var(within=Reals,bounds=(0,None),initialize=0) m.x81 = Var(within=Reals,bounds=(0,None),initialize=0) m.x82 = Var(within=Reals,bounds=(0,None),initialize=0) m.x83 = Var(within=Reals,bounds=(0,None),initialize=0) m.x84 = Var(within=Reals,bounds=(0,None),initialize=0) m.x85 = Var(within=Reals,bounds=(0,None),initialize=0) m.x86 = Var(within=Reals,bounds=(0,None),initialize=0) m.x87 = Var(within=Reals,bounds=(0,None),initialize=0) m.x88 = Var(within=Reals,bounds=(0,None),initialize=0) m.x89 = Var(within=Reals,bounds=(0,None),initialize=0) m.x90 = Var(within=Reals,bounds=(0,None),initialize=0) m.x91 = Var(within=Reals,bounds=(0,None),initialize=0) m.x92 = Var(within=Reals,bounds=(0,None),initialize=0) m.x93 = Var(within=Reals,bounds=(0,None),initialize=0) m.x94 = Var(within=Reals,bounds=(0,None),initialize=0) m.x95 = Var(within=Reals,bounds=(0,None),initialize=0) m.x96 = Var(within=Reals,bounds=(0,None),initialize=0) m.x97 = Var(within=Reals,bounds=(0,None),initialize=0) m.x98 = Var(within=Reals,bounds=(0,None),initialize=0) m.x99 = Var(within=Reals,bounds=(0,None),initialize=0) m.x100 = Var(within=Reals,bounds=(0,None),initialize=0) m.x101 = Var(within=Reals,bounds=(0,None),initialize=0) m.x102 = Var(within=Reals,bounds=(0,None),initialize=0) m.x103 = Var(within=Reals,bounds=(0,None),initialize=0) m.x104 = Var(within=Reals,bounds=(0,None),initialize=0) m.x105 = Var(within=Reals,bounds=(0,None),initialize=0) m.x106 = Var(within=Reals,bounds=(0,None),initialize=0) m.x107 = Var(within=Reals,bounds=(0,None),initialize=0) m.x108 = Var(within=Reals,bounds=(0,None),initialize=0) m.x109 = Var(within=Reals,bounds=(0,None),initialize=0) m.x110 = Var(within=Reals,bounds=(0,None),initialize=0) m.x111 = Var(within=Reals,bounds=(0,None),initialize=0) m.x112 = Var(within=Reals,bounds=(0,None),initialize=0) m.x113 = Var(within=Reals,bounds=(0,None),initialize=0) m.x114 = Var(within=Reals,bounds=(0,None),initialize=0) m.x115 = Var(within=Reals,bounds=(0,None),initialize=0) m.x116 = Var(within=Reals,bounds=(0,None),initialize=0) m.x117 = Var(within=Reals,bounds=(0,None),initialize=0) m.x118 = Var(within=Reals,bounds=(0,None),initialize=0) m.x119 = Var(within=Reals,bounds=(0,None),initialize=0) m.x120 = Var(within=Reals,bounds=(0,None),initialize=0) m.x121 = Var(within=Reals,bounds=(0,None),initialize=0) m.x122 = Var(within=Reals,bounds=(0,None),initialize=0) m.x123 = Var(within=Reals,bounds=(0,None),initialize=0) m.x124 = Var(within=Reals,bounds=(0,None),initialize=0) m.x125 = Var(within=Reals,bounds=(0,None),initialize=0) m.x126 = Var(within=Reals,bounds=(0,None),initialize=0) m.x127 = Var(within=Reals,bounds=(0,None),initialize=0) m.x128 = Var(within=Reals,bounds=(0,None),initialize=0) m.x129 = Var(within=Reals,bounds=(0,None),initialize=0) m.x130 = Var(within=Reals,bounds=(0,None),initialize=0) m.x131 = Var(within=Reals,bounds=(0,None),initialize=0) m.x132 = Var(within=Reals,bounds=(0,None),initialize=0) m.x133 = Var(within=Reals,bounds=(0,None),initialize=0) m.x134 = Var(within=Reals,bounds=(0,None),initialize=0) m.x135 = Var(within=Reals,bounds=(0,None),initialize=0) m.x136 = Var(within=Reals,bounds=(0,None),initialize=0) m.x137 = Var(within=Reals,bounds=(0,None),initialize=0) m.x138 = Var(within=Reals,bounds=(0,None),initialize=0) m.x139 = Var(within=Reals,bounds=(0,None),initialize=0) m.x140 = Var(within=Reals,bounds=(0,None),initialize=0) m.x141 = Var(within=Reals,bounds=(0,None),initialize=0) m.x142 = Var(within=Reals,bounds=(0,None),initialize=0) m.x143 = Var(within=Reals,bounds=(0,None),initialize=0) m.x144 = Var(within=Reals,bounds=(0,None),initialize=0) m.x145 = Var(within=Reals,bounds=(0,None),initialize=0) m.x146 = Var(within=Reals,bounds=(0,None),initialize=0) m.x147 = Var(within=Reals,bounds=(0,None),initialize=0) m.x148 = Var(within=Reals,bounds=(0,None),initialize=0) m.x149 = Var(within=Reals,bounds=(0,None),initialize=0) m.x150 = Var(within=Reals,bounds=(0,None),initialize=0) m.x151 = Var(within=Reals,bounds=(0,None),initialize=0) m.x152 = Var(within=Reals,bounds=(0,None),initialize=0) m.x153 = Var(within=Reals,bounds=(0,None),initialize=0) m.x154 = Var(within=Reals,bounds=(0,None),initialize=0) m.x155 = Var(within=Reals,bounds=(0,None),initialize=0) m.x156 = Var(within=Reals,bounds=(0,None),initialize=0) m.x157 = Var(within=Reals,bounds=(0,None),initialize=0) m.x158 = Var(within=Reals,bounds=(0,None),initialize=0) m.x159 = Var(within=Reals,bounds=(0,None),initialize=0) m.x160 = Var(within=Reals,bounds=(0,None),initialize=0) m.x161 = Var(within=Reals,bounds=(0,None),initialize=0) m.x162 = Var(within=Reals,bounds=(0,None),initialize=0) m.x163 = Var(within=Reals,bounds=(0,None),initialize=0) m.x164 = Var(within=Reals,bounds=(0,None),initialize=0) m.x165 = Var(within=Reals,bounds=(0,None),initialize=0) m.x166 = Var(within=Reals,bounds=(0,None),initialize=0) m.x167 = Var(within=Reals,bounds=(0,None),initialize=0) m.x168 = Var(within=Reals,bounds=(0,None),initialize=0) m.x169 = Var(within=Reals,bounds=(0,None),initialize=0) m.x170 = Var(within=Reals,bounds=(0,None),initialize=0) m.x171 = Var(within=Reals,bounds=(0,None),initialize=0) m.x172 = Var(within=Reals,bounds=(0,None),initialize=0) m.x173 = Var(within=Reals,bounds=(0,None),initialize=0) m.x174 = Var(within=Reals,bounds=(0,None),initialize=0) m.x175 = Var(within=Reals,bounds=(0,None),initialize=0) m.x176 = Var(within=Reals,bounds=(0,None),initialize=0) m.x177 = Var(within=Reals,bounds=(0,None),initialize=0) m.x178 = Var(within=Reals,bounds=(0,None),initialize=0) m.x179 = Var(within=Reals,bounds=(0,None),initialize=0) m.x180 = Var(within=Reals,bounds=(0,None),initialize=0) m.x181 = Var(within=Reals,bounds=(0,None),initialize=0) m.x182 = Var(within=Reals,bounds=(0,None),initialize=0) m.x183 = Var(within=Reals,bounds=(0,None),initialize=0) m.x184 = Var(within=Reals,bounds=(0,None),initialize=0) m.x185 = Var(within=Reals,bounds=(0,None),initialize=0) m.x186 = Var(within=Reals,bounds=(0,None),initialize=0) m.x187 = Var(within=Reals,bounds=(0,None),initialize=0) m.x188 = Var(within=Reals,bounds=(0,None),initialize=0) m.x189 = Var(within=Reals,bounds=(0,None),initialize=0) m.x190 = Var(within=Reals,bounds=(0,None),initialize=0) m.x191 = Var(within=Reals,bounds=(0,None),initialize=0) m.x192 = Var(within=Reals,bounds=(0,None),initialize=0) m.x193 = Var(within=Reals,bounds=(0,None),initialize=0) m.x194 = Var(within=Reals,bounds=(0,None),initialize=0) m.x195 = Var(within=Reals,bounds=(0,None),initialize=0) m.x196 = Var(within=Reals,bounds=(0,None),initialize=0) m.x197 = Var(within=Reals,bounds=(0,None),initialize=0) m.x198 = Var(within=Reals,bounds=(0,None),initialize=0) m.x199 = Var(within=Reals,bounds=(0,None),initialize=0) m.b200 = Var(within=Binary,bounds=(0,1),initialize=0) m.b201 = Var(within=Binary,bounds=(0,1),initialize=0) m.b202 = Var(within=Binary,bounds=(0,1),initialize=0) m.b203 = Var(within=Binary,bounds=(0,1),initialize=0) m.b204 = Var(within=Binary,bounds=(0,1),initialize=0) m.b205 = Var(within=Binary,bounds=(0,1),initialize=0) m.b206 = Var(within=Binary,bounds=(0,1),initialize=0) m.b207 = Var(within=Binary,bounds=(0,1),initialize=0) m.b208 = Var(within=Binary,bounds=(0,1),initialize=0) m.b209 = Var(within=Binary,bounds=(0,1),initialize=0) m.b210 = Var(within=Binary,bounds=(0,1),initialize=0) m.b211 = Var(within=Binary,bounds=(0,1),initialize=0) m.b212 = Var(within=Binary,bounds=(0,1),initialize=0) m.b213 = Var(within=Binary,bounds=(0,1),initialize=0) m.b214 = Var(within=Binary,bounds=(0,1),initialize=0) m.b215 = Var(within=Binary,bounds=(0,1),initialize=0) m.b216 = Var(within=Binary,bounds=(0,1),initialize=0) m.b217 = Var(within=Binary,bounds=(0,1),initialize=0) m.b218 = Var(within=Binary,bounds=(0,1),initialize=0) m.b219 = Var(within=Binary,bounds=(0,1),initialize=0) m.b220 = Var(within=Binary,bounds=(0,1),initialize=0) m.b221 = Var(within=Binary,bounds=(0,1),initialize=0) m.b222 = Var(within=Binary,bounds=(0,1),initialize=0) m.b223 = Var(within=Binary,bounds=(0,1),initialize=0) m.b224 = Var(within=Binary,bounds=(0,1),initialize=0) m.b225 = Var(within=Binary,bounds=(0,1),initialize=0) m.b226 = Var(within=Binary,bounds=(0,1),initialize=0) m.b227 = Var(within=Binary,bounds=(0,1),initialize=0) m.b228 = Var(within=Binary,bounds=(0,1),initialize=0) m.b229 = Var(within=Binary,bounds=(0,1),initialize=0) m.obj = Objective(expr= - m.x2 + 5*m.x8 - 2*m.x13 - 10*m.x30 - 5*m.x31 + 40*m.x38 + 15*m.x39 + 10*m.x40 + 30*m.x41 + 35*m.x42 + 20*m.x43 + 25*m.x44 + 15*m.x45 + 30*m.x53 - m.x58 + 80*m.x66 + 285*m.x67 + 290*m.x68 + 280*m.x69 + 290*m.x70 + 350*m.x71 - 5*m.b200 - 8*m.b201 - 6*m.b202 - 10*m.b203 - 6*m.b204 - 7*m.b205 - 4*m.b206 - 5*m.b207 - 2*m.b208 - 4*m.b209 - 3*m.b210 - 7*m.b211 - 3*m.b212 - 2*m.b213 - 4*m.b214 - 2*m.b215 - 3*m.b216 - 5*m.b217 - 2*m.b218 - m.b219 - 2*m.b220 - 9*m.b221 - 5*m.b222 - 2*m.b223 - 10*m.b224 - 4*m.b225 - 7*m.b226 - 4*m.b227 - 2*m.b228 - 8*m.b229, sense=maximize) m.c2 = Constraint(expr= m.x2 - m.x3 - m.x4 == 0) m.c3 = Constraint(expr= - m.x5 - m.x6 + m.x7 == 0) m.c4 = Constraint(expr= m.x7 - m.x8 - m.x9 == 0) m.c5 = Constraint(expr= m.x9 - m.x10 - m.x11 - m.x12 == 0) m.c6 = Constraint(expr= m.x14 - m.x17 - m.x18 == 0) m.c7 = Constraint(expr= m.x16 - m.x19 - m.x20 - m.x21 == 0) m.c8 = Constraint(expr= m.x24 - m.x28 - m.x29 == 0) m.c9 = Constraint(expr= - m.x25 - m.x31 + m.x32 == 0) m.c10 = Constraint(expr= m.x26 - m.x33 - m.x34 == 0) m.c11 = Constraint(expr= m.x27 - m.x35 - m.x36 - m.x37 == 0) m.c12 = Constraint(expr= m.x46 - m.x47 == 0) m.c13 = Constraint(expr= m.x47 - m.x48 - m.x49 == 0) m.c14 = Constraint(expr= - m.x50 - m.x51 + m.x52 == 0) m.c15 = Constraint(expr= m.x52 - m.x53 - m.x54 == 0) m.c16 = Constraint(expr= m.x54 - m.x55 - m.x56 - m.x57 == 0) m.c17 = Constraint(expr= m.x59 - m.x62 - m.x63 == 0) m.c18 = Constraint(expr= m.x61 - m.x64 - m.x65 - m.x66 == 0) m.c19 = Constraint(expr=(m.x76/(1e-6 + m.b200) - log(1 + m.x72/(1e-6 + m.b200)))*(1e-6 + m.b200) <= 0) m.c20 = Constraint(expr= m.x73 == 0) m.c21 = Constraint(expr= m.x77 == 0) m.c22 = Constraint(expr= m.x3 - m.x72 - m.x73 == 0) m.c23 = Constraint(expr= m.x5 - m.x76 - m.x77 == 0) m.c24 = Constraint(expr= m.x72 - 40*m.b200 <= 0) m.c25 = Constraint(expr= m.x73 + 40*m.b200 <= 40) m.c26 = Constraint(expr= m.x76 - 3.71357206670431*m.b200 <= 0) m.c27 = Constraint(expr= m.x77 + 3.71357206670431*m.b200 <= 3.71357206670431) m.c28 = Constraint(expr=(m.x78/(1e-6 + m.b201) - 1.2*log(1 + m.x74/(1e-6 + m.b201)))*(1e-6 + m.b201) <= 0) m.c29 = Constraint(expr= m.x75 == 0) m.c30 = Constraint(expr= m.x79 == 0) m.c31 = Constraint(expr= m.x4 - m.x74 - m.x75 == 0) m.c32 = Constraint(expr= m.x6 - m.x78 - m.x79 == 0) m.c33 = Constraint(expr= m.x74 - 40*m.b201 <= 0) m.c34 = Constraint(expr= m.x75 + 40*m.b201 <= 40) m.c35 = Constraint(expr= m.x78 - 4.45628648004517*m.b201 <= 0) m.c36 = Constraint(expr= m.x79 + 4.45628648004517*m.b201 <= 4.45628648004517) m.c37 = Constraint(expr= - 0.75*m.x80 + m.x88 == 0) m.c38 = Constraint(expr= m.x81 == 0) m.c39 = Constraint(expr= m.x89 == 0) m.c40 = Constraint(expr= m.x10 - m.x80 - m.x81 == 0) m.c41 = Constraint(expr= m.x14 - m.x88 - m.x89 == 0) m.c42 = Constraint(expr= m.x80 - 4.45628648004517*m.b202 <= 0) m.c43 = Constraint(expr= m.x81 + 4.45628648004517*m.b202 <= 4.45628648004517) m.c44 = Constraint(expr= m.x88 - 3.34221486003388*m.b202 <= 0) m.c45 = Constraint(expr= m.x89 + 3.34221486003388*m.b202 <= 3.34221486003388) m.c46 = Constraint(expr=(m.x90/(1e-6 + m.b203) - 1.5*log(1 + m.x82/(1e-6 + m.b203)))*(1e-6 + m.b203) <= 0) m.c47 = Constraint(expr= m.x83 == 0) m.c48 = Constraint(expr= m.x92 == 0) m.c49 = Constraint(expr= m.x11 - m.x82 - m.x83 == 0) m.c50 = Constraint(expr= m.x15 - m.x90 - m.x92 == 0) m.c51 = Constraint(expr= m.x82 - 4.45628648004517*m.b203 <= 0) m.c52 = Constraint(expr= m.x83 + 4.45628648004517*m.b203 <= 4.45628648004517) m.c53 = Constraint(expr= m.x90 - 2.54515263975353*m.b203 <= 0) m.c54 = Constraint(expr= m.x92 + 2.54515263975353*m.b203 <= 2.54515263975353) m.c55 = Constraint(expr= - m.x84 + m.x94 == 0) m.c56 = Constraint(expr= - 0.5*m.x86 + m.x94 == 0) m.c57 = Constraint(expr= m.x85 == 0) m.c58 = Constraint(expr= m.x87 == 0) m.c59 = Constraint(expr= m.x95 == 0) m.c60 = Constraint(expr= m.x12 - m.x84 - m.x85 == 0) m.c61 = Constraint(expr= m.x13 - m.x86 - m.x87 == 0) m.c62 = Constraint(expr= m.x16 - m.x94 - m.x95 == 0) m.c63 = Constraint(expr= m.x84 - 4.45628648004517*m.b204 <= 0) m.c64 = Constraint(expr= m.x85 + 4.45628648004517*m.b204 <= 4.45628648004517) m.c65 = Constraint(expr= m.x86 - 30*m.b204 <= 0) m.c66 = Constraint(expr= m.x87 + 30*m.b204 <= 30) m.c67 = Constraint(expr= m.x94 - 15*m.b204 <= 0) m.c68 = Constraint(expr= m.x95 + 15*m.b204 <= 15) m.c69 = Constraint(expr=(m.x106/(1e-6 + m.b205) - 1.25*log(1 + m.x96/(1e-6 + m.b205)))*(1e-6 + m.b205) <= 0) m.c70 = Constraint(expr= m.x97 == 0) m.c71 = Constraint(expr= m.x108 == 0) m.c72 = Constraint(expr= m.x17 - m.x96 - m.x97 == 0) m.c73 = Constraint(expr= m.x22 - m.x106 - m.x108 == 0) m.c74 = Constraint(expr= m.x96 - 3.34221486003388*m.b205 <= 0) m.c75 = Constraint(expr= m.x97 + 3.34221486003388*m.b205 <= 3.34221486003388) m.c76 = Constraint(expr= m.x106 - 1.83548069293539*m.b205 <= 0) m.c77 = Constraint(expr= m.x108 + 1.83548069293539*m.b205 <= 1.83548069293539) m.c78 = Constraint(expr=(m.x110/(1e-6 + m.b206) - 0.9*log(1 + m.x98/(1e-6 + m.b206)))*(1e-6 + m.b206) <= 0) m.c79 = Constraint(expr= m.x99 == 0) m.c80 = Constraint(expr= m.x112 == 0) m.c81 = Constraint(expr= m.x18 - m.x98 - m.x99 == 0) m.c82 = Constraint(expr= m.x23 - m.x110 - m.x112 == 0) m.c83 = Constraint(expr= m.x98 - 3.34221486003388*m.b206 <= 0) m.c84 = Constraint(expr= m.x99 + 3.34221486003388*m.b206 <= 3.34221486003388) m.c85 = Constraint(expr= m.x110 - 1.32154609891348*m.b206 <= 0) m.c86 = Constraint(expr= m.x112 + 1.32154609891348*m.b206 <= 1.32154609891348) m.c87 = Constraint(expr=(m.x114/(1e-6 + m.b207) - log(1 + m.x91/(1e-6 + m.b207)))*(1e-6 + m.b207) <= 0) m.c88 = Constraint(expr= m.x93 == 0) m.c89 = Constraint(expr= m.x115 == 0) m.c90 = Constraint(expr= m.x15 - m.x91 - m.x93 == 0) m.c91 = Constraint(expr= m.x24 - m.x114 - m.x115 == 0) m.c92 = Constraint(expr= m.x91 - 2.54515263975353*m.b207 <= 0) m.c93 = Constraint(expr= m.x93 + 2.54515263975353*m.b207 <= 2.54515263975353) m.c94 = Constraint(expr= m.x114 - 1.26558121681553*m.b207 <= 0) m.c95 = Constraint(expr= m.x115 + 1.26558121681553*m.b207 <= 1.26558121681553) m.c96 = Constraint(expr= - 0.9*m.x100 + m.x116 == 0) m.c97 = Constraint(expr= m.x101 == 0) m.c98 = Constraint(expr= m.x117 == 0) m.c99 = Constraint(expr= m.x19 - m.x100 - m.x101 == 0) m.c100 = Constraint(expr= m.x25 - m.x116 - m.x117 == 0) m.c101 = Constraint(expr= m.x100 - 15*m.b208 <= 0) m.c102 = Constraint(expr= m.x101 + 15*m.b208 <= 15) m.c103 = Constraint(expr= m.x116 - 13.5*m.b208 <= 0) m.c104 = Constraint(expr= m.x117 + 13.5*m.b208 <= 13.5) m.c105 = Constraint(expr= - 0.6*m.x102 + m.x118 == 0) m.c106 = Constraint(expr= m.x103 == 0) m.c107 = Constraint(expr= m.x119 == 0) m.c108 = Constraint(expr= m.x20 - m.x102 - m.x103 == 0) m.c109 = Constraint(expr= m.x26 - m.x118 - m.x119 == 0) m.c110 = Constraint(expr= m.x102 - 15*m.b209 <= 0) m.c111 = Constraint(expr= m.x103 + 15*m.b209 <= 15) m.c112 = Constraint(expr= m.x118 - 9*m.b209 <= 0) m.c113 = Constraint(expr= m.x119 + 9*m.b209 <= 9) m.c114 = Constraint(expr=(m.x120/(1e-6 + m.b210) - 1.1*log(1 + m.x104/(1e-6 + m.b210)))*(1e-6 + m.b210) <= 0) m.c115 = Constraint(expr= m.x105 == 0) m.c116 = Constraint(expr= m.x121 == 0) m.c117 = Constraint(expr= m.x21 - m.x104 - m.x105 == 0) m.c118 = Constraint(expr= m.x27 - m.x120 - m.x121 == 0) m.c119 = Constraint(expr= m.x104 - 15*m.b210 <= 0) m.c120 = Constraint(expr= m.x105 + 15*m.b210 <= 15) m.c121 = Constraint(expr= m.x120 - 3.04984759446376*m.b210 <= 0) m.c122 = Constraint(expr= m.x121 + 3.04984759446376*m.b210 <= 3.04984759446376) m.c123 = Constraint(expr= - 0.9*m.x107 + m.x140 == 0) m.c124 = Constraint(expr= - m.x126 + m.x140 == 0) m.c125 = Constraint(expr= m.x109 == 0) m.c126 = Constraint(expr= m.x127 == 0) m.c127 = Constraint(expr= m.x141 == 0) m.c128 = Constraint(expr= m.x22 - m.x107 - m.x109 == 0) m.c129 = Constraint(expr= m.x30 - m.x126 - m.x127 == 0) m.c130 = Constraint(expr= m.x38 - m.x140 - m.x141 == 0) m.c131 = Constraint(expr= m.x107 - 1.83548069293539*m.b211 <= 0) m.c132 = Constraint(expr= m.x109 + 1.83548069293539*m.b211 <= 1.83548069293539) m.c133 = Constraint(expr= m.x126 - 20*m.b211 <= 0) m.c134 = Constraint(expr= m.x127 + 20*m.b211 <= 20) m.c135 = Constraint(expr= m.x140 - 20*m.b211 <= 0) m.c136 = Constraint(expr= m.x141 + 20*m.b211 <= 20) m.c137 = Constraint(expr=(m.x142/(1e-6 + m.b212) - log(1 + m.x111/(1e-6 + m.b212)))*(1e-6 + m.b212) <= 0) m.c138 = Constraint(expr= m.x113 == 0) m.c139 = Constraint(expr= m.x143 == 0) m.c140 = Constraint(expr= m.x23 - m.x111 - m.x113 == 0) m.c141 = Constraint(expr= m.x39 - m.x142 - m.x143 == 0) m.c142 = Constraint(expr= m.x111 - 1.32154609891348*m.b212 <= 0) m.c143 = Constraint(expr= m.x113 + 1.32154609891348*m.b212 <= 1.32154609891348) m.c144 = Constraint(expr= m.x142 - 0.842233385663186*m.b212 <= 0) m.c145 = Constraint(expr= m.x143 + 0.842233385663186*m.b212 <= 0.842233385663186) m.c146 = Constraint(expr=(m.x144/(1e-6 + m.b213) - 0.7*log(1 + m.x122/(1e-6 + m.b213)))*(1e-6 + m.b213) <= 0) m.c147 = Constraint(expr= m.x123 == 0) m.c148 = Constraint(expr= m.x145 == 0) m.c149 = Constraint(expr= m.x28 - m.x122 - m.x123 == 0) m.c150 = Constraint(expr= m.x40 - m.x144 - m.x145 == 0) m.c151 = Constraint(expr= m.x122 - 1.26558121681553*m.b213 <= 0) m.c152 = Constraint(expr= m.x123 + 1.26558121681553*m.b213 <= 1.26558121681553) m.c153 = Constraint(expr= m.x144 - 0.572481933717686*m.b213 <= 0) m.c154 = Constraint(expr= m.x145 + 0.572481933717686*m.b213 <= 0.572481933717686) m.c155 = Constraint(expr=(m.x146/(1e-6 + m.b214) - 0.65*log(1 + m.x124/(1e-6 + m.b214)))*(1e-6 + m.b214) <= 0) m.c156 = Constraint(expr=(m.x146/(1e-6 + m.b214) - 0.65*log(1 + m.x128/(1e-6 + m.b214)))*(1e-6 + m.b214) <= 0) m.c157 = Constraint(expr= m.x125 == 0) m.c158 = Constraint(expr= m.x129 == 0) m.c159 = Constraint(expr= m.x147 == 0) m.c160 = Constraint(expr= m.x29 - m.x124 - m.x125 == 0) m.c161 = Constraint(expr= m.x32 - m.x128 - m.x129 == 0) m.c162 = Constraint(expr= m.x41 - m.x146 - m.x147 == 0) m.c163 = Constraint(expr= m.x124 - 1.26558121681553*m.b214 <= 0) m.c164 = Constraint(expr= m.x125 + 1.26558121681553*m.b214 <= 1.26558121681553) m.c165 = Constraint(expr= m.x128 - 33.5*m.b214 <= 0) m.c166 = Constraint(expr= m.x129 + 33.5*m.b214 <= 33.5) m.c167 = Constraint(expr= m.x146 - 2.30162356062425*m.b214 <= 0) m.c168 = Constraint(expr= m.x147 + 2.30162356062425*m.b214 <= 2.30162356062425) m.c169 = Constraint(expr= - m.x130 + m.x148 == 0) m.c170 = Constraint(expr= m.x131 == 0) m.c171 = Constraint(expr= m.x149 == 0) m.c172 = Constraint(expr= m.x33 - m.x130 - m.x131 == 0) m.c173 = Constraint(expr= m.x42 - m.x148 - m.x149 == 0) m.c174 = Constraint(expr= m.x130 - 9*m.b215 <= 0) m.c175 = Constraint(expr= m.x131 + 9*m.b215 <= 9) m.c176 = Constraint(expr= m.x148 - 9*m.b215 <= 0) m.c177 = Constraint(expr= m.x149 + 9*m.b215 <= 9) m.c178 = Constraint(expr= - m.x132 + m.x150 == 0) m.c179 = Constraint(expr= m.x133 == 0) m.c180 = Constraint(expr= m.x151 == 0) m.c181 = Constraint(expr= m.x34 - m.x132 - m.x133 == 0) m.c182 = Constraint(expr= m.x43 - m.x150 - m.x151 == 0) m.c183 = Constraint(expr= m.x132 - 9*m.b216 <= 0) m.c184 = Constraint(expr= m.x133 + 9*m.b216 <= 9) m.c185 = Constraint(expr= m.x150 - 9*m.b216 <= 0) m.c186 = Constraint(expr= m.x151 + 9*m.b216 <= 9) m.c187 = Constraint(expr=(m.x152/(1e-6 + m.b217) - 0.75*log(1 + m.x134/(1e-6 + m.b217)))*(1e-6 + m.b217) <= 0) m.c188 = Constraint(expr= m.x135 == 0) m.c189 = Constraint(expr= m.x153 == 0) m.c190 = Constraint(expr= m.x35 - m.x134 - m.x135 == 0) m.c191 = Constraint(expr= m.x44 - m.x152 - m.x153 == 0) m.c192 = Constraint(expr= m.x134 - 3.04984759446376*m.b217 <= 0) m.c193 = Constraint(expr= m.x135 + 3.04984759446376*m.b217 <= 3.04984759446376) m.c194 = Constraint(expr= m.x152 - 1.04900943706034*m.b217 <= 0) m.c195 = Constraint(expr= m.x153 + 1.04900943706034*m.b217 <= 1.04900943706034) m.c196 = Constraint(expr=(m.x154/(1e-6 + m.b218) - 0.8*log(1 + m.x136/(1e-6 + m.b218)))*(1e-6 + m.b218) <= 0) m.c197 = Constraint(expr= m.x137 == 0) m.c198 = Constraint(expr= m.x155 == 0) m.c199 = Constraint(expr= m.x36 - m.x136 - m.x137 == 0) m.c200 = Constraint(expr= m.x45 - m.x154 - m.x155 == 0) m.c201 = Constraint(expr= m.x136 - 3.04984759446376*m.b218 <= 0) m.c202 = Constraint(expr= m.x137 + 3.04984759446376*m.b218 <= 3.04984759446376) m.c203 = Constraint(expr= m.x154 - 1.11894339953103*m.b218 <= 0) m.c204 = Constraint(expr= m.x155 + 1.11894339953103*m.b218 <= 1.11894339953103) m.c205 = Constraint(expr=(m.x156/(1e-6 + m.b219) - 0.85*log(1 + m.x138/(1e-6 + m.b219)))*(1e-6 + m.b219) <= 0) m.c206 = Constraint(expr= m.x139 == 0) m.c207 = Constraint(expr= m.x157 == 0) m.c208 = Constraint(expr= m.x37 - m.x138 - m.x139 == 0) m.c209 = Constraint(expr= m.x46 - m.x156 - m.x157 == 0) m.c210 = Constraint(expr= m.x138 - 3.04984759446376*m.b219 <= 0) m.c211 = Constraint(expr= m.x139 + 3.04984759446376*m.b219 <= 3.04984759446376) m.c212 = Constraint(expr= m.x156 - 1.18887736200171*m.b219 <= 0) m.c213 = Constraint(expr= m.x157 + 1.18887736200171*m.b219 <= 1.18887736200171) m.c214 = Constraint(expr=(m.x162/(1e-6 + m.b220) - log(1 + m.x158/(1e-6 + m.b220)))*(1e-6 + m.b220) <= 0) m.c215 = Constraint(expr= m.x159 == 0) m.c216 = Constraint(expr= m.x163 == 0) m.c217 = Constraint(expr= m.x48 - m.x158 - m.x159 == 0) m.c218 = Constraint(expr= m.x50 - m.x162 - m.x163 == 0) m.c219 = Constraint(expr= m.x158 - 1.18887736200171*m.b220 <= 0) m.c220 = Constraint(expr= m.x159 + 1.18887736200171*m.b220 <= 1.18887736200171) m.c221 = Constraint(expr= m.x162 - 0.78338879230327*m.b220 <= 0) m.c222 = Constraint(expr= m.x163 + 0.78338879230327*m.b220 <= 0.78338879230327) m.c223 = Constraint(expr=(m.x164/(1e-6 + m.b221) - 1.2*log(1 + m.x160/(1e-6 + m.b221)))*(1e-6 + m.b221) <= 0) m.c224 = Constraint(expr= m.x161 == 0) m.c225 = Constraint(expr= m.x165 == 0) m.c226 = Constraint(expr= m.x49 - m.x160 - m.x161 == 0) m.c227 = Constraint(expr= m.x51 - m.x164 - m.x165 == 0) m.c228 = Constraint(expr= m.x160 - 1.18887736200171*m.b221 <= 0) m.c229 = Constraint(expr= m.x161 + 1.18887736200171*m.b221 <= 1.18887736200171) m.c230 = Constraint(expr= m.x164 - 0.940066550763924*m.b221 <= 0) m.c231 = Constraint(expr= m.x165 + 0.940066550763924*m.b221 <= 0.940066550763924) m.c232 = Constraint(expr= - 0.75*m.x166 + m.x174 == 0) m.c233 = Constraint(expr= m.x167 == 0) m.c234 = Constraint(expr= m.x175 == 0) m.c235 = Constraint(expr= m.x55 - m.x166 - m.x167 == 0) m.c236 = Constraint(expr= m.x59 - m.x174 - m.x175 == 0) m.c237 = Constraint(expr= m.x166 - 0.940066550763924*m.b222 <= 0) m.c238 = Constraint(expr= m.x167 + 0.940066550763924*m.b222 <= 0.940066550763924) m.c239 = Constraint(expr= m.x174 - 0.705049913072943*m.b222 <= 0) m.c240 = Constraint(expr= m.x175 + 0.705049913072943*m.b222 <= 0.705049913072943) m.c241 = Constraint(expr=(m.x176/(1e-6 + m.b223) - 1.5*log(1 + m.x168/(1e-6 + m.b223)))*(1e-6 + m.b223) <= 0) m.c242 = Constraint(expr= m.x169 == 0) m.c243 = Constraint(expr= m.x178 == 0) m.c244 = Constraint(expr= m.x56 - m.x168 - m.x169 == 0) m.c245 = Constraint(expr= m.x60 - m.x176 - m.x178 == 0) m.c246 = Constraint(expr= m.x168 - 0.940066550763924*m.b223 <= 0) m.c247 = Constraint(expr= m.x169 + 0.940066550763924*m.b223 <= 0.940066550763924) m.c248 = Constraint(expr= m.x176 - 0.994083415506506*m.b223 <= 0) m.c249 = Constraint(expr= m.x178 + 0.994083415506506*m.b223 <= 0.994083415506506) m.c250 = Constraint(expr= - m.x170 + m.x180 == 0) m.c251 = Constraint(expr= - 0.5*m.x172 + m.x180 == 0) m.c252 = Constraint(expr= m.x171 == 0) m.c253 = Constraint(expr= m.x173 == 0) m.c254 = Constraint(expr= m.x181 == 0) m.c255 = Constraint(expr= m.x57 - m.x170 - m.x171 == 0) m.c256 = Constraint(expr= m.x58 - m.x172 - m.x173 == 0) m.c257 = Constraint(expr= m.x61 - m.x180 - m.x181 == 0) m.c258 = Constraint(expr= m.x170 - 0.940066550763924*m.b224 <= 0) m.c259 = Constraint(expr= m.x171 + 0.940066550763924*m.b224 <= 0.940066550763924) m.c260 = Constraint(expr= m.x172 - 30*m.b224 <= 0) m.c261 = Constraint(expr= m.x173 + 30*m.b224 <= 30) m.c262 = Constraint(expr= m.x180 - 15*m.b224 <= 0) m.c263 = Constraint(expr= m.x181 + 15*m.b224 <= 15) m.c264 = Constraint(expr=(m.x190/(1e-6 + m.b225) - 1.25*log(1 + m.x182/(1e-6 + m.b225)))*(1e-6 + m.b225) <= 0) m.c265 = Constraint(expr= m.x183 == 0) m.c266 = Constraint(expr= m.x191 == 0) m.c267 = Constraint(expr= m.x62 - m.x182 - m.x183 == 0) m.c268 = Constraint(expr= m.x67 - m.x190 - m.x191 == 0) m.c269 = Constraint(expr= m.x182 - 0.705049913072943*m.b225 <= 0) m.c270 = Constraint(expr= m.x183 + 0.705049913072943*m.b225 <= 0.705049913072943) m.c271 = Constraint(expr= m.x190 - 0.666992981045719*m.b225 <= 0) m.c272 = Constraint(expr= m.x191 + 0.666992981045719*m.b225 <= 0.666992981045719) m.c273 = Constraint(expr=(m.x192/(1e-6 + m.b226) - 0.9*log(1 + m.x184/(1e-6 + m.b226)))*(1e-6 + m.b226) <= 0) m.c274 = Constraint(expr= m.x185 == 0) m.c275 = Constraint(expr= m.x193 == 0) m.c276 = Constraint(expr= m.x63 - m.x184 - m.x185 == 0) m.c277 = Constraint(expr= m.x68 - m.x192 - m.x193 == 0) m.c278 = Constraint(expr= m.x184 - 0.705049913072943*m.b226 <= 0) m.c279 = Constraint(expr= m.x185 + 0.705049913072943*m.b226 <= 0.705049913072943) m.c280 = Constraint(expr= m.x192 - 0.480234946352917*m.b226 <= 0) m.c281 = Constraint(expr= m.x193 + 0.480234946352917*m.b226 <= 0.480234946352917) m.c282 = Constraint(expr=(m.x194/(1e-6 + m.b227) - log(1 + m.x177/(1e-6 + m.b227)))*(1e-6 + m.b227) <= 0) m.c283 = Constraint(expr= m.x179 == 0) m.c284 = Constraint(expr= m.x195 == 0) m.c285 = Constraint(expr= m.x60 - m.x177 - m.x179 == 0) m.c286 = Constraint(expr= m.x69 - m.x194 - m.x195 == 0) m.c287 = Constraint(expr= m.x177 - 0.994083415506506*m.b227 <= 0) m.c288 = Constraint(expr= m.x179 + 0.994083415506506*m.b227 <= 0.994083415506506) m.c289 = Constraint(expr= m.x194 - 0.690184503917672*m.b227 <= 0) m.c290 = Constraint(expr= m.x195 + 0.690184503917672*m.b227 <= 0.690184503917672) m.c291 = Constraint(expr= - 0.9*m.x186 + m.x196 == 0) m.c292 = Constraint(expr= m.x187 == 0) m.c293 = Constraint(expr= m.x197 == 0) m.c294 = Constraint(expr= m.x64 - m.x186 - m.x187 == 0) m.c295 = Constraint(expr= m.x70 - m.x196 - m.x197 == 0) m.c296 = Constraint(expr= m.x186 - 15*m.b228 <= 0) m.c297 = Constraint(expr= m.x187 + 15*m.b228 <= 15) m.c298 = Constraint(expr= m.x196 - 13.5*m.b228 <= 0) m.c299 = Constraint(expr= m.x197 + 13.5*m.b228 <= 13.5) m.c300 = Constraint(expr= - 0.6*m.x188 + m.x198 == 0) m.c301 = Constraint(expr= m.x189 == 0) m.c302 = Constraint(expr= m.x199 == 0) m.c303 = Constraint(expr= m.x65 - m.x188 - m.x189 == 0) m.c304 = Constraint(expr= m.x71 - m.x198 - m.x199 == 0) m.c305 = Constraint(expr= m.x188 - 15*m.b229 <= 0) m.c306 = Constraint(expr= m.x189 + 15*m.b229 <= 15) m.c307 = Constraint(expr= m.x198 - 9*m.b229 <= 0) m.c308 = Constraint(expr= m.x199 + 9*m.b229 <= 9) m.c309 = Constraint(expr= m.b200 + m.b201 == 1) m.c310 = Constraint(expr= - m.b202 + m.b205 + m.b206 >= 0) m.c311 = Constraint(expr= - m.b205 + m.b211 >= 0) m.c312 = Constraint(expr= - m.b206 + m.b212 >= 0) m.c313 = Constraint(expr= - m.b203 + m.b207 >= 0) m.c314 = Constraint(expr= - m.b207 + m.b213 + m.b214 >= 0) m.c315 = Constraint(expr= - m.b204 + m.b208 + m.b209 + m.b210 >= 0) m.c316 = Constraint(expr= - m.b208 + m.b214 >= 0) m.c317 = Constraint(expr= - m.b209 + m.b215 + m.b216 >= 0) m.c318 = Constraint(expr= - m.b210 + m.b217 + m.b218 + m.b219 >= 0) m.c319 = Constraint(expr= m.b200 + m.b201 - m.b202 >= 0) m.c320 = Constraint(expr= m.b200 + m.b201 - m.b203 >= 0) m.c321 = Constraint(expr= m.b200 + m.b201 - m.b204 >= 0) m.c322 = Constraint(expr= m.b202 - m.b205 >= 0) m.c323 = Constraint(expr= m.b202 - m.b206 >= 0) m.c324 = Constraint(expr= m.b203 - m.b207 >= 0) m.c325 = Constraint(expr= m.b204 - m.b208 >= 0) m.c326 = Constraint(expr= m.b204 - m.b209 >= 0) m.c327 = Constraint(expr= m.b204 - m.b210 >= 0) m.c328 = Constraint(expr= m.b205 - m.b211 >= 0) m.c329 = Constraint(expr= m.b206 - m.b212 >= 0) m.c330 = Constraint(expr= m.b207 - m.b213 >= 0) m.c331 = Constraint(expr= m.b207 - m.b214 >= 0) m.c332 = Constraint(expr= m.b209 - m.b215 >= 0) m.c333 = Constraint(expr= m.b209 - m.b216 >= 0) m.c334 = Constraint(expr= m.b210 - m.b217 >= 0) m.c335 = Constraint(expr= m.b210 - m.b218 >= 0) m.c336 = Constraint(expr= m.b210 - m.b219 >= 0) m.c337 = Constraint(expr= - m.b219 + m.b220 + m.b221 >= 0) m.c338 = Constraint(expr= - m.b222 + m.b225 + m.b226 >= 0) m.c339 = Constraint(expr= - m.b223 + m.b227 >= 0) m.c340 = Constraint(expr= m.b219 - m.b220 >= 0) m.c341 = Constraint(expr= m.b219 - m.b221 >= 0) m.c342 = Constraint(expr= m.b222 - m.b225 >= 0) m.c343 = Constraint(expr= m.b222 - m.b226 >= 0) m.c344 = Constraint(expr= m.b223 - m.b227 >= 0) m.c345 = Constraint(expr= m.b224 - m.b228 >= 0) m.c346 = Constraint(expr= m.b224 - m.b229 >= 0)
36.967403
120
0.642678
6,287
35,156
3.593765
0.110068
0.044879
0.223068
0.175268
0.511906
0.402231
0.386297
0.382624
0.373418
0.004692
0
0.232316
0.151496
35,156
950
121
37.006316
0.525109
0.019342
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.001718
0
0.001718
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
537b700c734a755e9db53189d3d693032347e7e6
144
py
Python
app/http/controllers/TagController.py
vaibhavmule/masonite-realworld-example-app
96d3cd9c12ad518903b5e1c302ab6a3c36d23279
[ "MIT" ]
11
2019-01-24T11:36:25.000Z
2022-03-09T09:21:01.000Z
app/http/controllers/TagController.py
vaibhavmule/masonite-realworld-example-app
96d3cd9c12ad518903b5e1c302ab6a3c36d23279
[ "MIT" ]
11
2018-12-04T07:12:49.000Z
2021-06-01T23:19:16.000Z
app/http/controllers/TagController.py
vaibhavmule/masonite-realworld-example-app
96d3cd9c12ad518903b5e1c302ab6a3c36d23279
[ "MIT" ]
2
2021-05-16T04:50:21.000Z
2022-01-07T07:07:25.000Z
from app.Tag import Tag class TagController: def index(self): tags = Tag.lists('name').serialize() return {'tags': tags}
16
44
0.611111
18
144
4.888889
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.256944
144
8
45
18
0.82243
0
0
0
0
0
0.055556
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
539517465a0a02c349e24267edec1b44654ce35a
970
py
Python
codingbat/warmup1/4_diff21.py
GudjonGunnarsson/python-challenges
fccf75bf237d77627cb725d39a4432a477c4573b
[ "MIT" ]
null
null
null
codingbat/warmup1/4_diff21.py
GudjonGunnarsson/python-challenges
fccf75bf237d77627cb725d39a4432a477c4573b
[ "MIT" ]
null
null
null
codingbat/warmup1/4_diff21.py
GudjonGunnarsson/python-challenges
fccf75bf237d77627cb725d39a4432a477c4573b
[ "MIT" ]
null
null
null
#!/usr/bin/python3 """ This challenge is as follows: Given an int n, return the absolute difference between n and 21, except return double the absolute difference if n is over 21. Expected Results: 19 -> 2 10 -> 11 21 -> 0 """ def diff21(n): # This part is where the challenge is supposed to be solved return (n - 21)*2 if n > 21 else (21 - n) if __name__ == '__main__': # This part is only to test if challenge is a success print("Scenario 1: 19: {}".format("success" if diff21(19) == 2 else "fail")) print("Scenario 2: 10: {}".format("success" if diff21(10) == 11 else "fail")) print("Scenario 3: 21: {}".format("success" if diff21(21) == 0 else "fail")) print("Scenario 4: 22: {}".format("success" if diff21(22) == 2 else "fail")) print("Scenario 5: -2: {}".format("success" if diff21(-2) == 23 else "fail")) print("Scenario 6: 50: {}".format("success" if diff21(50) == 58 else "fail"))
38.8
81
0.608247
149
970
3.90604
0.389262
0.134021
0.154639
0.216495
0.075601
0
0
0
0
0
0
0.097855
0.230928
970
24
82
40.416667
0.682306
0.351546
0
0
0
0
0.307432
0
0
0
0
0
0
1
0.111111
false
0
0
0.111111
0.222222
0.666667
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
1
0
1
0
3
53ac51e90d002841ecc7f82932748e68c5f6be98
142
py
Python
PythonExercicios/Mundo1/ex010.py
leonardocsrod/Python-Curso-em-Video
d61e4f1f0779050d176419de2cec0ef539e48cb3
[ "MIT" ]
null
null
null
PythonExercicios/Mundo1/ex010.py
leonardocsrod/Python-Curso-em-Video
d61e4f1f0779050d176419de2cec0ef539e48cb3
[ "MIT" ]
null
null
null
PythonExercicios/Mundo1/ex010.py
leonardocsrod/Python-Curso-em-Video
d61e4f1f0779050d176419de2cec0ef539e48cb3
[ "MIT" ]
null
null
null
money = float(input('How much money do you have: ')) dollar = money / 5.5 print('You can buy {:.2f} with {:.2f} reais.'.format(dollar, money))
47.333333
68
0.65493
24
142
3.875
0.708333
0.236559
0
0
0
0
0
0
0
0
0
0.033058
0.147887
142
3
68
47.333333
0.735537
0
0
0
0
0
0.454545
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
53b06e7535efe96c2021ac1a376e337fa8ecbf87
341
py
Python
config.py
Noahbob2233/bob2233
a70b95b23f524c358d718916f73a2d55e046a2cb
[ "MIT" ]
null
null
null
config.py
Noahbob2233/bob2233
a70b95b23f524c358d718916f73a2d55e046a2cb
[ "MIT" ]
null
null
null
config.py
Noahbob2233/bob2233
a70b95b23f524c358d718916f73a2d55e046a2cb
[ "MIT" ]
1
2020-08-29T19:46:35.000Z
2020-08-29T19:46:35.000Z
discord_token = 'NDQyNTQ3OTY0MDI0NzE3MzEy.DdAacQ._iDLpBSxzKb8T5rZDh4De9A1sXc' user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0' goat_url = 'https://2fwotdvm2o-dsn.algolia.net/1/indexes/ProductTemplateSearch/query' stockx_url = 'https://xw7sbct9v6-dsn.algolia.net/1/indexes/products/query'
48.714286
94
0.780059
46
341
5.673913
0.73913
0.022989
0.099617
0.10728
0.16092
0
0
0
0
0
0
0.124601
0.082111
341
6
95
56.833333
0.709265
0
0
0
0
0.25
0.8
0.176119
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
53bbf308c1408a31b9919c2cf196cf06584b71dd
31
py
Python
alphacsc/datasets/__init__.py
sophiaas/alphacsc
402b8f6c8ee4ba9c86e9da0e2073d900cf8da207
[ "BSD-3-Clause" ]
89
2017-05-31T19:20:52.000Z
2022-03-22T09:52:17.000Z
alphacsc/datasets/__init__.py
sophiaas/alphacsc
402b8f6c8ee4ba9c86e9da0e2073d900cf8da207
[ "BSD-3-Clause" ]
75
2017-07-15T14:03:40.000Z
2022-03-29T17:31:58.000Z
alphacsc/datasets/__init__.py
sophiaas/alphacsc
402b8f6c8ee4ba9c86e9da0e2073d900cf8da207
[ "BSD-3-Clause" ]
35
2017-06-16T12:48:23.000Z
2022-03-21T09:49:55.000Z
DATASETS = ['simu', 'somato']
10.333333
29
0.580645
3
31
6
1
0
0
0
0
0
0
0
0
0
0
0
0.16129
31
2
30
15.5
0.692308
0
0
0
0
0
0.333333
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
53cdfcb5f4ff25f22d60df8eec7f88ebd2f33995
386
py
Python
sdk/python/pulumi_azure_nextgen/kusto/__init__.py
test-wiz-sec/pulumi-azure-nextgen
20a695af0d020b34b0f1c336e1b69702755174cc
[ "Apache-2.0" ]
null
null
null
sdk/python/pulumi_azure_nextgen/kusto/__init__.py
test-wiz-sec/pulumi-azure-nextgen
20a695af0d020b34b0f1c336e1b69702755174cc
[ "Apache-2.0" ]
null
null
null
sdk/python/pulumi_azure_nextgen/kusto/__init__.py
test-wiz-sec/pulumi-azure-nextgen
20a695af0d020b34b0f1c336e1b69702755174cc
[ "Apache-2.0" ]
null
null
null
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** # Make subpackages available: from . import ( latest, v20170907privatepreview, v20180907preview, v20190121, v20190515, v20190907, v20191109, v20200215, v20200614, v20200918, )
20.315789
80
0.665803
43
386
5.976744
0.930233
0
0
0
0
0
0
0
0
0
0
0.249147
0.240933
386
18
81
21.444444
0.627986
0.489637
0
0
1
0
0
0
0
0
0
0
0
1
0
true
0
0.083333
0
0.083333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
53e4e2a4e79047c1a6a21b1fb00307bf93d85537
19,473
py
Python
RiskQuantLib/DataInputAPI/getDataFromJYDB.py
SyuyaMurakami/RiskQuantLib-Doc
2503befc24c2e422e51f8b9f468c8d8439e11c65
[ "MIT" ]
1
2021-12-29T12:18:45.000Z
2021-12-29T12:18:45.000Z
RiskQuantLib/DataInputAPI/getDataFromJYDB.py
SyuyaMurakami/RiskQuantLib-Doc
2503befc24c2e422e51f8b9f468c8d8439e11c65
[ "MIT" ]
null
null
null
RiskQuantLib/DataInputAPI/getDataFromJYDB.py
SyuyaMurakami/RiskQuantLib-Doc
2503befc24c2e422e51f8b9f468c8d8439e11c65
[ "MIT" ]
1
2021-12-08T02:14:34.000Z
2021-12-08T02:14:34.000Z
#!/usr/bin/python #coding = utf-8 import numpy as np import pandas as pd def decoratorQuery(queryFunction): """ This function deal with the issue that oracle can not query more than 1000 'IN' condition. """ def decoratedQueryFunction(*args): lenNum = len(args[1]) if lenNum < 1000: return queryFunction(*args) else: splitNum = int(lenNum / 1000) + 1 listSplit = [[j for index, j in enumerate(args[1]) if int(index / 1000) == i] for i in range(splitNum)] classRef = args[0] args = args[2:] result = [queryFunction(classRef, i, *args) for i in listSplit] return pd.concat(result) return decoratedQueryFunction class getDataFromJYDB(): def __init__(self,databaseNameString:str,hostAddress:str,port:int,userName:str,passWord:str): from RiskQuantLib.Tool.databaseTool import oracleTool self.connect = oracleTool(databaseNameString=databaseNameString,hostAddress=hostAddress,port=port,userName=userName,passWord=passWord) @decoratorQuery def getSwIndexClose(self,indexCode:list,date:pd.Timestamp): """ This function returns the close point of ShenWan industry level one index. Parameters ---------- indexCode : list The list of index code. date : pd.Timestamp The date you want to draw data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT s.SECUCODE, s.SECUABBR, qs.TRADINGDAY, qs.CLOSEPRICE FROM JYDB.QT_SYWGINDEXQUOTE qs JOIN JYDB.SECUMAIN s ON qs.INNERCODE = s.INNERCODE WHERE qs.TRADINGDAY = TO_DATE('{date}', 'yyyy-mm-dd')" index = "'"+"','".join(indexCode)+"'" sql = baseSql + f" AND s.SECUCODE in ({index})" data = self.connect.readSql(sql) return data def getFundAccNav(self,fund : str, date : pd.Timestamp): """ This function returns fund net asset value after interest adjust. Parameters ---------- fund : str Fund code. date : pd.Timestamp The date you need to pull the data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") sql = f"SELECT s.SECUCODE , s.SECUABBR, mf.TRADINGDAY, UNITNVRESTORED FROM JYDB.MF_FUNDNETVALUERE mf JOIN JYDB.SECUMAIN s ON mf.INNERCODE = s.INNERCODE WHERE SECUCODE = '{fund}' AND mf.TRADINGDAY = TO_DATE('{date}','yyyy-mm-dd')" data = self.connect.readSql(sql) return data def getFundStockTopTen(self,fund : str, date : pd.Timestamp): """ This function returns top ten stock holdings of a mutual fund. Parameters ---------- fund : str Fund code. date : pd.Timestamp The date you need to pull the data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") sql = f"SELECT s.SECUCODE , s.SECUABBR, mk.REPORTDATE, mk.SERIALNUMBER, s2.SECUCODE AS stockcode, s2.SECUABBR AS stockname, mk.RATIOINNV FROM JYDB.MF_KEYSTOCKPORTFOLIO mk JOIN JYDB.SECUMAIN s ON mk.INNERCODE = s.INNERCODE JOIN JYDB.SECUMAIN s2 ON mk.STOCKINNERCODE = s2.INNERCODE WHERE s.SECUCODE = '{fund}' AND mk.REPORTDATE = TO_DATE('{date}','yyyy-mm-dd')" data = self.connect.readSql(sql) return data @decoratorQuery def getSecurityCodeAndNameAbbr(self, securityList : list): """ This function will return the code and name abbr in JYDB. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR FROM JYDB.SECUMAIN s WHERE" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getSwIndustryAStockBelongTo(self, securityList: list): """ This function will return the Shen Wan industry section of stock in JYDB. However, it only applies to A share in China. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, le.FirstIndustryName FROM JYDB.LC_EXGINDUSTRY le JOIN JYDB.SECUMAIN s ON le.COMPANYCODE = s.COMPANYCODE WHERE STANDARD = 24 AND s.SecuCategory = 1 AND le.canceldate is null" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getSwIndustrySTARStockBelongTo(self, securityList: list): """ This function will return the Shen Wan industry section of stock in JYDB. However, it only applies to STAR share in China. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, le.FirstIndustryName FROM JYDB.LC_STIBEXGINDUSTRY le JOIN JYDB.SECUMAIN s ON le.COMPANYCODE = s.COMPANYCODE WHERE STANDARD = 24 AND s.SecuCategory = 1 AND le.canceldate is null" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getStockMarketPlate(self, securityList: list): """ This function will return the exchange trading plate of stock in JYDB. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, cs.MS FROM JYDB.CT_SYSTEMCONST cs JOIN JYDB.SECUMAIN s ON cs.DM = s.LISTEDSECTOR WHERE LB = 207" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getStockTradingMarket(self, securityList: list): """ This function will return the exchange where stock is trading in JYDB. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, cs.MS FROM JYDB.CT_SYSTEMCONST cs JOIN JYDB.SECUMAIN s ON cs.DM = s.SECUMARKET WHERE LB = 201" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getIssuer(self, securityList: list): """ This function returns the issuer of each security. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, li.CHINAME FROM JYDB.LC_INSTIARCHIVE li JOIN JYDB.SECUMAIN s ON s.COMPANYCODE = li.COMPANYCODE WHERE " securities = "'" + "','".join(securityList) + "'" sql = baseSql + f"SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getTotalMktValueOfAStock(self, securityList: list, date : pd.Timestamp): """ This function returns the total outlying market value of each stock, but it only applies in A share, China. Parameters ---------- securityList : list A string list contains security code. date : pd.Timestamp The date you want to pull the data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT s.SECUCODE, s.SECUABBR, qp.NEGOTIABLEMV FROM JYDB.QT_PERFORMANCE qp JOIN JYDB.SECUMAIN s ON s.INNERCODE = qp.INNERCODE WHERE qp.TRADINGDAY = TO_DATE('"+date+"','yyyy-mm-dd')" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getTotalMktValueOfSTARStock(self, securityList: list, date : pd.Timestamp): """ This function returns the total outlying market value of each stock, but it only applies in STAR, China. Parameters ---------- securityList : list A string list contains security code. date : pd.Timestamp The date you want to pull the data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT s.SECUCODE, s.SECUABBR, qp.NEGOTIABLEMV FROM JYDB.LC_STIBPERFORMANCE qp JOIN JYDB.SECUMAIN s ON s.INNERCODE = qp.INNERCODE WHERE qp.TRADINGDAY = TO_DATE('"+date+"','yyyy-mm-dd')" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getBondSubType(self, securityList: list): """ This function returns the sub type of each bond. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, cs.MS FROM (JYDB.BOND_BASICINFO bb JOIN JYDB.SECUMAIN s ON s.INNERCODE = bb.INNERCODE) JOIN JYDB.CT_SYSTEMCONST cs ON bb.BONDNATURE = cs.DM WHERE LB='1243'" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getIssuerRating(self, securityList : list, method = 'CBR', crsystem = 'domestic'): """ This function returns the issuer rating of issuer. Parameters ---------- securityList : list A list of bond. method : str Credit rating method, can be 'CBR' or 'Other'. crsystem : str Name of credit rating system, can be 'domestic', 'foreign' or 'all'. Returns ------- pd.DataFrame """ crsystem_dict = {'domestic':'(1)','foreign':'(2)','all':'(1,2)'} baseSql = f"SELECT s.SECUCODE, s.SECUABBR, bc.CRDATE, cs.MS, bc.CRASNAME, bc.CRSYSTEM FROM (JYDB.BOND_COMCREDITGRADING bc JOIN JYDB.SECUMAIN s ON s.COMPANYCODE = bc.COMPANYCODE) JOIN JYDB.CT_SYSTEMCONST cs ON bc.CRCODE = cs.DM WHERE LB IN (1372,2069,2070,2071,2276) AND IVALUE<>3 AND bc.CRSYSTEM IN "+crsystem_dict[crsystem] securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities}) ORDER BY CRDATE" data = self.connect.readSql(sql) if method == 'CBR': data = data[data['crasname']=='中债资信评估有限责任公司'] data['codeName'] = data['secucode']+data['secuabbr'] return data.groupby('codeName').apply(lambda x:x[x.crdate == max(x.crdate)]) else: data = data[data['crasname'] != '中债资信评估有限责任公司'] data['codeName'] = data['secucode'] + data['secuabbr'] return data.groupby('codeName').apply(lambda x: x[x.crdate == max(x.crdate)]) @decoratorQuery def getBondCBRImpliedRating(self, securityList: list, date : pd.Timestamp): """ This function returns the CBR implied rating of bond. Parameters ---------- securityList : list A string list contains security code. date : pd.Timestamp The date you want to pull the data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT s.SECUCODE, s.SECUABBR, bc.UPDATETIME, cs.MS FROM (JYDB.BOND_CBMIR bc JOIN JYDB.SECUMAIN s ON s.INNERCODE = bc.INNERCODE) JOIN JYDB.CT_SYSTEMCONST cs ON bc.IMPLIEDGRADE = cs.DM WHERE LB = 2080 AND UPDATETIME LIKE TO_DATE('" + date + "','yyyy-mm-dd')" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getBondRating(self, securityList: list): """ This function returns the rating of each bond. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, bb.CREDITRATING, bb.CRAS FROM JYDB.BOND_BASICINFO bb JOIN JYDB.SECUMAIN s ON s.INNERCODE = bb.INNERCODE WHERE " securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getBondCouponRate(self, securityList: list): """ This function returns the coupon rate of each bond. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, bb.COUPONRATE FROM JYDB.BOND_BASICINFO bb JOIN JYDB.SECUMAIN s ON s.INNERCODE = bb.INNERCODE WHERE " securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getBondMaturity(self, securityList: list): """ This function returns the maturity of each bond. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, bb.MATURITY FROM JYDB.BOND_BASICINFO bb JOIN JYDB.SECUMAIN s ON s.INNERCODE = bb.INNERCODE WHERE " securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" SECUCODE IN ({securities})" data = self.connect.readSql(sql) return data @decoratorQuery def getBondDuration(self, securityList: list, date : pd.Timestamp): """ This function returns the valuation duration of each bond. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT s.SECUCODE, s.SECUABBR, bc.VPADURATION, bc.ENDDATE FROM JYDB.BOND_CBVALUATIONALL bc JOIN JYDB.SECUMAIN s ON s.INNERCODE = bc.INNERCODE WHERE ENDDATE LIKE TO_DATE('"+ date + "','yyyy-mm-dd')" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) data.drop_duplicates(inplace=True) return data @decoratorQuery def getBondYTM(self, securityList: list, date : pd.Timestamp): """ This function returns the valuation YTM of each bond. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT s.SECUCODE, s.SECUABBR, bc.VPYIELD, bc.ENDDATE FROM JYDB.BOND_CBVALUATIONALL bc JOIN JYDB.SECUMAIN s ON s.INNERCODE = bc.INNERCODE WHERE ENDDATE LIKE TO_DATE('"+ date + "','yyyy-mm-dd')" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) data.drop_duplicates(inplace=True) return data def getAllPublicFund(self, date : pd.Timestamp): """ This function returns all public fund, given a date. Parameters ---------- date : pd.Timestamp The date you want to pull data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT s.SECUCODE, s.SECUABBR FROM JYDB.MF_FUNDARCHIVES mf JOIN JYDB.SECUMAIN s ON s.INNERCODE = mf.INNERCODE WHERE STARTDATE IS NULL OR (TO_DATE('"+ date + "','yyyy-mm-dd')<EXPIREDATE AND TO_DATE('" + date + "','yyyy-mm-dd')>STARTDATE)" data = self.connect.readSql(baseSql) data.drop_duplicates(inplace=True) return data @decoratorQuery def getFundSubType(self, securityList: list): """ This function returns the sub type of each fund. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, cs.MS FROM (JYDB.MF_FUNDARCHIVES mf JOIN JYDB.SECUMAIN s ON s.INNERCODE = mf.INNERCODE) JOIN JYDB.CT_SYSTEMCONST cs ON mf.FUNDTYPECODE = cs.DM WHERE LB = 1249 AND DM IN(1101,1103,1105,1107,1109,1199,1200)" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) data.drop_duplicates(inplace=True) return data @decoratorQuery def getFundInvestmentStyle(self, securityList: list): """ This function returns the investment style of each fund. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT s.SECUCODE, s.SECUABBR, cs.MS FROM (JYDB.MF_FUNDARCHIVES mf JOIN JYDB.SECUMAIN s ON s.INNERCODE = mf.INNERCODE) JOIN JYDB.CT_SYSTEMCONST cs ON mf.INVESTMENTTYPE = cs.DM WHERE LB = 1094" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) data.drop_duplicates(inplace=True) return data @decoratorQuery def getFutureUnderlying(self, securityList: list): """ This function returns the underlying of each future. Parameters ---------- securityList : list A string list contains security code. Returns ------- pd.DataFrame """ baseSql = f"SELECT fc.CONTRACTCODE, fc.CONTRACTABBR, cp.PRODUCTNAME, cs.MS FROM (JYDB.FUT_CONTRACTMAIN fc JOIN JYDB.CT_PRODUCT cp ON fc.OPTIONCODE = cp.PRODUCTCODE) JOIN JYDB.CT_SYSTEMCONST cs ON fc.CONTRACTTYPE = cs.DM WHERE PRODUCTCATEGORY = 326 AND PRODUCTCODE NOT IN (383) AND LB = 1461" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND CONTRACTCODE IN ({securities})" data = self.connect.readSql(sql) data.drop_duplicates(inplace=True) return data def getSwIndustryName(self): """ This function returns the name of shen wan industry level one. Returns ------- pd.DataFrame """ sql = "SELECT DISTINCT FIRSTINDUSTRYNAME FROM JYDB.LC_EXGINDUSTRY WHERE STANDARD = 24" data = self.connect.readSql(sql) return data def getIndexConstitute(self, index : str, date: pd.Timestamp): """ This function will return the index constitution. Parameters ---------- index : str Index code. date : pd.Timestamp The date you want to pull your data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT s.SECUCODE, s.SECUABBR, s2.SECUCODE AS STOCKCODE, s2.SECUABBR AS STOCKNAME, WEIGHT, ENDDATE FROM JYDB.LC_INDEXCOMPONENTSWEIGHT li JOIN JYDB.SECUMAIN s ON s.INNERCODE = li.INDEXCODE JOIN JYDB.SECUMAIN s2 ON li.INNERCODE = s2.INNERCODE WHERE s.SECUCODE = '{index}' AND li.ENDDATE = (SELECT max(li.ENDDATE) FROM JYDB.LC_INDEXCOMPONENTSWEIGHT li JOIN JYDB.SECUMAIN s ON li.INDEXCODE = s.INNERCODE WHERE SECUCODE = '{index}' AND li.ENDDATE <= TO_DATE('{date}','yyyy-mm-dd'))" data = self.connect.readSql(baseSql) data.weight /= 100 return data @decoratorQuery def getStockClose(self, securityList: list, date : pd.Timestamp): """ This function returns the close price of each stock. Parameters ---------- securityList : list A string list contains security code. date : pd.Timestamp The date you want to pull data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT s.SECUCODE, s.SECUABBR, qd.CLOSEPRICE, qd.PREVCLOSEPRICE, qd.TRADINGDAY FROM JYDB.QT_DAILYQUOTE qd JOIN JYDB.SECUMAIN s ON s.INNERCODE = qd.INNERCODE WHERE s.SECUCATEGORY = 1 AND qd.TRADINGDAY LIKE TO_DATE('"+ date + "','yyyy-mm-dd')" securities = "'" + "','".join(securityList) + "'" sql = baseSql + f" AND SECUCODE IN ({securities})" data = self.connect.readSql(sql) data.drop_duplicates(inplace=True) return data @decoratorQuery def getTreasureBondYieldCurve(self, date : pd.Timestamp): """ This function will return the China treasure bond yield curve in inter-bank market. Parameters ---------- date : pd.Timestamp The date you want to pull your data on. Returns ------- pd.DataFrame """ date = date.strftime("%Y-%m-%d") baseSql = f"SELECT BC.UPDATETIME, BC.CURVETYPE, BC.YEARSTOMATURITY, BC.YIELD FROM JYDB.BOND_CBYIELDCURVEOPEN BC WHERE BC.CURVECODE = 10 AND BC.UPDATETIME LIKE TO_DATE('{date}', 'yyyy-mm-dd')" data = self.connect.readSql(baseSql) return data
32.563545
491
0.686643
2,570
19,473
5.179377
0.134241
0.027045
0.036511
0.044625
0.738186
0.716099
0.704079
0.665465
0.639471
0.61483
0
0.008037
0.175731
19,473
598
492
32.563545
0.821257
0.286345
0
0.630137
0
0.114155
0.470579
0.040593
0.09589
0
0
0
0
1
0.136986
false
0.009132
0.013699
0
0.296804
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3