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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a0732cf7ece31a1a210020de8f634dd9031f8b24 | 2,118 | py | Python | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/SUN/triangle_list.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 210 | 2016-04-09T14:26:00.000Z | 2022-03-25T18:36:19.000Z | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/SUN/triangle_list.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 72 | 2016-09-04T09:30:19.000Z | 2022-03-27T17:06:53.000Z | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/SUN/triangle_list.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 64 | 2016-04-09T14:26:49.000Z | 2022-03-21T11:19:47.000Z | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'GL_SUN_triangle_list'
def _f( function ):
return _p.createFunction( function,_p.PLATFORM.GL,'GL_SUN_triangle_list',error_checker=_errors._error_checker)
GL_R1UI_C3F_V3F_SUN=_C('GL_R1UI_C3F_V3F_SUN',0x85C6)
GL_R1UI_C4F_N3F_V3F_SUN=_C('GL_R1UI_C4F_N3F_V3F_SUN',0x85C8)
GL_R1UI_C4UB_V3F_SUN=_C('GL_R1UI_C4UB_V3F_SUN',0x85C5)
GL_R1UI_N3F_V3F_SUN=_C('GL_R1UI_N3F_V3F_SUN',0x85C7)
GL_R1UI_T2F_C4F_N3F_V3F_SUN=_C('GL_R1UI_T2F_C4F_N3F_V3F_SUN',0x85CB)
GL_R1UI_T2F_N3F_V3F_SUN=_C('GL_R1UI_T2F_N3F_V3F_SUN',0x85CA)
GL_R1UI_T2F_V3F_SUN=_C('GL_R1UI_T2F_V3F_SUN',0x85C9)
GL_R1UI_V3F_SUN=_C('GL_R1UI_V3F_SUN',0x85C4)
GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN=_C('GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN',0x85C3)
GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN=_C('GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN',0x85C2)
GL_REPLACEMENT_CODE_ARRAY_SUN=_C('GL_REPLACEMENT_CODE_ARRAY_SUN',0x85C0)
GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN=_C('GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN',0x85C1)
GL_REPLACEMENT_CODE_SUN=_C('GL_REPLACEMENT_CODE_SUN',0x81D8)
GL_REPLACE_MIDDLE_SUN=_C('GL_REPLACE_MIDDLE_SUN',0x0002)
GL_REPLACE_OLDEST_SUN=_C('GL_REPLACE_OLDEST_SUN',0x0003)
GL_RESTART_SUN=_C('GL_RESTART_SUN',0x0001)
GL_TRIANGLE_LIST_SUN=_C('GL_TRIANGLE_LIST_SUN',0x81D7)
@_f
@_p.types(None,_cs.GLenum,_cs.GLsizei,arrays.GLvoidpArray)
def glReplacementCodePointerSUN(type,stride,pointer):pass
@_f
@_p.types(None,_cs.GLubyte)
def glReplacementCodeubSUN(code):pass
@_f
@_p.types(None,arrays.GLubyteArray)
def glReplacementCodeubvSUN(code):pass
@_f
@_p.types(None,_cs.GLuint)
def glReplacementCodeuiSUN(code):pass
@_f
@_p.types(None,arrays.GLuintArray)
def glReplacementCodeuivSUN(code):pass
@_f
@_p.types(None,_cs.GLushort)
def glReplacementCodeusSUN(code):pass
@_f
@_p.types(None,arrays.GLushortArray)
def glReplacementCodeusvSUN(code):pass
| 40.730769 | 114 | 0.846553 | 357 | 2,118 | 4.478992 | 0.260504 | 0.042527 | 0.06379 | 0.045028 | 0.454659 | 0.310194 | 0.123827 | 0 | 0 | 0 | 0 | 0.061133 | 0.050047 | 2,118 | 51 | 115 | 41.529412 | 0.733598 | 0.047214 | 0 | 0.148936 | 1 | 0 | 0.218797 | 0.136251 | 0 | 0 | 0.050721 | 0 | 0 | 1 | 0.170213 | false | 0.148936 | 0.12766 | 0.021277 | 0.319149 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
a0783e54f2180e69d39e74136bc7506227d84753 | 1,023 | py | Python | users/migrations/0002_create_superuser.py | glasnt/mewgram | cd31df84d313c0edb452336a6b014428c110a2fc | [
"BSD-3-Clause"
] | null | null | null | users/migrations/0002_create_superuser.py | glasnt/mewgram | cd31df84d313c0edb452336a6b014428c110a2fc | [
"BSD-3-Clause"
] | 2 | 2020-06-28T04:12:52.000Z | 2021-06-09T19:13:32.000Z | users/migrations/0002_create_superuser.py | glasnt/mewgram | cd31df84d313c0edb452336a6b014428c110a2fc | [
"BSD-3-Clause"
] | 2 | 2020-07-01T04:30:32.000Z | 2021-05-14T12:09:46.000Z | import os
from django.contrib.auth import get_user_model
from django.db import migrations
from django.conf import settings
def access_secret(secret_key):
if settings.LOCAL_DEVELOPMENT:
return os.environ[secret_key]
else:
import google.auth
from google.cloud import secretmanager as sm
_, project = google.auth.default()
client = sm.SecretManagerServiceClient()
name = client.secret_version_path(project, secret_key, "latest")
payload = client.access_secret_version(name=name).payload.data.decode("UTF-8")
return payload
def createsuperuser(apps, schema_editor):
email = access_secret("ADMINEMAIL")
password = access_secret("ADMINPASS")
# Create a new user using acquired password
User = get_user_model()
User.objects.create_superuser(email, password=password)
class Migration(migrations.Migration):
dependencies = [
("users", "0001_initial"),
]
operations = [migrations.RunPython(createsuperuser)]
| 25.575 | 86 | 0.711632 | 118 | 1,023 | 6.008475 | 0.542373 | 0.067701 | 0.03385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006105 | 0.199413 | 1,023 | 39 | 87 | 26.230769 | 0.859585 | 0.040078 | 0 | 0 | 0 | 0 | 0.047959 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.08 | false | 0.08 | 0.24 | 0 | 0.52 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
a084cfc85db76855d4517add733deabdc4ec6114 | 793 | py | Python | ctrack/migrations/0006_billpdfscraperconfig.py | dmkent/cattrack | 2387f72d7a384638731a70b377826562f4f22a31 | [
"MIT"
] | null | null | null | ctrack/migrations/0006_billpdfscraperconfig.py | dmkent/cattrack | 2387f72d7a384638731a70b377826562f4f22a31 | [
"MIT"
] | 11 | 2019-10-06T10:48:19.000Z | 2022-02-10T08:25:05.000Z | ctrack/migrations/0006_billpdfscraperconfig.py | dmkent/cattrack | 2387f72d7a384638731a70b377826562f4f22a31 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-12 21:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ctrack', '0005_auto_20171004_2043'),
]
operations = [
migrations.CreateModel(
name='BillPdfScraperConfig',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('field', models.CharField(max_length=20)),
('label_pattern', models.CharField(max_length=50)),
('value_pattern', models.CharField(max_length=50)),
('processor', models.CharField(max_length=200)),
],
),
]
| 30.5 | 114 | 0.598991 | 82 | 793 | 5.585366 | 0.682927 | 0.131004 | 0.157205 | 0.209607 | 0.144105 | 0.144105 | 0 | 0 | 0 | 0 | 0 | 0.072414 | 0.2686 | 793 | 25 | 115 | 31.72 | 0.717241 | 0.08575 | 0 | 0 | 1 | 0 | 0.128809 | 0.031856 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.277778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a0a824b21c22314e8b0bee6fcd5a68a3357743a0 | 730 | py | Python | GroceryTask/groceries/views.py | diyajaiswal11/Grocery-Task | 13a2157c4765f2503b09d782ab0c096108f53a7c | [
"MIT"
] | null | null | null | GroceryTask/groceries/views.py | diyajaiswal11/Grocery-Task | 13a2157c4765f2503b09d782ab0c096108f53a7c | [
"MIT"
] | null | null | null | GroceryTask/groceries/views.py | diyajaiswal11/Grocery-Task | 13a2157c4765f2503b09d782ab0c096108f53a7c | [
"MIT"
] | null | null | null | from django.shortcuts import render
from rest_framework import generics
from rest_framework.filters import SearchFilter,OrderingFilter
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.pagination import PageNumberPagination
from .models import *
from .serializers import *
class GroceryItemPagination(PageNumberPagination):
page_size = 5
class GroceryItemListAPIView(generics.ListAPIView):
queryset = GroceryItem.objects.all()
filter_backends = [SearchFilter, DjangoFilterBackend, OrderingFilter]
search_fields = ['title','description']
ordering_fields = ['price','created_at']
serializer_class = GroceryItemSerializer
pagination_class = GroceryItemPagination
| 36.5 | 73 | 0.810959 | 70 | 730 | 8.285714 | 0.557143 | 0.089655 | 0.087931 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00157 | 0.127397 | 730 | 19 | 74 | 38.421053 | 0.908948 | 0 | 0 | 0 | 0 | 0 | 0.042466 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4375 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
a0b578acf977da0bfb3791f7e9ae189368679c18 | 349 | py | Python | constants.py | richardpur/Massivo | dadda5212025784da552f5744b0cc306b5a6e9d9 | [
"Apache-2.0"
] | null | null | null | constants.py | richardpur/Massivo | dadda5212025784da552f5744b0cc306b5a6e9d9 | [
"Apache-2.0"
] | null | null | null | constants.py | richardpur/Massivo | dadda5212025784da552f5744b0cc306b5a6e9d9 | [
"Apache-2.0"
] | null | null | null | LOG_FILE = 'temperature.log'
ZONE_ID = 'ZoneId'
MAX_TEMP = 'MaximumTemperature'
TRIGGERED = 'Triggered'
INCORRECT_CREDENTIALS = 'Incorrect Credentials.'
INCORRECT_ARGUEMENTS = 'Incorrect arguments provided - IP username password'
TEMPERATURE_API = 'http://{}/axis-cgi/temperature_alarm/getzonestatus.cgi?'
DATE_TIME_FORMAT = '%Y-%m-%d %H:%M:%S' | 26.846154 | 76 | 0.759312 | 42 | 349 | 6.095238 | 0.761905 | 0.15625 | 0.226563 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103152 | 349 | 13 | 77 | 26.846154 | 0.817891 | 0 | 0 | 0 | 0 | 0 | 0.551429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.125 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
26023780fc76833942c5bd5c87120f1e384de8c6 | 229 | py | Python | tests/generators/send-gen.py | jpolitz/lambda-py-paper | 746ef63fc1123714b4adaf78119028afbea7bd76 | [
"Apache-2.0"
] | 25 | 2015-04-16T04:31:49.000Z | 2022-03-10T15:53:28.000Z | tests/generators/send-gen.py | jpolitz/lambda-py-paper | 746ef63fc1123714b4adaf78119028afbea7bd76 | [
"Apache-2.0"
] | 1 | 2018-11-21T22:40:02.000Z | 2018-11-26T17:53:11.000Z | tests/generators/send-gen.py | jpolitz/lambda-py-paper | 746ef63fc1123714b4adaf78119028afbea7bd76 | [
"Apache-2.0"
] | 1 | 2021-03-26T03:36:19.000Z | 2021-03-26T03:36:19.000Z | def coroutine(seq):
count = 0
while count < 200:
count += yield
seq.append(count)
seq = []
c = coroutine(seq)
next(c)
___assertEqual(seq, [])
c.send(10)
___assertEqual(seq, [10])
c.send(10)
___assertEqual(seq, [10, 20]) | 13.470588 | 29 | 0.655022 | 34 | 229 | 4.147059 | 0.441176 | 0.297872 | 0.099291 | 0.255319 | 0.326241 | 0.326241 | 0 | 0 | 0 | 0 | 0 | 0.073298 | 0.165939 | 229 | 17 | 29 | 13.470588 | 0.664921 | 0 | 0 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | 1 | 0.076923 | false | 0 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
260d3d65db567e1ae296367dd6f9f823ce75041b | 120 | py | Python | lightning_pass/gui/static/qt_designer/output/__init__.py | kucera-lukas/lightning-pass | 6be2860dae5e93a09702c180321d75bc5fe01b93 | [
"MIT"
] | null | null | null | lightning_pass/gui/static/qt_designer/output/__init__.py | kucera-lukas/lightning-pass | 6be2860dae5e93a09702c180321d75bc5fe01b93 | [
"MIT"
] | null | null | null | lightning_pass/gui/static/qt_designer/output/__init__.py | kucera-lukas/lightning-pass | 6be2860dae5e93a09702c180321d75bc5fe01b93 | [
"MIT"
] | null | null | null | """Subpackage containing the .py files converted by qt designer."""
__all__ = ["main", "splash_screen", "vault_widget"]
| 40 | 67 | 0.725 | 15 | 120 | 5.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116667 | 120 | 2 | 68 | 60 | 0.764151 | 0.508333 | 0 | 0 | 0 | 0 | 0.54717 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
261c59ef40e1dbe496cb6a416c7f01b4f6b76b37 | 903 | py | Python | facet/matcher/similarity/jaccard.py | edponce/FACET | 0dca2d728813a4865e72b2e8fd6b114a0c63d5b0 | [
"MIT"
] | 2 | 2020-10-16T19:27:21.000Z | 2021-11-04T15:06:54.000Z | facet/matcher/similarity/jaccard.py | edponce/FACET | 0dca2d728813a4865e72b2e8fd6b114a0c63d5b0 | [
"MIT"
] | 24 | 2020-07-13T01:49:36.000Z | 2020-10-30T21:54:00.000Z | facet/matcher/similarity/jaccard.py | edponce/FACET | 0dca2d728813a4865e72b2e8fd6b114a0c63d5b0 | [
"MIT"
] | null | null | null | import math
from .base import BaseSimilarity
__all__ = ['JaccardSimilarity']
class JaccardSimilarity(BaseSimilarity):
"""Jaccard similarity coefficient.
Conditions:
>>> jaccard(x,y) = |x & y| / |x U y|, (0,1] -> R
>>> jaccard(x,y) >= a
>>> ceil(a*|x U y|) <= |x & y| <= min(|x|,|y|)
>>> ceil(a*|x U y|) <= |y|
>>> ceil(a*|x|) <= |y| <= floor(|x|/a)
"""
NAME = 'jaccard'
def min_features(self, length, alpha):
return int(math.ceil(alpha * length))
def max_features(self, length, alpha):
return int(math.floor(length / alpha))
def min_common_features(self, lengthA, lengthB, alpha):
return int(math.ceil(alpha * (lengthA + lengthB) / (1. + alpha)))
def similarity(self, featuresA, featuresB):
fa = set(featuresA)
fb = set(featuresB)
return float(len(fa & fb) / len(fa | fb))
| 26.558824 | 73 | 0.55814 | 115 | 903 | 4.313043 | 0.356522 | 0.024194 | 0.018145 | 0.108871 | 0.25 | 0.217742 | 0.145161 | 0 | 0 | 0 | 0 | 0.004505 | 0.262458 | 903 | 33 | 74 | 27.363636 | 0.74024 | 0.27464 | 0 | 0 | 0 | 0 | 0.03871 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.133333 | 0.2 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
261d125b3ae2b14d0b1b687aa6ba92205050b520 | 515 | py | Python | app/data/models/book.py | neurothrone/book-library | ea21ea2a18dae38a2646035b0c33cf845fb8b472 | [
"MIT"
] | null | null | null | app/data/models/book.py | neurothrone/book-library | ea21ea2a18dae38a2646035b0c33cf845fb8b472 | [
"MIT"
] | null | null | null | app/data/models/book.py | neurothrone/book-library | ea21ea2a18dae38a2646035b0c33cf845fb8b472 | [
"MIT"
] | null | null | null | from tortoise import fields, models
from app.shared.enums import Category
class BookDB(models.Model):
id: int = fields.IntField(pk=True, generated=True)
title: str = fields.CharField(max_length=64, null=False)
author: str = fields.CharField(max_length=64, null=False)
category: Category = fields.CharEnumField(Category,
default=Category.WILL_READ,
max_length=10)
class Meta:
table = "books"
| 32.1875 | 73 | 0.6 | 57 | 515 | 5.350877 | 0.614035 | 0.088525 | 0.118033 | 0.137705 | 0.24918 | 0.24918 | 0.24918 | 0.24918 | 0 | 0 | 0 | 0.016949 | 0.312621 | 515 | 15 | 74 | 34.333333 | 0.844633 | 0 | 0 | 0 | 1 | 0 | 0.009709 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.181818 | 0 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
262fc38f2aa4bba0d05bf4356a1b2e47d722057f | 679 | py | Python | src/compas_convert/native.py | tetov/compas_convert | 390940c5e0194998193840af7f90db6e590eee1c | [
"MIT"
] | 2 | 2021-06-24T14:06:34.000Z | 2021-11-02T15:47:56.000Z | src/compas_convert/native.py | tetov/compas_convert | 390940c5e0194998193840af7f90db6e590eee1c | [
"MIT"
] | 6 | 2021-07-28T13:39:26.000Z | 2021-12-13T15:18:36.000Z | src/compas_convert/native.py | biodigitalmatter/compas_convert | eca2a97e0b7d0f1be35d208f73c796fbc3da34fd | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import compas.data
from compas_convert import register_converter
@register_converter([str], compas.data.Data)
def json_str_to_compas_obj(json_str): # type: (str) -> compas.data.Data
"""Convert JSON string to object based on :class:`compas.data.Data`."""
return compas.data.json_loads(json_str)
def compas_obj_to_json_str(obj, pretty=False): # type: (compas.Base, bool) -> str
"""Convert object based on :class:`compas.data.Data` to JSON string.
Just use the native function instead.
"""
return compas.data.json_dumps(obj, pretty=pretty)
| 30.863636 | 82 | 0.75405 | 99 | 679 | 4.878788 | 0.353535 | 0.144928 | 0.115942 | 0.070393 | 0.132505 | 0.132505 | 0.132505 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 679 | 21 | 83 | 32.333333 | 0.829897 | 0.34757 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.5 | 0 | 0.9 | 0.1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
2640ad00c23f726a83dca364c8bb52c3d0ac1fd5 | 973 | py | Python | rockit/core/tests/test_holder_commands.py | acreations/rockit-server | 4d1e87b563d9339e73bf0e5c698a59e8e124cc01 | [
"MIT"
] | null | null | null | rockit/core/tests/test_holder_commands.py | acreations/rockit-server | 4d1e87b563d9339e73bf0e5c698a59e8e124cc01 | [
"MIT"
] | null | null | null | rockit/core/tests/test_holder_commands.py | acreations/rockit-server | 4d1e87b563d9339e73bf0e5c698a59e8e124cc01 | [
"MIT"
] | null | null | null | from django.test import TestCase
from rockit.core.holders import CommandsHolder
class CommandsHolderTestCase(TestCase):
def setUp(self):
self.holder = CommandsHolder()
def test_it_should_be_able_to_add_switch_command(self):
self.holder.add_switch_command('IDENTIFIER', 'TEST_BINARY', 'true', 'false', 'false')
content = self.holder.get_content()
self.assertEqual(True, 'IDENTIFIER' in str(content))
self.assertEqual(True, 'TEST_BINARY' in str(content))
self.assertEqual(True, 'on' in str(content))
self.assertEqual(True, 'off' in str(content))
self.assertEqual(True, 'current' in str(content))
def test_it_should_be_able_to_add_choice_command(self):
self.holder.add_choice_command('TEST_CHOICE')
# Add more unit test later
def test_it_should_be_able_to_add_scales_command(self):
self.holder.add_scales_command('TEST_SCALES')
# Add more unit test later | 33.551724 | 93 | 0.709147 | 129 | 973 | 5.077519 | 0.310078 | 0.100763 | 0.167939 | 0.198473 | 0.479389 | 0.308397 | 0.119084 | 0.119084 | 0 | 0 | 0 | 0 | 0.189106 | 973 | 29 | 94 | 33.551724 | 0.830165 | 0.05036 | 0 | 0 | 0 | 0 | 0.097614 | 0 | 0 | 0 | 0 | 0 | 0.294118 | 1 | 0.235294 | false | 0 | 0.117647 | 0 | 0.411765 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
2643d8a8ddd335b12e7243f52f06a5b2c503bddc | 785 | py | Python | server/processes/migrations/0123_auto_20200821_0549.py | CloudReactor/task_manager | 464ca74371064fabb9a21b1f5bacba30360932ab | [
"Fair"
] | null | null | null | server/processes/migrations/0123_auto_20200821_0549.py | CloudReactor/task_manager | 464ca74371064fabb9a21b1f5bacba30360932ab | [
"Fair"
] | 6 | 2021-11-01T01:35:40.000Z | 2022-02-11T03:33:06.000Z | server/processes/migrations/0123_auto_20200821_0549.py | CloudReactor/task_manager | 464ca74371064fabb9a21b1f5bacba30360932ab | [
"Fair"
] | null | null | null | # Generated by Django 2.2.14 on 2020-08-21 05:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('processes', '0122_auto_20200816_2030'),
]
operations = [
migrations.AddField(
model_name='saastoken',
name='access_level',
field=models.IntegerField(null=True),
),
migrations.AddField(
model_name='saastoken',
name='description',
field=models.CharField(blank=True, default='', max_length=5000),
),
migrations.AddField(
model_name='saastoken',
name='name',
field=models.CharField(blank=True, default='', max_length=200),
),
]
| 27.068966 | 77 | 0.555414 | 74 | 785 | 5.77027 | 0.581081 | 0.126464 | 0.161593 | 0.189696 | 0.491803 | 0.491803 | 0.210773 | 0.210773 | 0 | 0 | 0 | 0.073864 | 0.327389 | 785 | 28 | 78 | 28.035714 | 0.734848 | 0.058599 | 0 | 0.409091 | 1 | 0 | 0.121298 | 0.03244 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
2648d5d1e50c5531076979f46364eb9087d936fa | 179 | py | Python | ARC033/ARC033b.py | VolgaKurvar/AtCoder | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | [
"Unlicense"
] | null | null | null | ARC033/ARC033b.py | VolgaKurvar/AtCoder | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | [
"Unlicense"
] | null | null | null | ARC033/ARC033b.py | VolgaKurvar/AtCoder | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | [
"Unlicense"
] | null | null | null | na, nb = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = set(a)
b = set(b)
t = len(a & b)
t2 = len(a.union(b))
print(t/t2)
| 16.272727 | 35 | 0.547486 | 36 | 179 | 2.722222 | 0.416667 | 0.183673 | 0.336735 | 0.489796 | 0.591837 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013423 | 0.167598 | 179 | 10 | 36 | 17.9 | 0.644295 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
264e3329c9d55202f1462f3791a1d2b590f0a0fd | 1,219 | py | Python | tfx_addons/schema_curation/test_data/module_file/module_file.py | casassg/tfx-addons | 845047274ea0d900cdc3604644453e5d345f301a | [
"Apache-2.0"
] | 70 | 2021-03-16T17:35:04.000Z | 2022-03-28T08:20:07.000Z | tfx_addons/schema_curation/test_data/module_file/module_file.py | casassg/tfx-addons | 845047274ea0d900cdc3604644453e5d345f301a | [
"Apache-2.0"
] | 104 | 2021-04-04T01:10:03.000Z | 2022-03-31T14:25:17.000Z | tfx_addons/schema_curation/test_data/module_file/module_file.py | casassg/tfx-addons | 845047274ea0d900cdc3604644453e5d345f301a | [
"Apache-2.0"
] | 38 | 2021-03-19T17:53:08.000Z | 2022-03-31T14:24:13.000Z | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Supplement for chicago taxi pipeline example with specifics schema modification.
This module file will be used in the custom schema curation component.
"""
import tensorflow_data_validation as tfdv
# TFX schema curation component will call this function.
def schema_fn(schema):
"""modifies the infered schema.
Args:
schema:schema generated by SchemaGen component of tfx
"""
#changing "tips" into optional feature
feature = tfdv.get_feature(schema, 'tips')
feature.presence.min_fraction = 0.9
return schema
| 35.852941 | 83 | 0.716981 | 166 | 1,219 | 5.23494 | 0.638554 | 0.069045 | 0.029919 | 0.036824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009728 | 0.156686 | 1,219 | 33 | 84 | 36.939394 | 0.835603 | 0.815422 | 0 | 0 | 0 | 0 | 0.020942 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
264ff355da2527ab28ed90883dd6aa89fc37f469 | 9,248 | py | Python | pysnmp_mibs/MPLS-LC-FR-STD-MIB.py | jackjack821/pysnmp-mibs | 9835ea0bb2420715caf4ee9aaa07d59bb263acd6 | [
"BSD-2-Clause"
] | 6 | 2017-04-21T13:48:08.000Z | 2022-01-06T19:42:52.000Z | pysnmp_mibs/MPLS-LC-FR-STD-MIB.py | jackjack821/pysnmp-mibs | 9835ea0bb2420715caf4ee9aaa07d59bb263acd6 | [
"BSD-2-Clause"
] | 1 | 2020-05-05T16:42:25.000Z | 2020-05-05T16:42:25.000Z | pysnmp_mibs/MPLS-LC-FR-STD-MIB.py | jackjack821/pysnmp-mibs | 9835ea0bb2420715caf4ee9aaa07d59bb263acd6 | [
"BSD-2-Clause"
] | 6 | 2020-02-08T20:28:49.000Z | 2021-09-14T13:36:46.000Z | #
# PySNMP MIB module MPLS-LC-FR-STD-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/MPLS-LC-FR-STD-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:21:02 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( ObjectIdentifier, Integer, OctetString, ) = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
( ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint")
( DLCI, ) = mibBuilder.importSymbols("FRAME-RELAY-DTE-MIB", "DLCI")
( mplsInterfaceIndex, ) = mibBuilder.importSymbols("MPLS-LSR-STD-MIB", "mplsInterfaceIndex")
( mplsStdMIB, ) = mibBuilder.importSymbols("MPLS-TC-STD-MIB", "mplsStdMIB")
( ObjectGroup, ModuleCompliance, NotificationGroup, ) = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
( TimeTicks, ObjectIdentity, NotificationType, Gauge32, ModuleIdentity, Counter64, Unsigned32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Integer32, iso, Counter32, Bits, ) = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "ObjectIdentity", "NotificationType", "Gauge32", "ModuleIdentity", "Counter64", "Unsigned32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Integer32", "iso", "Counter32", "Bits")
( TextualConvention, StorageType, DisplayString, RowStatus, ) = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "StorageType", "DisplayString", "RowStatus")
mplsLcFrStdMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 10, 166, 10)).setRevisions(("2006-01-12 00:00",))
if mibBuilder.loadTexts: mplsLcFrStdMIB.setLastUpdated('200601120000Z')
if mibBuilder.loadTexts: mplsLcFrStdMIB.setOrganization('Multiprotocol Label Switching (MPLS) Working Group')
if mibBuilder.loadTexts: mplsLcFrStdMIB.setContactInfo(' Thomas D. Nadeau\n Cisco Systems, Inc.\n Email: tnadeau@cisco.com\n\n Subrahmanya Hegde\n Email: subrah@cisco.com\n\n General comments should be sent to mpls@uu.net\n ')
if mibBuilder.loadTexts: mplsLcFrStdMIB.setDescription('This MIB module contains managed object definitions for\n MPLS Label-Controlled Frame-Relay interfaces as defined\n in (RFC3034).\n\n Copyright (C) The Internet Society (2006). This\n version of this MIB module is part of RFC 4368; see\n the RFC itself for full legal notices.')
mplsLcFrStdNotifications = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 10, 0))
mplsLcFrStdObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 10, 1))
mplsLcFrStdConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 10, 2))
mplsLcFrStdInterfaceConfTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 10, 1, 1), )
if mibBuilder.loadTexts: mplsLcFrStdInterfaceConfTable.setDescription("This table specifies per-interface MPLS LC-FR\n capability and associated information. In particular,\n this table sparsely extends the MPLS-LSR-STD-MIB's\n mplsInterfaceConfTable.")
mplsLcFrStdInterfaceConfEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 10, 1, 1, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsInterfaceIndex"))
if mibBuilder.loadTexts: mplsLcFrStdInterfaceConfEntry.setDescription('An entry in this table is created by an LSR for\n every interface capable of supporting MPLS LC-FR.\n Each entry in this table will exist only if a\n corresponding entry in ifTable and mplsInterfaceConfTable\n exists. If the associated entries in ifTable and\n mplsInterfaceConfTable are deleted, the corresponding\n entry in this table must also be deleted shortly\n thereafter.')
mplsLcFrStdTrafficMinDlci = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 10, 1, 1, 1, 1), DLCI()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLcFrStdTrafficMinDlci.setDescription('This is the minimum DLCI value over which this\n LSR is willing to accept traffic on this\n interface.')
mplsLcFrStdTrafficMaxDlci = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 10, 1, 1, 1, 2), DLCI()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLcFrStdTrafficMaxDlci.setDescription('This is the max DLCI value over which this\n LSR is willing to accept traffic on this\n interface.')
mplsLcFrStdCtrlMinDlci = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 10, 1, 1, 1, 3), DLCI()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLcFrStdCtrlMinDlci.setDescription('This is the min DLCI value over which this\n LSR is willing to accept control traffic\n on this interface.')
mplsLcFrStdCtrlMaxDlci = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 10, 1, 1, 1, 4), DLCI()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLcFrStdCtrlMaxDlci.setDescription('This is the max DLCI value over which this\n LSR is willing to accept control traffic\n on this interface.')
mplsLcFrStdInterfaceConfRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 10, 1, 1, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLcFrStdInterfaceConfRowStatus.setDescription('This object is used to create and\n delete entries in this table. When configuring\n entries in this table, the corresponding ifEntry and\n mplsInterfaceConfEntry MUST exist beforehand. If a manager\n attempts to create an entry for a corresponding\n mplsInterfaceConfEntry that does not support LC-FR,\n the agent MUST return an inconsistentValue error.\n If this table is implemented read-only, then the\n agent must set this object to active(1) when this\n row is made active. If this table is implemented\n writable, then an agent MUST not allow modification\n to its objects once this value is set to active(1),\n except to mplsLcFrStdInterfaceConfRowStatus and\n mplsLcFrStdInterfaceConfStorageType.')
mplsLcFrStdInterfaceConfStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 10, 1, 1, 1, 6), StorageType().clone('nonVolatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLcFrStdInterfaceConfStorageType.setDescription("The storage type for this conceptual row.\n Conceptual rows having the value 'permanent(4)'\n need not allow write-access to any columnar\n objects in the row.")
mplsLcFrStdCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 10, 2, 1))
mplsLcFrStdGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 10, 2, 2))
mplsLcFrStdModuleFullCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 10, 166, 10, 2, 1, 1)).setObjects(*(("MPLS-LC-FR-STD-MIB", "mplsLcFrStdIfGroup"),))
if mibBuilder.loadTexts: mplsLcFrStdModuleFullCompliance.setDescription('Compliance statement for agents that provide\n full support for MPLS-LC-FR-STD-MIB. Such\n devices can be monitored and also be configured\n using this MIB module.')
mplsLcFrStdModuleReadOnlyCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 10, 166, 10, 2, 1, 2)).setObjects(*(("MPLS-LC-FR-STD-MIB", "mplsLcFrStdIfGroup"),))
if mibBuilder.loadTexts: mplsLcFrStdModuleReadOnlyCompliance.setDescription('Compliance requirement for implementations that only\n provide read-only support for MPLS-LC-FR-STD-MIB.\n Such devices can be monitored but cannot be configured\n using this MIB module.\n ')
mplsLcFrStdIfGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 10, 2, 2, 1)).setObjects(*(("MPLS-LC-FR-STD-MIB", "mplsLcFrStdTrafficMinDlci"), ("MPLS-LC-FR-STD-MIB", "mplsLcFrStdTrafficMaxDlci"), ("MPLS-LC-FR-STD-MIB", "mplsLcFrStdCtrlMinDlci"), ("MPLS-LC-FR-STD-MIB", "mplsLcFrStdCtrlMaxDlci"), ("MPLS-LC-FR-STD-MIB", "mplsLcFrStdInterfaceConfRowStatus"), ("MPLS-LC-FR-STD-MIB", "mplsLcFrStdInterfaceConfStorageType"),))
if mibBuilder.loadTexts: mplsLcFrStdIfGroup.setDescription('Collection of objects needed for MPLS LC-FR\n interface configuration.')
mibBuilder.exportSymbols("MPLS-LC-FR-STD-MIB", mplsLcFrStdInterfaceConfStorageType=mplsLcFrStdInterfaceConfStorageType, mplsLcFrStdConformance=mplsLcFrStdConformance, mplsLcFrStdModuleReadOnlyCompliance=mplsLcFrStdModuleReadOnlyCompliance, mplsLcFrStdMIB=mplsLcFrStdMIB, PYSNMP_MODULE_ID=mplsLcFrStdMIB, mplsLcFrStdTrafficMinDlci=mplsLcFrStdTrafficMinDlci, mplsLcFrStdCtrlMaxDlci=mplsLcFrStdCtrlMaxDlci, mplsLcFrStdIfGroup=mplsLcFrStdIfGroup, mplsLcFrStdGroups=mplsLcFrStdGroups, mplsLcFrStdInterfaceConfTable=mplsLcFrStdInterfaceConfTable, mplsLcFrStdTrafficMaxDlci=mplsLcFrStdTrafficMaxDlci, mplsLcFrStdCompliances=mplsLcFrStdCompliances, mplsLcFrStdModuleFullCompliance=mplsLcFrStdModuleFullCompliance, mplsLcFrStdCtrlMinDlci=mplsLcFrStdCtrlMinDlci, mplsLcFrStdNotifications=mplsLcFrStdNotifications, mplsLcFrStdObjects=mplsLcFrStdObjects, mplsLcFrStdInterfaceConfRowStatus=mplsLcFrStdInterfaceConfRowStatus, mplsLcFrStdInterfaceConfEntry=mplsLcFrStdInterfaceConfEntry)
| 184.96 | 972 | 0.752703 | 1,101 | 9,248 | 6.319709 | 0.268847 | 0.006036 | 0.00733 | 0.009773 | 0.305979 | 0.237281 | 0.196177 | 0.176631 | 0.176631 | 0.174763 | 0 | 0.047327 | 0.136354 | 9,248 | 49 | 973 | 188.734694 | 0.823839 | 0.033737 | 0 | 0 | 0 | 0.285714 | 0.470707 | 0.048168 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.214286 | 0 | 0.214286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
2656f486dbb9a995ab58b0d36630f0d8efff265c | 509 | py | Python | tests/pyarxaas/hierarchy/test_Interval.py | vinayranjan/pyarxaas | f304d360adf1a647d9daff0afda5290ca0fd7ec8 | [
"MIT"
] | 4 | 2020-07-14T16:36:09.000Z | 2020-11-24T14:28:02.000Z | tests/pyarxaas/hierarchy/test_Interval.py | vinayranjan/pyarxaas | f304d360adf1a647d9daff0afda5290ca0fd7ec8 | [
"MIT"
] | 20 | 2020-06-19T04:37:33.000Z | 2021-07-26T04:27:46.000Z | tests/pyarxaas/hierarchy/test_Interval.py | vinayranjan/pyarxaas | f304d360adf1a647d9daff0afda5290ca0fd7ec8 | [
"MIT"
] | 2 | 2020-11-11T11:52:06.000Z | 2020-12-03T10:22:47.000Z | import unittest
from pyarxaas.hierarchy.interval_builder.interval import Interval
class IntervalTest(unittest.TestCase):
def test_init(self):
self.assertIsNotNone(Interval(0, 10))
def test_equality(self):
i1 = Interval(0, 10, "child")
i2 = Interval(0, 10, "child")
self.assertEqual(i1, i2)
def test_hash(self):
i1 = Interval(0, 10, "child")
i2 = Interval(0, 10, "child")
test_set = {i1, i2}
self.assertEqual(1, len(test_set))
| 23.136364 | 65 | 0.624754 | 65 | 509 | 4.8 | 0.4 | 0.144231 | 0.176282 | 0.205128 | 0.25641 | 0.25641 | 0.25641 | 0.25641 | 0.25641 | 0.25641 | 0 | 0.062827 | 0.249509 | 509 | 21 | 66 | 24.238095 | 0.753927 | 0 | 0 | 0.285714 | 0 | 0 | 0.03937 | 0 | 0 | 0 | 0 | 0 | 0.214286 | 1 | 0.214286 | false | 0 | 0.142857 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
265979b0be0f811adb2b1d248b1e12962a970100 | 998 | py | Python | biggmodeldata/reactions.py | ssokolen/biggmodeldata | 66a4ae8c68480d8510beb00a67fcf5656f0bad4c | [
"BSD-4-Clause-UC"
] | 1 | 2021-05-05T13:29:38.000Z | 2021-05-05T13:29:38.000Z | biggmodeldata/reactions.py | ssokolen/biggmodeldata | 66a4ae8c68480d8510beb00a67fcf5656f0bad4c | [
"BSD-4-Clause-UC"
] | null | null | null | biggmodeldata/reactions.py | ssokolen/biggmodeldata | 66a4ae8c68480d8510beb00a67fcf5656f0bad4c | [
"BSD-4-Clause-UC"
] | null | null | null | from .schema import ReactionNames, ReactionECs, ReactionMetabolites, ReactionAlternatives
def ecs(rid):
query = ReactionECs.select().where(ReactionECs.rid == rid)
return [item.ec for item in query]
def ids(ec):
query = ReactionECs.select().where(ReactionECs.ec == ec)
return [item.rid for item in query]
def reactants(rid):
query = ReactionMetabolites.select().where(
(ReactionMetabolites.rid == rid) & (ReactionMetabolites.stoichiometry < 0)
)
return [(item.stoichiometry, item.mid) for item in query]
def products(rid):
query = ReactionMetabolites.select().where(
(ReactionMetabolites.rid == rid) & (ReactionMetabolites.stoichiometry > 0)
)
return [(item.stoichiometry, item.mid) for item in query]
def alternatives(rid, include_self = True):
query = ReactionAlternatives.select().where(ReactionAlternatives.rid == rid)
out = [rid] if include_self else []
return out + [item.alternative for item in query]
| 28.514286 | 89 | 0.697395 | 112 | 998 | 6.196429 | 0.285714 | 0.079251 | 0.064842 | 0.100865 | 0.570605 | 0.412104 | 0.412104 | 0.412104 | 0.412104 | 0.412104 | 0 | 0.002469 | 0.188377 | 998 | 34 | 90 | 29.352941 | 0.854321 | 0 | 0 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0.047619 | 0 | 0.52381 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
2660dda60ee1b5202e4f923b0b39a95ce6fc18ad | 1,738 | py | Python | pycantonese/tests/test_docs.py | jacksonllee/pycantonese | 610aa7de35d2d36cf78ea787eca9093b728be38b | [
"MIT"
] | 124 | 2019-08-12T13:10:43.000Z | 2022-03-24T18:35:58.000Z | pycantonese/tests/test_docs.py | jacksonllee/pycantonese | 610aa7de35d2d36cf78ea787eca9093b728be38b | [
"MIT"
] | 13 | 2019-09-03T17:08:49.000Z | 2021-12-28T21:37:17.000Z | pycantonese/tests/test_docs.py | jacksonllee/pycantonese | 610aa7de35d2d36cf78ea787eca9093b728be38b | [
"MIT"
] | 15 | 2019-08-09T04:03:01.000Z | 2022-03-17T10:18:21.000Z | """Tests related to the documentation."""
import pytest
import requests
@pytest.mark.parametrize(
"url",
[
"https://talkbank.org/manuals/CHAT.pdf",
"https://pylangacq.org/",
"http://compling.hss.ntu.edu.sg/hkcancor/",
"https://github.com/jacksonllee/pycantonese/blob/main/pycantonese/data/hkcancor/README.md", # noqa: E501
"https://childes.talkbank.org/data/Biling/YipMatthews.zip",
"https://pylangacq.org/read.html",
"https://pylangacq.org/headers.html",
"https://docs.python.org/3/library/re.html",
"https://www.lshk.org/jyutping",
"https://www.tug.org/TUGboat/tb17-2/tb51rei.pdf",
"https://universaldependencies.org/u/pos/index.html",
"https://pycantonese.org/index.html#links",
# Archives
"https://pycantonese.org/papers/lee-chen-tsui-wicl3-slides-2016-03-12.pdf",
"https://pycantonese.org/papers/lee-chen-tsui-wicl3-handout-2016-03-12.pdf",
"https://pycantonese.org/papers/Lee-pycantonese-2015.html",
"https://github.com/jacksonllee/pycantonese/blob/main/docs/tutorials/lee-pycantonese-2021-05-16.ipynb", # noqa: E501
"https://github.com/jacksonllee/pycantonese/blob/main/docs/tutorials/lee-python-2021-april.ipynb", # noqa: E501
"https://github.com/chaaklau/school-of-cantonese-2021-materials/blob/main/chaak_sfp_2021_05_16.ipynb", # noqa: E501
"https://github.com/charlestklam/school-of-cantonese-studies-2021/blob/main/Multiword_Expressions_Discontinuous_Constructions.ipynb", # noqa: E501
],
)
def test_urls_work(url):
"""URLs used in the documentation shouldn't be dead."""
with requests.get(url) as r:
assert r.status_code == 200
| 46.972973 | 155 | 0.677791 | 226 | 1,738 | 5.168142 | 0.486726 | 0.047089 | 0.059932 | 0.064212 | 0.324486 | 0.324486 | 0.30137 | 0.263699 | 0.217466 | 0.10274 | 0 | 0.050238 | 0.152474 | 1,738 | 36 | 156 | 48.277778 | 0.742702 | 0.086306 | 0 | 0 | 0 | 0.241379 | 0.726463 | 0 | 0 | 0 | 0 | 0 | 0.034483 | 1 | 0.034483 | false | 0 | 0.068966 | 0 | 0.103448 | 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 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
268a62fd439ad959cced4d3dd75e20d035878588 | 779 | py | Python | goods/migrations/0031_auto_20171222_1756.py | huachao2017/goodsdl | 3616d53b90696a97a5d56a064e2a14d484b821d7 | [
"Apache-2.0"
] | 3 | 2018-10-16T09:36:12.000Z | 2019-04-15T03:12:49.000Z | goods/migrations/0031_auto_20171222_1756.py | huachao2017/goodsdl | 3616d53b90696a97a5d56a064e2a14d484b821d7 | [
"Apache-2.0"
] | null | null | null | goods/migrations/0031_auto_20171222_1756.py | huachao2017/goodsdl | 3616d53b90696a97a5d56a064e2a14d484b821d7 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-22 17:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('goods', '0030_auto_20171222_1557'),
]
operations = [
migrations.RemoveField(
model_name='transactionmetrix',
name='rfid_minus_upc',
),
migrations.AddField(
model_name='transactionmetrix',
name='only_image_upc_num',
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name='transactionmetrix',
name='only_rfid_upc_num',
field=models.PositiveIntegerField(default=0),
),
]
| 25.966667 | 57 | 0.609756 | 76 | 779 | 6 | 0.618421 | 0.059211 | 0.171053 | 0.197368 | 0.425439 | 0.425439 | 0.425439 | 0 | 0 | 0 | 0 | 0.062724 | 0.283697 | 779 | 29 | 58 | 26.862069 | 0.75448 | 0.087291 | 0 | 0.454545 | 1 | 0 | 0.180791 | 0.032486 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.090909 | 0 | 0.227273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
268d81046c7e6c585d87c0c0b96fbfc68c39dbf8 | 273 | py | Python | nupicter/__init__.py | industArk/nupicter | eee50c0313ed31bffefe3294f3103a13fb3de54c | [
"BSD-2-Clause"
] | null | null | null | nupicter/__init__.py | industArk/nupicter | eee50c0313ed31bffefe3294f3103a13fb3de54c | [
"BSD-2-Clause"
] | 14 | 2021-05-08T16:28:19.000Z | 2021-06-12T07:42:38.000Z | nupicter/__init__.py | industArk/nupicter | eee50c0313ed31bffefe3294f3103a13fb3de54c | [
"BSD-2-Clause"
] | null | null | null | # Nupicter - Hand operated picture filtering tool
# Copyright (C) 2021 Arkadiusz Choruzy
#
# Arkadiusz Choruzy
# achoruzy@gmail.com
try:
from nupicter import filehandler
except (ImportError, IOError):
filehandler = MissingModule("filehandler", urgent=1)
| 22.75 | 56 | 0.732601 | 29 | 273 | 6.896552 | 0.827586 | 0.16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022523 | 0.186813 | 273 | 11 | 57 | 24.818182 | 0.878378 | 0.468864 | 0 | 0 | 0 | 0 | 0.080292 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
26944bcd34949b80f762504c263ae2e0544ae0d7 | 4,012 | py | Python | src/api/extension.py | piwaniuk/critic | 28ed20bb8032d7cc5aa23de98da51e619fd84164 | [
"Apache-2.0"
] | 216 | 2015-01-05T12:48:10.000Z | 2022-03-08T00:12:23.000Z | src/api/extension.py | piwaniuk/critic | 28ed20bb8032d7cc5aa23de98da51e619fd84164 | [
"Apache-2.0"
] | 55 | 2015-02-28T12:10:26.000Z | 2020-11-18T17:45:16.000Z | src/api/extension.py | piwaniuk/critic | 28ed20bb8032d7cc5aa23de98da51e619fd84164 | [
"Apache-2.0"
] | 34 | 2015-05-02T15:15:10.000Z | 2020-06-15T19:20:37.000Z | # -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2015 the Critic contributors, Opera Software ASA
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import api
class ExtensionError(api.APIError):
"""Base exception for all errors related to the Extension class"""
pass
class InvalidExtensionId(ExtensionError):
"""Raised when a invalid extension id is used"""
def __init__(self, value):
"""Constructor"""
super(InvalidExtensionId, self).__init__(
"Invalid extension id: %r" % value)
self.value = value
class InvalidExtensionKey(ExtensionError):
"""Raised when an invalid extension key is used"""
def __init__(self, value):
"""Constructor"""
super(InvalidExtensionKey, self).__init__(
"Invalid extension key: %r" % value)
self.value = value
class Extension(api.APIObject):
"""Representation of a Critic extension"""
@property
def id(self):
"""The extension's unique id"""
return self._impl.id
@property
def name(self):
"""The extension's name"""
return self._impl.name
@property
def key(self):
"""The extension's unique key
For a system extension, the key is the extension's name. For other
extensions, the key is the publisher's username followed by a slash
followed by the extension's name."""
return self._impl.getKey(self.critic)
@property
def publisher(self):
"""The extension's publisher
The user that published the extension. This may not be the author
(who may not be a user of this Critic system.)
None if this is a system extension."""
return self._impl.getPublisher(self.critic)
@property
def default_version(self):
"""The default extension version
This is typically the version whose extension description and other
metadata should be presented as the extension's true metadata."""
return self._impl.getDefaultVersion()
def fetch(critic, extension_id=None, key=None):
"""Fetch an Extension object with the given extension id or key
Exactly one of the 'extension_id' and 'key' arguments can be used.
Exceptions:
InvalidExtensionId: if 'extension_id' is used and is not a valid
extension id.
InvalidExtensionKey: if 'key' is used and is not a valid extensions
key."""
import api.impl
assert isinstance(critic, api.critic.Critic)
assert (extension_id is None) != (key is None)
return api.impl.extension.fetch(critic, extension_id, key)
def fetchAll(critic, publisher=None, installed_by=None):
"""Fetch Extension objects for all extensions in the system
If 'publisher' is not None, it must be an api.user.User object, and only
extensions published by this user are returned.
If 'installed_by' is not None, it must be an api.user.User object, and
only extensions that this user has installed are returned. This may
include extensions that are universally installed (i.e. installed for all
users, and not by this user directly.)"""
import api.impl
assert isinstance(critic, api.critic.Critic)
assert publisher is None or isinstance(publisher, api.user.User)
assert installed_by is None or isinstance(installed_by, api.user.User)
return api.impl.extension.fetchAll(critic, publisher, installed_by)
| 35.821429 | 80 | 0.676221 | 534 | 4,012 | 5.020599 | 0.294007 | 0.044759 | 0.033943 | 0.025364 | 0.183514 | 0.166356 | 0.147706 | 0.109661 | 0.081313 | 0.081313 | 0 | 0.002965 | 0.243519 | 4,012 | 111 | 81 | 36.144144 | 0.880395 | 0.546112 | 0 | 0.325 | 0 | 0 | 0.03123 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.225 | false | 0.025 | 0.075 | 0 | 0.575 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
13fe7b87cf0d0531c3cb30478484ab32b8b70295 | 1,039 | py | Python | apostello/views/keywords.py | LaudateCorpus1/apostello | 1ace89d0d9e1f7a1760f6247d90a60a9787a4f12 | [
"MIT"
] | 69 | 2015-10-03T20:27:53.000Z | 2021-04-06T05:26:18.000Z | apostello/views/keywords.py | LaudateCorpus1/apostello | 1ace89d0d9e1f7a1760f6247d90a60a9787a4f12 | [
"MIT"
] | 73 | 2015-10-03T17:53:47.000Z | 2020-10-01T03:08:01.000Z | apostello/views/keywords.py | LaudateCorpus1/apostello | 1ace89d0d9e1f7a1760f6247d90a60a9787a4f12 | [
"MIT"
] | 29 | 2015-10-23T22:00:13.000Z | 2021-11-30T04:48:06.000Z | import csv
from django.contrib.auth.decorators import login_required
from django.urls import reverse
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from apostello.decorators import keyword_access_check
from apostello.models import Keyword
@keyword_access_check
@login_required
def keyword_csv(request, keyword):
"""Return a CSV with the responses for a single keyword."""
keyword = get_object_or_404(Keyword, keyword=keyword)
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(content_type="text/csv")
response["Content-Disposition"] = 'attachment; filename="{0}.csv"'.format(keyword.keyword)
writer = csv.writer(response)
writer.writerow(["From", "Time", "Keyword", "Message"])
# write response rows
for sms_ in keyword.fetch_matches():
writer.writerow([sms_.sender_name, sms_.time_received, sms_.matched_keyword, sms_.content])
return response
| 37.107143 | 99 | 0.773821 | 134 | 1,039 | 5.828358 | 0.455224 | 0.06402 | 0.028169 | 0.035851 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007795 | 0.135707 | 1,039 | 27 | 100 | 38.481481 | 0.861915 | 0.13282 | 0 | 0 | 0 | 0 | 0.088367 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0 | 0.421053 | 0 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
cd16e3326e42d84b0d1fbd799e1c0ea055dbc316 | 973 | py | Python | cmsplugin_contact/nospam/forms.py | datakortet/cmsplugin-contact | 57568d73ddb2748e45c37c2cd74f29988ab4c239 | [
"BSD-2-Clause"
] | 12 | 2015-02-28T22:52:00.000Z | 2019-06-27T13:59:17.000Z | cmsplugin_contact/nospam/forms.py | datakortet/cmsplugin-contact | 57568d73ddb2748e45c37c2cd74f29988ab4c239 | [
"BSD-2-Clause"
] | 32 | 2015-03-10T12:11:53.000Z | 2019-03-13T02:43:45.000Z | cmsplugin_contact/nospam/forms.py | datakortet/cmsplugin-contact | 57568d73ddb2748e45c37c2cd74f29988ab4c239 | [
"BSD-2-Clause"
] | 28 | 2015-03-12T14:40:18.000Z | 2021-04-13T05:55:30.000Z | from django import forms
from ..nospam import utils
from .fields import HoneypotField
class BaseForm(forms.Form):
def __init__(self, request, *args, **kwargs):
self._request = request
super(BaseForm, self).__init__(*args, **kwargs)
class AkismetForm(BaseForm):
akismet_fields = {
'comment_author': 'name',
'comment_author_email': 'email',
'comment_author_url': 'url',
'comment_content': 'comment',
}
akismet_api_key = None
def akismet_check(self):
fields = {}
for key, value in self.akismet_fields.items():
fields[key] = self.cleaned_data[value]
return utils.akismet_check(self._request, akismet_api_key=self.akismet_api_key, **fields)
class RecaptchaForm(BaseForm):
pass
class HoneyPotForm(BaseForm):
accept_terms = HoneypotField()
class SuperSpamKillerForm(RecaptchaForm, HoneyPotForm, AkismetForm):
pass
| 23.731707 | 97 | 0.651593 | 103 | 973 | 5.883495 | 0.417476 | 0.054455 | 0.064356 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.244604 | 973 | 40 | 98 | 24.325 | 0.82449 | 0 | 0 | 0.076923 | 0 | 0 | 0.088386 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0.076923 | 0.115385 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
cd27b2a1cd489e6f3c5b02196bf4e2402796f138 | 482 | py | Python | src/contract_test/test_contract.py | lucasstd/teste-selenium | 9ca1c57c9470ccbe708172013cd28835d26a8614 | [
"MIT"
] | null | null | null | src/contract_test/test_contract.py | lucasstd/teste-selenium | 9ca1c57c9470ccbe708172013cd28835d26a8614 | [
"MIT"
] | null | null | null | src/contract_test/test_contract.py | lucasstd/teste-selenium | 9ca1c57c9470ccbe708172013cd28835d26a8614 | [
"MIT"
] | null | null | null | import pytest
import logging
import json
import urllib.request
# Local libraries
from ..settings import configs
from .json_schema.jsonschema_validator import validate_json
""" Describe: Testar JSON da API """
def test_contract():
# Abrir o link nas variaveis de ambiente "API_URL"
with urllib.request.urlopen(configs['API_URL']) as url:
data = json.loads(url.read().decode())
# Garantir que a validação não volte nenhum erro
assert not validate_json(data)
| 28.352941 | 59 | 0.744813 | 68 | 482 | 5.176471 | 0.691176 | 0.073864 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170124 | 482 | 16 | 60 | 30.125 | 0.88 | 0.23029 | 0 | 0 | 0 | 0 | 0.021148 | 0 | 0 | 0 | 0 | 0 | 0.1 | 1 | 0.1 | false | 0 | 0.6 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
cd27cfc54fcf6a0e2e9ba33f36fcd8725b1aef67 | 189 | py | Python | exercicio18.py | LuizHps18/infosatc-lp-avaliativo-01 | 0b891d74a98705182175a53e023b6cbbe8cc880a | [
"MIT"
] | null | null | null | exercicio18.py | LuizHps18/infosatc-lp-avaliativo-01 | 0b891d74a98705182175a53e023b6cbbe8cc880a | [
"MIT"
] | null | null | null | exercicio18.py | LuizHps18/infosatc-lp-avaliativo-01 | 0b891d74a98705182175a53e023b6cbbe8cc880a | [
"MIT"
] | null | null | null | vm = float(input("Digite um volume em metros cubicos: "))
lc = 1000 * vm
print("O volume digitado é de {} metros cubicos, esse valor convertido é em volume {:.2f} litros " .format(vm,lc)) | 37.8 | 114 | 0.693122 | 31 | 189 | 4.225806 | 0.709677 | 0.198473 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032051 | 0.174603 | 189 | 5 | 114 | 37.8 | 0.807692 | 0 | 0 | 0 | 0 | 0 | 0.663158 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cd2848e49aea955be5810398f2be14cbaff83b91 | 221 | py | Python | always_use/db/db_config.py | Valuebai/awesome-python-io | 8bb3400036843975cb41cbfd85ccfe603596930b | [
"MIT"
] | 8 | 2019-05-01T05:22:44.000Z | 2022-03-02T10:04:48.000Z | always_use/db/db_config.py | Valuebai/awesome-python-io | 8bb3400036843975cb41cbfd85ccfe603596930b | [
"MIT"
] | 26 | 2019-03-23T05:10:04.000Z | 2022-03-04T09:57:32.000Z | always_use/db/db_config.py | Valuebai/awesome-python-io | 8bb3400036843975cb41cbfd85ccfe603596930b | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# [mysql数据库配置信息]
db_mysql_host = "127.0.0.1"
db_mysql_port = 3306
db_mysql_user = 'root'
db_mysql_password = '123456'
db_mysql_database = 'matrix'
db_mysql_charset = 'utf8'
| 18.416667 | 28 | 0.705882 | 35 | 221 | 4.114286 | 0.685714 | 0.291667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09375 | 0.131222 | 221 | 11 | 29 | 20.090909 | 0.65625 | 0.257919 | 0 | 0 | 0 | 0 | 0.180124 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
cd3796f31496a4a24753c73aaf4e9e725c93e284 | 1,112 | py | Python | configs/LaneMarkings.py | JonasStankevicius/ConvPoint_Keras | 3850e09ad5c39c892bc031c050b30ea48866a4d8 | [
"MIT"
] | 16 | 2020-06-07T14:25:46.000Z | 2022-03-24T17:14:27.000Z | configs/LaneMarkings.py | JonasStankevicius/ConvPoint_Keras | 3850e09ad5c39c892bc031c050b30ea48866a4d8 | [
"MIT"
] | 4 | 2020-11-10T18:03:15.000Z | 2022-02-10T04:32:24.000Z | configs/LaneMarkings.py | JonasStankevicius/ConvPoint_Keras | 3850e09ad5c39c892bc031c050b30ea48866a4d8 | [
"MIT"
] | 5 | 2020-11-10T14:38:38.000Z | 2022-01-31T09:38:30.000Z | from configs import Config, Aerial
from imports import *
class LaneMarkings(Aerial):
pointComponents = 3
noFeature = False
featureComponents = 1
classCount = 2
classNames = Label.LaneMarkings.Names
blocksize = 1
test_step = 0.5
name = "LaneMarkings"
def NormalizeData(self, points, features = None, labels = None):
return points, features * 255, labels
class LaneMarkingsSmallDense(LaneMarkings):
blocksize = 1
test_step = 0.9
ValidationInterval = 1
TestInterval = 3
name = "LaneMarkingsSmallDense"
Paths = Paths.LaneMarkingsSmallDense
def ValidationFiles(self):
return Paths.GetFiles(self.Paths.processedTest)
class LaneMarkingsLargeSparse(LaneMarkings):
blocksize = 6
test_step = 3
ValidationInterval = 1
TestInterval = 3
test_split = 0
name = "LaneMarkingsLargeSparse"
Paths = Paths.LaneMarkingsLargeSparse
def TestFiles(self):
return self.train_files
def ValidationFiles(self):
return Paths.GetFiles(self.Paths.processedTest) | 21.803922 | 68 | 0.67446 | 107 | 1,112 | 6.962617 | 0.448598 | 0.032215 | 0.037584 | 0.048322 | 0.220134 | 0.169128 | 0.169128 | 0.169128 | 0.169128 | 0 | 0 | 0.02303 | 0.258094 | 1,112 | 51 | 69 | 21.803922 | 0.88 | 0 | 0 | 0.294118 | 0 | 0 | 0.051213 | 0.040431 | 0 | 0 | 0 | 0 | 0 | 1 | 0.117647 | false | 0 | 0.058824 | 0.117647 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
cd3ca46f8932fbb278e4bb6b48d6422c13aec1cd | 310 | py | Python | Assignment 1 - Neural networks/unroll_params.py | marioyc/Hand-written-Digit-Recognition | b86e097e00d1799b8d799cb702177a2bf64ab5ee | [
"MIT"
] | null | null | null | Assignment 1 - Neural networks/unroll_params.py | marioyc/Hand-written-Digit-Recognition | b86e097e00d1799b8d799cb702177a2bf64ab5ee | [
"MIT"
] | null | null | null | Assignment 1 - Neural networks/unroll_params.py | marioyc/Hand-written-Digit-Recognition | b86e097e00d1799b8d799cb702177a2bf64ab5ee | [
"MIT"
] | null | null | null | from numpy import *
def unroll_params(Theta):
nn_params = reshape(Theta[0],(1,-1)).transpose()
for i in range(1,len(Theta)):
nn_params = concatenate((nn_params,reshape(Theta[i], (1, -1)).transpose()))
nn_params = ndarray.flatten(nn_params)
return nn_params
| 23.846154 | 83 | 0.609677 | 42 | 310 | 4.333333 | 0.5 | 0.263736 | 0.142857 | 0.21978 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.245161 | 310 | 12 | 84 | 25.833333 | 0.752137 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cd4c4575e44c7ecd3fd16cccee06df1c256fb8c6 | 992 | py | Python | src/chapter 4/exercise 4.py | group5BCS1/BCS-2021 | 696b53bdfc46799b4a527604fbd6cd6cfb3982eb | [
"MIT"
] | null | null | null | src/chapter 4/exercise 4.py | group5BCS1/BCS-2021 | 696b53bdfc46799b4a527604fbd6cd6cfb3982eb | [
"MIT"
] | null | null | null | src/chapter 4/exercise 4.py | group5BCS1/BCS-2021 | 696b53bdfc46799b4a527604fbd6cd6cfb3982eb | [
"MIT"
] | null | null | null | def computer_grade(score):
<<<<<<< HEAD
print("The score entered must be an integer or a float")
score = (float(input("Enter your score :")))
if score<0:
return("BAD SCORE")
elif score>1:
return ("BAD SCORE")
elif score >=0.9:
return ("A")
elif score >=0.8:
return ("B")
elif score>=0.7:
return ("C")
elif score>=0.6:
return ("D")
elif score<0.6:
return ("F")
else:
return ("BAD SCORE")
result = computer_grade("score")
print(result)
=======
try:
score = (float(input("Enter your score :")))
if score<0:
print("BAD SCORE")
elif score>1:
print("BAD SCORE")
elif score >=0.9:
print("A")
elif score >=0.8:
print("B")
elif score>=0.7:
print("C")
elif score>=0.6:
print("D")
elif score<0.6:
print("F")
else:
print("BAD SCORE")
except:
print("Bad score")
computer_grade("score")
>>>>>>> 4baa02f (charpter 4 exrcises are done)
| 21.565217 | 59 | 0.539315 | 140 | 992 | 3.8 | 0.3 | 0.135338 | 0.18797 | 0.12782 | 0.541353 | 0.210526 | 0.139098 | 0.139098 | 0.139098 | 0 | 0 | 0.039216 | 0.280242 | 992 | 45 | 60 | 22.044444 | 0.705882 | 0 | 0 | 0.533333 | 0 | 0 | 0.167339 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.244444 | 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 | 0 | 0 | 2 |
cd632a7c89dec5baac1545bff21d69b98863afab | 384 | py | Python | apps/cms/serializers/category_serializers.py | lovebirdegg/nnms-server | 9fd4563ccca9f29add375d346cdd1c2dd636c512 | [
"MIT"
] | null | null | null | apps/cms/serializers/category_serializers.py | lovebirdegg/nnms-server | 9fd4563ccca9f29add375d346cdd1c2dd636c512 | [
"MIT"
] | null | null | null | apps/cms/serializers/category_serializers.py | lovebirdegg/nnms-server | 9fd4563ccca9f29add375d346cdd1c2dd636c512 | [
"MIT"
] | null | null | null | # @Time : 2020-08-18 10:24:22
# @Author : code_generator
from rest_framework import serializers
from ..models import CategoryInfo
from rest_framework_recursive.fields import RecursiveField
class CategoryInfoSerializer(serializers.ModelSerializer):
children = RecursiveField(many=True, required=False)
class Meta:
model = CategoryInfo
fields = '__all__' | 27.428571 | 58 | 0.755208 | 42 | 384 | 6.714286 | 0.738095 | 0.056738 | 0.120567 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044025 | 0.171875 | 384 | 14 | 59 | 27.428571 | 0.842767 | 0.145833 | 0 | 0 | 0 | 0 | 0.021472 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
cd69e7371d91125d1cbe88b313158ddc7e8c0276 | 3,260 | py | Python | website/auth.py | abrarahasanadil/Blood-Bank-Management-System | 528934ac0c2a77ebbcf63504c195b4beaf38fabf | [
"MIT"
] | 1 | 2021-05-24T11:46:05.000Z | 2021-05-24T11:46:05.000Z | website/auth.py | abrarahasanadil/Blood-Bank-Management-System | 528934ac0c2a77ebbcf63504c195b4beaf38fabf | [
"MIT"
] | null | null | null | website/auth.py | abrarahasanadil/Blood-Bank-Management-System | 528934ac0c2a77ebbcf63504c195b4beaf38fabf | [
"MIT"
] | null | null | null | from flask import Blueprint, render_template, request, flash, redirect, url_for
from .models import User
from werkzeug.security import generate_password_hash, check_password_hash
from . import db
from flask_login import login_user, logout_user, login_required, current_user
auth = Blueprint('auth', __name__)
# ! LOGIN
@auth.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
email = request.form.get('email')
password = request.form.get('password')
# ! Filtering user with this email
user = User.query.filter_by(email=email).first()
if user:
if check_password_hash(user.password, password):
flash('Logged in', category='success')
login_user(user, remember=True)
return redirect(url_for('views.dashboard'))
else:
flash('Incorrect Password, Try again', category='error')
else:
flash('No account created, Create one now', category='error')
return redirect(url_for('auth.sign_up'))
return render_template("login.html", user=current_user)
# ! LOGOUT
@auth.route('/logout')
@login_required
def logout():
logout_user()
return redirect(url_for('auth.login'))
# ! SIGN UP
@auth.route('/sign-up', methods=['GET', 'POST'])
def sign_up():
if request.method == 'POST':
email = request.form.get('email')
name = request.form.get('name')
phone = request.form.get('phone')
gender = request.form.get('gender')
blood_type = request.form.get('blood_type')
password1 = request.form.get('password1')
password2 = request.form.get('password2')
mylist = ['A+', 'A-', 'B+', 'B-', 'O+', 'O-', 'AB+', 'AB-']
user = User.query.filter_by(email=email).first()
if user:
flash('Email already exists', category='error')
elif len(email) < 3:
flash('Invalid Email', category='error')
elif len(name) < 2:
flash('Name must be at least of 1 character', category='error')
elif len(phone) < 11:
flash('Invalid Phone Number', category='error')
elif len(phone) > 11:
flash('Invalid Phone Number', category='error')
elif blood_type.upper() not in mylist:
flash("Enter Valid Blood Type", category='error')
elif password1 != password2:
flash('Passwords don\'t match.', category='error')
elif len(password1) < 7:
flash('Password must be at least 7 characters', category='error')
else:
# ? ADD USER TO DATABASE
new_user = User(email = email,
name = name,
phone = phone,
blood_type = blood_type,
gender = gender,
password = generate_password_hash(password1, method='sha256'))
db.session.add(new_user)
db.session.commit()
login_user(new_user, remember=True)
flash('Account created', category="success")
return redirect(url_for('views.dashboard'))
return render_template("sign_up.html", user= current_user)
| 37.906977 | 90 | 0.584049 | 375 | 3,260 | 4.96 | 0.290667 | 0.069892 | 0.067742 | 0.053763 | 0.216667 | 0.19086 | 0.154301 | 0.154301 | 0.154301 | 0.108065 | 0 | 0.008595 | 0.286196 | 3,260 | 85 | 91 | 38.352941 | 0.790718 | 0.025153 | 0 | 0.217391 | 1 | 0 | 0.172131 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.043478 | false | 0.15942 | 0.072464 | 0 | 0.202899 | 0.028986 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
cd6e315e7c5b16827a521513dff9b68bf73b99a2 | 12,439 | py | Python | avalon-py/avalon/protos/job_pb2.py | yoshida-lab/avalon | 6c85434b1a6c089bc57bc9f76fa0a931d2dd4c70 | [
"Apache-2.0"
] | null | null | null | avalon-py/avalon/protos/job_pb2.py | yoshida-lab/avalon | 6c85434b1a6c089bc57bc9f76fa0a931d2dd4c70 | [
"Apache-2.0"
] | null | null | null | avalon-py/avalon/protos/job_pb2.py | yoshida-lab/avalon | 6c85434b1a6c089bc57bc9f76fa0a931d2dd4c70 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: job.protobuf
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
import task_pb2 as task__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='job.protobuf',
package='job',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\tjob.protobuf\x12\x03job\x1a\x1fgoogle/protobuf/timestamp.protobuf\x1a\ntask.protobuf\"!\n\x07JobList\x12\x16\n\x04jobs\x18\x01 \x03(\x0b\x32\x08.job.Job\"\x13\n\x05JobId\x12\n\n\x02id\x18\x01 \x01(\r\"\x18\n\x06JobIds\x12\x0e\n\x02id\x18\x01 \x03(\x05\x42\x02\x10\x01\"\xd5\x01\n\x03Job\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0f\n\x07job_dir\x18\x02 \x01(\t\x12\x10\n\x08hostname\x18\x03 \x01(\t\x12.\n\ncreated_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x66inished_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1c\n\x05state\x18\x06 \x01(\x0e\x32\r.job.JobState\x12\x14\n\x07message\x18\x07 \x01(\tH\x00\x88\x01\x01\x42\n\n\x08_message*b\n\x08JobState\x12\x0b\n\x07STANDBY\x10\x00\x12\n\n\x06MOVING\x10\x01\x12\x0b\n\x07PENDING\x10\x02\x12\x0b\n\x07RUNNING\x10\x03\x12\x08\n\x04\x44ONE\x10\x04\x12\t\n\x05\x45RROR\x10\x05\x12\x0e\n\nTERMINATED\x10\x06\x32y\n\x08QueryJob\x12%\n\x07GetJobs\x12\x0c.task.TaskId\x1a\x0c.job.JobList\x12&\n\tGetJobIds\x12\x0c.task.TaskId\x1a\x0b.job.JobIds\x12\x1e\n\x06GetJob\x12\n.job.JobId\x1a\x08.job.Jobb\x06proto3'
,
dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,task__pb2.DESCRIPTOR,])
_JOBSTATE = _descriptor.EnumDescriptor(
name='JobState',
full_name='job.JobState',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='STANDBY', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='MOVING', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='PENDING', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='RUNNING', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='DONE', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ERROR', index=5, number=5,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='TERMINATED', index=6, number=6,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=361,
serialized_end=459,
)
_sym_db.RegisterEnumDescriptor(_JOBSTATE)
JobState = enum_type_wrapper.EnumTypeWrapper(_JOBSTATE)
STANDBY = 0
MOVING = 1
PENDING = 2
RUNNING = 3
DONE = 4
ERROR = 5
TERMINATED = 6
_JOBLIST = _descriptor.Descriptor(
name='JobList',
full_name='job.JobList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='jobs', full_name='job.JobList.jobs', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=63,
serialized_end=96,
)
_JOBID = _descriptor.Descriptor(
name='JobId',
full_name='job.JobId',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='job.JobId.id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=98,
serialized_end=117,
)
_JOBIDS = _descriptor.Descriptor(
name='JobIds',
full_name='job.JobIds',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='job.JobIds.id', index=0,
number=1, type=5, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\020\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=119,
serialized_end=143,
)
_JOB = _descriptor.Descriptor(
name='Job',
full_name='job.Job',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='job.Job.id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='job_dir', full_name='job.Job.job_dir', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='hostname', full_name='job.Job.hostname', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='created_at', full_name='job.Job.created_at', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='finished_at', full_name='job.Job.finished_at', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='state', full_name='job.Job.state', index=5,
number=6, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='message', full_name='job.Job.message', index=6,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
_descriptor.OneofDescriptor(
name='_message', full_name='job.Job._message',
index=0, containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[]),
],
serialized_start=146,
serialized_end=359,
)
_JOBLIST.fields_by_name['jobs'].message_type = _JOB
_JOB.fields_by_name['created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_JOB.fields_by_name['finished_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_JOB.fields_by_name['state'].enum_type = _JOBSTATE
_JOB.oneofs_by_name['_message'].fields.append(
_JOB.fields_by_name['message'])
_JOB.fields_by_name['message'].containing_oneof = _JOB.oneofs_by_name['_message']
DESCRIPTOR.message_types_by_name['JobList'] = _JOBLIST
DESCRIPTOR.message_types_by_name['JobId'] = _JOBID
DESCRIPTOR.message_types_by_name['JobIds'] = _JOBIDS
DESCRIPTOR.message_types_by_name['Job'] = _JOB
DESCRIPTOR.enum_types_by_name['JobState'] = _JOBSTATE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
JobList = _reflection.GeneratedProtocolMessageType('JobList', (_message.Message,), {
'DESCRIPTOR' : _JOBLIST,
'__module__' : 'job_pb2'
# @@protoc_insertion_point(class_scope:job.JobList)
})
_sym_db.RegisterMessage(JobList)
JobId = _reflection.GeneratedProtocolMessageType('JobId', (_message.Message,), {
'DESCRIPTOR' : _JOBID,
'__module__' : 'job_pb2'
# @@protoc_insertion_point(class_scope:job.JobId)
})
_sym_db.RegisterMessage(JobId)
JobIds = _reflection.GeneratedProtocolMessageType('JobIds', (_message.Message,), {
'DESCRIPTOR' : _JOBIDS,
'__module__' : 'job_pb2'
# @@protoc_insertion_point(class_scope:job.JobIds)
})
_sym_db.RegisterMessage(JobIds)
Job = _reflection.GeneratedProtocolMessageType('Job', (_message.Message,), {
'DESCRIPTOR' : _JOB,
'__module__' : 'job_pb2'
# @@protoc_insertion_point(class_scope:job.Job)
})
_sym_db.RegisterMessage(Job)
_JOBIDS.fields_by_name['id']._options = None
_QUERYJOB = _descriptor.ServiceDescriptor(
name='QueryJob',
full_name='job.QueryJob',
file=DESCRIPTOR,
index=0,
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_start=461,
serialized_end=582,
methods=[
_descriptor.MethodDescriptor(
name='GetJobs',
full_name='job.QueryJob.GetJobs',
index=0,
containing_service=None,
input_type=task__pb2._TASKID,
output_type=_JOBLIST,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='GetJobIds',
full_name='job.QueryJob.GetJobIds',
index=1,
containing_service=None,
input_type=task__pb2._TASKID,
output_type=_JOBIDS,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='GetJob',
full_name='job.QueryJob.GetJob',
index=2,
containing_service=None,
input_type=_JOBID,
output_type=_JOB,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
])
_sym_db.RegisterServiceDescriptor(_QUERYJOB)
DESCRIPTOR.services_by_name['QueryJob'] = _QUERYJOB
# @@protoc_insertion_point(module_scope)
| 35.039437 | 1,105 | 0.742825 | 1,615 | 12,439 | 5.380186 | 0.130031 | 0.058004 | 0.09184 | 0.087007 | 0.612499 | 0.576476 | 0.565197 | 0.565197 | 0.543791 | 0.5103 | 0 | 0.038586 | 0.1312 | 12,439 | 354 | 1,106 | 35.138418 | 0.76543 | 0.031996 | 0 | 0.58805 | 1 | 0.003145 | 0.152823 | 0.091295 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.022013 | 0 | 0.022013 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cd7dd87bbd800adc3777c0e908ccf7e50731f318 | 86 | py | Python | 1/q1.py | inuradz/Advent-of-code-2018 | 8016613fef56557d99c7e19f5f00e67dd68d901a | [
"MIT"
] | null | null | null | 1/q1.py | inuradz/Advent-of-code-2018 | 8016613fef56557d99c7e19f5f00e67dd68d901a | [
"MIT"
] | null | null | null | 1/q1.py | inuradz/Advent-of-code-2018 | 8016613fef56557d99c7e19f5f00e67dd68d901a | [
"MIT"
] | null | null | null | import sys
num = 0
for line in sys.stdin:
num += int(line.rstrip())
print(num) | 9.555556 | 29 | 0.627907 | 15 | 86 | 3.6 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015152 | 0.232558 | 86 | 9 | 30 | 9.555556 | 0.80303 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cd84b45ee3ed9b0575c53efe8edd37c976d77fbd | 710 | py | Python | things/management/commands/rebuild_static_site.py | jmoswalt/django-things | e9889490efa4da3ff7abb6fa192bb66596d5a240 | [
"Apache-2.0"
] | 2 | 2017-05-17T16:40:52.000Z | 2019-10-27T02:52:17.000Z | things/management/commands/rebuild_static_site.py | jmoswalt/django-things | e9889490efa4da3ff7abb6fa192bb66596d5a240 | [
"Apache-2.0"
] | 7 | 2020-02-11T21:18:40.000Z | 2022-03-11T23:11:29.000Z | things/management/commands/rebuild_static_site.py | jmoswalt/django-things | e9889490efa4da3ff7abb6fa192bb66596d5a240 | [
"Apache-2.0"
] | null | null | null | import os
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.conf import settings
from things.models import StaticBuild
class Command(BaseCommand):
"""
Runs the staticsitegen command and the collectstatic command.
"""
def handle(self, **options):
call_command('collectstatic', interactive=False)
call_command('staticsitegen')
if settings.MEDUSA_DEPLOY_DIR:
os.system("sed -i 's|http://testserver|%s|g' %s" % (settings.SERVER_NAME, os.path.join(settings.MEDUSA_DEPLOY_DIR, 'feed', 'index.rss')))
mark_staticbuild = StaticBuild()
mark_staticbuild.save()
print "DONE !!!"
| 32.272727 | 149 | 0.7 | 85 | 710 | 5.729412 | 0.576471 | 0.061602 | 0.057495 | 0.098563 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188732 | 710 | 21 | 150 | 33.809524 | 0.845486 | 0 | 0 | 0 | 0 | 0 | 0.131122 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.357143 | null | null | 0.071429 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
cd96266b46c5806a1223dde7574b15d8296f4d2f | 165 | py | Python | pythonProject/EXERCICIOS PYTHON/ex005.py | lucasjlgc/Aulas-de-Python- | 6aaed1c660487a680e9c449210600ccdfa326612 | [
"MIT"
] | null | null | null | pythonProject/EXERCICIOS PYTHON/ex005.py | lucasjlgc/Aulas-de-Python- | 6aaed1c660487a680e9c449210600ccdfa326612 | [
"MIT"
] | 1 | 2021-06-25T15:29:11.000Z | 2021-06-25T15:29:11.000Z | pythonProject/EXERCICIOS PYTHON/ex005.py | lucasjlgc/Aulas-de-Python- | 6aaed1c660487a680e9c449210600ccdfa326612 | [
"MIT"
] | null | null | null | numero = int(input('Digite um numero: '))
menor = numero -1
maior = numero + 1
print(f'Analisando o numero {numero}, seu antecessor {menor} e o sucessor é {maior}') | 33 | 85 | 0.69697 | 26 | 165 | 4.423077 | 0.653846 | 0.121739 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.163636 | 165 | 5 | 85 | 33 | 0.818841 | 0 | 0 | 0 | 0 | 0 | 0.560241 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cd991692a6c52bee04c420b8af6e15ade981da95 | 156 | py | Python | config.py | ruter/free-PACKT-eBooks-Crawler | e99941b2c61ccebc6b6a10ebd03451e9046471b5 | [
"MIT"
] | 17 | 2017-05-12T13:54:40.000Z | 2022-02-13T21:03:04.000Z | config.py | ruter/free-PACKT-eBooks-Crawler | e99941b2c61ccebc6b6a10ebd03451e9046471b5 | [
"MIT"
] | 1 | 2019-12-30T07:38:35.000Z | 2019-12-30T08:09:57.000Z | config.py | ruter/free-PACKT-eBooks-Crawler | e99941b2c61ccebc6b6a10ebd03451e9046471b5 | [
"MIT"
] | 4 | 2017-05-13T13:23:57.000Z | 2018-07-25T01:42:32.000Z | # -*- coding: utf-8 -*-
account = {
'email': 'YOUR EMAIL',
'password': 'YOUR PASSWORD'
}
op = "Login"
form_id = "packt_user_login_form"
frequency = 8 | 14.181818 | 33 | 0.615385 | 20 | 156 | 4.6 | 0.7 | 0.195652 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015873 | 0.192308 | 156 | 11 | 34 | 14.181818 | 0.714286 | 0.134615 | 0 | 0 | 0 | 0 | 0.462687 | 0.156716 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.142857 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
2696dcb7c6828134fa6b4c49e0f517f4006168bc | 242 | py | Python | ex10.py | PhyuAye/Python_exercises-1 | 3a4049d7af5d0bb3a13b89f3040c9e26a888fea6 | [
"MIT"
] | null | null | null | ex10.py | PhyuAye/Python_exercises-1 | 3a4049d7af5d0bb3a13b89f3040c9e26a888fea6 | [
"MIT"
] | null | null | null | ex10.py | PhyuAye/Python_exercises-1 | 3a4049d7af5d0bb3a13b89f3040c9e26a888fea6 | [
"MIT"
] | 1 | 2018-06-26T08:29:44.000Z | 2018-06-26T08:29:44.000Z | tabby_dog="\tI'm tabbed in";
persian_dog="I'm split\non s line."
backslash_dog="i'm \\ a \\ dog"
fat_dog="I'll do a list:\t* dog food \t* Fishies \t* Catnip\n\t* Grass"
print(tabby_dog)
print(persian_dog)
print(backslash_dog)
print(fat_dog)
| 24.2 | 71 | 0.710744 | 49 | 242 | 3.346939 | 0.510204 | 0.073171 | 0.060976 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115702 | 242 | 9 | 72 | 26.888889 | 0.766355 | 0 | 0 | 0 | 0 | 0.125 | 0.46473 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
269bc2c5e5d7e6c67217d4221e9d812684ede287 | 708 | py | Python | swifttest/chain/generatescripts.py | wangzhezhe/observerchain | faa8fb9d845a2720704538f01e1e7597083d4510 | [
"MIT"
] | null | null | null | swifttest/chain/generatescripts.py | wangzhezhe/observerchain | faa8fb9d845a2720704538f01e1e7597083d4510 | [
"MIT"
] | null | null | null | swifttest/chain/generatescripts.py | wangzhezhe/observerchain | faa8fb9d845a2720704538f01e1e7597083d4510 | [
"MIT"
] | null | null | null | import datetime
import time
import os
import sys
if len(sys.argv)!=2:
print './generate.py <pairnum>'
sys.exit(0)
pairnum=int(sys.argv[1])
originstr='''file simout <single_file_mapper; file=strcat("output/simout.out")>;
simout = simulation(steps,range,values,prev);
file anaout <single_file_mapper; file=strcat("output/anaout.out")>;
anaout = analyze(simout);'''
file=open('chain.swift', 'a')
for x in range(2,pairnum+1):
simout='simout'+str(x)
anaout='anaout'+str(x)
anaoutprev='anaout'+str(x-1)
nstr=originstr.replace('simout',simout)
nstr=nstr.replace('anaout',anaout)
nstr=nstr.replace('prev',anaoutprev)
file.write('\n\n')
file.write(nstr)
file.close()
| 22.125 | 80 | 0.685028 | 104 | 708 | 4.625 | 0.442308 | 0.024948 | 0.066528 | 0.08316 | 0.133056 | 0.133056 | 0 | 0 | 0 | 0 | 0 | 0.009772 | 0.132768 | 708 | 31 | 81 | 22.83871 | 0.773616 | 0 | 0 | 0 | 1 | 0 | 0.397454 | 0.1471 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.173913 | null | null | 0.043478 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
26e449afc3608e4fa70d36b12f47f719338f3c60 | 160 | py | Python | MultirefPredict/tests/compare.py | chenruduan/MultirefPredict | fb44809efcbe413db0a38092c36e8bee6e2a94df | [
"BSD-3-Clause"
] | 1 | 2020-07-07T18:05:36.000Z | 2020-07-07T18:05:36.000Z | MultirefPredict/tests/compare.py | chenruduan/MultirefPredict | fb44809efcbe413db0a38092c36e8bee6e2a94df | [
"BSD-3-Clause"
] | null | null | null | MultirefPredict/tests/compare.py | chenruduan/MultirefPredict | fb44809efcbe413db0a38092c36e8bee6e2a94df | [
"BSD-3-Clause"
] | null | null | null | """
Helper functions for comparison
"""
import math
def fuzzyEqual(a,b,thre):
res = False
if math.fabs(a-b) < thre:
res = True
return res
| 14.545455 | 31 | 0.60625 | 23 | 160 | 4.217391 | 0.73913 | 0.041237 | 0.123711 | 0.185567 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.275 | 160 | 10 | 32 | 16 | 0.836207 | 0.19375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
26fb70bfd6595d2543b70237a6bf66d075d78495 | 3,422 | py | Python | tests/test_parser.py | F1ashhimself/ui-map-parser | abc99d910f5d6d3f509fd62a9bb70f5c563197e8 | [
"Apache-2.0"
] | null | null | null | tests/test_parser.py | F1ashhimself/ui-map-parser | abc99d910f5d6d3f509fd62a9bb70f5c563197e8 | [
"Apache-2.0"
] | null | null | null | tests/test_parser.py | F1ashhimself/ui-map-parser | abc99d910f5d6d3f509fd62a9bb70f5c563197e8 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
__author__ = 'f1ashhimself@gmail.com'
import pytest
from hamcrest import assert_that, equal_to, raises
from ui_map_parser import UIMapException
def test_simple_element(ui_map_parser):
selector_type, selector = ui_map_parser.parse_element('SimpleELEMENT')
assert_that(selector_type, equal_to('xpath'))
assert_that(selector, equal_to('//div'))
def test_element_with_different_cased_properties(ui_map_parser):
selector_type, selector = ui_map_parser.parse_element('ElementWithDifferentCasedProperties')
assert_that(selector_type, equal_to('xpath'))
assert_that(selector, equal_to('//div'))
def test_element_without_type(ui_map_parser):
selector_type, selector = ui_map_parser.parse_element('ElementWithoutType')
assert_that(selector_type, equal_to('xpath'))
assert_that(selector, equal_to('//div'))
def test_element_with_parent_in_common(ui_map_parser):
selector_type, selector = ui_map_parser.parse_element('Foo.ElementWithParent')
assert_that(selector_type, equal_to('xpath'))
assert_that(selector, equal_to('//div/span'))
def test_element_with_parent_not_in_common(ui_map_parser):
selector_type, selector = ui_map_parser.parse_element('ElementWithParent')
assert_that(selector_type, equal_to('xpath'))
assert_that(selector, equal_to('/div[@id="some_id"]'))
def test_element_with_template(ui_map_parser):
selector_type, selector = ui_map_parser.parse_element('ElementWithTemplate', template={'id_name': 'some_id'})
assert_that(selector_type, equal_to('xpath'))
assert_that(selector, equal_to('//div[@id="some_id"]'))
def test_element_with_template_in_parent(ui_map_parser):
selector_type, selector = ui_map_parser.parse_element('Foo.ElementWithTemplateInParent',
template={'id_name': 'some_id'})
assert_that(selector_type, equal_to('xpath'))
assert_that(selector, equal_to('//div[@id="some_id"]/span'))
@pytest.mark.parametrize('ui_map_parser', ['en'], indirect=True)
def test_element_with_different_language(ui_map_parser):
selector_type, selector = ui_map_parser.parse_element('ElementWithSelectorForEnLanguage')
assert_that(selector_type, equal_to('xpath'))
assert_that(selector, equal_to('//div[text()="some text"]'))
def test_file_not_found(ui_map_parser):
file_name = 'UnexistingFile'
assert_that(lambda: ui_map_parser.parse_element(f'{file_name}.UnexistingElement'),
raises(UIMapException, f'File "{file_name.lower()}" was not found.'))
def test_element_not_found(ui_map_parser):
element_name = 'UnexistingElement'
assert_that(lambda: ui_map_parser.parse_element(element_name),
raises(UIMapException, f'Element "{element_name}" was not found.'))
def test_element_with_parent_but_different_types(ui_map_parser):
element_name = 'Foo.ElementWithParentDifferentTypes'
assert_that(lambda: ui_map_parser.parse_element(element_name),
raises(UIMapException,
f'"{element_name}" element and "SimpleElement" element have different element '
f'types.'))
def test_element_with_different_register(ui_map_parser):
selector_type, selector = ui_map_parser.parse_element('bAr.ElementWithDifferentREgister')
assert_that(selector_type, equal_to('xpath'))
assert_that(selector, equal_to('/div/span'))
| 39.790698 | 113 | 0.746639 | 442 | 3,422 | 5.346154 | 0.167421 | 0.055015 | 0.121033 | 0.081253 | 0.716462 | 0.642827 | 0.621667 | 0.621667 | 0.605163 | 0.605163 | 0 | 0.000678 | 0.138515 | 3,422 | 85 | 114 | 40.258824 | 0.800882 | 0.006137 | 0 | 0.25 | 0 | 0 | 0.208297 | 0.08326 | 0 | 0 | 0 | 0 | 0.392857 | 1 | 0.214286 | false | 0 | 0.053571 | 0 | 0.267857 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
26fe658227b923ad1072ae4ea1831b410f24d42e | 4,516 | py | Python | yaglm/opt/glm_loss/huber_regression.py | ngierty/yaglm | 57e212b576af7c5c0f0d62f9d6ad2484b9e25f10 | [
"MIT"
] | 15 | 2021-10-19T15:00:12.000Z | 2022-03-24T22:24:54.000Z | yaglm/opt/glm_loss/huber_regression.py | ngierty/yaglm | 57e212b576af7c5c0f0d62f9d6ad2484b9e25f10 | [
"MIT"
] | 13 | 2021-07-22T21:52:55.000Z | 2021-10-07T11:50:10.000Z | yaglm/opt/glm_loss/huber_regression.py | ngierty/yaglm | 57e212b576af7c5c0f0d62f9d6ad2484b9e25f10 | [
"MIT"
] | 2 | 2021-11-12T18:45:12.000Z | 2021-12-14T14:57:42.000Z | import numpy as np
from scipy.optimize import root_scalar
from yaglm.opt.glm_loss.base import Glm, GlmMultiResp, GlmInputLoss
from yaglm.opt.utils import safe_vectorize
def huber_eval_1d(r, knot=1):
x_abs = abs(r)
if x_abs <= knot:
return 0.5 * r ** 2
else:
return knot * (x_abs - 0.5 * knot)
vec_huber_eval = safe_vectorize(huber_eval_1d)
def huber_grad_1d(r, knot=1):
if abs(r) <= knot:
return r
else:
return knot * np.sign(r)
vec_huber_grad = safe_vectorize(huber_grad_1d)
def huber_prox_1d(z, y, knot=1, step=1):
# https://math.stackexchange.com/questions/1650411/proximal-operator-of-the-huber-loss-function
# also see (2.2) or https://web.stanford.edu/~boyd/papers/pdf/prox_algs.pdf
r = z - y
# p = r - step * r / max(abs(r), step + 1)
# return p + y
return z - step * r / max(abs(r), step + 1)
vec_huber_prox = safe_vectorize(huber_prox_1d)
def sample_losses(z, y, knot=1):
return vec_huber_eval(r=z - y, knot=knot)
def sample_losses_multi_resp(z, y, knot=1):
return vec_huber_eval(r=z - y, knot=knot).sum(axis=1)
def sample_grads(z, y, knot=1):
return vec_huber_grad(r=z - y, knot=knot)
def huberized_mean_1d(values, knot=1, sample_weight=None, **kws):
"""
Computes the huberized mean of a set of 1d samples.
Parameters
----------
values: array-like, (n_samples)
knot: float
Where the knot is.
sample_weight: None, array-like (n_samples, )
**kws:
keyword arguments to scipy.optimize.root_scalar
Output
------
avg: float
"""
def score(x):
scores = np.array([huber_grad_1d(r=x - v, knot=knot)
for v in values.ravel()])
return np.average(scores, weights=sample_weight)
avg = np.average(values, weights=sample_weight)
med = np.median(values)
bracket = [min(values), max(values)]
result = root_scalar(f=score, bracket=bracket,
x0=avg, x1=med,
**kws)
huber_mean = result.root
return huber_mean
def huberized_mean(values, axis=0, knot=1, sample_weight=None, **kws):
"""
Computes the huberized mean along the axis of an array.
Parameters
----------
values: array-like, (n_samples)
knot: float
Where the knot is.
sample_weight: None, array-like (n_samples, )
**kws:
keyword arguments to scipy.optimize.root_scalar
Output
------
avg: array-like or float
"""
out = np.apply_along_axis(func1d=huberized_mean_1d,
arr=values, axis=axis,
knot=knot, sample_weight=sample_weight, **kws)
if out.ndim == 0:
out = float(out)
return out
class Huber(GlmInputLoss):
sample_losses = staticmethod(sample_losses)
sample_grads = staticmethod(sample_grads)
# TODO: add this
# sample_proxs = !!!!
@property
def is_smooth(self):
return self.loss_kws['knot'] > 0
@property
def grad_lip(self):
return 1 / self.n_samples
class HuberReg(Glm):
GLM_LOSS_CLASS = Huber
def __init__(self, X, y, fit_intercept=True, sample_weight=None,
knot=1.35):
super().__init__(X=X, y=y, fit_intercept=fit_intercept,
sample_weight=sample_weight, knot=knot)
def intercept_at_coef_eq0(self):
return huberized_mean(values=self.y,
axis=0,
sample_weight=self.sample_weight,
knot=self.loss_kws['knot'])
class HuberMulti(GlmInputLoss):
sample_losses = staticmethod(sample_losses_multi_resp)
sample_grads = staticmethod(sample_grads)
sample_proxs = staticmethod(vec_huber_prox)
@property
def is_smooth(self):
return self.loss_kws['knot'] > 0
@property
def grad_lip(self):
return 1 / self.n_samples
class HuberRegMultiResp(GlmMultiResp):
GLM_LOSS_CLASS = HuberMulti
def __init__(self, X, y, fit_intercept=True, sample_weight=None,
knot=1.35):
super().__init__(X=X, y=y, fit_intercept=fit_intercept,
sample_weight=sample_weight, knot=knot)
def intercept_at_coef_eq0(self):
return huberized_mean(values=self.y,
axis=0,
sample_weight=self.sample_weight,
knot=self.loss_kws['knot'])
| 24.543478 | 99 | 0.606732 | 612 | 4,516 | 4.259804 | 0.22549 | 0.082854 | 0.01611 | 0.01074 | 0.508631 | 0.482547 | 0.439202 | 0.418105 | 0.418105 | 0.418105 | 0 | 0.01697 | 0.28233 | 4,516 | 183 | 100 | 24.677596 | 0.787411 | 0.183127 | 0 | 0.386364 | 0 | 0 | 0.004488 | 0 | 0 | 0 | 0 | 0.005464 | 0 | 1 | 0.193182 | false | 0 | 0.045455 | 0.102273 | 0.556818 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
f8062d58b79567b1c58d25496de86acfbbfe2898 | 600 | py | Python | setup.py | Rafael-Cirino/ciridrive-python | f4d2e8b5477343547caf6952a1615a59ee8b892c | [
"MIT"
] | 1 | 2020-09-04T01:25:26.000Z | 2020-09-04T01:25:26.000Z | setup.py | Rafael-Cirino/Ciridrive | f4d2e8b5477343547caf6952a1615a59ee8b892c | [
"MIT"
] | null | null | null | setup.py | Rafael-Cirino/Ciridrive | f4d2e8b5477343547caf6952a1615a59ee8b892c | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
setup(
name="ciridrive_python",
version="1.195",
url="https://github.com/Rafael-Cirino/Ciridrive",
license="MIT",
author="Rafael Cirino",
author_email="rafael.cirino@unicamperacing.com.br",
description="This library simplifies the integration of python algorithms with Google drive | Essa biblioteca simplifica a integração de algoritmos em python, com o Google drive",
packages=find_packages(exclude=["test", "credentials", "download", "pass_drive"]),
long_description=open("README.md").read(),
zip_safe=False,
)
| 37.5 | 183 | 0.73 | 75 | 600 | 5.746667 | 0.76 | 0.083527 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007797 | 0.145 | 600 | 15 | 184 | 40 | 0.832359 | 0 | 0 | 0 | 0 | 0.076923 | 0.534224 | 0.058431 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.076923 | 0.076923 | 0 | 0.076923 | 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 | 0 | 0 | 0 | 2 |
f80d261c33d7c82d65a9d2e0773e2086b974ef1f | 175 | py | Python | lang/Python/sorting-algorithms-permutation-sort.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | lang/Python/sorting-algorithms-permutation-sort.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | lang/Python/sorting-algorithms-permutation-sort.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | from itertools import permutations
in_order = lambda s: all(x <= s[i+1] for i,x in enumerate(s[:-1]))
perm_sort = lambda s: next((p for p in permutations(s) if in_order(p)))
| 35 | 71 | 0.697143 | 35 | 175 | 3.4 | 0.542857 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013514 | 0.154286 | 175 | 4 | 72 | 43.75 | 0.790541 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
f8153db257604a325f643a00624010fded894b78 | 215 | py | Python | tests/exam/while-mul.py | Mieschendahl/assignment-final-stub | 19eea657fcc4f8a455c42028f34b918628514cc0 | [
"MIT"
] | null | null | null | tests/exam/while-mul.py | Mieschendahl/assignment-final-stub | 19eea657fcc4f8a455c42028f34b918628514cc0 | [
"MIT"
] | 1 | 2022-03-20T11:08:45.000Z | 2022-03-20T11:08:45.000Z | tests/exam/while-mul.py | Mieschendahl/assignment-final-stub | 19eea657fcc4f8a455c42028f34b918628514cc0 | [
"MIT"
] | 6 | 2022-03-13T13:10:25.000Z | 2022-03-28T22:18:12.000Z | #in=5
#in=10
#in=11
#in=20
#in=22
#in=30
#in=33
#in=40
#in=44
#in=50
#in=55
#golden=6050
n = input_int()
out = 0
while (n > 0):
x = input_int()
y = input_int()
out = out + x * y
n = n - 1
print(out)
| 10.238095 | 21 | 0.525581 | 47 | 215 | 2.340426 | 0.510638 | 0.218182 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177215 | 0.265116 | 215 | 20 | 22 | 10.75 | 0.518987 | 0.302326 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f81f08ea66a0e6555f63689069644ed0e4254564 | 506 | py | Python | pyobs/interfaces/IStoppable.py | pyobs/pyobs-core | e3401e63eb31587c2bc535f7346b7e4ef69d64ab | [
"MIT"
] | 4 | 2020-02-14T10:50:03.000Z | 2022-03-25T04:15:06.000Z | pyobs/interfaces/IStoppable.py | pyobs/pyobs-core | e3401e63eb31587c2bc535f7346b7e4ef69d64ab | [
"MIT"
] | 60 | 2020-09-14T09:10:20.000Z | 2022-03-25T17:51:42.000Z | pyobs/interfaces/IStoppable.py | pyobs/pyobs-core | e3401e63eb31587c2bc535f7346b7e4ef69d64ab | [
"MIT"
] | 2 | 2020-10-14T09:34:57.000Z | 2021-04-27T09:35:57.000Z | from .interface import *
class IStoppable(Interface):
"""The module can be started and stopped."""
__module__ = 'pyobs.interfaces'
def start(self, *args, **kwargs):
"""Starts a service."""
raise NotImplementedError
def stop(self, *args, **kwargs):
"""Stops a service."""
raise NotImplementedError
def is_running(self, *args, **kwargs) -> bool:
"""Whether a service is running."""
raise NotImplementedError
__all__ = ['IStoppable']
| 23 | 50 | 0.618577 | 52 | 506 | 5.846154 | 0.596154 | 0.078947 | 0.138158 | 0.210526 | 0.230263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.247036 | 506 | 21 | 51 | 24.095238 | 0.7979 | 0.203557 | 0 | 0.3 | 0 | 0 | 0.068063 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.1 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f824213f7665bbddd46ab9bbf233b3badda842e4 | 472 | py | Python | src/readonly.py | m-mizutani/slips | 1ddd5b234df06556d0ade2dcf90a00d6ab708c00 | [
"BSD-2-Clause"
] | 4 | 2018-05-03T00:50:33.000Z | 2019-10-18T01:57:03.000Z | src/readonly.py | m-mizutani/slips | 1ddd5b234df06556d0ade2dcf90a00d6ab708c00 | [
"BSD-2-Clause"
] | null | null | null | src/readonly.py | m-mizutani/slips | 1ddd5b234df06556d0ade2dcf90a00d6ab708c00 | [
"BSD-2-Clause"
] | 2 | 2019-10-18T01:57:29.000Z | 2021-01-30T03:56:48.000Z | import slips.interface
import logging
import collections
class MyTest(slips.interface.Handler):
def __init__(self):
self._logger = logging.getLogger()
self._logger.setLevel(logging.INFO)
self._results = collections.defaultdict(int)
def setup(self, args):
self._logger.info('ARGS > %s', args)
def recv(self, meta, event):
self._results[meta.tag] += 1
def result(self):
return dict(self._results)
| 23.6 | 52 | 0.648305 | 56 | 472 | 5.285714 | 0.517857 | 0.101351 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002778 | 0.237288 | 472 | 19 | 53 | 24.842105 | 0.819444 | 0 | 0 | 0 | 0 | 0 | 0.019068 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.214286 | 0.071429 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f82c929794d779ed83cfd15f8f6d12804fbf93e2 | 578 | py | Python | paprika_sync/core/forms.py | grschafer/paprika-sync | 8b6fcd6246557bb79009fa9355fd4d588fb8ed90 | [
"MIT"
] | null | null | null | paprika_sync/core/forms.py | grschafer/paprika-sync | 8b6fcd6246557bb79009fa9355fd4d588fb8ed90 | [
"MIT"
] | null | null | null | paprika_sync/core/forms.py | grschafer/paprika-sync | 8b6fcd6246557bb79009fa9355fd4d588fb8ed90 | [
"MIT"
] | null | null | null | from django import forms
from .models import PaprikaAccount
class PaprikaAccountForm(forms.ModelForm):
class Meta:
model = PaprikaAccount
fields = ('username', 'password', 'alias')
widgets = {
'password': forms.PasswordInput(),
}
def __init__(self, *args, user=None, **kwargs):
super().__init__(*args, **kwargs)
self.user = user
def save(self, **kwargs):
return PaprikaAccount.import_account(self.user, self.cleaned_data['username'], self.cleaned_data['password'], self.cleaned_data['alias'])
| 28.9 | 145 | 0.643599 | 60 | 578 | 6 | 0.5 | 0.091667 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223183 | 578 | 19 | 146 | 30.421053 | 0.801782 | 0 | 0 | 0 | 0 | 0 | 0.086505 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.214286 | 0.214286 | 0.071429 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
f83e0082851ba73afb81834246970df2d4f2a686 | 87 | py | Python | src/changeHasOpen.py | Glassware-corporation/Glassware-launcher | d0ea5b7506798bfd7204c5d5c104d47f5f944fda | [
"CC0-1.0"
] | 1 | 2022-03-31T18:56:48.000Z | 2022-03-31T18:56:48.000Z | src/changeHasOpen.py | JakeTheDev0000/jake-Launcher-CPP | d0ea5b7506798bfd7204c5d5c104d47f5f944fda | [
"CC0-1.0"
] | null | null | null | src/changeHasOpen.py | JakeTheDev0000/jake-Launcher-CPP | d0ea5b7506798bfd7204c5d5c104d47f5f944fda | [
"CC0-1.0"
] | null | null | null | fileChange = open("gwsf/hasOpened.gwsf", "w")
fileChange.write("1")
fileChange.close()
| 21.75 | 45 | 0.724138 | 11 | 87 | 5.727273 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012346 | 0.068966 | 87 | 3 | 46 | 29 | 0.765432 | 0 | 0 | 0 | 0 | 0 | 0.241379 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f84bbf453fd33e7fe8b82927f9336ec19d362dec | 369 | py | Python | tests/test_alerts.py | mauza/seekout | 7f8d9b7f3c55f8e1f259c06852e8f57666c55872 | [
"MIT"
] | 1 | 2020-11-11T03:39:25.000Z | 2020-11-11T03:39:25.000Z | tests/test_alerts.py | mauza/seekout | 7f8d9b7f3c55f8e1f259c06852e8f57666c55872 | [
"MIT"
] | null | null | null | tests/test_alerts.py | mauza/seekout | 7f8d9b7f3c55f8e1f259c06852e8f57666c55872 | [
"MIT"
] | null | null | null | from seekout.alerts.sms import sms_notification
def test_sms():
try:
sms_notification(
msg_text="Hello",
recipients=["mauza@mauza.net"],
smtp_user="doesntwork",
smtp_password="password",
smtp_host="localhost",
smtp_port=576,
)
except ConnectionRefusedError:
pass
| 23.0625 | 47 | 0.569106 | 35 | 369 | 5.771429 | 0.742857 | 0.148515 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012245 | 0.336043 | 369 | 15 | 48 | 24.6 | 0.812245 | 0 | 0 | 0 | 0 | 0 | 0.127371 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | true | 0.153846 | 0.076923 | 0 | 0.153846 | 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 | 0 | 0 | 0 | 2 |
f86925d5b48dbecf7621646b9b6600d360422495 | 98 | py | Python | output/models/ms_data/simple_type/st_e067_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/ms_data/simple_type/st_e067_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/ms_data/simple_type/st_e067_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.ms_data.simple_type.st_e067_xsd.st_e067 import Root
__all__ = [
"Root",
]
| 16.333333 | 70 | 0.744898 | 16 | 98 | 4 | 0.8125 | 0.1875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 0.142857 | 98 | 5 | 71 | 19.6 | 0.690476 | 0 | 0 | 0 | 0 | 0 | 0.040816 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f86d37f2f4a208f87d7869b60d0b175792ec187b | 8,381 | py | Python | Classes/Constexpr.py | Phil0nator/Cb-Compiler | 63059ee4c2e0426dc1424586324730af89f435de | [
"MIT"
] | 3 | 2021-03-09T04:54:04.000Z | 2021-09-28T21:07:37.000Z | Classes/Constexpr.py | Phil0nator/Cb-major-Compiler | 63059ee4c2e0426dc1424586324730af89f435de | [
"MIT"
] | null | null | null | Classes/Constexpr.py | Phil0nator/Cb-major-Compiler | 63059ee4c2e0426dc1424586324730af89f435de | [
"MIT"
] | null | null | null | ####################################################
# The Constexpr file is used by the compiler to evaluate
# specifically constant expressions ( expressions containing
# only constant / macro values. )
#
# Constexpr evaluation is done through a slight modification
# to the ExpressionEvaluators, in that it will only call the
# "calculateConstant" function of globals.py for the evaluation.
#####################################################
from globals import LONG, operatorISO, DOUBLE, LITERAL
import Classes.ExpressionComponent as EC
from Postfixer import Postfixer
from Classes.Variable import Variable
from Assembly.Registers import *
from Classes.Error import *
ternarystack = [] # ternary operator -- extra storage
def calculateConstant(a, b, op, c=None):
if(op == "*"):
return EC.ExpressionComponent(
int(a.accessor * b.accessor), LITERAL.copy(), constint=True)
elif(op == "/"):
if b.accessor == 0:
throw(DivisionByZero(b.token))
return EC.ExpressionComponent(
int(a.accessor / b.accessor), LITERAL.copy(), constint=True)
elif(op == "+"):
return EC.ExpressionComponent(
int(a.accessor + b.accessor), LITERAL.copy(), constint=True)
elif(op == "-"):
return EC.ExpressionComponent(
int(a.accessor - b.accessor), LITERAL.copy(), constint=True)
elif(op == "=="):
return EC.ExpressionComponent(
int(a.accessor == b.accessor), LITERAL.copy(), constint=True)
elif(op == "!="):
return EC.ExpressionComponent(
int(a.accessor != b.accessor), LITERAL.copy(), constint=True)
elif(op == "<="):
return EC.ExpressionComponent(
int(a.accessor <= b.accessor), LITERAL.copy(), constint=True)
elif(op == ">="):
return EC.ExpressionComponent(
int(a.accessor >= b.accessor), LITERAL.copy(), constint=True)
elif(op == ">"):
return EC.ExpressionComponent(
int(a.accessor > b.accessor), LITERAL.copy(), constint=True)
elif(op == "<"):
return EC.ExpressionComponent(
int(a.accessor < b.accessor), LITERAL.copy(), constint=True)
elif(op == "%"):
return EC.ExpressionComponent(
int(a.accessor % b.accessor), LITERAL.copy(), constint=True)
elif(op == ">>"):
return EC.ExpressionComponent(
int(a.accessor >> b.accessor), LITERAL.copy(), constint=True)
elif(op == "<<"):
return EC.ExpressionComponent(
int(a.accessor << b.accessor), LITERAL.copy(), constint=True)
elif(op == "||"):
return EC.ExpressionComponent(
int(a.accessor or b.accessor), LITERAL.copy(), constint=True)
elif(op == "&&"):
return EC.ExpressionComponent(
int(a.accessor and b.accessor), LITERAL.copy(), constint=True)
elif(op == "&"):
return EC.ExpressionComponent(
int(a.accessor & b.accessor), LITERAL.copy(), constint=True)
elif(op == "|"):
return EC.ExpressionComponent(
int(a.accessor | b.accessor), LITERAL.copy(), constint=True)
elif(op == "^"):
return EC.ExpressionComponent(
int(a.accessor ^ b.accessor), LITERAL.copy(), constint=True)
elif (op == ":"):
ternarystack.append(("", a, b))
if (c is not None):
return a if c else b
elif (op == "?"):
_, opa, opb = ternarystack.pop()
rfree(opa.accessor) # just in case registers are being passed in here
rfree(opb.accessor)
rfree(b.accessor)
return opa if a.accessor == True else opb
elif (op == "!"):
return EC.ExpressionComponent(
int(not a.accessor), LITERAL.copy(), constint=True)
elif (op == "~"):
return EC.ExpressionComponent(
int(~a.accessor), LITERAL.copy(), constint=True)
def calculateCfloat(a, b, op):
if(op == "*"):
return EC.ExpressionComponent(
float(a.accessor * b.accessor), DOUBLE.copy(), constint=True)
elif(op == "/"):
return EC.ExpressionComponent(
float(a.accessor / b.accessor), DOUBLE.copy(), constint=True)
elif(op == "+"):
return EC.ExpressionComponent(
float(a.accessor + b.accessor), DOUBLE.copy(), constint=True)
elif(op == "-"):
return EC.ExpressionComponent(
float(a.accessor - b.accessor), DOUBLE.copy(), constint=True)
elif(op == "=="):
return EC.ExpressionComponent(
float(a.accessor == b.accessor), DOUBLE.copy(), constint=True)
elif(op == "!="):
return EC.ExpressionComponent(
float(a.accessor != b.accessor), DOUBLE.copy(), constint=True)
elif(op == "<="):
return EC.ExpressionComponent(
float(a.accessor <= b.accessor), DOUBLE.copy(), constint=True)
elif(op == ">="):
return EC.ExpressionComponent(
float(a.accessor >= b.accessor), DOUBLE.copy(), constint=True)
elif(op == ">"):
return EC.ExpressionComponent(
float(a.accessor > b.accessor), DOUBLE.copy(), constint=True)
elif(op == "<"):
return EC.ExpressionComponent(
float(a.accessor < b.accessor), DOUBLE.copy(), constint=True)
elif(op == "%"):
return EC.ExpressionComponent(
float(a.accessor % b.accessor), DOUBLE.copy(), constint=True)
elif(op == ">>"):
return EC.ExpressionComponent(
float(a.accessor >> b.accessor), DOUBLE.copy(), constint=True)
elif(op == "<<"):
return EC.ExpressionComponent(
float(a.accessor << b.accessor), DOUBLE.copy(), constint=True)
elif(op == "||"):
return EC.ExpressionComponent(
float(a.accessor or b.accessor), DOUBLE.copy(), constint=True)
elif(op == "&&"):
return EC.ExpressionComponent(
float(a.accessor & b.accessor), DOUBLE.copy(), constint=True)
elif(op == "&"):
return EC.ExpressionComponent(
float(a.accessor & b.accessor), DOUBLE.copy(), constint=True)
elif(op == "|"):
return EC.ExpressionComponent(
float(a.accessor | b.accessor), DOUBLE.copy(), constint=True)
elif(op == "^"):
return EC.ExpressionComponent(
float(a.accessor ^ b.accessor), DOUBLE.copy(), constint=True)
# get result of a op b while taking initializer value for a and b if they
# are vars.
def evaluate(a, b, op):
if(a is None):
return evaluate(b, None, None)
if(isinstance(a.accessor, Variable)):
a.accessor = a.accessor.initializer
if(b is not None and isinstance(b.accessor, Variable)):
b.accessor = b.accessor.initializer
if(b is not None):
return calculateConstant(a, b, op) if a.isconstint(
) and b.isconstint() else calculateCfloat(a, b, op)
else:
return calculateConstant(a, None, op)
return a
def buildConstantSet(flt, tokens, fn):
values = []
subeq = []
for token in tokens:
if(token.tok == "{" or token.tok == "," or token.tok == "}"):
values.append(
determineConstexpr(
flt,
subeq,
fn)) if len(subeq) > 0 else None
subeq = []
continue
else:
subeq.append(token)
return EC.ExpressionComponent(values, set, token=tokens[0])
# standard postfix evaluation, using 'evaluate(a,b,op)'
# \see ExpressionEvaluator
def determineConstexpr(flt, tokens, fn, globalScope=False):
pf = Postfixer(tokens, fn, globalScope)
expr = pf.createPostfix()
stack = []
for e in expr:
if(e.isoperation):
if(not operatorISO(e.accessor)):
op = e.accessor
a = stack.pop()
if(op == "-"):
if(len(stack) == 0):
stack.append(
evaluate(EC.ExpressionComponent(0, LITERAL.copy()), a, op))
continue
b = stack.pop()
stack.append(evaluate(a, b, op))
else:
a = stack.pop()
op = e.accessor
stack.append(evaluate(a, None, op))
else:
stack.append(e)
# return value in the form of ExpressionComponent
return stack.pop()
| 37.752252 | 87 | 0.570338 | 909 | 8,381 | 5.257426 | 0.134213 | 0.079096 | 0.220339 | 0.224524 | 0.635279 | 0.624817 | 0.612262 | 0.599289 | 0.599289 | 0.599289 | 0 | 0.000824 | 0.276101 | 8,381 | 221 | 88 | 37.923077 | 0.78688 | 0.076721 | 0 | 0.473118 | 0 | 0 | 0.007878 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.026882 | false | 0 | 0.032258 | 0 | 0.306452 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f8768051c114a50cf2fbeb5e5b531b667460f4d0 | 10,118 | py | Python | examples/plotting_definition.py | TizianThieringer/model-vs-human | 17729b8167520f682d93d55c340c27de07bb2681 | [
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | null | null | null | examples/plotting_definition.py | TizianThieringer/model-vs-human | 17729b8167520f682d93d55c340c27de07bb2681 | [
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | null | null | null | examples/plotting_definition.py | TizianThieringer/model-vs-human | 17729b8167520f682d93d55c340c27de07bb2681 | [
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | null | null | null | # /!usr/bin/env python3
"""
Define decision makers (either human participants or CNN models).
"""
from modelvshuman import constants as c
from modelvshuman.plotting.colors import *
from modelvshuman.plotting.decision_makers import DecisionMaker
def plotting_definition_template(df):
"""Decision makers to compare a few models with human observers.
This exemplary definition can be adapted for the
desired purpose, e.g. by adding more/different models.
Note that models will need to be evaluated first, before
their data can be plotted.
For each model, define:
- a color using rgb(42, 42, 42)
- a plotting symbol by setting marker;
a list of markers can be found here:
https://matplotlib.org/3.1.0/api/markers_api.html
"""
decision_makers = []
decision_makers.append(DecisionMaker(name_pattern="mlp_mixer_l",
color=rgb(65, 117, 117), marker="o", df=df,
plotting_name="MLP-Mixer Large"))
decision_makers.append(DecisionMaker(name_pattern="mlp_mixer_b",
color=rgb(65, 117, 117), marker="o", df=df,
plotting_name="MLP-Mixer Base"))
decision_makers.append(DecisionMaker(name_pattern="convnext_base",
color=rgb(150, 110, 110), marker="o", df=df,
plotting_name="ConvNext Base"))
decision_makers.append(DecisionMaker(name_pattern="convnext_large",
color=rgb(150, 110, 110), marker="o", df=df,
plotting_name="ConvNext Large"))
decision_makers.append(DecisionMaker(name_pattern="swin_large",
color=rgb(210, 150, 0), marker="v", df=df,
plotting_name="SWIN Large"))
decision_makers.append(DecisionMaker(name_pattern="swin_base",
color=rgb(210, 150, 0), marker="v", df=df,
plotting_name="SWIN Base"))
decision_makers.append(DecisionMaker(name_pattern="dino_v8",
color=rgb(166, 203, 166), marker="v", df=df,
plotting_name="DINO"))
decision_makers.append(DecisionMaker(name_pattern="clip_16",
color=rgb(80, 170, 200), marker="v", df=df,
plotting_name="CLIP ViT-B/16"))
decision_makers.append(DecisionMaker(name_pattern="clip",
color=rgb(80, 170, 200), marker="v", df=df,
plotting_name="CLIP ViT-B/32"))
decision_makers.append(DecisionMaker(name_pattern="clip_14",
color=rgb(80, 170, 200), marker="v", df=df,
plotting_name="CLIP ViT-L/14"))
decision_makers.append(DecisionMaker(name_pattern="simclr_resnet50x1",
color=rgb(217, 217, 214), marker="o", df=df,
plotting_name="SIMCLR"))
decision_makers.append(DecisionMaker(name_pattern="resnet50",
color=rgb(217, 217, 214), marker="o", df=df,
plotting_name="ResNet50"))
decision_makers.append(DecisionMaker(name_pattern="efficientnet_l2_noisy_student_475",
color=rgb(217, 217, 214), marker="o", df=df,
plotting_name="Noisy Student"))
# decision_makers.append(DecisionMaker(name_pattern="resnet50_trained_on_SIN_and_IN_then_finetuned_on_IN",
# color=rgb(117, 117, 214), marker="o", df=df,
# plotting_name="SIN_and_IN_ft"))
# decision_makers.append(DecisionMaker(name_pattern="resnet50_trained_on_SIN_and_IN",
# color=rgb(117, 117, 214), marker="o", df=df,
# plotting_name="SIN_and_IN"))
# decision_makers.append(DecisionMaker(name_pattern="resnet50_trained_on_SIN",
# color=rgb(117, 117, 214), marker="o", df=df,
# plotting_name="SIN"))
decision_makers.append(DecisionMaker(name_pattern="subject-*",
color=rgb(165, 30, 55), marker="D", df=df,
plotting_name="humans"))
return decision_makers
def get_comparison_decision_makers(df, include_humans=True,
humans_last=True):
"""Decision makers used in our paper."""
d = []
# 1. supervised models
for model in c.TORCHVISION_MODELS:
d.append(DecisionMaker(name_pattern=model,
color=rgb(230, 230, 230), df=df,
plotting_name=model))
# 2. self-supervised models
for model in c.PYCONTRAST_MODELS:
d.append(DecisionMaker(name_pattern=model,
color=orange2, marker="o", df=df,
plotting_name=model+": ResNet-50"))
d.append(DecisionMaker(name_pattern="simclr_resnet50x1",
color=orange2, marker="o", df=df,
plotting_name="SimCLR: ResNet-50x1"))
d.append(DecisionMaker(name_pattern="simclr_resnet50x2",
color=orange2, marker="o", df=df,
plotting_name="SimCLR: ResNet-50x2"))
d.append(DecisionMaker(name_pattern="simclr_resnet50x4",
color=orange2, marker="o", df=df,
plotting_name="SimCLR: ResNet-50x4"))
# 3. adversarially robust models
d += [DecisionMaker(name_pattern="resnet50_l2_eps0",
color=rgb(196, 205, 229), marker="o", df=df,
plotting_name="ResNet-50 L2 eps 0.0"),
DecisionMaker(name_pattern="resnet50_l2_eps0_5",
color=rgb(176, 190, 220), marker="o", df=df,
plotting_name="ResNet-50 L2 eps 0.5"),
DecisionMaker(name_pattern="resnet50_l2_eps1",
color=rgb(134, 159, 203), marker="o", df=df,
plotting_name="ResNet-50 L2 eps 1.0"),
DecisionMaker(name_pattern="resnet50_l2_eps3",
color=rgb(86, 130, 186), marker="o", df=df,
plotting_name="ResNet-50 L2 eps 3.0"),
DecisionMaker(name_pattern="resnet50_l2_eps5",
color=blue2, marker="o", df=df,
plotting_name="ResNet-50 L2 eps 5.0")]
# 4. vision transformers without large-scale pretraining
d.append(DecisionMaker(name_pattern="vit_small_patch16_224",
color=rgb(144, 159, 110), marker="v", df=df,
plotting_name="ViT-S"))
d.append(DecisionMaker(name_pattern="vit_base_patch16_224",
color=rgb(144, 159, 110), marker="v", df=df,
plotting_name="ViT-B"))
d.append(DecisionMaker(name_pattern="vit_large_patch16_224",
color=rgb(144, 159, 110), marker="v", df=df,
plotting_name="ViT-L"))
if not humans_last:
if include_humans:
d.append(DecisionMaker(name_pattern="subject-*",
color=red, marker="D", df=df,
plotting_name="humans"))
d.append(DecisionMaker(name_pattern="clip",
color=brown1, marker="v", df=df,
plotting_name="CLIP: ViT-B (400M)"))
d.append(DecisionMaker(name_pattern="ResNeXt101_32x16d_swsl",
color=purple1, marker="o", df=df,
plotting_name="SWSL: ResNeXt-101 (940M)"))
d.append(DecisionMaker(name_pattern="resnet50_swsl",
color=purple1, marker="o", df=df,
plotting_name="SWSL: ResNet-50 (940M)"))
bitm_col = rgb(153, 142, 195)
d.append(DecisionMaker(name_pattern="BiTM_resnetv2_152x4",
color=bitm_col, marker="o", df=df,
plotting_name="BiT-M: ResNet-152x4 (14M)"))
d.append(DecisionMaker(name_pattern="BiTM_resnetv2_152x2",
color=bitm_col, marker="o", df=df,
plotting_name="BiT-M: ResNet-152x2 (14M)"))
d.append(DecisionMaker(name_pattern="BiTM_resnetv2_101x3",
color=bitm_col, marker="o", df=df,
plotting_name="BiT-M: ResNet-101x3 (14M)"))
d.append(DecisionMaker(name_pattern="BiTM_resnetv2_101x1",
color=bitm_col, marker="o", df=df,
plotting_name="BiT-M: ResNet-101x1 (14M)"))
d.append(DecisionMaker(name_pattern="BiTM_resnetv2_50x3",
color=bitm_col, marker="o", df=df,
plotting_name="BiT-M: ResNet-50x3 (14M)"))
d.append(DecisionMaker(name_pattern="BiTM_resnetv2_50x1",
color=bitm_col, marker="o", df=df,
plotting_name="BiT-M: ResNet-50x1 (14M)"))
d.append(DecisionMaker(name_pattern="transformer_L16_IN21K",
color=green1, marker="v", df=df,
plotting_name="ViT-L (14M)"))
d.append(DecisionMaker(name_pattern="transformer_B16_IN21K",
color=green1, marker="v", df=df,
plotting_name="ViT-B (14M)"))
d.append(DecisionMaker(name_pattern="efficientnet_l2_noisy_student_475",
color=metallic, marker="o", df=df,
plotting_name="Noisy Student: ENetL2 (300M)"))
if humans_last:
d.append(DecisionMaker(name_pattern="clip",
color=brown1, marker="v", df=df,
plotting_name="CLIP: ViT-B (400M)"))
if include_humans:
d.append(DecisionMaker(name_pattern="subject-*",
color=red, marker="D", df=df,
plotting_name="humans"))
return d
| 51.360406 | 109 | 0.549022 | 1,131 | 10,118 | 4.721485 | 0.195402 | 0.143258 | 0.202247 | 0.134831 | 0.773596 | 0.749251 | 0.657678 | 0.56779 | 0.42397 | 0.42397 | 0 | 0.068873 | 0.334157 | 10,118 | 196 | 110 | 51.622449 | 0.723764 | 0.133623 | 0 | 0.321678 | 0 | 0 | 0.146078 | 0.019784 | 0 | 0 | 0 | 0 | 0 | 1 | 0.013986 | false | 0 | 0.020979 | 0 | 0.048951 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f88cfa25a30adfa3008406fdd55bd8a13a5a0257 | 4,512 | py | Python | Uncertainty/data/case-9-modified/case9.py | thanever/SOC | 9f30d1a9c7610a68de9c178a1170bdf1c8ca11d4 | [
"MIT"
] | null | null | null | Uncertainty/data/case-9-modified/case9.py | thanever/SOC | 9f30d1a9c7610a68de9c178a1170bdf1c8ca11d4 | [
"MIT"
] | null | null | null | Uncertainty/data/case-9-modified/case9.py | thanever/SOC | 9f30d1a9c7610a68de9c178a1170bdf1c8ca11d4 | [
"MIT"
] | null | null | null | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Power flow data for 9 bus, 3 generator case.
Modifications:
1. Add 3 new lines to complicate the network
2. twice the loads
Additional data:
1. Add 3 columns for gen data
"""
from numpy import array
def case9():
"""Power flow data for 9 bus, 3 generator case.
Please see L{caseformat} for details on the case file format.
Based on data from Joe H. Chow's book, p. 70.
@return: Power flow data for 9 bus, 3 generator case.
"""
ppc = {"version": '2'}
##----- Power Flow Data -----##
## system MVA base
ppc["baseMVA"] = 100.0
## bus data
# bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
#! ratio_ls_max - maximal ratio of load shedding
#! w_d - load shedding cost, the unit is $/MW
ppc["bus"] = array([
[1, 3, 0, 0, 0, 0, 1, 1, 0, 345, 1, 1.1, 0.9, 0.8, 10],
[2, 2, 0, 0, 0, 0, 1, 1, 0, 345, 1, 1.1, 0.9, 0.8, 10],
[3, 2, 0, 0, 0, 0, 1, 1, 0, 345, 1, 1.1, 0.9, 0.8, 10],
[4, 1, 0, 0, 0, 0, 1, 1, 0, 345, 1, 1.1, 0.9, 0.8, 10],
[5, 1, 90, 30, 0, 0, 1, 1, 0, 345, 1, 1.1, 0.9, 0.8, 10],
[6, 1, 0, 0, 0, 0, 1, 1, 0, 345, 1, 1.1, 0.9, 0.8, 10],
[7, 1, 100, 35, 0, 0, 1, 1, 0, 345, 1, 1.1, 0.9, 0.8, 8],
[8, 1, 0, 0, 0, 0, 1, 1, 0, 345, 1, 1.1, 0.9, 0.8, 10],
[9, 1, 125, 50, 0, 0, 1, 1, 0, 345, 1, 1.1, 0.9, 0.8, 6]
])
## generator data
# bus, Pg, Qg, Qmax, Qmin, Vg, mBase, status, Pmax, Pmin, Pc1, Pc2,
# Qc1min, Qc1max, Qc2min, Qc2max, ramp_agc, ramp_10, ramp_30, ramp_q, apf
#! gen_type - 0 for conventional generators and 1 for VRE-based generators
#! phi_v_min - minimal power factor of inverters
#! s_v_max - MVA rating of inverters
#! r_+2 - upward ramp rate for the second stage
#! r_-2 - downward ramp rate for the second stage, r_-2 = r_+2 if the generator does not participate into regulation
#! r_+3 - upward ramp rate for the second stage
#! r_-3 - downward ramp rate for the second stage, r_-2 = r_+2 if the generator does not participate into regulation
ppc["gen"] = array([
[1, 0, 0, 300, -300, 1, 100, 1, 250, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.95, 250*1.5, 20, 40, 30, 60],
[2, 163, 0, 300, -300, 1, 100, 1, 300, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.95, 300*1.5, 20, 40, 30, 60],
[3, 85, 0, 300, -300, 1, 100, 1, 270, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.95, 270*1.5, 0, 0, 30, 60]
])
## branch data
# fbus, tbus, r, x, b, rateA, rateB, rateC, ratio, angle, status, angmin, angmax
#! w_s - cost of line switching in the third-stage corrective control
ppc["branch"] = array([
[1, 4, 0, 0.0576, 0, 250*3, 250, 250, 1, 0, 1, -30, 30, 0.1],
[4, 5, 0.017, 0.092, 0.158, 250, 250, 250, 0, 0, 1, -30, 30, 0.1],
[5, 6, 0.039, 0.17, 0.358, 150, 150, 150, 0, 0, 1, -30, 30, 0.1],
[3, 6, 0, 0.0586, 0, 300*3, 300, 300, 1, 0, 1, -30, 30, 0.1],
[6, 7, 0.0119, 0.1008, 0.209, 150, 150, 150, 0, 0, 1, -30, 30, 0.1],
[7, 8, 0.0085, 0.072, 0.149, 250, 250, 250, 0, 0, 1, -30, 30, 0.1],
[8, 2, 0, 0.0625, 0, 250*3, 250, 250, 1, 0, 1, -30, 30, 0.1],
[8, 9, 0.032, 0.161, 0.306, 250, 250, 250, 0, 0, 1, -30, 30, 0.1],
[9, 4, 0.01, 0.085, 0.176, 250, 250, 250, 0, 0, 1, -30, 30, 0.1],
[5, 7, 0.002, 0.02, 0.04 ,50, 50, 50, 0, 0, 1, -30, 30, 0.1],
[5, 9, 0.002, 0.02, 0.04 ,50, 50, 50, 0, 0, 1, -30, 30, 0.1],
[7, 9, 0.002, 0.02, 0.04 ,50, 50, 50, 0, 0, 1, -30, 30, 0.1],
[4, 6, 0.02, 0.2, 0.4 , 300, 300, 300, 0, 0, 1, -30, 30, 0.1],
[4, 8, 0.02, 0.2, 0.4 , 300, 300, 300, 0, 0, 1, -30, 30, 0.1]
])
##----- OPF Data -----##
## area data
# area refbus
ppc["areas"] = array([
[1, 5]
])
## generator cost data
# 1 startup shutdown n x1 y1 ... xn yn
# 2 startup shutdown n c(n-1) ... c0
#! w_+2
#! w_-2
#! w_+3
#! w_-3
ppc["gencost"] = array([
[2, 1500, 0, 3, 0.11, 5, 150, 10, 10, 1, 1],
[2, 2000, 0, 3, 0.085, 1.2, 600, 1, 1, 1, 1],
[2, 3000, 0, 3, 0.1225, 1, 335, 1, 1, 1, 1]
])
return ppc
| 43.384615 | 127 | 0.483378 | 887 | 4,512 | 2.429538 | 0.255919 | 0.064037 | 0.057077 | 0.059397 | 0.416705 | 0.416705 | 0.390719 | 0.385151 | 0.352668 | 0.305336 | 0 | 0.284777 | 0.324468 | 4,512 | 103 | 128 | 43.805825 | 0.422244 | 0.378768 | 0 | 0.111111 | 0 | 0 | 0.014396 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.022222 | false | 0 | 0.022222 | 0 | 0.066667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f899ed7b367b6039d19ba257da453c5f5036cd6b | 3,920 | py | Python | rstview/registry.py | sveetch/rstview | 83bed8fa55187fa2372cf037a26825de09782d23 | [
"MIT"
] | 3 | 2017-08-22T03:45:14.000Z | 2019-04-29T16:44:21.000Z | rstview/registry.py | sveetch/rstview | 83bed8fa55187fa2372cf037a26825de09782d23 | [
"MIT"
] | 1 | 2016-07-24T21:01:57.000Z | 2016-10-22T23:06:42.000Z | rstview/registry.py | sveetch/rstview | 83bed8fa55187fa2372cf037a26825de09782d23 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
.. _Docutils Configuration: http://docutils.sourceforge.net/docs/user/config.html
.. _registry-intro:
Configuration registry
======================
Registry store configurations by the way of its interface.
Default global registry is available at ``rstview.registry.rstview_registry``
and is global for the whole project and apps, you don't need to fill it again
for a same Django instance.
A configuration is a dictionnary of parameters for reStructuredText parser:
.. sourcecode:: python
{
'default': {
'initial_header_level': 1,
'language_code': "en",
},
}
Configuration name is used to retrieve parameters from the registry interface.
See `Docutils Configuration`_ for a full references of available parser
parameters.
"""
class RstviewConfigAlreadyRegistered(Exception):
pass
class RstviewConfigNotRegistered(Exception):
pass
class RstConfigSite(object):
"""
Rstview configurations registry
Keyword Arguments:
initial (dict): Optional initial dictionnary of configuration. Default
to an empty dict.
"""
def __init__(self, *args, **kwargs):
self._registry = kwargs.get('initial', {})
def reset(self):
"""
Reset registry to an empty Dict.
"""
self._registry = {}
def get_registry(self):
"""
Return current registry
Returns:
dict: Currrent registry.
"""
return self._registry
def get_names(self):
"""
Return registred configuration names.
Returns:
list: List of registred names, sorted with default ``sorted()``
behavior.
"""
return sorted(self._registry.keys())
def has_name(self, name):
"""
Find if given name is a registred configuration name.
Returns:
bool: ``True`` if name exists in current registry, else ``False``.
"""
return name in self._registry
def get_parameters(self, name):
"""
Get parameters from given configuration name.
Arguments:
name (string): Configuration name.
Returns:
string or tuple: Configuration parameters.
"""
if not self.has_name(name):
msg = 'Given name "{}" is not registered as a configuration.'
raise RstviewConfigNotRegistered(msg.format(name))
return self._registry[name]
def register(self, name, value):
"""
Register a configuration for given name.
Arguments:
name (string): Configuration name.
value (string or tuple): Configuration parameters to define.
Raises:
``RstviewConfigAlreadyRegistered`` if name is allready registered in
configurations.
"""
if self.has_name(name):
msg = 'Given name "{}" is already registered as a configuration.'
raise RstviewConfigAlreadyRegistered(msg.format(name))
self._registry[name] = value
def unregister(self, name):
"""
Unregister a configuration from its name.
Arguments:
name (string): Url name.
Raises:
``RstviewConfigNotRegistered`` if given url name is not registred yet.
"""
if not self.has_name(name):
msg = 'Given name "{}" is not registered as a configuration.'
raise RstviewConfigNotRegistered(msg.format(name))
del self._registry[name]
def update(self, configs):
"""
Update many configuration.
This works like the ``Dict.update({..})`` method.
Arguments:
configs (dict): A dict of configurations.
"""
self._registry.update(configs)
#: Default rstview configurations registry for a Django instance.
rstview_registry = RstConfigSite()
| 25.960265 | 82 | 0.6125 | 404 | 3,920 | 5.873762 | 0.326733 | 0.045512 | 0.018542 | 0.022756 | 0.17952 | 0.136115 | 0.102402 | 0.102402 | 0.090181 | 0.090181 | 0 | 0.000721 | 0.292347 | 3,920 | 150 | 83 | 26.133333 | 0.854722 | 0.533673 | 0 | 0.242424 | 0 | 0 | 0.120226 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0.060606 | 0 | 0 | 0.484848 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
f89f6d874fd7697cc82a29a81d07b6f0101e5625 | 345 | py | Python | scripts/test/brocontrl.py | istoliving/hardenedlinux-zeek-scripts | 3b28f3b9649345f39ae1ae2ad49243b96a237c42 | [
"MIT"
] | 25 | 2019-08-11T09:12:34.000Z | 2021-04-28T04:51:33.000Z | scripts/test/brocontrl.py | hardenedlinux/hardenedlinux-bro-script | c3fdfc44aa95a723ea4e63ffc4cfba9f57c5737d | [
"MIT"
] | null | null | null | scripts/test/brocontrl.py | hardenedlinux/hardenedlinux-bro-script | c3fdfc44aa95a723ea4e63ffc4cfba9f57c5737d | [
"MIT"
] | 8 | 2019-09-21T08:25:15.000Z | 2021-05-26T02:12:28.000Z | import BroControl.plugin
from BroControl import config
class Foo(BroControl.plugin.Plugin):
def __init__(self):
super(Foo, self).__init__(apiversion=1)
def name(self):
return "foo"
def pluginVersion(self):
return 1
def init(self):
self.message("foo plugin is initialized")
return True
| 20.294118 | 49 | 0.652174 | 42 | 345 | 5.166667 | 0.47619 | 0.147465 | 0.101382 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007782 | 0.255072 | 345 | 16 | 50 | 21.5625 | 0.836576 | 0 | 0 | 0 | 0 | 0 | 0.081159 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0.166667 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
f8a5c93c24493e138c3bdd385163549fd477da01 | 158 | py | Python | mcache/tests/common.py | frmengel/integrations-core | a13e4b9b06c0df9b0000172f2eab36953d7d1683 | [
"BSD-3-Clause"
] | null | null | null | mcache/tests/common.py | frmengel/integrations-core | a13e4b9b06c0df9b0000172f2eab36953d7d1683 | [
"BSD-3-Clause"
] | null | null | null | mcache/tests/common.py | frmengel/integrations-core | a13e4b9b06c0df9b0000172f2eab36953d7d1683 | [
"BSD-3-Clause"
] | null | null | null | # (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
PORT = 11211
SERVICE_CHECK = 'memcache.can_connect'
| 26.333333 | 53 | 0.759494 | 22 | 158 | 5.363636 | 0.954545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096296 | 0.14557 | 158 | 5 | 54 | 31.6 | 0.777778 | 0.626582 | 0 | 0 | 0 | 0 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f8a8a259a42e1f4ba31d4e306e057082f057dca5 | 1,789 | py | Python | and_beyond/http_errors.py | Gaming32/Pyweek32Sandbox | eb29f43f11644a9bbf756c0ff09c74d6ddc4d071 | [
"MIT"
] | 1 | 2021-09-27T11:33:37.000Z | 2021-09-27T11:33:37.000Z | and_beyond/http_errors.py | Gaming32/and-Beyond | eb29f43f11644a9bbf756c0ff09c74d6ddc4d071 | [
"MIT"
] | null | null | null | and_beyond/http_errors.py | Gaming32/and-Beyond | eb29f43f11644a9bbf756c0ff09c74d6ddc4d071 | [
"MIT"
] | null | null | null | from typing import Any, Optional
class AuthClientError(Exception):
pass
class InsecureAuth(AuthClientError):
pass
class AuthServerError(AuthClientError):
human: Optional[str]
info: Any
status: int = 400
def __init__(self, human: Optional[str], args: Any, status: int = None) -> None:
self.human = human
self.info = args
if status is not None:
self.status = status
def __str__(self) -> str:
return str(self.info) if self.human is None else self.human
class ServerKeyError(AuthServerError):
status = 400
class FormatError(AuthServerError):
status = 400
class ServerTypeError(AuthServerError):
status = 400
class Unauthorized(AuthServerError):
status = 401
class ServerInsecurityError(AuthServerError):
status = 401
class NoSuchUserError(AuthServerError):
status = 404
class NoSuchSessionError(AuthServerError):
status = 404
class NotFound(AuthServerError):
status = 404
class MethodNotAllowed(AuthServerError):
status = 405
class Conflict(AuthServerError):
status = 409
class Ratelimited(AuthServerError):
status = 429
class InternalServerError(AuthServerError):
status = 500
SERVER_ERRORS: dict[str, type[AuthServerError]] = {}
for _error_type in (
('KeyError', ServerKeyError),
FormatError,
('TypeError', ServerTypeError),
Unauthorized,
('InsecurityError', ServerInsecurityError),
NoSuchUserError,
NoSuchSessionError,
NotFound,
MethodNotAllowed,
Conflict,
Ratelimited,
('InternalError', InternalServerError),
):
if isinstance(_error_type, tuple):
_name, _type = _error_type
else:
_name, _type = _error_type.__name__, _error_type
SERVER_ERRORS[_name] = _type
| 18.635417 | 84 | 0.695361 | 173 | 1,789 | 7.017341 | 0.34104 | 0.207578 | 0.059308 | 0.071664 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027917 | 0.219117 | 1,789 | 95 | 85 | 18.831579 | 0.841088 | 0 | 0 | 0.166667 | 0 | 0 | 0.025154 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.033333 | false | 0.033333 | 0.016667 | 0.016667 | 0.566667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f8b4397aa52a6b445cd8110a544a01db995ab54c | 693 | py | Python | bbbs/rights/admin.py | dangerousmonk/bigBrothers-bigSisters-backend | 81ced19d48fb8833b19ed6a7e6463f56e687e6c2 | [
"MIT"
] | null | null | null | bbbs/rights/admin.py | dangerousmonk/bigBrothers-bigSisters-backend | 81ced19d48fb8833b19ed6a7e6463f56e687e6c2 | [
"MIT"
] | null | null | null | bbbs/rights/admin.py | dangerousmonk/bigBrothers-bigSisters-backend | 81ced19d48fb8833b19ed6a7e6463f56e687e6c2 | [
"MIT"
] | null | null | null | from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from bbbs.common.mixins import TagAdminMixin
from bbbs.common.permissions import BaseStaffAdminPermission
from .models import Right
@admin.register(Right)
class RightAdmin(BaseStaffAdminPermission, TagAdminMixin):
list_display = ('id', 'title', 'get_description', 'get_tags')
search_fields = ('title', 'description', 'text')
list_filter = ('tags','color',)
@admin.display(description=_('description'))
def get_description(self, obj):
description = obj.description
if description is not None:
return f'{description[:30]}...'
return description
| 30.130435 | 65 | 0.720058 | 76 | 693 | 6.447368 | 0.565789 | 0.040816 | 0.057143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003478 | 0.170274 | 693 | 22 | 66 | 31.5 | 0.848696 | 0 | 0 | 0 | 0 | 0 | 0.131503 | 0.030347 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0.3125 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f8ba479254639ca41ab223a9c54ef1df1e8fd3ee | 265 | py | Python | setup.py | Cursorr/DiscordBotTemplate | ac8ebab81750679b620717f20a621f3d7efb105e | [
"MIT"
] | 4 | 2021-12-27T18:06:17.000Z | 2021-12-27T20:22:15.000Z | setup.py | Cursorr/DiscordBotTemplate | ac8ebab81750679b620717f20a621f3d7efb105e | [
"MIT"
] | null | null | null | setup.py | Cursorr/DiscordBotTemplate | ac8ebab81750679b620717f20a621f3d7efb105e | [
"MIT"
] | null | null | null | from setuptools import setup
setup(
name='DiscordBotTemplate',
author='Cursorr',
version='1.0',
description='Bot template creator for discord.py',
url='https://www.github.com/Cursorr/DiscordBotTemplate',
packages=['dbt', 'dbttemplates']
)
| 22.083333 | 60 | 0.690566 | 29 | 265 | 6.310345 | 0.896552 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009009 | 0.162264 | 265 | 11 | 61 | 24.090909 | 0.815315 | 0 | 0 | 0 | 0 | 0 | 0.479245 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.111111 | 0 | 0.111111 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f8bfb458f8d604398e98767464abf944cba76515 | 9,090 | py | Python | src/oci/data_integration/models/conditional_composite_field_map.py | pabs3/oci-python-sdk | 437ba18ce39af2d1090e277c4bb8750c89f83021 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/data_integration/models/conditional_composite_field_map.py | pabs3/oci-python-sdk | 437ba18ce39af2d1090e277c4bb8750c89f83021 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/data_integration/models/conditional_composite_field_map.py | pabs3/oci-python-sdk | 437ba18ce39af2d1090e277c4bb8750c89f83021 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
from .field_map import FieldMap
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401
from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class ConditionalCompositeFieldMap(FieldMap):
"""
A conditional composite field map.
"""
def __init__(self, **kwargs):
"""
Initializes a new ConditionalCompositeFieldMap object with values from keyword arguments. The default value of the :py:attr:`~oci.data_integration.models.ConditionalCompositeFieldMap.model_type` attribute
of this class is ``CONDITIONAL_COMPOSITE_FIELD_MAP`` and it should not be changed.
The following keyword arguments are supported (corresponding to the getters/setters of this class):
:param model_type:
The value to assign to the model_type property of this ConditionalCompositeFieldMap.
Allowed values for this property are: "DIRECT_NAMED_FIELD_MAP", "COMPOSITE_FIELD_MAP", "DIRECT_FIELD_MAP", "RULE_BASED_FIELD_MAP", "CONDITIONAL_COMPOSITE_FIELD_MAP", "NAMED_ENTITY_MAP", "RULE_BASED_ENTITY_MAP"
:type model_type: str
:param description:
The value to assign to the description property of this ConditionalCompositeFieldMap.
:type description: str
:param field_map_scope:
The value to assign to the field_map_scope property of this ConditionalCompositeFieldMap.
:type field_map_scope: list[oci.data_integration.models.ProjectionRule]
:param key:
The value to assign to the key property of this ConditionalCompositeFieldMap.
:type key: str
:param model_version:
The value to assign to the model_version property of this ConditionalCompositeFieldMap.
:type model_version: str
:param parent_ref:
The value to assign to the parent_ref property of this ConditionalCompositeFieldMap.
:type parent_ref: oci.data_integration.models.ParentReference
:param config_values:
The value to assign to the config_values property of this ConditionalCompositeFieldMap.
:type config_values: oci.data_integration.models.ConfigValues
:param object_status:
The value to assign to the object_status property of this ConditionalCompositeFieldMap.
:type object_status: int
:param field_maps:
The value to assign to the field_maps property of this ConditionalCompositeFieldMap.
:type field_maps: list[oci.data_integration.models.FieldMap]
"""
self.swagger_types = {
'model_type': 'str',
'description': 'str',
'field_map_scope': 'list[ProjectionRule]',
'key': 'str',
'model_version': 'str',
'parent_ref': 'ParentReference',
'config_values': 'ConfigValues',
'object_status': 'int',
'field_maps': 'list[FieldMap]'
}
self.attribute_map = {
'model_type': 'modelType',
'description': 'description',
'field_map_scope': 'fieldMapScope',
'key': 'key',
'model_version': 'modelVersion',
'parent_ref': 'parentRef',
'config_values': 'configValues',
'object_status': 'objectStatus',
'field_maps': 'fieldMaps'
}
self._model_type = None
self._description = None
self._field_map_scope = None
self._key = None
self._model_version = None
self._parent_ref = None
self._config_values = None
self._object_status = None
self._field_maps = None
self._model_type = 'CONDITIONAL_COMPOSITE_FIELD_MAP'
@property
def field_map_scope(self):
"""
Gets the field_map_scope of this ConditionalCompositeFieldMap.
An array of projection rules.
:return: The field_map_scope of this ConditionalCompositeFieldMap.
:rtype: list[oci.data_integration.models.ProjectionRule]
"""
return self._field_map_scope
@field_map_scope.setter
def field_map_scope(self, field_map_scope):
"""
Sets the field_map_scope of this ConditionalCompositeFieldMap.
An array of projection rules.
:param field_map_scope: The field_map_scope of this ConditionalCompositeFieldMap.
:type: list[oci.data_integration.models.ProjectionRule]
"""
self._field_map_scope = field_map_scope
@property
def key(self):
"""
Gets the key of this ConditionalCompositeFieldMap.
The object key.
:return: The key of this ConditionalCompositeFieldMap.
:rtype: str
"""
return self._key
@key.setter
def key(self, key):
"""
Sets the key of this ConditionalCompositeFieldMap.
The object key.
:param key: The key of this ConditionalCompositeFieldMap.
:type: str
"""
self._key = key
@property
def model_version(self):
"""
Gets the model_version of this ConditionalCompositeFieldMap.
The object's model version.
:return: The model_version of this ConditionalCompositeFieldMap.
:rtype: str
"""
return self._model_version
@model_version.setter
def model_version(self, model_version):
"""
Sets the model_version of this ConditionalCompositeFieldMap.
The object's model version.
:param model_version: The model_version of this ConditionalCompositeFieldMap.
:type: str
"""
self._model_version = model_version
@property
def parent_ref(self):
"""
Gets the parent_ref of this ConditionalCompositeFieldMap.
:return: The parent_ref of this ConditionalCompositeFieldMap.
:rtype: oci.data_integration.models.ParentReference
"""
return self._parent_ref
@parent_ref.setter
def parent_ref(self, parent_ref):
"""
Sets the parent_ref of this ConditionalCompositeFieldMap.
:param parent_ref: The parent_ref of this ConditionalCompositeFieldMap.
:type: oci.data_integration.models.ParentReference
"""
self._parent_ref = parent_ref
@property
def config_values(self):
"""
Gets the config_values of this ConditionalCompositeFieldMap.
:return: The config_values of this ConditionalCompositeFieldMap.
:rtype: oci.data_integration.models.ConfigValues
"""
return self._config_values
@config_values.setter
def config_values(self, config_values):
"""
Sets the config_values of this ConditionalCompositeFieldMap.
:param config_values: The config_values of this ConditionalCompositeFieldMap.
:type: oci.data_integration.models.ConfigValues
"""
self._config_values = config_values
@property
def object_status(self):
"""
Gets the object_status of this ConditionalCompositeFieldMap.
The status of an object that can be set to value 1 for shallow references across objects, other values reserved.
:return: The object_status of this ConditionalCompositeFieldMap.
:rtype: int
"""
return self._object_status
@object_status.setter
def object_status(self, object_status):
"""
Sets the object_status of this ConditionalCompositeFieldMap.
The status of an object that can be set to value 1 for shallow references across objects, other values reserved.
:param object_status: The object_status of this ConditionalCompositeFieldMap.
:type: int
"""
self._object_status = object_status
@property
def field_maps(self):
"""
Gets the field_maps of this ConditionalCompositeFieldMap.
An array of field maps.
:return: The field_maps of this ConditionalCompositeFieldMap.
:rtype: list[oci.data_integration.models.FieldMap]
"""
return self._field_maps
@field_maps.setter
def field_maps(self, field_maps):
"""
Sets the field_maps of this ConditionalCompositeFieldMap.
An array of field maps.
:param field_maps: The field_maps of this ConditionalCompositeFieldMap.
:type: list[oci.data_integration.models.FieldMap]
"""
self._field_maps = field_maps
def __repr__(self):
return formatted_flat_dict(self)
def __eq__(self, other):
if other is None:
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
return not self == other
| 34.172932 | 245 | 0.667327 | 1,022 | 9,090 | 5.700587 | 0.151663 | 0.040165 | 0.215929 | 0.097837 | 0.568143 | 0.418984 | 0.286646 | 0.226227 | 0.165465 | 0.119808 | 0 | 0.002986 | 0.263146 | 9,090 | 265 | 246 | 34.301887 | 0.866826 | 0.556876 | 0 | 0.079545 | 0 | 0 | 0.126002 | 0.009939 | 0 | 0 | 0 | 0 | 0 | 1 | 0.204545 | false | 0 | 0.034091 | 0.022727 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6efa3a45c8b7d296275bfba8dec50ea487fba39e | 246 | py | Python | example/src/file3_shared.py | 5x12/pipely | 9d67bc35ede403c79cc624d2f51e15de7167754c | [
"MIT"
] | 9 | 2022-01-14T17:02:59.000Z | 2022-03-26T19:12:51.000Z | example/src/file3_shared.py | 5x12/pipely | 9d67bc35ede403c79cc624d2f51e15de7167754c | [
"MIT"
] | 1 | 2022-03-11T19:42:32.000Z | 2022-03-24T16:36:23.000Z | example/src/file3_shared.py | 5x12/pipely | 9d67bc35ede403c79cc624d2f51e15de7167754c | [
"MIT"
] | 2 | 2022-03-11T03:06:39.000Z | 2022-03-15T17:31:32.000Z | class aSumPrint:
def run(self, context): #include context
a_sum = context["aSum"] #to extract from shared dictionary
print(f'a_sum = {a_sum}')
def __call__(self, context):
self.run(context) #to run the function
| 30.75 | 67 | 0.642276 | 34 | 246 | 4.441176 | 0.588235 | 0.07947 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.247967 | 246 | 7 | 68 | 35.142857 | 0.816216 | 0.272358 | 0 | 0 | 0 | 0 | 0.107955 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.5 | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3e1f2f1d8c9bcd63d4fead649a1a28c7be7da7f1 | 698 | py | Python | authentication/models/token.py | Mangeneh/akkaskhooneh-backend | 2a81e73fbe0d55d5821ba1670a997bd8851c4af6 | [
"MIT"
] | 7 | 2018-09-17T18:34:49.000Z | 2019-09-15T11:39:15.000Z | authentication/models/token.py | Mangeneh/akkaskhooneh-backend | 2a81e73fbe0d55d5821ba1670a997bd8851c4af6 | [
"MIT"
] | 9 | 2019-10-21T17:12:21.000Z | 2022-03-11T23:28:14.000Z | authentication/models/token.py | Mangeneh/akkaskhooneh-backend | 2a81e73fbe0d55d5821ba1670a997bd8851c4af6 | [
"MIT"
] | 1 | 2019-11-29T16:12:12.000Z | 2019-11-29T16:12:12.000Z | import binascii
import os
from django.db import models
from authentication.models import User
class Token(models.Model):
"""
Athorization token model for reset password
"""
key = models.CharField(max_length=6, primary_key=True)
user = models.OneToOneField(
User, on_delete=models.CASCADE, related_name='token')
created_time = models.DateTimeField(auto_now_add=True)
def save(self, *args, **kwargs):
if not self.key:
self.key = self.generate_key()
return super(Token, self).save(*args, **kwargs)
def generate_key(self):
return binascii.hexlify(os.urandom(3)).decode()
def __str__(self):
return self.key
| 24.068966 | 61 | 0.67192 | 90 | 698 | 5.066667 | 0.555556 | 0.046053 | 0.048246 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00367 | 0.219198 | 698 | 28 | 62 | 24.928571 | 0.833028 | 0.061605 | 0 | 0 | 0 | 0 | 0.007825 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0.235294 | 0.117647 | 0.823529 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
3e3b16d0e8abec2fa4875a04f1973e5181e5528f | 825 | py | Python | flaskexample/function.py | skyelong/flask | bccf78f96f025765ab585b6814a82a12a4c1c45b | [
"MIT"
] | 1 | 2020-06-09T23:40:10.000Z | 2020-06-09T23:40:10.000Z | flaskexample/function.py | skyelong/flask | bccf78f96f025765ab585b6814a82a12a4c1c45b | [
"MIT"
] | null | null | null | flaskexample/function.py | skyelong/flask | bccf78f96f025765ab585b6814a82a12a4c1c45b | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 21:15:31 2020
@author: macbook
"""
from joblib import dump, load
import numpy as np
import cv2
from sqlalchemy import create_engine
from sqlalchemy_utils import database_exists, create_database
import psycopg2
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn import metrics
import matplotlib.pyplot as plt
#import the clustered ds swatches
hsv_knn = load('static/ds_h_knn_3.joblib')
username = request.args.get('username', 'World')
for filename in os.listdir('static/'):
if filename.startswith('image2_'): # not to remove other images
os.remove('static/' + filename)
urllib.request.urlretrieve(username, "static/image2.jpg") | 27.5 | 72 | 0.751515 | 116 | 825 | 5.241379 | 0.672414 | 0.054276 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02726 | 0.155152 | 825 | 30 | 73 | 27.5 | 0.84505 | 0.123636 | 0 | 0 | 0 | 0 | 0.113809 | 0.036419 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.647059 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
3e3bab73f7c801176f72f3969ae7eff7bcfbb821 | 821 | py | Python | app/models/retailer.py | kwilson21/PS5Tracker | d3a8fb8638838fe99fb3a3b4e3ddb6973816d75b | [
"MIT"
] | null | null | null | app/models/retailer.py | kwilson21/PS5Tracker | d3a8fb8638838fe99fb3a3b4e3ddb6973816d75b | [
"MIT"
] | null | null | null | app/models/retailer.py | kwilson21/PS5Tracker | d3a8fb8638838fe99fb3a3b4e3ddb6973816d75b | [
"MIT"
] | null | null | null | from typing import List
import orjson # type: ignore
from pydantic import BaseModel
from app.models.availability import Availability
from app.models.ps5_version import PS5Version
from app.models.stock_status import StockStatus
from app.utils.json_utils import orjson_dumps
class Retailer(BaseModel):
name: str
availabilities: List[Availability]
@property
def in_stock_availabilities(self) -> List[Availability]:
return [
availability for availability in self.availabilities if availability.stock_status is StockStatus.IN_STOCK
]
@property
def versions_in_stock(self) -> List[PS5Version]:
return [availability.version for availability in self.in_stock_availabilities]
class Config:
json_loads = orjson.loads
json_dumps = orjson_dumps
| 28.310345 | 117 | 0.750305 | 99 | 821 | 6.070707 | 0.373737 | 0.046589 | 0.064892 | 0.069884 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004532 | 0.193666 | 821 | 28 | 118 | 29.321429 | 0.903323 | 0.014616 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.095238 | false | 0 | 0.333333 | 0.095238 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
3e402c78be8c7455e1c2fd9ba54e1d24b81b26d5 | 246 | py | Python | mcadmin/util.py | michelfaria/mcadmin | bb048f415d5effcf6f125e9ec050d1e693ff4e99 | [
"MIT"
] | null | null | null | mcadmin/util.py | michelfaria/mcadmin | bb048f415d5effcf6f125e9ec050d1e693ff4e99 | [
"MIT"
] | null | null | null | mcadmin/util.py | michelfaria/mcadmin | bb048f415d5effcf6f125e9ec050d1e693ff4e99 | [
"MIT"
] | null | null | null | # mcadmin/util.py
from flask import request, abort
def require_json():
"""
This will raise a 400 HTTP/Bad Request error if the request does not have JSON content.
"""
if not request.is_json:
abort(400, 'Expected JSON')
| 20.5 | 91 | 0.666667 | 37 | 246 | 4.378378 | 0.72973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032258 | 0.243902 | 246 | 11 | 92 | 22.363636 | 0.83871 | 0.422764 | 0 | 0 | 0 | 0 | 0.103175 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0 | 0.25 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3e4dcfd3e1bb3f300fbda7bc70c9324d68dbe1ef | 472 | py | Python | tools/_init_paths.py | sibeiyang/sgmn | 00731b4f2202246d40a36d2a6727c599e6e649aa | [
"MIT"
] | 130 | 2020-04-17T02:11:08.000Z | 2022-03-18T22:31:09.000Z | tools/_init_paths.py | luowensheng/sgmn | f09b94707bf8094d6d63353b9e5ca0ee83423ba5 | [
"MIT"
] | 15 | 2020-05-21T16:56:57.000Z | 2021-09-14T13:38:04.000Z | tools/_init_paths.py | luowensheng/sgmn | f09b94707bf8094d6d63353b9e5ca0ee83423ba5 | [
"MIT"
] | 19 | 2020-04-19T02:56:50.000Z | 2022-01-19T10:48:48.000Z | import os.path as osp
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
# path
this_dir = osp.dirname(__file__)
# refer path
refer_dir = osp.join(this_dir, '..', 'data', 'ref')
sys.path.insert(0, refer_dir)
# lib path
sys.path.insert(0, osp.join(this_dir, '..'))
sys.path.insert(0, osp.join(this_dir, '..', 'lib'))
sys.path.insert(0, osp.join(this_dir, '..', 'tools'))
sys.path.insert(0, osp.join(this_dir, '..', 'utils')) | 22.47619 | 53 | 0.648305 | 81 | 472 | 3.617284 | 0.296296 | 0.167235 | 0.266212 | 0.286689 | 0.457338 | 0.382253 | 0.382253 | 0.382253 | 0 | 0 | 0 | 0.014815 | 0.141949 | 472 | 21 | 54 | 22.47619 | 0.708642 | 0.050847 | 0 | 0 | 0 | 0 | 0.067568 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.166667 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3e4fc03b27aa9cbb71b20cb43ebf88f21294eb21 | 3,725 | py | Python | tests/test_django_auth_backend.py | ZhukovGreen/aiohttp-json-rpc | f359d9106fb837bbad7acccfcdeaecd016b233fd | [
"Apache-2.0"
] | 59 | 2016-01-04T23:06:44.000Z | 2021-03-08T02:17:52.000Z | tests/test_django_auth_backend.py | ZhukovGreen/aiohttp-json-rpc | f359d9106fb837bbad7acccfcdeaecd016b233fd | [
"Apache-2.0"
] | 60 | 2015-11-30T15:28:19.000Z | 2021-09-27T14:08:41.000Z | tests/test_django_auth_backend.py | ZhukovGreen/aiohttp-json-rpc | f359d9106fb837bbad7acccfcdeaecd016b233fd | [
"Apache-2.0"
] | 24 | 2015-11-27T16:23:30.000Z | 2021-09-26T17:06:53.000Z | import pytest
pytestmark = pytest.mark.django(reason='Depends on Django')
@pytest.fixture
def items(db):
from django_project.models import Item
for i in range(10):
Item.objects.create(client_id=i, number=i)
@pytest.mark.asyncio
async def test_login(django_rpc_context, django_staff_user):
from aiohttp_json_rpc.auth import login_required
# setup rpc
@login_required
async def restricted_method(request):
return True
django_rpc_context.rpc.add_methods(('', restricted_method))
# setup client
client = await django_rpc_context.make_client()
# run test
# # without login
methods = await client.call('get_methods')
assert 'login' in methods
assert 'restricted_method' not in methods
# # after login login
assert await client.call('login', {
'username': 'admin',
'password': 'admin',
})
methods = await client.call('get_methods')
assert 'login' not in methods
assert 'restricted_method' in methods
@pytest.mark.asyncio
async def test_generic_orm_methods(django_rpc_context, django_staff_user):
client = await django_rpc_context.make_client()
assert await client.call('login', {
'username': 'admin',
'password': 'admin',
})
methods = await client.call('get_methods')
assert list(filter(lambda m: m.startswith('db__'), methods))
@pytest.mark.asyncio
async def test_generic_orm_view(django_rpc_context, django_staff_user, items):
client = await django_rpc_context.make_client()
assert await client.call('login', {
'username': 'admin',
'password': 'admin',
})
assert len(await client.call('db__django_project.view_item')) == 10
items = await client.call('db__django_project.view_item', {
'number__gt': 0,
'number__lt': 9,
})
assert len(items) == 8
@pytest.mark.asyncio
async def test_generic_orm_delete(django_rpc_context, django_staff_user,
items):
client = await django_rpc_context.make_client()
assert await client.call('login', {
'username': 'admin',
'password': 'admin',
})
assert len(await client.call('db__django_project.view_item')) == 10
await client.call('db__django_project.delete_item', {
'number__gt': 0,
'number__lt': 9,
})
assert len(await client.call('db__django_project.view_item')) == 2
@pytest.mark.asyncio
async def test_generic_orm_add(django_rpc_context, django_staff_user, items):
client = await django_rpc_context.make_client()
assert await client.call('login', {
'username': 'admin',
'password': 'admin',
})
assert len(await client.call('db__django_project.view_item')) == 10
new_item = await client.call('db__django_project.add_item', {
'client_id': 100,
'number': 100,
})
assert len(await client.call('db__django_project.view_item')) == 11
assert await client.call('db__django_project.view_item', {
'pk': new_item['pk'],
})
@pytest.mark.asyncio
async def test_generic_orm_change(django_rpc_context, django_staff_user,
items):
client = await django_rpc_context.make_client()
assert await client.call('login', {
'username': 'admin',
'password': 'admin',
})
item = (await client.call('db__django_project.view_item'))[0]
assert await client.call('db__django_project.change_item', {
'pk': item['pk'],
'number': item['number'] + 1,
})
change_item = (await client.call('db__django_project.view_item', {
'pk': item['pk'],
}))[0]
assert change_item['number'] == item['number'] + 1
| 25.340136 | 78 | 0.653423 | 468 | 3,725 | 4.90812 | 0.17094 | 0.100566 | 0.137135 | 0.088811 | 0.750544 | 0.723552 | 0.670875 | 0.62168 | 0.535046 | 0.417066 | 0 | 0.008966 | 0.221477 | 3,725 | 146 | 79 | 25.513699 | 0.783103 | 0.01745 | 0 | 0.585106 | 0 | 0 | 0.195509 | 0.092826 | 0 | 0 | 0 | 0 | 0.212766 | 1 | 0.010638 | false | 0.06383 | 0.031915 | 0 | 0.053191 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
3e6817266db3f1633afde117a0b26d4cf9d2c4de | 570 | py | Python | src/app/client/publisher/publisher_factory.py | acatalfano/distributed-systems-assignment-1 | 442510f14f2ae167b95a18bb458c2cf64f5caa87 | [
"MIT"
] | null | null | null | src/app/client/publisher/publisher_factory.py | acatalfano/distributed-systems-assignment-1 | 442510f14f2ae167b95a18bb458c2cf64f5caa87 | [
"MIT"
] | null | null | null | src/app/client/publisher/publisher_factory.py | acatalfano/distributed-systems-assignment-1 | 442510f14f2ae167b95a18bb458c2cf64f5caa87 | [
"MIT"
] | null | null | null | from ...common.broker_mode import BrokerMode
from .publisher import Publisher
from .integrated_publisher import IntegratedPublisher
from .direct_publisher import DirectPublisher
class PublisherFactory:
def __init__(self, broker_mode: BrokerMode):
self.__broker_mode = broker_mode
def create(self, id: str) -> Publisher:
if self.__broker_mode == BrokerMode.INDIRECT:
return IntegratedPublisher(id)
elif self.__broker_mode == BrokerMode.DIRECT:
return DirectPublisher()
else:
raise ValueError
| 31.666667 | 53 | 0.715789 | 59 | 570 | 6.610169 | 0.440678 | 0.153846 | 0.14359 | 0.184615 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.219298 | 570 | 17 | 54 | 33.529412 | 0.876404 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
3e74d38f33e3e84d492bfca48d73e22bf44c9008 | 16,499 | py | Python | UMLRT2Kiltera_MM/Properties/unit_contracts/HUnitR04c_CompleteLHS.py | levilucio/SyVOLT | 7526ec794d21565e3efcc925a7b08ae8db27d46a | [
"MIT"
] | 3 | 2017-06-02T19:26:27.000Z | 2021-06-14T04:25:45.000Z | UMLRT2Kiltera_MM/Properties/unit_contracts/HUnitR04c_CompleteLHS.py | levilucio/SyVOLT | 7526ec794d21565e3efcc925a7b08ae8db27d46a | [
"MIT"
] | 8 | 2016-08-24T07:04:07.000Z | 2017-05-26T16:22:47.000Z | UMLRT2Kiltera_MM/Properties/unit_contracts/HUnitR04c_CompleteLHS.py | levilucio/SyVOLT | 7526ec794d21565e3efcc925a7b08ae8db27d46a | [
"MIT"
] | 1 | 2019-10-31T06:00:23.000Z | 2019-10-31T06:00:23.000Z | from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitR04c_CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitR04c_CompleteLHS
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HUnitR04c_CompleteLHS, self).__init__(name='HUnitR04c_CompleteLHS', num_nodes=0, edges=[])
# Add the edges
self.add_edges([])
# Set the graph attributes
self["mm__"] = ['MT_pre__FamiliesToPersonsMM', 'MoTifRule']
self["MT_constraint__"] = """return True"""
self["name"] = """"""
self["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'HUnitR04c_CompleteLHS')
self["equations"] = []
# Set the node attributes
# match class State(State) node
self.add_node()
self.vs[0]["MT_pre__attr1"] = """return True"""
self.vs[0]["MT_label__"] = """1"""
self.vs[0]["mm__"] = """MT_pre__State"""
self.vs[0]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'State')
# apply class ProcDef(4.2.a.0ProcDef) node
self.add_node()
self.vs[1]["MT_pre__attr1"] = """return True"""
self.vs[1]["MT_label__"] = """2"""
self.vs[1]["mm__"] = """MT_pre__ProcDef"""
self.vs[1]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.0ProcDef')
# apply class LocalDef(4.2.a.1LocalDef) node
self.add_node()
self.vs[2]["MT_pre__attr1"] = """return True"""
self.vs[2]["MT_label__"] = """3"""
self.vs[2]["mm__"] = """MT_pre__LocalDef"""
self.vs[2]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.1LocalDef')
# apply class Name(4.2.a.2Name) node
self.add_node()
self.vs[3]["MT_pre__attr1"] = """return True"""
self.vs[3]["MT_label__"] = """4"""
self.vs[3]["mm__"] = """MT_pre__Name"""
self.vs[3]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.2Name')
# apply class New(4.2.a.3New) node
self.add_node()
self.vs[4]["MT_pre__attr1"] = """return True"""
self.vs[4]["MT_label__"] = """5"""
self.vs[4]["mm__"] = """MT_pre__New"""
self.vs[4]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.3New')
# apply class Name(4.2.a.4Name) node
self.add_node()
self.vs[5]["MT_pre__attr1"] = """return True"""
self.vs[5]["MT_label__"] = """6"""
self.vs[5]["mm__"] = """MT_pre__Name"""
self.vs[5]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.4Name')
# apply class Name(4.2.a.5Name) node
self.add_node()
self.vs[6]["MT_pre__attr1"] = """return True"""
self.vs[6]["MT_label__"] = """7"""
self.vs[6]["mm__"] = """MT_pre__Name"""
self.vs[6]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.5Name')
# apply class Name(4.2.a.6Name) node
self.add_node()
self.vs[7]["MT_pre__attr1"] = """return True"""
self.vs[7]["MT_label__"] = """8"""
self.vs[7]["mm__"] = """MT_pre__Name"""
self.vs[7]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.6Name')
# apply class Par(4.2.a.7Par) node
self.add_node()
self.vs[8]["MT_pre__attr1"] = """return True"""
self.vs[8]["MT_label__"] = """9"""
self.vs[8]["mm__"] = """MT_pre__Par"""
self.vs[8]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.7Par')
# apply class Inst(4.2.a.8Inst) node
self.add_node()
self.vs[9]["MT_pre__attr1"] = """return True"""
self.vs[9]["MT_label__"] = """10"""
self.vs[9]["mm__"] = """MT_pre__Inst"""
self.vs[9]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.8Inst')
# apply class Inst(4.2.a.9Inst) node
self.add_node()
self.vs[10]["MT_pre__attr1"] = """return True"""
self.vs[10]["MT_label__"] = """11"""
self.vs[10]["mm__"] = """MT_pre__Inst"""
self.vs[10]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.9Inst')
# apply class Name(4.2.a.10Name) node
self.add_node()
self.vs[11]["MT_pre__attr1"] = """return True"""
self.vs[11]["MT_label__"] = """12"""
self.vs[11]["mm__"] = """MT_pre__Name"""
self.vs[11]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.10Name')
# apply class Name(4.2.a.11Name) node
self.add_node()
self.vs[12]["MT_pre__attr1"] = """return True"""
self.vs[12]["MT_label__"] = """13"""
self.vs[12]["mm__"] = """MT_pre__Name"""
self.vs[12]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.11Name')
# apply class Name(4.2.a.12Name) node
self.add_node()
self.vs[13]["MT_pre__attr1"] = """return True"""
self.vs[13]["MT_label__"] = """14"""
self.vs[13]["mm__"] = """MT_pre__Name"""
self.vs[13]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.12Name')
# apply class Name(4.2.a.13Name) node
self.add_node()
self.vs[14]["MT_pre__attr1"] = """return True"""
self.vs[14]["MT_label__"] = """15"""
self.vs[14]["mm__"] = """MT_pre__Name"""
self.vs[14]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.13Name')
# apply class Name(4.2.a.14Name) node
self.add_node()
self.vs[15]["MT_pre__attr1"] = """return True"""
self.vs[15]["MT_label__"] = """16"""
self.vs[15]["mm__"] = """MT_pre__Name"""
self.vs[15]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.14Name')
# apply class Name(4.2.a.15Name) node
self.add_node()
self.vs[16]["MT_pre__attr1"] = """return True"""
self.vs[16]["MT_label__"] = """17"""
self.vs[16]["mm__"] = """MT_pre__Name"""
self.vs[16]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.15Name')
# apply class Name(4.2.a.16Name) node
self.add_node()
self.vs[17]["MT_pre__attr1"] = """return True"""
self.vs[17]["MT_label__"] = """18"""
self.vs[17]["mm__"] = """MT_pre__Name"""
self.vs[17]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.16Name')
# apply association ProcDef--p-->LocalDefnode
self.add_node()
self.vs[18]["MT_pre__attr1"] = """return attr_value == "p" """
self.vs[18]["MT_label__"] = """19"""
self.vs[18]["mm__"] = """MT_pre__directLink_T"""
self.vs[18]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.0ProcDefassoc184.2.a.1LocalDef')
# apply association ProcDef--channelNames-->Namenode
self.add_node()
self.vs[19]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[19]["MT_label__"] = """20"""
self.vs[19]["mm__"] = """MT_pre__directLink_T"""
self.vs[19]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.0ProcDefassoc194.2.a.2Name')
# apply association LocalDef--p-->Newnode
self.add_node()
self.vs[20]["MT_pre__attr1"] = """return attr_value == "p" """
self.vs[20]["MT_label__"] = """21"""
self.vs[20]["mm__"] = """MT_pre__directLink_T"""
self.vs[20]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.1LocalDefassoc204.2.a.3New')
# apply association New--channelNames-->Namenode
self.add_node()
self.vs[21]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[21]["MT_label__"] = """22"""
self.vs[21]["mm__"] = """MT_pre__directLink_T"""
self.vs[21]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.3Newassoc214.2.a.4Name')
# apply association New--channelNames-->Namenode
self.add_node()
self.vs[22]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[22]["MT_label__"] = """23"""
self.vs[22]["mm__"] = """MT_pre__directLink_T"""
self.vs[22]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.3Newassoc224.2.a.5Name')
# apply association New--channelNames-->Namenode
self.add_node()
self.vs[23]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[23]["MT_label__"] = """24"""
self.vs[23]["mm__"] = """MT_pre__directLink_T"""
self.vs[23]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.3Newassoc234.2.a.6Name')
# apply association New--p-->Parnode
self.add_node()
self.vs[24]["MT_pre__attr1"] = """return attr_value == "p" """
self.vs[24]["MT_label__"] = """25"""
self.vs[24]["mm__"] = """MT_pre__directLink_T"""
self.vs[24]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.3Newassoc244.2.a.7Par')
# apply association Par--p-->Instnode
self.add_node()
self.vs[25]["MT_pre__attr1"] = """return attr_value == "p" """
self.vs[25]["MT_label__"] = """26"""
self.vs[25]["mm__"] = """MT_pre__directLink_T"""
self.vs[25]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.7Parassoc254.2.a.9Inst')
# apply association Par--p-->Instnode
self.add_node()
self.vs[26]["MT_pre__attr1"] = """return attr_value == "p" """
self.vs[26]["MT_label__"] = """27"""
self.vs[26]["mm__"] = """MT_pre__directLink_T"""
self.vs[26]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.7Parassoc264.2.a.8Inst')
# apply association Inst--channelNames-->Namenode
self.add_node()
self.vs[27]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[27]["MT_label__"] = """28"""
self.vs[27]["mm__"] = """MT_pre__directLink_T"""
self.vs[27]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.8Instassoc274.2.a.10Name')
# apply association Inst--channelNames-->Namenode
self.add_node()
self.vs[28]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[28]["MT_label__"] = """29"""
self.vs[28]["mm__"] = """MT_pre__directLink_T"""
self.vs[28]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.8Instassoc284.2.a.11Name')
# apply association Inst--channelNames-->Namenode
self.add_node()
self.vs[29]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[29]["MT_label__"] = """30"""
self.vs[29]["mm__"] = """MT_pre__directLink_T"""
self.vs[29]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.8Instassoc294.2.a.12Name')
# apply association Inst--channelNames-->Namenode
self.add_node()
self.vs[30]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[30]["MT_label__"] = """31"""
self.vs[30]["mm__"] = """MT_pre__directLink_T"""
self.vs[30]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.8Instassoc304.2.a.13Name')
# apply association Inst--channelNames-->Namenode
self.add_node()
self.vs[31]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[31]["MT_label__"] = """32"""
self.vs[31]["mm__"] = """MT_pre__directLink_T"""
self.vs[31]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.9Instassoc314.2.a.14Name')
# apply association Inst--channelNames-->Namenode
self.add_node()
self.vs[32]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[32]["MT_label__"] = """33"""
self.vs[32]["mm__"] = """MT_pre__directLink_T"""
self.vs[32]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.9Instassoc324.2.a.15Name')
# apply association Inst--channelNames-->Namenode
self.add_node()
self.vs[33]["MT_pre__attr1"] = """return attr_value == "channelNames" """
self.vs[33]["MT_label__"] = """34"""
self.vs[33]["mm__"] = """MT_pre__directLink_T"""
self.vs[33]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.9Instassoc334.2.a.16Name')
# trace association ProcDef--trace-->nullnode
self.add_node()
self.vs[34]["MT_label__"] = """35"""
self.vs[34]["mm__"] = """MT_pre__trace_link"""
self.vs[34]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'4.2.a.0ProcDefassoc34State')
self['equations'].append(((3,'literal'),('constant','sh')))
self['equations'].append(((5,'literal'),('constant','exit_in')))
self['equations'].append(((6,'literal'),('constant','exack_in')))
self['equations'].append(((7,'literal'),('constant','sh_in')))
self['equations'].append(((9,'name'),('constant','C')))
self['equations'].append(((10,'name'),('constant','H')))
self['equations'].append(((11,'literal'),('constant','enp')))
self['equations'].append(((12,'literal'),('constant','exit_in')))
self['equations'].append(((13,'literal'),('constant','exack_in')))
self['equations'].append(((14,'literal'),('constant','sh_in')))
self['equations'].append(((15,'literal'),('constant','exit_in')))
self['equations'].append(((16,'literal'),('constant','exack_in')))
self['equations'].append(((17,'literal'),('constant','sh_in')))
# Add the edges
self.add_edges([
(1,18), # apply class ProcDef(4.2.a.0ProcDef) -> association p
(18,2), # association LocalDef -> apply class LocalDef(4.2.a.1LocalDef)
(1,19), # apply class ProcDef(4.2.a.0ProcDef) -> association channelNames
(19,3), # association Name -> apply class Name(4.2.a.2Name)
(2,20), # apply class LocalDef(4.2.a.1LocalDef) -> association p
(20,4), # association New -> apply class New(4.2.a.3New)
(4,21), # apply class New(4.2.a.3New) -> association channelNames
(21,5), # association Name -> apply class Name(4.2.a.4Name)
(4,22), # apply class New(4.2.a.3New) -> association channelNames
(22,6), # association Name -> apply class Name(4.2.a.5Name)
(4,23), # apply class New(4.2.a.3New) -> association channelNames
(23,7), # association Name -> apply class Name(4.2.a.6Name)
(4,24), # apply class New(4.2.a.3New) -> association p
(24,8), # association Par -> apply class Par(4.2.a.7Par)
(8,25), # apply class Par(4.2.a.7Par) -> association p
(25,10), # association Inst -> apply class Inst(4.2.a.9Inst)
(8,26), # apply class Par(4.2.a.7Par) -> association p
(26,9), # association Inst -> apply class Inst(4.2.a.8Inst)
(9,27), # apply class Inst(4.2.a.8Inst) -> association channelNames
(27,11), # association Name -> apply class Name(4.2.a.10Name)
(9,28), # apply class Inst(4.2.a.8Inst) -> association channelNames
(28,12), # association Name -> apply class Name(4.2.a.11Name)
(9,29), # apply class Inst(4.2.a.8Inst) -> association channelNames
(29,13), # association Name -> apply class Name(4.2.a.12Name)
(9,30), # apply class Inst(4.2.a.8Inst) -> association channelNames
(30,14), # association Name -> apply class Name(4.2.a.13Name)
(10,31), # apply class Inst(4.2.a.9Inst) -> association channelNames
(31,15), # association Name -> apply class Name(4.2.a.14Name)
(10,32), # apply class Inst(4.2.a.9Inst) -> association channelNames
(32,16), # association Name -> apply class Name(4.2.a.15Name)
(10,33), # apply class Inst(4.2.a.9Inst) -> association channelNames
(33,17), # association Name -> apply class Name(4.2.a.16Name)
(1,34), # apply class ProcDef(State) -> backward_association
(34,0), # backward_associationnull -> match_class null(State)
])
# define evaluation methods for each match class.
def eval_attr11(self, attr_value, this):
return True
# define evaluation methods for each apply class.
def eval_attr12(self, attr_value, this):
return True
def eval_attr13(self, attr_value, this):
return True
def eval_attr14(self, attr_value, this):
return True
def eval_attr15(self, attr_value, this):
return True
def eval_attr16(self, attr_value, this):
return True
def eval_attr17(self, attr_value, this):
return True
def eval_attr18(self, attr_value, this):
return True
def eval_attr19(self, attr_value, this):
return True
def eval_attr110(self, attr_value, this):
return True
def eval_attr111(self, attr_value, this):
return True
def eval_attr112(self, attr_value, this):
return True
def eval_attr113(self, attr_value, this):
return True
def eval_attr114(self, attr_value, this):
return True
def eval_attr115(self, attr_value, this):
return True
def eval_attr116(self, attr_value, this):
return True
def eval_attr117(self, attr_value, this):
return True
def eval_attr118(self, attr_value, this):
return True
# define evaluation methods for each match association.
# define evaluation methods for each apply association.
def eval_attr119(self, attr_value, this):
return attr_value == "p"
def eval_attr120(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr121(self, attr_value, this):
return attr_value == "p"
def eval_attr122(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr123(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr124(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr125(self, attr_value, this):
return attr_value == "p"
def eval_attr126(self, attr_value, this):
return attr_value == "p"
def eval_attr127(self, attr_value, this):
return attr_value == "p"
def eval_attr128(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr129(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr130(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr131(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr132(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr133(self, attr_value, this):
return attr_value == "channelNames"
def eval_attr134(self, attr_value, this):
return attr_value == "channelNames"
def constraint(self, PreNode, graph):
return True
| 39.283333 | 98 | 0.65907 | 2,539 | 16,499 | 4.01536 | 0.077983 | 0.081805 | 0.024424 | 0.060029 | 0.730554 | 0.723884 | 0.647082 | 0.473369 | 0.368514 | 0.145267 | 0 | 0.067083 | 0.126311 | 16,499 | 419 | 99 | 39.377088 | 0.640166 | 0.217953 | 0 | 0.229508 | 0 | 0 | 0.298603 | 0.044642 | 0 | 0 | 0 | 0 | 0 | 1 | 0.118033 | false | 0 | 0.006557 | 0.114754 | 0.242623 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
3e830a2faa222b6377472df1642cb90be4532d77 | 174 | py | Python | code-216.py | cpermuttacth/BornToDev | fde536ea307ca7ce76743a8116c36c2fd5e4f5e2 | [
"Apache-2.0"
] | null | null | null | code-216.py | cpermuttacth/BornToDev | fde536ea307ca7ce76743a8116c36c2fd5e4f5e2 | [
"Apache-2.0"
] | null | null | null | code-216.py | cpermuttacth/BornToDev | fde536ea307ca7ce76743a8116c36c2fd5e4f5e2 | [
"Apache-2.0"
] | null | null | null | x = int(input())
n = int(input())
a = []
for y in range(n):
a.append(input().split())
for y in range(n):
if x >= int(a[y][0]) and x <= int(a[y][1]):
print(a[y][2])
| 19.333333 | 47 | 0.5 | 37 | 174 | 2.351351 | 0.459459 | 0.137931 | 0.137931 | 0.252874 | 0.275862 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021898 | 0.212644 | 174 | 8 | 48 | 21.75 | 0.613139 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3e91b66dae3d1c0edf5f2f9d46dc2d90eadc1c07 | 1,053 | py | Python | utility/genkey.py | devclub-iitd/pantomath | 251758fdcc6f56a1c1d2118c7838197ed0dc25a4 | [
"MIT"
] | null | null | null | utility/genkey.py | devclub-iitd/pantomath | 251758fdcc6f56a1c1d2118c7838197ed0dc25a4 | [
"MIT"
] | 5 | 2018-10-15T17:34:44.000Z | 2018-10-19T15:17:44.000Z | utility/genkey.py | devclub-iitd/pantomath | 251758fdcc6f56a1c1d2118c7838197ed0dc25a4 | [
"MIT"
] | 1 | 2020-08-27T05:15:33.000Z | 2020-08-27T05:15:33.000Z | """
Generates an Admin-key and DB-key for you
Call using
`python genkey.py your-password`
"""
import sys
import re
import bcrypt
def bad_password(password):
"""
checks for valid password
"""
return len(password) < 8 or re.match('^[A-Za-z0-9@#$%^&\*\.+=]+$', password) is None
if __name__ == '__main__':
if len(sys.argv) < 3:
print ('Please provide 2 passwords for admin and DB key')
exit(1)
admin_password = (sys.argv[1]).encode()
if bad_password(admin_password.decode()):
print ('Password should be of minimum length 8 and should contain only A-Za-z0-9@#$%^&*.+=')
exit(1)
admin_key = bcrypt.hashpw(admin_password, bcrypt.gensalt())
db_password = (sys.argv[2]).encode()
if bad_password(db_password.decode()):
print ('Password should be of minimum length 8 and should contain only A-Za-z0-9@#$%^&*.+=')
exit(1)
db_key = bcrypt.hashpw(db_password, bcrypt.gensalt())
print ("ADMIN_SECRET:", admin_key.decode())
print ("DB_SECRET:", db_key.decode())
| 29.25 | 100 | 0.637227 | 152 | 1,053 | 4.263158 | 0.381579 | 0.030864 | 0.023148 | 0.027778 | 0.253086 | 0.253086 | 0.253086 | 0.253086 | 0.253086 | 0.253086 | 0 | 0.01907 | 0.203229 | 1,053 | 35 | 101 | 30.085714 | 0.753278 | 0.105413 | 0 | 0.238095 | 1 | 0 | 0.291621 | 0.028292 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0.52381 | 0.142857 | 0 | 0.238095 | 0.238095 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e412f1d711e6fea67da35e6a372e4375335a95c9 | 466 | py | Python | examples/read-vlan.py | alliedtelesis/py-networking | 6c5d4bdafabfb4feef235a02344432e1f0336e48 | [
"Apache-2.0"
] | 4 | 2015-04-24T20:36:56.000Z | 2021-05-03T20:21:54.000Z | examples/read-vlan.py | alliedtelesis/py-networking | 6c5d4bdafabfb4feef235a02344432e1f0336e48 | [
"Apache-2.0"
] | 1 | 2019-07-14T07:07:21.000Z | 2019-07-14T07:07:21.000Z | examples/read-vlan.py | alliedtelesis/py-networking | 6c5d4bdafabfb4feef235a02344432e1f0336e48 | [
"Apache-2.0"
] | 3 | 2015-04-24T20:37:04.000Z | 2017-03-02T15:14:46.000Z | from pynetworking.Device import Device
dev = Device('10.17.39.253', username='manager', password='friend')
dev.open()
print "Vlan Id Name State Untagged Tagged "
print "--------------------------------------------------"
for vid, info in dev.vlan.items():
print "{0:10}{1:10}{2:10}{3:<10}{4:<10}".format(
vid,
info['name'],
info['current state'],
len(info['untagged']),
len(info['tagged']))
dev.close()
| 25.888889 | 67 | 0.515021 | 58 | 466 | 4.137931 | 0.603448 | 0.058333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065041 | 0.208155 | 466 | 17 | 68 | 27.411765 | 0.585366 | 0 | 0 | 0 | 0 | 0.076923 | 0.403433 | 0.175966 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.076923 | 0.076923 | null | null | 0.230769 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e433dd54017a61fd54bcda9e5a03752d18780d9f | 1,882 | py | Python | TaskController.py | etibuteau/BehaviorTree | 429e7024b0931d648264a206abf7de7e28f6d1f1 | [
"MIT"
] | null | null | null | TaskController.py | etibuteau/BehaviorTree | 429e7024b0931d648264a206abf7de7e28f6d1f1 | [
"MIT"
] | null | null | null | TaskController.py | etibuteau/BehaviorTree | 429e7024b0931d648264a206abf7de7e28f6d1f1 | [
"MIT"
] | null | null | null | # Under MIT License, see LICENSE.txt
__author__ = 'RoboCupULaval'
class TaskController:
"""Class added by composition to any task,
to keep track of the Task state
and logic flow.
This state-control class is separated
from the Task class so the Decorators
have a chance at compile-time security.
@author Ying"""
def __init__(self):
self.done = False
self.success = True
self.started = False
def set_task(self,task):
"""Sets the task reference
@param task Task to monitor"""
self.task = task
def safe_start(self,task):
"""Starts the monitored class"""
self.started = True
task.start()
def safe_end(self,task):
"""Ends the monitored task"""
self.done = False
self.started = False
task.end()
def finish_with_success(self):
"""Ends the monitored class, with success"""
self.success = True
self.done = True
def finish_with_failure(self):
"""Ends the monitored class, with failure"""
self.success = False
self.done = True
def succeeded(self):
"""Indicates whether the task finished successfully
@return True if it did, false if it didn't """
return self.success
def failed(self):
"""Indicates whether the task finished with failure
@return True if it did, false if it didn't"""
return not self.success
def finished(self):
"""Indicates whether the task finished
@return True if it did, false if it didn't """
return self.done
def started(self):
"""Indicates whether the class has started or not
@return True if it has, false if it hasn't"""
return self.started
def reset_task(self):
"""Marks the class as just started."""
self.done = False
| 27.275362 | 59 | 0.611583 | 247 | 1,882 | 4.595142 | 0.323887 | 0.028194 | 0.070485 | 0.081057 | 0.248458 | 0.248458 | 0.104846 | 0.104846 | 0.104846 | 0.104846 | 0 | 0 | 0.300744 | 1,882 | 68 | 60 | 27.676471 | 0.862462 | 0.436769 | 0 | 0.290323 | 0 | 0 | 0.01383 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.354839 | false | 0 | 0 | 0 | 0.516129 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e4368ce7803d4347b21e59cfa1896523e22cf313 | 266 | py | Python | depth_numpy_to_exr.py | drwalton/3d-photo-inpainting | 0f5d32847c1f06d04caadd40c93085bba39df3cb | [
"MIT"
] | null | null | null | depth_numpy_to_exr.py | drwalton/3d-photo-inpainting | 0f5d32847c1f06d04caadd40c93085bba39df3cb | [
"MIT"
] | null | null | null | depth_numpy_to_exr.py | drwalton/3d-photo-inpainting | 0f5d32847c1f06d04caadd40c93085bba39df3cb | [
"MIT"
] | null | null | null | import numpy as np
import OpenEXR
import sys
import Imath
import array
depth = np.load(sys.argv[1])
print(depth.shape)
out = OpenEXR.OutputFile(sys.argv[2], OpenEXR.Header(depth.shape[-2], depth.shape[-1]))
out.writePixels({'R' : depth, 'G' : depth, 'B' : depth})
| 22.166667 | 87 | 0.706767 | 43 | 266 | 4.372093 | 0.511628 | 0.159574 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017094 | 0.120301 | 266 | 11 | 88 | 24.181818 | 0.786325 | 0 | 0 | 0 | 0 | 0 | 0.011278 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.555556 | 0 | 0.555556 | 0.111111 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e43f7e9e5df62623a3eea4b7a68049fdc9f2b1cd | 892 | py | Python | tests/test_api.py | proteanblank/poseidon | 8e446a2b46a4a3c136e297f8684b777b9379766b | [
"Apache-2.0"
] | 251 | 2017-09-19T17:26:24.000Z | 2020-07-17T15:30:32.000Z | tests/test_api.py | anarkiwi/poseidon | a99f0eeb4963d23576808c31fafc980608799315 | [
"Apache-2.0"
] | 1,375 | 2017-09-14T18:45:51.000Z | 2020-07-31T00:44:56.000Z | tests/test_api.py | anarkiwi/poseidon | a99f0eeb4963d23576808c31fafc980608799315 | [
"Apache-2.0"
] | 98 | 2017-09-15T22:02:28.000Z | 2020-07-02T14:45:40.000Z | import falcon
import pytest
from falcon import testing
from poseidon_api.api import api
@pytest.fixture
def client():
return testing.TestClient(api)
def test_v1(client):
response = client.simulate_get('/v1')
assert response.status == falcon.HTTP_OK
def test_network(client):
response = client.simulate_get('/v1/network')
assert len(response.json) == 2
assert response.status == falcon.HTTP_OK
def test_network_by_ip(client):
response = client.simulate_get('/v1/network/10.0.0.1')
assert len(response.json['dataset']) == 0
assert response.status == falcon.HTTP_OK
def test_network_full(client):
response = client.simulate_get('/v1/network_full')
assert len(response.json) == 1
assert response.status == falcon.HTTP_OK
def test_info(client):
response = client.simulate_get('/v1/info')
assert response.status == falcon.HTTP_OK
| 23.473684 | 58 | 0.721973 | 125 | 892 | 4.992 | 0.264 | 0.05609 | 0.160256 | 0.224359 | 0.633013 | 0.633013 | 0.475962 | 0.283654 | 0.221154 | 0 | 0 | 0.018667 | 0.159193 | 892 | 37 | 59 | 24.108108 | 0.813333 | 0 | 0 | 0.2 | 0 | 0 | 0.07287 | 0 | 0 | 0 | 0 | 0 | 0.32 | 1 | 0.24 | false | 0 | 0.16 | 0.04 | 0.44 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e4496ae534fdc8623c4213666f171ce647824267 | 253 | py | Python | output/models/nist_data/list_pkg/nmtoken/schema_instance/nistschema_sv_iv_list_nmtoken_min_length_1_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/nist_data/list_pkg/nmtoken/schema_instance/nistschema_sv_iv_list_nmtoken_min_length_1_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/nist_data/list_pkg/nmtoken/schema_instance/nistschema_sv_iv_list_nmtoken_min_length_1_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.nist_data.list_pkg.nmtoken.schema_instance.nistschema_sv_iv_list_nmtoken_min_length_1_xsd.nistschema_sv_iv_list_nmtoken_min_length_1 import NistschemaSvIvListNmtokenMinLength1
__all__ = [
"NistschemaSvIvListNmtokenMinLength1",
]
| 42.166667 | 194 | 0.893281 | 31 | 253 | 6.580645 | 0.645161 | 0.117647 | 0.137255 | 0.176471 | 0.343137 | 0.343137 | 0.343137 | 0.343137 | 0 | 0 | 0 | 0.016736 | 0.055336 | 253 | 5 | 195 | 50.6 | 0.83682 | 0 | 0 | 0 | 0 | 0 | 0.13834 | 0.13834 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e49bb49e5e5799129e4f4d166cd1487266d6baf6 | 701 | py | Python | Exam/exam_skeleton/project/decoration/decoration_repository.py | geodimitrov/PythonOOP_SoftUni | f1c6718c878b618b3ab3f174cd4d187bd178940b | [
"MIT"
] | 1 | 2021-06-30T11:53:44.000Z | 2021-06-30T11:53:44.000Z | Exam/exam_skeleton/project/decoration/decoration_repository.py | geodimitrov/PythonOOP_SoftUni | f1c6718c878b618b3ab3f174cd4d187bd178940b | [
"MIT"
] | null | null | null | Exam/exam_skeleton/project/decoration/decoration_repository.py | geodimitrov/PythonOOP_SoftUni | f1c6718c878b618b3ab3f174cd4d187bd178940b | [
"MIT"
] | null | null | null | class DecorationRepository:
def __init__(self):
self.decorations = []
@staticmethod
def get_obj_by_type(objects, obj_type):
result = [obj for obj in objects if obj.__class__.__name__ == obj_type]
return result
def add(self, decoration):
self.decorations.append(decoration)
def remove(self, decoration):
if decoration not in self.decorations:
return False
self.decorations.remove(decoration)
return True
def find_by_type(self, decoration_type: str):
decorations = self.get_obj_by_type(self.decorations,decoration_type)
if decorations:
return decorations[0]
return "None" | 30.478261 | 79 | 0.659058 | 81 | 701 | 5.407407 | 0.358025 | 0.171233 | 0.03653 | 0.054795 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001938 | 0.263909 | 701 | 23 | 80 | 30.478261 | 0.846899 | 0 | 0 | 0 | 0 | 0 | 0.005698 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0 | 0 | 0.578947 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e49dc099d76fc95f4167a5b6bca84002a9238eb6 | 397 | py | Python | tests/test_report_request.py | czuhajster/garb | 57af0a65074c125ff6e928954b793eb04a800347 | [
"MIT"
] | 1 | 2021-11-11T16:22:11.000Z | 2021-11-11T16:22:11.000Z | tests/test_report_request.py | czuhajster/garb | 57af0a65074c125ff6e928954b793eb04a800347 | [
"MIT"
] | null | null | null | tests/test_report_request.py | czuhajster/garb | 57af0a65074c125ff6e928954b793eb04a800347 | [
"MIT"
] | null | null | null | from garb import report_request
def test_report_request():
"""
Tests `ReportRequest` class.
"""
pass
def test_request_body_to_json():
"""
Tests `RequestBody` class conversion to JSON string.
"""
reportBody = report_request.RequestBody([])
reportBodyJson = reportBody.json()
assert reportBodyJson == '{"reportRequests": [], "useResourceQuotas": false}'
| 22.055556 | 81 | 0.672544 | 38 | 397 | 6.815789 | 0.605263 | 0.150579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.20403 | 397 | 17 | 82 | 23.352941 | 0.81962 | 0.20403 | 0 | 0 | 0 | 0 | 0.175439 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.285714 | false | 0.142857 | 0.142857 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e4a0427bbab30ca85c74ce884062896154805e9d | 1,478 | py | Python | iroha/proposal_pb2.py | takemiyamakoto/iroha-python | e0a4f9be3e3aae2ce0fa256642fe6c4e75583db7 | [
"Apache-2.0"
] | null | null | null | iroha/proposal_pb2.py | takemiyamakoto/iroha-python | e0a4f9be3e3aae2ce0fa256642fe6c4e75583db7 | [
"Apache-2.0"
] | null | null | null | iroha/proposal_pb2.py | takemiyamakoto/iroha-python | e0a4f9be3e3aae2ce0fa256642fe6c4e75583db7 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: proposal.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from . import transaction_pb2 as transaction__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproposal.proto\x12\x0eiroha.protocol\x1a\x11transaction.proto\"c\n\x08Proposal\x12\x0e\n\x06height\x18\x01 \x01(\x04\x12\x31\n\x0ctransactions\x18\x02 \x03(\x0b\x32\x1b.iroha.protocol.Transaction\x12\x14\n\x0c\x63reated_time\x18\x03 \x01(\x04\x42\x1aZ\x18iroha.generated/protocolb\x06proto3')
_PROPOSAL = DESCRIPTOR.message_types_by_name['Proposal']
Proposal = _reflection.GeneratedProtocolMessageType('Proposal', (_message.Message,), {
'DESCRIPTOR' : _PROPOSAL,
'__module__' : 'proposal_pb2'
# @@protoc_insertion_point(class_scope:iroha.protocol.Proposal)
})
_sym_db.RegisterMessage(Proposal)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'Z\030iroha.generated/protocol'
_PROPOSAL._serialized_start=53
_PROPOSAL._serialized_end=152
# @@protoc_insertion_point(module_scope)
| 39.945946 | 358 | 0.805142 | 189 | 1,478 | 6.010582 | 0.465608 | 0.044014 | 0.079225 | 0.105634 | 0.059859 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053333 | 0.086604 | 1,478 | 36 | 359 | 41.055556 | 0.788148 | 0.182003 | 0 | 0 | 1 | 0.052632 | 0.311352 | 0.268781 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.315789 | 0 | 0.315789 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
e4b06bcd97ea40db41b64c3a4587f59c6665e9d9 | 271 | py | Python | mmdet/core/mask/__init__.py | fengyouliang/wheat_detection | d056123426a1260c29b486cbb8e44a88a0a3c5bc | [
"Apache-2.0"
] | null | null | null | mmdet/core/mask/__init__.py | fengyouliang/wheat_detection | d056123426a1260c29b486cbb8e44a88a0a3c5bc | [
"Apache-2.0"
] | null | null | null | mmdet/core/mask/__init__.py | fengyouliang/wheat_detection | d056123426a1260c29b486cbb8e44a88a0a3c5bc | [
"Apache-2.0"
] | null | null | null | from .mask_target import mask_target
from .structures import BitmapMasks, PolygonMasks
from .utils import encode_mask_results, split_combined_polys
__all__ = [
'split_combined_polys', 'mask_target', 'BitmapMasks', 'PolygonMasks',
'encode_mask_results'
]
| 30.111111 | 74 | 0.771218 | 31 | 271 | 6.258065 | 0.451613 | 0.154639 | 0.175258 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147601 | 271 | 8 | 75 | 33.875 | 0.839827 | 0 | 0 | 0 | 0 | 0 | 0.277567 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
e4b613ac09c5d3467de3760bcd662e4a8ae0f5c4 | 457 | py | Python | experiments/problems/functions/quartic.py | QuintonWeenink/investigating-cpso-for-nn-training | 7747622671da27f8c9b4c27046472befce963dad | [
"MIT"
] | 2 | 2020-06-22T09:18:13.000Z | 2021-07-09T02:41:30.000Z | experiments/problems/functions/quartic.py | QuintonWeenink/investigating-cpso-for-nn-training | 7747622671da27f8c9b4c27046472befce963dad | [
"MIT"
] | null | null | null | experiments/problems/functions/quartic.py | QuintonWeenink/investigating-cpso-for-nn-training | 7747622671da27f8c9b4c27046472befce963dad | [
"MIT"
] | 1 | 2018-12-05T11:00:39.000Z | 2018-12-05T11:00:39.000Z | import numpy as np
from mlpy.numberGenerator.bounds import Bounds
from experiments.problems.functions.structure.function import Function
class Quartic(Function):
def function(self, x):
return np.sum(np.multiply(np.arange(1, len(x) + 1), np.power(x, 4.0)))
def getBounds(self):
return Bounds(-1.28, 1.28)
def test(self):
assert(16 == self.function(np.array([2])))
assert(48 == self.function(np.array([2, 2]))) | 28.5625 | 78 | 0.660832 | 68 | 457 | 4.441176 | 0.514706 | 0.019868 | 0.092715 | 0.125828 | 0.13245 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045822 | 0.188184 | 457 | 16 | 79 | 28.5625 | 0.768194 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 1 | 0.272727 | false | 0 | 0.272727 | 0.181818 | 0.818182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
e4e616e30408929df57fa8f65d081cbd7382e955 | 939 | py | Python | backend/polls/models.py | cristian-rincon/vote-app | 7d8fc6537b4a13854fe88fc8e4d8f14f20e50787 | [
"MIT"
] | 1 | 2022-02-04T01:01:20.000Z | 2022-02-04T01:01:20.000Z | backend/polls/models.py | cristian-rincon/vote-app | 7d8fc6537b4a13854fe88fc8e4d8f14f20e50787 | [
"MIT"
] | 21 | 2022-03-26T21:39:42.000Z | 2022-03-26T22:58:57.000Z | backend/polls/models.py | cristian-rincon/vote-app | 7d8fc6537b4a13854fe88fc8e4d8f14f20e50787 | [
"MIT"
] | null | null | null | import datetime
from typing import Any, Union
from django.db import models
from django.utils import timezone
class Question(models.Model):
created_by = models.ForeignKey("auth.User", related_name="questions", on_delete=models.CASCADE, null=True)
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField("date published", auto_now_add=True, blank=True)
published = models.BooleanField(default=True)
def __str__(self) -> Any:
return self.question_text
def was_published_recently(self) -> Any:
return self.pub_date >= timezone.now() - datetime.timedelta(days=1) and self.published
class Choice(models.Model):
question = models.ForeignKey(Question, related_name="choices", on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __str__(self) -> Union[str, Any]:
return self.choice_text
| 33.535714 | 110 | 0.739084 | 124 | 939 | 5.395161 | 0.459677 | 0.040359 | 0.058296 | 0.06278 | 0.092676 | 0.092676 | 0 | 0 | 0 | 0 | 0 | 0.010076 | 0.15442 | 939 | 27 | 111 | 34.777778 | 0.832494 | 0 | 0 | 0 | 0 | 0 | 0.041534 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.157895 | false | 0 | 0.210526 | 0.157895 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
e4effb68641b5e63999401a1cdb6f33e4408f909 | 7,413 | py | Python | src/database.py | nyalldawson/vicmap2pgsql | f48605f636fe754758ae3d41aa86278a35cc099f | [
"MIT"
] | 2 | 2016-02-08T04:51:08.000Z | 2020-10-26T01:48:11.000Z | src/database.py | nyalldawson/vicmap2pgsql | f48605f636fe754758ae3d41aa86278a35cc099f | [
"MIT"
] | null | null | null | src/database.py | nyalldawson/vicmap2pgsql | f48605f636fe754758ae3d41aa86278a35cc099f | [
"MIT"
] | null | null | null | #!python
import os
import psycopg2
class Database():
""" Handles interaction with the Postgres database """
def __init__(self):
self.port = 5432
self.host = 'localhost'
self.database = 'postgis'
self.user = 'postgis'
self.password = 'password'
self.getParamsFromEnv()
self.c = self.createConnection()
def __del__(self):
try:
self.closeConnection()
except:
pass
def __enter__(self):
return self
def __exit__(self, type, value, tb):
self.closeConnection()
def getParamsFromEnv(self):
"""Extracts connection parameters from the environment"""
self.port = os.getenv('PGPORT', self.port)
self.host = os.getenv('PGHOST', self.host)
self.database = os.getenv('PGDATABASE', self.database)
self.user = os.getenv('PGUSER', self.user)
self.password = os.getenv('PGPASSWORD', self.password)
def createConnection(self):
"""Initiates a connection to the PostGIS server"""
conn_string = "host='{}' dbname='{}' user='{}' password='{}' port={}".format(
self.host, self.database, self.user, self.password, self.port)
return psycopg2.connect(conn_string)
def encodeLiteral(self, string):
"""Encodes a string literal"""
return string.replace("'","''")
def encodeTableName(self, schema, table):
"""Encodes a table name to a safe string to use in a query"""
return '"{}"."{}"'.format(schema, table)
def encodeSchemaName(self, schema):
"""Encodes a schema name to a safe string to use in a query"""
return '"{}"'.format(schema)
def encodeColumnName(self, column):
"""Encodes a column name to a safe string to use in a query"""
return '"{}"'.format(column)
def fetchSqlRecords(self, sql):
"""Executes a SQL query and returns the result rows"""
cursor = self.c.cursor()
cursor.execute(sql)
r = cursor.fetchall()
cursor.close()
return r
def runSql(self, sql):
"""Executes a SQL query"""
cursor = self.c.cursor()
cursor.execute(sql)
self.c.commit()
cursor.close()
return True
def runSqlNoTransaction(self, sql):
"""Executes a SQL query outside of a transaction block"""
self.c.autocommit = True
cursor = self.c.cursor()
cursor.execute(sql)
self.c.commit()
cursor.close()
self.c.autocommit = False
return True
def tableExists(self, schema, table):
"""Tests whether the specified table exists in the database"""
r = self.fetchSqlRecords(
"SELECT to_regclass('{}.{}')".format(schema, table))
return r[0][0]
def tableHasColumn(self, schema, table, column):
"""Tests whether a table has a specified column"""
res = self.fetchSqlRecords(
"select count(*) from information_schema.columns c where c.table_schema = '{}' and c.table_name='{}' and c.column_name='{}'".format(schema, table, column))
return res[0][0] > 0
def createTable(self, schema, table, cols):
"""Creates a new table in the database, with specified columns.
param cols is an array of [name, definition, extra defs (eg PRIMARY KEY)]
"""
col_definition = ','.join(
['"{}" {} {}'.format(c[0], c[1], c[2]) for c in cols])
return self.runSql('CREATE TABLE {} ({})'.format(self.encodeTableName(schema, table), col_definition))
def setTableComment(self, schema, table, comment):
"""Sets the comment for the specified table
"""
return self.runSql('COMMENT ON TABLE {} IS \'{}\''.format(self.encodeTableName(schema, table), self.encodeLiteral(comment)))
def dropTable(self, schema, table, cascade=False):
""" Drops a table from the database """
if cascade:
return self.runSql('DROP TABLE IF EXISTS {} CASCADE'.format(self.encodeTableName(schema, table)))
else:
return self.runSql('DROP TABLE IF EXISTS {}'.format(self.encodeTableName(schema, table)))
def truncateTable(self, schema, table):
""" Truncates a table from the database """
return self.runSql('TRUNCATE TABLE {}'.format(self.encodeTableName(schema, table)))
def getTableColumnDefs(self, schema, table):
""" Gets the column definitions for the specified table """
src_columns = self.fetchSqlRecords(
"select c.column_name, data_type, character_maximum_length, numeric_precision, numeric_scale from information_schema.columns c where c.table_schema = '{}' and c.table_name='{}'".format(schema, table))
return [dict(zip(('name', 'type', 'max_length', 'precision', 'scale'), c)) for c in src_columns]
def getGeometryColumnDef(self, schema, table, column):
""" Returns the definition of a geometry column """
defs = self.fetchSqlRecords(
"select type, srid from geometry_columns where f_table_schema='{}' and f_table_name='{}' and f_geometry_column='{}'".format(schema, table, column))
if not len(defs) == 1:
return None
return 'geometry({},{})'.format(defs[0][0], defs[0][1])
def recordCount(self, schema, table):
""" Returns the number of rows in a table """
r = self.fetchSqlRecords(
"SELECT count(*) FROM {}".format(self.encodeTableName(schema, table)))
return r[0][0]
def copyData(self, src_schema, src_table, src_columns, dest_schema, dest_table, dest_columns):
"""Copies data from one table to another"""
sql = 'INSERT INTO {} ( {} ) SELECT {} FROM {}'.format(self.encodeTableName(dest_schema, dest_table), ','.join(dest_columns),
','.join(src_columns), self.encodeTableName(src_schema, src_table))
return self.runSql(sql)
def schemaExists(self, schema):
"""Tests whether the specified schema exists in the database"""
r = self.fetchSqlRecords(
"SELECT count(*) FROM information_schema.schemata WHERE schema_name = '{}'".format(schema))
return r[0][0] > 0
def createSchema(self, schema):
"""Creates a schema"""
return self.runSql('CREATE SCHEMA IF NOT EXISTS {}'.format(self.encodeSchemaName(schema)))
def createSpatialIndex(self, schema, table, column):
"""Creates a spatial index on a geometry column"""
index_name = '{}_{}_idx'.format(table, column)
return self.runSql('CREATE INDEX {} ON {} USING gist ({})'.format(index_name, self.encodeTableName(schema, table), self.encodeColumnName(column)))
def vacuum(self, schema, table):
"""Vacuums a table"""
return self.runSqlNoTransaction('VACUUM ANALYSE {}'.format(self.encodeTableName(schema, table)))
def closeConnection(self):
self.c.close()
def ogrString(self):
"""Returns an OGR format string which can be used to connect to the database"""
return 'host={} user={} port={} dbname={} password={}'.format(self.host, self.user, self.port, self.database, self.password)
| 42.119318 | 213 | 0.60313 | 849 | 7,413 | 5.193168 | 0.221437 | 0.062372 | 0.040826 | 0.054434 | 0.250397 | 0.210252 | 0.149013 | 0.103425 | 0.083012 | 0.083012 | 0 | 0.004404 | 0.26494 | 7,413 | 175 | 214 | 42.36 | 0.804735 | 0.163362 | 0 | 0.178571 | 0 | 0.017857 | 0.174979 | 0.021447 | 0 | 0 | 0 | 0 | 0 | 1 | 0.258929 | false | 0.053571 | 0.017857 | 0.008929 | 0.517857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e4f4dbf7e69ef2e31a62a524eb5edc3fde725f47 | 566 | py | Python | Sistema/sisprel/backend/app/app/schemas/question_option_open.py | JosueHernandezR/TTR | 204a501da14a04310e85b43230c5e32c2009e471 | [
"MIT"
] | null | null | null | Sistema/sisprel/backend/app/app/schemas/question_option_open.py | JosueHernandezR/TTR | 204a501da14a04310e85b43230c5e32c2009e471 | [
"MIT"
] | null | null | null | Sistema/sisprel/backend/app/app/schemas/question_option_open.py | JosueHernandezR/TTR | 204a501da14a04310e85b43230c5e32c2009e471 | [
"MIT"
] | null | null | null | from typing import Optional, List
from pydantic import BaseModel
class QuestionOptionOpenBase(BaseModel):
weight_max: int
class QuestionOptionOpenCreate(QuestionOptionOpenBase):
weight_max: int
class QuestionOptionOpenUpdate(QuestionOptionOpenBase):
pass
class QuestionOptionOpenInDBBase(QuestionOptionOpenBase):
id: int
question_id: int
question_survey_id: int
class Config:
orm_mode = True
class QuestionOptionOpen(QuestionOptionOpenInDBBase):
pass
class QuestionOptionOpenInDB(QuestionOptionOpenInDBBase):
pass
| 20.962963 | 57 | 0.793286 | 50 | 566 | 8.86 | 0.5 | 0.054176 | 0.054176 | 0.076749 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160777 | 566 | 26 | 58 | 21.769231 | 0.932632 | 0 | 0 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0.111111 | 0 | 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 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
e4fbd73c6e2c5dca4321002d511753f76f128204 | 1,060 | py | Python | tensorflow_lite_support/python/task/vision/core/color_space_type.py | khanhlvg/tflite-support | a4febca66974ae51fecc45bb7ecbc31794bbc4fc | [
"Apache-2.0"
] | null | null | null | tensorflow_lite_support/python/task/vision/core/color_space_type.py | khanhlvg/tflite-support | a4febca66974ae51fecc45bb7ecbc31794bbc4fc | [
"Apache-2.0"
] | null | null | null | tensorflow_lite_support/python/task/vision/core/color_space_type.py | khanhlvg/tflite-support | a4febca66974ae51fecc45bb7ecbc31794bbc4fc | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Types of color space of an image."""
import enum
@enum.unique
class ColorSpaceType(enum.Enum):
"""Represents the type of color space of an image."""
# Each pixel is a single element representing only the amount of light.
GRAYSCALE = "GRAYSCALE"
# Each pixel has red, green, and blue color components.
RGB = "RGB"
# An extension of RGB color values with an alpha channel - which specifies the
# opacity of the color.
RGBA = "RGBA"
| 36.551724 | 80 | 0.742453 | 162 | 1,060 | 4.858025 | 0.617284 | 0.076239 | 0.033037 | 0.040661 | 0.053367 | 0.053367 | 0 | 0 | 0 | 0 | 0 | 0.009249 | 0.183962 | 1,060 | 28 | 81 | 37.857143 | 0.900578 | 0.836792 | 0 | 0 | 0 | 0 | 0.109589 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e4fc3f92bbf0463a5376f09c909035a695ffdc32 | 264 | py | Python | core-python/Core_Python/loop/ForElse.py | theumang100/tutorials-1 | 497f54c2adb022c316530319a168fca1c007d4b1 | [
"MIT"
] | 9 | 2020-04-23T05:24:19.000Z | 2022-02-17T16:37:51.000Z | core-python/Core_Python/loop/ForElse.py | theumang100/tutorials-1 | 497f54c2adb022c316530319a168fca1c007d4b1 | [
"MIT"
] | 5 | 2020-10-01T05:08:37.000Z | 2020-10-12T03:18:10.000Z | core-python/Core_Python/loop/ForElse.py | theumang100/tutorials-1 | 497f54c2adb022c316530319a168fca1c007d4b1 | [
"MIT"
] | 9 | 2020-04-28T14:06:41.000Z | 2021-10-19T18:32:28.000Z | n = int (input('Enter a number for prime number series : '))
for i in range(2,n):
for j in range(2,i):
if i % j == 0:
print(i,"is not a prime number because",j,"*",i//j,"=",i)
break
else:
print(i,"is a prime number") | 33 | 69 | 0.511364 | 46 | 264 | 2.934783 | 0.478261 | 0.244444 | 0.118519 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01676 | 0.32197 | 264 | 8 | 70 | 33 | 0.73743 | 0 | 0 | 0 | 0 | 0 | 0.335849 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9021021bbdedac6e9dc9cff610fc6bafb62ee09c | 1,297 | py | Python | src/backend/backend/profiles/serializers.py | jordimart/findmenu-ng-django | 14606889f8b8a1aeb49c87128de6efe084377365 | [
"MIT"
] | null | null | null | src/backend/backend/profiles/serializers.py | jordimart/findmenu-ng-django | 14606889f8b8a1aeb49c87128de6efe084377365 | [
"MIT"
] | null | null | null | src/backend/backend/profiles/serializers.py | jordimart/findmenu-ng-django | 14606889f8b8a1aeb49c87128de6efe084377365 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from .models import Profile
class ProfileSerializer(serializers.ModelSerializer):
username = serializers.CharField(source='user.username')
email = serializers.CharField(source='user.email')
created_at = serializers.CharField(source='user.created_at')
bio = serializers.CharField(allow_blank=True, required=False)
image = serializers.SerializerMethodField()
city = serializers.CharField(allow_blank=True, required=False)
name = serializers.CharField(allow_blank=True, required=False)
first_name = serializers.CharField(allow_blank=True, required=False)
last_name = serializers.CharField(allow_blank=True, required=False)
date_birth = serializers.CharField(allow_blank=True, required=False)
friends = serializers.IntegerField(default=0, required=False)
restaurants = serializers.IntegerField(default=0, required=False)
class Meta:
model = Profile
fields = ('username', 'bio', 'image', 'city', 'name', 'first_name', 'last_name', 'date_birth', 'friends',
'restaurants', 'email', 'created_at')
read_only_fields = ('username', 'email')
def get_image(self, obj):
if obj.image:
return obj.image
return 'static/images/userdefault.jpg'
| 41.83871 | 113 | 0.717039 | 143 | 1,297 | 6.370629 | 0.356643 | 0.197585 | 0.164654 | 0.197585 | 0.419319 | 0.419319 | 0.322722 | 0.167947 | 0 | 0 | 0 | 0.001854 | 0.16808 | 1,297 | 30 | 114 | 43.233333 | 0.842447 | 0 | 0 | 0 | 0 | 0 | 0.127988 | 0.022359 | 0 | 0 | 0 | 0 | 0 | 1 | 0.041667 | false | 0 | 0.083333 | 0 | 0.791667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
90247c1fea4b365720ade34a8d361421d787c57d | 1,951 | py | Python | pyplan/strategies.py | Oscar-Garcia/pyplan | 0cd6d586d7ef909244a875861911d212445e567e | [
"MIT"
] | null | null | null | pyplan/strategies.py | Oscar-Garcia/pyplan | 0cd6d586d7ef909244a875861911d212445e567e | [
"MIT"
] | null | null | null | pyplan/strategies.py | Oscar-Garcia/pyplan | 0cd6d586d7ef909244a875861911d212445e567e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from .graph import Graph, SearchSpace
from .nodes import Node
class PythonCodeError(Exception):
def __init__(self, source_code):
super().__init__()
self.source_code = source_code
def __repr__(self):
return '%s("%s")' % (self.__class__.__name__, self.source_code)
def succesors_generation(node: Node, domain: Graph, **kwargs): # pylint: disable=unused-argument
return domain.successors(domain.get_node(node.reference))
def order_evaluation(nodes, open_nodes_counter, **kwargs): # pylint: disable=unused-argument
return list(range(open_nodes_counter + len(nodes), open_nodes_counter, -1))
def random_evaluation(nodes, search_space, **kwargs): # pylint: disable=unused-argument
raise NotImplementedError()
def get_reference_node(node: Node, domain: Graph) -> Node:
return domain.get_node(getattr(node, 'reference'))
def python_test(node: Node, domain: Graph, **kwargs) -> bool:
test = getattr(get_reference_node(node, domain), 'test', None)
if not test:
return True
try:
return bool(eval(test['code'], kwargs)) # pylint: disable=eval-used
except Exception as error:
raise PythonCodeError(test.get('source', '???')) from error
def python_execution(node: Node, domain: Graph, **kwargs) -> bool:
action = getattr(get_reference_node(node, domain), 'action', None)
if action:
try:
eval(action['code'], kwargs) # pylint: disable=eval-used
except Exception as error:
raise PythonCodeError(action.get('source', '???')) from error
SELECTION_MAX = SearchSpace.ORDER_BY_MAX
SELECTION_MIN = SearchSpace.ORDER_BY_MIN
DEFAULT_POLICIES = {
'generation': succesors_generation,
'test': python_test,
'selection': SELECTION_MAX,
'execution': python_execution,
'evaluation': order_evaluation,
}
def get_default_strategy(strategy):
return DEFAULT_POLICIES[strategy]
| 30.484375 | 97 | 0.696566 | 235 | 1,951 | 5.531915 | 0.293617 | 0.049231 | 0.064615 | 0.058462 | 0.307692 | 0.267692 | 0.112308 | 0.112308 | 0.112308 | 0.112308 | 0 | 0.001248 | 0.17837 | 1,951 | 63 | 98 | 30.968254 | 0.809732 | 0.086622 | 0 | 0.095238 | 0 | 0 | 0.053521 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.047619 | 0.119048 | 0.452381 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
902a9f32d85ea9dd6e1ed47320979f3489016818 | 360 | py | Python | tests/test_project/app_rename_column/migrations/0002_auto_20190414_1502.py | christianbundy/django-migration-linter | 3f0531f349c4c237a5ff1afd594956a58103dc5d | [
"Apache-2.0"
] | 357 | 2017-04-05T20:50:31.000Z | 2022-03-16T01:37:13.000Z | tests/test_project/app_rename_column/migrations/0002_auto_20190414_1502.py | christianbundy/django-migration-linter | 3f0531f349c4c237a5ff1afd594956a58103dc5d | [
"Apache-2.0"
] | 146 | 2017-04-06T14:14:26.000Z | 2022-03-28T18:02:53.000Z | tests/test_project/app_rename_column/migrations/0002_auto_20190414_1502.py | christianbundy/django-migration-linter | 3f0531f349c4c237a5ff1afd594956a58103dc5d | [
"Apache-2.0"
] | 45 | 2017-10-31T16:25:22.000Z | 2022-02-24T22:13:37.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 15:02
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("app_rename_column", "0001_initial")]
operations = [
migrations.RenameField(model_name="a", old_name="field", new_name="renamed")
]
| 24 | 84 | 0.705556 | 47 | 360 | 5.170213 | 0.829787 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.07309 | 0.163889 | 360 | 14 | 85 | 25.714286 | 0.734219 | 0.191667 | 0 | 0 | 1 | 0 | 0.145833 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
5f40f37782483413d164bf47576733296c183a34 | 1,425 | py | Python | ravendb/documents/session/loaders/loaders.py | ravendb/RavenDB-Python-Client | 6286b459b501e755fe8e8591a48acf8616605ccd | [
"MIT"
] | 8 | 2016-10-08T17:45:44.000Z | 2018-05-29T12:16:43.000Z | ravendb/documents/session/loaders/loaders.py | ravendb/RavenDB-Python-Client | 6286b459b501e755fe8e8591a48acf8616605ccd | [
"MIT"
] | 5 | 2017-02-12T15:50:53.000Z | 2017-09-18T12:25:01.000Z | ravendb/documents/session/loaders/loaders.py | ravendb/RavenDB-Python-Client | 6286b459b501e755fe8e8591a48acf8616605ccd | [
"MIT"
] | 8 | 2016-07-03T07:59:12.000Z | 2017-09-18T11:22:23.000Z | from __future__ import annotations
from abc import abstractmethod
from typing import TypeVar, TYPE_CHECKING, Dict, List, Type
from ravendb.documents.store.lazy import Lazy
if TYPE_CHECKING:
from ravendb.documents.session.document_session import DocumentSession
_T = TypeVar("_T")
class LoaderWithInclude:
@abstractmethod
def include(self, path: str) -> LoaderWithInclude:
pass
@abstractmethod
def load(self, object_type: type, *ids: str) -> Dict[str, object]:
pass
class MultiLoaderWithInclude(LoaderWithInclude):
def __init__(self, session: DocumentSession):
self.__session = session
self.__includes: List[str] = []
def include(self, path: str) -> LoaderWithInclude:
self.__includes.append(path)
return self
def load(self, object_type: Type[_T], *ids: str) -> Dict[str, object]:
return self.__session._load_internal(object_type, list(ids), self.__includes)
class LazyMultiLoaderWithInclude(LoaderWithInclude):
def __init__(self, session: "DocumentSession"):
self.__session = session
self.__includes = []
def include(self, path: str) -> LazyMultiLoaderWithInclude:
self.__includes.append(path)
return self
def load(self, object_type: Type[_T], *ids: str) -> Lazy[Dict[str, object]]:
return self.__session.lazy_load_internal(object_type, list(ids), self.__includes, None)
| 30.319149 | 95 | 0.705965 | 162 | 1,425 | 5.91358 | 0.246914 | 0.068894 | 0.043841 | 0.056367 | 0.596033 | 0.55428 | 0.386221 | 0.386221 | 0.300626 | 0.300626 | 0 | 0 | 0.192281 | 1,425 | 46 | 96 | 30.978261 | 0.83232 | 0 | 0 | 0.375 | 0 | 0 | 0.01193 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.0625 | 0.15625 | 0.0625 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
5f5aea15240bbd9611868813c51d975e0aeb66f9 | 467 | py | Python | day46/decorator.py | nurmatthias/100DaysOfCode | 22002e4b31d13e6b52e6b9222d2e91c2070c5744 | [
"Apache-2.0"
] | null | null | null | day46/decorator.py | nurmatthias/100DaysOfCode | 22002e4b31d13e6b52e6b9222d2e91c2070c5744 | [
"Apache-2.0"
] | null | null | null | day46/decorator.py | nurmatthias/100DaysOfCode | 22002e4b31d13e6b52e6b9222d2e91c2070c5744 | [
"Apache-2.0"
] | null | null | null | import time
def speed_calc_decorator(function):
def wrapper():
start_time = time.time()
function()
difference = time.time() - start_time
print(f"{function.__name__} run speed: {difference}s")
return wrapper
@speed_calc_decorator
def fast_function():
for i in range(10000000):
i * i
@speed_calc_decorator
def slow_function():
for i in range(100000000):
i * i
fast_function()
slow_function() | 19.458333 | 62 | 0.642398 | 59 | 467 | 4.813559 | 0.40678 | 0.09507 | 0.190141 | 0.147887 | 0.133803 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048991 | 0.256959 | 467 | 24 | 63 | 19.458333 | 0.769452 | 0 | 0 | 0.222222 | 0 | 0 | 0.094017 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.055556 | 0 | 0.333333 | 0.055556 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5f5d68980630ae2dd0dc5c2163441506deba2f3b | 17,816 | py | Python | book/views.py | pincoin/rakmai | d9daa399aff50712a86b2dec9d94e622237b25b0 | [
"MIT"
] | 11 | 2018-04-02T16:36:19.000Z | 2019-07-10T05:54:58.000Z | book/views.py | pincoin/rakmai | d9daa399aff50712a86b2dec9d94e622237b25b0 | [
"MIT"
] | 22 | 2019-01-01T20:40:21.000Z | 2022-02-10T08:06:39.000Z | book/views.py | pincoin/rakmai | d9daa399aff50712a86b2dec9d94e622237b25b0 | [
"MIT"
] | 4 | 2019-03-12T14:24:37.000Z | 2022-01-07T16:20:22.000Z | import logging
from django.db.models import Q
from django.urls import reverse
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.views.generic import (
ListView, DetailView
)
from django.views.generic.edit import (
CreateView, UpdateView, DeleteView
)
from ipware import get_client_ip
from rakmai.viewmixins import (
SuperuserRequiredMixin, OwnerRequiredMixin, PageableMixin
)
from rakmai.views import (
FileUploadView, FileDeleteView
)
from . import settings as book_settings
from .forms import (
BookForm, PageForm, PageAttachmentForm
)
from .models import (
Book, Page, Category, Attachment
)
from .viewmixins import (
BookContextMixin, SearchContextMixin
)
class BookListView(SearchContextMixin, PageableMixin, ListView):
logger = logging.getLogger(__name__)
context_object_name = 'books'
def __init__(self):
super(BookListView, self).__init__()
self.block_size = book_settings.BOOK_BLOCK_SIZE
self.chunk_size = book_settings.BOOK_CHUNK_SIZE
def get_queryset(self):
return Book.objects \
.select_related('category', 'owner') \
.public()
def get_context_data(self, **kwargs):
context = super(BookListView, self).get_context_data(**kwargs)
context['page_title'] = _('Book List')
return context
def get_template_names(self):
return 'book/{}/book_list.html'.format(book_settings.BOOK_THEME)
class BookDetailView(SearchContextMixin, DetailView):
logger = logging.getLogger(__name__)
context_object_name = 'book'
def get_object(self, queryset=None):
obj = super(BookDetailView, self).get_object()
obj.view_count += 1
obj.save()
return obj
def get_queryset(self):
return Book.objects \
.select_related('category', 'owner') \
.filter(pk=self.kwargs['pk']) \
.public()
def get_context_data(self, **kwargs):
context = super(BookDetailView, self).get_context_data(**kwargs)
context['page_title'] = self.object.title
return context
def get_template_names(self):
return 'book/{}/book_detail.html'.format(book_settings.BOOK_THEME)
class BookMyListView(SearchContextMixin, OwnerRequiredMixin, SuperuserRequiredMixin, PageableMixin, ListView):
logger = logging.getLogger(__name__)
context_object_name = 'books'
queryset = Book.objects \
.select_related('category', 'owner')
def __init__(self):
super(BookMyListView, self).__init__()
self.block_size = book_settings.BOOK_BLOCK_SIZE
self.chunk_size = book_settings.BOOK_CHUNK_SIZE
def get_queryset(self):
# Note: Call OwnerRequiredMixin
return super(BookMyListView, self).get_queryset()
def get_context_data(self, **kwargs):
context = super(BookMyListView, self).get_context_data(**kwargs)
context['page_title'] = _('Book List')
return context
def get_template_names(self):
return 'book/{}/book_my_list.html'.format(book_settings.BOOK_THEME)
class PageDetailView(SearchContextMixin, BookContextMixin, DetailView):
logger = logging.getLogger(__name__)
context_object_name = 'page'
def get_object(self, queryset=None):
obj = super(PageDetailView, self).get_object()
obj.view_count += 1
obj.save()
return obj
def get_queryset(self):
return Page.objects.filter(pk=self.kwargs['pk']) \
.select_related('owner', 'book') \
.book(self.kwargs['book']) \
.filter(book__status=Book.STATUS_CHOICES.public) \
.public() \
.order_by('tree_id', 'lft')
def get_context_data(self, **kwargs):
context = super(PageDetailView, self).get_context_data(**kwargs)
context['page_title'] = '{} - {}'.format(self.object.title, self.object.book.title)
context['page_meta_description'] = self.object.description
context['page_meta_keywords'] = self.object.keywords
context['page_id'] = int(self.kwargs['pk'])
context['page_absolute_url'] = self.request.build_absolute_uri(
reverse('book:page-detail', args=(self.object.book.pk, self.object.pk)))
return context
def get_form_kwargs(self):
return {
'book': self.object.book.id,
'page': self.object.id,
}
def get_template_names(self):
return 'book/{}/page_detail.html'.format(book_settings.BOOK_THEME)
class PageListView(SearchContextMixin, BookContextMixin, ListView):
logger = logging.getLogger(__name__)
context_object_name = 'pages'
def get_queryset(self):
queryset = Page.objects \
.book(self.kwargs['book']) \
.public() \
.order_by('tree_id', 'lft')
form = self.search_form_class(self.request.GET)
if form.is_valid() and form.cleaned_data['q']:
q = form.cleaned_data['q']
queryset = queryset.filter(
Q(title__icontains=q) |
Q(content__icontains=q)
)
return queryset
else:
return None
def get_context_data(self, **kwargs):
context = super(PageListView, self).get_context_data(**kwargs)
context['page_title'] = _('Search Results - {}').format(self.book.title)
return context
def get_template_names(self):
return 'book/{}/page_list.html'.format(book_settings.BOOK_THEME)
class BookMyDetailView(SearchContextMixin, SuperuserRequiredMixin, DetailView):
logger = logging.getLogger(__name__)
context_object_name = 'book'
def get_queryset(self):
return Book.objects \
.select_related('category', 'owner') \
.filter(pk=self.kwargs['pk']) \
.filter(owner=self.request.user) # No OwnerRequiredMixin
def get_context_data(self, **kwargs):
context = super(BookMyDetailView, self).get_context_data(**kwargs)
context['page_title'] = self.object.title
return context
def get_template_names(self):
return 'book/{}/book_my_detail.html'.format(book_settings.BOOK_THEME)
class BookCreateView(SearchContextMixin, SuperuserRequiredMixin, CreateView):
logger = logging.getLogger(__name__)
model = Book
context_object_name = 'book'
form_class = BookForm
def get_context_data(self, **kwargs):
context = super(BookCreateView, self).get_context_data(**kwargs)
context['page_title'] = _('Write New Book')
return context
def get_form_kwargs(self):
kwargs = super(BookCreateView, self).get_form_kwargs()
kwargs['categories'] = Category.objects.all().order_by('tree_id', 'lft')
return kwargs
def form_valid(self, form):
# These must be set before `form_valid()` which saves Page model instance.
# Then, `self.object` is available in order to save attachments.
form.instance.owner = self.request.user
form.instance.view_count = 0
form.instance.updated = now()
return super(BookCreateView, self).form_valid(form)
def get_success_url(self):
return reverse('book:book-my-detail', args=(self.object.id,))
def get_template_names(self):
return 'book/{}/book_create.html'.format(book_settings.BOOK_THEME)
class BookUpdateView(SearchContextMixin, OwnerRequiredMixin, SuperuserRequiredMixin, UpdateView):
logger = logging.getLogger(__name__)
model = Book
context_object_name = 'book'
form_class = BookForm
def get_context_data(self, **kwargs):
context = super(BookUpdateView, self).get_context_data(**kwargs)
context['page_title'] = _('Edit Book - {}').format(self.object.title)
return context
def get_form_kwargs(self):
kwargs = super(BookUpdateView, self).get_form_kwargs()
kwargs['categories'] = Category.objects.all().order_by('tree_id', 'lft')
return kwargs
def form_valid(self, form):
# These must be set before `form_valid()` which saves Page model instance.
# Then, `self.object` is available in order to save attachments.
form.instance.updated = now()
# The fields such as created, updated, view_count are filled by default.
return super(BookUpdateView, self).form_valid(form)
def get_success_url(self):
return reverse('book:book-my-detail', args=(self.object.id,))
def get_template_names(self):
return 'book/{}/book_update.html'.format(book_settings.BOOK_THEME)
class BookDeleteView(SearchContextMixin, OwnerRequiredMixin, SuperuserRequiredMixin, DeleteView):
logger = logging.getLogger(__name__)
model = Book
context_object_name = 'book'
def get_context_data(self, **kwargs):
context = super(BookDeleteView, self).get_context_data(**kwargs)
context['page_title'] = _('Delete Book - {}').format(self.object.title)
return context
def get_success_url(self):
return reverse('book:book-my-list')
def get_template_names(self):
return 'book/{}/book_confirm_delete.html'.format(book_settings.BOOK_THEME)
class PageCreateView(SearchContextMixin, SuperuserRequiredMixin, BookContextMixin, CreateView):
logger = logging.getLogger(__name__)
model = Page
context_object_name = 'page'
def get_context_data(self, **kwargs):
context = super(PageCreateView, self).get_context_data(**kwargs)
context['page_title'] = _('Write New Page')
return context
def get_form_class(self):
"""
Return different form when validation is required.
Hidden fields are not prepopulated but appended to form by AJAX.
"""
if self.request.method == 'POST':
return PageAttachmentForm
else:
return PageForm
def get_form_kwargs(self):
kwargs = super(PageCreateView, self).get_form_kwargs()
kwargs['parents'] = Page.objects.filter(book__pk=self.book.pk).order_by('tree_id', 'lft')
return kwargs
def form_valid(self, form):
# These must be set before `form_valid()` which saves Page model instance.
# Then, `self.object` is available in order to save attachments.
form.instance.book = self.book
form.instance.book.updated = now()
form.instance.book.save()
form.instance.owner = self.request.user
form.instance.view_count = 0
form.instance.updated = now()
form.instance.ip_address = get_client_ip(self.request)[0]
response = super(PageCreateView, self).form_valid(form)
# Retrieve attachments not related to any post yet.
attachments = Attachment.objects.filter(
uid__in=form.cleaned_data['attachments'],
page__isnull=True,
)
if attachments:
self.object.attachments.set(attachments)
return response
def get_success_url(self):
return reverse('book:page-my-detail', args=(self.book.id, self.object.id))
def get_template_names(self):
return 'book/{}/page_create.html'.format(book_settings.BOOK_THEME)
class PageUpdateView(SearchContextMixin, OwnerRequiredMixin, SuperuserRequiredMixin, BookContextMixin, UpdateView):
logger = logging.getLogger(__name__)
model = Page
context_object_name = 'page'
def get_context_data(self, **kwargs):
context = super(PageUpdateView, self).get_context_data(**kwargs)
context['page_title'] = _('Edit Page - {}').format(self.object.title)
return context
def get_form_class(self):
"""
Return different form when validation is required.
Hidden fields are not prepopulated but appended to form by AJAX.
"""
if self.request.method == 'POST':
return PageAttachmentForm
else:
return PageForm
def get_form_kwargs(self):
kwargs = super(PageUpdateView, self).get_form_kwargs()
kwargs['parents'] = Page.objects.filter(book__pk=self.book.pk).order_by('tree_id', 'lft')
return kwargs
def form_valid(self, form):
# These must be set before `form_valid()` which saves Page model instance.
# Then, `self.object` is available in order to save attachments.
form.instance.book.updated = now()
form.instance.book.save()
form.instance.updated = now()
form.instance.ip_address = get_client_ip(self.request)[0]
response = super(PageUpdateView, self).form_valid(form)
# Retrieve attachments not related to any post yet.
attachments = Attachment.objects.filter(
uid__in=form.cleaned_data['attachments'],
page__isnull=True,
)
if attachments:
attachments.update(page=self.object)
return response
def get_success_url(self):
return reverse('book:page-my-detail', args=(self.book.id, self.object.id))
def get_template_names(self):
return 'book/{}/page_update.html'.format(book_settings.BOOK_THEME)
class PageDeleteView(SearchContextMixin, OwnerRequiredMixin, SuperuserRequiredMixin, BookContextMixin, DeleteView):
logger = logging.getLogger(__name__)
model = Page
context_object_name = 'page'
def get_context_data(self, **kwargs):
context = super(PageDeleteView, self).get_context_data(**kwargs)
context['page_title'] = _('Delete Page - {}').format(self.object.title)
return context
def get_success_url(self):
return reverse('book:book-my-detail', args=(self.book.id,))
def get_template_names(self):
return 'book/{}/page_confirm_delete.html'.format(book_settings.BOOK_THEME)
class PageMyDetailView(SearchContextMixin, SuperuserRequiredMixin, BookContextMixin, DetailView):
logger = logging.getLogger(__name__)
context_object_name = 'page'
def get_queryset(self):
# No OwnerRequiredMixin
return Page.objects \
.filter(pk=self.kwargs['pk']) \
.select_related('owner', 'book') \
.book(self.kwargs['book']) \
.filter(owner=self.request.user) \
.order_by('tree_id', 'lft')
def get_context_data(self, **kwargs):
context = super(PageMyDetailView, self).get_context_data(**kwargs)
context['page_title'] = '{} - {}'.format(self.object.title, self.object.book.title)
context['page_meta_description'] = self.object.description
context['page_meta_keywords'] = self.object.keywords
context['page_id'] = int(self.kwargs['pk'])
return context
def get_template_names(self):
return 'book/{}/page_my_detail.html'.format(book_settings.BOOK_THEME)
class PageMyListView(SearchContextMixin, OwnerRequiredMixin, SuperuserRequiredMixin, BookContextMixin, ListView):
logger = logging.getLogger(__name__)
context_object_name = 'pages'
def get_queryset(self):
# No OwnerRequiredMixin
queryset = Page.objects \
.book(self.kwargs['book']) \
.filter(owner=self.request.user) \
.order_by('tree_id', 'lft')
form = self.search_form_class(self.request.GET)
if form.is_valid() and form.cleaned_data['q']:
q = form.cleaned_data['q']
queryset = queryset.filter(
Q(title__icontains=q) |
Q(content__icontains=q)
)
return queryset
else:
return None
def get_context_data(self, **kwargs):
context = super(PageMyListView, self).get_context_data(**kwargs)
context['page_title'] = _('Search Results - {}').format(self.book.title)
return context
def get_template_names(self):
return 'book/{}/page_my_list.html'.format(book_settings.BOOK_THEME)
class PageAttachmentUploadView(SuperuserRequiredMixin, FileUploadView):
# Raise PermissionDenied exception instead of the redirect
raise_exception = True
def upload_file(self, *args, **kwargs):
"""
Upload files and return JSON file list.
"""
uploaded_files = kwargs.pop('uploaded_files', None)
files = []
if uploaded_files:
# `files` is HTML attribute name not from Django/Python.
for file in uploaded_files.getlist('files'):
# Attachment class inherits AbstractAttachment
attachment = Attachment()
attachment.file = file
attachment.name = file.name
attachment.save()
files.append({
"uid": attachment.uid,
"name": file.name,
"size": file.size,
"url": attachment.file.url
})
# Return JSON key `files`
return {"files": files}
class PageAttachmentDeleteView(SuperuserRequiredMixin, FileDeleteView):
# Raise PermissionDenied exception instead of the redirect
raise_exception = True
def delete_file(self, *args, **kwargs):
"""
Delete files and return JSON file list.
"""
form = kwargs.pop('form', None)
user = kwargs.pop('user', None)
files = []
if form and user:
# Attachment class inherits AbstractAttachment and they are asynchronously deleted by cron.
attachment = Attachment.objects.select_related('page__owner').get(uid=form.cleaned_data['uid'])
if attachment.page and attachment.page.owner == user:
attachment.page = None
attachment.save()
files.append({
"uid": attachment.uid,
})
# Return JSON key `files`
return {"files": files}
| 34.796875 | 115 | 0.654243 | 1,999 | 17,816 | 5.614807 | 0.106053 | 0.027263 | 0.034925 | 0.032431 | 0.735032 | 0.732537 | 0.713204 | 0.69191 | 0.643264 | 0.579383 | 0 | 0.000441 | 0.23608 | 17,816 | 511 | 116 | 34.864971 | 0.824247 | 0.082791 | 0 | 0.644628 | 0 | 0 | 0.078527 | 0.024551 | 0 | 0 | 0 | 0 | 0 | 1 | 0.162534 | false | 0 | 0.038567 | 0.07438 | 0.520661 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5f779e24578907cc4ef22b92653863b4ea375b8b | 9,988 | py | Python | .config/qtile/powerline_bar.py | SlavicPixel/Dotfiles | 1bd4664b77cafbc17241a4dca0a05e99785f1f12 | [
"MIT"
] | null | null | null | .config/qtile/powerline_bar.py | SlavicPixel/Dotfiles | 1bd4664b77cafbc17241a4dca0a05e99785f1f12 | [
"MIT"
] | null | null | null | .config/qtile/powerline_bar.py | SlavicPixel/Dotfiles | 1bd4664b77cafbc17241a4dca0a05e99785f1f12 | [
"MIT"
] | null | null | null | widget_defaults = dict(
font="FiraCode Nerd Font",
fontsize = 21,
padding = 2,
background=colors[2]
)
extension_defaults = widget_defaults.copy()
def init_widgets_list():
prompt = "{0}@{1}: ".format(os.environ["USER"], socket.gethostname())
widgets_list = [
widget.Sep(
linewidth = 0,
padding = 6,
foreground = colors[2],
background = colors[0]
),
widget.Image(
filename = "~/.config/qtile/icons/tux.png",
scale = "False",
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm)},
background = colors[0]
),
widget.Sep(
linewidth = 0,
padding = 6,
foreground = colors[2],
background = colors[0]
),
widget.TextBox(
text = '|',
background = colors[0],
foreground = '#808080',
fontsize = 20
),
widget.Sep(
linewidth = 0,
padding = 6,
foreground = colors[2],
background = colors[0]
),
widget.GroupBox(
font = "FiraCode Nerd Font",
fontsize = 18,
margin_y = 3,
margin_x = 0,
padding_y = 5,
padding_x = 3,
borderwidth = 3,
active = "#ff71ce",
inactive = colors[2],
rounded = False,
highlight_color = colors[0],
highlight_method = "line",
this_current_screen_border = colors[6],
this_screen_border = colors [4],
other_current_screen_border = colors[6],
other_screen_border = colors[4],
foreground = colors[2],
background = colors[0]
),
widget.Prompt(
prompt = prompt,
font = "Ubuntu Mono",
padding = 10,
foreground = colors[3],
background = colors[1],
fontsize = 16
),
widget.Sep(
linewidth = 0,
padding = 40,
foreground = colors[2],
background = colors[0]
),
widget.WindowName(
foreground = colors[6],
background = colors[0],
padding = 0
),
widget.Sep(
linewidth = 0,
padding = 6,
foreground = colors[0],
background = colors[0]
),
widget.TextBox(
text = '',
background = colors[0],
foreground = colors[5],
padding = -1,
fontsize = 70
),
widget.CheckUpdates(
update_interval = 1800,
distro = "Arch_checkupdates",
display_format = "⟳{updates} Updates",
foreground = colors[2],
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e sudo pacman -Syu')},
background = colors[5]
),
widget.TextBox(
text = '',
background = colors[5],
foreground = colors[4],
padding = -1,
fontsize = 70
),
widget.CPU(
format = 'cpu: {load_percent}% {freq_current}GHz',
foreground = colors[2],
background = colors[4]
),
widget.TextBox(
text = '',
background = colors[4],
foreground = colors[5],
padding = -1,
fontsize = 70
),
widget.TextBox(
text = " 🌡",
padding = 2,
foreground = colors[2],
background = colors[5],
fontsize = 16
),
widget.ThermalSensor(
foreground = colors[2],
background = colors[5],
threshold = 90,
padding = 5,
tag_sensor = "Package id 0"
),
widget.TextBox(
text='',
background = colors[5],
foreground = colors[4],
padding = -1,
fontsize = 70
),
widget.NvidiaSensors(
foreground = colors[2],
background = colors[4],
format = 'GPU {temp}°C'
),
widget.TextBox(
text = '',
background = colors[4],
foreground = colors[5],
padding = -1,
fontsize = 70
),
widget.TextBox(
text = " 🖬",
foreground = colors[2],
background = colors[5],
padding = 0,
fontsize = 16
),
widget.Memory(
foreground = colors[2],
background = colors[5],
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e htop')},
padding = 5
),
widget.TextBox(
text='',
background = colors[5],
foreground = colors[4],
padding = -1,
fontsize = 70
),
widget.Net(
interface = "wlan0",# interface_name
format = '{down} ↓↑ {up}',
foreground = colors[2],
background = colors[4],
padding = 5
),
widget.TextBox(
text = '',
background = colors[4],
foreground = colors[5],
padding = -1,
fontsize = 70
),
widget.TextBox(
text = "Vol:",
foreground = colors[2],
background = colors[5],
padding = 0,
),
widget.Volume(
foreground = colors[2],
background = colors[5],
padding = 5
),
widget.TextBox(
text = '',
background = colors[5],
foreground = colors[4],
padding = -1,
fontsize = 70
),
widget.CurrentLayoutIcon(
custom_icon_paths = [os.path.expanduser("~/.config/qtile/icons")],
foreground = colors[0],
background = colors[4],
padding = 0,
scale = 0.7
),
widget.CurrentLayout(
foreground = colors[2],
background = colors[4],
padding = 5
),
widget.TextBox(
text = '',
background = colors[4],
foreground = colors[5],
padding = -1,
fontsize = 70
),
widget.Clock(
foreground = colors[2],
background = colors[5],
format = "%A, %B %d - %H:%M:%S",
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + f" --hold -e cal {current_year}")}
),
widget.Sep(
linewidth = 0,
padding = 10,
foreground = colors[0],
background = colors[5]
),
widget.TextBox(
text = '',
background = colors[5],
foreground = colors[4],
padding = -1,
fontsize = 70
),
widget.Systray(
background=colors[4],
icon_size=21,
padding = 4
),
widget.Sep(
linewidth = 0,
padding = 10,
foreground = colors[0],
background = colors[4]
),
]
return widgets_list
| 38.713178 | 120 | 0.321185 | 618 | 9,988 | 5.148867 | 0.236246 | 0.186047 | 0.090823 | 0.135764 | 0.648963 | 0.606537 | 0.522942 | 0.475801 | 0.407605 | 0.363922 | 0 | 0.044543 | 0.595415 | 9,988 | 257 | 121 | 38.863813 | 0.738926 | 0.001402 | 0 | 0.709804 | 0 | 0 | 0.037405 | 0.005014 | 0 | 0 | 0 | 0 | 0 | 1 | 0.003922 | false | 0 | 0 | 0 | 0.007843 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5f7d2445a4b760b7df25feda83baa0aaf0153b7d | 253 | py | Python | db/schema/Customer.py | bradywatkinson/go-db-service-boilerplate-dev | 5daf744e44f9ca4560a72d595d1c2e784a6f62c6 | [
"MIT"
] | null | null | null | db/schema/Customer.py | bradywatkinson/go-db-service-boilerplate-dev | 5daf744e44f9ca4560a72d595d1c2e784a6f62c6 | [
"MIT"
] | null | null | null | db/schema/Customer.py | bradywatkinson/go-db-service-boilerplate-dev | 5daf744e44f9ca4560a72d595d1c2e784a6f62c6 | [
"MIT"
] | null | null | null | from .DB import db, Base, GormModelMixin
class Customer(Base, GormModelMixin):
id = db.Column(db.Integer(), primary_key=True)
first_name = db.Column(db.UnicodeText(), nullable=False)
last_name = db.Column(db.UnicodeText(), nullable=False)
| 31.625 | 60 | 0.727273 | 34 | 253 | 5.323529 | 0.558824 | 0.132597 | 0.165746 | 0.154696 | 0.41989 | 0.41989 | 0.41989 | 0 | 0 | 0 | 0 | 0 | 0.13834 | 253 | 7 | 61 | 36.142857 | 0.830275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
5f85d66a23db53b7f2f48672eb1fe400c15adcef | 1,113 | py | Python | FHIRPower/SepsisPredictor/apps.py | NematiLab/Streaming-Sepsis-Prediction-System-for-Intensive-Care-Units | fb5ad260fb8d264d85aea9e6c895d1700eea4d11 | [
"Apache-2.0"
] | 2 | 2019-05-16T16:41:22.000Z | 2021-04-22T22:06:49.000Z | FHIRPower/SepsisPredictor/apps.py | NematiLab/Streaming-Sepsis-Prediction-System-for-Intensive-Care-Units | fb5ad260fb8d264d85aea9e6c895d1700eea4d11 | [
"Apache-2.0"
] | null | null | null | FHIRPower/SepsisPredictor/apps.py | NematiLab/Streaming-Sepsis-Prediction-System-for-Intensive-Care-Units | fb5ad260fb8d264d85aea9e6c895d1700eea4d11 | [
"Apache-2.0"
] | 3 | 2019-03-26T01:39:18.000Z | 2020-02-02T19:06:33.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
# from datetime import datetime, timedelta
class SepsisPredictorConfig(AppConfig):
name = 'SepsisPredictor'
def ready(self):
# from DataInterface import uiinterface
from SepsisPredictor import models
m = models.Measurement()
m.delete_everything()
# origin_timestamp = '2017-10-02T08:59:59.000-04:00'
# origin_timestamp_str = origin_timestamp[:len(origin_timestamp) - 6]
#
#
# start_time = datetime.strptime(origin_timestamp_str, '%Y-%m-%dT%H:%M:%S.%f')
# range_delta = timedelta(minutes=5)
# end_time = start_time + range_delta
#
# starting_timestamp = datetime.strftime(start_time, '%Y-%m-%dT%H:%M:%S') + '.000-04:00'
# ending_timestamp = datetime.strftime(end_time, '%Y-%m-%dT%H:%M:%S') + '.000-04:00'
#
# ui = uiinterface.UIInterface('FHIRPower_sepsis_data_interface', 'http://35.188.235.179:8080/baseDstu3')
# ui.getTimedData(starting_timestamp, ending_timestamp) | 39.75 | 113 | 0.651393 | 134 | 1,113 | 5.208955 | 0.507463 | 0.10745 | 0.030086 | 0.02149 | 0.061605 | 0.061605 | 0.051576 | 0.051576 | 0.051576 | 0.051576 | 0 | 0.061644 | 0.212938 | 1,113 | 28 | 114 | 39.75 | 0.73516 | 0.624438 | 0 | 0 | 0 | 0 | 0.037313 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
5f8a36dc7223ed18f86c5f5b5f2579fa4c9b6179 | 790 | py | Python | junit_reporting/migrations/0012_default_values.py | nashif/django-junit-reporting | 38c776ee5395d7b0e41174918a0b218c7cfeb8f8 | [
"BSD-3-Clause"
] | null | null | null | junit_reporting/migrations/0012_default_values.py | nashif/django-junit-reporting | 38c776ee5395d7b0e41174918a0b218c7cfeb8f8 | [
"BSD-3-Clause"
] | 1 | 2019-07-29T18:25:50.000Z | 2019-07-29T18:25:50.000Z | junit_reporting/migrations/0012_default_values.py | nashif/django-junit-reporting | 38c776ee5395d7b0e41174918a0b218c7cfeb8f8 | [
"BSD-3-Clause"
] | 2 | 2019-10-26T02:53:16.000Z | 2022-02-23T15:12:17.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-14 21:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('junit_reporting', '0011_JUnitReport_unique_build_per_project'),
]
operations = [
migrations.AlterField(
model_name='junitsuite',
name='runtime',
field=models.FloatField(default=0),
),
migrations.AlterField(
model_name='junitsuite',
name='skipped',
field=models.IntegerField(default=0),
),
migrations.AlterField(
model_name='junittest',
name='runtime',
field=models.FloatField(default=0),
),
]
| 25.483871 | 73 | 0.591139 | 76 | 790 | 5.960526 | 0.618421 | 0.13245 | 0.165563 | 0.192053 | 0.439294 | 0.439294 | 0.1766 | 0 | 0 | 0 | 0 | 0.043165 | 0.296203 | 790 | 30 | 74 | 26.333333 | 0.771583 | 0.086076 | 0 | 0.521739 | 1 | 0 | 0.147427 | 0.057024 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.086957 | 0 | 0.217391 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5f90c4ba51e5942bcd5d45b1df13abd156c34312 | 1,889 | py | Python | src/ensure_only_approved_third_parties_can_assume_roles.py | indeni/cloudrail-sample-custom-rules | e71e4b6cf4b9ff328e42a0ae80ed9805cd38a472 | [
"MIT"
] | null | null | null | src/ensure_only_approved_third_parties_can_assume_roles.py | indeni/cloudrail-sample-custom-rules | e71e4b6cf4b9ff328e42a0ae80ed9805cd38a472 | [
"MIT"
] | null | null | null | src/ensure_only_approved_third_parties_can_assume_roles.py | indeni/cloudrail-sample-custom-rules | e71e4b6cf4b9ff328e42a0ae80ed9805cd38a472 | [
"MIT"
] | null | null | null | from typing import List, Dict
from cloudrail.knowledge.context.aws.account.account import Account
from cloudrail.knowledge.context.aws.iam.policy_statement import StatementEffect
from cloudrail.knowledge.context.base_environment_context import BaseEnvironmentContext
from cloudrail.knowledge.rules.base_rule import BaseRule, Issue
from cloudrail.knowledge.rules.rule_parameters.base_paramerter import ParameterType
from cloudrail.knowledge.utils import arn_utils
class EnsureOnlyAssumesThirdPartiesCanAssumeRoles(BaseRule):
def __init__(self):
self.approved_list_of_third_parties: List[str] = [
"645376637575", # Indeni Cloudrail
"464622532012", # DataDog
]
def get_id(self) -> str:
return 'ensure_only_approved_third_parties_can_assume_roles'
def get_needed_parameters(self) -> List[ParameterType]:
return []
def execute(self, env_context: BaseEnvironmentContext, parameters: Dict[ParameterType, any]) -> List[Issue]:
issues: List[Issue] = []
for role in env_context.roles:
for statement in role.assume_role_policy.statements:
if statement.effect == StatementEffect.ALLOW:
for principal in statement.principal.principal_values:
if arn_utils.is_valid_arn(principal) and arn_utils.get_arn_account_id(principal) not in self.approved_list_of_third_parties:
issues.append(Issue(f'The IAM role `{role.get_friendly_name()}` has a trust policy that allows account `{ arn_utils.get_arn_account_id(principal)}` '
f'to assume it but that is not in the list of pre-approved third-party accounts', role, role))
return issues
def should_run_rule(self, environment_context: BaseEnvironmentContext) -> bool:
return bool(environment_context.roles)
| 51.054054 | 177 | 0.719428 | 224 | 1,889 | 5.839286 | 0.379464 | 0.059633 | 0.100917 | 0.066514 | 0.143731 | 0.094801 | 0.04893 | 0 | 0 | 0 | 0 | 0.016021 | 0.206988 | 1,889 | 36 | 178 | 52.472222 | 0.857143 | 0.012705 | 0 | 0 | 0 | 0.034483 | 0.149302 | 0.064447 | 0 | 0 | 0 | 0 | 0 | 1 | 0.172414 | false | 0 | 0.241379 | 0.103448 | 0.586207 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
5fb995bab27561980bd45ce53253662dc789af27 | 1,030 | py | Python | cdmft/setups/common.py | nikwitt/cdmft | ebca66c760e0f6618a0b475eeeb5ace3cd229a2c | [
"MIT"
] | 7 | 2019-05-02T13:19:33.000Z | 2021-11-17T14:06:55.000Z | cdmft/setups/common.py | nikwitt/cdmft | ebca66c760e0f6618a0b475eeeb5ace3cd229a2c | [
"MIT"
] | null | null | null | cdmft/setups/common.py | nikwitt/cdmft | ebca66c760e0f6618a0b475eeeb5ace3cd229a2c | [
"MIT"
] | 1 | 2021-04-14T15:05:50.000Z | 2021-04-14T15:05:50.000Z | class CycleSetupCommon:
"""
realization needs self.h_int, self.gloc, self.g0, self.se, self.mu, self.global_moves,
self.quantum_numbers
"""
def initialize_cycle(self):
return {'h_int': self.h_int,'g_local': self.gloc, 'weiss_field': self.g0,
'self_energy': self.se, 'mu': self.mu, 'global_moves': self.global_moves,
'quantum_numbers': self.quantum_numbers}
def set_data(self, storage, load_mu = True):
"""
loads the data of g_imp_iw, g_weiss_iw, se_imp_iw, mu from storage into the corresponding
objects
The data is copied, storage returns objects that are all BlockGf's and can not init
a selfconsistency cycle
"""
g = storage.load('g_imp_iw')
self.gloc << g
try: # TODO backward compatibility
self.g0 << storage.load('g_weiss_iw')
except KeyError:
pass
self.se << storage.load('se_imp_iw')
if load_mu:
self.mu = storage.load('mu')
| 38.148148 | 97 | 0.608738 | 141 | 1,030 | 4.248227 | 0.425532 | 0.09182 | 0.026711 | 0.070117 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00406 | 0.282524 | 1,030 | 26 | 98 | 39.615385 | 0.806495 | 0.332039 | 0 | 0 | 0 | 0 | 0.148148 | 0 | 0 | 0 | 0 | 0.038462 | 0 | 1 | 0.133333 | false | 0.066667 | 0 | 0.066667 | 0.266667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
5fbb50031bde3d5fdfd011664ed5b2ce1cbd5506 | 522 | py | Python | OpinioDelivery/constants.py | anistark/opiniohll | e77a54c7a457c132ce16cc593b320ce27e60f246 | [
"MIT"
] | null | null | null | OpinioDelivery/constants.py | anistark/opiniohll | e77a54c7a457c132ce16cc593b320ce27e60f246 | [
"MIT"
] | null | null | null | OpinioDelivery/constants.py | anistark/opiniohll | e77a54c7a457c132ce16cc593b320ce27e60f246 | [
"MIT"
] | null | null | null | # All the constants
# Get keys
import config
# All the Base Endpoints
STAGING_URL_HOST = 'test.deliver.opinioapp.com'
PRODUCTION_URL_HOST = 'deliver.opinioapp.com'
ACCESS_KEY = config.ACCESS_KEY
SECRET_KEY = config.SECRET_KEY
# Api Endpoints
API_BASE_ENDPOINT = '/api'
API_VERSION = 'v1'
API_ENDPOINT = API_BASE_ENDPOINT + '/' + API_VERSION + '/orders'
API_MERCHANT_ENDPOINT = API_BASE_ENDPOINT + '/' + API_VERSION + '/merchants'
API_SERVICEABILITY_ENDPOINT = API_BASE_ENDPOINT + '/' + API_VERSION + '/serviceability'
| 27.473684 | 87 | 0.766284 | 69 | 522 | 5.434783 | 0.405797 | 0.205333 | 0.16 | 0.192 | 0.264 | 0.264 | 0 | 0 | 0 | 0 | 0 | 0.002193 | 0.126437 | 522 | 18 | 88 | 29 | 0.820175 | 0.12069 | 0 | 0 | 0 | 0 | 0.193833 | 0.103524 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5fbd15c08b6932414d1daee3b941637fb2a429eb | 1,135 | py | Python | mythx_models/request/group_list.py | ConsenSys/mythx-models | e912c2fc6e7d18041310d3b9f0f95085db47ed9b | [
"MIT"
] | 2 | 2019-08-26T13:42:28.000Z | 2019-11-13T15:44:16.000Z | mythx_models/request/group_list.py | ConsenSys/mythx-models | e912c2fc6e7d18041310d3b9f0f95085db47ed9b | [
"MIT"
] | 22 | 2019-08-26T13:14:55.000Z | 2021-04-18T14:22:52.000Z | mythx_models/request/group_list.py | ConsenSys/mythx-models | e912c2fc6e7d18041310d3b9f0f95085db47ed9b | [
"MIT"
] | 6 | 2019-08-29T15:51:38.000Z | 2021-04-05T11:41:34.000Z | """This module contains the GroupListRequest domain model."""
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
class GroupListRequest(BaseModel):
offset: Optional[int]
created_by: Optional[str] = Field(alias="createdBy")
group_name: Optional[str] = Field(alias="groupName")
date_from: Optional[datetime] = Field(alias="dateFrom")
date_to: Optional[datetime] = Field(alias="dateTo")
class Config:
allow_population_by_field_name = True
use_enum_values = True
@property
def endpoint(self):
return "v1/analysis-groups"
@property
def method(self):
return "GET"
@property
def payload(self):
return {}
@property
def headers(self):
return {}
@property
def parameters(self):
return {
"offset": self.offset,
"createdBy": self.created_by,
"groupName": self.group_name,
"dateFrom": self.date_from.isoformat() if self.date_from else None,
"dateTo": self.date_to.isoformat() if self.date_to else None,
}
| 25.222222 | 79 | 0.640529 | 128 | 1,135 | 5.554688 | 0.421875 | 0.077356 | 0.045007 | 0.059072 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001183 | 0.255507 | 1,135 | 44 | 80 | 25.795455 | 0.840237 | 0.048458 | 0 | 0.212121 | 0 | 0 | 0.08473 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.151515 | false | 0 | 0.090909 | 0.151515 | 0.606061 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.