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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1207575defc5d03469e62a79d6627247fbf73ef2 | 108 | py | Python | teampy/__init__.py | arcward/teampy | 34097dfca2cf6eb2a405ff0346b46e7ab9520444 | [
"MIT"
] | null | null | null | teampy/__init__.py | arcward/teampy | 34097dfca2cf6eb2a405ff0346b46e7ab9520444 | [
"MIT"
] | null | null | null | teampy/__init__.py | arcward/teampy | 34097dfca2cf6eb2a405ff0346b46e7ab9520444 | [
"MIT"
] | null | null | null | from teampy.client import APIClient
__version__ = '0.1'
__author__ = 'Edward Wells'
__all__ = ['APIClient'] | 21.6 | 35 | 0.75 | 13 | 108 | 5.307692 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021277 | 0.12963 | 108 | 5 | 36 | 21.6 | 0.712766 | 0 | 0 | 0 | 0 | 0 | 0.220183 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1222227113bac1587e2d7de9daa11d0c8149596e | 366 | py | Python | wildlifecompliance/migrations/0431_merge_20200218_1801.py | preranaandure/wildlifecompliance | bc19575f7bccf7e19adadbbaf5d3eda1d1aee4b5 | [
"Apache-2.0"
] | 1 | 2020-12-07T17:12:40.000Z | 2020-12-07T17:12:40.000Z | wildlifecompliance/migrations/0431_merge_20200218_1801.py | preranaandure/wildlifecompliance | bc19575f7bccf7e19adadbbaf5d3eda1d1aee4b5 | [
"Apache-2.0"
] | 14 | 2020-01-08T08:08:26.000Z | 2021-03-19T22:59:46.000Z | wildlifecompliance/migrations/0431_merge_20200218_1801.py | preranaandure/wildlifecompliance | bc19575f7bccf7e19adadbbaf5d3eda1d1aee4b5 | [
"Apache-2.0"
] | 15 | 2020-01-08T08:02:28.000Z | 2021-11-03T06:48:32.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2020-02-18 10:01
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wildlifecompliance', '0430_briefofevidencedocument'),
('wildlifecompliance', '0427_merge_20200214_1614'),
]
operations = [
]
| 21.529412 | 63 | 0.688525 | 39 | 366 | 6.230769 | 0.794872 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12585 | 0.196721 | 366 | 16 | 64 | 22.875 | 0.70068 | 0.185792 | 0 | 0 | 1 | 0 | 0.298305 | 0.176271 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
1223017e27fe3759d3dd4b76699ecf7642b1cb0c | 112 | py | Python | Term2/15-5-square-for-input.py | theseana/apondaone | 7cbf3572a86c73220329804fee1f3d03842ae902 | [
"MIT"
] | null | null | null | Term2/15-5-square-for-input.py | theseana/apondaone | 7cbf3572a86c73220329804fee1f3d03842ae902 | [
"MIT"
] | null | null | null | Term2/15-5-square-for-input.py | theseana/apondaone | 7cbf3572a86c73220329804fee1f3d03842ae902 | [
"MIT"
] | null | null | null | import turtle as t
zel = float(input("What is your Zel: "))
for i in range(4):
t.fd(zel)
t.lt(90)
t.done()
| 14 | 40 | 0.616071 | 24 | 112 | 2.875 | 0.791667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033708 | 0.205357 | 112 | 7 | 41 | 16 | 0.741573 | 0 | 0 | 0 | 0 | 0 | 0.160714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
122ae92db8c0fba7f33754fcbab35f9e25571cce | 1,032 | py | Python | rsp2/src/python/rsp2/io/structure_dir.py | colin-daniels/agnr-ml | fc936cb8b6a68c37dfaf64c74796e0cf795c1bb8 | [
"MIT"
] | null | null | null | rsp2/src/python/rsp2/io/structure_dir.py | colin-daniels/agnr-ml | fc936cb8b6a68c37dfaf64c74796e0cf795c1bb8 | [
"MIT"
] | null | null | null | rsp2/src/python/rsp2/io/structure_dir.py | colin-daniels/agnr-ml | fc936cb8b6a68c37dfaf64c74796e0cf795c1bb8 | [
"MIT"
] | null | null | null | import json
import os
from pymatgen.io.vasp import Poscar
def from_path(path):
# TODO: should maybe support .tar.gz or .tar.xz
return StructureDir.from_dir(path)
class StructureDir:
def __init__(self, *, layers, masses, layer_sc_matrices, structure):
self.layers = layers
self.masses = masses
self.layer_sc_matrices = layer_sc_matrices
self.structure = structure
@classmethod
def from_dir(cls, path):
structure = Poscar.from_file(os.path.join(path, 'POSCAR')).structure
with open(os.path.join(path, 'meta.json')) as f:
meta = json.load(f)
layer_sc_matrices = meta.pop('layer_sc_matrices', None) or meta.pop('layer-sc-matrices', None)
if layer_sc_matrices:
layer_sc_matrices = [x['matrix'] for x in layer_sc_matrices]
return cls(
layers=meta.pop('layers', None),
masses=meta.pop('masses', None),
layer_sc_matrices=layer_sc_matrices,
structure=structure,
)
| 32.25 | 102 | 0.643411 | 136 | 1,032 | 4.676471 | 0.345588 | 0.121069 | 0.259434 | 0.09434 | 0.22327 | 0.22327 | 0 | 0 | 0 | 0 | 0 | 0 | 0.250969 | 1,032 | 31 | 103 | 33.290323 | 0.822768 | 0.043605 | 0 | 0 | 0 | 0 | 0.06802 | 0 | 0 | 0 | 0 | 0.032258 | 0 | 1 | 0.12 | false | 0 | 0.12 | 0.04 | 0.36 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
123cdad2272e052e427dddd3ee2cb08bee5b4d82 | 573 | py | Python | dracoon/public_models.py | Quirinwierer/dracoon-python-api | 7fad8cdb95069fb80069e76c740547f3ad02b910 | [
"Apache-2.0"
] | 3 | 2020-10-05T14:34:46.000Z | 2020-11-27T07:44:57.000Z | dracoon/public_models.py | Quirinwierer/dracoon-python-api | 7fad8cdb95069fb80069e76c740547f3ad02b910 | [
"Apache-2.0"
] | 1 | 2022-02-15T16:01:12.000Z | 2022-02-15T16:01:12.000Z | dracoon/public_models.py | Quirinwierer/dracoon-python-api | 7fad8cdb95069fb80069e76c740547f3ad02b910 | [
"Apache-2.0"
] | 1 | 2021-03-04T08:16:07.000Z | 2021-03-04T08:16:07.000Z | from dataclasses import dataclass
from typing import List
@dataclass
class SystemInfo:
languageDefault: str
hideLoginPinputFields: bool
s3Hosts: List[str]
s3EnforceDirectUpload: bool
useS3Storage: bool
@dataclass
class ActiveDirectoryInfoItem:
id: int
alias: str
isGlobalAvailable: bool
@dataclass
class ActiveDirectoryInfo:
items: List[ActiveDirectoryInfoItem]
@dataclass
class OpenIdInfoItem:
id: int
issuer: str
alias: str
isGlobalAvailable: bool
@dataclass
class OpenIdInfo:
items: List[OpenIdInfoItem]
| 17.363636 | 40 | 0.743455 | 54 | 573 | 7.888889 | 0.462963 | 0.164319 | 0.126761 | 0.13615 | 0.201878 | 0.201878 | 0 | 0 | 0 | 0 | 0 | 0.006579 | 0.204188 | 573 | 32 | 41 | 17.90625 | 0.927632 | 0 | 0 | 0.423077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.076923 | 0 | 0.807692 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
123fd7b7b9f4d286bd20d4bce4dab814f4d0a36c | 254 | py | Python | Fibonacci.py | Eziowrf/project555 | a8c883b55186f59d7fe1d953c404522a17985f98 | [
"MIT"
] | 1 | 2019-07-21T06:05:09.000Z | 2019-07-21T06:05:09.000Z | Fibonacci.py | Eziowrf/project555 | a8c883b55186f59d7fe1d953c404522a17985f98 | [
"MIT"
] | 5 | 2018-09-21T01:15:26.000Z | 2018-09-26T18:37:32.000Z | Fibonacci.py | Eziowrf/project555 | a8c883b55186f59d7fe1d953c404522a17985f98 | [
"MIT"
] | 1 | 2018-09-23T15:57:26.000Z | 2018-09-23T15:57:26.000Z | # Yunfan Ye 10423172
def Fibonacci(n):
if n == 1:
return 1
elif n == 2:
return 1
else:
return Fibonacci(n - 1) + Fibonacci(n - 2)
# arr = [1,2,3,4,5,6,7,8,9,10]
# for i in arr:
# print(Fibonacci(i))
| 19.538462 | 51 | 0.484252 | 42 | 254 | 2.928571 | 0.595238 | 0.243902 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15528 | 0.366142 | 254 | 12 | 52 | 21.166667 | 0.608696 | 0.334646 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
124a1d7c7ee9fa6fc3a3d429e6d76f675fb7017f | 227 | py | Python | src/utils/url_path.py | FP-DataSolutions/DeltaWarehouse | 2c57e6176d9461a287ee925f9006fdfef8da5653 | [
"Apache-2.0"
] | 6 | 2020-06-18T13:31:53.000Z | 2021-09-12T20:27:26.000Z | src/utils/url_path.py | FP-DataSolutions/DeltaWarehouse | 2c57e6176d9461a287ee925f9006fdfef8da5653 | [
"Apache-2.0"
] | null | null | null | src/utils/url_path.py | FP-DataSolutions/DeltaWarehouse | 2c57e6176d9461a287ee925f9006fdfef8da5653 | [
"Apache-2.0"
] | 1 | 2021-04-03T16:56:38.000Z | 2021-04-03T16:56:38.000Z | class UrlPath:
@staticmethod
def combine(*args):
result = ''
for path in args:
result += path if path.endswith('/') else '{}/'.format(path)
#result = result[:-1]
return result | 28.375 | 72 | 0.528634 | 24 | 227 | 5 | 0.666667 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006579 | 0.330396 | 227 | 8 | 73 | 28.375 | 0.782895 | 0.088106 | 0 | 0 | 0 | 0 | 0.019324 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.428571 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1254d16c4e176a58c1a20487d3f11f36c8056c00 | 256 | py | Python | tests/i18n/patterns/urls/path_unused.py | webjunkie/django | 5dbca13f3baa2e1bafd77e84a80ad6d8a074712e | [
"BSD-3-Clause"
] | 790 | 2015-01-03T02:13:39.000Z | 2020-05-10T19:53:57.000Z | AppServer/lib/django-1.5/tests/regressiontests/i18n/patterns/urls/path_unused.py | nlake44/appscale | 6944af660ca4cb772c9b6c2332ab28e5ef4d849f | [
"Apache-2.0"
] | 1,361 | 2015-01-08T23:09:40.000Z | 2020-04-14T00:03:04.000Z | AppServer/lib/django-1.5/tests/regressiontests/i18n/patterns/urls/path_unused.py | nlake44/appscale | 6944af660ca4cb772c9b6c2332ab28e5ef4d849f | [
"Apache-2.0"
] | 155 | 2015-01-08T22:59:31.000Z | 2020-04-08T08:01:53.000Z | from django.conf.urls import url
from django.conf.urls import patterns
from django.views.generic import TemplateView
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = patterns('',
url(r'^nl/foo/', view, name='not-translated'),
)
| 23.272727 | 55 | 0.753906 | 36 | 256 | 5.305556 | 0.611111 | 0.157068 | 0.146597 | 0.188482 | 0.251309 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113281 | 256 | 10 | 56 | 25.6 | 0.84141 | 0 | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 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 | 0 | 0 | 0 | 2 |
12597459b30dbd3bd8a1d404996a35025ae53e68 | 196 | py | Python | app/api/__init__.py | correaleyval/Telezon-S3 | 1a6de581c73f7b2391207bfd717f0dfc42de0223 | [
"MIT"
] | 12 | 2021-03-18T20:42:19.000Z | 2021-06-08T18:43:05.000Z | app/api/__init__.py | luiscib3r/Telezon-S3 | 1a6de581c73f7b2391207bfd717f0dfc42de0223 | [
"MIT"
] | 1 | 2021-03-19T14:08:51.000Z | 2021-03-19T23:09:55.000Z | app/api/__init__.py | luiscib3r/Telezon-S3 | 1a6de581c73f7b2391207bfd717f0dfc42de0223 | [
"MIT"
] | 1 | 2021-04-11T04:35:14.000Z | 2021-04-11T04:35:14.000Z | from fastapi import APIRouter
from app.api.auth import router as auth
from app.api.v1 import router as v1
router = APIRouter(prefix='/api')
router.include_router(auth)
router.include_router(v1)
| 21.777778 | 39 | 0.795918 | 32 | 196 | 4.8125 | 0.375 | 0.090909 | 0.12987 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017341 | 0.117347 | 196 | 8 | 40 | 24.5 | 0.872832 | 0 | 0 | 0 | 0 | 0 | 0.020408 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
126a9e516f4b1e45a50ac7e8798792874a6e0626 | 2,385 | py | Python | tests/test_memory.py | Lewuathe/algernon | 23d3aef69d701ddd33cd90451ec8738032396430 | [
"MIT"
] | null | null | null | tests/test_memory.py | Lewuathe/algernon | 23d3aef69d701ddd33cd90451ec8738032396430 | [
"MIT"
] | null | null | null | tests/test_memory.py | Lewuathe/algernon | 23d3aef69d701ddd33cd90451ec8738032396430 | [
"MIT"
] | null | null | null | from algernon.memory import Memory
import pytest
import numpy as np
from keras.models import Sequential
from keras.layers.core import Dense
from keras.optimizers import sgd
class MockModel:
def __init__(self, output_dims, input_dims):
self.w = np.random.random(size=(output_dims, input_dims))
def predict(self, X):
return np.dot(X, self.w.T)
def predict_proba(self, X):
return self.predict(X)
class TestMemory:
TEST_OBSERVATION_SHAPE = (4, 2)
TEST_ACTION_DIMS = 3
TEST_GAMMA = 0.3
TEST_MAX_MEMORY = 1000
def test_init_values(self):
m = Memory(TestMemory.TEST_OBSERVATION_SHAPE,
TestMemory.TEST_ACTION_DIMS,
TestMemory.TEST_GAMMA,
TestMemory.TEST_MAX_MEMORY)
assert m.observation_shape == TestMemory.TEST_OBSERVATION_SHAPE
assert m.action_dims == TestMemory.TEST_ACTION_DIMS
assert len(m.memories) == 0
assert m.max_memory == TestMemory.TEST_MAX_MEMORY
def test_observation_dims(self):
ret = Memory.get_observation_dims(TestMemory.TEST_OBSERVATION_SHAPE)
# 4 * 2
assert ret == 8
def test_append(self):
m = Memory(TestMemory.TEST_OBSERVATION_SHAPE,
TestMemory.TEST_ACTION_DIMS,
TestMemory.TEST_GAMMA,
TestMemory.TEST_MAX_MEMORY)
s = np.random.random(size=TestMemory.TEST_OBSERVATION_SHAPE)
s_prime = np.random.random(size=TestMemory.TEST_OBSERVATION_SHAPE)
m.append(s, 1, 0.2, s_prime, False)
assert len(m.memories) == 1
def test_get_batch(self):
m = Memory(TestMemory.TEST_OBSERVATION_SHAPE,
TestMemory.TEST_ACTION_DIMS,
TestMemory.TEST_GAMMA,
TestMemory.TEST_MAX_MEMORY)
for _ in range(10):
s = np.random.random(size=TestMemory.TEST_OBSERVATION_SHAPE).flatten()
a = np.random.randint(TestMemory.TEST_ACTION_DIMS)
r = np.random.random(size=1)[0]
s_prime = np.random.random(size=TestMemory.TEST_OBSERVATION_SHAPE).flatten()
m.append(s, a, r, s_prime, False)
assert len(m.memories) == 10
X, y = m.get_batch(MockModel(3, 8), 3)
assert X.shape[0] == y.shape[0] == 3
assert X.shape[1] == 8
assert y.shape[1] == 3
| 31.381579 | 88 | 0.635639 | 311 | 2,385 | 4.639871 | 0.21865 | 0.213444 | 0.17325 | 0.2079 | 0.459459 | 0.459459 | 0.415107 | 0.374913 | 0.374913 | 0.297297 | 0 | 0.019009 | 0.272117 | 2,385 | 75 | 89 | 31.8 | 0.812212 | 0.002096 | 0 | 0.218182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 1 | 0.127273 | false | 0 | 0.109091 | 0.036364 | 0.381818 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1271a5b636e4e2a4b34227856118cd1f4633a6d6 | 872 | py | Python | models.py | harmonyinnovationhub/project-beta | f98a08972ffb9c01123aa4849dc06a8b0beec171 | [
"MIT"
] | null | null | null | models.py | harmonyinnovationhub/project-beta | f98a08972ffb9c01123aa4849dc06a8b0beec171 | [
"MIT"
] | null | null | null | models.py | harmonyinnovationhub/project-beta | f98a08972ffb9c01123aa4849dc06a8b0beec171 | [
"MIT"
] | null | null | null | from core import app
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
db = SQLAlchemy(app)
migrate = Migrate(app, db)
# user table
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
token = db.Column(db.String(50), unique=True)
name = db.Column(db.String(50))
password = db.Column(db.String(128))
admin = db.Column(db.Boolean)
class LogLag(db.Model):
id = db.Column(db.Integer, primary_key=True)
logitude = db.Column(db.Float(128))
latitude = db.Column(db.Float(128))
def __init__(self, logitude, latitude):
self.logitude = logitude
self.latitude = latitude
class Upload(db.Model):
id = db.Column(db.Integer, primary_key=True)
file = db.Column(db.Text, nullable=False)
name = db.Column(db.Text, nullable=False)
mimetype = db.Column(db.Text, nullable=False) | 28.129032 | 49 | 0.692661 | 128 | 872 | 4.648438 | 0.3125 | 0.161345 | 0.201681 | 0.055462 | 0.458824 | 0.337815 | 0.201681 | 0.201681 | 0.201681 | 0.201681 | 0 | 0.018131 | 0.177752 | 872 | 31 | 50 | 28.129032 | 0.811715 | 0.011468 | 0 | 0.130435 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.043478 | false | 0.043478 | 0.130435 | 0 | 0.826087 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
89c3edf7f3339956ac7cca062ad64b1b9a40814b | 1,457 | py | Python | setup.py | BCD65/electricityLoadForecasting | 07a6ed060afaf7cc2906c0389b5c9e9b0fede193 | [
"MIT"
] | null | null | null | setup.py | BCD65/electricityLoadForecasting | 07a6ed060afaf7cc2906c0389b5c9e9b0fede193 | [
"MIT"
] | null | null | null | setup.py | BCD65/electricityLoadForecasting | 07a6ed060afaf7cc2906c0389b5c9e9b0fede193 | [
"MIT"
] | null | null | null |
import setuptools
from distutils.core import setup
setup(
name = 'electricityLoadForecasting',
version = '0.1.dev0',
packages = setuptools.find_packages(),
scripts = ['scripts/main_forecasting.py',
'scripts/preprocessing_eCO2mix.py',
],
author = 'Ben',
author_email = 'bcd6591[at]gmail.com',
license = 'MIT License',
long_description = open('README.txt').read(),
python_requires = ">= 3.6",
install_requires = [
'astral==1.2',
'chardet',
'cvxpy',
'datetime',
'h5py',
'ipdb',
'matplotlib',
'numpy',
'pandas',
'prox_tv',
'pytz',
'scikit-learn',
'scipy',
'seaborn',
'termcolor',
'tzlocal',
'unidecode',
#'openblas',
#'sklearn-contrib-py-earth',
#'spams',
#'rpy2',
#'xgboost',
],
) | 35.536585 | 61 | 0.320522 | 79 | 1,457 | 5.810127 | 0.848101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022839 | 0.579272 | 1,457 | 41 | 62 | 35.536585 | 0.725938 | 0.04324 | 0 | 0.058824 | 0 | 0 | 0.189345 | 0.061195 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.058824 | 0 | 0.058824 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
89c56780209adbe0387cf368029ab9a32fd8735c | 377 | py | Python | sound_play/scripts/test/test_sound_client.py | iory/audio_common | 1db0394dcef452b93474665ee902ab80c3e7e439 | [
"BSD-3-Clause"
] | 742 | 2017-07-05T02:49:36.000Z | 2022-03-30T12:55:43.000Z | sound_play/scripts/test/test_sound_client.py | iory/audio_common | 1db0394dcef452b93474665ee902ab80c3e7e439 | [
"BSD-3-Clause"
] | 124 | 2015-06-25T22:52:21.000Z | 2022-02-28T15:02:23.000Z | sound_play/scripts/test/test_sound_client.py | iory/audio_common | 1db0394dcef452b93474665ee902ab80c3e7e439 | [
"BSD-3-Clause"
] | 425 | 2017-07-04T22:03:29.000Z | 2022-03-29T06:59:06.000Z | #!/usr/bin/env python
import unittest
import rospy
import rostest
from sound_play.libsoundplay import SoundClient
class TestCase(unittest.TestCase):
def test_soundclient_constructor(self):
s = SoundClient()
self.assertIsNotNone(s)
if __name__ == '__main__':
rostest.rosrun('sound_play', 'test_sound_client', TestCase)
__author__ = 'Felix Duvallet'
| 20.944444 | 63 | 0.745358 | 44 | 377 | 5.977273 | 0.659091 | 0.068441 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.159151 | 377 | 17 | 64 | 22.176471 | 0.829653 | 0.05305 | 0 | 0 | 0 | 0 | 0.13764 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 1 | 0.090909 | false | 0 | 0.363636 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
89d29a1fa605d5be215d81daea59d7f25ded9268 | 6,239 | py | Python | src/utils/testing_utils.py | rluiseugenio/dpa_rita | 4da52a103b455c97d7f3bc6253f1c455c340dfc4 | [
"MIT"
] | null | null | null | src/utils/testing_utils.py | rluiseugenio/dpa_rita | 4da52a103b455c97d7f3bc6253f1c455c340dfc4 | [
"MIT"
] | 10 | 2020-05-06T14:30:44.000Z | 2022-03-12T00:33:00.000Z | src/utils/testing_utils.py | rluiseugenio/dpa_rita | 4da52a103b455c97d7f3bc6253f1c455c340dfc4 | [
"MIT"
] | 6 | 2020-04-15T04:30:36.000Z | 2020-10-23T16:02:24.000Z | #python -m marbles test_semantic_columns.py
import unittest
from marbles.mixins import mixins
import pandas as pd
import requests
from pyspark.sql import SparkSession
import psycopg2 as pg
import pandas as pd
import marbles
from pyspark.sql.types import StructType, StructField, StringType
import psycopg2 as pg
#from src.features.build_features import crear_features
from src import(
MY_USER,
MY_PASS,
MY_HOST,
MY_PORT,
MY_DB,
)
def get_clean_data_test():
clean_rita = StructType([StructField('year', StringType(), True),
StructField('quarter', StringType(), True),
StructField('month', StringType(), True),
StructField('dayofmonth', StringType(), True),
StructField('dayofweek', StringType(), True),
StructField('flightdate', StringType(), True),
StructField('reporting_airline', StringType(), True),
StructField('dot_id_reporting_airline', StringType(), True),
StructField('iata_code_reporting_airline', StringType(), True),
StructField('tail_number', StringType(), True),
StructField('flight_number_reporting_airline', StringType(), True),
StructField('originairportid', StringType(), True),
StructField('originairportseqid', StringType(), True),
StructField('origincitymarketid', StringType(), True),
StructField('origin', StringType(), True),
StructField('origincityname', StringType(), True),
StructField('originstate', StringType(), True),
StructField('originstatefips', StringType(), True),
StructField('originstatename', StringType(), True),
StructField('originwac', StringType(), True),
StructField('destairportid', StringType(), True),
StructField('destairportseqid', StringType(), True),
StructField('destcitymarketid', StringType(), True),
StructField('dest', StringType(), True),
StructField('destcityname', StringType(), True),
StructField('deststate', StringType(), True),
StructField('deststatefips', StringType(), True),
StructField('deststatename', StringType(), True),
StructField('destwac', StringType(), True),
StructField('crsdeptime', StringType(), True),
StructField('deptime', StringType(), True),
StructField('depdelay', StringType(), True),
StructField('depdelayminutes', StringType(), True),
StructField('depdel15', StringType(), True),
StructField('departuredelaygroups', StringType(), True),
StructField('deptimeblk', StringType(), True),
StructField('taxiout', StringType(), True),
StructField('wheelsoff', StringType(), True),
StructField('wheelson', StringType(), True),
StructField('taxiin', StringType(), True),
StructField('crsarrtime', StringType(), True),
StructField('arrtime', StringType(), True),
StructField('arrdelay', StringType(), True),
StructField('arrdelayminutes', StringType(), True),
StructField('arrdel15', StringType(), True),
StructField('arrivaldelaygroups', StringType(), True),
StructField('arrtimeblk', StringType(), True),
StructField('cancelled', StringType(), True),
StructField('diverted', StringType(), True),
StructField('crselapsedtime', StringType(), True),
StructField('actualelapsedtime', StringType(), True),
StructField('airtime', StringType(), True),
StructField('flights', StringType(), True),
StructField('distance', StringType(), True),
StructField('distancegroup', StringType(), True),
StructField('divairportlandings', StringType(), True),
StructField('rangoatrasohoras', StringType(), True)
])
config_psyco = "host='{0}' dbname='{1}' user='{2}' password='{3}'".format(MY_HOST,MY_DB,MY_USER,MY_PASS)
connection = pg.connect(config_psyco)
pdf = pd.read_sql_query('select * from clean.rita limit 1;',con=connection)
spark = SparkSession.builder.config('spark.driver.extraClassPath', 'postgresql-9.4.1207.jar').getOrCreate()
df = spark.createDataFrame(pdf, schema=clean_rita)
return df
def crear_features_test(base):
from pyspark.sql import functions as f
base = base.withColumn('findesemana', f.when(f.col('dayofweek') == 5, 1).when(f.col('dayofweek') == 6, 1).when(f.col('dayofweek') == 7, 1).otherwise(0))
base = base.withColumn('quincena', f.when(f.col('dayofmonth') == 15, 1).when(f.col('dayofmonth') == 14, 1).when(f.col('dayofmonth') == 16, 1).when(f.col('dayofmonth') == 29, 1).when(f.col('dayofmonth') == 30, 1).when(f.col('dayofmonth') == 31, 1).when(f.col('dayofmonth') == 1, 1).when(f.col('dayofmonth') == 2, 1).when(f.col('dayofmonth') == 3, 1).otherwise(0))
base = base.withColumn('dephour', f.when(f.col('dayofweek') == 5, 1).otherwise(0))
base = base.withColumn('seishoras', f.when(f.col('dephour') == 6, 1).when(f.col('dephour') == 12, 1).when(f.col('dephour') == 18, 1).when(f.col('dephour') == 0, 1).otherwise(0))
return base
| 58.858491 | 366 | 0.536624 | 518 | 6,239 | 6.395753 | 0.297297 | 0.240869 | 0.422578 | 0.035315 | 0.172351 | 0.038032 | 0.012074 | 0 | 0 | 0 | 0 | 0.015047 | 0.328899 | 6,239 | 105 | 367 | 59.419048 | 0.776212 | 0.015387 | 0 | 0.044944 | 0 | 0 | 0.163003 | 0.021495 | 0 | 0 | 0 | 0 | 0 | 1 | 0.022472 | false | 0.022472 | 0.134831 | 0 | 0.179775 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
89d312b14f6d96924f16b029fd0ee12233883f44 | 6,572 | py | Python | polygon.py | darinamazur/Math-modeling- | 8de5913fd8314dc51641700c9a1088c6f34fd2a3 | [
"MIT"
] | null | null | null | polygon.py | darinamazur/Math-modeling- | 8de5913fd8314dc51641700c9a1088c6f34fd2a3 | [
"MIT"
] | null | null | null | polygon.py | darinamazur/Math-modeling- | 8de5913fd8314dc51641700c9a1088c6f34fd2a3 | [
"MIT"
] | null | null | null | import math
class polygon:
def __init__(self, arr):
self.original_arr = arr
self.size = len(self.original_arr)
self.__set_min_max_by_original__()
self.__refactor_original_seq__()
self.sorted_arr.append(self.sorted_arr[0])
self.size += 1
def __set_min_max_by_original__(self):
self.x_min_ind = 0
self.x_max_ind = 0
self.y_min_ind = 0
self.y_max_ind = 0
for i in range(1, self.size):
if self.original_arr[i][0] > self.original_arr[self.x_max_ind][0]:
self.x_max_ind = i
if self.original_arr[i][0] < self.original_arr[self.x_min_ind][0]:
self.x_min_ind = i
if self.original_arr[i][1] > self.original_arr[self.y_max_ind][1]:
self.y_max_ind = i
if self.original_arr[i][1] < self.original_arr[self.y_min_ind][1]:
self.y_min_ind = i
def __refactor_original_seq__(self):
self.sorted_arr = []
for i in range(self.x_min_ind, self.size):
self.sorted_arr.append(self.original_arr[i])
for i in range(0, self.x_min_ind):
self.sorted_arr.append(self.original_arr[i])
self.x_max_ind = (self.x_max_ind - self.x_min_ind) % self.size
self.y_max_ind = (self.y_max_ind - self.x_min_ind) % self.size
self.y_min_ind = (self.y_min_ind - self.x_min_ind) % self.size
self.x_min_ind = 0
def __equal__(x1, x2):
return abs(x1 - x2) < 1E-4
def get_top_border(self, x):
if polygon.__equal__(x, self.sorted_arr[self.x_max_ind][0]):
if polygon.__equal__(self.sorted_arr[self.x_max_ind][0], self.sorted_arr[self.x_max_ind + 1][0]):
return max(self.sorted_arr[self.x_max_ind][1], self.sorted_arr[self.x_max_ind + 1][1])
else:
return self.sorted_arr[self.x_max_ind][1]
if polygon.__equal__(x, self.sorted_arr[self.x_min_ind][0]):
if polygon.__equal__(self.sorted_arr[self.x_min_ind][0], self.sorted_arr[self.x_min_ind + 1][0]):
return max(self.sorted_arr[self.x_min_ind][1], self.sorted_arr[self.x_min_ind + 1][1])
else:
return self.sorted_arr[self.x_min_ind][1]
for i in range(self.x_min_ind, self.x_max_ind):
if x >= self.sorted_arr[i][0] and x < self.sorted_arr[i + 1][0]:
if self.sorted_arr[i][0] != self.sorted_arr[i + 1][0]:
x1 = self.sorted_arr[i][0]
x2 = self.sorted_arr[i + 1][0]
y1 = self.sorted_arr[i][1]
y2 = self.sorted_arr[i + 1][1]
return y1 + (x - x1) * (y2 - y1) / (x2 - x1)
else:
return max(self.sorted_arr[i][1], self.sorted_arr[i + 1][1])
exit(3)
def get_bottom_border(self, x):
if polygon.__equal__(x, self.sorted_arr[self.x_max_ind][0]):
if polygon.__equal__(self.sorted_arr[self.x_max_ind][0], self.sorted_arr[self.x_max_ind + 1][0]):
return min(self.sorted_arr[self.x_max_ind][1], self.sorted_arr[self.x_max_ind + 1][1])
else:
return self.sorted_arr[self.x_max_ind][1]
if polygon.__equal__(x, self.sorted_arr[self.x_min_ind][0]):
if polygon.__equal__(self.sorted_arr[self.x_min_ind][0], self.sorted_arr[self.x_min_ind + 1][0]):
return min(self.sorted_arr[self.x_min_ind][1], self.sorted_arr[self.x_min_ind + 1][1])
else:
return self.sorted_arr[self.x_min_ind][1]
for i in range(self.x_max_ind, self.size - 1):
if x < self.sorted_arr[i][0] and x >= self.sorted_arr[i + 1][0]:
if self.sorted_arr[i][0] != self.sorted_arr[i + 1][0]:
x1 = self.sorted_arr[i][0]
x2 = self.sorted_arr[i + 1][0]
y1 = self.sorted_arr[i][1]
y2 = self.sorted_arr[i + 1][1]
return y1 + (x - x1) * (y2 - y1) / (x2 - x1)
else:
return min(self.sorted_arr[i][1], self.sorted_arr[i + 1][1])
exit(3)
def get_x_min(self):
return self.sorted_arr[self.x_min_ind][0]
def get_x_max(self):
return self.sorted_arr[self.x_max_ind][0]
def get_y_min(self):
return self.sorted_arr[self.y_min_ind][1]
def get_y_max(self):
return self.sorted_arr[self.y_max_ind][1]
def get_contour_length(self):
res = 0
for i in range(0, self.size - 1):
res += math.sqrt((self.sorted_arr[i][0] - self.sorted_arr[i + 1][0]) ** 2 + (self.sorted_arr[i][1] - self.sorted_arr[i + 1][1]) ** 2)
return res
def get_contour_sequence(self, dpi=10):
# returns 2d-array with 1-dimension length same as points in array,
# second dimension have length 3, contains x, y, multiplier constant
n = math.ceil(self.get_contour_length() * dpi)
res_arr = []
for i in range(0, self.size - 1):
x_cur = self.sorted_arr[i][0]
x_next = self.sorted_arr[i + 1][0]
y_cur = self.sorted_arr[i][1]
y_next = self.sorted_arr[i + 1][1]
if not polygon.__equal__(x_cur, x_next):
y_x = lambda x: y_cur + (x - x_cur) * (y_next - y_cur) / (x_next - x_cur)
section_length = math.sqrt((x_next - x_cur) ** 2 + (y_next - y_cur) ** 2)
n = math.ceil(section_length * dpi)
if n != 0:
step_x = (x_next - x_cur) / float(n)
step_len = section_length / float(n)
for i in range(0, n):
tmp_x = x_cur + step_x * (i + 0.5)
tmp_y = y_x(tmp_x)
res_arr.insert(0, [tmp_x, tmp_y, step_len])
else:
section_length = math.sqrt((x_next - x_cur) ** 2 + (y_next - y_cur) ** 2)
n = math.ceil(section_length * dpi)
if n != 0:
step_p = (y_next - y_cur) / float(n)
step_len = section_length / float(n)
for i in range(0, n):
tmp_y = y_cur + step_p * (i + 0.5)
res_arr.insert(0, [x_cur, tmp_y, step_len])
return res_arr
def contains_point(self, x, y):
if x > self.get_x_max() or x < self.get_x_min():
return False
return self.get_top_border(x) >= y and self.get_bottom_border(x) <= y
| 46.609929 | 145 | 0.549452 | 1,052 | 6,572 | 3.113118 | 0.078897 | 0.18626 | 0.242137 | 0.145344 | 0.759695 | 0.718168 | 0.665649 | 0.629008 | 0.564886 | 0.553893 | 0 | 0.03352 | 0.319081 | 6,572 | 140 | 146 | 46.942857 | 0.698324 | 0.020085 | 0 | 0.392 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.104 | false | 0 | 0.008 | 0.04 | 0.288 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
89d3bf0df91591781ea747a7755b48cfdfadf9ad | 783 | py | Python | lists/management/commands/seed_list.py | nasir733/airbnb-clone | 9ac746b6f3f3c8fc45f97773266e6f5f182d14b9 | [
"MIT"
] | null | null | null | lists/management/commands/seed_list.py | nasir733/airbnb-clone | 9ac746b6f3f3c8fc45f97773266e6f5f182d14b9 | [
"MIT"
] | null | null | null | lists/management/commands/seed_list.py | nasir733/airbnb-clone | 9ac746b6f3f3c8fc45f97773266e6f5f182d14b9 | [
"MIT"
] | null | null | null | import random
from django.core.management.base import BaseCommand
from django.contrib.admin.utils import flatten
from django_seed import Seed
from lists import models as list_models
from users import models as user_models
from rooms import models as room_models
NAME = "lists"
class Command(BaseCommand):
help = f"This command creates {NAME}"
def handle(self, *args, **options):
users = user_models.User.objects.all()
rooms = room_models.Room.objects.all()
for user in users:
list_model = list_models.List.objects.create(user=user, name="Favs.")
to_add = rooms[random.randint(0, 5) : random.randint(6, 30)]
list_model.rooms.add(*to_add)
self.stdout.write(self.style.SUCCESS(f"{0} {NAME} created!"))
| 29 | 81 | 0.696041 | 112 | 783 | 4.767857 | 0.464286 | 0.05618 | 0.078652 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009569 | 0.199234 | 783 | 26 | 82 | 30.115385 | 0.842105 | 0 | 0 | 0 | 0 | 0 | 0.07152 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0.388889 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
89d9126f3e319e5ec89708f1f4c286d5fd016235 | 356 | py | Python | catalog_harvesting/util.py | ioos/catalog-harvesting | 7674f9d0aba21032737f09364db6cd0afa3664cc | [
"MIT"
] | null | null | null | catalog_harvesting/util.py | ioos/catalog-harvesting | 7674f9d0aba21032737f09364db6cd0afa3664cc | [
"MIT"
] | 17 | 2016-07-01T18:52:20.000Z | 2021-12-13T19:48:50.000Z | catalog_harvesting/util.py | ioos/catalog-harvesting | 7674f9d0aba21032737f09364db6cd0afa3664cc | [
"MIT"
] | 4 | 2016-06-28T15:29:28.000Z | 2017-05-16T18:54:04.000Z | #!/usr/bin/env python
'''
catalog_harvesting/util.py
General utilities for the project
'''
import random
def unique_id():
'''
Return a random 17-character string that works well for mongo IDs
'''
charmap = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
return ''.join([random.choice(charmap) for i in range(17)])
| 19.777778 | 78 | 0.72191 | 42 | 356 | 6.071429 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047458 | 0.171348 | 356 | 17 | 79 | 20.941176 | 0.816949 | 0.41573 | 0 | 0 | 0 | 0 | 0.338798 | 0.338798 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
89e0907a323d313394f560697c26056210dde316 | 375 | py | Python | users/views.py | migleankstutyte/kaavapino | 1fd0b642a66f1ec7c61decf46433dc9f0bf3ed8e | [
"MIT"
] | 3 | 2019-02-07T14:47:00.000Z | 2022-02-15T14:09:38.000Z | users/views.py | migleankstutyte/kaavapino | 1fd0b642a66f1ec7c61decf46433dc9f0bf3ed8e | [
"MIT"
] | 74 | 2017-12-13T09:18:04.000Z | 2022-03-11T23:29:59.000Z | users/views.py | migleankstutyte/kaavapino | 1fd0b642a66f1ec7c61decf46433dc9f0bf3ed8e | [
"MIT"
] | 8 | 2017-12-13T09:31:20.000Z | 2022-02-15T13:10:34.000Z | from django.contrib.auth import get_user_model
from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet
from users.serializers import UserSerializer
class UserViewSet(mixins.RetrieveModelMixin, mixins.ListModelMixin, GenericViewSet):
queryset = get_user_model().objects.all()
serializer_class = UserSerializer
lookup_field = "uuid"
| 31.25 | 84 | 0.824 | 43 | 375 | 7 | 0.627907 | 0.046512 | 0.079734 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117333 | 375 | 11 | 85 | 34.090909 | 0.909366 | 0 | 0 | 0 | 0 | 0 | 0.010667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
89f877e4490404ffc1a3340b3e037743f3566d9c | 302 | py | Python | cli4/__main__.py | pygrigori/python-cloudflare | d7cdb0cd5b0408b30c403d4d83915466a1e3d558 | [
"MIT"
] | 465 | 2016-05-07T00:22:59.000Z | 2022-03-31T08:36:24.000Z | cli4/__main__.py | pygrigori/python-cloudflare | d7cdb0cd5b0408b30c403d4d83915466a1e3d558 | [
"MIT"
] | 129 | 2016-05-17T08:00:15.000Z | 2022-03-31T23:09:36.000Z | cli4/__main__.py | pygrigori/python-cloudflare | d7cdb0cd5b0408b30c403d4d83915466a1e3d558 | [
"MIT"
] | 167 | 2016-05-09T16:19:27.000Z | 2022-03-31T07:19:18.000Z | #!/usr/bin/env python
"""Cloudflare API via command line"""
from __future__ import absolute_import
import sys
from .cli4 import cli4
def main(args=None):
"""Cloudflare API via command line"""
if args is None:
args = sys.argv[1:]
cli4(args)
if __name__ == '__main__':
main()
| 17.764706 | 41 | 0.662252 | 43 | 302 | 4.348837 | 0.55814 | 0.139037 | 0.171123 | 0.245989 | 0.28877 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016878 | 0.215232 | 302 | 16 | 42 | 18.875 | 0.772152 | 0.278146 | 0 | 0 | 0 | 0 | 0.038647 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
89fd8cdfeb3e77602c5bf98124fe6cf01b3a5355 | 91 | py | Python | test_example.py | cmput401-fall2018/web-app-ci-cd-with-travis-ci-pennyfea | 87532a9ed76b1a06dbc40e18b1c774f3b597388e | [
"MIT"
] | null | null | null | test_example.py | cmput401-fall2018/web-app-ci-cd-with-travis-ci-pennyfea | 87532a9ed76b1a06dbc40e18b1c774f3b597388e | [
"MIT"
] | null | null | null | test_example.py | cmput401-fall2018/web-app-ci-cd-with-travis-ci-pennyfea | 87532a9ed76b1a06dbc40e18b1c774f3b597388e | [
"MIT"
] | null | null | null | def test_example():
num1 = 1
num2 = 3
if num2 > num1:
print("Working")
| 15.166667 | 24 | 0.516484 | 12 | 91 | 3.833333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103448 | 0.362637 | 91 | 5 | 25 | 18.2 | 0.689655 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d607c50df384a8836cc766ca7abe51f12d75551d | 13,980 | py | Python | deploy/alembic/versions/6fb351569d30_create_tables.py | gordon-elliott/glod | a381e21455d05d9c005942a3dee4ac67e10f366a | [
"MIT"
] | null | null | null | deploy/alembic/versions/6fb351569d30_create_tables.py | gordon-elliott/glod | a381e21455d05d9c005942a3dee4ac67e10f366a | [
"MIT"
] | 1 | 2021-03-10T16:48:34.000Z | 2021-03-10T16:48:34.000Z | deploy/alembic/versions/6fb351569d30_create_tables.py | gordon-elliott/glod | a381e21455d05d9c005942a3dee4ac67e10f366a | [
"MIT"
] | null | null | null | """create tables
Revision ID: 6fb351569d30
Revises: 4f72de1ff38b
Create Date: 2019-05-06 21:59:43.998735
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6fb351569d30'
down_revision = '4f72de1ff38b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('account',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('reference_no', sa.Integer(), nullable=True),
sa.Column('purpose', sa.String(length=64), nullable=True),
sa.Column('status', sa.Enum('Active', 'Closed', name='accountstatus', schema='glod', inherit_schema=True), nullable=True),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('institution', sa.String(length=64), nullable=True),
sa.Column('sort_code', sa.String(length=64), nullable=True),
sa.Column('account_no', sa.String(length=64), nullable=True),
sa.Column('BIC', sa.String(length=64), nullable=True),
sa.Column('IBAN', sa.String(length=64), nullable=True),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('address',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('address1', sa.String(length=64), nullable=True),
sa.Column('address2', sa.String(length=64), nullable=True),
sa.Column('address3', sa.String(length=64), nullable=True),
sa.Column('county', sa.String(length=64), nullable=True),
sa.Column('countryISO', sa.String(length=64), nullable=True),
sa.Column('eircode', sa.String(length=64), nullable=True),
sa.Column('telephone', sa.String(length=64), nullable=True),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('household',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('reference_no', sa.Integer(), nullable=True),
sa.Column('address1', sa.String(length=64), nullable=True),
sa.Column('address2', sa.String(length=64), nullable=True),
sa.Column('address3', sa.String(length=64), nullable=True),
sa.Column('county', sa.String(length=64), nullable=True),
sa.Column('eircode', sa.String(length=64), nullable=True),
sa.Column('telephone', sa.String(length=64), nullable=True),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('nominal_account',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('code', sa.String(length=64), nullable=True),
sa.Column('description', sa.String(length=64), nullable=True),
sa.Column('SOFA_heading', sa.Enum('Donations_and_legacies', 'Income_from_charitable_activities', 'Other_trading_activities', 'Investments', 'Other_income', 'Raising_funds', 'Expenditure_on_charitable_activities', 'Other_expenditure', name='nominalaccountsofaheading', schema='glod', inherit_schema=True), nullable=True),
sa.Column('category', sa.Enum('Income', 'Expenditure', 'Fixed_assets', 'Current_assets', 'Liabilities', name='nominalaccountcategory', schema='glod', inherit_schema=True), nullable=True),
sa.Column('sub_category', sa.Enum('Tangible_assets', 'Investments', 'Debtors', 'Cash_at_bank_and_in_hand', 'Creditors_Amounts_falling_due_in_one_year', 'Creditors_Amounts_falling_due_after_more_than_one_year', 'Agency_accounts', 'Reserves', name='nominalaccountsubcategory', schema='glod', inherit_schema=True), nullable=True),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('organisation',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('category', sa.Enum('Household', 'NonLocalHousehold', 'Company', 'Charity', 'Government', name='organisationcategory', schema='glod', inherit_schema=True), nullable=True),
sa.Column('status', sa.Enum('Active', 'Inactive', name='organisationstatus', schema='glod', inherit_schema=True), nullable=True),
sa.Column('reference_no', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('parishioner',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('reference_no', sa.Integer(), nullable=True),
sa.Column('surname', sa.String(length=64), nullable=True),
sa.Column('first_name', sa.String(length=64), nullable=True),
sa.Column('title', sa.String(length=64), nullable=True),
sa.Column('status', sa.String(length=64), nullable=True),
sa.Column('main_contact', sa.String(length=64), nullable=True),
sa.Column('household_ref_no', sa.Integer(), nullable=True),
sa.Column('mobile', sa.String(length=64), nullable=True),
sa.Column('other', sa.String(length=64), nullable=True),
sa.Column('email', sa.String(length=64), nullable=True),
sa.Column('gdpr_response', sa.String(length=64), nullable=True),
sa.Column('by_email', sa.String(length=64), nullable=True),
sa.Column('by_phone', sa.String(length=64), nullable=True),
sa.Column('by_post', sa.String(length=64), nullable=True),
sa.Column('news', sa.String(length=64), nullable=True),
sa.Column('finance', sa.String(length=64), nullable=True),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('subject',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('select_vestry_summary', sa.String(length=64), nullable=True),
sa.Column('easter_vestry_summary', sa.String(length=64), nullable=True),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('fund',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('restriction', sa.Enum('Unrestricted', 'Restricted', 'Endowment', name='fundrestriction', schema='glod', inherit_schema=True), nullable=True),
sa.Column('is_parish_fund', sa.Boolean(), nullable=True),
sa.Column('is_realised', sa.Boolean(), nullable=True),
sa.Column('account_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['account_id'], ['glod.account.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('organisation_address',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('status', sa.Enum('Current', 'Prior', name='organisationaddressstatus', schema='glod', inherit_schema=True), nullable=True),
sa.Column('address_id', sa.Integer(), nullable=True),
sa.Column('organisation_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['address_id'], ['glod.address.id'], ),
sa.ForeignKeyConstraint(['organisation_id'], ['glod.organisation.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('person',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('family_name', sa.String(length=64), nullable=True),
sa.Column('given_name', sa.String(length=64), nullable=True),
sa.Column('title', sa.String(length=64), nullable=True),
sa.Column('status', sa.Enum('Active', 'LostContact', 'Deceased', name='personstatus', schema='glod', inherit_schema=True), nullable=True),
sa.Column('mobile', sa.String(length=64), nullable=True),
sa.Column('other_phone', sa.String(length=64), nullable=True),
sa.Column('email', sa.String(length=64), nullable=True),
sa.Column('parishioner_reference_no', sa.Integer(), nullable=True),
sa.Column('organisation_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['organisation_id'], ['glod.organisation.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('statement_item',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('date', sa.Date(), nullable=True),
sa.Column('details', sa.String(length=64), nullable=True),
sa.Column('currency', sa.String(length=64), nullable=True),
sa.Column('debit', sa.Numeric(scale=2), nullable=True),
sa.Column('credit', sa.Numeric(scale=2), nullable=True),
sa.Column('balance', sa.Numeric(scale=2), nullable=True),
sa.Column('detail_override', sa.String(length=64), nullable=True),
sa.Column('designated_balance', sa.Enum('No', 'Opening', 'Closing', name='statementitemdesignatedbalance', schema='glod', inherit_schema=True), nullable=True),
sa.Column('account_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['account_id'], ['glod.account.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('communication_permission',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('is_main_contact', sa.Boolean(), nullable=True),
sa.Column('gdpr_response', sa.DateTime(), nullable=True),
sa.Column('by_email', sa.Boolean(), nullable=True),
sa.Column('by_phone', sa.Boolean(), nullable=True),
sa.Column('by_post', sa.Boolean(), nullable=True),
sa.Column('news', sa.Boolean(), nullable=True),
sa.Column('finance', sa.Boolean(), nullable=True),
sa.Column('person_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['person_id'], ['glod.person.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('counterparty',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('reference_no', sa.Integer(), nullable=True),
sa.Column('bank_text', sa.String(length=64), nullable=True),
sa.Column('name_override', sa.String(length=64), nullable=True),
sa.Column('method', sa.String(length=64), nullable=True),
sa.Column('has_SO_card', sa.Boolean(), nullable=True),
sa.Column('by_email', sa.Boolean(), nullable=True),
sa.Column('notes', sa.String(length=1024), nullable=True),
sa.Column('person_id', sa.Integer(), nullable=True),
sa.Column('organisation_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['organisation_id'], ['glod.organisation.id'], ),
sa.ForeignKeyConstraint(['person_id'], ['glod.person.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('pps',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('pps', sa.String(length=64), nullable=True),
sa.Column('name_override', sa.String(length=64), nullable=True),
sa.Column('notes', sa.String(length=1024), nullable=True),
sa.Column('person_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['person_id'], ['glod.person.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('envelope',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=True),
sa.Column('envelope_number', sa.Integer(), nullable=True),
sa.Column('counterparty_id', sa.Integer(), nullable=True),
sa.Column('person_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['counterparty_id'], ['glod.counterparty.id'], ),
sa.ForeignKeyConstraint(['person_id'], ['glod.person.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('transaction',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('reference_no', sa.Integer(), nullable=True),
sa.Column('public_code', sa.String(length=64), nullable=True),
sa.Column('year', sa.Integer(), nullable=True),
sa.Column('month', sa.Integer(), nullable=True),
sa.Column('day', sa.Integer(), nullable=True),
sa.Column('payment_method', sa.Enum('BankCharges', 'BankTax', 'BillpayOnline', 'CashLodgmentEnvelopes', 'CashLodgmentOther', 'CashLodgmentPlate', 'Cheque', 'DirectDebit', 'DirectPayment', 'DirectTransfer', 'InBranch', 'StandingOrderMonthly', 'StandingOrderOther', 'StandingOrderQuarterly', 'StandingOrders', 'UnrealisedGainLoss', name='paymentmethod', schema='glod', inherit_schema=True), nullable=True),
sa.Column('description', sa.String(length=1024), nullable=True),
sa.Column('amount', sa.Numeric(scale=2), nullable=True),
sa.Column('income_expenditure', sa.Enum('Income', 'Expenditure', name='incomeexpenditure', schema='glod', inherit_schema=True), nullable=True),
sa.Column('FY', sa.String(length=64), nullable=True),
sa.Column('comments', sa.String(length=1024), nullable=True),
sa.Column('counterparty_id', sa.Integer(), nullable=True),
sa.Column('subject_id', sa.Integer(), nullable=True),
sa.Column('fund_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['counterparty_id'], ['glod.counterparty.id'], ),
sa.ForeignKeyConstraint(['fund_id'], ['glod.fund.id'], ),
sa.ForeignKeyConstraint(['subject_id'], ['glod.subject.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
op.create_table('transaction_check',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('transaction_id', sa.Integer(), nullable=True),
sa.Column('statement_item_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['statement_item_id'], ['glod.statement_item.id'], ),
sa.ForeignKeyConstraint(['transaction_id'], ['glod.transaction.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='glod'
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('transaction_check', schema='glod')
op.drop_table('transaction', schema='glod')
op.drop_table('envelope', schema='glod')
op.drop_table('pps', schema='glod')
op.drop_table('counterparty', schema='glod')
op.drop_table('communication_permission', schema='glod')
op.drop_table('statement_item', schema='glod')
op.drop_table('person', schema='glod')
op.drop_table('organisation_address', schema='glod')
op.drop_table('fund', schema='glod')
op.drop_table('subject', schema='glod')
op.drop_table('parishioner', schema='glod')
op.drop_table('organisation', schema='glod')
op.drop_table('nominal_account', schema='glod')
op.drop_table('household', schema='glod')
op.drop_table('address', schema='glod')
op.drop_table('account', schema='glod')
# ### end Alembic commands ###
| 53.155894 | 408 | 0.686767 | 1,762 | 13,980 | 5.3479 | 0.128263 | 0.114613 | 0.175316 | 0.214369 | 0.770349 | 0.736284 | 0.698185 | 0.671761 | 0.583254 | 0.455057 | 0 | 0.01545 | 0.120315 | 13,980 | 262 | 409 | 53.358779 | 0.750772 | 0.021102 | 0 | 0.446721 | 0 | 0 | 0.236225 | 0.039566 | 0 | 0 | 0 | 0 | 0 | 1 | 0.008197 | false | 0 | 0.008197 | 0 | 0.016393 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d60ba3512a50dda2a4e6cd60cfa185e17be8c13c | 1,792 | py | Python | moderngl_window/timers/base.py | DavideRuzza/moderngl-window | e9debc6ed4a1899aa83c0da2320e03b0c2922b80 | [
"MIT"
] | 142 | 2019-11-11T23:14:28.000Z | 2022-03-29T08:37:03.000Z | moderngl_window/timers/base.py | DavideRuzza/moderngl-window | e9debc6ed4a1899aa83c0da2320e03b0c2922b80 | [
"MIT"
] | 107 | 2019-10-31T20:31:45.000Z | 2022-03-23T15:01:41.000Z | moderngl_window/timers/base.py | DavideRuzza/moderngl-window | e9debc6ed4a1899aa83c0da2320e03b0c2922b80 | [
"MIT"
] | 36 | 2019-12-12T16:14:10.000Z | 2022-01-18T22:58:21.000Z | from typing import Tuple
class BaseTimer:
"""
A timer controls the time passed into the the render function.
This can be used in creative ways to control the current time
such as basing it on current location in an audio file.
All methods must be implemented.
"""
@property
def is_paused(self) -> bool:
"""bool: The pause state of the timer"""
raise NotImplementedError()
@property
def is_running(self) -> bool:
"""bool: Is the timer currently running?"""
raise NotImplementedError()
@property
def time(self) -> float:
"""Get or set the current time.
This can be used to jump around in the timeline.
Returns:
float: The current time in seconds
"""
raise NotImplementedError()
@time.setter
def time(self, value: float):
raise NotImplementedError()
def next_frame(self) -> Tuple[float, float]:
"""Get timer information for the next frame.
Returns:
Tuple[float, float]: The frametime and current time
"""
raise NotImplementedError()
def start(self):
"""Start the timer initially or resume after pause"""
raise NotImplementedError()
def pause(self):
"""Pause the timer"""
raise NotImplementedError()
def toggle_pause(self):
"""Toggle pause state"""
raise NotImplementedError()
def stop(self) -> Tuple[float, float]:
"""
Stop the timer. Should only be called once when stopping the timer.
Returns:
Tuple[float, float]> Current position in the timer, actual running duration
"""
raise NotImplementedError()
| 27.569231 | 88 | 0.592076 | 200 | 1,792 | 5.285 | 0.415 | 0.204352 | 0.12772 | 0.024598 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.325893 | 1,792 | 64 | 89 | 28 | 0.875 | 0.425781 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0 | 0.041667 | 0 | 0.458333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d60c263256042297b276978adacf12014f153b54 | 327 | py | Python | accounts/views.py | aryasadeghy/simpleSocial | 46c1f83a07817efbd095507303c66353fe1ae932 | [
"MIT"
] | null | null | null | accounts/views.py | aryasadeghy/simpleSocial | 46c1f83a07817efbd095507303c66353fe1ae932 | [
"MIT"
] | 6 | 2020-02-11T22:54:25.000Z | 2022-01-13T00:47:14.000Z | accounts/views.py | aryasadeghy/simpleSocial | 46c1f83a07817efbd095507303c66353fe1ae932 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.views.generic import CreateView
from django.urls import reverse_lazy
from accounts.forms import UserCreateForm
# Create your views here.
class Signup(CreateView):
form_class = UserCreateForm
success_url = reverse_lazy('login')
template_name = "accounts/signup.html" | 29.727273 | 43 | 0.798165 | 42 | 327 | 6.095238 | 0.619048 | 0.117188 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137615 | 327 | 11 | 44 | 29.727273 | 0.907801 | 0.070336 | 0 | 0 | 0 | 0 | 0.082508 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
d63dd2c75a7d51524459ca564e7f8c459de9700b | 352 | py | Python | Students/Zephyr/Exercise 1.py | MikelShifrin/Python1 | 0096a327023a28e0c639042ae01268b07e61943e | [
"MIT"
] | 3 | 2019-07-02T13:46:23.000Z | 2019-08-19T14:41:25.000Z | Students/Zephyr/Exercise 1.py | MikelShifrin/Python1 | 0096a327023a28e0c639042ae01268b07e61943e | [
"MIT"
] | null | null | null | Students/Zephyr/Exercise 1.py | MikelShifrin/Python1 | 0096a327023a28e0c639042ae01268b07e61943e | [
"MIT"
] | null | null | null | name = input('Please enter your name:\n')
age = int(input("Please enter your age:\n"))
color = input('Enter your favorite color:\n')
animal = input('Enter your favorite animal:\n')
print('Hello my name is' , name , '.')
print('I am' , age , 'years old.')
print('My favorite color is' , color ,'.')
print('My favorite animal is the' , animal , '.')
| 27.076923 | 49 | 0.644886 | 54 | 352 | 4.203704 | 0.37037 | 0.15859 | 0.140969 | 0.176211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167614 | 352 | 12 | 50 | 29.333333 | 0.774744 | 0 | 0 | 0 | 0 | 0 | 0.522727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
d643ba8252478c881a1cbb108bed0d0c073a4c21 | 2,532 | py | Python | ElexonDataPortal/vis/curtailment.py | r4ch45/ElexonDataPortal | d44ed4da33278c0135ff95fb126a10d9384af22f | [
"MIT"
] | 22 | 2021-01-12T12:34:43.000Z | 2022-03-30T06:18:40.000Z | ElexonDataPortal/vis/curtailment.py | r4ch45/ElexonDataPortal | d44ed4da33278c0135ff95fb126a10d9384af22f | [
"MIT"
] | 12 | 2021-02-26T16:17:58.000Z | 2022-03-29T19:32:29.000Z | ElexonDataPortal/vis/curtailment.py | r4ch45/ElexonDataPortal | d44ed4da33278c0135ff95fb126a10d9384af22f | [
"MIT"
] | 6 | 2021-06-07T11:58:35.000Z | 2022-03-30T06:18:42.000Z | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/vis-02-curtailment.ipynb (unless otherwise specified).
__all__ = ['get_wf_ids', 'flatten_list', 'get_curtailed_wfs_df', 'load_curtailed_wfs',
'add_next_week_of_data_to_curtailed_wfs']
# Cell
flatten_list = lambda list_: [item for sublist in list_ for item in sublist]
def get_wf_ids(dictionary_url='https://raw.githubusercontent.com/OSUKED/Power-Station-Dictionary/main/data/output/power_stations.csv'):
df_dictionary = pd.read_csv(dictionary_url)
wf_ids = flatten_list(df_dictionary.query('fuel_type=="wind"')['sett_bmu_id'].str.split(', ').to_list())
return wf_ids
# Cell
def get_curtailed_wfs_df(
api_key: str=None,
start_date: str = '2020-01-01',
end_date: str = '2020-01-01 1:30',
wf_ids: list=None,
dictionary_url: str='https://raw.githubusercontent.com/OSUKED/Power-Station-Dictionary/main/data/output/power_stations.csv'
):
if wf_ids is None:
wf_ids = get_wf_ids(dictionary_url=dictionary_url)
client = Client()
df_detsysprices = client.get_DETSYSPRICES(start_date, end_date)
df_curtailed_wfs = (df_detsysprices
.query('recordType=="BID" & soFlag=="T" & id in @wf_ids')
.astype({'bidVolume': float})
.groupby(['local_datetime', 'id'])
['bidVolume']
.sum()
.reset_index()
.pivot('local_datetime', 'id', 'bidVolume')
)
return df_curtailed_wfs
# Cell
def load_curtailed_wfs(
curtailed_wfs_fp: str='data/curtailed_wfs.csv'
):
df_curtailed_wfs = pd.read_csv(curtailed_wfs_fp)
df_curtailed_wfs = df_curtailed_wfs.set_index('local_datetime')
df_curtailed_wfs.index = pd.to_datetime(df_curtailed_wfs.index, utc=True).tz_convert('Europe/London')
return df_curtailed_wfs
# Cell
def add_next_week_of_data_to_curtailed_wfs(
curtailed_wfs_fp: str='data/curtailed_wfs.csv',
save_data: bool=True,
):
df_curtailed_wfs = load_curtailed_wfs(curtailed_wfs_fp)
most_recent_ts = df_curtailed_wfs.index.max()
start_date = most_recent_ts + pd.Timedelta(minutes=30)
end_date = start_date + pd.Timedelta(days=7)
client = Client()
df_curtailed_wfs_wk = get_curtailed_wfs_df(start_date=start_date, end_date=end_date, wf_ids=wf_ids)
df_curtailed_wfs = df_curtailed_wfs.append(df_curtailed_wfs_wk)
df_curtailed_wfs.to_csv(curtailed_wfs_fp)
return df_curtailed_wfs | 36.695652 | 135 | 0.690363 | 355 | 2,532 | 4.526761 | 0.307042 | 0.231487 | 0.13939 | 0.031736 | 0.365899 | 0.287492 | 0.197884 | 0.197884 | 0.16677 | 0.16677 | 0 | 0.011817 | 0.197867 | 2,532 | 69 | 136 | 36.695652 | 0.779419 | 0.047393 | 0 | 0.166667 | 1 | 0.041667 | 0.221022 | 0.034067 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0 | 0 | 0.166667 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c38411b92515ccabaac79cf9fee8dda8f91e01e8 | 1,343 | py | Python | tournament.py | feat7/chess_lm | 1e8538b980f19616d5042557612024e76f1a1ca6 | [
"MIT"
] | null | null | null | tournament.py | feat7/chess_lm | 1e8538b980f19616d5042557612024e76f1a1ca6 | [
"MIT"
] | null | null | null | tournament.py | feat7/chess_lm | 1e8538b980f19616d5042557612024e76f1a1ca6 | [
"MIT"
] | null | null | null | # """run the models and calculate ELO ratings
# 19.11.2020 - @yashbonde"""
# from argparse import ArgumentParser
# from chess_lm.model import ModelConfig
# from chess_lm.game import Player
# import torch
# def expected(p1, p2):
# return 1 / (1 - 10 ** ((p2 - p1) / 400))
# def elo(p, e, s, k=32):
# return p + k * (s - e)
# def new_elos_after_tournament(p1, p2, s):
# e = 0
# for _p2 in p2:
# e += expected(p1, _p2)
# _p1 = elo(p1, expected(p1, p2), s)
# return _p1
# # ---- script
# args = ArgumentParser(
# description='run tournament and obtain ELO ratings of different models')
# args.add_argument("--m1", type=str, default=".model_sample/z4_0.pt",
# help="path to first model checkpoint file")
# args.add_argument("--m2", type=str, default=".model_sample/z4_0.pt",
# help="path to second model checkpoint file")
# args.add_argument("--num_rounds", type=int, default=800,
# help="number of rounds in the tournament")
# args = args.parse_args()
# # make the baseline configuration and load the models
# config = ModelConfig(
# vocab_size=1793, # Fix: Model shape mismatch error
# n_ctx=60,
# n_embd=128,
# n_head=8,
# n_layer=30,
# n_positions=60,
# )
# m1 = Player(config, args.m1)
# m1 = Player(config, args.m2)
| 27.408163 | 78 | 0.619509 | 193 | 1,343 | 4.186529 | 0.481865 | 0.019802 | 0.044554 | 0.04703 | 0.183168 | 0.183168 | 0.09901 | 0.09901 | 0.09901 | 0.09901 | 0 | 0.058423 | 0.235294 | 1,343 | 48 | 79 | 27.979167 | 0.728335 | 0.93373 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c38bc9c5d5c49a6041942f29f1c2c82abcfe2e97 | 290 | py | Python | ex049.py | igormba/python-exercises | 000190c4b62dc64bbb2fb039a103890945b88fa5 | [
"MIT"
] | null | null | null | ex049.py | igormba/python-exercises | 000190c4b62dc64bbb2fb039a103890945b88fa5 | [
"MIT"
] | null | null | null | ex049.py | igormba/python-exercises | 000190c4b62dc64bbb2fb039a103890945b88fa5 | [
"MIT"
] | null | null | null | '''Rafaça o DESAFIO 009, mostrando a tabuada de um número que o usuário escolher, só que agora utilizando um laço for.'''
n = int(input('Digite um número para ver sua tabuada: '))
print('-' * 12)
for tabu in range(0, 11):
print('{} x {:2} = {}'.format(n, tabu, n*tabu))
print('-' * 12) | 41.428571 | 121 | 0.641379 | 49 | 290 | 3.795918 | 0.714286 | 0.086022 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046414 | 0.182759 | 290 | 7 | 122 | 41.428571 | 0.738397 | 0.396552 | 0 | 0.4 | 0 | 0 | 0.323529 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.6 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
c39e74a510420ce0e428d6654b2c91df1ac7a9d5 | 162 | py | Python | sta_etl/__init__.py | XeBoris/git-etl | 888f26e51a797dd111c9ca457a0c83b4f00296f0 | [
"MIT"
] | null | null | null | sta_etl/__init__.py | XeBoris/git-etl | 888f26e51a797dd111c9ca457a0c83b4f00296f0 | [
"MIT"
] | null | null | null | sta_etl/__init__.py | XeBoris/git-etl | 888f26e51a797dd111c9ca457a0c83b4f00296f0 | [
"MIT"
] | null | null | null | """Top-level package for sta-etl."""
__author__ = """Boris Bauermeister"""
__email__ = 'Boris.Bauermeister@gmail'
__version__ = '0.1.0'
#from sta_etl import *
| 18 | 38 | 0.697531 | 21 | 162 | 4.761905 | 0.761905 | 0.12 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021277 | 0.12963 | 162 | 8 | 39 | 20.25 | 0.687943 | 0.320988 | 0 | 0 | 0 | 0 | 0.451923 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c3ae4ba07955d7042040649cd40e5479799ed431 | 1,929 | py | Python | py/py_0527_randomized_binary_search.py | lcsm29/project-euler | fab794ece5aa7a11fc7c2177f26250f40a5b1447 | [
"MIT"
] | null | null | null | py/py_0527_randomized_binary_search.py | lcsm29/project-euler | fab794ece5aa7a11fc7c2177f26250f40a5b1447 | [
"MIT"
] | null | null | null | py/py_0527_randomized_binary_search.py | lcsm29/project-euler | fab794ece5aa7a11fc7c2177f26250f40a5b1447 | [
"MIT"
] | null | null | null | # Solution of;
# Project Euler Problem 527: Randomized Binary Search
# https://projecteuler.net/problem=527
#
# A secret integer t is selected at random within the range 1 ≤ t ≤ n. The
# goal is to guess the value of t by making repeated guesses, via integer g.
# After a guess is made, there are three possible outcomes, in which it will
# be revealed that either g < t, g = t, or g > t. Then the process can repeat
# as necessary. Normally, the number of guesses required on average can be
# minimized with a binary search: Given a lower bound L and upper bound H
# (initialized to L = 1 and H = n), let g = ⌊(L+H)/2⌋ where ⌊⋅⌋ is the integer
# floor function. If g = t, the process ends. Otherwise, if g < t, set L =
# g+1, but if g > t instead, set H = g−1. After setting the new bounds, the
# search process repeats, and ultimately ends once t is found. Even if t can
# be deduced without searching, assume that a search will be required anyway
# to confirm the value. Your friend Bob believes that the standard binary
# search is not that much better than his randomized variant: Instead of
# setting g = ⌊(L+H)/2⌋, simply let g be a random integer between L and H,
# inclusive. The rest of the algorithm is the same as the standard binary
# search. This new search routine will be referred to as a random binary
# search. Given that 1 ≤ t ≤ n for random t, let B(n) be the expected number
# of guesses needed to find t using the standard binary search, and let R(n)
# be the expected number of guesses needed to find t using the random binary
# search. For example, B(6) = 2. 33333333 and R(6) = 2. 71666667 when rounded
# to 8 decimal places. Find R(1010) − B(1010) rounded to 8 decimal places.
#
# by lcsm29 http://github.com/lcsm29/project-euler
import timed
def dummy(n):
pass
if __name__ == '__main__':
n = 1000
i = 10000
prob_id = 527
timed.caller(dummy, n, i, prob_id)
| 48.225 | 79 | 0.708657 | 354 | 1,929 | 3.870057 | 0.440678 | 0.061314 | 0.032847 | 0.050365 | 0.122628 | 0.081752 | 0.072993 | 0.072993 | 0.072993 | 0.072993 | 0 | 0.038944 | 0.214619 | 1,929 | 39 | 80 | 49.461538 | 0.856766 | 0.893209 | 0 | 0 | 0 | 0 | 0.044944 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.125 | 0.125 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
c3af215854abd4c90a3e4ca46f61b27b360bf47e | 242 | py | Python | NOV_17_2020/quiz2.py | refeed/PAlgoritmaTRPLA | e0c79c1d57bee0869e2344651718e8cf053c035f | [
"MIT"
] | null | null | null | NOV_17_2020/quiz2.py | refeed/PAlgoritmaTRPLA | e0c79c1d57bee0869e2344651718e8cf053c035f | [
"MIT"
] | null | null | null | NOV_17_2020/quiz2.py | refeed/PAlgoritmaTRPLA | e0c79c1d57bee0869e2344651718e8cf053c035f | [
"MIT"
] | null | null | null | '''
No 2. Buatlah fungsi tanpa pengembalian nilai, yaitu fungsi segitigabintang.
Misal, jika dipanggil dg segitigabintang(4), keluarannya :
*
**
***
****
'''
def segitigabintang(baris):
for i in range(baris):
print('*' * (i+1))
| 18.615385 | 77 | 0.64876 | 28 | 242 | 5.607143 | 0.821429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015306 | 0.190083 | 242 | 12 | 78 | 20.166667 | 0.785714 | 0.619835 | 0 | 0 | 0 | 0 | 0.011905 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c3c0682686fc342ab84606c799f8486241e754b8 | 1,547 | py | Python | python/eggroll/core/datastructure/__init__.py | liszekei/eggroll | 6a8cc5e1c9106d2633dc415092151f921f003743 | [
"Apache-2.0"
] | 209 | 2019-08-08T18:38:26.000Z | 2022-03-23T06:20:40.000Z | python/eggroll/core/datastructure/__init__.py | liszekei/eggroll | 6a8cc5e1c9106d2633dc415092151f921f003743 | [
"Apache-2.0"
] | 110 | 2019-08-09T02:50:47.000Z | 2022-03-07T10:30:21.000Z | python/eggroll/core/datastructure/__init__.py | liszekei/eggroll | 6a8cc5e1c9106d2633dc415092151f921f003743 | [
"Apache-2.0"
] | 77 | 2019-08-15T08:11:52.000Z | 2022-03-23T06:19:44.000Z | # Copyright (c) 2019 - now, Eggroll 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.
from importlib import import_module
from concurrent.futures import _base, ThreadPoolExecutor
from eggroll.core.datastructure.threadpool import ErThreadUnpooledExecutor
from eggroll.core.datastructure.queue import _PySimpleQueue
from eggroll.utils.log_utils import get_logger
L = get_logger()
try:
from queue import SimpleQueue
except ImportError:
SimpleQueue = _PySimpleQueue
def create_executor_pool(canonical_name: str = None, max_workers=None, thread_name_prefix=None, *args, **kwargs) -> _base.Executor:
if not canonical_name:
canonical_name = "concurrent.futures.ThreadPoolExecutor"
module_name, class_name = canonical_name.rsplit(".", 1)
_module = import_module(module_name)
_class = getattr(_module, class_name)
return _class(max_workers=max_workers, thread_name_prefix=thread_name_prefix, *args, **kwargs)
def create_simple_queue(*args, **kwargs):
return SimpleQueue()
| 37.731707 | 131 | 0.771816 | 208 | 1,547 | 5.576923 | 0.533654 | 0.051724 | 0.041379 | 0.027586 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006865 | 0.152553 | 1,547 | 40 | 132 | 38.675 | 0.877956 | 0.383969 | 0 | 0 | 0 | 0 | 0.040512 | 0.039446 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.421053 | 0.052632 | 0.631579 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
c3c6dc209f06eeee94d2df7708439a9145986364 | 230 | py | Python | examples/test_python_folder_classify.py | TensorPy/TensorPy | d8715a843081c48cc090b7168e144f7db36faff9 | [
"MIT"
] | 45 | 2016-10-20T01:38:31.000Z | 2021-06-05T15:34:03.000Z | examples/test_python_folder_classify.py | mdmintz/TensorPy | d8715a843081c48cc090b7168e144f7db36faff9 | [
"MIT"
] | 9 | 2017-03-25T12:10:11.000Z | 2020-09-25T21:19:47.000Z | examples/test_python_folder_classify.py | mdmintz/TensorPy | d8715a843081c48cc090b7168e144f7db36faff9 | [
"MIT"
] | 33 | 2016-10-22T11:41:34.000Z | 2021-03-18T15:51:10.000Z | from tensorpy import image_base
classifications = image_base.classify_folder_images('./images')
print("*** Displaying Image Classification Results as a list: ***")
for classification in classifications:
print(classification)
| 32.857143 | 67 | 0.791304 | 26 | 230 | 6.846154 | 0.692308 | 0.101124 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113043 | 230 | 6 | 68 | 38.333333 | 0.872549 | 0 | 0 | 0 | 0 | 0 | 0.286957 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.4 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c3c861bcdbf10ce7a55f230e67e34074b5d82dda | 3,113 | py | Python | RoboticsLanguage/Tools/Exceptions.py | robotcaresystems/roboticslanguage | 3bb7a2bf64ab8e9068889713fbeb18a45cd5a3ed | [
"Apache-2.0"
] | 64 | 2018-05-15T14:36:44.000Z | 2022-03-09T05:00:31.000Z | RoboticsLanguage/Tools/Exceptions.py | robotcaresystems/roboticslanguage | 3bb7a2bf64ab8e9068889713fbeb18a45cd5a3ed | [
"Apache-2.0"
] | 9 | 2018-04-17T21:12:27.000Z | 2019-11-08T20:53:32.000Z | RoboticsLanguage/Tools/Exceptions.py | robotcaresystems/roboticslanguage | 3bb7a2bf64ab8e9068889713fbeb18a45cd5a3ed | [
"Apache-2.0"
] | 10 | 2018-03-27T12:09:12.000Z | 2021-02-16T08:07:26.000Z | #
# This is the Robotics Language compiler
#
# ErrorHandling.py: Implements Error Handling functions
#
# Created on: June 22, 2017
# Author: Gabriel A. D. Lopes
# Licence: Apache 2.0
# Copyright: 2014-2017 Robot Care Systems BV, The Hague, The Netherlands. 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 re
import sys
from contextlib import contextmanager
class ReturnException(Exception):
pass
@contextmanager
def tryToProceed():
'''
Attempts to proceed when there is an exception. This function is coupled
with the action 'return' of the exception function. For example:
from RoboticsLanguage.Tools import Exceptions
def run_function():
with Exceptions.exception('test'):
a = 'a' + 1
print 'reaches this point'
with Exceptions.exception('test', action='return'):
raise Exception('test')
print 'does not reach this point'
with Exceptions.tryToProceed():
run_function()
print 'does not reach this point'
print 'reaches this point'
'''
try:
yield
except Exception as e:
if type(e).__name__ == 'ReturnException':
pass
else:
raise e
@contextmanager
def exception(key='default', code=None, parameters={}, **options):
'''
Generic exception function used in a 'with' context. Can be used fos system/libraries exceptions,
or to generate own exceptions. Usage:
# system error
with Exceptions.exception('test'):
a = 'a' + 1
# forced error
with Exceptions.exception('forced', action='stop'):
raise Exception('name')
'''
try:
yield
except Exception as e:
# get the logger level and action if defined.
level = options['level'] if 'level' in options.keys() else 'error'
action = options['action'] if 'action' in options.keys() else None
try:
# try to identify who sent the exception
emitter = re.search("<.*'([^']*)'>", str(type(e))).group(1)
except:
emitter = 'unknown'
# show the message
showExceptionMessage(emitter, key, e, level, action)
# apply actions
if action == 'stop':
# stop the RoL script
sys.exit(1)
elif action == 'return':
# this will return the parent function
raise ReturnException
def showExceptionMessage(emitter, key, exception, level, action):
print 'emitter: ' + emitter
print 'key: ' + key
print 'exception: ' + str(exception)
print 'level: ' + level
print 'action: ' + str(action)
def raiseException(group, key, code=None, parameters={}):
with exception(group, code, parameters):
raise Exception(key)
| 26.836207 | 99 | 0.680373 | 401 | 3,113 | 5.266833 | 0.426434 | 0.028409 | 0.043561 | 0.038352 | 0.077652 | 0.077652 | 0.028409 | 0 | 0 | 0 | 0 | 0.00986 | 0.218118 | 3,113 | 115 | 100 | 27.069565 | 0.857847 | 0.317379 | 0 | 0.282051 | 0 | 0 | 0.097942 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.051282 | 0.076923 | null | null | 0.128205 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
c3c8e031aee7868f8730d77f9fc2d1e3db73ac7c | 1,020 | py | Python | data_input/__init__.py | carlosvin/pricecalculator | 2c2c409e4a7f3e7d52001b19630a37a4e1a827ae | [
"Apache-2.0"
] | null | null | null | data_input/__init__.py | carlosvin/pricecalculator | 2c2c409e4a7f3e7d52001b19630a37a4e1a827ae | [
"Apache-2.0"
] | null | null | null | data_input/__init__.py | carlosvin/pricecalculator | 2c2c409e4a7f3e7d52001b19630a37a4e1a827ae | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf8 -*-
from urllib.request import Request, urlopen
import logging
import parsing
__author__ = 'carlos'
class Downloader(object):
def __init__(self, url):
self.url = url
def read(self):
request = Request( self.url )
request.add_header('Accept-encoding', 'text/html')
response = urlopen(request)
charset = response.headers.get('charset')
data = response.read()
logging.debug('Read %u bytes from %s (%s)' % (len(data), self.url, charset))
return data
class StocksInfoUpdater(object):
def __init__(self, url):
self.downloader = Downloader(url)
self.parser = parsing.StockParser()
def update(self):
dataread = self.downloader.read()
self.parser.feed(dataread)
return self.parser.stocks
@property
def stocks(self):
return self.parser.stocks
@property
def url(self):
return self.downloader.url
| 21.702128 | 84 | 0.594118 | 110 | 1,020 | 5.390909 | 0.4 | 0.059022 | 0.043845 | 0.057336 | 0.192243 | 0.192243 | 0 | 0 | 0 | 0 | 0 | 0.001391 | 0.295098 | 1,020 | 46 | 85 | 22.173913 | 0.823366 | 0.019608 | 0 | 0.206897 | 0 | 0 | 0.063126 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.206897 | false | 0 | 0.103448 | 0.068966 | 0.517241 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c3d17c2c456d36f8cb0a5fd4496941d685d48e93 | 328 | py | Python | ch22/import_test.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | 1 | 2020-10-12T13:33:29.000Z | 2020-10-12T13:33:29.000Z | ch22/import_test.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | null | null | null | ch22/import_test.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | 1 | 2016-11-09T07:28:45.000Z | 2016-11-09T07:28:45.000Z | #!/usr/bin/env python3
import sys
import re
import time
import datetime
import os
for module in sorted(sys.modules):
print("%-20s : %s" % (module, sys.modules[module]))
print('USER : ', os.environ['USER'])
print('PWD : ', os.environ['PWD'])
print('PYTHONPATH: ', os.environ.get('PYTHONPATH'))
print(sys.path)
| 19.294118 | 55 | 0.652439 | 46 | 328 | 4.652174 | 0.521739 | 0.126168 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010909 | 0.161585 | 328 | 16 | 56 | 20.5 | 0.767273 | 0.064024 | 0 | 0 | 0 | 0 | 0.205882 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.454545 | 0 | 0.454545 | 0.454545 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 2 |
c3d49173df679851d73eb5d1c962ff92c378def9 | 1,824 | py | Python | locust/locustfile.py | FannySundlofSopra/locust-on-azure | 09a5fb7e928ffacf2f4422c9c5bd92cbb88ae80c | [
"MIT"
] | null | null | null | locust/locustfile.py | FannySundlofSopra/locust-on-azure | 09a5fb7e928ffacf2f4422c9c5bd92cbb88ae80c | [
"MIT"
] | null | null | null | locust/locustfile.py | FannySundlofSopra/locust-on-azure | 09a5fb7e928ffacf2f4422c9c5bd92cbb88ae80c | [
"MIT"
] | null | null | null | from locust import HttpUser, task, between
from locust.contrib.fasthttp import FastHttpUser
class TestUser(FastHttpUser):
@task
def viewPage(self):
self.client.get('/insamlingar/varldshjalte')
self.client.get('/webpack-runtime-72a2735cd8a1a24911f7.js')
self.client.get('/framework-3f3b31f3b6fc5c344dca.js')
self.client.get('/app-9cd3bdb66ddb863d5142.js')
self.client.get('/styles-407fe62976dc5310c43e.js')
self.client.get('/commons-16f36d497b002bdafac4.js')
self.client.get('/9c31700cf97414fc836e3860377cce64191bc134-9c53b563cbb98335accd.js.js')
self.client.get('/component---src-templates-page-template-tsx-6c62c930e383b3f3ce6b.js')
self.client.get('/page-data/insamlingar/varldshjalte/page-data.json')
self.client.get('/page-data/sq/d/1014302582.json')
self.client.get('/page-data/sq/d/1203226985.json')
self.client.get('/page-data/sq/d/1677386854.json')
self.client.get('/page-data/sq/d/187643644.json')
self.client.get('/page-data/sq/d/28066254.json')
self.client.get('/page-data/sq/d/3200608417.json')
self.client.get('/page-data/sq/d/3296809872.json')
self.client.get('/page-data/sq/d/538779877.json')
self.client.get('/page-data/app-data.json')
self.client.get('/logo.svg')
self.client.get('/eng-flag.svg')
self.client.get('/logo-rh-sm.svg')
self.client.get('/logo-rh-md.svg')
self.client.get('/icon-chevron.svg')
self.client.get('/logo-90-konto.png')
self.client.get('/icon-facebook.svg')
self.client.get('/icon-instagram.svg')
self.client.get('/icon-twitter.svg')
self.client.get('/logo-svt.png')
self.client.get('/logo-sr.png')
self.client.get('/logo-ur.png') | 49.297297 | 95 | 0.660088 | 237 | 1,824 | 5.080169 | 0.291139 | 0.249169 | 0.32392 | 0.141196 | 0.397841 | 0.243355 | 0.186047 | 0.186047 | 0 | 0 | 0 | 0.12459 | 0.163925 | 1,824 | 37 | 96 | 49.297297 | 0.664918 | 0 | 0 | 0 | 0 | 0 | 0.450411 | 0.352877 | 0 | 0 | 0 | 0 | 0 | 1 | 0.028571 | false | 0 | 0.057143 | 0 | 0.114286 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c3d6fc016b75ad1d8fdff7a053452786b343e77c | 251 | py | Python | lino_book/projects/lydia/tests/dumps/18.12.0/invoicing_plan.py | lino-framework/lino_book | 4eab916832cd8f48ff1b9fc8c2789f0b437da0f8 | [
"BSD-2-Clause"
] | 3 | 2016-08-25T05:58:09.000Z | 2019-12-05T11:13:45.000Z | lino_book/projects/lydia/tests/dumps/18.12.0/invoicing_plan.py | lino-framework/lino_book | 4eab916832cd8f48ff1b9fc8c2789f0b437da0f8 | [
"BSD-2-Clause"
] | 18 | 2016-11-12T21:38:58.000Z | 2019-12-03T17:54:38.000Z | lino_book/projects/lydia/tests/dumps/18.12.0/invoicing_plan.py | lino-framework/lino_book | 4eab916832cd8f48ff1b9fc8c2789f0b437da0f8 | [
"BSD-2-Clause"
] | 9 | 2016-10-15T11:12:33.000Z | 2021-09-22T04:37:37.000Z | # -*- coding: UTF-8 -*-
logger.info("Loading 1 objects to table invoicing_plan...")
# fields: id, user, today, journal, max_date, partner, course
loader.save(create_invoicing_plan(1,6,date(2015,3,1),1,None,None,None))
loader.flush_deferred_objects()
| 35.857143 | 71 | 0.737052 | 40 | 251 | 4.475 | 0.75 | 0.145251 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048246 | 0.091633 | 251 | 6 | 72 | 41.833333 | 0.736842 | 0.322709 | 0 | 0 | 0 | 0 | 0.263473 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c3dac7924e9e075694dc1f3a5fa25da3cbacbc9b | 1,488 | py | Python | api/models.py | AnuragTimilsina/SchoolSystemAPI | 9ac55dc862953a075dbdc69d5c4176742d8da5b6 | [
"MIT"
] | null | null | null | api/models.py | AnuragTimilsina/SchoolSystemAPI | 9ac55dc862953a075dbdc69d5c4176742d8da5b6 | [
"MIT"
] | null | null | null | api/models.py | AnuragTimilsina/SchoolSystemAPI | 9ac55dc862953a075dbdc69d5c4176742d8da5b6 | [
"MIT"
] | 1 | 2021-07-16T11:28:36.000Z | 2021-07-16T11:28:36.000Z | from django.db import models
from users.models import User
class Assignment(models.Model):
title = models.CharField(max_length=50)
teacher = models.ForeignKey(User, on_delete=models.CASCADE)
def __str__(self):
return self.title
class GradedAssignment(models.Model):
student = models.ForeignKey(User, on_delete=models.CASCADE)
assignment = models.ForeignKey(Assignment,
on_delete=models.SET_NULL,
blank=True,
null=True)
grade = models.FloatField()
def __str__(self):
return self.student.username
class Choice(models.Model):
title = models.CharField(max_length=50)
def __str__(self):
return self.title
class Question(models.Model):
question = models.CharField(max_length=200)
choices = models.ManyToManyField(Choice)
answer = models.ForeignKey(Choice,
on_delete=models.CASCADE,
related_name='answer',
blank=True,
null=True)
assignment = models.ForeignKey(Assignment,
on_delete=models.CASCADE,
related_name='questions',
blank=True,
null=True)
order = models.SmallIntegerField()
def __str__(self):
return self.question
| 30.367347 | 63 | 0.551075 | 138 | 1,488 | 5.746377 | 0.318841 | 0.100883 | 0.088272 | 0.105927 | 0.52459 | 0.474149 | 0.411097 | 0.105927 | 0 | 0 | 0 | 0.007471 | 0.370296 | 1,488 | 48 | 64 | 31 | 0.838847 | 0 | 0 | 0.5 | 0 | 0 | 0.010081 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.055556 | 0.111111 | 0.694444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
c3e9f4343126ec46f0c5a89073232da6448d66bd | 3,118 | py | Python | shell/core/help.py | dromero1452/shellsploit-framework | 38ce78542fd2dd2ac30f6567972d695ede1e4709 | [
"MIT"
] | 2 | 2019-12-23T15:47:02.000Z | 2020-01-06T09:51:57.000Z | shell/core/help.py | badfish5150/shellsploit-framework | 22bb910d33379ca29ddd10ba93a63e9ff1eab99d | [
"MIT"
] | null | null | null | shell/core/help.py | badfish5150/shellsploit-framework | 22bb910d33379ca29ddd10ba93a63e9ff1eab99d | [
"MIT"
] | 1 | 2021-12-23T16:35:24.000Z | 2021-12-23T16:35:24.000Z | # ------------------Bombermans Team---------------------------------#
# Author : B3mB4m
# Concat : b3mb4m@protonmail.com
# Project : https://github.com/b3mb4m/Shellsploit
# LICENSE : https://github.com/b3mb4m/Shellsploit/blob/master/LICENSE
# ------------------------------------------------------------------#
from .color import *
def mainhelp():
print (bcolors.GREEN + """
Usage Commands
===============
\tCommands Description
\t------------ -------------
\thelp Help menu
\tos Command directly ur computer
\tuse Select Module For Use
\tclear Clear the menu
\tshow shellcodes Show Shellcodes of Current Database
\tshow backdoors Show Backdoors of Current Database
\tshow injectors Show Injectors(Shellcode,dll,so etc..)
\tshow encoders Show Encoders(Py,Ruby,PHP,Shellcode etc..)
""")
def shellcodehelp():
print (bcolors.GREEN + """
Shellcode Commands
===================
\tCommands Description
\t------------ -------------
\tback Exit Current Module
\tset Set Value Of Options To Modules
\tunset Unset Value Of Options To Modules
\tip Get IP address(Requires net connection)
\tos Command directly ur computer
\tclear Clear the menu
\tdisas Disassembly the shellcode(Support : x86/x64)
\twhatisthis Learn which kind of shellcode it is
\titeration Encoder iteration time
\tgenerate Generate shellcode
\toutput Save option to shellcode(txt,py,c,cpp,exe,raw,dll)
\tshow encoders List all obfucscation encoders
\tshow options Show Current Options Of Selected Module
""")
def injectorhelp():
print (bcolors.GREEN + """
Injector Commands
===================
\tCommands Description
\t------------ -------------
\tset Set Value Of Options To Modules
\tunset Unset Value Of Options To Modules
\thelp Help menu
\tback Exit Current Module
\tos Command directly ur computer
\tpids Get PID list of computer
\tgetpid Get specific PID on list(Ex. getpid Python)
\tclear Clear the menu
\tinject Start injector
\tshow options Show current options of selected module
\tshow shellcode Show current shellcode of selected module
""")
def backdoorshelp():
print (bcolors.GREEN + """
Injector Commands
===================
\tCommands Description
\t------------ -------------
\tset Set Value Of Options To Modules
\tunset Unset Value Of Options To Modules
\thelp Help menu
\tback Exit Current Module
\tos Command directly ur computer
\tclear Clear the menu
\tgenerate Generate backdoor
\tshow options Show current options of selected module
""")
| 36.255814 | 74 | 0.536562 | 301 | 3,118 | 5.55814 | 0.398671 | 0.025105 | 0.050209 | 0.057382 | 0.429169 | 0.375374 | 0.375374 | 0.375374 | 0.292887 | 0.254632 | 0 | 0.005652 | 0.319115 | 3,118 | 85 | 75 | 36.682353 | 0.782383 | 0.095574 | 0 | 0.623188 | 0 | 0.014493 | 0.909285 | 0.032373 | 0 | 0 | 0 | 0 | 0 | 1 | 0.057971 | true | 0 | 0.014493 | 0 | 0.072464 | 0.057971 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7f01e3a718f45996d405a272db21ce74f4e2b2d9 | 553 | py | Python | launch/test.py | a-tharva/LaunchEnv | 3f138d863e961c541513539c499574122fbd8b9b | [
"MIT"
] | 1 | 2022-01-25T04:44:22.000Z | 2022-01-25T04:44:22.000Z | launch/test.py | a-tharva/LaunchEnv | 3f138d863e961c541513539c499574122fbd8b9b | [
"MIT"
] | null | null | null | launch/test.py | a-tharva/LaunchEnv | 3f138d863e961c541513539c499574122fbd8b9b | [
"MIT"
] | null | null | null | #import subprocess
#
#subprocess.Popen(f'C:\Windows\system32\calc.exe')
#
#
#
#
#
#
#
#\ is a escape character. You have three options.
#
#1) use /. This, as a bonus works for linux as well:
# 'D:/xxx/xxxx/asd/asd.exe'
#
#2) escape the backslash
# 'D:\\xxx\\xxxx\\asd\\asd.exe'
#
#3) use raw strings:
#r'D:\xxx\xxxx\asd\asd.exe'
#import json
#
#with open('/src/environment/data.json', 'r+') as f:
# lst = json.load(f)
# print(lst.index(bee))
#import pyfiglet
#
#result = pyfiglet.figlet_format("fort", font = "small" )
#print(result)
| 14.945946 | 58 | 0.631103 | 86 | 553 | 4.046512 | 0.639535 | 0.034483 | 0.068966 | 0.094828 | 0.146552 | 0.146552 | 0 | 0 | 0 | 0 | 0 | 0.010846 | 0.166365 | 553 | 36 | 59 | 15.361111 | 0.744035 | 0.882459 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7f114c9480739ed4ffd7edf4c037a334bd96a0d0 | 1,286 | py | Python | passl/hooks/evaluate_hook.py | LielinJiang/PASSL | 56be08aa50c4883e12b2a728103ccb56dd19b047 | [
"Apache-2.0"
] | null | null | null | passl/hooks/evaluate_hook.py | LielinJiang/PASSL | 56be08aa50c4883e12b2a728103ccb56dd19b047 | [
"Apache-2.0"
] | null | null | null | passl/hooks/evaluate_hook.py | LielinJiang/PASSL | 56be08aa50c4883e12b2a728103ccb56dd19b047 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tqdm import tqdm
from collections import OrderedDict
import paddle
import paddle.distributed as dist
from .hook import Hook
from .builder import HOOKS
from ..utils.logger import get_logger
from ..utils.misc import AverageMeter
@HOOKS.register()
class EvaluateHook(Hook):
def __init__(self, init_eval=False, eval_kargs=None):
if eval_kargs is None:
self.eval_kargs = {}
else:
self.eval_kargs = eval_kargs
self.init_eval = init_eval
def run_begin(self, trainer):
if self.init_eval:
trainer.val(**self.eval_kargs)
def train_epoch_end(self, trainer):
trainer.val(**self.eval_kargs)
| 31.365854 | 74 | 0.724728 | 186 | 1,286 | 4.908602 | 0.543011 | 0.069003 | 0.056955 | 0.035049 | 0.050383 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007782 | 0.200622 | 1,286 | 40 | 75 | 32.15 | 0.88035 | 0.452566 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.380952 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
7f223ce0b0a9bae329fb3c8299587d1e8fad0fa3 | 1,576 | py | Python | edinet_baseline_hourly_module/edinet_models/pyEMIS/ConsumptionModels/constantMonthlyModel.py | BeeGroup-cimne/module_edinet | 0cda52e9d6222a681f85567e9bf0f7e5885ebf5e | [
"MIT"
] | null | null | null | edinet_baseline_hourly_module/edinet_models/pyEMIS/ConsumptionModels/constantMonthlyModel.py | BeeGroup-cimne/module_edinet | 0cda52e9d6222a681f85567e9bf0f7e5885ebf5e | [
"MIT"
] | 13 | 2021-03-25T22:24:38.000Z | 2022-03-12T00:56:45.000Z | edinet_baseline_hourly_module/edinet_models/pyEMIS/ConsumptionModels/constantMonthlyModel.py | BeeGroup-cimne/module_edinet | 0cda52e9d6222a681f85567e9bf0f7e5885ebf5e | [
"MIT"
] | 1 | 2019-03-13T09:49:56.000Z | 2019-03-13T09:49:56.000Z | #This is a class because it stores its model parameters and has a 'prediction' function which returns predictions for input data
import numpy as np
from baseModel import baseModel, ModellingError as me
from datetime import datetime
import pandas as pd
class ModellingError(me): pass
class ConstantMonthlyModel(baseModel):
"""
A constant consumption model: consumption is estimated as the average of all input data
Input_data must respond to the method call 'consumption'
"""
n_parameters = 1
def __init__(self, data):
if len(data) <= 11:#(self.n_parameters + 2):
self.mean = np.nan
self.std = np.nan
#raise ModellingError, "Not enough input data"
if 'temperature' in data.dtype.names:
x = data['temperature']
self.xrange = [min(x), max(x)]
data_pd = pd.DataFrame.from_records(data)
data_pd['ts'] = data_pd['timestamp'].apply(datetime.fromtimestamp)
data_pd = data_pd.set_index(pd.DatetimeIndex(data_pd['ts']))
data_pd.sort_index(inplace=True)
last_month = data_pd[-1:].index.month+1 if data_pd[-1:].index.month != 12 else 1
self.mean = data_pd[data_pd.index.month==last_month]['consumption'].mean()
self.std = data_pd[data_pd.index.month==last_month]['consumption'].std()
def prediction(self, independent_data):
return np.array([self.mean] * len(independent_data))
def simulation(self, independent_data):
return self.std * np.random.randn(independent_data.size) + self.mean
def parameters(self):
return {'mean': self.mean, 'std': self.std} | 37.52381 | 128 | 0.701142 | 227 | 1,576 | 4.735683 | 0.400881 | 0.072558 | 0.027907 | 0.033488 | 0.135814 | 0.07814 | 0.07814 | 0.07814 | 0.07814 | 0 | 0 | 0.007764 | 0.182741 | 1,576 | 42 | 129 | 37.52381 | 0.826863 | 0.217005 | 0 | 0 | 0 | 0 | 0.052502 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.148148 | false | 0.037037 | 0.148148 | 0.111111 | 0.518519 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
6134e4f18a0efb8caf473f314596ff6aa401c746 | 597 | py | Python | ml-work/test.py | numankh/HypeBeastDashboard | 8b30fe2cb972a603b6ce1d84004b418d52471a7e | [
"MIT"
] | null | null | null | ml-work/test.py | numankh/HypeBeastDashboard | 8b30fe2cb972a603b6ce1d84004b418d52471a7e | [
"MIT"
] | null | null | null | ml-work/test.py | numankh/HypeBeastDashboard | 8b30fe2cb972a603b6ce1d84004b418d52471a7e | [
"MIT"
] | null | null | null | # linear regression feature importance
from sklearn.datasets import make_regression
from sklearn.linear_model import LinearRegression
from matplotlib import pyplot
# define dataset
X, y = make_regression(n_samples=1000, n_features=10, n_informative=5, random_state=1)
# define the model
model = LinearRegression()
# fit the model
model.fit(X, y)
# get importance
importance = model.coef_
# summarize feature importance
for i,v in enumerate(importance):
print('Feature: %0d, Score: %.5f' % (i,v))
# plot feature importance
pyplot.bar([x for x in range(len(importance))], importance)
pyplot.show()
| 31.421053 | 86 | 0.778894 | 86 | 597 | 5.313953 | 0.534884 | 0.111597 | 0.056893 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019048 | 0.120603 | 597 | 18 | 87 | 33.166667 | 0.851429 | 0.251256 | 0 | 0 | 0 | 0 | 0.056948 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.545455 | 0 | 0.545455 | 0.090909 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
614115a92e300f92dd37eb72064e8a55346da282 | 228 | py | Python | djangopeople/djangopeople/management/commands/recluster.py | timgraham/djangopeople | de595ac8d7e8540871c282294a332a835ac0c177 | [
"MIT"
] | null | null | null | djangopeople/djangopeople/management/commands/recluster.py | timgraham/djangopeople | de595ac8d7e8540871c282294a332a835ac0c177 | [
"MIT"
] | null | null | null | djangopeople/djangopeople/management/commands/recluster.py | timgraham/djangopeople | de595ac8d7e8540871c282294a332a835ac0c177 | [
"MIT"
] | null | null | null | from django.core.management.base import NoArgsCommand
from ... import clustering
class Command(NoArgsCommand):
help = "Re-runs the server-side clustering"
def handle_noargs(self, **options):
clustering.run()
| 20.727273 | 53 | 0.723684 | 27 | 228 | 6.074074 | 0.814815 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175439 | 228 | 10 | 54 | 22.8 | 0.87234 | 0 | 0 | 0 | 0 | 0 | 0.149123 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
61419b6e24bcba1a05210251891441000213b61a | 1,557 | py | Python | WeLearn/M3-Python/L1-Python_Intro/hello.py | Sheldon101/mycssi2019labs | 4ff1ecda475a54be79ee9ce44f1dac77418df2db | [
"Apache-2.0"
] | null | null | null | WeLearn/M3-Python/L1-Python_Intro/hello.py | Sheldon101/mycssi2019labs | 4ff1ecda475a54be79ee9ce44f1dac77418df2db | [
"Apache-2.0"
] | null | null | null | WeLearn/M3-Python/L1-Python_Intro/hello.py | Sheldon101/mycssi2019labs | 4ff1ecda475a54be79ee9ce44f1dac77418df2db | [
"Apache-2.0"
] | null | null | null | #num1=int(raw_input("Enter num #1:"))
#num2=int(raw_input("Enter num #2:"))
#total= num1 + num2
#print("The sum is: "+ str(total))
# need to be a string so computer can read it
# all strings can be integers but not all integers can be strings
# num = int(raw_input("Enter a number:"))
# if num>0:
# print("That's a postive num!")
# elif num<0:
# print("That's a negative num!")
# else:
# print("Zero is neither postive nor negative!")
# string = "hello"
# for letter in string:
# print(letter.upper())
#
# for i in range(5): repaeted executed depend on how may letters in the string so hello would be 5
# print(i)
#
# x=1
# while x <=5:
# print(x)
# x=x+1
# my_name= "B"
# friend1= "A"
# friend2= "J"
# friend3= "M"
# print(
# "My name is %s and my friends are %s, %s, and %s" %
# (my_name,friend1,friend2,friend3 )
# )
#
# name= "C"
# age= 19
# print("My name is "+ name + "and I'm " + str(age)+"years old.") one way
# print("My name is %s and I'm %s years old." %(name,age)) second way
# def greetAgent():
# print("B. James Bond.")
# greetAgent() always call the func
#
# def greetAgent(first_name, last_name):
# print("%s. %s. %s." % (last_name, first_name, last_name))
# One way
#
#
# def createAgentGreeting(first_name, last_name):
# return"%s. %s. %s." % (last_name, first_name, last_name)
#
# print(createAgentGreeting("Citlally", "G"))
# second way
word = "computerz"
print(word[:5]) # prints "compu"
print(word[:-1]) # prints "computer"
print(word[4:]) # prints "uterz"
print(word[-3:]) # prints "erz"
| 26.389831 | 98 | 0.626204 | 252 | 1,557 | 3.809524 | 0.396825 | 0.05 | 0.054167 | 0.070833 | 0.192708 | 0.125 | 0.058333 | 0.058333 | 0.058333 | 0 | 0 | 0.019857 | 0.191394 | 1,557 | 58 | 99 | 26.844828 | 0.742653 | 0.869621 | 0 | 0 | 0 | 0 | 0.061644 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.8 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
615eb18c148fdcb7f52ffdef75ab23706867bb3b | 2,268 | py | Python | tmpFile.py | yingyulou/tmpFile | 557e74351a0412b70c0ef1179479920e86b31bc4 | [
"MIT"
] | 2 | 2019-06-11T10:30:35.000Z | 2020-08-27T07:05:41.000Z | tmpFile.py | yingyulou/tmpFile | 557e74351a0412b70c0ef1179479920e86b31bc4 | [
"MIT"
] | null | null | null | tmpFile.py | yingyulou/tmpFile | 557e74351a0412b70c0ef1179479920e86b31bc4 | [
"MIT"
] | 1 | 2019-03-17T02:52:21.000Z | 2019-03-17T02:52:21.000Z | #!/bin/env python
# coding=UTF-8
'''
DESCRIPTION
tmpFile
A module for creating temporary files and folders.
VERSION
1.4.0
LATEST UPDATE
2019.3.4
'''
# Import Python Lib
from os import remove, mkdir
from os.path import join, exists, abspath
from uuid import uuid4
from shutil import rmtree
################################################################################
# Tmp File
################################################################################
class tmpFile(object):
'''
DESCRIPTION
Create a tmp file.
USAGE
from tmpFile import tmpFile
with tmpFile() as tmpFileName:
with open(tmpFileName, 'w') as fo:
...
# File: "tmpFileName" will be deleted automatically (if exist)
ARGUMENT
* ext = '', str
The extension of the tempfile.
* path = './', str
The path of the tempfile.
'''
__slots__ = ('__tmpFileName',)
def __init__(self, ext = '', path = './'):
self.__tmpFileName = abspath(join(path, str(uuid4()) + ext))
def __enter__(self):
return self.__tmpFileName
def __exit__(self, *exc_info):
if exists(self.__tmpFileName):
remove(self.__tmpFileName)
################################################################################
# Tmp Folder
################################################################################
class tmpFolder(object):
'''
DESCRIPTION
Create a tmp folder.
USAGE
from tmpFile import tmpFolder
with tmpFolder() as tmpFolderPath:
...
# Folder: "tmpFolderPath" will be deleted automatically (if exist)
ARGUMENT
* path = './', str
The path of the tmp folder.
'''
__slots__ = ('__tmpFolderName',)
def __init__(self, path = './'):
self.__tmpFolderName = abspath(join(path, str(uuid4())))
def __enter__(self):
mkdir(self.__tmpFolderName)
return self.__tmpFolderName
def __exit__(self, *exc_info):
if exists(self.__tmpFolderName):
rmtree(self.__tmpFolderName) | 19.220339 | 80 | 0.479718 | 199 | 2,268 | 5.18593 | 0.38191 | 0.082364 | 0.044574 | 0.046512 | 0.271318 | 0.174419 | 0.137597 | 0.05814 | 0 | 0 | 0 | 0.00814 | 0.295855 | 2,268 | 118 | 81 | 19.220339 | 0.638071 | 0.369489 | 0 | 0.173913 | 0 | 0 | 0.035874 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0 | 0.173913 | 0.043478 | 0.695652 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
615ee1b639ae928638b3d914af60405b9ed2a109 | 364 | py | Python | hw_asr/augmentations/wave_augmentations/__init__.py | isdevnull/asr_hw | 9650506b80d4e38574b63390f79a6f01786b7d18 | [
"MIT"
] | null | null | null | hw_asr/augmentations/wave_augmentations/__init__.py | isdevnull/asr_hw | 9650506b80d4e38574b63390f79a6f01786b7d18 | [
"MIT"
] | null | null | null | hw_asr/augmentations/wave_augmentations/__init__.py | isdevnull/asr_hw | 9650506b80d4e38574b63390f79a6f01786b7d18 | [
"MIT"
] | null | null | null | from hw_asr.augmentations.wave_augmentations.Gain import Gain
from hw_asr.augmentations.wave_augmentations.ImpulseResponse import ImpulseResponse
from hw_asr.augmentations.wave_augmentations.Noise import GaussianNoise
from hw_asr.augmentations.wave_augmentations.TimeStretch import TimeStretch
__all__ = [
"Gain",
"ImpulseResponse",
"GaussianNoise"
]
| 33.090909 | 83 | 0.837912 | 40 | 364 | 7.325 | 0.3 | 0.081911 | 0.122867 | 0.300341 | 0.532423 | 0.532423 | 0 | 0 | 0 | 0 | 0 | 0 | 0.098901 | 364 | 10 | 84 | 36.4 | 0.893293 | 0 | 0 | 0 | 0 | 0 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
6172cb90d3acbe6eb936a5e0311837e45f59b5d1 | 1,217 | py | Python | setup.py | kimvanwyk/red-mail | 78dc763e5b5f09eed820a11233299dd2c7b0190b | [
"MIT"
] | null | null | null | setup.py | kimvanwyk/red-mail | 78dc763e5b5f09eed820a11233299dd2c7b0190b | [
"MIT"
] | null | null | null | setup.py | kimvanwyk/red-mail | 78dc763e5b5f09eed820a11233299dd2c7b0190b | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
import versioneer
with open("README.md", "r") as f:
long_description = f.read()
setup(
name="redmail",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
author="Mikael Koli",
author_email="koli.mikael@gmail.com",
url="https://github.com/Miksus/red-mail.git",
packages=find_packages(),
description="Email sending library",
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=[
"Topic :: Communications :: Email",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Intended Audience :: Developers",
"Intended Audience :: Customer Service",
"Intended Audience :: Financial and Insurance Industry",
],
include_package_data=True, # for MANIFEST.in
python_requires='>=3.6.0',
install_requires = [
'jinja2',
],
)
| 30.425 | 64 | 0.637634 | 129 | 1,217 | 5.899225 | 0.596899 | 0.149803 | 0.197109 | 0.204993 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017003 | 0.226787 | 1,217 | 39 | 65 | 31.205128 | 0.791711 | 0.012325 | 0 | 0.058824 | 0 | 0 | 0.451667 | 0.0175 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.058824 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
61752f9c0020e5238d87c07d19b74f84c1ea9f90 | 4,286 | py | Python | tests_requre/service/test_views.py | IceWreck/packit-service | ab8a3ae7b7f078f4a5bf3465516c1abc894fe3dc | [
"MIT"
] | null | null | null | tests_requre/service/test_views.py | IceWreck/packit-service | ab8a3ae7b7f078f4a5bf3465516c1abc894fe3dc | [
"MIT"
] | 2 | 2020-09-02T08:14:27.000Z | 2020-09-03T03:16:27.000Z | tests_requre/service/test_views.py | IceWreck/packit-service | ab8a3ae7b7f078f4a5bf3465516c1abc894fe3dc | [
"MIT"
] | null | null | null | from flask import url_for
from flexmock import flexmock
from packit_service import models
from packit_service.models import CoprBuildModel
from packit_service.service.views import _get_build_info
from tests_requre.conftest import SampleValues
def test_get_build_logs_for_build_pr(clean_before_and_after, a_copr_build_for_pr):
flexmock(models).should_receive("optional_time").and_return(
"2020-05-19 16:17:14 UTC"
)
response = _get_build_info(a_copr_build_for_pr, build_description="COPR build")
assert "We can't find any info" not in response
assert "Builds for the-namespace/the-repo-name: PR #342" in response
assert "2020-05-19 16:17:14 UTC" in response
assert a_copr_build_for_pr.status in response
assert a_copr_build_for_pr.target in response
assert str(a_copr_build_for_pr.srpm_build_id) in response
assert a_copr_build_for_pr.build_logs_url in response
def test_get_build_logs_for_build_branch_push(
clean_before_and_after, a_copr_build_for_branch_push
):
flexmock(models).should_receive("optional_time").and_return(
"2020-05-19 16:17:14 UTC"
)
response = _get_build_info(
a_copr_build_for_branch_push, build_description="COPR build"
)
assert "We can't find any info" not in response
assert "Builds for the-namespace/the-repo-name: branch build-branch" in response
assert "2020-05-19 16:17:14 UTC" in response
assert a_copr_build_for_branch_push.status in response
assert a_copr_build_for_branch_push.target in response
assert str(a_copr_build_for_branch_push.srpm_build_id) in response
assert a_copr_build_for_branch_push.build_logs_url in response
def test_get_build_logs_for_build_release(
clean_before_and_after, a_copr_build_for_release
):
flexmock(models).should_receive("optional_time").and_return(
"2020-05-19 16:17:14 UTC"
)
response = _get_build_info(a_copr_build_for_release, build_description="COPR build")
assert "We can't find any info" not in response
assert "Builds for the-namespace/the-repo-name: release v1.0.2" in response
assert "2020-05-19 16:17:14 UTC" in response
assert a_copr_build_for_release.status in response
assert a_copr_build_for_release.target in response
assert str(a_copr_build_for_release.srpm_build_id) in response
assert a_copr_build_for_release.build_logs_url in response
def test_srpm_logs_view(client, clean_before_and_after, srpm_build_model):
# Logs view uses the id of the SRPMBuildModel not CoprBuildModel
response = client.get(
url_for("builds.get_srpm_build_logs_by_id", id_=srpm_build_model.id)
)
response = response.data.decode()
assert "SRPM build logs" in response
assert str(srpm_build_model.id) in response
assert "some\nboring\nlogs" in response
def test_copr_build_info_view(client, clean_before_and_after, multiple_copr_builds):
flexmock(models).should_receive("optional_time").and_return(
"2020-05-19 16:17:14 UTC"
)
build = CoprBuildModel.get_by_build_id(123456, SampleValues.chroots[0])
build.set_build_logs_url(
"https://copr.somewhere/results/owner/package/target/build.logs"
)
response = client.get(url_for("builds.copr_build_info", id_=str(build.id)))
response = response.data.decode()
assert "Builds for the-namespace/the-repo-name: PR #342" in response
assert "2020-05-19 16:17:14 UTC" in response
assert build.status in response
assert build.target in response
assert str(build.srpm_build_id) in response
assert build.build_logs_url in response
def test_koji_build_info_view(client, clean_before_and_after, a_koji_build_for_pr):
flexmock(models).should_receive("optional_time").and_return(
"2020-05-19 16:17:14 UTC"
)
response = client.get(
url_for("builds.koji_build_info", id_=str(a_koji_build_for_pr.id))
)
response = response.data.decode()
assert "Builds for the-namespace/the-repo-name: PR #342" in response
assert "2020-05-19 16:17:14 UTC" in response
assert a_koji_build_for_pr.status in response
assert a_koji_build_for_pr.target in response
assert str(a_koji_build_for_pr.srpm_build_id) in response
assert a_koji_build_for_pr.build_logs_url in response
| 39.321101 | 88 | 0.765749 | 695 | 4,286 | 4.385612 | 0.128058 | 0.11811 | 0.15748 | 0.076772 | 0.771325 | 0.75689 | 0.684711 | 0.653543 | 0.543963 | 0.474738 | 0 | 0.04402 | 0.157256 | 4,286 | 108 | 89 | 39.685185 | 0.799834 | 0.014466 | 0 | 0.325581 | 0 | 0 | 0.193273 | 0.051161 | 0 | 0 | 0 | 0 | 0.418605 | 1 | 0.069767 | false | 0 | 0.069767 | 0 | 0.139535 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6178677cf010170ac4ef5c808891d12fe972a547 | 1,088 | py | Python | shopyoapi/uploads.py | Maurilearn/learnings | 0af03e5646c9053b3cfc27465983ce466ad2f3cb | [
"MIT"
] | null | null | null | shopyoapi/uploads.py | Maurilearn/learnings | 0af03e5646c9053b3cfc27465983ce466ad2f3cb | [
"MIT"
] | null | null | null | shopyoapi/uploads.py | Maurilearn/learnings | 0af03e5646c9053b3cfc27465983ce466ad2f3cb | [
"MIT"
] | null | null | null |
from werkzeug.security import generate_password_hash
from shopyoapi.init import db
from app import app
from modules.auth.models import User
from modules.school.models import Setting
# from modules.settings.models import Settings
def add_admin(name, email, password):
with app.app_context():
admin = User(
name=name,
email=email,
role='admin'
)
admin.set_hash(password)
admin.insert()
print('[x] added admin:', name, email, password)
'''
def add_setting(name, value):
with app.app_context():
if Settings.query.filter_by(setting=name).first():
s = Settings.query.get(name)
s.value = value
db.session.commit()
else:
s = Settings(setting=name, value=value)
db.session.add(s)
db.session.commit()
'''
def add_setting(name, value):
with app.app_context():
s = Setting(
name=name,
value=value)
s.insert()
print('[x] Added name:{} with value:{}'.format(name, value)) | 26.536585 | 68 | 0.59375 | 133 | 1,088 | 4.781955 | 0.323308 | 0.086478 | 0.04717 | 0.080189 | 0.122642 | 0.122642 | 0.122642 | 0.122642 | 0.122642 | 0 | 0 | 0 | 0.290441 | 1,088 | 41 | 68 | 26.536585 | 0.823834 | 0.040441 | 0 | 0.181818 | 1 | 0 | 0.075472 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0.181818 | 0.227273 | 0 | 0.318182 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
617b72d47fe1a620e75af426de3f519c6430df3c | 858 | py | Python | scofield/tax/models.py | howiworkdaily/scofield-project | f0daaf785c344a0da1f5b624518c9fa6c0514745 | [
"BSD-3-Clause"
] | 4 | 2016-04-10T13:37:58.000Z | 2018-06-11T18:49:29.000Z | scofield/tax/models.py | howiworkdaily/scofield-project | f0daaf785c344a0da1f5b624518c9fa6c0514745 | [
"BSD-3-Clause"
] | null | null | null | scofield/tax/models.py | howiworkdaily/scofield-project | f0daaf785c344a0da1f5b624518c9fa6c0514745 | [
"BSD-3-Clause"
] | 2 | 2015-04-08T19:52:19.000Z | 2021-02-10T08:08:19.000Z | from django.db import models
class TaxClass(models.Model):
"""
Tax rate for a product.
"""
title = models.CharField(max_length=100)
description = models.CharField(max_length=200, help_text='Description of products to be taxed')
def __unicode__(self):
return self.title
class Meta:
verbose_name = "Tax Class"
verbose_name_plural = "Tax Classes"
class Tax(models.Model):
"""
Tax Percentage
"""
taxclass = models.ForeignKey(TaxClass)
percentage = models.DecimalField(max_digits=7, decimal_places=2)
def _display_percentage(self):
return "%#2.2f%%" % (100*self.percentage)
_display_percentage.short_description = 'Percentage'
display_percentage = property(_display_percentage)
class Meta:
verbose_name = "Tax"
verbose_name_plural = "Tax"
| 25.235294 | 99 | 0.670163 | 99 | 858 | 5.575758 | 0.484848 | 0.07971 | 0.050725 | 0.086957 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019637 | 0.228438 | 858 | 33 | 100 | 26 | 0.814199 | 0.044289 | 0 | 0.105263 | 0 | 0 | 0.100254 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.052632 | 0.105263 | 0.736842 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
6184ff3e6d5499ae2279934df653ba237021e92e | 328 | py | Python | rh/apps/case_studies/cms_apps.py | rapidpro/chpro-microsite | 4e1d1210b49ec60ab0711d78235bf45eeb5c0275 | [
"BSD-3-Clause"
] | null | null | null | rh/apps/case_studies/cms_apps.py | rapidpro/chpro-microsite | 4e1d1210b49ec60ab0711d78235bf45eeb5c0275 | [
"BSD-3-Clause"
] | 108 | 2018-01-30T15:26:18.000Z | 2021-06-10T17:29:57.000Z | rh/apps/case_studies/cms_apps.py | rapidpro/chpro-microsite | 4e1d1210b49ec60ab0711d78235bf45eeb5c0275 | [
"BSD-3-Clause"
] | null | null | null | from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
class CaseStudiesApphook(CMSApp):
app_name = "case_studies"
name = "Case Studies Application"
def get_urls(self, page=None, language=None, **kwargs):
return ["rh.apps.case_studies.urls"]
apphook_pool.register(CaseStudiesApphook)
| 23.428571 | 59 | 0.75 | 43 | 328 | 5.534884 | 0.604651 | 0.138655 | 0.12605 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155488 | 328 | 13 | 60 | 25.230769 | 0.859206 | 0 | 0 | 0 | 0 | 0 | 0.185976 | 0.07622 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0.125 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
619239cbab47f38d61f102bfd2c870af018bffa8 | 407 | py | Python | Chapter05/restful_python_2_05/Django01/games_service/games/models.py | PacktPublishing/Hands-On-RESTful-Python-Web-Services-Second-Edition | db8212c90f6394d8ee6fadb038e2b01ef83c963d | [
"MIT"
] | 45 | 2018-12-21T01:02:16.000Z | 2022-03-18T08:23:13.000Z | Chapter05/restful_python_2_05/Django01/games_service/games/models.py | PacktPublishing/Hands-On-RESTful-Python-Web-Services-Second-Edition | db8212c90f6394d8ee6fadb038e2b01ef83c963d | [
"MIT"
] | 12 | 2020-02-11T23:32:33.000Z | 2021-06-10T22:29:56.000Z | Chapter05/restful_python_2_05/Django01/games_service/games/models.py | PacktPublishing/Hands-On-RESTful-Python-Web-Services-Second-Edition | db8212c90f6394d8ee6fadb038e2b01ef83c963d | [
"MIT"
] | 29 | 2019-02-11T16:45:56.000Z | 2022-03-29T12:43:27.000Z | from django.db import models
class Game(models.Model):
created_timestamp = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=200)
release_date = models.DateTimeField()
esrb_rating = models.CharField(max_length=150)
played_once = models.BooleanField(default=False)
played_times = models.IntegerField(default=0)
class Meta:
ordering = ('name',)
| 29.071429 | 63 | 0.732187 | 50 | 407 | 5.78 | 0.7 | 0.131488 | 0.124567 | 0.16609 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020649 | 0.167076 | 407 | 13 | 64 | 31.307692 | 0.831858 | 0 | 0 | 0 | 0 | 0 | 0.009828 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.9 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
61938ef87f807b50b7ef975df7fc7cd96772c7e3 | 7,100 | py | Python | old_py2/controllers/datafeed_controller.py | bovlb/the-blue-alliance | 29389649d96fe060688f218d463e642dcebfd6cc | [
"MIT"
] | null | null | null | old_py2/controllers/datafeed_controller.py | bovlb/the-blue-alliance | 29389649d96fe060688f218d463e642dcebfd6cc | [
"MIT"
] | null | null | null | old_py2/controllers/datafeed_controller.py | bovlb/the-blue-alliance | 29389649d96fe060688f218d463e642dcebfd6cc | [
"MIT"
] | null | null | null | import logging
import os
import datetime
import tba_config
import time
import json
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from consts.event_type import EventType
from consts.media_type import MediaType
from consts.media_tag import MediaTag
from datafeeds.datafeed_fms_api import DatafeedFMSAPI
from datafeeds.datafeed_tba import DatafeedTba
from datafeeds.datafeed_resource_library import DatafeedResourceLibrary
from helpers.district_manipulator import DistrictManipulator
from helpers.event_helper import EventHelper
from helpers.event_manipulator import EventManipulator
from helpers.event_details_manipulator import EventDetailsManipulator
from helpers.event_team_manipulator import EventTeamManipulator
from helpers.match_manipulator import MatchManipulator
from helpers.match_helper import MatchHelper
from helpers.award_manipulator import AwardManipulator
from helpers.media_manipulator import MediaManipulator
from helpers.team_manipulator import TeamManipulator
from helpers.district_team_manipulator import DistrictTeamManipulator
from helpers.robot_manipulator import RobotManipulator
from helpers.event.offseason_event_helper import OffseasonEventHelper
from helpers.suggestions.suggestion_creator import SuggestionCreator
from models.district_team import DistrictTeam
from models.event import Event
from models.event_details import EventDetails
from models.event_team import EventTeam
from models.media import Media
from models.robot import Robot
from models.sitevar import Sitevar
from models.team import Team
from sitevars.website_blacklist import WebsiteBlacklist
class DistrictRankingsGet(webapp.RequestHandler):
"""
Fetch district rankings from FIRST
This data does not have full pre-event point breakdowns, but it does contain
things like CMP advancement
"""
def get(self, district_key):
class TbaVideosEnqueue(webapp.RequestHandler):
"""
Handles enqueing grabing tba_videos for Matches at individual Events.
"""
def get(self):
events = Event.query()
for event in events:
taskqueue.add(
url='/tasks/get/tba_videos/' + event.key_name,
method='GET')
template_values = {
'event_count': Event.query().count(),
}
if 'X-Appengine-Taskname' not in self.request.headers: # Only write out if not in taskqueue
path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/tba_videos_enqueue.html')
self.response.out.write(template.render(path, template_values))
class TbaVideosGet(webapp.RequestHandler):
"""
Handles reading a TBA video listing page and updating the match objects in the datastore as needed.
"""
def get(self, event_key):
df = DatafeedTba()
event = Event.get_by_id(event_key)
match_filetypes = df.getVideos(event)
if match_filetypes:
matches_to_put = []
for match in event.matches:
if match.tba_videos != match_filetypes.get(match.key_name, []):
match.tba_videos = match_filetypes.get(match.key_name, [])
match.dirty = True
matches_to_put.append(match)
MatchManipulator.createOrUpdate(matches_to_put)
tbavideos = match_filetypes.items()
else:
logging.info("No tbavideos found for event " + event.key_name)
tbavideos = []
template_values = {
'tbavideos': tbavideos,
}
if 'X-Appengine-Taskname' not in self.request.headers: # Only write out if not in taskqueue
path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/tba_videos_get.html')
self.response.out.write(template.render(path, template_values))
class HallOfFameTeamsGet(webapp.RequestHandler):
"""
Handles scraping the list of Hall of Fame teams from FIRST resource library.
"""
def get(self):
df = DatafeedResourceLibrary()
teams = df.getHallOfFameTeams()
if teams:
media_to_update = []
for team in teams:
team_reference = Media.create_reference('team', team['team_id'])
video_foreign_key = team['video']
if video_foreign_key:
media_to_update.append(Media(id=Media.render_key_name(MediaType.YOUTUBE_VIDEO, video_foreign_key),
media_type_enum=MediaType.YOUTUBE_VIDEO,
media_tag_enum=[MediaTag.CHAIRMANS_VIDEO],
references=[team_reference],
year=team['year'],
foreign_key=video_foreign_key))
presentation_foreign_key = team['presentation']
if presentation_foreign_key:
media_to_update.append(Media(id=Media.render_key_name(MediaType.YOUTUBE_VIDEO, presentation_foreign_key),
media_type_enum=MediaType.YOUTUBE_VIDEO,
media_tag_enum=[MediaTag.CHAIRMANS_PRESENTATION],
references=[team_reference],
year=team['year'],
foreign_key=presentation_foreign_key))
essay_foreign_key = team['essay']
if essay_foreign_key:
media_to_update.append(Media(id=Media.render_key_name(MediaType.EXTERNAL_LINK, essay_foreign_key),
media_type_enum=MediaType.EXTERNAL_LINK,
media_tag_enum=[MediaTag.CHAIRMANS_ESSAY],
references=[team_reference],
year=team['year'],
foreign_key=essay_foreign_key))
MediaManipulator.createOrUpdate(media_to_update)
else:
logging.info("No Hall of Fame teams found")
teams = []
template_values = {
'teams': teams,
}
if 'X-Appengine-Taskname' not in self.request.headers: # Only write out if not in taskqueue
path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/hall_of_fame_teams_get.html')
self.response.out.write(template.render(path, template_values))
class TeamBlacklistWebsiteDo(webapp.RequestHandler):
"""
Blacklist the current website for a team
"""
def get(self, key_name):
team = Team.get_by_id(key_name)
if team.website:
WebsiteBlacklist.blacklist(team.website)
self.redirect('/backend-tasks/get/team_details/{}'.format(key_name))
| 40.340909 | 125 | 0.640704 | 758 | 7,100 | 5.792876 | 0.246702 | 0.034161 | 0.020496 | 0.015031 | 0.30813 | 0.269642 | 0.262355 | 0.262355 | 0.23161 | 0.23161 | 0 | 0 | 0.289296 | 7,100 | 175 | 126 | 40.571429 | 0.870194 | 0.014648 | 0 | 0.168 | 0 | 0 | 0.059096 | 0.029934 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.312 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
61bcb1723cde31df785e9875b137882312c8d564 | 1,086 | py | Python | tests/test_validation_settings.py | IndicoDataSolutions/finetune-transformer-lm | 3534658e5de281e5634c8481b0fb37635b0cb3af | [
"MIT"
] | null | null | null | tests/test_validation_settings.py | IndicoDataSolutions/finetune-transformer-lm | 3534658e5de281e5634c8481b0fb37635b0cb3af | [
"MIT"
] | null | null | null | tests/test_validation_settings.py | IndicoDataSolutions/finetune-transformer-lm | 3534658e5de281e5634c8481b0fb37635b0cb3af | [
"MIT"
] | null | null | null | import unittest
from finetune.util.input_utils import validation_settings
class TestValidationSettings(unittest.TestCase):
def test_validation_settings(self):
"""
Ensure LM only training does not error out
"""
val_size, val_interval = validation_settings(dataset_size=30, batch_size=4, val_size=0, val_interval=None, keep_best_model=False)
self.assertEqual(val_size, 0)
val_size, val_interval = validation_settings(dataset_size=80, batch_size=4, val_size=0.05, val_interval=None, keep_best_model=False)
self.assertEqual(val_size, 4)
self.assertEqual(val_interval, 4)
val_size, val_interval = validation_settings(dataset_size=80, batch_size=2, val_size=0.05, val_interval=None, keep_best_model=False)
self.assertEqual(val_size, 4)
self.assertEqual(val_interval, 8)
val_size, val_interval = validation_settings(dataset_size=400, batch_size=4, val_size=0.05, val_interval=None, keep_best_model=False)
self.assertEqual(val_size, 20)
self.assertEqual(val_interval, 20)
| 43.44 | 141 | 0.736648 | 153 | 1,086 | 4.921569 | 0.281046 | 0.111554 | 0.167331 | 0.095618 | 0.721116 | 0.721116 | 0.697211 | 0.697211 | 0.572377 | 0.572377 | 0 | 0.035635 | 0.173112 | 1,086 | 24 | 142 | 45.25 | 0.802895 | 0.038674 | 0 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | 1 | 0.066667 | false | 0 | 0.133333 | 0 | 0.266667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4eec746d820c53cfe1acfbbe561209eb0112a801 | 207 | py | Python | tests/SHA256/run.py | weikengchen/Virgo | 73b924f33e18c017bafa3ed37da84a7b0d80ec5d | [
"Apache-2.0"
] | 9 | 2020-06-02T04:54:08.000Z | 2021-12-07T12:54:09.000Z | tests/SHA256/run.py | weikengchen/Virgo | 73b924f33e18c017bafa3ed37da84a7b0d80ec5d | [
"Apache-2.0"
] | 2 | 2021-01-07T18:34:10.000Z | 2021-03-22T20:29:43.000Z | tests/SHA256/run.py | weikengchen/Virgo | 73b924f33e18c017bafa3ed37da84a7b0d80ec5d | [
"Apache-2.0"
] | 5 | 2020-06-08T09:11:37.000Z | 2021-07-29T12:15:47.000Z | import os
os.system('mkdir -p LOG')
for i in range(8):
os.system('./zk_proof SHA256_64_merkle_' + str(i + 1) + '_circuit.txt SHA256_64_merkle_' + str(i + 1) + '_meta.txt LOG/SHA256_' + str(i + 1) + '.txt')
| 41.4 | 151 | 0.647343 | 38 | 207 | 3.263158 | 0.552632 | 0.096774 | 0.120968 | 0.274194 | 0.306452 | 0.306452 | 0 | 0 | 0 | 0 | 0 | 0.097143 | 0.154589 | 207 | 4 | 152 | 51.75 | 0.611429 | 0 | 0 | 0 | 0 | 0 | 0.458937 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4ef201c0a10d56d741c0b5148b73d6e3ae7ebce4 | 143 | py | Python | acmgnyr2011/b.py | AnAverageHuman/competitive | 4c4b9bdbe91fde1c52f731426f9a53bff97796e1 | [
"BSD-3-Clause"
] | null | null | null | acmgnyr2011/b.py | AnAverageHuman/competitive | 4c4b9bdbe91fde1c52f731426f9a53bff97796e1 | [
"BSD-3-Clause"
] | null | null | null | acmgnyr2011/b.py | AnAverageHuman/competitive | 4c4b9bdbe91fde1c52f731426f9a53bff97796e1 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
P = int(input())
for _ in range(P):
N, n, m = [int(i) for i in input().split()]
print(f"{N} {(n - m) * m + 1}")
| 20.428571 | 47 | 0.48951 | 28 | 143 | 2.464286 | 0.607143 | 0.057971 | 0.086957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009259 | 0.244755 | 143 | 6 | 48 | 23.833333 | 0.62963 | 0.13986 | 0 | 0 | 0 | 0 | 0.172131 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4ef48cca62f034a2764603154909770a46970bca | 284 | py | Python | tests/tasks/test_aws_athena_task.py | jezd-axyl/platsec-aws-scanner | bc2b064c87ac2f77fab49c1e1eb3782d6de685b2 | [
"Apache-2.0"
] | null | null | null | tests/tasks/test_aws_athena_task.py | jezd-axyl/platsec-aws-scanner | bc2b064c87ac2f77fab49c1e1eb3782d6de685b2 | [
"Apache-2.0"
] | 4 | 2021-05-06T12:36:46.000Z | 2022-02-11T09:47:57.000Z | tests/tasks/test_aws_athena_task.py | jezd-axyl/platsec-aws-scanner | bc2b064c87ac2f77fab49c1e1eb3782d6de685b2 | [
"Apache-2.0"
] | 2 | 2021-04-21T04:48:47.000Z | 2022-01-14T04:29:17.000Z | from unittest import TestCase
from unittest.mock import Mock
from tests.test_types_generator import athena_task
class TestAwsAthenaTask(TestCase):
def test_run_task(self) -> None:
with self.assertRaises(NotImplementedError):
athena_task()._run_task(Mock())
| 25.818182 | 52 | 0.757042 | 35 | 284 | 5.914286 | 0.571429 | 0.115942 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.169014 | 284 | 10 | 53 | 28.4 | 0.877119 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 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 | 0 | 1 | 0 | 0 | 2 |
4ef95f448285155ef51a0543042976937c9cfbc9 | 1,487 | py | Python | amftrack/pipeline/scripts/post_processing/make_small_exp.py | Cocopyth/MscThesis | 60162bc779a3a668e7447b60bb9a4b2a616b8093 | [
"MIT"
] | 1 | 2021-06-10T02:51:53.000Z | 2021-06-10T02:51:53.000Z | amftrack/pipeline/scripts/post_processing/make_small_exp.py | Cocopyth/MscThesis | 60162bc779a3a668e7447b60bb9a4b2a616b8093 | [
"MIT"
] | null | null | null | amftrack/pipeline/scripts/post_processing/make_small_exp.py | Cocopyth/MscThesis | 60162bc779a3a668e7447b60bb9a4b2a616b8093 | [
"MIT"
] | null | null | null | from path import path_code_dir
import sys
sys.path.insert(0, path_code_dir)
from amftrack.pipeline.functions.image_processing.extract_width_fun import *
from amftrack.pipeline.functions.image_processing.experiment_class_surf import Experiment, save_graphs, load_graphs
from amftrack.util import get_dates_datetime, get_dirname
import pickle
import networkx as nx
import pandas as pd
from amftrack.pipeline.paths.directory import directory_scratch
from path import path_code_dir
import os
import json
from datetime import datetime
from pymatreader import read_mat
import cv2
import matplotlib.pyplot as plt
from IPython.display import clear_output
from amftrack.plotutil import plot_t_tp1
from amftrack.notebooks.analysis.util import directory_scratch
import imageio
directory = str(sys.argv[1])
overwrite = eval(sys.argv[2])
i = int(sys.argv[-1])
op_id = int(sys.argv[-2])
run_info = pd.read_json(f'{directory_scratch}temp/{op_id}.json')
list_f,list_args = pickle.load(open(f'{directory_scratch}temp/{op_id}.pick', "rb"))
folder_list = list(run_info['folder_analysis'])
directory_name = folder_list[i]
select = run_info.loc[run_info['folder_analysis'] == directory_name]
row = [row for index, row in select.iterrows()][0]
plate_num = row['Plate']
path_exp = f'{directory}{row["path_exp"]}'
exp = pickle.load(open(path_exp, "rb"))
exp.dates.sort()
save_graphs(exp)
exp.nx_graph = None
dirName = exp.save_location
exp.pickle_save(f"{dirName}/")
| 36.268293 | 116 | 0.778749 | 232 | 1,487 | 4.780172 | 0.392241 | 0.064923 | 0.029757 | 0.032462 | 0.241659 | 0.241659 | 0.055906 | 0 | 0 | 0 | 0 | 0.006093 | 0.117014 | 1,487 | 40 | 117 | 37.175 | 0.838538 | 0 | 0 | 0.051282 | 0 | 0 | 0.102972 | 0.069109 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.512821 | 0 | 0.512821 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f60f32aa489881ec2e8225930b221b8c8e96f54f | 2,416 | py | Python | python_data_utils/spark/ml/randomforest.py | surajiyer/python-data-utils | d6e9bf81204a01545a3edb165c5724eb24f37c18 | [
"MIT"
] | 4 | 2019-01-06T00:09:21.000Z | 2022-01-28T06:03:13.000Z | python_data_utils/spark/ml/randomforest.py | surajiyer/python-data-utils | d6e9bf81204a01545a3edb165c5724eb24f37c18 | [
"MIT"
] | null | null | null | python_data_utils/spark/ml/randomforest.py | surajiyer/python-data-utils | d6e9bf81204a01545a3edb165c5724eb24f37c18 | [
"MIT"
] | null | null | null | __all__ = ['RandomForestBinaryModel']
from pyspark.sql import DataFrame
from pyspark.ml.classification import RandomForestClassifier
from python_data_utils.spark.evaluation.multiclass import MulticlassEvaluator
from python_data_utils.spark.ml.base import BinaryClassCVModel, Metrics
class RandomForestBinaryModel(BinaryClassCVModel):
def __init__(
self, *, estimator=None, evaluator=None,
label_col: str = 'label', params_map=None):
estimator = RandomForestClassifier(labelCol=label_col)\
if not estimator else estimator
assert isinstance(estimator, RandomForestClassifier)
evaluator = MulticlassEvaluator(metricName='weightedFMeasure')\
if not evaluator else evaluator
super().__init__(estimator=estimator, evaluator=evaluator)
self.params_map = {
'maxDepth': [5, 10, 20],
'numTrees': [20, 30, 40, 50],
'minInstancesPerNode': [1, 2, 3]
} if not params_map else params_map
@Metrics.register('feature_importances')
def feature_importances(self, predictions):
self.logger.info('Get feature importances')
feature_importance = self.best_model.stages[-1].featureImportances
feature_importance = sorted([
(self.features[i], fi)
for i, fi in enumerate(feature_importance)]
, key=lambda x: -x[1])
return feature_importance
def get_feature_importances(self, df: DataFrame):
"""
Takes in a feature importance from a random forest / GBT model and map it to the column names
Output as a pandas dataframe for easy reading
Params
------
df: DataFrame
Example dataframe with same schema as model input.
Usage
----------
>>> rf = RandomForestClassifier(featuresCol="features")
>>> mod = rf.fit(train)
>>> get_feature_importances(train)
"""
import pandas as pd
featureImp = self.best_model.stages[-1].featureImportances
featuresCol = self.estimator.getFeaturesCol()
features = df.schema[featuresCol].metadata["ml_attr"]["attrs"]
list_extract = [features[i] for i in features]
varlist = pd.DataFrame(list_extract)
varlist['score'] = varlist['idx'].apply(lambda x: featureImp[x])
return varlist.sort_values('score', ascending=False)
| 39.606557 | 101 | 0.657699 | 255 | 2,416 | 6.082353 | 0.470588 | 0.058027 | 0.040619 | 0.0245 | 0.079948 | 0.049001 | 0 | 0 | 0 | 0 | 0 | 0.010417 | 0.245033 | 2,416 | 60 | 102 | 40.266667 | 0.839912 | 0.147351 | 0 | 0 | 0 | 0 | 0.074642 | 0.011759 | 0 | 0 | 0 | 0 | 0.026316 | 1 | 0.078947 | false | 0 | 0.368421 | 0 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f61b72c600c72677f6d1712bc62795a8c1da3213 | 7,482 | py | Python | tests/test_config_defaults.py | nmichlo/eunomia | 5c6ef13b5af5335d4437867953b5eaa872ac56bb | [
"MIT"
] | 3 | 2021-02-07T17:55:46.000Z | 2021-02-15T11:58:36.000Z | tests/test_config_defaults.py | nmichlo/eunomia | 5c6ef13b5af5335d4437867953b5eaa872ac56bb | [
"MIT"
] | null | null | null | tests/test_config_defaults.py | nmichlo/eunomia | 5c6ef13b5af5335d4437867953b5eaa872ac56bb | [
"MIT"
] | null | null | null | import pytest
from eunomia.config._default import Default
from eunomia.config.nodes import ConfigNode
from tests.test_backend_obj import _make_config_group
# ========================================================================= #
# Test YAML & Custom Tags #
# ========================================================================= #
def _resolver(string):
if isinstance(string, ConfigNode):
return string.get_config_value({}, {}, {})
return string
def _resolve_default(group, default):
# we are testing this! \/ \/ \/
g, c, pkg, is_self = default.to_resolved_components(group, _resolver)
# we are testing this! /\ /\ /\
return g.abs_path, [c.abs_path for c in c], pkg
def test_defaults():
root = _make_config_group(suboption=None, suboption2=None, package1='<option>', package2='asdf.fdsa')
d = root.get_option_recursive('default')
s1 = root.get_group_recursive('subgroup')
s1o1 = root.get_option_recursive('subgroup/suboption1')
s1o2 = root.get_option_recursive('subgroup/suboption2')
s2 = root.get_group_recursive('subgroup2')
s2s3 = root.get_group_recursive('subgroup2/subgroup3')
s2s3o1 = root.get_option_recursive('subgroup2/subgroup3/suboption1')
s2s3o2 = root.get_option_recursive('subgroup2/subgroup3/suboption2')
# multiple different versions
assert _resolve_default(root, Default(d)) == ('/', ['/default'], ())
assert _resolve_default(root, Default({root: d})) == ('/', ['/default'], ())
assert _resolve_default(root, Default({root: [d]})) == ('/', ['/default'], ())
assert _resolve_default(root, Default({'/': 'default'})) == ('/', ['/default'], ())
assert _resolve_default(root, Default({'/': '/default'})) == ('/', ['/default'], ())
assert _resolve_default(root, Default({'/': ['/default']})) == ('/', ['/default'], ())
assert _resolve_default(root, Default({'/': ['default']})) == ('/', ['/default'], ())
# these should throw errors, option points to option
with pytest.raises(KeyError, match='key .* is not a group'): _resolve_default(root, Default({'/default': ['default']}))
with pytest.raises(KeyError, match='key .* is not a group'): _resolve_default(root, Default({d: d}))
with pytest.raises(KeyError, match='key .* is not a group'): _resolve_default(root, Default({d: [d]}))
# allow group to represent all suboptions
assert _resolve_default(root, Default('')) == ('/', ['/default'], ()) # technically this is valid, its just confusing... should it be disabled?
assert _resolve_default(root, Default('default')) == ('/', ['/default'], ()) # we want relative support in case we use group.absorb for example
assert _resolve_default(root, Default('/')) == ('/', ['/default'], ())
assert _resolve_default(root, Default('/default')) == ('/', ['/default'], ())
assert _resolve_default(root, Default(root)) == ('/', ['/default'], ())
assert _resolve_default(root, Default({'/': '/'})) == ('/', ['/default'], ())
assert _resolve_default(root, Default({'/': '*'})) == ('/', ['/default'], ())
assert _resolve_default(root, Default({root: '*'})) == ('/', ['/default'], ())
assert _resolve_default(root, Default({root: root})) == ('/', ['/default'], ())
assert _resolve_default(root, Default({'/': root})) == ('/', ['/default'], ())
# these should throw errors, group points to group in list
with pytest.raises(KeyError, match='value in list .* is not an option'): _resolve_default(root, Default({'/': ['subgroup']}))
with pytest.raises(KeyError, match='value in list .* is not an option'): _resolve_default(root, Default({'/': ['default', 'subgroup']}))
# check parents
assert _resolve_default(root, Default(d)) == ('/', ['/default'], ())
assert _resolve_default(s1, Default(d)) == ('/', ['/default'], ())
assert _resolve_default(s2, Default(d)) == ('/', ['/default'], ())
assert _resolve_default(s2s3, Default(d)) == ('/', ['/default'], ())
# check others
assert _resolve_default(root, Default(s1)) == ('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))
assert _resolve_default(s1, Default(s1)) == ('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))
assert _resolve_default(s2, Default(s1)) == ('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))
assert _resolve_default(s2s3, Default(s1)) == ('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))
assert _resolve_default(root, Default({s1: '*'})) == ('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))
assert _resolve_default(root, Default({s1: s1})) == ('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))
# strings
assert _resolve_default(root, Default('subgroup')) == ('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))
assert _resolve_default(root, Default('/subgroup')) == ('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))
assert _resolve_default(root, Default(s1)) == ('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))
assert _resolve_default(root, Default(s1o1)) == ('/subgroup', ['/subgroup/suboption1'], ('subgroup',))
assert _resolve_default(root, Default({'/subgroup': 'suboption1'})) == ('/subgroup', ['/subgroup/suboption1'], ('subgroup',))
assert _resolve_default(root, Default({'subgroup': 'suboption1'})) == ('/subgroup', ['/subgroup/suboption1'], ('subgroup',))
with pytest.raises(KeyError, match="Group '/subgroup2/subgroup3' does not have child 'subgroup'"):
_resolve_default(s2s3, Default({'subgroup': 'suboption1'}))
with pytest.raises(KeyError, match="Group '/subgroup2' does not have child 'subgroup'"):
_resolve_default(s2, Default({'subgroup': 'suboption1'}))
with pytest.raises(KeyError, match="Group '/subgroup' does not have child 'subgroup'"):
_resolve_default(s1, Default({'subgroup': 'suboption1'}))
def test_defaults_advanced():
def resolve_entry_defaults(group):
results = []
for default in group.get_option('default').get_unresolved_defaults():
results.append(_resolve_default(group, default))
return results
assert resolve_entry_defaults(_make_config_group(suboption='suboption1')) == [('/subgroup', ['/subgroup/suboption1'], ('subgroup',))]
assert resolve_entry_defaults(_make_config_group(suboption='suboption2')) == [('/subgroup', ['/subgroup/suboption2'], ('subgroup',))]
assert resolve_entry_defaults(_make_config_group(suboption=['suboption2'])) == [('/subgroup', ['/subgroup/suboption2'], ('subgroup',))]
assert resolve_entry_defaults(_make_config_group(suboption=['suboption1', 'suboption2'])) == [('/subgroup', ['/subgroup/suboption1', '/subgroup/suboption2'], ('subgroup',))]
assert resolve_entry_defaults(_make_config_group(suboption=None, suboption2='suboption1')) == [('/subgroup2/subgroup3', ['/subgroup2/subgroup3/suboption1'], ('subgroup2', 'subgroup3'))]
assert resolve_entry_defaults(_make_config_group(suboption=None, suboption2='suboption2')) == [('/subgroup2/subgroup3', ['/subgroup2/subgroup3/suboption2'], ('subgroup2', 'subgroup3'))]
| 66.212389 | 189 | 0.62911 | 747 | 7,482 | 6.089692 | 0.15261 | 0.132337 | 0.138492 | 0.175863 | 0.736426 | 0.693779 | 0.639261 | 0.575291 | 0.557046 | 0.515718 | 0 | 0.016912 | 0.15437 | 7,482 | 112 | 190 | 66.803571 | 0.70207 | 0.084469 | 0 | 0.051948 | 0 | 0 | 0.269946 | 0.02108 | 0 | 0 | 0 | 0 | 0.506494 | 1 | 0.064935 | false | 0 | 0.051948 | 0 | 0.168831 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f61c2aa8d4b0c6d527e4128c6b11bb2329c17ab9 | 651 | py | Python | apf/core/templates/step/package/step.py | alercebroker/APF | d71cec49ee7f4a1667210b70c48501d036d5c08b | [
"MIT"
] | 2 | 2020-03-12T17:27:11.000Z | 2020-05-28T21:21:51.000Z | apf/core/templates/step/package/step.py | alercebroker/APF | d71cec49ee7f4a1667210b70c48501d036d5c08b | [
"MIT"
] | 15 | 2019-11-25T19:51:39.000Z | 2022-03-04T19:00:31.000Z | apf/core/templates/step/package/step.py | alercebroker/APF | d71cec49ee7f4a1667210b70c48501d036d5c08b | [
"MIT"
] | 2 | 2020-06-21T07:55:58.000Z | 2022-02-08T11:09:05.000Z | from apf.core.step import GenericStep
import logging
class {{step_name}}(GenericStep):
"""{{step_name}} Description
Parameters
----------
consumer : GenericConsumer
Description of parameter `consumer`.
**step_args : type
Other args passed to step (DB connections, API requests, etc.)
"""
def __init__(self,consumer = None, config = None,level = logging.INFO,**step_args):
super().__init__(consumer,config=config, level=level)
def execute(self,message):
################################
# Here comes the Step Logic #
################################
pass
| 26.04 | 87 | 0.560676 | 64 | 651 | 5.515625 | 0.625 | 0.045326 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.235023 | 651 | 24 | 88 | 27.125 | 0.708835 | 0.038402 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.142857 | 0.285714 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
f61d22ab24870ca8c56c224b5de2063d76fef120 | 5,107 | py | Python | NLPFeatures.py | Nik0l/UTemPr | cc8c64dd01910194d1f18530a687595dceff30df | [
"MIT"
] | 2 | 2016-02-24T19:36:12.000Z | 2017-08-04T07:46:06.000Z | NLPFeatures.py | Nik0l/UTemPr | cc8c64dd01910194d1f18530a687595dceff30df | [
"MIT"
] | 1 | 2016-03-03T09:18:07.000Z | 2016-03-03T09:18:07.000Z | NLPFeatures.py | Nik0l/UTemPr | cc8c64dd01910194d1f18530a687595dceff30df | [
"MIT"
] | 2 | 2017-04-18T09:56:30.000Z | 2019-11-22T01:40:10.000Z | __author__ = 'nb254'
#requires question_title_length.csv for processing: TITLE, BODY, POSTID, USERID
import nltk, csv
import pandas as pd
import Features as features
#test = "<p>I have an original Arduino UNO R3 that I bought and an <a href='http://arduino.cc/en/Main/ArduinoBoardSerialSingleSided3' rel='nofollow'>Arduino Severino (S3V3)</a> that I"'"ve built.</p><p>I have no problems uploading sketches to the UNO, but sometimes, when uploading to the Severino board, I have to hard reset it at a specific time during the upload process, when the IDE says something like this below:</p><pre><code>avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch System wide configuration file is C:\arduino-1.0.3\hardware/tools/avr/etc avrdude.conf Using Port:.\COM1 Using Programmer : arduino Overriding Baud Rate : 115200 avrdude: Send: 0 [30] [20] avrdude: Send: 0 [30] [20] avrdude: Send: 0 [30] [20] </code></pre> <p>If I don"'"t reset it when one of the <code>Send</code> messages are being displayed, I get the <code>not in sync</code> message, as below:</p><pre><code>avrdude: Recv: avrdude: stk500_getsync(): not in sync: resp=0x00</code></pre><p>Other times, if I'm lucky, I can upload to the Severino board without having to reset it.</p><p>So, my questions are:</p><ol><li><p><strong>Why does that happen? Why Severino needs a hard reset during upload?</strong></p></li><li><p><strong>Why is the problem intermitent?</strong> Why does it happen sometimes and others it doesn't?</p></li><li><p><strong>How can I fix that problem?</strong> Is there a simple change to the Severino design that would fix that?</p></li></ol>"
def NLPExtract(data, file_name):
HEADER = features.KEYS + features.NLP_FEATURES
# the file where all 'wh' and '?' will be saved
csv_writer = csv.writer(open(file_name, 'wb'))
csv_writer.writerow(HEADER)
i = 0
#print data
for index, row in data.iterrows():
#TODO: delete the second condition
if i > 0:
print row
res = NLPFeatures(row)
csv_writer.writerow(res)
i = i + 1
# counts words of a particular type, for example, 'WP' - 'wh' words
def NLPFeatures(row):
post_id = row['PostId']
user_id = row['UserId']
#print row
try:
res = NLPFeaturesCalc(row['Q_Title'], row['Q_Body'])
res = [post_id, user_id] + res
except UnicodeDecodeError:
#TODO: convert to unicode, currently just ignoring the error
print('UnicodeDecodeError: ' + row['Q_Title'])
res = [post_id, user_id] + [0]*12
return res
def NLPFeaturesCalc(title, body):
num_qm = 0
num_wp = 0
symbols = ['VBG', 'VBZ', 'VBP', 'VB', 'VBD', 'VBN'] #verbs
selfRef = ['I','my','myself', 'we', 'We', 'My', 'Myself', 'i'] # self-reference nouns
# tokens of the title and the body
tokens = [nltk.word_tokenize(title), nltk.word_tokenize(body)]
tagged = [nltk.pos_tag(tokens[0]), nltk.pos_tag(tokens[1])]
############### construct features ############################
num_qm = [Count(tokens[0], '?'), Count(tokens[1], '?')] # number of question marks
num_wp = [CountP(tagged[0], 'WP'), CountP(tagged[1], 'WP')]# number of 'wh' words
num_av = [CountV(tagged[0], symbols), CountV(tagged[1], symbols)] #number of active verbs
num_sr = [CountM(tokens[0], selfRef), CountM(tokens[1], selfRef)] #self-reference
num_url = body.count('<a href=') # how many url links are there
num_img = body.count('<img') # how many images are there
num_cst = body.count('<code>') # how many start code blocks
num_cen = body.count('</code>') # how many end code blocks
cod_len = CodeLength(body, num_cst, num_cen) # total length of code in chars
res = [num_wp[0], num_wp[1], num_qm[0], num_qm[1], num_av[0], num_av[1], num_sr[0], num_sr[1], num_url, num_img, num_cst, cod_len]
return res
def CountP(data, TYPE):
num = 0
for x in data:
if x[1] == TYPE:
num = num + 1
return num
# counts a number of particular words or symbols, for example, '?'
def Count(data, symbol):
num = 0
for x in data:
if x == symbol:
num = num + 1
return num
# counts a number of multiple symbols
def CountM(data, symbols):
num = 0
for sym in symbols:
num = num + Count(data, sym)
return num
# counts a number of multiple symbols
def CountV(data, symbols):
num = 0
for sym in symbols:
num = num + CountP(data, sym)
#print num
#print sym
return num
# checks if it is a substring
def SubString(data, text):
if text in data:
return 1
else:
return 0
def CodeLength(text, num_cst, num_cen):#text and the number of start and end code blocks
cod_len = 0
if num_cst <> num_cen or num_cst * num_cen == 0:
return cod_len
else:
s = text.replace(" ","")
s = s.replace("</code>"," ")
s = s.replace("<code>"," ")
#print s
s = s.split()
i = 0
for line in s:
if i%2 <> 0:
cod_len = cod_len + len(line)
i = i + 1
return cod_len
| 45.598214 | 1,568 | 0.649305 | 825 | 5,107 | 3.944242 | 0.333333 | 0.01721 | 0.011063 | 0.014751 | 0.137677 | 0.084819 | 0.084819 | 0.084819 | 0.07437 | 0.036878 | 0 | 0.02696 | 0.208341 | 5,107 | 111 | 1,569 | 46.009009 | 0.777888 | 0.470922 | 0 | 0.282353 | 0 | 0 | 0.055112 | 0 | 0 | 0 | 0 | 0.009009 | 0 | 0 | null | null | 0 | 0.035294 | null | null | 0.023529 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f636a882b94f8b074d76f3398dd62f93844dc2ba | 245 | py | Python | factory_djoy/__about__.py | jamescooke/factory_djoy | 97cf68a068b831f2830688a91e7b143b97bc1326 | [
"MIT"
] | 26 | 2016-05-27T19:00:34.000Z | 2022-02-14T14:22:20.000Z | factory_djoy/__about__.py | jamescooke/factory_djoy | 97cf68a068b831f2830688a91e7b143b97bc1326 | [
"MIT"
] | 37 | 2016-05-27T18:58:51.000Z | 2021-10-10T11:35:08.000Z | factory_djoy/__about__.py | jamescooke/factory_djoy | 97cf68a068b831f2830688a91e7b143b97bc1326 | [
"MIT"
] | null | null | null | __name__ = 'factory_djoy'
__version__ = '2.2.0'
__author__ = 'James Cooke'
__copyright__ = '2021, {}'.format(__author__)
__description__ = 'Factories for Django, creating valid model instances every time.'
__email__ = 'github@jamescooke.info'
| 27.222222 | 84 | 0.755102 | 28 | 245 | 5.571429 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032558 | 0.122449 | 245 | 8 | 85 | 30.625 | 0.693023 | 0 | 0 | 0 | 0 | 0 | 0.497959 | 0.089796 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f6630d45727b60cf6121d275d6c726d45711227d | 287 | py | Python | Life.py | lianwt115/python_pygame | 4d70846740e8905f63059de107a8d0831d9ffe0c | [
"MIT"
] | 1 | 2018-08-14T02:54:14.000Z | 2018-08-14T02:54:14.000Z | Life.py | lianwt115/python_pygame | 4d70846740e8905f63059de107a8d0831d9ffe0c | [
"MIT"
] | null | null | null | Life.py | lianwt115/python_pygame | 4d70846740e8905f63059de107a8d0831d9ffe0c | [
"MIT"
] | null | null | null | # 子弹
import pygame
class Life(pygame.sprite.Sprite):
def __init__(self, img, init_pos):
pygame.sprite.Sprite.__init__(self)
self.image = img
self.rect = self.image.get_rect()
self.rect.topleft = init_pos
def update(self):
self.kill()
| 17.9375 | 43 | 0.620209 | 38 | 287 | 4.394737 | 0.447368 | 0.143713 | 0.215569 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.264808 | 287 | 15 | 44 | 19.133333 | 0.791469 | 0.006969 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 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 | 2 |
f66a07a388a781ad9ca3ffd91259ea2672b30eef | 2,449 | py | Python | idgo_admin/views/sld_preview.py | neogeo-technologies/idgo | 23e028b0d7fb2daf54d7e2954e0cc4d7b9be4210 | [
"Apache-2.0"
] | null | null | null | idgo_admin/views/sld_preview.py | neogeo-technologies/idgo | 23e028b0d7fb2daf54d7e2954e0cc4d7b9be4210 | [
"Apache-2.0"
] | 2 | 2018-09-14T07:12:00.000Z | 2019-11-13T09:32:24.000Z | idgo_admin/views/sld_preview.py | neogeo-technologies/idgo | 23e028b0d7fb2daf54d7e2954e0cc4d7b9be4210 | [
"Apache-2.0"
] | 2 | 2019-03-25T08:27:43.000Z | 2019-10-07T15:25:30.000Z | # Copyright (c) 2017-2021 Neogeo-Technologies.
# 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 redis
import urllib.parse
import uuid
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.http import HttpResponse
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views import View
from idgo_admin import REDIS_HOST
from idgo_admin import REDIS_EXPIRATION
from idgo_admin import LOGIN_URL
from idgo_admin import HOST_INTERNAL
from idgo_admin import PORT_INTERNAL
strict_redis = redis.StrictRedis(REDIS_HOST)
@method_decorator([csrf_exempt, login_required(login_url=LOGIN_URL)], name='dispatch')
class SLDPreviewSetter(View):
def post(self, request, *args, **kwargs):
sld = request.POST.get('sld')
key = str(uuid.uuid4())
strict_redis.set(key, sld)
strict_redis.expire(key, REDIS_EXPIRATION)
response = HttpResponse(status=201)
location = request.build_absolute_uri(
reverse('idgo_admin:sld_preview_getter', kwargs={'key': key}))
# C'est moche
if HOST_INTERNAL and PORT_INTERNAL:
netloc = '{host}:{port}'.format(
host=HOST_INTERNAL, port=PORT_INTERNAL)
parsed = urllib.parse.urlparse(location)
replaced = parsed._replace(netloc=netloc)
response['Content-Location'] = replaced.geturl()
else:
response['Content-Location'] = location
return response
@method_decorator([csrf_exempt], name='dispatch')
class SLDPreviewGetter(View):
def get(self, request, key=None, *args, **kwargs):
sld = strict_redis.get(key)
if not sld:
raise Http404
return HttpResponse(sld, status=200, content_type='application/vnd.ogc.sld+xml')
| 31.805195 | 88 | 0.721111 | 325 | 2,449 | 5.32 | 0.458462 | 0.04627 | 0.037594 | 0.054945 | 0.027762 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012645 | 0.192732 | 2,449 | 76 | 89 | 32.223684 | 0.861912 | 0.24459 | 0 | 0 | 0 | 0 | 0.067067 | 0.030534 | 0 | 0 | 0 | 0 | 0 | 1 | 0.046512 | false | 0 | 0.372093 | 0 | 0.511628 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f67473386f78c6d97077c35b82b59ca8dd569a05 | 681 | py | Python | equipment_piece.py | cookyt/mhw_optimizer | 05dc4483f9bb0b6f8c2d8e205239d58bbd4c274a | [
"MIT"
] | null | null | null | equipment_piece.py | cookyt/mhw_optimizer | 05dc4483f9bb0b6f8c2d8e205239d58bbd4c274a | [
"MIT"
] | null | null | null | equipment_piece.py | cookyt/mhw_optimizer | 05dc4483f9bb0b6f8c2d8e205239d58bbd4c274a | [
"MIT"
] | null | null | null | from enum import Enum
class BodyPart(Enum):
HEAD = 0
BODY = 1
ARMS = 2
WAIST = 3
LEGS = 4
CHARM = 5
class EquipmentPiece:
def __init__(self, name, body_part, skills):
self.name = name
self.body_part = body_part
self.skills = skills
class ArmourPiece(EquipmentPiece):
def __init__(self, name, body_part, defence, skills, decoration_slots):
EquipmentPiece.__init__(self, name, body_part, skills)
self.defence = defence
self.decoration_slots = decoration_slots
class Charm(EquipmentPiece):
def __init__(self, name, skills):
EquipmentPiece.__init__(self, name, BodyPart.CHARM, skills)
| 22.7 | 75 | 0.666667 | 82 | 681 | 5.195122 | 0.341463 | 0.112676 | 0.140845 | 0.176056 | 0.335681 | 0.267606 | 0.267606 | 0 | 0 | 0 | 0 | 0.011719 | 0.248164 | 681 | 29 | 76 | 23.482759 | 0.820313 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.047619 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
9c875ae7c2afe703c37e9e06e4b3067ddcb1e099 | 11,643 | py | Python | src/OTLMOW/OTLModel/Datatypes/KlVerlichtingstoestelModelnaam.py | davidvlaminck/OTLClassPython | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | 2 | 2022-02-01T08:58:11.000Z | 2022-02-08T13:35:17.000Z | src/OTLMOW/OTLModel/Datatypes/KlVerlichtingstoestelModelnaam.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | src/OTLMOW/OTLModel/Datatypes/KlVerlichtingstoestelModelnaam.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | # coding=utf-8
from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField
from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde
# Generated with OTLEnumerationCreator. To modify: extend, do not edit
class KlVerlichtingstoestelModelnaam(KeuzelijstField):
"""De modelnaam van het verlichtingstoestel."""
naam = 'KlVerlichtingstoestelModelnaam'
label = 'Verlichtingstoestel modelnaam'
objectUri = 'https://wegenenverkeer.data.vlaanderen.be/ns/abstracten#KlVerlichtingstoestelModelnaam'
definition = 'De modelnaam van het verlichtingstoestel.'
codelist = 'https://wegenenverkeer.data.vlaanderen.be/id/conceptscheme/KlVerlichtingstoestelModelnaam'
options = {
'ARC': KeuzelijstWaarde(invulwaarde='ARC',
label='ARC',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/ARC'),
'Belgica': KeuzelijstWaarde(invulwaarde='Belgica',
label='Belgica',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Belgica'),
'Calypso': KeuzelijstWaarde(invulwaarde='Calypso',
label='Calypso',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Calypso'),
'Corus': KeuzelijstWaarde(invulwaarde='Corus',
label='Corus',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Corus'),
'DTN': KeuzelijstWaarde(invulwaarde='DTN',
label='DTN',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/DTN'),
'Evolo': KeuzelijstWaarde(invulwaarde='Evolo',
label='Evolo',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Evolo'),
'Focal': KeuzelijstWaarde(invulwaarde='Focal',
label='Focal',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Focal'),
'GSM': KeuzelijstWaarde(invulwaarde='GSM',
label='GSM',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/GSM'),
'GTMB': KeuzelijstWaarde(invulwaarde='GTMB',
label='GTMB',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/GTMB'),
'GTNB': KeuzelijstWaarde(invulwaarde='GTNB',
label='GTNB',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/GTNB'),
'GZM': KeuzelijstWaarde(invulwaarde='GZM',
label='GZM',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/GZM'),
'Gema': KeuzelijstWaarde(invulwaarde='Gema',
label='Gema',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Gema'),
'HCI-TS': KeuzelijstWaarde(invulwaarde='HCI-TS',
label='HCI-TS',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/HCI-TS'),
'Iridium': KeuzelijstWaarde(invulwaarde='Iridium',
label='Iridium',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Iridium'),
'MNF300': KeuzelijstWaarde(invulwaarde='MNF300',
label='MNF300',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/MNF300'),
'MWF230': KeuzelijstWaarde(invulwaarde='MWF230',
label='MWF230',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/MWF230'),
'MY11': KeuzelijstWaarde(invulwaarde='MY11',
label='MY11',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/MY11'),
'Neos': KeuzelijstWaarde(invulwaarde='Neos',
label='Neos',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Neos'),
'Onyx': KeuzelijstWaarde(invulwaarde='Onyx',
label='Onyx',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Onyx'),
'RT3NB': KeuzelijstWaarde(invulwaarde='RT3NB',
label='RT3NB',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/RT3NB'),
'RT3SB': KeuzelijstWaarde(invulwaarde='RT3SB',
label='RT3SB',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/RT3SB'),
'RXN': KeuzelijstWaarde(invulwaarde='RXN',
label='RXN',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/RXN'),
'RXS': KeuzelijstWaarde(invulwaarde='RXS',
label='RXS',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/RXS'),
'Radial': KeuzelijstWaarde(invulwaarde='Radial',
label='Radial',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Radial'),
'SRS201': KeuzelijstWaarde(invulwaarde='SRS201',
label='SRS201',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/SRS201'),
'Safir': KeuzelijstWaarde(invulwaarde='Safir',
label='Safir',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Safir'),
'Saturnus': KeuzelijstWaarde(invulwaarde='Saturnus',
label='Saturnus',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Saturnus'),
'Squalo': KeuzelijstWaarde(invulwaarde='Squalo',
label='Squalo',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Squalo'),
'Syntra': KeuzelijstWaarde(invulwaarde='Syntra',
label='Syntra',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Syntra'),
'VTP': KeuzelijstWaarde(invulwaarde='VTP',
label='VTP',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/VTP'),
'Z18': KeuzelijstWaarde(invulwaarde='Z18',
label='Z18',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Z18'),
'Z2': KeuzelijstWaarde(invulwaarde='Z2',
label='Z2',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Z2'),
'Z21': KeuzelijstWaarde(invulwaarde='Z21',
label='Z21',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/Z21'),
'ampera': KeuzelijstWaarde(invulwaarde='ampera',
label='Ampera',
definitie='Ampera',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/ampera'),
'andere': KeuzelijstWaarde(invulwaarde='andere',
label='andere',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/andere'),
'brugleuning': KeuzelijstWaarde(invulwaarde='brugleuning',
label='brugleuning',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/brugleuning'),
'clear-field': KeuzelijstWaarde(invulwaarde='clear-field',
label='ClearField',
definitie='ClearField',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/clear-field'),
'digi-street': KeuzelijstWaarde(invulwaarde='digi-street',
label='DigiStreet',
definitie='DigiStreet',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/digi-street'),
'izylum': KeuzelijstWaarde(invulwaarde='izylum',
label='Izylum',
definitie='Izylum',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/izylum'),
'luma': KeuzelijstWaarde(invulwaarde='luma',
label='Luma',
definitie='Luma',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/luma'),
'lumi-street': KeuzelijstWaarde(invulwaarde='lumi-street',
label='LumiStreet',
definitie='LumiStreet',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/lumi-street'),
'projector': KeuzelijstWaarde(invulwaarde='projector',
label='projector',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/projector'),
'teceo': KeuzelijstWaarde(invulwaarde='teceo',
label='Teceo',
definitie='Teceo',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlVerlichtingstoestelModelnaam/teceo')
}
| 76.098039 | 149 | 0.562913 | 779 | 11,643 | 8.41335 | 0.119384 | 0.130455 | 0.157919 | 0.226579 | 0.567897 | 0.556912 | 0.544553 | 0.544553 | 0.544553 | 0 | 0 | 0.009341 | 0.328781 | 11,643 | 152 | 150 | 76.598684 | 0.829303 | 0.01065 | 0 | 0 | 1 | 0 | 0.42316 | 0.002606 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.013699 | 0 | 0.061644 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9c879e5d1943efd11dd7e5215bb6e0131412a141 | 209 | py | Python | ospath/ospath_expanduser.py | dineshkumar2509/learning-python | e8af11ff0b396da4c3f2cfe21d14131bae4b2adb | [
"MIT"
] | 86 | 2015-06-13T16:53:55.000Z | 2022-03-24T20:56:42.000Z | ospath/ospath_expanduser.py | pei-zheng-yi/learning-python | 55e350dfe44cf04f7d4408e76e72d2f467bd42ce | [
"MIT"
] | 9 | 2015-05-27T07:52:44.000Z | 2022-03-29T21:52:40.000Z | ospath/ospath_expanduser.py | pei-zheng-yi/learning-python | 55e350dfe44cf04f7d4408e76e72d2f467bd42ce | [
"MIT"
] | 124 | 2015-12-10T01:17:18.000Z | 2021-11-08T04:03:38.000Z | #!/usr/bin/env python
# encoding: utf-8
"""Expand tilde in filenames.
"""
import os.path
for user in ['', 'dhellmann', 'postgres']:
lookup = '~' + user
print lookup, ':', os.path.expanduser(lookup)
| 17.416667 | 49 | 0.62201 | 27 | 209 | 4.814815 | 0.777778 | 0.092308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005848 | 0.181818 | 209 | 11 | 50 | 19 | 0.754386 | 0.172249 | 0 | 0 | 0 | 0 | 0.137681 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.25 | null | null | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9c8c0ef5b1b94d70574d07bd18de4607864827eb | 1,056 | py | Python | src/hashing_.py | pawelmhm/recenseo.es | 026ac67cb6e146745aad1649c338ed89b83f0c63 | [
"MIT"
] | null | null | null | src/hashing_.py | pawelmhm/recenseo.es | 026ac67cb6e146745aad1649c338ed89b83f0c63 | [
"MIT"
] | 1 | 2021-03-19T22:06:54.000Z | 2021-03-19T22:06:54.000Z | src/hashing_.py | pawelmhm/recenseo.es | 026ac67cb6e146745aad1649c338ed89b83f0c63 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from hmac import HMAC
from hashlib import sha256
import random
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def pbkd(password,salt):
"""
password must be a string in ascii, for some reasons
string of type unicode provokes the following error:
"TypeError: character mapping must return integer, None or unicode"
TODO: should we check type of string before it gets here?
"""
return HMAC(str(password),salt,sha256).digest()
def randomSalt(num_bytes):
return "".join(chr(random.randrange(256)) for i in xrange(num_bytes))
def hash_password(plain_text):
salt = randomSalt(8)
for i in xrange(1000):
hashed_password = pbkd(plain_text,salt)
return salt.encode("base64").strip() + "," + hashed_password.encode("base64").strip()
def check_password(saved_pass, plain_pass):
salt,hashed_p = saved_pass.split(",")
salt=salt.decode("base64")
hashed_p = hashed_p.decode("base64")
return hashed_p == pbkd(plain_pass, salt) | 31.058824 | 89 | 0.710227 | 148 | 1,056 | 4.932432 | 0.506757 | 0.038356 | 0.016438 | 0.032877 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026346 | 0.173295 | 1,056 | 34 | 90 | 31.058824 | 0.809851 | 0.243371 | 0 | 0 | 0 | 0 | 0.033766 | 0 | 0 | 0 | 0 | 0.029412 | 0 | 1 | 0.2 | false | 0.4 | 0.2 | 0.05 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
9ca288ba9259937c8aeaac578a1dd9eb50715c34 | 1,930 | py | Python | scheduled_bots/scripts/add_ECO_evidence_code.py | turoger/scheduled-bots | 23fd30ccc242391151af3a1727f9fbf9dc95d433 | [
"MIT"
] | 6 | 2017-05-04T01:04:26.000Z | 2022-03-04T12:22:17.000Z | scheduled_bots/scripts/add_ECO_evidence_code.py | turoger/scheduled-bots | 23fd30ccc242391151af3a1727f9fbf9dc95d433 | [
"MIT"
] | 55 | 2017-03-14T21:16:44.000Z | 2022-03-02T12:39:14.000Z | scheduled_bots/scripts/add_ECO_evidence_code.py | turoger/scheduled-bots | 23fd30ccc242391151af3a1727f9fbf9dc95d433 | [
"MIT"
] | 13 | 2017-02-10T21:40:06.000Z | 2022-01-18T01:27:52.000Z | """
One off script to Map evidence codes between ECO and GO
https://github.com/evidenceontology/evidenceontology/blob/master/gaf-eco-mapping.txt
"""
import datetime
from wikidataintegrator import wdi_core, wdi_login
from scheduled_bots.local import WDPASS, WDUSER
login = wdi_login.WDLogin(WDUSER, WDPASS)
go_evidence_codes = {'EXP': 'Q23173789', 'IDA': 'Q23174122', 'IPI': 'Q23174389', 'IMP': 'Q23174671', 'IGI': 'Q23174952',
'IEP': 'Q23175251', 'ISS': 'Q23175558', 'ISO': 'Q23190637', 'ISA': 'Q23190738', 'ISM': 'Q23190825',
'IGC': 'Q23190826', 'IBA': 'Q23190827', 'IBD': 'Q23190833', 'IKR': 'Q23190842', 'IRD': 'Q23190850',
'RCA': 'Q23190852', 'TAS': 'Q23190853', 'NAS': 'Q23190854', 'IC': 'Q23190856', 'ND': 'Q23190857',
'IEA': 'Q23190881', 'IMR': 'Q23190842'}
eco = {'EXP': 'ECO:0000269', 'IBA': 'ECO:0000318', 'IBD': 'ECO:0000319', 'IC': 'ECO:0000305', 'IDA': 'ECO:0000314',
'IEA': 'ECO:0000501', 'IEP': 'ECO:0000270', 'IGC': 'ECO:0000317', 'IGI': 'ECO:0000316', 'IKR': 'ECO:0000320',
'IMP': 'ECO:0000315', 'IMR': 'ECO:0000320', 'IPI': 'ECO:0000353', 'IRD': 'ECO:0000321', 'ISA': 'ECO:0000247',
'ISM': 'ECO:0000255', 'ISO': 'ECO:0000266', 'ISS': 'ECO:0000250', 'NAS': 'ECO:0000303', 'ND': 'ECO:0000307',
'RCA': 'ECO:0000245', 'TAS': 'ECO:0000304'}
reference = [wdi_core.WDItemID("Q28445410", "P248", is_reference=True), # stated in ECO
wdi_core.WDTime(datetime.datetime.now().strftime('+%Y-%m-%dT00:00:00Z'), 'P813', is_reference=True)]
for evidence_code, wdid in go_evidence_codes.items():
data = [wdi_core.WDString('http://purl.obolibrary.org/obo/{}'.format(eco[evidence_code].replace(":", "_")), 'P1709',
references=[reference])]
item = wdi_core.WDItemEngine(wd_item_id=wdid, data=data)
item.write(login, edit_summary="add ECO equivalent class")
| 58.484848 | 120 | 0.615544 | 231 | 1,930 | 5.056277 | 0.601732 | 0.029966 | 0.025685 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221112 | 0.170466 | 1,930 | 32 | 121 | 60.3125 | 0.508432 | 0.080311 | 0 | 0 | 0 | 0 | 0.378042 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.095238 | 0.142857 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
9ca412a5e4887117f87a070c4624fcb1569c592d | 6,322 | py | Python | pychemia/population/_population.py | quanshengwu/PyChemia | 98e9f7a1118b694dbda3ee75411ff8f8d7b9688b | [
"MIT"
] | 1 | 2021-03-26T12:34:45.000Z | 2021-03-26T12:34:45.000Z | pychemia/population/_population.py | quanshengwu/PyChemia | 98e9f7a1118b694dbda3ee75411ff8f8d7b9688b | [
"MIT"
] | null | null | null | pychemia/population/_population.py | quanshengwu/PyChemia | 98e9f7a1118b694dbda3ee75411ff8f8d7b9688b | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
import json
import numpy as np
from builtins import str
from abc import ABCMeta, abstractmethod
from pychemia import HAS_PYMONGO
from pychemia.utils.computing import deep_unicode
if HAS_PYMONGO:
from pychemia.db import PyChemiaDB
class Population:
__metaclass__ = ABCMeta
"""
General class for all optimization algorithms that uses fixed and blocked
Generations
"""
def __init__(self, name, tag, use_mongo=True):
name = deep_unicode(name)
self.tag = tag
self.pcdb = None
if isinstance(name, str):
self.name = name
if use_mongo:
self.pcdb = PyChemiaDB(name)
else:
self.name = name.name
if use_mongo:
self.pcdb = name
def __iter__(self):
return self.pcdb.entries.find()
def __len__(self):
return len(self.members)
def __str__(self):
ret = ' Population Name: %s\n' % self.name
ret += ' Tag: %s\n' % self.tag
ret += ' Members: %s\n' % len(self)
return ret
def disable(self, entry_id):
self.pcdb.entries.update({'_id': entry_id}, {'$set': {'status.' + self.tag: False}})
def enable(self, entry_id):
self.pcdb.entries.update({'_id': entry_id}, {'$set': {'status.' + self.tag: True}})
def get_values(self, selection):
ret = {}
for i in selection:
ret[i] = self.value(i)
return ret
def update_properties(self, entry_id, new_properties):
self.pcdb.update(entry_id, properties=new_properties)
def set_in_properties(self, entry_id, field, value):
return self.pcdb.entries.update_one({'_id': entry_id}, {'$set': {'properties.'+field: value}})
def get_population_info(self):
return self.pcdb.db.population_info.find_one({'tag': self.tag})
def insert_entry(self, entry):
if 'structure' not in entry:
entry['structure']={}
if 'properties' not in entry:
entry['properties']={}
if 'status' not in entry:
entry['status']={}
self.pcdb.entries.insert(entry)
def get_structure(self, entry_id):
return self.pcdb.get_structure(entry_id)
def set_structure(self, entry_id, structure):
return self.pcdb.update(entry_id, structure=structure)
def get_entry(self, entry_id, projection=None, with_id=True):
"""
Return an entry identified by 'entry_id'
:param with_id:
:param projection: Insert that projection into the query
:param entry_id: A database identifier
:return:
"""
if projection is None:
projection = {}
if not with_id:
projection['_id']=0
entry = self.pcdb.entries.find_one({'_id': entry_id}, projection)
return entry
def ids_sorted(self, selection):
values = np.array([self.value(i) for i in selection])
sorted_indices = np.argsort(values)
return np.array(selection)[sorted_indices]
def load_json(self, filename):
filep = open(filename, 'r')
data = json.load(filep)
for entry in data:
self.pcdb.entries.insert(entry)
def random_population(self, n):
"""
Create N new random structures to the population
:param n: (int) The number of new structures
:return: (list) The identifiers for the new structures
"""
return [self.add_random() for i in range(n)]
def replace_failed(self):
pass
def save_info(self):
data = self.pcdb.db.population_info.find_one({'_id': self.tag})
if data is None:
data = self.to_dict
data['_id'] = self.tag
self.pcdb.db.population_info.insert(data)
else:
self.pcdb.db.population_info.update({'_id': self.tag}, self.to_dict)
def save_json(self, filename):
ret = []
for entry_id in self.members:
ret.append(self.get_entry(entry_id, with_id=False))
filep = open(filename, 'w')
json.dump(ret, filep, sort_keys=True, indent=4, separators=(',', ': '))
def unlock_all(self, name=None):
for i in self.members:
self.pcdb.unlock(i, name=name)
@abstractmethod
def add_random(self):
pass
@abstractmethod
def check_duplicates(self, ids):
pass
@abstractmethod
def cross(self, ids):
pass
@abstractmethod
def distance(self, entry_id, entry_jd):
pass
@abstractmethod
def get_duplicates(self, ids):
pass
@abstractmethod
def from_dict(self, population_dict):
pass
@abstractmethod
def is_evaluated(self, entry_id):
pass
@abstractmethod
def move_random(self, entry_id, factor=0.2, in_place=False, kind='move'):
pass
@abstractmethod
def move(self, entry_id, entry_jd, factor=0.2, in_place=False):
pass
@abstractmethod
def new_entry(self, data, active=True):
pass
@abstractmethod
def recover(self):
pass
@abstractmethod
def value(self, entry_id):
pass
@abstractmethod
def str_entry(self, entry_id):
pass
@property
def actives(self):
return [entry['_id'] for entry in self.pcdb.entries.find({'status.' + self.tag: True}, {'_id': 1})]
@property
def actives_evaluated(self):
return [x for x in self.actives if self.is_evaluated(x)]
@property
def actives_no_evaluated(self):
return [x for x in self.actives if not self.is_evaluated(x)]
@property
def evaluated(self):
return [entry for entry in self.members if self.is_evaluated(entry)]
@property
def fraction_evaluated(self):
ret = np.sum([1 for i in self.actives if self.is_evaluated(i)])
return float(ret) / len(self.actives)
@property
def members(self):
return [x['_id'] for x in self.pcdb.entries.find({}, {'_id': 1})]
@property
def to_dict(self):
return {'name': self.name, 'tag': self.tag}
@property
def best_candidate(self):
return self.ids_sorted(self.evaluated)[0]
def refine_progressive(self, entry_id):
pass
| 27.72807 | 107 | 0.607403 | 808 | 6,322 | 4.587871 | 0.191832 | 0.049096 | 0.041543 | 0.020502 | 0.222282 | 0.169409 | 0.094686 | 0.051794 | 0.051794 | 0.051794 | 0 | 0.002201 | 0.28124 | 6,322 | 227 | 108 | 27.85022 | 0.8136 | 0.049351 | 0 | 0.271605 | 0 | 0 | 0.039071 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.265432 | false | 0.092593 | 0.049383 | 0.080247 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
9cadce2a65716efbbbaef6fb365b1a19a14d1464 | 779 | py | Python | code/mod.py | aragilar/python-testing | 312496a9016975d99230744e262799999740720b | [
"CC-BY-4.0"
] | null | null | null | code/mod.py | aragilar/python-testing | 312496a9016975d99230744e262799999740720b | [
"CC-BY-4.0"
] | null | null | null | code/mod.py | aragilar/python-testing | 312496a9016975d99230744e262799999740720b | [
"CC-BY-4.0"
] | null | null | null | import os.path
import numpy as np
def sinc2d(x, y):
if x == 0.0 and y == 0.0:
return 1.0
elif x == 0.0:
return np.sin(y) / y
elif y == 0.0:
return np.sin(x) / x
else:
return (np.sin(x) / x) * (np.sin(y) / y)
def a(x):
return x + 1
def b(x):
return 2 * x
def c(x):
return b(a(x))
def std(vals):
# surely this is cheating...
return 1.0
def fib(n):
if n == 0 or n == 1:
return n
else:
return fib(n - 1) + fib(n - 2)
def f(workdir=None):
if workdir is None:
workdir = os.getcwd()
else:
workdir = str(workdir)
if not os.path.exists(os.path.join(workdir, "no.txt")):
with open(os.path.join(workdir, "yes.txt"), "w") as f:
f.write("42")
| 18.116279 | 62 | 0.499358 | 138 | 779 | 2.818841 | 0.34058 | 0.061697 | 0.061697 | 0.046272 | 0.105398 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040698 | 0.337612 | 779 | 42 | 63 | 18.547619 | 0.713178 | 0.033376 | 0 | 0.15625 | 0 | 0 | 0.021333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.21875 | false | 0 | 0.0625 | 0.125 | 0.59375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
9cbdcc9bd41342ec729fa4605f8c43d39b4c42ad | 461 | py | Python | python/chrysophylax/buy_and_hold.py | dichodaemon/chrysophylax | 834214e7d021643084be910d2b99bd7d18497faa | [
"MIT"
] | null | null | null | python/chrysophylax/buy_and_hold.py | dichodaemon/chrysophylax | 834214e7d021643084be910d2b99bd7d18497faa | [
"MIT"
] | null | null | null | python/chrysophylax/buy_and_hold.py | dichodaemon/chrysophylax | 834214e7d021643084be910d2b99bd7d18497faa | [
"MIT"
] | null | null | null | import garm.indicators as gari
import ham.time_utils as hamt
import ohlcv
import luigi
import strategies as chs
from luigi.util import inherits
@inherits(chs.Strategy)
class BuyAndHold(chs.Strategy):
FN = gari.buy_and_hold_signals
def requires(self):
for m in hamt.months(self.start_date, self.end_date):
yield ohlcv.OHLCV(
self.pair, self.exchange, m, self.period,
self.destination_path)
| 24.263158 | 61 | 0.683297 | 64 | 461 | 4.8125 | 0.625 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.24295 | 461 | 18 | 62 | 25.611111 | 0.882521 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.428571 | 0 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
9ccf4e8bda92837d4e656009c423fc5151a4c436 | 1,024 | py | Python | database/repositories/ModelBlobRepository.py | roblkenn/EECS441-Backend | 96fa0ca6775c13426dacdcbe1da02a8fa6e887ed | [
"RSA-MD"
] | null | null | null | database/repositories/ModelBlobRepository.py | roblkenn/EECS441-Backend | 96fa0ca6775c13426dacdcbe1da02a8fa6e887ed | [
"RSA-MD"
] | null | null | null | database/repositories/ModelBlobRepository.py | roblkenn/EECS441-Backend | 96fa0ca6775c13426dacdcbe1da02a8fa6e887ed | [
"RSA-MD"
] | null | null | null | from azure.storage.blob.baseblobservice import BaseBlobService
from azure.storage.blob.blockblobservice import BlockBlobService
from database.models.Blob import Blob
class ModelBlobRepository:
def __init__(self):
self.blockBlobService = BlockBlobService(account_name='stylesblobstorage', account_key='B4qA7PlPtEk+y/zDsn16+0KXjlLJpcmnZb9C/CLDTbU9PzI294Ithc6j3y+jBz6j4KKAe3LcqadtkKe24JhxIw==')
self.blobService = BaseBlobService(account_name='stylesblobstorage', account_key='B4qA7PlPtEk+y/zDsn16+0KXjlLJpcmnZb9C/CLDTbU9PzI294Ithc6j3y+jBz6j4KKAe3LcqadtkKe24JhxIw==')
self.containerName = 'models'
def create(self, modelBytes, userId):
self.blockBlobService.create_blob_from_text(self.containerName, userId, modelBytes)
return userId
def read(self, blobName):
blob = self.blobService.get_blob_to_text(self.containerName, blobName)
return Blob(blob)
def delete(self, blobName):
return self.blobService.delete_blob(self.containerName, blobName)
| 48.761905 | 186 | 0.783203 | 102 | 1,024 | 7.715686 | 0.352941 | 0.086404 | 0.040661 | 0.050826 | 0.312579 | 0.312579 | 0.312579 | 0.312579 | 0.312579 | 0.312579 | 0 | 0.038245 | 0.131836 | 1,024 | 20 | 187 | 51.2 | 0.847019 | 0 | 0 | 0 | 0 | 0 | 0.210938 | 0.171875 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.1875 | 0.0625 | 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 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
9cdaf7e31350059d27162184ea87fbd63d36f82d | 409 | py | Python | dust/exe.py | tanico-rikudo/raspi4 | ead6064ee5eaf0fb3459487047903aeb031189b7 | [
"MIT"
] | null | null | null | dust/exe.py | tanico-rikudo/raspi4 | ead6064ee5eaf0fb3459487047903aeb031189b7 | [
"MIT"
] | null | null | null | dust/exe.py | tanico-rikudo/raspi4 | ead6064ee5eaf0fb3459487047903aeb031189b7 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
from datetime import datetime as dt
import logging
import json
import sys
from particle_counter import ParticleCounter
# Make instance
device001 = ParticleCounter(30)
# Set signal pin
device001.set_pin_number(PIN=14)
# Excute
device001.particle_count(count_times=1000000)
# Finish
GPIO.cleanup()
print('==== Done ====') | 16.36 | 45 | 0.753056 | 57 | 409 | 5.315789 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05949 | 0.136919 | 409 | 25 | 46 | 16.36 | 0.798867 | 0.207824 | 0 | 0 | 0 | 0 | 0.043887 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.583333 | 0 | 0.583333 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
9cea6c5884c806c3032a4309da7131c515de5453 | 2,467 | py | Python | registryServer/apps/account/api.py | HumanDynamics/openPDS-RegistryServer | fe88f513a93c116f6bd4e2d81b29376a45f16249 | [
"MIT"
] | 7 | 2015-01-05T17:25:15.000Z | 2019-06-07T05:19:53.000Z | registryServer/apps/account/api.py | HumanDynamics/openPDS-RegistryServer | fe88f513a93c116f6bd4e2d81b29376a45f16249 | [
"MIT"
] | 1 | 2015-11-10T17:16:01.000Z | 2015-11-18T16:09:43.000Z | registryServer/apps/account/api.py | HumanDynamics/openPDS-RegistryServer | fe88f513a93c116f6bd4e2d81b29376a45f16249 | [
"MIT"
] | 13 | 2015-01-05T17:25:20.000Z | 2021-12-16T12:43:52.000Z | from django.contrib.auth.models import User
from apps.account.models import Profile, Group
from tastypie import fields
from tastypie.authorization import DjangoAuthorization, Authorization
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from tastypie.exceptions import BadRequest
from django.db import IntegrityError
from oauth2app.models import Client, AccessRange
import pdb
class UserResource(ModelResource):
class Meta:
queryset = User.objects.all()
authorization = Authorization()
excludes = ['last_login', 'password', 'date_joined']
def obj_create(self, bundle, request=None, **kwargs):
username, password = bundle.data['username'], bundle.data['password']
try:
bundle.obj = User.objects.create_user(username, '', password)
except IntegrityError:
raise BadRequest('That username already exists.')
return bundle
class GroupResource(ModelResource):
class Meta:
queryset = Group.objects.all()
authorization = Authorization()
# excludes = ['is_staff', 'is_superuser', 'last_login', 'password', 'date_joined']
class ClientResource(ModelResource):
class Meta:
queryset = Client.objects.all()
authorization = Authorization()
# excludes = ['is_staff', 'is_superuser', 'last_login', 'password', 'date_joined']
class ScopeResource(ModelResource):
class Meta:
queryset = AccessRange.objects.all()
authorization = Authorization()
# excludes = ['is_staff', 'is_superuser', 'last_login', 'password', 'date_joined']
class ProfileResource(ModelResource):
user = fields.ForeignKey(UserResource, 'user', full=True)
# group = fields.ForeignKey(GroupResource, 'group', full=True, null=True, blank=True)
# client = fields.ForeignKey(ClientResource, 'client', full=True, null=True, blank=True)
class Meta:
queryset = Profile.objects.all()
authorization = Authorization()
# excludes = ['is_staff', 'is_superuser', 'last_login', 'password', 'date_joined']
def obj_create(self, bundle, request=None, **kwargs):
try:
password = bundle.data["user"].pop("password")
bundle = super(ProfileResource, self).obj_create(bundle, request, **kwargs)
bundle.obj.user.set_password(password)
bundle.obj.user.save()
except IntegrityError:
raise BadRequest('Username already exists')
return bundle
| 39.15873 | 91 | 0.691934 | 259 | 2,467 | 6.494208 | 0.277992 | 0.026754 | 0.050535 | 0.107015 | 0.378121 | 0.312723 | 0.282996 | 0.282996 | 0.282996 | 0.282996 | 0 | 0.000503 | 0.194163 | 2,467 | 62 | 92 | 39.790323 | 0.845573 | 0.202675 | 0 | 0.382979 | 0 | 0 | 0.057682 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.042553 | false | 0.106383 | 0.191489 | 0 | 0.510638 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
9cf45647d9d8c0126932e004da932d00ac6a9682 | 189 | py | Python | payments/urls.py | caocmai/maker | bec025c3301a21e75638aca28576c724b44e259f | [
"MIT"
] | null | null | null | payments/urls.py | caocmai/maker | bec025c3301a21e75638aca28576c724b44e259f | [
"MIT"
] | 8 | 2020-06-06T01:12:07.000Z | 2021-06-10T19:38:47.000Z | payments/urls.py | caocmai/Maker | bec025c3301a21e75638aca28576c724b44e259f | [
"MIT"
] | 1 | 2020-03-05T08:11:39.000Z | 2020-03-05T08:11:39.000Z | from django.urls import path
from . import views
urlpatterns = [
path('charge/', views.charge, name='charge'),
path('payment/', views.HomePageView.as_view(), name='payment'),
]
| 17.181818 | 67 | 0.671958 | 23 | 189 | 5.478261 | 0.565217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15873 | 189 | 10 | 68 | 18.9 | 0.792453 | 0 | 0 | 0 | 0 | 0 | 0.148148 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
9cfa728536bee61e0fd7a0cb5ca6747960450394 | 869 | py | Python | dataanalysis/mopitt_data_analysis.py | s-ai-kia/nasa_stf | cc60cf7f74c77a78dc8fa1140d787614fc4cca7b | [
"MIT"
] | 1 | 2020-10-05T04:11:45.000Z | 2020-10-05T04:11:45.000Z | dataanalysis/mopitt_data_analysis.py | s-ai-kia/nasa_stf | cc60cf7f74c77a78dc8fa1140d787614fc4cca7b | [
"MIT"
] | null | null | null | dataanalysis/mopitt_data_analysis.py | s-ai-kia/nasa_stf | cc60cf7f74c77a78dc8fa1140d787614fc4cca7b | [
"MIT"
] | 3 | 2020-12-13T19:36:09.000Z | 2021-11-25T19:01:51.000Z | # -*- coding: utf-8 -*-
"""mopitt_data_analysis.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1bb_9kuO0Suo5761xgJioS84TrEdR5ojj
"""
import pandas as pd
df = pd.read_csv('MOP02J-20200101-L2V18.0.3.csv')
df.head()
df
tx = df[0:5000]
tx
import plotly.express as px
fig4 = px.density_mapbox(tx, lat='# Latitude', lon=' Longitude', z=' COTotalColumn', radius=10,
center=dict(lat=0, lon=180), zoom=0,
mapbox_style="stamen-terrain")
fig4.show()
import chart_studio
import chart_studio.plotly as py
import chart_studio.tools as tls
pip install chart_studio
username = 'saikia'
api_key = 'oIIOTBZOlv8hbx8XorKH'
chart_studio.tools.set_credentials_file(username=username, api_key=api_key)
py.plot(fig4, filename = 'csa-mopitt', auto_open=True)
| 21.195122 | 95 | 0.715765 | 123 | 869 | 4.918699 | 0.658537 | 0.090909 | 0.084298 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.059147 | 0.163406 | 869 | 40 | 96 | 21.725 | 0.77304 | 0.024166 | 0 | 0 | 1 | 0 | 0.170437 | 0.043741 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.263158 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1416c17873c1a9581d387ea49ff4f96596f2b2dc | 955 | py | Python | test/test_1.py | rgooler/AOC2019 | f761881240a5fe8711f730887f0f5033ea287e3d | [
"Apache-2.0"
] | null | null | null | test/test_1.py | rgooler/AOC2019 | f761881240a5fe8711f730887f0f5033ea287e3d | [
"Apache-2.0"
] | null | null | null | test/test_1.py | rgooler/AOC2019 | f761881240a5fe8711f730887f0f5033ea287e3d | [
"Apache-2.0"
] | null | null | null | from aoc2019 import *
import unittest
class Day1(unittest.TestCase):
def test_mass_12(self):
chall = Rocket()
self.assertEqual(chall.calc_fuel_weight(12), 2)
def test_mass_14(self):
chall = Rocket()
self.assertEqual(chall.calc_fuel_weight(14), 2)
def test_mass_1969(self):
chall = Rocket()
self.assertEqual(chall.calc_fuel_weight(1969), 654)
def test_mass_100756(self):
chall = Rocket()
self.assertEqual(chall.calc_fuel_weight(100756), 33583)
def test_mass2_12(self):
chall = Rocket()
self.assertEqual(chall.calc_fuel_weight_recursive(12), 2)
def test_mass2_1969(self):
chall = Rocket()
self.assertEqual(chall.calc_fuel_weight_recursive(1969), 966)
def test_mass2_100756(self):
chall = Rocket()
self.assertEqual(chall.calc_fuel_weight_recursive(100756), 50346)
if __name__ == '__main__':
unittest.main() | 28.088235 | 73 | 0.668063 | 122 | 955 | 4.909836 | 0.254098 | 0.081803 | 0.175292 | 0.222037 | 0.657763 | 0.657763 | 0.657763 | 0.657763 | 0.657763 | 0.57596 | 0 | 0.106469 | 0.223037 | 955 | 34 | 74 | 28.088235 | 0.700809 | 0 | 0 | 0.269231 | 0 | 0 | 0.008368 | 0 | 0 | 0 | 0 | 0 | 0.269231 | 1 | 0.269231 | false | 0 | 0.076923 | 0 | 0.384615 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
141e206d570003abeaf4105dda08506c129a99b2 | 403 | py | Python | abc/abc107/abc107b.py | c-yan/atcoder | 940e49d576e6a2d734288fadaf368e486480a948 | [
"MIT"
] | 1 | 2019-08-21T00:49:34.000Z | 2019-08-21T00:49:34.000Z | abc/abc107/abc107b.py | c-yan/atcoder | 940e49d576e6a2d734288fadaf368e486480a948 | [
"MIT"
] | null | null | null | abc/abc107/abc107b.py | c-yan/atcoder | 940e49d576e6a2d734288fadaf368e486480a948 | [
"MIT"
] | null | null | null | from sys import stdout
H, W = map(int, input().split())
a = [input() for _ in range(H)]
h = [all(c == '.' for c in a[i]) for i in range(H)]
w = [True] * W
for i in range(H):
for j in range(W):
w[j] = w[j] and a[i][j] == '.'
for i in range(H):
if h[i]:
continue
for j in range(W):
if w[j]:
continue
stdout.write(a[i][j])
stdout.write('\n')
| 19.190476 | 51 | 0.48139 | 76 | 403 | 2.539474 | 0.315789 | 0.217617 | 0.165803 | 0.170984 | 0.310881 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.320099 | 403 | 20 | 52 | 20.15 | 0.70438 | 0 | 0 | 0.375 | 0 | 0 | 0.009926 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.0625 | 0 | 0.0625 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
142313749cfd9431bfe0ceeb096274e6b438b71c | 350 | py | Python | openpnm/topotools/__init__.py | lixuekai2001/OpenPNM | 9026f0fed427d37f4caf1a79e4a7684490d52cf6 | [
"MIT"
] | 2 | 2019-08-24T09:17:40.000Z | 2020-07-05T07:21:21.000Z | openpnm/topotools/__init__.py | xu-kai-xu/OpenPNM | 61d5fc4729a0a29291cf6c53c07c4246e7a13714 | [
"MIT"
] | 2 | 2020-06-26T19:58:23.000Z | 2021-12-14T07:16:41.000Z | openpnm/topotools/__init__.py | xu-kai-xu/OpenPNM | 61d5fc4729a0a29291cf6c53c07c4246e7a13714 | [
"MIT"
] | null | null | null | r"""
Collection of functions for manipulating network topology
=========================================================
This module contains a selection of functions that deal specifically with
network topology.
"""
from ._topotools import *
from ._perctools import *
from ._graphtools import *
from ._plottools import *
from . import generators
| 23.333333 | 73 | 0.66 | 36 | 350 | 6.305556 | 0.666667 | 0.176211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131429 | 350 | 14 | 74 | 25 | 0.746711 | 0.594286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.833333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
1437f6b2872552388cca334ea76cadd246a03878 | 6,406 | py | Python | drip/api/subscribers.py | willjohnson/drip-python | 13e2836b5acb7a822b0e1f9884e3249d37734cef | [
"MIT"
] | 5 | 2019-04-11T19:32:14.000Z | 2020-08-03T21:58:55.000Z | drip/api/subscribers.py | willjohnson/drip-python | 13e2836b5acb7a822b0e1f9884e3249d37734cef | [
"MIT"
] | 7 | 2019-03-19T03:54:49.000Z | 2021-12-09T21:53:28.000Z | drip/api/subscribers.py | willjohnson/drip-python | 13e2836b5acb7a822b0e1f9884e3249d37734cef | [
"MIT"
] | 1 | 2021-01-11T21:51:51.000Z | 2021-01-11T21:51:51.000Z | from typing import TYPE_CHECKING
from drip.utils import json_list, json_object, raise_response
if TYPE_CHECKING:
from requests import Session
class Subscribers:
session: 'Session'
@json_object('subscribers')
def create_or_update_subscriber(self, email, marshall=True, **options):
"""
create_or_update_subscriber(email,
new_email=None, user_id=None, time_zone='Etc/UTC', lifetime_value=None, ip_address=None,
tags=None, remove_tags=None, prospect=True, base_lead_score=30, eu_consent=None, eu_consent_message=None, marshall=True)
Update a subscriber or create it if it doesn't exist.
Arguments:
email {str} -- Person's email address
Call Options:
new_email {str} -- Update the subscriber's email address, taking precedence over 'email' while creating (default: {None})
user_id {str} -- A custom unique identifier (default: {None})
time_zone {str} -- Timezone (default: {'Etc/UTC'})
lifetime_value {int} -- LifeTime Value, in cents (default: {None})
ip_address {str} -- IP Address (default: {None})
custom_fields {Mapping[str, Any]} -- Dictionary of custom fields and their values (default: {None})
tags {Iterable[str]} -- List of tags to apply (default: {None})
remove_tags {Iterable[str]} -- List of tags to remove (default: {None})
prospect {bool} -- Person is a Prospect (default: {True})
base_lead_score {int} -- Starting leadscore (default: {0})
eu_consent {str} -- Status of consent for GDPR: granted, denied (default: {None})
eu_consent_message {str} -- Message that was consented to (default: {None})
Other Keyword Arguments:
marshall {bool} -- Unpack the Response object (default: {True})
Returns:
Response -- API Response, or the marshalled Subscriber object
"""
payload = {
'email': email,
}
payload.update(options)
return self.session.post('subscribers', json={'subscribers': [payload, ]})
@json_list('subscribers')
def subscribers(self, marshall=True, **params):
"""
subscribers(page=0, per_page=100, marshall=True)
List all subscribers. Supports pagination and filtering.
Call Parameters:
page {int} -- Page to get, or 0 for all pages (default: {0})
per_page {int} -- Number of objects to get on each page (default: {100})
tags {Iterable[str]} -- List of tags to filter by (default: {None})
subscribed_before {str} -- Include only people created before this date, Eg. "2016-01-01T00:00:00Z" (default: {None})
subscribed_after {str} -- Include only people after before this date, Eg. "2016-01-01T00:00:00Z" (default: {None})
Other Keyword Arguments:
marshall {bool} -- Unpack the Response object (default: {True})
Returns:
Response -- API Response, or the marshalled List of Subscriber objects
"""
return self.session.get('subscribers', params=params)
@json_object('subscribers')
def subscriber(self, email, marshall=True):
"""
subscriber(email, marshall=True)
Get a subscriber.
Arguments:
email {str} -- Person's email address
Other Keyword Arguments:
marshall {bool} -- Unpack the Response object (default: {True})
Returns:
Response -- API Response, or the marshalled Subscriber object
"""
return self.session.get(f'subscribers/{email}')
@json_object('subscribers')
def unsubscribe(self, email, marshall=True, **params):
"""
unsubscribe(email, campaign_id=None, marshall=True)
Unsubscribe a subscriber from all campaigns, or optionally one specific campaign.
Arguments:
email {str} -- Person's email address
Call Parameters:
campaign_id {int} -- Campaign from which to remove the subscriber (default: {None})
Other Keyword Arguments:
marshall {bool} -- Unpack the Response object (default: {True})
Returns:
Response -- API Response, or the marshalled Subscriber object
"""
return self.session.post(f'subscribers/{email}/remove', params=params)
@json_object('subscribers')
def unsubscribe_from_all(self, email, marshall=True):
"""
unsubscribe_from_all(email, campaign_id=None, marshall=True)
Unsubscribe a subscriber from all campaigns.
Arguments:
email {str} -- Person's email address
Other Keyword Arguments:
marshall {bool} -- Unpack the Response object (default: {True})
Returns:
Response -- API Response, or the marshalled Subscriber object
"""
return self.session.post(f'subscribers/{email}/unsubscribe_all')
@raise_response()
def delete_subscriber(self, email):
"""
delete_subscriber(email, campaign_id=None, marshall=True)
Delete a subscriber.
Arguments:
email {str} -- Person's email address
Returns:
Response -- API Response
"""
return self.session.delete(f'subscribers/{email}')
# @pagination('subscribers')
# def subscribers(self,
# status: str = None, # active, all, unsubscribed, active_or_unsubscribed, undeliverable. Default: active
# tags: 'Iterable[str]' = None,
# subscribed_before: str = None, # "2017-01-01T00:00:00Z"
# subscribed_after: str = None,
# page: int = 0,
# per_page: int = None,
# marshall=True) -> 'Response':
# payload: 'MutableMapping[str, Any]' = {}
# if status:
# payload['status'] = status
# if tags:
# payload['tags'] = tags
# if subscribed_before:
# payload['subscribed_before'] = subscribed_before
# if subscribed_after:
# payload['subscribed_after'] = subscribed_after
# if page:
# payload['page'] = page
# if per_page:
# payload['per_page'] = per_page
# return self.session.get('subscribers', params=payload)
| 38.130952 | 133 | 0.604589 | 705 | 6,406 | 5.395745 | 0.215603 | 0.037592 | 0.031283 | 0.041009 | 0.397739 | 0.369348 | 0.324395 | 0.303102 | 0.282072 | 0.266824 | 0 | 0.012067 | 0.28848 | 6,406 | 167 | 134 | 38.359281 | 0.82251 | 0.682329 | 0 | 0.142857 | 0 | 0 | 0.143786 | 0.044075 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.107143 | 0 | 0.607143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
143b9d9f954626237df01251d000fda5f839d52f | 680 | py | Python | utils/notification/notification_manager.py | sanjusci/google_sheet_reader | c2b11bdb1eb3e2799cdd22aa4ed67f9c86daea56 | [
"MIT"
] | null | null | null | utils/notification/notification_manager.py | sanjusci/google_sheet_reader | c2b11bdb1eb3e2799cdd22aa4ed67f9c86daea56 | [
"MIT"
] | 3 | 2021-02-08T20:27:15.000Z | 2021-06-01T23:18:51.000Z | utils/notification/notification_manager.py | sanjusci/google_sheet_reader | c2b11bdb1eb3e2799cdd22aa4ed67f9c86daea56 | [
"MIT"
] | null | null | null | # Create your service here.
__author__ = "Sanju Sci"
__email__ = "sanju.sci9@gmail.com"
__copyright__ = "Copyright 2019."
from utils.commons import safe_invoke
class NotificationManager(object):
def __init__(self, *args, **kwargs):
pass
def notify(self, *args, **kwargs):
pass
@staticmethod
def notify_sync(notif_mgr, *args, **kwargs):
safe_invoke(notif_mgr.notify, *args)
@classmethod
def EMAIL(cls, *args, **kwargs):
from utils.notification.email.email_manager import EmailManager
return EmailManager(*args, **kwargs)
class Parameters(object):
pass
__all__ = ["NotificationManager", "Parameters"]
| 20.606061 | 71 | 0.680882 | 75 | 680 | 5.826667 | 0.546667 | 0.114416 | 0.064073 | 0.08238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009242 | 0.204412 | 680 | 32 | 72 | 21.25 | 0.798521 | 0.036765 | 0 | 0.157895 | 0 | 0 | 0.111792 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0.157895 | 0.105263 | 0 | 0.473684 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
145acd330fc58583c49d623ffb6e709da478a671 | 315 | py | Python | tests/test_set_up_logger.py | dennlinger/hypergraph-document-store | 72b90119b163b92254c73442bee52cde55e58517 | [
"MIT"
] | null | null | null | tests/test_set_up_logger.py | dennlinger/hypergraph-document-store | 72b90119b163b92254c73442bee52cde55e58517 | [
"MIT"
] | 1 | 2019-12-12T09:20:00.000Z | 2019-12-12T09:20:00.000Z | tests/test_set_up_logger.py | dennlinger/hypergraph-document-store | 72b90119b163b92254c73442bee52cde55e58517 | [
"MIT"
] | 1 | 2021-07-22T14:16:47.000Z | 2021-07-22T14:16:47.000Z | from unittest import TestCase
import os
class TestSet_up_logger(TestCase):
def test_set_up_logger(self):
from utils import set_up_logger
from logging import Logger
logger = set_up_logger("test", "test.log")
self.assertIsInstance(logger, Logger)
os.remove("test.log")
| 22.5 | 50 | 0.688889 | 42 | 315 | 4.952381 | 0.428571 | 0.153846 | 0.158654 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.231746 | 315 | 13 | 51 | 24.230769 | 0.859504 | 0 | 0 | 0 | 0 | 0 | 0.063492 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.111111 | false | 0 | 0.444444 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
145ef1cdc80727bde5f62588059dc90f98d8c984 | 535 | py | Python | src/generic.py | jfecroft/Hamilton | 35ade5fc07a330e6a05e1ea391a16b8874737eb5 | [
"MIT"
] | null | null | null | src/generic.py | jfecroft/Hamilton | 35ade5fc07a330e6a05e1ea391a16b8874737eb5 | [
"MIT"
] | null | null | null | src/generic.py | jfecroft/Hamilton | 35ade5fc07a330e6a05e1ea391a16b8874737eb5 | [
"MIT"
] | null | null | null | """
generic functions
"""
from yaml import load
def reduce_output(func, item, *args, **kwargs):
"""
simple function to reduce output from existing functions
if func returns an iterable - just return item
"""
def inner_func(*args, **kwargs):
return func(*args, **kwargs)[item]
return inner_func
def load_yaml(filen):
"""
load a yaml file and return the json object
"""
with open('{}.yml'.format(filen), 'r') as open_file:
return_dict = load(open_file)
return return_dict
| 21.4 | 60 | 0.642991 | 72 | 535 | 4.666667 | 0.527778 | 0.089286 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.239252 | 535 | 24 | 61 | 22.291667 | 0.825553 | 0.31028 | 0 | 0 | 0 | 0 | 0.021538 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0.111111 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
146252a9963181e60bb9b862f53e83071c1987b1 | 2,925 | py | Python | venv/lib/python3.7/site-packages/MDAnalysis/selections/__init__.py | dtklinh/GBRDE | c87fada492f24943d7d6b6ecda61c67f41d5bf83 | [
"MIT"
] | 2 | 2021-03-04T16:57:06.000Z | 2021-08-11T01:42:29.000Z | venv/lib/python3.7/site-packages/MDAnalysis/selections/__init__.py | dtklinh/GBRDE | c87fada492f24943d7d6b6ecda61c67f41d5bf83 | [
"MIT"
] | null | null | null | venv/lib/python3.7/site-packages/MDAnalysis/selections/__init__.py | dtklinh/GBRDE | c87fada492f24943d7d6b6ecda61c67f41d5bf83 | [
"MIT"
] | null | null | null | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under the GNU Public Licence, v2 or any higher version
#
# Please cite your use of MDAnalysis in published work:
#
# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler,
# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein.
# MDAnalysis: A Python package for the rapid analysis of molecular dynamics
# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th
# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy.
# doi: 10.25080/majora-629e541a-00e
#
# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein.
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#
"""
Selection exporters
===================
Functions to write a :class:`MDAnalysis.core.groups.AtomGroup` selection
to a file so that it can be used in another programme.
:mod:`MDAnalysis.selections.vmd`
VMD_ selections
:mod:`MDAnalysis.selections.pymol`
PyMol_ selections
:mod:`MDAnalysis.selections.gromacs`
Gromacs_ selections
:mod:`MDAnalysis.selections.charmm`
CHARMM_ selections
The :class:`MDAnalysis.selections.base.SelectionWriterBase` base class and
helper functions are in :mod:`MDAnalysis.selections.base`, with the
exception of `:func:get_writer`:
.. autofunction:: get_writer
"""
from __future__ import absolute_import
from six import raise_from
import os.path
from .. import _SELECTION_WRITERS
from . import vmd
from . import pymol
from . import gromacs
from . import charmm
from . import jmol
def get_writer(filename, defaultformat):
"""Return a SelectionWriter for `filename` or a `defaultformat`.
Parameters
----------
filename : str
name of the output file; the extension is used to guess the file format
defaultformat : str
if `filename` does not have an extension, use `defaultformat` instead
Returns
-------
SelectionWriter : `type`
the writer *class* for the detected format
Raises
------
:exc:`NotImplementedError`
for any format that is not defined
"""
if filename:
format = os.path.splitext(filename)[1][1:] # strip initial dot!
format = format or defaultformat # use default if no fmt from fn
format = format.strip().upper() # canonical for lookup
try:
return _SELECTION_WRITERS[format]
except KeyError:
raise_from(NotImplementedError(
"Writing as {0!r} is not implemented;"
" only {1!r} will work.".format(format, _SELECTION_WRITERS.keys())),
None)
| 31.451613 | 80 | 0.696752 | 396 | 2,925 | 5.09596 | 0.530303 | 0.034688 | 0.056987 | 0.049058 | 0.061447 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029636 | 0.192479 | 2,925 | 92 | 81 | 31.793478 | 0.824725 | 0.726838 | 0 | 0 | 0 | 0 | 0.082739 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0 | 0.428571 | 0 | 0.52381 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
1472d75a6abf289e47bd71dbaf7c5950d9fe47ac | 1,332 | py | Python | john_zelle_python3/gpa.py | alirkaya/programming-textbook-solutions | 7362dce474b8a881d654f95604e09d1d0e76aec2 | [
"MIT"
] | null | null | null | john_zelle_python3/gpa.py | alirkaya/programming-textbook-solutions | 7362dce474b8a881d654f95604e09d1d0e76aec2 | [
"MIT"
] | null | null | null | john_zelle_python3/gpa.py | alirkaya/programming-textbook-solutions | 7362dce474b8a881d654f95604e09d1d0e76aec2 | [
"MIT"
] | null | null | null | class Student:
def __init__(self, name, hours, qpoints):
self.name = name
self.hours = float(hours)
self.qpoints = float(qpoints)
def get_name(self):
return self.name
def get_hours(self):
return self.hours
def get_qpoints(self):
return self.qpoints
def gpa(self):
return self.qpoints / self.hours
def make_student(info_str):
# info_str is a tab-separated line: name hours qpoints
# returns a corresponding Student object
name, hours, qpoints = info_str.split('\t')
return Student(name, hours, qpoints)
def main():
# open the input file for reading
filename = input('Enter the name of the grade file: ')
infile = open(filename, 'r')
# set best to the record for the first student in the file
best = make_student(infile.readline())
# process subsequent lines of the file
for line in infile:
# turn the line into a student record
s = make_student(line)
# if this student is best so far, remember it.
if s.gpa() > best.gpa():
best = s
infile.close()
# print information about the best student
print('The best student is', best.get_name())
print('hours:', best.get_hours())
print('GPA:', best.gpa())
if __name__ == '__main__': main() | 25.615385 | 63 | 0.627628 | 184 | 1,332 | 4.418478 | 0.331522 | 0.04428 | 0.078721 | 0.051661 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.272523 | 1,332 | 52 | 64 | 25.615385 | 0.839009 | 0.258258 | 0 | 0 | 0 | 0 | 0.07551 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.241379 | false | 0 | 0 | 0.137931 | 0.448276 | 0.103448 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
147da05a9f652a5715c04bef141e04cc07ea681a | 790 | py | Python | aws_sso/utils/registry.py | rkhullar/many-sso | 14e019187e411bdeee77152310b09d250ec90555 | [
"MIT"
] | 2 | 2019-12-15T18:57:58.000Z | 2020-06-15T22:02:29.000Z | aws_sso/utils/registry.py | rkhullar/many-sso | 14e019187e411bdeee77152310b09d250ec90555 | [
"MIT"
] | 1 | 2020-02-06T19:02:36.000Z | 2020-02-06T19:02:36.000Z | aws_sso/utils/registry.py | rkhullar/many-sso | 14e019187e411bdeee77152310b09d250ec90555 | [
"MIT"
] | null | null | null | from typing import Callable, Dict, Type
def register_action(action: str, mapping_name: str = '__actions__'):
# https://stackoverflow.com/questions/3589311/get-defining-class-of-unbound-method-object-in-python-3/25959545#25959545
class RegistryHandler:
def __init__(self, fn: Callable):
self.fn = fn
def __set_name__(self, owner: Type, name: str):
if not hasattr(owner, mapping_name):
setattr(owner, mapping_name, dict())
mapping: Dict[str: Callable] = getattr(owner, mapping_name)
mapping[action] = self.fn
setattr(owner, name, self.fn)
return RegistryHandler
def register_service(cls):
"""discover methods within a class with prefix "handle_" and populate the actions"""
| 30.384615 | 123 | 0.663291 | 96 | 790 | 5.25 | 0.552083 | 0.087302 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039539 | 0.231646 | 790 | 25 | 124 | 31.6 | 0.790774 | 0.248101 | 0 | 0 | 0 | 0 | 0.018739 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0.076923 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
14848a43d3f090cdc183de7af48de1c3e490059a | 311 | py | Python | fuzzi-gen/fuzzi/evaluation/pate.py | hengchu/fuzzi-impl | bcf49c42d2dd4e1e3c1fe8b85fa7f845ea8fd016 | [
"BSD-3-Clause"
] | 4 | 2019-04-02T15:54:21.000Z | 2022-02-14T20:34:00.000Z | fuzzi-gen/fuzzi/evaluation/pate.py | hengchu/fuzzi-impl | bcf49c42d2dd4e1e3c1fe8b85fa7f845ea8fd016 | [
"BSD-3-Clause"
] | 1 | 2019-08-19T13:53:50.000Z | 2019-08-19T13:53:50.000Z | fuzzi-gen/fuzzi/evaluation/pate.py | hengchu/fuzzi-impl | bcf49c42d2dd4e1e3c1fe8b85fa7f845ea8fd016 | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
def main():
from fuzzi.evaluation import pate_train
from fuzzi.generated import pate_label
predictions = pate_label.outputs
truth = [x[-1] for x in pate_label.db_test]
print(predictions)
print(truth)
print('PATE accuracy = %f' % (np.mean(predictions == truth)))
| 25.916667 | 65 | 0.691318 | 44 | 311 | 4.772727 | 0.590909 | 0.128571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004049 | 0.205788 | 311 | 11 | 66 | 28.272727 | 0.846154 | 0 | 0 | 0 | 1 | 0 | 0.057878 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.444444 | 0.333333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
148fa74d7a5813457d336a4cb138f1b0a1e99c02 | 1,321 | py | Python | urchin/fs/mp3file.py | kellen/urchinfs | ea47d8997b42b9b472ea16d1bc7921b988840e4b | [
"Unlicense"
] | 2 | 2021-11-08T03:11:32.000Z | 2021-11-08T08:21:24.000Z | urchin/fs/mp3file.py | kellen/urchinfs | ea47d8997b42b9b472ea16d1bc7921b988840e4b | [
"Unlicense"
] | null | null | null | urchin/fs/mp3file.py | kellen/urchinfs | ea47d8997b42b9b472ea16d1bc7921b988840e4b | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import logging
from fnmatch import fnmatch
import mutagen
from mutagen.easyid3 import EasyID3
import urchin.fs.default
import urchin.fs.json
import urchin.fs.plugin
import urchin.fs.mp3
MP3_GLOB = "*.mp3"
class Plugin(urchin.fs.plugin.Plugin):
name = "mp3file"
def __init__(self):
super(Plugin, self).__init__(
indexer=Mp3FileIndexer,
matcher=urchin.fs.default.DefaultMetadataMatcher,
extractor=urchin.fs.mp3.Mp3MetadataExtractor,
merger=urchin.fs.default.DefaultMerger,
munger=urchin.fs.default.DefaultMunger,
formatter=Mp3FileFormatter,
)
class Mp3FileIndexer(urchin.fs.abstract.AbstractFileIndexer):
name = "mp3file"
def __init__(self, config):
super(Mp3FileIndexer, self).__init__(config, MP3_GLOB)
class Mp3FileFormatter(urchin.fs.plugin.Formatter):
name = "mp3file"
def __init__(self, config):
pass
def format(self, original_name, metadata):
# reduce single values from sets
d = {k: list(v)[0] if type(v) == set and len(v) == 1 else v for k,v in metadata.items()}
return set(["%(tracknumber)s - %(artist)s - %(title)s" % d])
| 30.022727 | 96 | 0.659349 | 158 | 1,321 | 5.335443 | 0.462025 | 0.104389 | 0.066429 | 0.064057 | 0.092527 | 0.066429 | 0 | 0 | 0 | 0 | 0 | 0.018664 | 0.229372 | 1,321 | 43 | 97 | 30.72093 | 0.80943 | 0.055261 | 0 | 0.151515 | 0 | 0 | 0.053012 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.121212 | false | 0.030303 | 0.30303 | 0 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
14ac2d2492de50193750cbad1ef4a4ffc1cccf0a | 618 | py | Python | app/core/serializers.py | jblanquicett92/django_celery_app | 5b0069905ec721cc1632611f08c733a5b93d20d8 | [
"MIT"
] | null | null | null | app/core/serializers.py | jblanquicett92/django_celery_app | 5b0069905ec721cc1632611f08c733a5b93d20d8 | [
"MIT"
] | null | null | null | app/core/serializers.py | jblanquicett92/django_celery_app | 5b0069905ec721cc1632611f08c733a5b93d20d8 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from .models import Event, Notification
class EventSerializer(serializers.ModelSerializer):
class Meta:
model = Event
exclude = ('id', 'moved_to', 'received_timestamp',)
class EventExcludeIDSerializer(serializers.ModelSerializer):
class Meta:
model = Event
fields = ('file_name', 'file_path', 'moved_to', 'received_timestamp')
class NotificationSerializer(serializers.ModelSerializer):
event_data=EventExcludeIDSerializer()
class Meta:
model = Notification
exclude = ('id',)
| 25.75 | 77 | 0.669903 | 54 | 618 | 7.518519 | 0.481481 | 0.192118 | 0.103448 | 0.172414 | 0.364532 | 0.221675 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2411 | 618 | 23 | 78 | 26.869565 | 0.865672 | 0 | 0 | 0.333333 | 0 | 0 | 0.119741 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.133333 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
1ae21a526218223ed04c6372b03062ed8240aa78 | 1,671 | py | Python | Controller/controleTelas.py | IuriBritoDev/TKINO | 3c689788324bd5badc84c7969f331b076046c211 | [
"MIT"
] | null | null | null | Controller/controleTelas.py | IuriBritoDev/TKINO | 3c689788324bd5badc84c7969f331b076046c211 | [
"MIT"
] | null | null | null | Controller/controleTelas.py | IuriBritoDev/TKINO | 3c689788324bd5badc84c7969f331b076046c211 | [
"MIT"
] | null | null | null | from View import telaRelatorio, telaNovoProjeto, telaAbrirProjeto, telaCadastro, telaConfigura, telaConexao, telaEditarControle, telaPopUp
from View.Painel import painelSensores, painelControladores, painelConexao
from View.Conexao import telaConAnalogAnalog, telaConAnalogDigit, telaConDigitAnalog, telaConDigitDigit
# Abre as telas da aba de seleção
def AbreTelaNovoProjeto(tela):
telaNovoProjeto.TelaNovoProjeto(tela)
def AbreTelaAbrirProjeto(tela):
telaAbrirProjeto.TelaAbrirProjeto(tela)
def AbreTelaRelatorio(tela):
telaRelatorio.TelaRelatorio(tela)
def AbreTelaCadastro(tela):
telaCadastro.TelaCadastro(tela)
def AbreTelaConfigura(tela):
telaConfigura.TelaConfigura(tela)
def AbreTelaConexao(tela):
telaConexao.TelaConexao(tela)
# Abre telas de conexões de atuadores
def AbreTelaConAnAn(tela):
telaConAnalogAnalog.TelaConAnalogAnalog(tela)
def AbreTelaConAnDig(tela):
telaConAnalogDigit.TelaConAnalogDig(tela)
def AbreTelaConDigAn(tela):
telaConDigitAnalog.TelaConDigAnalog(tela)
def AbreTelaConDigDig(tela):
telaConDigitDigit.TelaConDigDig(tela)
# Abre os frames das abas
def AbreFrameSensores(frame):
painelSensores.PainelSensores(frame)
def AbreFrameControladores(frame, tela):
painelControladores.PainelControladores(frame, tela)
def AbreFrameConexao(frame, tela):
painelConexao.PainelConexao(frame, tela)
# Abre telas de edição da conexão e controladores
def AbreEditorControlador(tela, controle):
telaEditarControle.TelaEditarControle(tela, controle)
# Abre telas de PopUP
def AbrePopUp(tela, mensagem):
telaPopUp.TelaPopUp(tela, mensagem) | 24.217391 | 138 | 0.79234 | 154 | 1,671 | 8.597403 | 0.396104 | 0.047583 | 0.024924 | 0.022659 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137642 | 1,671 | 69 | 139 | 24.217391 | 0.918806 | 0.095751 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.454545 | false | 0 | 0.090909 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
1aef5c7a0e77fccf10468e703c0a3cb229409069 | 2,336 | py | Python | tests/__init__.py | contentstack/contentstack-utils-python | 3c7bb445dc77e5a2ab18ceac6f87a35d37b52186 | [
"MIT"
] | null | null | null | tests/__init__.py | contentstack/contentstack-utils-python | 3c7bb445dc77e5a2ab18ceac6f87a35d37b52186 | [
"MIT"
] | null | null | null | tests/__init__.py | contentstack/contentstack-utils-python | 3c7bb445dc77e5a2ab18ceac6f87a35d37b52186 | [
"MIT"
] | null | null | null | # pytest --html=tests/report/test-report.html
# above command runs tests and test reports generates in tests/report location.
# nosetests --with-coverage --cover-html
# clean all the .pyc files
# find . -name \*.pyc -delete
# nosetests --with-coverage --cover-html
# pytest --cov=contentstack_utils
# pytest -v --cov=contentstack_utils --cov-report=html
# pytest --html=tests/report/test-report.html
from unittest import TestLoader, TestSuite
from .convert_style import TestConvertStyle
from .test_default_opt_others import TestDefaultOptOther
from .test_helper_node_to_html import TestHelperNodeToHtml
from .test_item_types import TestItemType
from .test_metadata import TestMetadata
from .test_option_render_mark import TestOptionRenderMark
from .test_render_default_options import TestRenderDefaultOption
from .test_render_options import TestRenderOption
from .test_style_type import TestStyleType
from .test_util_srte import TestSuperchargedUtils
from .test_utils import TestUtility
def all_tests():
test_module_itemtype = TestLoader().loadTestsFromTestCase(TestItemType)
test_module_metadata = TestLoader().loadTestsFromTestCase(TestMetadata)
test_module_style_type = TestLoader().loadTestsFromTestCase(TestStyleType)
test_module_utility = TestLoader().loadTestsFromTestCase(TestUtility)
test_module_default_option = TestLoader().loadTestsFromTestCase(TestDefaultOptOther)
test_module_node_to_html = TestLoader().loadTestsFromTestCase(TestHelperNodeToHtml)
test_module_render_mark = TestLoader().loadTestsFromTestCase(TestOptionRenderMark)
test_module_render_default_option = TestLoader().loadTestsFromTestCase(TestRenderDefaultOption)
test_module_render_option = TestLoader().loadTestsFromTestCase(TestRenderOption)
test_module_utils_srte = TestLoader().loadTestsFromTestCase(TestSuperchargedUtils)
test_module_convert_style = TestLoader().loadTestsFromTestCase(TestConvertStyle)
suite = TestSuite([
test_module_itemtype,
test_module_metadata,
test_module_style_type,
test_module_utility,
test_module_default_option,
test_module_node_to_html,
test_module_render_mark,
test_module_render_default_option,
test_module_render_option,
test_module_utils_srte,
test_module_convert_style
])
| 44.075472 | 99 | 0.81036 | 254 | 2,336 | 7.094488 | 0.271654 | 0.122087 | 0.053274 | 0.023307 | 0.126526 | 0.038846 | 0.038846 | 0 | 0 | 0 | 0 | 0 | 0.125 | 2,336 | 52 | 100 | 44.923077 | 0.881605 | 0.163527 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.027027 | false | 0 | 0.324324 | 0 | 0.351351 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
1afafdaa5a55f840c140378943d38c4159a3e9db | 610 | py | Python | Exercicios - Mundo3/Ex109/teste.py | BrianMath/ExerciciosPythonCeV | 4960f1a58d281b32afd5dfd6ea65e0ae5ad48b4f | [
"MIT"
] | null | null | null | Exercicios - Mundo3/Ex109/teste.py | BrianMath/ExerciciosPythonCeV | 4960f1a58d281b32afd5dfd6ea65e0ae5ad48b4f | [
"MIT"
] | null | null | null | Exercicios - Mundo3/Ex109/teste.py | BrianMath/ExerciciosPythonCeV | 4960f1a58d281b32afd5dfd6ea65e0ae5ad48b4f | [
"MIT"
] | null | null | null | import moeda
preco = float(input("Digite o preço: R$"))
por100 = float(input("Digite a porcentagem: "))
formatar = str(input("Deseja formatar como moeda [S/N]? ")).upper()
if "S" in formatar:
formatado = True
else:
formatado = False
print(f"\nA metade de {moeda.moeda(preco)} é {moeda.metade(preco, formatado)}")
print(f"O dobro de {moeda.moeda(preco)} é {moeda.dobro(preco, formatado)}")
print(f"Aumentando {por100}% de {moeda.moeda(preco)}, temos {moeda.aumentar(preco, por100, formatado)}")
print(f"Diminuindo {por100}% de {moeda.moeda(preco)}, temos {moeda.diminuir(preco, por100, formatado)}")
| 38.125 | 104 | 0.701639 | 88 | 610 | 4.863636 | 0.420455 | 0.116822 | 0.11215 | 0.158879 | 0.261682 | 0.261682 | 0.154206 | 0 | 0 | 0 | 0 | 0.027985 | 0.121311 | 610 | 15 | 105 | 40.666667 | 0.770522 | 0 | 0 | 0 | 0 | 0.25 | 0.65082 | 0.140984 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.083333 | 0 | 0.083333 | 0.333333 | 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 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
210e8623af2b83c3331b035c74ce32e4c79cb05e | 2,735 | py | Python | zeus/common/ipc/uni_comm.py | wnov/vega | bf51cbe389d41033c4ae4bc02e5078c3c247c845 | [
"MIT"
] | 6 | 2020-11-13T15:44:47.000Z | 2021-12-02T08:14:06.000Z | zeus/common/ipc/uni_comm.py | JacobLee121/vega | 19256aca4d047bfad3b461f0a927e1c2abb9eb03 | [
"MIT"
] | null | null | null | zeus/common/ipc/uni_comm.py | JacobLee121/vega | 19256aca4d047bfad3b461f0a927e1c2abb9eb03 | [
"MIT"
] | 2 | 2021-06-25T09:42:32.000Z | 2021-08-06T18:00:09.000Z | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""Uni comm."""
import threading
from absl import logging
from zeus.common.util.register import Registers
class UniComm(object):
"""Uni comm."""
def __init__(self, comm_name, **comm_info):
super(UniComm, self).__init__()
self.comm = Registers.comm[comm_name](comm_info)
self.lock = threading.Lock()
def send(self, data, name=None, block=True, **kwargs):
"""Create common send interface."""
return self.comm.send(data, name, block, **kwargs)
def recv(self, name=None, block=True):
"""Create common recieve interface."""
return self.comm.recv(name, block)
def send_bytes(self, data):
"""Create common send_bytes interface."""
return self.comm.send_bytes(data)
def recv_bytes(self):
"""Create common recv_bytes interface."""
return self.comm.recv_bytes()
def send_multipart(self, data):
"""Create common send_multipart interface."""
return self.comm.send_multipart(data)
def recv_multipart(self):
"""Create common recv_multipart interface."""
return self.comm.recv_multipart()
def delete(self, name):
"""Delete."""
return self.comm.delete(name)
@property
def info(self):
"""Fetch comm info."""
return str(self.comm)
def close(self):
"""Close."""
logging.debug("start close comm...")
with self.lock:
try:
self.comm.close()
except AttributeError as err:
logging.info("call comm.close failed! with: \n{}".format(err))
| 35.986842 | 79 | 0.677514 | 365 | 2,735 | 5.010959 | 0.40274 | 0.048114 | 0.053581 | 0.075451 | 0.130126 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001878 | 0.221207 | 2,735 | 75 | 80 | 36.466667 | 0.856808 | 0.496892 | 0 | 0 | 0 | 0 | 0.040707 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0 | 0.09375 | 0 | 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 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
21160771a6aab5b0c62e80306c257ce5f76ec26d | 300 | py | Python | FreeCodeCamp/Scientific Computing with Python/Python for Everybody/09.py | saulpaiva/Code | 3c6591da52ccf40565ed0a4e857e83e7f643b72d | [
"MIT"
] | 1 | 2021-09-29T01:26:29.000Z | 2021-09-29T01:26:29.000Z | FreeCodeCamp/Scientific Computing with Python/Python for Everybody/09.py | saulpaiva/Code | 3c6591da52ccf40565ed0a4e857e83e7f643b72d | [
"MIT"
] | null | null | null | FreeCodeCamp/Scientific Computing with Python/Python for Everybody/09.py | saulpaiva/Code | 3c6591da52ccf40565ed0a4e857e83e7f643b72d | [
"MIT"
] | null | null | null | # Iterations: Definite Loops
'''
Use the 'for' word
there is a iteration variable like 'i' or 'friend'
'''
# for i in [5, 4, 3, 2, 1] :
# print(i)
# print('Blastoff!')
# friends = ['matheus', 'wataru', 'mogli']
# for friend in friends :
# print('happy new year:', friend)
# print('Done!')
| 18.75 | 50 | 0.596667 | 43 | 300 | 4.162791 | 0.744186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021097 | 0.21 | 300 | 15 | 51 | 20 | 0.734177 | 0.91 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
211ad11f9ebdef48bf332ecf751958ae13ba3bd7 | 566 | py | Python | core/migrations/0004_auto_20210502_0503.py | Armestrong/resale_api | 75a798f2aa95b7d316e145f3811fa05537c606df | [
"MIT"
] | null | null | null | core/migrations/0004_auto_20210502_0503.py | Armestrong/resale_api | 75a798f2aa95b7d316e145f3811fa05537c606df | [
"MIT"
] | null | null | null | core/migrations/0004_auto_20210502_0503.py | Armestrong/resale_api | 75a798f2aa95b7d316e145f3811fa05537c606df | [
"MIT"
] | null | null | null | # Generated by Django 2.2 on 2021-05-02 08:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20210502_0459'),
]
operations = [
migrations.AlterField(
model_name='property',
name='features',
field=models.CharField(max_length=255, null=True),
),
migrations.AlterField(
model_name='property',
name='finality',
field=models.CharField(max_length=255, null=True),
),
]
| 23.583333 | 62 | 0.584806 | 58 | 566 | 5.586207 | 0.637931 | 0.123457 | 0.154321 | 0.179012 | 0.5 | 0.5 | 0.246914 | 0.246914 | 0 | 0 | 0 | 0.090909 | 0.300353 | 566 | 23 | 63 | 24.608696 | 0.727273 | 0.075972 | 0 | 0.470588 | 1 | 0 | 0.113244 | 0.044146 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
2130a3b1de35b98506260b7bd36a4036bd7b7be6 | 2,054 | py | Python | encrypted_fields_test/migrations/0003_demomigrationmodel_add_more_fields.py | bishtamit/django-searchable-encrypted-fields | dce4afe4aef826fda137dfae0f60c683d5b40a46 | [
"MIT"
] | 1 | 2021-08-21T08:55:03.000Z | 2021-08-21T08:55:03.000Z | encrypted_fields_test/migrations/0003_demomigrationmodel_add_more_fields.py | bishtamit/django-searchable-encrypted-fields | dce4afe4aef826fda137dfae0f60c683d5b40a46 | [
"MIT"
] | null | null | null | encrypted_fields_test/migrations/0003_demomigrationmodel_add_more_fields.py | bishtamit/django-searchable-encrypted-fields | dce4afe4aef826fda137dfae0f60c683d5b40a46 | [
"MIT"
] | null | null | null | # Generated by Django 2.1 on 2020-10-08 10:05
import datetime
from django.db import migrations
import encrypted_fields.fields
class Migration(migrations.Migration):
dependencies = [
('encrypted_fields_test', '0002_demomigrationmodel_add_test_record'),
]
operations = [
migrations.AddField(
model_name='demomigrationmodel',
name='_default_char',
field=encrypted_fields.fields.EncryptedCharField(default='foo default', max_length=20),
),
migrations.AddField(
model_name='demomigrationmodel',
name='_default_date',
field=encrypted_fields.fields.EncryptedDateField(default=datetime.date.today),
),
migrations.AddField(
model_name='demomigrationmodel',
name='_default_number',
field=encrypted_fields.fields.EncryptedPositiveSmallIntegerField(default=1),
),
migrations.AddField(
model_name='demomigrationmodel',
name='searchable_default_char',
field=encrypted_fields.fields.SearchField(blank=True, db_index=True, encrypted_field_name='_default_char', hash_key='123abc', max_length=66, null=True),
),
migrations.AddField(
model_name='demomigrationmodel',
name='searchable_default_date',
field=encrypted_fields.fields.SearchField(blank=True, db_index=True, encrypted_field_name='_default_date', hash_key='123abc', max_length=66, null=True),
),
migrations.AddField(
model_name='demomigrationmodel',
name='default_encrypted_char',
field=encrypted_fields.fields.EncryptedCharField(default='encrypted hi', max_length=20),
),
migrations.AddField(
model_name='demomigrationmodel',
name='searchable_default_number',
field=encrypted_fields.fields.SearchField(blank=True, db_index=True, encrypted_field_name='_default_number', hash_key='123abc', max_length=66, null=True),
),
]
| 40.27451 | 166 | 0.666504 | 203 | 2,054 | 6.458128 | 0.261084 | 0.102975 | 0.128146 | 0.144165 | 0.741419 | 0.741419 | 0.683448 | 0.503432 | 0.402746 | 0.311213 | 0 | 0.024066 | 0.231256 | 2,054 | 50 | 167 | 41.08 | 0.806206 | 0.020935 | 0 | 0.477273 | 1 | 0 | 0.2001 | 0.076157 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.068182 | 0 | 0.136364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
2142b80614595ab18852d993af6b0a6d8357433f | 208 | py | Python | Test3/Pandas.py | leejw51/BumblebeeNet | fd9bedbfaad9bb94bcb4f1dc44eec8125bb9c690 | [
"MIT"
] | null | null | null | Test3/Pandas.py | leejw51/BumblebeeNet | fd9bedbfaad9bb94bcb4f1dc44eec8125bb9c690 | [
"MIT"
] | null | null | null | Test3/Pandas.py | leejw51/BumblebeeNet | fd9bedbfaad9bb94bcb4f1dc44eec8125bb9c690 | [
"MIT"
] | null | null | null | import pandas as pd
data = {'name':['john', 'anna', 'peter', 'linda'],
'location': [ 'new york', 'paris', 'berlin', 'london'],
'age': [24, 13, 53, 33]}
data_pandas = pd.DataFrame(data)
print(data_pandas)
| 29.714286 | 57 | 0.610577 | 29 | 208 | 4.310345 | 0.793103 | 0.16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044944 | 0.144231 | 208 | 6 | 58 | 34.666667 | 0.657303 | 0 | 0 | 0 | 0 | 0 | 0.278846 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.