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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e4d00d5ab2c2bb9e0028ead41569560a75c52b53 | 273 | py | Python | 6gil_cpython_zlib/example.py | drodri/python-cpp-accu2016 | 26d7940f7b322f7e4817ccb5d918cba605165540 | [
"MIT"
] | 5 | 2016-07-14T12:42:25.000Z | 2021-02-08T21:48:27.000Z | 6gil_cpython_zlib/example.py | drodri/python-cpp-accu2016 | 26d7940f7b322f7e4817ccb5d918cba605165540 | [
"MIT"
] | null | null | null | 6gil_cpython_zlib/example.py | drodri/python-cpp-accu2016 | 26d7940f7b322f7e4817ccb5d918cba605165540 | [
"MIT"
] | 1 | 2016-10-02T17:23:54.000Z | 2016-10-02T17:23:54.000Z | import mymath
if __name__ == '__main__':
input = "Hello world, hello world" * 100000
ct_archive = mymath.deflate(input)
print "Compression ", len(input), "=>", len(ct_archive)
ct_orig = mymath.inflate(ct_archive)
assert ct_orig == input
print "OK " | 30.333333 | 59 | 0.663004 | 35 | 273 | 4.8 | 0.542857 | 0.160714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027778 | 0.208791 | 273 | 9 | 60 | 30.333333 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.178832 | 0 | 0 | 0 | 0 | 0 | 0.125 | 0 | null | null | 0 | 0.125 | null | null | 0.25 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e4f2cd7f115df7152591148e007266ce068c0880 | 993 | py | Python | open_sea_v1/endpoints/abc.py | MyNameIsBondJamesBond/opensea-python-wrapper | a9d1cf492f5e4a278de88cfcce7b02f0a049eb4c | [
"MIT"
] | 14 | 2021-08-01T10:17:00.000Z | 2022-03-07T21:19:50.000Z | open_sea_v1/endpoints/abc.py | MyNameIsBondJamesBond/opensea-python-wrapper | a9d1cf492f5e4a278de88cfcce7b02f0a049eb4c | [
"MIT"
] | 1 | 2021-11-18T12:16:13.000Z | 2021-11-20T22:40:12.000Z | open_sea_v1/endpoints/abc.py | MyNameIsBondJamesBond/opensea-python-wrapper | a9d1cf492f5e4a278de88cfcce7b02f0a049eb4c | [
"MIT"
] | 3 | 2021-09-04T16:10:37.000Z | 2021-10-20T17:56:32.000Z | from abc import ABC, abstractmethod
from typing import Generator, Type
from open_sea_v1.endpoints.client import ClientParams
from open_sea_v1.responses.abc import BaseResponse
class BaseEndpoint(ABC):
@property
@abstractmethod
def __post_init__(self):
"""Using post_init to run param validation"""
@property
@abstractmethod
def client_params(self) -> ClientParams:
"""Instance of common OpenSea Endpoint parameters."""
@property
@abstractmethod
def _response_type(self) -> Type[BaseResponse]:
""""""
@property
@abstractmethod
def url(self) -> str:
"""Endpoint URL"""
@abstractmethod
def _parse_json(self) -> Generator[list[list[BaseResponse]], None, None]:
"""Returns all pages for the query."""
@property
@abstractmethod
def get_params(self) -> str:
"""Endpoint URL"""
@property
@abstractmethod
def _validate_request_params(self) -> None:
""""""
| 23.093023 | 77 | 0.657603 | 105 | 993 | 6.038095 | 0.47619 | 0.187697 | 0.236593 | 0.041009 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002625 | 0.232628 | 993 | 42 | 78 | 23.642857 | 0.829396 | 0.147029 | 0 | 0.52 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.28 | false | 0 | 0.16 | 0 | 0.48 | 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 |
e4f498f1d36b78937eb01dc7896c4b554f71ac90 | 8,365 | py | Python | ARMODServers/Apps/ARExperiences/migrations/0012_auto_20220321_1648.py | Phantomxm2021/ARMOD-Dashboard | 383cf0a5e72dc5a2651f43e693f06773d5b88bbd | [
"Apache-2.0"
] | 1 | 2021-11-04T09:03:27.000Z | 2021-11-04T09:03:27.000Z | ARMODServers/Apps/ARExperiences/migrations/0012_auto_20220321_1648.py | Phantomxm2021/ARMOD-Dashboard | 383cf0a5e72dc5a2651f43e693f06773d5b88bbd | [
"Apache-2.0"
] | null | null | null | ARMODServers/Apps/ARExperiences/migrations/0012_auto_20220321_1648.py | Phantomxm2021/ARMOD-Dashboard | 383cf0a5e72dc5a2651f43e693f06773d5b88bbd | [
"Apache-2.0"
] | null | null | null | # Generated by Django 3.2 on 2022-03-21 08:48
import Apps.ARExperiences.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ARExperiences', '0011_auto_20210419_0224'),
]
operations = [
migrations.CreateModel(
name='ARExperienceModelV2',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Create Time')),
('update_time', models.DateTimeField(auto_now=True, null=True, verbose_name='Update Time')),
('is_delete', models.BooleanField(default=False, verbose_name='Delete Flag')),
('app_uid', models.BigIntegerField(db_index=True, default=-1, verbose_name='AR Experience Id')),
('user_uid', models.BigIntegerField(db_index=True, default=-1, verbose_name='User uid')),
('project_id', models.BigIntegerField(db_index=True, default=-1, unique=True, verbose_name='Showcase uid')),
('project_name', models.CharField(db_index=True, default='', max_length=16, unique=True, verbose_name='Showcase name')),
('project_brief', models.CharField(default='', max_length=64, verbose_name='Showcase brief')),
('project_status', models.IntegerField(db_index=True, default=0, verbose_name='Showcase status')),
('project_permission', models.IntegerField(db_index=True, default=1, verbose_name='Showcase permission')),
('project_icon', models.CharField(default='', max_length=512, verbose_name='Showcase icon')),
('project_header', models.CharField(default='', max_length=512, verbose_name='Showcase header')),
('project_preview', models.CharField(default='', max_length=1024, verbose_name='Showcase previews(json)')),
('project_description', models.CharField(blank=True, default='', max_length=1024, verbose_name='Showcase description')),
('project_recommend', models.BooleanField(db_index=True, default=False, verbose_name='Showcase recommend')),
('project_tags', models.JSONField(default=Apps.ARExperiences.models.getJSONFieldDefault, verbose_name='Showcase not index tags')),
('project_weight', models.IntegerField(db_index=True, default=0, verbose_name='Showcase Weight')),
],
options={
'verbose_name': 'ARExperiences_V2',
'verbose_name_plural': 'ARExperiences_V2',
'db_table': 'armod_arexperiences_v2',
},
),
migrations.CreateModel(
name='ARExperienceResourceV2',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Create Time')),
('update_time', models.DateTimeField(auto_now=True, null=True, verbose_name='Update Time')),
('is_delete', models.BooleanField(default=False, verbose_name='Delete Flag')),
('project_id', models.BigIntegerField(db_index=True, null=True, verbose_name='AR Experience Id')),
('json_url', models.CharField(max_length=128, verbose_name='android json')),
('bundle_url', models.CharField(max_length=128, verbose_name='android bundle')),
('bundle_size', models.FloatField(default=-1, verbose_name='android bundle size')),
('platform_type', models.CharField(max_length=16, verbose_name='Platform')),
],
options={
'verbose_name': 'ARExperienceAssets_V2',
'verbose_name_plural': 'ARExperienceAssets_V2',
'db_table': 'armod_arexperience_assets_v2',
},
),
migrations.CreateModel(
name='Statistics',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('pv', models.IntegerField(default=0, verbose_name='UV')),
('uv', models.IntegerField(default=0, verbose_name='PV')),
('date', models.CharField(max_length=200)),
('project_id', models.BigIntegerField(db_index=True, null=True, verbose_name='AR Experience Id')),
],
),
migrations.AlterField(
model_name='arexperienceasset',
name='android_bundle',
field=models.CharField(max_length=128, verbose_name='Android Bundle'),
),
migrations.AlterField(
model_name='arexperienceasset',
name='android_bundle_size',
field=models.FloatField(default=-1, verbose_name='Android Bundle Size'),
),
migrations.AlterField(
model_name='arexperienceasset',
name='android_json',
field=models.CharField(max_length=128, verbose_name='Android Json'),
),
migrations.AlterField(
model_name='arexperienceasset',
name='arexperience_uid',
field=models.BigIntegerField(db_index=True, default=-1, verbose_name='AR Experience Id'),
),
migrations.AlterField(
model_name='arexperienceasset',
name='create_time',
field=models.DateTimeField(auto_now_add=True, null=True, verbose_name='Create Time'),
),
migrations.AlterField(
model_name='arexperienceasset',
name='ios_bundle',
field=models.CharField(max_length=128, verbose_name='iOS Bundle'),
),
migrations.AlterField(
model_name='arexperienceasset',
name='ios_bundle_size',
field=models.FloatField(default=-1, verbose_name='iOS Bundle Size'),
),
migrations.AlterField(
model_name='arexperienceasset',
name='ios_json',
field=models.CharField(max_length=128, verbose_name='iOS Json'),
),
migrations.AlterField(
model_name='arexperienceasset',
name='is_delete',
field=models.BooleanField(default=False, verbose_name='Delete Flag'),
),
migrations.AlterField(
model_name='arexperienceasset',
name='update_time',
field=models.DateTimeField(auto_now=True, null=True, verbose_name='Update Time'),
),
migrations.AlterField(
model_name='arexperiencemodel',
name='app_uid',
field=models.BigIntegerField(db_index=True, default=-1, verbose_name='App Id'),
),
migrations.AlterField(
model_name='arexperiencemodel',
name='arexperience_uid',
field=models.BigIntegerField(db_index=True, default=-1, primary_key=True, serialize=False, verbose_name='AR Experience Id'),
),
migrations.AlterField(
model_name='arexperiencemodel',
name='create_time',
field=models.DateTimeField(auto_now_add=True, null=True, verbose_name='Create Time'),
),
migrations.AlterField(
model_name='arexperiencemodel',
name='description',
field=models.CharField(default='', max_length=128, verbose_name='AR Experience Descriptor'),
),
migrations.AlterField(
model_name='arexperiencemodel',
name='is_delete',
field=models.BooleanField(default=False, verbose_name='Delete Flag'),
),
migrations.AlterField(
model_name='arexperiencemodel',
name='name',
field=models.CharField(db_index=True, max_length=64, unique=True, verbose_name='AR Experience Name'),
),
migrations.AlterField(
model_name='arexperiencemodel',
name='status',
field=models.IntegerField(db_index=True, default=1, verbose_name='AR Experience Project Status'),
),
migrations.AlterField(
model_name='arexperiencemodel',
name='update_time',
field=models.DateTimeField(auto_now=True, null=True, verbose_name='Update Time'),
),
]
| 51.635802 | 146 | 0.617932 | 832 | 8,365 | 5.996394 | 0.139423 | 0.116857 | 0.090198 | 0.10463 | 0.761275 | 0.715574 | 0.664662 | 0.583885 | 0.533574 | 0.380237 | 0 | 0.015896 | 0.255469 | 8,365 | 161 | 147 | 51.956522 | 0.785164 | 0.00514 | 0 | 0.6 | 1 | 0 | 0.210938 | 0.016466 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.012903 | 0 | 0.032258 | 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 |
e4f6a046893b1c77aa152dee7087ba59a813bb9f | 1,741 | py | Python | deprecated/project/ProjectResults.py | Prodigysov/seutil | 988f33f707e43ddf38b0d4bb8805e48dad3a0517 | [
"Apache-2.0"
] | 2 | 2019-07-30T20:33:37.000Z | 2020-01-06T17:20:16.000Z | deprecated/project/ProjectResults.py | Prodigysov/seutil | 988f33f707e43ddf38b0d4bb8805e48dad3a0517 | [
"Apache-2.0"
] | null | null | null | deprecated/project/ProjectResults.py | Prodigysov/seutil | 988f33f707e43ddf38b0d4bb8805e48dad3a0517 | [
"Apache-2.0"
] | null | null | null | from pathlib import Path
from typing import *
from .. import io, Stream
class ProjectResults:
def __init__(self):
self.full_name: str = "UNKNOWN"
self.results_dir: Path = None
return
@classmethod
def from_base_results_dir(cls, base_results_dir: Path) -> List["ProjectResults"]:
full_names = Stream.of_dirs(base_results_dir)
return [cls.get_project_results(n, base_results_dir / n) for n in full_names]
@classmethod
def get_project_results(cls, full_name: str, results_dir: Path) -> "ProjectResults":
results = cls()
results.full_name = full_name
results.results_dir = results_dir
return results
@property
def meta_dir(self) -> Path:
meta_dir: Path = self.results_dir / "META"
meta_dir.mkdir(parents=True, exist_ok=True)
return meta_dir
def load_meta_result(self, file_name: str, *args, **kwargs) -> Any:
return io.load(self.meta_dir / file_name, *args, **kwargs)
def dump_meta_result(self, file_name: str, data: Any, *args, **kwargs) -> None:
io.dump(self.meta_dir / file_name, data, *args, **kwargs)
def get_revision_dir(self, revision: str) -> Path:
revision_dir = self.results_dir / revision
revision_dir.mkdir(parents=True, exist_ok=True)
return revision_dir
def load_revision_result(
self, revision: str, file_name: str, *args, **kwargs
) -> Any:
return io.load(self.get_revision_dir(revision) / file_name, *args, **kwargs)
def dump_revision_result(
self, revision: str, file_name: str, data: Any, *args, **kwargs
) -> None:
io.dump(self.get_revision_dir(revision) / file_name, data, *args, **kwargs)
| 34.137255 | 88 | 0.659966 | 235 | 1,741 | 4.621277 | 0.204255 | 0.092081 | 0.051565 | 0.034991 | 0.436464 | 0.390424 | 0.325967 | 0.270718 | 0.151013 | 0.151013 | 0 | 0 | 0.228604 | 1,741 | 50 | 89 | 34.82 | 0.808637 | 0 | 0 | 0.051282 | 0 | 0 | 0.022401 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.076923 | 0.051282 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e4f869826579353b9c49dd447ddd70dc6ef3ed5b | 188 | py | Python | numpy/pythoncode.py | ikelee22/pythonlib | cbf0faf548dfc35d799898178bf7e8c3461e5776 | [
"MIT"
] | null | null | null | numpy/pythoncode.py | ikelee22/pythonlib | cbf0faf548dfc35d799898178bf7e8c3461e5776 | [
"MIT"
] | null | null | null | numpy/pythoncode.py | ikelee22/pythonlib | cbf0faf548dfc35d799898178bf7e8c3461e5776 | [
"MIT"
] | null | null | null | # this is a python file created in jupyter notbook
def list_fruits(fruits=[]):
for fruit in fruits:
print(fruit)
fruits = ['apple','kiwi','banana']
list_fruit(fruits)
| 23.5 | 50 | 0.654255 | 26 | 188 | 4.653846 | 0.692308 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223404 | 188 | 7 | 51 | 26.857143 | 0.828767 | 0.255319 | 0 | 0 | 0 | 0 | 0.108696 | 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 |
e4f8892896c6ea77e88be5bc9a982ffb3b5c2a3b | 5,499 | py | Python | code_richheader.py | byeongal/malware_tutorial | f7fc29cab05cc274aef3d2cd8b5e8bcf1acbe8ad | [
"MIT"
] | null | null | null | code_richheader.py | byeongal/malware_tutorial | f7fc29cab05cc274aef3d2cd8b5e8bcf1acbe8ad | [
"MIT"
] | null | null | null | code_richheader.py | byeongal/malware_tutorial | f7fc29cab05cc274aef3d2cd8b5e8bcf1acbe8ad | [
"MIT"
] | null | null | null | import pefile
COMPID_DICT = {
0: "Unknown",
1: "Import0",
2: "Linker510",
3: "Cvtomf510",
4: "Linker600",
5: "Cvtomf600",
6: "Cvtres500",
7: "Utc11_Basic",
8: "Utc11_C",
9: "Utc12_Basic",
10: "Utc12_C",
11: "Utc12_CPP",
12: "AliasObj60",
13: "VisualBasic60",
14: "Masm613",
15: "Masm710",
16: "Linker511",
17: "Cvtomf511",
18: "Masm614",
19: "Linker512",
20: "Cvtomf512",
21: "Utc12_C_Std",
22: "Utc12_CPP_Std",
23: "Utc12_C_Book",
24: "Utc12_CPP_Book",
25: "Implib700",
26: "Cvtomf700",
27: "Utc13_Basic",
28: "Utc13_C",
29: "Utc13_CPP",
30: "Linker610",
31: "Cvtomf610",
32: "Linker601",
33: "Cvtomf601",
34: "Utc12_1_Basic",
35: "Utc12_1_C",
36: "Utc12_1_CPP",
37: "Linker620",
38: "Cvtomf620",
39: "AliasObj70",
40: "Linker621",
41: "Cvtomf621",
42: "Masm615",
43: "Utc13_LTCG_C",
44: "Utc13_LTCG_CPP",
45: "Masm620",
46: "ILAsm100",
47: "Utc12_2_Basic",
48: "Utc12_2_C",
49: "Utc12_2_CPP",
50: "Utc12_2_C_Std",
51: "Utc12_2_CPP_Std",
52: "Utc12_2_C_Book",
53: "Utc12_2_CPP_Book",
54: "Implib622",
55: "Cvtomf622",
56: "Cvtres501",
57: "Utc13_C_Std",
58: "Utc13_CPP_Std",
59: "Cvtpgd1300",
60: "Linker622",
61: "Linker700",
62: "Export622",
63: "Export700",
64: "Masm700",
65: "Utc13_POGO_I_C",
66: "Utc13_POGO_I_CPP",
67: "Utc13_POGO_O_C",
68: "Utc13_POGO_O_CPP",
69: "Cvtres700",
70: "Cvtres710p",
71: "Linker710p",
72: "Cvtomf710p",
73: "Export710p",
74: "Implib710p",
75: "Masm710p",
76: "Utc1310p_C",
77: "Utc1310p_CPP",
78: "Utc1310p_C_Std",
79: "Utc1310p_CPP_Std",
80: "Utc1310p_LTCG_C",
81: "Utc1310p_LTCG_CPP",
82: "Utc1310p_POGO_I_C",
83: "Utc1310p_POGO_I_CPP",
84: "Utc1310p_POGO_O_C",
85: "Utc1310p_POGO_O_CPP",
86: "Linker624",
87: "Cvtomf624",
88: "Export624",
89: "Implib624",
90: "Linker710",
91: "Cvtomf710",
92: "Export710",
93: "Implib710",
94: "Cvtres710",
95: "Utc1310_C",
96: "Utc1310_CPP",
97: "Utc1310_C_Std",
98: "Utc1310_CPP_Std",
99: "Utc1310_LTCG_C",
100: "Utc1310_LTCG_CPP",
101: "Utc1310_POGO_I_C",
102: "Utc1310_POGO_I_CPP",
103: "Utc1310_POGO_O_C",
104: "Utc1310_POGO_O_CPP",
105: "AliasObj710",
106: "AliasObj710p",
107: "Cvtpgd1310",
108: "Cvtpgd1310p",
109: "Utc1400_C",
110: "Utc1400_CPP",
111: "Utc1400_C_Std",
112: "Utc1400_CPP_Std",
113: "Utc1400_LTCG_C",
114: "Utc1400_LTCG_CPP",
115: "Utc1400_POGO_I_C",
116: "Utc1400_POGO_I_CPP",
117: "Utc1400_POGO_O_C",
118: "Utc1400_POGO_O_CPP",
119: "Cvtpgd1400",
120: "Linker800",
121: "Cvtomf800",
122: "Export800",
123: "Implib800",
124: "Cvtres800",
125: "Masm800",
126: "AliasObj800",
127: "PhoenixPrerelease",
128: "Utc1400_CVTCIL_C",
129: "Utc1400_CVTCIL_CPP",
130: "Utc1400_LTCG_MSIL",
131: "Utc1500_C",
132: "Utc1500_CPP",
133: "Utc1500_C_Std",
134: "Utc1500_CPP_Std",
135: "Utc1500_CVTCIL_C",
136: "Utc1500_CVTCIL_CPP",
137: "Utc1500_LTCG_C",
138: "Utc1500_LTCG_CPP",
139: "Utc1500_LTCG_MSIL",
140: "Utc1500_POGO_I_C",
141: "Utc1500_POGO_I_CPP",
142: "Utc1500_POGO_O_C",
143: "Utc1500_POGO_O_CPP",
144: "Cvtpgd1500",
145: "Linker900",
146: "Export900",
147: "Implib900",
148: "Cvtres900",
149: "Masm900",
150: "AliasObj900",
151: "Resource900",
152: "AliasObj1000",
154: "Cvtres1000",
155: "Export1000",
156: "Implib1000",
157: "Linker1000",
158: "Masm1000",
170: "Utc1600_C",
171: "Utc1600_CPP",
172: "Utc1600_CVTCIL_C",
173: "Utc1600_CVTCIL_CPP",
174: "Utc1600_LTCG_C ",
175: "Utc1600_LTCG_CPP",
176: "Utc1600_LTCG_MSIL",
177: "Utc1600_POGO_I_C",
178: "Utc1600_POGO_I_CPP",
179: "Utc1600_POGO_O_C",
180: "Utc1600_POGO_O_CPP",
183: "Linker1010",
184: "Export1010",
185: "Implib1010",
186: "Cvtres1010",
187: "Masm1010",
188: "AliasObj1010",
199: "AliasObj1100",
201: "Cvtres1100",
202: "Export1100",
203: "Implib1100",
204: "Linker1100",
205: "Masm1100",
206: "Utc1700_C",
207: "Utc1700_CPP",
208: "Utc1700_CVTCIL_C",
209: "Utc1700_CVTCIL_CPP",
210: "Utc1700_LTCG_C ",
211: "Utc1700_LTCG_CPP",
212: "Utc1700_LTCG_MSIL",
213: "Utc1700_POGO_I_C",
214: "Utc1700_POGO_I_CPP",
215: "Utc1700_POGO_O_C",
216: "Utc1700_POGO_O_CPP",
}
import pefile
# AhnLab-V3 : Trojan/Win32.WannaCryptor.R200571
# ALYac : Trojan.Ransom.WannaCryptor
file_path = r"./samples/84c82835a5d21bbcf75a61706d8ab549.vir"
pe = pefile.PE(file_path)
rich_header = []
for i in range(0, len(getattr(pe.RICH_HEADER, 'values', [])), 2):
comp_id = pe.RICH_HEADER.values[i]
comp_cnt = pe.RICH_HEADER.values[i + 1]
comp_name = COMPID_DICT.get((comp_id & 0xffff0000) >> 16, '*unknown*')
comp_build = comp_id & 0xffff
rich_header.append({"id": (comp_id & 0xffff0000) >> 16, "count": comp_cnt, "name": comp_name, "build": comp_build})
for each in rich_header:
print('Name : {}'.format(each['name']))
print('ID : 0x{:04X}'.format(each['id']))
print('Build : 0x{:04X}'.format(each['build']))
print('Count : {}'.format(each['count']))
print() | 25.224771 | 119 | 0.599018 | 710 | 5,499 | 4.31831 | 0.490141 | 0.022831 | 0.013699 | 0.017613 | 0.012394 | 0 | 0 | 0 | 0 | 0 | 0 | 0.274064 | 0.232951 | 5,499 | 218 | 120 | 25.224771 | 0.452821 | 0.014548 | 0 | 0.009479 | 0 | 0 | 0.44508 | 0.008492 | 0 | 0 | 0.0048 | 0 | 0 | 1 | 0 | false | 0 | 0.014218 | 0 | 0.014218 | 0.023697 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e4fe927d10ea95ffeae42b7f09cf04fcc3b5d779 | 70 | py | Python | visualsnoop/__init__.py | visualsnoop/visualsnoop-client-python | b40dcf90bec67acb091ab2d9f435ea2ba2d24f20 | [
"BSD-4-Clause"
] | 1 | 2015-01-25T23:10:52.000Z | 2015-01-25T23:10:52.000Z | visualsnoop/__init__.py | visualsnoop/visualsnoop-client-python | b40dcf90bec67acb091ab2d9f435ea2ba2d24f20 | [
"BSD-4-Clause"
] | null | null | null | visualsnoop/__init__.py | visualsnoop/visualsnoop-client-python | b40dcf90bec67acb091ab2d9f435ea2ba2d24f20 | [
"BSD-4-Clause"
] | null | null | null | __version__ = '0.2'
DEFAULT_ENDPOINT='http://visualsnoop.com/api/v1'
| 17.5 | 48 | 0.742857 | 10 | 70 | 4.7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046154 | 0.071429 | 70 | 3 | 49 | 23.333333 | 0.676923 | 0 | 0 | 0 | 0 | 0 | 0.457143 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
90199a66d87e8247108db5d542392d6e5d5033f5 | 847 | py | Python | fbone/badge/models.py | edgarallang/dop-backend | c7c89b6145dfb895ab3dcb14172fa47afdbdf1be | [
"BSD-3-Clause"
] | 1 | 2015-12-14T17:53:34.000Z | 2015-12-14T17:53:34.000Z | fbone/badge/models.py | edgarallang/fbone | c7c89b6145dfb895ab3dcb14172fa47afdbdf1be | [
"BSD-3-Clause"
] | null | null | null | fbone/badge/models.py | edgarallang/fbone | c7c89b6145dfb895ab3dcb14172fa47afdbdf1be | [
"BSD-3-Clause"
] | null | null | null | from sqlalchemy import Column, types
from sqlalchemy.ext.mutable import Mutable
from sqlalchemy.exc import IntegrityError
from ..extensions import db
from ..utils import get_current_time, SEX_TYPE, STRING_LEN
from ..level import *
from .schemas import *
class Badge(db.Model):
__tablename__ = 'badges'
badge_id = Column(db.Integer, primary_key=True)
name = Column(db.String(STRING_LEN), nullable=False, unique=True)
info = Column(db.String(STRING_LEN), nullable=False)
level = db.relationship("Level", uselist=False, backref="badges")
class UsersBadges(db.Model):
__tablename__ = 'users_badges'
users_badges_id = Column(db.Integer, primary_key=True)
user_id = Column(db.Integer)
badge_id = Column(db.Integer)
reward_date = Column(db.DateTime)
type = Column(db.String(STRING_LEN), nullable=False)
| 35.291667 | 69 | 0.742621 | 115 | 847 | 5.26087 | 0.391304 | 0.105785 | 0.066116 | 0.112397 | 0.32562 | 0.280992 | 0.280992 | 0 | 0 | 0 | 0 | 0 | 0.149941 | 847 | 23 | 70 | 36.826087 | 0.840278 | 0 | 0 | 0 | 0 | 0 | 0.034238 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.35 | 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 |
9019e285df73098dd09c9649c272611b9680d776 | 78 | py | Python | apps/network_apps/__init__.py | LouisPi/PiPortableRecorder | 430a4b6e1e869cbd68fd89bbf97261710fd7db6b | [
"Apache-2.0",
"MIT"
] | 51 | 2017-12-03T21:59:13.000Z | 2021-01-02T17:13:34.000Z | apps/network_apps/__init__.py | LouisPi/PiPortableRecorder | 430a4b6e1e869cbd68fd89bbf97261710fd7db6b | [
"Apache-2.0",
"MIT"
] | 153 | 2017-10-27T19:59:46.000Z | 2020-01-14T23:58:57.000Z | apps/network_apps/__init__.py | LouisPi/PiPortableRecorder | 430a4b6e1e869cbd68fd89bbf97261710fd7db6b | [
"Apache-2.0",
"MIT"
] | 26 | 2017-11-16T11:10:56.000Z | 2022-03-29T18:44:48.000Z | _menu_name = "Networking"
_ordering = [
"wpa_cli",
"network",
"nmap",
"upnp"]
| 11.142857 | 25 | 0.653846 | 9 | 78 | 5.222222 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128205 | 78 | 6 | 26 | 13 | 0.691176 | 0 | 0 | 0 | 0 | 0 | 0.410256 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
90320414d5545b38764cd72587480188bd9c886c | 422 | py | Python | python/en/_numpy/organize_this/test_numpy.Quickstart_tutorial-03.py | aimldl/coding | 70ddbfaa454ab92fd072ee8dc614ecc330b34a70 | [
"MIT"
] | null | null | null | python/en/_numpy/organize_this/test_numpy.Quickstart_tutorial-03.py | aimldl/coding | 70ddbfaa454ab92fd072ee8dc614ecc330b34a70 | [
"MIT"
] | null | null | null | python/en/_numpy/organize_this/test_numpy.Quickstart_tutorial-03.py | aimldl/coding | 70ddbfaa454ab92fd072ee8dc614ecc330b34a70 | [
"MIT"
] | null | null | null | """
test_numpy.Quickstart_tutorial-03.py
* References
Quickstart tutorial
https://docs.scipy.org/doc/numpy/user/quickstart.html
TODO: Start from
A frequent error consists in calling array with multiple numeric
"""
import numpy as np
a = np.array( [2,3,4] )
"""
>>> a
array([2, 3, 4])
>>> a.dtype
dtype('int64')
>>> a.dtype.name
'int64'
"""
b = np.array( [1.2, 3.5, 5.1] )
"""
>>> b.dtype
dtype('float64')
""" | 14.066667 | 65 | 0.63981 | 67 | 422 | 4 | 0.597015 | 0.022388 | 0.052239 | 0.059701 | 0.067164 | 0 | 0 | 0 | 0 | 0 | 0 | 0.056497 | 0.161137 | 422 | 30 | 66 | 14.066667 | 0.700565 | 0.504739 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033333 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
903a54b6626556365a90f252b17955f6d87727ea | 512 | py | Python | examples/basic/handler.py | ferama/bruco | 77edef97dfa0fb64209ac1c64f768f524920a116 | [
"MIT"
] | 1 | 2021-05-24T15:17:00.000Z | 2021-05-24T15:17:00.000Z | examples/basic/handler.py | ferama/bruco | 77edef97dfa0fb64209ac1c64f768f524920a116 | [
"MIT"
] | null | null | null | examples/basic/handler.py | ferama/bruco | 77edef97dfa0fb64209ac1c64f768f524920a116 | [
"MIT"
] | null | null | null | import os
def handle_event(context, data):
context.logger.info(data.decode())
if context.var == False:
context.logger.info("var is false")
setattr(context, "var", True)
else:
context.logger.info("var is true")
context.logger.info("##### ENV DUMP #####")
for k, v in os.environ.items():
context.logger.info(f"{k}: {v}")
return data.decode() + " test"
def init_context(context):
context.logger.info("init context")
setattr(context, "var", False) | 26.947368 | 47 | 0.611328 | 68 | 512 | 4.573529 | 0.426471 | 0.250804 | 0.327974 | 0.128617 | 0.141479 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.216797 | 512 | 19 | 48 | 26.947368 | 0.775561 | 0 | 0 | 0 | 0 | 0 | 0.14425 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0.066667 | 0 | 0.266667 | 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 |
5f440383899383c1efbd2eccc5f0cb1b8ab53ed4 | 857 | py | Python | src/syaml/interfaces.py | lgblkb/syaml | 442f377066eab73eb55e346f368bc46eda25d8cc | [
"Apache-2.0"
] | null | null | null | src/syaml/interfaces.py | lgblkb/syaml | 442f377066eab73eb55e346f368bc46eda25d8cc | [
"Apache-2.0"
] | null | null | null | src/syaml/interfaces.py | lgblkb/syaml | 442f377066eab73eb55e346f368bc46eda25d8cc | [
"Apache-2.0"
] | null | null | null | from zope.interface import (
Attribute,
Interface,
)
class IPreProcess(Interface):
def __call__(fileobj):
"""Initial processing for target file.
:param fileobj:
:rtype: file like object
:return fileobj: file object (seeked to top)
"""
class IParser(Interface):
def __call__(fileobj):
"""Parse fileobj
:param fileobj:
:rtype: unkown
:return obj: parsed object
"""
class IPostProcess(Interface):
def __call__(obj):
"""Post process to obj
:param fileobj:
:rtype: unkown
:return obj: post processed object
"""
class IReader(Interface):
pre = Attribute('pre process')
parse = Attribute('parser process')
post = Attribute('post process')
def __call__(obj):
"""Read formatted file"""
| 19.477273 | 52 | 0.590432 | 86 | 857 | 5.697674 | 0.430233 | 0.057143 | 0.097959 | 0.093878 | 0.130612 | 0.130612 | 0 | 0 | 0 | 0 | 0 | 0 | 0.305718 | 857 | 43 | 53 | 19.930233 | 0.823529 | 0.352392 | 0 | 0.266667 | 0 | 0 | 0.085057 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.066667 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
5f685cfaeb21ee93d617e2000789bec4ccb9c5bf | 992 | py | Python | examples/benchmark_example.py | eirrgang/radical.utils | 7a3dde9cf8cc110d3d35f507fe1e27554bbb92d2 | [
"MIT"
] | 7 | 2015-10-25T10:07:19.000Z | 2021-04-30T04:25:31.000Z | examples/benchmark_example.py | eirrgang/radical.utils | 7a3dde9cf8cc110d3d35f507fe1e27554bbb92d2 | [
"MIT"
] | 205 | 2015-02-23T10:32:26.000Z | 2022-03-26T19:27:46.000Z | examples/benchmark_example.py | eirrgang/radical.utils | 7a3dde9cf8cc110d3d35f507fe1e27554bbb92d2 | [
"MIT"
] | 8 | 2015-09-17T21:42:29.000Z | 2020-10-06T11:53:22.000Z |
__author__ = "Radical.Utils Development Team (Andre Merzky)"
__copyright__ = "Copyright 2013, RADICAL@Rutgers"
__license__ = "MIT"
import radical.utils as ru
import sys
import time
# ------------------------------------------------------------------------------
#
def benchmark_pre(tid, app_cfg, bench_cfg):
if 'load' not in app_cfg:
raise KeyError('no load configured')
# ------------------------------------------------------------------------------
#
def benchmark_core(tid, i, app_cfg, bench_cfg):
time.sleep(float(app_cfg['load']))
# ------------------------------------------------------------------------------
#
def benchmark_post(tid, app_cfg, bench_cfg):
pass
# ------------------------------------------------------------------------------
#
cfg = sys.argv[1]
b = ru.Benchmark(cfg, 'job_run', benchmark_pre, benchmark_core, benchmark_post)
b.run()
b.eval()
# ------------------------------------------------------------------------------
| 22.044444 | 80 | 0.413306 | 86 | 992 | 4.453488 | 0.511628 | 0.078329 | 0.086162 | 0.109661 | 0.088773 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005708 | 0.116935 | 992 | 44 | 81 | 22.545455 | 0.431507 | 0.397177 | 0 | 0 | 0 | 0 | 0.191453 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0.058824 | 0.176471 | 0 | 0.352941 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
5f70c151b5b096b3e0b0b61d8b7adf82f806a94c | 813 | py | Python | com_blacktensor/cop/exc/resource/exchange.py | Jelly6489/Stock-Proj | 3e7b1ad5cddc5b142f0069e024199fe969c7c7e8 | [
"MIT"
] | null | null | null | com_blacktensor/cop/exc/resource/exchange.py | Jelly6489/Stock-Proj | 3e7b1ad5cddc5b142f0069e024199fe969c7c7e8 | [
"MIT"
] | null | null | null | com_blacktensor/cop/exc/resource/exchange.py | Jelly6489/Stock-Proj | 3e7b1ad5cddc5b142f0069e024199fe969c7c7e8 | [
"MIT"
] | 2 | 2020-11-13T08:11:04.000Z | 2020-11-14T05:32:09.000Z | # from flask import request
# from flask_restful import Resource, reqparse
# from flask import jsonify
# from com_blacktensor.cop.exc.model.exchange_kdd import ExchangeKdd
# from com_blacktensor.cop.exc.model.exchange_kdd import ExchangeDao
# # ============================================================
# # ================== =====================
# # ================== Resourcing =====================
# # ================== =====================
# # ============================================================
# class Exchange(Resource):
# def __init__(self):
# self.dao = FinanceDao()
# def get(self):
# result = self.dao.find_all()
# return jsonify([item.json for item in result])
# # return jsonify(str(result)) | 40.65 | 68 | 0.434194 | 64 | 813 | 5.359375 | 0.53125 | 0.078717 | 0.087464 | 0.122449 | 0.268222 | 0.268222 | 0.268222 | 0.268222 | 0.268222 | 0 | 0 | 0 | 0.201722 | 813 | 20 | 69 | 40.65 | 0.528505 | 0.947109 | 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 |
5f714ae985efa6fe9d1ea19f977f36c9fbe405b1 | 156 | py | Python | client/my-client.py | chrisdo023/My-IKEA-Greenhouse-Cabinet | 87c178fadbb23483ba01140277d9365326f1807e | [
"MIT"
] | null | null | null | client/my-client.py | chrisdo023/My-IKEA-Greenhouse-Cabinet | 87c178fadbb23483ba01140277d9365326f1807e | [
"MIT"
] | null | null | null | client/my-client.py | chrisdo023/My-IKEA-Greenhouse-Cabinet | 87c178fadbb23483ba01140277d9365326f1807e | [
"MIT"
] | null | null | null | import requests, json
response = requests.get('http://127.0.0.1:5000/retrieve')
item = json.loads(response.text)
for each in item["data"]:
print(each) | 22.285714 | 57 | 0.705128 | 25 | 156 | 4.4 | 0.76 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072993 | 0.121795 | 156 | 7 | 58 | 22.285714 | 0.729927 | 0 | 0 | 0 | 0 | 0 | 0.216561 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5f73410d5413f2993374ec22e1346db0d8c2d04b | 1,413 | py | Python | test_priorityq.py | CharlyWelch/data-structures | eda7ecf1256758e3b1005286f9d4849df71b2201 | [
"MIT"
] | null | null | null | test_priorityq.py | CharlyWelch/data-structures | eda7ecf1256758e3b1005286f9d4849df71b2201 | [
"MIT"
] | null | null | null | test_priorityq.py | CharlyWelch/data-structures | eda7ecf1256758e3b1005286f9d4849df71b2201 | [
"MIT"
] | null | null | null | import pytest
import unittest
from priorityq import Node, PriorityQ
class PriorityTest(unittest.TestCase):
def test_1(self):
""" test that insert puts the node in the queue """
p = PriorityQ()
n1 = Node(1)
p.insert(n1)
self.assertEqual(p.head._value, 1)
def test_2(self):
""" test that insert puts the node in the queue in the correct position with no priority assignment """
p = PriorityQ()
n1 = Node(1)
n2 = Node(2)
p.insert(n1)
p.insert(n2)
self.assertEqual(p.head._value, 1)
def test_3(self):
""" test that insert puts the node in the queue in the correct position if given a priority value """
p = PriorityQ()
n1 = Node(1)
n2 = Node(2)
n3 = Node(3)
p.insert(n1, 1)
p.insert(n2, 2)
p.insert(n3, 3)
self.assertEqual(p.head._priority, 3)
def test_4(self):
""" test that pop() removes the highest priority node """
pass
def test_5(self):
""" test that pop() returns the value of the highest priority node """
def test_6(self):
""" test that peek() returns the value of the highest ptriority node """
def test_7(self):
""" test that pop() returns None if empty """
pass
def test_8(self):
""" test that peek() returns None if empty """
pass
| 27.705882 | 111 | 0.573956 | 199 | 1,413 | 4.020101 | 0.261307 | 0.07 | 0.12 | 0.0675 | 0.56 | 0.40625 | 0.33875 | 0.33875 | 0.19625 | 0.19625 | 0 | 0.033195 | 0.317764 | 1,413 | 50 | 112 | 28.26 | 0.796681 | 0.350318 | 0 | 0.454545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 1 | 0.242424 | false | 0.090909 | 0.090909 | 0 | 0.363636 | 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 |
5f74dfc76f6dc61f009b7c27b53d023109e64a5f | 294 | py | Python | Crawling/googleimages/google.py | osamhack2020/web_ArmyLens_ArmyLens | 23678d7dab25fceaacc30b158461b26820e4195c | [
"MIT"
] | 1 | 2021-09-29T09:05:51.000Z | 2021-09-29T09:05:51.000Z | Crawling/googleimages/google.py | osamhack2020/web_ArmyLens_ArmyLens | 23678d7dab25fceaacc30b158461b26820e4195c | [
"MIT"
] | null | null | null | Crawling/googleimages/google.py | osamhack2020/web_ArmyLens_ArmyLens | 23678d7dab25fceaacc30b158461b26820e4195c | [
"MIT"
] | null | null | null | from google_images_download import google_images_download
response = google_images_download.googleimagesdownload()
arguments = {"keywords":"MM-1 Minimore","limit":200,"print_urls":True, "format": "png"} #creating list of arguments
paths = response.download(arguments)
print(paths) | 42 | 118 | 0.768707 | 35 | 294 | 6.257143 | 0.657143 | 0.164384 | 0.273973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015385 | 0.115646 | 294 | 7 | 119 | 42 | 0.826923 | 0.088435 | 0 | 0 | 0 | 0 | 0.171756 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.4 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5fc3bf4ebe495a830672e1be94810404b51dbaf6 | 690 | py | Python | tools/skqp/extract_report.py | ndsol/subskia | 9a8f6e5ffc6676281a4389aa1503ba6c4352eaca | [
"BSD-3-Clause"
] | null | null | null | tools/skqp/extract_report.py | ndsol/subskia | 9a8f6e5ffc6676281a4389aa1503ba6c4352eaca | [
"BSD-3-Clause"
] | null | null | null | tools/skqp/extract_report.py | ndsol/subskia | 9a8f6e5ffc6676281a4389aa1503ba6c4352eaca | [
"BSD-3-Clause"
] | null | null | null | #! /usr/bin/env python2
# Copyright 2017 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import StringIO
import os
import sys
import sysopen
import tarfile
import tempfile
import zlib
if __name__ == '__main__':
if len(sys.argv) != 2:
print 'usage: %s FILE.ab\n' % sys.argv[0]
exit (1)
with open(sys.argv[1], 'rb') as f:
f.read(24)
t = tarfile.open(fileobj=StringIO.StringIO(zlib.decompress(f.read())))
d = tempfile.mkdtemp(prefix='skqp_')
t.extractall(d)
p = os.path.join(d, 'apps/org.skia.skqp/f/skqp_report/report.html')
assert os.path.isfile(p)
print p
sysopen.sysopen(p)
| 23 | 74 | 0.678261 | 114 | 690 | 4.017544 | 0.649123 | 0.045852 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019643 | 0.188406 | 690 | 29 | 75 | 23.793103 | 0.798214 | 0.213043 | 0 | 0 | 0 | 0 | 0.145522 | 0.08209 | 0 | 0 | 0 | 0 | 0.05 | 0 | null | null | 0 | 0.35 | null | null | 0.1 | 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 |
5fcb5d3ba67e8013a7289cbef9b3d31e10a2ae4b | 599 | py | Python | sandbox/apps/shipping/repository.py | izi-core/izi-core | 21176be2d41f0cf54ca954f294209c585f643dba | [
"BSD-3-Clause"
] | null | null | null | sandbox/apps/shipping/repository.py | izi-core/izi-core | 21176be2d41f0cf54ca954f294209c585f643dba | [
"BSD-3-Clause"
] | null | null | null | sandbox/apps/shipping/repository.py | izi-core/izi-core | 21176be2d41f0cf54ca954f294209c585f643dba | [
"BSD-3-Clause"
] | null | null | null | from decimal import Decimal as D
from izi.apps.shipping.methods import Free, FixedPrice
from izi_shipping.methods import SelfPickup, ApiBased
from izi.apps.shipping.repository import Repository as CoreRepository
class Repository(CoreRepository):
"""
This class is included so that there is a choice of shipping methods.
IZI's default behavior is to only have one which means you can't test
the shipping features of PayPal.
"""
# Here we will list all the supported shipping method... , ApiBased()
methods = [Free(), FixedPrice(D('10.00'), D('10.00')), SelfPickup(), ]
| 37.4375 | 74 | 0.734558 | 86 | 599 | 5.104651 | 0.581395 | 0.047836 | 0.050114 | 0.08656 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01626 | 0.178631 | 599 | 15 | 75 | 39.933333 | 0.876016 | 0.402337 | 0 | 0 | 0 | 0 | 0.02994 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 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 |
3955f9dae10de161cc239ff54f3ab4a4802a717e | 555 | py | Python | examples/pyecho/echo.py | 38/plumber | 30fead11cddd6352025dcac0c16065172744c0f9 | [
"BSD-2-Clause"
] | 39 | 2017-05-22T04:23:41.000Z | 2021-11-15T20:19:20.000Z | examples/pyecho/echo.py | 38/plumber | 30fead11cddd6352025dcac0c16065172744c0f9 | [
"BSD-2-Clause"
] | 10 | 2017-05-27T14:36:11.000Z | 2018-04-26T20:46:51.000Z | examples/pyecho/echo.py | 38/plumber | 30fead11cddd6352025dcac0c16065172744c0f9 | [
"BSD-2-Clause"
] | 2 | 2017-06-09T21:36:51.000Z | 2019-01-27T01:30:58.000Z | import pservlet
def init(args):
return (pservlet.pipe_define("in", pservlet.PIPE_INPUT),
pservlet.pipe_define("out", pservlet.PIPE_OUTPUT))
def execute(s):
while True:
tmp = pservlet.pipe_read(s[0])
if not tmp:
if not pservlet.pipe_eof(s[0]):
pservlet.pipe_set_flag(s[0], pservlet.PIPE_PERSIST)
else:
pservlet.pipe_clr_flag(s[0], pservlet.PIPE_PERSIST)
return 0
else:
pservlet.pipe_write(s[1], tmp)
def cleanup(s):
return 0
| 27.75 | 67 | 0.587387 | 74 | 555 | 4.22973 | 0.405405 | 0.421725 | 0.095847 | 0.134185 | 0.159744 | 0.159744 | 0 | 0 | 0 | 0 | 0 | 0.018041 | 0.300901 | 555 | 19 | 68 | 29.210526 | 0.78866 | 0 | 0 | 0.235294 | 0 | 0 | 0.009009 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0.058824 | 0.117647 | 0.411765 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
396bef3adb8fd217f072af71f4c4a636d0527ee7 | 5,237 | py | Python | controller.py | MiloDennison/Text-Stream-Protocol | dbd8267286e0a454f9f54e86da02f65014561ca0 | [
"MIT"
] | null | null | null | controller.py | MiloDennison/Text-Stream-Protocol | dbd8267286e0a454f9f54e86da02f65014561ca0 | [
"MIT"
] | null | null | null | controller.py | MiloDennison/Text-Stream-Protocol | dbd8267286e0a454f9f54e86da02f65014561ca0 | [
"MIT"
] | null | null | null | #4390 Semester Project
#Patrick Le, Trevor, Duncan, Logan Dennison
#Controller Code
import socket
import sys
import os
import errno
import time
class Controller:
LOCAL_IP = "10.0.0.3"
R_IP = "10.0.0.2"
S_IP = "10.0.0.1"
C_SEND = (LOCAL_IP,2500)
C_RECV = (LOCAL_IP,5000)
R = (R_IP,5000)
S = (S_IP,5000)
sendSock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
recvSock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
COMMANDPROMPT = ("Enter the number corresponding to the desired command:\n[0] Play\n[1] Pause\n[2] Restart\n[3] Disconnect\n")
FILEPROMPT = ("Enter the number corresponding to the desired file:")
type = ""
code = ""
inPayload = ["",""]
outPayload = ""
disconnect = False
streaming = False
def __init__(self):
self.sendSock.bind(self.C_SEND)
self.recvSock.bind(self.C_RECV)
self.disconnect = False
def isConnected(self):
if self.disconnect:
return False
else:
return True
def listenCommand(self):
#print("Controller: Listening")
packet = ["","",""]
try:
rawPacket, rawIP = self.recvSock.recvfrom(2048)
except:
raise
if rawPacket:
#print "Controller: Received Message"
packet = rawPacket.split(" ",2)
self.type = packet[0] #first is type
self.code = packet[1] #second is type
if type == "STREAM" and code == "NULL":
self.inPayload = packet[2].split(" ",1) #will be split if type and code are stream and NULL
else:
self.inPayload[0] = packet[2]
#print "Controller: MESSAGE: " + self.type + " " + self.code + " " + str(self.inPayload)
def sendCommand(self, HOST, STATUS):
#print "Controller: Sending"
localPacket = STATUS + self.outPayload
if HOST == "S":
self.sendSock.sendto(localPacket,self.S)
if HOST == "R":
self.sendSock.sendto(localPacket,self.R)
#print "Controller: Message Sent to " + HOST
#print "Controller: MESSAGE: " + localPacket
def play(self):
print "Controller: PLAY"
self.sendCommand("S", "PLAY NULL ")
def pause(self):
print "Controller: PAUSE"
self.sendCommand("S", "PAUSE NULL ")
def restart(self):
print "Controller: RESTART"
self.outPayload = str(0)
self.sendCommand("S", "PLAY LINE ")
self.sendCommand("R", "PLAY LINE ")
def disconnectF(self):
print "Controller: DISCONNECT"
self.sendCommand("S", "DISCONNECT NULL ")
print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
print "Controller: Disconnected"
controller = Controller()
print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
while controller.isConnected():
#create initial frame
controller.sendCommand("S", "CONNECT NULL ")
prompt = ""
controller.recvSock.setblocking(1)
controller.listenCommand()
controller.recvSock.setblocking(0)
files = controller.inPayload[0].split(" ",len(controller.inPayload[0])-1)
print controller.FILEPROMPT
index = 0
for f in files:
prompt += "[" + str(index) + "]" + " " + f + "\n"
index += 1
index = int(raw_input(prompt))
print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
controller.outPayload = files[index]
controller.sendCommand("R", "STREAM FILE ")
#populate list frame
#wait for selection of file by user
while controller.isConnected():
try:
controller.listenCommand()
except socket.error:
continue #include try and catch in a loop
else:
if controller.code == "FNF":
break
controller.recvSock.setblocking(1)
while controller.code != "READY":
controller.listenCommand()
controller.sendCommand("S", "PLAY NULL ")
controller.recvSock.setblocking(0)
while controller.isConnected():
buttonPress = int(raw_input(controller.COMMANDPROMPT))
controller.recvSock.setblocking(0)
print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
if buttonPress == 0:
controller.play()
elif buttonPress == 1:
controller.pause()
elif buttonPress == 2:
controller.restart()
elif buttonPress == 3:
controller.disconnectF()
controller.disconnect = True
if(controller.code == "END"):
controller.disconnect = True
controller.sendCommand("S", "DISCONNECT NULL ")
controller.sendCommand("R", "DISCONNECT NULL ")
controller.sendCommand("S", "DISCONNECT NULL ")
controller.sendCommand("R", "DISCONNECT NULL ")
controller.sendCommand("S", "DISCONNECT NULL ")
controller.sendCommand("R", "DISCONNECT NULL ")
controller.sendCommand("S", "DISCONNECT NULL ")
controller.sendCommand("R", "DISCONNECT NULL ")
| 32.73125 | 130 | 0.582204 | 676 | 5,237 | 4.47929 | 0.201183 | 0.098415 | 0.143659 | 0.186262 | 0.225561 | 0.203765 | 0.203765 | 0.178005 | 0.152246 | 0.152246 | 0 | 0.017155 | 0.276494 | 5,237 | 159 | 131 | 32.937107 | 0.782001 | 0.100248 | 0 | 0.237705 | 0 | 0.040984 | 0.181431 | 0.065162 | 0.008197 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.040984 | null | null | 0.081967 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
39709bbf1853da0b896853e72944583fb96a441b | 247 | py | Python | backend/mariokrat/models/player.py | meikyuu/MarioKrat | 36839ffc442f6ca861c1ceb0e1b911d5723cf48a | [
"MIT"
] | null | null | null | backend/mariokrat/models/player.py | meikyuu/MarioKrat | 36839ffc442f6ca861c1ceb0e1b911d5723cf48a | [
"MIT"
] | 5 | 2021-03-30T12:33:53.000Z | 2021-09-22T18:21:46.000Z | backend/mariokrat/models/player.py | meikyuu/MarioKrat | 36839ffc442f6ca861c1ceb0e1b911d5723cf48a | [
"MIT"
] | 2 | 2022-03-14T13:59:53.000Z | 2022-03-14T14:00:17.000Z | from django.db import models
class Player(models.Model):
tournament = models.ForeignKey(
'Tournament', on_delete=models.CASCADE,
related_name='players',
)
number = models.IntegerField()
name = models.TextField()
| 20.583333 | 47 | 0.672065 | 26 | 247 | 6.307692 | 0.730769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218623 | 247 | 11 | 48 | 22.454545 | 0.849741 | 0 | 0 | 0 | 0 | 0 | 0.068826 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.625 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
39746299e2b573fa225d11623903bec33e7fcf29 | 178 | py | Python | app/schemas/utils.py | ninoseki/uzen | 93726f22f43902e17b22dd36142dac05171d0d84 | [
"MIT"
] | 76 | 2020-02-27T06:36:27.000Z | 2022-03-10T20:18:03.000Z | app/schemas/utils.py | ninoseki/uzen | 93726f22f43902e17b22dd36142dac05171d0d84 | [
"MIT"
] | 33 | 2020-03-13T02:04:14.000Z | 2022-03-04T02:06:11.000Z | app/schemas/utils.py | ninoseki/uzen | 93726f22f43902e17b22dd36142dac05171d0d84 | [
"MIT"
] | 6 | 2020-03-17T16:42:25.000Z | 2021-04-27T06:35:46.000Z | from pydantic import BaseModel, Field
class CountResponse(BaseModel):
"""Count"""
count: int = Field(
...,
description="A Total count of items",
)
| 16.181818 | 45 | 0.595506 | 18 | 178 | 5.888889 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.280899 | 178 | 10 | 46 | 17.8 | 0.828125 | 0.02809 | 0 | 0 | 0 | 0 | 0.131737 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3981270e42135ab0df13c69a250e1f6e5ee4f7b3 | 379 | py | Python | luvina/backend/__init__.py | EnjoyLifeFund/py36pkgs | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | luvina/backend/__init__.py | EnjoyLifeFund/py36pkgs | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | luvina/backend/__init__.py | EnjoyLifeFund/py36pkgs | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
from __future__ import print_function
import sys
_BACKEND = 'nltk'
if _BACKEND == 'nltk':
sys.stderr.write('Using NLTK backend.\n')
from .nltk_backend import *
else:
raise ValueError('Unknown backend: ' + str(_BACKEND))
def backend():
"""Public method for determining
the current backend.
"""
return _BACKEND
| 21.055556 | 57 | 0.707124 | 46 | 379 | 5.5 | 0.586957 | 0.079051 | 0.126482 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195251 | 379 | 17 | 58 | 22.294118 | 0.829508 | 0.131926 | 0 | 0 | 0 | 0 | 0.146497 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.363636 | 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 |
398724660340fd5da262f9ee3c6da6f332554b43 | 1,236 | py | Python | pytpp/attributes/code_signing_project.py | Venafi/pytpp | 42af655b2403b8c9447c86962abd4aaa0201f646 | [
"MIT"
] | 4 | 2022-02-04T23:58:55.000Z | 2022-02-15T18:53:08.000Z | pytpp/attributes/code_signing_project.py | Venafi/pytpp | 42af655b2403b8c9447c86962abd4aaa0201f646 | [
"MIT"
] | null | null | null | pytpp/attributes/code_signing_project.py | Venafi/pytpp | 42af655b2403b8c9447c86962abd4aaa0201f646 | [
"MIT"
] | null | null | null | from pytpp.attributes._helper import IterableMeta, Attribute
from pytpp.attributes.top import TopAttributes
class CodeSigningProjectAttributes(TopAttributes, metaclass=IterableMeta):
__config_class__ = "Code Signing Project"
approval_submission_date = Attribute('Approval Submission Date', min_version='21.2')
auditor = Attribute('Auditor', min_version='19.2')
certificate_issue_flow_dn = Attribute('Certificate Issue Flow DN', min_version='19.2')
certificate_owner = Attribute('Certificate Owner', min_version='19.2')
code_signing_application_dn = Attribute('Code Signing Application DN', min_version='19.2')
flow_instance_macro = Attribute('Flow Instance Macro', min_version='19.3')
key_issue_flow_dn = Attribute('Key Issue Flow DN', min_version='19.2')
key_owner = Attribute('Key Owner', min_version='19.2')
key_use_approver = Attribute('Key Use Approver', min_version='19.2')
key_user = Attribute('Key User', min_version='19.2')
owner = Attribute('Owner', min_version='19.2')
project_delete_flow_dn = Attribute('Project Delete Flow DN', min_version='21.1')
purpose = Attribute('Purpose', min_version='19.2')
risk_level = Attribute('Risk Level', min_version='19.2')
status = Attribute('Status', min_version='19.2')
| 56.181818 | 91 | 0.773463 | 172 | 1,236 | 5.30814 | 0.255814 | 0.164294 | 0.170865 | 0.170865 | 0.190581 | 0.052574 | 0.052574 | 0 | 0 | 0 | 0 | 0.040214 | 0.09466 | 1,236 | 21 | 92 | 58.857143 | 0.775693 | 0 | 0 | 0 | 0 | 0 | 0.241909 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.105263 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
3988711ef652132d461d91e1ce96e42cb1fd49e2 | 2,019 | py | Python | app/oauth2/models.py | yishan1331/heroku-yishan-paas | bd46bc8c067999b1dfb83b863b5ba64e76933d0a | [
"MIT"
] | null | null | null | app/oauth2/models.py | yishan1331/heroku-yishan-paas | bd46bc8c067999b1dfb83b863b5ba64e76933d0a | [
"MIT"
] | null | null | null | app/oauth2/models.py | yishan1331/heroku-yishan-paas | bd46bc8c067999b1dfb83b863b5ba64e76933d0a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import time
from sqlalchemy import Column, String, Integer, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from authlib.integrations.sqla_oauth2 import (
OAuth2ClientMixin,
OAuth2AuthorizationCodeMixin,
OAuth2TokenMixin,
)
# import redis
Base = declarative_base()
#客戶API主帳號列表
class SystemList(Base):
__tablename__ = 'system_list'
id = Column(Integer, primary_key=True)
system_name = Column(String(40), unique=True)
system_info = Column(String(128))
def __str__(self):
return self.system_name
def get_system_id(self):
return self.id
def check_password(self, password):
return password == 'valid'
#客戶API主帳號Oauth2 Client列表(client_id&client_secret....)
class OAuth2Client(Base, OAuth2ClientMixin):
__tablename__ = 'oauth2_client'
id = Column(Integer, primary_key=True)
system_id = Column(
Integer, ForeignKey('system_list.id', ondelete='CASCADE'))
sub_account_counts = Column(Integer, nullable=False, default=0)
system_list = relationship('SystemList')
# class OAuth2AuthorizationCode(Base, OAuth2AuthorizationCodeMixin):
# __tablename__ = 'oauth2_code'
# id = Column(Integer, primary_key=True)
# system_id = Column(
# Integer, ForeignKey('system_list.id', ondelete='CASCADE'))
# system_list = relationship('SystemList')
class OAuth2Token(Base, OAuth2TokenMixin):
__tablename__ = 'oauth2_token'
id = Column(Integer, primary_key=True)
system_id = Column(
Integer, ForeignKey('system_list.id', ondelete='CASCADE'))
system_list = relationship('SystemList')
def is_refresh_token_active(self):
if self.revoked:
return False
expires_at = self.issued_at + self.expires_in * 2
return expires_at >= time.time()
# POOL = redis.ConnectionPool(host='192.168.88.75', port=6379, db=0,password="sapido")
# Yishan_dbRedis = redis.Redis(connection_pool=POOL) | 29.26087 | 86 | 0.713224 | 228 | 2,019 | 6.057018 | 0.390351 | 0.075308 | 0.076032 | 0.063722 | 0.291093 | 0.260681 | 0.260681 | 0.235337 | 0.235337 | 0.235337 | 0 | 0.02233 | 0.179297 | 2,019 | 69 | 87 | 29.26087 | 0.811104 | 0.253591 | 0 | 0.230769 | 0 | 0 | 0.068896 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.102564 | false | 0.051282 | 0.128205 | 0.076923 | 0.769231 | 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 |
398ade4f499a43f9a2c94b761110bd1a24df5a61 | 417 | py | Python | kabzimal/rest/views/category.py | arasumran/kabzimal | dbae35fdb940bdf0338bd43983b1894c87a35961 | [
"MIT"
] | null | null | null | kabzimal/rest/views/category.py | arasumran/kabzimal | dbae35fdb940bdf0338bd43983b1894c87a35961 | [
"MIT"
] | 12 | 2020-06-05T23:02:28.000Z | 2022-03-11T23:59:56.000Z | kabzimal/rest/views/category.py | arasumran/kabzimal | dbae35fdb940bdf0338bd43983b1894c87a35961 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from rest_framework.permissions import AllowAny
from rest_framework.viewsets import ModelViewSet
from kabzimal.models import CategoryModel
from kabzimal.rest.serializers.category import CategorySerializers
class CategoryViewSet(ModelViewSet):
search_fields = '__all__'
ordering_fields = '__all__'
serializer_class = CategorySerializers
queryset = CategoryModel.objects.all() | 32.076923 | 66 | 0.800959 | 43 | 417 | 7.465116 | 0.604651 | 0.049844 | 0.105919 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002747 | 0.127098 | 417 | 13 | 67 | 32.076923 | 0.879121 | 0.05036 | 0 | 0 | 0 | 0 | 0.035443 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 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 |
398f86a2d0e79cd0f4a7623be335f6e264b20313 | 5,749 | py | Python | hatemile/util/html/htmldomelement.py | hatemile/HaTeMiLe-for-Python | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | [
"Apache-2.0"
] | 2 | 2018-10-26T02:55:35.000Z | 2021-03-30T07:07:55.000Z | hatemile/util/html/htmldomelement.py | hatemile/HaTeMiLe-for-Python | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | [
"Apache-2.0"
] | null | null | null | hatemile/util/html/htmldomelement.py | hatemile/HaTeMiLe-for-Python | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | [
"Apache-2.0"
] | null | null | null | # 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.
"""
Module of HTMLDOMElement interface.
"""
from .htmldomnode import HTMLDOMNode
class HTMLDOMElement(HTMLDOMNode):
"""
The HTMLDOMElement interface contains the methods for access of the HTML
element.
"""
def get_tag_name(self):
"""
Returns the tag name of element.
:return: The tag name of element in uppercase letters.
:rtype: str
"""
pass
def get_attribute(self, name):
"""
Returns the value of a attribute.
:param name: The name of attribute.
:type name: str
:return: The value of the attribute or None if the element not contains
the attribute.
:rtype: str
"""
pass
def set_attribute(self, name, value):
"""
Create or modify a attribute.
:param name: The name of attribute.
:type name: str
:param value: The value of attribute.
:type value: str
"""
pass
def remove_attribute(self, name):
"""
Remove a attribute of element.
:param name: The name of attribute.
:type name: str
"""
pass
def has_attribute(self, name):
"""
Check that the element has an attribute.
:param name: The name of attribute.
:type name: str
:return: True if the element has the attribute or False if the element
not has the attribute.
:rtype: bool
"""
pass
def has_attributes(self):
"""
Check that the element has attributes.
:return: True if the element has attributes or False if the element not
has attributes.
:rtype: bool
"""
pass
def append_element(self, element):
"""
Append a element child.
:param element: The element that be inserted.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:return: This element.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
pass
def prepend_element(self, element):
"""
Prepend a element child.
:param element: The element that be inserted.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:return: This element.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
pass
def get_children_elements(self):
"""
Returns the elements children of this element.
:return: The elements children of this element.
:rtype: list(hatemile.util.html.htmldomelement.HTMLDOMElement)
"""
pass
def get_children(self):
"""
Returns the children of this element.
:return: The children of this element.
:rtype: list(hatemile.util.html.htmldomnode.HTMLDOMNode)
"""
pass
def normalize(self):
"""
Joins adjacent Text nodes.
:return: This element.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
pass
def has_children_elements(self):
"""
Check that the element has elements children.
:return: True if the element has elements children or False if the
element not has elements children.
:rtype: bool
"""
pass
def has_children(self):
"""
Check that the element has children.
:return: True if the element has children or False if the element not
has children.
:rtype: bool
"""
pass
def get_inner_html(self):
"""
Returns the inner HTML code of this element.
:return: The inner HTML code of this element.
:rtype: str
"""
pass
def get_outer_html(self):
"""
Returns the HTML code of this element.
:return: The HTML code of this element.
:rtype: str
"""
pass
def clone_element(self):
"""
Clone this element.
:return: The clone.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
pass
def get_first_element_child(self):
"""
Returns the first element child of this element.
:return: The first element child of this element.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
pass
def get_last_element_child(self):
"""
Returns the last element child of this element.
:return: The last element child of this element.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
pass
def get_first_node_child(self):
"""
Returns the first node child of this element.
:return: The first node child of this element.
:rtype: hatemile.util.html.htmldomnode.HTMLDOMNode
"""
pass
def get_last_node_child(self):
"""
Returns the last node child of this element.
:return: The last node child of this element.
:rtype: hatemile.util.html.htmldomnode.HTMLDOMNode
"""
pass
| 23.954167 | 79 | 0.594364 | 662 | 5,749 | 5.113293 | 0.18429 | 0.064993 | 0.061448 | 0.079764 | 0.632496 | 0.556869 | 0.496603 | 0.37873 | 0.359232 | 0.283604 | 0 | 0.001038 | 0.329623 | 5,749 | 239 | 80 | 24.054393 | 0.87727 | 0.619238 | 0 | 0.47619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.47619 | false | 0.47619 | 0.02381 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
39946cb9509090d128de507f741845fa334ac528 | 217 | py | Python | uvaonlinejudge/12577.py | andraantariksa/code-exercise-answer | 69b7dbdc081cdb094cb110a72bc0c9242d3d344d | [
"MIT"
] | 1 | 2019-11-06T15:17:48.000Z | 2019-11-06T15:17:48.000Z | uvaonlinejudge/12577.py | andraantariksa/code-exercise-answer | 69b7dbdc081cdb094cb110a72bc0c9242d3d344d | [
"MIT"
] | null | null | null | uvaonlinejudge/12577.py | andraantariksa/code-exercise-answer | 69b7dbdc081cdb094cb110a72bc0c9242d3d344d | [
"MIT"
] | 1 | 2018-11-13T08:43:26.000Z | 2018-11-13T08:43:26.000Z | i = 1
while True:
inp = input()
if inp == "Hajj":
inp = "Hajj-e-Akbar"
elif inp == "Umrah":
inp = "Hajj-e-Asghar"
else:
break
print("Case {}: {}".format(i, inp))
i += 1
| 18.083333 | 39 | 0.447005 | 29 | 217 | 3.344828 | 0.62069 | 0.216495 | 0.164948 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.364055 | 217 | 11 | 40 | 19.727273 | 0.688406 | 0 | 0 | 0 | 0 | 0 | 0.207373 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.090909 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
39986bd00756fe2928054494e06dba5ca1cdd690 | 1,488 | py | Python | src/cobra/apps/organization/summary/views.py | lyoniionly/django-cobra | 2427e5cf74b7739115b1224da3306986b3ee345c | [
"Apache-2.0"
] | 1 | 2015-01-27T08:56:46.000Z | 2015-01-27T08:56:46.000Z | src/cobra/apps/organization/summary/views.py | lyoniionly/django-cobra | 2427e5cf74b7739115b1224da3306986b3ee345c | [
"Apache-2.0"
] | null | null | null | src/cobra/apps/organization/summary/views.py | lyoniionly/django-cobra | 2427e5cf74b7739115b1224da3306986b3ee345c | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import
import calendar
from collections import OrderedDict
import collections
from itertools import groupby
import json
from braces.views import JSONResponseMixin
import datetime
from django import http
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.utils import timezone
from django.utils.dates import MONTHS
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.generic import View
from cobra.core.loading import get_model, get_class
from django.utils.translation import ugettext_lazy as _, ugettext
from django.views import generic
from cobra.views.generic import ProjectView, OrganizationView
from cobra.core.utils import date_from_string, get_datetime_now, get_local_datetime_now
from cobra.core.calendar import get_calendar_first_weekday
from cobra.core.compat import get_user_model
from cobra.core.render import render_to_string
User = get_user_model()
class SummaryReportView(OrganizationView):
def get(self, request, organization, *args, **kwargs):
summary_user = get_object_or_404(User, username__iexact=self.kwargs['username'])
context = {
'active_nav': 'summary_report',
}
template_name = 'organization/summary/summary_report.html'
return self.respond(template_name, context)
| 37.2 | 88 | 0.818548 | 197 | 1,488 | 5.974619 | 0.390863 | 0.093458 | 0.055225 | 0.023789 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004615 | 0.126344 | 1,488 | 39 | 89 | 38.153846 | 0.900769 | 0 | 0 | 0 | 0 | 0 | 0.048387 | 0.026882 | 0 | 0 | 0 | 0 | 0 | 1 | 0.029412 | false | 0 | 0.735294 | 0 | 0.823529 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
39a2f31d1cf9e494a33203842aece56b8a7cc053 | 241 | py | Python | python_to_you/extensions/marshmallow.py | jacksonsr45/python_to_you | f0016e0450f3f2a4ba1f592baff8a9c28ffeaec7 | [
"MIT"
] | 1 | 2021-05-11T12:09:00.000Z | 2021-05-11T12:09:00.000Z | python_to_you/extensions/marshmallow.py | jacksonsr45/python_to_you | f0016e0450f3f2a4ba1f592baff8a9c28ffeaec7 | [
"MIT"
] | null | null | null | python_to_you/extensions/marshmallow.py | jacksonsr45/python_to_you | f0016e0450f3f2a4ba1f592baff8a9c28ffeaec7 | [
"MIT"
] | null | null | null | from typing import NoReturn
from flask_marshmallow import Marshmallow
##
# Creating a instance of the Marshmallow in ma
# #
ma = Marshmallow()
##
# Init ma
# @param app
# @return none
# #
def init_app(app) -> NoReturn:
ma.init_app(app) | 16.066667 | 46 | 0.709544 | 34 | 241 | 4.941176 | 0.558824 | 0.083333 | 0.119048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186722 | 241 | 15 | 47 | 16.066667 | 0.857143 | 0.319502 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
39a528d6734e5b105d62292085624f740c4d18b7 | 783 | py | Python | src/scheduler/rpc/ProcessRpcClientService.py | jedicontributors/pythondataintegrator | 3e877b367ab9b20185476128ec053db41087879f | [
"MIT"
] | null | null | null | src/scheduler/rpc/ProcessRpcClientService.py | jedicontributors/pythondataintegrator | 3e877b367ab9b20185476128ec053db41087879f | [
"MIT"
] | null | null | null | src/scheduler/rpc/ProcessRpcClientService.py | jedicontributors/pythondataintegrator | 3e877b367ab9b20185476128ec053db41087879f | [
"MIT"
] | null | null | null | import rpyc
from injector import inject
from infrastructor.dependency.scopes import IScoped
from models.configs.ProcessRpcClientConfig import ProcessRpcClientConfig
class ProcessRpcClientService(IScoped):
@inject
def __init__(self,
process_rpc_client_config: ProcessRpcClientConfig,
):
self.process_rpc_client_config = process_rpc_client_config
def connect_rpc(self):
conn = rpyc.connect(self.process_rpc_client_config.host, self.process_rpc_client_config.port)
return conn
def call_job_start(self, data_operation_id,job_id,data_operation_job_execution_id ):
conn = self.connect_rpc()
job = conn.root.job_start(data_operation_id,job_id, data_operation_job_execution_id)
return job | 35.590909 | 101 | 0.753512 | 96 | 783 | 5.75 | 0.354167 | 0.09058 | 0.144928 | 0.199275 | 0.358696 | 0.17029 | 0.17029 | 0.17029 | 0.17029 | 0.17029 | 0 | 0 | 0.189017 | 783 | 22 | 102 | 35.590909 | 0.869291 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0.235294 | 0 | 0.588235 | 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 |
39b70d4aba8b1a326038921e81a9f4e1e7248eb3 | 595 | py | Python | bullseyeapp/migrations/0004_auto_20220102_1130.py | theresnotime/bullseye | 930fbaf5dcb62cde512c975795b0403c97903ec3 | [
"MIT"
] | 2 | 2021-08-23T22:32:56.000Z | 2021-09-19T21:47:15.000Z | bullseyeapp/migrations/0004_auto_20220102_1130.py | theresnotime/bullseye | 930fbaf5dcb62cde512c975795b0403c97903ec3 | [
"MIT"
] | 7 | 2021-08-25T16:47:46.000Z | 2022-03-10T04:13:34.000Z | bullseyeapp/migrations/0004_auto_20220102_1130.py | theresnotime/bullseye | 930fbaf5dcb62cde512c975795b0403c97903ec3 | [
"MIT"
] | 3 | 2021-09-19T16:42:47.000Z | 2022-03-02T03:17:38.000Z | # Generated by Django 3.2.6 on 2022-01-02 16:30
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bullseyeapp', '0003_alter_monthlystats_month'),
]
operations = [
migrations.AlterField(
model_name='monthlystats',
name='month',
field=models.DateField(default=datetime.date(2022, 1, 1)),
),
migrations.AlterField(
model_name='monthlystats',
name='name',
field=models.CharField(max_length=255),
),
]
| 23.8 | 70 | 0.598319 | 60 | 595 | 5.833333 | 0.65 | 0.114286 | 0.142857 | 0.165714 | 0.257143 | 0.257143 | 0 | 0 | 0 | 0 | 0 | 0.066194 | 0.289076 | 595 | 24 | 71 | 24.791667 | 0.761229 | 0.07563 | 0 | 0.333333 | 1 | 0 | 0.133212 | 0.05292 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.277778 | 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 |
39b95b1be268dd24dc5908667acc61730b0e2c0c | 2,557 | py | Python | pypress/blog/blueprint/AuthApi.py | klvdan/demos | 96fdc5f272da217cf61260fc6d59fb4fde8f3773 | [
"MIT"
] | null | null | null | pypress/blog/blueprint/AuthApi.py | klvdan/demos | 96fdc5f272da217cf61260fc6d59fb4fde8f3773 | [
"MIT"
] | null | null | null | pypress/blog/blueprint/AuthApi.py | klvdan/demos | 96fdc5f272da217cf61260fc6d59fb4fde8f3773 | [
"MIT"
] | null | null | null | import functools
from flask import (
request, g, redirect, url_for,
flash, render_template,
Blueprint, session
)
from werkzeug.security import check_password_hash, generate_password_hash
from blog.model import User
from blog.db import db_session
bp = Blueprint('auth', __name__, url_prefix='/auth')
@bp.route('/register', methods=['GET', 'POST'])
def register():
if request.method == 'POST':
"""register"""
username = request.form['username']
password = request.form['password']
err = None
if not username:
err = 'Username is required!'
elif not password:
err = 'Password is required!'
elif db_session.query(User)\
.filter_by(username=username)\
.first() is not None:
err = 'User {} is already registered!'.format(username)
if err is None:
user = User(username=username, password=generate_password_hash(password))
db_session.add(user)
db_session.commit()
return redirect(url_for('auth.login'))
flash(err)
return render_template('auth/register.html')
@bp.route('/login', methods=['GET','POST'])
def login():
if request.method == 'POST':
"""login"""
username = request.form['username']
password = request.form['password']
err = None
user = db_session.query(User)\
.filter_by(username=username) \
.first()
if not username:
err = 'Username is required!'
elif not password:
err = 'Password is required!'
elif user is None:
err = 'User {} is not exists!'.format(username)
elif not check_password_hash(user.password, password):
err = 'Password is incorrect!'
if err is None:
session.clear()
session['uid'] = user.id
return redirect(url_for('home'))
flash(err)
return render_template('auth/login.html')
@bp.before_app_request
def load_logged_in_user():
uid = session.get('uid')
if uid is None:
g.user = None
else:
g.user = db_session.query(User) \
.filter_by(id=uid) \
.first()
@bp.route('/logout')
def logout():
session.clear()
return redirect(url_for('home'))
def login_required(fn):
@functools.wraps(fn)
def wrapper(**kwargs):
if not g.user:
return redirect(url_for('auth.login'))
return fn(**kwargs)
return wrapper
| 26.915789 | 85 | 0.581541 | 296 | 2,557 | 4.902027 | 0.246622 | 0.037216 | 0.048243 | 0.055134 | 0.391454 | 0.358374 | 0.274294 | 0.250861 | 0.250861 | 0.186079 | 0 | 0 | 0.29605 | 2,557 | 94 | 86 | 27.202128 | 0.806111 | 0 | 0 | 0.405405 | 1 | 0 | 0.122433 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.081081 | false | 0.135135 | 0.067568 | 0 | 0.256757 | 0.027027 | 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 |
39bdd3526bf2ddd7e129378c327c33a76b7e1893 | 675 | py | Python | tests/test_basic.py | blue-yonder/cee_syslog_handler | ae46bf37cfc32f71e1bd9be6dfd24266d1779ccb | [
"BSD-3-Clause"
] | 7 | 2015-03-11T09:26:25.000Z | 2020-04-10T21:21:33.000Z | tests/test_basic.py | blue-yonder/cee_syslog_handler | ae46bf37cfc32f71e1bd9be6dfd24266d1779ccb | [
"BSD-3-Clause"
] | 5 | 2015-03-05T10:36:25.000Z | 2020-10-15T15:00:00.000Z | tests/test_basic.py | blue-yonder/cee_syslog_handler | ae46bf37cfc32f71e1bd9be6dfd24266d1779ccb | [
"BSD-3-Clause"
] | 6 | 2015-03-05T07:50:05.000Z | 2020-11-06T09:33:30.000Z | from cee_syslog_handler import get_fields
class Record(object):
def __init__(self, value=None):
if value:
self.some_column = value
def check_single_value(value):
record = Record(value)
message_dict = get_fields({}, record)
assert message_dict == {"_some_column": value}
def test_get_fields_empty():
record = Record()
message_dict = get_fields({}, record)
assert message_dict == {}
def test_string_types():
check_single_value("some_text")
check_single_value(u"some_text")
check_single_value("1")
check_single_value("1.1")
def test_numeric_types():
check_single_value(1.1)
check_single_value(1)
| 21.09375 | 50 | 0.693333 | 92 | 675 | 4.663043 | 0.336957 | 0.179487 | 0.261072 | 0.158508 | 0.438228 | 0.200466 | 0.200466 | 0.200466 | 0 | 0 | 0 | 0.01107 | 0.197037 | 675 | 31 | 51 | 21.774194 | 0.780443 | 0 | 0 | 0.095238 | 0 | 0 | 0.05037 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 1 | 0.238095 | false | 0 | 0.047619 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
39e8d5ff18e29806b418aa0a18a2e30af9a0cefa | 183 | py | Python | coders/curso_python/manipulacao_arquivos/io_v3.py | flaviogf/Cursos | 2b120dbcd24a907121f58482fdcdfa01b164872c | [
"MIT"
] | 2 | 2021-02-20T23:50:07.000Z | 2021-08-15T03:04:35.000Z | coders/curso_python/manipulacao_arquivos/io_v3.py | flaviogf/Cursos | 2b120dbcd24a907121f58482fdcdfa01b164872c | [
"MIT"
] | 18 | 2019-08-07T02:33:00.000Z | 2021-03-18T22:52:38.000Z | coders/curso_python/manipulacao_arquivos/io_v3.py | flaviogf/Cursos | 2b120dbcd24a907121f58482fdcdfa01b164872c | [
"MIT"
] | 2 | 2020-09-28T13:00:09.000Z | 2021-12-30T12:21:08.000Z | #!/usr/local/bin/python3
try:
arquivo = open('pessoas.csv')
for it in arquivo:
print('Nome {}, Idade {}'.format(*it.strip().split(',')))
finally:
arquivo.close()
| 20.333333 | 65 | 0.584699 | 23 | 183 | 4.652174 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006803 | 0.196721 | 183 | 8 | 66 | 22.875 | 0.721088 | 0.125683 | 0 | 0 | 0 | 0 | 0.18239 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 |
39ea648c2bf6f784daa33c862d390b68763b3db2 | 196 | py | Python | generator/templates/control/delete.py | wancy86/tornado-seed | bea842f4ba6b23dda53ec9ae9f1349e1d2b54fd3 | [
"MIT"
] | null | null | null | generator/templates/control/delete.py | wancy86/tornado-seed | bea842f4ba6b23dda53ec9ae9f1349e1d2b54fd3 | [
"MIT"
] | null | null | null | generator/templates/control/delete.py | wancy86/tornado-seed | bea842f4ba6b23dda53ec9ae9f1349e1d2b54fd3 | [
"MIT"
] | null | null | null | @authenticated
def delete(self):
model = self.db.query([model_name]).filter([delete_filter]).first()
self.db.delete(model)
self.db.commit()
return JsonResponse(self, '000') | 32.666667 | 72 | 0.663265 | 25 | 196 | 5.12 | 0.56 | 0.140625 | 0.171875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018519 | 0.173469 | 196 | 6 | 73 | 32.666667 | 0.771605 | 0 | 0 | 0 | 0 | 0 | 0.015625 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
39eef9fe5bd2775cc2099c0d9b3090d6a17144ee | 747 | py | Python | caffe-dslt/examples/test.py | JHvisionchen/DSLT-matlab | 6cf80298d01651085fa27d6bd59fb1f2dd1a0d9e | [
"Apache-2.0"
] | 1 | 2019-03-18T00:30:33.000Z | 2019-03-18T00:30:33.000Z | caffe-dslt/examples/test.py | JHvisionchen/DSLT-matlab | 6cf80298d01651085fa27d6bd59fb1f2dd1a0d9e | [
"Apache-2.0"
] | null | null | null | caffe-dslt/examples/test.py | JHvisionchen/DSLT-matlab | 6cf80298d01651085fa27d6bd59fb1f2dd1a0d9e | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 1 22:05:35 2016
@author: luxiankai
"""
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
# Make sure that caffe is on the python path:
caffe_root = '../' # this file is expected to be in {caffe_root}/examples
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
plt.rcParams['figure.figsize'] = (10, 10)
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
import os
MEAN_FILE=caffe_root+'examples/ResNet/ResNet_mean.binaryproto'
mean_blob = caffe.proto.caffe_pb2.BlobProto()
mean_blob.ParseFromString(open(MEAN_FILE, 'rb').read())
# 将均值blob转为numpy.array
mean_npy = caffe.io.blobproto_to_array(mean_blob)
print mean_npy.shape
| 24.096774 | 74 | 0.742972 | 114 | 747 | 4.736842 | 0.596491 | 0.066667 | 0.062963 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027397 | 0.120482 | 747 | 30 | 75 | 24.9 | 0.794521 | 0.210174 | 0 | 0 | 0 | 0 | 0.2 | 0.075 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 0.066667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
39ef7ba40d7f30468fbf11d748527163a76b9e6e | 618 | py | Python | uil/vue/views.py | UiL-OTS-labs/django-shared-core | 702ca346f1be861108ec70ceed2ed3b99623f0a3 | [
"Apache-2.0"
] | null | null | null | uil/vue/views.py | UiL-OTS-labs/django-shared-core | 702ca346f1be861108ec70ceed2ed3b99623f0a3 | [
"Apache-2.0"
] | 13 | 2019-06-25T13:23:30.000Z | 2022-02-10T07:00:39.000Z | uil/vue/views.py | UiL-OTS-labs/django-shared-core | 702ca346f1be861108ec70ceed2ed3b99623f0a3 | [
"Apache-2.0"
] | null | null | null | from django.http import HttpResponse
from django.views import generic
from uil.vue.utils import get_vue_js, get_vue_css
class VueJSView(generic.View):
def get(self, request, component, *args, **kwargs):
from uil.vue.components import Vue
c = Vue.get_component(component)
return HttpResponse(get_vue_js(c), content_type='text/javascript')
class VueCSSView(generic.View):
def get(self, request, component, *args, **kwargs):
from uil.vue.components import Vue
c = Vue.get_component(component)
return HttpResponse(get_vue_css(c), content_type='text/css')
| 24.72 | 74 | 0.710356 | 85 | 618 | 5.023529 | 0.352941 | 0.056206 | 0.070258 | 0.079625 | 0.58548 | 0.58548 | 0.58548 | 0.58548 | 0.58548 | 0.58548 | 0 | 0 | 0.187702 | 618 | 24 | 75 | 25.75 | 0.850598 | 0 | 0 | 0.461538 | 0 | 0 | 0.037277 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.384615 | 0 | 0.846154 | 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 |
f2d1e7ce61a1ea8fbcb06809ca95790f1dffb8fc | 1,326 | py | Python | index.py | gerroo/python-battleship | cbe4e0ea01fd75d08b15c38cfc7c371da9d43d64 | [
"MIT"
] | null | null | null | index.py | gerroo/python-battleship | cbe4e0ea01fd75d08b15c38cfc7c371da9d43d64 | [
"MIT"
] | null | null | null | index.py | gerroo/python-battleship | cbe4e0ea01fd75d08b15c38cfc7c371da9d43d64 | [
"MIT"
] | null | null | null | print("""
To play multiplayer and become server enter 1
To play multiplayer and connect enter 2
To play with a bot enter 3
""")
DEBUG = 1 #For release set this to 0
def dbgPrint(x):
if DEBUG:
print(x)
import socket, threading
firstInput = int(input("->"))
dbgPrint("First input is {0}".format(firstInput))
if firstInput == 1:
multiServer()
elif firstInput == 2:
multiClient()
elif firstInput == 3:
bot()
def multiServer():
pass
def multiClient():
pass
def bot():
pass
#NOTES: use threading for network interface and ui consider pygame for gui
class networkManager:
def __init__(self, clientOrServer):
dbgPrint("New network manager")
def clientGetterLoop(clientsocket):
pass
def client(self):
clientsocket = socket.socket(
socket.AF_INET,
socket.SOCK_STREAM
)
host =
port = 15560
try:
clientsocket.connect((host,port)) # Connect to h
except Exception as e:
dbgPrint(e)
print("Connection Error")
t = threading.Thread(run= clientGetterLoop)
message = clientsocket.recv(1024).decode('ascii') # Receive 1024 bytes
clientsocket.send(message.encode('ascii')) # Send message
clientsocket.close()
class uiManager:
pass
| 20.4 | 78 | 0.634992 | 156 | 1,326 | 5.358974 | 0.544872 | 0.021531 | 0.04067 | 0.047847 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02268 | 0.268477 | 1,326 | 64 | 79 | 20.71875 | 0.839175 | 0.107843 | 0 | 0.106383 | 0 | 0 | 0.151952 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.106383 | 0.021277 | null | null | 0.06383 | 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 |
f2d2d7048037f4259f2e8cc132f0bb1c8f8b52d5 | 1,331 | py | Python | tests/features/notice_eligibility_checker/test_notice_ineligibility.py | meaningfy-ws/ted-xml-2-rdf | ac26a19f3761b7cf79d79a46be6323b658f067eb | [
"Apache-2.0"
] | 1 | 2022-03-21T12:32:52.000Z | 2022-03-21T12:32:52.000Z | tests/features/notice_eligibility_checker/test_notice_ineligibility.py | meaningfy-ws/ted-xml-2-rdf | ac26a19f3761b7cf79d79a46be6323b658f067eb | [
"Apache-2.0"
] | 24 | 2022-02-10T10:43:56.000Z | 2022-03-29T12:36:21.000Z | tests/features/notice_eligibility_checker/test_notice_ineligibility.py | meaningfy-ws/ted-sws | d1e351eacb2900f84ec7edc457e49d8202fbaff5 | [
"Apache-2.0"
] | null | null | null | from pytest_bdd import scenario, given, when, then
from ted_sws.core.model.notice import NoticeStatus
from ted_sws.metadata_normaliser.services.metadata_normalizer import MetadataNormaliser
from ted_sws.notice_eligibility.services.notice_eligibility import notice_eligibility_checker
@scenario('test_notice_eligibility_validation_tests.feature', 'not finding validation tests set for a TED XML notice')
def test_ineligibility():
"""not finding validation tests set for a TED XML notice"""
@given("a notice", target_fixture="ineligibility_notice")
def step_impl(f18_notice_2022):
return f18_notice_2022
@when("checking process is executed", target_fixture="ineligibility_result")
def step_impl(ineligibility_notice, notice_storage, mapping_suite_repository_in_file_system):
MetadataNormaliser(notice=ineligibility_notice).normalise_metadata()
return notice_eligibility_checker(notice=ineligibility_notice,
mapping_suite_repository=mapping_suite_repository_in_file_system)
@then("validation tests set is not found")
def step_impl(ineligibility_result):
assert ineligibility_result is None
@then("notice status INELIGIBLE_FOR_TRANSFORMATION")
def step_impl(ineligibility_notice):
assert ineligibility_notice.status == NoticeStatus.INELIGIBLE_FOR_TRANSFORMATION
| 40.333333 | 118 | 0.817431 | 165 | 1,331 | 6.266667 | 0.357576 | 0.110251 | 0.042553 | 0.069633 | 0.208897 | 0.15087 | 0.085106 | 0.085106 | 0.085106 | 0.085106 | 0 | 0.010213 | 0.117205 | 1,331 | 32 | 119 | 41.59375 | 0.869787 | 0.03982 | 0 | 0 | 0 | 0 | 0.198899 | 0.060535 | 0 | 0 | 0 | 0 | 0.1 | 1 | 0.25 | false | 0 | 0.2 | 0.05 | 0.55 | 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 |
f2deff557137ac9a00474fc127698a28a55ff990 | 474 | py | Python | scripts/add_trimmed_read_paths.py | jtevns/Metagenomics-Workflow | 883a52ae3e245dccff6d5ef883544d52a8b63633 | [
"MIT"
] | null | null | null | scripts/add_trimmed_read_paths.py | jtevns/Metagenomics-Workflow | 883a52ae3e245dccff6d5ef883544d52a8b63633 | [
"MIT"
] | 15 | 2021-02-26T08:27:33.000Z | 2021-03-15T13:48:12.000Z | scripts/add_trimmed_read_paths.py | jtevns/Metagenomics-Workflow | 883a52ae3e245dccff6d5ef883544d52a8b63633 | [
"MIT"
] | null | null | null | import sys
line_count = 0
with open(sys.argv[1]) as f:
for line in f:
if line_count > 0:
split_line = line.strip().split(",")
split_line.append("trimmed_reads/"+split_line[0]+"/"+split_line[0]+"_trimmed_R1.fastq")
split_line.append("trimmed_reads/"+split_line[0]+"/"+split_line[0]+"_trimmed_R2.fastq")
print(",".join(split_line))
else:
print(line.strip())
line_count = line_count + 1
| 31.6 | 99 | 0.586498 | 66 | 474 | 3.939394 | 0.378788 | 0.276923 | 0.153846 | 0.169231 | 0.415385 | 0.415385 | 0.415385 | 0.415385 | 0.415385 | 0.415385 | 0 | 0.028249 | 0.253165 | 474 | 14 | 100 | 33.857143 | 0.706215 | 0 | 0 | 0 | 0 | 0 | 0.139241 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.083333 | 0 | 0.083333 | 0.166667 | 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 |
f2f7368abcbab7dc2aa41aa42c2ef77662f37f29 | 452 | py | Python | projects/signals.py | Ngapa/upkoding | 07e235869a94a7a17f37bc064c31ac2628440e58 | [
"MIT"
] | null | null | null | projects/signals.py | Ngapa/upkoding | 07e235869a94a7a17f37bc064c31ac2628440e58 | [
"MIT"
] | null | null | null | projects/signals.py | Ngapa/upkoding | 07e235869a94a7a17f37bc064c31ac2628440e58 | [
"MIT"
] | null | null | null | from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import UserProject, UserProjectEvent
# @receiver(post_save, sender=UserProject, dispatch_uid='user_project_event')
# def create_user_project_event(sender, instance, created, **kwargs):
# if created:
# print('Project started')
# else:
# print(instance.requirements)
# print(instance._original_values.get('requirements'))
| 32.285714 | 77 | 0.74115 | 52 | 452 | 6.25 | 0.576923 | 0.061538 | 0.098462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154867 | 452 | 13 | 78 | 34.769231 | 0.850785 | 0.663717 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
f2f74bcc02a94518e572b244b6dca65cc9b89550 | 877 | py | Python | src/features/log_transform.py | onurerkin/prohack | 51665841de04de4a7d44a3aeacec8e9142110cea | [
"MIT"
] | null | null | null | src/features/log_transform.py | onurerkin/prohack | 51665841de04de4a7d44a3aeacec8e9142110cea | [
"MIT"
] | null | null | null | src/features/log_transform.py | onurerkin/prohack | 51665841de04de4a7d44a3aeacec8e9142110cea | [
"MIT"
] | null | null | null | # region imports
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import norm
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_log_error
from sklearn import preprocessing
from sklearn.model_selection import cross_val_score, cross_val_predict
import lightgbm
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import IterativeImputer
from src.features.impute_columns import (impute_categorical_columns, impute_numeric_columns)
from src.contracts.Dataset import Dataset
from src.features.standardize import standardize
from src.features.label_encoder import MultiColumnLabelEncoder
# endregion
def create_log_transform(full_ds, column_name):
full_ds[column_name + '_log'] = np.log(full_ds[column_name]+3)
return full_ds | 30.241379 | 92 | 0.849487 | 126 | 877 | 5.68254 | 0.492063 | 0.092179 | 0.062849 | 0.067039 | 0.086592 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001279 | 0.108324 | 877 | 29 | 93 | 30.241379 | 0.914322 | 0.027366 | 0 | 0 | 0 | 0 | 0.0047 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0.85 | 0 | 0.95 | 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 |
840e3e92339d6c3635dffee4c74621caca209267 | 94 | py | Python | python_lessons/freecodecamp_python/014_dict_object_d_for_in_print.py | 1986MMartin/coding-sections-markus | e13be32e5d83e69250ecfb3c76a04ee48a320607 | [
"Apache-2.0"
] | null | null | null | python_lessons/freecodecamp_python/014_dict_object_d_for_in_print.py | 1986MMartin/coding-sections-markus | e13be32e5d83e69250ecfb3c76a04ee48a320607 | [
"Apache-2.0"
] | null | null | null | python_lessons/freecodecamp_python/014_dict_object_d_for_in_print.py | 1986MMartin/coding-sections-markus | e13be32e5d83e69250ecfb3c76a04ee48a320607 | [
"Apache-2.0"
] | null | null | null | d = dict()
d['quincy'] = 1
d['beau'] = 5
d['kris'] = 9
for (k,i) in d.items():
print(k, i) | 15.666667 | 23 | 0.478723 | 20 | 94 | 2.25 | 0.7 | 0.088889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041096 | 0.223404 | 94 | 6 | 24 | 15.666667 | 0.575342 | 0 | 0 | 0 | 0 | 0 | 0.147368 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 |
841155db262189fb66615b0ad5b651fc09efa6c0 | 642 | py | Python | src/__init__.py | dxas90/hugtor | 5a68f794ede055a4363425d48e4ea87abb9a8e38 | [
"Apache-2.0"
] | null | null | null | src/__init__.py | dxas90/hugtor | 5a68f794ede055a4363425d48e4ea87abb9a8e38 | [
"Apache-2.0"
] | null | null | null | src/__init__.py | dxas90/hugtor | 5a68f794ede055a4363425d48e4ea87abb9a8e38 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import atexit
import os
from .app import api
from .tor import TorController
__version__ = '0.0.1'
APP_PORT = os.environ.get('APP_PORT', 5055)
APP_HIDDEN_SERVICE_PORT = os.environ.get('APP_HIDDEN_SERVICE_PORT', 80)
APP_HIDDEN_SERVICE_KEY_PATH = os.environ.get('APP_HIDDEN_SERVICE_KEY_PATH',
'my_service_key')
controler = TorController(api, APP_PORT, APP_HIDDEN_SERVICE_PORT,
APP_HIDDEN_SERVICE_KEY_PATH)
application = controler.__hug_wsgi__
@atexit.register
def cleanup():
try:
controler.stop()
except Exception:
pass
| 24.692308 | 75 | 0.672897 | 83 | 642 | 4.783133 | 0.433735 | 0.13602 | 0.241814 | 0.11335 | 0.332494 | 0.141058 | 0 | 0 | 0 | 0 | 0 | 0.020325 | 0.233645 | 642 | 25 | 76 | 25.68 | 0.786585 | 0.03271 | 0 | 0 | 0 | 0 | 0.124394 | 0.080775 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0.055556 | 0.222222 | 0 | 0.277778 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
8414120bdc9bf79ac8b36ff738eab5188bd73714 | 344 | py | Python | runoob/basic_tutorial/test.py | zeroonegit/python | 919f8bb14ae91e37e42ff08192df24b60135596f | [
"MIT"
] | 1 | 2017-03-30T00:43:40.000Z | 2017-03-30T00:43:40.000Z | runoob/basic_tutorial/test.py | QuinceySun/Python | 919f8bb14ae91e37e42ff08192df24b60135596f | [
"MIT"
] | null | null | null | runoob/basic_tutorial/test.py | QuinceySun/Python | 919f8bb14ae91e37e42ff08192df24b60135596f | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author by: One Zero
# Filename: test.py
## 用户输入数字
#num1 = input('输入第一个数字: ')
#num2 = input('输入第二个数字: ')
#
## 求和
#sum = float(num1) + float(num2)
#
## 显示计算结果
#print('数字 {0} 和 {1} 相加结果为: {2}'.format(num1, num2, sum))
print('两数之和为 %.1f' % (float(input('输入第一个数字: ')) + float(input('输入第二个数字: '))))
| 20.235294 | 77 | 0.584302 | 48 | 344 | 4.1875 | 0.708333 | 0.119403 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041379 | 0.156977 | 344 | 16 | 78 | 21.5 | 0.651724 | 0.68314 | 0 | 0 | 0 | 0 | 0.301075 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
844994d390955a1304d9bf7395fcf0cfbf57a3f6 | 5,217 | py | Python | usuarios/migrations/0001_initial.py | mfeduardo/aluguetaxi | 488beda92ac19e3d37a8555469b4defebbbf0b34 | [
"MIT"
] | null | null | null | usuarios/migrations/0001_initial.py | mfeduardo/aluguetaxi | 488beda92ac19e3d37a8555469b4defebbbf0b34 | [
"MIT"
] | null | null | null | usuarios/migrations/0001_initial.py | mfeduardo/aluguetaxi | 488beda92ac19e3d37a8555469b4defebbbf0b34 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.6 on 2021-08-04 21:31
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateModel(
name='Usuario',
fields=[
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('nome', models.CharField(max_length=255)),
('sobrenome', models.CharField(blank=True, max_length=255, null=True)),
('email', models.CharField(max_length=255, unique=True)),
('telefone', models.CharField(blank=True, max_length=255, null=True)),
('telefone2', models.CharField(blank=True, max_length=255, null=True)),
('cpf', models.CharField(blank=True, max_length=255, null=True)),
('licenca', models.CharField(blank=True, max_length=255, null=True)),
('foto', models.CharField(blank=True, max_length=255, null=True)),
('data_nascimento', models.DateField(blank=True, null=True)),
('tipo_pessoa', models.CharField(blank=True, max_length=255, null=True)),
('categoria', models.CharField(blank=True, max_length=255, null=True)),
('password', models.CharField(blank=True, max_length=255, null=True)),
('admin', models.BooleanField(blank=True, null=True)),
('nivel', models.IntegerField(blank=True, null=True)),
('slug', models.CharField(blank=True, max_length=255, null=True)),
('endereco', models.CharField(blank=True, max_length=255, null=True)),
('cidade', models.CharField(blank=True, max_length=255, null=True)),
('cidade_id', models.CharField(blank=True, max_length=255, null=True)),
('uf_id', models.CharField(blank=True, max_length=255, null=True)),
('uf', models.CharField(blank=True, max_length=255, null=True)),
('uf_nome', models.CharField(blank=True, max_length=255, null=True)),
('promo', models.BooleanField(blank=True, null=True)),
('promo_extra', models.CharField(blank=True, max_length=255, null=True)),
('contagem_anuncios', models.IntegerField(blank=True, null=True)),
('lista_automoveis', models.CharField(blank=True, max_length=255, null=True)),
('newsletter', models.BooleanField(blank=True, null=True)),
('sobre', models.CharField(blank=True, max_length=255, null=True)),
('zap', models.CharField(blank=True, max_length=255, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('deleted_at', models.DateTimeField(blank=True, null=True)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]
| 69.56 | 329 | 0.634081 | 599 | 5,217 | 5.383973 | 0.283806 | 0.089302 | 0.136434 | 0.163721 | 0.502636 | 0.468527 | 0.368372 | 0.338605 | 0.338605 | 0.133953 | 0 | 0.02442 | 0.222925 | 5,217 | 74 | 330 | 70.5 | 0.77109 | 0.008626 | 0 | 0.029851 | 1 | 0 | 0.209671 | 0.007157 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.014925 | 0.074627 | 0 | 0.134328 | 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 |
846144bdce5626421043fe97eb46424bccb50cba | 5,567 | py | Python | _gen.py | vgarvardt/x11colors-go | 85d93120298e9bffe7827abbdfb8318855c0f397 | [
"MIT"
] | 1 | 2021-02-27T14:47:10.000Z | 2021-02-27T14:47:10.000Z | _gen.py | vgarvardt/x11colors-go | 85d93120298e9bffe7827abbdfb8318855c0f397 | [
"MIT"
] | null | null | null | _gen.py | vgarvardt/x11colors-go | 85d93120298e9bffe7827abbdfb8318855c0f397 | [
"MIT"
] | null | null | null | from collections import OrderedDict
# values copied from the
# https://ru.wikipedia.org/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_%D1%86%D0%B2%D0%B5%D1%82%D0%BE%D0%B2_%D0%B2_X11#%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_%D1%86%D0%B2%D0%B5%D1%82%D0%BE%D0%B2_[2]
raw = """
Alice Blue #F0F8FF 240 248 255
Antique White #FAEBD7 250 235 215
Aqua #00FFFF 0 255 255
Aquamarine #7FFFD4 127 255 212
Azure #F0FFFF 240 255 255
Beige #F5F5DC 245 245 220
Bisque #FFE4C4 255 228 196
Black #000000 0 0 0
Blanched Almond #FFEBCD 255 235 205
Blue #0000FF 0 0 255
Blue Violet #8A2BE2 138 43 226
Brown #A52A2A 165 42 42
Burlywood #DEB887 222 184 135
Cadet Blue #5F9EA0 95 158 160
Chartreuse #7FFF00 127 255 0
Chocolate #D2691E 210 105 30
Coral #FF7F50 255 127 80
Cornflower #6495ED 100 149 237
Cornsilk #FFF8DC 255 248 220
Crimson #DC143C 220 20 60
Cyan #00FFFF 0 255 255
Dark Blue #00008B 0 0 139
Dark Cyan #008B8B 0 139 139
Dark Goldenrod #B8860B 184 134 11
Dark Gray #A9A9A9 169 169 169
Dark Green #006400 0 100 0
Dark Khaki #BDB76B 189 183 107
Dark Magenta #8B008B 139 0 139
Dark Olive Green #556B2F 85 107 47
Dark Orange #FF8C00 255 140 0
Dark Orchid #9932CC 153 50 204
Dark Red #8B0000 139 0 0
Dark Salmon #E9967A 233 150 122
Dark Sea Green #8FBC8F 143 188 143
Dark Slate Blue #483D8B 72 61 139
Dark Slate Gray #2F4F4F 47 79 79
Dark Turquoise #00CED1 0 206 209
Dark Violet #9400D3 148 0 211
Deep Pink #FF1493 255 20 147
Deep Sky Blue #00BFFF 0 191 255
Dim Gray #696969 105 105 105
Dodger Blue #1E90FF 30 144 255
Firebrick #B22222 178 34 34
Floral White #FFFAF0 255 250 240
Forest Green #228B22 34 139 34
Fuchsia #FF00FF 255 0 255
Gainsboro #DCDCDC 220 220 220
Ghost White #F8F8FF 248 248 255
Gold #FFD700 255 215 0
Goldenrod #DAA520 218 165 32
Gray (X11) #BEBEBE 190 190 190
Gray (W3C) #7F7F7F 127 127 127
Green (X11) #00FF00 0 255 0
Green (W3C) #007F00 0 127 0
Green Yellow #ADFF2F 173 255 47
Honeydew #F0FFF0 240 255 240
Hot Pink #FF69B4 255 105 180
Indian Red #CD5C5C 205 92 92
Indigo #4B0082 75 0 130
Ivory #FFFFF0 255 255 240
Khaki #F0E68C 240 230 140
Lavender #E6E6FA 230 230 250
Lavender Blush #FFF0F5 255 240 245
Lawn Green #7CFC00 124 252 0
Lemon Chiffon #FFFACD 255 250 205
Light Blue #ADD8E6 173 216 230
Light Coral #F08080 240 128 128
Light Cyan #E0FFFF 224 255 255
Light Goldenrod #FAFAD2 250 250 210
Light Gray #D3D3D3 211 211 211
Light Green #90EE90 144 238 144
Light Pink #FFB6C1 255 182 193
Light Salmon #FFA07A 255 160 122
Light Sea Green #20B2AA 32 178 170
Light Sky Blue #87CEFA 135 206 250
Light Slate Gray #778899 119 136 153
Light Steel Blue #B0C4DE 176 196 222
Light Yellow #FFFFE0 255 255 224
Lime #00FF00 0 255 0
Lime Green #32CD32 50 205 50
Linen #FAF0E6 250 240 230
Magenta #FF00FF 255 0 255
Maroon (X11) #B03060 176 48 96
Maroon (W3C) #7F0000 127 0 0
Medium Aquamarine #66CDAA 102 205 170
Medium Blue #0000CD 0 0 205
Medium Orchid #BA55D3 186 85 211
Medium Purple #9370DB 147 112 219
Medium Sea Green #3CB371 60 179 113
Medium Slate Blue #7B68EE 123 104 238
Medium Spring Green #00FA9A 0 250 154
Medium Turquoise #48D1CC 72 209 204
Medium Violet Red #C71585 199 21 133
Midnight Blue #191970 25 25 112
Mint Cream #F5FFFA 245 255 250
Misty Rose #FFE4E1 255 228 225
Moccasin #FFE4B5 255 228 181
Navajo White #FFDEAD 255 222 173
Navy #000080 0 0 128
Old Lace #FDF5E6 253 245 230
Olive #808000 128 128 0
Olive Drab #6B8E23 107 142 35
Orange #FFA500 255 165 0
Orange Red #FF4500 255 69 0
Orchid #DA70D6 218 112 214
Pale Goldenrod #EEE8AA 238 232 170
Pale Green #98FB98 152 251 152
Pale Turquoise #AFEEEE 175 238 238
Pale Violet Red #DB7093 219 112 147
Papaya Whip #FFEFD5 255 239 213
Peach Puff #FFDAB9 255 218 185
Peru #CD853F 205 133 63
Pink #FFC0CB 255 192 203
Plum #DDA0DD 221 160 221
Powder Blue #B0E0E6 176 224 230
Purple (X11) #A020F0 160 32 240
Purple (W3C) #7F007F 127 0 127
Red #FF0000 255 0 0
Rosy Brown #BC8F8F 188 143 143
Royal Blue #4169E1 65 105 225
Saddle Brown #8B4513 139 69 19
Salmon #FA8072 250 128 114
Sandy Brown #F4A460 244 164 96
Sea Green #2E8B57 46 139 87
Seashell #FFF5EE 255 245 238
Sienna #A0522D 160 82 45
Silver #C0C0C0 192 192 192
Sky Blue #87CEEB 135 206 235
Slate Blue #6A5ACD 106 90 205
Slate Gray #708090 112 128 144
Snow #FFFAFA 255 250 250
Spring Green #00FF7F 0 255 127
Steel Blue #4682B4 70 130 180
Tan #D2B48C 210 180 140
Teal #008080 0 128 128
Thistle #D8BFD8 216 191 216
Tomato #FF6347 255 99 71
Turquoise #40E0D0 64 224 208
Violet #EE82EE 238 130 238
Wheat #F5DEB3 245 222 179
White #FFFFFF 255 255 255
White Smoke #F5F5F5 245 245 245
Yellow #FFFF00 255 255 0
Yellow Green #9ACD32 154 205 50
"""
var_names = []
name_vars = OrderedDict()
for line in raw.splitlines():
line = line.strip()
if len(line) < 1:
continue
name, color_def = line.split('#')
var_name = name.strip().replace(' ', '', 10).replace('\t', '').replace('(', '').replace(')', '')
color_name = name.strip()
var_names.append(var_name)
name_vars[color_name] = var_name
print('{0} = X11Color{{"{1}", color.RGBA{{0x{2}, 0x{3}, 0x{4}, 0xFF}}, true}}'.format(
var_name,
color_name,
color_def[0:2],
color_def[2:4],
color_def[4:6],
))
print('\n\n' + ',\n'.join(var_names) + '\n\n')
for color_name, var_name in name_vars.items():
print('"{0}": {1},'.format(color_name, var_name))
| 31.275281 | 194 | 0.697862 | 997 | 5,567 | 3.870612 | 0.437312 | 0.013993 | 0.006219 | 0.012438 | 0.024877 | 0.024877 | 0.024877 | 0.024877 | 0.024877 | 0.024877 | 0 | 0.387798 | 0.231543 | 5,567 | 177 | 195 | 31.451977 | 0.514259 | 0.038441 | 0 | 0 | 0 | 0.005952 | 0.871565 | 0 | 0 | 0 | 0.000748 | 0 | 0 | 1 | 0 | false | 0 | 0.005952 | 0 | 0.005952 | 0.017857 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ffc2c95e6d728e1551ee721307f15b771cba1ac7 | 5,156 | py | Python | sdk/python/pulumi_aws/ec2/eip_association.py | Charliekenney23/pulumi-aws | 55bd0390160d27350b297834026fee52114a2d41 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws/ec2/eip_association.py | Charliekenney23/pulumi-aws | 55bd0390160d27350b297834026fee52114a2d41 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws/ec2/eip_association.py | Charliekenney23/pulumi-aws | 55bd0390160d27350b297834026fee52114a2d41 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2021-03-08T15:05:29.000Z | 2021-03-08T15:05:29.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class EipAssociation(pulumi.CustomResource):
allocation_id: pulumi.Output[str]
"""
The allocation ID. This is required for EC2-VPC.
"""
allow_reassociation: pulumi.Output[bool]
"""
Whether to allow an Elastic IP to
be re-associated. Defaults to `true` in VPC.
"""
instance_id: pulumi.Output[str]
"""
The ID of the instance. This is required for
EC2-Classic. For EC2-VPC, you can specify either the instance ID or the
network interface ID, but not both. The operation fails if you specify an
instance ID unless exactly one network interface is attached.
"""
network_interface_id: pulumi.Output[str]
"""
The ID of the network interface. If the
instance has more than one network interface, you must specify a network
interface ID.
"""
private_ip_address: pulumi.Output[str]
"""
The primary or secondary private IP address
to associate with the Elastic IP address. If no private IP address is
specified, the Elastic IP address is associated with the primary private IP
address.
"""
public_ip: pulumi.Output[str]
"""
The Elastic IP address. This is required for EC2-Classic.
"""
def __init__(__self__, resource_name, opts=None, allocation_id=None, allow_reassociation=None, instance_id=None, network_interface_id=None, private_ip_address=None, public_ip=None, __name__=None, __opts__=None):
"""
Provides an AWS EIP Association as a top level resource, to associate and
disassociate Elastic IPs from AWS Instances and Network Interfaces.
> **NOTE:** Do not use this resource to associate an EIP to `aws_lb` or `aws_nat_gateway` resources. Instead use the `allocation_id` available in those resources to allow AWS to manage the association, otherwise you will see `AuthFailure` errors.
> **NOTE:** `aws_eip_association` is useful in scenarios where EIPs are either
pre-existing or distributed to customers or users and therefore cannot be changed.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] allocation_id: The allocation ID. This is required for EC2-VPC.
:param pulumi.Input[bool] allow_reassociation: Whether to allow an Elastic IP to
be re-associated. Defaults to `true` in VPC.
:param pulumi.Input[str] instance_id: The ID of the instance. This is required for
EC2-Classic. For EC2-VPC, you can specify either the instance ID or the
network interface ID, but not both. The operation fails if you specify an
instance ID unless exactly one network interface is attached.
:param pulumi.Input[str] network_interface_id: The ID of the network interface. If the
instance has more than one network interface, you must specify a network
interface ID.
:param pulumi.Input[str] private_ip_address: The primary or secondary private IP address
to associate with the Elastic IP address. If no private IP address is
specified, the Elastic IP address is associated with the primary private IP
address.
:param pulumi.Input[str] public_ip: The Elastic IP address. This is required for EC2-Classic.
"""
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
resource_name = __name__
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if not resource_name:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(resource_name, str):
raise TypeError('Expected resource name to be a string')
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
__props__ = dict()
__props__['allocation_id'] = allocation_id
__props__['allow_reassociation'] = allow_reassociation
__props__['instance_id'] = instance_id
__props__['network_interface_id'] = network_interface_id
__props__['private_ip_address'] = private_ip_address
__props__['public_ip'] = public_ip
super(EipAssociation, __self__).__init__(
'aws:ec2/eipAssociation:EipAssociation',
resource_name,
__props__,
opts)
def translate_output_property(self, prop):
return tables._CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop
def translate_input_property(self, prop):
return tables._SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop
| 45.628319 | 254 | 0.688712 | 684 | 5,156 | 4.97807 | 0.241228 | 0.044934 | 0.051689 | 0.029956 | 0.424376 | 0.401762 | 0.38884 | 0.38884 | 0.358884 | 0.336564 | 0 | 0.002569 | 0.245151 | 5,156 | 112 | 255 | 46.035714 | 0.872302 | 0.373739 | 0 | 0 | 1 | 0 | 0.173195 | 0.017461 | 0 | 0 | 0 | 0 | 0 | 1 | 0.073171 | false | 0.073171 | 0.121951 | 0.04878 | 0.414634 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
ffcbfe97907f424e285cc650c8aa8ed2f05983a3 | 487 | py | Python | imploder/core.py | eabderh/imploder | d489b4f34a219e673cd356028db8866a992ee8bc | [
"MIT"
] | null | null | null | imploder/core.py | eabderh/imploder | d489b4f34a219e673cd356028db8866a992ee8bc | [
"MIT"
] | null | null | null | imploder/core.py | eabderh/imploder | d489b4f34a219e673cd356028db8866a992ee8bc | [
"MIT"
] | null | null | null |
import sys
import importlib
from exporter import Export
globalize = Export().top()
def implode():
for module in sys.modules.values():
items = module.__dict__.items()
if ('__IMPLODE__', True) in items:
print('IMPLODE - ' + module.__name__)
if module.__spec__ is not None:
importlib.reload(module)
globalize.module(module)
def impload(module):
importlib.reload(module)
globalize.module(module)
| 18.037037 | 49 | 0.620123 | 53 | 487 | 5.396226 | 0.509434 | 0.104895 | 0.146853 | 0.20979 | 0.293706 | 0.293706 | 0 | 0 | 0 | 0 | 0 | 0 | 0.279261 | 487 | 26 | 50 | 18.730769 | 0.814815 | 0 | 0 | 0.266667 | 0 | 0 | 0.043659 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0.333333 | 0 | 0.466667 | 0.066667 | 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 |
083b3f134da977d1bba29fd500e957877e4abc03 | 690 | py | Python | net/wyun/tests/prep/test_excel2DB.py | michaelyin/im2markup-prep | 0613e4f77f1b50084a85e5c0b1511c9ae007211d | [
"Apache-2.0"
] | 3 | 2018-04-19T13:51:33.000Z | 2020-10-04T12:35:50.000Z | net/wyun/tests/prep/test_excel2DB.py | michaelyin/im2markup-prep | 0613e4f77f1b50084a85e5c0b1511c9ae007211d | [
"Apache-2.0"
] | null | null | null | net/wyun/tests/prep/test_excel2DB.py | michaelyin/im2markup-prep | 0613e4f77f1b50084a85e5c0b1511c9ae007211d | [
"Apache-2.0"
] | 1 | 2018-11-22T08:44:11.000Z | 2018-11-22T08:44:11.000Z | from unittest import TestCase
from net.wyun.mer.prep.dbbatch import DBBatch
from net.wyun.mer.prep.xlsx2db import Excel2DB
from net.wyun.mer.ink.scg import Scg
class TestExcel2DB(TestCase):
def setUp(self):
dbhost, dbuser, dbpass, dbname = 'localhost', 'hope', 'hope', 'equation'
dbbatch = DBBatch(dbhost, dbuser, dbpass, dbname)
self.excel2db = Excel2DB(dbbatch, 'data/xlsx/hw_record.xlsx')
def test_saveScg2db(self):
self.excel2db.saveRow2db(1)
def test_saveAllScgs(self):
nrow = self.excel2db.excel.get_row_number()
for i in range(1, nrow):
print 'processing row: ', i
self.excel2db.saveRow2db(i)
| 30 | 80 | 0.673913 | 90 | 690 | 5.111111 | 0.5 | 0.104348 | 0.071739 | 0.091304 | 0.078261 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023985 | 0.214493 | 690 | 22 | 81 | 31.363636 | 0.824723 | 0 | 0 | 0 | 0 | 0 | 0.094477 | 0.034884 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.125 | 0.25 | null | null | 0.0625 | 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 |
083eee1ace087ebaa042da41d50c63e755596d67 | 413 | py | Python | 1º Semestre/Aula 06 - 24_09/Estrutura encadeadas.py | thaistlsantos/Python-FIT | 2467a4af0083bdae6233a1a6a4af0e6310f3b9c3 | [
"MIT"
] | null | null | null | 1º Semestre/Aula 06 - 24_09/Estrutura encadeadas.py | thaistlsantos/Python-FIT | 2467a4af0083bdae6233a1a6a4af0e6310f3b9c3 | [
"MIT"
] | null | null | null | 1º Semestre/Aula 06 - 24_09/Estrutura encadeadas.py | thaistlsantos/Python-FIT | 2467a4af0083bdae6233a1a6a4af0e6310f3b9c3 | [
"MIT"
] | null | null | null | #Estrutuas encadeadas
0 1 2
if opcao == 1:
#dar 10 % de desconto
else:
#sei que não é 1
if opcao == 2:
#dar 5 % de desconto
else:
#sei que não é 1 e nem 2
if opcao == 3:
#preço normal em 2x
else:
#sei que não 1, nem 2 e nem 3
#cobrar 10% de juros
#e parcelar em 3x
# exibis o valor da compra e numero de vezes
| 19.666667 | 44 | 0.508475 | 68 | 413 | 3.088235 | 0.514706 | 0.1 | 0.142857 | 0.185714 | 0.238095 | 0.238095 | 0.238095 | 0.238095 | 0 | 0 | 0 | 0.080508 | 0.428571 | 413 | 20 | 45 | 20.65 | 0.809322 | 0.535109 | 0 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0849c93798ade1973ea0b405190781c91677b605 | 448 | py | Python | basepair/helpers/set_filter.py | basepair/basepair-python | ce0e9a549e8eede9e55dc47a36ed4e9532607cff | [
"MIT"
] | 2 | 2015-09-14T00:45:45.000Z | 2021-08-13T16:45:25.000Z | basepair/helpers/set_filter.py | basepair/basepair-python | ce0e9a549e8eede9e55dc47a36ed4e9532607cff | [
"MIT"
] | 12 | 2020-07-22T19:09:56.000Z | 2022-01-20T16:35:43.000Z | basepair/helpers/set_filter.py | basepair/basepair-python | ce0e9a549e8eede9e55dc47a36ed4e9532607cff | [
"MIT"
] | 1 | 2022-02-23T15:27:31.000Z | 2022-02-23T15:27:31.000Z | '''Helper to filter sets of data'''
class SetFilter:
'''Helper class to filter list'''
@staticmethod
def diff(a_set, b_set):
'''Filter by not intersection'''
return not set(b_set).intersection(set(a_set))
@staticmethod
def exact(a_set, b_set):
'''Filter by eq'''
return set(a_set) == set(b_set)
@staticmethod
def subset(a_set, b_set):
'''Filter by intersection'''
return set(a_set).intersection(set(b_set))
| 23.578947 | 50 | 0.662946 | 68 | 448 | 4.191176 | 0.323529 | 0.084211 | 0.147368 | 0.084211 | 0.168421 | 0.168421 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189732 | 448 | 18 | 51 | 24.888889 | 0.785124 | 0.267857 | 0 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f22ad9067ec91eec68569a0a6e271319d8bbd0d2 | 898 | py | Python | flake8_useless_assert/patch_const.py | decorator-factory/flake8-useless-assert | 6bdf6d2738dafe19863977d4c81614baa4c4dc8a | [
"MIT"
] | 2 | 2021-11-24T22:05:24.000Z | 2021-11-25T00:20:06.000Z | flake8_useless_assert/patch_const.py | decorator-factory/flake8-useless-assert | 6bdf6d2738dafe19863977d4c81614baa4c4dc8a | [
"MIT"
] | 2 | 2021-11-25T19:35:14.000Z | 2021-11-25T19:38:07.000Z | flake8_useless_assert/patch_const.py | decorator-factory/flake8-useless-assert | 6bdf6d2738dafe19863977d4c81614baa4c4dc8a | [
"MIT"
] | null | null | null | import ast
class LegacyConstantRewriter(ast.NodeTransformer):
"""
Transformer that replaces deprecated constant nodes (Str, Num,
NameConstant, Ellipsis) with Constant.
"""
def visit_Str(self, node: ast.Str) -> ast.AST:
const_node = ast.Constant(value=node.s)
ast.copy_location(const_node, node)
return const_node
def visit_Num(self, node: ast.Num) -> ast.AST:
const_node = ast.Constant(value=node.n)
ast.copy_location(const_node, node)
return const_node
def visit_NameConstant(self, node: ast.NameConstant) -> ast.AST:
const_node = ast.Constant(value=node.value)
ast.copy_location(const_node, node)
return const_node
def visit_Ellipsis(self, node: ast.Ellipsis) -> ast.AST:
const_node = ast.Constant(value=...)
ast.copy_location(const_node, node)
return const_node
| 32.071429 | 68 | 0.669265 | 116 | 898 | 5.008621 | 0.232759 | 0.185886 | 0.075732 | 0.10327 | 0.580034 | 0.580034 | 0.580034 | 0.535284 | 0.354561 | 0.354561 | 0 | 0 | 0.226058 | 898 | 27 | 69 | 33.259259 | 0.835971 | 0.112472 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.055556 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f22fefbf51ffa31fed267bc5a706ef87e8681c06 | 814 | py | Python | deploy/workflow/abstract_workflow.py | bigdatalab/movingdata | 9e51a54b9c601fa8fd55a571d28beb66fcca9def | [
"MIT"
] | 1 | 2017-01-19T22:54:22.000Z | 2017-01-19T22:54:22.000Z | deploy/workflow/abstract_workflow.py | bigdatalab/movingdata | 9e51a54b9c601fa8fd55a571d28beb66fcca9def | [
"MIT"
] | null | null | null | deploy/workflow/abstract_workflow.py | bigdatalab/movingdata | 9e51a54b9c601fa8fd55a571d28beb66fcca9def | [
"MIT"
] | null | null | null | #
# Represents an abstract workflow
#
# Copyright (c) 2013 by Michael Luckeneder
#
from abc import ABCMeta, abstractmethod
class AbstractWorkflow(object):
"""Represents an abstract workflow"""
__metaclass__ = ABCMeta
def __init__(self):
"""Initialize workflow"""
self.conn = None
def set_connection(self, conn):
"""Inject connection"""
self.conn = conn
@abstractmethod
def init(self, conn):
"""Initialize workflow"""
return
@abstractmethod
def run(self, conn):
"""Execute the workflow"""
return
@abstractmethod
def get_endpoints(self):
"""Extract workflow endpoint URLs"""
return
@abstractmethod
def get_workflow_hosts(self):
"""Extract workflow hosts"""
return
| 20.35 | 44 | 0.620393 | 79 | 814 | 6.240506 | 0.481013 | 0.081136 | 0.139959 | 0.11359 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006803 | 0.277641 | 814 | 39 | 45 | 20.871795 | 0.831633 | 0.292383 | 0 | 0.421053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0 | 0.052632 | 0 | 0.684211 | 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 |
f24fa38642e830cc450e765faa49b32d49427b29 | 1,233 | py | Python | Hackerrank/DP/temp.py | khaleeque-ansari/Online-Coding-Problems-Solutions-Python | c8378ccad88ce5f50239f82cf9569344e1b92f18 | [
"Apache-2.0"
] | null | null | null | Hackerrank/DP/temp.py | khaleeque-ansari/Online-Coding-Problems-Solutions-Python | c8378ccad88ce5f50239f82cf9569344e1b92f18 | [
"Apache-2.0"
] | null | null | null | Hackerrank/DP/temp.py | khaleeque-ansari/Online-Coding-Problems-Solutions-Python | c8378ccad88ce5f50239f82cf9569344e1b92f18 | [
"Apache-2.0"
] | null | null | null | stop = False
ans = 0
prev = 0
curr = 0
while not stop:#stop when decreasing sequence or only one element left
def get_shr_pric(i):
if i < 0 or i > n-1:
return 0
return shr[i]
#find peaks
peaks = []
for j in xrange(n):
if get_shr_pric(j) >= get_shr_pric(j-1) and get_shr_pric(j) > get_shr_pric(j+1):
peaks.append(j)
curr = peaks.index(max(shr[prev:]))
s = 0
for n in xrange(prev,curr):
s += shr[n]
ans += (curr - prev)*shr[curr] - s
prev = curr + 1
if (shr[prev:]) == sorted((shr[prev:]),reverse=True):
stop = True
inc_peaks = []
l = len(peaks)
if l > 1:
for k in xrange(l-1):
if shr[peaks[k]] > shr[peaks[k+1]]:
inc_peaks.append(peaks[k])
inc_peaks.append(peaks[l-1])
else:
inc_peaks = peaks
print ans
| 23.711538 | 93 | 0.378751 | 143 | 1,233 | 3.167832 | 0.314685 | 0.066225 | 0.110375 | 0.09713 | 0.101545 | 0.101545 | 0.101545 | 0.101545 | 0.101545 | 0 | 0 | 0.023769 | 0.522303 | 1,233 | 51 | 94 | 24.176471 | 0.745331 | 0.052717 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.032258 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f25dccb0e12ebddb8fc49190e7d6a5b34ace1f74 | 1,188 | py | Python | jumpmaplist/route.py | jsza/jump-map-list | 7db4a9ef7031dede6ad382cc0a4c9061cd544a16 | [
"MIT"
] | null | null | null | jumpmaplist/route.py | jsza/jump-map-list | 7db4a9ef7031dede6ad382cc0a4c9061cd544a16 | [
"MIT"
] | null | null | null | jumpmaplist/route.py | jsza/jump-map-list | 7db4a9ef7031dede6ad382cc0a4c9061cd544a16 | [
"MIT"
] | null | null | null | from txspinneret import query as q
from jumpmaplist.constants.tf2 import JUMP_CLASSES
from jumpmaplist.constants.tiers import VALID_TIERS
from jumpmaplist.constants.mediatype import MEDIA_TYPES
def JumpClass(name, base=10, encoding=None):
"""
Match a jump class index route parameter.
See `txpinneret.query.Integer`.
"""
def _match(request, value):
value = q.Integer(value, base, encoding)
if value in JUMP_CLASSES:
return name, value
return name, None
return _match
def MapTier(name, base=10, encoding=None):
"""
Match a map tier route parameter.
See `txpinneret.query.Integer`.
"""
def _match(request, value):
value = q.Integer(value, base, encoding)
if value in VALID_TIERS:
return name, value
return name, None
return _match
def MediaType(name, base=10, encoding=None):
"""
Match a media type route parameter.
See `txpinneret.query.Integer`.
"""
def _match(request, value):
value = q.Integer(value, base, encoding)
if value in MEDIA_TYPES:
return name, value
return name, None
return _match
| 23.294118 | 55 | 0.649832 | 148 | 1,188 | 5.135135 | 0.277027 | 0.078947 | 0.094737 | 0.071053 | 0.663158 | 0.663158 | 0.663158 | 0.552632 | 0.5 | 0.386842 | 0 | 0.008009 | 0.26431 | 1,188 | 50 | 56 | 23.76 | 0.861556 | 0.176768 | 0 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0 | 0.16 | 0 | 0.76 | 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 |
f27e1b74ec450f73b5634ab48425f8f84c5e1fed | 285 | py | Python | TWITOFF/tempCodeRunnerFile.py | zwarshavsky/DS8_twitoff | ac2ce2b245aca17aca7e4bdb69a9a93b0906af23 | [
"MIT"
] | null | null | null | TWITOFF/tempCodeRunnerFile.py | zwarshavsky/DS8_twitoff | ac2ce2b245aca17aca7e4bdb69a9a93b0906af23 | [
"MIT"
] | 5 | 2021-06-02T00:49:41.000Z | 2022-03-12T00:10:16.000Z | TWITOFF/tempCodeRunnerFile.py | zwarshavsky/DS8_twitoff | ac2ce2b245aca17aca7e4bdb69a9a93b0906af23 | [
"MIT"
] | null | null | null | from decouple import config
from dotenv import load_dotenv
from flask import Flask, render_template, request
from .models import DB, User
from .predict import predict_user
from .twitter import add_or_update_user
#now we make a app factory
def create_app():
app = Flask(__name__) | 23.75 | 49 | 0.8 | 45 | 285 | 4.822222 | 0.6 | 0.073733 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154386 | 285 | 12 | 50 | 23.75 | 0.900415 | 0.087719 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.75 | 0 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f28fdef84e31a8fe0fbecc9f4fc1c37a02b05424 | 1,247 | py | Python | migrations/versions/ad076ac6931b_add_meeting_to_motion_vote.py | louking/members | ee204211812e00945f9e2b09cfa130cc9d3e6558 | [
"Apache-2.0"
] | 1 | 2020-12-07T02:52:01.000Z | 2020-12-07T02:52:01.000Z | migrations/versions/ad076ac6931b_add_meeting_to_motion_vote.py | louking/members | ee204211812e00945f9e2b09cfa130cc9d3e6558 | [
"Apache-2.0"
] | 496 | 2020-02-12T15:48:26.000Z | 2022-03-23T11:17:27.000Z | migrations/versions/ad076ac6931b_add_meeting_to_motion_vote.py | louking/members | ee204211812e00945f9e2b09cfa130cc9d3e6558 | [
"Apache-2.0"
] | null | null | null | """add meeting to motion vote
Revision ID: ad076ac6931b
Revises: 26ae315ec30d
Create Date: 2020-07-24 15:43:55.472692
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ad076ac6931b'
down_revision = '26ae315ec30d'
branch_labels = None
depends_on = None
def upgrade(engine_name):
globals()["upgrade_%s" % engine_name]()
def downgrade(engine_name):
globals()["downgrade_%s" % engine_name]()
def upgrade_():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('motionvote', sa.Column('meeting_id', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'motionvote', 'meeting', ['meeting_id'], ['id'])
# ### end Alembic commands ###
def downgrade_():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'motionvote', type_='foreignkey')
op.drop_column('motionvote', 'meeting_id')
# ### end Alembic commands ###
def upgrade_users():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade_users():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
| 22.672727 | 85 | 0.672815 | 148 | 1,247 | 5.52027 | 0.412162 | 0.05508 | 0.102815 | 0.112607 | 0.358629 | 0.276622 | 0.276622 | 0.276622 | 0.168911 | 0.168911 | 0 | 0.047059 | 0.182037 | 1,247 | 54 | 86 | 23.092593 | 0.753922 | 0.370489 | 0 | 0.1 | 0 | 0 | 0.187761 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0.1 | 0.1 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
f299376d21a5c231262bf1475d727066f6e2c08e | 3,996 | py | Python | src/dockerblade/exceptions.py | ChrisTimperley/dockerblade | 2be99bb9b2919ac87831879e04d6739d6967a8f3 | [
"Apache-2.0"
] | 1 | 2020-06-27T23:21:00.000Z | 2020-06-27T23:21:00.000Z | src/dockerblade/exceptions.py | ChrisTimperley/dockerblade | 2be99bb9b2919ac87831879e04d6739d6967a8f3 | [
"Apache-2.0"
] | 66 | 2019-10-12T22:20:49.000Z | 2021-12-08T20:15:28.000Z | src/dockerblade/exceptions.py | ChrisTimperley/dockerblade | 2be99bb9b2919ac87831879e04d6739d6967a8f3 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import typing as _t
import attr as _attr
import subprocess as _subprocess
class DockerBladeException(Exception):
"""Used by all exceptions that are thrown by DockerBlade."""
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class UnexpectedError(DockerBladeException):
"""An unexpected error occurred during an operation."""
description: str
error: _t.Optional['CalledProcessError'] = _attr.ib(default=None)
def __str__(self) -> str:
msg = f"An unexpected error occurred: {self.description}"
if self.error:
msg += f' ({self.error})'
return msg
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class EnvNotFoundError(DockerBladeException):
"""No environment variable was found with the given name."""
name: str
def __str__(self) -> str:
return f"No environment variable found with name: {self.name}"
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class CopyFailed(DockerBladeException):
"""A copy operation failed unexpectedly."""
reason: str
def __str__(self) -> str:
return f'Copy operation failed: {self.reason}'
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class IsADirectoryError(DockerBladeException):
"""The given path is a directory but a file was expected."""
path: str
def __str__(self) -> str:
return f'Directory exists at path where file is expected: {self.path}'
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class DirectoryNotEmpty(DockerBladeException):
"""A given directory is not empty."""
path: str
def __str__(self) -> str:
return f'Directory is not empty: {self.path}'
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class IsNotADirectoryError(DockerBladeException):
"""The given path is not a directory."""
path: str
def __str__(self) -> str:
return f'Directory was expected at path: {self.path}'
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class HostFileNotFound(DockerBladeException):
"""No file was found at a given path on the host machine."""
path: str
def __str__(self) -> str:
return f'File not found [{self.path}] on host machine'
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class ContainerFileNotFound(DockerBladeException):
"""No file was found at a given path in a container."""
container_id: str
path: str
def __str__(self) -> str:
return (f'File not found [{self.path}] '
f'in container [{self.container_id}]')
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class ContainerFileAlreadyExists(DockerBladeException):
"""A file already exists at a given path inside a container."""
container_id: str
path: str
def __str__(self) -> str:
return (f'File already exists [{self.path}] '
f'in container [{self.container_id}]')
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class CalledProcessError(DockerBladeException, _subprocess.CalledProcessError):
"""Thrown when a process produces a non-zero return code.
Attributes
----------
cmd: str
The command that was used to launch the process.
returncode: int
The returncode that was produced by the process.
duration: float
The number of seconds that elapsed before the process terminated.
output: T, optional
The output, if any, that was produced by the process.
"""
cmd: str
returncode: int
duration: float
output: _t.Optional[_t.Union[str, bytes]]
@_attr.s(frozen=True, auto_exc=True, auto_attribs=True)
class TimeoutExpired(DockerBladeException, _subprocess.TimeoutExpired):
"""Thrown when a timeout expires while waiting for a process.
Attributes
----------
cmd: str
The command that was used to launch the process.
timeout: float
The timeout in seconds.
"""
cmd: str
timeout: float
| 29.820896 | 79 | 0.685185 | 522 | 3,996 | 5.088123 | 0.227969 | 0.066265 | 0.045557 | 0.062123 | 0.467997 | 0.442395 | 0.422063 | 0.404744 | 0.404744 | 0.329443 | 0 | 0.000315 | 0.205956 | 3,996 | 133 | 80 | 30.045113 | 0.836748 | 0.266517 | 0 | 0.477612 | 0 | 0 | 0.172389 | 0.015021 | 0 | 0 | 0 | 0 | 0 | 1 | 0.134328 | false | 0 | 0.044776 | 0.119403 | 0.761194 | 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 |
f2ab56ac0774f86845db22271272c7bf7382c5ad | 400 | py | Python | v1/teams/views/slack_channel.py | dhakal0kushal/Website-API | 6876fdb0c4789c1488321513d66194d06d49ff2b | [
"MIT"
] | null | null | null | v1/teams/views/slack_channel.py | dhakal0kushal/Website-API | 6876fdb0c4789c1488321513d66194d06d49ff2b | [
"MIT"
] | null | null | null | v1/teams/views/slack_channel.py | dhakal0kushal/Website-API | 6876fdb0c4789c1488321513d66194d06d49ff2b | [
"MIT"
] | null | null | null | from rest_framework.viewsets import ModelViewSet
from v1.third_party.rest_framework.permissions import IsStaffOrReadOnly
from ..models.slack_channel import SlackChannel
from ..serializers.team import SlackChannelSerializer
class SlackChannelViewSet(ModelViewSet):
queryset = SlackChannel.objects.all()
serializer_class = SlackChannelSerializer
permission_classes = [IsStaffOrReadOnly]
| 33.333333 | 71 | 0.84 | 39 | 400 | 8.461538 | 0.666667 | 0.078788 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002793 | 0.105 | 400 | 11 | 72 | 36.363636 | 0.918994 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
f2ae37f689af5a4aee9c188b87654b6b768e3e2a | 8,977 | py | Python | temboo/core/Library/Genability/TariffData/GetTariffs.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 7 | 2016-03-07T02:07:21.000Z | 2022-01-21T02:22:41.000Z | temboo/core/Library/Genability/TariffData/GetTariffs.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | null | null | null | temboo/core/Library/Genability/TariffData/GetTariffs.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 8 | 2016-06-14T06:01:11.000Z | 2020-04-22T09:21:44.000Z | # -*- coding: utf-8 -*-
###############################################################################
#
# GetTariffs
# Returns a list of Tariff objects based a specified search criteria.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# 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 temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetTariffs(Choreography):
def __init__(self, temboo_session):
"""
Create a new instance of the GetTariffs Choreo. A TembooSession object, containing a valid
set of Temboo credentials, must be supplied.
"""
super(GetTariffs, self).__init__(temboo_session, '/Library/Genability/TariffData/GetTariffs')
def new_input_set(self):
return GetTariffsInputSet()
def _make_result_set(self, result, path):
return GetTariffsResultSet(result, path)
def _make_execution(self, session, exec_id, path):
return GetTariffsChoreographyExecution(session, exec_id, path)
class GetTariffsInputSet(InputSet):
"""
An InputSet with methods appropriate for specifying the inputs to the GetTariffs
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
"""
def set_AccountID(self, value):
"""
Set the value of the AccountID input for this Choreo. ((optional, string) The unique ID of the Account to find tariffs for. Values passed in will override those from the Account.)
"""
super(GetTariffsInputSet, self)._set_input('AccountID', value)
def set_AppID(self, value):
"""
Set the value of the AppID input for this Choreo. ((conditional, string) The App ID provided by Genability.)
"""
super(GetTariffsInputSet, self)._set_input('AppID', value)
def set_AppKey(self, value):
"""
Set the value of the AppKey input for this Choreo. ((required, string) The App Key provided by Genability.)
"""
super(GetTariffsInputSet, self)._set_input('AppKey', value)
def set_CustomerClasses(self, value):
"""
Set the value of the CustomerClasses input for this Choreo. ((optional, string) Returns only these customer classes. Valid values are: RESIDENTIAL, GENERAL.)
"""
super(GetTariffsInputSet, self)._set_input('CustomerClasses', value)
def set_EffectiveOn(self, value):
"""
Set the value of the EffectiveOn input for this Choreo. ((optional, date) Returns only tariffs that are effective on this date.)
"""
super(GetTariffsInputSet, self)._set_input('EffectiveOn', value)
def set_EndsWith(self, value):
"""
Set the value of the EndsWith input for this Choreo. ((optional, string) When true, the search will only return results that end with the specified search string. Otherwise, any match of the search string will be returned as a result.)
"""
super(GetTariffsInputSet, self)._set_input('EndsWith', value)
def set_FromDateTime(self, value):
"""
Set the value of the FromDateTime input for this Choreo. ((optional, date) Returns only tariffs that are effective on or after this date.)
"""
super(GetTariffsInputSet, self)._set_input('FromDateTime', value)
def set_IsRegex(self, value):
"""
Set the value of the IsRegex input for this Choreo. ((optional, boolean) When true, the provided search string will be regarded as a regular expression and the search will return results matching the regular expression.)
"""
super(GetTariffsInputSet, self)._set_input('IsRegex', value)
def set_LSEID(self, value):
"""
Set the value of the LSEID input for this Choreo. ((optional, integer) Filter tariffs for a specific LSE.)
"""
super(GetTariffsInputSet, self)._set_input('LSEID', value)
def set_PageCount(self, value):
"""
Set the value of the PageCount input for this Choreo. ((optional, integer) The number of results to return. Defaults to 25.)
"""
super(GetTariffsInputSet, self)._set_input('PageCount', value)
def set_PageStart(self, value):
"""
Set the value of the PageStart input for this Choreo. ((optional, integer) The page number to begin the result set from. Defaults to 1.)
"""
super(GetTariffsInputSet, self)._set_input('PageStart', value)
def set_PopulateProperties(self, value):
"""
Set the value of the PopulateProperties input for this Choreo. ((optional, boolean) Set to "true" to populate the properties for the returned Tariffs.)
"""
super(GetTariffsInputSet, self)._set_input('PopulateProperties', value)
def set_PopulateRates(self, value):
"""
Set the value of the PopulateRates input for this Choreo. ((optional, boolean) Set to "true" to populate the rate details for the returned Tariffs.)
"""
super(GetTariffsInputSet, self)._set_input('PopulateRates', value)
def set_SearchOn(self, value):
"""
Set the value of the SearchOn input for this Choreo. ((optional, string) Comma separated list of fields to query on. When searchOn is specified, the text provided in the search string field will be searched within these fields.)
"""
super(GetTariffsInputSet, self)._set_input('SearchOn', value)
def set_Search(self, value):
"""
Set the value of the Search input for this Choreo. ((optional, string) The string of text to search on. This can also be a regular expression, in which case you should set the 'isRegex' flag to true.)
"""
super(GetTariffsInputSet, self)._set_input('Search', value)
def set_SortOn(self, value):
"""
Set the value of the SortOn input for this Choreo. ((optional, string) Comma separated list of fields to sort on.)
"""
super(GetTariffsInputSet, self)._set_input('SortOn', value)
def set_SortOrder(self, value):
"""
Set the value of the SortOrder input for this Choreo. ((optional, string) Comma separated list of ordering. Possible values are 'ASC' and 'DESC'. Default is 'ASC'. This list corresponds to the field list used in the SortOn input.)
"""
super(GetTariffsInputSet, self)._set_input('SortOrder', value)
def set_StartsWith(self, value):
"""
Set the value of the StartsWith input for this Choreo. ((optional, boolean) When true, the search will only return results that begin with the specified search string. Otherwise, any match of the search string will be returned as a result.)
"""
super(GetTariffsInputSet, self)._set_input('StartsWith', value)
def set_TariffTypes(self, value):
"""
Set the value of the TariffTypes input for this Choreo. ((optional, string) Returns only these tariff types. Valid values are: DEFAULT, ALTERNATIVE, OPTIONAL_EXTRA, RIDER.)
"""
super(GetTariffsInputSet, self)._set_input('TariffTypes', value)
def set_ToDateTime(self, value):
"""
Set the value of the ToDateTime input for this Choreo. ((optional, date) Returns only tariffs that are effective on or before this date.)
"""
super(GetTariffsInputSet, self)._set_input('ToDateTime', value)
def set_ZipCode(self, value):
"""
Set the value of the ZipCode input for this Choreo. ((optional, string) Return tariffs for a given zip or post code.)
"""
super(GetTariffsInputSet, self)._set_input('ZipCode', value)
class GetTariffsResultSet(ResultSet):
"""
A ResultSet with methods tailored to the values returned by the GetTariffs Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
"""
def getJSONFromString(self, str):
return json.loads(str)
def get_Response(self):
"""
Retrieve the value for the "Response" output from this Choreo execution. ((json) The response from Genability.)
"""
return self._output.get('Response', None)
class GetTariffsChoreographyExecution(ChoreographyExecution):
def _make_result_set(self, response, path):
return GetTariffsResultSet(response, path)
| 49.054645 | 248 | 0.677955 | 1,128 | 8,977 | 5.317376 | 0.213652 | 0.021674 | 0.042014 | 0.052518 | 0.447482 | 0.34945 | 0.333278 | 0.200567 | 0.182227 | 0.120707 | 0 | 0.002424 | 0.21867 | 8,977 | 182 | 249 | 49.324176 | 0.852723 | 0.518325 | 0 | 0 | 0 | 0 | 0.068086 | 0.011488 | 0 | 0 | 0 | 0 | 0 | 1 | 0.430769 | false | 0 | 0.076923 | 0.076923 | 0.661538 | 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 |
f2b4c3c0a68d3e92b2ec95d65186a2fc28487ba5 | 1,183 | py | Python | tilingsgui/utils.py | PermutaTriangle/tilingsgui | 7421200dbf00eb429abeb22a29ad70fdb6644a90 | [
"BSD-3-Clause"
] | 2 | 2020-07-01T17:03:04.000Z | 2020-07-17T13:25:59.000Z | tilingsgui/utils.py | PermutaTriangle/tilingsgui | 7421200dbf00eb429abeb22a29ad70fdb6644a90 | [
"BSD-3-Clause"
] | 6 | 2019-11-20T09:48:10.000Z | 2020-09-16T06:51:24.000Z | tilingsgui/utils.py | PermutaTriangle/tilingsgui | 7421200dbf00eb429abeb22a29ad70fdb6644a90 | [
"BSD-3-Clause"
] | 3 | 2019-11-19T12:10:21.000Z | 2020-06-29T11:36:29.000Z | """A collection of various utility functionality.
"""
import datetime
import pyperclip
def paste() -> str:
"""Paste what is currently in clipboard. This can fail if os does not
included required dependencies.
* Win: None
* Mac: pbcopy and pbpaste (should be built in)
* Linux: xclip
Returns:
str: The pasted value as a string or an empty string if fails.
"""
try:
return pyperclip.paste()
except pyperclip.PyperclipException:
print("Required clipboard tools for pyperclip missing")
return ""
def get_current_time_string() -> str:
"""Get the current date and time as a string.
Returns:
str: The current datetime.
"""
return datetime.datetime.now().isoformat()
def clamp(value: float, min_value: float, max_value: float) -> float:
"""Returns the closest value to value in [min_value, max_value].
Args:
value (float): The value to map.
min_value (float): Minimum value of interval.
max_value (float): Maximum value of interval.
Returns:
float: The value clamped between boundaries
"""
return min(max_value, max(value, min_value))
| 25.170213 | 73 | 0.656805 | 153 | 1,183 | 5.006536 | 0.496732 | 0.078329 | 0.033943 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.253593 | 1,183 | 46 | 74 | 25.717391 | 0.867497 | 0.544379 | 0 | 0 | 0 | 0 | 0.103139 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.166667 | 0 | 0.75 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f2c4787335e226588174e6bb0a1070e06545972d | 259 | py | Python | IceGame/h5game/models/game_tpl_m.py | onebitxy/djangoing | 5061516b0f5bce1794488680ca616f512ae3ad42 | [
"MIT"
] | null | null | null | IceGame/h5game/models/game_tpl_m.py | onebitxy/djangoing | 5061516b0f5bce1794488680ca616f512ae3ad42 | [
"MIT"
] | null | null | null | IceGame/h5game/models/game_tpl_m.py | onebitxy/djangoing | 5061516b0f5bce1794488680ca616f512ae3ad42 | [
"MIT"
] | null | null | null | #!/usr/bin/python3.7
# -*- coding: utf-8 -*-
from .abs_game_m import AbsGame
class GameTpl(AbsGame):
'''
游戏模板类
'''
def is_template(self):
'''
是否为模板游戏
'''
return True
def __str__(self):
return '%s[%s]' % (self.project.name, self.name)
| 11.26087 | 50 | 0.598456 | 35 | 259 | 4.228571 | 0.771429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014634 | 0.208494 | 259 | 22 | 51 | 11.772727 | 0.707317 | 0.212355 | 0 | 0 | 0 | 0 | 0.033333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0.166667 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
4b2f0c4dbe10c27f739c9991ec4b877e6f01bb3d | 60,934 | py | Python | wbpy/tests/climate_data.py | Giving-Tuesday/wbpy | 5077d6455b511caa8421f0165cc18a26c5b97eb9 | [
"MIT"
] | 40 | 2015-01-17T23:28:12.000Z | 2022-02-27T16:55:22.000Z | wbpy/tests/climate_data.py | Giving-Tuesday/wbpy | 5077d6455b511caa8421f0165cc18a26c5b97eb9 | [
"MIT"
] | 1 | 2020-07-06T07:01:32.000Z | 2020-07-18T13:02:39.000Z | wbpy/tests/climate_data.py | Giving-Tuesday/wbpy | 5077d6455b511caa8421f0165cc18a26c5b97eb9 | [
"MIT"
] | 9 | 2015-10-02T23:58:21.000Z | 2021-10-04T00:22:02.000Z | # -*- coding: utf-8 -*-
import datetime
import wbpy
class InstrumentalData(object):
def __init__(self):
self.dataset = wbpy.InstrumentalDataset(self.data, self.data_stat,
self.data_type, self.date)
class InstrumentalMonth(InstrumentalData):
date = datetime.date(2013, 10, 1)
data_type = "month"
data_stat = "tas"
data_regions = ["gbr", "esp"]
url_a = "climatedataapi.worldbank.org/climateweb/rest/v1/country/cru/tas/month/gbr"
response_a = [
{
"month": 0,
"data": 3.548619
},
{
"month": 1,
"data": 3.5660548
},
{
"month": 2,
"data": 5.029752
},
{
"month": 3,
"data": 7.046495
},
{
"month": 4,
"data": 9.992739
},
{
"month": 5,
"data": 12.64797
},
{
"month": 6,
"data": 14.395218
},
{
"month": 7,
"data": 14.276817
},
{
"month": 8,
"data": 12.295507
},
{
"month": 9,
"data": 9.340202
},
{
"month": 10,
"data": 5.964761
},
{
"month": 11,
"data": 4.2208977
}
]
url_b = "climatedataapi.worldbank.org/climateweb/rest/v1/country/cru/tas/month/esp"
response_b = [
{
"month": 0,
"data": 6.2650433
},
{
"month": 1,
"data": 7.335536
},
{
"month": 2,
"data": 9.484709
},
{
"month": 3,
"data": 11.475021
},
{
"month": 4,
"data": 14.807161
},
{
"month": 5,
"data": 18.776157
},
{
"month": 6,
"data": 21.889704
},
{
"month": 7,
"data": 22.015457
},
{
"month": 8,
"data": 19.039537
},
{
"month": 9,
"data": 14.4277115
},
{
"month": 10,
"data": 9.737686
},
{
"month": 11,
"data": 6.9298105
}
]
data = [
dict(url=url_a, resp=response_a),
dict(url=url_b, resp=response_b),
]
class InstrumentalYear(InstrumentalData):
data_type = "year"
data_stat = "tas"
data_regions = ["bra"]
url = "climatedataapi.worldbank.org/climateweb/rest/v1/country/cru/tas/year/bra"
date = datetime.date(2013, 10, 1)
response = [
{
"year": 1901,
"data": 24.896547
},
{
"year": 1902,
"data": 25.09181
},
{
"year": 1903,
"data": 24.896107
},
{
"year": 1904,
"data": 24.527473
},
{
"year": 1905,
"data": 24.840496
},
{
"year": 1906,
"data": 24.773937
},
{
"year": 1907,
"data": 24.726265
},
{
"year": 1908,
"data": 24.891228
},
{
"year": 1909,
"data": 24.801495
},
{
"year": 1910,
"data": 24.767641
},
{
"year": 1911,
"data": 24.702343
},
{
"year": 1912,
"data": 24.702488
},
{
"year": 1913,
"data": 24.747656
},
{
"year": 1914,
"data": 25.001505
},
{
"year": 1915,
"data": 25.063795
},
{
"year": 1916,
"data": 24.573738
},
{
"year": 1917,
"data": 24.081936
},
{
"year": 1918,
"data": 24.573418
},
{
"year": 1919,
"data": 24.992315
},
{
"year": 1920,
"data": 24.629692
},
{
"year": 1921,
"data": 24.334965
},
{
"year": 1922,
"data": 24.371807
},
{
"year": 1923,
"data": 24.37411
},
{
"year": 1924,
"data": 24.255426
},
{
"year": 1925,
"data": 24.437939
},
{
"year": 1926,
"data": 24.772419
},
{
"year": 1927,
"data": 24.338501
},
{
"year": 1928,
"data": 24.549429
},
{
"year": 1929,
"data": 24.388468
},
{
"year": 1930,
"data": 24.692787
},
{
"year": 1931,
"data": 24.63292
},
{
"year": 1932,
"data": 24.742476
},
{
"year": 1933,
"data": 24.408184
},
{
"year": 1934,
"data": 24.358976
},
{
"year": 1935,
"data": 24.552368
},
{
"year": 1936,
"data": 24.793364
},
{
"year": 1937,
"data": 24.749926
},
{
"year": 1938,
"data": 24.633394
},
{
"year": 1939,
"data": 24.676409
},
{
"year": 1940,
"data": 24.92098
},
{
"year": 1941,
"data": 25.087818
},
{
"year": 1942,
"data": 24.88943
},
{
"year": 1943,
"data": 24.662493
},
{
"year": 1944,
"data": 24.960236
},
{
"year": 1945,
"data": 24.751871
},
{
"year": 1946,
"data": 24.82267
},
{
"year": 1947,
"data": 24.613426
},
{
"year": 1948,
"data": 24.73713
},
{
"year": 1949,
"data": 24.509995
},
{
"year": 1950,
"data": 24.528568
},
{
"year": 1951,
"data": 24.488796
},
{
"year": 1952,
"data": 24.644905
},
{
"year": 1953,
"data": 24.787127
},
{
"year": 1954,
"data": 24.857592
},
{
"year": 1955,
"data": 24.568645
},
{
"year": 1956,
"data": 24.290783
},
{
"year": 1957,
"data": 24.673687
},
{
"year": 1958,
"data": 25.121525
},
{
"year": 1959,
"data": 24.947987
},
{
"year": 1960,
"data": 24.629892
},
{
"year": 1961,
"data": 25.141964
},
{
"year": 1962,
"data": 24.80534
},
{
"year": 1963,
"data": 25.217241
},
{
"year": 1964,
"data": 24.832363
},
{
"year": 1965,
"data": 25.042736
},
{
"year": 1966,
"data": 25.179237
},
{
"year": 1967,
"data": 25.035997
},
{
"year": 1968,
"data": 24.658405
},
{
"year": 1969,
"data": 25.26417
},
{
"year": 1970,
"data": 25.130068
},
{
"year": 1971,
"data": 24.418861
},
{
"year": 1972,
"data": 24.88816
},
{
"year": 1973,
"data": 25.007069
},
{
"year": 1974,
"data": 24.396254
},
{
"year": 1975,
"data": 24.438084
},
{
"year": 1976,
"data": 24.39613
},
{
"year": 1977,
"data": 24.807856
},
{
"year": 1978,
"data": 24.677866
},
{
"year": 1979,
"data": 24.693518
},
{
"year": 1980,
"data": 24.841465
},
{
"year": 1981,
"data": 24.6487
},
{
"year": 1982,
"data": 24.80703
},
{
"year": 1983,
"data": 25.007809
},
{
"year": 1984,
"data": 24.80416
},
{
"year": 1985,
"data": 24.776478
},
{
"year": 1986,
"data": 24.891207
},
{
"year": 1987,
"data": 25.302525
},
{
"year": 1988,
"data": 25.050127
},
{
"year": 1989,
"data": 24.709227
},
{
"year": 1990,
"data": 25.069971
},
{
"year": 1991,
"data": 25.041132
},
{
"year": 1992,
"data": 24.83469
},
{
"year": 1993,
"data": 24.955845
},
{
"year": 1994,
"data": 25.072952
},
{
"year": 1995,
"data": 25.300232
},
{
"year": 1996,
"data": 25.046738
},
{
"year": 1997,
"data": 25.368227
},
{
"year": 1998,
"data": 25.68623
},
{
"year": 1999,
"data": 25.147045
},
{
"year": 2000,
"data": 25.142067
},
{
"year": 2001,
"data": 25.421627
},
{
"year": 2002,
"data": 25.65718
},
{
"year": 2003,
"data": 25.480742
},
{
"year": 2004,
"data": 25.389252
},
{
"year": 2005,
"data": 25.70073
},
{
"year": 2006,
"data": 25.494154
},
{
"year": 2007,
"data": 25.547108
},
{
"year": 2008,
"data": 25.218435
},
{
"year": 2009,
"data": 25.496075
}
]
data = [dict(url=url, resp=response)]
class InstrumentalDecade(InstrumentalData):
date = datetime.date(2013, 10, 1)
data_regions = ["302", 300]
data_type = "year"
data_stat = "pr"
url_a = "climatedataapi.worldbank.org/climateweb/rest/v1/basin/cru/pr/decade/302"
response_a = [
{
"year": 1960,
"data": 14.410124
},
{
"year": 1970,
"data": 14.093135
},
{
"year": 1980,
"data": 15.368048
},
{
"year": 1990,
"data": 13.921389
},
{
"year": 2000,
"data": 14.790415
}
]
url_b = "climatedataapi.worldbank.org/climateweb/rest/v1/basin/cru/pr/decade/300"
response_b = [
{
"year": 1960,
"data": 14.603459
},
{
"year": 1970,
"data": 13.365872
},
{
"year": 1980,
"data": 14.364871
},
{
"year": 1990,
"data": 13.437422
},
{
"year": 2000,
"data": 13.864062
}
]
data = [
dict(url=url_a, resp=response_a),
dict(url=url_b, resp=response_b),
]
###############################################################################
class ModelledData(object):
date = datetime.date(2013, 10, 1)
def __init__(self):
self.dataset = wbpy.ModelledDataset(self.data, self.data_stat,
self.data_type, self.date)
class ModelledVarMAVG(ModelledData):
data_type = "mavg"
data_stat = "pr"
url_a = "climatedataapi.worldbank.org/climateweb/rest/v1/country/mavg/pr/2020/2039/bra"
response_a = [
{
"scenario": "a2",
"gcm": "bccr_bcm2_0",
"variable": "pr",
"monthVals": [
185.9119307,
179.4912687,
201.9563387,
177.0913426,
141.9072026,
75.73041729,
25.36077901,
19.56156441,
46.01293487,
120.6003451,
164.9925405,
213.0492542
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "bccr_bcm2_0",
"variable": "pr",
"monthVals": [
197.9507224,
183.0097443,
199.5386431,
182.6175624,
136.4165153,
74.34675163,
25.4942208,
20.12643269,
45.19111231,
119.7389798,
169.5458828,
201.009392
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "cccma_cgcm3_1",
"variable": "pr",
"monthVals": [
175.3399486,
149.1324675,
156.6887422,
112.9897196,
90.3763538,
68.36105859,
40.01162929,
37.79072858,
52.06211842,
88.35877702,
127.6709071,
159.1258626
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "cccma_cgcm3_1",
"variable": "pr",
"monthVals": [
168.9997536,
154.1076911,
147.6358306,
109.7238568,
88.58024856,
68.53163534,
45.75345805,
38.45494273,
49.26003488,
82.52696985,
123.251174,
164.2477515
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "cnrm_cm3",
"variable": "pr",
"monthVals": [
224.0367216,
196.6077669,
202.8810861,
162.8615656,
124.1423346,
75.01528848,
41.73538182,
34.87234125,
56.12943647,
122.591761,
184.4567928,
237.0679304
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "cnrm_cm3",
"variable": "pr",
"monthVals": [
222.7255998,
192.5433291,
202.5877503,
164.6251101,
123.123457,
71.61321335,
43.23144306,
33.69804863,
52.52722404,
120.0766934,
183.8422661,
225.2343164
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "csiro_mk3_5",
"variable": "pr",
"monthVals": [
123.9099292,
134.3177428,
176.361714,
115.579037,
54.4493068,
22.02883396,
12.96994837,
8.279050239,
7.28580286,
29.02741012,
91.69503348,
110.3264769
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "csiro_mk3_5",
"variable": "pr",
"monthVals": [
58.0984503,
21.28558475,
13.32598924,
8.130379828,
8.731148318,
30.37387121,
75.01313616,
100.2893652,
116.2299511,
134.6405696,
162.7747509,
122.1317042
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "gfdl_cm2_0",
"variable": "pr",
"monthVals": [
175.78654019180925,
180.85550789069546,
205.31114644501392,
159.82260847936683,
78.65965795938745,
27.99575065049227,
12.85206195129054,
7.377582594065352,
9.763425115173986,
25.825058591432786,
53.439633853343786,
122.24680474741609
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "gfdl_cm2_0",
"variable": "pr",
"monthVals": [
183.94907402780152,
173.27339520496653,
200.3642120530161,
160.22034447595482,
80.23321338078026,
27.804553145882277,
13.230271211071807,
7.920905716319827,
10.886190139675206,
21.9923851234191,
58.54730393928616,
132.01966261647954
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "gfdl_cm2_1",
"variable": "pr",
"monthVals": [
170.49227280530903,
173.329389211361,
201.33533317643324,
162.02831847686718,
90.3289785743943,
33.17926098384495,
12.328995263990294,
7.93924153445835,
7.082900424977892,
14.065740069871696,
35.94273489344688,
125.56228557097484
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "gfdl_cm2_1",
"variable": "pr",
"monthVals": [
168.61991554027512,
171.97571761631144,
203.76296579729865,
159.37105061099413,
92.5410384593826,
32.689186168653215,
12.070261009328004,
7.944789895116801,
9.272561785712266,
14.399896152080485,
40.47448209454984,
121.93202089629315
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "ingv_echam4",
"variable": "pr",
"monthVals": [
166.4696910276135,
162.46309844371362,
203.6866798231904,
164.32273878250092,
105.8116016008141,
54.619003097817846,
34.31288501538833,
37.283133255010945,
59.06054087580708,
103.08986456519608,
149.9279460147331,
173.34109240509295
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "inmcm3_0",
"variable": "pr",
"monthVals": [
115.46826895148368,
127.40704755024606,
160.32098967628983,
130.55191175074867,
96.71862547376998,
54.774879418649675,
34.218835564572736,
25.47844826357251,
25.419996999010326,
41.00103938803942,
66.0973295211563,
94.25829028025821
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "inmcm3_0",
"variable": "pr",
"monthVals": [
111.55949856328677,
130.891632886089,
149.7342006716992,
124.20884771684203,
92.3636894574043,
52.283570467106216,
35.625204076285875,
26.322881397026674,
25.334883170584767,
40.174399393190704,
64.41039206391847,
89.73834421253434
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "ipsl_cm4",
"variable": "pr",
"monthVals": [
150.53362541386542,
141.3446232555447,
137.57435203654364,
99.6864473840741,
82.77173183449418,
60.92623971019543,
37.00282612903225,
19.573650038981317,
16.43123311130715,
29.949668965506596,
51.39719751029006,
106.06830679634582
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "ipsl_cm4",
"variable": "pr",
"monthVals": [
133.61388111588303,
129.52683931536671,
136.87097512304067,
94.50154721631245,
81.31963721208645,
58.166575855718904,
32.60227375454003,
17.682055927550607,
18.160338390229256,
30.914038846390316,
48.27705176425011,
84.76368402905548
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "miroc3_2_medres",
"variable": "pr",
"monthVals": [
182.11662141834867,
169.40805286007873,
173.27530733886283,
119.73198418068274,
80.05372373403118,
34.27586084604831,
19.38129852679904,
12.401512601042427,
17.460500836500238,
67.76783473380884,
143.96316970133248,
170.5258979966619
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "miroc3_2_medres",
"variable": "pr",
"monthVals": [
192.71609450230758,
178.9858303260115,
171.48235190866566,
126.39526998468763,
81.88630924920773,
36.008826532967916,
19.575956625305995,
13.302172150249774,
16.162548669013002,
72.71141690517346,
143.97937887959438,
180.55398724140883
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "miub_echo_g",
"variable": "pr",
"monthVals": [
203.5565015151278,
179.61802138268175,
191.41627809641577,
153.78631016214732,
84.38124546538764,
37.98118267332855,
35.02228014950773,
33.56598117551646,
66.85787702557667,
139.20611786846055,
208.66660819431596,
224.98628109957178
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "miub_echo_g",
"variable": "pr",
"monthVals": [
203.60364280128553,
181.17021345461401,
189.00854941172395,
147.85753469552964,
88.52909664558408,
40.48384541115692,
33.56374035695625,
38.33459122649312,
73.33209990979582,
144.95173100668626,
202.17075872846547,
213.3554635849518
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "mpi_echam5",
"variable": "pr",
"monthVals": [
186.7423297609729,
164.2737953691745,
167.68470327196192,
130.77376561460977,
84.43172150111742,
37.69998445942299,
25.501181266593825,
31.45400277066972,
43.36605725071117,
94.47913527165721,
141.36949041669982,
197.71099876301457
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "mpi_echam5",
"variable": "pr",
"monthVals": [
183.58270691981116,
153.1869132793232,
159.253184871347,
131.2887078344292,
81.45115392819636,
37.978400107431426,
27.70810209835673,
31.787560728881402,
48.81270921118208,
95.1457188697616,
143.26599559529342,
198.3237475504716
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "mri_cgcm2_3_2a",
"variable": "pr",
"monthVals": [
177.85226320585735,
172.64225777482022,
186.78311021345502,
153.1142524364734,
113.4804976513871,
77.34739887396928,
65.9941187031517,
71.87010134427786,
81.76462275053068,
133.12707659630166,
167.1143143999915,
177.02394964840744
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "mri_cgcm2_3_2a",
"variable": "pr",
"monthVals": [
173.66443532758854,
165.7700600582115,
180.77776727423048,
149.831179796081,
110.1608521073214,
70.0088255616304,
60.39585603760798,
64.24498150516098,
78.59558229740753,
131.6075477262494,
162.56154479813313,
174.80878752311105
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "ukmo_hadcm3",
"variable": "pr",
"monthVals": [
209.9184598943895,
193.45944141711087,
187.81292173503894,
123.98778231376677,
76.33221524636157,
46.86560506545097,
30.868594461035727,
28.799849010019496,
50.40172522139115,
99.22266083571004,
151.6815581078797,
184.76988307143097
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "b1",
"gcm": "ukmo_hadcm3",
"variable": "pr",
"monthVals": [
195.27587704529176,
182.5596585611383,
188.6221342171158,
120.52371865668492,
68.94588942608999,
44.4829303870293,
27.253179311256854,
25.420887830824665,
55.69201742403883,
100.64409591731918,
148.54736491668405,
186.71035736217937
],
"fromYear": 2020,
"toYear": 2039
},
{
"scenario": "a2",
"gcm": "ukmo_hadgem1",
"variable": "pr",
"monthVals": [
232.74615560380732,
219.78910575819924,
225.8292288579767,
170.78439640469009,
145.5398708972161,
121.77445728826555,
68.21822290956692,
53.45959114144747,
64.81820576802161,
108.97130067924117,
143.86930669515124,
202.01667207109713
],
"fromYear": 2020,
"toYear": 2039
}
]
url_b = "climatedataapi.worldbank.org/climateweb/rest/v1/country/mavg/pr/2040/2059/bra"
response_b = [
{
"scenario": "a2",
"gcm": "bccr_bcm2_0",
"variable": "pr",
"monthVals": [
195.5793736,
182.7630994,
206.6982444,
182.822458,
133.748869,
73.93557677,
24.10691248,
19.37378554,
41.63891282,
120.1151595,
168.3348883,
201.3484943
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "bccr_bcm2_0",
"variable": "pr",
"monthVals": [
190.4957035,
184.7039624,
204.3603684,
188.3312328,
132.1854847,
69.1956174,
25.20033471,
20.23098444,
41.317024,
120.4716267,
162.9740693,
200.4123377
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "cccma_cgcm3_1",
"variable": "pr",
"monthVals": [
174.1158705,
153.1189684,
152.1684578,
106.4477175,
89.21465241,
64.90670558,
44.71232049,
39.24718901,
54.51003384,
84.56577826,
123.4654074,
165.6939926
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "cccma_cgcm3_1",
"variable": "pr",
"monthVals": [
172.9444265,
153.6827535,
150.7628746,
108.2616569,
87.88020157,
64.65845578,
43.82297329,
34.41408772,
56.27731333,
82.73861727,
122.9170387,
161.6421127
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "cnrm_cm3",
"variable": "pr",
"monthVals": [
223.9531903,
202.8911865,
203.761117,
162.4331613,
130.1181652,
70.1964507,
40.8583795,
32.77695039,
53.04974719,
124.0644688,
202.7320487,
241.1177347
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "cnrm_cm3",
"variable": "pr",
"monthVals": [
223.9232004,
195.9359255,
205.34332,
164.6127582,
123.6955022,
69.67589825,
44.71079049,
36.5183244,
58.41852175,
123.6383108,
189.9872049,
231.8704809
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "csiro_mk3_5",
"variable": "pr",
"monthVals": [
128.1028041,
130.3778071,
171.7074925,
120.4442326,
54.68086443,
20.46551372,
12.17890431,
7.792450681,
7.784312321,
29.55968472,
84.5484612,
102.1926787
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "csiro_mk3_5",
"variable": "pr",
"monthVals": [
58.09381685,
19.48055415,
12.47507105,
6.724284318,
8.698490555,
32.14334874,
72.58468465,
95.56913552,
117.3749232,
137.3918068,
152.6208025,
135.9557449
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "gfdl_cm2_0",
"variable": "pr",
"monthVals": [
173.7119342668932,
180.06392927932836,
201.31627230518822,
159.0103258116212,
73.9994908354951,
27.77532489752411,
12.751904228680567,
6.045152632442195,
8.671844274797806,
22.272585215576772,
52.367259232281214,
116.95423081701725
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "gfdl_cm2_0",
"variable": "pr",
"monthVals": [
173.02116666855147,
177.31139279359385,
205.40076011896315,
151.85093343362215,
79.22908553645154,
27.55409175647437,
12.677099419143497,
8.635900875779537,
10.50944442546522,
23.301512680870385,
51.584673926762676,
120.79398603563767
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "gfdl_cm2_1",
"variable": "pr",
"monthVals": [
166.96186678596663,
163.16148153239308,
189.81670114951842,
155.81067232114856,
92.34337001512209,
33.81570269857165,
12.094041314709214,
7.394875021705342,
6.585846839127386,
14.134739118554329,
35.38634177725905,
132.97570170343766
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "gfdl_cm2_1",
"variable": "pr",
"monthVals": [
166.12015907323035,
164.7296939445054,
196.70439300285463,
159.3320381915752,
89.62777079997969,
34.18769743676804,
12.589483706828275,
6.408542472393113,
7.684637367904589,
12.588371697781,
33.65032334535062,
105.12044023411545
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "ingv_echam4",
"variable": "pr",
"monthVals": [
168.32366457450135,
157.88773400168262,
200.07006146001632,
169.19064165638812,
107.61004034290816,
55.03835804046013,
38.983857344196274,
43.6232324721096,
59.76362453681988,
105.1267764484133,
149.60025190674722,
178.16392659717837
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "inmcm3_0",
"variable": "pr",
"monthVals": [
109.87183782271723,
127.01117029444065,
151.0261448294358,
121.51017378915093,
87.70862175934897,
52.92330619560907,
35.88966798532602,
24.6690311878878,
25.380697744355004,
40.823301064893606,
63.32562997950198,
91.46733413757299
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "inmcm3_0",
"variable": "pr",
"monthVals": [
116.30661791404165,
123.28626422548842,
148.52570465388936,
126.7447018243416,
89.7245160225296,
52.587695362294696,
33.4645098598079,
22.55765428473376,
22.411286608834335,
39.080048146713004,
60.508108117143415,
93.5172980211498
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "ipsl_cm4",
"variable": "pr",
"monthVals": [
143.46410288220872,
132.5949298243666,
135.34519640429951,
99.63227959017638,
77.46641201596785,
61.750559436864776,
39.53684954336641,
17.431796053949633,
19.639458690408194,
34.46238757010302,
52.400862229608784,
96.96971580726316
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "ipsl_cm4",
"variable": "pr",
"monthVals": [
146.43157485522306,
128.40834148160462,
135.09223724992813,
99.58559051235534,
77.48086865392787,
65.85770275299372,
38.45951081020905,
17.56512454572527,
18.88081536168624,
33.26034794680815,
55.652653655121235,
97.86208694066711
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "miroc3_2_medres",
"variable": "pr",
"monthVals": [
190.92549190691733,
176.86261255977738,
168.41691193116182,
128.42052858062618,
84.95674765004865,
35.114717358506994,
18.12148742227037,
12.567749684140574,
12.740203656059471,
63.758448099123044,
147.84059094328217,
171.79107008151317
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "miroc3_2_medres",
"variable": "pr",
"monthVals": [
195.0668043119673,
172.29306927825215,
170.15583402709314,
123.00083713194337,
78.98758659004356,
35.92240550039776,
18.46134530901646,
11.140726613921489,
17.471851663517906,
63.69252387848479,
141.36051661353275,
181.1016599520231
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "miub_echo_g",
"variable": "pr",
"monthVals": [
208.58505932633318,
179.837714735397,
198.30316450744644,
152.6327679389209,
83.93160272278362,
41.39092457609803,
30.61845493369003,
35.52396039966745,
74.29119929802002,
147.17049732250592,
214.2336633395438,
226.70715571716582
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "miub_echo_g",
"variable": "pr",
"monthVals": [
206.52781237543974,
177.74201983897703,
190.08455382830346,
154.43441522646998,
85.96712466047033,
41.489245182647046,
32.20410120499347,
36.21056855727497,
71.78471469931765,
142.96797063812772,
215.49234481406197,
228.1138284227602
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "mpi_echam5",
"variable": "pr",
"monthVals": [
180.77466286046044,
149.3793813622988,
163.07831207208108,
131.55627130403627,
84.77701849720836,
41.45075043027561,
26.40401604322258,
31.009465162774607,
44.24003048170926,
85.85619102661683,
143.52129150493684,
206.99347209085212
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "mpi_echam5",
"variable": "pr",
"monthVals": [
182.76784520761888,
156.3852298428511,
162.6228149127028,
126.70823523431994,
85.58755272573022,
39.03980338501256,
25.965026060528565,
33.1951651547854,
39.89377668542464,
89.7679369990353,
142.43945579612637,
199.26956275500058
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "mri_cgcm2_3_2a",
"variable": "pr",
"monthVals": [
179.18495546186637,
168.96244960548088,
180.56627003494475,
147.49454244257745,
106.79773883906017,
70.85113422426691,
62.21667733710024,
68.55841674740657,
77.86985095727249,
131.45682860267306,
163.50456629811427,
181.24327363376818
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "mri_cgcm2_3_2a",
"variable": "pr",
"monthVals": [
177.37817018226025,
169.1997076473039,
180.15588842240402,
150.3328246057465,
110.77655322150748,
74.24749105798715,
64.98362879626876,
65.74352470647946,
80.09972446999093,
131.5683678926702,
168.53200984633992,
177.34859966179434
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "ukmo_hadcm3",
"variable": "pr",
"monthVals": [
209.42172542928287,
192.61752554377162,
186.7883453559198,
117.9764835939969,
64.50786728078764,
44.53443780072038,
25.562549431184372,
24.096708607839396,
46.94644722579118,
100.12003266912087,
148.82644332984535,
185.24377347516656
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "b1",
"gcm": "ukmo_hadcm3",
"variable": "pr",
"monthVals": [
200.37673916648623,
186.72682979043873,
186.52648285216472,
125.1086215719615,
69.69767004136803,
42.72595884216439,
27.515754257908124,
28.09842532467795,
55.95814292670152,
100.89312554123707,
149.08948088774804,
184.6118687950643
],
"fromYear": 2040,
"toYear": 2059
},
{
"scenario": "a2",
"gcm": "ukmo_hadgem1",
"variable": "pr",
"monthVals": [
225.71320105234378,
211.64536703106893,
223.5107293719708,
174.0137847081534,
148.4994484048934,
117.09818273534523,
68.6275054868496,
51.291382924190216,
55.65796913436562,
109.87616048343556,
151.88583607272494,
196.01073552023018
],
"fromYear": 2040,
"toYear": 2059
}
]
data = [
dict(url=url_a, resp=response_a),
dict(url=url_b, resp=response_b),
]
class ModelledVarAANOM(ModelledData):
data_type = "annualanom"
data_stat = "tas"
url_a = "climatedataapi.worldbank.org/climateweb/rest/v1/country/annualanom/tas/2020/2039/jpn"
response_a = [
{
"scenario": "a2",
"gcm": "bccr_bcm2_0",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
0.7786479749176315
]
},
{
"scenario": "b1",
"gcm": "bccr_bcm2_0",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
0.8449176989103157
]
},
{
"scenario": "a2",
"gcm": "cccma_cgcm3_1",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.2275165758643685
]
},
{
"scenario": "b1",
"gcm": "cccma_cgcm3_1",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.0621217426498424
]
},
{
"scenario": "a2",
"gcm": "cnrm_cm3",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.1647210372120789
]
},
{
"scenario": "b1",
"gcm": "cnrm_cm3",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.429963764391737
]
},
{
"scenario": "a2",
"gcm": "csiro_mk3_5",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.2534846255653422
]
},
{
"scenario": "b1",
"gcm": "csiro_mk3_5",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
0.9668153461658157
]
},
{
"scenario": "a2",
"gcm": "gfdl_cm2_0",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.0066664846322106
]
},
{
"scenario": "b1",
"gcm": "gfdl_cm2_0",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.3024468672897367
]
},
{
"scenario": "a2",
"gcm": "gfdl_cm2_1",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
0.9445158305922633
]
},
{
"scenario": "b1",
"gcm": "gfdl_cm2_1",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.217628880551053
]
},
{
"scenario": "a2",
"gcm": "ingv_echam4",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
0.721512643914342
]
},
{
"scenario": "a2",
"gcm": "inmcm3_0",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.3766808760792104
]
},
{
"scenario": "b1",
"gcm": "inmcm3_0",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
0.9657624897205526
]
},
{
"scenario": "a2",
"gcm": "ipsl_cm4",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.0700354325148944
]
},
{
"scenario": "b1",
"gcm": "ipsl_cm4",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.1120043302838944
]
},
{
"scenario": "a2",
"gcm": "miroc3_2_medres",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.504642687345158
]
},
{
"scenario": "b1",
"gcm": "miroc3_2_medres",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.3705990439960523
]
},
{
"scenario": "a2",
"gcm": "miub_echo_g",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.4130586322989738
]
},
{
"scenario": "b1",
"gcm": "miub_echo_g",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.0317559493214734
]
},
{
"scenario": "a2",
"gcm": "mpi_echam5",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
0.6037645841900264
]
},
{
"scenario": "b1",
"gcm": "mpi_echam5",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
0.6843181409334473
]
},
{
"scenario": "a2",
"gcm": "mri_cgcm2_3_2a",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
0.8660503186673421
]
},
{
"scenario": "b1",
"gcm": "mri_cgcm2_3_2a",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.0293233771075527
]
},
{
"scenario": "a2",
"gcm": "ukmo_hadcm3",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.3679215280637105
]
},
{
"scenario": "b1",
"gcm": "ukmo_hadcm3",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.2086350290398158
]
},
{
"scenario": "a2",
"gcm": "ukmo_hadgem1",
"variable": "tas",
"fromYear": 2020,
"toYear": 2039,
"annualData": [
1.3869098864103686
]
}
]
url_b = "climatedataapi.worldbank.org/climateweb/rest/v1/country/annualanom/tas/2060/2079/jpn"
response_b = [
{
"scenario": "a2",
"gcm": "bccr_bcm2_0",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.255086798416842
]
},
{
"scenario": "b1",
"gcm": "bccr_bcm2_0",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
1.4150808233955265
]
},
{
"scenario": "a2",
"gcm": "cccma_cgcm3_1",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.6754439504526317
]
},
{
"scenario": "b1",
"gcm": "cccma_cgcm3_1",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
1.70144974558079
]
},
{
"scenario": "a2",
"gcm": "cnrm_cm3",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
3.0710481342507894
]
},
{
"scenario": "b1",
"gcm": "cnrm_cm3",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.1501922607426316
]
},
{
"scenario": "a2",
"gcm": "csiro_mk3_5",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.567907232987895
]
},
{
"scenario": "b1",
"gcm": "csiro_mk3_5",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
1.9166894210021053
]
},
{
"scenario": "a2",
"gcm": "gfdl_cm2_0",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.951608758223684
]
},
{
"scenario": "b1",
"gcm": "gfdl_cm2_0",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.52318854080921
]
},
{
"scenario": "a2",
"gcm": "gfdl_cm2_1",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.5611435739621053
]
},
{
"scenario": "b1",
"gcm": "gfdl_cm2_1",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
1.999645835474737
]
},
{
"scenario": "a2",
"gcm": "ingv_echam4",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
1.9863618549544735
]
},
{
"scenario": "a2",
"gcm": "inmcm3_0",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.5045936986015787
]
},
{
"scenario": "b1",
"gcm": "inmcm3_0",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
1.8178285297599999
]
},
{
"scenario": "a2",
"gcm": "ipsl_cm4",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.819903725071842
]
},
{
"scenario": "b1",
"gcm": "ipsl_cm4",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.261749267578158
]
},
{
"scenario": "a2",
"gcm": "miroc3_2_medres",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
3.192606072676842
]
},
{
"scenario": "b1",
"gcm": "miroc3_2_medres",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.301438181024474
]
},
{
"scenario": "a2",
"gcm": "miub_echo_g",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
3.030264603464474
]
},
{
"scenario": "b1",
"gcm": "miub_echo_g",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.4906086168792108
]
},
{
"scenario": "a2",
"gcm": "mpi_echam5",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.403093839946579
]
},
{
"scenario": "b1",
"gcm": "mpi_echam5",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.0043094032678943
]
},
{
"scenario": "a2",
"gcm": "mri_cgcm2_3_2a",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.223550093801053
]
},
{
"scenario": "b1",
"gcm": "mri_cgcm2_3_2a",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
1.9238570363900005
]
},
{
"scenario": "a2",
"gcm": "ukmo_hadcm3",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
3.2231140136713154
]
},
{
"scenario": "b1",
"gcm": "ukmo_hadcm3",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
2.411973652086579
]
},
{
"scenario": "a2",
"gcm": "ukmo_hadgem1",
"variable": "tas",
"fromYear": 2060,
"toYear": 2079,
"annualData": [
3.096522281043947
]
}
]
url_c = "climatedataapi.worldbank.org/climateweb/rest/v1/country/annualanom/tas/ensemble/2060/2079/jpn"
response_c = [
{
"scenario": "a2",
"fromYear": 2060,
"toYear": 2079,
"annualVal": [
2.181849266353948
],
"percentile": 10
},
{
"scenario": "b1",
"fromYear": 2060,
"toYear": 2079,
"annualVal": [
2.492199715814999
],
"percentile": 90
},
{
"scenario": "a2",
"fromYear": 2060,
"toYear": 2079,
"annualVal": [
3.2158861599476314
],
"percentile": 90
},
{
"scenario": "b1",
"fromYear": 2060,
"toYear": 2079,
"annualVal": [
2.1578240645557893
],
"percentile": 50
},
{
"scenario": "b1",
"fromYear": 2060,
"toYear": 2079,
"annualVal": [
1.6806745121352629
],
"percentile": 10
},
{
"scenario": "a2",
"fromYear": 2060,
"toYear": 2079,
"annualVal": [
2.7747529682360526
],
"percentile": 50
}
]
data = [
dict(url=url_a, resp=response_a),
dict(url=url_b, resp=response_b),
dict(url=url_c, resp=response_c),
]
class ModelledStat(ModelledData):
data_type = "mavg"
data_stat = "tmin_means"
url_a = "climatedataapi.worldbank.org/climateweb/rest/v1/country/mavg/ensemble/tmin_means/2046/2065/aus"
response_a = [
{
"scenario": "b1",
"monthVals": [
25.782083803811982,
25.634608734978226,
24.114042061695542,
21.46466295453778,
18.052794096204266,
15.101227853563024,
13.606312052408395,
14.576856708530173,
17.27432642406916,
20.47667560577746,
23.306786077290358,
25.037286224368643
],
"percentile": 90,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "b1",
"monthVals": [
24.041002031960893,
23.880588344994475,
22.67146384769044,
19.886640076104676,
16.046275778875685,
13.048262530434489,
11.696615708667647,
13.040205686357462,
15.58095425287858,
18.5749880472795,
21.244146103331047,
23.116800172595788
],
"percentile": 50,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "a2",
"monthVals": [
21.581415437062162,
21.752888304394073,
20.168976287839964,
17.458623985713725,
14.199868598513163,
11.072101651297425,
9.729770958159154,
10.630333902571474,
13.256081190110892,
16.404454576706183,
18.974266628689783,
20.477993464997603
],
"percentile": 10,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "b1",
"monthVals": [
21.10662211948022,
21.197347937689965,
19.804292882284805,
16.986286434598355,
13.64291070302453,
10.435863842435202,
9.062306179735174,
10.143603411780752,
12.577768972185863,
15.805609361862539,
18.311742615171077,
19.940080189175784
],
"percentile": 10,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "a2",
"monthVals": [
26.199926584035097,
26.08030697292755,
24.52425097995068,
21.83637115902157,
18.305653300815962,
15.245683038498221,
14.1148452737556,
14.981919038562001,
17.592039754656533,
20.77404207865334,
23.537432471381152,
25.52079916636054
],
"percentile": 90,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "a2",
"monthVals": [
24.408924450345864,
24.38896102905363,
23.18872515360395,
20.491847644382446,
16.720330077275246,
13.489942398072039,
12.157988754908306,
13.409644813534802,
16.035596533884487,
19.10823663923685,
21.69680718528129,
23.609122865465135
],
"percentile": 50,
"fromYear": 2046,
"toYear": 2065
}
]
url_b = "climatedataapi.worldbank.org/climateweb/rest/v1/country/mavg/ensemble/tmin_means/2046/2065/nzl"
response_b = [
{
"scenario": "b1",
"monthVals": [
16.401694195610716,
17.008454118460715,
16.4645305361,
14.840376615530001,
13.021743570053214,
11.583745241169643,
10.744972620690714,
10.453464831625,
10.672451002253927,
11.231809565002859,
12.463586228230714,
14.541015999650355
],
"percentile": 90,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "b1",
"monthVals": [
15.367983545582144,
15.912106343678575,
15.328311852042857,
13.773818765363572,
11.987482070920711,
10.564060296334999,
9.669650009702858,
9.45698642731107,
9.854635425973214,
10.563139268330714,
11.863610131406073,
13.69362272534464
],
"percentile": 50,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "a2",
"monthVals": [
13.693805830807142,
13.978051424030355,
13.31321934291607,
11.869024361892144,
10.267027071541426,
8.805862699235357,
8.189702902521427,
8.144503423142499,
8.752993822099999,
9.377128192358573,
10.597079311097856,
12.226380586624286
],
"percentile": 10,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "b1",
"monthVals": [
13.285540955404642,
13.639775242117853,
13.000142897872857,
11.565237573215358,
9.875808937212144,
8.596301266128929,
7.842985459735716,
7.787801623345355,
8.381649102487142,
9.006317768784285,
10.233347552166785,
11.953954969136428
],
"percentile": 10,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "a2",
"monthVals": [
16.686951330732143,
17.245020525803575,
16.69483978407143,
15.03799993651893,
13.24689153262714,
11.917718172072856,
11.048641289976787,
10.828486732078215,
10.977341600833572,
11.547211255340002,
12.763983215594646,
14.979195049835715
],
"percentile": 90,
"fromYear": 2046,
"toYear": 2065
},
{
"scenario": "a2",
"monthVals": [
15.671809571128566,
16.161321912496433,
15.561991895942857,
14.043036835538215,
12.255052345144287,
10.822844896997498,
9.95973421846,
9.724211062704285,
10.008326768875358,
10.813060607225713,
12.155830349238927,
14.113970484054287
],
"percentile": 50,
"fromYear": 2046,
"toYear": 2065
}
]
data = [
dict(url=url_a, resp=response_a),
dict(url=url_b, resp=response_b),
]
| 22.165879 | 108 | 0.434158 | 4,464 | 60,934 | 5.868504 | 0.324821 | 0.017178 | 0.029774 | 0.047028 | 0.366683 | 0.363858 | 0.355384 | 0.316754 | 0.250449 | 0.156087 | 0 | 0.47447 | 0.434962 | 60,934 | 2,748 | 109 | 22.173945 | 0.286407 | 0.000345 | 0 | 0.34026 | 0 | 0.004453 | 0.155297 | 0.01583 | 0 | 0 | 0 | 0 | 0 | 1 | 0.000742 | false | 0 | 0.000742 | 0 | 0.022635 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4b344650e9da8979754cb1e88ee36fa433453ed0 | 215 | py | Python | src/main.py | joshf26/JSML | ef1b033f19b2d5fdf12eb65932f530c07652360e | [
"MIT"
] | 2 | 2020-01-06T21:46:31.000Z | 2020-01-07T08:14:06.000Z | src/main.py | joshf26/JSML | ef1b033f19b2d5fdf12eb65932f530c07652360e | [
"MIT"
] | null | null | null | src/main.py | joshf26/JSML | ef1b033f19b2d5fdf12eb65932f530c07652360e | [
"MIT"
] | null | null | null | from inputparser import parse_input
from transpile import transpile
def main():
data, output_file = parse_input()
html = transpile(data)
output_file.write(html)
if __name__ == '__main__':
main()
| 16.538462 | 37 | 0.706977 | 27 | 215 | 5.185185 | 0.555556 | 0.142857 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 215 | 12 | 38 | 17.916667 | 0.813953 | 0 | 0 | 0 | 0 | 0 | 0.037209 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0 | 0.375 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4b3ac8a5aef92c65f3baa4b5995f57ed3d0dd9e5 | 2,237 | py | Python | src/note/models/note.py | MaximeRaynal/SimpleNote | aee1eeba5561dbf985bd7349a0528bfed6ceaeda | [
"MIT"
] | null | null | null | src/note/models/note.py | MaximeRaynal/SimpleNote | aee1eeba5561dbf985bd7349a0528bfed6ceaeda | [
"MIT"
] | null | null | null | src/note/models/note.py | MaximeRaynal/SimpleNote | aee1eeba5561dbf985bd7349a0528bfed6ceaeda | [
"MIT"
] | null | null | null | import os
import uuid
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from note.models.page import Page
class Note(models.Model):
""" Représentation d'une note comme un ensemble de page.
La plus part des infos sont stocké de manière physique dans les
dossiers le stockage en BDD sert à faciliter la recherche.
Sur le disque une note est stocké dans le dossier settings.NOTE_DIR,
à l'intérieur d'un dossier portant le nom de l'utilisateur.
Une note est un dossier contenant les pages et les attachments.
Le dossier est nommé nomNote_uuid
"""
note_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=50)
description = models.TextField()
privacy_state = models.CharField(max_length=20)
creation_date = models.DateTimeField()
last_update = models.DateTimeField()
is_crypted = models.BooleanField(default=False)
author = models.ForeignKey(User)
tags = models.ManyToManyField('Tag', null=True)
def __str__(self):
return self.name
def laod_page(self):
""" Charge les pages (fichier stocké) associé à la note """
note_directory = os.path.join(settings.NOTE_DIR, self.author)
note_directory = os.path.join(note_directory, self.name)
for element in note_directory:
if element.endswith('.md'):
self.pages.append(Page().load(element))
def save_on_disk(self):
""" Enregistre la note sur le disque """
passnote_directory = os.path.join(settings.NOTE_DIR, self.author)
note_directory = os.path.join(passnote_directory, self.name + '_' + self.note_id)
if not os.path.isdir(note_directory):
os.mkdir(self.name)
for page in self.pages:
page_path = os.path.join(note_directory, page.__str__() + '.md')
with open(page_path, 'w') as f:
f.truncate()
f.write(page.text)
def light_serialization(self):
properties = dict()
properties['uuid'] = str(self.note_id)
properties['name'] = str(self.name)
return properties
| 35.507937 | 89 | 0.665624 | 300 | 2,237 | 4.836667 | 0.436667 | 0.062715 | 0.034459 | 0.052378 | 0.119917 | 0.09235 | 0.09235 | 0.09235 | 0.09235 | 0.09235 | 0 | 0.002941 | 0.240054 | 2,237 | 62 | 90 | 36.080645 | 0.850588 | 0.219043 | 0 | 0 | 0 | 0 | 0.011364 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.102564 | false | 0.051282 | 0.153846 | 0.025641 | 0.564103 | 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 |
4b572d8c55c8387fb2e7d30c27301f01ba34c449 | 1,361 | py | Python | tests/unit_tests/python/qt/test_error_catcher.py | robertapplin/N-Body-Simulations | 9cd9887c64e5c256ad4dbcb86b227561ed7ff413 | [
"MIT"
] | null | null | null | tests/unit_tests/python/qt/test_error_catcher.py | robertapplin/N-Body-Simulations | 9cd9887c64e5c256ad4dbcb86b227561ed7ff413 | [
"MIT"
] | 13 | 2021-01-17T13:19:25.000Z | 2022-02-11T21:51:45.000Z | tests/unit_tests/python/qt/test_error_catcher.py | robertapplin/N-Body-Simulations | 9cd9887c64e5c256ad4dbcb86b227561ed7ff413 | [
"MIT"
] | null | null | null | # Project Repository : https://github.com/robertapplin/N-Body-Simulations
# Authored by Robert Applin, 2020
import pytest
from n_body_simulations.test_helpers.dummy_class_helper import DummyErrorProneClass
from n_body_simulations.test_helpers.setup_test_helper import enable_test_mode
enable_test_mode()
@pytest.fixture(scope='module')
def dummy_class():
return DummyErrorProneClass()
def test_that_the_error_causer_causes_an_error_when_not_using_the_error_catcher(dummy_class):
try:
dummy_class.cause_an_uncaught_exception()
except RuntimeError:
return
pytest.fail("The ErrorCauser class did not cause an exception when expected.")
def test_that_an_exception_is_caught_by_the_error_catcher(dummy_class):
dummy_class.cause_an_exception()
def test_that_a_divide_by_zero_error_is_caught_by_the_error_catcher(dummy_class):
dummy_class.divide_by_zero()
def test_that_an_index_out_of_range_error_is_caught_by_the_error_catcher(dummy_class):
dummy_class.index_out_of_range()
def test_that_a_function_returning_nothing_will_not_cause_an_error_when_decorated_by_the_error_catcher(dummy_class):
dummy_class.function_that_returns_nothing()
def test_that_a_function_will_return_the_correct_value_when_decorated_by_the_error_catcher(dummy_class):
assert dummy_class.function_that_returns_a_value() == 1.0
| 32.404762 | 116 | 0.847906 | 207 | 1,361 | 4.990338 | 0.342995 | 0.135528 | 0.063892 | 0.116167 | 0.396902 | 0.287512 | 0.227493 | 0.227493 | 0.140368 | 0.140368 | 0 | 0.004874 | 0.095518 | 1,361 | 41 | 117 | 33.195122 | 0.834281 | 0.07568 | 0 | 0 | 0 | 0 | 0.05498 | 0 | 0 | 0 | 0 | 0 | 0.043478 | 1 | 0.304348 | false | 0 | 0.130435 | 0.043478 | 0.521739 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4b895850b8fe21db07e7f09783afd0763591a4f2 | 327 | py | Python | xylophone/project/objects/obj_logo.py | Turysaz/pyframework | da44b8127aa6b89d6cdb3bdb564c386520b37e22 | [
"MIT"
] | null | null | null | xylophone/project/objects/obj_logo.py | Turysaz/pyframework | da44b8127aa6b89d6cdb3bdb564c386520b37e22 | [
"MIT"
] | 6 | 2018-04-09T20:57:14.000Z | 2018-04-09T21:18:12.000Z | xylophone/project/objects/obj_logo.py | Turysaz/xylophone | da44b8127aa6b89d6cdb3bdb564c386520b37e22 | [
"MIT"
] | null | null | null | # Copyright (c) 2018 Turysaz <turysaz@posteo.org>
# This is a minimalistic example for a xylophone game object
import pygame, framework
class ObjLogo(GameObject):
# THIS TWO LINES MUST ALWAYS LOOK LIKE THAT #
def __init__(self, event_aggregator, room):
super.__init__(event_aggregator, room)
pass
| 21.8 | 60 | 0.718654 | 43 | 327 | 5.232558 | 0.837209 | 0.133333 | 0.168889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015504 | 0.211009 | 327 | 14 | 61 | 23.357143 | 0.856589 | 0.452599 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
4b8d1f20e8adb8ecc94ffc5b31ad4cb73b0a20f5 | 387 | py | Python | modoboa_postfix_autoreply/apps.py | modoboa/modoboa-postfix-autoreply | 353c62e51a0ecd011d056264422d74fcd571f05b | [
"MIT"
] | 5 | 2017-06-23T08:18:52.000Z | 2021-02-17T07:09:24.000Z | modoboa_postfix_autoreply/apps.py | modoboa/modoboa-postfix-autoreply | 353c62e51a0ecd011d056264422d74fcd571f05b | [
"MIT"
] | 78 | 2015-05-02T09:19:09.000Z | 2022-02-28T02:07:05.000Z | modoboa_postfix_autoreply/apps.py | modoboa/modoboa-postfix-autoreply | 353c62e51a0ecd011d056264422d74fcd571f05b | [
"MIT"
] | 10 | 2015-05-05T10:19:23.000Z | 2020-04-09T05:20:59.000Z | # -*- coding: utf-8 -*-
"""AppConfig for modoboa_postfix_autoreply."""
from __future__ import unicode_literals
from django.apps import AppConfig
class PostfixAutoreplyConfig(AppConfig):
"""App configuration."""
name = "modoboa_postfix_autoreply"
verbose_name = "Auto-reply functionality using Postfix"
def ready(self):
from . import handlers # NOQA:F401
| 20.368421 | 59 | 0.715762 | 42 | 387 | 6.357143 | 0.738095 | 0.104869 | 0.172285 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012618 | 0.180879 | 387 | 18 | 60 | 21.5 | 0.829653 | 0.237726 | 0 | 0 | 0 | 0 | 0.222615 | 0.088339 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 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 |
4ba2c2e5862018ee8445db37764b01a416bc6ec1 | 658 | py | Python | web/spider/test.py | laozhudetui/LSpider | 2c3d1bd5ef740aa49c2e13054d79877edb00a83f | [
"MIT"
] | 311 | 2021-01-20T08:47:37.000Z | 2022-03-30T16:28:04.000Z | web/spider/test.py | hoatrangnv/LSpider-P | 6544b842012eb5bbb8d35d5eafa6175d9fdf76e0 | [
"MIT"
] | 15 | 2021-01-21T02:36:23.000Z | 2021-11-30T03:00:04.000Z | web/spider/test.py | hoatrangnv/LSpider-P | 6544b842012eb5bbb8d35d5eafa6175d9fdf76e0 | [
"MIT"
] | 49 | 2021-01-25T02:48:59.000Z | 2022-03-31T03:56:46.000Z | #!/usr/bin/env python
# encoding: utf-8
'''
@author: LoRexxar
@contact: lorexxar@gmail.com
@file: test.py.py
@time: 2020/4/3 15:45
@desc:
'''
from django.test import TestCase
from django.utils import timezone
from .controller.spider import SpiderCore
class SpiderCoreTests(TestCase):
def test_was_published_recently_with_future_question(self):
scancore = SpiderCore()
scancore.target_list.put({'url': 'https://lorexxar.cn', 'type': 'link', 'deep': 0})
# scancore.target_list.put({'url': "https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js", 'type': 'js', 'deep': 0})
scancore.scan()
return True
| 22.689655 | 132 | 0.676292 | 91 | 658 | 4.802198 | 0.703297 | 0.045767 | 0.08238 | 0.09611 | 0.132723 | 0.132723 | 0 | 0 | 0 | 0 | 0 | 0.028933 | 0.159574 | 658 | 28 | 133 | 23.5 | 0.761302 | 0.384498 | 0 | 0 | 0 | 0 | 0.086076 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 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 |
4ba68a4e727f5e59342b353c9f35007624cddbc6 | 221 | py | Python | mayan/__init__.py | camerondphillips/MAYAN | b8cd44af50f0b2f2b59286d9c88e2f7aa573a93f | [
"Apache-2.0"
] | null | null | null | mayan/__init__.py | camerondphillips/MAYAN | b8cd44af50f0b2f2b59286d9c88e2f7aa573a93f | [
"Apache-2.0"
] | null | null | null | mayan/__init__.py | camerondphillips/MAYAN | b8cd44af50f0b2f2b59286d9c88e2f7aa573a93f | [
"Apache-2.0"
] | null | null | null | from __future__ import unicode_literals
__title__ = 'Mayan EDMS'
__version__ = '1.1.1'
__build__ = 0x010101
__author__ = 'Roberto Rosario'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2011-2015 Roberto Rosario'
| 24.555556 | 53 | 0.778281 | 27 | 221 | 5.296296 | 0.814815 | 0.027972 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104167 | 0.131222 | 221 | 8 | 54 | 27.625 | 0.640625 | 0 | 0 | 0 | 0 | 0 | 0.339367 | 0 | 0 | 0 | 0.036199 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4ba9c6267dd9a2706963c1fc2ed6b4afd96b8b69 | 231 | py | Python | es_sink/es_sink/__init__.py | avmi/community | 94abc715845d17fb4c24e70c7c328b2d4da0d581 | [
"Apache-2.0"
] | 305 | 2019-03-11T15:25:53.000Z | 2021-03-03T09:34:02.000Z | es_sink/es_sink/__init__.py | marhak/odfe-community | c1f2802205eb11c0fdbbbef909b0e33e90ea2ad5 | [
"Apache-2.0"
] | 233 | 2019-03-11T14:52:59.000Z | 2021-03-03T12:11:00.000Z | es_sink/es_sink/__init__.py | marhak/odfe-community | c1f2802205eb11c0fdbbbef909b0e33e90ea2ad5 | [
"Apache-2.0"
] | 97 | 2019-03-17T20:56:46.000Z | 2021-02-28T14:14:01.000Z | __all__ = ['descriptor',
'es_transport',
'flushing_buffer',
'line_buffer',
'sqs_transport',
'transport_exceptions',
'transport_result',
'transport_utils'] | 28.875 | 34 | 0.515152 | 16 | 231 | 6.75 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.372294 | 231 | 8 | 35 | 28.875 | 0.744828 | 0 | 0 | 0 | 0 | 0 | 0.482759 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4bad3a41cd420892a7c5c5bb12d3599772448c88 | 1,508 | py | Python | addons/mixer/blender_client/__init__.py | trisadmeslek/V-Sekai-Blender-tools | 0d8747387c58584b50c69c61ba50a881319114f8 | [
"MIT"
] | null | null | null | addons/mixer/blender_client/__init__.py | trisadmeslek/V-Sekai-Blender-tools | 0d8747387c58584b50c69c61ba50a881319114f8 | [
"MIT"
] | null | null | null | addons/mixer/blender_client/__init__.py | trisadmeslek/V-Sekai-Blender-tools | 0d8747387c58584b50c69c61ba50a881319114f8 | [
"MIT"
] | null | null | null | # GPLv3 License
#
# Copyright (C) 2020 Ubisoft
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
This package defines how we send Blender updates to the server, and how we interpret updates we receive to update
Blender's data.
These functionalities are implemented in the BlenderClient class and in submodules of the package.
Submodules with a well defined entity name (camera, collection, light, ...) handle updates for the corresponding
data type in Blender. The goal is to replace all this specific code with the submodule data.py, which use
the blender_data package to treat updates of Blender's data in a generic way.
Specific code will still be required to handle non-Blender clients. As an example, mesh.py add to the MESH
message a triangulated, with modifiers applied, of the mesh. This is for non-Blender clients. In the future we want to
move these kind of specific processes to a plug-in system.
"""
| 45.69697 | 118 | 0.776525 | 249 | 1,508 | 4.698795 | 0.53012 | 0.021368 | 0.033333 | 0.048718 | 0.070085 | 0.047863 | 0 | 0 | 0 | 0 | 0 | 0.004815 | 0.17374 | 1,508 | 32 | 119 | 47.125 | 0.934189 | 0.972149 | 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 |
4bb2a9746529bca7a0b3ca83d5f6cb6f5f6cc6d0 | 614 | py | Python | gen_vocab.py | NonvolatileMemory/baseline_for_chatbot-mxnet | 2d32dbfe85653af92c6ef461888110b845d62a70 | [
"MIT"
] | 7 | 2017-12-14T14:30:27.000Z | 2018-12-25T11:16:36.000Z | gen_vocab.py | NonvolatileMemory/baseline_for_chatbot-mxnet | 2d32dbfe85653af92c6ef461888110b845d62a70 | [
"MIT"
] | null | null | null | gen_vocab.py | NonvolatileMemory/baseline_for_chatbot-mxnet | 2d32dbfe85653af92c6ef461888110b845d62a70 | [
"MIT"
] | null | null | null | from data_utils import *
import pickle
fenci_right_save_path = "/root/PycharmProjects/sigir/data/right_fenci_profile_pad.csv"
fenci_wrong_save_path = "/root/PycharmProjects/sigir/data/wrong_fenci_profile_pad.csv"
raw_data, raw_label = load_data_and_labels(fenci_right_save_path, fenci_wrong_save_path)
word2id, id2word = build_vocab(raw_data)
with open('/root/PycharmProjects/sigir/baseline/dual_lstm/vocab/word2id_file', 'wb') as f:
pickle.dump(word2id, f)
f.close()
with open('/root/PycharmProjects/sigir/baseline/dual_lstm/vocab/id2word_file', 'wb') as ff:
pickle.dump(id2word, ff)
ff.close() | 40.933333 | 91 | 0.79316 | 94 | 614 | 4.861702 | 0.393617 | 0.070022 | 0.210066 | 0.078775 | 0.389497 | 0.389497 | 0.231947 | 0.231947 | 0.231947 | 0 | 0 | 0.010733 | 0.089577 | 614 | 15 | 92 | 40.933333 | 0.806798 | 0 | 0 | 0 | 0 | 0 | 0.413008 | 0.406504 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4bb9db117c9c8d8a8f6f0501dc48a084ee89dbad | 1,534 | py | Python | src/bc/lib/keys.py | OsmelLavalier/OlavalierChain | a30b413a5a80394660949a333a12c2675e146a54 | [
"MIT"
] | null | null | null | src/bc/lib/keys.py | OsmelLavalier/OlavalierChain | a30b413a5a80394660949a333a12c2675e146a54 | [
"MIT"
] | null | null | null | src/bc/lib/keys.py | OsmelLavalier/OlavalierChain | a30b413a5a80394660949a333a12c2675e146a54 | [
"MIT"
] | null | null | null | import rsa
from cryptography.fernet import Fernet
# TODO: implement decryption logic so another client can access the data sent
def generate_key_pair():
"""Generate public/private key pair"""
pubkey, privkey = rsa.newkeys(nbits=2048)
return pubkey, privkey
def get_keys_as_pem(pubkey: rsa.key.PublicKey, privkey: rsa.key.PrivateKey):
"""Get public/private key pair in PEM format"""
return pubkey.save_pkcs1('PEM'), privkey.save_pkcs1('PEM')
def get_encrypt_data(secret: bytes, public_pem: bytes):
"""Generate a random key and encrypt data and public from client"""
symmetric_key = Fernet.generate_key() # Generating a random bytes key
cipher = Fernet(symmetric_key) # create the cipher
# Encrypt data
secret_encrypted = cipher.encrypt(secret)
# Encrypt the symmetric key with clients public key
pubkey = rsa.PublicKey.load_pkcs1(public_pem)
encrypted_public_key = rsa.encrypt(message=symmetric_key, pub_key=pubkey)
return secret_encrypted, encrypted_public_key
def get_decrypted_data(secret: bytes, encrypted_public_key: bytes, private_pem: bytes):
"""Decrypt client data and return it"""
# Load PEM
private_key = rsa.PrivateKey.load_pkcs1(private_pem)
# Decrypt the encrypted key with private key
decrypted_public_key = rsa.decrypt(crypto=encrypted_public_key, priv_key=private_key)
cipher = Fernet(decrypted_public_key)
# Decrypt the secret
decrypted_data = cipher.decrypt(secret)
return decrypted_data.decode('utf-8') | 30.68 | 89 | 0.745763 | 211 | 1,534 | 5.227488 | 0.298578 | 0.057117 | 0.065277 | 0.036265 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007064 | 0.169492 | 1,534 | 50 | 90 | 30.68 | 0.858713 | 0.279661 | 0 | 0 | 1 | 0 | 0.010204 | 0 | 0 | 0 | 0 | 0.02 | 0 | 1 | 0.2 | false | 0 | 0.1 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4bba001668565e139fc16e22cff9ea6eefc7fb92 | 293 | py | Python | Testes/PF/02.Total do Centro de Custo.py | pedroivoal/Dessoft | da4da1b48112db8da6a6b2ac5beef396c6d624d7 | [
"MIT"
] | null | null | null | Testes/PF/02.Total do Centro de Custo.py | pedroivoal/Dessoft | da4da1b48112db8da6a6b2ac5beef396c6d624d7 | [
"MIT"
] | null | null | null | Testes/PF/02.Total do Centro de Custo.py | pedroivoal/Dessoft | da4da1b48112db8da6a6b2ac5beef396c6d624d7 | [
"MIT"
] | null | null | null | def total_centro_custo(D_e):
D_return = {}
# Pecorre dados de cada pessoa
for v in D_e.values():
if v['centro de custo'] not in D_return:
D_return[v['centro de custo']] = 0
D_return[v['centro de custo']] += v['valor']
return D_return | 24.416667 | 52 | 0.56314 | 46 | 293 | 3.391304 | 0.434783 | 0.224359 | 0.173077 | 0.269231 | 0.269231 | 0.269231 | 0 | 0 | 0 | 0 | 0 | 0.005 | 0.317406 | 293 | 12 | 53 | 24.416667 | 0.775 | 0.095563 | 0 | 0 | 0 | 0 | 0.189394 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.285714 | 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 |
298d7d6194f5d8dd86de6010e1ac5f0d1f9606ae | 122 | py | Python | xworker/main.py | ciur/lesson-8-python-packaging | 103914288b617bc716fcbba05820743844e97269 | [
"Apache-2.0"
] | null | null | null | xworker/main.py | ciur/lesson-8-python-packaging | 103914288b617bc716fcbba05820743844e97269 | [
"Apache-2.0"
] | 7 | 2020-06-05T20:26:15.000Z | 2021-09-22T18:21:02.000Z | xworker/main.py | ciur/lesson-8-python-packaging | 103914288b617bc716fcbba05820743844e97269 | [
"Apache-2.0"
] | null | null | null | from utils import prepare
def start():
prepare()
print("Let's start!")
if __name__ == '__main__':
start()
| 11.090909 | 26 | 0.606557 | 15 | 122 | 4.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.245902 | 122 | 10 | 27 | 12.2 | 0.717391 | 0 | 0 | 0 | 0 | 0 | 0.163934 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | true | 0 | 0.166667 | 0 | 0.333333 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
299597ab1b612a8400444aff1727c676d8fd1c8c | 261 | py | Python | microesp/esp8266/error.py | ashep/microesp | 288e1775f470831ddc873e5dde860ce969eb74b6 | [
"MIT"
] | null | null | null | microesp/esp8266/error.py | ashep/microesp | 288e1775f470831ddc873e5dde860ce969eb74b6 | [
"MIT"
] | null | null | null | microesp/esp8266/error.py | ashep/microesp | 288e1775f470831ddc873e5dde860ce969eb74b6 | [
"MIT"
] | null | null | null | """MicroESP Errors
"""
__author__ = 'Oleksandr Shepetko'
__email__ = 'a@shepetko.com'
__license__ = 'MIT'
class ESP8266Error(Exception):
pass
class DeviceNotConnectedError(ESP8266Error):
pass
class DeviceCodeExecutionError(ESP8266Error):
pass
| 14.5 | 45 | 0.747126 | 23 | 261 | 7.956522 | 0.695652 | 0.098361 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054299 | 0.153257 | 261 | 17 | 46 | 15.352941 | 0.773756 | 0.057471 | 0 | 0.333333 | 0 | 0 | 0.146444 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.333333 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
299ac7ef7e24acfc28fe3e598545034303f516ad | 760 | py | Python | frontend/urls.py | mtianyan/django-drf-react-quickstart | 10ab8fa02c6be7e58177bf41b1e4a3f09f67e4d5 | [
"Apache-2.0"
] | 3 | 2019-01-07T06:00:07.000Z | 2019-08-19T08:42:57.000Z | frontend/urls.py | mtianyan/django-drf-react-quickstart | 10ab8fa02c6be7e58177bf41b1e4a3f09f67e4d5 | [
"Apache-2.0"
] | 3 | 2020-06-05T19:59:17.000Z | 2021-06-10T22:07:06.000Z | frontend/urls.py | mtianyan/django-drf-react-quickstart | 10ab8fa02c6be7e58177bf41b1e4a3f09f67e4d5 | [
"Apache-2.0"
] | null | null | null | # !/usr/bin/python
# -*-coding:utf-8-*-
__author__ = 'mtianyan'
__date__ = '2019-01-07 21:19'
"""
┏┓ ┏┓+ +
┏┛┻━━━┛┻┓ + +
┃ ┃
┃ ━ ┃ ++ + + +
████━████ ┃+
┃ ┃ +
┃ ┻ ┃
┃ ┃ + +
┗━┓ ┏━┛
┃ ┃
┃ ┃ + + + +
┃ ┃ Code is far away from bug with the animal protecting
┃ ┃ + 神兽保佑,代码无bug
┃ ┃
┃ ┃ +
┃ ┗━━━┓ + +
┃ ┣┓
┃ ┏┛
┗┓┓┏━┳┓┏┛ + + + +
┃┫┫ ┃┫┫
┗┻┛ ┗┻┛+ + + +
"""
from django.urls import path
from . import views
urlpatterns = [
path('', views.index ),
] | 23.75 | 79 | 0.232895 | 80 | 760 | 3.1875 | 0.5875 | 0.133333 | 0.129412 | 0.094118 | 0.043137 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038922 | 0.560526 | 760 | 32 | 80 | 23.75 | 0.467066 | 0.046053 | 0 | 0 | 0 | 0 | 0.157895 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
29b434f84b5aeaa66a0c2fe65bb604e05b12b197 | 7,364 | py | Python | copernicus_retrieval/parser.py | FWidm/CopernicusRetrieval | 5a31694fd44dee3e4773fd17cdd66136d039eb89 | [
"MIT"
] | 1 | 2019-06-02T11:47:37.000Z | 2019-06-02T11:47:37.000Z | copernicus_retrieval/parser.py | FWidm/CopernicusRetrieval | 5a31694fd44dee3e4773fd17cdd66136d039eb89 | [
"MIT"
] | null | null | null | copernicus_retrieval/parser.py | FWidm/CopernicusRetrieval | 5a31694fd44dee3e4773fd17cdd66136d039eb89 | [
"MIT"
] | null | null | null | from datetime import datetime
import eccodes
import pytz
from copernicus_retrieval import util
from copernicus_retrieval.data import copernicus_data
from copernicus_retrieval.data.copernicus_enums import Time, ParameterCAMS
class Parser(object):
def retrieve_metadata(self, gid):
"""
Retrieves specific metadata keys from the currently loaded grib file
more information: https://software.ecmwf.int/wiki/display/ECC/GRIB%3A+Keys
:param gid: grib file
:return: dictionary containing the keys
"""
keys = [
#todo: add more params if needed.
'dataTime',
'paramId', # parameter works as well
'units',
'shortName',
'name',
'date',
'step'
]
dict = {}
for key in keys:
try:
dict[key] = eccodes.codes_get(gid, key)
except eccodes.CodesInternalError as err:
print 'Error with key="%s" : %s' % (key, err.msg)
return dict
def convert_to_alternative_unit(self, value, unit):
"""
Converts the retrieved value from thee existing Unit into another one if supported.
:param value: to convert from
:param unit: to convert from
:return: touple of value and unit
"""
#print value,unit
if "K" in unit:
return value-273.15,"C"
return None,None
def format_data(self, eccData, metadata):
"""
reformat the data
:param eccData: contains lat, lon, index, value, distance (from target in km)
:param metadata: contains dataTime, paramId, units, shortName, name
:return:
"""
ret_dict = {}
data = {}
for i in range(0, len(eccData)):
data = dict(eccData[i])
#data['paramId'] = metadata['paramId']
data['date'] = datetime.strptime(str(metadata['date']), '%Y%m%d').replace(hour=metadata['dataTime'] / 100,
tzinfo=pytz.UTC)
converted_val, target_unit = self.convert_to_alternative_unit(data['value'],metadata['units'])
data['description'] = metadata
if converted_val:
data['convertedValue']=converted_val
if target_unit:
data['description']['convertedUnit'] = target_unit
param = ParameterCAMS.lookup_id(metadata['paramId'])
#todo: adjust type here.
ret_dict[param.name] = copernicus_data.CopernicusData(data,metadata['name'])
return ret_dict
def get_nearest_values(self, filePath, point, n=1, parameters=ParameterCAMS.all(),
times=Time.all(), regroup=True):
"""
Retrieves data from the given filePath - retrieves 1 or 4 values near the given point
:param filePath: path to the retrieved grib file
:param point: (latitude,longitude)
:param n: 1 or 4 points to retrieve
:param parameters: list of parameters (Enums.Parameter)
:param times: list of times (Enums.Time)
:return: dict containing all expected values
"""
f = open(filePath)
if n != 1 and n != 4:
raise Exception("Parameter 'n' describes the number of requested data points and must be either 1 or 4.")
if type(point[0]) is not float:
raise Exception("Point should be a list of two coordinates in the form of [lat:float,lon:float] ")
results = {}
list = []
# loop through all the parameters
while 1:
gid = eccodes.codes_grib_new_from_file(f)
if gid is None:
break
metadata = self.retrieve_metadata(gid)
if ParameterCAMS.lookup_id(metadata['paramId']) not in parameters: # skip unused/unsupported params
#print "skipping... metadata={}".format(metadata)
continue
if Time.lookup_time(metadata['dataTime']) not in times: # skip unused/unsupported times
continue
nearest = eccodes.codes_grib_find_nearest(gid, point[0], point[1], is_lsm=False, npoints=n)
data = self.format_data(nearest, metadata)
list.append(data)
eccodes.codes_release(gid)
f.close()
results['values'] = list
if regroup:
results = self.group_dict_by_param(results)
return results
def group_dict_by_param(self, dict):
"""
groups all values of a specific type inside the same dict e.g. if 4 values for "mean sea level pressure" exist,
all values are now in a list under the same key.
:param dict: resulting dict after parsing
:return: grouped up dictionary by parameter-type
"""
new = {}
for item in dict['values']:
for key, val in item.iteritems():
if key not in new:
new[key] = []
new[key].append(val)
return new
def get_parameters(self, filePath,csv=False):
"""
Retrieves parameters for all parameters that are currently available at time 00:00:00 and returns them as a list of strings for
Enums.Parameter.py
:param filePath:
:return:
"""
f = open(filePath)
metadata_list = []
# loop through all the parameters and retrieve the metadata
while 1:
gid = eccodes.codes_grib_new_from_file(f)
if gid is None:
break
metadata = self.retrieve_metadata(gid)
if (Time.lookup_time(metadata['dataTime']) == Time.ZERO):
metadata_list.append(metadata)
return util.parameter_to_string(metadata_list, csv=csv)
def test_dwd_grib(self, filePath, point, n=1, parameters=ParameterCAMS.all(),
times=Time.all(), regroup=False):
"""
Retrieves data from the given filePath - retrieves 1 or 4 values near the given point
:param filePath: path to the retrieved grib file
:param point: (latitude,longitude)
:param n: 1 or 4 points to retrieve
:param parameters: list of parameters (Enums.Parameter)
:param times: list of times (Enums.Time)
:return: dict containing all expected values
"""
f = open(filePath)
if n != 1 and n != 4:
raise Exception("Parameter 'n' describes the number of requested data points and must be either 1 or 4.")
if type(point[0]) is not float:
raise Exception("Point should be a list of two coordinates in the form of [lat:float,lon:float] ")
results = {}
list = []
# loop through all the parameters
while 1:
gid = eccodes.codes_grib_new_from_file(f)
if gid is None:
break
metadata = self.retrieve_metadata(gid)
print metadata
nearest = eccodes.codes_grib_find_nearest(gid, point[0], point[1], is_lsm=False, npoints=n)
list.append(nearest)
eccodes.codes_release(gid)
f.close()
results['values'] = list
if regroup:
results = self.group_dict_by_param(results)
return results | 37.958763 | 135 | 0.584193 | 877 | 7,364 | 4.822121 | 0.253136 | 0.0227 | 0.005675 | 0.012769 | 0.451407 | 0.434382 | 0.412391 | 0.412391 | 0.412391 | 0.412391 | 0 | 0.008882 | 0.327268 | 7,364 | 194 | 136 | 37.958763 | 0.844772 | 0.049294 | 0 | 0.40708 | 0 | 0.017699 | 0.107396 | 0.008511 | 0 | 0 | 0 | 0.010309 | 0 | 0 | null | null | 0 | 0.053097 | null | null | 0.017699 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
29c2e4a74615e6f22d1cf8f17d7339f32387441f | 2,498 | py | Python | jupyterhub_config.py | yuvipanda/jupyterhub-multicluster-kubespawner | 11b090addd0374cd552afe4cccb90b67bbb77417 | [
"BSD-3-Clause"
] | 3 | 2022-01-11T10:18:57.000Z | 2022-01-27T01:29:52.000Z | jupyterhub_config.py | yuvipanda/jupyterhub-multicluster-kubespawner | 11b090addd0374cd552afe4cccb90b67bbb77417 | [
"BSD-3-Clause"
] | null | null | null | jupyterhub_config.py | yuvipanda/jupyterhub-multicluster-kubespawner | 11b090addd0374cd552afe4cccb90b67bbb77417 | [
"BSD-3-Clause"
] | null | null | null | from jupyterhub.spawner import SimpleLocalProcessSpawner
from jupyterhub.auth import DummyAuthenticator
c.JupyterHub.allow_named_servers = True
c.JupyterHub.cleanup_servers = False
c.Spawner.hub_connect_url = "https://71dc-36-255-233-17.ngrok.io"
# c.Spawner.hub_connect_ip = "192.168.0.151"
c.JupyterHub.spawner_class = "multicluster_kubespawner.MultiClusterKubeSpawner"
c.JupyterHub.authenticator_class = DummyAuthenticator
c.MultiClusterKubeSpawner.profile_list = [
{
"display_name": "minikube",
"description": "Launch on local minikube",
"spawner_override": {
"kubernetes_context": "minikube",
"ingress_public_url": "http://192.168.64.3:31974",
},
},
{
"display_name": "GKE",
"description": "Launch on GKE on us-central-1",
"spawner_override": {
"kubernetes_context": "gke_ucb-datahub-2018_us-central1_fall-2019",
"ingress_public_url": "http://35.238.7.135",
},
},
{
"display_name": "DigitalOcean SFO",
"description": "Launch on a DigitalOcean Cluster in California",
"spawner_override": {
"kubernetes_context": "do-nyc3-nbss-1",
"ingress_public_url": "http://144.126.250.129",
},
},
]
c.MultiClusterKubeSpawner.patches = {
"01-memory": """
kind: Pod
metadata:
name: {{key}}
spec:
containers:
- name: notebook
resources:
requests:
memory: 16Mi
""",
"02-cpu": """
kind: Pod
metadata:
name: {{key}}
spec:
containers:
- name: notebook
resources:
requests:
cpu: 10m
""",
}
# dask-kubernetes setup
c.MultiClusterKubeSpawner.resources = {
"10-dask-role": """
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{key}}-dask
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- list
- create
- delete
""",
"11-dask-rolebinding": """
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{key}}-dask
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{key}}-dask
subjects:
- apiGroup: ""
kind: ServiceAccount
name: {{key}}
""",
}
| 25.489796 | 79 | 0.551241 | 234 | 2,498 | 5.760684 | 0.5 | 0.031157 | 0.04451 | 0.071217 | 0.152819 | 0.152819 | 0.152819 | 0.096439 | 0.096439 | 0.096439 | 0 | 0.050708 | 0.321057 | 2,498 | 97 | 80 | 25.752577 | 0.744104 | 0.025621 | 0 | 0.386364 | 0 | 0 | 0.659399 | 0.070341 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.022727 | 0 | 0.022727 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
29d4815e922d6a3072e087d70d1740de5b3958c1 | 3,946 | py | Python | mtg/cards/views.py | thomasperrot/MTGTrader | 36c2d4992bb5cfff48e36aeb48c0fc8122d8a8b0 | [
"MIT"
] | 5 | 2017-09-27T15:58:41.000Z | 2020-08-30T02:33:58.000Z | mtg/cards/views.py | thomasperrot/MTGTrader | 36c2d4992bb5cfff48e36aeb48c0fc8122d8a8b0 | [
"MIT"
] | null | null | null | mtg/cards/views.py | thomasperrot/MTGTrader | 36c2d4992bb5cfff48e36aeb48c0fc8122d8a8b0 | [
"MIT"
] | 2 | 2019-10-18T00:04:30.000Z | 2021-06-06T10:14:41.000Z | """
@author: Thomas PERROT
Contains views for cards app
"""
from datetime import date, timedelta
from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from rest_framework import viewsets
from rest_framework.decorators import list_route, detail_route
from rest_framework.response import Response
from . import serializers
from . import tasks
from .models import CardName, Card
import stats
import tournaments
class CardNameViewSet(viewsets.ReadOnlyModelViewSet):
"""View for card names.
"""
queryset = CardName.objects.order_by('name')
serializer_class = serializers.CardNameSerializer
search_fields = ('name',)
class CardViewSet(viewsets.ReadOnlyModelViewSet):
"""View for cards.
"""
queryset = Card.objects.order_by('name')
serializer_class = serializers.CardSerializer
search_fields = ('name', 'set')
@list_route()
def get_failed_mkm(self, request) -> Response:
"""Returns cards that have failed being crawled on magiccardmarket.eu.
"""
failed_cards = Card.objects.filter(
is_relevant=True,
price__isnull=True
).exclude(
layout='double-faced'
)
serializer = self.get_serializer(failed_cards, many=True)
return Response(serializer.data)
@detail_route()
def get_prices(self, request, pk=None) -> Response:
"""Returns last month prices for the given card.
"""
card = get_object_or_404(Card, id=pk)
prices = card.prices.filter(date__gte=date.today() - timedelta(days=30))
serializer = stats.serializers.PriceSerializer(prices, many=True)
return Response(serializer.data)
@detail_route()
def get_playing_ratio(self, request, pk=None) -> Response:
"""Returns last month playing ratio for the given card.
Tournaments are discreet and random events, so one single day can not be representative. We have
to aggregate on tournaments over a certain period to avoid random results. The chosen period is 3 days.
"""
# TODO: This is to slow ! we need to compute it in the background !
card = get_object_or_404(Card, id=pk)
card_name = card.name.name
days_in_month = 30
aggregating_period = 3
playing_ratio = []
for i in range(0, days_in_month // aggregating_period, aggregating_period):
played_cards = tournaments.models.Tournament.get_played_cards(
date.today() - timedelta(days=i), date.today() - timedelta(days=i + aggregating_period))
playing_ratio.append({'date': date.today() - timedelta(days=i),
'ratio': played_cards[card_name] / sum(played_cards.values())})
return Response(playing_ratio)
@detail_route()
def get_statistics(self, request, pk=None) -> Response:
"""Returns all the statistics for the given card for ast month.
"""
card = get_object_or_404(Card, id=pk)
stats = card.stats.filter(date__gte=date.today() - timedelta(30))
serializer = stats.serializers.StatisticsSerializer(stats, many=True)
return Response(serializer.data)
@detail_route()
def get_features(self, request, pk=None) -> Response:
"""Returns today features for the given cards.
"""
card = get_object_or_404(Card, id=pk)
features = card.features_set.filter(date=date.today())
return Response(features.features)
def harvest_sets(request):
"""Temporary view to harvest all sets.
"""
# TODO: remove me
tasks.harvest_sets.delay()
return HttpResponse("<html><body>Harvesting all sets...</body></html>")
def harvest_cards(request):
"""Temporary view to harvest all cards.
"""
# TODO: remove me
tasks.harvest_cards.delay()
return HttpResponse("<html><body>Harvesting all cards...</body></html>")
| 30.122137 | 111 | 0.668018 | 479 | 3,946 | 5.354906 | 0.311065 | 0.021053 | 0.021443 | 0.02729 | 0.322807 | 0.277193 | 0.203119 | 0.134503 | 0.061988 | 0.061988 | 0 | 0.0079 | 0.230106 | 3,946 | 130 | 112 | 30.353846 | 0.836406 | 0.200456 | 0 | 0.169231 | 0 | 0 | 0.044553 | 0.028293 | 0 | 0 | 0 | 0.023077 | 0 | 1 | 0.107692 | false | 0 | 0.169231 | 0 | 0.507692 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
29dd6fd0dca08aeb845fc7c16fd78c45477700cc | 499 | py | Python | server/test.py | SentyFunBall/valour-vapp | ec2c029f206fcb92b59b974cf1335fbfffa3ef9a | [
"MIT"
] | 1 | 2021-01-16T18:01:51.000Z | 2021-01-16T18:01:51.000Z | server/test.py | SentyFunBall/valour-vapp | ec2c029f206fcb92b59b974cf1335fbfffa3ef9a | [
"MIT"
] | 17 | 2021-01-16T08:40:53.000Z | 2021-05-08T19:23:54.000Z | server/test.py | SentyFunBall/valour-vapp | ec2c029f206fcb92b59b974cf1335fbfffa3ef9a | [
"MIT"
] | 3 | 2021-02-01T01:43:38.000Z | 2021-02-02T12:31:48.000Z | import requests
Base = 'http://127.0.0.1:5000/' # use this for the 'base_url' test server, later we will use the valour link
def get(base_url, final):
response = requests.get(base_url + final)
return response.json().keys(), response.json().values()
def post_something(base_url, final, something_key, something_value):
dict_ = dict(zip(something_key, something_value))
response = requests.put(base_url + final, dict_)
return response.json().keys(), response.json().values()
| 33.266667 | 109 | 0.713427 | 73 | 499 | 4.712329 | 0.479452 | 0.101744 | 0.139535 | 0.087209 | 0.232558 | 0.232558 | 0.232558 | 0 | 0 | 0 | 0 | 0.023585 | 0.150301 | 499 | 14 | 110 | 35.642857 | 0.787736 | 0.148297 | 0 | 0.222222 | 0 | 0 | 0.052009 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
29ef1b852840c6c0dc2b43eee5c79b8731c777f0 | 201 | py | Python | Dataset/Leetcode/train/125/98.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/125/98.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/125/98.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution:
def XXX(self, s):
if not s:
return False
a = ''
for i in s:
if i.isalnum():
a += i
return a.lower() == a[::-1].lower()
| 18.272727 | 43 | 0.39801 | 27 | 201 | 2.962963 | 0.62963 | 0.075 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009174 | 0.457711 | 201 | 10 | 44 | 20.1 | 0.724771 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
29f33b865aac93a714a08b6a6e0db850989b2213 | 250 | py | Python | inheritance_example.py | youngvz/youngvz-python | ef64b1ba3de4f8d3c27bf0a9cbaef5b16f59fba2 | [
"MIT"
] | null | null | null | inheritance_example.py | youngvz/youngvz-python | ef64b1ba3de4f8d3c27bf0a9cbaef5b16f59fba2 | [
"MIT"
] | null | null | null | inheritance_example.py | youngvz/youngvz-python | ef64b1ba3de4f8d3c27bf0a9cbaef5b16f59fba2 | [
"MIT"
] | null | null | null | class Robot:
def greet(self):
print('Hello Viraj')
class RobotChild(Robot):
def greet(self):
print('Hello Scott')
# Instantiate RobotChild Class
child = RobotChild()
# Invoke Greet method from RobotChild class
child.greet()
| 19.230769 | 43 | 0.684 | 30 | 250 | 5.7 | 0.5 | 0.093567 | 0.152047 | 0.19883 | 0.315789 | 0.315789 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212 | 250 | 12 | 44 | 20.833333 | 0.86802 | 0.28 | 0 | 0.25 | 0 | 0 | 0.124294 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0.25 | 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 |
29f87a6a467ebfb2792a3bb36c149a79b1bd2d16 | 415 | py | Python | standard-demo/ogms/ogmsservice/base.py | franklinzhanggis/model-interoperable-engine | 40b724813bec9af16f4ca95e36f8ff16be787315 | [
"MIT"
] | null | null | null | standard-demo/ogms/ogmsservice/base.py | franklinzhanggis/model-interoperable-engine | 40b724813bec9af16f4ca95e36f8ff16be787315 | [
"MIT"
] | null | null | null | standard-demo/ogms/ogmsservice/base.py | franklinzhanggis/model-interoperable-engine | 40b724813bec9af16f4ca95e36f8ff16be787315 | [
"MIT"
] | null | null | null | from .utils import HttpHelper
class Service:
def __init__(self, ip, port):
self.ip = ip
self.port = port
def getBaseURL(self):
return "http://" + self.ip + ":" + str(self.port) + "/"
def connect(self):
strData = HttpHelper.Request_get_str_sync(self.ip, self.port, "/ping")
if strData == "OK":
return True
else:
return False
| 24.411765 | 78 | 0.546988 | 49 | 415 | 4.489796 | 0.530612 | 0.109091 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.325301 | 415 | 16 | 79 | 25.9375 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0.038554 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.076923 | 0.076923 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
29fb7e0e9462828210c1437d38360fc5f785fe70 | 183 | py | Python | Basics/5/hi.py | mabdelaal86/python-courses | 5e2be0df3c00eb084ec39d49402be38fac635097 | [
"MIT"
] | 1 | 2020-03-10T15:40:22.000Z | 2020-03-10T15:40:22.000Z | Basics/5/hi.py | mabdelaal86/python-courses | 5e2be0df3c00eb084ec39d49402be38fac635097 | [
"MIT"
] | null | null | null | Basics/5/hi.py | mabdelaal86/python-courses | 5e2be0df3c00eb084ec39d49402be38fac635097 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
def welcome():
print("Welcome")
def hi(name):
print("Hi " + name + "!")
welcome()
username = input("Who are there? ")
hi(name=username)
hi(username)
| 14.076923 | 35 | 0.617486 | 25 | 183 | 4.52 | 0.56 | 0.159292 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006667 | 0.180328 | 183 | 12 | 36 | 15.25 | 0.746667 | 0.114754 | 0 | 0 | 0 | 0 | 0.161491 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4b14373443d6331c2f1f5a413233ecd3a3313e64 | 13,685 | py | Python | importers/htm.py | bliksemlabs/bliksemintegration | 38f4a4b6e7ea28e8f5c4f7fe1a75868549ee4677 | [
"BSD-2-Clause"
] | 5 | 2015-11-13T09:46:18.000Z | 2019-05-12T20:56:00.000Z | importers/htm.py | bliksemlabs/bliksemintegration | 38f4a4b6e7ea28e8f5c4f7fe1a75868549ee4677 | [
"BSD-2-Clause"
] | 5 | 2015-07-11T00:40:01.000Z | 2019-04-30T15:20:34.000Z | importers/htm.py | bliksemlabs/bliksemintegration | 38f4a4b6e7ea28e8f5c4f7fe1a75868549ee4677 | [
"BSD-2-Clause"
] | 5 | 2015-07-15T09:35:54.000Z | 2018-03-11T09:28:52.000Z | from kv1_811 import *
from inserter import insert,version_imported,reject
from bs4 import BeautifulSoup
import urllib2
from settings.const import *
from datetime import datetime,timedelta
import logging
logger = logging.getLogger("importer")
getPool = getFakePool811
def getDataSource():
return { '1' : {
'operator_id' : 'HTM',
'name' : 'HTM KV1',
'description' : 'HTM Rail KV1 leveringen',
'email' : None,
'url' : None}}
def setLineColors():
conn = psycopg2.connect(database_connect)
cur = conn.cursor()
cur.execute("""
update line set name= replace(name,publiccode||' ','') where operator_id like 'HTM:%';
UPDATE line SET color_shield = 'e72419', color_text = 'ffffff' WHERE publiccode = '1' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = 'ffc52d', color_text = '000000' WHERE publiccode = '2' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = 'be1fa1', color_text = 'ffffff' WHERE publiccode = '3' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = 'ef7100', color_text = '000000' WHERE publiccode = '4' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '59e759', color_text = '000000' WHERE publiccode = '5' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '009fe3', color_text = '000000' WHERE publiccode = '6' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '6040a0', color_text = 'ffffff' WHERE publiccode = '8' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '8dbb00', color_text = '000000' WHERE publiccode = '9' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '465c6b', color_text = 'ffffff' WHERE publiccode = '10' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = 'b27f66', color_text = '000000' WHERE publiccode = '11' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = 'e39fc9', color_text = '000000' WHERE publiccode = '12' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '8c7ad2', color_text = '000000' WHERE publiccode = '15' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '773d29', color_text = 'ffffff' WHERE publiccode = '16' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '003186', color_text = 'ffffff' WHERE publiccode = '17' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '00a788', color_text = '000000' WHERE publiccode = '19' and transportmode = 'TRAM' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '009fe3', color_text = '000000' WHERE publiccode = '18' and transportmode = 'BUS' and operator_id like 'HTM:%';
UPDATE line SET color_shield = 'ef7100', color_text = '000000' WHERE publiccode = '21' and transportmode = 'BUS' and operator_id like 'HTM:%';
UPDATE line SET color_shield = 'e39fc9', color_text = '000000' WHERE publiccode = '22' and transportmode = 'BUS' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '003186', color_text = 'ffffff' WHERE publiccode = '23' and transportmode = 'BUS' and operator_id like 'HTM:%';
UPDATE line SET color_shield = 'be1fa1', color_text = 'ffffff' WHERE publiccode = '24' and transportmode = 'BUS' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '773d29', color_text = 'ffffff' WHERE publiccode = '25' and transportmode = 'BUS' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '8dbb00', color_text = '000000' WHERE publiccode = '26' and transportmode = 'BUS' and operator_id like 'HTM:%';
UPDATE line SET color_shield = 'e72419', color_text = 'ffffff' WHERE publiccode = '28' and transportmode = 'BUS' and operator_id like 'HTM:%';
UPDATE line SET color_shield = '000000', color_text = 'f7ff00' WHERE publiccode like 'N%' and transportmode = 'BUS' and operator_id like 'HTM:%';
""")
cur.close()
conn.commit()
conn.close()
def generatePool(conn):
cur = conn.cursor()
cur.execute("""
CREATE TEMPORARY TABLE temp_pool as (
SELECT dataownercode,userstopcodebegin,userstopcodeend,transporttype,row_number() OVER (PARTITION BY
dataownercode,userstopcodebegin,userstopcodeend,transporttype ORDER BY index) as index,locationx_ew,locationy_ns
FROM
((SELECT DISTINCT ON (userstopcodebegin,userstopcodeend,transporttype)
dataownercode,userstopcodebegin,userstopcodeend,transporttype,0 as index,locationx_ew,locationy_ns
FROM pool JOIN point using (version,dataownercode,pointcode)
ORDER BY userstopcodebegin,userstopcodeend,transporttype,distancesincestartoflink ASC)
UNION
(SELECT DISTINCT ON (userstopcodebegin,userstopcodeend,transporttype)
dataownercode,userstopcodebegin,userstopcodeend,transporttype,99999 as index,locationx_ew,locationy_ns
FROM pool JOIN point using (version,dataownercode,pointcode)
ORDER BY userstopcodebegin,userstopcodeend,transporttype,distancesincestartoflink DESC)
UNION
SELECT dataownercode,userstopcodebegin,userstopcodeend,transporttype,(dp).path[1] as index,st_x((dp).geom)::integer as
locationx_ew,st_y((dp).geom)::integer as locationy_ns
FROM
(SELECT dataownercode,userstopcodebegin,userstopcodeend,transporttype,st_dumppoints(geom) as dp FROM htm_pool_geom) as x) as pool
ORDER BY dataownercode,userstopcodebegin,userstopcodeend,transporttype,index);
DELETE FROM temp_pool WHERE userstopcodebegin||':'||userstopcodeend||':'||transporttype NOT in (SELECT DISTINCT
userstopcodebegin||':'||userstopcodeend||':'||transporttype FROM htm_pool_geom);
INSERT INTO POINT (
SELECT DISTINCT ON (locationx_ew,locationy_ns)
'POINT',1,'I' as implicit,'HTM','OG'||row_number() OVER (ORDER BY locationx_ew,locationy_ns),current_date as validfrom,'PL' as pointtype,'RD' as
coordinatesystemtype,locationx_ew,locationy_ns,0 as locationz, NULL as description
FROM
temp_pool where locationx_ew||':'||locationy_ns not in (select distinct locationx_ew||':'||locationy_ns from point where version = 1)
);
DELETE FROM pool WHERE userstopcodebegin||':'||userstopcodeend||':'||transporttype in (SELECT DISTINCT
userstopcodebegin||':'||userstopcodeend||':'||transporttype FROM temp_pool) and version = 1;
INSERT INTO pool(
SELECT DISTINCT ON (version, dataownercode, userstopcodebegin, userstopcodeend, linkvalidfrom, pointcode, transporttype)
'POOL',l.version,'I',p.dataownercode,p.userstopcodebegin,p.userstopcodeend,l.validfrom as linkvalidfrom,p.dataownercode,pt.pointcode,
SUM(coalesce(st_distance(st_setsrid(st_makepoint(p.locationx_ew,p.locationy_ns),28992),st_setsrid(st_makepoint(prev.locationx_ew,prev.locationy_ns),28992))::integer,0))
OVER (PARTITION BY l.version,p.dataownercode,p.userstopcodebegin,p.userstopcodeend,p.transporttype
ORDER BY p.index
ROWS between UNBOUNDED PRECEDING and 0 PRECEDING) as distancesincestartoflink,
NULL as sgementspeed,NULL as localpointspeed,NULL as description,p.transporttype
FROM
temp_pool as p JOIN link as l USING (dataownercode,userstopcodebegin,userstopcodeend,transporttype)
JOIN (SELECT DISTINCT ON (version,locationx_ew,locationy_ns) version,locationx_ew,locationy_ns,pointcode
FROM POINT ) AS pt USING (locationx_ew,locationy_ns)
LEFT JOIN temp_pool as prev ON (p.index = prev.index +1 AND p.transporttype = prev.transporttype
AND p.userstopcodebegin = prev.userstopcodebegin AND p.userstopcodeend = prev.userstopcodeend));
""")
def getMergeStrategies(conn):
cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)
cur.execute("""
SELECT 'DATASOURCE' as type,'1' as datasourceref,min(validdate) as fromdate FROM operday GROUP BY dataownercode
""")
rows = cur.fetchall()
cur.close()
return rows
def getOperator():
return { 'HTM' : {'privatecode' : 'HTM',
'operator_id' : 'HTM',
'name' : 'HTM',
'phone' : '0900-4864636',
'url' : 'http://www.htm.net',
'timezone' : 'Europe/Amsterdam',
'language' : 'nl'},
'HTMBUZZ' : {'privatecode' : 'HTMBUZZ',
'operator_id' : 'HTMBUZZ',
'name' : 'HTMbuzz',
'phone' : '0900-4864636',
'url' : 'http://www.htmbuzz.nl',
'timezone' : 'Europe/Amsterdam',
'language' : 'nl'}
}
def getMergeStrategies(conn):
cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)
cur.execute("""
SELECT 'DATASOURCE' as type,'1' as datasourceref,min(validfrom) as fromdate,max(validthru) as todate FROM schedvers GROUP BY dataownercode
""")
rows = cur.fetchall()
cur.close()
return rows
def cleanDest(conn):
cur = conn.cursor()
cur.execute("""
UPDATE dest SET destnamefull = replace(destnamefull,'N1 ','') WHERE destnamefull like 'N1 %';
UPDATE dest SET destnamefull = replace(destnamefull,'N2 ','') WHERE destnamefull like 'N2 %';
UPDATE dest SET destnamefull = replace(destnamefull,'N3 ','') WHERE destnamefull like 'N3 %';
UPDATE dest SET destnamefull = replace(destnamefull,'N4 ','') WHERE destnamefull like 'N4 %';
UPDATE dest SET destnamefull = replace(destnamefull,'N5 ','') WHERE destnamefull like 'N5 %';
UPDATE dest SET destnamefull = replace(destnamefull,'N6 ','') WHERE destnamefull like 'N6 %';
UPDATE dest SET destnamefull = replace(destnamefull,'N7 ','') WHERE destnamefull like 'N7 %';
""")
def import_zip(path,filename,version):
meta,conn = load(path,filename)
if datetime.strptime(meta['enddate'].replace('-',''),'%Y%m%d') < (datetime.now() - timedelta(days=1)):
data = {}
data['DATASOURCE'] = getDataSource()
data['VERSION'] = {}
data['VERSION']['1'] = {'privatecode' : 'HTM:'+filename,
'datasourceref' : '1',
'operator_id' : 'HTM:'+filename,
'startdate' : meta['startdate'],
'enddate' : meta['enddate'],
'error' : 'ALREADY_EXPIRED',
'description' : filename}
logger.info('Reject '+filename+'\n'+str(data['VERSION']['1']))
reject(data)
conn.commit()
conn.close()
return
try:
cleanDest(conn)
if pool_generation_enabled:
generatePool(conn)
data = {}
data['OPERATOR'] = getOperator()
data['MERGESTRATEGY'] = getMergeStrategies(conn)
data['DATASOURCE'] = getDataSource()
data['VERSION'] = {}
data['VERSION']['1'] = {'privatecode' : 'HTM:'+filename,
'datasourceref' : '1',
'operator_id' : 'HTM:'+filename,
'startdate' : meta['startdate'],
'enddate' : meta['enddate'],
'description' : filename}
data['DESTINATIONDISPLAY'] = getDestinationDisplays(conn)
data['LINE'] = getLineWithGeneratedNames(conn)
data['STOPPOINT'] = getStopPoints(conn)
data['STOPAREA'] = getStopAreas(conn)
data['AVAILABILITYCONDITION'] = getAvailabilityConditionsUsingOperday(conn)
data['PRODUCTCATEGORY'] = getBISONproductcategories()
data['ADMINISTRATIVEZONE'] = getAdministrativeZones(conn)
timedemandGroupRefForJourney,data['TIMEDEMANDGROUP'] = calculateTimeDemandGroups(conn)
routeRefForPattern,data['ROUTE'] = clusterPatternsIntoRoute(conn,getPool811)
data['JOURNEYPATTERN'] = getJourneyPatterns(routeRefForPattern,conn,data['ROUTE'])
data['JOURNEY'] = getJourneys(timedemandGroupRefForJourney,conn)
data['NOTICEASSIGNMENT'] = {}
data['NOTICE'] = {}
data['NOTICEGROUP'] = {}
insert(data)
conn.close()
setLineColors()
except:
raise
def download(url,filename):
u = urllib2.urlopen(url)
f = open('/tmp/'+filename, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print "Downloading: %s Bytes: %s" % (filename, file_size)
file_size_dl = 0
block_sz = 8192
while True:
buffer = u.read(block_sz)
if not buffer:
break
file_size_dl += len(buffer)
f.write(buffer)
status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
status = status + chr(8)*(len(status)+1)
print status,
print
f.close()
import_zip('/tmp',filename,None)
url = 'http://data.ndovloket.nl/htm/'
def sync():
f = urllib2.urlopen(url+'?order=d')
soup = BeautifulSoup(f.read())
for link in soup.find_all('a'):
link = link.get('href')
filename = urllib2.unquote(link)
if '.zip' in link.lower():
if not version_imported('HTM:'+filename):
try:
logger.info('Importing :'+filename)
download(url+link,filename)
except Exception as e:
logger.error(filename,exc_info=True)
pass
| 55.857143 | 168 | 0.656924 | 1,520 | 13,685 | 5.813816 | 0.211184 | 0.033948 | 0.036777 | 0.048093 | 0.549734 | 0.456942 | 0.395949 | 0.377504 | 0.37309 | 0.37309 | 0 | 0.03011 | 0.220972 | 13,685 | 244 | 169 | 56.086066 | 0.798799 | 0 | 0 | 0.277533 | 0 | 0.145374 | 0.64114 | 0.170771 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.004405 | 0.052863 | null | null | 0.013216 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4b1ca9d58dfd6c0273ef502c16e0f08a0c3bed83 | 184 | py | Python | rollDice.py | fixture94/super-duper-sortmabob | b3c2eabe4ff2cccbcafae8d1fb7d88263705168c | [
"MIT"
] | null | null | null | rollDice.py | fixture94/super-duper-sortmabob | b3c2eabe4ff2cccbcafae8d1fb7d88263705168c | [
"MIT"
] | null | null | null | rollDice.py | fixture94/super-duper-sortmabob | b3c2eabe4ff2cccbcafae8d1fb7d88263705168c | [
"MIT"
] | null | null | null | import random
def rollDice():
roll = random.randrange(1, 6, 1);
return roll;
i=0
for x in range(1, 100):
roll = rollDice();
arrayRolls[i]=[];
i=i+1;
| 18.4 | 38 | 0.532609 | 27 | 184 | 3.62963 | 0.62963 | 0.040816 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070866 | 0.309783 | 184 | 9 | 39 | 20.444444 | 0.700787 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4b20429c4d9d87d427e6428dc530469cbbe0f379 | 408 | py | Python | lib/stats.py | T-Mac/Handle | aef3d6ae020a1fe1d621f15ac3349cbe1d4e8477 | [
"WTFPL"
] | 7 | 2015-05-10T00:38:11.000Z | 2021-06-07T23:06:06.000Z | lib/stats.py | T-Mac/Handle | aef3d6ae020a1fe1d621f15ac3349cbe1d4e8477 | [
"WTFPL"
] | 1 | 2017-04-23T19:03:09.000Z | 2017-04-23T21:44:05.000Z | lib/stats.py | T-Mac/Handle | aef3d6ae020a1fe1d621f15ac3349cbe1d4e8477 | [
"WTFPL"
] | 3 | 2016-10-23T17:04:44.000Z | 2019-04-30T20:42:29.000Z | import json
import urllib2
import uuid
def checkin(id):
try:
result=urllib2.urlopen('http://stats.kennytheserver.com/checkin?id=%s' %id).read()
return True
except:
pass
return False
def has_internet():
try:
response=urllib2.urlopen('http://74.125.134.100',timeout=5)
return True
except urllib2.URLError as err: pass
return False
def gen_id():
return uuid.uuid4().hex
| 18.545455 | 85 | 0.691176 | 59 | 408 | 4.745763 | 0.610169 | 0.064286 | 0.128571 | 0.128571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051051 | 0.183824 | 408 | 21 | 86 | 19.428571 | 0.78979 | 0 | 0 | 0.333333 | 0 | 0 | 0.170543 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.111111 | 0.166667 | 0.055556 | 0.611111 | 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 |
4b2362b8abe0447f222ff1476239c065266eebf5 | 1,138 | py | Python | text/ToxicComments_MultiLabel/preprocess.py | kishorecbe/Tensorflow-Solutions | a158766633bc20ca4289096e4a5454a9e0d04e51 | [
"Apache-2.0"
] | null | null | null | text/ToxicComments_MultiLabel/preprocess.py | kishorecbe/Tensorflow-Solutions | a158766633bc20ca4289096e4a5454a9e0d04e51 | [
"Apache-2.0"
] | null | null | null | text/ToxicComments_MultiLabel/preprocess.py | kishorecbe/Tensorflow-Solutions | a158766633bc20ca4289096e4a5454a9e0d04e51 | [
"Apache-2.0"
] | null | null | null | import re
import pandas as pd
def clean_str(x):
s = x
s = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", s)
s = re.sub(r"\'s", " \'s", s)
s = re.sub(r"\'ve", " \'ve", s)
s = re.sub(r"n\'t", " n\'t", s)
s = re.sub(r"\'re", " \'re", s)
s = re.sub(r"\'d", " \'d", s)
s = re.sub(r"\'ll", " \'ll", s)
s = re.sub(r",", " , ", s)
s = re.sub(r"!", " ! ", s)
s = re.sub(r"\(", " \( ", s)
s = re.sub(r"\)", " \) ", s)
s = re.sub(r"\?", " \? ", s)
s = re.sub(r"\s{2,}", " ", s)
s = re.sub(r'\S*(x{2,}|X{2,})\S*', "xxx", s)
s = re.sub(r'[^\x00-\x7F]+', "", s)
s = re.sub(r'"', "", s)
s = s.strip().lower()
return s
def clean_data(file_name):
data_set = pd.read_csv(file_name).fillna("sterby")
data_set['comment_text'] = data_set['comment_text'].apply(lambda x: clean_str(x))
data_set['comment_text'] = data_set['comment_text'].str.strip()
data_set.drop('id', axis=1, inplace=True)
file_name = file_name.replace('.csv', '')
data_set.to_csv(file_name + '_preprocess.csv', index=False, sep='\t')
# clean_data('data/train.csv')
clean_data('data/test.csv')
| 29.179487 | 85 | 0.485062 | 201 | 1,138 | 2.626866 | 0.268657 | 0.07197 | 0.181818 | 0.212121 | 0.376894 | 0.287879 | 0.270833 | 0.270833 | 0.092803 | 0.092803 | 0 | 0.010124 | 0.218805 | 1,138 | 38 | 86 | 29.947368 | 0.583802 | 0.024605 | 0 | 0 | 0 | 0 | 0.208484 | 0.018953 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.066667 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d99beb55e8092e932dfa2da1e9c9ab8e2b6241ca | 412 | py | Python | scripts/build/special_case_namespaces.py | frontend-arch/devtools-frontend | 907a14259687036ceac26b301d4fc9965327ec11 | [
"BSD-3-Clause"
] | 2 | 2021-04-25T19:26:02.000Z | 2022-01-13T00:36:50.000Z | scripts/build/special_case_namespaces.py | frontend-arch/devtools-frontend | 907a14259687036ceac26b301d4fc9965327ec11 | [
"BSD-3-Clause"
] | 1 | 2021-01-22T00:22:39.000Z | 2021-01-22T00:22:39.000Z | scripts/build/special_case_namespaces.py | emchap/devtools-frontend | 65c824b5adc918400877f7f1d65f17c901e42421 | [
"BSD-3-Clause"
] | 4 | 2020-02-09T12:31:17.000Z | 2021-09-02T12:56:58.000Z | # Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
from os import path
special_case_namespaces_path = path.join(path.dirname(path.abspath(__file__)), 'special_case_namespaces.json')
with open(special_case_namespaces_path) as json_file:
special_case_namespaces = json.load(json_file)
| 37.454545 | 110 | 0.803398 | 65 | 412 | 4.846154 | 0.630769 | 0.139683 | 0.266667 | 0.15873 | 0.184127 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011142 | 0.128641 | 412 | 10 | 111 | 41.2 | 0.866295 | 0.376214 | 0 | 0 | 0 | 0 | 0.110672 | 0.110672 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
d99f81d9baec3a7d9ac843e917de10ed8f3e13a2 | 336 | py | Python | farmbeats-server/soilmoisture.py | jimbobbennett/farmbeats-vnext-experimental | 6d8e28a7d8ea97b2951819b39eb2402133f06b8d | [
"MIT"
] | 5 | 2022-01-19T12:00:04.000Z | 2022-03-15T23:12:04.000Z | farmbeats-server/soilmoisture.py | jimbobbennett/farmbeats-vnext-experimental | 6d8e28a7d8ea97b2951819b39eb2402133f06b8d | [
"MIT"
] | null | null | null | farmbeats-server/soilmoisture.py | jimbobbennett/farmbeats-vnext-experimental | 6d8e28a7d8ea97b2951819b39eb2402133f06b8d | [
"MIT"
] | 2 | 2022-02-03T21:04:02.000Z | 2022-03-14T19:34:31.000Z | from grove import adc
class SoilMoistureSensor:
def __init__(self, pin:int):
self.__pin = pin
self.__adc = adc.ADC()
self.__moisture = -1
def capture_values(self) -> None:
self.__moisture = self.__adc.read(self.__pin)
@property
def moisture(self) -> int:
return self.__moisture | 24 | 53 | 0.627976 | 41 | 336 | 4.682927 | 0.463415 | 0.109375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004065 | 0.267857 | 336 | 14 | 54 | 24 | 0.776423 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.090909 | 0.090909 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
d9a204d0a12baea4c426311cb55cdf98dbb80706 | 135 | py | Python | lekcja_w05g.py | pawel-gbr/pawel-gbr.github.io | 69cae413b21ed59509751432929bb42a1991bd1c | [
"BSD-2-Clause"
] | null | null | null | lekcja_w05g.py | pawel-gbr/pawel-gbr.github.io | 69cae413b21ed59509751432929bb42a1991bd1c | [
"BSD-2-Clause"
] | 1 | 2018-09-26T16:20:08.000Z | 2018-09-26T16:50:03.000Z | lekcja_w05g.py | pawel-gbr/pawel-gbr.github.io | 69cae413b21ed59509751432929bb42a1991bd1c | [
"BSD-2-Clause"
] | null | null | null | thisdict = {
"brand":"Ford",
"model":"Mustang",
"year":1964
}
for x in thisdict.values():
print(x)
| 16.875 | 27 | 0.466667 | 14 | 135 | 4.5 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045977 | 0.355556 | 135 | 7 | 28 | 19.285714 | 0.678161 | 0 | 0 | 0 | 0 | 0 | 0.185185 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.142857 | 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 |
d9accc1fb4d8b635edfdd72c407d45917d34c963 | 305 | py | Python | examples/houses.py | shwars/jturtle | e03c74781d32bc1f9f1600096e7a0d258ea01c6b | [
"MIT"
] | 1 | 2020-01-16T00:38:47.000Z | 2020-01-16T00:38:47.000Z | examples/houses.py | shwars/jturtle | e03c74781d32bc1f9f1600096e7a0d258ea01c6b | [
"MIT"
] | null | null | null | examples/houses.py | shwars/jturtle | e03c74781d32bc1f9f1600096e7a0d258ea01c6b | [
"MIT"
] | null | null | null | import sys
sys.path.append('d:\\work\\jturtle')
from jturtle import *
init()
for _ in range(4):
forward(40)
right(90)
done(True)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.done(True) | 15.25 | 36 | 0.72459 | 49 | 305 | 4.489796 | 0.428571 | 0.159091 | 0.290909 | 0.4 | 0.554545 | 0.554545 | 0.554545 | 0.554545 | 0.554545 | 0.554545 | 0 | 0.092251 | 0.111475 | 305 | 20 | 37 | 15.25 | 0.719557 | 0 | 0 | 0.470588 | 0 | 0 | 0.055556 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.117647 | 0 | 0.117647 | 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 |
d9b21dbccc30618399d20f8b7710f74cfec3ea4e | 220 | py | Python | contrib/wallettools/walletchangepass.py | cityfarmer-project/cityfarmer | 484b21303c48d7c2bdd6b9159e534e15921be71c | [
"MIT"
] | null | null | null | contrib/wallettools/walletchangepass.py | cityfarmer-project/cityfarmer | 484b21303c48d7c2bdd6b9159e534e15921be71c | [
"MIT"
] | null | null | null | contrib/wallettools/walletchangepass.py | cityfarmer-project/cityfarmer | 484b21303c48d7c2bdd6b9159e534e15921be71c | [
"MIT"
] | null | null | null | from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:1006")
pwd = raw_input("Enter old wallet passphrase: ")
pwd2 = raw_input("Enter new wallet passphrase: ")
access.walletpassphrasechange(pwd, pwd2)
| 36.666667 | 49 | 0.768182 | 30 | 220 | 5.566667 | 0.666667 | 0.095808 | 0.155689 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060914 | 0.104545 | 220 | 5 | 50 | 44 | 0.786802 | 0 | 0 | 0 | 0 | 0 | 0.359091 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.6 | 0.2 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
d9b633a66de248c1022d1e0062944c182dc2465a | 2,198 | py | Python | calculator.py | sebkuip/minecraft-region-calculator | a16c448a76cceedc1bf3cac568650e7ad4cf9837 | [
"MIT"
] | null | null | null | calculator.py | sebkuip/minecraft-region-calculator | a16c448a76cceedc1bf3cac568650e7ad4cf9837 | [
"MIT"
] | null | null | null | calculator.py | sebkuip/minecraft-region-calculator | a16c448a76cceedc1bf3cac568650e7ad4cf9837 | [
"MIT"
] | null | null | null | # A simple calculator to see the region/chunks/blocks depending on coordinates
# You just enter your data in the format `T.X.Z`, with T being Type (B/C/R for Block, Chunk or Region respectively) and X and Z being the coordinates of the thing you want to calculate
# When given a block type, the format also allows for entering a Y coordinate following the format `B.X.Y.Z`
# The . may also be replaced by a , or a space.
# When given a block it will give you the chunk and region coordinates this block is in
# When given a chunk it shows what blocks it contains, and what region it is in
# When given a region it shows the coordinates of the blocks it contains and the coordinates of the chunks it contains
# Feel free to use this code anywhere. It's open source. If you want, please do link the github link.
# Enjoy
import re
print("Please enter the coordinates you want to calculate following the format `T.X.Z` or `B.X.Y.Z`. For more details, consult the readme")
while True:
uinput = input("Input: ").strip().lower()
if not re.search(r"^(([bcr][.,\s]-?\d+[.,\s]-?\d+)|(b[.,\s]-?\d+[.,\s]-?\d+[.,\s]-?\d+))$", uinput):
# ^ start of line [bcr] for either of the 3 types. [.,\s] for seperators. -? for possible negative. \d+ for any lenght number. $ for end of line. | to split the regex in 2 parts, surounded with () each to group them.
print("This isn't a valid input. Please follow the format `T.X.Z` or `B.X.Y.Z` for input. For more details, consult the readme")
continue
break
uinput = re.split(r"[.,\s]+", uinput)
if len(uinput) > 3:
uinput.pop(2)
utype = uinput[0]
ux = int(uinput[1])
uz = int(uinput[2])
print(f"type: {utype} x: {ux} y: {uz}")
if utype == "b":
print(f"block {ux},{uz} is inside chunk {ux//16},{uz//16} and within region {ux//512},{uz//512}")
elif utype == "c":
print(f"chunk {ux},{uz} contains blocks {ux*16},{uz*16} to {(ux+1)*16-1},{(uz+1)*16-1} and is within region {ux//32},{uz//32}")
elif utype == "r":
print(f"region {ux},{uz} contains blocks {ux*512},{uz*512} to {(ux+1)*512-1},{(uz+1)*512-1} and contains chunks {ux*32},{uz*32} to {(ux+1)*32-1},{(uz+1)*32-1}")
input("Press enter to close the program") | 48.844444 | 220 | 0.661056 | 407 | 2,198 | 3.570025 | 0.326781 | 0.03097 | 0.027529 | 0.022712 | 0.123193 | 0.068135 | 0.028906 | 0.028906 | 0.028906 | 0.028906 | 0 | 0.033776 | 0.178344 | 2,198 | 45 | 221 | 48.844444 | 0.770764 | 0.461328 | 0 | 0 | 0 | 0.272727 | 0.639693 | 0.130324 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.045455 | 0.272727 | 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 |
d9bba264d93849eaccbd6bfbe0257541dc1f1f8b | 484 | py | Python | tests/shared/test_event_stream.py | Hyaxia/Bank-DDD-CQRS-ES | 116e3eb3e93d549c1da53e6d506ab47667d77445 | [
"MIT"
] | 8 | 2020-10-27T09:46:20.000Z | 2022-01-27T12:16:48.000Z | tests/shared/test_event_stream.py | Hyaxia/Bank-DDD-CQRS-ES | 116e3eb3e93d549c1da53e6d506ab47667d77445 | [
"MIT"
] | null | null | null | tests/shared/test_event_stream.py | Hyaxia/Bank-DDD-CQRS-ES | 116e3eb3e93d549c1da53e6d506ab47667d77445 | [
"MIT"
] | 2 | 2021-05-29T08:11:48.000Z | 2021-07-26T04:44:53.000Z | import pytest
from dataclasses import FrozenInstanceError
from bank_ddd_es_cqrs.shared.model import EventStream
def test_default_version_on_new_event_stream_is_minus_one():
event_stream = EventStream([])
assert event_stream.version == -1
def test_event_stream_immutable():
event_stream = EventStream([])
with pytest.raises(FrozenInstanceError):
event_stream.version = 2
with pytest.raises(FrozenInstanceError):
event_stream.events = ['asd']
| 24.2 | 60 | 0.762397 | 58 | 484 | 6.017241 | 0.534483 | 0.22063 | 0.126075 | 0.200573 | 0.26361 | 0.26361 | 0 | 0 | 0 | 0 | 0 | 0.004914 | 0.159091 | 484 | 19 | 61 | 25.473684 | 0.85258 | 0 | 0 | 0.333333 | 0 | 0 | 0.006237 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.166667 | false | 0 | 0.25 | 0 | 0.416667 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.