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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8073b3eefddd9b6e88a57a9d493a6e1a085ed023 | 249 | py | Python | xunta/__init__.py | chenxu10/XunTa | 2041239182d578df99b64e85c53a5cd15c3d23b5 | [
"MIT"
] | null | null | null | xunta/__init__.py | chenxu10/XunTa | 2041239182d578df99b64e85c53a5cd15c3d23b5 | [
"MIT"
] | null | null | null | xunta/__init__.py | chenxu10/XunTa | 2041239182d578df99b64e85c53a5cd15c3d23b5 | [
"MIT"
] | null | null | null | from ._version import __version__
from .getint import (
config
)
from .getint.ph import (
daily_job_board,
make_search_urls,
)
from .getint.fref import (
find_referral,
send_email
)
from .passint.training import (
train
) | 13.105263 | 33 | 0.694779 | 31 | 249 | 5.225806 | 0.645161 | 0.185185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.228916 | 249 | 19 | 34 | 13.105263 | 0.84375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.066667 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
8095d0334cf4b93c561d9e8b89945621ef9c0c49 | 135 | py | Python | output/models/sun_data/attr_decl/ad_name/ad_name00110m/ad_name00110m10_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/sun_data/attr_decl/ad_name/ad_name00110m/ad_name00110m10_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/sun_data/attr_decl/ad_name/ad_name00110m/ad_name00110m10_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.sun_data.attr_decl.ad_name.ad_name00110m.ad_name00110m10_xsd.ad_name00110m10 import Root
__all__ = [
"Root",
]
| 22.5 | 107 | 0.8 | 20 | 135 | 4.85 | 0.75 | 0.28866 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157025 | 0.103704 | 135 | 5 | 108 | 27 | 0.644628 | 0 | 0 | 0 | 0 | 0 | 0.02963 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
809750e9170b6c02534a8fe7eea4218ea012aa97 | 401 | py | Python | examples/arctic_duration/bin/train_duration.py | saikrishnarallabandi/python_connectionist | e3f8f92c8de865190ad727951eb2b0e514248afc | [
"Apache-2.0"
] | null | null | null | examples/arctic_duration/bin/train_duration.py | saikrishnarallabandi/python_connectionist | e3f8f92c8de865190ad727951eb2b0e514248afc | [
"Apache-2.0"
] | null | null | null | examples/arctic_duration/bin/train_duration.py | saikrishnarallabandi/python_connectionist | e3f8f92c8de865190ad727951eb2b0e514248afc | [
"Apache-2.0"
] | null | null | null | import os
f = open('etc/txt.done.data.train')
for line in f:
id = line.split('\n')[0].split()[1]
fname = 'dur_feats/' + id + '.dur'
cmd = 'cp ' + fname + ' dur_feats/train'
os.system(cmd)
f = open('etc/txt.done.data.test')
for line in f:
id = line.split('\n')[0].split()[1]
fname = 'dur_feats/' + id + '.dur'
cmd = 'cp ' + fname + ' dur_feats/test'
os.system(cmd)
| 23.588235 | 44 | 0.548628 | 66 | 401 | 3.272727 | 0.363636 | 0.148148 | 0.240741 | 0.101852 | 0.777778 | 0.777778 | 0.601852 | 0.601852 | 0.601852 | 0.601852 | 0 | 0.012987 | 0.23192 | 401 | 16 | 45 | 25.0625 | 0.688312 | 0 | 0 | 0.615385 | 0 | 0 | 0.285 | 0.1125 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.076923 | 0 | 0.076923 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
80996187f086eb636bd4bfa33a95485691dbc5fa | 3,007 | py | Python | pymnn/pip_package/MNN/tools/mnn_fb/QuantizedBiasAdd.py | xhuan28/MNN | 81df3a48d79cbc0b75251d12934345948866f7be | [
"Apache-2.0"
] | 3 | 2019-12-27T01:10:32.000Z | 2021-05-14T08:10:40.000Z | pymnn/pip_package/MNN/tools/mnn_fb/QuantizedBiasAdd.py | xhuan28/MNN | 81df3a48d79cbc0b75251d12934345948866f7be | [
"Apache-2.0"
] | 10 | 2019-07-04T01:40:13.000Z | 2019-10-30T02:38:42.000Z | pymnn/pip_package/MNN/tools/mnn_fb/QuantizedBiasAdd.py | xhuan28/MNN | 81df3a48d79cbc0b75251d12934345948866f7be | [
"Apache-2.0"
] | 1 | 2020-03-10T02:17:47.000Z | 2020-03-10T02:17:47.000Z | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: MNN
import flatbuffers
class QuantizedBiasAdd(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsQuantizedBiasAdd(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = QuantizedBiasAdd()
x.Init(buf, n + offset)
return x
# QuantizedBiasAdd
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# QuantizedBiasAdd
def Bias(self, j):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
a = self._tab.Vector(o)
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# QuantizedBiasAdd
def BiasAsNumpy(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
return 0
# QuantizedBiasAdd
def BiasLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.VectorLen(o)
return 0
# QuantizedBiasAdd
def InputType(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
# QuantizedBiasAdd
def Max(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
# QuantizedBiasAdd
def Min(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
# QuantizedBiasAdd
def OutputType(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
def QuantizedBiasAddStart(builder): builder.StartObject(5)
def QuantizedBiasAddAddBias(builder, bias): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(bias), 0)
def QuantizedBiasAddStartBiasVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def QuantizedBiasAddAddInputType(builder, inputType): builder.PrependInt32Slot(1, inputType, 0)
def QuantizedBiasAddAddMax(builder, max): builder.PrependInt32Slot(2, max, 0)
def QuantizedBiasAddAddMin(builder, min): builder.PrependInt32Slot(3, min, 0)
def QuantizedBiasAddAddOutputType(builder, outputType): builder.PrependInt32Slot(4, outputType, 0)
def QuantizedBiasAddEnd(builder): return builder.EndObject()
| 38.063291 | 139 | 0.693382 | 353 | 3,007 | 5.767705 | 0.223796 | 0.068762 | 0.162083 | 0.154715 | 0.492633 | 0.450393 | 0.410118 | 0.410118 | 0.386542 | 0.386542 | 0 | 0.02381 | 0.203858 | 3,007 | 78 | 140 | 38.551282 | 0.82665 | 0.072165 | 0 | 0.381818 | 1 | 0 | 0.001439 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.309091 | false | 0 | 0.018182 | 0.036364 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
809ec97c5e729099b6ad4f22dd114e1af606dbe0 | 4,145 | py | Python | web/iosblog/settings.py | mrscorpion/MSEasyReader | 68179352d641c6f138dd79b594f8376c94611345 | [
"MIT"
] | 519 | 2016-05-19T16:51:51.000Z | 2021-10-09T15:20:02.000Z | web/iosblog/settings.py | mrscorpion/MSEasyReader | 68179352d641c6f138dd79b594f8376c94611345 | [
"MIT"
] | 8 | 2016-05-12T15:44:28.000Z | 2016-11-01T16:13:16.000Z | web/iosblog/settings.py | everettjf/iOSBlog | 258a9977fb6aba35857f885c68b8672f798b9b26 | [
"MIT"
] | 77 | 2016-05-13T07:36:35.000Z | 2021-04-21T05:34:19.000Z | """
Django settings for iosblog project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if 'IOSBLOGRUNMODE' in os.environ:
RUNMODE = os.environ['IOSBLOGRUNMODE']
else:
RUNMODE = 'develop'
if RUNMODE == 'production':
DEBUG = False
with open('/etc/iosblog/secret_key.txt') as f:
SECRET_KEY = f.read().strip()
else:
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '(3$68-dhb79a%j9fsr+@8g(fbb*3-e1-b6d1voogql&7&0#8mv'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['.iosblog.cc']
# Application definition
INSTALLED_APPS = [
'x123.apps.X123Config',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'oauth2_provider',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'iosblog.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'iosblog.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': os.path.join(BASE_DIR, 'db.cnf')
}
}
}
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'zh-cn'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
],
'PAGE_SIZE': 20,
'DEFAULT_AUTHENTICATION_CLASSES': (
'oauth2_provider.ext.rest_framework.OAuth2Authentication',
)
}
STATIC_ROOT= '/var/www/iosblog/static'
MEDIA_ROOT = '/var/www/iosblog/media'
if DEBUG:
MEDIA_URL = '/media/'
else:
MEDIA_URL = 'http://iosblog.cc/media/'
| 25.58642 | 91 | 0.688299 | 459 | 4,145 | 6.106754 | 0.420479 | 0.078844 | 0.054584 | 0.062433 | 0.174456 | 0.15091 | 0.095255 | 0.095255 | 0.042811 | 0 | 0 | 0.014105 | 0.179011 | 4,145 | 161 | 92 | 25.745342 | 0.80958 | 0.264656 | 0 | 0.073684 | 1 | 0.010526 | 0.547139 | 0.43963 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.052632 | 0.010526 | 0 | 0.010526 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
80bd592c04824682916ce53190af6de1b6d46c54 | 13,914 | py | Python | tests/integration/test_cmsplugins.py | gmmata/djangocms-htmlsitemap | ea4da5c4384bb741fd12b03adc229bfea58050da | [
"BSD-3-Clause"
] | 5 | 2015-09-25T06:50:34.000Z | 2019-07-01T16:11:42.000Z | tests/integration/test_cmsplugins.py | gmmata/djangocms-htmlsitemap | ea4da5c4384bb741fd12b03adc229bfea58050da | [
"BSD-3-Clause"
] | 6 | 2016-07-08T09:39:51.000Z | 2018-08-29T07:45:35.000Z | tests/integration/test_cmsplugins.py | gmmata/djangocms-htmlsitemap | ea4da5c4384bb741fd12b03adc229bfea58050da | [
"BSD-3-Clause"
] | 5 | 2016-07-08T14:40:39.000Z | 2022-02-01T19:44:31.000Z | # -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth.models import User
from django.template import RequestContext
from django.test.client import RequestFactory
from django.utils.html import strip_spaces_between_tags
from django.utils.translation import activate
import pytest
from cms import __version__
from cms.api import add_plugin, create_page, create_title, publish_page
from cms.models import Placeholder
from djangocms_htmlsitemap import cms_plugins
def get_cms_version():
return tuple(map(lambda i: int(i), __version__.split(".")))
if get_cms_version() >= (3, 4):
from cms.plugin_rendering import ContentRenderer
@pytest.mark.django_db
class TestHtmlSitemapPlugin(object):
@pytest.fixture(autouse=True)
def setup_cms(self):
# Creates a request
self.request = self.get_request()
# Creates a test user
self.user = User.objects.create(
username="testuser", is_active=True, is_superuser=True
)
# Creates a basic tree of CMS pages
self.index_page = create_page(
"Index", "index.html", "en", published=True, in_navigation=True
) # noq
try:
# django-cms 3.5+
self.index_page.set_as_homepage()
except AttributeError:
# django-cms < 3.5 defaults the first page as being the home page
pass
self.depth2_page1 = create_page(
"Depth 2 page 1",
"simple.html",
"en",
in_navigation=True,
published=True,
parent=self.index_page,
)
self.depth2_page2 = create_page(
"Depth 2 page 2",
"simple.html",
"en",
in_navigation=False,
published=True,
parent=self.index_page,
)
self.depth3_page1 = create_page(
"Depth 3 page 1",
"simple.html",
"en",
in_navigation=False,
published=True,
parent=self.depth2_page2,
)
self.depth3_page2 = create_page(
"Depth 3 page 2",
"simple.html",
"en",
in_navigation=False,
published=True,
parent=self.depth2_page2,
)
self.depth2_page3 = create_page(
"Depth 2 page 3",
"simple.html",
"en",
in_navigation=False,
published=True,
parent=self.index_page,
)
self.depth2_page4 = create_page(
"Depth 2 page 4",
"simple.html",
"en",
in_navigation=False,
published=True,
parent=self.index_page,
)
self.depth3_page3 = create_page(
"Depth 3 page 3",
"simple.html",
"en",
in_navigation=False,
published=True,
parent=self.depth2_page4,
)
def get_request(self):
factory = RequestFactory()
if settings.USE_I18N:
language = settings.LANGUAGES[0][0]
else:
language = settings.LANGUAGE_CODE
request = factory.get("/")
request.LANGUAGE_CODE = language
request.current_page = None
return request
def render_plugin(self, instance):
context = RequestContext(self.request, {"request": self.request})
if get_cms_version() >= (3, 4):
renderer = ContentRenderer(request=self.request)
return renderer.render_plugin(instance, context)
else:
return instance.render_plugin(context)
def test_can_render_a_simple_tree_of_cms_pages(self):
# Setup
placeholder = Placeholder.objects.create(slot="test")
model_instance = add_plugin(placeholder, cms_plugins.HtmlSitemapPlugin, "en")
# Run
html = self.render_plugin(model_instance)
html = strip_spaces_between_tags(html)
# Check
assert (
html.strip()
== strip_spaces_between_tags(
"""
<div id="sitemap">
<ul>
<li>
<a href="/" title="Index">Index</a>
<ul>
<li><a href="/depth-2-page-1/" title="Depth 2 page 1">Depth 2 page 1</a></li>
<li>
<a href="/depth-2-page-2/" title="Depth 2 page 2">Depth 2 page 2</a>
<ul>
<li><a href="/depth-2-page-2/depth-3-page-1/" title="Depth 3 page 1">Depth 3 page 1</a></li>
<li><a href="/depth-2-page-2/depth-3-page-2/" title="Depth 3 page 2">Depth 3 page 2</a></li>
</ul>
</li>
<li><a href="/depth-2-page-3/" title="Depth 2 page 3">Depth 2 page 3</a></li>
<li>
<a href="/depth-2-page-4/" title="Depth 2 page 4">Depth 2 page 4</a>
<ul>
<li><a href="/depth-2-page-4/depth-3-page-3/" title="Depth 3 page 3">Depth 3 page 3</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
"""
).strip()
)
def test_can_render_a_simple_tree_of_cms_pages_from_a_minimum_depth(self):
# Setup
placeholder = Placeholder.objects.create(slot="test")
model_instance = add_plugin(
placeholder, cms_plugins.HtmlSitemapPlugin, "en", min_depth=2
)
# Run
html = self.render_plugin(model_instance)
html = strip_spaces_between_tags(html)
# Check
assert (
html.strip()
== strip_spaces_between_tags(
"""
<div id="sitemap">
<ul>
<li><a href="/depth-2-page-1/" title="Depth 2 page 1">Depth 2 page 1</a></li>
<li>
<a href="/depth-2-page-2/" title="Depth 2 page 2">Depth 2 page 2</a>
<ul>
<li><a href="/depth-2-page-2/depth-3-page-1/" title="Depth 3 page 1">Depth 3 page 1</a></li>
<li><a href="/depth-2-page-2/depth-3-page-2/" title="Depth 3 page 2">Depth 3 page 2</a></li>
</ul>
</li>
<li><a href="/depth-2-page-3/" title="Depth 2 page 3">Depth 2 page 3</a></li>
<li>
<a href="/depth-2-page-4/" title="Depth 2 page 4">Depth 2 page 4</a>
<ul>
<li><a href="/depth-2-page-4/depth-3-page-3/" title="Depth 3 page 3">Depth 3 page 3</a></li>
</ul>
</li>
</ul>
</div>
"""
).strip()
)
def test_can_render_a_simple_tree_of_cms_pages_to_a_maximum_depth(self):
# Setup
placeholder = Placeholder.objects.create(slot="test")
model_instance = add_plugin(
placeholder, cms_plugins.HtmlSitemapPlugin, "en", max_depth=2
)
# Run
html = self.render_plugin(model_instance)
html = strip_spaces_between_tags(html)
# Check
assert (
html.strip()
== strip_spaces_between_tags(
"""
<div id="sitemap">
<ul>
<li>
<a href="/" title="Index">Index</a>
<ul>
<li><a href="/depth-2-page-1/" title="Depth 2 page 1">Depth 2 page 1</a></li>
<li>
<a href="/depth-2-page-2/" title="Depth 2 page 2">Depth 2 page 2</a>
</li>
<li><a href="/depth-2-page-3/" title="Depth 2 page 3">Depth 2 page 3</a></li>
<li>
<a href="/depth-2-page-4/" title="Depth 2 page 4">Depth 2 page 4</a>
</li>
</ul>
</li>
</ul>
</div>
"""
).strip()
)
def test_can_render_a_simple_tree_of_cms_pages_from_a_minimum_depth_to_a_maximum_depth(
self
):
# Setup
placeholder = Placeholder.objects.create(slot="test")
model_instance = add_plugin(
placeholder, cms_plugins.HtmlSitemapPlugin, "en", min_depth=2, max_depth=2
)
# Run
html = self.render_plugin(model_instance)
html = strip_spaces_between_tags(html)
# Check
assert (
html.strip()
== strip_spaces_between_tags(
"""
<div id="sitemap">
<ul>
<li><a href="/depth-2-page-1/" title="Depth 2 page 1">Depth 2 page 1</a></li>
<li>
<a href="/depth-2-page-2/" title="Depth 2 page 2">Depth 2 page 2</a>
</li>
<li><a href="/depth-2-page-3/" title="Depth 2 page 3">Depth 2 page 3</a></li>
<li>
<a href="/depth-2-page-4/" title="Depth 2 page 4">Depth 2 page 4</a>
</li>
</ul>
</div>
"""
).strip()
)
def test_can_render_a_simple_tree_of_cms_pages_that_are_in_navigation(self):
# Setup
placeholder = Placeholder.objects.create(slot="test")
model_instance = add_plugin(
placeholder, cms_plugins.HtmlSitemapPlugin, "en", in_navigation=True
)
# Run
html = self.render_plugin(model_instance)
html = strip_spaces_between_tags(html)
# Check
assert (
html.strip()
== strip_spaces_between_tags(
"""
<div id="sitemap">
<ul>
<li>
<a href="/" title="Index">Index</a>
<ul>
<li><a href="/depth-2-page-1/" title="Depth 2 page 1">Depth 2 page 1</a></li>
</ul>
</li>
</ul>
</div>
"""
).strip()
)
def test_can_render_a_simple_tree_of_cms_pages_that_are_not_in_navigation(self):
# Setup
placeholder = Placeholder.objects.create(slot="test")
model_instance = add_plugin(
placeholder, cms_plugins.HtmlSitemapPlugin, "en", in_navigation=False
)
# Run
html = self.render_plugin(model_instance)
html = strip_spaces_between_tags(html)
# Check
assert (
html.strip()
== strip_spaces_between_tags(
"""
<div id="sitemap">
<ul>
<li>
<a href="/depth-2-page-2/" title="Depth 2 page 2">Depth 2 page 2</a>
<ul>
<li><a href="/depth-2-page-2/depth-3-page-1/" title="Depth 3 page 1">Depth 3 page 1</a></li>
<li><a href="/depth-2-page-2/depth-3-page-2/" title="Depth 3 page 2">Depth 3 page 2</a></li>
</ul>
</li>
<li><a href="/depth-2-page-3/" title="Depth 2 page 3">Depth 2 page 3</a></li>
<li>
<a href="/depth-2-page-4/" title="Depth 2 page 4">Depth 2 page 4</a>
<ul>
<li><a href="/depth-2-page-4/depth-3-page-3/" title="Depth 3 page 3">Depth 3 page 3</a></li>
</ul>
</li>
</ul>
</div>
"""
).strip()
)
def test_can_render_sitemap_in_other_language(self):
create_title("fr", "Index fr", self.index_page)
create_title("fr", "Niveau 2 Page 1", self.depth2_page1)
publish_page(self.index_page, self.user, "fr")
publish_page(self.depth2_page1, self.user, "fr")
activate("fr")
self.request.LANGUAGE_CODE = "fr"
# Setup
placeholder = Placeholder.objects.create(slot="test")
model_instance = add_plugin(
placeholder, cms_plugins.HtmlSitemapPlugin, "fr", in_navigation=True
)
# Run
html = self.render_plugin(model_instance)
html = strip_spaces_between_tags(html)
# Check
assert (
html.strip()
== strip_spaces_between_tags(
"""
<div id="sitemap">
<ul>
<li>
<a href="/" title="Index fr">Index fr</a>
<ul>
<li>
<a href="/niveau-2-page-1/" title="Niveau 2 Page 1">Niveau 2 Page 1</a>
</li>
</ul>
</li>
</ul>
</div>
"""
).strip()
)
| 35.585678 | 132 | 0.455728 | 1,504 | 13,914 | 4.051197 | 0.098404 | 0.075825 | 0.11981 | 0.057115 | 0.729854 | 0.70622 | 0.70064 | 0.69506 | 0.687182 | 0.687182 | 0 | 0.032152 | 0.429999 | 13,914 | 390 | 133 | 35.676923 | 0.736099 | 0.020699 | 0 | 0.474227 | 0 | 0 | 0.040252 | 0 | 0 | 0 | 0 | 0 | 0.036082 | 1 | 0.056701 | false | 0.005155 | 0.06701 | 0.005155 | 0.149485 | 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 |
80c7abe4da67f8c239ffca9590b6dd4112b9e3a7 | 2,300 | py | Python | Part2/test2.py | ParashRahman/Database-Project | 3a934d82289b58dcf83497b658970b2d336c1fba | [
"Apache-2.0"
] | null | null | null | Part2/test2.py | ParashRahman/Database-Project | 3a934d82289b58dcf83497b658970b2d336c1fba | [
"Apache-2.0"
] | null | null | null | Part2/test2.py | ParashRahman/Database-Project | 3a934d82289b58dcf83497b658970b2d336c1fba | [
"Apache-2.0"
] | null | null | null | #################################
# This file was used to perform the experiments
#
# Tests consist of timing each db type for
# each type of search
################################
from rand import Random
import time
from b_tree import BTree
from hash_table import HashTable
from index_file import IndexFile
current_milli_time = lambda: time.time() * 1000000
def are_equal ( r1, r2, r3 ):
if ( set(r1) == set(r2) ):
print( "r1 == r2" )
if ( set(r2) == set(r3) ):
print( "r2 == r3" )
b = BTree("1.db")
h = HashTable("2.db")
i = IndexFile("3.db", "4.db")
r = Random()
data = r.get_keys_and_values( 100000 )
to_key_search = [data[250][0]]
to_data_search = [data[250][1]]
to_range_search = ('g', 'w')
b.insert( data )
h.insert( data )
i.insert( data )
print "Key Search"
print "b"
start = current_milli_time()
result1 = b.retrieve_using_key( to_key_search )
end = current_milli_time()
print (end - start)
print "h"
start = current_milli_time()
result2 = h.retrieve_using_key( to_key_search )
end = current_milli_time()
print (end - start)
print "i"
start = current_milli_time()
result3 = i.retrieve_using_key( to_key_search )
end = current_milli_time()
print (end - start)
are_equal ( result1, result2, result3 )
print
print "Value Search"
print "b"
start = current_milli_time()
result1 = b.retrieve_using_data_values( to_data_search )
end = current_milli_time()
print (end - start)
print "h"
start = current_milli_time()
result2 = h.retrieve_using_data_values( to_data_search )
end = current_milli_time()
print (end - start)
print "i"
start = current_milli_time()
result3 = i.retrieve_using_data_values( to_data_search )
end = current_milli_time()
print (end - start)
are_equal ( result1, result2, result3 )
print
print "Range Search"
print "b"
start = current_milli_time()
result1 = b.retrieve_range( to_range_search[0], to_range_search[1] )
end = current_milli_time()
print( end - start )
print "h"
start = current_milli_time()
result2 = h.retrieve_range( to_range_search[0], to_range_search[1] )
end = current_milli_time()
print( end - start )
print "i"
start = current_milli_time()
result3 = i.retrieve_range( to_range_search[0], to_range_search[1] )
end = current_milli_time()
print( end - start )
are_equal ( result1, result2, result3 )
| 24.210526 | 68 | 0.695217 | 349 | 2,300 | 4.30659 | 0.203438 | 0.151697 | 0.202262 | 0.125749 | 0.689953 | 0.689953 | 0.689953 | 0.689953 | 0.689953 | 0.689953 | 0 | 0.030976 | 0.157826 | 2,300 | 94 | 69 | 24.468085 | 0.744966 | 0.046957 | 0 | 0.546667 | 0 | 0 | 0.036287 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.066667 | null | null | 0.333333 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
80ca521a31bbc7d2ec7be23fa7aa799237c156ab | 289 | py | Python | Programas do Curso/Desafio 35.py | carvalhopedro22/Programas-em-python-cursos-e-geral- | 970e1ebe6cdd1e31f52dfd60328c2203d4de3ef1 | [
"MIT"
] | null | null | null | Programas do Curso/Desafio 35.py | carvalhopedro22/Programas-em-python-cursos-e-geral- | 970e1ebe6cdd1e31f52dfd60328c2203d4de3ef1 | [
"MIT"
] | null | null | null | Programas do Curso/Desafio 35.py | carvalhopedro22/Programas-em-python-cursos-e-geral- | 970e1ebe6cdd1e31f52dfd60328c2203d4de3ef1 | [
"MIT"
] | null | null | null | a = int(input('Digite o primeiro segmento '))
b = int(input('Digite o segundo segmento: '))
c = int(input('Digite o terceiro segmento '))
if (b - c) < a < (b + c) and (a - c) < b < (a + c) and (a - b) < c < (a + b):
print('Formam um triangulo')
else:
print('Nao formam um triangulo') | 41.285714 | 79 | 0.584775 | 49 | 289 | 3.44898 | 0.387755 | 0.142012 | 0.248521 | 0.266272 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221453 | 289 | 7 | 80 | 41.285714 | 0.751111 | 0 | 0 | 0 | 0 | 0 | 0.424138 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.285714 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
80df99ce512d00741adece3453a3c0cabd879fe8 | 1,220 | py | Python | api/views.py | greenishsea/pt3django | edb884bd8db30a58eaa2b7a3f3a0b6bbc477adef | [
"MIT"
] | null | null | null | api/views.py | greenishsea/pt3django | edb884bd8db30a58eaa2b7a3f3a0b6bbc477adef | [
"MIT"
] | null | null | null | api/views.py | greenishsea/pt3django | edb884bd8db30a58eaa2b7a3f3a0b6bbc477adef | [
"MIT"
] | null | null | null | from rest_framework import generics
from .models import Book, Location
from .serializers import BookSerializer, LocationSerializer
class BookList(generics.ListCreateAPIView):
"""
API endpoint for listing and creating Book objects
"""
queryset = Book.objects.all()
serializer_class = BookSerializer
class LocationList(generics.ListCreateAPIView):
"""
API endpoint for listing and creating Location objects
"""
queryset = Location.objects.all()
serializer_class = LocationSerializer
# TODO unsolved: Wrap response data like {'locations': <data>} .
# Need to check drf serializer generics View's usage
# from django.contrib.auth.models import User
# from rest_framework import viewsets, response, permissions
# from .serializers import UserSerializer
# class UserViewSet(viewsets.ModelViewSet):
# queryset = User.objects.all()
# serializer_class = UserSerializer
# permission_classes = (permissions.IsAuthenticated,)
# def retrieve(self, request, pk=None):
# if pk == 'i':
# return response.Response(UserSerializer(request.user,
# context={'request':request}).data)
# return super(UserViewSet, self).retrieve(request, pk) | 30.5 | 68 | 0.72541 | 129 | 1,220 | 6.813953 | 0.48062 | 0.03413 | 0.068259 | 0.085324 | 0.129693 | 0.129693 | 0.129693 | 0.129693 | 0 | 0 | 0 | 0 | 0.181967 | 1,220 | 40 | 69 | 30.5 | 0.880762 | 0.648361 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
038cbd62320524273a7faa6a7126181a8a582c87 | 2,918 | py | Python | boardinghouse/contrib/invite/models.py | luzfcb/django-boardinghouse | 4b9fc7b0e51b6f72abcd904152b92243cf6f0eb0 | [
"BSD-3-Clause"
] | null | null | null | boardinghouse/contrib/invite/models.py | luzfcb/django-boardinghouse | 4b9fc7b0e51b6f72abcd904152b92243cf6f0eb0 | [
"BSD-3-Clause"
] | null | null | null | boardinghouse/contrib/invite/models.py | luzfcb/django-boardinghouse | 4b9fc7b0e51b6f72abcd904152b92243cf6f0eb0 | [
"BSD-3-Clause"
] | null | null | null | import datetime
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now
# Can't import into the class namespace: we need to do it at the module.
from boardinghouse.base import SharedSchemaModel
UserModel = getattr(settings, 'AUTH_USER_MODEL', 'auth.user')
INVITATION_EXPIRY = getattr(settings, 'INVITATION_EXPIRY', datetime.timedelta(7))
class InvitationQuerySet(models.query.QuerySet):
def not_handled(self):
return self.filter(declined_at=None).filter(accepted_at=None)
def pending(self):
return self.not_handled().filter(
created_at__gte=now() - INVITATION_EXPIRY
)
def not_pending(self):
# Any invitations that have expired, have been accepted or declined.
return self.exclude(pk__in=self.pending())
def expired(self):
return self.not_handled().filter(
created_at__lt=now() - INVITATION_EXPIRY
)
def accepted(self):
return self.exclude(accepted_at=None)
def declined(self):
return self.exclude(declined_at=None)
def for_email(self, email):
return self.filter(email=email)
class Invitation(SharedSchemaModel):
email = models.EmailField(verbose_name=_('Email address'))
sender = models.ForeignKey(UserModel, related_name='sent_invitations')
message = models.TextField()
schema = models.ForeignKey('boardinghouse.schema', related_name='invitations')
redemption_code = models.CharField(max_length=36, null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
# Can we ensure that at most one of these two is not null?
accepted_at = models.DateTimeField(null=True, blank=True)
declined_at = models.DateTimeField(null=True, blank=True)
objects = InvitationQuerySet.as_manager()
class Meta:
ordering = ('created_at',)
app_label = 'invite'
def __unicode__(self):
return '[%s] Invitation to %s from %s to join %s' % (
unicode(self.status), self.email, self.sender, self.schema.name
)
@property
def redeemed(self):
return self.accepted_at or self.declined_at
@property
def declined(self):
return self.declined_at is not None
@property
def accepted(self):
return self.accepted_at is not None
@property
def expired(self):
return self.created_at < now() - INVITATION_EXPIRY
@property
def redeemable(self):
return not (self.expired or self.redeemed)
@property
def status(self):
if self.declined:
return _('DECLINED')
if self.accepted:
return _('ACCEPTED')
if self.expired:
return _('EXPIRED')
return _('PENDING')
@property
def expiry_date(self):
return self.created_at + INVITATION_EXPIRY
| 29.18 | 82 | 0.67889 | 359 | 2,918 | 5.359331 | 0.317549 | 0.06237 | 0.072765 | 0.026507 | 0.202703 | 0.102911 | 0.080042 | 0.040541 | 0 | 0 | 0 | 0.001329 | 0.226525 | 2,918 | 99 | 83 | 29.474747 | 0.85113 | 0.066484 | 0 | 0.211268 | 0 | 0 | 0.06875 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.211268 | false | 0 | 0.084507 | 0.197183 | 0.71831 | 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 |
039912b242f928896006ffe4bf9f5933beb0e18a | 1,960 | py | Python | bouser/castiel/interfaces.py | MarsStirner/bouser | 33bf759448fec4340581f1cc44e7b0b23a2c4e7a | [
"0BSD"
] | null | null | null | bouser/castiel/interfaces.py | MarsStirner/bouser | 33bf759448fec4340581f1cc44e7b0b23a2c4e7a | [
"0BSD"
] | null | null | null | bouser/castiel/interfaces.py | MarsStirner/bouser | 33bf759448fec4340581f1cc44e7b0b23a2c4e7a | [
"0BSD"
] | null | null | null | # -*- coding: utf-8 -*-
from zope.interface import Interface, Attribute, classImplements
__author__ = 'viruzzz-kun'
class ICasService(Interface):
db = Attribute('db', 'Database service')
expiry_time = Attribute('expiry_time', 'Token time to live')
clean_period = Attribute('clean_period', 'How often service should check for expired tokens')
check_duplicate_tokens = Attribute(
'check_duplicate_tokens',
'Should the service raise exception if user already took a token?')
def acquire_token(self, login, password):
"""
Acquire auth token for login / password pair
:param login:
:param password:
:return:
"""
def release_token(self, token):
"""
Release previously acquired token
:param token:
:return:
"""
def check_token(self, token):
"""
Check whether auth token is valid
:param token:
:return:
"""
def prolong_token(self, token):
"""
Make token live longer
:param token:
:return:
"""
class IAuthTokenObject(Interface):
user_id = Attribute('user_id', 'User identifier')
token = Attribute('token', 'Unique authentication token')
deadline = Attribute('deadline', 'Time at which token will expire')
object = Attribute('object', 'IAuthObject')
class IAuthenticator(Interface):
def get_user(self, login, password):
"""
Get authentication object
:param login: user login
:param password: user password
:return: Deferred which fires either object or failure
"""
class IAuthObject(Interface):
user_id = Attribute('user_id', 'User unique id')
login = Attribute('login', 'User login')
groups = Attribute('groups', 'User groups or roles')
def get_description(self):
"""
Get text description of AuthObject
:return: string
"""
| 27.222222 | 97 | 0.619388 | 208 | 1,960 | 5.730769 | 0.403846 | 0.030201 | 0.035235 | 0.031879 | 0.057047 | 0.057047 | 0.057047 | 0 | 0 | 0 | 0 | 0.000705 | 0.27602 | 1,960 | 71 | 98 | 27.605634 | 0.839323 | 0.232143 | 0 | 0 | 0 | 0 | 0.298732 | 0.017433 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0.08 | 0.04 | 0 | 0.88 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
039e9866ef3d93b6082f62f6f2303d421d811b27 | 846 | py | Python | savu/plugins/unregistered/dezinger_old/dezinger_deprecated_tools.py | elainehoml/Savu | e4772704606f71d6803d832084e10faa585e7358 | [
"Apache-2.0"
] | 39 | 2015-03-30T14:03:42.000Z | 2022-03-16T16:50:33.000Z | savu/plugins/unregistered/dezinger_old/dezinger_deprecated_tools.py | elainehoml/Savu | e4772704606f71d6803d832084e10faa585e7358 | [
"Apache-2.0"
] | 670 | 2015-02-11T11:08:09.000Z | 2022-03-21T09:27:57.000Z | savu/plugins/unregistered/dezinger_old/dezinger_deprecated_tools.py | elainehoml/Savu | e4772704606f71d6803d832084e10faa585e7358 | [
"Apache-2.0"
] | 54 | 2015-02-13T14:09:52.000Z | 2022-01-24T13:57:09.000Z | from savu.plugins.plugin_tools import PluginTools
class DezingerDeprecatedTools(PluginTools):
"""A plugin for cleaning x-ray strikes based on statistical evaluation of
the near neighbourhood
"""
def define_parameters(self):
"""
outlier_mu:
visibility: basic
dtype: float
description: Threshold for defecting outliers, greater is less
sensitive.
default: 10.0
kernel_size:
visibility: basic
dtype: int
description: Number of frames included in average.
default: 5
mode:
visibility: intermediate
dtype: int
description: 'output mode, 0=normal 5=zinger strength 6=zinger
yes/no.'
default: 0
"""
| 30.214286 | 77 | 0.560284 | 81 | 846 | 5.802469 | 0.765432 | 0.06383 | 0.085106 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015326 | 0.382979 | 846 | 27 | 78 | 31.333333 | 0.885057 | 0.64539 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
03bda1d222a249c9fd6e62c3dc9d059b6da67f6a | 446 | py | Python | exercises/pt/solution_01_03_02.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 2,085 | 2019-04-17T13:10:40.000Z | 2022-03-30T21:51:46.000Z | exercises/pt/solution_01_03_02.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 79 | 2019-04-18T14:42:55.000Z | 2022-03-07T08:15:43.000Z | exercises/pt/solution_01_03_02.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 361 | 2019-04-17T13:34:32.000Z | 2022-03-28T04:42:45.000Z | # Importar a classe da língua inglesa (English) e criar um objeto nlp
from spacy.lang.en import English
nlp = English()
# Processar o texto
doc = nlp("I like tree kangaroos and narwhals.")
# Uma partição do Doc para "tree kangaroos"
tree_kangaroos = doc[2:4]
print(tree_kangaroos.text)
# Uma partição do Doc para "tree kangaroos and narwhals" (sem incluir o ".")
tree_kangaroos_and_narwhals = doc[2:6]
print(tree_kangaroos_and_narwhals.text)
| 27.875 | 76 | 0.762332 | 72 | 446 | 4.611111 | 0.527778 | 0.274096 | 0.192771 | 0.289157 | 0.198795 | 0.198795 | 0.198795 | 0 | 0 | 0 | 0 | 0.010526 | 0.147982 | 446 | 15 | 77 | 29.733333 | 0.863158 | 0.452915 | 0 | 0 | 0 | 0 | 0.146444 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.285714 | 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 |
03d846ef2e49246219f5f2db6de564d85fab09ce | 547 | py | Python | coders/curso_python/estruturas_controle/desafio_for.py | flaviogf/Cursos | 2b120dbcd24a907121f58482fdcdfa01b164872c | [
"MIT"
] | 2 | 2021-02-20T23:50:07.000Z | 2021-08-15T03:04:35.000Z | coders/curso_python/estruturas_controle/desafio_for.py | flaviogf/Cursos | 2b120dbcd24a907121f58482fdcdfa01b164872c | [
"MIT"
] | 18 | 2019-08-07T02:33:00.000Z | 2021-03-18T22:52:38.000Z | coders/curso_python/estruturas_controle/desafio_for.py | flaviogf/Cursos | 2b120dbcd24a907121f58482fdcdfa01b164872c | [
"MIT"
] | 2 | 2020-09-28T13:00:09.000Z | 2021-12-30T12:21:08.000Z | #!/usr/local/bin/python3
from random import randint
def sortea_numero():
return randint(1, 6)
def eh_impar(numero: float):
return numero % 2 != 0
def acertou(numero_sorteado: float, numero: float):
return numero_sorteado == numero
if __name__ == '__main__':
numero_sorteado = sortea_numero()
for it in range(1, 7):
if eh_impar(it):
continue
if acertou(numero_sorteado, it):
print('ACERTOU!', numero_sorteado)
break
else:
print('NÃO ACERTOU O NUMERO!')
| 18.233333 | 51 | 0.621572 | 69 | 547 | 4.681159 | 0.507246 | 0.216718 | 0.195046 | 0.142415 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017588 | 0.272395 | 547 | 29 | 52 | 18.862069 | 0.79397 | 0.042048 | 0 | 0 | 0 | 0 | 0.070746 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0.058824 | 0.176471 | 0.411765 | 0.117647 | 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 | 1 | 0 | 0 | 0 | 3 |
03e5e5bea3e74c9afe5f069eeee979f0763284b5 | 15,044 | py | Python | tests/test_mod.py | pji/mkname | ebeb4e5158835ac322910a35449a063673c8efc8 | [
"MIT"
] | null | null | null | tests/test_mod.py | pji/mkname | ebeb4e5158835ac322910a35449a063673c8efc8 | [
"MIT"
] | null | null | null | tests/test_mod.py | pji/mkname | ebeb4e5158835ac322910a35449a063673c8efc8 | [
"MIT"
] | null | null | null | """
test_mod
~~~~~~~~
unit tests for the mkname.mod function.
"""
import unittest as ut
from unittest.mock import patch
from mkname import mod
# Test cases.
class AddLetters(ut.TestCase):
def _core_modify_test(self, exp, base_name, mod_fn, roll_values):
"""Core of the name modifier (mod) tests."""
# Test state.
with patch('mkname.mod.roll') as mock_roll:
mock_roll.side_effect = roll_values
# Run test.
act = mod_fn(base_name)
# Determine test result.
self.assertEqual(exp, act)
def add_letters_test(self,
exp,
base_name,
letter_roll,
position_roll,
index_roll=0,
wild_roll=0,
count_roll=0,
index_rolls=(0, 0)):
"""The common code for the standard test of mkname.
add_scifi_letters().
"""
roll_values = [
letter_roll,
position_roll,
index_roll,
wild_roll,
count_roll,
*index_rolls,
]
mod_fn = mod.add_letters
self._core_modify_test(exp, base_name, mod_fn, roll_values)
# add_scifi_letters tests.
def test_addletters_append_letter_when_ends_with_vowel(self):
"""When the given base ends with a vowel, the scifi
letter should be appended to the name if it's added to the
end of the name.
"""
# Expected value.
exp = 'Stevez'
# Test data and state.
base = 'Steve'
letter_roll = 4
position_roll = 6
# Run test and determine result.
self.add_letters_test(exp, base, letter_roll, position_roll)
def test_addletters_prepend_letter_when_starts_with_vowel(self):
"""When the given base name starts with a vowel, the scifi
letter should be prepended to the name if it's added to the
front of the name.
"""
# Expected value.
exp = 'Xadam'
# Test data and state.
base = 'Adam'
letter_roll = 3
position_roll = 1
# Run test and determine result.
self.add_letters_test(exp, base, letter_roll, position_roll)
def test_addletters_replace_end_when_ends_with_consonant(self):
"""When the given base name starts with a consonant, the scifi
letter should replace the first letter if it's added to the
front of the name.
"""
# Expected value.
exp = 'Adaz'
# Test data and state.
base = 'Adam'
letter_roll = 4
position_roll = 6
# Run test and determine result.
self.add_letters_test(exp, base, letter_roll, position_roll)
def test_addletters_replace_random_letter(self):
"""When the given base name starts with a consonant, the scifi
letter should replace the first letter if it's added to the
front of the name.
"""
# Expected value.
exp = 'Kdkm'
# Test data and state.
base = 'Adam'
letter_roll = 1
position_roll = 11
index_roll = 3
wild_roll = 20
count_roll = 3
index_rolls = [1, 3, 3]
# Run test and determine result.
self.add_letters_test(
exp,
base,
letter_roll,
position_roll,
wild_roll,
index_roll,
count_roll,
index_rolls
)
def test_addletters_replace_start_when_starts_with_consonant(self):
"""When the given base name starts with a consonant, the scifi
letter should replace the first letter if it's added to the
front of the name.
"""
# Expected value.
exp = 'Xteve'
# Test data and state.
base = 'Steve'
letter_roll = 3
position_roll = 1
# Run test and determine result.
self.add_letters_test(exp, base, letter_roll, position_roll)
class AddPunctuation(ut.TestCase):
def add_punctuation_test(self,
exp,
name,
rolls,
**kwargs):
"""Run a standard add_punctuation test."""
# Test data and state.
kwargs['name'] = name
with patch('mkname.mod.roll') as mock_roll:
mock_roll.side_effect = rolls
# Run test.
act = mod.add_punctuation(**kwargs)
# Determine test result.
self.assertEqual(exp, act)
def test_add_puctuation(self):
"""Given a name, add a punctuation mark into the name. It
capitalizes the first letter and the letter after the
punctuation mark in the name.
"""
exp = "S'Pam"
name = 'spam'
rolls = [1, 2]
self.add_punctuation_test(exp, name, rolls)
def test_add_puctuation_at_index(self):
"""Given an index, add the punctuation at that index.
"""
exp = "Spa.M"
name = 'spam'
rolls = [3]
index = 3
self.add_punctuation_test(exp, name, rolls, index=index)
def test_add_punctuation_do_not_cap_after_mark(self):
"""If False is passed for cap_after, then the letter after
the mark isn't capitalized."""
exp = "Spa'm"
name = 'spam'
rolls = [1,4]
cap_after = False
self.add_punctuation_test(exp, name, rolls, cap_after=cap_after)
def test_add_punctuation_do_not_cap_before_mark(self):
"""If False is passed for cap_before, then the letter before
the mark isn't capitalized."""
exp = "s'Pam"
name = 'spam'
rolls = [1,2]
cap_before = False
self.add_punctuation_test(exp, name, rolls, cap_before=cap_before)
def test_add_punctuation_start_of_name(self):
"""If the selected position is in front of the name,
add the mark to the beginning of the name.
"""
exp = '-Spam'
name = 'spam'
rolls = [2, 1]
self.add_punctuation_test(exp, name, rolls)
class CompoundNamesTestCase(ut.TestCase):
def test_compound_names(self):
"""Given two names, return a string that combines the two
names.
"""
# Expected value.
exp = 'Dallory'
# Test data and state.
a = 'Donatello'
b = 'Mallory'
# Run test.
act = mod.compound_names(a, b)
# Determine test result.
self.assertEqual(exp, act)
class DoubleLetterTestCase(ut.TestCase):
def test_double_letter(self):
"""Given a name, select a letter in the name and double it."""
# Expected value.
exp = 'Spaam'
# Test data and state.
name = 'Spam'
with patch('mkname.mod.roll') as mock_roll:
mock_roll.return_value = 3
# Run test.
act = mod.double_letter(name)
# Determine test success.
self.assertEqual(exp, act)
def test_double_letter_only_given_letters(self):
"""If given a string of letters, only double a letter that
is in that list."""
# Expected value.
exp = 'Baacon'
# Test data and state.
name = 'Bacon'
letters = 'aeiou'
with patch('mkname.mod.roll') as mock_roll:
mock_roll.return_value = 1
# Run test.
act = mod.double_letter(name, letters)
# Determine test success.
self.assertEqual(exp, act)
def test_double_letter_given_letters_not_in_name(self):
"""If given a string of letters and the name doesn't have
any of those letters, return the name.
'"""
# Expected value.
exp = 'Bacon'
# Test data and state.
name = 'Bacon'
letters = 'kqxz'
with patch('mkname.mod.roll') as mock_roll:
mock_roll.return_value = 1
# Run test.
act = mod.double_letter(name, letters)
# Determine test success.
self.assertEqual(exp, act)
class TranslateLettersTestCase(ut.TestCase):
def test_translate_characters(self):
"""Given a mapping that maps characters in the name to different
characters, return the translated name.
"""
# Expected value.
exp = 'sanatella'
# Test data and state.
name = 'donatello'
char_map = {
'd': 's',
'o': 'a',
}
# Run test.
act = mod.translate_characters(name, char_map)
# Determine test result.
self.assertEqual(exp, act)
class SimpleModifiersTestCase(ut.TestCase):
def _core_modify_test(self, exp, base_name, mod_fn, roll_values):
"""Core of the name modifier (mod) tests."""
# Test state.
with patch('mkname.mod.roll') as mock_roll:
mock_roll.side_effect = roll_values
# Run test.
act = mod_fn(base_name)
# Determine test result.
self.assertEqual(exp, act)
def double_vowel_test(self, exp, base_name, index_roll):
"""The common core for tests of garble()."""
# Test data and state.
roll_values = [
index_roll,
]
mod_fn = mod.double_vowel
self._core_modify_test(exp, base_name, mod_fn, roll_values)
def garble_test(self, exp, base_name, index_roll):
"""The common core for tests of garble()."""
# Test data and state.
roll_values = [
index_roll,
]
mod_fn = mod.garble
self._core_modify_test(exp, base_name, mod_fn, roll_values)
def make_scifi_test(self,
exp,
base_name,
letter_roll,
position_roll,
index_roll=0,
wild_roll=0,
count_roll=0,
index_rolls=(0, 0)):
"""The common code for the standard test of mkname.
add_scifi_letters().
"""
roll_values = [
letter_roll,
position_roll,
index_roll,
wild_roll,
count_roll,
*index_rolls,
]
mod_fn = mod.make_scifi
self._core_modify_test(exp, base_name, mod_fn, roll_values)
def vulcanize_test(self, exp, base_name, roll_values):
"""The common core for tests of garble()."""
# Test data and state.
mod_fn = mod.vulcanize
self._core_modify_test(exp, base_name, mod_fn, roll_values)
# double_vowel tests.
def test_double_vowel(self):
"""Given a base name, double_vowel() should double a vowel
within the name.
"""
# Expected value.
exp = 'Baacon'
# Test data and state.
base = 'Bacon'
index_roll = 1
# Run test and determine result.
self.double_vowel_test(exp, base, index_roll)
# garble tests.
def test_garble(self):
"""Given a base name, garble() should garble it by converting
a section in the middle to base64.
"""
# Expected value.
exp = 'Scaam'
# Test data and state.
base = 'Spam'
index_roll = 2
# Run test and determine result.
self.garble_test(exp, base, index_roll)
# add_scifi_letters tests.
def test_make_scifi_append_letter_when_ends_with_vowel(self):
"""When the given base ends with a vowel, the scifi
letter should be appended to the name if it's added to the
end of the name.
"""
# Expected value.
exp = 'Stevez'
# Test data and state.
base = 'Steve'
letter_roll = 4
position_roll = 6
# Run test and determine result.
self.make_scifi_test(exp, base, letter_roll, position_roll)
def test_make_scifi_prepend_letter_when_starts_with_vowel(self):
"""When the given base name starts with a vowel, the scifi
letter should be prepended to the name if it's added to the
front of the name.
"""
# Expected value.
exp = 'Xadam'
# Test data and state.
base = 'Adam'
letter_roll = 3
position_roll = 1
# Run test and determine result.
self.make_scifi_test(exp, base, letter_roll, position_roll)
def test_make_scifi_replace_end_when_ends_with_consonant(self):
"""When the given base name starts with a consonant, the scifi
letter should replace the first letter if it's added to the
front of the name.
"""
# Expected value.
exp = 'Adaz'
# Test data and state.
base = 'Adam'
letter_roll = 4
position_roll = 6
# Run test and determine result.
self.make_scifi_test(exp, base, letter_roll, position_roll)
def test_make_scifi_replace_random_letter(self):
"""When the given base name starts with a consonant, the scifi
letter should replace the first letter if it's added to the
front of the name.
"""
# Expected value.
exp = 'Kdkm'
# Test data and state.
base = 'Adam'
letter_roll = 1
position_roll = 11
index_roll = 3
wild_roll = 20
count_roll = 3
index_rolls = [1, 3, 3]
# Run test and determine result.
self.make_scifi_test(
exp,
base,
letter_roll,
position_roll,
wild_roll,
index_roll,
count_roll,
index_rolls
)
def test_make_scifi_replace_start_when_starts_with_consonant(self):
"""When the given base name starts with a consonant, the scifi
letter should replace the first letter if it's added to the
front of the name.
"""
# Expected value.
exp = 'Xteve'
# Test data and state.
base = 'Steve'
letter_roll = 3
position_roll = 1
# Run test and determine result.
self.make_scifi_test(exp, base, letter_roll, position_roll)
# vulcanize tests.
def test_vulcanize(self):
"""Given a base name, vulcanize() should prefix the name
with "T''".
"""
# Expected value.
exp = "T'Spam"
# Test data and state.
base = 'Spam'
roll_values = [5, 0]
# Run test and determine result.
self.vulcanize_test(exp, base, roll_values)
def test_vulcanize_not_t(self):
"""One in six times, the prefix should use a letter other than
"T".
"""
# Expected value.
exp = "Su'Spam"
# Test data and state.
base = 'Spam'
roll_values = [6, 8, 0]
# Run test and determine result.
self.vulcanize_test(exp, base, roll_values)
| 29.042471 | 74 | 0.565209 | 1,861 | 15,044 | 4.371306 | 0.098334 | 0.022372 | 0.0311 | 0.045237 | 0.757714 | 0.733006 | 0.709035 | 0.673264 | 0.630854 | 0.611186 | 0 | 0.007009 | 0.355092 | 15,044 | 517 | 75 | 29.098646 | 0.831478 | 0.303111 | 0 | 0.606299 | 0 | 0 | 0.036442 | 0 | 0 | 0 | 0 | 0 | 0.031496 | 1 | 0.125984 | false | 0 | 0.011811 | 0 | 0.161417 | 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 |
ff0da0f85947b73b896743a08621b84bed4cc63c | 62 | py | Python | TheLengthofSequence.py | Arnabsaha6/Snakify | df0c1112ae8a56a275044f786bfd89f746e3ca85 | [
"MIT"
] | null | null | null | TheLengthofSequence.py | Arnabsaha6/Snakify | df0c1112ae8a56a275044f786bfd89f746e3ca85 | [
"MIT"
] | null | null | null | TheLengthofSequence.py | Arnabsaha6/Snakify | df0c1112ae8a56a275044f786bfd89f746e3ca85 | [
"MIT"
] | null | null | null | Code:
len = 0
while int(input()) != 0:
len += 1
print(len) | 12.4 | 24 | 0.548387 | 11 | 62 | 3.090909 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06383 | 0.241935 | 62 | 5 | 25 | 12.4 | 0.659574 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ff1b0eb21f7b697e5b53984149c7dddfe73aeef5 | 4,709 | py | Python | pynetworking/tests/example_functions.py | JulianSobott/networking | 8ef64323ecb45b12ad21df372b28dfb131cec2f6 | [
"Apache-2.0"
] | null | null | null | pynetworking/tests/example_functions.py | JulianSobott/networking | 8ef64323ecb45b12ad21df372b28dfb131cec2f6 | [
"Apache-2.0"
] | 4 | 2019-06-06T19:47:03.000Z | 2020-02-18T17:48:42.000Z | pynetworking/tests/example_functions.py | JulianSobott/pynetworking | 8ef64323ecb45b12ad21df372b28dfb131cec2f6 | [
"Apache-2.0"
] | null | null | null | """
@author: Julian Sobott
@brief:
@description:
@external_use:
@internal_use:
"""
import pynetworking as net
from pynetworking.Logging import logger
class _DummyServerFunctions(net.ServerFunctions):
@staticmethod
def return_client_id() -> int:
return net.ClientManager().get().id
@staticmethod
def no_arg_no_ret() -> None:
return no_arg_no_ret()
@staticmethod
def no_arg_ret() -> bool:
return no_arg_ret()
@staticmethod
def incrementer(number: int) -> int:
return incrementer(number)
@staticmethod
def immutable_args_ret(name: str, age: int, children: tuple) -> str:
return immutable_args_ret(name, age, children)
@staticmethod
def args_ret_object(name, age) -> 'DummyPerson':
return args_ret_object(name, age)
@staticmethod
def class_args_ret(person: 'DummyPerson') -> tuple:
return class_args_ret(person)
@staticmethod
def huge_args_huge_ret(*args):
return huge_args_huge_ret(*args)
@staticmethod
def func_in_func(start: int) -> bool:
return func_in_func(start)
@staticmethod
def many_func_in_func():
return many_func_in_func()
@staticmethod
def server_faculty(number: int) -> int:
return server_faculty(number)
@staticmethod
def client_faculty(number: int) -> int:
return client_faculty(number)
@staticmethod
def get_file(file_path: str, destination_path: str) -> net.File:
return get_file(file_path, destination_path)
class _DummyClientFunctions(net.ServerFunctions):
@staticmethod
def no_arg_no_ret() -> None:
return no_arg_no_ret()
@staticmethod
def no_arg_ret() -> bool:
return no_arg_ret()
@staticmethod
def incrementer(number: int) -> int:
return incrementer(number)
@staticmethod
def immutable_args_ret(name: str, age: int, children: tuple) -> str:
return immutable_args_ret(name, age, children)
@staticmethod
def args_ret_object(name, age) -> 'DummyPerson':
return args_ret_object(name, age)
@staticmethod
def class_args_ret(person: 'DummyPerson') -> tuple:
return class_args_ret(person)
@staticmethod
def huge_args_huge_ret(*args):
return huge_args_huge_ret(*args)
@staticmethod
def func_in_func(start: int) -> bool:
return func_in_func(start)
@staticmethod
def many_func_in_func():
return many_func_in_func()
@staticmethod
def server_faculty(number: int) -> int:
return server_faculty(number)
@staticmethod
def client_faculty(number: int) -> int:
return client_faculty(number)
class DummyServerCommunicator(net.ServerCommunicator):
remote_functions = _DummyServerFunctions
local_functions = _DummyClientFunctions
class DummyMultiServerCommunicator(net.MultiServerCommunicator):
remote_functions = _DummyServerFunctions
local_functions = _DummyClientFunctions
class DummyClientCommunicator(net.ClientCommunicator):
remote_functions = _DummyClientFunctions
local_functions = _DummyServerFunctions
class DummyPerson:
def __init__(self, name, age):
self.name = name
self.age = age
def __eq__(self, other):
if isinstance(other, DummyPerson):
return (self.name == other.name
and self.age == other.age)
def no_arg_no_ret() -> None:
print("no_arg_no_ret() called")
def no_arg_ret() -> bool:
print("no_arg_ret() called")
return True
def incrementer(number: int) -> int:
return number + 1
def immutable_args_ret(name: str, age: int, children: tuple) -> str:
return f"{name} is {age} old and has {len(children)}: {children}"
def args_ret_object(name, age) -> DummyPerson:
return DummyPerson(name, age)
def class_args_ret(person: DummyPerson) -> tuple:
name = person.name
age = person.age
return name, age
def huge_args_huge_ret(*args):
return args
def func_in_func(start: int) -> bool:
ret = net.ClientManager().get().remote_functions.incrementer(start)
return ret + 1
def many_func_in_func():
return net.ClientManager().get().remote_functions.client_faculty(5)
def server_faculty(number: int) -> int:
if number <= 1:
return number
return number * net.ClientManager().get().remote_functions.client_faculty(number - 1)
def client_faculty(number: int) -> int:
if number <= 1:
return number
return number * DummyServerCommunicator.remote_functions.server_faculty(number - 1)
def get_file(file_path: str, destination_path: str) -> net.File:
return net.File(file_path, destination_path)
| 23.903553 | 89 | 0.68677 | 570 | 4,709 | 5.403509 | 0.140351 | 0.116883 | 0.032468 | 0.040909 | 0.713312 | 0.67987 | 0.650649 | 0.542857 | 0.52987 | 0.52987 | 0 | 0.001894 | 0.215332 | 4,709 | 196 | 90 | 24.02551 | 0.831664 | 0.016139 | 0 | 0.696 | 0 | 0 | 0.030277 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.304 | false | 0 | 0.016 | 0.24 | 0.72 | 0.016 | 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 |
2060731b0b281b4a91fe4a9b690d5d62ac92f3dd | 725 | py | Python | Reports_ipynb/my_callbacks.py | Rashmeet09/Autotagging_music | 5842cfe4076835ab64cf3eeb0ab484b9057d35c7 | [
"MIT"
] | null | null | null | Reports_ipynb/my_callbacks.py | Rashmeet09/Autotagging_music | 5842cfe4076835ab64cf3eeb0ab484b9057d35c7 | [
"MIT"
] | null | null | null | Reports_ipynb/my_callbacks.py | Rashmeet09/Autotagging_music | 5842cfe4076835ab64cf3eeb0ab484b9057d35c7 | [
"MIT"
] | null | null | null | import keras
from sklearn.metrics import roc_auc_score
auc_score = 0.0
class Histories(keras.callbacks.Callback):
def on_train_begin(self, logs={}):
self.aucs = []
#self.losses = []
def on_train_end(self, logs={}):
return
def on_epoch_begin(self, epoch, logs={}):
global auc_score
print("AUC:",auc_score)
return
def on_epoch_end(self, epoch, logs={}):
global auc_score
#self.losses.append(logs.get('loss'))
y_pred = self.model.predict(self.model.validation_data[0])
auc_score = roc_auc_score(self.model.validation_data[1], y_pred)
self.aucs.append(auc_score)
return
def on_batch_begin(self, batch, logs={}):
return
def on_batch_end(self, batch, logs={}):
return
| 21.969697 | 67 | 0.695172 | 110 | 725 | 4.345455 | 0.336364 | 0.133891 | 0.09205 | 0.062762 | 0.192469 | 0.112971 | 0 | 0 | 0 | 0 | 0 | 0.006623 | 0.166897 | 725 | 32 | 68 | 22.65625 | 0.784768 | 0.071724 | 0 | 0.318182 | 0 | 0 | 0.005961 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.090909 | 0.136364 | 0.636364 | 0.045455 | 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 |
206398ed24521905a33c77cb95589eb30a188e67 | 140 | py | Python | tests/schema_mapping/expected/generated_example9.py | loyada/typed-py | 8f946ed0cddb38bf7fd463a4c8111a592ccae31a | [
"MIT"
] | 14 | 2018-02-14T13:28:47.000Z | 2022-02-12T08:03:21.000Z | tests/schema_mapping/expected/generated_example9.py | loyada/typed-py | 8f946ed0cddb38bf7fd463a4c8111a592ccae31a | [
"MIT"
] | 142 | 2017-11-22T14:02:33.000Z | 2022-03-23T21:26:29.000Z | tests/schema_mapping/expected/generated_example9.py | loyada/typed-py | 8f946ed0cddb38bf7fd463a4c8111a592ccae31a | [
"MIT"
] | 4 | 2017-12-14T16:46:45.000Z | 2021-12-15T16:33:31.000Z | from typedpy import *
class Example1(Structure):
D = Map(items=[String(), Integer()], default=lambda: {'abc': 0})
_required = []
| 17.5 | 68 | 0.621429 | 16 | 140 | 5.375 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017699 | 0.192857 | 140 | 7 | 69 | 20 | 0.743363 | 0 | 0 | 0 | 0 | 0 | 0.021429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2065e39c0892636b978d596de49b975b4ab47ea2 | 99 | py | Python | Infosys Assignments/11.4(monthly pay).py | DivyaMaddipudi/Infosyscc | 8792cb89df36efc42bdd335c7be6079fcea95be7 | [
"MIT"
] | null | null | null | Infosys Assignments/11.4(monthly pay).py | DivyaMaddipudi/Infosyscc | 8792cb89df36efc42bdd335c7be6079fcea95be7 | [
"MIT"
] | null | null | null | Infosys Assignments/11.4(monthly pay).py | DivyaMaddipudi/Infosyscc | 8792cb89df36efc42bdd335c7be6079fcea95be7 | [
"MIT"
] | null | null | null | hours = 40
pay_rate = 400
no_weeks = 4
monthly_pay = hours * pay_rate *no_weeks
print(monthly_pay)
| 16.5 | 40 | 0.757576 | 18 | 99 | 3.833333 | 0.555556 | 0.202899 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072289 | 0.161616 | 99 | 5 | 41 | 19.8 | 0.759036 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2068de62e8a5ae249e41772b818979a769ce1f65 | 359 | py | Python | py-misc/result_record.py | thehemen/dc-contest-2021-r2 | 601ec2dbdf410f91b573e9ad9aee6188b588ec6a | [
"MIT"
] | null | null | null | py-misc/result_record.py | thehemen/dc-contest-2021-r2 | 601ec2dbdf410f91b573e9ad9aee6188b588ec6a | [
"MIT"
] | null | null | null | py-misc/result_record.py | thehemen/dc-contest-2021-r2 | 601ec2dbdf410f91b573e9ad9aee6188b588ec6a | [
"MIT"
] | null | null | null | import json
class ResultRecord:
def __init__(self, raw_data, pretty_print):
self.data_dict = json.loads(raw_data)
self.lang_code = self.data_dict['lang_code']
self.category = self.data_dict['category']
self.__pretty_print = pretty_print
def __repr__(self):
return self.__pretty_print.pformat(self.data_dict)
| 27.615385 | 58 | 0.693593 | 48 | 359 | 4.6875 | 0.395833 | 0.195556 | 0.213333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208914 | 359 | 12 | 59 | 29.916667 | 0.792254 | 0 | 0 | 0 | 0 | 0 | 0.047354 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0.111111 | 0.555556 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 3 |
20778b92ccae477a7ce93ea228f7a46d982bf470 | 498 | py | Python | Phase-3/Python Challenge/Day-88.py | CodedLadiesInnovateTech/python-challenges | 22ce26c68fea6c7c243ada831e47c52e27a62127 | [
"MIT"
] | 11 | 2020-05-11T08:41:21.000Z | 2022-02-27T08:21:37.000Z | Phase-3/Python Challenge/Day-88.py | CodedLadiesInnovateTech/python-challenges | 22ce26c68fea6c7c243ada831e47c52e27a62127 | [
"MIT"
] | 9 | 2020-05-12T10:46:06.000Z | 2020-05-28T17:37:19.000Z | Phase-3/Python Challenge/Day-88.py | CodedLadiesInnovateTech/python-challenges | 22ce26c68fea6c7c243ada831e47c52e27a62127 | [
"MIT"
] | 44 | 2020-05-10T20:53:32.000Z | 2021-04-25T18:47:08.000Z | '''
1. Write a Python program to find three numbers from an array such that the sum of three numbers equal to a given number
Input : [1, 0, -1, 0, -2, 2], 0)
Output : [[-2, -1, 1, 2], [-2, 0, 0, 2], [-1, 0, 0, 1]]
2. Write a Python program to compute and return the square root of a given 'integer'.
Input : 16
Output : 4
Note : The returned value will be an 'integer'
3. Write a Python program to find the single number in a list that doesn't occur twice
Input : [5, 3, 4, 3, 4]
Output : 5
'''
| 31.125 | 120 | 0.654618 | 99 | 498 | 3.292929 | 0.464646 | 0.055215 | 0.110429 | 0.174847 | 0.217791 | 0.153374 | 0 | 0 | 0 | 0 | 0 | 0.079897 | 0.220884 | 498 | 15 | 121 | 33.2 | 0.760309 | 0.97992 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
20810687c51cbb1a65e77504b29548d915b2e407 | 171 | py | Python | 02_Python/functions.py | DaviNakamuraCardoso/Harvard-CS50-Web-Programming | afec745eede41f7b294c3ee6ebaff9ac042e5e4c | [
"MIT"
] | null | null | null | 02_Python/functions.py | DaviNakamuraCardoso/Harvard-CS50-Web-Programming | afec745eede41f7b294c3ee6ebaff9ac042e5e4c | [
"MIT"
] | null | null | null | 02_Python/functions.py | DaviNakamuraCardoso/Harvard-CS50-Web-Programming | afec745eede41f7b294c3ee6ebaff9ac042e5e4c | [
"MIT"
] | null | null | null | def main():
for i in range(10):
print(f"The square of {i} is {square(i)}")
return
def square(n):
return n**2
if __name__ == '__main__':
main()
| 13.153846 | 50 | 0.54386 | 27 | 171 | 3.148148 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024793 | 0.292398 | 171 | 12 | 51 | 14.25 | 0.677686 | 0 | 0 | 0 | 0 | 0 | 0.233918 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.125 | 0.5 | 0.125 | 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 | 1 | 0 | 0 | 0 | 3 |
20cdc100a9e818436c6d7a4af295eb66db9c99f4 | 499 | py | Python | memorytestgame/example.config.py | bradcornford/Memory-Test-Game | 605fd5fef22b0314e381f36d109e2c991ad4935f | [
"MIT"
] | null | null | null | memorytestgame/example.config.py | bradcornford/Memory-Test-Game | 605fd5fef22b0314e381f36d109e2c991ad4935f | [
"MIT"
] | null | null | null | memorytestgame/example.config.py | bradcornford/Memory-Test-Game | 605fd5fef22b0314e381f36d109e2c991ad4935f | [
"MIT"
] | null | null | null | game = {
'leds': (
# GPIO05 - Pin 29
5,
# GPIO12 - Pin 32
12,
# GPIO17 - Pin 11
17,
# GPIO22 - Pin 15
22,
# GPIO25 - Pin 22
25
),
'switches': (
# GPIO06 - Pin 31
6,
# GPIO13 - Pin 33
13,
# GPIO19 - Pin 35
19,
# GPIO23 - Pin 16
23,
# GPIO24 - Pin 18
24
),
'countdown': 5,
'game_time': 60,
'score_increment': 1
}
| 16.633333 | 25 | 0.362725 | 51 | 499 | 3.509804 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.26383 | 0.529058 | 499 | 29 | 26 | 17.206897 | 0.497872 | 0.318637 | 0 | 0.105263 | 0 | 0 | 0.136778 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
20f15d7ee621c7bf94dfc07650c5dfbdbae8cee9 | 507 | py | Python | carnival/plugins.py | carnival-org/carnival | f7c272a4841db844fc0b165e94c5d3a76d24109f | [
"MIT"
] | 4 | 2020-05-15T12:32:30.000Z | 2022-02-23T11:00:06.000Z | carnival/plugins.py | a1fred/carnival | 178985cc89a8754bcca6381cf0225892f7795b69 | [
"MIT"
] | null | null | null | carnival/plugins.py | a1fred/carnival | 178985cc89a8754bcca6381cf0225892f7795b69 | [
"MIT"
] | 1 | 2020-01-31T16:59:08.000Z | 2020-01-31T16:59:08.000Z | import typing
import importlib
import pkgutil
def discover_plugins() -> typing.Dict[str, typing.Any]:
"""
Get modules, name starting with carnival_
"""
discovered_plugins: typing.Dict[str, typing.Any] = {}
for finder, name, ispkg in pkgutil.iter_modules():
if name.startswith('carnival_') or name == 'carnival':
if name != 'carnival_tasks' and ispkg is True:
discovered_plugins[name] = importlib.import_module(name)
return discovered_plugins
| 26.684211 | 72 | 0.670611 | 60 | 507 | 5.516667 | 0.516667 | 0.154079 | 0.102719 | 0.120846 | 0.175227 | 0.175227 | 0 | 0 | 0 | 0 | 0 | 0 | 0.224852 | 507 | 18 | 73 | 28.166667 | 0.842239 | 0.080868 | 0 | 0 | 0 | 0 | 0.068889 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | true | 0 | 0.4 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
20f52468dc7cc0df888624bf41be0071c5be23dc | 413 | py | Python | adventofcode_2015/day01_part1.py | vesche/snippets | 7a9d598df99c26c4e0c63669f9f95a94eeed0d08 | [
"Unlicense"
] | 7 | 2016-01-03T19:42:07.000Z | 2018-10-23T14:03:12.000Z | adventofcode_2015/day01_part1.py | vesche/snippets | 7a9d598df99c26c4e0c63669f9f95a94eeed0d08 | [
"Unlicense"
] | null | null | null | adventofcode_2015/day01_part1.py | vesche/snippets | 7a9d598df99c26c4e0c63669f9f95a94eeed0d08 | [
"Unlicense"
] | 1 | 2018-03-09T08:52:01.000Z | 2018-03-09T08:52:01.000Z | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Advent of Code, Day 01 - Part 1
# https://github.com/vesche
#
def main():
final_floor = 0
with open("day01_input.txt", 'r') as f:
for floor in f.read():
if floor == '(':
final_floor += 1
elif floor == ')':
final_floor -= 1
print final_floor
if __name__ == "__main__":
main()
| 16.52 | 43 | 0.498789 | 53 | 413 | 3.641509 | 0.716981 | 0.207254 | 0.15544 | 0.165803 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0369 | 0.343826 | 413 | 24 | 44 | 17.208333 | 0.675277 | 0.244552 | 0 | 0 | 0 | 0 | 0.084967 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.090909 | 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 |
4545b2cf32aa30c7065edfb5bfc5ff17b55489c3 | 13,393 | py | Python | test/test_subscriptions_api.py | billforward/bf-python | d2b812329ca3ed1fd94364d7f46f69ad74665596 | [
"Apache-2.0"
] | 2 | 2016-11-23T17:32:37.000Z | 2022-02-24T05:13:20.000Z | test/test_subscriptions_api.py | billforward/bf-python | d2b812329ca3ed1fd94364d7f46f69ad74665596 | [
"Apache-2.0"
] | null | null | null | test/test_subscriptions_api.py | billforward/bf-python | d2b812329ca3ed1fd94364d7f46f69ad74665596 | [
"Apache-2.0"
] | 1 | 2016-12-30T20:02:48.000Z | 2016-12-30T20:02:48.000Z | # coding: utf-8
"""
BillForward REST API
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
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 __future__ import absolute_import
import os
import sys
import unittest
import billforward
from billforward.rest import ApiException
from billforward.apis.subscriptions_api import SubscriptionsApi
class TestSubscriptionsApi(unittest.TestCase):
""" SubscriptionsApi unit test stubs """
def setUp(self):
self.api = billforward.apis.subscriptions_api.SubscriptionsApi()
def tearDown(self):
pass
def test_add_charge_to_subscription(self):
"""
Test case for add_charge_to_subscription
Creates a charge on the specified subscription.
"""
pass
def test_add_coupon_to_subscription(self):
"""
Test case for add_coupon_to_subscription
Applies a coupon to a subscription.
"""
pass
def test_add_credit_note_to_subscription(self):
"""
Test case for add_credit_note_to_subscription
Creates a credit-note which may be used by only the specified subscription.
"""
pass
def test_add_payment_method_to_subscription(self):
"""
Test case for add_payment_method_to_subscription
Enables the payment method to pay invoices of this subscription.
"""
pass
def test_advance_subscription(self):
"""
Test case for advance_subscription
Advance the subscription through time.
"""
pass
def test_available_payment_methods_for_subscription(self):
"""
Test case for available_payment_methods_for_subscription
Returns all available payment methods for the specified subscription. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_batch_create_subscriptions(self):
"""
Test case for batch_create_subscriptions
Create multiple subscriptions.
"""
pass
def test_cancel_subscription(self):
"""
Test case for cancel_subscription
Retires the subscription specified by the subscription-ID parameter. Retiring a subscription causes it to cancel based on the specified retirement settings for the product.
"""
pass
def test_create_aggregating_subscription(self):
"""
Test case for create_aggregating_subscription
Create an aggregating subscription.
"""
pass
def test_create_subscription(self):
"""
Test case for create_subscription
Create a new subscription.
"""
pass
def test_create_subscription_v2(self):
"""
Test case for create_subscription_v2
Create a subscription (V2).
"""
pass
def test_create_timer(self):
"""
Test case for create_timer
Create a timer for a subscription event.
"""
pass
def test_delete_metadata_for_subscription(self):
"""
Test case for delete_metadata_for_subscription
Remove any associated metadata.
"""
pass
def test_freeze_subscription(self):
"""
Test case for freeze_subscription
Freeze the subscription.
"""
pass
def test_get_all_subscriptions(self):
"""
Test case for get_all_subscriptions
Retrieves a collection of all subscriptions. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_applicable_coupons_for_subscription(self):
"""
Test case for get_applicable_coupons_for_subscription
Retrieves a collection of the coupons which can be applied to this subscription.
"""
pass
def test_get_available_credit_subscription(self):
"""
Test case for get_available_credit_subscription
Returns all available credit-notes for the specified subscription. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_charges_on_subscription(self):
"""
Test case for get_charges_on_subscription
Returns all charges for the specified subscription. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_children_of_subscription(self):
"""
Test case for get_children_of_subscription
Return all entities whose invoices will be aggregated by the specified subscription By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_coupons_on_subscription(self):
"""
Test case for get_coupons_on_subscription
Retrieves a collection of the coupons and the unique codes currently applied to the subscription.
"""
pass
def test_get_invoices_for_subscription_by_state(self):
"""
Test case for get_invoices_for_subscription_by_state
Retrieves a collection of invoice objects of the specified state for the given subscription. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_metadata_for_subscription(self):
"""
Test case for get_metadata_for_subscription
Retrieve any associated metadata.
"""
pass
def test_get_parent_subscription(self):
"""
Test case for get_parent_subscription
Return the parent of the given subscription.
"""
pass
def test_get_pricing_component_values_of_subscription(self):
"""
Test case for get_pricing_component_values_of_subscription
Gets the subscription's current pricing-component values.
"""
pass
def test_get_subscription_by_account_id(self):
"""
Test case for get_subscription_by_account_id
Retrieves a collection of subscriptions, specified by the account-ID parameter. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_subscription_by_id(self):
"""
Test case for get_subscription_by_id
Retrieves a single subscription, specified by the ID parameter.
"""
pass
def test_get_subscription_by_product_id(self):
"""
Test case for get_subscription_by_product_id
Retrieves a collection of subscriptions, specified by the product-ID parameter. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_subscription_by_product_rate_plan_id(self):
"""
Test case for get_subscription_by_product_rate_plan_id
Retrieves a collection of subscriptions, specified by the product-rate-plan-ID parameter. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_subscription_by_state(self):
"""
Test case for get_subscription_by_state
Retrieves a collection of subscriptions, specified by the state parameter. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_subscription_by_version_id(self):
"""
Test case for get_subscription_by_version_id
Retrieves a single subscription, specified by the version-ID parameter.
"""
pass
def test_get_subscriptions_by_initial_period_start(self):
"""
Test case for get_subscriptions_by_initial_period_start
Retrieves a collection of subscription objects with period-end times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_subscriptions_by_period_end(self):
"""
Test case for get_subscriptions_by_period_end
Retrieves a collection of subscription objects with period-end times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_subscriptions_by_period_start(self):
"""
Test case for get_subscriptions_by_period_start
Retrieves a collection of subscription objects with period-start times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_subscriptions_by_successful_periods(self):
"""
Test case for get_subscriptions_by_successful_periods
Retrieves a collection of subscription objects whose successful periods count falls within the range specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_swagger_subscription(self):
"""
Test case for get_swagger_subscription
"""
pass
def test_get_timers_for_subscription(self):
"""
Test case for get_timers_for_subscription
Retrieves a collection timer amendments for the specified subscription.. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_import_subscription(self):
"""
Test case for import_subscription
Import a subscription.
"""
pass
def test_invoice_charges_on_subscription(self):
"""
Test case for invoice_charges_on_subscription
Invoice any outstanding charges for the subscription.
"""
pass
def test_migrate_subscription(self):
"""
Test case for migrate_subscription
Migrate the subscription to a new plan.
"""
pass
def test_remove_coupon_from_subscription(self):
"""
Test case for remove_coupon_from_subscription
Removes the coupon from the subscription.
"""
pass
def test_remove_credit_from_subscription(self):
"""
Test case for remove_credit_from_subscription
Decrease the amount of credit available to the specified subscription.
"""
pass
def test_remove_payment_method_from_subscription(self):
"""
Test case for remove_payment_method_from_subscription
Removes the specified payment method for the given subscription.
"""
pass
def test_remove_pricing_component_value_change_from_subscription(self):
"""
Test case for remove_pricing_component_value_change_from_subscription
Discards from the subscription any scheduled changes in the value of the specified pricing-component.
"""
pass
def test_resume_subscription(self):
"""
Test case for resume_subscription
Resume the frozen subscription.
"""
pass
def test_revive_subscription(self):
"""
Test case for revive_subscription
Revives a cancelled subscription and returns it to its previous state
"""
pass
def test_set_metadata_for_subscription(self):
"""
Test case for set_metadata_for_subscription
Remove any existing metadata keys and create the provided data.
"""
pass
def test_set_pricing_component_value_on_subscription(self):
"""
Test case for set_pricing_component_value_on_subscription
Sets upon this subscription a new value for the specified pricing-component without performing an upgrade.
"""
pass
def test_set_pricing_component_value_on_subscription_v2(self):
"""
Test case for set_pricing_component_value_on_subscription_v2
Upgrades/downgrades this subscription to some new value for the specified pricing-component.
"""
pass
def test_update_subscription(self):
"""
Test case for update_subscription
Update a subscription.
"""
pass
def test_update_subscription_v2(self):
"""
Test case for update_subscription_v2
Update a subscription (V2).
"""
pass
def test_upsert_metadata_for_subscription(self):
"""
Test case for upsert_metadata_for_subscription
Update any existing metadata key-values and insert any new key-values, no keys will be removed.
"""
pass
if __name__ == '__main__':
unittest.main()
| 29.435165 | 247 | 0.675203 | 1,603 | 13,393 | 5.407985 | 0.150967 | 0.041181 | 0.064713 | 0.088245 | 0.656939 | 0.553928 | 0.453109 | 0.315723 | 0.276733 | 0.240628 | 0 | 0.004742 | 0.275666 | 13,393 | 454 | 248 | 29.5 | 0.888877 | 0.564623 | 0 | 0.448276 | 1 | 0 | 0.001913 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.456897 | false | 0.448276 | 0.068966 | 0 | 0.534483 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
45628687e4e9d4d8bc74fd512bee57cfd528e3a1 | 369 | py | Python | Data-Engineering-with-Databricks/Solutions/Includes/classroom-setup-3.1-setup-meta.py | svchandramohan/data-engineering-with-databricks | 5537b07a07c326f8386d9029e8c0f4cba96f5776 | [
"CC0-1.0"
] | 35 | 2022-01-20T01:26:20.000Z | 2022-03-30T11:56:23.000Z | Data-Engineering-with-Databricks/Solutions/Includes/classroom-setup-3.1-setup-meta.py | svchandramohan/data-engineering-with-databricks | 5537b07a07c326f8386d9029e8c0f4cba96f5776 | [
"CC0-1.0"
] | null | null | null | Data-Engineering-with-Databricks/Solutions/Includes/classroom-setup-3.1-setup-meta.py | svchandramohan/data-engineering-with-databricks | 5537b07a07c326f8386d9029e8c0f4cba96f5776 | [
"CC0-1.0"
] | 30 | 2022-01-28T23:53:32.000Z | 2022-03-31T08:25:27.000Z | # Databricks notebook source
# MAGIC %run ./_utility-methods $lesson="3.1"
# COMMAND ----------
DA.cleanup()
DA.init(create_db=False)
install_dtavod_datasets(reinstall=False)
print()
copy_source_dataset(f"{DA.working_dir_prefix}/source/dtavod/flights/departuredelays.csv", f"{DA.paths.working_dir}/flights/departuredelays.csv", "csv", "flights")
DA.conclude_setup()
| 28.384615 | 162 | 0.758808 | 50 | 369 | 5.4 | 0.68 | 0.022222 | 0.185185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005797 | 0.065041 | 369 | 12 | 163 | 30.75 | 0.776812 | 0.241192 | 0 | 0 | 0 | 0 | 0.454545 | 0.418182 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
456b609faba1a8d8936559c97ecc84dc3a2d8f8d | 142 | py | Python | cftracker/config/cn_config.py | Existever/PyCFTrackers | 3221e47aecca40de21ad9be875b2f8d960b4e09c | [
"MIT"
] | 231 | 2019-04-01T08:04:40.000Z | 2020-02-19T10:16:12.000Z | cftracker/config/cn_config.py | Existever/PyCFTrackers | 3221e47aecca40de21ad9be875b2f8d960b4e09c | [
"MIT"
] | 18 | 2020-04-17T03:52:02.000Z | 2021-10-15T13:36:46.000Z | cftracker/config/cn_config.py | Existever/PyCFTrackers | 3221e47aecca40de21ad9be875b2f8d960b4e09c | [
"MIT"
] | 63 | 2020-02-24T15:21:12.000Z | 2022-03-26T21:44:40.000Z | class CNConfig:
interp_factor = 0.075
sigma = 0.2
lambda_= 0.01
output_sigma_factor=1./16
padding=1
cn_type = 'pyECO'
| 17.75 | 29 | 0.626761 | 22 | 142 | 3.818182 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126214 | 0.274648 | 142 | 7 | 30 | 20.285714 | 0.68932 | 0 | 0 | 0 | 0 | 0 | 0.035211 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
456b722fee744bb1708672adbe61e0729c970d00 | 454 | py | Python | Python/structural_patterns/adapter/message_display.py | ploukareas/Design-Patterns | 8effde38d73ae9058c3028c97ef395644a90d55b | [
"BSD-3-Clause",
"MIT"
] | 28 | 2018-09-28T07:45:35.000Z | 2022-02-12T12:25:05.000Z | Python/structural_patterns/adapter/message_display.py | ploukareas/Design-Patterns | 8effde38d73ae9058c3028c97ef395644a90d55b | [
"BSD-3-Clause",
"MIT"
] | null | null | null | Python/structural_patterns/adapter/message_display.py | ploukareas/Design-Patterns | 8effde38d73ae9058c3028c97ef395644a90d55b | [
"BSD-3-Clause",
"MIT"
] | 5 | 2021-05-10T23:19:55.000Z | 2022-03-04T20:26:35.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ˅
# ˄
class MessageDisplay(object):
# ˅
# ˄
def __init__(self, message):
self.__message = message
# ˅
pass
# ˄
def display_with_hyphens(self):
# ˅
print('-- ' + self.__message + ' --')
# ˄
def display_with_brackets(self):
# ˅
print('[[ ' + self.__message + ' ]]')
# ˄
# ˅
# ˄
# ˅
# ˄
| 11.641026 | 45 | 0.411894 | 48 | 454 | 3.895833 | 0.458333 | 0.042781 | 0.117647 | 0.160428 | 0.235294 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0.003704 | 0.405286 | 454 | 38 | 46 | 11.947368 | 0.637037 | 0.154185 | 0 | 0 | 0 | 0 | 0.032609 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0.125 | 0 | 0 | 0.5 | 0.25 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
459264b28d0a033607fe9034ef14d252673184ba | 69 | py | Python | pyaud_plugins/__init__.py | jshwi/pyaud | c3268e56b483661fb8baa6da8c4c96420f0f74b3 | [
"MIT"
] | 2 | 2021-02-03T01:18:17.000Z | 2021-06-28T07:24:29.000Z | pyaud_plugins/__init__.py | jshwi/pyaud | c3268e56b483661fb8baa6da8c4c96420f0f74b3 | [
"MIT"
] | 31 | 2021-11-11T15:27:14.000Z | 2022-03-18T14:44:51.000Z | pyaud_plugins/__init__.py | jshwi/pyaud | c3268e56b483661fb8baa6da8c4c96420f0f74b3 | [
"MIT"
] | null | null | null | """
plugins
=======
"""
from . import modules
__all__ = ["modules"]
| 8.625 | 21 | 0.550725 | 6 | 69 | 5.666667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 69 | 7 | 22 | 9.857143 | 0.596491 | 0.217391 | 0 | 0 | 0 | 0 | 0.152174 | 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 |
459c59dc170a99701eb50656ac684e46ac01318e | 20,403 | py | Python | tensornetwork/matrixproductstates/base_mps_test.py | ashoknar/TensorNetwork | 82636b75a0c53b5447c84d9a4e85226fe0e6f43a | [
"Apache-2.0"
] | null | null | null | tensornetwork/matrixproductstates/base_mps_test.py | ashoknar/TensorNetwork | 82636b75a0c53b5447c84d9a4e85226fe0e6f43a | [
"Apache-2.0"
] | null | null | null | tensornetwork/matrixproductstates/base_mps_test.py | ashoknar/TensorNetwork | 82636b75a0c53b5447c84d9a4e85226fe0e6f43a | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 The TensorNetwork Authors
#
# 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 __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pytest
import numpy as np
import tensornetwork as tn
from tensornetwork.backends import backend_factory
from tensornetwork.matrixproductstates.base_mps import BaseMPS
import tensorflow as tf
from jax.config import config
config.update("jax_enable_x64", True)
tf.compat.v1.enable_v2_behavior()
@pytest.fixture(
name="backend_dtype_values",
params=[('numpy', np.float64), ('numpy', np.complex128),
('tensorflow', np.float64), ('tensorflow', np.complex128),
('pytorch', np.float64), ('jax', np.float64)])
def backend_dtype(request):
return request.param
def get_random_np(shape, dtype, seed=0):
np.random.seed(seed) #get the same tensors every time you call this function
if dtype is np.complex64:
return np.random.randn(*shape).astype(
np.float32) + 1j * np.random.randn(*shape).astype(np.float32)
if dtype is np.complex128:
return np.random.randn(*shape).astype(
np.float64) + 1j * np.random.randn(*shape).astype(np.float64)
return np.random.randn(*shape).astype(dtype)
def test_normalization(backend):
D, d, N = 10, 2, 10
tensors = [np.random.randn(1, d, D)] + [
np.random.randn(D, d, D) for _ in range(N - 2)
] + [np.random.randn(D, d, 1)]
mps = BaseMPS(tensors, center_position=0, backend=backend)
mps.position(len(mps) - 1)
Z = mps.position(0, normalize=True)
np.testing.assert_allclose(Z, 1.0)
def test_backend_initialization(backend):
be = backend_factory.get_backend(backend)
D, d, N = 10, 2, 10
tensors = [np.random.randn(1, d, D)] + [
np.random.randn(D, d, D) for _ in range(N - 2)
] + [np.random.randn(D, d, 1)]
mps = BaseMPS(tensors, center_position=0, backend=be)
mps.position(len(mps) - 1)
Z = mps.position(0, normalize=True)
np.testing.assert_allclose(Z, 1.0)
def test_left_orthonormalization(backend_dtype_values):
backend = backend_dtype_values[0]
dtype = backend_dtype_values[1]
D, d, N = 10, 2, 10
tensors = [get_random_np((1, d, D), dtype)] + [
get_random_np((D, d, D), dtype) for _ in range(N - 2)
] + [get_random_np((D, d, 1), dtype)]
mps = BaseMPS(tensors, center_position=N - 1, backend=backend)
mps.position(0)
mps.position(len(mps) - 1)
assert all([
mps.check_orthonormality('left', site) < 1E-12
for site in range(len(mps))
])
def test_right_orthonormalization(backend_dtype_values):
backend = backend_dtype_values[0]
dtype = backend_dtype_values[1]
D, d, N = 10, 2, 10
tensors = [get_random_np((1, d, D), dtype)] + [
get_random_np((D, d, D), dtype) for _ in range(N - 2)
] + [get_random_np((D, d, 1), dtype)]
mps = BaseMPS(tensors, center_position=0, backend=backend)
mps.position(len(mps) - 1)
mps.position(0)
assert all([
mps.check_orthonormality('right', site) < 1E-12
for site in range(len(mps))
])
def test_apply_one_site_gate(backend_dtype_values):
backend = backend_dtype_values[0]
dtype = backend_dtype_values[1]
D, d, N = 10, 2, 10
tensors = [get_random_np((1, d, D), dtype)] + [
get_random_np((D, d, D), dtype) for _ in range(N - 2)
] + [get_random_np((D, d, 1), dtype)]
mps = BaseMPS(tensors, center_position=0, backend=backend)
tensor = mps.tensors[5]
gate = get_random_np((2, 2), dtype)
mps.apply_one_site_gate(gate, 5)
actual = np.transpose(np.tensordot(tensor, gate, ([1], [1])), (0, 2, 1))
np.testing.assert_allclose(mps.tensors[5], actual)
def test_apply_two_site_gate(backend_dtype_values):
backend = backend_dtype_values[0]
dtype = backend_dtype_values[1]
D, d, N = 10, 2, 10
tensors = [get_random_np((1, d, D), dtype)] + [
get_random_np((D, d, D), dtype) for _ in range(N - 2)
] + [get_random_np((D, d, 1), dtype)]
mps = BaseMPS(tensors, center_position=0, backend=backend)
gate = get_random_np((2, 2, 2, 2), dtype)
tensor1 = mps.tensors[5]
tensor2 = mps.tensors[6]
mps.apply_two_site_gate(gate, 5, 6)
tmp = np.tensordot(tensor1, tensor2, ([2], [0]))
actual = np.transpose(np.tensordot(tmp, gate, ([1, 2], [2, 3])), (0, 2, 3, 1))
node1 = tn.Node(mps.tensors[5], backend=backend)
node2 = tn.Node(mps.tensors[6], backend=backend)
node1[2] ^ node2[0]
order = [node1[0], node1[1], node2[1], node2[2]]
res = tn.contract_between(node1, node2)
res.reorder_edges(order)
np.testing.assert_allclose(res.tensor, actual)
def test_position_raises_error(backend):
D, d, N = 10, 2, 10
tensors = [np.random.randn(1, d, D)] + [
np.random.randn(D, d, D) for _ in range(N - 2)
] + [np.random.randn(D, d, 1)]
mps = BaseMPS(tensors, center_position=0, backend=backend)
with pytest.raises(ValueError):
mps.position(-1)
with pytest.raises(ValueError):
mps.position(11)
def test_position_no_normalization(backend):
D, d, N = 4, 2, 6
tensors = [np.ones((1, d, D))] + [np.ones((D, d, D)) for _ in range(N - 2)
] + [np.ones((D, d, 1))]
mps = BaseMPS(tensors, center_position=0, backend=backend)
Z = mps.position(len(mps) - 1, normalize=False)
np.testing.assert_allclose(Z, 8192.0)
def test_position_shift_left(backend):
D, d, N = 4, 2, 6
tensors = [np.ones((1, d, D))] + [np.ones((D, d, D)) for _ in range(N - 2)
] + [np.ones((D, d, 1))]
mps = BaseMPS(tensors, center_position=int(N / 2), backend=backend)
Z = mps.position(0, normalize=True)
np.testing.assert_allclose(Z, 2.828427)
def test_position_shift_right(backend):
D, d, N = 4, 2, 6
tensors = [np.ones((1, d, D))] + [np.ones((D, d, D)) for _ in range(N - 2)
] + [np.ones((D, d, 1))]
mps = BaseMPS(tensors, center_position=int(N / 2), backend=backend)
Z = mps.position(N - 1, normalize=True)
np.testing.assert_allclose(Z, 2.828427)
def test_position_no_shift(backend):
D, d, N = 4, 2, 6
tensors = [np.ones((1, d, D))] + [np.ones((D, d, D)) for _ in range(N - 2)
] + [np.ones((D, d, 1))]
mps = BaseMPS(tensors, center_position=int(N / 2), backend=backend)
Z = mps.position(int(N / 2), normalize=True)
np.testing.assert_allclose(Z, 5.656854)
def test_position_no_shift_no_normalization(backend):
D, d, N = 4, 2, 6
tensors = [np.ones((1, d, D))] + [np.ones((D, d, D)) for _ in range(N - 2)
] + [np.ones((D, d, 1))]
mps = BaseMPS(tensors, center_position=int(N / 2), backend=backend)
Z = mps.position(int(N / 2), normalize=False)
np.testing.assert_allclose(Z, 5.656854)
def test_different_dtypes_raises_error():
D, d = 4, 2
tensors = [
np.ones((1, d, D), dtype=np.float64),
np.ones((D, d, D), dtype=np.complex64)
]
with pytest.raises(TypeError):
BaseMPS(tensors, backend='numpy')
_tensors = [
np.ones((1, d, D), dtype=np.float64),
np.ones((D, d, D), dtype=np.float64)
]
mps = BaseMPS(_tensors, backend='numpy')
mps.tensors = tensors
with pytest.raises(TypeError):
mps.dtype
def test_not_implemented():
D, d = 4, 2
tensors = [np.ones((1, d, D)), np.ones((D, d, D))]
mps = BaseMPS(tensors, backend='numpy')
with pytest.raises(NotImplementedError):
mps.save('tmp')
with pytest.raises(NotImplementedError):
mps.right_envs([0])
with pytest.raises(NotImplementedError):
mps.left_envs([0])
with pytest.raises(NotImplementedError):
mps.canonicalize()
def test_physical_dimensions(backend):
D = 3
tensors = [np.ones((1, 2, D)), np.ones((D, 3, D)), np.ones((D, 4, 1))]
mps = BaseMPS(tensors, backend=backend)
assert mps.physical_dimensions == [2, 3, 4]
def test_apply_transfer_operator_left(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mat = backend.convert_to_tensor(
np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=np.float64))
mps = BaseMPS(tensors, backend=backend)
expected = np.array([[74., 58., 38.], [78., 146., 102.], [38., 114., 74.]])
actual = mps.apply_transfer_operator(site=3, direction=1, matrix=mat)
np.testing.assert_allclose(actual, expected)
actual = mps.apply_transfer_operator(site=3, direction="l", matrix=mat)
np.testing.assert_allclose(actual, expected)
actual = mps.apply_transfer_operator(site=3, direction="left", matrix=mat)
np.testing.assert_allclose(actual, expected)
def test_apply_transfer_operator_right(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mat = backend.convert_to_tensor(
np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=np.float64))
mps = BaseMPS(tensors, backend=backend)
expected = np.array([[80., -20., 128.], [-20., 10., -60.], [144., -60.,
360.]])
actual = mps.apply_transfer_operator(site=3, direction=-1, matrix=mat)
np.testing.assert_allclose(actual, expected)
actual = mps.apply_transfer_operator(site=3, direction="r", matrix=mat)
np.testing.assert_allclose(actual, expected)
actual = mps.apply_transfer_operator(site=3, direction="right", matrix=mat)
np.testing.assert_allclose(actual, expected)
def test_apply_transfer_operator_invalid_direction_raises_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mat = backend.convert_to_tensor(
np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=np.float64))
mps = BaseMPS(tensors, backend=backend)
with pytest.raises(ValueError):
mps.apply_transfer_operator(site=3, direction=0, matrix=mat)
with pytest.raises(ValueError):
mps.apply_transfer_operator(site=3, direction="keft", matrix=mat)
def test_measure_local_operator_value_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
operator = backend.convert_to_tensor(
np.array([[1, -1], [-1, 1]], dtype=np.float64))
mps = BaseMPS(tensors, backend=backend)
with pytest.raises(ValueError):
mps.measure_local_operator(ops=2 * [operator], sites=[1, 2, 3])
def test_measure_two_body_correlator_value_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
operator = backend.convert_to_tensor(
np.array([[1, -1], [-1, 1]], dtype=np.float64))
mps = BaseMPS(tensors, backend=backend)
with pytest.raises(ValueError):
mps.measure_two_body_correlator(
op1=operator, op2=operator, site1=-1, sites2=[2])
def test_get_tensor(backend):
backend = backend_factory.get_backend(backend)
tensor1 = np.ones((2, 3, 2), dtype=np.float64)
tensor2 = 2 * np.ones((2, 3, 2), dtype=np.float64)
tensors = [tensor1, tensor2]
mps = BaseMPS(tensors, backend=backend)
np.testing.assert_allclose(mps.get_tensor(0), tensor1)
np.testing.assert_allclose(mps.get_tensor(1), tensor2)
def test_get_tensor_connector_matrix(backend):
backend = backend_factory.get_backend(backend)
tensor1 = np.ones((2, 3, 2), dtype=np.float64)
tensor2 = 2 * np.ones((2, 3, 2), dtype=np.float64)
connector = backend.convert_to_tensor(np.ones((2, 2), dtype=np.float64))
tensors = [tensor1, tensor2]
mps = BaseMPS(tensors, backend=backend, connector_matrix=connector)
np.testing.assert_allclose(mps.get_tensor(0), tensor1)
np.testing.assert_allclose(mps.get_tensor(1), 2 * tensor2)
def test_get_tensor_raises_error(backend):
backend = backend_factory.get_backend(backend)
tensor1 = np.ones((2, 3, 2), dtype=np.float64)
tensor2 = 2 * np.ones((2, 3, 2), dtype=np.float64)
tensors = [tensor1, tensor2]
mps = BaseMPS(tensors, backend=backend)
with pytest.raises(ValueError):
mps.get_tensor(site=-1)
with pytest.raises(IndexError):
mps.get_tensor(site=3)
def test_check_canonical(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
np.testing.assert_allclose(mps.check_canonical(), 71.714713)
def test_check_normality_raises_value_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.ones((2, 3, 2), dtype=np.float64)
tensors = [tensor]
mps = BaseMPS(tensors, backend=backend)
with pytest.raises(ValueError):
mps.check_orthonormality(which="keft", site=0)
def test_apply_two_site_gate_2(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
gate = backend.convert_to_tensor(
np.array([[[[0., 1.], [0., 0.]], [[1., 0.], [0., 0.]]],
[[[0., 0.], [0., 1.]], [[0., 0.], [1., 0.]]]],
dtype=np.float64))
actual = mps.apply_two_site_gate(
gate=gate, site1=1, site2=2, max_singular_values=1)
np.testing.assert_allclose(actual[0], 9.133530)
expected = np.array([[5.817886], [9.039142]])
np.testing.assert_allclose(np.abs(mps.tensors[1][0]), expected, rtol=1e-04)
expected = np.array([[0.516264, 0.080136, 0.225841],
[0.225841, 0.59876, 0.516264]])
np.testing.assert_allclose(np.abs(mps.tensors[2][0]), expected, rtol=1e-04)
def test_apply_two_site_wrong_gate_raises_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
gate1 = backend.convert_to_tensor(np.ones((2, 2, 2), dtype=np.float64))
gate2 = backend.convert_to_tensor(np.ones((2, 2, 2, 2, 2), dtype=np.float64))
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate1, site1=1, site2=2)
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate2, site1=1, site2=2)
def test_apply_two_site_wrong_site1_raises_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
gate = backend.convert_to_tensor(np.ones((2, 2, 2, 2), dtype=np.float64))
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate, site1=-1, site2=2)
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate, site1=6, site2=2)
def test_apply_two_site_wrong_site2_raises_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
gate = backend.convert_to_tensor(np.ones((2, 2, 2, 2), dtype=np.float64))
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate, site1=0, site2=0)
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate, site1=0, site2=6)
def test_apply_two_site_wrong_site1_site2_raises_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
gate = backend.convert_to_tensor(np.ones((2, 2, 2, 2), dtype=np.float64))
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate, site1=2, site2=2)
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate, site1=2, site2=4)
def test_apply_two_site_max_singular_value_not_center_raises_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
gate = backend.convert_to_tensor(np.ones((2, 2, 2, 2), dtype=np.float64))
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate, site1=3, site2=4, max_singular_values=1)
with pytest.raises(ValueError):
mps.apply_two_site_gate(gate=gate, site1=3, site2=4, max_truncation_err=.1)
def test_apply_one_site_gate_2(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
gate = backend.convert_to_tensor(np.array([[0, 1], [1, 0]], dtype=np.float64))
mps.apply_one_site_gate(gate=gate, site=1)
expected = np.array([[1., -2., 1.], [1., 2., 1.]])
np.testing.assert_allclose(mps.tensors[1][0], expected)
def test_apply_one_site_gate_wrong_gate_raises_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
gate1 = backend.convert_to_tensor(np.ones((2, 2, 2), dtype=np.float64))
gate2 = backend.convert_to_tensor(np.ones((2, 2, 2), dtype=np.float64))
with pytest.raises(ValueError):
mps.apply_one_site_gate(gate=gate1, site=1)
with pytest.raises(ValueError):
mps.apply_one_site_gate(gate=gate2, site=1)
def test_apply_one_site_gate_invalid_site_raises_error(backend):
backend = backend_factory.get_backend(backend)
tensor = np.array([[[1., 2., 1.], [1., -2., 1.]],
[[-1., 1., -1.], [-1., 1., -1.]], [[1., 2, 3], [3, 2, 1]]],
dtype=np.float64)
tensors = 6 * [backend.convert_to_tensor(tensor)]
mps = BaseMPS(tensors, backend=backend, center_position=2)
gate = backend.convert_to_tensor(np.ones((2, 2), dtype=np.float64))
with pytest.raises(ValueError):
mps.apply_one_site_gate(gate=gate, site=-1)
with pytest.raises(ValueError):
mps.apply_one_site_gate(gate=gate, site=6)
| 39.388031 | 80 | 0.638534 | 3,072 | 20,403 | 4.081706 | 0.083333 | 0.020576 | 0.02249 | 0.024563 | 0.795518 | 0.74679 | 0.726693 | 0.693516 | 0.67621 | 0.664487 | 0 | 0.060805 | 0.185071 | 20,403 | 517 | 81 | 39.464217 | 0.69333 | 0.030241 | 0 | 0.596618 | 0 | 0 | 0.00607 | 0 | 0 | 0 | 0 | 0 | 0.065217 | 1 | 0.086957 | false | 0 | 0.024155 | 0.002415 | 0.120773 | 0.002415 | 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 |
45df0dc4c77536fb90c1ba21e08b3d203eb30fc5 | 135 | py | Python | setup.py | HendrikPN/gym-icy-gridworld | 20012cd574f8b2b8391a0368cb2f4255d78ebb90 | [
"Apache-2.0"
] | null | null | null | setup.py | HendrikPN/gym-icy-gridworld | 20012cd574f8b2b8391a0368cb2f4255d78ebb90 | [
"Apache-2.0"
] | null | null | null | setup.py | HendrikPN/gym-icy-gridworld | 20012cd574f8b2b8391a0368cb2f4255d78ebb90 | [
"Apache-2.0"
] | null | null | null | from setuptools import setup
setup(name='gym_icy_gridworld',
version='0.0.1',
install_requires=['gym', 'opencv-python']
)
| 19.285714 | 47 | 0.681481 | 18 | 135 | 4.944444 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026549 | 0.162963 | 135 | 6 | 48 | 22.5 | 0.761062 | 0 | 0 | 0 | 0 | 0 | 0.281481 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
afe4f2d5b5267af03720176f07451f0d64d9fa34 | 1,136 | py | Python | triple_agent/tests/test_reprs.py | andrewzwicky/TripleAgent | 8d056df5c53a3d264dc778bad6771a0a2f62e7e7 | [
"MIT"
] | 3 | 2020-04-25T11:42:03.000Z | 2020-07-08T16:38:26.000Z | triple_agent/tests/test_reprs.py | andrewzwicky/TripleAgent | 8d056df5c53a3d264dc778bad6771a0a2f62e7e7 | [
"MIT"
] | 17 | 2019-08-11T19:09:55.000Z | 2021-03-30T17:12:28.000Z | triple_agent/tests/test_reprs.py | andrewzwicky/TripleAgent | 8d056df5c53a3d264dc778bad6771a0a2f62e7e7 | [
"MIT"
] | null | null | null | import pytest
from triple_agent.classes.action_tests import ActionTest
from triple_agent.classes.books import Books
from triple_agent.classes.characters import Characters
from triple_agent.classes.roles import Roles
@pytest.mark.quick
def test_repr_AT_green():
assert repr(ActionTest.Green) == "ActionTest.Green"
@pytest.mark.quick
def test_repr_AT_ignored():
assert repr(ActionTest.Ignored) == "ActionTest.Ignored"
@pytest.mark.quick
def test_repr_books_green():
assert repr(Books.Green) == "Books.Green"
@pytest.mark.quick
def test_repr_books_blue():
assert repr(Books.Blue) == "Books.Blue"
@pytest.mark.quick
def test_repr_chars_sue():
assert repr(Characters.Sue) == "Characters.Sue"
@pytest.mark.quick
def test_repr_chars_wheels():
assert repr(Characters.Wheels) == "Characters.Wheels"
@pytest.mark.quick
def test_repr_chars_djackson():
assert repr(Characters.DJackson) == "Characters.DJackson"
@pytest.mark.quick
def test_repr_roles_spy():
assert repr(Roles.Spy) == "Roles.Spy"
@pytest.mark.quick
def test_repr_roles_da():
assert repr(Roles.DoubleAgent) == "Roles.DoubleAgent"
| 22.27451 | 61 | 0.763204 | 157 | 1,136 | 5.318471 | 0.184713 | 0.107784 | 0.161677 | 0.194012 | 0.338922 | 0.338922 | 0.338922 | 0 | 0 | 0 | 0 | 0 | 0.118838 | 1,136 | 50 | 62 | 22.72 | 0.834166 | 0 | 0 | 0.28125 | 0 | 0 | 0.115317 | 0 | 0 | 0 | 0 | 0 | 0.28125 | 1 | 0.28125 | true | 0 | 0.15625 | 0 | 0.4375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
affff8f4319276f7e0e007f5c5b0128d4d6d2c3f | 7,423 | py | Python | src/third_party/beaengine/tests/0f16.py | CrackerCat/rp | 5fe693c26d76b514efaedb4084f6e37d820db023 | [
"MIT"
] | 1 | 2022-01-17T17:40:29.000Z | 2022-01-17T17:40:29.000Z | src/third_party/beaengine/tests/0f16.py | CrackerCat/rp | 5fe693c26d76b514efaedb4084f6e37d820db023 | [
"MIT"
] | null | null | null | src/third_party/beaengine/tests/0f16.py | CrackerCat/rp | 5fe693c26d76b514efaedb4084f6e37d820db023 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
# @author : beaengine@gmail.com
from headers.BeaEnginePython import *
from nose.tools import *
class TestSuite:
def test(self):
# 66 0F 16 /r
# MOVHPD xmm1, m64
Buffer = bytes.fromhex('660f16e0')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Opcode), '0xf16')
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'movhpd')
assert_equal(myDisasm.repr(), 'movhpd xmm4, xmm0')
# VEX.NDS.128.66.0F.WIG 16 /r
# VMOVHPD xmm2, xmm1, m64
myVEX = VEX('VEX.NDS.128.66.0F.WIG')
Buffer = bytes.fromhex('{}169000000000'.format(myVEX.c4()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Opcode), '0x16')
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovhpd')
assert_equal(myDisasm.repr(), 'vmovhpd xmm10, xmm15, qword ptr [r8+00000000h]')
# EVEX.NDS.128.66.0F.W1 16 /r
# VMOVHPD xmm2, xmm1, m64
myEVEX = EVEX('EVEX.NDS.128.66.0F.W1')
Buffer = bytes.fromhex('{}169000000000'.format(myEVEX.prefix()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x16)
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovhpd')
assert_equal(myDisasm.repr(), 'vmovhpd xmm26, xmm31, qword ptr [r8+00000000h]')
# NP 0F 16 /r
# MOVHPS xmm1, m64
Buffer = bytes.fromhex('0f169000000000')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Opcode), '0xf16')
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'movhps')
assert_equal(myDisasm.repr(), 'movhps xmm2, qword ptr [rax+00000000h]')
# VEX.NDS.128.0F.WIG 16 /r
# VMOVHPS xmm2, xmm1, m64
myVEX = VEX('VEX.NDS.128.0F.WIG')
Buffer = bytes.fromhex('{}169000000000'.format(myVEX.c4()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Opcode), '0x16')
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovhps')
assert_equal(myDisasm.repr(), 'vmovhps xmm10, xmm15, qword ptr [r8+00000000h]')
# EVEX.NDS.128.0F.W0 16 /r
# VMOVHPS xmm2, xmm1, m64
myEVEX = EVEX('EVEX.NDS.128.0F.W0')
Buffer = bytes.fromhex('{}169000000000'.format(myEVEX.prefix()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x16)
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovhps')
assert_equal(myDisasm.repr(), 'vmovhps xmm26, xmm31, qword ptr [r8+00000000h]')
# NP 0F 16 /r
# MOVLHPS xmm1, xmm2
Buffer = bytes.fromhex('0f16e0')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Opcode), '0xf16')
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'movlhps')
assert_equal(myDisasm.repr(), 'movlhps xmm4, xmm0')
# VEX.NDS.128.0F.WIG 16 /r
# VMOVLHPS xmm1, xmm2, xmm3
myVEX = VEX('VEX.NDS.128.0F.WIG')
Buffer = bytes.fromhex('{}16e0'.format(myVEX.c4()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Opcode), '0x16')
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovlhps')
assert_equal(myDisasm.repr(), 'vmovlhps xmm12, xmm15, xmm8')
# EVEX.NDS.128.0F.W0 16 /r
# VMOVLHPS xmm1, xmm2, xmm3
myEVEX = EVEX('EVEX.NDS.128.0F.W0')
Buffer = bytes.fromhex('{}16e0'.format(myEVEX.prefix()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x16)
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovlhps')
assert_equal(myDisasm.repr(), 'vmovlhps xmm28, xmm31, xmm24')
# F3 0F 16 /r
# MOVSHDUP xmm1, xmm2/m128
Buffer = bytes.fromhex('f30f169000000000')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Opcode), '0xf16')
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'movshdup')
assert_equal(myDisasm.repr(), 'movshdup xmm2, xmmword ptr [rax+00000000h]')
# VEX.128.F3.0F.WIG 16 /r
# VMOVSHDUP xmm1, xmm2/m128
myVEX = VEX('VEX.128.F3.0F.WIG')
Buffer = bytes.fromhex('{}169000000000'.format(myVEX.c4()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Opcode), '0x16')
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovshdup')
assert_equal(myDisasm.repr(), 'vmovshdup xmm10, xmmword ptr [r8+00000000h]')
# VEX.256.F3.0F.WIG 16 /r
# VMOVSHDUP ymm1, ymm2/m256
myVEX = VEX('VEX.256.F3.0F.WIG')
Buffer = bytes.fromhex('{}169000000000'.format(myVEX.c4()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Opcode), '0x16')
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovshdup')
assert_equal(myDisasm.repr(), 'vmovshdup ymm10, ymmword ptr [r8+00000000h]')
# EVEX.128.F3.0F.W0 16 /r
# VMOVSHDUP xmm1 {k1}{z}, xmm2/m128
myEVEX = EVEX('EVEX.128.F3.0F.W0')
Buffer = bytes.fromhex('{}169000000000'.format(myEVEX.prefix()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x16)
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovshdup')
assert_equal(myDisasm.repr(), 'vmovshdup xmm26, xmmword ptr [r8+00000000h]')
# EVEX.256.F3.0F.W0 16 /r
# VMOVSHDUP ymm1 {k1}{z}, ymm2/m256
myEVEX = EVEX('EVEX.256.F3.0F.W0')
Buffer = bytes.fromhex('{}169000000000'.format(myEVEX.prefix()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x16)
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovshdup')
assert_equal(myDisasm.repr(), 'vmovshdup ymm26, ymmword ptr [r8+00000000h]')
# EVEX.512.F3.0F.W0 16 /r
# VMOVSHDUP zmm1 {k1}{z}, zmm2/m512
myEVEX = EVEX('EVEX.512.F3.0F.W0')
Buffer = bytes.fromhex('{}169000000000'.format(myEVEX.prefix()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x16)
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vmovshdup')
assert_equal(myDisasm.repr(), 'vmovshdup zmm26, zmmword ptr [r8+00000000h]')
| 40.342391 | 87 | 0.643001 | 910 | 7,423 | 5.195604 | 0.187912 | 0.104695 | 0.14467 | 0.106599 | 0.768613 | 0.724619 | 0.67132 | 0.659052 | 0.64192 | 0.625423 | 0 | 0.097497 | 0.224842 | 7,423 | 183 | 88 | 40.562842 | 0.724192 | 0.190085 | 0 | 0.657143 | 0 | 0 | 0.185384 | 0.00704 | 0 | 0 | 0.010727 | 0 | 0.428571 | 1 | 0.009524 | false | 0 | 0.019048 | 0 | 0.038095 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b307649c3dc0cc3dce8a215052e45c64b462d99b | 619 | py | Python | Taller de python/ejercicio_13.py | Ivan-Daniel/Algortimo-y-Programacion-Talleres | b90f79d3a920dd9b6494309172cdea2319bfddc0 | [
"MIT"
] | 1 | 2021-08-04T16:30:54.000Z | 2021-08-04T16:30:54.000Z | Taller de python/ejercicio_13.py | Ivan-Daniel/Algortimo-y-Programacion-Talleres | b90f79d3a920dd9b6494309172cdea2319bfddc0 | [
"MIT"
] | null | null | null | Taller de python/ejercicio_13.py | Ivan-Daniel/Algortimo-y-Programacion-Talleres | b90f79d3a920dd9b6494309172cdea2319bfddc0 | [
"MIT"
] | null | null | null | """
Entradas
a-->int-->Cantidad de billetes de 50000
b-->int-->Cantidad de billetes de 20000
c-->int-->Cantidad de billetes de 10000
d-->int-->Cantidad de billetes de 5000
e-->int-->Cantidad de billetes de 2000
f-->int-->Cantidad de billetes de 1000
g-->int-->Cantidad de billetes de 500
h-->int-->Cantidad de billetes de 100
Salidas
i-->int-->Cantidad total de dinero
"""
inp=input().split()
q,w,e,r,t,j,u,p=inp
q=int(q)
w=int(w)
e=int(e)
r=int(r)
t=int(t)
j=int(j)
u=int(u)
p=int(p)
#caja negra
i=(q*50000)+(w*20000)+(e*10000)+(r*5000)+(t*2000)+(j*1000)+(u*500)+(p*100)
print("La cantidad total de dinero es "+str(i)) | 23.807692 | 74 | 0.668821 | 128 | 619 | 3.234375 | 0.320313 | 0.23913 | 0.251208 | 0.405797 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119565 | 0.108239 | 619 | 26 | 75 | 23.807692 | 0.630435 | 0.605816 | 0 | 0 | 0 | 0 | 0.130802 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.083333 | 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 |
b30a5c7659bf3f66e75e6dae90faa8861c881544 | 396 | py | Python | mposp_root/apis/views.py | hanshendrickx/gitDP002 | 9703791a2270495830142917a7b12ba1eb2ca3f5 | [
"CC0-1.0"
] | null | null | null | mposp_root/apis/views.py | hanshendrickx/gitDP002 | 9703791a2270495830142917a7b12ba1eb2ca3f5 | [
"CC0-1.0"
] | null | null | null | mposp_root/apis/views.py | hanshendrickx/gitDP002 | 9703791a2270495830142917a7b12ba1eb2ca3f5 | [
"CC0-1.0"
] | null | null | null | # apis/views.py
from rest_framework import generics
from todos import models
from .serializers import TodoSerializer
class ListTodo(generics.ListCreateAPIView):
queryset = models.Todo.objects.all()
serializer_class = TodoSerializer
class DetailTodo(generics.RetrieveUpdateDestroyAPIView):
queryset = models.Todo.objects.all()
serializer_class = TodoSerializer
| 24.75 | 57 | 0.767677 | 40 | 396 | 7.525 | 0.55 | 0.126246 | 0.119601 | 0.166113 | 0.378738 | 0.378738 | 0.378738 | 0.378738 | 0 | 0 | 0 | 0 | 0.166667 | 396 | 15 | 58 | 26.4 | 0.912121 | 0.032828 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
b3192f7958f879495bffca7d9a08475f6fb14493 | 2,118 | py | Python | assets/2017-09-27/Python/pythonSpeedFloat.py | ChrisLuginbuhl/cjekel.github.io | a0bc8edf6ff97437035a13ae476bc04fd2448eef | [
"MIT"
] | null | null | null | assets/2017-09-27/Python/pythonSpeedFloat.py | ChrisLuginbuhl/cjekel.github.io | a0bc8edf6ff97437035a13ae476bc04fd2448eef | [
"MIT"
] | null | null | null | assets/2017-09-27/Python/pythonSpeedFloat.py | ChrisLuginbuhl/cjekel.github.io | a0bc8edf6ff97437035a13ae476bc04fd2448eef | [
"MIT"
] | null | null | null | import time as time
import numpy as np
import numba
# generate 1 billion samples
n = 1000000000
# Add 2 * Y to X, element by element:
# Slowest
# Create two int arrays, each filled with with one billion 1's.
X = np.ones(n, dtype=np.float)
Y = np.ones(n, dtype=np.float)
t0 = time.time()
X = X + 2.0 * Y
t1 = time.time()
print('run time',t1-t0,'seconds')
#100 loops, run time 5.9 seconds
# A bit faster
X = np.ones(n, dtype=np.float)
Y = np.ones(n, dtype=np.float)
t0 = time.time()
X = X + 2 * Y
t1 = time.time()
print('run time',t1-t0,'seconds')
#100 loops, run time 4.5 sconds
# Much faster
X = np.ones(n, dtype=np.float)
Y = np.ones(n, dtype=np.float)
t0 = time.time()
X += 2 * Y
t1 = time.time()
print('run time',t1-t0,'seconds')
#100 loops, run time 4.5 seconds
# Fastest
X = np.ones(n, dtype=np.float)
Y = np.ones(n, dtype=np.float)
t0 = time.time()
np.add(X, Y, out=X); np.add(X, Y, out=X)
# the above line is equivalent to the following line
# X += Y; X += Y
# the reason why this is faster is because it doesn't need to create a copy of X
# when performing the math.
t1 = time.time()
print('run time',t1-t0,'seconds')
#100 loops, run time 3.9 seconds
# Much faster...
X = np.ones(n, dtype=np.float)
Y = np.ones(n, dtype=np.float)
t0 = time.time()
@numba.vectorize(nopython=True)
def add2(x, y):
return x + 2 * y
add2(X, Y, out=X)
t1 = time.time()
print('run time',t1-t0,'seconds')
# run time 1.94 seconds
# Slightly faster by declaring data type ... on average ...
# single threaded
X = np.ones(n, dtype=np.float)
Y = np.ones(n, dtype=np.float)
t0 = time.time()
@numba.vectorize(["float64(float64,float64)"],nopython=True,target='cpu')
def add2_par(x, y):
return x + 2 * y
add2_par(X, Y, out=X)
t1 = time.time()
print('run time',t1-t0,'seconds')
# run time 1.90 seconds
# Slightly faster in parallel...
X = np.ones(n, dtype=np.float)
Y = np.ones(n, dtype=np.float)
t0 = time.time()
@numba.vectorize(["float64(float64,float64)"],nopython=True,target='parallel')
def add2_par(x, y):
return x + 2 * y
add2_par(X, Y, out=X)
t1 = time.time()
print('run time',t1-t0,'seconds')
# run time 1.53 seconds
| 24.344828 | 80 | 0.66289 | 408 | 2,118 | 3.431373 | 0.227941 | 0.06 | 0.07 | 0.12 | 0.669286 | 0.669286 | 0.653571 | 0.642857 | 0.642857 | 0.642857 | 0 | 0.053521 | 0.161945 | 2,118 | 86 | 81 | 24.627907 | 0.735211 | 0.304533 | 0 | 0.763636 | 1 | 0 | 0.113103 | 0.033103 | 0 | 0 | 0 | 0 | 0 | 1 | 0.054545 | false | 0 | 0.054545 | 0.054545 | 0.163636 | 0.127273 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b32ea1a2be5ac3b1594927f3e857b87085e84b1d | 233 | py | Python | homeworks/aleksey_gukov/lesson10/level04.py | tgrx/Z22 | b2539682ff26c8b6d9f63a7670c8a9c6b614a8ff | [
"Apache-2.0"
] | null | null | null | homeworks/aleksey_gukov/lesson10/level04.py | tgrx/Z22 | b2539682ff26c8b6d9f63a7670c8a9c6b614a8ff | [
"Apache-2.0"
] | 8 | 2019-11-15T18:15:56.000Z | 2020-02-03T18:05:05.000Z | homeworks/aleksey_gukov/lesson10/level04.py | tgrx/Z22 | b2539682ff26c8b6d9f63a7670c8a9c6b614a8ff | [
"Apache-2.0"
] | null | null | null | def diag_diff(matriza):
first_diag = second_diag = 0
razmer = len(matriza)
for i in range(razmer):
first_diag += matriza[i][i]
second_diag += matriza[i][razmer - i - 1]
return first_diag - second_diag
| 29.125 | 49 | 0.630901 | 34 | 233 | 4.117647 | 0.441176 | 0.192857 | 0.214286 | 0.271429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011561 | 0.257511 | 233 | 7 | 50 | 33.285714 | 0.797688 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b3449389435e2b68dd7ebaf325dd6ba528e4e10e | 527 | py | Python | scripts/pepper_interface/data_exchange/data.py | MPI-IS/reactive_pepper | 079f9b0627bfd6c9e3f2a4466c95ad662002a600 | [
"BSD-3-Clause"
] | null | null | null | scripts/pepper_interface/data_exchange/data.py | MPI-IS/reactive_pepper | 079f9b0627bfd6c9e3f2a4466c95ad662002a600 | [
"BSD-3-Clause"
] | null | null | null | scripts/pepper_interface/data_exchange/data.py | MPI-IS/reactive_pepper | 079f9b0627bfd6c9e3f2a4466c95ad662002a600 | [
"BSD-3-Clause"
] | null | null | null | import threading,copy
class Data(object) :
def __init__(self,data_transform=None):
self._data = None
self._lock = threading.Lock()
self._data_transform = data_transform
data_transform=None
def set(self,data):
with self._lock:
self._data = data
if self._data_transform:
self._data_transform(self._data)
def get(self):
with self._lock:
r = copy.deepcopy(self._data)
return r
| 22.913043 | 48 | 0.557875 | 59 | 527 | 4.644068 | 0.322034 | 0.262774 | 0.248175 | 0.189781 | 0.153285 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.360531 | 527 | 22 | 49 | 23.954545 | 0.813056 | 0 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1875 | false | 0 | 0.0625 | 0 | 0.375 | 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 |
b345b09f7b614c463f2509f08b697695f8168e70 | 834 | py | Python | cohesity_management_sdk/models/acl_mode_enum.py | chandrashekar-cohesity/management-sdk-python | 9e6ec99e8a288005804b808c4e9b19fd204e3a8b | [
"Apache-2.0"
] | 1 | 2021-01-07T20:36:22.000Z | 2021-01-07T20:36:22.000Z | cohesity_management_sdk/models/acl_mode_enum.py | chandrashekar-cohesity/management-sdk-python | 9e6ec99e8a288005804b808c4e9b19fd204e3a8b | [
"Apache-2.0"
] | null | null | null | cohesity_management_sdk/models/acl_mode_enum.py | chandrashekar-cohesity/management-sdk-python | 9e6ec99e8a288005804b808c4e9b19fd204e3a8b | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class AclModeEnum(object):
"""Implementation of the 'AclMode' enum.
ACL mode for this SMB share.
'kNative' specifies native ACL mode supports UNIX-like ACLs and Windows
ACLs. In native mode, because SMB natively supports both ACLs while NFS
only supports UNIX ACLs, ACLs will not be shared between SMB and NFS.
'kShared' shares UNIX-like ACL permissions with the NFS protocol.
In shared mode both protocol ACL permissions are required to match.
When one protocol creates files or modifies permissions, they must comply
with the permission settings of the other protocol.
Attributes:
KSHARED: TODO: type description here.
KNATIVE: TODO: type description here.
"""
KSHARED = 'kShared'
KNATIVE = 'kNative'
| 30.888889 | 77 | 0.709832 | 112 | 834 | 5.285714 | 0.607143 | 0.016892 | 0.064189 | 0.077703 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007776 | 0.229017 | 834 | 26 | 78 | 32.076923 | 0.912908 | 0.827338 | 0 | 0 | 0 | 0 | 0.162791 | 0 | 0 | 0 | 0 | 0.076923 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b358b2195a26f9fb92eeb61fbf097c0eb34551b4 | 701 | py | Python | src/application/use_case/query/StationAvailabilitiesPredictionByDateTimeInPeriodFilterView.py | lechatquidanse/bicing-prediction-api | cc71f9a57d1151fa768ad2b3769b9a4df77289f6 | [
"Unlicense",
"MIT"
] | 5 | 2019-02-01T01:10:18.000Z | 2020-10-14T07:32:30.000Z | src/application/use_case/query/StationAvailabilitiesPredictionByDateTimeInPeriodFilterView.py | lechatquidanse/bicing-prediction-api | cc71f9a57d1151fa768ad2b3769b9a4df77289f6 | [
"Unlicense",
"MIT"
] | null | null | null | src/application/use_case/query/StationAvailabilitiesPredictionByDateTimeInPeriodFilterView.py | lechatquidanse/bicing-prediction-api | cc71f9a57d1151fa768ad2b3769b9a4df77289f6 | [
"Unlicense",
"MIT"
] | null | null | null | """
View for query station availabilities by filter
"""
import uuid
from pandas import DataFrame
from application.use_case.filter.ByDateTimeInPeriodFilter import ByDateTimeInPeriodFilter
class StationAvailabilitiesPredictionByDateTimeInPeriodFilterView:
def __init__(self, station_id: uuid, by_filter: ByDateTimeInPeriodFilter, predictions: DataFrame):
self._station_id = station_id
self._by_filter = by_filter
self._predictions = predictions
def station_id(self) -> uuid:
return self._station_id
def by_filter(self) -> ByDateTimeInPeriodFilter:
return self._by_filter
def predictions(self) -> DataFrame:
return self._predictions
| 28.04 | 102 | 0.757489 | 72 | 701 | 7.083333 | 0.333333 | 0.094118 | 0.076471 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.18117 | 701 | 24 | 103 | 29.208333 | 0.888502 | 0.067047 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.214286 | 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 |
b35f97b76a97190f63ad88ed4648477e8333d4ce | 2,781 | py | Python | safebay_final_web_app/safebay/forms.py | rhurst11/SafeBayProject | 4620e66dc7ba784c5eb29040534995d9482e0362 | [
"MIT"
] | null | null | null | safebay_final_web_app/safebay/forms.py | rhurst11/SafeBayProject | 4620e66dc7ba784c5eb29040534995d9482e0362 | [
"MIT"
] | null | null | null | safebay_final_web_app/safebay/forms.py | rhurst11/SafeBayProject | 4620e66dc7ba784c5eb29040534995d9482e0362 | [
"MIT"
] | null | null | null | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError
from flask_login import current_user
from safebay.models import User
class RegistrationForm(FlaskForm):
username = StringField('Username',
validators=[DataRequired(), Length(min=2, max=20)])
email = StringField('Email',
validators=[DataRequired(), Email()])
password = PasswordField('Password', validators=[DataRequired()])
confirm_password = PasswordField('Confirm Password',
validators=[DataRequired(), EqualTo('password')])
submit = SubmitField('Sign Up')
def validate_username(self, username):
user_exists = User.query.filter_by(username=username.data).first()
if user_exists:
raise ValidationError('That Username is taken, please choose a different one')
def validate_email(self, email):
email_exists = User.query.filter_by(email=email.data).first()
if email_exists:
raise ValidationError('That email is already registered, please choose a different one')
class LoginForm(FlaskForm):
email = StringField('Email',
validators=[DataRequired(), Email()])
password = PasswordField('Password', validators=[DataRequired()])
remember = BooleanField('Remember Me')
submit = SubmitField('Login')
class UpdateAccountForm(FlaskForm):
username = StringField('Username',
validators=[DataRequired(), Length(min=2, max=20)])
email = StringField('Email',
validators=[DataRequired(), Email()])
submit = SubmitField('Update')
def validate_username(self, username):
if username.data != current_user.username:
user_exists = User.query.filter_by(username=username.data).first()
if user_exists:
raise ValidationError('That Username is taken, please choose a different one')
def validate_email(self, email):
if email.data != current_user.email:
email_exists = User.query.filter_by(email=email.data).first()
if email_exists:
raise ValidationError('That email is already registered, please choose a different one')
class AuthenticationForm(FlaskForm):
email = StringField('Email',
validators=[DataRequired(), Email()])
password = PasswordField('Password', validators=[DataRequired()])
remember = BooleanField('Remember Me')
submit = SubmitField('Authenticate')
class Face_RegistrationForm():
image_file = StringField('Face')
submit = SubmitField('Register Face') | 41.507463 | 104 | 0.662711 | 274 | 2,781 | 6.638686 | 0.237226 | 0.120946 | 0.046179 | 0.068169 | 0.692688 | 0.663002 | 0.663002 | 0.663002 | 0.663002 | 0.663002 | 0 | 0.002809 | 0.231931 | 2,781 | 67 | 105 | 41.507463 | 0.848783 | 0 | 0 | 0.622642 | 0 | 0 | 0.13839 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.075472 | false | 0.113208 | 0.09434 | 0 | 0.603774 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
2fc4761fa4cfb6fff044d037ec5d911a76713ac8 | 435 | py | Python | tests/test_routes.py | calebsander/RuddockWebsite | e6497bfdecffdfb712c36085fa1df93d08380dd2 | [
"MIT"
] | 7 | 2015-01-31T20:07:23.000Z | 2020-04-11T16:36:08.000Z | tests/test_routes.py | calebsander/RuddockWebsite | e6497bfdecffdfb712c36085fa1df93d08380dd2 | [
"MIT"
] | 103 | 2015-01-01T08:31:41.000Z | 2022-02-14T06:17:58.000Z | tests/test_routes.py | mply/RuddockWebsite | 63f1f25da5bef842b5b2337592186f8e23c1803b | [
"MIT"
] | 8 | 2017-10-01T07:27:34.000Z | 2020-05-04T01:49:30.000Z | """
Tests routes that are not in a module.
"""
import flask
import http.client
from ruddock.testing.fixtures import client
def test_home(client):
"""Tests the / route."""
response = client.get(flask.url_for('home'))
assert response.status_code == http.client.OK
def test_contact(client):
"""Tests the /contact route."""
response = client.get(flask.url_for('show_contact'))
assert response.status_code == http.client.OK
| 22.894737 | 54 | 0.724138 | 63 | 435 | 4.888889 | 0.492063 | 0.097403 | 0.090909 | 0.142857 | 0.448052 | 0.448052 | 0.448052 | 0 | 0 | 0 | 0 | 0 | 0.137931 | 435 | 18 | 55 | 24.166667 | 0.821333 | 0.190805 | 0 | 0.222222 | 0 | 0 | 0.047904 | 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 |
2fc6117cf3b87ba2bc2443334fb466cadadedfb6 | 456 | py | Python | footle/models/matches.py | SupImDos/footle | ff9178e52d1577c96a8b6ec00883ead9317f8b46 | [
"MIT"
] | 1 | 2022-03-25T15:28:57.000Z | 2022-03-25T15:28:57.000Z | footle/models/matches.py | SupImDos/footle | ff9178e52d1577c96a8b6ec00883ead9317f8b46 | [
"MIT"
] | null | null | null | footle/models/matches.py | SupImDos/footle | ff9178e52d1577c96a8b6ec00883ead9317f8b46 | [
"MIT"
] | null | null | null | """Provides Match Enumeration for Footle"""
# Standard
import enum
# Third-Party
import pydantic
class Accuracy(enum.IntEnum):
"""Match Enumeration for Footle"""
WRONG = 0
CLOSE = 1
RIGHT = 2
class Direction(enum.IntEnum):
"""Numeric Match Enumeration for Footle"""
TOO_LOW = 0
EXACT = 1
TOO_HIGH = 2
class Match(pydantic.BaseModel):
"""Match Model for Footle"""
accuracy: Accuracy
direction: Direction
| 15.724138 | 46 | 0.662281 | 55 | 456 | 5.454545 | 0.509091 | 0.12 | 0.19 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017192 | 0.234649 | 456 | 28 | 47 | 16.285714 | 0.842407 | 0.324561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.153846 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2fdc329c394ac232e415c4eec14e5008eeb3e64d | 95 | py | Python | LicenseAnalysis/Compliance/apps.py | JiananHe/LicenseAnalysis | c34e02378e294d4ac0e27ee06b2dc47687e281e0 | [
"Apache-2.0"
] | 1 | 2020-10-28T07:09:41.000Z | 2020-10-28T07:09:41.000Z | LicenseAnalysis/Compliance/apps.py | JiananHe/LicenseAnalysis | c34e02378e294d4ac0e27ee06b2dc47687e281e0 | [
"Apache-2.0"
] | 1 | 2018-11-25T14:08:54.000Z | 2018-11-25T14:08:54.000Z | LicenseAnalysis/Compliance/apps.py | JiananHe/LicenseAnalysis | c34e02378e294d4ac0e27ee06b2dc47687e281e0 | [
"Apache-2.0"
] | 1 | 2022-03-20T16:37:41.000Z | 2022-03-20T16:37:41.000Z | from django.apps import AppConfig
class ComplianceConfig(AppConfig):
name = 'Compliance'
| 15.833333 | 34 | 0.768421 | 10 | 95 | 7.3 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157895 | 95 | 5 | 35 | 19 | 0.9125 | 0 | 0 | 0 | 0 | 0 | 0.105263 | 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 |
2fe9c5a2156e0af77340ad6efdef92e754439fa2 | 190 | py | Python | setup.py | yannl35133/sslib | 4c58487989aa06490a90cbcd0aa4c760937a9278 | [
"MIT"
] | null | null | null | setup.py | yannl35133/sslib | 4c58487989aa06490a90cbcd0aa4c760937a9278 | [
"MIT"
] | null | null | null | setup.py | yannl35133/sslib | 4c58487989aa06490a90cbcd0aa4c760937a9278 | [
"MIT"
] | null | null | null | from setuptools import setup
# TODO use versioneer
setup(
name='sslib',
version="0.9.0",
packages=['sslib'],
include_package_data=False,
install_requires=['nlzss11']
)
| 15.833333 | 32 | 0.668421 | 23 | 190 | 5.391304 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03268 | 0.194737 | 190 | 11 | 33 | 17.272727 | 0.777778 | 0.1 | 0 | 0 | 0 | 0 | 0.130178 | 0 | 0 | 0 | 0 | 0.090909 | 0 | 1 | 0 | true | 0 | 0.125 | 0 | 0.125 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2fec88e9eedfda28cd329e31916d50639efab7f2 | 237 | py | Python | tests/__init__.py | labbsr0x/flask-monitor | 579054efe6ccd98d5d5b30e98e39b1b463e5b538 | [
"MIT"
] | 1 | 2021-01-27T02:46:18.000Z | 2021-01-27T02:46:18.000Z | tests/__init__.py | labbsr0x/flask-monitor | 579054efe6ccd98d5d5b30e98e39b1b463e5b538 | [
"MIT"
] | 12 | 2020-01-30T14:55:12.000Z | 2021-12-29T13:46:38.000Z | tests/__init__.py | labbsr0x/flask-monitor | 579054efe6ccd98d5d5b30e98e39b1b463e5b538 | [
"MIT"
] | 2 | 2020-01-27T17:32:57.000Z | 2021-12-28T14:59:04.000Z | """
test
~~~~
Flask-Monitor is a simple extension to Flask allowing you to add
prometheus middleware to add basic but very useful metrics for
your Python Flask app.
:license: MIT, see LICENSE for more details.
""" | 29.625 | 68 | 0.683544 | 34 | 237 | 4.764706 | 0.794118 | 0.061728 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.248945 | 237 | 8 | 69 | 29.625 | 0.910112 | 0.864979 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
640cbfc8855756cbc188a60e0108949a2d0a9032 | 994 | py | Python | PyObjCTest/test_nslock.py | Khan/pyobjc-framework-Cocoa | f8b015ea2a72d8d78be6084fb12925c4785b8f1f | [
"MIT"
] | 132 | 2015-01-01T10:02:42.000Z | 2022-03-09T12:51:01.000Z | mac/pyobjc-framework-Cocoa/PyObjCTest/test_nslock.py | mba811/music-player | 7998986b34cfda2244ef622adefb839331b81a81 | [
"BSD-2-Clause"
] | 6 | 2015-01-06T08:23:19.000Z | 2019-03-14T12:22:06.000Z | mac/pyobjc-framework-Cocoa/PyObjCTest/test_nslock.py | mba811/music-player | 7998986b34cfda2244ef622adefb839331b81a81 | [
"BSD-2-Clause"
] | 27 | 2015-02-23T11:51:43.000Z | 2022-03-07T02:34:18.000Z | from Foundation import *
import objc
from PyObjCTools.TestSupport import *
class TestNSLockProtocols (TestCase):
def testLockIsLock(self):
# Test for bug #1735937
lock = NSLock.alloc().init()
self.assert_(lock.conformsToProtocol_(objc.protocolNamed("NSLocking")))
self.assert_(lock.conformsToProtocol_(protocols.NSLocking))
def testMethods(self):
self.assertResultIsBOOL(NSLock.tryLock)
self.assertResultIsBOOL(NSLock.lockBeforeDate_)
self.assertResultIsBOOL(NSConditionLock.tryLock)
self.assertResultIsBOOL(NSConditionLock.tryLockWhenCondition_)
self.assertResultIsBOOL(NSConditionLock.lockBeforeDate_)
self.assertResultIsBOOL(NSConditionLock.lockWhenCondition_beforeDate_)
self.assertResultIsBOOL(NSRecursiveLock.tryLock)
self.assertResultIsBOOL(NSRecursiveLock.lockBeforeDate_)
self.assertResultIsBOOL(NSCondition.waitUntilDate_)
if __name__ == "__main__":
main()
| 30.121212 | 79 | 0.748491 | 80 | 994 | 9.0625 | 0.4875 | 0.273103 | 0.204138 | 0.088276 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008475 | 0.169014 | 994 | 32 | 80 | 31.0625 | 0.869249 | 0.020121 | 0 | 0 | 0 | 0 | 0.017508 | 0 | 0 | 0 | 0 | 0 | 0.55 | 1 | 0.1 | false | 0 | 0.15 | 0 | 0.3 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
641730da4f830a5e28c5835511461bc88b4cc2fa | 326 | py | Python | quoteblog/quotes/forms.py | SlavicPixel/quoteblog | 9875bffd98badd4d7c4eea505987c7c772e6795d | [
"MIT"
] | null | null | null | quoteblog/quotes/forms.py | SlavicPixel/quoteblog | 9875bffd98badd4d7c4eea505987c7c772e6795d | [
"MIT"
] | null | null | null | quoteblog/quotes/forms.py | SlavicPixel/quoteblog | 9875bffd98badd4d7c4eea505987c7c772e6795d | [
"MIT"
] | null | null | null | from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired, ValidationError
class QuoteForm(FlaskForm):
author_guess = StringField('Your Guess:', validators=[DataRequired()])
submit = SubmitField('Guess') | 40.75 | 74 | 0.806748 | 36 | 326 | 7.222222 | 0.555556 | 0.069231 | 0.092308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116564 | 326 | 8 | 75 | 40.75 | 0.902778 | 0 | 0 | 0 | 0 | 0 | 0.04893 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
643079a729c11f4ecb92d52695b097a98416e81a | 1,203 | py | Python | nativedroid/nativedroid/analyses/resolver/jni/java_type/primitive.py | CherishAZ/Argus-SAF | 06596c6bb03fe2560030b52bf2b47d17d1bd3068 | [
"Apache-2.0"
] | 152 | 2016-06-10T19:10:03.000Z | 2022-02-26T12:43:00.000Z | nativedroid/nativedroid/analyses/resolver/jni/java_type/primitive.py | CherishAZ/Argus-SAF | 06596c6bb03fe2560030b52bf2b47d17d1bd3068 | [
"Apache-2.0"
] | 83 | 2016-07-08T16:49:37.000Z | 2022-01-16T10:48:27.000Z | nativedroid/nativedroid/analyses/resolver/jni/java_type/primitive.py | CherishAZ/Argus-SAF | 06596c6bb03fe2560030b52bf2b47d17d1bd3068 | [
"Apache-2.0"
] | 47 | 2016-06-22T01:28:21.000Z | 2022-03-06T14:18:08.000Z | from nativedroid.analyses.resolver.jni.jtype import JType
__author__ = "Xingwei Lin, Fengguo Wei"
__copyright__ = "Copyright 2018, The Argus-SAF Project"
__license__ = "Apache v2.0"
class JBoolean(JType):
def __init__(self, project):
super(JBoolean, self).__init__(project, 'jboolean', 1)
class JByte(JType):
def __init__(self, project):
super(JByte, self).__init__(project, 'jbyte', 1)
class JChar(JType):
def __init__(self, project):
super(JChar, self).__init__(project, 'jchar', 2)
class JShort(JType):
def __init__(self, project):
super(JShort, self).__init__(project, 'jshort', 2)
class JInt(JType):
def __init__(self, project):
super(JInt, self).__init__(project, 'jint', 4)
class JLong(JType):
def __init__(self, project):
super(JLong, self).__init__(project, 'jlong', 8)
class JFloat(JType):
def __init__(self, project):
super(JFloat, self).__init__(project, 'jfloat', 4)
class JDouble(JType):
def __init__(self, project):
super(JDouble, self).__init__(project, 'jdouble', 8)
class Void(JType):
def __init__(self, project):
super(Void, self).__init__(project, 'void')
| 23.588235 | 62 | 0.669992 | 149 | 1,203 | 4.845638 | 0.268456 | 0.099723 | 0.149584 | 0.199446 | 0.34903 | 0.34903 | 0 | 0 | 0 | 0 | 0 | 0.014359 | 0.189526 | 1,203 | 50 | 63 | 24.06 | 0.726154 | 0 | 0 | 0.290323 | 0 | 0 | 0.101413 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.290323 | false | 0 | 0.032258 | 0 | 0.612903 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6431c797dbddcefafb61770186940513e1271b17 | 791 | py | Python | release/stubs.min/System/Runtime/InteropServices/__init___parts/FieldOffsetAttribute.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 182 | 2017-06-27T02:26:15.000Z | 2022-03-30T18:53:43.000Z | release/stubs.min/System/Runtime/InteropServices/__init___parts/FieldOffsetAttribute.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 28 | 2017-06-27T13:38:23.000Z | 2022-03-15T11:19:44.000Z | release/stubs.min/System/Runtime/InteropServices/__init___parts/FieldOffsetAttribute.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 67 | 2017-06-28T09:43:59.000Z | 2022-03-20T21:17:10.000Z | class FieldOffsetAttribute(Attribute,_Attribute):
"""
Indicates the physical position of fields within the unmanaged representation of a class or structure.
FieldOffsetAttribute(offset: int)
"""
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,offset):
""" __new__(cls: type,offset: int) """
pass
Value=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the offset from the beginning of the structure to the beginning of the field.
Get: Value(self: FieldOffsetAttribute) -> int
"""
| 28.25 | 215 | 0.709229 | 98 | 791 | 5.22449 | 0.459184 | 0.087891 | 0.09375 | 0.111328 | 0.220703 | 0.220703 | 0.220703 | 0.220703 | 0.220703 | 0.220703 | 0 | 0 | 0.174463 | 791 | 27 | 216 | 29.296296 | 0.784074 | 0.475348 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.285714 | 0 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
643342f23eeb16b9efd20cde6944de8e09d83bd1 | 148 | py | Python | fast_bfmatcher/__init__.py | kmkolasinski/fast-bfmatcher | 4f858a1ca686002c328c117eb8da18eaca3a2325 | [
"MIT"
] | null | null | null | fast_bfmatcher/__init__.py | kmkolasinski/fast-bfmatcher | 4f858a1ca686002c328c117eb8da18eaca3a2325 | [
"MIT"
] | null | null | null | fast_bfmatcher/__init__.py | kmkolasinski/fast-bfmatcher | 4f858a1ca686002c328c117eb8da18eaca3a2325 | [
"MIT"
] | null | null | null | from fast_bfmatcher.matchers import (
FastL2CCBFMatcher,
FastL2RTBFMatcher,
FastL2RTCCBFMatcher,
Matcher,
l2_distance_matrix,
)
| 18.5 | 37 | 0.743243 | 12 | 148 | 8.916667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033898 | 0.202703 | 148 | 7 | 38 | 21.142857 | 0.872881 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.142857 | 0 | 0.142857 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ff324888e21e010bad15041dbb8df4cb5bb5d378 | 1,375 | py | Python | autokeras/const.py | sugendran/autokeras | 0d6bc294964759e1f135fdb61c0c0fc7d83fd542 | [
"MIT"
] | 1 | 2020-03-05T01:54:29.000Z | 2020-03-05T01:54:29.000Z | autokeras/const.py | mhlee0328/autokeras | 4ceb4939b33823d90fca00c581e4cedab6d7a3b0 | [
"MIT"
] | null | null | null | autokeras/const.py | mhlee0328/autokeras | 4ceb4939b33823d90fca00c581e4cedab6d7a3b0 | [
"MIT"
] | null | null | null | INITIAL_HPS = {
'image_classifier': [{
'image_block_1/block_type': 'vanilla',
'image_block_1/normalize': True,
'image_block_1/augment': False,
'image_block_1_vanilla/kernel_size': 3,
'image_block_1_vanilla/num_blocks': 1,
'image_block_1_vanilla/separable': False,
'image_block_1_vanilla/dropout_rate': 0.25,
'image_block_1_vanilla/filters_0_1': 32,
'image_block_1_vanilla/filters_0_2': 64,
'spatial_reduction_1/reduction_type': 'flatten',
'dense_block_1/num_layers': 1,
'dense_block_1/use_batchnorm': False,
'dense_block_1/dropout_rate': 0,
'dense_block_1/units_0': 128,
'classification_head_1/dropout_rate': 0.5,
'optimizer': 'adam'
}, {
'image_block_1/block_type': 'resnet',
'image_block_1/normalize': True,
'image_block_1/augment': True,
'image_block_1_resnet/version': 'v2',
'image_block_1_resnet/pooling': 'avg',
'image_block_1_resnet/conv3_depth': 4,
'image_block_1_resnet/conv4_depth': 6,
'dense_block_1/num_layers': 2,
'dense_block_1/use_batchnorm': False,
'dense_block_1/dropout_rate': 0,
'dense_block_1/units_0': 32,
'dense_block_1/units_1': 32,
'classification_head_1/dropout_rate': 0,
'optimizer': 'adam'
}],
}
| 38.194444 | 56 | 0.638545 | 183 | 1,375 | 4.300546 | 0.273224 | 0.190597 | 0.223634 | 0.13723 | 0.584498 | 0.424396 | 0.279543 | 0.279543 | 0.279543 | 0.172808 | 0 | 0.059772 | 0.233455 | 1,375 | 35 | 57 | 39.285714 | 0.686907 | 0 | 0 | 0.228571 | 0 | 0 | 0.609455 | 0.560727 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ff379e2e532b793a9f3db21321435ec6bbf69e31 | 314 | py | Python | tests/test_maxscoreagent.py | torlenor/kalah | 12a5520445c60855ed42c5bd30e512c168d531ca | [
"MIT"
] | 1 | 2020-11-30T21:20:33.000Z | 2020-11-30T21:20:33.000Z | tests/test_maxscoreagent.py | torlenor/kalah | 12a5520445c60855ed42c5bd30e512c168d531ca | [
"MIT"
] | 6 | 2020-11-13T11:07:53.000Z | 2020-11-13T14:33:32.000Z | tests/test_maxscoreagent.py | torlenor/kalah | 12a5520445c60855ed42c5bd30e512c168d531ca | [
"MIT"
] | 1 | 2020-12-10T17:53:06.000Z | 2020-12-10T17:53:06.000Z | import random
from kalah.kalahboard import KalahBoard
from kalah.agents.maxscoreagent import MaxScoreAgent
import unittest
class Test_MaxScoreAgent(unittest.TestCase):
def test_maxscoreagent(self):
# No additional tests, see utils tests
pass
if __name__ == '__main__':
unittest.main()
| 19.625 | 52 | 0.751592 | 36 | 314 | 6.277778 | 0.611111 | 0.079646 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.184713 | 314 | 15 | 53 | 20.933333 | 0.882813 | 0.11465 | 0 | 0 | 0 | 0 | 0.028986 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.111111 | 0.444444 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
ff5e77bd043e6cc2e18797bdad5957d238bf8099 | 202 | py | Python | EgammaAnalysis/CSA07Skims/python/EgammaZJetToMuHLT_cfi.py | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 1 | 2019-08-09T08:42:11.000Z | 2019-08-09T08:42:11.000Z | EgammaAnalysis/CSA07Skims/python/EgammaZJetToMuHLT_cfi.py | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | null | null | null | EgammaAnalysis/CSA07Skims/python/EgammaZJetToMuHLT_cfi.py | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 1 | 2019-04-03T19:23:27.000Z | 2019-04-03T19:23:27.000Z | import FWCore.ParameterSet.Config as cms
import copy
from HLTrigger.HLTfilters.hltHighLevel_cfi import *
EgammaZJetToMuHLT = copy.deepcopy(hltHighLevel)
EgammaZJetToMuHLT.HLTPaths = ['HLT_DoubleMu3']
| 25.25 | 51 | 0.836634 | 22 | 202 | 7.590909 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005435 | 0.089109 | 202 | 7 | 52 | 28.857143 | 0.902174 | 0 | 0 | 0 | 0 | 0 | 0.064677 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
ff9ddb0d9ea010a317a1cbe6963d1f5861f364a9 | 433 | py | Python | rocketgram/inlineresults/__init__.py | waneroy/rocketgram | b84d12772a743a534878e417cd8c1f3c7d4ace1f | [
"MIT"
] | null | null | null | rocketgram/inlineresults/__init__.py | waneroy/rocketgram | b84d12772a743a534878e417cd8c1f3c7d4ace1f | [
"MIT"
] | null | null | null | rocketgram/inlineresults/__init__.py | waneroy/rocketgram | b84d12772a743a534878e417cd8c1f3c7d4ace1f | [
"MIT"
] | 1 | 2021-02-26T14:21:59.000Z | 2021-02-26T14:21:59.000Z | # Copyright (C) 2015-2019 by Vd.
# This file is part of RocketGram, the modern Telegram bot framework.
# RocketGram is released under the MIT License (see LICENSE).
from .contactmessagecontent import ContactMessageContent
from .inlineresults import InlineQueryResults
from .locationmessagecontent import LocationMessageContent
from .textmessagecontent import TextMessageContent
from .venuemessagecontent import VenueMessageContent
| 39.363636 | 69 | 0.845266 | 46 | 433 | 7.956522 | 0.652174 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020888 | 0.115473 | 433 | 10 | 70 | 43.3 | 0.934726 | 0.364896 | 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 |
ffb5bd53ba1e2d00af1f6b5fc70781bf6788c48d | 886 | py | Python | pyVenv/src/InventoryManagement/InvManage/migrations/0009_auto_20200325_1939.py | thephilosophicaljijutsumaster/InventoryManagement | 7c57fcc435976c39b249106642ee848da2eea201 | [
"MIT"
] | null | null | null | pyVenv/src/InventoryManagement/InvManage/migrations/0009_auto_20200325_1939.py | thephilosophicaljijutsumaster/InventoryManagement | 7c57fcc435976c39b249106642ee848da2eea201 | [
"MIT"
] | 12 | 2020-07-05T14:30:46.000Z | 2020-08-06T21:06:00.000Z | pyVenv/src/InventoryManagement/InvManage/migrations/0009_auto_20200325_1939.py | thephilosophicaljijutsumaster/InventoryManagement | 7c57fcc435976c39b249106642ee848da2eea201 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.4 on 2020-03-25 14:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('InvManage', '0008_auto_20200325_1938'),
]
operations = [
migrations.AlterField(
model_name='product',
name='height',
field=models.FloatField(blank=True, null=True),
),
migrations.AlterField(
model_name='product',
name='length',
field=models.FloatField(blank=True, null=True),
),
migrations.AlterField(
model_name='product',
name='weight',
field=models.FloatField(blank=True, null=True),
),
migrations.AlterField(
model_name='product',
name='width',
field=models.FloatField(blank=True, null=True),
),
]
| 26.058824 | 59 | 0.557562 | 85 | 886 | 5.729412 | 0.458824 | 0.164271 | 0.205339 | 0.238193 | 0.640657 | 0.640657 | 0.558522 | 0.480493 | 0.480493 | 0.480493 | 0 | 0.051667 | 0.322799 | 886 | 33 | 60 | 26.848485 | 0.76 | 0.05079 | 0 | 0.592593 | 1 | 0 | 0.098927 | 0.027414 | 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 |
ffb6819c0facb1846f1dbee6b5a99a8a50ce5a36 | 29 | py | Python | visualization/__init__.py | aleisalem/Maat | 702c88a6a86f0b56e504df8f4d7ba18e8a39c887 | [
"Apache-2.0"
] | 4 | 2019-10-11T12:19:29.000Z | 2020-08-06T21:45:10.000Z | visualization/__init__.py | aleisalem/Maat | 702c88a6a86f0b56e504df8f4d7ba18e8a39c887 | [
"Apache-2.0"
] | null | null | null | visualization/__init__.py | aleisalem/Maat | 702c88a6a86f0b56e504df8f4d7ba18e8a39c887 | [
"Apache-2.0"
] | 1 | 2021-01-05T11:50:22.000Z | 2021-01-05T11:50:22.000Z | __all__ = ["visualize_data"]
| 14.5 | 28 | 0.724138 | 3 | 29 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103448 | 29 | 1 | 29 | 29 | 0.615385 | 0 | 0 | 0 | 0 | 0 | 0.482759 | 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 |
44069c20f4d76b16cd711c0ce1fd144cc7cfea7f | 1,942 | py | Python | mods/LuisfemdDevGame.py | luisfemd/BombSquad-Community-Mod-Manager | c5ffa47683a8ca17bb2c0c86bb56a1da9c26c117 | [
"Unlicense"
] | null | null | null | mods/LuisfemdDevGame.py | luisfemd/BombSquad-Community-Mod-Manager | c5ffa47683a8ca17bb2c0c86bb56a1da9c26c117 | [
"Unlicense"
] | null | null | null | mods/LuisfemdDevGame.py | luisfemd/BombSquad-Community-Mod-Manager | c5ffa47683a8ca17bb2c0c86bb56a1da9c26c117 | [
"Unlicense"
] | null | null | null | import bs
# so the game knows to ignore out-of-date ones.
def bsGetAPIVersion():
return 4
# how BombSquad asks us what games we provide
def bsGetGames():
return [LuisfemdDevGame]
#class PlayerLleva(bs.PlayerSpaz):
#
# def handleMessage(self, message):
# if isinstance(message,bs.HitMessage):
# name = self.getName()
# bs.sreenMessage(name + " la lleva")
class LuisfemdDevGame(bs.TeamGameActivity):
@classmethod
def getName(cls):
return 'Initial Dev Game'
@classmethod
def getDescription(cls,sessionType):
return 'My first bombsquad bomb game: La lleva.'
def onBegin(self):
bs.TeamGameActivity.onBegin(self)
# game's starting - let's just set a timer to end it in 5 seconds
bs.screenMessage("La lleva... Ending in 60 seconds...")
#bs.Powerup(self, position=(10, 21, 30), powerupType='curse', expire=False)
# bs.Powerup(position=(0,0,0),powerupType='health').autoRetain()
self._endGameTimer = bs.Timer(5000, bs.WeakCall(self.endGame))
def endGame(self):
# game's over - set a score for each team and tell our activity to finish
ourResults = bs.TeamGameResults()
for team in self.teams: ourResults.setTeamScore(team,0)
self.end(results=ourResults)
# def onPlayerJoin(self, player):
#bs.TeamGameActivity.onPlayerJoin(self, player)
# self.spawnPlayer(player)AA
# def spawnPlayer(self, player):
# #spaz = self.spawnPlayerSpaz(player)
# spaz = PlayerLleva(color=player.color, highlight=player.highlight, character=player.character, player=player)
#
#
# # lets reconnect this player's controls to this
# # spaz but *without* the ability to attack or pick stuff up
# #spaz.connectControlsToPlayer(enablePunch=True, enableBomb=False, enablePickUp=True)
# player.setActor(spaz)
# #spaz.curse()
| 32.366667 | 118 | 0.661174 | 233 | 1,942 | 5.506438 | 0.532189 | 0.016368 | 0.01403 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012024 | 0.229145 | 1,942 | 59 | 119 | 32.915254 | 0.845023 | 0.583419 | 0 | 0.1 | 0 | 0 | 0.115681 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.05 | 0.2 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
442492106ed3e4508ac192ddaca01031d68cb1c3 | 109 | py | Python | touchtechnology/admin/__init__.py | goodtune/vitriolic | d135eecf7acbc229a872585ebafb8bbefca52df4 | [
"BSD-3-Clause"
] | null | null | null | touchtechnology/admin/__init__.py | goodtune/vitriolic | d135eecf7acbc229a872585ebafb8bbefca52df4 | [
"BSD-3-Clause"
] | 28 | 2016-12-09T21:14:19.000Z | 2022-01-11T07:17:16.000Z | touchtechnology/admin/__init__.py | goodtune/vitriolic | d135eecf7acbc229a872585ebafb8bbefca52df4 | [
"BSD-3-Clause"
] | null | null | null | from django.contrib.admin import autodiscover
default_app_config = "touchtechnology.admin.apps.AdminConfig"
| 27.25 | 61 | 0.853211 | 13 | 109 | 7 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073395 | 109 | 3 | 62 | 36.333333 | 0.90099 | 0 | 0 | 0 | 0 | 0 | 0.348624 | 0.348624 | 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 |
44408ea21010cf004ddc5647cdc08accab8ea1d5 | 1,059 | py | Python | tests/priority_queue_unit_test.py | ivanv6/pycompressor | cc1b9986cdb2e9fcf88af7224f03e58cfaa30e62 | [
"MIT"
] | null | null | null | tests/priority_queue_unit_test.py | ivanv6/pycompressor | cc1b9986cdb2e9fcf88af7224f03e58cfaa30e62 | [
"MIT"
] | 1 | 2020-11-11T15:58:55.000Z | 2020-11-11T15:58:55.000Z | tests/priority_queue_unit_test.py | ivanv6/pycompressor | cc1b9986cdb2e9fcf88af7224f03e58cfaa30e62 | [
"MIT"
] | 1 | 2020-11-11T15:12:55.000Z | 2020-11-11T15:12:55.000Z | import unittest
from pycompressor.priority_queue import MinPQ
class MinPQUnitTest(unittest.TestCase):
def test_pq(self):
pq = MinPQ()
pq.enqueue(100)
pq.enqueue(200)
for i in range(20):
pq.enqueue(19 - i)
self.assertEqual(pq.size(), 22)
self.assertFalse(pq.is_empty())
for i in range(20):
self.assertEqual(pq.del_min(), i)
self.assertEqual(pq.del_min(), 100)
self.assertEqual(pq.del_min(), 200)
self.assertTrue(pq.is_empty())
def test_max_pq(self):
pq = MinPQ(compare=lambda x, y: y - x)
pq.enqueue(100)
pq.enqueue(200)
for i in range(20):
pq.enqueue(19 - i)
self.assertEqual(pq.size(), 22)
self.assertFalse(pq.is_empty())
self.assertEqual(pq.del_min(), 200)
self.assertEqual(pq.del_min(), 100)
for i in range(20):
self.assertEqual(pq.del_min(), 19 - i)
self.assertTrue(pq.is_empty())
if __name__ == '__main__':
unittest.main() | 24.627907 | 50 | 0.576015 | 143 | 1,059 | 4.111888 | 0.27972 | 0.204082 | 0.231293 | 0.204082 | 0.704082 | 0.632653 | 0.55102 | 0.44898 | 0.44898 | 0.44898 | 0 | 0.055851 | 0.289896 | 1,059 | 43 | 51 | 24.627907 | 0.726064 | 0 | 0 | 0.645161 | 0 | 0 | 0.007547 | 0 | 0 | 0 | 0 | 0 | 0.387097 | 1 | 0.064516 | false | 0 | 0.064516 | 0 | 0.16129 | 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 |
444f43900086aabc863edd73901e5489c9b4ce58 | 869 | py | Python | rfidsecuritysvc/util/auth.py | bcurnow/rfid-security-svc | d3806cb74d3d0cc2623ea425230dc8781ba4d8b4 | [
"Apache-2.0"
] | null | null | null | rfidsecuritysvc/util/auth.py | bcurnow/rfid-security-svc | d3806cb74d3d0cc2623ea425230dc8781ba4d8b4 | [
"Apache-2.0"
] | null | null | null | rfidsecuritysvc/util/auth.py | bcurnow/rfid-security-svc | d3806cb74d3d0cc2623ea425230dc8781ba4d8b4 | [
"Apache-2.0"
] | null | null | null | from secrets import token_urlsafe
from connexion.exceptions import OAuthProblem
from werkzeug.security import check_password_hash, generate_password_hash
from rfidsecuritysvc.model import config
API_KEY_CONFIG_KEY = 'ADMIN_API_KEY'
API_KEY_SIZE = 64
def generate_api_key():
"""Generates a new 512-bit secure token, hashes it and stores it in the config table, returns the unhashed value"""
# Generate a 1024 token
token = token_urlsafe(API_KEY_SIZE)
# Always delete first to avoid a duplicate key error
config.delete(API_KEY_CONFIG_KEY)
config.create(API_KEY_CONFIG_KEY, generate_password_hash(token))
return token
def verify_apikey(apikey, required_scopes):
if check_password_hash(config.get(API_KEY_CONFIG_KEY).value, apikey):
return {'uid': 'Admin API Key'}
raise OAuthProblem(f'Invalid authentication: "{apikey}"')
| 34.76 | 119 | 0.776755 | 126 | 869 | 5.103175 | 0.47619 | 0.083981 | 0.07465 | 0.093313 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012212 | 0.151899 | 869 | 24 | 120 | 36.208333 | 0.860244 | 0.210587 | 0 | 0 | 1 | 0 | 0.092784 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0.2 | 0.266667 | 0 | 0.533333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
448cba7c77bd81e019294761089b6481f64e5158 | 1,378 | py | Python | proj01_ifelse/rockpaper sisors.py | wesleyhodge/vsa-programing | 7cd91a057bde938605390da27036896c976a4fc3 | [
"MIT"
] | 1 | 2018-12-07T01:40:33.000Z | 2018-12-07T01:40:33.000Z | proj01_ifelse/rockpaper sisors.py | wesleyhodge/vsa-programing | 7cd91a057bde938605390da27036896c976a4fc3 | [
"MIT"
] | null | null | null | proj01_ifelse/rockpaper sisors.py | wesleyhodge/vsa-programing | 7cd91a057bde938605390da27036896c976a4fc3 | [
"MIT"
] | null | null | null | import random
loop_control=0
while loop_control==0:
p1=raw_input("player 1 enter rock, paper, or scissors:")
p1=p1.lower()
p2=random.randint(1,3)
if p1=="rock" and p2==3:
print "computer played scissors"
print "player 1 won."
elif p1=="scissor" and p2==1:
print "computer played rock"
print "computer won."
elif p1=="rock" and p2==1:
print "computer played rock"
print "tie"
elif p1=="scissors" and p2==3:
print "computer played scissors"
print "tie"
elif p1=="paper" and p2==1:
print "computer played rock"
print "player 1 won"
elif p1=="rock" and p2==2:
print "computer played paper"
print "computer won"
elif p1=="paper" and p2==2:
print "computer played paper"
print "tie"
elif p1=="scissors" and p2==2:
print "computer played paper"
print "player one won"
elif p1=="paper" and p2==3:
print "computer played scissors"
print "computer won"
else:
print "incorrect spelling"
q=raw_input("would you like to keep playing? (lower case)(yes or no)")
if q=="yes" or q=="yea" or q=="yeah" or q=="sure" or q=="ok":
loop_control=0
elif q=="no" or q=="nope" or q=="exit":
loop_control=1
else:
print "incorrect spelling"
loop_control=1 | 32.046512 | 74 | 0.582003 | 199 | 1,378 | 3.994975 | 0.251256 | 0.196226 | 0.215094 | 0.041509 | 0.577358 | 0.543396 | 0.446541 | 0.403774 | 0 | 0 | 0 | 0.041965 | 0.291001 | 1,378 | 43 | 75 | 32.046512 | 0.77175 | 0 | 0 | 0.511628 | 0 | 0 | 0.353154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.023256 | null | null | 0.465116 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
9220eafb9a3fd829b5d170d18d0f85c84c6f6fc4 | 103 | py | Python | atcoder/abc168/a.py | sugitanishi/competitive-programming | 51af65fdce514ece12f8afbf142b809d63eefb5d | [
"MIT"
] | null | null | null | atcoder/abc168/a.py | sugitanishi/competitive-programming | 51af65fdce514ece12f8afbf142b809d63eefb5d | [
"MIT"
] | null | null | null | atcoder/abc168/a.py | sugitanishi/competitive-programming | 51af65fdce514ece12f8afbf142b809d63eefb5d | [
"MIT"
] | null | null | null | s=input()
if s[-1] in '24579':
print('hon')
elif s[-1] in '0168':
print('pon')
else:
print('bon') | 14.714286 | 21 | 0.553398 | 19 | 103 | 3 | 0.684211 | 0.070175 | 0.140351 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129412 | 0.174757 | 103 | 7 | 22 | 14.714286 | 0.541176 | 0 | 0 | 0 | 0 | 0 | 0.173077 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 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 |
923a4230495a62872a1700478191b1a6ff98df59 | 27 | py | Python | Packages/Dead/globus/__init__.py | xylar/cdat | 8a5080cb18febfde365efc96147e25f51494a2bf | [
"BSD-3-Clause"
] | 62 | 2018-03-30T15:46:56.000Z | 2021-12-08T23:30:24.000Z | Packages/Dead/globus/__init__.py | xylar/cdat | 8a5080cb18febfde365efc96147e25f51494a2bf | [
"BSD-3-Clause"
] | 114 | 2018-03-21T01:12:43.000Z | 2021-07-05T12:29:54.000Z | Packages/Dead/globus/__init__.py | CDAT/uvcdat | 5133560c0c049b5c93ee321ba0af494253b44f91 | [
"BSD-3-Clause"
] | 14 | 2018-06-06T02:42:47.000Z | 2021-11-26T03:27:00.000Z | __all__ = ['grid_storage']
| 13.5 | 26 | 0.703704 | 3 | 27 | 4.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 27 | 1 | 27 | 27 | 0.583333 | 0 | 0 | 0 | 0 | 0 | 0.444444 | 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 |
9262897e813baea65299a6404c77c3af5dd98693 | 586 | py | Python | torabot/mods/feed/views/web.py | Answeror/torabot | b6260190ec1f0dc8bf3f7ba3512c0522668c59ed | [
"MIT"
] | 42 | 2015-01-20T10:45:08.000Z | 2021-04-17T05:10:27.000Z | torabot/mods/feed/views/web.py | Answeror/torabot | b6260190ec1f0dc8bf3f7ba3512c0522668c59ed | [
"MIT"
] | 4 | 2015-01-23T05:40:44.000Z | 2016-12-19T03:52:20.000Z | torabot/mods/feed/views/web.py | Answeror/torabot | b6260190ec1f0dc8bf3f7ba3512c0522668c59ed | [
"MIT"
] | 8 | 2015-05-07T03:51:05.000Z | 2019-03-20T05:40:47.000Z | from flask import render_template
from ..query import parse as parse_query
def format_query_result(query):
return {
'uri': format_uri_result,
}[parse_query(query.text).method](query)
def format_uri_result(query):
return render_template('feed/result/uri.html', query=query)
def format_notice_body(notice):
return {
'feed.new': format_uri_notice
}[notice.change.kind](notice)
def format_uri_notice(notice):
return render_template('feed/notice/uri.html', notice=notice)
def format_help_page():
return render_template('feed/help.html')
| 21.703704 | 65 | 0.728669 | 81 | 586 | 5.024691 | 0.296296 | 0.110565 | 0.103194 | 0.176904 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156997 | 586 | 26 | 66 | 22.538462 | 0.823887 | 0 | 0 | 0.125 | 0 | 0 | 0.110922 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0 | 0.125 | 0.3125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
92666d3708024a3eec0da2de267b2cf65efe1bd2 | 305 | py | Python | py/external/_dummy/setproctitle.py | arccode/factory | a1b0fccd68987d8cd9c89710adc3c04b868347ec | [
"BSD-3-Clause"
] | 3 | 2022-01-06T16:52:52.000Z | 2022-03-07T11:30:47.000Z | py/external/_dummy/setproctitle.py | arccode/factory | a1b0fccd68987d8cd9c89710adc3c04b868347ec | [
"BSD-3-Clause"
] | null | null | null | py/external/_dummy/setproctitle.py | arccode/factory | a1b0fccd68987d8cd9c89710adc3c04b868347ec | [
"BSD-3-Clause"
] | 1 | 2021-10-24T01:47:22.000Z | 2021-10-24T01:47:22.000Z | # Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Dummy implementation for setproctitle."""
import logging
def setproctitle(message):
logging.info('Dummy setproctitle: %s', message)
| 27.727273 | 72 | 0.760656 | 44 | 305 | 5.272727 | 0.840909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015564 | 0.157377 | 305 | 10 | 73 | 30.5 | 0.88716 | 0.64918 | 0 | 0 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
926ecec8ea5e5ad9590ee16a4c888a0d06c6892a | 631 | py | Python | Random number generator.py | Sherlock5000/python-projects | b3f8fc602c6a816164116a227741077af5aee22d | [
"Apache-2.0"
] | null | null | null | Random number generator.py | Sherlock5000/python-projects | b3f8fc602c6a816164116a227741077af5aee22d | [
"Apache-2.0"
] | null | null | null | Random number generator.py | Sherlock5000/python-projects | b3f8fc602c6a816164116a227741077af5aee22d | [
"Apache-2.0"
] | null | null | null | import random
for num in range(1):
number = random.randint(1, 101)
entered_number = input("Guess a number:")
entered_number = int(entered_number)
if entered_number > number:
print("You were off by ", entered_number - number)
print("The random number generated was ", number)
elif entered_number < number:
print("You were off by ", entered_number - number)
print("The random number generated was ", number)
elif entered_number == number:
print("You have guessed correctly !!. The number is indeed ", entered_number)
else:
print("Input has been given incorrectly. Please try again.")
| 33.210526 | 82 | 0.698891 | 86 | 631 | 5.023256 | 0.44186 | 0.270833 | 0.219907 | 0.277778 | 0.511574 | 0.511574 | 0.511574 | 0.511574 | 0.511574 | 0.511574 | 0 | 0.00996 | 0.204437 | 631 | 18 | 83 | 35.055556 | 0.850598 | 0 | 0 | 0.266667 | 0 | 0 | 0.349103 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.066667 | 0.4 | 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 |
92a46672aa16dcc12aad7ef3d88ec897d4887693 | 66 | py | Python | secrets_template.py | haxelcaribou/MinesweeperBot | 3fdd4d83f7b8787c0615be112ad5e6fca4771d87 | [
"MIT"
] | null | null | null | secrets_template.py | haxelcaribou/MinesweeperBot | 3fdd4d83f7b8787c0615be112ad5e6fca4771d87 | [
"MIT"
] | null | null | null | secrets_template.py | haxelcaribou/MinesweeperBot | 3fdd4d83f7b8787c0615be112ad5e6fca4771d87 | [
"MIT"
] | null | null | null | # rename file to secrets.py
token = "YOUR DISCORD BOT TOKEN HERE"
| 22 | 37 | 0.742424 | 11 | 66 | 4.454545 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 66 | 2 | 38 | 33 | 0.907407 | 0.378788 | 0 | 0 | 0 | 0 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
92a62f24f62e37142b9708b4ebf14844b3a88591 | 1,850 | py | Python | admin_app.py | nitindantu/Facial | 1f71be1c110ea423fc6f0f079e6738e15b26895f | [
"Apache-2.0"
] | null | null | null | admin_app.py | nitindantu/Facial | 1f71be1c110ea423fc6f0f079e6738e15b26895f | [
"Apache-2.0"
] | null | null | null | admin_app.py | nitindantu/Facial | 1f71be1c110ea423fc6f0f079e6738e15b26895f | [
"Apache-2.0"
] | null | null | null | from datetime import date
from flask import Flask, render_template, request, redirect, url_for, Response, session, flash
from flask_mongoengine import MongoEngine, Document
from flask_wtf import FlaskForm
from PIL import Image, ImageDraw
from wtforms import StringField, PasswordField
from wtforms import form
from wtforms.fields import DateField
from wtforms.fields.core import RadioField
import cv2
import json
import requests
import pymongo
from wtforms.form import Form
from wtforms.validators import Email, Length, InputRequired
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user
from flask_mail import Mail, Message
import random
app = Flask(__name__, template_folder='.')
mail = Mail(app)
app.config['MONGODB_SETTINGS'] = {
'db': 'project',
'host': 'mongodb+srv://user:hello123@project.kswnu.mongodb.net/project?retryWrites=true&w=majority',
'port': 27017
}
# mail
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = 'dragonsairam.sai@gmail.com'
app.config['MAIL_PASSWORD'] = '896209Sa!'
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True
mail = Mail(app)
app.config['SECRET_KEY'] = "HELLO_WORLD"
db = MongoEngine(app)
login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'login'
class User(UserMixin, db.Document):
meta = {'collection': 'users'}
email = db.StringField()
password = db.StringField()
name = db.StringField()
rollno = db.StringField()
cate = db.StringField()
class facial(UserMixin, db.Document):
meta = {'collection': 'rec1'}
rollno = db.StringField()
face_pixels = db.ListField()
| 30.833333 | 105 | 0.735676 | 236 | 1,850 | 5.614407 | 0.436441 | 0.05434 | 0.058868 | 0.031698 | 0.111698 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012172 | 0.156216 | 1,850 | 59 | 106 | 31.355932 | 0.836643 | 0.002162 | 0 | 0.081633 | 0 | 0.020408 | 0.16648 | 0.064462 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.081633 | 0.387755 | 0 | 0.612245 | 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 |
92b12ab3f88044eaed72293e1fd3053bf1f434a1 | 114 | py | Python | terrascript/provider/dns.py | amlodzianowski/python-terrascript | 1111affe6cd30d9b8b7bc74ae4e27590f7d4dc49 | [
"BSD-2-Clause"
] | null | null | null | terrascript/provider/dns.py | amlodzianowski/python-terrascript | 1111affe6cd30d9b8b7bc74ae4e27590f7d4dc49 | [
"BSD-2-Clause"
] | null | null | null | terrascript/provider/dns.py | amlodzianowski/python-terrascript | 1111affe6cd30d9b8b7bc74ae4e27590f7d4dc49 | [
"BSD-2-Clause"
] | null | null | null | # terrascript/provider/dns.py
import terrascript
class dns(terrascript.Provider):
pass
__all__ = ["dns"]
| 10.363636 | 32 | 0.719298 | 13 | 114 | 6 | 0.615385 | 0.487179 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 114 | 10 | 33 | 11.4 | 0.821053 | 0.236842 | 0 | 0 | 0 | 0 | 0.035294 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.25 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
2b80a14a02b638493da34cdbe1bca59a17f7c197 | 624 | py | Python | profiles/api/serializers.py | iamfeysal/asp | e36aa9b319e002bca9a681baa09a99ca720c03d2 | [
"MIT"
] | null | null | null | profiles/api/serializers.py | iamfeysal/asp | e36aa9b319e002bca9a681baa09a99ca720c03d2 | [
"MIT"
] | 12 | 2021-04-08T22:02:34.000Z | 2022-01-13T03:40:54.000Z | profiles/api/serializers.py | iamfeysal/asp | e36aa9b319e002bca9a681baa09a99ca720c03d2 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from profiles.models import UserProfile
class UserProfileSerializer(serializers.ModelSerializer):
foot_choice = serializers.CharField(source='get_foot_choice_display')
nationality = serializers.CharField(source='get_nationality_display')
gender = serializers.CharField(source='get_gender_display')
print("hit user serializer")
class Meta:
model = UserProfile
# users = serializers.ReadOnlyField()
fields = (
"id", "user", "nickname", "birth_date", "foot_choice",
"nationality", "current_status", "gender", "age")
| 34.666667 | 73 | 0.709936 | 61 | 624 | 7.065574 | 0.57377 | 0.069606 | 0.180974 | 0.201856 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.184295 | 624 | 17 | 74 | 36.705882 | 0.846758 | 0.05609 | 0 | 0 | 0 | 0 | 0.258944 | 0.078365 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.583333 | 0.083333 | 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 |
2b811b986771ad59cc18191bc852892c64dd2f29 | 138 | py | Python | text/_form/cascade/phantom/class/stateful/sounding/__init__.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | text/_form/cascade/phantom/class/stateful/sounding/__init__.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | text/_form/cascade/phantom/class/stateful/sounding/__init__.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | """
*Sounding State*
A type describing state of data soundness.
"""
class SoundingState(
StatefulPhantomClass,
):
pass
| 9.857143 | 44 | 0.652174 | 13 | 138 | 6.923077 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.253623 | 138 | 13 | 45 | 10.615385 | 0.873786 | 0.434783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.25 | 0 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
2ba05e6bf6a00ddea62d8738b2ed3fac63307613 | 533 | py | Python | Textbook/Chapter 5/zerosOnesAndLike.py | hunterluepke/Learn-Python-for-Stats-and-Econ | d580a8e27ba937fc8401ac6d0714b6488ac8bbb6 | [
"MIT"
] | 16 | 2019-01-10T18:54:13.000Z | 2022-01-28T20:07:20.000Z | Textbook/Chapter 5/zerosOnesAndLike.py | hunterluepke/Learn-Python-for-Stats-and-Econ | d580a8e27ba937fc8401ac6d0714b6488ac8bbb6 | [
"MIT"
] | null | null | null | Textbook/Chapter 5/zerosOnesAndLike.py | hunterluepke/Learn-Python-for-Stats-and-Econ | d580a8e27ba937fc8401ac6d0714b6488ac8bbb6 | [
"MIT"
] | 15 | 2019-01-24T17:11:20.000Z | 2021-12-11T01:53:57.000Z | #zerosOnesAndLike.py
import numpy as np
list_of_lists = [[1,2,3], [4,5,6], [7,8,9]]
array_of_arrays = np.array(list_of_lists)
zeros_like_array = np.zeros_like(list_of_lists)
ones_like_array = np.ones_like(list_of_lists)
empty_like_array = np.empty_like(list_of_lists)
print("list_of_lists:", list_of_lists, sep="\n")
print("array_of_arrays:", array_of_arrays, sep="\n")
print("zeros_like_array:", zeros_like_array, sep="\n")
print("ones_like_array:", ones_like_array, sep="\n")
print("empty_like_array:", empty_like_array, sep="\n") | 41 | 54 | 0.761726 | 98 | 533 | 3.72449 | 0.27551 | 0.221918 | 0.210959 | 0.123288 | 0.09863 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018145 | 0.069418 | 533 | 13 | 55 | 41 | 0.717742 | 0.035647 | 0 | 0 | 0 | 0 | 0.175097 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.090909 | 0 | 0.090909 | 0.454545 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
2bbd63c1fa4d41cf36a835444cd9261a6c5f0dd3 | 1,254 | py | Python | setup.py | runcode-io/runcode-python | bbeb9156e66c71ee8c0c21b6db5719aefdedf8ef | [
"MIT"
] | null | null | null | setup.py | runcode-io/runcode-python | bbeb9156e66c71ee8c0c21b6db5719aefdedf8ef | [
"MIT"
] | 1 | 2021-11-17T13:49:18.000Z | 2021-11-17T13:49:18.000Z | setup.py | runcode-io/runcode-python | bbeb9156e66c71ee8c0c21b6db5719aefdedf8ef | [
"MIT"
] | null | null | null | import io
import os
from setuptools import setup, find_packages
VERSION = "0.2"
with open(os.path.join(os.path.dirname(__file__), "README.md")) as readme:
README = readme.read()
setup(
name="runcode",
version=VERSION,
author="RunCode",
author_email="hello@runcode.io",
url="https://github.com/runcode-io/runcode-python",
description="RunCode Python API",
long_description=README,
long_description_content_type="text/markdown",
packages=find_packages(exclude=["tests", "tests.*"]),
include_package_data=True,
install_requires=["requests"],
classifiers=[
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Software Development :: Internationalization",
],
)
| 32.153846 | 74 | 0.633971 | 134 | 1,254 | 5.828358 | 0.529851 | 0.21895 | 0.288092 | 0.266325 | 0.069142 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017382 | 0.220096 | 1,254 | 38 | 75 | 33 | 0.781186 | 0 | 0 | 0 | 0 | 0 | 0.492026 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.088235 | 0 | 0.088235 | 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 |
2be1ea91ae28dc1c466a7a671b957c4df0573a08 | 4,033 | py | Python | test/test_amendments_api.py | billforward/bf-python | d2b812329ca3ed1fd94364d7f46f69ad74665596 | [
"Apache-2.0"
] | 2 | 2016-11-23T17:32:37.000Z | 2022-02-24T05:13:20.000Z | test/test_amendments_api.py | billforward/bf-python | d2b812329ca3ed1fd94364d7f46f69ad74665596 | [
"Apache-2.0"
] | null | null | null | test/test_amendments_api.py | billforward/bf-python | d2b812329ca3ed1fd94364d7f46f69ad74665596 | [
"Apache-2.0"
] | 1 | 2016-12-30T20:02:48.000Z | 2016-12-30T20:02:48.000Z | # coding: utf-8
"""
BillForward REST API
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
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 __future__ import absolute_import
import os
import sys
import unittest
import billforward
from billforward.rest import ApiException
from billforward.apis.amendments_api import AmendmentsApi
class TestAmendmentsApi(unittest.TestCase):
""" AmendmentsApi unit test stubs """
def setUp(self):
self.api = billforward.apis.amendments_api.AmendmentsApi()
def tearDown(self):
pass
def test_create_amendment(self):
"""
Test case for create_amendment
Create an amendment.
"""
pass
def test_get_all_amendments(self):
"""
Test case for get_all_amendments
Returns a collection of all amendments. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_amendment_by_id(self):
"""
Test case for get_amendment_by_id
Returns a single amendment, specified by the amendment-ID parameter.
"""
pass
def test_get_amendment_by_state(self):
"""
Test case for get_amendment_by_state
Returns a collection of amendments, specified by the state parameter. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_amendment_by_subscription_id(self):
"""
Test case for get_amendment_by_subscription_id
Returns a collection of amendments, specified by the subscription-ID parameter. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_amendment_swagger(self):
"""
Test case for get_amendment_swagger
"""
pass
def test_get_amendments_by_actioning_time(self):
"""
Test case for get_amendments_by_actioning_time
Returns a collection of amendment objects with an actioning-time within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_amendments_by_created_date(self):
"""
Test case for get_amendments_by_created_date
Returns a collection of amendment objects with created times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_amendments_by_updated_date(self):
"""
Test case for get_amendments_by_updated_date
Returns a collection of amendment objects with updated times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_retire_amendment(self):
"""
Test case for retire_amendment
Retires the amendment specified by the amendment-ID parameter. Retiring a amendment causes it to cancel based on the specificed retirement settings for the product.
"""
pass
def test_update_amendment(self):
"""
Test case for update_amendment
Update an amendment.
"""
pass
if __name__ == '__main__':
unittest.main()
| 29.874074 | 229 | 0.689313 | 521 | 4,033 | 5.174664 | 0.28023 | 0.048961 | 0.044881 | 0.061202 | 0.546365 | 0.483309 | 0.454377 | 0.385757 | 0.272255 | 0.272255 | 0 | 0.006678 | 0.257377 | 4,033 | 134 | 230 | 30.097015 | 0.893489 | 0.609968 | 0 | 0.333333 | 1 | 0 | 0.006873 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.361111 | false | 0.333333 | 0.194444 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
920b89054058b013fdb09f68b3e15377a48d9b11 | 4,146 | py | Python | jacc/migrations/0022_auto_20200629_0346.py | kajala/django-jacc | b9610684eb1503f0f47785b86c75ac2a62bc4ab9 | [
"MIT"
] | 10 | 2019-02-25T23:30:33.000Z | 2021-05-02T18:02:48.000Z | jacc/migrations/0022_auto_20200629_0346.py | kajala/django-jacc | b9610684eb1503f0f47785b86c75ac2a62bc4ab9 | [
"MIT"
] | null | null | null | jacc/migrations/0022_auto_20200629_0346.py | kajala/django-jacc | b9610684eb1503f0f47785b86c75ac2a62bc4ab9 | [
"MIT"
] | 4 | 2019-09-09T09:33:55.000Z | 2022-01-01T09:28:13.000Z | # Generated by Django 3.0.7 on 2020-06-29 03:46
from django.db import migrations
import jutil.modelfields
class Migration(migrations.Migration):
dependencies = [
("jacc", "0021_auto_20191209_2231"),
]
operations = [
migrations.AlterField(
model_name="account",
name="currency",
field=jutil.modelfields.SafeCharField(
blank=True,
choices=[("EUR", "EUR"), ("USD", "USD")],
default="EUR",
max_length=3,
verbose_name="currency",
),
),
migrations.AlterField(
model_name="account",
name="name",
field=jutil.modelfields.SafeCharField(blank=True, db_index=True, default="", max_length=64, verbose_name="name"),
),
migrations.AlterField(
model_name="accountentry",
name="description",
field=jutil.modelfields.SafeCharField(blank=True, default="", max_length=256, verbose_name="description"),
),
migrations.AlterField(
model_name="accountentrysourcefile",
name="name",
field=jutil.modelfields.SafeCharField(blank=True, db_index=True, default="", max_length=255, verbose_name="name"),
),
migrations.AlterField(
model_name="accounttype",
name="code",
field=jutil.modelfields.SafeCharField(db_index=True, max_length=32, unique=True, verbose_name="code"),
),
migrations.AlterField(
model_name="accounttype",
name="name",
field=jutil.modelfields.SafeCharField(db_index=True, max_length=64, unique=True, verbose_name="name"),
),
migrations.AlterField(
model_name="contract",
name="name",
field=jutil.modelfields.SafeCharField(blank=True, db_index=True, default="", max_length=128, verbose_name="name"),
),
migrations.AlterField(
model_name="entrytype",
name="code",
field=jutil.modelfields.SafeCharField(db_index=True, max_length=64, unique=True, verbose_name="code"),
),
migrations.AlterField(
model_name="entrytype",
name="identifier",
field=jutil.modelfields.SafeCharField(blank=True, db_index=True, default="", max_length=40, verbose_name="identifier"),
),
migrations.AlterField(
model_name="entrytype",
name="name",
field=jutil.modelfields.SafeCharField(blank=True, db_index=True, default="", max_length=128, verbose_name="name"),
),
migrations.AlterField(
model_name="invoice",
name="filename",
field=jutil.modelfields.SafeCharField(blank=True, db_index=True, default="", max_length=255, verbose_name="filename"),
),
migrations.AlterField(
model_name="invoice",
name="notes",
field=jutil.modelfields.SafeTextField(blank=True, default="", verbose_name="notes"),
),
migrations.AlterField(
model_name="invoice",
name="number",
field=jutil.modelfields.SafeCharField(blank=True, db_index=True, default="", max_length=32, verbose_name="invoice number"),
),
migrations.AlterField(
model_name="invoice",
name="state",
field=jutil.modelfields.SafeCharField(
blank=True,
choices=[("N", "Not due yet"), ("D", "Due"), ("L", "Late"), ("P", "Paid")],
db_index=True,
default="",
max_length=1,
verbose_name="state",
),
),
migrations.AlterField(
model_name="invoice",
name="type",
field=jutil.modelfields.SafeCharField(
blank=True,
choices=[("I1", "Invoice"), ("I2", "Credit Note")],
db_index=True,
default="I1",
max_length=2,
verbose_name="type",
),
),
]
| 37.690909 | 135 | 0.555234 | 386 | 4,146 | 5.810881 | 0.209845 | 0.114133 | 0.167187 | 0.193937 | 0.723139 | 0.723139 | 0.541685 | 0.425769 | 0.425769 | 0.386982 | 0 | 0.022464 | 0.312832 | 4,146 | 109 | 136 | 38.036697 | 0.76483 | 0.010854 | 0 | 0.601942 | 1 | 0 | 0.100024 | 0.010978 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.019417 | 0 | 0.048544 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
921e0fac6bcb121032fff89f41922f773cfa1eac | 37 | py | Python | time/__init__.py | claywahlstrom/pack | 86b70198a4b185611c2ce3d29df99dd01233a6ac | [
"BSD-2-Clause"
] | 2 | 2019-05-04T09:32:15.000Z | 2021-02-08T08:38:23.000Z | time/__init__.py | claywahlstrom/pack | 86b70198a4b185611c2ce3d29df99dd01233a6ac | [
"BSD-2-Clause"
] | null | null | null | time/__init__.py | claywahlstrom/pack | 86b70198a4b185611c2ce3d29df99dd01233a6ac | [
"BSD-2-Clause"
] | null | null | null |
__all__ = ['base', 'core', 'dates']
| 12.333333 | 35 | 0.540541 | 4 | 37 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162162 | 37 | 2 | 36 | 18.5 | 0.516129 | 0 | 0 | 0 | 0 | 0 | 0.361111 | 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 |
ecfad6b739301e59d3788f6a87294b18bf4acd9c | 4,353 | py | Python | utils/wave_equation_solutions.py | dtu-act/pinn-acoustic-wave-prop | 2fbc7e39499e28264396669999b8be8f86f01082 | [
"MIT"
] | 7 | 2021-11-05T21:48:44.000Z | 2022-01-28T14:52:14.000Z | utils/wave_equation_solutions.py | dtu-act/pinn-acoustic-wave-prop | 2fbc7e39499e28264396669999b8be8f86f01082 | [
"MIT"
] | null | null | null | utils/wave_equation_solutions.py | dtu-act/pinn-acoustic-wave-prop | 2fbc7e39499e28264396669999b8be8f86f01082 | [
"MIT"
] | 1 | 2021-11-21T01:43:17.000Z | 2021-11-21T01:43:17.000Z | import numpy as np
from models.datastructures import BoundaryType
def WaveEquation1D(grid, x0, boundary_cond, c, sigma0, num_reflections=4):
""" Analytical solution with Dirichlet or Neumann boundaries
num_reflections: number of reflections in the solution
"""
assert(boundary_cond == BoundaryType.DIRICHLET or boundary_cond == BoundaryType.NEUMANN)
amp_sign = 1
x_mesh = grid[0]
t_mesh = grid[1]
xmin = np.min(x_mesh)
xmax = np.max(x_mesh)
L = ( xmax - xmin )
# 1D wave function definition: x0 is an array containing 2 elements for positive and negative travelling waves, respectively
pfunc = lambda x,t,x0: 0.5*np.exp(-0.5*(np.array((x-x0[0] - c*t))/sigma0)**2) + \
0.5*np.exp(-0.5*(np.array((x-x0[1] + c*t))/sigma0)**2)
# initial wave solution (no reflections)
p = pfunc(x_mesh,t_mesh,[x0,x0])
if num_reflections <= 0:
return p
# calculate starting positions for reflected waves for superposition
x0_rel = (x0 - xmin) / L # relative position
for i in range(num_reflections):
if np.mod(i,2) == 0:
x0_min = xmin - i*L - L*x0_rel # x0 for positive travelling wave
x0_max = xmax + (i+1)*L - L*x0_rel # x0 for negative travelling wave
else:
x0_min = xmin - i*L - (L - L*x0_rel) # x0 for positive travelling wave
x0_max = xmax + i*L + L*x0_rel # x0 for negative travelling wave
if boundary_cond == BoundaryType.DIRICHLET:
amp_sign = -1*amp_sign
p = p + amp_sign*pfunc(x_mesh,t_mesh,[x0_min,x0_max])
return p
def WaveEquation2D(grid, X0, boundary_cond, c, sigma0, num_reflections=4):
""" Analytical solution with Dirichlet or Neumann boundaries
num_reflections: number of reflections in the solution
"""
assert(boundary_cond == BoundaryType.DIRICHLET or boundary_cond == BoundaryType.NEUMANN)
amp_sign = 1
x_mesh = grid[0]
y_mesh = grid[1]
t_mesh = grid[2]
xmin = np.min(x_mesh)
xmax = np.max(x_mesh)
ymin = np.min(y_mesh)
ymax = np.max(y_mesh)
x0 = X0[0]
y0 = X0[1]
Lx = ( xmax - xmin )
Ly = ( ymax - ymin )
# 2D wave function definition: x0 and y0 are arrays containing 2 elements each for positive and negative travelling waves, respectively
pfunc = lambda x,y,t,x0,y0: 0.5*np.exp(-0.5*(np.array((x-x0[0] - c*t))/sigma0)**2)*np.exp(-0.5*(np.array((y-y0[0] - c*t))/sigma0)**2) + \
0.5*np.exp(-0.5*(np.array((x-x0[1] + c*t))/sigma0)**2)*np.exp(-0.5*(np.array((y-y0[1] + c*t))/sigma0)**2)
# initial wave solution (no reflections)
p = pfunc(x_mesh,y_mesh,t_mesh,[x0,x0],[y0,y0])
if num_reflections <= 0:
return p
# calculate starting positions for reflected waves for superposition
x0_rel = (x0 - xmin) / Lx # relative position
y0_rel = (y0 - ymin) / Ly # relative position
for i in range(num_reflections):
if np.mod(i,2) == 0:
# x0 for positive travelling wave
x0_min = xmin - i*Lx - Lx*x0_rel
y0_min = ymin - i*Ly - Ly*y0_rel
# x0 for negative travelling wave
x0_max = xmax + (i+1)*Lx - Lx*x0_rel
y0_max = ymax + (i+1)*Ly - Ly*y0_rel
else:
# x0 for positive travelling wave
x0_min = xmin - i*Lx - (Lx - Lx*x0_rel)
y0_min = ymin - i*Ly - (Ly - Ly*y0_rel)
# x0 for negative travelling wave
x0_max = xmax + i*Lx + Lx*x0_rel
y0_max = ymax + i*Ly + Ly*y0_rel
if boundary_cond == BoundaryType.DIRICHLET:
amp_sign = -1*amp_sign
p = p + amp_sign*pfunc(x_mesh,y_mesh,t_mesh,[x0_min,x0_max],[y0_min,y0_max])
return p
def generateSolutionData(grid, x0_sources, c, sigma0, boundary_cond):
p_data = []
spatial_dim = np.asarray(x0_sources).shape[1]
for i, x0 in enumerate(x0_sources):
if spatial_dim == 1:
p_sol = WaveEquation1D(grid,x0,boundary_cond,c,sigma0)
elif spatial_dim == 2:
p_sol = WaveEquation2D(grid,x0,boundary_cond,c,sigma0)
else:
raise NotImplementedError()
p_data.append(np.asarray(p_sol))
return np.asarray(p_data) | 35.104839 | 141 | 0.5966 | 658 | 4,353 | 3.805471 | 0.159574 | 0.052716 | 0.015974 | 0.016773 | 0.763578 | 0.758387 | 0.748403 | 0.695687 | 0.670927 | 0.64377 | 0 | 0.04817 | 0.284631 | 4,353 | 124 | 142 | 35.104839 | 0.755941 | 0.230416 | 0 | 0.36 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026667 | 1 | 0.04 | false | 0 | 0.026667 | 0 | 0.133333 | 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 |
a627412fcdeae89ad46cda7c7ae37cd38de26714 | 1,082 | py | Python | shapes/trapeze.py | katyleo/programming-2021-19fpl | bc780ced91d3178791556aa0d0252d8db9e1b241 | [
"MIT"
] | null | null | null | shapes/trapeze.py | katyleo/programming-2021-19fpl | bc780ced91d3178791556aa0d0252d8db9e1b241 | [
"MIT"
] | null | null | null | shapes/trapeze.py | katyleo/programming-2021-19fpl | bc780ced91d3178791556aa0d0252d8db9e1b241 | [
"MIT"
] | null | null | null | """
Programming for linguists
Implementation of the class RightTriangle
"""
import math
from shapes.shape import Shape
class RightTrapeze(Shape):
"""
A class for right-angled triangle
"""
def __init__(self, uid: int, a_s: int, b_s: int, c_s: int):
super().__init__(uid)
self.a_s = a_s
self.b_s = b_s
self.c_s = c_s
def get_area(self):
"""
Returns the area of a triangle
:return int: the area of a triangle
"""
return ((self.a_s + self.b_s) / 2) * math.sqrt(self.c_s ** 2 -
((self.a_s - self.b_s) ** 2) / 4)
def get_perimeter(self):
"""
Returns the perimeter of a triangle
:return int: the perimeter of a triangle
"""
return self.a_s + self.b_s + (2 * self.c_s)
def get_diagonal(self):
"""
Returns the diagonal length of a triangle
:return int: the diagonal length of a triangle
"""
return int(math.sqrt(self.a_s ** 2 + self.b_s * self.c_s))
| 26.390244 | 88 | 0.546211 | 156 | 1,082 | 3.589744 | 0.237179 | 0.025 | 0.117857 | 0.182143 | 0.444643 | 0.401786 | 0.2625 | 0.239286 | 0.107143 | 0.107143 | 0 | 0.008463 | 0.344732 | 1,082 | 40 | 89 | 27.05 | 0.781382 | 0.308688 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.133333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
a62a9fc03febe8b658213f55e3faf7a37c75d711 | 287 | py | Python | app/backgrounds.py | efrabaez/MLH-Portfolio | 9ec919ce78e765451af7ff5834dfc034f918e660 | [
"MIT"
] | null | null | null | app/backgrounds.py | efrabaez/MLH-Portfolio | 9ec919ce78e765451af7ff5834dfc034f918e660 | [
"MIT"
] | null | null | null | app/backgrounds.py | efrabaez/MLH-Portfolio | 9ec919ce78e765451af7ff5834dfc034f918e660 | [
"MIT"
] | null | null | null | from random import randint, random
scss_files = ["purple.css"]
def get_random_background():
random_index = randint(0, len(scss_files) - 1)
# return "{{ url_for('static',filename='styles/backgrounds/{" + scss_files[random_index] + "}') }}"
return scss_files[random_index]
| 28.7 | 104 | 0.696864 | 37 | 287 | 5.135135 | 0.594595 | 0.189474 | 0.157895 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008197 | 0.149826 | 287 | 9 | 105 | 31.888889 | 0.770492 | 0.341463 | 0 | 0 | 0 | 0 | 0.053476 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
a6e8677a1bb3964163f6dfb1cf453d77eea44071 | 348 | py | Python | at/abc119/a.py | xsthunder/a | 3c30f31c59030d70462b71ef28c5eee19c6eddd6 | [
"MIT"
] | 1 | 2018-07-22T04:52:10.000Z | 2018-07-22T04:52:10.000Z | at/abc119/a.py | xsthunder/a | 3c30f31c59030d70462b71ef28c5eee19c6eddd6 | [
"MIT"
] | 1 | 2018-08-11T13:29:59.000Z | 2018-08-11T13:31:28.000Z | at/abc119/a.py | xsthunder/a | 3c30f31c59030d70462b71ef28c5eee19c6eddd6 | [
"MIT"
] | null | null | null | s = input()
y, m, d = map(int, s.split('/'))
f = False
(
Heisei,
TBD,
)= (
'Heisei',
'TBD',
)
if y < 2019:
print(Heisei)
elif y == 2019:
if(m < 4):
print(Heisei)
elif m == 4:
if(d <= 30):
print(Heisei)
else :
print(TBD)
else :
print(TBD)
else :
print(TBD)
| 13.92 | 32 | 0.416667 | 45 | 348 | 3.222222 | 0.422222 | 0.227586 | 0.248276 | 0.22069 | 0.248276 | 0.248276 | 0 | 0 | 0 | 0 | 0 | 0.058252 | 0.408046 | 348 | 24 | 33 | 14.5 | 0.645631 | 0 | 0 | 0.375 | 0 | 0 | 0.028736 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 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 |
a6fcb6b1aa9b16abcc2a3746f71a1fac0878d8f2 | 211 | py | Python | mpy/Pins_pico.py | bdambrosio/rfm69 | fd67061310dfe4811be66e94c4e0b7100d15533a | [
"MIT"
] | null | null | null | mpy/Pins_pico.py | bdambrosio/rfm69 | fd67061310dfe4811be66e94c4e0b7100d15533a | [
"MIT"
] | null | null | null | mpy/Pins_pico.py | bdambrosio/rfm69 | fd67061310dfe4811be66e94c4e0b7100d15533a | [
"MIT"
] | null | null | null | rfm69SpiBus = 0
rfm69NSS = 5 # GPIO5 == pin 7
rfm69D0 = 9 # GPIO9 == pin 12
rfm69RST = 8 # GPIO8 == pin 11
am2302 = 22 # GPIO22 == pin 29
voltADC = 26 # GPIO26 == pin 31 | 30.142857 | 38 | 0.50237 | 27 | 211 | 3.925926 | 0.851852 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.291339 | 0.398104 | 211 | 7 | 39 | 30.142857 | 0.543307 | 0.398104 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
470220d312fab5c5654a079b2ed6ba123b84ba4a | 373 | py | Python | destination/views.py | ksopan/Django_Travel_Agency | 22749a9b4bd5944bf9f002c653f45210f6fc392b | [
"MIT"
] | null | null | null | destination/views.py | ksopan/Django_Travel_Agency | 22749a9b4bd5944bf9f002c653f45210f6fc392b | [
"MIT"
] | null | null | null | destination/views.py | ksopan/Django_Travel_Agency | 22749a9b4bd5944bf9f002c653f45210f6fc392b | [
"MIT"
] | null | null | null | from django.shortcuts import render, redirect
from django.http import HttpResponse
from travello.models import Destination
# Create your views here.
def new_dest(request,city_name):
# dests = Destination.objects.all().filter(name=city_name)
dests = Destination.objects.all().filter(name=city_name)
return render(request, 'destination.html',{'dests': dests})
| 31.083333 | 63 | 0.766756 | 49 | 373 | 5.755102 | 0.55102 | 0.085106 | 0.092199 | 0.170213 | 0.340426 | 0.340426 | 0.340426 | 0.340426 | 0.340426 | 0.340426 | 0 | 0 | 0.123324 | 373 | 11 | 64 | 33.909091 | 0.862385 | 0.214477 | 0 | 0 | 0 | 0 | 0.072414 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.5 | 0 | 0.833333 | 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 |
470d9f3e72baa75639ee589945d183a2901d1e9f | 79 | py | Python | sitemessage/__init__.py | idlesign/django-sitemessage | 87257304958a7ec0b9005f9bb513a3b0f6153833 | [
"BSD-3-Clause"
] | 49 | 2015-01-26T01:31:22.000Z | 2022-02-01T19:10:55.000Z | sitemessage/__init__.py | idlesign/django-sitemessage | 87257304958a7ec0b9005f9bb513a3b0f6153833 | [
"BSD-3-Clause"
] | 10 | 2015-11-13T09:38:53.000Z | 2021-03-14T11:22:35.000Z | sitemessage/__init__.py | idlesign/django-sitemessage | 87257304958a7ec0b9005f9bb513a3b0f6153833 | [
"BSD-3-Clause"
] | 10 | 2015-03-16T09:01:47.000Z | 2021-03-14T10:10:27.000Z | VERSION = (1, 3, 4)
default_app_config = 'sitemessage.apps.SitemessageConfig' | 19.75 | 57 | 0.759494 | 10 | 79 | 5.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042857 | 0.113924 | 79 | 4 | 57 | 19.75 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0.425 | 0.425 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
471b3eb363149aeee03c4866921f25c646166eb6 | 983 | py | Python | ax/connection.py | axxiao/toby | de64f4b2f5e39531d08143e99cf2785992010a13 | [
"MIT"
] | null | null | null | ax/connection.py | axxiao/toby | de64f4b2f5e39531d08143e99cf2785992010a13 | [
"MIT"
] | null | null | null | ax/connection.py | axxiao/toby | de64f4b2f5e39531d08143e99cf2785992010a13 | [
"MIT"
] | null | null | null | """
The main class to handle all connection related classes,
e.g. Cache, DB
__author__ = "Alex Xiao <http://www.alexxiao.me/>"
__date__ = "2018-11-03"
__version__ = "0.1"
Version:
0.1 (02/07/2017 AX) : implemented basic definition, zmq
0.2 (04/03/2018 AX) : changed from zmq to redis
0.3 (25/08/2018 AX) : combined queue & cache together
0.4 (22/04/2019 AX) : Restructured to be songle place for all connections
"""
from .base import get_context
from ax.wrapper.sqlalchemy import Connection as DatabaseConnection
def get_db_connection(user_name, password, *args, **kwargs):
"""
Context managed get db connection function
:param user_name: user name
:param password: password
:param args: additional arguments for DatabaseConnection
:param kwargs: additional key-word arguments for DatabaseConnection
:return: context object
"""
return get_context(DatabaseConnection, user_name, password, *args, **kwargs)
| 32.766667 | 81 | 0.706002 | 135 | 983 | 5 | 0.577778 | 0.047407 | 0.026667 | 0.059259 | 0.077037 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063371 | 0.197355 | 983 | 29 | 82 | 33.896552 | 0.792142 | 0.703967 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.5 | 0.5 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
4720764b29306cc77dde3c94a1e83f892c0411d1 | 226 | py | Python | Emmanuel ANENE/Phase 1/Python Basic 1/Day9/task7.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 6 | 2020-05-23T19:53:25.000Z | 2021-05-08T20:21:30.000Z | Emmanuel ANENE/Phase 1/Python Basic 1/Day9/task7.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 8 | 2020-05-14T18:53:12.000Z | 2020-07-03T00:06:20.000Z | Emmanuel ANENE/Phase 1/Python Basic 1/Day9/task7.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 39 | 2020-05-10T20:55:02.000Z | 2020-09-12T17:40:59.000Z | '''
Write a Python program to test whether the system is a big-endian platform or little-endian platform
'''
import sys
if sys.byteorder == "little":
print("Little-endian platform")
else:
print("Big-endian platform") | 22.6 | 100 | 0.721239 | 33 | 226 | 4.939394 | 0.636364 | 0.343558 | 0.208589 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168142 | 226 | 10 | 101 | 22.6 | 0.867021 | 0.442478 | 0 | 0 | 0 | 0 | 0.394958 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0.4 | 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 |
4731983caa4e34739b915977856cd5ec6c0166d8 | 3,221 | py | Python | TupleConversionsProject/generate_cpp17.py | MotorPogromizd/TestTupleConversions | 9c66e1d32890adfd16811bbe4ec5a692f74ce399 | [
"MIT"
] | null | null | null | TupleConversionsProject/generate_cpp17.py | MotorPogromizd/TestTupleConversions | 9c66e1d32890adfd16811bbe4ec5a692f74ce399 | [
"MIT"
] | null | null | null | TupleConversionsProject/generate_cpp17.py | MotorPogromizd/TestTupleConversions | 9c66e1d32890adfd16811bbe4ec5a692f74ce399 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# Copyright (c) 2018
# Call file:
# python ./generate_cpp17.py > TupleConversions/Private/structurebindings_generated.h
############################################################################################################################
import sys
import string
# Skipping some letters that may produce keywords or are hard to read, or shadow template parameters
ascii_letters = string.ascii_letters.replace("o", "").replace("O", "").replace("i", "").replace("I", "").replace("T", "")
PROLOGUE = """#ifndef STRUCTURE_BINDING_GENERATED_HPP
#define STRUCTURE_BINDING_GENERATED_HPP
#pragma once
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////// This is an auto generated header. Modify generate_cpp17.py instead. ////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <tuple>
#include <type_traits>
/**
* @file
* @brief Contains detail functions for converting struct to std::tuple
*
* Contains detail functions for converting struct to std::tuple.
* This file is auto-generated by generate_cpp17.py
* @warning Dont use this functions directly!
* @ingroup TupleConversions
*/
namespace TupleConversions::Detail {
template <class T>
constexpr auto toTupleImpl(
T&&, std::integral_constant<std::size_t, 0>
) noexcept
{
return std::make_tuple();
}
template <class T>
constexpr auto toTupleImpl(
T&& val, std::integral_constant<std::size_t, 1>
) noexcept
{
auto&& [a] = std::forward<T>(val);
return std::make_tuple(a);
}
"""
############################################################################################################################
EPILOGUE = """
} // TupleConversions::Detail
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif // BOOST_PFR_DETAIL_CORE17_GENERATED_HPP
"""
############################################################################################################################
indexes = " a"
print PROLOGUE
funcs_count = 100 if len(sys.argv) == 1 else int(sys.argv[1])
max_args_on_a_line = 10#len(ascii_letters)
for i in xrange(1, funcs_count):
if i % max_args_on_a_line == 0:
indexes += ",\n "
else:
indexes += ", "
if i >= max_args_on_a_line:
indexes += ascii_letters[i / max_args_on_a_line - 1]
indexes += ascii_letters[i % max_args_on_a_line]
print "template <class T>"
print "constexpr auto toTupleImpl("
print " T&& val, std::integral_constant<std::size_t, " + str(i + 1) + ">"
print " ) noexcept"
print "{"
print " auto&& ["
print indexes
print " ] = std::forward<T>(val);"
print ""
print " return std::make_tuple("
print indexes
print " );"
print "}\n"
print "template <class T, size_t N>"
print "constexpr auto toTupleImpl("
print " T&& val, std::integral_constant<std::size_t, N>"
print " ) noexcept"
print "{"
print " static_assert(N < " + str(funcs_count + 1) + ");"
print "}"
print EPILOGUE
| 29.824074 | 124 | 0.502639 | 326 | 3,221 | 4.791411 | 0.346626 | 0.038412 | 0.028809 | 0.03201 | 0.310499 | 0.301536 | 0.284251 | 0.213188 | 0.193342 | 0.083227 | 0 | 0.009548 | 0.15461 | 3,221 | 107 | 125 | 30.102804 | 0.564084 | 0.076684 | 0 | 0.24 | 1 | 0 | 0.65832 | 0.273883 | 0 | 0 | 0 | 0 | 0.013333 | 0 | null | null | 0 | 0.026667 | null | null | 0.293333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5b2f3c0d5c9260c50c1f6f2a65c2f6f5c3c755c1 | 1,341 | py | Python | crime/migrations/0004_auto_20200222_1159.py | fritzdale/crime_prevention_system | 4b56893971aa7bfc3331386d80bacd96f762e4ea | [
"MIT"
] | null | null | null | crime/migrations/0004_auto_20200222_1159.py | fritzdale/crime_prevention_system | 4b56893971aa7bfc3331386d80bacd96f762e4ea | [
"MIT"
] | null | null | null | crime/migrations/0004_auto_20200222_1159.py | fritzdale/crime_prevention_system | 4b56893971aa7bfc3331386d80bacd96f762e4ea | [
"MIT"
] | null | null | null | # Generated by Django 3.0.3 on 2020-02-22 06:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crime', '0003_area'),
]
operations = [
migrations.CreateModel(
name='complaint_details',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('Email', models.EmailField(max_length=254)),
('firstname', models.CharField(max_length=100)),
('lastname', models.CharField(max_length=100)),
('carea', models.CharField(max_length=800)),
('wip', models.CharField(max_length=500)),
('detail', models.CharField(max_length=2000)),
('image', models.ImageField(upload_to='image')),
],
),
migrations.AlterField(
model_name='area',
name='doorno',
field=models.CharField(max_length=50),
),
migrations.AlterField(
model_name='area',
name='pincode',
field=models.CharField(max_length=50),
),
migrations.AlterField(
model_name='area',
name='state',
field=models.CharField(max_length=50),
),
]
| 31.928571 | 114 | 0.54437 | 128 | 1,341 | 5.5625 | 0.5 | 0.113764 | 0.202247 | 0.269663 | 0.36236 | 0.286517 | 0.191011 | 0.191011 | 0.191011 | 0.191011 | 0 | 0.048246 | 0.319911 | 1,341 | 41 | 115 | 32.707317 | 0.732456 | 0.033557 | 0 | 0.371429 | 1 | 0 | 0.085781 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.028571 | 0 | 0.114286 | 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 |
5b3b4fd10f19924c71f4f06f9a292e80aa1533fe | 215 | py | Python | user_feedback/urls.py | aahilgert/UserFeedback | 1b754d848eb65431d79c598034f727aec099db86 | [
"BSD-3-Clause"
] | null | null | null | user_feedback/urls.py | aahilgert/UserFeedback | 1b754d848eb65431d79c598034f727aec099db86 | [
"BSD-3-Clause"
] | 1 | 2021-05-11T03:12:28.000Z | 2021-05-11T03:12:28.000Z | user_feedback/urls.py | aahilgert/UserFeedback | 1b754d848eb65431d79c598034f727aec099db86 | [
"BSD-3-Clause"
] | 1 | 2020-07-08T19:36:39.000Z | 2020-07-08T19:36:39.000Z | from django.conf.urls import url
from . import views
app_name = "user_feedback"
def flow_patterns():
return [url(r"^post", views.post_feedback_json, name="post")]
urlpatterns = sum([flow_patterns()], [])
| 15.357143 | 65 | 0.702326 | 30 | 215 | 4.833333 | 0.666667 | 0.165517 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148837 | 215 | 13 | 66 | 16.538462 | 0.79235 | 0 | 0 | 0 | 0 | 0 | 0.102326 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
5b3c71aec114f980fb4ead99946c4afab0655095 | 179 | py | Python | test/test_examples_contacts.py | Nekroze/partpy | dbb7d2fb285464fc43d85bc31f5af46192d301f6 | [
"MIT"
] | 1 | 2017-07-02T16:18:37.000Z | 2017-07-02T16:18:37.000Z | test/test_examples_contacts.py | Nekroze/partpy | dbb7d2fb285464fc43d85bc31f5af46192d301f6 | [
"MIT"
] | null | null | null | test/test_examples_contacts.py | Nekroze/partpy | dbb7d2fb285464fc43d85bc31f5af46192d301f6 | [
"MIT"
] | null | null | null | from examples.contacts import PARSER, EXPECTED
class Test_Contacts(object):
def test_contacs_output(self):
output = PARSER.parse()
assert output == EXPECTED
| 22.375 | 46 | 0.709497 | 21 | 179 | 5.904762 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212291 | 179 | 7 | 47 | 25.571429 | 0.879433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 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 |
5b9bf844c4b3f56ac874807da7d365032010e1ef | 295 | py | Python | PSA/psaExceptions.py | SECURED-FP7/secured-psa-nsm | 20c8f790ebc2d2aa8c33bda1e047f8f29275a0be | [
"Apache-2.0"
] | null | null | null | PSA/psaExceptions.py | SECURED-FP7/secured-psa-nsm | 20c8f790ebc2d2aa8c33bda1e047f8f29275a0be | [
"Apache-2.0"
] | null | null | null | PSA/psaExceptions.py | SECURED-FP7/secured-psa-nsm | 20c8f790ebc2d2aa8c33bda1e047f8f29275a0be | [
"Apache-2.0"
] | null | null | null | # -*- Mode:Python;indent-tabs-mode:nil; -*-
#
# File: psaExceptions.py
# Created: 05/09/2014
# Author: BSC
#
# Description:
# Custom execption class to manage error in the PSC
#
class psaExceptions( object ):
class confRetrievalFailed( Exception ):
pass
| 19.666667 | 57 | 0.620339 | 32 | 295 | 5.71875 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036866 | 0.264407 | 295 | 14 | 58 | 21.071429 | 0.806452 | 0.630508 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
5ba38564848be875d98f245f90e926a05088f8c8 | 83 | py | Python | web/public/python/static/defaultPython.py | zonglu666/teaching-open | d005189948fc04d37ad3c255daa84540ffae1dec | [
"Apache-2.0"
] | 119 | 2020-10-25T17:24:07.000Z | 2022-03-31T06:54:23.000Z | web/public/python/static/defaultPython.py | zonglu666/teaching-open | d005189948fc04d37ad3c255daa84540ffae1dec | [
"Apache-2.0"
] | 6 | 2020-10-27T14:13:13.000Z | 2021-11-09T16:59:07.000Z | web/public/python/static/defaultPython.py | zonglu666/teaching-open | d005189948fc04d37ad3c255daa84540ffae1dec | [
"Apache-2.0"
] | 83 | 2020-10-27T13:07:19.000Z | 2022-03-16T15:20:02.000Z | import turtle
t = turtle.Turtle()
t.forward(100)
print ("Teaching Python Editor") | 13.833333 | 32 | 0.73494 | 12 | 83 | 5.083333 | 0.75 | 0.229508 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041667 | 0.13253 | 83 | 6 | 32 | 13.833333 | 0.805556 | 0 | 0 | 0 | 0 | 0 | 0.261905 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5ba9ae6ca97e5b596ccf1056f676c309937fdb41 | 136 | py | Python | officialWebsite/events/urls.py | parthsujalshah/officialWebsite | fe3f99cab35d9dcb8a4923913ad6ba03bcf4946b | [
"MIT"
] | null | null | null | officialWebsite/events/urls.py | parthsujalshah/officialWebsite | fe3f99cab35d9dcb8a4923913ad6ba03bcf4946b | [
"MIT"
] | null | null | null | officialWebsite/events/urls.py | parthsujalshah/officialWebsite | fe3f99cab35d9dcb8a4923913ad6ba03bcf4946b | [
"MIT"
] | null | null | null | from django.urls import path, include
from . import views
urlpatterns = [
path('', views.EventViewSet.as_view(), name="events"),
]
| 19.428571 | 58 | 0.698529 | 17 | 136 | 5.529412 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154412 | 136 | 6 | 59 | 22.666667 | 0.817391 | 0 | 0 | 0 | 0 | 0 | 0.044118 | 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 |
5bd728be5389d91c4b672492f0c1ae8d1b436e07 | 634 | py | Python | tests/test_fortysixelks.py | widyamedia/simplemonitor | 88764cc4fa74bd81191f1ca2438de0f399404e5b | [
"BSD-3-Clause"
] | 1 | 2021-07-24T14:05:12.000Z | 2021-07-24T14:05:12.000Z | tests/test_fortysixelks.py | widyamedia/simplemonitor | 88764cc4fa74bd81191f1ca2438de0f399404e5b | [
"BSD-3-Clause"
] | 14 | 2020-10-25T19:23:40.000Z | 2021-12-22T12:47:06.000Z | tests/test_fortysixelks.py | widyamedia/simplemonitor | 88764cc4fa74bd81191f1ca2438de0f399404e5b | [
"BSD-3-Clause"
] | null | null | null | import sys
import unittest
import Alerters.fortysixelks
import util
class Test46Elks(unittest.TestCase):
def test_46elks(self):
config_options={
'username': 'a',
'password': 'b',
'target': 'c'
}
config_options['sender'] = 'ab'
with self.assertRaises(util.AlerterConfigurationError):
a = Alerters.fortysixelks.FortySixElksAlerter(config_options=config_options)
config_options['sender'] = '123456789012'
a = Alerters.fortysixelks.FortySixElksAlerter(config_options=config_options)
self.assertEqual(a.sender, '12345678901')
| 27.565217 | 88 | 0.660883 | 59 | 634 | 6.966102 | 0.508475 | 0.221411 | 0.138686 | 0.189781 | 0.321168 | 0.321168 | 0.321168 | 0.321168 | 0 | 0 | 0 | 0.05567 | 0.235016 | 634 | 22 | 89 | 28.818182 | 0.791753 | 0 | 0 | 0.117647 | 0 | 0 | 0.097792 | 0 | 0 | 0 | 0 | 0 | 0.117647 | 1 | 0.058824 | false | 0.058824 | 0.235294 | 0 | 0.352941 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
5bf86f5e7320c04c2353f882add88e58ed9ba436 | 157 | py | Python | appcraft_auth/apps.py | AppCraftTeam/appcraft-auth | 428fafb4e543e9adcb32a5ab6df20dc7a439088e | [
"BSD-3-Clause"
] | null | null | null | appcraft_auth/apps.py | AppCraftTeam/appcraft-auth | 428fafb4e543e9adcb32a5ab6df20dc7a439088e | [
"BSD-3-Clause"
] | null | null | null | appcraft_auth/apps.py | AppCraftTeam/appcraft-auth | 428fafb4e543e9adcb32a5ab6df20dc7a439088e | [
"BSD-3-Clause"
] | null | null | null | from django.apps import AppConfig
class AppcraftAuthConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'appcraft_auth'
| 22.428571 | 56 | 0.77707 | 18 | 157 | 6.611111 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140127 | 157 | 6 | 57 | 26.166667 | 0.881481 | 0 | 0 | 0 | 0 | 0 | 0.267516 | 0.184713 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
750508c16c65362c9e2c2208f4dde47ca2f4f407 | 135 | py | Python | tests/kcleaner_main_test.py | gcarrarom/kubeconfig-cleaner-cli | fd5cfae0cdff1d7fe258d4843ae1a72790a2515a | [
"MIT"
] | 34 | 2019-05-29T12:32:19.000Z | 2022-03-29T19:52:58.000Z | tests/kcleaner_main_test.py | gcarrarom/kubeconfig-cleaner-cli | fd5cfae0cdff1d7fe258d4843ae1a72790a2515a | [
"MIT"
] | 9 | 2019-05-15T18:32:01.000Z | 2020-04-21T16:26:24.000Z | tests/kcleaner_main_test.py | gcarrarom/kubeconfig-cleaner-cli | fd5cfae0cdff1d7fe258d4843ae1a72790a2515a | [
"MIT"
] | null | null | null | from __future__ import print_function
import click
from click.testing import CliRunner
from kcleaner import cli
runner = CliRunner()
| 19.285714 | 37 | 0.82963 | 18 | 135 | 5.944444 | 0.611111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140741 | 135 | 6 | 38 | 22.5 | 0.922414 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7505132968f8c3155583f28f9d00514997c1e94c | 557 | py | Python | datapipe/pipelines/__init__.py | caesarcc/python-data-pipeline | 6db09e05e466fdf2d1dbf690870d908b31817a3d | [
"BSD-2-Clause"
] | null | null | null | datapipe/pipelines/__init__.py | caesarcc/python-data-pipeline | 6db09e05e466fdf2d1dbf690870d908b31817a3d | [
"BSD-2-Clause"
] | null | null | null | datapipe/pipelines/__init__.py | caesarcc/python-data-pipeline | 6db09e05e466fdf2d1dbf690870d908b31817a3d | [
"BSD-2-Clause"
] | null | null | null | from datapipe.pipelines.bigsql_exec import BigSQLExec
from datapipe.pipelines.hdfs_export import HdfsExport
from datapipe.pipelines.hdfs_import import HdfsImport
from datapipe.pipelines.sqoop_export import SqoopExport
from datapipe.pipelines.sqoop_import import SqoopImport
from datapipe.utils.constantes import *
PIPELINES_DISPONIVEIS = {
YAML_SCOOP_IMPORT: SqoopImport,
YAML_SCOOP_EXPORT: SqoopExport,
YAML_BIGSQL_EXEC: BigSQLExec,
YAML_HDFS_EXPORT: HdfsExport,
YAML_HDFS_IMPORT: HdfsImport,
# YAML_PYTHON_SCRIPT: PythonScript,
}
| 34.8125 | 55 | 0.829443 | 66 | 557 | 6.727273 | 0.333333 | 0.162162 | 0.236486 | 0.112613 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118492 | 557 | 15 | 56 | 37.133333 | 0.904277 | 0.059246 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.615385 | 0 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
75297786e1e129d9ff8508a7024c138c87b8815a | 720 | py | Python | tests/grammars/CustomSubclassGenerator.py | 38b394ce01/grammarinator | 601ce9260450ab2234438c041905e1e904eeeba5 | [
"BSD-3-Clause"
] | 228 | 2017-05-15T14:31:10.000Z | 2022-03-30T13:03:51.000Z | tests/grammars/CustomSubclassGenerator.py | 38b394ce01/grammarinator | 601ce9260450ab2234438c041905e1e904eeeba5 | [
"BSD-3-Clause"
] | 45 | 2017-06-24T14:13:18.000Z | 2022-03-29T14:07:26.000Z | tests/grammars/CustomSubclassGenerator.py | 38b394ce01/grammarinator | 601ce9260450ab2234438c041905e1e904eeeba5 | [
"BSD-3-Clause"
] | 57 | 2017-05-15T14:36:18.000Z | 2022-03-24T22:36:16.000Z | # Copyright (c) 2017-2020 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
# This custom unparser is used by Custom.g4
from grammarinator.runtime import *
from CustomGenerator import CustomGenerator
class CustomSubclassGenerator(CustomGenerator):
def tagname(self, parent=None):
current = UnparserRule(name='tagname', parent=parent)
UnlexerRule(src='customtag', parent=current)
return current
def _custom_lexer_content(self, parent=None):
return UnlexerRule(src='custom content', parent=parent)
| 30 | 64 | 0.743056 | 90 | 720 | 5.911111 | 0.677778 | 0.015038 | 0.037594 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018303 | 0.165278 | 720 | 23 | 65 | 31.304348 | 0.866889 | 0.391667 | 0 | 0 | 0 | 0 | 0.069767 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0.111111 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.