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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f81645d8d8d718ec6d0f2fd5efdfee06de47fecf | 364 | py | Python | pydemic/mixins/__init__.py | PyDemic/pydemic | 7e748e4bbe5c1f7fb209271af0ff8afb8fbd4fd5 | [
"MIT"
] | 3 | 2020-05-10T23:52:41.000Z | 2021-08-31T14:38:24.000Z | pydemic/mixins/__init__.py | PyDemic/pydemic | 7e748e4bbe5c1f7fb209271af0ff8afb8fbd4fd5 | [
"MIT"
] | 1 | 2020-09-27T03:26:51.000Z | 2022-03-30T12:18:08.000Z | pydemic/mixins/__init__.py | PyDemic/pydemic | 7e748e4bbe5c1f7fb209271af0ff8afb8fbd4fd5 | [
"MIT"
] | 1 | 2020-10-01T04:07:39.000Z | 2020-10-01T04:07:39.000Z | from .info import Info
from .meta_info import Meta
from .params_info import ParamsInfo
from .results import Results
from .with_data import WithDataMixin, WithDataModelMixin
from .with_info import WithInfoMixin
from .with_params import WithParamsMixin, WithDynamicParamsMixin
from .with_region import WithRegionDemography
from .with_results import WithResultsMixin
| 36.4 | 64 | 0.865385 | 45 | 364 | 6.844444 | 0.377778 | 0.12987 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104396 | 364 | 9 | 65 | 40.444444 | 0.944785 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f8236d63dd03b057bd6278aa76416b915ba7c5cf | 221 | py | Python | tutorial/tutotial10.py | seigot/tetris_game_tutorial | 3360b2dc2ed3462177d5829fd298fac0330be325 | [
"MIT"
] | 1 | 2021-06-01T12:35:59.000Z | 2021-06-01T12:35:59.000Z | tutorial/tutotial10.py | seigot/tetris_game_tutorial | 3360b2dc2ed3462177d5829fd298fac0330be325 | [
"MIT"
] | null | null | null | tutorial/tutotial10.py | seigot/tetris_game_tutorial | 3360b2dc2ed3462177d5829fd298fac0330be325 | [
"MIT"
] | 4 | 2021-06-23T11:23:26.000Z | 2021-12-10T17:40:04.000Z | #辞書型
print("辞書型")
profile = {
"name": "tani",
"email": "kazunori-t@cyberbra.in"
}
print(profile["name"])
# 新しく要素を追加
profile["gender"] = "male"
# 新しく要素を追加した辞書型(profile)を出力
print(profile)
print(profile["gender"])
| 14.733333 | 37 | 0.651584 | 26 | 221 | 5.538462 | 0.576923 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135747 | 221 | 14 | 38 | 15.785714 | 0.753927 | 0.171946 | 0 | 0 | 0 | 0 | 0.322222 | 0.122222 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.444444 | 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 | 1 | 0 | 3 |
f82c6c17abea8c10c556bc6633647af470f8ff9d | 202 | py | Python | demo_photo_face_rec.py | AntonFirc/SUR | 3173a80731e601cdcc590166a8ba2ef801e60325 | [
"MIT"
] | null | null | null | demo_photo_face_rec.py | AntonFirc/SUR | 3173a80731e601cdcc590166a8ba2ef801e60325 | [
"MIT"
] | null | null | null | demo_photo_face_rec.py | AntonFirc/SUR | 3173a80731e601cdcc590166a8ba2ef801e60325 | [
"MIT"
] | null | null | null | import sys
import os
sys.path.append(os.path.abspath('./photo'))
from photo_face_recognition import PhotoFaceRecognition
pr = PhotoFaceRecognition()
pr.train_model()
pr.eval_model()
pr.label_data()
| 15.538462 | 55 | 0.787129 | 28 | 202 | 5.5 | 0.607143 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.094059 | 202 | 12 | 56 | 16.833333 | 0.84153 | 0 | 0 | 0 | 0 | 0 | 0.034653 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f82cdcd7839aba48622a0553d33b63ab5a58431f | 71 | py | Python | examples/require.py | Nemika-Haj/PyJS | 5a67164f8b8d445467edb304c0728ca7a0463be6 | [
"MIT"
] | 5 | 2021-02-22T14:22:17.000Z | 2021-10-31T23:54:45.000Z | examples/require.py | Nemika-Haj/PyJS | 5a67164f8b8d445467edb304c0728ca7a0463be6 | [
"MIT"
] | null | null | null | examples/require.py | Nemika-Haj/PyJS | 5a67164f8b8d445467edb304c0728ca7a0463be6 | [
"MIT"
] | null | null | null | from PyJS import *
rand = require("random")
print(rand.randint(5,10)) | 14.2 | 25 | 0.704225 | 11 | 71 | 4.545455 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048387 | 0.126761 | 71 | 5 | 25 | 14.2 | 0.758065 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f8451083f9211b0dad6f328542b0bb62f9ac7720 | 2,336 | py | Python | django_backend/login_api/models.py | SeethaLakshmanan/lilys-supermarket | b35144eec2a2ab63297096addc3d8c20565136be | [
"MIT"
] | null | null | null | django_backend/login_api/models.py | SeethaLakshmanan/lilys-supermarket | b35144eec2a2ab63297096addc3d8c20565136be | [
"MIT"
] | null | null | null | django_backend/login_api/models.py | SeethaLakshmanan/lilys-supermarket | b35144eec2a2ab63297096addc3d8c20565136be | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from rest_framework.authtoken.models import Token
# class for creating the user
class UsersManager(BaseUserManager):
def create_user(self, first_name, last_name, email, password):
if not email:
raise ValueError("User must enter email address")
if not first_name:
raise ValueError("User must enter first name")
if not last_name:
raise ValueError("User must enter last name")
if not password:
raise ValueError("User must enter password")
user = self.model(first_name=first_name,
last_name=last_name,
email=self.normalize_email(email))
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, first_name, last_name, email, password):
# Todo: Update password property based on how Admin will be created later,
# for now asking password when creating superuser so that it is convenient for testing
user = self.create_user(first_name=first_name,
last_name=last_name,
email=self.normalize_email(email),
password=password)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user
# class defining the user model and the fields
class UsersModel(AbstractBaseUser):
first_name = models.CharField(verbose_name='first_name', max_length=50)
last_name = models.CharField(verbose_name='last_name', max_length=50)
email = models.EmailField(verbose_name='email', max_length=50, unique=True)
password = models.CharField(verbose_name='password', max_length=32)
is_active = models.BooleanField(default=True)
is_admin = models.BooleanField(default=False)
is_staff = models.BooleanField(default=False)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['first_name', 'last_name', 'password']
objects = UsersManager()
def __str__(self):
return self.email # temp, to be modified later
def has_perm(self, perm, obj=None):
return self.is_admin
def has_module_perms(self, app_label):
return True
| 37.079365 | 94 | 0.663527 | 290 | 2,336 | 5.162069 | 0.327586 | 0.066132 | 0.064128 | 0.05678 | 0.287241 | 0.209753 | 0.167001 | 0.082832 | 0.082832 | 0.082832 | 0 | 0.004616 | 0.258134 | 2,336 | 62 | 95 | 37.677419 | 0.859204 | 0.110017 | 0 | 0.133333 | 0 | 0 | 0.081042 | 0 | 0 | 0 | 0 | 0.016129 | 0 | 1 | 0.111111 | false | 0.177778 | 0.066667 | 0.066667 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
f84a8beb47f4453f803633cf62c0e03a235f5ce1 | 1,920 | py | Python | idManager/model/database/db_model.py | lgarciasbr/idm-api | 3517d29d55eb2a06fb5b4b21359b6cf6d11529a0 | [
"Apache-2.0"
] | 2 | 2018-01-14T22:43:43.000Z | 2018-01-14T22:43:48.000Z | idManager/model/database/db_model.py | lgarciasbr/idm-api | 3517d29d55eb2a06fb5b4b21359b6cf6d11529a0 | [
"Apache-2.0"
] | null | null | null | idManager/model/database/db_model.py | lgarciasbr/idm-api | 3517d29d55eb2a06fb5b4b21359b6cf6d11529a0 | [
"Apache-2.0"
] | null | null | null | from flask import url_for
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import func
from sqlalchemy.orm import backref
from idManager.settings import TOKEN_HOST, REDIS_URL
import redis
db = SQLAlchemy()
if TOKEN_HOST == 'redis':
db_redis = redis.from_url(REDIS_URL)
else:
db_redis = ''
class Group(db.Model):
__tablename__ = 'idm_groups'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(120), unique=False, nullable=False)
created_at = db.Column(db.DateTime, nullable=False, default=func.now())
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
@property
def url(self):
return url_for('api.get_group_by_id', pk=self.id, _external=True)
class Account(db.Model):
__tablename__ = 'idm_accounts'
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(120), unique=True, nullable=False)
password = db.Column(db.Binary, unique=False, nullable=False)
created_at = db.Column(db.DateTime, nullable=False, default=func.now())
def __init__(self, email, password):
self.email = email
self.password = password
def __str__(self):
return self.email
@property
def url(self):
return url_for('api.get_account_by_id', pk=self.id, _external=True)
class Token(db.Model):
__tablename__ = 'idm_token'
id = db.Column(db.Integer, primary_key=True)
account_id = db.Column(db.Integer, db.ForeignKey(Account.id), unique=False, nullable=False)
token = db.Column(db.String(200), unique=False, nullable=False)
last_accessed_date = db.Column(db.DateTime, nullable=False, default=func.now())
account = db.relationship(Account, backref=backref('tokens'))
def __init__(self, account, token):
self.account = account
self.token = token
def __str__(self):
return self.token
| 29.090909 | 95 | 0.691667 | 265 | 1,920 | 4.762264 | 0.237736 | 0.069731 | 0.087163 | 0.038035 | 0.455626 | 0.393027 | 0.358162 | 0.358162 | 0.233756 | 0.141046 | 0 | 0.005788 | 0.190104 | 1,920 | 65 | 96 | 29.538462 | 0.805788 | 0 | 0 | 0.244898 | 0 | 0 | 0.042708 | 0.010938 | 0 | 0 | 0 | 0 | 0 | 1 | 0.163265 | false | 0.061224 | 0.122449 | 0.102041 | 0.755102 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 3 |
f860b3687b46cca2655f4dc593ec39fcf96d84a6 | 919 | py | Python | catalog/bindings/csw/conceptual_scheme_type.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/csw/conceptual_scheme_type.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/csw/conceptual_scheme_type.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass, field
from typing import Optional
__NAMESPACE__ = "http://www.opengis.net/cat/csw/2.0.2"
@dataclass
class ConceptualSchemeType:
name: Optional[str] = field(
default=None,
metadata={
"name": "Name",
"type": "Element",
"namespace": "http://www.opengis.net/cat/csw/2.0.2",
"required": True,
},
)
document: Optional[str] = field(
default=None,
metadata={
"name": "Document",
"type": "Element",
"namespace": "http://www.opengis.net/cat/csw/2.0.2",
"required": True,
},
)
authority: Optional[str] = field(
default=None,
metadata={
"name": "Authority",
"type": "Element",
"namespace": "http://www.opengis.net/cat/csw/2.0.2",
"required": True,
},
)
| 25.527778 | 64 | 0.505985 | 91 | 919 | 5.065934 | 0.318681 | 0.112798 | 0.138829 | 0.199566 | 0.707158 | 0.707158 | 0.707158 | 0.453362 | 0.453362 | 0.453362 | 0 | 0.019576 | 0.332971 | 919 | 35 | 65 | 26.257143 | 0.732463 | 0 | 0 | 0.46875 | 0 | 0 | 0.284004 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.0625 | 0 | 0.1875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f86bd9f4e87573b05f67caf83cdf4b6b3b57fc74 | 508 | py | Python | backend/back_inicio.py | Nicolasramos411/pyqt5-simpsons-game | a0f52b78f82adddcd392d440ecb2469e342f9b9d | [
"MIT"
] | null | null | null | backend/back_inicio.py | Nicolasramos411/pyqt5-simpsons-game | a0f52b78f82adddcd392d440ecb2469e342f9b9d | [
"MIT"
] | null | null | null | backend/back_inicio.py | Nicolasramos411/pyqt5-simpsons-game | a0f52b78f82adddcd392d440ecb2469e342f9b9d | [
"MIT"
] | null | null | null | from PyQt5.QtCore import QObject, pyqtSignal, QTimer
class BackInicio(QObject):
senal_nombre_verificado = pyqtSignal(bool) # Envía al front-end si el nombre es valido
def __init__(self):
super().__init__()
def verificacion(self, nombre):
if nombre.isalnum() and len(nombre) > 0:
self.senal_nombre_verificado.emit(True)
else:
self.senal_nombre_verificado.emit(False)
with open("ranking.txt", "a") as txt:
pass | 25.4 | 92 | 0.629921 | 61 | 508 | 5.016393 | 0.688525 | 0.107843 | 0.205882 | 0.163399 | 0.189542 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005435 | 0.275591 | 508 | 20 | 93 | 25.4 | 0.826087 | 0.080709 | 0 | 0 | 0 | 0 | 0.026846 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.083333 | 0.083333 | 0 | 0.416667 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f8775d20d7a43378483ad853fecb30e905e1ed95 | 169 | py | Python | trader/core/utils/functional.py | JustasZaltauskas/Trader | 554b788dbb856a81dc599ba90d9acdef2d9a340c | [
"MIT"
] | 3 | 2018-09-28T09:55:21.000Z | 2019-04-19T08:30:12.000Z | trader/core/utils/functional.py | JustasZaltauskas/Trader | 554b788dbb856a81dc599ba90d9acdef2d9a340c | [
"MIT"
] | null | null | null | trader/core/utils/functional.py | JustasZaltauskas/Trader | 554b788dbb856a81dc599ba90d9acdef2d9a340c | [
"MIT"
] | null | null | null | from toolz import curry
@curry
def append(arr, x):
arr.append(x)
return arr
@curry
def set_attribute(obj, name, value):
obj[name] = value
return obj
| 12.071429 | 36 | 0.656805 | 26 | 169 | 4.230769 | 0.538462 | 0.145455 | 0.218182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.242604 | 169 | 13 | 37 | 13 | 0.859375 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f8780808986160762c306fe2229eb70c50f74c22 | 949 | py | Python | src/AuShadha/visit/visit_phyexam/dijit_widgets/pane.py | GosthMan/AuShadha | 3ab48825a0dba19bf880b6ac6141ab7a6adf1f3e | [
"PostgreSQL"
] | 46 | 2015-03-04T14:19:47.000Z | 2021-12-09T02:58:46.000Z | src/AuShadha/visit/visit_phyexam/dijit_widgets/pane.py | aytida23/AuShadha | 3ab48825a0dba19bf880b6ac6141ab7a6adf1f3e | [
"PostgreSQL"
] | 2 | 2015-06-05T10:29:04.000Z | 2015-12-06T16:54:10.000Z | src/AuShadha/visit/visit_phyexam/dijit_widgets/pane.py | aytida23/AuShadha | 3ab48825a0dba19bf880b6ac6141ab7a6adf1f3e | [
"PostgreSQL"
] | 24 | 2015-03-23T01:38:11.000Z | 2022-01-24T16:23:42.000Z | ################################################################################
# Project: AuShadha
# Description: Pane of the UI
# Author ; Dr.Easwar T.R
# Date: 04-11-2013
# License: GNU-GPL Version3, see LICENSE.txt for details
################################################################################
from cStringIO import StringIO
import yaml
# General Django Imports----------------------------------
from django.http import Http404, HttpResponse
import json
from django.core.urlresolvers import reverse
from django.template import Template, Context
from django.contrib.auth.decorators import login_required
from AuShadha.apps.ui.ui import UI
from patient import MODULE_LABEL
#from patient.models import PatientDetail
PatientDetail = UI.get_module("PatientRegistration")
VisitDetail = UI.get_module("OPD_Visit")
AdmissionDetail = UI.get_module("Admission")
@login_required
def render_phyexam_pane(request, visit_id = None):
pass | 32.724138 | 80 | 0.640674 | 106 | 949 | 5.641509 | 0.622642 | 0.06689 | 0.055184 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013986 | 0.09589 | 949 | 29 | 81 | 32.724138 | 0.682984 | 0.249737 | 0 | 0 | 0 | 0 | 0.06789 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0.066667 | 0.6 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
f893b7b07b1b751f0335dbc31741687cced68c9b | 167 | py | Python | python_images/enviroment_image/main.py | kavisek/docker-images | 74a131b55fe68e6748eff5613b8ee94b07714ded | [
"MIT"
] | 1 | 2020-03-03T22:12:12.000Z | 2020-03-03T22:12:12.000Z | python_images/enviroment_image/main.py | kavisek/docker-images | 74a131b55fe68e6748eff5613b8ee94b07714ded | [
"MIT"
] | 5 | 2021-06-02T03:55:08.000Z | 2022-03-12T00:54:02.000Z | python_images/enviroment_image/main.py | kavisek/docker-images | 74a131b55fe68e6748eff5613b8ee94b07714ded | [
"MIT"
] | 1 | 2020-03-21T04:13:49.000Z | 2020-03-21T04:13:49.000Z | import sys
import os
import pprint
def main():
print("python version:", sys.version)
pprint.pprint(os.environ._data)
if __name__ == "__main__":
main()
| 12.846154 | 41 | 0.670659 | 22 | 167 | 4.681818 | 0.590909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.197605 | 167 | 12 | 42 | 13.916667 | 0.768657 | 0 | 0 | 0 | 0 | 0 | 0.137725 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | true | 0 | 0.375 | 0 | 0.5 | 0.375 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f8a2df29296a34122f9bbd027e83430219b542c8 | 350 | py | Python | rl/envs/LunarLanderWithNoise.py | mahkons/Lottery-ticket-hypothesis | 96ec399fdfc4138a37feecb24a63b3cdb8e50e1e | [
"MIT"
] | 7 | 2020-10-08T04:59:51.000Z | 2021-12-03T06:12:39.000Z | rl/envs/LunarLanderWithNoise.py | mahkons/Lottery-ticket-hypothesis | 96ec399fdfc4138a37feecb24a63b3cdb8e50e1e | [
"MIT"
] | null | null | null | rl/envs/LunarLanderWithNoise.py | mahkons/Lottery-ticket-hypothesis | 96ec399fdfc4138a37feecb24a63b3cdb8e50e1e | [
"MIT"
] | null | null | null | import numpy as np
from envs.EnvWrapper import EnvWrapper
class LunarLanderWithNoise(EnvWrapper):
def __init__(self, random_state):
super(LunarLanderWithNoise, self).__init__("LunarLander-v2", random_state)
self.state_sz = 256
def transform_obs(self, obs):
return np.concatenate((obs, np.random.uniform(size=248)))
| 29.166667 | 82 | 0.728571 | 43 | 350 | 5.651163 | 0.604651 | 0.090535 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024138 | 0.171429 | 350 | 11 | 83 | 31.818182 | 0.813793 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f8c1bd44c997817237bb3e84355962ea4498e022 | 58 | py | Python | src/sadie/numbering/__init__.py | jwillis0720/pybody | 2d7c68650ac1ef5f3003ccb67171898eac1f63eb | [
"MIT"
] | null | null | null | src/sadie/numbering/__init__.py | jwillis0720/pybody | 2d7c68650ac1ef5f3003ccb67171898eac1f63eb | [
"MIT"
] | null | null | null | src/sadie/numbering/__init__.py | jwillis0720/pybody | 2d7c68650ac1ef5f3003ccb67171898eac1f63eb | [
"MIT"
] | null | null | null | from .numbering import Numbering
__all__ = ["Numbering"]
| 14.5 | 32 | 0.758621 | 6 | 58 | 6.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137931 | 58 | 3 | 33 | 19.333333 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.155172 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f8c1f6a2eed5ac2d86c9cc5c873ea1217665c486 | 8,289 | py | Python | src/LIGAND/NP_LigandMaker.py | MDSYN2019/MDNPPackage | 6a5e503b2ee48707472359dd1f3a3624320cfd67 | [
"Apache-2.0"
] | null | null | null | src/LIGAND/NP_LigandMaker.py | MDSYN2019/MDNPPackage | 6a5e503b2ee48707472359dd1f3a3624320cfd67 | [
"Apache-2.0"
] | null | null | null | src/LIGAND/NP_LigandMaker.py | MDSYN2019/MDNPPackage | 6a5e503b2ee48707472359dd1f3a3624320cfd67 | [
"Apache-2.0"
] | null | null | null |
import numpy as np
import six
import collections
import requests
from bs4 import BeautifulSoup
from collections import Counter
from scipy import ndimage
from rdkit import Chem
from rdkit import RDConfig
from rdkit import DataStructs
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import Draw
from rdkit.Chem import AllChem
from rdkit.Chem import rdqueries
from rdkit.Chem import ChemicalFeatures
from rdkit.Chem import rdchem
from rdkit.Chem import rdmolops
from rdkit.Chem import rdmolfiles
from rdkit.Chem import rdMolDescriptors
from rdkit.Chem import rdMolTransforms
from rdkit import RDConfig
from rdkit.Chem.Fragments import fr_Ar_N
from itertools import chain
from collections import defaultdict
from operator import itemgetter
IPythonConsole.molSize = 250,250
import plotly.graph_objs as go
# MDAnalysis and Alignment libraries
import MDAnalysis as mda
from MDAnalysis.analysis import align
from MDAnalysis.analysis.rms import rmsd
import numpy as np
import pandas as pd
# Scipy libaries
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from scipy.spatial import ConvexHull, convex_hull_plot_2d
# Boilerplate libraries
import sys
import re
import math
import scipy
# scipy libaries
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from scipy.spatial import ConvexHull, convex_hull_plot_2d
import numpy as np
import scipy
import pybel
import rdkit
from rdkit import Chem
import MDAnalysis as mda
"""
------------------------
Last Updated: 22/10/2021
------------------------
Breakdown:
----------
The class MolecularConverter translates the smiles string of the ligand(s)
into a cartesian coordinate xyz file. From this, we use the indices of the
smiles sting and match it to the SmilesToMartiniDictionary. From this, we
can use the center of geometry of the indices and replace with the relevant
Martini bead.
"""
class MolecularConverter:
"""
Written Manual here
"""
def __init__(self, option, smilesString):
"""
The constructor must detect whether the smiles string is valid or not
"""
# Adding Martini Beads dictionary - at the moment, I am using
# Martini 3 references
self._SmilesToMartiniDictionary = {}
SmilesToMartiniDictionary["CC(=O)CO"] = 'P2' # P2 Bead
SmilesToMartiniDictionary["CC(=O)O"] = 'SP2' # SP2 Bead
SmilesToMartiniDictionary["CC(C)O"] = 'P1' # P1 Bead
SmilesToMartiniDictionary["CC(C)O"] = 'P1' # P1 Bead
def GetRingSystems(self, mol, includeSpiro=False):
"""
What is this function doing?
"""
ri = mol.GetRingInfo() # Sets out the indices of the rings structures within the mol file
systems = []
for ring in ri.AtomRings():
ringAts = set(ring)
nSystems = []
for system in systems:
nInCommon = len(ringAts.intersection(system))
if nInCommon and (includeSpiro or nInCommon>1):
ringAts = ringAts.union(system)
else:
nSystems.append(system)
nSystems.append(ringAts)
systems = nSystems
return systems
def ComputeCoordinatesLigands(self):
"""
Get the generic basis of the xyz coorinates of the
ligands
"""
u = mda.Universe.from_smiles(smilesString)
# new feature
Molecule = u1.select_atoms('all')
MoleculeAtomPositions = Molecule.positions # Finds
| 61.858209 | 203 | 0.300519 | 443 | 8,289 | 5.577878 | 0.433409 | 0.058276 | 0.057871 | 0.069203 | 0.189802 | 0.164306 | 0.138406 | 0.138406 | 0.106839 | 0.106839 | 0 | 0.010197 | 0.668718 | 8,289 | 133 | 204 | 62.323308 | 0.889658 | 0.123537 | 0 | 0.256757 | 0 | 0 | 0.005795 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.040541 | false | 0 | 0.635135 | 0 | 0.702703 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
3e837e6341d28750deb4b6ba3f02b66093428ed5 | 2,152 | py | Python | fhirclient/models/provenance_tests.py | JamesSkane/smart_resources | 85c362542b85ebc43ec00cd04915b114ee95f9c0 | [
"Apache-2.0"
] | null | null | null | fhirclient/models/provenance_tests.py | JamesSkane/smart_resources | 85c362542b85ebc43ec00cd04915b114ee95f9c0 | [
"Apache-2.0"
] | null | null | null | fhirclient/models/provenance_tests.py | JamesSkane/smart_resources | 85c362542b85ebc43ec00cd04915b114ee95f9c0 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 0.5.0.5149 on 2015-07-06.
# 2015, SMART Health IT.
import os
import io
import unittest
import json
from . import provenance
from .fhirdate import FHIRDate
class ProvenanceTests(unittest.TestCase):
def instantiate_from(self, filename):
datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or ''
with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle:
js = json.load(handle)
self.assertEqual("Provenance", js["resourceType"])
return provenance.Provenance(js)
def testProvenance1(self):
inst = self.instantiate_from("provenance-example.json")
self.assertIsNotNone(inst, "Must have instantiated a Provenance instance")
self.implProvenance1(inst)
js = inst.as_json()
self.assertEqual("Provenance", js["resourceType"])
inst2 = provenance.Provenance(js)
self.implProvenance1(inst2)
def implProvenance1(self, inst):
self.assertEqual(inst.agent[0].display, "Grahame Grieve")
self.assertEqual(inst.agent[0].referenceUri, "mailto:grahame@healthintersections.com.au")
self.assertEqual(inst.agent[0].role.code, "author")
self.assertEqual(inst.agent[0].role.system, "http://hl7.org/fhir/provenance-participant-role")
self.assertEqual(inst.agent[0].type.code, "person")
self.assertEqual(inst.agent[0].type.system, "http://hl7.org/fhir/provenance-participant-type")
self.assertEqual(inst.id, "example")
self.assertEqual(inst.period.start.date, FHIRDate("2011-06-23").date)
self.assertEqual(inst.period.start.as_json(), "2011-06-23")
self.assertEqual(inst.reason.text, "Editing the FHIR Specification")
self.assertEqual(inst.recorded.date, FHIRDate("2012-11-08T23:16:03+11:00").date)
self.assertEqual(inst.recorded.as_json(), "2012-11-08T23:16:03+11:00")
self.assertEqual(inst.text.div, "<div>Authored on 8-Nov 2011 by Grahame Grieve. Content extracted from ISO-21090</div>")
self.assertEqual(inst.text.status, "generated")
| 43.04 | 128 | 0.680762 | 274 | 2,152 | 5.321168 | 0.394161 | 0.164609 | 0.182442 | 0.098765 | 0.290809 | 0.161866 | 0.082305 | 0 | 0 | 0 | 0 | 0.054771 | 0.177045 | 2,152 | 49 | 129 | 43.918367 | 0.768492 | 0.052509 | 0 | 0.055556 | 1 | 0.027778 | 0.245942 | 0.066404 | 0 | 0 | 0 | 0 | 0.472222 | 1 | 0.083333 | false | 0 | 0.166667 | 0 | 0.305556 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3e83c8c9b66481e86306586daf899e5fb50df3f4 | 615 | py | Python | core/migrations/0011_auto_20210819_1938.py | Thom03/majiapi | e65d9ed8c6dad5c599bcd21946284e87ba7feb1e | [
"MIT"
] | 1 | 2021-08-17T19:24:26.000Z | 2021-08-17T19:24:26.000Z | core/migrations/0011_auto_20210819_1938.py | Thom03/majiapi | e65d9ed8c6dad5c599bcd21946284e87ba7feb1e | [
"MIT"
] | null | null | null | core/migrations/0011_auto_20210819_1938.py | Thom03/majiapi | e65d9ed8c6dad5c599bcd21946284e87ba7feb1e | [
"MIT"
] | null | null | null | # Generated by Django 2.1.5 on 2021-08-19 19:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0010_auto_20210819_1621'),
]
operations = [
migrations.RenameField(
model_name='meterreading',
old_name='current_reading',
new_name='meter_reading',
),
migrations.RemoveField(
model_name='meterreading',
name='consumption',
),
migrations.RemoveField(
model_name='meterreading',
name='previous_reading',
),
]
| 22.777778 | 47 | 0.572358 | 56 | 615 | 6.089286 | 0.642857 | 0.079179 | 0.184751 | 0.175953 | 0.269795 | 0.269795 | 0 | 0 | 0 | 0 | 0 | 0.074341 | 0.321951 | 615 | 26 | 48 | 23.653846 | 0.743405 | 0.073171 | 0 | 0.4 | 1 | 0 | 0.207746 | 0.040493 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.05 | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3e89cdb3a70f3beefebaaaba15b82be623ee4bed | 105 | py | Python | src/ptpip/constants/object/live_view_display_rotation.py | DethCount/ptpip-d5300 | ed2f8a46600f2bb3330a7e5f4d5d47cf93fc10bd | [
"MIT"
] | null | null | null | src/ptpip/constants/object/live_view_display_rotation.py | DethCount/ptpip-d5300 | ed2f8a46600f2bb3330a7e5f4d5d47cf93fc10bd | [
"MIT"
] | null | null | null | src/ptpip/constants/object/live_view_display_rotation.py | DethCount/ptpip-d5300 | ed2f8a46600f2bb3330a7e5f4d5d47cf93fc10bd | [
"MIT"
] | null | null | null | from enum import Enum
class LiveViewDisplayRotation(Enum):
NoRotation = 0
RotateCCW = 1
RotateCW = 2
| 15 | 36 | 0.761905 | 13 | 105 | 6.153846 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034884 | 0.180952 | 105 | 6 | 37 | 17.5 | 0.895349 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
e41aa6e8879b6af807d21ba2de0d41b47525fc60 | 324 | py | Python | src/recipi/utils/helpers.py | EnTeQuAk/recpy | 58f157bd5b054db07be366beca76821386c28f6c | [
"0BSD"
] | 2 | 2015-11-12T08:58:14.000Z | 2021-03-06T01:30:11.000Z | src/recipi/utils/helpers.py | recipi/recipi | 58f157bd5b054db07be366beca76821386c28f6c | [
"0BSD"
] | 6 | 2015-02-03T00:16:58.000Z | 2015-02-04T23:47:30.000Z | src/recipi/utils/helpers.py | recipi/recipi | 58f157bd5b054db07be366beca76821386c28f6c | [
"0BSD"
] | null | null | null | from django.contrib.sessions.serializers import JSONSerializer as BaseJSONSerializer
from recipi.utils import json
class UUIDCapableJSONSerializer(BaseJSONSerializer):
def dumps(self, obj):
return json.dumps(obj).encode('latin-1')
def loads(self, data):
return json.loads(data.decode('latin-1'))
| 27 | 84 | 0.743827 | 39 | 324 | 6.179487 | 0.641026 | 0.082988 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007299 | 0.154321 | 324 | 11 | 85 | 29.454545 | 0.872263 | 0 | 0 | 0 | 0 | 0 | 0.04321 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.285714 | 0.285714 | 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 | 1 | 0 | 0 | 3 |
e43b8ab9d024c587cfdd71bb583bcc3de62905ca | 858 | py | Python | weave/util.py | CBI-PITT/weave | dbd647b7c995291b7b746550df6b7ae9a5c9c5dc | [
"BSD-3-Clause"
] | null | null | null | weave/util.py | CBI-PITT/weave | dbd647b7c995291b7b746550df6b7ae9a5c9c5dc | [
"BSD-3-Clause"
] | null | null | null | weave/util.py | CBI-PITT/weave | dbd647b7c995291b7b746550df6b7ae9a5c9c5dc | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 28 11:00:12 2022
@author: awatson
"""
import os
def pixToMB(pixNum,bit=16):
return pixNum*bit/8/1024/1024
def MBToPix(MB,bit=16):
return MB/bit*8*1024*1024
def getFileName(y,x):
return '{}.{}.tif'.format(y,x)
def getDir(location,t,c,z):
return os.path.join(
location,
str(t),
str(c),
str(z)
)
def makeDir(location):
os.makedirs(location, exist_ok=True)
def getFullFilePath(location,t,c,z,y,x):
return os.path.join(
getDir(location,t,c,z),
getFileName(y,x)
)
def prepareAndGetFilePath(location,t,c,z,y,x):
path = getFullFilePath(location,t,c,z,y,x)
makeDir(os.path.split(path)[0])
return path
def getMetaFile(location):
return os.path.join(location,'weave.json')
| 17.16 | 46 | 0.595571 | 127 | 858 | 4.015748 | 0.393701 | 0.023529 | 0.098039 | 0.107843 | 0.354902 | 0.135294 | 0.109804 | 0 | 0 | 0 | 0 | 0.055641 | 0.245921 | 858 | 49 | 47 | 17.510204 | 0.732612 | 0.088578 | 0 | 0.074074 | 0 | 0 | 0.024611 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.296296 | false | 0 | 0.037037 | 0.222222 | 0.592593 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e4441cc52e0e959a9d6acad69a149e52c8715d03 | 2,059 | py | Python | darwinpush/listener.py | fasteroute/darwinpush | c919049e076cbdf61007fc9cc1c5a0271cde7929 | [
"Apache-2.0"
] | 3 | 2015-08-15T15:38:06.000Z | 2019-08-06T11:09:32.000Z | darwinpush/listener.py | grundleborg/darwinpush | c919049e076cbdf61007fc9cc1c5a0271cde7929 | [
"Apache-2.0"
] | 34 | 2015-07-22T13:47:16.000Z | 2015-08-12T17:40:23.000Z | darwinpush/listener.py | grundleborg/darwinpush | c919049e076cbdf61007fc9cc1c5a0271cde7929 | [
"Apache-2.0"
] | 1 | 2015-08-30T15:26:24.000Z | 2015-08-30T15:26:24.000Z | from darwinpush.messages import *
class Listener:
def __init__(self, q):
print("Initialising Listener")
#self.queue = queue.Queue(maxsize=10000)
self.queue = q
#self.process = multiprocessing.Process(target=self._run)
#self.thread.daemon = True
#p.start()
#p.join()
#self.thread.start()
def _run(self):
print("Running listener")
while True:
message = self.queue.get()
#self.queue.task_done()
if type(message) == ScheduleMessage:
self.on_schedule_message(message)
elif type(message) == DeactivatedMessage:
self.on_deactivated_message(message)
elif type(message) == AssociationMessage:
self.on_association_message(message)
elif type(message) == TrainStatusMessage:
self.on_train_status_message(message)
elif type(message) == StationMessage:
self.on_station_message(message)
elif type(message) == TrainAlertMessage:
self.on_train_alert_message(message)
elif type(message) == TrainOrderMessage:
self.on_train_order_message(message)
elif type(message) == TrackingIdMessage:
self.on_tracking_id_message(message)
elif type(message) == AlarmMessage:
self.on_alarm_message(message)
else:
print("Another type of message")
def on_schedule_message(self, message):
pass
def on_deactivated_message(self, message):
pass
def on_association_message(self, message):
pass
def on_train_status_message(self, message):
pass
def on_station_message(self, message):
pass
def on_train_alert_message(self, message):
pass
def on_train_order_message(self, message):
pass
def on_tracking_id_message(self, message):
pass
def on_alarm_message(self, message):
pass
| 29.414286 | 65 | 0.59932 | 214 | 2,059 | 5.528037 | 0.275701 | 0.092984 | 0.13694 | 0.167371 | 0.391378 | 0.195266 | 0.08115 | 0 | 0 | 0 | 0 | 0.003546 | 0.315202 | 2,059 | 69 | 66 | 29.84058 | 0.835461 | 0.08645 | 0 | 0.191489 | 0 | 0 | 0.032051 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.234043 | false | 0.191489 | 0.021277 | 0 | 0.276596 | 0.06383 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e47c382c952aba5f4faa8eda3515ced105c54c2c | 618 | py | Python | callofduty/object.py | j0lv3r4/CallofDuty.py | 099d67d64d9b95902ea96974704f9b4bc64fa52d | [
"MIT"
] | 98 | 2018-11-02T11:22:40.000Z | 2022-02-28T19:04:50.000Z | callofduty/object.py | j0lv3r4/CallofDuty.py | 099d67d64d9b95902ea96974704f9b4bc64fa52d | [
"MIT"
] | 73 | 2020-01-27T06:23:59.000Z | 2021-11-09T20:32:33.000Z | callofduty/object.py | j0lv3r4/CallofDuty.py | 099d67d64d9b95902ea96974704f9b4bc64fa52d | [
"MIT"
] | 37 | 2020-05-24T21:04:50.000Z | 2022-02-15T00:08:24.000Z | import logging
from typing import Optional
log: logging.Logger = logging.getLogger(__name__)
class Object:
"""
Represents a generic Call of Duty object.
Parameters
----------
client : callofduty.Client
Client which manages communication with the Call of Duty API.
"""
_type: Optional[str] = None
def __init__(self, client):
self._client = client
@property
def type(self) -> Optional[str]:
return self._type
def __repr__(self) -> str:
return f"<{self.__class__.__name__}>"
def __str__(self) -> str:
return self.__repr__()
| 19.935484 | 69 | 0.62945 | 71 | 618 | 5.042254 | 0.507042 | 0.075419 | 0.055866 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.262136 | 618 | 30 | 70 | 20.6 | 0.785088 | 0.254045 | 0 | 0 | 0 | 0 | 0.062937 | 0.062937 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.214286 | 0.785714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e49fda163f55d610b93da6b7501f798ca595d7e3 | 69 | py | Python | python/testData/inspections/PyTypeCheckerInspection/TypingAnnotatedTypeMultiFile/annotated.py | alexey-anufriev/intellij-community | ffcd46f14e630acdefcc76e2bfc7c43d2449013a | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/inspections/PyTypeCheckerInspection/TypingAnnotatedTypeMultiFile/annotated.py | alexey-anufriev/intellij-community | ffcd46f14e630acdefcc76e2bfc7c43d2449013a | [
"Apache-2.0"
] | 1 | 2020-07-30T19:04:47.000Z | 2020-07-30T19:04:47.000Z | python/testData/inspections/PyTypeCheckerInspection/TypingAnnotatedTypeMultiFile/annotated.py | bradleesand/intellij-community | 750ff9c10333c9c1278c00dbe8d88c877b1b9749 | [
"Apache-2.0"
] | 1 | 2020-10-15T05:56:42.000Z | 2020-10-15T05:56:42.000Z | from typing import Annotated
A = Annotated[int, "Some constraint"]
| 13.8 | 37 | 0.753623 | 9 | 69 | 5.777778 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15942 | 69 | 4 | 38 | 17.25 | 0.896552 | 0 | 0 | 0 | 0 | 0 | 0.217391 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e4ad09735938ff76892b644ae6d212db98b1d785 | 629 | py | Python | pykka/_envelope.py | fjarri/pykka | d1b33b32ba60c6a3e83576ea746b780775e8ff3e | [
"Apache-2.0"
] | 796 | 2015-01-01T14:40:40.000Z | 2022-03-31T09:57:45.000Z | pykka/_envelope.py | fjarri/pykka | d1b33b32ba60c6a3e83576ea746b780775e8ff3e | [
"Apache-2.0"
] | 123 | 2015-02-06T11:45:55.000Z | 2022-03-25T04:11:21.000Z | pykka/_envelope.py | fjarri/pykka | d1b33b32ba60c6a3e83576ea746b780775e8ff3e | [
"Apache-2.0"
] | 103 | 2015-01-13T10:34:27.000Z | 2022-02-23T12:47:10.000Z | class Envelope:
"""
Envelope to add metadata to a message.
This is an internal type and is not part of the public API.
:param message: the message to send
:type message: any
:param reply_to: the future to reply to if there is a response
:type reply_to: :class:`pykka.Future`
"""
# Using slots speeds up envelope creation with ~20%
__slots__ = ["message", "reply_to"]
def __init__(self, message, reply_to=None):
self.message = message
self.reply_to = reply_to
def __repr__(self):
return f"Envelope(message={self.message!r}, reply_to={self.reply_to!r})"
| 28.590909 | 80 | 0.659777 | 93 | 629 | 4.247312 | 0.462366 | 0.159494 | 0.04557 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004202 | 0.243243 | 629 | 21 | 81 | 29.952381 | 0.82563 | 0.488076 | 0 | 0 | 0 | 0 | 0.269231 | 0.213287 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0 | 0.142857 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e4adc5a2b666cd2da460e75b3f871db7f1c57ade | 1,001 | py | Python | src/utils/namers.py | canbakiskan/l2-normalized-network | a3e571e87b7e9ae76c80a33d058b982c4fd6bcfa | [
"Apache-2.0"
] | null | null | null | src/utils/namers.py | canbakiskan/l2-normalized-network | a3e571e87b7e9ae76c80a33d058b982c4fd6bcfa | [
"Apache-2.0"
] | null | null | null | src/utils/namers.py | canbakiskan/l2-normalized-network | a3e571e87b7e9ae76c80a33d058b982c4fd6bcfa | [
"Apache-2.0"
] | null | null | null | from os.path import join
def classifier_params_string(args):
classifier_params_string = args.neural_net.architecture
classifier_params_string += f"_{args.optimizer.name}"
classifier_params_string += f"_{args.optimizer.lr_scheduler}"
classifier_params_string += f"_{args.optimizer.lr:.4f}"
classifier_params_string += f"_ep_{args.neural_net.epochs}"
if args.hoyer_activation_lambda != 0.0:
classifier_params_string += f"_hoy_{args.hoyer_activation_lambda:.5f}"
if args.optimizer.gs:
classifier_params_string += f"_gs"
return classifier_params_string
def classifier_ckpt_namer(args):
file_path = join(args.directory, 'checkpoints',
'classifiers')
file_path = join(file_path, classifier_params_string(args) + '.pt')
return file_path
def classifier_log_namer(args):
file_path = join(args.directory, 'logs')
file_path = join(file_path, classifier_params_string(args) + '.log')
return file_path
| 24.414634 | 78 | 0.719281 | 128 | 1,001 | 5.242188 | 0.304688 | 0.262295 | 0.360656 | 0.205663 | 0.405365 | 0.405365 | 0.351714 | 0.137109 | 0.137109 | 0 | 0 | 0.004848 | 0.175824 | 1,001 | 40 | 79 | 25.025 | 0.808485 | 0 | 0 | 0.095238 | 0 | 0 | 0.178821 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.047619 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e4bd298c34d592c8ce8e59184db2c50b39660c01 | 1,169 | py | Python | src/cmp/cil/utils/cil_scope.py | codestrange/cool-compiler-2020 | 30508965d75a1a1d1362d0b51bef8da3978fd0c2 | [
"MIT"
] | 3 | 2020-01-14T04:47:32.000Z | 2020-09-10T17:57:20.000Z | src/cmp/cil/utils/cil_scope.py | codestrange/cool-compiler-2020 | 30508965d75a1a1d1362d0b51bef8da3978fd0c2 | [
"MIT"
] | 5 | 2020-01-14T06:06:35.000Z | 2020-02-19T01:01:33.000Z | src/cmp/cil/utils/cil_scope.py | codestrange/cool-compiler-2020 | 30508965d75a1a1d1362d0b51bef8da3978fd0c2 | [
"MIT"
] | 3 | 2020-01-14T04:58:24.000Z | 2020-01-14T16:23:41.000Z | from typing import Dict, Optional
class Var:
def __init__(self, idx: str, local_name: str):
self.id = idx
self.local_name = local_name
def __str__(self):
return f"[var] {self.id}: {self.local_name}"
def __repr__(self):
return str(self)
class Scope:
def __init__(self, parent: Optional["Scope"] = None):
self.parent = parent
self.vars: Dict[str, Var] = {}
def child(self):
return Scope(parent=self)
def define_var(self, name: str, local_name: str) -> Var:
var = self.vars[name] = Var(name, local_name)
return var
def get_var(self, name: str) -> Optional[Var]:
try:
return self.vars[name]
except KeyError:
if self.parent is not None:
return self.parent.get_var(name)
return None
def __str__(self):
cond = self.parent is None
result = "{\n"
result += "\t" if cond else "Parent:\n" + f"{self.parent}\n\t"
result += "\n\t".join(str(x) for x in self.vars.values())
result += "\n}"
return result
def __repr__(self):
return str(self)
| 25.413043 | 70 | 0.562019 | 157 | 1,169 | 3.974522 | 0.261147 | 0.086538 | 0.035256 | 0.048077 | 0.076923 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 0.310522 | 1,169 | 45 | 71 | 25.977778 | 0.774194 | 0 | 0 | 0.176471 | 0 | 0 | 0.065868 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.264706 | false | 0 | 0.029412 | 0.117647 | 0.617647 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e4e3065459b5d5f0a9888247147ef60f1f589522 | 200 | py | Python | settings.py | azharhappy/Nancy-VA--MacOS | e2825f1e61e5f5c995de9cdda8e836d4a34cbb7d | [
"MIT"
] | 4 | 2017-01-03T07:26:10.000Z | 2017-06-28T11:16:39.000Z | settings.py | azhar22k/Nancy-VA--MacOS | e2825f1e61e5f5c995de9cdda8e836d4a34cbb7d | [
"MIT"
] | null | null | null | settings.py | azhar22k/Nancy-VA--MacOS | e2825f1e61e5f5c995de9cdda8e836d4a34cbb7d | [
"MIT"
] | 2 | 2018-03-27T13:00:58.000Z | 2019-01-14T14:55:59.000Z | #wolframalpha settings
from wolframalpha import Client
app_id = "TGRUL2-794AT5556P"
client = Client(app_id)
#getting user directory
from subprocess import getoutput
homeDir = getoutput('echo $HOME')
| 22.222222 | 33 | 0.805 | 25 | 200 | 6.36 | 0.68 | 0.113208 | 0.138365 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0.12 | 200 | 8 | 34 | 25 | 0.857955 | 0.215 | 0 | 0 | 0 | 0 | 0.174194 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e4e401e5261b898311caee7d88bef391d9d73a68 | 735 | py | Python | examples/example_project/context.py | szabolcsdombi/zengl | 2c9c26784285f2f049fb5d6fc9da0ad65d32d52f | [
"MIT"
] | 116 | 2021-10-31T17:24:18.000Z | 2022-02-01T05:47:18.000Z | examples/example_project/context.py | szabolcsdombi/zengl | 2c9c26784285f2f049fb5d6fc9da0ad65d32d52f | [
"MIT"
] | 9 | 2021-11-12T19:21:33.000Z | 2022-01-20T09:48:31.000Z | examples/example_project/context.py | szabolcsdombi/zengl | 2c9c26784285f2f049fb5d6fc9da0ad65d32d52f | [
"MIT"
] | 3 | 2021-11-12T18:55:05.000Z | 2022-01-19T13:58:26.000Z | import zengl
class Context:
context = None
main_uniform_buffer = None
main_uniform_buffer_data = bytearray(b'\x00' * 64)
@classmethod
def initialize(cls):
ctx = zengl.context()
cls.context = ctx
cls.main_uniform_buffer = ctx.buffer(size=64)
ctx.includes['main_uniform_buffer'] = '''
layout (std140) uniform MainUniformBuffer {
mat4 mvp;
};
'''
@classmethod
def update_camera(cls, eye, target, aspect, fov):
cls.main_uniform_buffer_data[0:64] = zengl.camera(eye, target, aspect=aspect, fov=fov)
@classmethod
def flush_uniform_buffer(cls):
cls.main_uniform_buffer.write(cls.main_uniform_buffer_data)
| 27.222222 | 94 | 0.636735 | 87 | 735 | 5.149425 | 0.390805 | 0.232143 | 0.265625 | 0.178571 | 0.107143 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023985 | 0.262585 | 735 | 26 | 95 | 28.269231 | 0.802583 | 0 | 0 | 0.142857 | 0 | 0 | 0.17551 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.047619 | 0 | 0.380952 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
90155303159d4ac879a8e0f325c067375bb23d1c | 661 | py | Python | 3sum-closest/Solution.8137743.py | rahul-ramadas/leetcode | 6c84c2333a613729361c5cdb63dc3fc80203b340 | [
"MIT"
] | null | null | null | 3sum-closest/Solution.8137743.py | rahul-ramadas/leetcode | 6c84c2333a613729361c5cdb63dc3fc80203b340 | [
"MIT"
] | 1 | 2016-09-11T22:26:17.000Z | 2016-09-13T01:49:48.000Z | 3sum-closest/Solution.8137743.py | rahul-ramadas/leetcode | 6c84c2333a613729361c5cdb63dc3fc80203b340 | [
"MIT"
] | null | null | null | class Solution:
def threeSumClosest(self, num, target):
num = sorted(num)
best_sum = num[0] + num[1] + num[2]
for i in range(len(num)):
j = i + 1
k = len(num) - 1
while j < k:
current_sum = num[i] + num[j] + num[k]
if current_sum == target:
return current_sum
if abs(current_sum - target) < abs(best_sum - target):
best_sum = current_sum
if current_sum > target:
k -= 1
else:
j += 1
return best_sum
| 26.44 | 71 | 0.406959 | 74 | 661 | 3.5 | 0.351351 | 0.23166 | 0.185328 | 0.138996 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021341 | 0.503782 | 661 | 24 | 72 | 27.541667 | 0.768293 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
902448fc1be82e2073edb9ed08cb25b5b2a8c894 | 6,068 | py | Python | tests/test_jwt_authenticator.py | mikenac/jwt_authenticator | fb7739d48b1453a77d82ca89acbeed7a15107abb | [
"MIT"
] | 1 | 2020-08-12T15:45:44.000Z | 2020-08-12T15:45:44.000Z | tests/test_jwt_authenticator.py | TeleTrackingTechnologies/jwt_authenticator | fb7739d48b1453a77d82ca89acbeed7a15107abb | [
"MIT"
] | null | null | null | tests/test_jwt_authenticator.py | TeleTrackingTechnologies/jwt_authenticator | fb7739d48b1453a77d82ca89acbeed7a15107abb | [
"MIT"
] | null | null | null | import os
import datetime
import unittest
import secrets
from jwt_authenticator.authentication_handler import AuthenticationHandler, AuthError
from flask import Flask
class JwtAuthenticatorTests(unittest.TestCase):
""" Test fixture for application unit tests"""
@classmethod
def setUpClass(cls):
"""Setup for the test class"""
print("Executing test fixture setup")
env_modpath = os.environ.get('MODULE_PATH')
if env_modpath is None:
cls.mod_path = "../jwt_authenticator"
else:
cls.mod_path = env_modpath
# the path of this file
cls.this_path = os.path.dirname(__file__)
def test_generate_and_validate_token_success(self):
""" Generate and decode a token"""
audience = 'http://www.service.wingdings.com/'
roles = {'role': ['admin', 'user'], 'aud': audience}
secret = secrets.token_urlsafe(32)
token = AuthenticationHandler.generate_auth_token(roles, secret)
decoded_token = AuthenticationHandler.validate_and_decode_token(
token=token, key=secret,
audience=audience
)
self.assertTrue(decoded_token['role'][0] == 'admin')
self.assertTrue(decoded_token['role'][1] == 'user')
def test_generate_and_validate_token_512_success(self):
""" Generate and decode a token using a different algorithm"""
audience = 'http://www.service.wingdings.com/'
roles = {'role': ['admin', 'user'], 'aud': audience}
secret = secrets.token_urlsafe(32)
token = AuthenticationHandler.generate_auth_token(roles, secret, algorithm="HS512")
decoded_token = AuthenticationHandler.validate_and_decode_token(
token=token, key=secret,
audience=audience, algorithms=["HS512"]
)
self.assertTrue(decoded_token['role'][0] == 'admin')
self.assertTrue(decoded_token['role'][1] == 'user')
def test_validate_token_expired(self):
""" Expired tokens should throw exceptions"""
audience = 'http://www.service.wingdings.com/'
roles = {'role': ['admin', 'user'], 'aud': audience,
'exp': datetime.datetime.utcnow() - datetime.timedelta(minutes=15)}
secret = secrets.token_urlsafe(32)
token = AuthenticationHandler.generate_auth_token(roles, secret)
with self.assertRaises(AuthError):
_ = AuthenticationHandler.validate_and_decode_token(
token=token, key=secret,
audience=audience
)
def test_validate_token_role_mismatch(self):
""" A role is specified and not matched"""
audience = 'http://www.service.wingdings.com/'
roles = {'role': ['admin', 'user'], 'aud': audience}
secret = secrets.token_urlsafe(32)
token = AuthenticationHandler.generate_auth_token(roles, secret)
with self.assertRaises(AuthError):
_ = AuthenticationHandler.validate_and_decode_token(
token=token, key=secret, role_name="optimus prime",
audience=audience)
def test_validate_token_role_match(self):
""" A role is specified and matched """
audience = 'http://www.service.wingdings.com/'
roles = {'role': ['admin', 'user'], 'aud': audience}
secret = secrets.token_urlsafe(32)
token = AuthenticationHandler.generate_auth_token(roles, secret)
decoded_token = AuthenticationHandler.validate_and_decode_token(
token=token, key=secret, role_name="admin",
audience=audience)
self.assertTrue(decoded_token['role'][0] == 'admin')
self.assertTrue(decoded_token['role'][1] == 'user')
def test_invalid_token_secret_mismatch(self):
""" Make sure invalid tokens are rejected"""
audience = 'http://www.service.wingdings.com/'
roles = {'role': ['admin', 'user'], 'aud': audience}
secret = secrets.token_urlsafe(32)
secret1 = secrets.token_urlsafe(32)
token = AuthenticationHandler.generate_auth_token(roles, secret)
with self.assertRaises(AuthError):
_ = AuthenticationHandler.validate_and_decode_token(
token=token, key=secret1,
audience=audience)
def test_invalid_token_audience_mismatch(self):
""" Make sure invalid tokens are rejected"""
audience = 'http://www.service.wingdings.com/'
roles = {'role': ['admin', 'user'], 'aud': audience}
secret = secrets.token_urlsafe(32)
audience1 = "somebody"
token = AuthenticationHandler.generate_auth_token(roles, secret)
with self.assertRaises(AuthError):
_ = AuthenticationHandler.validate_and_decode_token(
token=token, key=secret,
audience=audience1)
def test_environment_variables_override_config(self):
""" Specified environment variable settings should override default module config"""
app = Flask('test.cfg')
app.config.from_pyfile(f"{self.this_path}/config.py")
ctx = app.app_context()
ctx.push()
os.environ["JWT_SECRET"] = "sed"
os.environ["JWT_AUDIENCE"] = "larry"
AuthenticationHandler.load_configuration()
try:
self.assertTrue(app.config["SECRET"] == "sed", "Secret does not match")
self.assertTrue(app.config["AUDIENCE"] == "larry", "Audience does not match")
finally:
ctx.pop()
def test_config_from_file(self):
""" Specified environment variable settings should override default module config"""
app = Flask('test.cfg')
app.config.from_pyfile(f"{self.this_path}/config.py")
ctx = app.app_context()
ctx.push()
AuthenticationHandler.load_configuration()
try:
self.assertTrue(app.config["SECRET"] == "foobar", "Secret does not match")
self.assertTrue(app.config["AUDIENCE"] == "fred", "Audience does not match")
finally:
ctx.pop()
| 37.226994 | 92 | 0.636124 | 644 | 6,068 | 5.809006 | 0.204969 | 0.037423 | 0.040631 | 0.044908 | 0.767709 | 0.767709 | 0.740711 | 0.687784 | 0.687784 | 0.624165 | 0 | 0.00808 | 0.245386 | 6,068 | 162 | 93 | 37.45679 | 0.80891 | 0.084212 | 0 | 0.607143 | 0 | 0 | 0.1319 | 0.009473 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.089286 | false | 0 | 0.053571 | 0 | 0.151786 | 0.008929 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9049a2e6e6af9f21ba7ff84f694bd742aa1d22f3 | 4,710 | py | Python | infrastructure/routes/course_router.py | Ubademy-G3/courses.service | f69ffe3d4736f6f3769d2d3aa74db4b98ff39f45 | [
"MIT"
] | null | null | null | infrastructure/routes/course_router.py | Ubademy-G3/courses.service | f69ffe3d4736f6f3769d2d3aa74db4b98ff39f45 | [
"MIT"
] | null | null | null | infrastructure/routes/course_router.py | Ubademy-G3/courses.service | f69ffe3d4736f6f3769d2d3aa74db4b98ff39f45 | [
"MIT"
] | 1 | 2022-03-16T21:53:33.000Z | 2022-03-16T21:53:33.000Z | from fastapi import APIRouter, Header, Query, Depends
from infrastructure.db.database import Session, get_db
from application.controllers.course_controller import CourseController
from application.services.auth import auth_service
from domain.course_model import CourseSchema, CourseDB, CourseList, CoursePatch, CourseWithRating, CourseWithRatingList
from typing import Optional, List
import logging
logger = logging.getLogger(__name__)
router = APIRouter()
@router.post("/", response_model=CourseDB, status_code=201)
async def create_course(payload: CourseSchema, db: Session = Depends(get_db), apikey: str = Header(None)):
logger.debug("Creating course..")
auth_service.check_api_key(apikey)
return CourseController.create_course(db, payload)
@router.get("/", response_model=CourseList, status_code=200)
async def get_all_courses(
db: Session = Depends(get_db),
apikey: str = Header(None),
category: Optional[List[int]] = Query(None, alias="category[]"),
subscription_type: Optional[List[str]] = Query(None, alias="subscription_type[]"),
text: Optional[str] = None,
):
auth_service.check_api_key(apikey)
courses_list = CourseController.get_all_courses(db, category, subscription_type, text)
return {"amount": len(courses_list), "courses": courses_list}
@router.get("/rated/", response_model=CourseWithRatingList, status_code=200)
async def get_all_courses_with_rating(
db: Session = Depends(get_db),
apikey: str = Header(None),
category: Optional[List[int]] = Query(None, alias="category[]"),
subscription_type: Optional[List[str]] = Query(None, alias="subscription_type[]"),
text: Optional[str] = None,
):
auth_service.check_api_key(apikey)
courses_list = CourseController.get_all_courses_with_rating(db, category, subscription_type, text)
return {"amount": len(courses_list), "courses": courses_list}
@router.get("/rated/user/{user_id}", response_model=CourseWithRatingList, status_code=200)
async def get_all_courses_by_user_with_rating(
user_id: str,
db: Session = Depends(get_db),
user_type: Optional[str] = None,
approval_state: Optional[bool] = None,
apikey: str = Header(None),
category: Optional[List[int]] = Query(None, alias="category[]"),
subscription_type: Optional[List[str]] = Query(None, alias="subscription_type[]"),
text: Optional[str] = None,
):
auth_service.check_api_key(apikey)
courses_list = CourseController.get_all_courses_by_user_with_rating(db, user_id, user_type, approval_state, category, subscription_type, text)
return {"amount": len(courses_list), "courses": courses_list}
@router.get("/list/", response_model=CourseList, status_code=200)
async def get_all_courses_from_list(
course_list: List[str] = Query(None, alias="id"),
db: Session = Depends(get_db),
apikey: str = Header(None),
):
auth_service.check_api_key(apikey)
courses_list = CourseController.get_all_courses_from_list(db, course_list)
return {"amount": len(courses_list), "courses": courses_list}
@router.get("/list/rated/", response_model=CourseWithRatingList, status_code=200)
async def get_all_courses_from_list_with_rating(
course_list: List[str] = Query(None, alias="id"),
db: Session = Depends(get_db),
apikey: str = Header(None),
):
auth_service.check_api_key(apikey)
courses_list = CourseController.get_all_courses_from_list_with_rating(db, course_list)
return {"amount": len(courses_list), "courses": courses_list}
@router.get("/{course_id}", response_model=CourseDB, status_code=200)
async def get_course(course_id: str, db: Session = Depends(get_db), apikey: str = Header(None)):
auth_service.check_api_key(apikey)
return CourseController.get_course(db, course_id)
@router.get("/{course_id}/rated/", response_model=CourseWithRating, status_code=200)
async def get_course_with_rating(course_id: str, db: Session = Depends(get_db), apikey: str = Header(None)):
auth_service.check_api_key(apikey)
return CourseController.get_course_with_rating(db, course_id)
@router.patch("/{course_id}", response_model=CourseDB, status_code=200)
async def update_course(course_id: str, course: CoursePatch, db: Session = Depends(get_db), apikey: str = Header(None)):
auth_service.check_api_key(apikey)
return CourseController.update_course(db, course_id, course)
@router.delete("/{course_id}", response_model=dict, status_code=200)
async def delete_course(course_id: str, db: Session = Depends(get_db), apikey: str = Header(None)):
auth_service.check_api_key(apikey)
CourseController.delete_course(db, course_id)
return {"message": "Course {} deleted successfully".format(course_id)}
| 39.915254 | 146 | 0.752442 | 627 | 4,710 | 5.374801 | 0.130782 | 0.048961 | 0.047478 | 0.05638 | 0.736202 | 0.720772 | 0.714837 | 0.681899 | 0.667062 | 0.655193 | 0 | 0.007262 | 0.12293 | 4,710 | 117 | 147 | 40.25641 | 0.808521 | 0 | 0 | 0.482353 | 0 | 0 | 0.066454 | 0.004459 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.082353 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5f51ed5cd411490de576279adc4b08a7a705a462 | 678 | py | Python | tests/conftest.py | jugmac00/sphinx-argparse-cli | 2e0b6bbffa78bdf4d4bb7bfc4b250e66a182f1eb | [
"MIT"
] | 10 | 2021-02-05T04:04:42.000Z | 2021-05-20T18:41:30.000Z | tests/conftest.py | jugmac00/sphinx-argparse-cli | 2e0b6bbffa78bdf4d4bb7bfc4b250e66a182f1eb | [
"MIT"
] | 10 | 2021-02-05T12:06:27.000Z | 2021-08-07T09:29:53.000Z | tests/conftest.py | jugmac00/sphinx-argparse-cli | 2e0b6bbffa78bdf4d4bb7bfc4b250e66a182f1eb | [
"MIT"
] | 4 | 2021-10-12T23:31:53.000Z | 2022-02-16T11:56:44.000Z | from __future__ import annotations
import pytest
from _pytest.config import Config
from docutils import __version__ as docutils_version
from sphinx import __display_version__ as sphinx_version
from sphinx.testing.path import path
pytest_plugins = "sphinx.testing.fixtures"
collect_ignore = ["roots"]
def pytest_report_header(config: Config) -> str: # noqa: U100
return f"libraries: Sphinx-{sphinx_version}, docutils-{docutils_version}"
@pytest.fixture(scope="session", name="rootdir")
def root_dir() -> path:
return path(__file__).parent.parent.abspath() / "roots"
def pytest_configure(config: Config) -> None:
config.addinivalue_line("markers", "prepare")
| 28.25 | 77 | 0.774336 | 86 | 678 | 5.767442 | 0.5 | 0.03629 | 0.068548 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005034 | 0.120944 | 678 | 23 | 78 | 29.478261 | 0.827181 | 0.014749 | 0 | 0 | 0 | 0 | 0.186186 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0.133333 | 0.733333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
5f6214c248bfd8b7317d4b0fdcaff29eef32df57 | 932 | py | Python | ree/1.py | userElaina/SpiritCTF-2021 | c5e4ae05362da1f25718d2f80050709f3f99ef17 | [
"MIT"
] | null | null | null | ree/1.py | userElaina/SpiritCTF-2021 | c5e4ae05362da1f25718d2f80050709f3f99ef17 | [
"MIT"
] | null | null | null | ree/1.py | userElaina/SpiritCTF-2021 | c5e4ae05362da1f25718d2f80050709f3f99ef17 | [
"MIT"
] | null | null | null | flag=[0]*35
box = [
253, 194, 15, 13, 82,
129, 244, 80, 193, 233,
36, 54, 199, 69, 219,
74, 136, 6, 190, 144,
68, 57, 156, 153, 240,
65, 95, 135, 61, 179,
159, 183, 182, 130, 107]
target = [
174, 178, 102, 127, 22,
245, 143, 226, 245, 131,
65, 105, 135, 48, 94,
21, 185, 188, 225, 211,
116, 11, 178, 184, 248,
18, 47, 205, 79, 38,
235, 244, 149, 196, 185]
state = target
for i in range(0, 35, 5):
# state[i] = flag[i] ^ box[i]
# state[i + 1] = flag[(i + 1)] ^ box[(i + 1)]
# state[i + 2] = ((state[i] ^ state[(i + 1)] ^ flag[(i + 2)]) - box[(i + 2)]) & 255
# state[i + 3] = flag[(i + 3)] ^ box[(i + 3)]
# state[i + 4] = flag[(i + 4)] ^ state[(i + 3)]
flag[i+4]=state[i+4]^state[i+3]
flag[i+3]=state[i+3]^box[i+3]
flag[i+2]=((state[i+2]+box[i+2])&255)^state[i+1]^state[i]
flag[i+1]=state[i+1]^box[i+1]
flag[i]=state[i]^box[i]
print(bytes(flag)) | 28.242424 | 88 | 0.483906 | 183 | 932 | 2.464481 | 0.448087 | 0.21286 | 0.062084 | 0.062084 | 0.283814 | 0.206208 | 0.133038 | 0.070953 | 0 | 0 | 0 | 0.324638 | 0.259657 | 932 | 33 | 89 | 28.242424 | 0.328986 | 0.26073 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.04 | 0 | 0 | 0 | null | 1 | 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 | 3 |
5f621fa5eb1aa0d7d3ecf5f99aa83d9feb5f290f | 20 | py | Python | swaglyrics/__init__.py | chriswang030/SwagLyrics-For-Spotify | a60fafe1ebe7a7d228495eba4d71f3a3b155f947 | [
"MIT"
] | 1 | 2019-02-14T05:24:18.000Z | 2019-02-14T05:24:18.000Z | swaglyrics/__init__.py | addddd123/SwagLyrics-For-Spotify | 8c0a9a4989c976adb79ce34c795d4070ea2abac3 | [
"MIT"
] | null | null | null | swaglyrics/__init__.py | addddd123/SwagLyrics-For-Spotify | 8c0a9a4989c976adb79ce34c795d4070ea2abac3 | [
"MIT"
] | null | null | null | name = 'swaglyrics'
| 10 | 19 | 0.7 | 2 | 20 | 7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 20 | 1 | 20 | 20 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5f71a29572c93d10fa342384e1ffecb1b5df5113 | 387 | py | Python | tests/test_plugin.py | clld/clldmpg | be9834314b1fc93116bd88baf48b54a9ca37e051 | [
"Apache-2.0"
] | null | null | null | tests/test_plugin.py | clld/clldmpg | be9834314b1fc93116bd88baf48b54a9ca37e051 | [
"Apache-2.0"
] | 14 | 2015-07-01T07:57:21.000Z | 2021-09-20T13:41:35.000Z | tests/test_plugin.py | clld/clldmpg | be9834314b1fc93116bd88baf48b54a9ca37e051 | [
"Apache-2.0"
] | 3 | 2015-12-06T22:03:44.000Z | 2018-10-12T18:10:04.000Z | from pyramid.testing import Configurator
def test_MpgOlacConfig(mocker):
from clldmpg import MpgOlacConfig
cfg = MpgOlacConfig()
assert cfg.admin(None).role == 'Admin'
assert 'eva' in cfg.description(mocker.MagicMock())['institution'].url
def test_includeme():
from clldmpg import includeme
includeme(Configurator(settings={'sqlalchemy.url': 'sqlite://'}))
| 24.1875 | 74 | 0.726098 | 43 | 387 | 6.488372 | 0.581395 | 0.050179 | 0.121864 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152455 | 387 | 15 | 75 | 25.8 | 0.85061 | 0 | 0 | 0 | 0 | 0 | 0.108527 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 1 | 0.222222 | false | 0 | 0.333333 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
5f72ef89eef45bcbec5d32eb189d651cc5f65444 | 261 | py | Python | src/python/src/rmq/utils/decorators/call_once.py | halimov-oa/scrapy-boilerplate | fe3c552fed26bedb0618c245ab923aa34a89ac9d | [
"MIT"
] | 34 | 2019-12-13T10:31:39.000Z | 2022-03-09T15:59:07.000Z | src/python/src/rmq/utils/decorators/call_once.py | halimov-oa/scrapy-boilerplate | fe3c552fed26bedb0618c245ab923aa34a89ac9d | [
"MIT"
] | 49 | 2020-02-25T19:41:09.000Z | 2022-02-27T12:05:25.000Z | src/python/src/rmq/utils/decorators/call_once.py | halimov-oa/scrapy-boilerplate | fe3c552fed26bedb0618c245ab923aa34a89ac9d | [
"MIT"
] | 23 | 2019-12-23T15:19:42.000Z | 2022-03-09T16:00:15.000Z | from functools import wraps
def call_once(f):
@wraps(f)
def wrapper(*args, **kwargs):
if not wrapper.__is_called:
wrapper.__is_called = True
return f(*args, **kwargs)
wrapper.__is_called = False
return wrapper
| 20.076923 | 38 | 0.616858 | 33 | 261 | 4.575758 | 0.545455 | 0.178808 | 0.298013 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.287356 | 261 | 12 | 39 | 21.75 | 0.811828 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 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 | 1 | 0 | 0 | 3 |
5fad0bf4bee24963cf3785988ffa92a06824d4c1 | 114 | py | Python | conjureup/controllers/juju/showsteps/gui.py | iMichka/conjure-up | 8e4599e6f58b52163384150d8d71e7802462d126 | [
"MIT"
] | 1 | 2019-06-26T23:39:13.000Z | 2019-06-26T23:39:13.000Z | conjureup/controllers/juju/showsteps/gui.py | iMichka/conjure-up | 8e4599e6f58b52163384150d8d71e7802462d126 | [
"MIT"
] | null | null | null | conjureup/controllers/juju/showsteps/gui.py | iMichka/conjure-up | 8e4599e6f58b52163384150d8d71e7802462d126 | [
"MIT"
] | 1 | 2020-10-05T14:42:31.000Z | 2020-10-05T14:42:31.000Z | from conjureup.controllers.base.showsteps.gui import ShowStepsController
_controller_class = ShowStepsController
| 28.5 | 72 | 0.885965 | 11 | 114 | 9 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070175 | 114 | 3 | 73 | 38 | 0.933962 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
5fc13db6cf72145114c32eaa6b0349bbab2345cc | 179 | py | Python | tests/test_example.py | sfxbadekunle/example-github-actions | 7e4543f1de4e37fe06f353bab814cb144b6e9d2d | [
"BSD-2-Clause"
] | null | null | null | tests/test_example.py | sfxbadekunle/example-github-actions | 7e4543f1de4e37fe06f353bab814cb144b6e9d2d | [
"BSD-2-Clause"
] | null | null | null | tests/test_example.py | sfxbadekunle/example-github-actions | 7e4543f1de4e37fe06f353bab814cb144b6e9d2d | [
"BSD-2-Clause"
] | null | null | null | import unittest
import pytest
class ExampleTest(unittest.TestCase):
def test_example(self):
self.assertEqual(2 * 2, 4)
if __name__ == "__main__":
unittest.main() | 19.888889 | 37 | 0.698324 | 22 | 179 | 5.272727 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02069 | 0.189944 | 179 | 9 | 38 | 19.888889 | 0.77931 | 0 | 0 | 0 | 0 | 0 | 0.044444 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5fc87a41019d961e919704b561e9a03da5e5413a | 2,690 | py | Python | Level.py | KRHS-GameProgramming-2016/AstroDigger | 426c3b4750d86fae9e3f61b744518ffb5370f330 | [
"MIT"
] | 1 | 2017-03-15T16:56:29.000Z | 2017-03-15T16:56:29.000Z | Level.py | KRHS-GameProgramming-2016/AstroDigger | 426c3b4750d86fae9e3f61b744518ffb5370f330 | [
"MIT"
] | 3 | 2017-02-10T15:54:31.000Z | 2017-03-13T16:09:06.000Z | Level.py | KRHS-GameProgramming-2016/AstroDigger | 426c3b4750d86fae9e3f61b744518ffb5370f330 | [
"MIT"
] | null | null | null | import pygame, sys, math
from Dirt import *
from Enemy import *
from ShootingEnemy import *
from Shade import *
class Level():
def __init__(self, levelFile, levelNumber=1, tileSize=64):
self.dirts = []
self.players = []
self.enemies = []
self.playerSpawns = []
self.tileSize = tileSize
self.loadLevel(levelFile, levelNumber)
def unloadLevel(self):
self.dirts = []
self.player = []
self.enemySpawn = []
def loadLevel(self, levelFile, levelNumber):
f = open("Resources/Levels/"+levelFile)
lines = f.readlines()
f.close()
newlines = []
for line in lines:
newline = ""
for c in line:
if c != '\n':
newline += c
newlines += [newline]
lines = newlines
startIndex = lines.index(str(levelNumber))+1
endIndex = startIndex + 10
newlines = []
for line in range(startIndex, endIndex):
#print lines[line]
newlines += [lines[line]]
lines = newlines
for line in lines:
print line
for y,line in enumerate(lines):
for x,c in enumerate(line):
if c in "1234567890" : #levels of dirt
self.dirts += [Dirt(c,
[x*self.tileSize + self.tileSize/2,
y*self.tileSize + self.tileSize/2],
self.tileSize)
]
if c in "x" : #Pew
self.enemies += [Enemy(2,
[x*self.tileSize + self.tileSize/2,
y*self.tileSize + self.tileSize/2],
self.tileSize)
]
if c in "y" : #Beatbox
self.enemies += [ShootingEnemy(1,
[x*self.tileSize + self.tileSize/2,
y*self.tileSize + self.tileSize/2],
self.tileSize)
]
if c in "z" : #Shade
self.enemies += [Shade(4,
[x*self.tileSize + self.tileSize/2,
y*self.tileSize + self.tileSize/2],
self.tileSize)
]
#Minimun speed = 1 | max = 64
if __name__ == "__main__":
level = Level("Digger level1.lvl", 1)
| 32.409639 | 75 | 0.414498 | 234 | 2,690 | 4.713675 | 0.286325 | 0.228468 | 0.116047 | 0.174071 | 0.285585 | 0.245694 | 0.245694 | 0.245694 | 0.245694 | 0.245694 | 0 | 0.023375 | 0.491078 | 2,690 | 82 | 76 | 32.804878 | 0.782323 | 0.027509 | 0 | 0.307692 | 0 | 0 | 0.021839 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.076923 | null | null | 0.015385 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
396ad12574d55687860011dc68a36b13e04bb74d | 582 | py | Python | qcloudsdkcdn/UpdateCdnProjectRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdkcdn/UpdateCdnProjectRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdkcdn/UpdateCdnProjectRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class UpdateCdnProjectRequest(Request):
def __init__(self):
super(UpdateCdnProjectRequest, self).__init__(
'cdn', 'qcloudcliV1', 'UpdateCdnProject', 'cdn.api.qcloud.com')
def get_hostId(self):
return self.get_params().get('hostId')
def set_hostId(self, hostId):
self.add_param('hostId', hostId)
def get_projectId(self):
return self.get_params().get('projectId')
def set_projectId(self, projectId):
self.add_param('projectId', projectId)
| 26.454545 | 75 | 0.666667 | 65 | 582 | 5.723077 | 0.415385 | 0.080645 | 0.075269 | 0.091398 | 0.139785 | 0.139785 | 0 | 0 | 0 | 0 | 0 | 0.004292 | 0.199313 | 582 | 21 | 76 | 27.714286 | 0.793991 | 0.036082 | 0 | 0 | 0 | 0 | 0.139535 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.384615 | false | 0 | 0.076923 | 0.153846 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
396afec22caf9e8954136c5289b69cdb8edd67ac | 538 | py | Python | exhibitors/admin.py | betoesquivel/fil2014 | 4c2e9188769096391bb206b76ed1ab8bd2ff66a1 | [
"MIT"
] | 1 | 2016-05-18T18:46:48.000Z | 2016-05-18T18:46:48.000Z | exhibitors/admin.py | betoesquivel/fil2014 | 4c2e9188769096391bb206b76ed1ab8bd2ff66a1 | [
"MIT"
] | null | null | null | exhibitors/admin.py | betoesquivel/fil2014 | 4c2e9188769096391bb206b76ed1ab8bd2ff66a1 | [
"MIT"
] | null | null | null | from django.contrib import admin
from exhibitors.models import Exhibitor, Workshop, WorkshopEvents, Stand, Editorial, Book, Author, Category, Award, Volunteer, BookRegistered
# Register your models here.
admin.site.register(Exhibitor)
admin.site.register(Workshop)
admin.site.register(WorkshopEvents)
admin.site.register(Stand)
admin.site.register(Editorial)
admin.site.register(Book)
admin.site.register(Author)
admin.site.register(Category)
admin.site.register(Award)
admin.site.register(Volunteer)
admin.site.register(BookRegistered)
| 33.625 | 141 | 0.827138 | 68 | 538 | 6.544118 | 0.323529 | 0.222472 | 0.420225 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065056 | 538 | 15 | 142 | 35.866667 | 0.884692 | 0.048327 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.153846 | 0 | 0.153846 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
397498d105b42120ccc77b29b0703d54e27daae8 | 1,432 | py | Python | aiotdlib/api/types/group_call_participant_video_info.py | jraylan/aiotdlib | 4528fcfca7c5c69b54a878ce6ce60e934a2dcc73 | [
"MIT"
] | 37 | 2021-05-04T10:41:41.000Z | 2022-03-30T13:48:05.000Z | aiotdlib/api/types/group_call_participant_video_info.py | jraylan/aiotdlib | 4528fcfca7c5c69b54a878ce6ce60e934a2dcc73 | [
"MIT"
] | 13 | 2021-07-17T19:54:51.000Z | 2022-02-26T06:50:00.000Z | aiotdlib/api/types/group_call_participant_video_info.py | jraylan/aiotdlib | 4528fcfca7c5c69b54a878ce6ce60e934a2dcc73 | [
"MIT"
] | 7 | 2021-09-22T21:27:11.000Z | 2022-02-20T02:33:19.000Z | # =============================================================================== #
# #
# This file has been generated automatically!! Do not change this manually! #
# #
# =============================================================================== #
from __future__ import annotations
from pydantic import Field
from .group_call_video_source_group import GroupCallVideoSourceGroup
from ..base_object import BaseObject
class GroupCallParticipantVideoInfo(BaseObject):
"""
Contains information about a group call participant's video channel
:param source_groups: List of synchronization source groups of the video
:type source_groups: :class:`list[GroupCallVideoSourceGroup]`
:param endpoint_id: Video channel endpoint identifier
:type endpoint_id: :class:`str`
:param is_paused: True if the video is paused. This flag needs to be ignored, if new video frames are received
:type is_paused: :class:`bool`
"""
ID: str = Field("groupCallParticipantVideoInfo", alias="@type")
source_groups: list[GroupCallVideoSourceGroup]
endpoint_id: str
is_paused: bool
@staticmethod
def read(q: dict) -> GroupCallParticipantVideoInfo:
return GroupCallParticipantVideoInfo.construct(**q)
| 38.702703 | 114 | 0.569832 | 126 | 1,432 | 6.333333 | 0.52381 | 0.06015 | 0.0401 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.26257 | 1,432 | 36 | 115 | 39.777778 | 0.755682 | 0.585196 | 0 | 0 | 1 | 0 | 0.064516 | 0.055028 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.333333 | 0.083333 | 0.916667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
3977e24e667c82c38d13db7779c28c370c51a3c2 | 536 | py | Python | ex07/pessoa.py | barbaracalderon/dsoo-1 | 4f4955afdd05874ab9d6d8c6136b9dd34852a80d | [
"MIT"
] | null | null | null | ex07/pessoa.py | barbaracalderon/dsoo-1 | 4f4955afdd05874ab9d6d8c6136b9dd34852a80d | [
"MIT"
] | null | null | null | ex07/pessoa.py | barbaracalderon/dsoo-1 | 4f4955afdd05874ab9d6d8c6136b9dd34852a80d | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
from abstractPessoa import AbstractPessoa
class Pessoa(AbstractPessoa, ABC):
def __init__(self, nome: str, codigo: int):
super().__init__()
self.__nome = nome
self.__codigo = codigo
@property
def nome(self) -> str:
return self.__nome
@nome.setter
def nome(self, nome) -> str:
self.__nome = nome
@property
def codigo(self) -> int:
return self.__codigo
@codigo.setter
def codigo(self, codigo) -> int:
self.__codigo = codigo | 22.333333 | 45 | 0.645522 | 64 | 536 | 5.09375 | 0.28125 | 0.122699 | 0.110429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.251866 | 536 | 24 | 46 | 22.333333 | 0.812968 | 0 | 0 | 0.315789 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0.105263 | 0.105263 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
398ef53a63e97f1996fb81d5d84823582ec83c72 | 362 | py | Python | groupmne/__init__.py | hichamjanati/group-meeg | deea93b5d045a320f8aef30505cd363e287151ac | [
"MIT"
] | 5 | 2019-06-19T19:00:41.000Z | 2021-04-10T13:09:25.000Z | groupmne/__init__.py | hichamjanati/group-meeg | deea93b5d045a320f8aef30505cd363e287151ac | [
"MIT"
] | 24 | 2019-06-17T20:47:55.000Z | 2021-03-09T11:54:25.000Z | groupmne/__init__.py | hichamjanati/group-meeg | deea93b5d045a320f8aef30505cd363e287151ac | [
"MIT"
] | 2 | 2019-06-17T20:17:36.000Z | 2019-07-09T10:02:12.000Z | """Multi-subject source localization with MNE."""
from . import group_model, inverse, utils
from .group_model import compute_fwd, prepare_fwds
from .inverse import compute_group_inverse
from ._version import __version__
__all__ = ["group_model", "inverse",
"compute_group_inverse", "compute_fwd",
"prepare_fwds", "__version__", "utils"]
| 30.166667 | 50 | 0.734807 | 43 | 362 | 5.627907 | 0.418605 | 0.123967 | 0.140496 | 0.173554 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160221 | 362 | 11 | 51 | 32.909091 | 0.796053 | 0.118785 | 0 | 0 | 0 | 0 | 0.249201 | 0.067093 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
39b129c4dab8b3eeffb5c49c8ca2b96a9b44a893 | 62 | py | Python | retinaface/__init__.py | hphuongdhsp/retinaface | c184141d91f6719c5b135ccd0ae99384ab84ca69 | [
"MIT"
] | 7 | 2020-11-27T15:32:29.000Z | 2021-06-03T19:05:32.000Z | retinaface/__init__.py | hphuongdhsp/retinaface | c184141d91f6719c5b135ccd0ae99384ab84ca69 | [
"MIT"
] | null | null | null | retinaface/__init__.py | hphuongdhsp/retinaface | c184141d91f6719c5b135ccd0ae99384ab84ca69 | [
"MIT"
] | 2 | 2020-12-29T11:20:42.000Z | 2021-02-26T02:41:40.000Z | __version__ = "0.0.1"
from .detector import RetinafaceDetector | 31 | 40 | 0.806452 | 8 | 62 | 5.75 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053571 | 0.096774 | 62 | 2 | 40 | 31 | 0.767857 | 0 | 0 | 0 | 0 | 0 | 0.079365 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
39d87f67ecd0f2f0ef3a08c6c0e3cbdbbfbfeb96 | 4,314 | py | Python | sample_package/vector.py | JanMatas/intro-to-python | 75da23f0e9018fec6bed44199c53e0a3ef2c7059 | [
"MIT"
] | 1 | 2020-09-06T18:37:00.000Z | 2020-09-06T18:37:00.000Z | sample_package/vector.py | JanMatas/intro-to-python | 75da23f0e9018fec6bed44199c53e0a3ef2c7059 | [
"MIT"
] | null | null | null | sample_package/vector.py | JanMatas/intro-to-python | 75da23f0e9018fec6bed44199c53e0a3ef2c7059 | [
"MIT"
] | 1 | 2021-12-04T20:11:35.000Z | 2021-12-04T20:11:35.000Z | """This module defines a Vector class."""
from .matrix import Matrix
class Vector:
"""A standard one-dimensional vector from linear algebra.
The class is designed for sub-classing in such a way that
the user can adapt the typing class attribute to change,
for example, how the entries are stored (e.g., as integers).
Attributes:
storage (callable): must return an iterable that is used
to store the entries of the vector; defaults to tuple
typing (callable): type casting applied to all vector
entries upon creation; defaults to float
zero_threshold (float): maximum difference allowed when
comparing an entry to zero; defaults to 1e-12
"""
storage = tuple
typing = float
zero_threshold = 1e-12
def __init__(self, data):
"""Initiate a new vector.
Args:
data (iterable): the vector's entries;
must have at least one element
Raises:
ValueError: if the provided data do not have enough entries
"""
self._entries = self.storage(self.typing(x) for x in data)
if len(self) == 0:
raise ValueError("the vector must have at least one entry")
def __repr__(self):
name, args = self.__class__.__name__, ", ".join(f"{x:.3f}" for x in self)
return f"{name}(({args}))"
def __str__(self):
name, first, last, entries = (
self.__class__.__name__,
self[0],
self[-1],
len(self),
)
return f"{name}({first:.1f}, ..., {last:.1f})[{entries:d}]"
def __len__(self):
return len(self._entries)
def __getitem__(self, index):
if not isinstance(index, int):
raise TypeError("index must be an integer")
return self._entries[index]
def __iter__(self):
return iter(self._entries)
def __reversed__(self):
return reversed(self._entries)
def __add__(self, other):
if isinstance(other, self.__class__):
if len(self) != len(other):
raise ValueError("vectors need to be of the same length")
return self.__class__(x + y for (x, y) in zip(self, other))
elif isinstance(other, numbers.Number):
return self.__class__(x + other for x in self)
return NotImplemented
def __radd__(self, other):
return self + other
def __sub__(self, other):
return self + (-other)
def __rsub__(self, other):
return (-self) + other
def __mul__(self, other):
if isinstance(other, self.__class__):
if len(self) != len(other):
raise ValueError("vectors need to be of the same length")
return sum(x * y for (x, y) in zip(self, other))
elif isinstance(other, numbers.Number):
return self.__class__(x * other for x in self)
return NotImplemented
def __rmul__(self, other):
return self * other
def __truediv__(self, other):
if isinstance(other, numbers.Number):
return self * (1 / other)
return NotImplemented
def __eq__(self, other):
if isinstance(other, self.__class__):
if len(self) != len(other):
raise ValueError("vectors need to be of the same length")
for x, y in zip(self, other):
if abs(x - y) > self.zero_threshold:
return False
return True
return NotImplemented
def __pos__(self):
return self
def __neg__(self):
return self.__class__(-x for x in self)
def __abs__(self):
return norm(self)
def __bool__(self):
return bool(abs(self))
def __float__(self):
if len(self) != 1:
raise RuntimeError("vector must have exactly one entry to become a scalar")
return self[0]
def as_matrix(self, *, column=True):
"""Convert the vector into a matrix.
Args:
column (bool): if the vector should be interpreted as
as a column vector or not; defaults to True
Returns:
matrix (Matrix)
"""
if column:
return Matrix([x] for x in self)
return Matrix([(x for x in self)])
| 30.380282 | 87 | 0.583217 | 545 | 4,314 | 4.372477 | 0.273395 | 0.056651 | 0.017625 | 0.025178 | 0.336551 | 0.305497 | 0.24423 | 0.216953 | 0.216953 | 0.216953 | 0 | 0.005135 | 0.322902 | 4,314 | 141 | 88 | 30.595745 | 0.810681 | 0.229485 | 0 | 0.180723 | 0 | 0 | 0.095253 | 0.007595 | 0 | 0 | 0 | 0 | 0 | 1 | 0.253012 | false | 0 | 0.012048 | 0.13253 | 0.650602 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
39deb813cd5685f2f43a3c9972aee3382aef172f | 562 | py | Python | conf/matplotlib_conf.py | SuperH-0630/HGSSystem | 4bd0b18cec810df4915fea9473adbea6faea4fe2 | [
"MIT"
] | null | null | null | conf/matplotlib_conf.py | SuperH-0630/HGSSystem | 4bd0b18cec810df4915fea9473adbea6faea4fe2 | [
"MIT"
] | null | null | null | conf/matplotlib_conf.py | SuperH-0630/HGSSystem | 4bd0b18cec810df4915fea9473adbea6faea4fe2 | [
"MIT"
] | null | null | null | class ConfigMatplotlibRelease:
""" Matplotlib 相关配置 """
matplotlib_font = "SimHei"
matplotlib_font_dict = dict(family=matplotlib_font)
ConfigMatplotlib = ConfigMatplotlibRelease
try:
import matplotlib.font_manager as fm
except ImportError:
pass
else:
if ConfigMatplotlib.matplotlib_font not in [f.name for f in fm.fontManager.ttflist]:
print(f"请安装 {ConfigMatplotlib.matplotlib_font} 字体")
fm.rcParams["font.sans-serif"] = [ConfigMatplotlib.matplotlib_font] # 配置中文字体
fm.rcParams["axes.unicode_minus"] = False # 解决负号变豆腐块
| 31.222222 | 88 | 0.743772 | 64 | 562 | 6.390625 | 0.59375 | 0.239609 | 0.220049 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.161922 | 562 | 17 | 89 | 33.058824 | 0.868365 | 0.058719 | 0 | 0 | 0 | 0 | 0.153551 | 0.065259 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.076923 | 0.153846 | 0 | 0.384615 | 0.076923 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f2f88b852a5d4bf1b561e8f3d45731f5dac6598e | 135 | py | Python | git_tester.py | uvchik/TollerName | 42d1e912d940ad854cf90bb9b6a57d20f917aeac | [
"MIT"
] | null | null | null | git_tester.py | uvchik/TollerName | 42d1e912d940ad854cf90bb9b6a57d20f917aeac | [
"MIT"
] | null | null | null | git_tester.py | uvchik/TollerName | 42d1e912d940ad854cf90bb9b6a57d20f917aeac | [
"MIT"
] | null | null | null | #! /usr/bin/python3
vorname = "Joe"
nachname = "Biden"
print("{0} {1} is elected!".format(vorname, nachname))
print("Hallo World!")
| 15 | 54 | 0.651852 | 18 | 135 | 4.888889 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.133333 | 135 | 8 | 55 | 16.875 | 0.726496 | 0.133333 | 0 | 0 | 0 | 0 | 0.336207 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
f2f9578c500a44373f680d659ef7c0ef1bf17191 | 255 | py | Python | tech/process/lingo_processor.py | fferegrino/techlingo.fyi | 0ed41160b4a8c854f9f0c9104ce619e73c2c7e26 | [
"MIT"
] | 4 | 2021-06-20T00:53:19.000Z | 2022-02-04T19:26:12.000Z | tech/process/lingo_processor.py | fferegrino/techlingo.fyi | 0ed41160b4a8c854f9f0c9104ce619e73c2c7e26 | [
"MIT"
] | 16 | 2021-06-15T06:10:15.000Z | 2021-07-20T19:02:11.000Z | tech/process/lingo_processor.py | fferegrino/techlingo.fyi | 0ed41160b4a8c854f9f0c9104ce619e73c2c7e26 | [
"MIT"
] | 1 | 2021-06-20T03:03:42.000Z | 2021-06-20T03:03:42.000Z | from tech.entities.processed_lingo import ProcessedLingo
class LingoProcessor:
def process(self, processed: ProcessedLingo):
pass
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
pass
| 19.615385 | 56 | 0.694118 | 30 | 255 | 5.5 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.239216 | 255 | 12 | 57 | 21.25 | 0.850515 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0.25 | 0.125 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
f2fad1d2968b82dd0169033c6b783649405426fa | 226 | py | Python | connections/api/serializers.py | frwickst/apartment-application-service | 40387327a0f82ba01bfcb6ab8532ea4aec40d37a | [
"MIT"
] | 1 | 2021-03-15T11:29:12.000Z | 2021-03-15T11:29:12.000Z | connections/api/serializers.py | frwickst/apartment-application-service | 40387327a0f82ba01bfcb6ab8532ea4aec40d37a | [
"MIT"
] | 130 | 2020-09-07T08:30:29.000Z | 2022-03-29T11:49:27.000Z | connections/api/serializers.py | frwickst/apartment-application-service | 40387327a0f82ba01bfcb6ab8532ea4aec40d37a | [
"MIT"
] | 4 | 2020-09-07T05:34:13.000Z | 2021-11-07T12:51:21.000Z | from rest_framework import serializers
from connections.models import MappedApartment
class MappedApartmentSerializer(serializers.ModelSerializer):
class Meta:
model = MappedApartment
fields = "__all__"
| 22.6 | 61 | 0.774336 | 20 | 226 | 8.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181416 | 226 | 9 | 62 | 25.111111 | 0.918919 | 0 | 0 | 0 | 0 | 0 | 0.030973 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8431ce7ee5d7ce84ff9dcdd48dc9bbc4bf329581 | 280 | py | Python | app/main/__init__.py | atwh0405/miniblog | 820fc2ec1b38210783a6b340827f6c0213277f3e | [
"MIT"
] | null | null | null | app/main/__init__.py | atwh0405/miniblog | 820fc2ec1b38210783a6b340827f6c0213277f3e | [
"MIT"
] | null | null | null | app/main/__init__.py | atwh0405/miniblog | 820fc2ec1b38210783a6b340827f6c0213277f3e | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Blueprint
main = Blueprint('main', __name__)
from . import errors, views
from ..models import Permissions
@main.app_context_processor
def inject_permissions():
return dict(Permissions=Permissions) | 21.538462 | 40 | 0.714286 | 34 | 280 | 5.676471 | 0.705882 | 0.134715 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00431 | 0.171429 | 280 | 13 | 40 | 21.538462 | 0.827586 | 0.15 | 0 | 0 | 0 | 0 | 0.017778 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0.142857 | 0.714286 | 0.285714 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
84408c32802b1ef61c4d79ba69a6d29d57f38cb2 | 18,152 | py | Python | Games/Ludo/cli/ludo/painter.py | avyayjain/Python_Scripts | d89926a84d5df3cbd57244df27f215891aa60d20 | [
"Unlicense"
] | 20 | 2020-08-17T13:49:03.000Z | 2022-01-26T18:04:14.000Z | Games/Ludo/cli/ludo/painter.py | avyayjain/Python_Scripts | d89926a84d5df3cbd57244df27f215891aa60d20 | [
"Unlicense"
] | 20 | 2020-09-30T15:49:38.000Z | 2021-10-21T05:06:00.000Z | Games/Ludo/cli/ludo/painter.py | avyayjain/Python_Scripts | d89926a84d5df3cbd57244df27f215891aa60d20 | [
"Unlicense"
] | 67 | 2020-08-17T18:23:11.000Z | 2022-02-21T08:29:16.000Z | from copy import deepcopy
from os import linesep
# board template (matrix)
BOARD_TMPL = [['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '#', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'Y', 'E', 'L', 'L', 'O', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', 'V', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', 'L', 'U', 'E', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', '-', '-', '>', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#'], ['#', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '#'], ['#', '-', '-', '-', '-', '-', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '-', '-', '-', '-', '-', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '-', '-', '-', '-', '-', '#'], ['#', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', 'X', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '#'], ['#', '-', '-', '-', '-', '-', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '-', '-', '-', '-', '-', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '-', '-', '-', '-', '-', '#'], ['#', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '#'], ['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '<', '-', '-', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'G', 'R', 'E', 'E', 'N', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'R', 'E', 'D', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '^', ' ', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', '-', '-', '-', '-', '-', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', '#', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'], ['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#']]
# List of two sized tuples. The content of tuple correspond
# with address of matrix BOARD_TMPL. While list index correspond
# with pawn share position from board class
CODE_COMMON_SQUARES = [
(), # 0 index not used
(14, 2), (14, 8), (14, 14), (14, 20), (14, 26), (14, 32), (14, 38),
(12, 38), (10, 38), (8, 38), (6, 38), (4, 38), (2, 38), (2, 44),
(2, 50), (4, 50), (6, 50), (8, 50), (10, 50), (12, 50), (14, 50),
(14, 56), (14, 62), (14, 68), (14, 74), (14, 80), (14, 86), (16, 86),
(18, 86), (18, 80), (18, 74), (18, 68), (18, 62), (18, 56), (18, 50),
(20, 50), (22, 50), (24, 50), (26, 50), (28, 50), (30, 50), (30, 44),
(30, 38), (28, 38), (26, 38), (24, 38), (22, 38), (20, 38), (18, 38),
(18, 32), (18, 26), (18, 20), (18, 14), (18, 8), (18, 2), (16, 2)
]
# tuple correspond with address of matrix BOARD_TMPL
# color correspond to pawn colour
# index of colour's list correspond with pawn private (final) position
CODE_COLOUR_SQUARES = {
'yellow': [(), (16, 8), (16, 14), (16, 20), (16, 26), (16, 32), (16, 38)],
'blue': [(), (4, 44), (6, 44), (8, 44), (10, 44), (12, 44), (14, 44)],
'red': [(), (16, 80), (16, 74), (16, 68), (16, 62), (16, 56), (16, 50)],
'green': [(), (28, 44), (26, 44), (24, 44), (22, 44), (20, 44), (18, 44)]
}
# tuple correspond with address of matrix BOARD_TMPL
# color correspond to pawn colour
# index of colour's list correspond with pawn initial position
CODE_POOL_PLACES = {
'yellow': [(), (6, 14), (6, 19), (8, 14), (8, 19)],
'blue': [(), (6, 71), (6, 76), (8, 71), (8, 76)],
'red': [(), (24, 71), (24, 76), (26, 71), (26, 76)],
'green': [(), (24, 14), (24, 19), (26, 14), (26, 19)]
}
class PaintBoard():
def __init__(self):
self.board_tmpl_curr = deepcopy(BOARD_TMPL)
def _place_pawn(self, pawn, position, offset):
common_poss, private_poss = position
colour = pawn.colour.lower()
if private_poss > 0:
# private squares
row, column = CODE_COLOUR_SQUARES[colour][private_poss]
elif common_poss == 0:
# pool
row, column = CODE_POOL_PLACES[colour][pawn.index]
offset = 0 # we do not need from offset in the pool only in squares
else:
# common squares
row, column = CODE_COMMON_SQUARES[common_poss]
if offset > 0:
self.board_tmpl_curr[row - 1][column + offset] = pawn.id[1]
else:
self.board_tmpl_curr[row - 1][column - 1] = pawn.id[0]
self.board_tmpl_curr[row - 1][column] = pawn.id[1]
def _place_pawns(self, position_pawns):
for position, pawns in position_pawns.items():
for index, pawn in enumerate(pawns):
self._place_pawn(pawn, position, index)
def paint(self, position):
'''expect dict of
key - occupied positions and
value - list of pawns on that position
'''
self.board_tmpl_curr = deepcopy(BOARD_TMPL)
self._place_pawns(position)
board_paint = [''.join(row_list) for row_list in self.board_tmpl_curr]
board_paint_str = linesep.join(board_paint)
return board_paint_str
def present_6_die_name(number, name):
'''nicer print of die and
name of the player
'''
hor_line = 9 * '-'
sps = 37 * ' '
hor_line = sps + hor_line
matrix = [['| |', '| # |', '| |'],
['| |', '| # # |', '| |'],
['| # |', '| # |', '| # |'],
['| # # |', '| |', '| # # |'],
['| # # |', '| # |', '| # # |'],
['| # # # |', '| |', '| # # # |']]
matrix = [[sps + cell for cell in row] for row in matrix]
die = matrix[number - 1]
die[1] = die[1] + " " + name
s = linesep.join([hor_line] + die + [hor_line])
return s
| 176.23301 | 14,180 | 0.113266 | 570 | 18,152 | 3.491228 | 0.242105 | 0.054271 | 0.039196 | 0.051256 | 0.20402 | 0.20402 | 0.20402 | 0.156281 | 0.106533 | 0.106533 | 0 | 0.030376 | 0.316274 | 18,152 | 102 | 14,181 | 177.960784 | 0.129965 | 0.039555 | 0 | 0.057971 | 0 | 0 | 0.174043 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.072464 | false | 0 | 0.028986 | 0 | 0.144928 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ffc39625910a0727e837291746c200a9c109501d | 581 | py | Python | neo_test.py | Christian-B/my_spinnaker | b19f4025878bc4fbd6d81d78cec8c284929e148b | [
"MIT"
] | null | null | null | neo_test.py | Christian-B/my_spinnaker | b19f4025878bc4fbd6d81d78cec8c284929e148b | [
"MIT"
] | null | null | null | neo_test.py | Christian-B/my_spinnaker | b19f4025878bc4fbd6d81d78cec8c284929e148b | [
"MIT"
] | null | null | null | import numpy as np
from quantities import Hz
from neo import AnalogSignal as AnalogSignal
n = np.array([[0.1, 0.1, 0.1, 0.1],
[-2.0, -2.0, -2.0, -4.0],
[0.1, 0.1, 0.1, 0.1],
[-0.1, -0.1, -0.1, -0.1],
[-0.1, -0.1, -0.1, -0.1],
[-3.0, -3.0, -3.0, -3.0],
[0.1, 0.1, 0.1, 0.1],
[0.1, 0.1, 0.1, 0.1]])
a = AnalogSignal(n, sampling_rate=1000*Hz, units='V')
print(n)
print(n[1, 3])
print(n.shape)
print(n[:, 0])
print(a)
print(a[1, 3])
print(a.magnitude.shape)
print(a.magnitude[:, 0])
| 23.24 | 53 | 0.462995 | 116 | 581 | 2.310345 | 0.215517 | 0.179104 | 0.235075 | 0.313433 | 0.212687 | 0.212687 | 0.186567 | 0.186567 | 0.156716 | 0.156716 | 0 | 0.178744 | 0.287435 | 581 | 24 | 54 | 24.208333 | 0.468599 | 0 | 0 | 0.2 | 0 | 0 | 0.001721 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.15 | 0 | 0.15 | 0.4 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ffce648a04f8681b45206553c41129956e1b3998 | 163 | py | Python | src/tests/daily_test.py | ehoaix/qpet | b4161e5ba85d5d80ff44629d74665022a9f01659 | [
"MIT"
] | 7 | 2021-07-23T06:15:35.000Z | 2022-03-31T08:19:50.000Z | src/tests/daily_test.py | mohiko/qpet | efce3bc8a7e19eb2da591f5e756b80d94658d0ea | [
"MIT"
] | 1 | 2021-11-05T07:43:50.000Z | 2021-11-05T07:43:50.000Z | src/tests/daily_test.py | mohiko/qpet | efce3bc8a7e19eb2da591f5e756b80d94658d0ea | [
"MIT"
] | 4 | 2021-11-04T10:50:51.000Z | 2022-01-03T01:59:48.000Z | from qpet import qpet
import unittest
class DailyTest(unittest.TestCase):
def test_basic(self):
pass
if __name__ == '__main__':
unittest.main()
| 14.818182 | 35 | 0.693252 | 20 | 163 | 5.2 | 0.75 | 0.192308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.214724 | 163 | 10 | 36 | 16.3 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0.04908 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.142857 | 0.285714 | 0 | 0.571429 | 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 | 1 | 0 | 0 | 3 |
ffe82ae544e4c44c41abff500a6c72c4d20ec043 | 106 | py | Python | answers/Akshay Shukla/Day5/ques1.py | arc03/30-DaysOfCode-March-2021 | 6d6e11bf70280a578113f163352fa4fa8408baf6 | [
"MIT"
] | 22 | 2021-03-16T14:07:47.000Z | 2021-08-13T08:52:50.000Z | answers/Akshay Shukla/Day5/ques1.py | arc03/30-DaysOfCode-March-2021 | 6d6e11bf70280a578113f163352fa4fa8408baf6 | [
"MIT"
] | 174 | 2021-03-16T21:16:40.000Z | 2021-06-12T05:19:51.000Z | answers/Akshay Shukla/Day5/ques1.py | arc03/30-DaysOfCode-March-2021 | 6d6e11bf70280a578113f163352fa4fa8408baf6 | [
"MIT"
] | 135 | 2021-03-16T16:47:12.000Z | 2021-06-27T14:22:38.000Z | x,y,z=0,1,0
print(x,',',y,end="")
for i in range(1,49):
z=x+y
print(',',z,end="")
x=y
y=z
| 13.25 | 23 | 0.433962 | 26 | 106 | 1.769231 | 0.461538 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075 | 0.245283 | 106 | 7 | 24 | 15.142857 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0.018868 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.285714 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
fff079ce77bf01ae417f39a9257cfba78600793b | 69 | py | Python | Polar_Coordinates.py | jairavelasco/hackerrank-python | 4bae82962d7086047571df027e93b546e0952d2c | [
"MIT"
] | null | null | null | Polar_Coordinates.py | jairavelasco/hackerrank-python | 4bae82962d7086047571df027e93b546e0952d2c | [
"MIT"
] | null | null | null | Polar_Coordinates.py | jairavelasco/hackerrank-python | 4bae82962d7086047571df027e93b546e0952d2c | [
"MIT"
] | null | null | null | import cmath
c = complex(input())
print(abs(c))
print(cmath.phase(c)) | 17.25 | 21 | 0.710145 | 12 | 69 | 4.083333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.086957 | 69 | 4 | 21 | 17.25 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
fffa1cf9aba30ea088883d1a9833d7ac78fe48af | 4,848 | py | Python | core/image_loaders.py | HakaiInstitute/deglint-mask-rgb | 1786a4cb255a4a0be3e6e5cfd7c77b5e4489994d | [
"MIT"
] | 3 | 2021-05-19T01:46:34.000Z | 2021-06-22T15:35:04.000Z | core/image_loaders.py | HakaiInstitute/deglint-mask-rgb | 1786a4cb255a4a0be3e6e5cfd7c77b5e4489994d | [
"MIT"
] | null | null | null | core/image_loaders.py | HakaiInstitute/deglint-mask-rgb | 1786a4cb255a4a0be3e6e5cfd7c77b5e4489994d | [
"MIT"
] | 1 | 2021-05-20T00:03:02.000Z | 2021-05-20T00:03:02.000Z | """
Created by: Taylor Denouden
Organization: Hakai Institute
Date: 2020-09-18
Description:
"""
import os
import re
from abc import ABC, ABCMeta, abstractmethod
from functools import singledispatchmethod
from pathlib import Path
from typing import Iterable, List, Union
import numpy as np
from PIL import Image
from .utils import list_images, normalize_img
Image.MAX_IMAGE_PIXELS = None
class ImageLoader(ABC):
def __init__(self, image_directory: str, mask_directory: str):
super().__init__()
self.image_directory = Path(image_directory)
self.mask_directory = Path(mask_directory)
def __len__(self):
return sum(1 for _ in self.paths)
@property
@abstractmethod
def images(self) -> Iterable[str]:
raise NotImplementedError
@property
@abstractmethod
def paths(self) -> Iterable[Union[List[str], str]]:
raise NotImplementedError
def preprocess_image(self, img: np.ndarray) -> np.ndarray:
return img
@singledispatchmethod
def get_mask_save_paths(self, img_paths: List[str]) -> Iterable[str]:
img_names = (Path(p).stem for p in img_paths)
return (str(self.mask_directory.joinpath(f"{p}_mask.png")) for p in img_names)
@get_mask_save_paths.register
def _(self, img_path: str) -> Iterable[str]:
return self.get_mask_save_paths([img_path])
class SingleFileImageLoader(ImageLoader, metaclass=ABCMeta):
@staticmethod
def load_image(path: str) -> np.ndarray:
img = Image.open(path)
return np.array(img).astype(np.float)
@property
def images(self) -> Iterable[np.ndarray]:
return (self.preprocess_image(self.load_image(p)) for p in self.paths)
class RGB8BitLoader(SingleFileImageLoader):
@property
def paths(self) -> Iterable[str]:
# Filter anything smaller than 1kb, since it's probably corrupt
return filter(lambda p: os.stat(p).st_size > (1 << 20), list_images(self.image_directory))
def preprocess_image(self, img: np.ndarray) -> np.ndarray:
return normalize_img(img, bit_depth=8)
class MultiFileImageLoader(ImageLoader, metaclass=ABCMeta):
@property
@abstractmethod
def paths(self) -> Iterable[List[str]]:
raise NotImplementedError
@staticmethod
def load_image(paths: List[str]) -> np.ndarray:
imgs = [np.asarray(Image.open(p)) for p in paths]
result = np.stack(imgs, axis=2).astype(np.float)
return result
@property
def images(self) -> Iterable[np.ndarray]:
return (self.preprocess_image(self.load_image(p)) for p in self.paths)
class MicasenseRedEdgeLoader(MultiFileImageLoader):
_blue_band_pattern = re.compile("(.*[\\\\/])?IMG_[0-9]{4}_1.tif", flags=re.IGNORECASE)
def _is_blue_band_path(self, path: str) -> bool:
return self._blue_band_pattern.match(str(path)) is not None
@property
def _blue_band_paths(self) -> Iterable[str]:
return filter(self._is_blue_band_path, list_images(self.image_directory))
@staticmethod
def _blue_band_path_to_band_paths(path: str) -> List[str]:
in_path_root = Path(path).stem[:-1]
return [str(Path(path).with_name(f"{in_path_root}{i}.tif")) for i in range(1, 6)]
@property
def paths(self) -> Iterable[List[str]]:
return map(self._blue_band_path_to_band_paths, self._blue_band_paths)
def preprocess_image(self, img: np.ndarray) -> np.ndarray:
return normalize_img(img, bit_depth=16)
class P4MSLoader(MultiFileImageLoader):
_blue_band_pattern = re.compile("(.*[\\\\/])?DJI_[0-9]{3}1.TIF", flags=re.IGNORECASE)
def _is_blue_band_path(self, path: str) -> bool:
return self._blue_band_pattern.match(str(path)) is not None
@property
def _blue_band_paths(self) -> Iterable[str]:
return filter(self._is_blue_band_path, list_images(self.image_directory))
@staticmethod
def _blue_band_path_to_band_paths(path: str) -> List[str]:
in_path_root = Path(path).stem[:-1]
return [str(Path(path).with_name(f"{in_path_root}{i}.TIF")) for i in range(1, 6)]
@property
def paths(self) -> Iterable[List[str]]:
return map(self._blue_band_path_to_band_paths, self._blue_band_paths)
def preprocess_image(self, img: np.ndarray) -> np.ndarray:
return normalize_img(img, bit_depth=16)
if __name__ == '__main__':
import matplotlib.pyplot as plt
loader = P4MSLoader("/media/taylor/Samsung_T5/Datasets/ExampleImages/P4MS", "/tmp")
for im in loader.images:
plt.figure()
plt.imshow(im[:, :, [2, 1, 0]])
plt.show()
loader = MicasenseRedEdgeLoader("/media/taylor/Samsung_T5/Datasets/ExampleImages/MicasenseRedEdge", "/tmp")
for im in loader.images:
plt.figure()
plt.imshow(im[:, :, [2, 1, 0]])
plt.show()
| 31.894737 | 111 | 0.683581 | 660 | 4,848 | 4.792424 | 0.224242 | 0.040468 | 0.030351 | 0.031616 | 0.539994 | 0.522289 | 0.439772 | 0.439772 | 0.439772 | 0.439772 | 0 | 0.011503 | 0.193069 | 4,848 | 151 | 112 | 32.10596 | 0.797035 | 0.031147 | 0 | 0.52381 | 0 | 0 | 0.05225 | 0.046279 | 0 | 0 | 0 | 0 | 0 | 1 | 0.228571 | false | 0 | 0.095238 | 0.142857 | 0.590476 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
fffdb61978c08d23ee1608acb0146ea1214fff62 | 11,710 | py | Python | pySpatialTools/Retrieve/aux_retriever_parsing.py | tgquintela/pySpatialTools | e028008f9750521bf7d311f7cd3323c88d621ea4 | [
"MIT"
] | 8 | 2015-07-21T05:15:16.000Z | 2018-06-12T18:22:52.000Z | pySpatialTools/Retrieve/aux_retriever_parsing.py | tgquintela/pySpatialTools | e028008f9750521bf7d311f7cd3323c88d621ea4 | [
"MIT"
] | 6 | 2016-01-11T22:25:28.000Z | 2016-01-28T16:17:46.000Z | pySpatialTools/Retrieve/aux_retriever_parsing.py | tgquintela/pySpatialTools | e028008f9750521bf7d311f7cd3323c88d621ea4 | [
"MIT"
] | null | null | null |
"""
Auxiliar retrievers parsing
---------------------------
Tools and utilities to parse heterogenous ways to give retriever information
in order to obtain retriever objects.
"""
import numpy as np
from retrievers import BaseRetriever
from collectionretrievers import RetrieverManager
from pySpatialTools.Discretization import _discretization_parsing_creation
###############################################################################
######################## Main paser creation functions ########################
###############################################################################
################################## Retrievers #################################
def _retrieverobject_parsing_creation(retriever_info):
"""Function which uniforms the retriever info to be useful in other
parts of the code.
Parameters
----------
retriever_info: pst.BaseRetriever or tuple
Variable which contains the retriever information. The standarts input
of that variable are:
* Retriever object
* (Retriever class, main_info)
* (Retriever class, main_info, pars_ret)
* (Retriever class, main_info, pars_ret, autolocs)
Returns
-------
retriever_info: pst.BaseRetriever
the retriever instance.
"""
if isinstance(retriever_info, BaseRetriever):
pass
else:
assert(type(retriever_info) == tuple)
assert(isinstance(retriever_info[0], object))
pars_ret = {}
if len(retriever_info) >= 3:
pars_ret = retriever_info[2]
if len(retriever_info) == 4:
pars_ret['autolocs'] = retriever_info[3]
retriever_info = retriever_info[0](retriever_info[1], **pars_ret)
assert(isinstance(retriever_info, BaseRetriever))
return retriever_info
def _retrievermanager_parsing_creation(retriever_info):
"""Function which uniforms the retriever info to be useful in other
parts of the code.
Parameters
----------
retriever_info: pst.BaseRetriever or tuple
Variable which contains the retriever information. The standarts input
of that variable are:
* Retriever object
* Retriever objects
* RetrieverManager objects
Returns
-------
retriever_info: pst.BaseRetriever
the retriever instance.
"""
if isinstance(retriever_info, BaseRetriever):
retriever_info = RetrieverManager(retriever_info)
elif type(retriever_info) == list:
assert(all([isinstance(e, BaseRetriever) for e in retriever_info]))
retriever_info = RetrieverManager(retriever_info)
else:
assert(isinstance(retriever_info, RetrieverManager))
assert(isinstance(retriever_info, RetrieverManager))
return retriever_info
def _retriever_parsing_creation(retriever_info):
"""Function which uniforms the retriever info to be useful in other
parts of the code.
Parameters
----------
retriever_info: pst.BaseRetriever or tuple
Variable which contains the retriever information. The standarts input
of that variable are:
* Retriever object
* (Retriever class, main_info)
* (Retriever class, main_info, pars_ret)
* (Retriever class, main_info, pars_ret, autolocs)
Returns
-------
retriever_info: pst.BaseRetriever
the retriever instance.
"""
if isinstance(retriever_info, RetrieverManager):
pass
elif isinstance(retriever_info, BaseRetriever):
retriever_info = _retrievermanager_parsing_creation(retriever_info)
elif type(retriever_info) == list:
r = [_retrieverobject_parsing_creation(ret) for ret in retriever_info]
retriever_info = _retrievermanager_parsing_creation(r)
else:
retriever_info = _retrieverobject_parsing_creation(retriever_info)
retriever_info = _retrievermanager_parsing_creation(retriever_info)
assert(isinstance(retriever_info, RetrieverManager))
return retriever_info
###############################################################################
################## Creation of automatic discretization maps ##################
###############################################################################
def create_m_in_inverse_discretization(discretization_info):
"""Create in_map for inverse discretization.
Parameters
----------
discretization_info: tuple or pst.BaseSpatialDiscretizor
It is defined by a discretization object or a tuple of locations,
regions and discretization object. The standard inputs of that
function parameter are:
* (discretizator, locs)
* (locs, regions)
* disc
* locs, regs, disc
Returns
-------
m_in_inverse_discretazation: function
the function which formats the input of the retriever.
"""
## 0. Parsing discretization information input
locs, regions, disc = _discretization_parsing_creation(discretization_info)
## 1. Building map
def m_in_inverse_discretazation(self, idxs):
"""Inverse application of the discretization information."""
new_idxs = []
for i in idxs:
new_idxs.append(np.where(regions == i)[0])
return new_idxs
return m_in_inverse_discretazation
def create_m_in_direct_discretization(discretization_info):
"""Create in_map for direct discretization.
Parameters
----------
discretization_info: tuple or pst.BaseSpatialDiscretizor
It is defined by a discretization object or a tuple of locations,
regions and discretization object. The standard inputs of that
function parameter are:
* (discretizator, locs)
* (locs, regions)
* disc
* locs, regs, disc
Returns
-------
m_in_direct_discretazation: function
the function which formats the input of the retriever.
"""
## 0. Parsing discretization information input
locs, regions, disc = _discretization_parsing_creation(discretization_info)
## 1. Building map
if disc is not None:
def m_in_direct_discretazation(self, idxs):
"""Direct application of the discretization information."""
return [disc.discretize(locs[i]) for i in idxs]
else:
def m_in_direct_discretazation(self, idxs):
"""Direct application of the discretization information."""
return [np.array(regions[e]) for e in idxs]
return m_in_direct_discretazation
def create_m_out_inverse_discretization(discretization_info):
"""Create out_map for inverse discretization.
Parameters
----------
discretization_info: tuple or pst.BaseSpatialDiscretizor
It is defined by a discretization object or a tuple of locations,
regions and discretization object. The standard inputs of that
function parameter are:
* (discretizator, locs)
* (locs, regions)
* disc
* locs, regs, disc
Returns
-------
m_out_inverse_discretization: function
the function which formats the output of the retriever.
"""
## 0. Parsing discretization information input
locs, regions, disc = _discretization_parsing_creation(discretization_info)
## 1. Building map
if type(regions) == np.ndarray:
def m_out_inverse_discretization(self, idxs, neighs_info):
"""This out_map for retrievers change the size of neighbourhood by
substituting the regions_id or groups_id in the neighs_info for the
elements which belong to this groups.
"""
neighs, dists = neighs_info
neighs_o, dists_o = [], []
for iss_i in range(len(neighs)):
neighs_p, dists_p = [], []
for i in range(len(neighs[iss_i])):
neighs_ip = np.where(regions == neighs[iss_i][i])[0]
neighs_p.append(neighs_ip)
if dists[iss_i] is not None:
sh = len(neighs_ip), 1
dists_p.append(np.ones(sh) * dists[iss_i][i])
if neighs_p:
neighs_p = np.concatenate(neighs_p)
if dists_p:
dists_p = np.concatenate(dists_p)
else:
dists_p = np.ones((0, 1))
neighs_o.append(neighs_p)
dists_o.append(dists_p)
return neighs_o, dists_o
return m_out_inverse_discretization
def create_m_out_direct_discretization(discretization_info):
"""Create out_map for inverse discretization.
Parameters
----------
discretization_info: tuple or pst.BaseSpatialDiscretizor
It is defined by a discretization object or a tuple of locations,
regions and discretization object. The standard inputs of that
function parameter are:
* (discretizator, locs)
* (locs, regions)
* disc
* locs, regs, disc
Returns
-------
m_out_direct_discretization: function
the function which formats the output of the retriever.
"""
## 0. Parsing discretization information input
locs, regions, disc = _discretization_parsing_creation(discretization_info)
## 1. Building map
if disc is None:
def m_out_direct_discretization(self, idxs, neighs_info):
"""This out_map for retrievers don't change the size of
neighbourhood, only substitutes the element id for the group or
regions id. It is useful for PhantomFeatures and direct distance
features. Distance don't change.
Parameters
----------
neighs_info: tuple (neighs, dists)
the neighbourhood information.
Returns
-------
neighs_info: tuple (neighs, dists)
the neighbourhood information.
"""
neighs, dists = neighs_info
neighs_o = []
for iss_i in range(len(neighs)):
neighs_p = []
for i in range(len(neighs[iss_i])):
neighs_ip = np.array([regions[neighs[iss_i][i]]]).ravel()
neighs_p.append(neighs_ip)
if neighs_p:
neighs_p = np.concatenate(neighs_p)
neighs_o.append(neighs_p)
return neighs_o, dists
else:
def m_out_direct_discretization(self, idxs, neighs_info):
"""This out_map for retrievers don't change the size of
neighbourhood, only substitutes the element id for the group or
regions id. It is useful for PhantomFeatures and direct distance
features. Distance don't change.
Parameters
----------
neighs_info: tuple (neighs, dists)
the neighbourhood information.
Returns
-------
neighs_info: tuple (neighs, dists)
the neighbourhood information.
"""
neighs, dists = neighs_info
neighs_o = []
for iss_i in range(len(neighs)):
neighs_p = []
for i in range(len(neighs[iss_i])):
neighs_ip = disc.discretize(locs[neighs[iss_i][i]])
neighs_p.append(np.array([neighs_ip]).ravel())
if neighs_p:
neighs_p = np.concatenate(neighs_p)
neighs_o.append(neighs_p)
return neighs_o, dists
return m_out_direct_discretization
| 35.592705 | 79 | 0.604526 | 1,234 | 11,710 | 5.538088 | 0.119935 | 0.089406 | 0.03029 | 0.024583 | 0.777583 | 0.735294 | 0.718028 | 0.659789 | 0.641059 | 0.635792 | 0 | 0.002373 | 0.280359 | 11,710 | 328 | 80 | 35.70122 | 0.808591 | 0.431682 | 0 | 0.504505 | 0 | 0 | 0.001498 | 0 | 0 | 0 | 0 | 0 | 0.063063 | 1 | 0.117117 | false | 0.018018 | 0.036036 | 0 | 0.27027 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
080c8e3ffb6ac24f753fe57c340383052f7ee631 | 908 | py | Python | tree_hugger/core/queries.py | sarthakforwet/tree-hugger | f987cec0b8ecd639679885d791c3fce51db282b9 | [
"MIT"
] | 95 | 2020-05-07T15:16:59.000Z | 2022-03-10T17:12:56.000Z | tree_hugger/core/queries.py | rajpratyush/tree-hugger | f987cec0b8ecd639679885d791c3fce51db282b9 | [
"MIT"
] | 33 | 2020-06-11T00:11:37.000Z | 2021-11-20T09:02:00.000Z | tree_hugger/core/queries.py | rajpratyush/tree-hugger | f987cec0b8ecd639679885d791c3fce51db282b9 | [
"MIT"
] | 10 | 2020-08-20T03:45:10.000Z | 2021-03-14T01:38:15.000Z | import os
import logging
from pathlib import Path
from collections import UserDict
import yaml
import tree_hugger.setup_logging
from tree_hugger.exceptions import QueryFileNotFoundError
class Query(UserDict):
data = {}
def __init__(self, query_file_path: str, query_file_content: str):
self.query_file_path = query_file_path
self.update(query_file_content)
@staticmethod
def fromFile(query_file_path: str):
if not Path(query_file_path).exists() or not Path(query_file_path).is_file():
raise QueryFileNotFoundError(f"Cound not find {query_file_path}")
with open(query_file_path) as f:
query = Query(query_file_path, yaml.load(f, Loader=yaml.FullLoader))
return query
def reload(self):
with open(self.query_file_path) as f:
self.update(yaml.load(f, Loader=yaml.FullLoader))
| 27.515152 | 85 | 0.696035 | 122 | 908 | 4.918033 | 0.352459 | 0.18 | 0.216667 | 0.085 | 0.216667 | 0.096667 | 0 | 0 | 0 | 0 | 0 | 0 | 0.225771 | 908 | 32 | 86 | 28.375 | 0.853485 | 0 | 0 | 0 | 0 | 0 | 0.035242 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.136364 | false | 0 | 0.318182 | 0 | 0.590909 | 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 | 1 | 0 | 0 | 3 |
0838774fd2ec7fb312c8b7ec7aab501b6ceab3c0 | 223 | py | Python | 0290.word_pattern/solution.py | WZMJ/Algorithms | 07f648541d38e24df38bda469665c12df6a50637 | [
"MIT"
] | 5 | 2020-05-23T02:18:26.000Z | 2021-07-05T05:36:01.000Z | 0290.word_pattern/solution.py | WZMJ/Algorithms | 07f648541d38e24df38bda469665c12df6a50637 | [
"MIT"
] | 1 | 2020-06-10T07:17:24.000Z | 2020-07-20T02:21:24.000Z | 0290.word_pattern/solution.py | WZMJ/Algorithms | 07f648541d38e24df38bda469665c12df6a50637 | [
"MIT"
] | 1 | 2019-04-23T13:01:50.000Z | 2019-04-23T13:01:50.000Z | class Solution:
def word_pattern(self, pattern: str, str: str) -> bool:
words = str.split(" ")
return len(pattern) == len(words) and len(set(pattern)) == len(set(words)) == len(set(zip(pattern, words)))
| 44.6 | 115 | 0.61435 | 31 | 223 | 4.387097 | 0.483871 | 0.132353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201794 | 223 | 4 | 116 | 55.75 | 0.764045 | 0 | 0 | 0 | 0 | 0 | 0.004484 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.75 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
083d32a0e26219db84725fa3c50a03abc3c4f22d | 196 | py | Python | backend/run.py | jiz148/medical_app | 2f8b3f299ff6a87e62ac7483b6d2bac156a08874 | [
"MIT"
] | null | null | null | backend/run.py | jiz148/medical_app | 2f8b3f299ff6a87e62ac7483b6d2bac156a08874 | [
"MIT"
] | null | null | null | backend/run.py | jiz148/medical_app | 2f8b3f299ff6a87e62ac7483b6d2bac156a08874 | [
"MIT"
] | null | null | null | # add system path
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from backend_app.api import app
if __name__ == "__main__":
app.run(debug=True, port=5001)
| 17.818182 | 59 | 0.739796 | 32 | 196 | 4.125 | 0.65625 | 0.090909 | 0.19697 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023529 | 0.132653 | 196 | 10 | 60 | 19.6 | 0.752941 | 0.076531 | 0 | 0 | 0 | 0 | 0.044693 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
08421ad6ff798414faaa10d03c7896d12c20ae79 | 1,242 | py | Python | NCPWD/apps/user_profile/migrations/0006_auto_20190816_0839.py | fossabot/NCPWD | e46776ecf0cb4f263ff4e7883cb2402a3fc58717 | [
"Apache-2.0"
] | 1 | 2019-08-22T23:36:07.000Z | 2019-08-22T23:36:07.000Z | NCPWD/apps/user_profile/migrations/0006_auto_20190816_0839.py | C3real-kill3r/H-digest | afce0a6e8b0fa4d2684550fe9f484ab9c6e76560 | [
"Apache-2.0"
] | 10 | 2019-12-12T13:59:43.000Z | 2021-09-22T18:21:44.000Z | NCPWD/apps/user_profile/migrations/0006_auto_20190816_0839.py | C3real-kill3r/H-digest | afce0a6e8b0fa4d2684550fe9f484ab9c6e76560 | [
"Apache-2.0"
] | 2 | 2019-12-12T13:56:33.000Z | 2019-12-26T11:47:05.000Z | # Generated by Django 2.2.4 on 2019-08-16 08:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user_profile', '0005_auto_20190810_0811'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='cause',
),
migrations.RemoveField(
model_name='profile',
name='disability',
),
migrations.RemoveField(
model_name='profile',
name='email',
),
migrations.RemoveField(
model_name='profile',
name='firstname',
),
migrations.RemoveField(
model_name='profile',
name='lastname',
),
migrations.RemoveField(
model_name='profile',
name='national_id',
),
migrations.RemoveField(
model_name='profile',
name='nationality',
),
migrations.AddField(
model_name='profile',
name='blood_type',
field=models.CharField(blank=True, choices=[('A', 'a'), ('B', 'b'), ('AB', 'ab'), ('O', 'o')], default='ALBINISM', max_length=15, null=True),
),
]
| 26.425532 | 153 | 0.516103 | 109 | 1,242 | 5.743119 | 0.495413 | 0.115016 | 0.204473 | 0.255591 | 0.458466 | 0.458466 | 0 | 0 | 0 | 0 | 0 | 0.04064 | 0.346216 | 1,242 | 46 | 154 | 27 | 0.730296 | 0.036232 | 0 | 0.575 | 1 | 0 | 0.148954 | 0.019247 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.025 | 0 | 0.1 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0851630a1f917bf43d8c79b5c904d735ea9f9299 | 2,374 | py | Python | lpbm/modules/articles.py | fmichea/lpbm | 172772d562e2f1aa4aba72599150f95f89bdf6ce | [
"BSD-3-Clause"
] | 1 | 2015-11-09T11:30:41.000Z | 2015-11-09T11:30:41.000Z | lpbm/modules/articles.py | fmichea/lpbm | 172772d562e2f1aa4aba72599150f95f89bdf6ce | [
"BSD-3-Clause"
] | 1 | 2015-04-28T07:02:21.000Z | 2016-01-23T19:12:11.000Z | lpbm/modules/articles.py | fmichea/lpbm | 172772d562e2f1aa4aba72599150f95f89bdf6ce | [
"BSD-3-Clause"
] | 2 | 2016-01-11T17:55:42.000Z | 2018-03-19T19:03:15.000Z | # lpbm/modules/articles.py - Loads articles and treats them.
# Author: Franck Michea < franck.michea@gmail.com >
# License: New BSD License (See LICENSE)
'''
Articles manager, finds and loads all the articles of the blog. These are a
pair of two files. One is a markdown file, the other one an ini file.
'''
import lpbm.exceptions
import lpbm.logging
import lpbm.module_loader
import lpbm.tools as ltools
from lpbm.lib.deprecated_command import deprecated_command
from lpbm.models.articles import Article
_LOGGER = lpbm.logging.get()
class Articles(lpbm.module_loader.ModelManagerModule):
'''
Articles manager, finds and loads all the articles of the blog. These are a
pair of two files. One is a markdown file, the other one an ini file.
'''
def abstract(self): return 'Loads and manipulates articles.'
def model_cls(self): return Article
def name(self): return 'articles'
def object_name(self): return 'article'
def init(self):
super().init()
self.needed_modules = ['authors', 'categories']
self.add_id_option('-p', '--publish', help='Publishes the draft.')
self.add_id_option('-E', '--edit-content', help='Opens your $EDITOR on the article.')
def load(self, modules, args):
def filter_fn(a):
return a.endswith('.markdown')
for root, filename in ltools.filter_files(filter_fn, self.args.exec_path, 'articles'):
self.register_object(Article, ltools.join(root, filename))
def _get_author_verbose(self, authors):
res = []
for idx in authors:
try:
res.append(self.modules['authors'][idx].nickname)
except lpbm.exceptions.ModelDoesNotExistError:
pass
return ltools.join_names(res or ['[deleted]'])
# Particular functions for command line.
def opt_list(self, *args, **kwargs):
'''Lists all the articles with some useful information.'''
deprecated_command()
def opt_publish(self, id):
'''Publish an article.'''
deprecated_command()
def opt_new(self):
'''
New article from command line. This will help the user create a
particular file.
'''
deprecated_command()
def opt_edit_content(self, id):
'''Opens editor to modify its content.'''
deprecated_command()
| 30.831169 | 94 | 0.658382 | 309 | 2,374 | 4.961165 | 0.407767 | 0.066536 | 0.027397 | 0.04501 | 0.146119 | 0.146119 | 0.146119 | 0.146119 | 0.146119 | 0.146119 | 0 | 0 | 0.23631 | 2,374 | 76 | 95 | 31.236842 | 0.84556 | 0.281803 | 0 | 0.105263 | 0 | 0 | 0.108656 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0.026316 | 0.157895 | 0.131579 | 0.552632 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f2370df3d871e32c742319d6d2bf923338119f5b | 470 | py | Python | KeywordArguments.py | DrewDaddio/Automate-Python | 552c8f4041c53c9ce1d6a7e1b8c11f640695453c | [
"Unlicense"
] | null | null | null | KeywordArguments.py | DrewDaddio/Automate-Python | 552c8f4041c53c9ce1d6a7e1b8c11f640695453c | [
"Unlicense"
] | null | null | null | KeywordArguments.py | DrewDaddio/Automate-Python | 552c8f4041c53c9ce1d6a7e1b8c11f640695453c | [
"Unlicense"
] | null | null | null | print('Hello')
print('World')
# adding a keyword argument will get "Hello World" on the same line.
print('Hello', end=' ')
print('World')
# the "end=' '" adds a single space character at the end of Hello starts the next print right next ot it
print('cat', 'dog', 'mouse')
#the above will have a single space character
print('cat', 'dog', 'mouse', sep='ABC')
#the above "sep" argument will make ABC show in the spaces instead of a single space character
| 33.571429 | 105 | 0.685106 | 76 | 470 | 4.236842 | 0.486842 | 0.065217 | 0.111801 | 0.195652 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.191489 | 470 | 13 | 106 | 36.153846 | 0.847368 | 0.653191 | 0 | 0.333333 | 0 | 0 | 0.317241 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
f244ffac0ac28bca762fdd0edf5599847bffff64 | 262 | py | Python | python_demos/mysql_demos/01_connect.py | t4d-classes/advanced-python_01102022 | bf20d78f0ad44324998ceed8bdd377ec1805f97e | [
"MIT"
] | null | null | null | python_demos/mysql_demos/01_connect.py | t4d-classes/advanced-python_01102022 | bf20d78f0ad44324998ceed8bdd377ec1805f97e | [
"MIT"
] | null | null | null | python_demos/mysql_demos/01_connect.py | t4d-classes/advanced-python_01102022 | bf20d78f0ad44324998ceed8bdd377ec1805f97e | [
"MIT"
] | 1 | 2022-01-14T18:12:37.000Z | 2022-01-14T18:12:37.000Z | import mysql.connector
from contextlib import closing
with closing(mysql.connector.connect(
host="localhost",
port=3306,
user="root",
password="sql!DB123!"
)) as mydb:
print(mydb)
print(mydb.is_connected())
print(mydb.is_connected())
| 16.375 | 37 | 0.69084 | 33 | 262 | 5.424242 | 0.666667 | 0.150838 | 0.145251 | 0.223464 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032407 | 0.175573 | 262 | 15 | 38 | 17.466667 | 0.796296 | 0 | 0 | 0.181818 | 0 | 0 | 0.087786 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.090909 | 0.181818 | 0 | 0.181818 | 0.272727 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f248799014f1580f7a21128c8db272cedeae8f5f | 582 | py | Python | apps/models/crawler.py | jiangxuewen16/hq-crawler | f03ec1e454513307e335943f224f4d927eaf2bbf | [
"MIT"
] | 1 | 2021-02-25T08:33:40.000Z | 2021-02-25T08:33:40.000Z | apps/models/crawler.py | jiangxuewen16/hq-crawler | f03ec1e454513307e335943f224f4d927eaf2bbf | [
"MIT"
] | null | null | null | apps/models/crawler.py | jiangxuewen16/hq-crawler | f03ec1e454513307e335943f224f4d927eaf2bbf | [
"MIT"
] | 2 | 2021-03-08T07:25:16.000Z | 2021-12-07T15:28:02.000Z | import mongoengine
class ExceptionLog(mongoengine.Document):
event = mongoengine.IntField()
system_name = mongoengine.StringField()
platform = mongoengine.StringField()
level = mongoengine.IntField()
api_url = mongoengine.StringField()
trace = mongoengine.StringField()
file = mongoengine.StringField()
msg = mongoengine.StringField()
line = mongoengine.StringField()
request_id = mongoengine.StringField()
request_time = mongoengine.StringField()
request_param = mongoengine.StringField()
create_at = mongoengine.StringField()
| 32.333333 | 45 | 0.737113 | 51 | 582 | 8.294118 | 0.470588 | 0.572104 | 0.205674 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 582 | 17 | 46 | 34.235294 | 0.872165 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 1 | 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 | 1 | 0 | 0 | 3 |
f25069e1531ad75689c84401f0ed4f4a318e478b | 199 | py | Python | Lecture.09/3.dictionary.3.py | joonion/coding-for-problem-solving | 9f7a0b7e18803c58596899595dacc87a74b1b9d1 | [
"MIT"
] | null | null | null | Lecture.09/3.dictionary.3.py | joonion/coding-for-problem-solving | 9f7a0b7e18803c58596899595dacc87a74b1b9d1 | [
"MIT"
] | null | null | null | Lecture.09/3.dictionary.3.py | joonion/coding-for-problem-solving | 9f7a0b7e18803c58596899595dacc87a74b1b9d1 | [
"MIT"
] | null | null | null | table = {"깍두기":1, "민혀기":2, "서주니":3}
print(table.keys())
print(table.values())
for item in table.items():
key = item[0]
value = item[1]
print(key, ":", value)
table["깍두기"] = 4
print(table) | 22.111111 | 35 | 0.582915 | 32 | 199 | 3.625 | 0.5625 | 0.258621 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036585 | 0.175879 | 199 | 9 | 36 | 22.111111 | 0.670732 | 0 | 0 | 0 | 0 | 0 | 0.065 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.444444 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
f25918a2249ecad0b4dbbf89a52fe6cbc6af2d78 | 255 | py | Python | remove_max_number_of_edges_to_keep_graph_fully_traversable.py | spencercjh/sync-leetcode-today-problem-python3-example | 4957e5eadb697334741df0fc297bec2edaa9e2ab | [
"Apache-2.0"
] | null | null | null | remove_max_number_of_edges_to_keep_graph_fully_traversable.py | spencercjh/sync-leetcode-today-problem-python3-example | 4957e5eadb697334741df0fc297bec2edaa9e2ab | [
"Apache-2.0"
] | null | null | null | remove_max_number_of_edges_to_keep_graph_fully_traversable.py | spencercjh/sync-leetcode-today-problem-python3-example | 4957e5eadb697334741df0fc297bec2edaa9e2ab | [
"Apache-2.0"
] | null | null | null |
class RemoveMaxNumberOfEdgesToKeepGraphFullyTraversable:
"""
https://leetcode-cn.com/problems/remove-max-number-of-edges-to-keep-graph-fully-traversable/
"""
def maxNumEdgesToRemove(self, n: int, edges: List[List[int]]) -> int:
| 28.333333 | 96 | 0.698039 | 27 | 255 | 6.592593 | 0.851852 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156863 | 255 | 8 | 97 | 31.875 | 0.827907 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f25fd453804d9342d201ed96d1a0aa2a58bbdbb9 | 586 | py | Python | robonaldo/commands/stop.py | xtrm-en/robonaldo | 91601bad88043effbb717e40467526fe11bd4cb5 | [
"0BSD"
] | null | null | null | robonaldo/commands/stop.py | xtrm-en/robonaldo | 91601bad88043effbb717e40467526fe11bd4cb5 | [
"0BSD"
] | null | null | null | robonaldo/commands/stop.py | xtrm-en/robonaldo | 91601bad88043effbb717e40467526fe11bd4cb5 | [
"0BSD"
] | null | null | null | from robonaldo.command import Command, CommandContext
from robonaldo.command import CommandManager
from robonaldo.controller import GameController
from robonaldo.core import Robonaldo
import sys
from typing import List
class Stop(Command):
def execute(self, ctx: CommandContext) -> bool:
Robonaldo().stop()
return (True, "")
def description(self) -> str:
return "Stops the current game"
def usages(self) -> List[str]:
return ["%NAME%"]
def aliases(self) -> List[str]:
return ["end"]
CommandManager().register(Stop(), "stop") | 25.478261 | 53 | 0.6843 | 67 | 586 | 5.985075 | 0.477612 | 0.129676 | 0.099751 | 0.129676 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.203072 | 586 | 23 | 54 | 25.478261 | 0.858672 | 0 | 0 | 0 | 0 | 0 | 0.059625 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.352941 | 0.176471 | 0.882353 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 3 |
f2625742cd02841d9982a75bdb21510947eae9f2 | 32 | py | Python | python/testData/inspections/PyTypeCheckerInspection/FieldWithNoneInStub/m1.py | truthiswill/intellij-community | fff88cfb0dc168eea18ecb745d3e5b93f57b0b95 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/inspections/PyTypeCheckerInspection/FieldWithNoneInStub/m1.py | truthiswill/intellij-community | fff88cfb0dc168eea18ecb745d3e5b93f57b0b95 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/inspections/PyTypeCheckerInspection/FieldWithNoneInStub/m1.py | truthiswill/intellij-community | fff88cfb0dc168eea18ecb745d3e5b93f57b0b95 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | class C(object):
foo = None
| 10.666667 | 16 | 0.59375 | 5 | 32 | 3.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.28125 | 32 | 2 | 17 | 16 | 0.826087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f27fa3f09458d2eb1cc80182721989f249077d95 | 1,150 | py | Python | students/K33422/laboratory_works/Kirillov_Nikolay/laboratory_work_4/hotel_app/serializers.py | NikolayKirillov/ITMO_ICT_WebDevelopment_2020-2021 | 77ea82c38eb25c8fd61815b92e4cb006708a6de7 | [
"MIT"
] | null | null | null | students/K33422/laboratory_works/Kirillov_Nikolay/laboratory_work_4/hotel_app/serializers.py | NikolayKirillov/ITMO_ICT_WebDevelopment_2020-2021 | 77ea82c38eb25c8fd61815b92e4cb006708a6de7 | [
"MIT"
] | null | null | null | students/K33422/laboratory_works/Kirillov_Nikolay/laboratory_work_4/hotel_app/serializers.py | NikolayKirillov/ITMO_ICT_WebDevelopment_2020-2021 | 77ea82c38eb25c8fd61815b92e4cb006708a6de7 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from django.contrib.auth.hashers import make_password
from .models import *
class RoomSerializer(serializers.ModelSerializer):
class Meta:
model = Room
fields = "__all__"
class StaffSerializer(serializers.ModelSerializer):
class Meta:
model = Staff
fields = "__all__"
class GuestSerializer(serializers.ModelSerializer):
class Meta:
model = Guest
fields = "__all__"
class CleaningSerializer(serializers.ModelSerializer):
class Meta:
model = Cleaning
fields = "__all__"
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = "__all__"
def create(self, validated_data):
user = User.objects.create(
email=validated_data['email'],
username=validated_data['username'],
password=make_password(validated_data['password']),
first_name=validated_data['first_name'],
last_name=validated_data['last_name']
)
user.set_password(validated_data['password'])
user.save()
return user
| 25 | 63 | 0.658261 | 111 | 1,150 | 6.504505 | 0.378378 | 0.126039 | 0.214681 | 0.242382 | 0.277008 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.254783 | 1,150 | 45 | 64 | 25.555556 | 0.842474 | 0 | 0 | 0.294118 | 0 | 0 | 0.072174 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.029412 | false | 0.088235 | 0.088235 | 0 | 0.441176 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f29c020d68fa9c1f720fae29e11974624aa88cb1 | 727 | py | Python | core/admin.py | thiagofreitascarneiro/Projeto_Fusion | 4bf9d1c69ddf83fbc957e9ccdc41112d71bbffa9 | [
"MIT"
] | null | null | null | core/admin.py | thiagofreitascarneiro/Projeto_Fusion | 4bf9d1c69ddf83fbc957e9ccdc41112d71bbffa9 | [
"MIT"
] | null | null | null | core/admin.py | thiagofreitascarneiro/Projeto_Fusion | 4bf9d1c69ddf83fbc957e9ccdc41112d71bbffa9 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Cargo, Servico, Funcionario, Feature, Preco
@admin.register(Cargo)
class CargoAdmin(admin.ModelAdmin):
list_display = ('cargo', 'ativo', 'modificado')
@admin.register(Servico)
class ServicoAdmin(admin.ModelAdmin):
list_display = ('servico', 'icone', 'ativo', 'modificado')
@admin.register(Funcionario)
class FuncionarioAdmin(admin.ModelAdmin):
list_display = ('nome', 'cargo', 'ativo', 'modificado')
@admin.register(Feature)
class FeatureAdmin(admin.ModelAdmin):
list_display = ('feature', 'icone', 'ativo', 'modificado')
@admin.register(Preco)
class Precoadmin(admin.ModelAdmin):
list_display = ('preco', 'categoria', 'descricao', 'icone')
| 23.451613 | 63 | 0.722146 | 77 | 727 | 6.753247 | 0.350649 | 0.125 | 0.182692 | 0.25 | 0.253846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122421 | 727 | 30 | 64 | 24.233333 | 0.815047 | 0 | 0 | 0 | 0 | 0 | 0.173793 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.117647 | 0 | 0.705882 | 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 | 1 | 0 | 0 | 3 |
f2a5e1bd4ee43f360092ed7ac978137e5c8ab12f | 3,577 | py | Python | registration/migrations/0002_attendee.py | OpenGeoLabs/gismentors-registration | caea938691fa8ec4331d1aa81bb820ac42734eea | [
"MIT"
] | 1 | 2018-05-19T22:47:36.000Z | 2018-05-19T22:47:36.000Z | registration/migrations/0002_attendee.py | OpenGeoLabs/gismentors-registration | caea938691fa8ec4331d1aa81bb820ac42734eea | [
"MIT"
] | 33 | 2018-09-05T12:54:04.000Z | 2020-10-12T07:31:50.000Z | registration/migrations/0002_attendee.py | OpenGeoLabs/gismentors-registration | caea938691fa8ec4331d1aa81bb820ac42734eea | [
"MIT"
] | null | null | null | # Generated by Django 2.0.5 on 2018-09-16 09:19
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('registration', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='attendee',
name='token',
field=models.CharField(default=uuid.UUID('1c771aa3-55da-4a7f-bef3-1b1dea0885e7'), max_length=255, verbose_name='Token'),
),
migrations.AlterField(
model_name='attendee',
name='gdpr',
field=models.BooleanField(help_text='<p>\n Souhlasím se zpracováním poskytnutých osobních údajů a\n zařazením do databáze uživatelů společnosti <a\n href="http://opengeolabs.cz" target="_blank">OpenGeoLabs s.r.o.</a> se\n sídlem Brandlova 1559/7, Praha 11, 149 00 (dále jen OpenGeoLabs\n s.r.o.) pro vlastní použití v souladu s příslušnými ustanoveními zákona\n č. 101/2000 Sb., o ochraně osobních údajů a o změně některých údajů v\n platném znění. Beru na vědomí, že údaje budou využívány pouze v rámci\n společnosti OpenGeoLabs s.r.o.</p>\n <p>Jsem si vědom/a toho, že souhlas s\n jejich zpracováním mohu kdykoliv odvolat zasláním e-mailu na adresu\n <abbr title="nahraďte správnou formou e-mailu">info [zavináč] opengeolabs [tečka] cz</abbr>.\n Souhlas bude automaticky prodloužen vždy o další roční období, pokud nedojde k jeho odvolání\n písemnou formou. Jsem si vědom/a svých práv, které subjektům poskytuje\n zákon č. 101/2000 Sb., o ochraně osobních údajů. Vaše data budou použita\n pro potřeby organizace kurzů GISMentors.</p>', verbose_name='Ochrana osobních údajů'),
),
migrations.AlterField(
model_name='attendee',
name='marketing',
field=models.BooleanField(help_text='<p>Souhlasím s tím, že společnost <a\n href="http://opengeolabs.cz" target="_blank">OpenGeoLabs s.r.o.</a> může využít můj\n e-mail pro zasílání krátkých marketingových zpráv (ne častěji než jednou za\n měsíc) obsahujících nabídky a slevy kurzů a informace o aktuálním dění ve\n společnosti.</p>\n <p>Jsem si vědom/a toho, že souhlas s použitím mého e-mailu pro\n marketingové účely mohu kdykoliv odvolat zasláním e-mailu na adresu\n <abbr title="nahraďte správnou formou e-mailu">info [zavináč] opengeolabs [tečka] cz</abbr>. Souhlas bude\n automaticky prodloužen vždy o další roční období, pokud nedojde k jeho\n odvolání písemnou formou.</p>\n ', verbose_name='Marketingová sdělení'),
),
migrations.AlterField(
model_name='courseattendee',
name='note',
field=models.TextField(blank=True, verbose_name='Poznámka'),
),
migrations.AlterField(
model_name='courseattendee',
name='token',
field=models.CharField(default=uuid.UUID('411cecbc-f292-4be9-aced-0d90f6434957'), max_length=255, verbose_name='Token'),
),
migrations.AlterField(
model_name='attendee',
name='token',
field=models.CharField(max_length=255, verbose_name='Token'),
),
migrations.AlterField(
model_name='courseattendee',
name='token',
field=models.CharField(max_length=255, verbose_name='Token'),
),
]
| 68.788462 | 1,262 | 0.630976 | 440 | 3,577 | 5.077273 | 0.438636 | 0.032229 | 0.067144 | 0.077887 | 0.515219 | 0.515219 | 0.44718 | 0.44718 | 0.385407 | 0.385407 | 0 | 0.035209 | 0.2695 | 3,577 | 51 | 1,263 | 70.137255 | 0.819747 | 0.01258 | 0 | 0.604651 | 1 | 0.046512 | 0.624646 | 0.035694 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.046512 | 0 | 0.116279 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f2c8a2c7b178b64761d3f6664f933fb977259788 | 382 | py | Python | src/digolds/manipulate/drop_empty_row.py | digolds/dp | 305089cbd2e933a0fff4d044485d591b6a2f3349 | [
"MIT"
] | null | null | null | src/digolds/manipulate/drop_empty_row.py | digolds/dp | 305089cbd2e933a0fff4d044485d591b6a2f3349 | [
"MIT"
] | null | null | null | src/digolds/manipulate/drop_empty_row.py | digolds/dp | 305089cbd2e933a0fff4d044485d591b6a2f3349 | [
"MIT"
] | null | null | null | import pandas as pd
def _parse(args):
return []
def _drop_empty_row(df):
return df.dropna(how='all')
name = 'drop-empty-row'
def operator(df, args):
return _drop_empty_row(df, *_parse(args))
if __name__ == "__main__":
data = [['tom', 10], ['nick', 15], [None, None]]
df = pd.DataFrame(data, columns = ['Name', 'Age'])
args = {}
operator(df, args) | 21.222222 | 55 | 0.604712 | 54 | 382 | 3.981481 | 0.518519 | 0.125581 | 0.167442 | 0.130233 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013245 | 0.209424 | 382 | 18 | 56 | 21.222222 | 0.698676 | 0 | 0 | 0 | 0 | 0 | 0.101828 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.076923 | 0.230769 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
4b2c437bc56b4579b4dd14464d44a745a5d108f6 | 1,308 | py | Python | common/smartdashboard_update_trigger.py | CtrlZ-FRC4096/Robot-2016-Public | f23a73758da74eb458543b3fea86c654598d9eec | [
"MIT"
] | null | null | null | common/smartdashboard_update_trigger.py | CtrlZ-FRC4096/Robot-2016-Public | f23a73758da74eb458543b3fea86c654598d9eec | [
"MIT"
] | null | null | null | common/smartdashboard_update_trigger.py | CtrlZ-FRC4096/Robot-2016-Public | f23a73758da74eb458543b3fea86c654598d9eec | [
"MIT"
] | null | null | null | """
Ctrl-Z FRC Team 4096
FIRST Robotics Competition 2016, "Stronghold"
Code for robot "Jaw-Z"
contact@team4096.org
"""
from wpilib.buttons import Trigger
from networktables import NetworkTable
class SmartDashboard_Update_Trigger( Trigger ):
'''
Trigger used to check when entries are updated
in the SmartDashboard. Courtesy of Team 2423
'''
def __init__( self, table_key, default_value ):
'''
Creates a new trigger for entries when updated.
:param table_key: The name of the entry in the
SmartDashboard NetworkTable
:param default_value: The value the entry will
take if it doesn't already exist in the
SmartDashboard
'''
self.table_key = table_key
self.sd = NetworkTable.getTable( 'SmartDashboard' )
self.auto_update_value = self.sd.getAutoUpdateValue( table_key, default_value )
self.last_value = self.auto_update_value.get( )
def get( self ):
updated = self.auto_update_value.get( ) != self.last_value
self.last_value = self.auto_update_value.get( )
return updated
def get_table_key( self ):
return self.table_key
def get_key_value( self ):
return self.auto_update_value.get( ) | 29.066667 | 87 | 0.652141 | 163 | 1,308 | 5.03681 | 0.411043 | 0.06821 | 0.085262 | 0.115713 | 0.151035 | 0.097442 | 0.097442 | 0.097442 | 0.097442 | 0 | 0 | 0.016913 | 0.276758 | 1,308 | 45 | 88 | 29.066667 | 0.850951 | 0.327982 | 0 | 0.125 | 0 | 0 | 0.017903 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
4b2fe072dc6e14fa0ddf1302d9d50ca334158afa | 286 | py | Python | association-backend/src/api/query.py | pauloxnet/pycon | 82b6eff76dcc785865ea3ffd97a45e931c0add26 | [
"MIT"
] | 56 | 2018-01-20T17:18:40.000Z | 2022-03-28T22:42:04.000Z | association-backend/src/api/query.py | pauloxnet/pycon | 82b6eff76dcc785865ea3ffd97a45e931c0add26 | [
"MIT"
] | 2,029 | 2018-01-20T11:37:24.000Z | 2022-03-31T04:10:51.000Z | association-backend/src/api/query.py | pauloxnet/pycon | 82b6eff76dcc785865ea3ffd97a45e931c0add26 | [
"MIT"
] | 17 | 2018-03-17T09:44:28.000Z | 2021-12-27T19:57:35.000Z | from typing import Any
import strawberry
from strawberry.types import Info
from src.api.context import Context
@strawberry.federation.type(extend=True)
class Query:
@strawberry.field
async def association_service(self, info: Info[Context, Any]) -> bool:
return True
| 20.428571 | 74 | 0.755245 | 38 | 286 | 5.657895 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167832 | 286 | 13 | 75 | 22 | 0.903361 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.444444 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
4b6d65db9677cacf83ebf573f4486fc50ee154fb | 6,340 | py | Python | samples/user management example.py | PTCInc/Kepware-ConfigAPI-SDK-Python | ff7757492a7ea1e73f3d5862ba956c8af4dcc797 | [
"MIT"
] | 9 | 2020-04-08T18:48:03.000Z | 2022-03-18T15:05:01.000Z | samples/user management example.py | PTCInc/Kepware-ConfigAPI-SDK-Python | ff7757492a7ea1e73f3d5862ba956c8af4dcc797 | [
"MIT"
] | 5 | 2020-08-24T15:08:54.000Z | 2022-03-16T17:07:09.000Z | samples/user management example.py | PTCInc/Kepware-ConfigAPI-SDK-Python | ff7757492a7ea1e73f3d5862ba956c8af4dcc797 | [
"MIT"
] | 10 | 2020-03-23T20:40:17.000Z | 2021-11-14T08:42:56.000Z | # -------------------------------------------------------------------------
# Copyright (c) PTC Inc. and/or all its affiliates. All rights reserved.
# See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# User Management Example - Simple example on how to manage a connection and
# execute various calls for configuring the user and user group properties of the Kepware
# Configuration API
from kepconfig import connection, error
from kepconfig.admin import user_groups, users
# User Groups
group1 = {
'common.ALLTYPES_NAME': 'Operators',
"libadminsettings.USERMANAGER_GROUP_ENABLED": True,
"libadminsettings.USERMANAGER_IO_TAG_READ": True,
"libadminsettings.USERMANAGER_IO_TAG_WRITE": True,
"libadminsettings.USERMANAGER_IO_TAG_DYNAMIC_ADDRESSING": True,
"libadminsettings.USERMANAGER_SYSTEM_TAG_READ": True,
"libadminsettings.USERMANAGER_SYSTEM_TAG_WRITE": True,
"libadminsettings.USERMANAGER_INTERNAL_TAG_READ": True,
"libadminsettings.USERMANAGER_INTERNAL_TAG_WRITE": True,
"libadminsettings.USERMANAGER_SERVER_MANAGE_LICENSES": True,
"libadminsettings.USERMANAGER_SERVER_RESET_OPC_DIAGS_LOG": True,
"libadminsettings.USERMANAGER_SERVER_RESET_COMM_DIAGS_LOG": True,
"libadminsettings.USERMANAGER_SERVER_MODIFY_SERVER_SETTINGS": True,
"libadminsettings.USERMANAGER_SERVER_DISCONNECT_CLIENTS": True,
"libadminsettings.USERMANAGER_SERVER_RESET_EVENT_LOG": True,
"libadminsettings.USERMANAGER_SERVER_OPCUA_DOTNET_CONFIGURATION": True,
"libadminsettings.USERMANAGER_SERVER_CONFIG_API_LOG_ACCESS": True,
"libadminsettings.USERMANAGER_SERVER_REPLACE_RUNTIME_PROJECT": True,
"libadminsettings.USERMANAGER_BROWSE_BROWSENAMESPACE": True
}
group2 = {
'common.ALLTYPES_NAME': 'UA Users',
"libadminsettings.USERMANAGER_GROUP_ENABLED": True,
"libadminsettings.USERMANAGER_IO_TAG_READ": True,
"libadminsettings.USERMANAGER_IO_TAG_WRITE": True,
"libadminsettings.USERMANAGER_IO_TAG_DYNAMIC_ADDRESSING": True,
"libadminsettings.USERMANAGER_SYSTEM_TAG_READ": True,
"libadminsettings.USERMANAGER_SYSTEM_TAG_WRITE": True,
"libadminsettings.USERMANAGER_INTERNAL_TAG_READ": True,
"libadminsettings.USERMANAGER_INTERNAL_TAG_WRITE": True,
"libadminsettings.USERMANAGER_SERVER_MANAGE_LICENSES": False,
"libadminsettings.USERMANAGER_SERVER_RESET_OPC_DIAGS_LOG": False,
"libadminsettings.USERMANAGER_SERVER_RESET_COMM_DIAGS_LOG": False,
"libadminsettings.USERMANAGER_SERVER_MODIFY_SERVER_SETTINGS": True,
"libadminsettings.USERMANAGER_SERVER_DISCONNECT_CLIENTS": False,
"libadminsettings.USERMANAGER_SERVER_RESET_EVENT_LOG": False,
"libadminsettings.USERMANAGER_SERVER_OPCUA_DOTNET_CONFIGURATION": False,
"libadminsettings.USERMANAGER_SERVER_CONFIG_API_LOG_ACCESS": False,
"libadminsettings.USERMANAGER_SERVER_REPLACE_RUNTIME_PROJECT": False,
"libadminsettings.USERMANAGER_BROWSE_BROWSENAMESPACE": True
}
# Users
user1 = {
"common.ALLTYPES_NAME": "Client1",
"libadminsettings.USERMANAGER_USER_GROUPNAME": "Operators",
"libadminsettings.USERMANAGER_USER_ENABLED": True,
"libadminsettings.USERMANAGER_USER_PASSWORD": "Password123456"
}
user2 = {
"common.ALLTYPES_NAME": "Client2",
"libadminsettings.USERMANAGER_USER_GROUPNAME": "UA Users",
"libadminsettings.USERMANAGER_USER_ENABLED": True,
"libadminsettings.USERMANAGER_USER_PASSWORD": "Password123456"
}
def ErrorHandler(err):
# Generic Handler for exception errors
if err.__class__ is error.KepError:
print(err.msg)
elif err.__class__ is error.KepHTTPError:
print(err.code)
print(err.msg)
print(err.url)
print(err.hdrs)
print(err.payload)
elif err.__class__ is error.KepURLError:
print(err.url)
print(err.reason)
else:
print('Different Exception Received: {}'.format(err))
# This creates a server reference that is used to target all modifications of
# the Kepware configuration
server = connection.server(host = '127.0.0.1', port = 57412, user = 'Administrator', pw = '')
# ---------------------------------------------
# User Group Methods
# ---------------------------------------------
# Add the User Groups with the appropriate parameters
try:
print("{} - {}".format("Add new User Groups", user_groups.add_user_group(server, [group1, group2])))
except Exception as err:
ErrorHandler(err)
# Modify permissions on a User Group
# Ex: Prevent Write access for user group
modify_group = {
"libadminsettings.USERMANAGER_IO_TAG_WRITE": False,
"libadminsettings.USERMANAGER_SYSTEM_TAG_WRITE": False,
"libadminsettings.USERMANAGER_INTERNAL_TAG_WRITE": False
}
try:
print("{} - {}".format("Modify User Group properties to prevent 'Writes'",user_groups.modify_user_group(server, modify_group, group1['common.ALLTYPES_NAME'])))
except Exception as err:
ErrorHandler(err)
# Disable and Enable a user groups
try:
print("{} - {}".format("Disable User Group",user_groups.disable_user_group(server, group1['common.ALLTYPES_NAME'])))
except Exception as err:
ErrorHandler(err)
try:
print("{} - {}".format("Enable User Group",user_groups.enable_user_group(server, group1['common.ALLTYPES_NAME'])))
except Exception as err:
ErrorHandler(err)
# ---------------------------------------------
# User Methods
# ---------------------------------------------
# Add new users with the appropriate parameters
try:
print("{} - {}".format("Add new Users", users.add_user(server, [user1, user2])))
except Exception as err:
ErrorHandler(err)
# Modify new user parameters - New Password
modify_pass = {
"libadminsettings.USERMANAGER_USER_PASSWORD": "NewPassword123"
}
try:
print("{} - {}".format("Updated a user password", users.modify_user(server,modify_pass, user1['common.ALLTYPES_NAME'])))
except Exception as err:
ErrorHandler(err)
# Disable and Enable a user
try:
print("{} - {}".format("Disable a user", users.disable_user(server, user1['common.ALLTYPES_NAME'])))
except Exception as err:
ErrorHandler(err)
try:
print("{} - {}".format("Enable a user", users.enable_user(server, user1['common.ALLTYPES_NAME'])))
except Exception as err:
ErrorHandler(err) | 40.903226 | 163 | 0.720505 | 688 | 6,340 | 6.360465 | 0.22093 | 0.283821 | 0.198355 | 0.093007 | 0.650594 | 0.573355 | 0.497486 | 0.410192 | 0.410192 | 0.388254 | 0 | 0.007628 | 0.131546 | 6,340 | 155 | 164 | 40.903226 | 0.787141 | 0.175079 | 0 | 0.468468 | 0 | 0 | 0.541507 | 0.432936 | 0 | 0 | 0 | 0 | 0 | 1 | 0.009009 | false | 0.045045 | 0.018018 | 0 | 0.027027 | 0.153153 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4ba56feac67304561767135cb1974964fe52c746 | 144 | py | Python | arvinddhindsa/blog/apps.py | Dhindsa91/Django-blog | 072dfecdc13839370aca9fc5a062eb8f9eea17b5 | [
"bzip2-1.0.6"
] | null | null | null | arvinddhindsa/blog/apps.py | Dhindsa91/Django-blog | 072dfecdc13839370aca9fc5a062eb8f9eea17b5 | [
"bzip2-1.0.6"
] | null | null | null | arvinddhindsa/blog/apps.py | Dhindsa91/Django-blog | 072dfecdc13839370aca9fc5a062eb8f9eea17b5 | [
"bzip2-1.0.6"
] | null | null | null | from django.apps import AppConfig
#These files added to main settings.py under Installed Apps
class BlogConfig(AppConfig):
name = 'blog'
| 18 | 59 | 0.763889 | 20 | 144 | 5.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173611 | 144 | 7 | 60 | 20.571429 | 0.92437 | 0.402778 | 0 | 0 | 0 | 0 | 0.047059 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
4bac93f7a17520e1bd2be44bff9d51ab0e8f3619 | 25,725 | py | Python | naa_Isotopic_Abundance.py | AustinShih/radwatch-analysis | 748f23bb09a5aae87e848a3b212244b15bdda600 | [
"MIT"
] | 6 | 2016-08-03T02:21:09.000Z | 2020-01-30T18:47:51.000Z | naa_Isotopic_Abundance.py | AustinShih/radwatch-analysis | 748f23bb09a5aae87e848a3b212244b15bdda600 | [
"MIT"
] | 47 | 2016-07-29T23:42:51.000Z | 2017-08-04T16:41:01.000Z | naa_Isotopic_Abundance.py | AustinShih/radwatch-analysis | 748f23bb09a5aae87e848a3b212244b15bdda600 | [
"MIT"
] | 10 | 2016-08-03T04:48:25.000Z | 2021-11-16T08:24:39.000Z | """Isotopic Abundances for each isotope"""
class Natural_Isotope(object):
def __init__(self, symbol, mass_number, mass, isotopic_abundance,
cross_section):
self.symbol = symbol
self.mass_number = mass_number
self.mass = mass
self.isotopic_abundance = .01 * isotopic_abundance
self.cross_section = cross_section
Hydrogen_1 = Natural_Isotope("H", 1, 1.007825, 99.9885, 0.332015)
Hydrogen_2 = Natural_Isotope("H", 2, 2.014102, 0.0115, 0.000505706)
Helium_3 = Natural_Isotope("HE", 3, 3.016029, 0.000137, 5.49873e-05)
Helium_4 = Natural_Isotope("HE", 4, 4.002603, 99.999893, 0)
Lithium_6 = Natural_Isotope("LI", 6, 6.015122, 7.59, 0.0385003)
Lithium_7 = Natural_Isotope("LI", 7, 7.016004, 92.41, 0.045402)
Beryllium_9 = Natural_Isotope("BE", 9, 9.012182, 100, 0.0100308)
Boron_10 = Natural_Isotope("B", 10, 10.012937, 19.9, 0.499871)
Boron_11 = Natural_Isotope("B", 11, 11.009305, 80.1, 0.00550004)
Carbon_12 = Natural_Isotope("C", 12, 12, 98.93, 0.0035)
Carbon_13 = Natural_Isotope("C", 13, 13.003355, 1.07, 0.0014)
Nitrogen_14 = Natural_Isotope("N", 14, 14.003074, 99.632, 0.0749913)
Nitrogen_15 = Natural_Isotope("N", 15, 15.000109, 0.368, 2.40099e-05)
Oxygen_16 = Natural_Isotope("O", 16, 15.994915, 99.757, 0.000189986)
Oxygen_17 = Natural_Isotope("O", 17, 16.999132, 0.038, 0.00382862)
Oxygen_18 = Natural_Isotope("O", 18, 17.9916, 0.205, 0.00016)
Fluorine_19 = Natural_Isotope("F", 19, 18.998403, 100, 0.00957834)
Neon_20 = Natural_Isotope("NE", 20, 19.99244, 90.48, 0.040)
Neon_21 = Natural_Isotope("NE", 21, 20.993847, 0.27, 0.7)
Neon_22 = Natural_Isotope("NE", 22, 21.991386, 9.25, 0.05)
Sodium_23 = Natural_Isotope("NA", 23, 22.98977, 100, 0.528001)
Magnesium_24 = Natural_Isotope("MG", 24, 23.985042, 78.99, 0.0502894)
Magnesium_25 = Natural_Isotope("MG", 25, 24.985837, 10, 0.190374)
Magnesium_26 = Natural_Isotope("Mg", 26, 25.982593, 11.01, 0.03831)
Aluminum_27 = Natural_Isotope("AL", 27, 26.981538, 100, 0.233463)
Silicon_28 = Natural_Isotope("SI", 28, 27.976927, 92.2297, 0.169141)
Silicon_29 = Natural_Isotope("SI", 29, 28.976495, 4.6832, 0.119961)
Silicon_30 = Natural_Isotope("SI", 30, 29.97377, 3.0872, 0.107085)
Phosphorus_31 = Natural_Isotope("P", 31, 30.973762, 100, 0.169361)
Sulfur_32 = Natural_Isotope("S", 32, 31.972071, 94.93, 0.528215)
Sulfur_33 = Natural_Isotope("S", 33, 32.971458, 0.76, 0.350075)
Sulfur_34 = Natural_Isotope("S", 34, 33.967867, 4.29, 0.223618)
Sulfur_36 = Natural_Isotope("S", 36, 35.967081, 0.02, 0.150482)
Chlorine_35 = Natural_Isotope("CL", 35, 34.968853, 75.78, 43.6122)
Chlorine_37 = Natural_Isotope("CL", 37, 36.965903, 24.22, 0.43311)
Argon_36 = Natural_Isotope("AR", 36, 35.967546, 0.3365, 5.04467)
Argon_38 = Natural_Isotope("AR", 38, 37.962732, 0.0632, 0.80184)
Argon_40 = Natural_Isotope("AR", 40, 39.962383, 99.6003, 0.660152)
Potassium_39 = Natural_Isotope("K", 39, 38.963707, 93.2581, 2.12742)
Potassium_40 = Natural_Isotope("K", 40, 39.963999, 0.0117, 30.0098)
Potassium_41 = Natural_Isotope("K", 41, 40.961826, 6.7302, 1.46113)
Calcium_40 = Natural_Isotope("CA", 40, 39.962591, 96.941, 0.407588)
Calcium_42 = Natural_Isotope("CA", 42, 41.958618, 0.647, 0.683094)
Calcium_43 = Natural_Isotope("CA", 43, 42.958768, 0.135, 11.6649)
Calcium_44 = Natural_Isotope("CA", 44, 43.955481, 2.086, 0.888633)
Calcium_46 = Natural_Isotope("CA", 46, 45.953693, 0.004, 0.740179)
Calcium_48 = Natural_Isotope("CA", 48, 47.952534, 0.187, 1.09293)
Scandium_45 = Natural_Isotope("SC", 45, 44.96691, 100, 27.1628)
Titanium_46 = Natural_Isotope("TI", 46, 45.952629, 8.25, 0.589748)
Titanium_47 = Natural_Isotope("TI", 47, 46.951764, 7.44, 1.62638)
Titanium_48 = Natural_Isotope("TI", 48, 47.947947, 73.72, 8.31791)
Titanium_49 = Natural_Isotope("TI", 49, 48.947871, 5.41, 1.86282)
Titanium_50 = Natural_Isotope("TI", 50, 49.944792, 5.18, 0.179537)
Vanadium_50 = Natural_Isotope("V", 50, 49.947163, 0.25, 44.6849)
Vanadium_51 = Natural_Isotope("V", 51, 50.943964, 99.75, 4.91912)
Chromium_50 = Natural_Isotope("CR", 50, 49.94605, 4.345, 15.4049)
Chromium_52 = Natural_Isotope("CR", 52, 51.940512, 83.789, 0.856093)
Chromium_53 = Natural_Isotope("CR", 53, 52.940654, 9.501, 18.0927)
Chromium_54 = Natural_Isotope("CR", 54, 53.938885, 2.365, 0.411198)
Manganese_55 = Natural_Isotope("MN", 55, 54.93805, 100, 13.2784)
Iron_54 = Natural_Isotope("FE", 54, 53.939615, 5.845, 2.25193)
Iron_56 = Natural_Isotope("FE", 56, 55.934942, 91.754, 2.58936)
Iron_57 = Natural_Isotope("FE", 57, 56.935399, 2.119, 2.42654)
Iron_58 = Natural_Isotope("FE", 58, 57.93328, 0.282, 1.14965)
Cobalt_59 = Natural_Isotope("CO", 59, 58.9332, 100, 37.1837)
Nickel_58 = Natural_Isotope("NI", 58, 57.935348, 68.0769, 4.22661)
Nickel_60 = Natural_Isotope("NI", 60, 59.930791, 26.2231, 2.40101)
Nickel_61 = Natural_Isotope("NI", 61, 60.93106, 1.1399, 2.5094)
Nickel_62 = Natural_Isotope("NI", 62, 61.928349, 3.6345, 14.9058)
Nickel_64 = Natural_Isotope("NI", 64, 63.92797, 0.9256, 1.48038)
Copper_63 = Natural_Isotope("CU", 63, 62.929601, 69.17, 4.47031)
Copper_65 = Natural_Isotope("CU", 65, 64.927794, 30.93, 2.14927)
Zinc_64 = Natural_Isotope("ZN", 64, 63.929147, 48.63, 0.787472)
Zinc_66 = Natural_Isotope("ZN", 66, 65.926037, 27.9, 0.617964)
Zinc_67 = Natural_Isotope("ZN", 67, 66.927131, 4.1, 7.47184)
Zinc_68 = Natural_Isotope("ZN", 68, 67.924848, 18.75, 1.0655)
Zinc_70 = Natural_Isotope("ZN", 70, 69.925325, 0.62, 0.0917385)
Gallium_69 = Natural_Isotope("GA", 69, 68.925581, 60.108, 1.73069)
Gallium_71 = Natural_Isotope("GA", 71, 70.924705, 39.892, 4.73143)
Germanium_70 = Natural_Isotope("GE", 70, 69.92425, 20.84, 3.05256)
Germanium_72 = Natural_Isotope("GE", 72, 71.922076, 27.45, 0.885938)
Germanium_73 = Natural_Isotope("GE", 73, 72.923459, 7.73, 14.705)
Germanium_74 = Natural_Isotope("GE", 74, 73.921178, 36.28, 0.519036)
Germanium_76 = Natural_Isotope("GE", 76, 75.921403, 7.61, 0.154659)
Arsenic_75 = Natural_Isotope("AS", 75, 74.921596, 100, 4.50161)
Selenium_74 = Natural_Isotope("SE", 74, 73.922477, 0.89, 51.8151)
Selenium_76 = Natural_Isotope("SE", 76, 75.919214, 9.37, 85.0218)
Selenium_77 = Natural_Isotope("SE", 77, 76.919915, 7.63, 42.0096)
Selenium_78 = Natural_Isotope("SE", 78, 77.91731, 23.77, 0.430126)
Selenium_80 = Natural_Isotope("SE", 80, 79.91652, 49.61, 0.610202)
Selenium_82 = Natural_Isotope("SE", 81, 81.9167, 8.73, 0.0444242)
Bromine_79 = Natural_Isotope("BR", 79, 78.918338, 50.69, 11.0042)
Bromine_81 = Natural_Isotope("BR", 81, 80.916291, 49.31, 2.3651)
Krypton_78 = Natural_Isotope("KR", 78, 77.920386, 0.35, 6.35568)
Krypton_80 = Natural_Isotope("KR", 80, 79.916378, 2.28, 11.5046)
Krypton_82 = Natural_Isotope("KR", 82, 81.913485, 11.58, 19.1672)
Krypton_83 = Natural_Isotope("KR", 83, 82.914136, 11.49, 198.19)
Krypton_84 = Natural_Isotope("KR", 84, 83.911507, 57, 0.110022)
Krypton_86 = Natural_Isotope("KR", 86, 85.91061, 17.3, 0.000878224)
Rubidium_85 = Natural_Isotope("RB", 85, 84.911789, 72.17, 0.493607)
Rubidium_87 = Natural_Isotope("RB", 86, 86.909183, 27.83, 0.120037)
Strontium_84 = Natural_Isotope("SR", 84, 83.913425, 0.56, 0.82219)
Strontium_86 = Natural_Isotope("SR", 86, 85.909262, 9.86, 1.00556)
Strontium_87 = Natural_Isotope("SR", 87, 86.908879, 7, 16.0085)
Strontium_88 = Natural_Isotope("SR", 88, 87.905848, 82.58, 0.00868793)
Yttrium_89 = Natural_Isotope("Y", 89, 88.905848, 100, 1.2787)
Zirconium_90 = Natural_Isotope("ZR", 90, 89.904704, 51.45, 0.00997575)
Zirconium_91 = Natural_Isotope("ZR", 91, 90.905645, 11.22, 1.21603)
Zirconium_92 = Natural_Isotope("ZR", 92, 91.90504, 17.15, 0.229231)
Zirconium_94 = Natural_Isotope("ZR", 94, 93.906316, 17.38, 0.0498845)
Zirconium_96 = Natural_Isotope("ZR", 96, 95.908276, 2.8, 0.0228521)
Niobium_93 = Natural_Isotope("NB", 93, 92.906378, 100, 1.15554)
Molybdenum_92 = Natural_Isotope("MO", 92, 91.90681, 14.84, 0.0798857)
Molybdenum_94 = Natural_Isotope("MO", 94, 93.905088, 9.25, 0.340371)
Molybdenum_95 = Natural_Isotope("MO", 95, 94.905841, 15.92, 13.3957)
Molybdenum_96 = Natural_Isotope("MO", 96, 95.904679, 16.68, 0.595576)
Molybdenum_97 = Natural_Isotope("MO", 97, 96.906021, 9.55, 2.19677)
Molybdenum_98 = Natural_Isotope("MO", 98, 97.905408, 24.13, 0.130026)
Molybdenum_100 = Natural_Isotope("MO", 100, 99.907477, 9.63, 0.199087)
Ruthenium_96 = Natural_Isotope("RU", 96, 95.907598, 5.54, 0.290132)
Ruthenium_98 = Natural_Isotope("RU", 98, 97.905287, 1.87, 8.00361)
Ruthenium_99 = Natural_Isotope("RU", 99, 98.905939, 12.76, 7.31152)
Ruthenium_100 = Natural_Isotope("RU", 100, 99.90422, 12.6, 5.79179)
Ruthenium_101 = Natural_Isotope("RU", 101, 100.905582, 17.06, 5.22585)
Ruthenium_102 = Natural_Isotope("RU", 102, 1101.90435, 31.55, 1.27024)
Ruthenium_104 = Natural_Isotope("RU", 104, 103.90543, 18.62, 0.471636)
Rhodium_103 = Natural_Isotope("RH", 103, 102.905504, 100, 142.13)
Palladium_102 = Natural_Isotope("PD", 102, 101.905608, 1.02, 1.82175)
Palladium_104 = Natural_Isotope("PD", 104, 103.904035, 11.14, 0.648775)
Palladium_105 = Natural_Isotope("PD", 105, 104.905084, 22.33, 20.8813)
Palladium_106 = Natural_Isotope("PD", 106, 105.903483, 27.33, 0.30831)
Palladium_108 = Natural_Isotope("PD", 108, 107.903894, 26.46, 8.48118)
Palladium_110 = Natural_Isotope("PD", 110, 109.905152, 11.72, 0.229065)
Silver_107 = Natural_Isotope("AG", 107, 106.905093, 51.839, 37.6085)
Silver_109 = Natural_Isotope("AG", 109, 108.904756, 48.161, 90.2639)
Cadmium_106 = Natural_Isotope("CD", 106, 105.906458, 1.25, 0.985925)
Cadmium_108 = Natural_Isotope("CD", 108, 107.904183, 0.89, 0.905986)
Cadmium_110 = Natural_Isotope("CD", 110, 109.903006, 12.49, 11.0017)
Cadmium_111 = Natural_Isotope("CD", 111, 110.904182, 12.8, 6.8683)
Cadmium_112 = Natural_Isotope("CD", 112, 111.902757, 24.13, 2.19876)
Cadmium_113 = Natural_Isotope("CD", 113, 112.904401, 12.22, 19964.1)
Cadmium_114 = Natural_Isotope("CD", 114, 113.903358, 28.73, 0.305462)
Cadmium_116 = Natural_Isotope("CD", 116, 115.904755, 7.49, 0.0761819)
Indium_113 = Natural_Isotope("IN", 113, 112.904061, 4.29, 12.1347)
Indium_115 = Natural_Isotope("IN", 115, 114.903878, 95.71, 202.272)
Tin_112 = Natural_Isotope("SN", 112, 111.904821, 0.97, 0.850333)
Tin_114 = Natural_Isotope("SN", 114, 113.902782, 0.66, 0.12533)
Tin_115 = Natural_Isotope("SN", 115, 114.903346, 0.34, 58.0177)
Tin_116 = Natural_Isotope("SN", 116, 115.901744, 14.54, 0.127698)
Tin_117 = Natural_Isotope("SN", 117, 116.902954, 7.68, 1.07097)
Tin_118 = Natural_Isotope("SN", 118, 117.901606, 24.22, 0.219838)
Tin_119 = Natural_Isotope("SN", 119, 118.903309, 8.59, 2.17455)
Tin_120 = Natural_Isotope("SN", 120, 119.902197, 32.58, 0.139557)
Tin_122 = Natural_Isotope("SN", 122, 121.90344, 4.63, 0.146058)
Tin_124 = Natural_Isotope("SN", 124, 123.905275, 5.79, 0.133765)
Antimony_121 = Natural_Isotope("SB", 121, 120.903818, 57.21, 5.77312)
Antimony_123 = Natural_Isotope("SB", 123, 122.904216, 42.79, 3.87523)
Tellurium_120 = Natural_Isotope("TE", 120, 119.904020, 0.09, 2.34103)
Tellurium_122 = Natural_Isotope("TE", 122, 121.903047, 2.55, 3.27307)
Tellurium_123 = Natural_Isotope("TE", 123, 122.904273, 0.89, 418.347)
Tellurium_124 = Natural_Isotope("TE", 124, 123.902819, 4.74, 6.32463)
Tellurium_125 = Natural_Isotope("TE", 125, 124.904425, 7.07, 1.28696)
Tellurium_126 = Natural_Isotope("TE", 126, 125.903306, 18.84, 0.442305)
Tellurium_128 = Natural_Isotope("TE", 128, 127.904461, 31.74, 0.199993)
Tellurium_130 = Natural_Isotope("TE", 130, 129.906223, 34.08, 0.195241)
Iodine_127 = Natural_Isotope("I", 127, 126.904468, 100, 6.14643)
Xenon_124 = Natural_Isotope("XE", 124, 123.905896, 0.09, 150.2)
Xenon_126 = Natural_Isotope("XE", 126, 125.903530, 0.09, 3.4874)
Xenon_128 = Natural_Isotope("XE", 128, 127.903530, 1.92, 5.19249)
Xenon_129 = Natural_Isotope("XE", 129, 128.904779, 26.44, 21.0066)
Xenon_130 = Natural_Isotope("XE", 130, 129.903508, 4.08, 4.77859)
Xenon_131 = Natural_Isotope("XE", 131, 130.905082, 21.18, 90.0327)
Xenon_132 = Natural_Isotope("XE", 132, 131.904154, 26.89, 0.450652)
Xenon_134 = Natural_Isotope("XE", 134, 133.905395, 10.44, 0.26489)
Xenon_136 = Natural_Isotope("XE", 136, 135.907220, 8.87, 0.260738)
Cesium_133 = Natural_Isotope("CS", 133, 132.905447, 100, 29.0552)
Barium_130 = Natural_Isotope("BA", 130, 129.906310, 0.106, 8.68002)
Barium_132 = Natural_Isotope("BA", 132, 131.905056, 0.101, 6.53133)
Barium_134 = Natural_Isotope("BA", 134, 133.904503, 2.417, 1.50433)
Barium_135 = Natural_Isotope("BA", 135, 134.905683, 6.592, 5.87216)
Barium_136 = Natural_Isotope("BA", 136, 135.904570, 7.854, 0.679633)
Barium_137 = Natural_Isotope("BA", 137, 136.905821, 11.232, 3.59734)
Barium_138 = Natural_Isotope("BA", 138, 137.905241, 71.698, 0.403537)
Lanthanum_138 = Natural_Isotope("LA", 138, 137.907107, 0.09, 57.1047)
Lanthanum_139 = Natural_Isotope("LA", 139, 138.907107, 99.91, 9.0416)
Cerium_136 = Natural_Isotope("CE", 136, 135.907144, 0.185, 7.45753)
Cerium_138 = Natural_Isotope("CE", 138, 137.905986, 0.251, 1.03713)
Cerium_140 = Natural_Isotope("CE", 140, 139.905434, 88.45, 0.577524)
Cerium_142 = Natural_Isotope("CE", 142, 141.90924, 11.114, 0.96504)
Praseodymium_141 = Natural_Isotope("PR", 141, 140.9076448, 100, 11.5092)
Neodymium_142 = Natural_Isotope("ND", 142, 141.907719, 27.2, 18.702)
Neodymium_143 = Natural_Isotope("ND", 143, 142.90981, 12.2, 325.207)
Neodymium_144 = Natural_Isotope("ND", 144, 143.910083, 23.8, 3.59476)
Neodymium_145 = Natural_Isotope("ND", 145, 144.912569, 8.3, 42.0042)
Neodymium_146 = Natural_Isotope("ND", 146, 145.913112, 17.2, 1.48972)
Neodymium_148 = Natural_Isotope("ND", 148, 147.916889, 5.7, 2.58455)
Neodymium_150 = Natural_Isotope("ND", 150, 149.920887, 5.6, 1.04087)
Samarium_144 = Natural_Isotope("SM", 144, 143.911995, 3.07, 1.63074)
Samarium_147 = Natural_Isotope("SM", 147, 146.914893, 14.99, 57.0005)
Samarium_148 = Natural_Isotope("SM", 148, 147.914818, 11.24, 2.40081)
Samarium_149 = Natural_Isotope("SM", 149, 148.91718, 13.82, 40513.5)
Samarium_150 = Natural_Isotope("SM", 150, 149.917271, 7.38, 100.028)
Samarium_152 = Natural_Isotope("SM", 152, 151.919728, 26.75, 206.002)
Samarium_154 = Natural_Isotope("SM", 154, 153.922205, 22.75, 8.32501)
Europium_151 = Natural_Isotope("EU", 151, 150.919846, 47.81, 9185.34)
Europium_153 = Natural_Isotope("EU", 153, 152.921226, 52.19, 358.045)
Gadolinium_152 = Natural_Isotope("GD", 152, 151.919788, 0.2, 735.135)
Gadolinium_154 = Natural_Isotope("GD", 154, 1553.920862, 2.18, 85.2086)
Gadolinium_155 = Natural_Isotope("GD", 155, 154.922619, 14.8, 60740.1)
Gadolinium_156 = Natural_Isotope("GD", 156, 155.92212, 20.47, 1.7951)
Gadolinium_157 = Natural_Isotope("GD", 157, 156.923957, 15.65, 252928)
Gadolinium_158 = Natural_Isotope("GD", 158, 157.924101, 24.84, 2.20303)
Gadolinium_160 = Natural_Isotope("GD", 160, 159.927051, 21.86, 1.41027)
Terbium_159 = Natural_Isotope("TB", 159, 158.925343, 100, 23.3595)
Dysprosium_156 = Natural_Isotope("DY", 156, 155.924278, 0.06, 33.0649)
Dysprosium_158 = Natural_Isotope("DY", 158, 157.924405, 0.1, 43.0828)
Dysprosium_160 = Natural_Isotope("DY", 160, 159.925194, 2.34, 55.9966)
Dysprosium_161 = Natural_Isotope("DY", 161, 160.92693, 18.91, 600.248)
Dysprosium_162 = Natural_Isotope("DY", 162, 161.926795, 25.51, 193.986)
Dysprosium_163 = Natural_Isotope("DY", 163, 162.928728, 24.9, 123.433)
Dysprosium_164 = Natural_Isotope("DY", 164, 163.929171, 28.18, 2653.58)
Holmium_165 = Natural_Isotope("HO", 165, 164.930319, 100, 64.6959)
Erbium_162 = Natural_Isotope("ER", 162, 161.928775, 0.14, 18.9178)
Erbium_164 = Natural_Isotope("ER", 164, 163.929197, 1.61, 12.9572)
Erbium_166 = Natural_Isotope("ER", 166, 165.93029, 33.61, 16.8769)
Erbium_167 = Natural_Isotope("ER", 167, 166.932045, 22.93, 649.812)
Erbium_168 = Natural_Isotope("ER", 168, 167.932368, 26.78, 2.74199)
Erbium_170 = Natural_Isotope("ER", 170, 160.93546, 14.94, 8.8531)
Thulium_169 = Natural_Isotope("TM", 169, 168.934211, 100, 105.049)
Ytterbium_168 = Natural_Isotope("YB", 168, 167.933894, 0.13, 2308.65)
Ytterbium_170 = Natural_Isotope("YB", 170, 169.934759, 3.04, 10.4239)
Ytterbium_171 = Natural_Isotope("YB", 171, 170.936322, 14.28, 55.1482)
Ytterbium_172 = Natural_Isotope("YB", 172, 171.936378, 21.83, 1.13789)
Ytterbium_173 = Natural_Isotope("YB", 173, 172.938207, 16.13, 16.0429)
Ytterbium_174 = Natural_Isotope("YB", 174, 173.938858, 31.83, 66.2165)
Ytterbium_176 = Natural_Isotope("YB", 176, 175.942568, 12.76, 2.8382)
Lutetium_175 = Natural_Isotope("LU", 175, 174.940768, 97.41, 23.0819)
Lutetium_176 = Natural_Isotope("LU", 176, 175.942682, 2.59, 2096.98)
Hafnium_174 = Natural_Isotope("HF", 174, 173.94004, 0.16, 549.546)
Hafnium_176 = Natural_Isotope("HF", 176, 175.941402, 5.26, 21.3847)
Hafnium_177 = Natural_Isotope("HF", 177, 176.94322, 18.6, 373.667)
Hafnium_178 = Natural_Isotope("HF", 178, 177.943698, 27.28, 83.9482)
Hafnium_179 = Natural_Isotope("HF", 179, 178.945815, 13.62, 42.7982)
Hafnium_180 = Natural_Isotope("HF", 180, 179.946549, 35.08, 13.0744)
Tantalum_180 = Natural_Isotope("TA", 180, 179.947466, 0.012, 791.213)
Tantalum_181 = Natural_Isotope("TA", 181, 180.947996, 99.988, 21.1306)
Tungsten_180 = Natural_Isotope("W", 180, 179.946706, 0.12, 29.6565)
Tungsten_182 = Natural_Isotope("W", 182, 181.948206, 26.5, 20.7155)
Tungsten_183 = Natural_Isotope("W", 183, 182.950224, 14.31, 10.1168)
Tungsten_184 = Natural_Isotope("W", 184, 183.950933, 30.64, 1.50204)
Tungsten_186 = Natural_Isotope("W", 186, 185.954362, 28.43, 38.0949)
Rhenium_185 = Natural_Isotope("RE", 185, 184.952956, 37.4, 112.176)
Rhenium_187 = Natural_Isotope("RE", 187, 186.955751, 62.6, 76.7062)
Osmium_184 = Natural_Isotope("OS", 184, 183.952491, 0.02, 3081.89)
Osmium_186 = Natural_Isotope("OS", 186, 185.953838, 1.59, 80.35977)
Osmium_187 = Natural_Isotope("OS", 187, 186.955748, 1.96, 320.331)
Osmium_188 = Natural_Isotope("OS", 188, 187.955836, 1.96, 5.22819)
Osmium_189 = Natural_Isotope("OS", 189, 188.958145, 13.24, 25.0801)
Osmium_190 = Natural_Isotope("OS", 190, 189.958445, 26.26, 13.0864)
Osmium_192 = Natural_Isotope("OS", 192, 191.961479, 40.78, 2.74746)
Iridium_191 = Natural_Isotope("IR", 191, 190.960591, 37.3, 954.468)
Iridium_193 = Natural_Isotope("IR", 193, 192.962924, 62.7, 111.173)
Platinum_190 = Natural_Isotope("PT", 190, 189.95993, 0.014, 153.122)
Platinum_192 = Natural_Isotope("PT", 192, 191.961035, 0.782, 10.6592)
Platinum_194 = Natural_Isotope("PT", 194, 193.962664, 32.967, 1.37928)
Platinum_195 = Natural_Isotope("PT", 195, 194.964774, 33.832, 27.5463)
Platinum_196 = Natural_Isotope("PT", 196, 195.964935, 25.242, 0.6488625)
Platinum_198 = Natural_Isotope("PT", 198, 197.967876, 7.163, 3.51825)
Gold_197 = Natural_Isotope("AU", 197, 196.966552, 100, 99.10925)
Mercury_196 = Natural_Isotope("HG", 196, 195.965815, 0.15, 3078.91)
Mercury_198 = Natural_Isotope("HG", 198, 197.966752, 9.97, 1.98586)
Mercury_199 = Natural_Isotope("HG", 199, 198.968262, 16.87, 2150.18)
Mercury_200 = Natural_Isotope("HG", 200, 199.968309, 23.1, 1.44314)
Mercury_201 = Natural_Isotope("HG", 201, 200.970285, 13.18, 4.90396)
Mercury_202 = Natural_Isotope("HG", 202, 201.970626, 29.86, 4.95514)
Mercury_204 = Natural_Isotope("HG", 204, 203.973476, 6.87, 0.431558)
Thallium_203 = Natural_Isotope("TL", 203, 202.972329, 29.524, 11.411)
Thallium_205 = Natural_Isotope("TL", 205, 204.974412, 70.476, 0.130514)
Lead_204 = Natural_Isotope("PB", 204, 203.973029, 1.4, 0.660895)
Lead_206 = Natural_Isotope("PB", 206, 205.974449, 24.1, 0.0297921)
Lead_207 = Natural_Isotope("PB", 207, 206.975881, 22.1, 0.712178)
Lead_208 = Natural_Isotope("PB", 208, 207.976636, 52.4, 0.000232076)
Bismuth_209 = Natural_Isotope("BI", 209, 208.980383, 100, 0.0338121)
Thorium_232 = Natural_Isotope("TH", 232, 232.0385879, 100, 7.33806)
Proactinium_231 = Natural_Isotope("PA", 231, 231.035879, 100, 200.689)
Uranium_234 = Natural_Isotope("U", 234, 234.040946, 0.0055, 100.908)
Uranium_235 = Natural_Isotope("U", 235, 235.043923, 0.72, 98.6866)
Uranium_238 = Natural_Isotope("U", 238, 238.050783, 99.2745, 2.68346)
natural_isotope_list = [Hydrogen_1, Hydrogen_2, Helium_3, Helium_4, Lithium_6,
Lithium_7, Beryllium_9, Boron_10, Boron_11, Carbon_12,
Carbon_13, Nitrogen_14, Nitrogen_15, Oxygen_16,
Oxygen_17, Oxygen_18, Fluorine_19, Neon_20, Neon_21,
Neon_22, Sodium_23, Magnesium_24, Magnesium_25,
Magnesium_26, Aluminum_27, Silicon_28, Silicon_29,
Silicon_30, Phosphorus_31, Sulfur_32, Sulfur_33,
Sulfur_34, Sulfur_36, Chlorine_35, Chlorine_37,
Argon_36, Argon_38, Argon_40, Potassium_39,
Potassium_40, Potassium_41, Calcium_40, Calcium_42,
Calcium_43, Calcium_44, Calcium_46, Calcium_48,
Scandium_45, Titanium_46, Titanium_47, Titanium_48,
Titanium_49, Titanium_50, Vanadium_50, Vanadium_51,
Chromium_50, Chromium_52, Chromium_53, Chromium_54,
Manganese_55, Iron_54, Iron_56, Iron_57, Iron_58,
Cobalt_59, Nickel_58, Nickel_60, Nickel_61, Nickel_62,
Nickel_64, Copper_63, Copper_65, Zinc_64, Zinc_66,
Zinc_67, Zinc_68, Zinc_70, Gallium_69, Gallium_71,
Germanium_70, Germanium_72, Germanium_73, Germanium_74,
Germanium_76, Arsenic_75, Selenium_74, Selenium_76,
Selenium_77, Selenium_78, Selenium_80, Selenium_82,
Bromine_79, Bromine_81, Krypton_78, Krypton_80,
Krypton_82, Krypton_83, Krypton_84, Krypton_86,
Rubidium_85, Rubidium_87, Strontium_84, Strontium_86,
Strontium_87, Strontium_88, Yttrium_89, Zirconium_90,
Zirconium_91, Zirconium_92, Zirconium_94, Zirconium_96,
Niobium_93, Molybdenum_92, Molybdenum_94,
Molybdenum_95, Molybdenum_96, Molybdenum_97,
Molybdenum_98, Molybdenum_100, Ruthenium_96,
Ruthenium_98, Ruthenium_99, Ruthenium_100,
Ruthenium_101, Ruthenium_102, Ruthenium_104,
Rhodium_103, Palladium_102, Palladium_104,
Palladium_105, Palladium_106, Palladium_108,
Palladium_110, Silver_107, Silver_109, Cadmium_106,
Cadmium_108, Cadmium_110, Cadmium_111, Cadmium_112,
Cadmium_113, Cadmium_114, Cadmium_116, Indium_113,
Indium_115, Tin_112, Tin_114, Tin_115, Tin_116,
Tin_117, Tin_118, Tin_119, Tin_120, Tin_122, Tin_124,
Antimony_121, Antimony_123, Tellurium_120,
Tellurium_122, Tellurium_123, Tellurium_124,
Tellurium_125, Tellurium_126, Tellurium_128,
Tellurium_130, Iodine_127, Xenon_124, Xenon_126,
Xenon_128, Xenon_129, Xenon_130, Xenon_131, Xenon_132,
Xenon_134, Xenon_136, Cesium_133, Barium_130,
Barium_132, Barium_134, Barium_135, Barium_136,
Barium_137, Barium_138, Lanthanum_138, Lanthanum_139,
Cerium_136, Cerium_138, Cerium_140, Cerium_142,
Praseodymium_141, Neodymium_142, Neodymium_143,
Neodymium_144, Neodymium_145, Neodymium_146,
Neodymium_148, Neodymium_150, Samarium_144,
Samarium_147, Samarium_148, Samarium_149, Samarium_150,
Samarium_152, Samarium_154, Europium_151, Europium_153,
Gadolinium_152, Gadolinium_154, Gadolinium_155,
Gadolinium_156, Gadolinium_157, Gadolinium_158,
Gadolinium_160, Terbium_159, Dysprosium_156,
Dysprosium_158, Dysprosium_160, Dysprosium_161,
Dysprosium_162, Dysprosium_163, Dysprosium_164,
Holmium_165, Erbium_162, Erbium_164, Erbium_166,
Erbium_167, Erbium_168, Erbium_170, Thulium_169,
Ytterbium_168, Ytterbium_170, Ytterbium_171,
Ytterbium_172, Ytterbium_173, Ytterbium_174,
Ytterbium_176, Lutetium_175, Lutetium_176,
Hafnium_174, Hafnium_176, Hafnium_177, Hafnium_178,
Hafnium_179, Hafnium_180, Tantalum_180, Tantalum_181,
Tungsten_180, Tungsten_182, Tungsten_183, Tungsten_184,
Tungsten_186, Rhenium_185, Rhenium_187, Osmium_184,
Osmium_186, Osmium_187, Osmium_188, Osmium_189,
Osmium_190, Osmium_192, Iridium_191,
Iridium_193, Platinum_190, Platinum_192, Platinum_194,
Platinum_195, Platinum_196, Platinum_198, Gold_197,
Mercury_196, Mercury_198, Mercury_199, Mercury_200,
Mercury_201, Mercury_202, Mercury_204, Thallium_203,
Thallium_205, Lead_204, Lead_206, Lead_207, Lead_208,
Bismuth_209, Thorium_232, Proactinium_231, Uranium_234,
Uranium_235, Uranium_238]
| 68.236074 | 80 | 0.67724 | 4,051 | 25,725 | 4.083436 | 0.254752 | 0.245436 | 0.009672 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.355156 | 0.177026 | 25,725 | 376 | 81 | 68.417553 | 0.426196 | 0.001399 | 0 | 0 | 0 | 0 | 0.021496 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.002695 | false | 0 | 0 | 0 | 0.005391 | 0 | 0 | 0 | 0 | null | 1 | 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 | 3 |
29958aa6f1da49f5ea7caddb786c93b859da38bc | 130 | py | Python | storeapi/files.py | pyhoneybot/plugins-store | 3e9c7989cf58e5933094fcba02f0db8e54f27e55 | [
"MIT"
] | 1 | 2020-05-08T18:16:23.000Z | 2020-05-08T18:16:23.000Z | storeapi/files.py | pyhoneybot/plugins-store | 3e9c7989cf58e5933094fcba02f0db8e54f27e55 | [
"MIT"
] | null | null | null | storeapi/files.py | pyhoneybot/plugins-store | 3e9c7989cf58e5933094fcba02f0db8e54f27e55 | [
"MIT"
] | null | null | null |
def new_file(filename, content):
with open(filename, 'w+') as f:
f.write(content)
print('Created at', filename)
| 18.571429 | 35 | 0.623077 | 18 | 130 | 4.444444 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | 130 | 6 | 36 | 21.666667 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.09375 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
299d2939f0157b5bc89bf80845d0c9887f8db709 | 9,776 | py | Python | examples/tor.py | JarbasAl/pybrowser | 61a6f96e601bb5bfb5085f90a7a7b1da03051878 | [
"Apache-2.0"
] | null | null | null | examples/tor.py | JarbasAl/pybrowser | 61a6f96e601bb5bfb5085f90a7a7b1da03051878 | [
"Apache-2.0"
] | null | null | null | examples/tor.py | JarbasAl/pybrowser | 61a6f96e601bb5bfb5085f90a7a7b1da03051878 | [
"Apache-2.0"
] | null | null | null | from pombo_correio import TorBrowser
from time import sleep
if __name__ == "__main__":
from os.path import join, dirname, expanduser
gecko_driver = join(dirname(__file__), "geckodriver")
# https://github.com/mozilla/geckodriver/releases
binary = expanduser("~/Downloads/tor-browser_en-US/Browser/firefox")
# Using context manager
with TorBrowser(gecko_driver,
headless=True,
js_enabled=False,
binary=binary) as browser:
browser.got_to_url("https://browserleaks.com/ip")
# TODO wait for element that indicates page loaded
browser.scroll_down(5)
sleep(1)
browser.save_screenshot("tor_browserleaks.png")
browser.got_to_url("https://check.torproject.org/")
browser.find_and_click_xpath("/html/body/div[2]/p[2]/a[2]")
browser.wait_for_xpath("/html/body/div/div[4]/div[2]/h2/span")
browser.scroll_down(5)
sleep(1)
browser.save_screenshot("tor_relay.png")
"""
BrowserEvents.BROWSER_OPEN {'open_tabs': ['15'], 'tab_id': '15', 'homepage': 'https://torproject.org/'}
BrowserEvents.OPEN_URL {'url': 'https://browserleaks.com/ip', 'old_url': 'https://www.torproject.org/', 'tab_id': '15'}
BrowserEvents.ELEMENT_SEND_KEYS {'keys': ['\ue015', '\ue015', '\ue015', '\ue015', '\ue015'], 'element_text': 'Home Page\nIP Address\nJavaScript\nWebRTC Leak Test\nCanvas Fingerprint\nWebGL Report\nFont Fingerprinting\nSSL Client Test\nGeolocation API\nFeatures Detection\nContent Filters\nJava Applet\nFlash Player\nSilverlight\nMore Tools\nSettings\nWhat Is My IP Address\nMy IP Address\nIP address 77.247.181.162\nHostname chomsky.torservers.net\nIP Address Location\nCountry Netherlands (NL)\nState/Region South Holland (ZH)\nCity Dordrecht\nISP NForce Entertainment B.V.\nASN 43350\nTimezone Europe/Amsterdam\nLocal Time Tue, 13 Oct 2020 22:14:32 +0200\nLatitude/Longitude 51.7731,4.6752\nIPv6 Leak Test\nIPv6 Address\n2a0b:f4c0:16c:16::1\nWebRTC Leak Test\nLocal IP address n/a\nPublic IP address n/a\nDNS Leak Test\nTest Results Found 2 Servers, 1 ISP, 1 Location\nYour DNS Servers\nIP Address : ISP : Location :\n185.220.100.130 F3 Netze e.V. Germany\n2a0b:f4c0:16c:130::1 F3 Netze e.V. Germany\nFlash Leak Test\nFlash IP address n/a\nTCP/IP Fingerprint\nOS Linux (2.2.x-3.x)\nLink Ethernet or modem\nMTU 1500\nDistance 11 Hops\nHTTP Headers\nraw headers\nRequest GET /ip HTTP/2.0\nHost browserleaks.com\nUser-Agent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0\nAccept text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\nAccept-Language en-US,en;q=0.5\nAccept-Encoding gzip, deflate, br\nUpgrade-Insecure-Requests 1\nTE trailers\n\n\n\n\n\n\n\n\nTor Relay Details\nRelays\n✔\nFound 3 Tor Relays matching your IP [show all / hide all]\nRelay #1 Fingerprint 204DFD2A2C6A0DC1FA0EACB495218E0B661704FD\nRunning\n✔\nTrue\nNickname HaveHeart\nCountry Netherlands\nLatitude/Longitude 52.3824,4.8995\nAS Number AS43350\nAS Name NForce Entertainment B.V.\nOR Addresses 77.247.181.164:443\nExit Addresses 77.247.181.162\nDir Address 77.247.181.164:80\nVerified Host Names rainbowwarrior.torservers.net\nFlags\nExit Policy\nreject 0.0.0.0/8:*\nreject 169.254.0.0/16:*\nreject 127.0.0.0/8:*\nreject 192.168.0.0/16:*\nreject 10.0.0.0/8:*\nreject 172.16.0.0/12:*\nreject 77.247.181.164:*\nreject *:25\nreject 45.79.79.0/24:*\nreject 45.79.65.0/24:*\naccept *:*\nFirst Seen 2017-10-03 00:00:00 UTC\nLast Seen 2020-10-13 19:00:00 UTC\nLast Restarted 2020-09-23 04:49:47 UTC\nBandwidth 51.68 MB/s\nContact https://www.torservers.net/donate.html <support .AT. torservers .DOT. net>\nPlatform Tor 0.4.4.5 on Linux\nVersion Status Recommended\nRelay #2 Fingerprint 77131D7E2EC1CA9B8D737502256DA9103599CE51\n\n\n\n\n\n\n\n\n\n\nRelay #3 Fingerprint 7BFB908A3AA5B491DA4CA72CCBEE0E1F2A939B55\n\n\n\n\n\n\n\n\n\n\nWhere is My IP\n77.247.181.162\n+\n−\n© OpenStreetMap contributors, © CARTO\nIP Address Whois\nWhois 77.247.181.162\ninetnum: 77.247.181.160 - 77.247.181.175\nnetname: ZWIEBELFREUNDE\ndescr: Customer 692 / Zwiebelfreunde e.V.\nremarks: Sent abuse to: abuse@torservers.net\ncountry: NL\nadmin-c: MB22990-RIPE\ntech-c: MB22990-RIPE\nabuse-c: AR18597-RIPE\nstatus: ASSIGNED PA\nmnt-by: MNT-NFORCE\nmnt-lower: MNT-NFORCE\nmnt-routes: MNT-NFORCE\ncreated: 2015-02-04T09:09:24Z\nlast-modified: 2019-09-17T10:54:47Z\nsource: RIPE # Filtered\n\nperson: Moritz Bartl\naddress: Zwiebelfreunde e.V.\naddress: c/o DID Dresdner Institut fuer Datenschutz\naddress: Palaisplatz 3\naddress: 01097 Dresden\naddress: Germany\nphone: +49-351-21296018\nfax-no: +49-8131-9044975\nremarks: ---------------------------------\nremarks: This network is used for research\nremarks: in anonymization services and\nremarks: provides Tor exit nodes to end\nremarks: users.\nremarks: ---------------------------------\nremarks: Dieser Netzblock wird zur\nremarks: Erforschung von Anonymisierungs-\nremarks: techniken genutzt und stellt\nremarks: Endnutzern Tor zur Verfuegung.\nremarks: ---------------------------------\nremarks: http://www.torservers.net/abuse.html\nremarks: ---------------------------------\nnic-hdl: MB22990-RIPE\nmnt-by: ZWIEBELFREUNDE\ncreated: 2011-02-11T04:11:32Z\nlast-modified: 2019-10-03T21:50:51Z\nsource: RIPE # Filtered\n\nroute: 77.247.176.0/21\ndescr: NFOrce Entertainment BV - route 77.247.176.0/21\norigin: AS43350\nmnt-by: MNT-NFORCE\ncreated: 2020-05-01T07:14:42Z\nlast-modified: 2020-05-01T07:14:42Z\nsource: RIPE\nFurther Reading\n\nLeave a Comment (113)\nBrowserLeaks © 2011-2020 All Right Reserved\nmoc.skaelresworb@nimda', 'tab_id': '15', 'url': 'https://browserleaks.com/ip', 'href': None}
BrowserEvents.SCREENSHOT {'image': 'tor_browserleaks.png', 'tab_id': '15', 'url': 'https://browserleaks.com/ip'}
BrowserEvents.OPEN_URL {'url': 'https://check.torproject.org/', 'old_url': 'https://browserleaks.com/ip', 'tab_id': '15'}
BrowserEvents.WAIT_FOR_XPATH {'xpath': '/html/body/div[2]/p[2]/a[2]', 'timeout': 10, 'tab_id': '15', 'url': 'https://check.torproject.org/'}
BrowserEvents.XPATH_FOUND {'xpath': '/html/body/div[2]/p[2]/a[2]', 'timeout': 10, 'tab_id': '15', 'url': 'https://check.torproject.org/', 'element_text': 'Relay Search', 'href': 'https://metrics.torproject.org/rs.html#search/185.220.100.243', 'element_id': 'b0246841-66b4-40f3-b14d-7e32336e9a3a'}
BrowserEvents.ELEMENT_CLICKED {'xpath': '/html/body/div[2]/p[2]/a[2]', 'element_text': 'Relay Search', 'tab_id': '15', 'url': 'https://check.torproject.org/', 'href': 'https://metrics.torproject.org/rs.html#search/185.220.100.243'}
BrowserEvents.WAIT_FOR_XPATH {'xpath': '/html/body/div/div[4]/div[2]/h2/span', 'timeout': 30, 'tab_id': '15', 'url': 'https://metrics.torproject.org/rs.html#search/185.220.100.243'}
BrowserEvents.XPATH_NOT_FOUND {'xpath': '/html/body/div/div[4]/div[2]/h2/span', 'timeout': 30, 'tab_id': '15', 'url': 'https://metrics.torproject.org/rs.html#search/185.220.100.243'}
BrowserEvents.ELEMENT_SEND_KEYS {'keys': ['\ue015', '\ue015', '\ue015', '\ue015', '\ue015'], 'element_text': 'News\nSources\nServices\nDevelopment\nResearch\nAbout\nHome\nUsers\nServers\nTraffic\nPerformance\nOnion Services\nApplications\nThe Tor Project is working with Simply Secure to improve the experience of the Tor Metrics website. Want to collaborate? Take this survey!\nHomeServicesRelay SearchSearch for 185.220.100.243\nRelay Search\n185.220.100.243\nShow\n10\n25\n50\n100\nentries\nNickname† Advertised Bandwidth Uptime Country IPv4 IPv6 Flags Add. Flags ORPort DirPort Type\n Total 96.33 MiB/s \nF3Netze (32) 52.27 MiB/s 25d 15h 185.220.100.243 2a0b:f4c0:16c:16::1 9000 9001 Relay\nF3Netze (32) 44.06 MiB/s 25d 15h 185.220.100.243 2a0b:f4c0:16c:16::1 9100 9101 Relay\nShowing 1 to 2 of 2 entries\nPrevious\n1\nNext\n†The number shown in parentheses is the total effective family size for the relay including the relay itself. A size of 1 indicates that the relay does not have any other effective family members. Note that bridge relays do not advertise family members in their descriptors and so there is no value shown for bridge relays.\nInformation for relays was published: 2020-10-13 19:00:00 UTC.\nInformation for bridges was published: 2020-10-13 18:57:56 UTC.\nOnionoo version: 8.0/27f3bbb\n© 2009–2018 The Tor Project\nContact\nThis material is supported in part by the National Science Foundation under Grant No. CNS-0959138. Any opinions, finding, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. "Tor" and the "Onion Logo" are registered trademarks of The Tor Project, Inc.. Data on this site is freely available under a CC0 no copyright declaration: To the extent possible under law, the Tor Project has waived all copyright and related or neighboring rights in the data. Graphs are licensed under a Creative Commons Attribution 3.0 United States License.', 'tab_id': '15', 'url': 'https://metrics.torproject.org/rs.html#search/185.220.100.243', 'href': None}
BrowserEvents.SCREENSHOT {'image': 'tor_relay.png', 'tab_id': '15', 'url': 'https://metrics.torproject.org/rs.html#search/185.220.100.243'}
BrowserEvents.BROWSER_CLOSED {'open_tabs': ['15'], 'tab_id': '15', 'current_url': 'https://metrics.torproject.org/rs.html#search/185.220.100.243', 'tab2url': {'15': 'https://check.torproject.org/'}}
""" | 227.348837 | 4,787 | 0.714914 | 1,502 | 9,776 | 4.610519 | 0.406125 | 0.007509 | 0.009531 | 0.010975 | 0.242455 | 0.191625 | 0.174585 | 0.169675 | 0.14917 | 0.143105 | 0 | 0.114797 | 0.130319 | 9,776 | 43 | 4,788 | 227.348837 | 0.698542 | 0.01207 | 0 | 0.2 | 0 | 0 | 0.238674 | 0.119337 | 0 | 0 | 0 | 0.023256 | 0 | 1 | 0 | false | 0 | 0.15 | 0 | 0.15 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
29b8815aa5acfffc71bf3c2111e8778a37393680 | 189 | py | Python | python/CodingInterviews/offer17.py | CharlesPikachu/-algorithm | 5989495054b013ee07d25c6185289513e25a6edd | [
"MIT"
] | 16 | 2019-07-15T12:17:54.000Z | 2021-10-31T21:52:47.000Z | python/CodingInterviews/offer17.py | CharlesPikachu/-algorithm | 5989495054b013ee07d25c6185289513e25a6edd | [
"MIT"
] | null | null | null | python/CodingInterviews/offer17.py | CharlesPikachu/-algorithm | 5989495054b013ee07d25c6185289513e25a6edd | [
"MIT"
] | 3 | 2020-07-21T11:18:01.000Z | 2021-06-18T17:46:14.000Z | '''
Function:
打印从1到最大的n位数
Author:
Charles
'''
class Solution:
def printNumbers(self, n: int) -> List[int]:
start, end = 1, 10 ** n
return list(range(start, end)) | 18.9 | 48 | 0.582011 | 23 | 189 | 4.782609 | 0.782609 | 0.145455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028986 | 0.269841 | 189 | 10 | 49 | 18.9 | 0.768116 | 0.238095 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.75 | 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 | 1 | 0 | 0 | 3 |
29c2c28e4d26dbf250dfaf2f48073f7d515331b8 | 1,092 | py | Python | slow_processing_times/utils.py | GeoffreyDlvl/SlowwwwwProcessingTimes | f0e37d11fef6d4922e6c9c8fc68766f29bd21bb4 | [
"MIT"
] | null | null | null | slow_processing_times/utils.py | GeoffreyDlvl/SlowwwwwProcessingTimes | f0e37d11fef6d4922e6c9c8fc68766f29bd21bb4 | [
"MIT"
] | null | null | null | slow_processing_times/utils.py | GeoffreyDlvl/SlowwwwwProcessingTimes | f0e37d11fef6d4922e6c9c8fc68766f29bd21bb4 | [
"MIT"
] | null | null | null | import os, hashlib
from flask import (
current_app, jsonify, request, Response
)
def archive_exists(filename):
return filename in os.listdir(current_app.config['UPLOAD_FOLDER'])
def create_response(json_body, status_code):
resp = jsonify(json_body)
resp.status_code = status_code
return resp
def compute_checksum(filename):
hash_md5 = hashlib.md5()
with open(os.path.join(current_app.config['UPLOAD_FOLDER'], filename), "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
def check_filename_in(request):
if not request.is_json:
return create_response({'message': 'Error: mimetype is not application/json'}, 400)
data = request.get_json()
try:
data['filename']
return Response()
except KeyError:
return create_response({'message': 'Key is not recognized. Use \'filename\''}, 400)
def is_response_empty(response):
return response.content_length is None
def get_filename_from(request):
return request.get_json()['filename'] | 30.333333 | 91 | 0.700549 | 146 | 1,092 | 5.047945 | 0.458904 | 0.040706 | 0.043419 | 0.059701 | 0.075984 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015766 | 0.186813 | 1,092 | 36 | 92 | 30.333333 | 0.814189 | 0 | 0 | 0 | 0 | 0 | 0.114364 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.206897 | false | 0 | 0.068966 | 0.103448 | 0.551724 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
29ddd784009f4e4a9bd9dcb496f22ba1f0e58e50 | 336 | py | Python | PYTHON/Strings/find_a_string.py | byung-u/HackerRank | 4c02fefff7002b3af774b99ebf8d40f149f9d163 | [
"MIT"
] | null | null | null | PYTHON/Strings/find_a_string.py | byung-u/HackerRank | 4c02fefff7002b3af774b99ebf8d40f149f9d163 | [
"MIT"
] | null | null | null | PYTHON/Strings/find_a_string.py | byung-u/HackerRank | 4c02fefff7002b3af774b99ebf8d40f149f9d163 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
def count_substring(string, sub_string):
l1 = len(string)
l2 = len(sub_string)
return len([i for i in range(0, l1 - l2 + 1) if (string[i:i+l2] == sub_string)])
if __name__ == '__main__':
string = input()
sub_string = input()
print(count_substring(string, sub_string))
| 19.764706 | 84 | 0.636905 | 51 | 336 | 3.901961 | 0.509804 | 0.226131 | 0.201005 | 0.231156 | 0.291457 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030534 | 0.220238 | 336 | 16 | 85 | 21 | 0.729008 | 0.0625 | 0 | 0 | 0 | 0 | 0.025559 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0 | 0.333333 | 0.111111 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4b10b07fbd553ab6db4a8aa768c1e21d2250ebfd | 907 | py | Python | scraping/migrations/0013_auto_20190307_1046.py | ThibaultRizzo/car-scraping | ca108a9c90319d8a935c58b30394a34f88e3d7df | [
"MIT"
] | null | null | null | scraping/migrations/0013_auto_20190307_1046.py | ThibaultRizzo/car-scraping | ca108a9c90319d8a935c58b30394a34f88e3d7df | [
"MIT"
] | 3 | 2020-02-11T23:48:07.000Z | 2021-03-31T19:01:48.000Z | scraping/migrations/0013_auto_20190307_1046.py | ThibaultRizzo/car-scraping | ca108a9c90319d8a935c58b30394a34f88e3d7df | [
"MIT"
] | 1 | 2019-02-25T13:40:36.000Z | 2019-02-25T13:40:36.000Z | # Generated by Django 2.1.5 on 2019-03-07 10:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scraping', '0012_auto_20190306_1322'),
]
operations = [
migrations.AlterField(
model_name='car',
name='color',
field=models.CharField(max_length=100, null=True),
),
migrations.AlterField(
model_name='car',
name='motor_type',
field=models.CharField(max_length=100, null=True),
),
migrations.AlterField(
model_name='car',
name='petrol_type',
field=models.CharField(max_length=100, null=True),
),
migrations.AlterField(
model_name='car',
name='reg_number',
field=models.CharField(max_length=100, null=True, unique=True),
),
]
| 26.676471 | 75 | 0.564498 | 94 | 907 | 5.297872 | 0.468085 | 0.160643 | 0.200803 | 0.232932 | 0.626506 | 0.626506 | 0.554217 | 0.554217 | 0.473896 | 0.473896 | 0 | 0.069355 | 0.316428 | 907 | 33 | 76 | 27.484848 | 0.733871 | 0.049614 | 0 | 0.555556 | 1 | 0 | 0.09186 | 0.026744 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.037037 | 0 | 0.148148 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4b2a2f9c4b98160142a330b5fdf86330d9c9cb3f | 204 | py | Python | PycharmProjects/Old.PythonExercicios/ex027.py | RodrigoMASRamos/Projects.py | ed15981b320914c9667305dcd5fb5b7906fd9b00 | [
"MIT"
] | null | null | null | PycharmProjects/Old.PythonExercicios/ex027.py | RodrigoMASRamos/Projects.py | ed15981b320914c9667305dcd5fb5b7906fd9b00 | [
"MIT"
] | null | null | null | PycharmProjects/Old.PythonExercicios/ex027.py | RodrigoMASRamos/Projects.py | ed15981b320914c9667305dcd5fb5b7906fd9b00 | [
"MIT"
] | null | null | null | n = str(input('Digite o seu nome completo: ')).strip()
print('Muito prazer em te conhecer,',n,'!')
nome = n.split()
print(f'Seu primeiro nome é {nome[0]}')
print(f'Seu último nome é {nome[len(nome)-1]}')
| 34 | 54 | 0.656863 | 37 | 204 | 3.621622 | 0.621622 | 0.089552 | 0.134328 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011236 | 0.127451 | 204 | 5 | 55 | 40.8 | 0.741573 | 0 | 0 | 0 | 0 | 0 | 0.602941 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.6 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
d99acc9a746afea5d516cdd5f124b1058ba4c025 | 318 | py | Python | yach/types/announcement.py | Yach-Network/yach-blockchain | 8e1f8538493de7a97009faf6a959d649f1f00324 | [
"Apache-2.0"
] | 2 | 2021-06-29T11:09:02.000Z | 2021-07-01T16:17:59.000Z | yach/types/announcement.py | Yach-Network/yach-blockchain | 8e1f8538493de7a97009faf6a959d649f1f00324 | [
"Apache-2.0"
] | null | null | null | yach/types/announcement.py | Yach-Network/yach-blockchain | 8e1f8538493de7a97009faf6a959d649f1f00324 | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass
from yach.types.blockchain_format.sized_bytes import bytes32
from yach.util.hash import std_hash
@dataclass(frozen=True)
class Announcement:
origin_info: bytes32
message: bytes
def name(self) -> bytes32:
return std_hash(bytes(self.origin_info + self.message))
| 22.714286 | 63 | 0.764151 | 43 | 318 | 5.511628 | 0.581395 | 0.067511 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022472 | 0.160377 | 318 | 13 | 64 | 24.461538 | 0.865169 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0.111111 | 0.888889 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
d9b42a3281f57ce064b0ac73116b1933869f8ea6 | 232 | py | Python | pydtk/io/__init__.py | dataware-tools/pydtk | 1da61fb8ca90de6c39a371a9b2b65f4473932991 | [
"Apache-2.0"
] | 11 | 2020-10-09T01:29:18.000Z | 2022-01-21T13:21:40.000Z | pydtk/io/__init__.py | dataware-tools/pydtk | 1da61fb8ca90de6c39a371a9b2b65f4473932991 | [
"Apache-2.0"
] | 64 | 2020-10-20T04:55:22.000Z | 2022-01-24T15:52:32.000Z | pydtk/io/__init__.py | dataware-tools/pydtk | 1da61fb8ca90de6c39a371a9b2b65f4473932991 | [
"Apache-2.0"
] | 1 | 2021-07-30T04:52:38.000Z | 2021-07-30T04:52:38.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright Toolkit Authors
"""pydtk modules."""
from pydtk.io.writer import BaseFileWriter
from pydtk.io.reader import BaseFileReader
from pydtk.io.errors import NoModelMatchedError
| 21.090909 | 47 | 0.758621 | 30 | 232 | 5.866667 | 0.7 | 0.153409 | 0.1875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004902 | 0.12069 | 232 | 10 | 48 | 23.2 | 0.857843 | 0.357759 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d9b69af3be3743bde145b2e9fb162d268c5bd804 | 165 | py | Python | battle-city/battle-city.py | mbdimitrova/battle-city | bd4f70d7f4c1d5cb41513ee44c1c03ef81786ab0 | [
"MIT"
] | 1 | 2015-04-27T23:27:52.000Z | 2015-04-27T23:27:52.000Z | battle-city/battle-city.py | mbdimitrova/battle-city | bd4f70d7f4c1d5cb41513ee44c1c03ef81786ab0 | [
"MIT"
] | null | null | null | battle-city/battle-city.py | mbdimitrova/battle-city | bd4f70d7f4c1d5cb41513ee44c1c03ef81786ab0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3.3
"""
This is an attempt to recreate
Battle City for NES
"""
from code.game import *
if __name__ == '__main__':
Game("level01").main()
| 13.75 | 30 | 0.660606 | 25 | 165 | 4.04 | 0.92 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02963 | 0.181818 | 165 | 11 | 31 | 15 | 0.718519 | 0.448485 | 0 | 0 | 0 | 0 | 0.180723 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d9d7652b0cea0dfa4633de3b20884eb71a3e8844 | 800 | py | Python | src/pretix/base/__init__.py | td00/pretix | e31bd7600c85598de135f2eb5012e2f33fdb1d11 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/pretix/base/__init__.py | td00/pretix | e31bd7600c85598de135f2eb5012e2f33fdb1d11 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/pretix/base/__init__.py | td00/pretix | e31bd7600c85598de135f2eb5012e2f33fdb1d11 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2017-08-09T17:11:28.000Z | 2017-08-09T17:11:28.000Z | from django.apps import AppConfig
from django.conf import settings
class PretixBaseConfig(AppConfig):
name = 'pretix.base'
label = 'pretixbase'
def ready(self):
from . import exporter # NOQA
from . import payment # NOQA
from . import exporters # NOQA
from . import invoice # NOQA
from .services import export, mail, tickets, cart, orders, cleanup, update_check # NOQA
try:
from .celery_app import app as celery_app # NOQA
except ImportError:
pass
if hasattr(settings, 'RAVEN_CONFIG'):
from ..sentry import initialize
initialize()
default_app_config = 'pretix.base.PretixBaseConfig'
try:
import pretix.celery_app as celery # NOQA
except ImportError:
pass
| 25.806452 | 96 | 0.64125 | 89 | 800 | 5.685393 | 0.505618 | 0.079051 | 0.083004 | 0.098814 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.29125 | 800 | 30 | 97 | 26.666667 | 0.892416 | 0.0425 | 0 | 0.26087 | 0 | 0 | 0.080475 | 0.036939 | 0 | 0 | 0 | 0 | 0 | 1 | 0.043478 | false | 0.086957 | 0.521739 | 0 | 0.695652 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
d9f8c4de9e4edbdfeb3d6aa0824fbca11e77e1fc | 60,089 | py | Python | synthpop_pb2.py | dabreegster/ua-aspics | 3214f3c2daef8d5f465bbc66cae2b01911e337de | [
"MIT"
] | 7 | 2022-01-03T16:12:03.000Z | 2022-02-24T16:41:34.000Z | synthpop_pb2.py | dabreegster/ua-aspics | 3214f3c2daef8d5f465bbc66cae2b01911e337de | [
"MIT"
] | 16 | 2021-12-30T16:50:13.000Z | 2022-03-11T11:53:25.000Z | synthpop_pb2.py | dabreegster/ua-aspics | 3214f3c2daef8d5f465bbc66cae2b01911e337de | [
"MIT"
] | 1 | 2022-02-23T16:12:57.000Z | 2022-02-23T16:12:57.000Z | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: synthpop.proto
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='synthpop.proto',
package='synthpop',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x0esynthpop.proto\x12\x08synthpop\"\x9f\x03\n\nPopulation\x12\'\n\nhouseholds\x18\x01 \x03(\x0b\x32\x13.synthpop.Household\x12 \n\x06people\x18\x02 \x03(\x0b\x32\x10.synthpop.Person\x12H\n\x13venues_per_activity\x18\x03 \x03(\x0b\x32+.synthpop.Population.VenuesPerActivityEntry\x12<\n\rinfo_per_msoa\x18\x04 \x03(\x0b\x32%.synthpop.Population.InfoPerMsoaEntry\x12$\n\x08lockdown\x18\x05 \x01(\x0b\x32\x12.synthpop.Lockdown\x1aM\n\x16VenuesPerActivityEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.synthpop.VenueList:\x02\x38\x01\x1aI\n\x10InfoPerMsoaEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.synthpop.InfoPerMSOA:\x02\x38\x01\"L\n\tHousehold\x12\n\n\x02id\x18\x01 \x01(\x04\x12\x10\n\x08msoa11cd\x18\x02 \x01(\t\x12\x10\n\x08orig_hid\x18\x03 \x01(\x03\x12\x0f\n\x07members\x18\x04 \x03(\x04\",\n\tVenueList\x12\x1f\n\x06venues\x18\x01 \x03(\x0b\x32\x0f.synthpop.Venue\"\x92\x01\n\x0bInfoPerMSOA\x12\x1e\n\x05shape\x18\x01 \x03(\x0b\x32\x0f.synthpop.Point\x12\x12\n\npopulation\x18\x02 \x01(\x04\x12\"\n\tbuildings\x18\x03 \x03(\x0b\x32\x0f.synthpop.Point\x12+\n\x12\x66lows_per_activity\x18\x04 \x03(\x0b\x32\x0f.synthpop.Flows\",\n\x05Point\x12\x11\n\tlongitude\x18\x01 \x01(\x02\x12\x10\n\x08latitude\x18\x02 \x01(\x02\"\xbd\x02\n\x06Person\x12\n\n\x02id\x18\x01 \x01(\x04\x12\x11\n\thousehold\x18\x02 \x01(\x04\x12\x11\n\tworkplace\x18\x03 \x01(\x04\x12*\n\x0bidentifiers\x18\x04 \x01(\x0b\x32\x15.synthpop.Identifiers\x12,\n\x0c\x64\x65mographics\x18\x05 \x01(\x0b\x32\x16.synthpop.Demographics\x12(\n\nemployment\x18\x06 \x01(\x0b\x32\x14.synthpop.Employment\x12 \n\x06health\x18\x07 \x01(\x0b\x32\x10.synthpop.Health\x12#\n\x08time_use\x18\x08 \x01(\x0b\x32\x11.synthpop.TimeUse\x12\x36\n\x12\x61\x63tivity_durations\x18\t \x03(\x0b\x32\x1a.synthpop.ActivityDuration\"J\n\x10\x41\x63tivityDuration\x12$\n\x08\x61\x63tivity\x18\x01 \x01(\x0e\x32\x12.synthpop.Activity\x12\x10\n\x08\x64uration\x18\x02 \x01(\x01\"P\n\x0bIdentifiers\x12\x12\n\npid_census\x18\x01 \x01(\x03\x12\x0f\n\x07pid_tus\x18\x02 \x01(\x03\x12\x0f\n\x07pid_hse\x18\x03 \x01(\x03\x12\x0b\n\x03idp\x18\x04 \x01(\t\"\x97\x01\n\x0c\x44\x65mographics\x12\x1a\n\x03sex\x18\x01 \x01(\x0e\x32\r.synthpop.Sex\x12\x11\n\tage_years\x18\x02 \x01(\r\x12 \n\x06origin\x18\x03 \x01(\x0e\x32\x10.synthpop.Origin\x12\x36\n\x1csocioeconomic_classification\x18\x04 \x01(\x0e\x32\x10.synthpop.NSSEC5\"\x91\x01\n\nEmployment\x12\x0f\n\x07sic1d07\x18\x01 \x01(\x04\x12\x0f\n\x07sic2d07\x18\x02 \x01(\x04\x12\x0f\n\x07soc2010\x18\x03 \x01(\x04\x12\"\n\x07pwkstat\x18\x04 \x01(\x0e\x32\x11.synthpop.PwkStat\x12\x15\n\rsalary_yearly\x18\x05 \x01(\x02\x12\x15\n\rsalary_hourly\x18\x06 \x01(\x02\"\x7f\n\x06Health\x12\x1a\n\x03\x62mi\x18\x01 \x01(\x0e\x32\r.synthpop.BMI\x12\"\n\x1ahas_cardiovascular_disease\x18\x02 \x01(\x08\x12\x14\n\x0chas_diabetes\x18\x03 \x01(\x08\x12\x1f\n\x17has_high_blood_pressure\x18\x04 \x01(\x08\"\xd3\x01\n\x07TimeUse\x12\x0f\n\x07unknown\x18\x01 \x01(\x01\x12\x0c\n\x04work\x18\x02 \x01(\x01\x12\x0e\n\x06school\x18\x03 \x01(\x01\x12\x0c\n\x04shop\x18\x04 \x01(\x01\x12\x10\n\x08services\x18\x05 \x01(\x01\x12\x0f\n\x07leisure\x18\x06 \x01(\x01\x12\x0e\n\x06\x65scort\x18\x07 \x01(\x01\x12\x11\n\ttransport\x18\x08 \x01(\x01\x12\x10\n\x08not_home\x18\t \x01(\x01\x12\x0c\n\x04home\x18\n \x01(\x01\x12\x11\n\twork_home\x18\x0b \x01(\x01\x12\x12\n\nhome_total\x18\x0c \x01(\x01\"L\n\x05\x46lows\x12$\n\x08\x61\x63tivity\x18\x01 \x01(\x0e\x32\x12.synthpop.Activity\x12\x1d\n\x05\x66lows\x18\x02 \x03(\x0b\x32\x0e.synthpop.Flow\"(\n\x04\x46low\x12\x10\n\x08venue_id\x18\x01 \x01(\x04\x12\x0e\n\x06weight\x18\x02 \x01(\x01\"i\n\x05Venue\x12\n\n\x02id\x18\x01 \x01(\x04\x12$\n\x08\x61\x63tivity\x18\x02 \x01(\x0e\x32\x12.synthpop.Activity\x12!\n\x08location\x18\x03 \x01(\x0b\x32\x0f.synthpop.Point\x12\x0b\n\x03urn\x18\x04 \x01(\x04\"/\n\x08Lockdown\x12\x12\n\nstart_date\x18\x01 \x01(\t\x12\x0f\n\x07per_day\x18\x02 \x03(\x02*\x1b\n\x03Sex\x12\n\n\x06\x46\x45MALE\x10\x00\x12\x08\n\x04MALE\x10\x01*?\n\x06Origin\x12\t\n\x05WHITE\x10\x00\x12\t\n\x05\x42LACK\x10\x01\x12\t\n\x05\x41SIAN\x10\x02\x12\t\n\x05MIXED\x10\x03\x12\t\n\x05OTHER\x10\x04*Y\n\x06NSSEC5\x12\x0e\n\nUNEMPLOYED\x10\x00\x12\n\n\x06HIGHER\x10\x01\x12\x10\n\x0cINTERMEDIATE\x10\x02\x12\t\n\x05SMALL\x10\x03\x12\t\n\x05LOWER\x10\x04\x12\x0b\n\x07ROUTINE\x10\x05*\xbe\x01\n\x07PwkStat\x12\x06\n\x02NA\x10\x00\x12\x0f\n\x0b\x45MPLOYEE_FT\x10\x01\x12\x0f\n\x0b\x45MPLOYEE_PT\x10\x02\x12\x13\n\x0f\x45MPLOYEE_UNSPEC\x10\x03\x12\x11\n\rSELF_EMPLOYED\x10\x04\x12\x12\n\x0ePWK_UNEMPLOYED\x10\x05\x12\x0b\n\x07RETIRED\x10\x06\x12\r\n\tHOMEMAKER\x10\x07\x12\x0e\n\nSTUDENT_FT\x10\x08\x12\x12\n\x0eLONG_TERM_SICK\x10\t\x12\r\n\tPWK_OTHER\x10\n*m\n\x03\x42MI\x12\x12\n\x0eNOT_APPLICABLE\x10\x00\x12\x0f\n\x0bUNDERWEIGHT\x10\x01\x12\n\n\x06NORMAL\x10\x02\x12\x0e\n\nOVERWEIGHT\x10\x03\x12\x0b\n\x07OBESE_1\x10\x04\x12\x0b\n\x07OBESE_2\x10\x05\x12\x0b\n\x07OBESE_3\x10\x06*T\n\x08\x41\x63tivity\x12\n\n\x06RETAIL\x10\x00\x12\x12\n\x0ePRIMARY_SCHOOL\x10\x01\x12\x14\n\x10SECONDARY_SCHOOL\x10\x02\x12\x08\n\x04HOME\x10\x03\x12\x08\n\x04WORK\x10\x04\x62\x06proto3'
)
_SEX = _descriptor.EnumDescriptor(
name='Sex',
full_name='synthpop.Sex',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='FEMALE', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='MALE', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=2164,
serialized_end=2191,
)
_sym_db.RegisterEnumDescriptor(_SEX)
Sex = enum_type_wrapper.EnumTypeWrapper(_SEX)
_ORIGIN = _descriptor.EnumDescriptor(
name='Origin',
full_name='synthpop.Origin',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='WHITE', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='BLACK', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ASIAN', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='MIXED', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='OTHER', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=2193,
serialized_end=2256,
)
_sym_db.RegisterEnumDescriptor(_ORIGIN)
Origin = enum_type_wrapper.EnumTypeWrapper(_ORIGIN)
_NSSEC5 = _descriptor.EnumDescriptor(
name='NSSEC5',
full_name='synthpop.NSSEC5',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='UNEMPLOYED', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='HIGHER', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='INTERMEDIATE', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='SMALL', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='LOWER', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ROUTINE', index=5, number=5,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=2258,
serialized_end=2347,
)
_sym_db.RegisterEnumDescriptor(_NSSEC5)
NSSEC5 = enum_type_wrapper.EnumTypeWrapper(_NSSEC5)
_PWKSTAT = _descriptor.EnumDescriptor(
name='PwkStat',
full_name='synthpop.PwkStat',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='NA', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='EMPLOYEE_FT', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='EMPLOYEE_PT', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='EMPLOYEE_UNSPEC', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='SELF_EMPLOYED', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='PWK_UNEMPLOYED', index=5, number=5,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='RETIRED', index=6, number=6,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='HOMEMAKER', index=7, number=7,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='STUDENT_FT', index=8, number=8,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='LONG_TERM_SICK', index=9, number=9,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='PWK_OTHER', index=10, number=10,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=2350,
serialized_end=2540,
)
_sym_db.RegisterEnumDescriptor(_PWKSTAT)
PwkStat = enum_type_wrapper.EnumTypeWrapper(_PWKSTAT)
_BMI = _descriptor.EnumDescriptor(
name='BMI',
full_name='synthpop.BMI',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='NOT_APPLICABLE', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='UNDERWEIGHT', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='NORMAL', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='OVERWEIGHT', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='OBESE_1', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='OBESE_2', index=5, number=5,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='OBESE_3', index=6, number=6,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=2542,
serialized_end=2651,
)
_sym_db.RegisterEnumDescriptor(_BMI)
BMI = enum_type_wrapper.EnumTypeWrapper(_BMI)
_ACTIVITY = _descriptor.EnumDescriptor(
name='Activity',
full_name='synthpop.Activity',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='RETAIL', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='PRIMARY_SCHOOL', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='SECONDARY_SCHOOL', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='HOME', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='WORK', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=2653,
serialized_end=2737,
)
_sym_db.RegisterEnumDescriptor(_ACTIVITY)
Activity = enum_type_wrapper.EnumTypeWrapper(_ACTIVITY)
FEMALE = 0
MALE = 1
WHITE = 0
BLACK = 1
ASIAN = 2
MIXED = 3
OTHER = 4
UNEMPLOYED = 0
HIGHER = 1
INTERMEDIATE = 2
SMALL = 3
LOWER = 4
ROUTINE = 5
NA = 0
EMPLOYEE_FT = 1
EMPLOYEE_PT = 2
EMPLOYEE_UNSPEC = 3
SELF_EMPLOYED = 4
PWK_UNEMPLOYED = 5
RETIRED = 6
HOMEMAKER = 7
STUDENT_FT = 8
LONG_TERM_SICK = 9
PWK_OTHER = 10
NOT_APPLICABLE = 0
UNDERWEIGHT = 1
NORMAL = 2
OVERWEIGHT = 3
OBESE_1 = 4
OBESE_2 = 5
OBESE_3 = 6
RETAIL = 0
PRIMARY_SCHOOL = 1
SECONDARY_SCHOOL = 2
HOME = 3
WORK = 4
_POPULATION_VENUESPERACTIVITYENTRY = _descriptor.Descriptor(
name='VenuesPerActivityEntry',
full_name='synthpop.Population.VenuesPerActivityEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='synthpop.Population.VenuesPerActivityEntry.key', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='synthpop.Population.VenuesPerActivityEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=b'8\001',
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=292,
serialized_end=369,
)
_POPULATION_INFOPERMSOAENTRY = _descriptor.Descriptor(
name='InfoPerMsoaEntry',
full_name='synthpop.Population.InfoPerMsoaEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='synthpop.Population.InfoPerMsoaEntry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='synthpop.Population.InfoPerMsoaEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=b'8\001',
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=371,
serialized_end=444,
)
_POPULATION = _descriptor.Descriptor(
name='Population',
full_name='synthpop.Population',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='households', full_name='synthpop.Population.households', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='people', full_name='synthpop.Population.people', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='venues_per_activity', full_name='synthpop.Population.venues_per_activity', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='info_per_msoa', full_name='synthpop.Population.info_per_msoa', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lockdown', full_name='synthpop.Population.lockdown', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[_POPULATION_VENUESPERACTIVITYENTRY, _POPULATION_INFOPERMSOAENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=29,
serialized_end=444,
)
_HOUSEHOLD = _descriptor.Descriptor(
name='Household',
full_name='synthpop.Household',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='synthpop.Household.id', index=0,
number=1, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='msoa11cd', full_name='synthpop.Household.msoa11cd', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='orig_hid', full_name='synthpop.Household.orig_hid', index=2,
number=3, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='members', full_name='synthpop.Household.members', index=3,
number=4, type=4, cpp_type=4, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=446,
serialized_end=522,
)
_VENUELIST = _descriptor.Descriptor(
name='VenueList',
full_name='synthpop.VenueList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='venues', full_name='synthpop.VenueList.venues', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=524,
serialized_end=568,
)
_INFOPERMSOA = _descriptor.Descriptor(
name='InfoPerMSOA',
full_name='synthpop.InfoPerMSOA',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='shape', full_name='synthpop.InfoPerMSOA.shape', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='population', full_name='synthpop.InfoPerMSOA.population', index=1,
number=2, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='buildings', full_name='synthpop.InfoPerMSOA.buildings', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='flows_per_activity', full_name='synthpop.InfoPerMSOA.flows_per_activity', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=571,
serialized_end=717,
)
_POINT = _descriptor.Descriptor(
name='Point',
full_name='synthpop.Point',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='longitude', full_name='synthpop.Point.longitude', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='latitude', full_name='synthpop.Point.latitude', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=719,
serialized_end=763,
)
_PERSON = _descriptor.Descriptor(
name='Person',
full_name='synthpop.Person',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='synthpop.Person.id', index=0,
number=1, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='household', full_name='synthpop.Person.household', index=1,
number=2, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='workplace', full_name='synthpop.Person.workplace', index=2,
number=3, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='identifiers', full_name='synthpop.Person.identifiers', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='demographics', full_name='synthpop.Person.demographics', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='employment', full_name='synthpop.Person.employment', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='health', full_name='synthpop.Person.health', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='time_use', full_name='synthpop.Person.time_use', index=7,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='activity_durations', full_name='synthpop.Person.activity_durations', index=8,
number=9, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=766,
serialized_end=1083,
)
_ACTIVITYDURATION = _descriptor.Descriptor(
name='ActivityDuration',
full_name='synthpop.ActivityDuration',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='activity', full_name='synthpop.ActivityDuration.activity', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='duration', full_name='synthpop.ActivityDuration.duration', index=1,
number=2, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1085,
serialized_end=1159,
)
_IDENTIFIERS = _descriptor.Descriptor(
name='Identifiers',
full_name='synthpop.Identifiers',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='pid_census', full_name='synthpop.Identifiers.pid_census', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='pid_tus', full_name='synthpop.Identifiers.pid_tus', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='pid_hse', full_name='synthpop.Identifiers.pid_hse', index=2,
number=3, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='idp', full_name='synthpop.Identifiers.idp', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1161,
serialized_end=1241,
)
_DEMOGRAPHICS = _descriptor.Descriptor(
name='Demographics',
full_name='synthpop.Demographics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='sex', full_name='synthpop.Demographics.sex', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='age_years', full_name='synthpop.Demographics.age_years', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='origin', full_name='synthpop.Demographics.origin', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='socioeconomic_classification', full_name='synthpop.Demographics.socioeconomic_classification', index=3,
number=4, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1244,
serialized_end=1395,
)
_EMPLOYMENT = _descriptor.Descriptor(
name='Employment',
full_name='synthpop.Employment',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='sic1d07', full_name='synthpop.Employment.sic1d07', index=0,
number=1, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='sic2d07', full_name='synthpop.Employment.sic2d07', index=1,
number=2, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='soc2010', full_name='synthpop.Employment.soc2010', index=2,
number=3, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='pwkstat', full_name='synthpop.Employment.pwkstat', index=3,
number=4, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='salary_yearly', full_name='synthpop.Employment.salary_yearly', index=4,
number=5, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='salary_hourly', full_name='synthpop.Employment.salary_hourly', index=5,
number=6, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1398,
serialized_end=1543,
)
_HEALTH = _descriptor.Descriptor(
name='Health',
full_name='synthpop.Health',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='bmi', full_name='synthpop.Health.bmi', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='has_cardiovascular_disease', full_name='synthpop.Health.has_cardiovascular_disease', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='has_diabetes', full_name='synthpop.Health.has_diabetes', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='has_high_blood_pressure', full_name='synthpop.Health.has_high_blood_pressure', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1545,
serialized_end=1672,
)
_TIMEUSE = _descriptor.Descriptor(
name='TimeUse',
full_name='synthpop.TimeUse',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='unknown', full_name='synthpop.TimeUse.unknown', index=0,
number=1, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='work', full_name='synthpop.TimeUse.work', index=1,
number=2, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='school', full_name='synthpop.TimeUse.school', index=2,
number=3, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='shop', full_name='synthpop.TimeUse.shop', index=3,
number=4, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='services', full_name='synthpop.TimeUse.services', index=4,
number=5, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='leisure', full_name='synthpop.TimeUse.leisure', index=5,
number=6, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='escort', full_name='synthpop.TimeUse.escort', index=6,
number=7, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='transport', full_name='synthpop.TimeUse.transport', index=7,
number=8, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='not_home', full_name='synthpop.TimeUse.not_home', index=8,
number=9, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='home', full_name='synthpop.TimeUse.home', index=9,
number=10, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='work_home', full_name='synthpop.TimeUse.work_home', index=10,
number=11, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='home_total', full_name='synthpop.TimeUse.home_total', index=11,
number=12, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1675,
serialized_end=1886,
)
_FLOWS = _descriptor.Descriptor(
name='Flows',
full_name='synthpop.Flows',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='activity', full_name='synthpop.Flows.activity', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='flows', full_name='synthpop.Flows.flows', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1888,
serialized_end=1964,
)
_FLOW = _descriptor.Descriptor(
name='Flow',
full_name='synthpop.Flow',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='venue_id', full_name='synthpop.Flow.venue_id', index=0,
number=1, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='weight', full_name='synthpop.Flow.weight', index=1,
number=2, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1966,
serialized_end=2006,
)
_VENUE = _descriptor.Descriptor(
name='Venue',
full_name='synthpop.Venue',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='synthpop.Venue.id', index=0,
number=1, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='activity', full_name='synthpop.Venue.activity', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='location', full_name='synthpop.Venue.location', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='urn', full_name='synthpop.Venue.urn', index=3,
number=4, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2008,
serialized_end=2113,
)
_LOCKDOWN = _descriptor.Descriptor(
name='Lockdown',
full_name='synthpop.Lockdown',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='start_date', full_name='synthpop.Lockdown.start_date', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='per_day', full_name='synthpop.Lockdown.per_day', index=1,
number=2, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2115,
serialized_end=2162,
)
_POPULATION_VENUESPERACTIVITYENTRY.fields_by_name['value'].message_type = _VENUELIST
_POPULATION_VENUESPERACTIVITYENTRY.containing_type = _POPULATION
_POPULATION_INFOPERMSOAENTRY.fields_by_name['value'].message_type = _INFOPERMSOA
_POPULATION_INFOPERMSOAENTRY.containing_type = _POPULATION
_POPULATION.fields_by_name['households'].message_type = _HOUSEHOLD
_POPULATION.fields_by_name['people'].message_type = _PERSON
_POPULATION.fields_by_name['venues_per_activity'].message_type = _POPULATION_VENUESPERACTIVITYENTRY
_POPULATION.fields_by_name['info_per_msoa'].message_type = _POPULATION_INFOPERMSOAENTRY
_POPULATION.fields_by_name['lockdown'].message_type = _LOCKDOWN
_VENUELIST.fields_by_name['venues'].message_type = _VENUE
_INFOPERMSOA.fields_by_name['shape'].message_type = _POINT
_INFOPERMSOA.fields_by_name['buildings'].message_type = _POINT
_INFOPERMSOA.fields_by_name['flows_per_activity'].message_type = _FLOWS
_PERSON.fields_by_name['identifiers'].message_type = _IDENTIFIERS
_PERSON.fields_by_name['demographics'].message_type = _DEMOGRAPHICS
_PERSON.fields_by_name['employment'].message_type = _EMPLOYMENT
_PERSON.fields_by_name['health'].message_type = _HEALTH
_PERSON.fields_by_name['time_use'].message_type = _TIMEUSE
_PERSON.fields_by_name['activity_durations'].message_type = _ACTIVITYDURATION
_ACTIVITYDURATION.fields_by_name['activity'].enum_type = _ACTIVITY
_DEMOGRAPHICS.fields_by_name['sex'].enum_type = _SEX
_DEMOGRAPHICS.fields_by_name['origin'].enum_type = _ORIGIN
_DEMOGRAPHICS.fields_by_name['socioeconomic_classification'].enum_type = _NSSEC5
_EMPLOYMENT.fields_by_name['pwkstat'].enum_type = _PWKSTAT
_HEALTH.fields_by_name['bmi'].enum_type = _BMI
_FLOWS.fields_by_name['activity'].enum_type = _ACTIVITY
_FLOWS.fields_by_name['flows'].message_type = _FLOW
_VENUE.fields_by_name['activity'].enum_type = _ACTIVITY
_VENUE.fields_by_name['location'].message_type = _POINT
DESCRIPTOR.message_types_by_name['Population'] = _POPULATION
DESCRIPTOR.message_types_by_name['Household'] = _HOUSEHOLD
DESCRIPTOR.message_types_by_name['VenueList'] = _VENUELIST
DESCRIPTOR.message_types_by_name['InfoPerMSOA'] = _INFOPERMSOA
DESCRIPTOR.message_types_by_name['Point'] = _POINT
DESCRIPTOR.message_types_by_name['Person'] = _PERSON
DESCRIPTOR.message_types_by_name['ActivityDuration'] = _ACTIVITYDURATION
DESCRIPTOR.message_types_by_name['Identifiers'] = _IDENTIFIERS
DESCRIPTOR.message_types_by_name['Demographics'] = _DEMOGRAPHICS
DESCRIPTOR.message_types_by_name['Employment'] = _EMPLOYMENT
DESCRIPTOR.message_types_by_name['Health'] = _HEALTH
DESCRIPTOR.message_types_by_name['TimeUse'] = _TIMEUSE
DESCRIPTOR.message_types_by_name['Flows'] = _FLOWS
DESCRIPTOR.message_types_by_name['Flow'] = _FLOW
DESCRIPTOR.message_types_by_name['Venue'] = _VENUE
DESCRIPTOR.message_types_by_name['Lockdown'] = _LOCKDOWN
DESCRIPTOR.enum_types_by_name['Sex'] = _SEX
DESCRIPTOR.enum_types_by_name['Origin'] = _ORIGIN
DESCRIPTOR.enum_types_by_name['NSSEC5'] = _NSSEC5
DESCRIPTOR.enum_types_by_name['PwkStat'] = _PWKSTAT
DESCRIPTOR.enum_types_by_name['BMI'] = _BMI
DESCRIPTOR.enum_types_by_name['Activity'] = _ACTIVITY
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Population = _reflection.GeneratedProtocolMessageType('Population', (_message.Message,), {
'VenuesPerActivityEntry' : _reflection.GeneratedProtocolMessageType('VenuesPerActivityEntry', (_message.Message,), {
'DESCRIPTOR' : _POPULATION_VENUESPERACTIVITYENTRY,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Population.VenuesPerActivityEntry)
})
,
'InfoPerMsoaEntry' : _reflection.GeneratedProtocolMessageType('InfoPerMsoaEntry', (_message.Message,), {
'DESCRIPTOR' : _POPULATION_INFOPERMSOAENTRY,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Population.InfoPerMsoaEntry)
})
,
'DESCRIPTOR' : _POPULATION,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Population)
})
_sym_db.RegisterMessage(Population)
_sym_db.RegisterMessage(Population.VenuesPerActivityEntry)
_sym_db.RegisterMessage(Population.InfoPerMsoaEntry)
Household = _reflection.GeneratedProtocolMessageType('Household', (_message.Message,), {
'DESCRIPTOR' : _HOUSEHOLD,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Household)
})
_sym_db.RegisterMessage(Household)
VenueList = _reflection.GeneratedProtocolMessageType('VenueList', (_message.Message,), {
'DESCRIPTOR' : _VENUELIST,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.VenueList)
})
_sym_db.RegisterMessage(VenueList)
InfoPerMSOA = _reflection.GeneratedProtocolMessageType('InfoPerMSOA', (_message.Message,), {
'DESCRIPTOR' : _INFOPERMSOA,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.InfoPerMSOA)
})
_sym_db.RegisterMessage(InfoPerMSOA)
Point = _reflection.GeneratedProtocolMessageType('Point', (_message.Message,), {
'DESCRIPTOR' : _POINT,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Point)
})
_sym_db.RegisterMessage(Point)
Person = _reflection.GeneratedProtocolMessageType('Person', (_message.Message,), {
'DESCRIPTOR' : _PERSON,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Person)
})
_sym_db.RegisterMessage(Person)
ActivityDuration = _reflection.GeneratedProtocolMessageType('ActivityDuration', (_message.Message,), {
'DESCRIPTOR' : _ACTIVITYDURATION,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.ActivityDuration)
})
_sym_db.RegisterMessage(ActivityDuration)
Identifiers = _reflection.GeneratedProtocolMessageType('Identifiers', (_message.Message,), {
'DESCRIPTOR' : _IDENTIFIERS,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Identifiers)
})
_sym_db.RegisterMessage(Identifiers)
Demographics = _reflection.GeneratedProtocolMessageType('Demographics', (_message.Message,), {
'DESCRIPTOR' : _DEMOGRAPHICS,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Demographics)
})
_sym_db.RegisterMessage(Demographics)
Employment = _reflection.GeneratedProtocolMessageType('Employment', (_message.Message,), {
'DESCRIPTOR' : _EMPLOYMENT,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Employment)
})
_sym_db.RegisterMessage(Employment)
Health = _reflection.GeneratedProtocolMessageType('Health', (_message.Message,), {
'DESCRIPTOR' : _HEALTH,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Health)
})
_sym_db.RegisterMessage(Health)
TimeUse = _reflection.GeneratedProtocolMessageType('TimeUse', (_message.Message,), {
'DESCRIPTOR' : _TIMEUSE,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.TimeUse)
})
_sym_db.RegisterMessage(TimeUse)
Flows = _reflection.GeneratedProtocolMessageType('Flows', (_message.Message,), {
'DESCRIPTOR' : _FLOWS,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Flows)
})
_sym_db.RegisterMessage(Flows)
Flow = _reflection.GeneratedProtocolMessageType('Flow', (_message.Message,), {
'DESCRIPTOR' : _FLOW,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Flow)
})
_sym_db.RegisterMessage(Flow)
Venue = _reflection.GeneratedProtocolMessageType('Venue', (_message.Message,), {
'DESCRIPTOR' : _VENUE,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Venue)
})
_sym_db.RegisterMessage(Venue)
Lockdown = _reflection.GeneratedProtocolMessageType('Lockdown', (_message.Message,), {
'DESCRIPTOR' : _LOCKDOWN,
'__module__' : 'synthpop_pb2'
# @@protoc_insertion_point(class_scope:synthpop.Lockdown)
})
_sym_db.RegisterMessage(Lockdown)
_POPULATION_VENUESPERACTIVITYENTRY._options = None
_POPULATION_INFOPERMSOAENTRY._options = None
# @@protoc_insertion_point(module_scope)
| 40.876871 | 5,185 | 0.748057 | 7,629 | 60,089 | 5.563901 | 0.055446 | 0.051452 | 0.096238 | 0.083964 | 0.721629 | 0.655924 | 0.648621 | 0.637949 | 0.636676 | 0.615473 | 0 | 0.042481 | 0.130307 | 60,089 | 1,469 | 5,186 | 40.904697 | 0.769762 | 0.020503 | 0 | 0.670298 | 1 | 0.007988 | 0.117179 | 0.068601 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.003631 | 0 | 0.003631 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8a0fcfd0c102ebe9a28be1b13f4433c13bbc3403 | 2,402 | py | Python | ufw_config/ufw.py | WeLikeToCodeStuff/UFW-Management-Python | 618c7b90e14b197002ecb80a5aec5bf58ea119e0 | [
"Apache-2.0"
] | null | null | null | ufw_config/ufw.py | WeLikeToCodeStuff/UFW-Management-Python | 618c7b90e14b197002ecb80a5aec5bf58ea119e0 | [
"Apache-2.0"
] | 1 | 2020-11-22T02:16:18.000Z | 2020-11-22T02:22:08.000Z | ufw_config/ufw.py | WeLikeToCodeStuff/UFW-Management-Python | 618c7b90e14b197002ecb80a5aec5bf58ea119e0 | [
"Apache-2.0"
] | null | null | null | import os
from sys import exit
from .generator import UfwConfigGenerator
def main():
os.system("clear")
print(
"\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015"
)
print("Thank you for using the UFW configure tool")
print("Made by NeonDevelopment && Theo Parris")
print("\u00A9 WeLikeToCodeStuff 2020 - Current year")
print(
"\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015"
)
generator = UfwConfigGenerator()
typeofstatus = input(
"Would you like to accept or deny a port? \n(You can also type 'portrange' to specify a portrange to accept/deny): "
)
acceptdeny = typeofstatus.lower()
if acceptdeny == "accept":
acceptport = input("What port would you like to accept?: ")
generator.generate(acceptport, True)
print(f"Port '{acceptport}' has been set to allowed")
exit()
elif acceptdeny == "deny":
denyport = input("What port would you like to deny?: ")
generator.generate(denyport, True)
print(f"Port '{denyport}' has been set to denied")
exit()
elif acceptdeny == "portrange":
rangenum = input("Please type a port range to accept/deny. \nUse the format: startport:stopport Example: 100:200 :")
rangestatus = input("Would you like to accept or deny this port range?: ")
rangetype = input("What type of these ports? tcp/udp :")
rangetypelower = rangetype.lower()
if rangestatus == "accept":
os.system("sudo ufw " + rangestatus + " " + rangenum + " /" + rangetype)
print(f"Port range '{rangenum}' has been set to accepted")
elif rangestatus == "deny":
os.system("sudo ufw " + rangestatus + " " + rangenum + " /" + rangetype)
print(f"Port range '{rangenum}' has been set to denied")
else:
print("That's not a valid option. Please choose 'accept', 'deny', or 'portrange'")
exit()
| 49.020408 | 263 | 0.647794 | 303 | 2,402 | 5.135314 | 0.29703 | 0.526992 | 0.771208 | 1.002571 | 0.470437 | 0.451157 | 0.451157 | 0.416452 | 0.376607 | 0.376607 | 0 | 0.18814 | 0.227727 | 2,402 | 48 | 264 | 50.041667 | 0.650674 | 0 | 0 | 0.209302 | 0 | 0.093023 | 0.553951 | 0.214104 | 0 | 0 | 0 | 0 | 0 | 1 | 0.023256 | false | 0 | 0.069767 | 0 | 0.093023 | 0.232558 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8a2331311c74994d7eeb291c86e00fbadb24d6cd | 476 | py | Python | python/clock/clock.py | fruit-in/exercism-solution | 942f824e2dacd23ee9fd12f5b3e8abed0aeb9581 | [
"MIT"
] | 9 | 2020-12-12T03:29:33.000Z | 2021-08-11T13:08:06.000Z | python/clock/clock.py | fruit-in/exercism-solution | 942f824e2dacd23ee9fd12f5b3e8abed0aeb9581 | [
"MIT"
] | null | null | null | python/clock/clock.py | fruit-in/exercism-solution | 942f824e2dacd23ee9fd12f5b3e8abed0aeb9581 | [
"MIT"
] | null | null | null | class Clock:
def __init__(self, hour, minute):
self.hour = (hour + (minute // 60)) % 24
self.minute = minute % 60
def __repr__(self):
return "{:02d}:{:02d}".format(self.hour, self.minute)
def __eq__(self, other):
return self.hour == other.hour and self.minute == other.minute
def __add__(self, minutes):
return Clock(self.hour, self.minute + minutes)
def __sub__(self, minutes):
return self + (-minutes)
| 28 | 70 | 0.60084 | 60 | 476 | 4.433333 | 0.316667 | 0.150376 | 0.090226 | 0.135338 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028329 | 0.258403 | 476 | 16 | 71 | 29.75 | 0.725212 | 0 | 0 | 0 | 0 | 0 | 0.027311 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0 | 0 | 0.333333 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8a25e4c4bc8bba356ba3442a2417b0847bd58149 | 169 | py | Python | sfa_api/test/conftest.py | wholmgren/solarforecastarbiter-api | defba6e62cbc1e3d3e57f7d709db6882d781dd01 | [
"MIT"
] | null | null | null | sfa_api/test/conftest.py | wholmgren/solarforecastarbiter-api | defba6e62cbc1e3d3e57f7d709db6882d781dd01 | [
"MIT"
] | null | null | null | sfa_api/test/conftest.py | wholmgren/solarforecastarbiter-api | defba6e62cbc1e3d3e57f7d709db6882d781dd01 | [
"MIT"
] | null | null | null | import pytest
from sfa_api import create_app
@pytest.fixture()
def api():
app = create_app(config_name='TestingConfig')
api = app.test_client()
return api
| 16.9 | 49 | 0.715976 | 24 | 169 | 4.833333 | 0.625 | 0.155172 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183432 | 169 | 9 | 50 | 18.777778 | 0.84058 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
8a386c33d4061c4bca933f0a07dc9ac20b2167e5 | 871 | py | Python | learnPythonTheHardWay/src/ex_04.py | pparacch/PlayingWithPython | 9fe75551cae6aeac8730b922a06ff0be85634f4d | [
"MIT"
] | null | null | null | learnPythonTheHardWay/src/ex_04.py | pparacch/PlayingWithPython | 9fe75551cae6aeac8730b922a06ff0be85634f4d | [
"MIT"
] | null | null | null | learnPythonTheHardWay/src/ex_04.py | pparacch/PlayingWithPython | 9fe75551cae6aeac8730b922a06ff0be85634f4d | [
"MIT"
] | null | null | null | #Variables & Names
#Playing around with variables, assignments and basic calculations.
#Python version 2.7.4
cars = 100 #assign to (variable) car the value 100 (integer)
space_in_a_car = 4.0 #assign to (variable) space_in_a_car teh value 4.0 (floating point)
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car #Note! Multiplcation integer by float
average_passengers_per_car = passengers / cars_driven #Note! Division between integres -> integer
print "There are", cars, "cars available."
print "There are only", drivers, "drivers available."
print "There will be", cars_not_driven, "empty cars today."
print "We can transport", carpool_capacity, "people today."
print "We have", passengers, "to carpool today."
print "We need ot put about", average_passengers_per_car, "in each car."
| 37.869565 | 97 | 0.769231 | 132 | 871 | 4.893939 | 0.5 | 0.032508 | 0.037152 | 0.051084 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022697 | 0.140069 | 871 | 22 | 98 | 39.590909 | 0.839786 | 0.338691 | 0 | 0 | 0 | 0 | 0.301056 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.285714 | 0 | null | null | 0.428571 | 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 | 1 | 0 | 3 |
8a56cd43018948d49b0622365534ea3348b75ea7 | 10,867 | py | Python | orquesta/tests/unit/utils/test_schema.py | trstruth/orquesta | e6ebbbeb2c661486067e659dc7552f0a986603a6 | [
"Apache-2.0"
] | 3 | 2020-11-17T21:29:26.000Z | 2021-03-17T13:56:16.000Z | orquesta/tests/unit/utils/test_schema.py | trstruth/orquesta | e6ebbbeb2c661486067e659dc7552f0a986603a6 | [
"Apache-2.0"
] | 5 | 2021-03-02T01:41:36.000Z | 2022-03-08T23:31:31.000Z | orquesta/tests/unit/utils/test_schema.py | trstruth/orquesta | e6ebbbeb2c661486067e659dc7552f0a986603a6 | [
"Apache-2.0"
] | 15 | 2020-08-08T16:21:40.000Z | 2022-03-17T04:45:51.000Z | # Copyright 2019 Extreme Networks, 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.
import unittest
from orquesta import exceptions as exc
from orquesta.utils import schema as schema_util
class SchemaUtilsTest(unittest.TestCase):
def test_get_schema_type(self):
self.assertEqual('object', schema_util.get_schema_type({'type': 'object'}))
self.assertIsNone(schema_util.get_schema_type({}))
self.assertIsNone(schema_util.get_schema_type(None))
def test_check_schema_mergeable(self):
schema_util.check_schema_mergeable(None)
schema_util.check_schema_mergeable({})
schema_util.check_schema_mergeable({'type': 'object'})
schema_util.check_schema_mergeable({'type': 'array'})
def test_check_schema_unmergeable(self):
self.assertRaises(
exc.SchemaIncompatibleError,
schema_util.check_schema_mergeable,
{'type': None}
)
self.assertRaises(
exc.SchemaIncompatibleError,
schema_util.check_schema_mergeable,
{'type': 'string'}
)
def test_check_schemas_compatible(self):
cases = [
{'type': 'object'},
{'type': 'array'},
{'type': None},
{},
None
]
for s in cases:
self.assertEqual(
schema_util.get_schema_type(s),
schema_util.check_schemas_compatible(s, s)
)
def test_check_schemas_incompatible(self):
self.assertRaises(
exc.SchemaIncompatibleError,
schema_util.check_schemas_compatible,
{'type': 'object'},
{'type': 'array'}
)
self.assertRaises(
exc.SchemaIncompatibleError,
schema_util.check_schemas_compatible,
{'type': 'object'},
None
)
self.assertRaises(
exc.SchemaIncompatibleError,
schema_util.check_schemas_compatible,
{'type': 'object'},
{}
)
def test_merge_schema_noop(self):
s = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'description': {'type': 'string'}
}
}
self.assertDictEqual(s, schema_util.merge_schema(s, None))
self.assertDictEqual(s, schema_util.merge_schema(None, s))
self.assertDictEqual({}, schema_util.merge_schema(None, None))
self.assertDictEqual({}, schema_util.merge_schema({}, {}))
def test_merge_schema_blank(self):
s = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'description': {'type': 'string'}
}
}
s_blank_obj = {'type': 'object'}
s_blank_arr = {'type': 'array'}
self.assertDictEqual(s, schema_util.merge_schema(s, s_blank_obj))
self.assertDictEqual(s, schema_util.merge_schema(s_blank_obj, s))
self.assertDictEqual(s, schema_util.merge_schema(s, s_blank_arr))
self.assertDictEqual(s, schema_util.merge_schema(s_blank_arr, s))
self.assertDictEqual({}, schema_util.merge_schema(s_blank_obj, s_blank_obj))
self.assertDictEqual({}, schema_util.merge_schema(s_blank_arr, s_blank_arr))
self.assertDictEqual({}, schema_util.merge_schema(s_blank_obj, s_blank_arr))
self.assertDictEqual({}, schema_util.merge_schema(s_blank_arr, s_blank_obj))
self.assertDictEqual({}, schema_util.merge_schema(None, s_blank_obj))
self.assertDictEqual({}, schema_util.merge_schema(s_blank_obj, None))
self.assertDictEqual({}, schema_util.merge_schema(None, s_blank_arr))
self.assertDictEqual({}, schema_util.merge_schema(s_blank_arr, None))
self.assertDictEqual({}, schema_util.merge_schema({}, s_blank_obj))
self.assertDictEqual({}, schema_util.merge_schema(s_blank_obj, {}))
self.assertDictEqual({}, schema_util.merge_schema({}, s_blank_arr))
self.assertDictEqual({}, schema_util.merge_schema(s_blank_arr, {}))
def test_merge_object_schema(self):
s1 = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'counter': {'type': 'integer'}
},
'required': ['name'],
'additionalProperties': False
}
s2 = {
'type': 'object',
'properties': {
'description': {'type': 'string'},
'counter': {'type': 'number'}
},
'required': ['counter'],
'additionalProperties': True
}
expected = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'description': {'type': 'string'},
'counter': {'type': 'number'}
},
'required': ['counter', 'name'],
'additionalProperties': False
}
self.assertDictEqual(expected, schema_util.merge_schema(s1, s2))
def test_merge_object_schema_overwrite_false(self):
s1 = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'counter': {'type': 'integer'}
},
'required': ['name'],
'additionalProperties': False
}
s2 = {
'type': 'object',
'properties': {
'description': {'type': 'string'},
'counter': {'type': 'number'}
},
'required': ['counter'],
'additionalProperties': True
}
expected = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'description': {'type': 'string'},
'counter': {'type': 'integer'}
},
'required': ['counter', 'name'],
'additionalProperties': False
}
self.assertDictEqual(expected, schema_util.merge_schema(s1, s2, False))
def test_merge_object_schema_patterned_properties(self):
s1 = {
'type': 'object',
'patternProperties': {
'^version$': {'type': 'integer'}
},
'minProperties': 0,
'maxProperties': 10
}
s2 = {
'type': 'object',
'patternProperties': {
'^version$': {'type': 'number'},
'^(?!version)\w+$': {'type': 'string'}
},
'minProperties': 1,
'maxProperties': 100
}
expected = {
'type': 'object',
'patternProperties': {
'^version$': {'type': 'number'},
'^(?!version)\w+$': {'type': 'string'}
},
'minProperties': 1,
'maxProperties': 10
}
self.assertDictEqual(expected, schema_util.merge_schema(s1, s2))
def test_merge_object_schema_patterned_properties_overwrite_false(self):
s1 = {
'type': 'object',
'patternProperties': {
'^version$': {'type': 'integer'}
},
'minProperties': 1,
'maxProperties': 100
}
s2 = {
'type': 'object',
'patternProperties': {
'^version$': {'type': 'number'},
'^(?!version)\w+$': {'type': 'string'}
},
'minProperties': 0,
'maxProperties': 10
}
expected = {
'type': 'object',
'patternProperties': {
'^version$': {'type': 'integer'},
'^(?!version)\w+$': {'type': 'string'}
},
'minProperties': 1,
'maxProperties': 100
}
self.assertDictEqual(expected, schema_util.merge_schema(s1, s2, False))
def test_merge_array_schema(self):
s1 = {
'type': 'array',
'items': [{'type': 'string'}],
'uniqueItems': True,
'minItems': 1,
'maxItems': 10
}
s2 = {
'type': 'array',
'items': [{'type': 'number'}],
'uniqueItems': True,
'minItems': 10,
'maxItems': 100
}
expected = {
'type': 'array',
'items': [{'type': 'number'}],
'uniqueItems': True,
'minItems': 10,
'maxItems': 100
}
self.assertDictEqual(expected, schema_util.merge_schema(s1, s2))
def test_merge_array_schema_overwrite_false(self):
s1 = {
'type': 'array',
'items': [{'type': 'string'}],
'uniqueItems': True,
'minItems': 1,
'maxItems': 10
}
s2 = {
'type': 'array',
'items': [{'type': 'number'}],
'uniqueItems': True,
'minItems': 10,
'maxItems': 100
}
expected = {
'type': 'array',
'items': [{'type': 'string'}],
'uniqueItems': True,
'minItems': 1,
'maxItems': 10
}
self.assertDictEqual(expected, schema_util.merge_schema(s1, s2, False))
def test_merge_array_schema_minimal(self):
s1 = {
'type': 'array',
'items': [{'type': 'string'}]
}
s2 = {
'type': 'array',
'items': [{'type': 'number'}]
}
expected = {
'type': 'array',
'items': [{'type': 'number'}]
}
self.assertDictEqual(expected, schema_util.merge_schema(s1, s2))
def test_merge_array_schema_skip_default(self):
s1 = {
'type': 'array',
'items': [{'type': 'string'}],
'uniqueItems': True,
'minItems': 1,
'maxItems': 10
}
s2 = {
'type': 'array',
'items': [{'type': 'number'}],
'uniqueItems': False,
'minItems': 0,
'maxItems': 0
}
expected = {
'type': 'array',
'items': [{'type': 'number'}]
}
self.assertDictEqual(expected, schema_util.merge_schema(s1, s2))
| 30.69774 | 84 | 0.507224 | 948 | 10,867 | 5.602321 | 0.138186 | 0.080964 | 0.079081 | 0.110714 | 0.807004 | 0.775372 | 0.736208 | 0.680474 | 0.65788 | 0.598946 | 0 | 0.01273 | 0.349406 | 10,867 | 353 | 85 | 30.784703 | 0.738472 | 0.05144 | 0 | 0.613793 | 0 | 0 | 0.180688 | 0 | 0 | 0 | 0 | 0 | 0.127586 | 1 | 0.051724 | false | 0 | 0.010345 | 0 | 0.065517 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8a5e4ff7fe9003c5f56a721ebc52f53f2567997d | 14,796 | py | Python | kivymd/theme_picker.py | CodexLink/InventoryEditor-Data_List_Simplier_AEMB | e14848a1ad9fc5111a17f6d1ae629866274b3b69 | [
"Apache-2.0"
] | 1 | 2021-04-02T23:27:59.000Z | 2021-04-02T23:27:59.000Z | kivymd/theme_picker.py | CodexLink/InventoryEditor-Data_List_Simplier_AEMB | e14848a1ad9fc5111a17f6d1ae629866274b3b69 | [
"Apache-2.0"
] | 2 | 2019-11-14T02:28:38.000Z | 2020-01-06T14:51:01.000Z | kivymd/theme_picker.py | CodexLink/InventoryEditor-Data_List_Simplier_AEMB | e14848a1ad9fc5111a17f6d1ae629866274b3b69 | [
"Apache-2.0"
] | 3 | 2021-03-02T20:15:47.000Z | 2021-06-02T19:36:44.000Z | # -*- coding: utf-8 -*-
from kivy.lang import Builder
from kivy.properties import OptionProperty
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.modalview import ModalView
from kivy.utils import get_color_from_hex
from kivymd.backgroundcolorbehavior import SpecificBackgroundColorBehavior
from kivymd.button import MDIconButton
from kivymd.color_definitions import colors
from kivymd.elevationbehavior import RectangularElevationBehavior
from kivymd.theming import ThemableBehavior
Builder.load_string("""
#:import MDTabbedPanel kivymd.tabs.MDTabbedPanel
#:import MDTab kivymd.tabs.MDTab
<ColorSelector>:
size: dp(40), dp(40)
pos: self.pos
size_hint: (None, None)
canvas:
Color:
rgba: root.rgb_hex(root.color_name)
Ellipse:
size: self.size
pos: self.pos
<AccentColorSelector@ColorSelector>:
on_release: app.theme_cls.accent_palette = root.color_name
<PrimaryColorSelector@ColorSelector>:
on_release: app.theme_cls.primary_palette = root.color_name
<MDThemePicker>:
size_hint: (None, None)
size: dp(284), dp(120)+dp(290)
pos_hint: {'center_x': .5, 'center_y': .5}
canvas:
Color:
rgb: app.theme_cls.primary_color
Rectangle:
size: self.width, dp(120)
pos: root.pos[0], root.pos[1] + root.height-dp(120)
Color:
rgb: app.theme_cls.bg_normal
Rectangle:
size: self.width, dp(290)
pos: root.pos[0], root.pos[1] + root.height-(dp(120)+dp(290))
MDFlatButton:
pos: root.pos[0]+root.size[0]-self.width-dp(10), root.pos[1] + dp(10)
text: "Close"
on_release: root.dismiss()
MDLabel:
font_style: "Headline"
text: "Change theme"
size_hint: (None, None)
size: dp(160), dp(50)
pos_hint: {'center_x': 0.5, 'center_y': 0.9}
theme_text_color: 'Custom'
text_color: root.specific_text_color
MDTabbedPanel:
size_hint: (None, None)
size: root.width, root.height-dp(135)
pos_hint: {'center_x': 0.5, 'center_y': 0.475}
id: tab_panel
tab_display_mode: 'text'
tab_width_mode: 'fixed'
MDTab:
name: 'color'
text: "Theme"
BoxLayout:
spacing: dp(4)
size_hint: (None, None)
size: dp(270), root.height # -dp(120)
pos_hint: {'center_x': 0.532, 'center_y': 0.89}
orientation: 'vertical'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
size: dp(230), dp(40)
pos: self.pos
halign: 'center'
orientation: 'horizontal'
BoxLayout:
PrimaryColorSelector:
color_name: 'Red'
BoxLayout:
PrimaryColorSelector:
color_name: 'Pink'
BoxLayout:
PrimaryColorSelector:
color_name: 'Purple'
BoxLayout:
PrimaryColorSelector:
color_name: 'DeepPurple'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': 0.5}
size: dp(230), dp(40)
pos: self.pos
halign: 'center'
orientation: 'horizontal'
BoxLayout:
PrimaryColorSelector:
color_name: 'Indigo'
BoxLayout:
PrimaryColorSelector:
color_name: 'Blue'
BoxLayout:
PrimaryColorSelector:
color_name: 'LightBlue'
BoxLayout:
PrimaryColorSelector:
color_name: 'Cyan'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': 0.5}
size: dp(230), dp(40)
pos: self.pos
halign: 'center'
orientation: 'horizontal'
padding: 0, 0, 0, dp(1)
BoxLayout:
PrimaryColorSelector:
color_name: 'Teal'
BoxLayout:
PrimaryColorSelector:
color_name: 'Green'
BoxLayout:
PrimaryColorSelector:
color_name: 'LightGreen'
BoxLayout:
PrimaryColorSelector:
color_name: 'Lime'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': 0.5}
size: dp(230), dp(40)
pos: self.pos
orientation: 'horizontal'
halign: 'center'
padding: 0, 0, 0, dp(1)
BoxLayout:
PrimaryColorSelector:
color_name: 'Yellow'
BoxLayout:
PrimaryColorSelector:
color_name: 'Amber'
BoxLayout:
PrimaryColorSelector:
color_name: 'Orange'
BoxLayout:
PrimaryColorSelector:
color_name: 'DeepOrange'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': 0.5}
size: dp(230), dp(40)
#pos: self.pos
orientation: 'horizontal'
padding: 0, 0, 0, dp(1)
BoxLayout:
PrimaryColorSelector:
color_name: 'Brown'
BoxLayout:
PrimaryColorSelector:
color_name: 'Grey'
BoxLayout:
PrimaryColorSelector:
color_name: 'BlueGrey'
BoxLayout:
MDIconButton:
size: dp(40), dp(40)
size_hint: (None, None)
canvas:
Color:
rgba: app.theme_cls.bg_normal
Ellipse:
size: self.size
pos: self.pos
disabled: True
MDTab:
name: 'accent_color'
text: "Accent"
BoxLayout:
spacing: dp(4)
size_hint: (None, None)
size: dp(270), root.height # -dp(120)
pos_hint: {'center_x': 0.532, 'center_y': 0.89}
orientation: 'vertical'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
size: dp(230), dp(40)
pos: self.pos
halign: 'center'
orientation: 'horizontal'
BoxLayout:
AccentColorSelector:
color_name: 'Red'
BoxLayout:
AccentColorSelector:
color_name: 'Pink'
BoxLayout:
AccentColorSelector:
color_name: 'Purple'
BoxLayout:
AccentColorSelector:
color_name: 'DeepPurple'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': 0.5}
size: dp(230), dp(40)
pos: self.pos
halign: 'center'
orientation: 'horizontal'
BoxLayout:
AccentColorSelector:
color_name: 'Indigo'
BoxLayout:
AccentColorSelector:
color_name: 'Blue'
BoxLayout:
AccentColorSelector:
color_name: 'LightBlue'
BoxLayout:
AccentColorSelector:
color_name: 'Cyan'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': 0.5}
size: dp(230), dp(40)
pos: self.pos
halign: 'center'
orientation: 'horizontal'
padding: 0, 0, 0, dp(1)
BoxLayout:
AccentColorSelector:
color_name: 'Teal'
BoxLayout:
AccentColorSelector:
color_name: 'Green'
BoxLayout:
AccentColorSelector:
color_name: 'LightGreen'
BoxLayout:
AccentColorSelector:
color_name: 'Lime'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': 0.5}
size: dp(230), dp(40)
pos: self.pos
orientation: 'horizontal'
halign: 'center'
padding: 0, 0, 0, dp(1)
BoxLayout:
AccentColorSelector:
color_name: 'Yellow'
BoxLayout:
AccentColorSelector:
color_name: 'Amber'
BoxLayout:
AccentColorSelector:
color_name: 'Orange'
BoxLayout:
AccentColorSelector:
color_name: 'DeepOrange'
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': 0.5}
size: dp(230), dp(40)
#pos: self.pos
orientation: 'horizontal'
padding: 0, 0, 0, dp(1)
BoxLayout:
AccentColorSelector:
color_name: 'Brown'
BoxLayout:
AccentColorSelector:
color_name: 'Grey'
BoxLayout:
AccentColorSelector:
color_name: 'BlueGrey'
BoxLayout:
MDIconButton:
size: dp(40), dp(40)
size_hint: (None, None)
canvas:
Color:
rgba: app.theme_cls.bg_normal
Ellipse:
size: self.size
pos: self.pos
disabled: True
MDTab:
name: 'style'
text: "Style"
FloatLayout:
size: self.size
pos: self.pos
BoxLayout:
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': .6}
halign: 'center'
valign: 'center'
spacing: dp(10)
width: dp(210)
height: dp(100)
MDIconButton:
size: dp(100), dp(100)
size_hint: (None, None)
canvas:
Color:
rgba: 1, 1, 1, 1
Ellipse:
size: self.size
pos: self.pos
Color:
rgba: 0, 0, 0, 1
Line:
width: 1.
circle: (self.center_x, self.center_y, dp(50))
on_release: app.theme_cls.theme_style = 'Light'
MDIconButton:
size: dp(100), dp(100)
pos: self.pos
size_hint: (None, None)
canvas:
Color:
rgba: 0, 0, 0, 1
Ellipse:
size: self.size
pos: self.pos
on_release: app.theme_cls.theme_style = 'Dark'
""")
class ColorSelector(MDIconButton):
color_name = OptionProperty(
'Indigo',
options=['Red', 'Pink', 'Purple', 'DeepPurple', 'Indigo', 'Blue',
'LightBlue', 'Cyan', 'Teal', 'Green', 'LightGreen',
'Lime', 'Yellow', 'Amber', 'Orange', 'DeepOrange',
'Brown', 'Grey', 'BlueGrey'])
def rgb_hex(self, col):
return get_color_from_hex(colors[col][self.theme_cls.accent_hue])
class MDThemePicker(ThemableBehavior, FloatLayout, ModalView,
SpecificBackgroundColorBehavior,
RectangularElevationBehavior):
pass
if __name__ == "__main__":
from kivy.app import App
from kivymd.theming import ThemeManager
class ThemePickerApp(App):
theme_cls = ThemeManager()
def build(self):
main_widget = Builder.load_string("""
#:import MDRaisedButton kivymd.button.MDRaisedButton
#:import MDThemePicker kivymd.theme_picker.MDThemePicker
FloatLayout:
MDRaisedButton:
size_hint: None, None
pos_hint: {'center_x': .5, 'center_y': .5}
size: 3 * dp(48), dp(48)
center_x: self.parent.center_x
text: 'Open theme picker'
on_release: MDThemePicker().open()
opposite_colors: True
""")
return main_widget
ThemePickerApp().run()
| 34.978723 | 78 | 0.414166 | 1,148 | 14,796 | 5.182056 | 0.13676 | 0.06354 | 0.044377 | 0.05917 | 0.495714 | 0.472012 | 0.438393 | 0.418222 | 0.404102 | 0.396033 | 0 | 0.033602 | 0.505204 | 14,796 | 422 | 79 | 35.061611 | 0.778992 | 0.001419 | 0 | 0.747253 | 0 | 0.008242 | 0.910039 | 0.061463 | 0 | 0 | 0 | 0 | 0 | 1 | 0.005495 | false | 0.002747 | 0.043956 | 0.002747 | 0.068681 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8a5e6d0a9418d81ef9bbb4782057c3cae7a84761 | 459 | py | Python | cisco-ios-xe/ydk/models/cisco_ios_xe/Cisco_IOS_XE_platform.py | Maikor/ydk-py | b86c4a7c570ae3b2c5557d098420446df5de4929 | [
"ECL-2.0",
"Apache-2.0"
] | 177 | 2016-03-15T17:03:51.000Z | 2022-03-18T16:48:44.000Z | cisco-ios-xe/ydk/models/cisco_ios_xe/Cisco_IOS_XE_platform.py | Maikor/ydk-py | b86c4a7c570ae3b2c5557d098420446df5de4929 | [
"ECL-2.0",
"Apache-2.0"
] | 18 | 2016-03-30T10:45:22.000Z | 2020-07-14T16:28:13.000Z | cisco-ios-xe/ydk/models/cisco_ios_xe/Cisco_IOS_XE_platform.py | Maikor/ydk-py | b86c4a7c570ae3b2c5557d098420446df5de4929 | [
"ECL-2.0",
"Apache-2.0"
] | 85 | 2016-03-16T20:38:57.000Z | 2022-02-22T04:26:02.000Z | """ Cisco_IOS_XE_platform
Cisco XE Native Platform Yang model.
Copyright (c) 2016, 2018 by Cisco Systems, Inc.
All rights reserved.
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.filters import YFilter
from ydk.errors import YError, YModelError
from ydk.errors.error_handler import handle_type_error as _handle_type_error
| 25.5 | 126 | 0.799564 | 65 | 459 | 5.507692 | 0.692308 | 0.078212 | 0.072626 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025189 | 0.135076 | 459 | 17 | 127 | 27 | 0.876574 | 0.281046 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
8a68f7c73209b26becc42d3eec81aecca6abdc95 | 1,341 | py | Python | tests/plugins/precision/test_deepspeed_precision.py | mathemusician/pytorch-lightning | 15fa5389387b3a220bc044dd30eb0be1e8f64944 | [
"Apache-2.0"
] | 3,469 | 2019-03-31T03:09:16.000Z | 2020-01-13T15:06:31.000Z | tests/plugins/precision/test_deepspeed_precision.py | mathemusician/pytorch-lightning | 15fa5389387b3a220bc044dd30eb0be1e8f64944 | [
"Apache-2.0"
] | 524 | 2019-04-02T12:33:39.000Z | 2020-01-14T02:53:33.000Z | tests/plugins/precision/test_deepspeed_precision.py | mathemusician/pytorch-lightning | 15fa5389387b3a220bc044dd30eb0be1e8f64944 | [
"Apache-2.0"
] | 365 | 2019-04-02T22:14:04.000Z | 2020-01-13T17:21:54.000Z | # Copyright The PyTorch Lightning team.
#
# 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 unittest import mock
import pytest
from pytorch_lightning.plugins.precision.deepspeed import DeepSpeedPrecisionPlugin
from pytorch_lightning.utilities.exceptions import MisconfigurationException
def test_invalid_precision_with_deepspeed_precision():
with pytest.raises(ValueError, match="is not supported. `precision` must be one of"):
DeepSpeedPrecisionPlugin(precision=64, amp_type="native")
@mock.patch("pytorch_lightning.plugins.precision.deepspeed._DEEPSPEED_GREATER_EQUAL_0_6", False)
def test_incompatible_bfloat16_raises_error_with_deepspeed_version():
with pytest.raises(MisconfigurationException, match="is not supported with `deepspeed < v0.6`"):
DeepSpeedPrecisionPlugin(precision="bf16", amp_type="native")
| 43.258065 | 100 | 0.797166 | 178 | 1,341 | 5.882022 | 0.55618 | 0.057307 | 0.024833 | 0.030564 | 0.078319 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011986 | 0.129008 | 1,341 | 30 | 101 | 44.7 | 0.884418 | 0.416853 | 0 | 0 | 0 | 0 | 0.226563 | 0.096354 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | true | 0 | 0.363636 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
8a6fb1591e79d0ce86bc7f4d94970462e56a33ed | 24,975 | py | Python | bandit/plugins/injection_shell.py | BackMarket/bandit | 7d6ab4a3e503843df3da389ce32ab30832d71474 | [
"Apache-2.0"
] | null | null | null | bandit/plugins/injection_shell.py | BackMarket/bandit | 7d6ab4a3e503843df3da389ce32ab30832d71474 | [
"Apache-2.0"
] | null | null | null | bandit/plugins/injection_shell.py | BackMarket/bandit | 7d6ab4a3e503843df3da389ce32ab30832d71474 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# SPDX-License-Identifier: Apache-2.0
import ast
import re
import bandit
from bandit.core import cwemap
from bandit.core import test_properties as test
# yuck, regex: starts with a windows drive letter (eg C:)
# or one of our path delimeter characters (/, \, .)
full_path_match = re.compile(r"^(?:[A-Za-z](?=\:)|[\\\/\.])")
def _evaluate_shell_call(context):
no_formatting = isinstance(context.node.args[0], ast.Str)
if no_formatting:
return bandit.LOW
else:
return bandit.HIGH
def gen_config(name):
if name == "shell_injection":
return {
# Start a process using the subprocess module, or one of its
# wrappers.
"subprocess": [
"subprocess.Popen",
"subprocess.call",
"subprocess.check_call",
"subprocess.check_output",
"subprocess.run",
],
# Start a process with a function vulnerable to shell injection.
"shell": [
"os.system",
"os.popen",
"os.popen2",
"os.popen3",
"os.popen4",
"popen2.popen2",
"popen2.popen3",
"popen2.popen4",
"popen2.Popen3",
"popen2.Popen4",
"commands.getoutput",
"commands.getstatusoutput",
],
# Start a process with a function that is not vulnerable to shell
# injection.
"no_shell": [
"os.execl",
"os.execle",
"os.execlp",
"os.execlpe",
"os.execv",
"os.execve",
"os.execvp",
"os.execvpe",
"os.spawnl",
"os.spawnle",
"os.spawnlp",
"os.spawnlpe",
"os.spawnv",
"os.spawnve",
"os.spawnvp",
"os.spawnvpe",
"os.startfile",
],
}
def has_shell(context):
keywords = context.node.keywords
result = False
if "shell" in context.call_keywords:
for key in keywords:
if key.arg == "shell":
val = key.value
if isinstance(val, ast.Num):
result = bool(val.n)
elif isinstance(val, ast.List):
result = bool(val.elts)
elif isinstance(val, ast.Dict):
result = bool(val.keys)
elif isinstance(val, ast.Name) and val.id in ["False", "None"]:
result = False
elif isinstance(val, ast.NameConstant):
result = val.value
else:
result = True
return result
@test.takes_config("shell_injection")
@test.checks("Call")
@test.test_id("B602")
def subprocess_popen_with_shell_equals_true(context, config):
"""**B602: Test for use of popen with shell equals true**
Python possesses many mechanisms to invoke an external executable. However,
doing so may present a security issue if appropriate care is not taken to
sanitize any user provided or variable input.
This plugin test is part of a family of tests built to check for process
spawning and warn appropriately. Specifically, this test looks for the
spawning of a subprocess using a command shell. This type of subprocess
invocation is dangerous as it is vulnerable to various shell injection
attacks. Great care should be taken to sanitize all input in order to
mitigate this risk. Calls of this type are identified by a parameter of
'shell=True' being given.
Additionally, this plugin scans the command string given and adjusts its
reported severity based on how it is presented. If the command string is a
simple static string containing no special shell characters, then the
resulting issue has low severity. If the string is static, but contains
shell formatting characters or wildcards, then the reported issue is
medium. Finally, if the string is computed using Python's string
manipulation or formatting operations, then the reported issue has high
severity. These severity levels reflect the likelihood that the code is
vulnerable to injection.
See also:
- :doc:`../plugins/linux_commands_wildcard_injection`
- :doc:`../plugins/subprocess_without_shell_equals_true`
- :doc:`../plugins/start_process_with_no_shell`
- :doc:`../plugins/start_process_with_a_shell`
- :doc:`../plugins/start_process_with_partial_path`
**Config Options:**
This plugin test shares a configuration with others in the same family,
namely `shell_injection`. This configuration is divided up into three
sections, `subprocess`, `shell` and `no_shell`. They each list Python calls
that spawn subprocesses, invoke commands within a shell, or invoke commands
without a shell (by replacing the calling process) respectively.
This plugin specifically scans for methods listed in `subprocess` section
that have shell=True specified.
.. code-block:: yaml
shell_injection:
# Start a process using the subprocess module, or one of its
wrappers.
subprocess:
- subprocess.Popen
- subprocess.call
:Example:
.. code-block:: none
>> Issue: subprocess call with shell=True seems safe, but may be
changed in the future, consider rewriting without shell
Severity: Low Confidence: High
Location: ./examples/subprocess_shell.py:21
20 subprocess.check_call(['/bin/ls', '-l'], shell=False)
21 subprocess.check_call('/bin/ls -l', shell=True)
22
>> Issue: call with shell=True contains special shell characters,
consider moving extra logic into Python code
Severity: Medium Confidence: High
Location: ./examples/subprocess_shell.py:26
25
26 subprocess.Popen('/bin/ls *', shell=True)
27 subprocess.Popen('/bin/ls %s' % ('something',), shell=True)
>> Issue: subprocess call with shell=True identified, security issue.
Severity: High Confidence: High
Location: ./examples/subprocess_shell.py:27
26 subprocess.Popen('/bin/ls *', shell=True)
27 subprocess.Popen('/bin/ls %s' % ('something',), shell=True)
28 subprocess.Popen('/bin/ls {}'.format('something'), shell=True)
.. seealso::
- https://security.openstack.org
- https://docs.python.org/3/library/subprocess.html#frequently-used-arguments
- https://security.openstack.org/guidelines/dg_use-subprocess-securely.html
- https://security.openstack.org/guidelines/dg_avoid-shell-true.html
.. versionadded:: 0.9.0
""" # noqa: E501
if config and context.call_function_name_qual in config["subprocess"]:
if has_shell(context):
if len(context.call_args) > 0:
sev = _evaluate_shell_call(context)
if sev == bandit.LOW:
return bandit.Issue(
severity=bandit.LOW,
cwe=cwemap.CWEMAP["B602"],
confidence=bandit.HIGH,
text="subprocess call with shell=True seems safe, but "
"may be changed in the future, consider "
"rewriting without shell",
lineno=context.get_lineno_for_call_arg("shell"),
)
else:
return bandit.Issue(
severity=bandit.HIGH,
cwe=cwemap.CWEMAP["B602"],
confidence=bandit.HIGH,
text="subprocess call with shell=True identified, "
"security issue.",
lineno=context.get_lineno_for_call_arg("shell"),
)
@test.takes_config("shell_injection")
@test.checks("Call")
@test.test_id("B603")
def subprocess_without_shell_equals_true(context, config):
"""**B603: Test for use of subprocess without shell equals true**
Python possesses many mechanisms to invoke an external executable. However,
doing so may present a security issue if appropriate care is not taken to
sanitize any user provided or variable input.
This plugin test is part of a family of tests built to check for process
spawning and warn appropriately. Specifically, this test looks for the
spawning of a subprocess without the use of a command shell. This type of
subprocess invocation is not vulnerable to shell injection attacks, but
care should still be taken to ensure validity of input.
Because this is a lesser issue than that described in
`subprocess_popen_with_shell_equals_true` a LOW severity warning is
reported.
See also:
- :doc:`../plugins/linux_commands_wildcard_injection`
- :doc:`../plugins/subprocess_popen_with_shell_equals_true`
- :doc:`../plugins/start_process_with_no_shell`
- :doc:`../plugins/start_process_with_a_shell`
- :doc:`../plugins/start_process_with_partial_path`
**Config Options:**
This plugin test shares a configuration with others in the same family,
namely `shell_injection`. This configuration is divided up into three
sections, `subprocess`, `shell` and `no_shell`. They each list Python calls
that spawn subprocesses, invoke commands within a shell, or invoke commands
without a shell (by replacing the calling process) respectively.
This plugin specifically scans for methods listed in `subprocess` section
that have shell=False specified.
.. code-block:: yaml
shell_injection:
# Start a process using the subprocess module, or one of its
wrappers.
subprocess:
- subprocess.Popen
- subprocess.call
:Example:
.. code-block:: none
>> Issue: subprocess call - check for execution of untrusted input.
Severity: Low Confidence: High
Location: ./examples/subprocess_shell.py:23
22
23 subprocess.check_output(['/bin/ls', '-l'])
24
.. seealso::
- https://security.openstack.org
- https://docs.python.org/3/library/subprocess.html#frequently-used-arguments
- https://security.openstack.org/guidelines/dg_avoid-shell-true.html
- https://security.openstack.org/guidelines/dg_use-subprocess-securely.html
.. versionadded:: 0.9.0
""" # noqa: E501
if config and context.call_function_name_qual in config["subprocess"]:
if not has_shell(context):
return bandit.Issue(
severity=bandit.LOW,
cwe=cwemap.CWEMAP["B603"],
confidence=bandit.HIGH,
text="subprocess call - check for execution of untrusted "
"input.",
lineno=context.get_lineno_for_call_arg("shell"),
)
@test.takes_config("shell_injection")
@test.checks("Call")
@test.test_id("B604")
def any_other_function_with_shell_equals_true(context, config):
"""**B604: Test for any function with shell equals true**
Python possesses many mechanisms to invoke an external executable. However,
doing so may present a security issue if appropriate care is not taken to
sanitize any user provided or variable input.
This plugin test is part of a family of tests built to check for process
spawning and warn appropriately. Specifically, this plugin test
interrogates method calls for the presence of a keyword parameter `shell`
equalling true. It is related to detection of shell injection issues and is
intended to catch custom wrappers to vulnerable methods that may have been
created.
See also:
- :doc:`../plugins/linux_commands_wildcard_injection`
- :doc:`../plugins/subprocess_popen_with_shell_equals_true`
- :doc:`../plugins/subprocess_without_shell_equals_true`
- :doc:`../plugins/start_process_with_no_shell`
- :doc:`../plugins/start_process_with_a_shell`
- :doc:`../plugins/start_process_with_partial_path`
**Config Options:**
This plugin test shares a configuration with others in the same family,
namely `shell_injection`. This configuration is divided up into three
sections, `subprocess`, `shell` and `no_shell`. They each list Python calls
that spawn subprocesses, invoke commands within a shell, or invoke commands
without a shell (by replacing the calling process) respectively.
Specifically, this plugin excludes those functions listed under the
subprocess section, these methods are tested in a separate specific test
plugin and this exclusion prevents duplicate issue reporting.
.. code-block:: yaml
shell_injection:
# Start a process using the subprocess module, or one of its
wrappers.
subprocess: [subprocess.Popen, subprocess.call,
subprocess.check_call, subprocess.check_output
execute_with_timeout]
:Example:
.. code-block:: none
>> Issue: Function call with shell=True parameter identified, possible
security issue.
Severity: Medium Confidence: High
Location: ./examples/subprocess_shell.py:9
8 pop('/bin/gcc --version', shell=True)
9 Popen('/bin/gcc --version', shell=True)
10
.. seealso::
- https://security.openstack.org/guidelines/dg_avoid-shell-true.html
- https://security.openstack.org/guidelines/dg_use-subprocess-securely.html
.. versionadded:: 0.9.0
""" # noqa: E501
if config and context.call_function_name_qual not in config["subprocess"]:
if has_shell(context):
return bandit.Issue(
severity=bandit.MEDIUM,
cwe=cwemap.CWEMAP["B604"],
confidence=bandit.LOW,
text="Function call with shell=True parameter identified, "
"possible security issue.",
lineno=context.get_lineno_for_call_arg("shell"),
)
@test.takes_config("shell_injection")
@test.checks("Call")
@test.test_id("B605")
def start_process_with_a_shell(context, config):
"""**B605: Test for starting a process with a shell**
Python possesses many mechanisms to invoke an external executable. However,
doing so may present a security issue if appropriate care is not taken to
sanitize any user provided or variable input.
This plugin test is part of a family of tests built to check for process
spawning and warn appropriately. Specifically, this test looks for the
spawning of a subprocess using a command shell. This type of subprocess
invocation is dangerous as it is vulnerable to various shell injection
attacks. Great care should be taken to sanitize all input in order to
mitigate this risk. Calls of this type are identified by the use of certain
commands which are known to use shells. Bandit will report a LOW
severity warning.
See also:
- :doc:`../plugins/linux_commands_wildcard_injection`
- :doc:`../plugins/subprocess_without_shell_equals_true`
- :doc:`../plugins/start_process_with_no_shell`
- :doc:`../plugins/start_process_with_partial_path`
- :doc:`../plugins/subprocess_popen_with_shell_equals_true`
**Config Options:**
This plugin test shares a configuration with others in the same family,
namely `shell_injection`. This configuration is divided up into three
sections, `subprocess`, `shell` and `no_shell`. They each list Python calls
that spawn subprocesses, invoke commands within a shell, or invoke commands
without a shell (by replacing the calling process) respectively.
This plugin specifically scans for methods listed in `shell` section.
.. code-block:: yaml
shell_injection:
shell:
- os.system
- os.popen
- os.popen2
- os.popen3
- os.popen4
- popen2.popen2
- popen2.popen3
- popen2.popen4
- popen2.Popen3
- popen2.Popen4
- commands.getoutput
- commands.getstatusoutput
:Example:
.. code-block:: none
>> Issue: Starting a process with a shell: check for injection.
Severity: Low Confidence: Medium
Location: examples/os_system.py:3
2
3 os.system('/bin/echo hi')
.. seealso::
- https://security.openstack.org
- https://docs.python.org/3/library/os.html#os.system
- https://docs.python.org/3/library/subprocess.html#frequently-used-arguments
- https://security.openstack.org/guidelines/dg_use-subprocess-securely.html
.. versionadded:: 0.10.0
""" # noqa: E501
if config and context.call_function_name_qual in config["shell"]:
if len(context.call_args) > 0:
sev = _evaluate_shell_call(context)
if sev == bandit.LOW:
return bandit.Issue(
severity=bandit.LOW,
cwe=cwemap.CWEMAP["B605"],
confidence=bandit.HIGH,
text="Starting a process with a shell: "
"Seems safe, but may be changed in the future, "
"consider rewriting without shell",
)
else:
return bandit.Issue(
severity=bandit.HIGH,
cwe=cwemap.CWEMAP["B605"],
confidence=bandit.HIGH,
text="Starting a process with a shell, possible injection"
" detected, security issue.",
)
@test.takes_config("shell_injection")
@test.checks("Call")
@test.test_id("B606")
def start_process_with_no_shell(context, config):
"""**B606: Test for starting a process with no shell**
Python possesses many mechanisms to invoke an external executable. However,
doing so may present a security issue if appropriate care is not taken to
sanitize any user provided or variable input.
This plugin test is part of a family of tests built to check for process
spawning and warn appropriately. Specifically, this test looks for the
spawning of a subprocess in a way that doesn't use a shell. Although this
is generally safe, it maybe useful for penetration testing workflows to
track where external system calls are used. As such a LOW severity message
is generated.
See also:
- :doc:`../plugins/linux_commands_wildcard_injection`
- :doc:`../plugins/subprocess_without_shell_equals_true`
- :doc:`../plugins/start_process_with_a_shell`
- :doc:`../plugins/start_process_with_partial_path`
- :doc:`../plugins/subprocess_popen_with_shell_equals_true`
**Config Options:**
This plugin test shares a configuration with others in the same family,
namely `shell_injection`. This configuration is divided up into three
sections, `subprocess`, `shell` and `no_shell`. They each list Python calls
that spawn subprocesses, invoke commands within a shell, or invoke commands
without a shell (by replacing the calling process) respectively.
This plugin specifically scans for methods listed in `no_shell` section.
.. code-block:: yaml
shell_injection:
no_shell:
- os.execl
- os.execle
- os.execlp
- os.execlpe
- os.execv
- os.execve
- os.execvp
- os.execvpe
- os.spawnl
- os.spawnle
- os.spawnlp
- os.spawnlpe
- os.spawnv
- os.spawnve
- os.spawnvp
- os.spawnvpe
- os.startfile
:Example:
.. code-block:: none
>> Issue: [start_process_with_no_shell] Starting a process without a
shell.
Severity: Low Confidence: Medium
Location: examples/os-spawn.py:8
7 os.spawnv(mode, path, args)
8 os.spawnve(mode, path, args, env)
9 os.spawnvp(mode, file, args)
.. seealso::
- https://security.openstack.org
- https://docs.python.org/3/library/os.html#os.system
- https://docs.python.org/3/library/subprocess.html#frequently-used-arguments
- https://security.openstack.org/guidelines/dg_use-subprocess-securely.html
.. versionadded:: 0.10.0
""" # noqa: E501
if config and context.call_function_name_qual in config["no_shell"]:
return bandit.Issue(
severity=bandit.LOW,
cwe=cwemap.CWEMAP["B606"],
confidence=bandit.MEDIUM,
text="Starting a process without a shell.",
)
@test.takes_config("shell_injection")
@test.checks("Call")
@test.test_id("B607")
def start_process_with_partial_path(context, config):
"""**B607: Test for starting a process with a partial path**
Python possesses many mechanisms to invoke an external executable. If the
desired executable path is not fully qualified relative to the filesystem
root then this may present a potential security risk.
In POSIX environments, the `PATH` environment variable is used to specify a
set of standard locations that will be searched for the first matching
named executable. While convenient, this behavior may allow a malicious
actor to exert control over a system. If they are able to adjust the
contents of the `PATH` variable, or manipulate the file system, then a
bogus executable may be discovered in place of the desired one. This
executable will be invoked with the user privileges of the Python process
that spawned it, potentially a highly privileged user.
This test will scan the parameters of all configured Python methods,
looking for paths that do not start at the filesystem root, that is, do not
have a leading '/' character.
**Config Options:**
This plugin test shares a configuration with others in the same family,
namely `shell_injection`. This configuration is divided up into three
sections, `subprocess`, `shell` and `no_shell`. They each list Python calls
that spawn subprocesses, invoke commands within a shell, or invoke commands
without a shell (by replacing the calling process) respectively.
This test will scan parameters of all methods in all sections. Note that
methods are fully qualified and de-aliased prior to checking.
.. code-block:: yaml
shell_injection:
# Start a process using the subprocess module, or one of its
wrappers.
subprocess:
- subprocess.Popen
- subprocess.call
# Start a process with a function vulnerable to shell injection.
shell:
- os.system
- os.popen
- popen2.Popen3
- popen2.Popen4
- commands.getoutput
- commands.getstatusoutput
# Start a process with a function that is not vulnerable to shell
injection.
no_shell:
- os.execl
- os.execle
:Example:
.. code-block:: none
>> Issue: Starting a process with a partial executable path
Severity: Low Confidence: High
Location: ./examples/partial_path_process.py:3
2 from subprocess import Popen as pop
3 pop('gcc --version', shell=False)
.. seealso::
- https://security.openstack.org
- https://docs.python.org/3/library/os.html#process-management
.. versionadded:: 0.13.0
"""
if config and len(context.call_args):
if (
context.call_function_name_qual in config["subprocess"]
or context.call_function_name_qual in config["shell"]
or context.call_function_name_qual in config["no_shell"]
):
node = context.node.args[0]
# some calls take an arg list, check the first part
if isinstance(node, ast.List):
node = node.elts[0]
# make sure the param is a string literal and not a var name
if isinstance(node, ast.Str) and not full_path_match.match(node.s):
return bandit.Issue(
severity=bandit.LOW,
cwe=cwemap.CWEMAP["B607"],
confidence=bandit.HIGH,
text="Starting a process with a partial executable path",
)
| 38.013699 | 82 | 0.627908 | 3,025 | 24,975 | 5.094215 | 0.149091 | 0.020701 | 0.017651 | 0.018559 | 0.747242 | 0.729137 | 0.709409 | 0.687476 | 0.66353 | 0.625827 | 0 | 0.010761 | 0.289329 | 24,975 | 656 | 83 | 38.071646 | 0.857457 | 0.650771 | 0 | 0.322581 | 0 | 0 | 0.179212 | 0.013043 | 0 | 0 | 0 | 0 | 0 | 1 | 0.048387 | false | 0 | 0.026882 | 0 | 0.139785 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8a75e89c80d69db20f7f12d342184ca2adfef506 | 227 | py | Python | 070-b-call-function.py | catherinedevlin/just-enough-python | 3e272d37cbe68eed3e90fb472cfb4caf0a571881 | [
"MIT"
] | 5 | 2019-07-25T13:54:44.000Z | 2021-02-05T12:16:53.000Z | 070-b-call-function.py | catherinedevlin/just-enough-python | 3e272d37cbe68eed3e90fb472cfb4caf0a571881 | [
"MIT"
] | null | null | null | 070-b-call-function.py | catherinedevlin/just-enough-python | 3e272d37cbe68eed3e90fb472cfb4caf0a571881 | [
"MIT"
] | null | null | null | # These function calls don't quite work. Fix them!
uniforms = {'Thelma': '4', 'Twi': '21', 'Dottie': '9'}
thelma_number = int uniforms['Thelma']
twi_number = int uniforms['Twi']
sum = thelma_number + twi_number
print(sum)
| 22.7 | 54 | 0.674009 | 33 | 227 | 4.515152 | 0.606061 | 0.187919 | 0.228188 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020942 | 0.15859 | 227 | 9 | 55 | 25.222222 | 0.759162 | 0.215859 | 0 | 0 | 0 | 0 | 0.159091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.