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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bf99ea429931bf400f6df16dd43bb5ff519cff71 | 1,650 | py | Python | vyper/errors.py | ykgk518/vyper | 5670b019858a319fed390e4a46a9c208c30ff9c7 | [
"MIT"
] | null | null | null | vyper/errors.py | ykgk518/vyper | 5670b019858a319fed390e4a46a9c208c30ff9c7 | [
"MIT"
] | null | null | null | vyper/errors.py | ykgk518/vyper | 5670b019858a319fed390e4a46a9c208c30ff9c7 | [
"MIT"
] | null | null | null | class ConfigFileNotFoundError(Exception):
"""Denotes failing to find configuration file."""
def __init__(self, message, locations, *args):
self.message = message
self.locations = ", ".join(str(l) for l in locations)
super(ConfigFileNotFoundError, self).__init__(message, locations,
*args)
def __str__(self):
return "Config File {0} Not Found in {1}".format(
self.message, self.locations)
class RemoteConfigError(Exception):
"""Denotes encountering an error while trying to
pull the configuration from the remote provider.
"""
def __init__(self, message, *args):
self.message = message
super(RemoteConfigError, self).__init__(message, *args)
def __str__(self):
return "Remote Configuration Error {0}".format(self.message)
class UnsupportedConfigError(Exception):
"""Denotes encountering an unsupported configuration file type."""
def __init__(self, message, *args):
self.message = message
super(UnsupportedConfigError, self).__init__(message, *args)
def __str__(self):
return "Unsupported Config Type {0}".format(self.message)
class UnsupportedRemoteProviderError(Exception):
"""Denotes encountering an unsupported remote provider.
Currently only etcd, consul and zookeeper are supported.
"""
def __init__(self, message, *args):
self.message = message
super(UnsupportedRemoteProviderError, self).__init__(message, *args)
def __str__(self):
return "Unsupported Remote Provider Type {0}".format(self.message)
| 35.869565 | 76 | 0.669697 | 170 | 1,650 | 6.217647 | 0.3 | 0.124882 | 0.041627 | 0.068117 | 0.412488 | 0.247871 | 0.247871 | 0.247871 | 0.214759 | 0 | 0 | 0.003934 | 0.229697 | 1,650 | 45 | 77 | 36.666667 | 0.827695 | 0.187273 | 0 | 0.407407 | 0 | 0 | 0.097542 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.296296 | false | 0 | 0 | 0.148148 | 0.592593 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
bfb1c3e5e233e08c88340377099097d0f5ecd8fa | 91 | py | Python | Chapter02/Activity2.01/juggler/projectm/apps.py | PacktPublishing/Web-Development-Projects-with-Django | 531bc4d58d614888cc81b7fd6f8ec859f5a65217 | [
"MIT"
] | 97 | 2021-03-01T12:54:30.000Z | 2022-03-28T02:57:26.000Z | Chapter02/Activity2.01/juggler/projectm/apps.py | PacktPublishing/Web-Development-Projects-with-Django | 531bc4d58d614888cc81b7fd6f8ec859f5a65217 | [
"MIT"
] | 81 | 2020-08-27T04:56:04.000Z | 2022-03-12T00:53:40.000Z | Chapter02/Activity2.01/juggler/projectm/apps.py | PacktPublishing/Web-Development-Projects-with-Django | 531bc4d58d614888cc81b7fd6f8ec859f5a65217 | [
"MIT"
] | 163 | 2020-12-25T14:38:38.000Z | 2022-03-30T10:31:40.000Z | from django.apps import AppConfig
class ProjectmConfig(AppConfig):
name = 'projectm'
| 15.166667 | 33 | 0.758242 | 10 | 91 | 6.9 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164835 | 91 | 5 | 34 | 18.2 | 0.907895 | 0 | 0 | 0 | 0 | 0 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bfcdae50b50083c18f4bb3b8f164a609f4ee0096 | 9 | py | Python | library/python/pytest/context.py | jochenater/catboost | de2786fbc633b0d6ea6a23b3862496c6151b95c2 | [
"Apache-2.0"
] | 6,989 | 2017-07-18T06:23:18.000Z | 2022-03-31T15:58:36.000Z | library/python/pytest/context.py | birichie/catboost | de75c6af12cf490700e76c22072fbdc15b35d679 | [
"Apache-2.0"
] | 1,978 | 2017-07-18T09:17:58.000Z | 2022-03-31T14:28:43.000Z | library/python/pytest/context.py | birichie/catboost | de75c6af12cf490700e76c22072fbdc15b35d679 | [
"Apache-2.0"
] | 1,228 | 2017-07-18T09:03:13.000Z | 2022-03-29T05:57:40.000Z | Ctx = {}
| 4.5 | 8 | 0.333333 | 1 | 9 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 9 | 1 | 9 | 9 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bfd626e5b10cb78b3223428ac8a2e54f82ab5f41 | 153 | py | Python | classic_tetris_project/test_helper/factories/pages.py | Madv0x/classic-tetris-project | cfd8c39376ad42e6ec57055d88d79916b3debe10 | [
"MIT"
] | 17 | 2019-11-23T12:56:06.000Z | 2022-02-05T21:48:00.000Z | classic_tetris_project/test_helper/factories/pages.py | Madv0x/classic-tetris-project | cfd8c39376ad42e6ec57055d88d79916b3debe10 | [
"MIT"
] | 43 | 2019-10-03T20:16:11.000Z | 2022-03-12T00:24:52.000Z | classic_tetris_project/test_helper/factories/pages.py | Madv0x/classic-tetris-project | cfd8c39376ad42e6ec57055d88d79916b3debe10 | [
"MIT"
] | 17 | 2020-02-09T01:55:01.000Z | 2021-11-12T21:16:50.000Z | import factory
from classic_tetris_project.models import *
class PageFactory(factory.django.DjangoModelFactory):
class Meta:
model = Page
| 17 | 53 | 0.75817 | 17 | 153 | 6.705882 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183007 | 153 | 8 | 54 | 19.125 | 0.912 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
44ab45c372fd14dc160850942559a820c29eca6b | 1,128 | py | Python | encuestas/views.py | codo-a-codo-python-2018-team2/tpo2-backend | 859f088cdb08b9155e4b9a6aa82e589fc946f00f | [
"MIT"
] | 4 | 2021-07-05T22:36:21.000Z | 2021-07-28T17:26:06.000Z | encuestas/views.py | codo-a-codo-python-2018-team2/tpo2-backend | 859f088cdb08b9155e4b9a6aa82e589fc946f00f | [
"MIT"
] | 15 | 2021-07-14T20:05:11.000Z | 2021-07-18T00:40:54.000Z | encuestas/views.py | codo-a-codo-python-2018-team2/tpo2-backend | 859f088cdb08b9155e4b9a6aa82e589fc946f00f | [
"MIT"
] | 4 | 2021-07-12T20:04:54.000Z | 2021-07-15T02:01:51.000Z | from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def home(request):
return render(request, "base.html")
def update(data):
pass
def create(data):
pass
def delete(data):
pass
def read(data):
return HttpResponse("READ Hello world from Django for Codo a Codo 4.0:")
def gretting(request):
print(dict(request.GET))
HttpResponse("Hello world from Django for Codo a Codo 4.0:")
if request.method == "GET":
my_response = read(request)
elif request.method == "UPDATE":
my_response = update(request)
elif request.method == "QUE VA?":
my_response = delete(request)
else: # Que method es?
my_response = create(request)
return my_response
def natalia(request):
return HttpResponse("Respuesta creada por Natalia")
def sofia(request):
return HttpResponse("Esta es la respuesta de Sofía Ferro")
def jose(request):
return HttpResponse("Esta es la respuesta creada por Jose Guevara")
def reinid(request):
return HttpResponse("Esta es la respuesta creada por Reinid Valarino")
| 19.789474 | 76 | 0.689716 | 151 | 1,128 | 5.119205 | 0.370861 | 0.100906 | 0.129366 | 0.112549 | 0.274256 | 0.274256 | 0.274256 | 0.219922 | 0.219922 | 0.087969 | 0 | 0.00452 | 0.215426 | 1,128 | 56 | 77 | 20.142857 | 0.868927 | 0.033688 | 0 | 0.09375 | 0 | 0 | 0.25023 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0.09375 | 0.0625 | 0.1875 | 0.59375 | 0.03125 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
44aeb2a98d1c0f03eda867ff88cfe7687d9983ef | 592 | py | Python | mriqc/interfaces/__init__.py | cbinyu/mriqc | 471d7bb8a6f1611bec813fd62175ea74494552af | [
"BSD-3-Clause"
] | null | null | null | mriqc/interfaces/__init__.py | cbinyu/mriqc | 471d7bb8a6f1611bec813fd62175ea74494552af | [
"BSD-3-Clause"
] | null | null | null | mriqc/interfaces/__init__.py | cbinyu/mriqc | 471d7bb8a6f1611bec813fd62175ea74494552af | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" mriqc nipype interfaces """
from __future__ import print_function, division, absolute_import, unicode_literals
from .anatomical import \
StructuralQC, ArtifactMask, ComputeQI2, Harmonize, RotationMask
from .functional import FunctionalQC, Spikes
from .bids import ReadSidecarJSON, IQMFileSink
from .viz import PlotMosaic, PlotContours, PlotSpikes
from .common import ConformImage, EnsureSize
from .webapi import UploadIQMs
| 39.466667 | 82 | 0.765203 | 75 | 592 | 5.946667 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011628 | 0.128378 | 592 | 14 | 83 | 42.285714 | 0.852713 | 0.298986 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.875 | 0 | 0.875 | 0.125 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
44b6b67076a2918fc3088334181af40564a9a915 | 1,542 | py | Python | illumio/rules/ruleset.py | dsommerville-illumio/illumio-py | 30e9ee4237b142a62579839ed8a21f2eb35c8b09 | [
"Apache-2.0"
] | 1 | 2022-01-18T04:55:16.000Z | 2022-01-18T04:55:16.000Z | illumio/rules/ruleset.py | dsommerville-illumio/illumio-py | 30e9ee4237b142a62579839ed8a21f2eb35c8b09 | [
"Apache-2.0"
] | null | null | null | illumio/rules/ruleset.py | dsommerville-illumio/illumio-py | 30e9ee4237b142a62579839ed8a21f2eb35c8b09 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""This module provides classes related to policy rule sets.
Copyright:
(c) 2022 Illumio
License:
Apache2, see LICENSE for more details.
"""
from dataclasses import dataclass
from typing import List
from illumio.util import MutableObject, pce_api
from illumio.policyobjects import LabelSet
from .rule import Rule
from .iptablesrule import IPTablesRule
@dataclass
@pce_api('rule_sets', is_sec_policy=True)
class RuleSet(MutableObject):
"""Provides scope boundaries for security policy rules.
Usage:
>>> from illumio import PolicyComputeEngine, RuleSet, LabelSet
>>> pce = PolicyComputeEngine('my.pce.com')
>>> pce.set_credentials('api_key_username', 'api_key_secret')
>>> app_label = pce.labels.create({'key': 'app', 'value': 'App'})
>>> env_label = pce.labels.create({'key': 'env', 'value': 'Production'})
>>> loc_label = pce.labels.create({'key': 'loc', 'value': 'AWS'})
>>> ruleset = RuleSet(
... name='RS-RINGFENCE',
... scopes=[
... LabelSet(
... labels=[app_label, env_label, loc_label]
... )
... ]
... )
>>> ruleset = pce.rule_sets.create(ruleset)
>>> ruleset
Ruleset(
href='/orgs/1/sec_policy/draft/rule_sets/19',
name='RS-RINGFENCE'
)
"""
enabled: bool = None
scopes: List[LabelSet] = None
rules: List[Rule] = None
ip_tables_rules: List[IPTablesRule] = None
| 29.653846 | 80 | 0.600519 | 169 | 1,542 | 5.35503 | 0.449704 | 0.035359 | 0.046409 | 0.066298 | 0.076243 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007867 | 0.258106 | 1,542 | 51 | 81 | 30.235294 | 0.783217 | 0.648508 | 0 | 0 | 0 | 0 | 0.020408 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.461538 | 0 | 0.846154 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
7826564fe6180ebfa9648f8c7f71f35f8d3ce912 | 824 | py | Python | factory/cars/models.py | avara1986/graphql-django | 57b9bcb479842e243488a59cb4db4f523c2877ce | [
"MIT"
] | null | null | null | factory/cars/models.py | avara1986/graphql-django | 57b9bcb479842e243488a59cb4db4f523c2877ce | [
"MIT"
] | null | null | null | factory/cars/models.py | avara1986/graphql-django | 57b9bcb479842e243488a59cb4db4f523c2877ce | [
"MIT"
] | null | null | null | from django.db import models
class Car(models.Model):
# name = models.CharField(max_length=100)
model = models.ForeignKey(
'Model',
on_delete=models.CASCADE,
related_name='cars'
)
color = models.CharField(max_length=100, null=True)
def __str__(self):
return "{} ({})".format(self.color, self.model)
class Model(models.Model):
name = models.CharField(max_length=100)
brand = models.ForeignKey(
'Brand',
on_delete=models.CASCADE,
related_name='models'
)
year = models.PositiveIntegerField(null=True)
def __str__(self):
return "{} [{}-{}]".format(self.name, self.brand, self.year)
class Brand(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return "{}".format(self.name,)
| 23.542857 | 68 | 0.629854 | 97 | 824 | 5.14433 | 0.309278 | 0.08016 | 0.144289 | 0.192385 | 0.639279 | 0.58517 | 0.456914 | 0.388778 | 0 | 0 | 0 | 0.018838 | 0.226942 | 824 | 34 | 69 | 24.235294 | 0.764521 | 0.04733 | 0 | 0.291667 | 0 | 0 | 0.049808 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.041667 | 0.125 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
785960861729eeb02ac0f6dc2bbedf5a680eaead | 946 | py | Python | src/chalky/shortcuts/bg.py | stephen-bunn/chalk | 8bcaaab309cc4f4b5eee019bce08e2765d72cf02 | [
"0BSD"
] | 2 | 2020-12-24T16:38:55.000Z | 2021-12-09T21:54:56.000Z | src/chalky/shortcuts/bg.py | stephen-bunn/chalk | 8bcaaab309cc4f4b5eee019bce08e2765d72cf02 | [
"0BSD"
] | null | null | null | src/chalky/shortcuts/bg.py | stephen-bunn/chalk | 8bcaaab309cc4f4b5eee019bce08e2765d72cf02 | [
"0BSD"
] | null | null | null | # -*- encoding: utf-8 -*-
# Copyright (c) 2020 Stephen Bunn <stephen@bunn.io>
# ISC License <https://choosealicense.com/licenses/isc>
"""Predefined background (bg) chalk colors."""
from ..chalk import Chalk
from ..color import Color
black = Chalk(background=Color.BLACK)
red = Chalk(background=Color.RED)
green = Chalk(background=Color.GREEN)
yellow = Chalk(background=Color.YELLOW)
blue = Chalk(background=Color.BLUE)
magenta = Chalk(background=Color.MAGENTA)
cyan = Chalk(background=Color.CYAN)
white = Chalk(background=Color.WHITE)
bright_black = Chalk(background=Color.BRIGHT_BLACK)
bright_red = Chalk(background=Color.BRIGHT_RED)
bright_green = Chalk(background=Color.BRIGHT_GREEN)
bright_yellow = Chalk(background=Color.BRIGHT_YELLOW)
bright_blue = Chalk(background=Color.BRIGHT_BLUE)
bright_magenta = Chalk(background=Color.MAGENTA)
bright_cyan = Chalk(background=Color.BRIGHT_CYAN)
bright_white = Chalk(background=Color.BRIGHT_WHITE)
| 35.037037 | 55 | 0.789641 | 126 | 946 | 5.809524 | 0.253968 | 0.327869 | 0.437158 | 0.248634 | 0.092896 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00578 | 0.085624 | 946 | 26 | 56 | 36.384615 | 0.840462 | 0.178647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.111111 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7867540febaf01ebf0a1265c880d0e90cd7c9702 | 262 | py | Python | manufacturers/__init__.py | pmaigutyak/mp-shop | 14ea67f71fd91a282d2070414924708214fc6464 | [
"0BSD"
] | 2 | 2018-03-14T11:32:36.000Z | 2021-09-25T14:31:36.000Z | manufacturers/__init__.py | pmaigutyak/mp-shop | 14ea67f71fd91a282d2070414924708214fc6464 | [
"0BSD"
] | null | null | null | manufacturers/__init__.py | pmaigutyak/mp-shop | 14ea67f71fd91a282d2070414924708214fc6464 | [
"0BSD"
] | null | null | null |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class ManufacturersAppConfig(AppConfig):
name = 'manufacturers'
verbose_name = _('Manufacturers')
default_app_config = 'manufacturers.ManufacturersAppConfig'
| 20.153846 | 59 | 0.79771 | 26 | 262 | 7.807692 | 0.692308 | 0.098522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133588 | 262 | 12 | 60 | 21.833333 | 0.894273 | 0 | 0 | 0 | 0 | 0 | 0.237548 | 0.137931 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
78813325f60f46599577965ee7582342a5290dfa | 688 | py | Python | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/pacman/model/abstract_classes/abstract_partitioned_partition_n_keys_map.py | Roboy/LSM_SpiNNaker_MyoArm | 04fa1eaf78778edea3ba3afa4c527d20c491718e | [
"BSD-3-Clause"
] | 2 | 2020-11-01T13:22:11.000Z | 2020-11-01T13:22:20.000Z | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/pacman/model/abstract_classes/abstract_partitioned_partition_n_keys_map.py | Roboy/LSM_SpiNNaker_MyoArm | 04fa1eaf78778edea3ba3afa4c527d20c491718e | [
"BSD-3-Clause"
] | null | null | null | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/pacman/model/abstract_classes/abstract_partitioned_partition_n_keys_map.py | Roboy/LSM_SpiNNaker_MyoArm | 04fa1eaf78778edea3ba3afa4c527d20c491718e | [
"BSD-3-Clause"
] | null | null | null | from abc import ABCMeta
from abc import abstractmethod
from six import add_metaclass
@add_metaclass(ABCMeta)
class AbstractPartitionedPartitionNKeysMap(object):
""" A map that provides the number of keys required by each partition
"""
@abstractmethod
def n_keys_for_partition(self, partition):
""" The number of keys required by the given partition
:param partition: The partition to set the number of keys for
:type partition:\
:py:class:`pacman.utilities.utility_objs.outgoing_edge_partition.OutgoingEdgePartition`
:return: The number of keys required by the partition
:rtype: int
"""
pass
| 31.272727 | 107 | 0.699128 | 83 | 688 | 5.698795 | 0.53012 | 0.07611 | 0.093023 | 0.12685 | 0.171247 | 0.171247 | 0.118393 | 0 | 0 | 0 | 0 | 0 | 0.241279 | 688 | 21 | 108 | 32.761905 | 0.90613 | 0.543605 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.125 | 0.375 | 0 | 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 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
7899c2c86824b17dd02e734e6662974d4d0848d2 | 540 | py | Python | AutoDiff/scalarCalculation/operators/square.py | Phutoast/SimpleAutoDiff | 7fc930266b33887bc9a94130a95746e2e253df92 | [
"MIT"
] | null | null | null | AutoDiff/scalarCalculation/operators/square.py | Phutoast/SimpleAutoDiff | 7fc930266b33887bc9a94130a95746e2e253df92 | [
"MIT"
] | null | null | null | AutoDiff/scalarCalculation/operators/square.py | Phutoast/SimpleAutoDiff | 7fc930266b33887bc9a94130a95746e2e253df92 | [
"MIT"
] | null | null | null | from .scalarOperator import ScalarOperator
class Square(ScalarOperator):
def __init__(self, operation1, name="Square"):
self.operation1 = operation1
self.name = name
def forward(self):
return self.operation1.forward() * self.operation1.forward()
def backward(self, grad):
self.operation1.backward(grad * 2 * self.operation1.forward())
def draw_graph(self, graph):
graph.node(self.name)
self.operation1.draw_graph(graph)
graph.edge(self.operation1.name, self.name)
| 30 | 70 | 0.677778 | 62 | 540 | 5.806452 | 0.306452 | 0.311111 | 0.175 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023419 | 0.209259 | 540 | 17 | 71 | 31.764706 | 0.819672 | 0 | 0 | 0 | 0 | 0 | 0.011111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0.076923 | 0.076923 | 0.538462 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
78a17ba088300d56363f764f87002d32f907b253 | 2,959 | py | Python | atest/testdata/keywords/type_conversion/AnnotationsWithTyping.py | rdagum/robotframework | b7069d505374e9f09a140ed5a9727d2a40716446 | [
"ECL-2.0",
"Apache-2.0"
] | 7,073 | 2015-01-01T17:19:16.000Z | 2022-03-31T22:01:29.000Z | atest/testdata/keywords/type_conversion/AnnotationsWithTyping.py | imust6226/robotframework | 08c56fef2ebc64d682c7f99acd77c480d8d0e028 | [
"ECL-2.0",
"Apache-2.0"
] | 2,412 | 2015-01-02T09:29:05.000Z | 2022-03-31T13:10:46.000Z | atest/testdata/keywords/type_conversion/AnnotationsWithTyping.py | rticau/robotframework | 33ee46dfacd5173c0a38d89c1a60abf6a747c8c0 | [
"ECL-2.0",
"Apache-2.0"
] | 2,298 | 2015-01-03T02:47:15.000Z | 2022-03-31T02:00:16.000Z | from typing import (List, Sequence, MutableSequence,
Dict, Mapping, MutableMapping,
Set, MutableSet)
try:
from typing import TypedDict
except ImportError:
from typing_extensions import TypedDict
from robot.api.deco import not_keyword
TypedDict = not_keyword(TypedDict)
class BadIntMeta(type(int)):
def __instancecheck__(self, instance):
raise TypeError('Bang!')
class BadInt(int, metaclass=BadIntMeta):
pass
def list_(argument: List, expected=None):
_validate_type(argument, expected)
def list_with_params(argument: List[int], expected=None):
_validate_type(argument, expected)
def sequence(argument: Sequence, expected=None):
_validate_type(argument, expected)
def sequence_with_params(argument: Sequence[bool], expected=None):
_validate_type(argument, expected)
def mutable_sequence(argument: MutableSequence, expected=None):
_validate_type(argument, expected)
def mutable_sequence_with_params(argument: MutableSequence[bool], expected=None):
_validate_type(argument, expected)
def dict_(argument: Dict, expected=None):
_validate_type(argument, expected)
def dict_with_params(argument: Dict[str, int], expected=None):
_validate_type(argument, expected)
def typeddict(argument: TypedDict('X', x=int), expected=None):
_validate_type(argument, expected)
def mapping(argument: Mapping, expected=None):
_validate_type(argument, expected)
def mapping_with_params(argument: Mapping[bool, int], expected=None):
_validate_type(argument, expected)
def mutable_mapping(argument: MutableMapping, expected=None):
_validate_type(argument, expected)
def mutable_mapping_with_params(argument: MutableMapping[bool, int], expected=None):
_validate_type(argument, expected)
def set_(argument: Set, expected=None):
_validate_type(argument, expected)
def set_with_params(argument: Set[bool], expected=None):
_validate_type(argument, expected)
def mutable_set(argument: MutableSet, expected=None):
_validate_type(argument, expected)
def mutable_set_with_params(argument: MutableSet[bool], expected=None):
_validate_type(argument, expected)
def none_as_default(argument: List = None, expected=None):
_validate_type(argument, expected)
def forward_reference(argument: 'List', expected=None):
_validate_type(argument, expected)
def forward_ref_with_params(argument: 'List[int]', expected=None):
_validate_type(argument, expected)
def not_liking_isinstance(argument: BadInt, expected=None):
_validate_type(argument, expected)
def _validate_type(argument, expected):
if isinstance(expected, str):
expected = eval(expected)
if argument != expected or type(argument) != type(expected):
raise AssertionError('%r (%s) != %r (%s)'
% (argument, type(argument).__name__,
expected, type(expected).__name__))
| 25.730435 | 84 | 0.73437 | 341 | 2,959 | 6.102639 | 0.173021 | 0.138395 | 0.211437 | 0.296012 | 0.552138 | 0.552138 | 0.552138 | 0.531475 | 0.310908 | 0.065353 | 0 | 0 | 0.163569 | 2,959 | 114 | 85 | 25.95614 | 0.840808 | 0 | 0 | 0.333333 | 0 | 0 | 0.012504 | 0 | 0 | 0 | 0 | 0 | 0.015873 | 1 | 0.365079 | false | 0.015873 | 0.079365 | 0 | 0.47619 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
78a490b28a266580ae2c75229f26507300a4da54 | 268 | py | Python | multicloud_storage/http.py | onXmaps/multicloud-storage | 185828404dd18473a1cc8404766641cdebc63f76 | [
"Apache-2.0"
] | null | null | null | multicloud_storage/http.py | onXmaps/multicloud-storage | 185828404dd18473a1cc8404766641cdebc63f76 | [
"Apache-2.0"
] | null | null | null | multicloud_storage/http.py | onXmaps/multicloud-storage | 185828404dd18473a1cc8404766641cdebc63f76 | [
"Apache-2.0"
] | null | null | null | from enum import Enum
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
class HttpMethod(Enum):
"""HttpMethod is an enum class for HTTP Methods."""
GET: Literal["GET"] = "GET"
PUT: Literal["PUT"] = "PUT"
| 19.142857 | 55 | 0.682836 | 35 | 268 | 5.2 | 0.514286 | 0.10989 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212687 | 268 | 13 | 56 | 20.615385 | 0.862559 | 0.16791 | 0 | 0 | 0 | 0 | 0.0553 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
78bfb00f6a5f20cfee23e5cb918db059b79c18dd | 368 | py | Python | tasks/cyclic-one-time-pad/flask/app/forms.py | HackerDom/qctf-starter-2018 | f4eef0fd41d777661b9fbcc61dcee9709d9f6268 | [
"MIT"
] | 8 | 2018-03-15T12:07:11.000Z | 2020-12-01T15:02:46.000Z | tasks/cyclic-one-time-pad/flask/app/forms.py | HackerDom/qctf-starter-2018 | f4eef0fd41d777661b9fbcc61dcee9709d9f6268 | [
"MIT"
] | 17 | 2020-01-28T22:17:42.000Z | 2022-03-11T23:18:09.000Z | tasks/cyclic-one-time-pad/flask/app/forms.py | HackerDom/qctf-starter-2018 | f4eef0fd41d777661b9fbcc61dcee9709d9f6268 | [
"MIT"
] | 2 | 2018-11-26T18:54:27.000Z | 2018-12-05T17:37:32.000Z | from flask_wtf import FlaskForm
from wtforms import TextField, TextAreaField, RadioField
from wtforms.validators import Required, Length
class EncryptForm(FlaskForm):
data_format = RadioField('data_format', choices=[('plain','Plain'), ('base64', 'Base64')], validators = [Required()])
data = TextAreaField('data', validators = [Required(), Length(max=1000)])
| 46 | 121 | 0.744565 | 40 | 368 | 6.775 | 0.525 | 0.081181 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02454 | 0.11413 | 368 | 7 | 122 | 52.571429 | 0.806748 | 0 | 0 | 0 | 0 | 0 | 0.100543 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
152772444df7d24a3e49977aa55102ebb43fa659 | 73 | py | Python | pytorch/pcdet/ops/voxels/__init__.py | chasingw/pointpillars_pytorch_trt | 941075a23d86991393ea71ddbeb916ca80b73400 | [
"Apache-2.0"
] | 45 | 2021-04-30T04:52:39.000Z | 2022-03-30T07:09:59.000Z | pytorch/pcdet/ops/voxels/__init__.py | chasingw/pointpillars_pytorch_trt | 941075a23d86991393ea71ddbeb916ca80b73400 | [
"Apache-2.0"
] | 17 | 2021-05-27T10:15:32.000Z | 2022-01-15T08:45:53.000Z | pytorch/pcdet/ops/voxels/__init__.py | chasingw/pointpillars_pytorch_trt | 941075a23d86991393ea71ddbeb916ca80b73400 | [
"Apache-2.0"
] | 15 | 2021-05-24T05:43:17.000Z | 2022-03-02T02:53:56.000Z | from .voxel_generator import VoxelGenerator
__all__ = ['VoxelGenerator'] | 24.333333 | 43 | 0.821918 | 7 | 73 | 7.857143 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09589 | 73 | 3 | 44 | 24.333333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0.189189 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
153cfea76b81f2fe18308a321470bb8ddfd5a798 | 91 | py | Python | blackdog/apps.py | UncleGoogle/dafipost | 5e19d6a69dde9b7e5267bbdba680906bdb5e56eb | [
"MIT"
] | null | null | null | blackdog/apps.py | UncleGoogle/dafipost | 5e19d6a69dde9b7e5267bbdba680906bdb5e56eb | [
"MIT"
] | 1 | 2021-02-08T01:44:32.000Z | 2021-02-08T01:44:32.000Z | blackdog/apps.py | UncleGoogle/dafipost | 5e19d6a69dde9b7e5267bbdba680906bdb5e56eb | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class BlackdogConfig(AppConfig):
name = 'blackdog'
| 15.166667 | 33 | 0.758242 | 10 | 91 | 6.9 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164835 | 91 | 5 | 34 | 18.2 | 0.907895 | 0 | 0 | 0 | 0 | 0 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
153ea265d3c3baffa683088f71df173393facf8a | 289 | py | Python | Topics/Methods and attributes/Lightbulb/main.py | the-rennegade/jet-brains-coffee-machine | cd7c395d748e951b2fd9c724a8121d0f076a4633 | [
"MIT"
] | null | null | null | Topics/Methods and attributes/Lightbulb/main.py | the-rennegade/jet-brains-coffee-machine | cd7c395d748e951b2fd9c724a8121d0f076a4633 | [
"MIT"
] | null | null | null | Topics/Methods and attributes/Lightbulb/main.py | the-rennegade/jet-brains-coffee-machine | cd7c395d748e951b2fd9c724a8121d0f076a4633 | [
"MIT"
] | null | null | null | class Lightbulb:
def __init__(self):
self.state = "off"
def change_state(self):
if self.state == "off":
self.state = "on"
print("Turning the light on")
else:
self.state = "off"
print("Turning the light off")
| 24.083333 | 42 | 0.50519 | 33 | 289 | 4.272727 | 0.454545 | 0.255319 | 0.255319 | 0.283688 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.377163 | 289 | 11 | 43 | 26.272727 | 0.783333 | 0 | 0 | 0.2 | 0 | 0 | 0.179931 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.3 | 0.2 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
15526d277b73fe9fa260e9ae08c1595eb57dfb8c | 44,287 | py | Python | global_buffer/design/global_buffer.py | StanfordAHA/garnet | 103424e597af0af258fe6e7e6f966b9f8bb69fe9 | [
"BSD-3-Clause"
] | 56 | 2018-12-15T02:47:57.000Z | 2022-03-25T23:50:40.000Z | global_buffer/design/global_buffer.py | StanfordAHA/garnet | 103424e597af0af258fe6e7e6f966b9f8bb69fe9 | [
"BSD-3-Clause"
] | 525 | 2018-07-27T20:35:54.000Z | 2022-03-28T23:52:20.000Z | global_buffer/design/global_buffer.py | StanfordAHA/garnet | 103424e597af0af258fe6e7e6f966b9f8bb69fe9 | [
"BSD-3-Clause"
] | 11 | 2019-01-26T06:41:10.000Z | 2021-03-28T08:02:26.000Z | from kratos import Generator, always_ff, posedge, always_comb, clock_en, clog2, const, concat
from kratos.util import to_magma
from global_buffer.design.glb_tile import GlbTile
from global_buffer.design.glb_cfg_ifc import GlbConfigInterface
from global_buffer.design.global_buffer_parameter import GlobalBufferParams
from global_buffer.design.glb_header import GlbHeader
from gemstone.generator.from_magma import FromMagma
class GlobalBuffer(Generator):
def __init__(self, _params: GlobalBufferParams):
super().__init__("global_buffer")
self._params = _params
self.header = GlbHeader(self._params)
self.clk = self.clock("clk")
self.stall = self.input("stall", self._params.num_glb_tiles)
self.reset = self.reset("reset")
# TODO: Why cgra_stall has same width as num_glb_tiles
self.cgra_stall_in = self.input(
"cgra_stall_in", self._params.num_glb_tiles)
self.cgra_stall = self.output(
"cgra_stall", 1, size=[self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.proc_wr_en = self.input(
"proc_wr_en", 1)
self.proc_wr_strb = self.input(
"proc_wr_strb", self._params.bank_data_width // 8)
self.proc_wr_addr = self.input(
"proc_wr_addr", self._params.glb_addr_width)
self.proc_wr_data = self.input(
"proc_wr_data", self._params.bank_data_width)
self.proc_rd_en = self.input(
"proc_rd_en", 1)
self.proc_rd_addr = self.input(
"proc_rd_addr", self._params.glb_addr_width)
self.proc_rd_data = self.output(
"proc_rd_data", self._params.bank_data_width)
self.proc_rd_data_valid = self.output(
"proc_rd_data_valid", 1)
self.if_cfg_wr_en = self.input(
"if_cfg_wr_en", 1)
self.if_cfg_wr_addr = self.input(
"if_cfg_wr_addr", self._params.axi_addr_width)
self.if_cfg_wr_data = self.input(
"if_cfg_wr_data", self._params.axi_data_width)
self.if_cfg_rd_en = self.input(
"if_cfg_rd_en", 1)
self.if_cfg_rd_addr = self.input(
"if_cfg_rd_addr", self._params.axi_addr_width)
self.if_cfg_rd_data = self.output(
"if_cfg_rd_data", self._params.axi_data_width)
self.if_cfg_rd_data_valid = self.output(
"if_cfg_rd_data_valid", 1)
self.if_sram_cfg_wr_en = self.input(
"if_sram_cfg_wr_en", 1)
self.if_sram_cfg_wr_addr = self.input(
"if_sram_cfg_wr_addr", self._params.glb_addr_width)
self.if_sram_cfg_wr_data = self.input(
"if_sram_cfg_wr_data", self._params.axi_data_width)
self.if_sram_cfg_rd_en = self.input(
"if_sram_cfg_rd_en", 1)
self.if_sram_cfg_rd_addr = self.input(
"if_sram_cfg_rd_addr", self._params.glb_addr_width)
self.if_sram_cfg_rd_data = self.output(
"if_sram_cfg_rd_data", self._params.axi_data_width)
self.if_sram_cfg_rd_data_valid = self.output(
"if_sram_cfg_rd_data_valid", 1)
self.cgra_cfg_jtag_gc2glb_wr_en = self.input(
"cgra_cfg_jtag_gc2glb_wr_en", 1)
self.cgra_cfg_jtag_gc2glb_rd_en = self.input(
"cgra_cfg_jtag_gc2glb_rd_en", 1)
self.cgra_cfg_jtag_gc2glb_addr = self.input(
"cgra_cfg_jtag_gc2glb_addr", self._params.cgra_cfg_addr_width)
self.cgra_cfg_jtag_gc2glb_data = self.input(
"cgra_cfg_jtag_gc2glb_data", self._params.cgra_cfg_data_width)
self.stream_data_f2g = self.input("stream_data_f2g", self._params.cgra_data_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.stream_data_valid_f2g = self.input("stream_data_valid_f2g", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.stream_data_g2f = self.output("stream_data_g2f", self._params.cgra_data_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.stream_data_valid_g2f = self.output("stream_data_valid_g2f", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.cgra_cfg_g2f_cfg_wr_en = self.output("cgra_cfg_g2f_cfg_wr_en", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.cgra_cfg_g2f_cfg_rd_en = self.output("cgra_cfg_g2f_cfg_rd_en", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.cgra_cfg_g2f_cfg_addr = self.output("cgra_cfg_g2f_cfg_addr", self._params.cgra_cfg_addr_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.cgra_cfg_g2f_cfg_data = self.output("cgra_cfg_g2f_cfg_data", self._params.cgra_cfg_data_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.strm_g2f_start_pulse = self.input("strm_g2f_start_pulse", self._params.num_glb_tiles)
self.strm_f2g_start_pulse = self.input("strm_f2g_start_pulse", self._params.num_glb_tiles)
self.pcfg_start_pulse = self.input("pcfg_start_pulse", self._params.num_glb_tiles)
self.strm_f2g_interrupt_pulse = self.output("strm_f2g_interrupt_pulse", self._params.num_glb_tiles)
self.strm_g2f_interrupt_pulse = self.output("strm_g2f_interrupt_pulse", self._params.num_glb_tiles)
self.pcfg_g2f_interrupt_pulse = self.output("pcfg_g2f_interrupt_pulse", self._params.num_glb_tiles)
# local variables
self.cgra_cfg_jtag_gc2glb_wr_en_d = self.var(
"cgra_cfg_jtag_gc2glb_wr_en_d", 1)
self.cgra_cfg_jtag_gc2glb_rd_en_d = self.var(
"cgra_cfg_jtag_gc2glb_rd_en_d", 1)
self.cgra_cfg_jtag_gc2glb_addr_d = self.var(
"cgra_cfg_jtag_gc2glb_addr_d", self._params.cgra_cfg_addr_width)
self.cgra_cfg_jtag_gc2glb_data_d = self.var(
"cgra_cfg_jtag_gc2glb_data_d", self._params.cgra_cfg_data_width)
self.proc_packet_d = self.var(
"proc_packet_d", self.header.packet_t)
self.proc_packet_e2w_esti = self.var(
"proc_packet_e2w_esti", self.header.packet_t, size=self._params.num_glb_tiles, packed=True)
self.proc_packet_w2e_wsti = self.var(
"proc_packet_w2e_wsti", self.header.packet_t, size=self._params.num_glb_tiles, packed=True)
self.proc_packet_e2w_wsto = self.var(
"proc_packet_e2w_wsto", self.header.packet_t, size=self._params.num_glb_tiles, packed=True)
self.proc_packet_w2e_esto = self.var(
"proc_packet_w2e_esto", self.header.packet_t, size=self._params.num_glb_tiles, packed=True)
self.strm_packet_e2w_esti = self.var(
"strm_packet_e2w_esti", self.header.packet_t, size=self._params.num_glb_tiles, packed=True)
self.strm_packet_w2e_wsti = self.var(
"strm_packet_w2e_wsti", self.header.packet_t, size=self._params.num_glb_tiles, packed=True)
self.strm_packet_e2w_wsto = self.var(
"strm_packet_e2w_wsto", self.header.packet_t, size=self._params.num_glb_tiles, packed=True)
self.strm_packet_w2e_esto = self.var(
"strm_packet_w2e_esto", self.header.packet_t, size=self._params.num_glb_tiles, packed=True)
self.pcfg_packet_e2w_esti = self.var(
"pcfg_packet_e2w_esti", self.header.rd_packet_t, size=self._params.num_glb_tiles, packed=True)
self.pcfg_packet_w2e_wsti = self.var(
"pcfg_packet_w2e_wsti", self.header.rd_packet_t, size=self._params.num_glb_tiles, packed=True)
self.pcfg_packet_e2w_wsto = self.var(
"pcfg_packet_e2w_wsto", self.header.rd_packet_t, size=self._params.num_glb_tiles, packed=True)
self.pcfg_packet_w2e_esto = self.var(
"pcfg_packet_w2e_esto", self.header.rd_packet_t, size=self._params.num_glb_tiles, packed=True)
self.cfg_tile_connected = self.var(
"cfg_tile_connected", self._params.num_glb_tiles + 1)
self.cfg_pcfg_tile_connected = self.var(
"cfg_pcfg_tile_connected", self._params.num_glb_tiles + 1)
self.wire(self.cfg_tile_connected[0], 0)
self.wire(self.cfg_pcfg_tile_connected[0], 0)
self.cgra_cfg_jtag_wsti_wr_en = self.var(
"cgra_cfg_jtag_wsti_wr_en", 1, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_wsti_rd_en = self.var(
"cgra_cfg_jtag_wsti_rd_en", 1, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_wsti_addr = self.var(
"cgra_cfg_jtag_wsti_addr", self._params.cgra_cfg_addr_width, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_wsti_data = self.var(
"cgra_cfg_jtag_wsti_data", self._params.cgra_cfg_data_width, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_esto_wr_en = self.var(
"cgra_cfg_jtag_esto_wr_en", 1, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_esto_rd_en = self.var(
"cgra_cfg_jtag_esto_rd_en", 1, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_esto_addr = self.var(
"cgra_cfg_jtag_esto_addr", self._params.cgra_cfg_addr_width, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_esto_data = self.var(
"cgra_cfg_jtag_esto_data", self._params.cgra_cfg_data_width, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_wsti_rd_en_bypass = self.var("cgra_cfg_jtag_wsti_rd_en_bypass", 1,
size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_wsti_addr_bypass = self.var("cgra_cfg_jtag_wsti_addr_bypass",
self._params.cgra_cfg_addr_width,
size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_esto_rd_en_bypass = self.var("cgra_cfg_jtag_esto_rd_en_bypass", 1,
size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_jtag_esto_addr_bypass = self.var("cgra_cfg_jtag_esto_addr_bypass",
self._params.cgra_cfg_addr_width,
size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_pcfg_wsti_wr_en = self.var(
"cgra_cfg_pcfg_wsti_wr_en", 1, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_pcfg_wsti_rd_en = self.var(
"cgra_cfg_pcfg_wsti_rd_en", 1, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_pcfg_wsti_addr = self.var(
"cgra_cfg_pcfg_wsti_addr", self._params.cgra_cfg_addr_width, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_pcfg_wsti_data = self.var(
"cgra_cfg_pcfg_wsti_data", self._params.cgra_cfg_data_width, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_pcfg_esto_wr_en = self.var(
"cgra_cfg_pcfg_esto_wr_en", 1, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_pcfg_esto_rd_en = self.var(
"cgra_cfg_pcfg_esto_rd_en", 1, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_pcfg_esto_addr = self.var(
"cgra_cfg_pcfg_esto_addr", self._params.cgra_cfg_addr_width, size=self._params.num_glb_tiles, packed=True)
self.cgra_cfg_pcfg_esto_data = self.var(
"cgra_cfg_pcfg_esto_data", self._params.cgra_cfg_data_width, size=self._params.num_glb_tiles, packed=True)
self.stall_w = self.var("stall_w", self._params.num_glb_tiles)
self.stall_d = self.var("stall_d", self._params.num_glb_tiles)
self.wire(self.stall_w, self.stall)
self.cgra_stall_in_w = self.var(
"cgra_stall_in_w", self._params.num_glb_tiles)
self.cgra_stall_in_d = self.var(
"cgra_stall_in_d", self._params.num_glb_tiles)
self.wire(self.cgra_stall_in_w, self.cgra_stall_in)
for i in range(self._params.num_glb_tiles):
self.wire(self.cgra_stall[i], concat(
*[self.cgra_stall_in_d[i]] * self._params.cgra_per_glb))
self.strm_g2f_start_pulse_w = self.var("strm_g2f_start_pulse_w", self._params.num_glb_tiles)
self.strm_g2f_start_pulse_d = self.var("strm_g2f_start_pulse_d", self._params.num_glb_tiles)
self.wire(self.strm_g2f_start_pulse, self.strm_g2f_start_pulse_w)
self.strm_f2g_start_pulse_w = self.var("strm_f2g_start_pulse_w", self._params.num_glb_tiles)
self.strm_f2g_start_pulse_d = self.var("strm_f2g_start_pulse_d", self._params.num_glb_tiles)
self.wire(self.strm_f2g_start_pulse, self.strm_f2g_start_pulse_w)
self.pcfg_start_pulse_w = self.var("pcfg_start_pulse_w", self._params.num_glb_tiles)
self.pcfg_start_pulse_d = self.var("pcfg_start_pulse_d", self._params.num_glb_tiles)
self.wire(self.pcfg_start_pulse, self.pcfg_start_pulse_w)
self.strm_f2g_interrupt_pulse_w = self.var("strm_f2g_interrupt_pulse_w", self._params.num_glb_tiles)
self.strm_f2g_interrupt_pulse_d = self.var("strm_f2g_interrupt_pulse_d", self._params.num_glb_tiles)
self.wire(self.strm_f2g_interrupt_pulse_d, self.strm_f2g_interrupt_pulse)
self.strm_g2f_interrupt_pulse_w = self.var("strm_g2f_interrupt_pulse_w", self._params.num_glb_tiles)
self.strm_g2f_interrupt_pulse_d = self.var("strm_g2f_interrupt_pulse_d", self._params.num_glb_tiles)
self.wire(self.strm_g2f_interrupt_pulse_d, self.strm_g2f_interrupt_pulse)
self.pcfg_g2f_interrupt_pulse_w = self.var("pcfg_g2f_interrupt_pulse_w", self._params.num_glb_tiles)
self.pcfg_g2f_interrupt_pulse_d = self.var("pcfg_g2f_interrupt_pulse_d", self._params.num_glb_tiles)
self.wire(self.pcfg_g2f_interrupt_pulse_d, self.pcfg_g2f_interrupt_pulse)
self.cgra_cfg_g2f_cfg_wr_en_w = self.var("cgra_cfg_g2f_cfg_wr_en_w", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.cgra_cfg_g2f_cfg_wr_en_d = self.var("cgra_cfg_g2f_cfg_wr_en_d", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.wire(self.cgra_cfg_g2f_cfg_wr_en_d, self.cgra_cfg_g2f_cfg_wr_en)
self.cgra_cfg_g2f_cfg_rd_en_w = self.var("cgra_cfg_g2f_cfg_rd_en_w", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.cgra_cfg_g2f_cfg_rd_en_d = self.var("cgra_cfg_g2f_cfg_rd_en_d", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.wire(self.cgra_cfg_g2f_cfg_rd_en_d, self.cgra_cfg_g2f_cfg_rd_en)
self.cgra_cfg_g2f_cfg_addr_w = self.var("cgra_cfg_g2f_cfg_addr_w", self._params.cgra_cfg_addr_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.cgra_cfg_g2f_cfg_addr_d = self.var("cgra_cfg_g2f_cfg_addr_d", self._params.cgra_cfg_addr_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.wire(self.cgra_cfg_g2f_cfg_addr_d, self.cgra_cfg_g2f_cfg_addr)
self.cgra_cfg_g2f_cfg_data_w = self.var("cgra_cfg_g2f_cfg_data_w", self._params.cgra_cfg_data_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.cgra_cfg_g2f_cfg_data_d = self.var("cgra_cfg_g2f_cfg_data_d", self._params.cgra_cfg_data_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.wire(self.cgra_cfg_g2f_cfg_data_d, self.cgra_cfg_g2f_cfg_data)
self.stream_data_f2g_w = self.var("stream_data_f2g_w", self._params.cgra_data_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.stream_data_f2g_d = self.var("stream_data_f2g_d", self._params.cgra_data_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.wire(self.stream_data_f2g, self.stream_data_f2g_w)
self.stream_data_valid_f2g_w = self.var("stream_data_valid_f2g_w", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.stream_data_valid_f2g_d = self.var("stream_data_valid_f2g_d", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.wire(self.stream_data_valid_f2g, self.stream_data_valid_f2g_w)
self.stream_data_g2f_w = self.var("stream_data_g2f_w", self._params.cgra_data_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.stream_data_g2f_d = self.var("stream_data_g2f_d", self._params.cgra_data_width, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.wire(self.stream_data_g2f_d, self.stream_data_g2f)
self.stream_data_valid_g2f_w = self.var("stream_data_valid_g2f_w", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.stream_data_valid_g2f_d = self.var("stream_data_valid_g2f_d", 1, size=[
self._params.num_glb_tiles, self._params.cgra_per_glb], packed=True)
self.wire(self.stream_data_valid_g2f_d, self.stream_data_valid_g2f)
# interface
if_cfg_tile2tile = GlbConfigInterface(
addr_width=self._params.axi_addr_width, data_width=self._params.axi_data_width)
if_sram_cfg_tile2tile = GlbConfigInterface(
addr_width=self._params.glb_addr_width, data_width=self._params.axi_data_width)
self.if_cfg_list = []
self.if_sram_cfg_list = []
for i in range(self._params.num_glb_tiles + 1):
self.if_cfg_list.append(self.interface(
if_cfg_tile2tile, f"if_cfg_tile2tile_{i}"))
self.if_sram_cfg_list.append(self.interface(
if_sram_cfg_tile2tile, f"if_sram_cfg_tile2tile_{i}"))
self.glb_tile = []
for i in range(self._params.num_glb_tiles):
self.glb_tile.append(GlbTile(_params=self._params))
self.wire(self.if_cfg_list[-1].rd_data, 0)
self.wire(self.if_cfg_list[-1].rd_data_valid, 0)
self.wire(self.if_sram_cfg_list[-1].rd_data, 0)
self.wire(self.if_sram_cfg_list[-1].rd_data_valid, 0)
self.add_glb_tile()
self.add_always(self.left_edge_proc_ff)
self.add_always(self.left_edge_cfg_ff)
self.add_always(self.left_edge_sram_cfg_ff)
self.add_always(self.left_edge_cgra_cfg_ff)
self.tile2tile_e2w_wiring()
self.tile2tile_w2e_wiring()
self.add_always(self.tile2tile_w2e_cfg_wiring)
self.add_always(self.interrupt_pipeline)
self.add_always(self.start_pulse_pipeline)
self.add_always(self.stall_pipeline)
self.add_always(self.stream_data_pipeline)
self.add_always(self.cgra_cfg_pcfg_pipeline)
@always_ff((posedge, "clk"), (posedge, "reset"))
def left_edge_proc_ff(self):
if self.reset:
self.proc_packet_d['wr_en'] = 0
self.proc_packet_d['wr_strb'] = 0
self.proc_packet_d['wr_addr'] = 0
self.proc_packet_d['wr_data'] = 0
self.proc_packet_d['rd_en'] = 0
self.proc_packet_d['rd_addr'] = 0
self.proc_packet_d['rd_data'] = 0
self.proc_packet_d['rd_data_valid'] = 0
self.proc_rd_data = 0
self.proc_rd_data_valid = 0
else:
self.proc_packet_d['wr_en'] = self.proc_wr_en
self.proc_packet_d['wr_strb'] = self.proc_wr_strb
self.proc_packet_d['wr_addr'] = self.proc_wr_addr
self.proc_packet_d['wr_data'] = self.proc_wr_data
self.proc_packet_d['rd_en'] = self.proc_rd_en
self.proc_packet_d['rd_addr'] = self.proc_rd_addr
self.proc_packet_d['rd_data'] = 0
self.proc_packet_d['rd_data_valid'] = 0
self.proc_rd_data = self.proc_packet_e2w_wsto[0]['rd_data']
self.proc_rd_data_valid = self.proc_packet_e2w_wsto[0]['rd_data_valid']
@always_ff((posedge, "clk"), (posedge, "reset"))
def left_edge_cfg_ff(self):
if self.reset:
self.if_cfg_list[0].wr_en = 0
self.if_cfg_list[0].wr_addr = 0
self.if_cfg_list[0].wr_data = 0
self.if_cfg_list[0].rd_en = 0
self.if_cfg_list[0].rd_addr = 0
self.if_cfg_rd_data = 0
self.if_cfg_rd_data_valid = 0
else:
self.if_cfg_list[0].wr_en = self.if_cfg_wr_en
self.if_cfg_list[0].wr_addr = self.if_cfg_wr_addr
self.if_cfg_list[0].wr_data = self.if_cfg_wr_data
self.if_cfg_list[0].rd_en = self.if_cfg_rd_en
self.if_cfg_list[0].rd_addr = self.if_cfg_rd_addr
self.if_cfg_rd_data = self.if_cfg_list[0].rd_data
self.if_cfg_rd_data_valid = self.if_cfg_list[0].rd_data_valid
@always_ff((posedge, "clk"), (posedge, "reset"))
def left_edge_sram_cfg_ff(self):
if self.reset:
self.if_sram_cfg_list[0].wr_en = 0
self.if_sram_cfg_list[0].wr_addr = 0
self.if_sram_cfg_list[0].wr_data = 0
self.if_sram_cfg_list[0].rd_en = 0
self.if_sram_cfg_list[0].rd_addr = 0
self.if_sram_cfg_rd_data = 0
self.if_sram_cfg_rd_data_valid = 0
else:
self.if_sram_cfg_list[0].wr_en = self.if_sram_cfg_wr_en
self.if_sram_cfg_list[0].wr_addr = self.if_sram_cfg_wr_addr
self.if_sram_cfg_list[0].wr_data = self.if_sram_cfg_wr_data
self.if_sram_cfg_list[0].rd_en = self.if_sram_cfg_rd_en
self.if_sram_cfg_list[0].rd_addr = self.if_sram_cfg_rd_addr
self.if_sram_cfg_rd_data = self.if_sram_cfg_list[0].rd_data
self.if_sram_cfg_rd_data_valid = self.if_sram_cfg_list[0].rd_data_valid
@always_ff((posedge, "clk"), (posedge, "reset"))
def left_edge_cgra_cfg_ff(self):
if self.reset:
self.cgra_cfg_jtag_gc2glb_wr_en_d = 0
self.cgra_cfg_jtag_gc2glb_rd_en_d = 0
self.cgra_cfg_jtag_gc2glb_addr_d = 0
self.cgra_cfg_jtag_gc2glb_data_d = 0
else:
self.cgra_cfg_jtag_gc2glb_wr_en_d = self.cgra_cfg_jtag_gc2glb_wr_en
self.cgra_cfg_jtag_gc2glb_rd_en_d = self.cgra_cfg_jtag_gc2glb_rd_en
self.cgra_cfg_jtag_gc2glb_addr_d = self.cgra_cfg_jtag_gc2glb_addr
self.cgra_cfg_jtag_gc2glb_data_d = self.cgra_cfg_jtag_gc2glb_data
def tile2tile_e2w_wiring(self):
self.wire(self.proc_packet_e2w_esti[self._params.num_glb_tiles - 1],
self.proc_packet_w2e_esto[self._params.num_glb_tiles - 1])
self.wire(self.strm_packet_e2w_esti[self._params.num_glb_tiles - 1], 0)
self.wire(self.pcfg_packet_e2w_esti[self._params.num_glb_tiles - 1], 0)
for i in range(self._params.num_glb_tiles - 1):
self.wire(self.proc_packet_e2w_esti[i],
self.proc_packet_e2w_wsto[i + 1])
self.wire(self.strm_packet_e2w_esti[i],
self.strm_packet_e2w_wsto[i + 1])
self.wire(self.pcfg_packet_e2w_esti[i],
self.pcfg_packet_e2w_wsto[i + 1])
def tile2tile_w2e_wiring(self):
self.wire(self.proc_packet_w2e_wsti[0], self.proc_packet_d)
self.wire(self.strm_packet_w2e_wsti[0], 0)
self.wire(self.pcfg_packet_w2e_wsti[0], 0)
for i in range(1, self._params.num_glb_tiles):
self.wire(self.proc_packet_w2e_wsti[const(i, clog2(self._params.num_glb_tiles))],
self.proc_packet_w2e_esto[const((i - 1), clog2(self._params.num_glb_tiles))])
self.wire(self.strm_packet_w2e_wsti[const(i, clog2(self._params.num_glb_tiles))],
self.strm_packet_w2e_esto[const((i - 1), clog2(self._params.num_glb_tiles))])
self.wire(self.pcfg_packet_w2e_wsti[const(i, clog2(self._params.num_glb_tiles))],
self.pcfg_packet_w2e_esto[const((i - 1), clog2(self._params.num_glb_tiles))])
@always_comb
def tile2tile_w2e_cfg_wiring(self):
for i in range(0, self._params.num_glb_tiles):
if i == 0:
self.cgra_cfg_jtag_wsti_rd_en[i] = 0
self.cgra_cfg_jtag_wsti_wr_en[i] = self.cgra_cfg_jtag_gc2glb_wr_en_d
self.cgra_cfg_jtag_wsti_addr[i] = self.cgra_cfg_jtag_gc2glb_addr_d
self.cgra_cfg_jtag_wsti_data[i] = self.cgra_cfg_jtag_gc2glb_data_d
self.cgra_cfg_jtag_wsti_rd_en_bypass[i] = self.cgra_cfg_jtag_gc2glb_rd_en_d
self.cgra_cfg_jtag_wsti_addr_bypass[i] = self.cgra_cfg_jtag_gc2glb_addr_d
self.cgra_cfg_pcfg_wsti_rd_en[i] = 0
self.cgra_cfg_pcfg_wsti_wr_en[i] = 0
self.cgra_cfg_pcfg_wsti_addr[i] = 0
self.cgra_cfg_pcfg_wsti_data[i] = 0
else:
self.cgra_cfg_jtag_wsti_rd_en[i] = self.cgra_cfg_jtag_esto_rd_en[i - 1]
self.cgra_cfg_jtag_wsti_wr_en[i] = self.cgra_cfg_jtag_esto_wr_en[i - 1]
self.cgra_cfg_jtag_wsti_addr[i] = self.cgra_cfg_jtag_esto_addr[i - 1]
self.cgra_cfg_jtag_wsti_data[i] = self.cgra_cfg_jtag_esto_data[i - 1]
self.cgra_cfg_jtag_wsti_rd_en_bypass[i] = self.cgra_cfg_jtag_esto_rd_en_bypass[i - 1]
self.cgra_cfg_jtag_wsti_addr_bypass[i] = self.cgra_cfg_jtag_esto_addr_bypass[i - 1]
self.cgra_cfg_pcfg_wsti_rd_en[i] = self.cgra_cfg_pcfg_esto_rd_en[i - 1]
self.cgra_cfg_pcfg_wsti_wr_en[i] = self.cgra_cfg_pcfg_esto_wr_en[i - 1]
self.cgra_cfg_pcfg_wsti_addr[i] = self.cgra_cfg_pcfg_esto_addr[i - 1]
self.cgra_cfg_pcfg_wsti_data[i] = self.cgra_cfg_pcfg_esto_data[i - 1]
def add_glb_tile(self):
for i in range(self._params.num_glb_tiles):
self.add_child(f"glb_tile_gen_{i}",
self.glb_tile[i],
clk=self.clk,
clk_en=clock_en(~self.stall_d[i]),
reset=self.reset,
glb_tile_id=i,
proc_wr_en_e2w_esti=self.proc_packet_e2w_esti[i]['wr_en'],
proc_wr_strb_e2w_esti=self.proc_packet_e2w_esti[i]['wr_strb'],
proc_wr_addr_e2w_esti=self.proc_packet_e2w_esti[i]['wr_addr'],
proc_wr_data_e2w_esti=self.proc_packet_e2w_esti[i]['wr_data'],
proc_rd_en_e2w_esti=self.proc_packet_e2w_esti[i]['rd_en'],
proc_rd_addr_e2w_esti=self.proc_packet_e2w_esti[i]['rd_addr'],
proc_rd_data_e2w_esti=self.proc_packet_e2w_esti[i]['rd_data'],
proc_rd_data_valid_e2w_esti=self.proc_packet_e2w_esti[
i]['rd_data_valid'],
proc_wr_en_w2e_esto=self.proc_packet_w2e_esto[i]['wr_en'],
proc_wr_strb_w2e_esto=self.proc_packet_w2e_esto[i]['wr_strb'],
proc_wr_addr_w2e_esto=self.proc_packet_w2e_esto[i]['wr_addr'],
proc_wr_data_w2e_esto=self.proc_packet_w2e_esto[i]['wr_data'],
proc_rd_en_w2e_esto=self.proc_packet_w2e_esto[i]['rd_en'],
proc_rd_addr_w2e_esto=self.proc_packet_w2e_esto[i]['rd_addr'],
proc_rd_data_w2e_esto=self.proc_packet_w2e_esto[i]['rd_data'],
proc_rd_data_valid_w2e_esto=self.proc_packet_w2e_esto[
i]['rd_data_valid'],
proc_wr_en_w2e_wsti=self.proc_packet_w2e_wsti[i]['wr_en'],
proc_wr_strb_w2e_wsti=self.proc_packet_w2e_wsti[i]['wr_strb'],
proc_wr_addr_w2e_wsti=self.proc_packet_w2e_wsti[i]['wr_addr'],
proc_wr_data_w2e_wsti=self.proc_packet_w2e_wsti[i]['wr_data'],
proc_rd_en_w2e_wsti=self.proc_packet_w2e_wsti[i]['rd_en'],
proc_rd_addr_w2e_wsti=self.proc_packet_w2e_wsti[i]['rd_addr'],
proc_rd_data_w2e_wsti=self.proc_packet_w2e_wsti[i]['rd_data'],
proc_rd_data_valid_w2e_wsti=self.proc_packet_w2e_wsti[
i]['rd_data_valid'],
proc_wr_en_e2w_wsto=self.proc_packet_e2w_wsto[i]['wr_en'],
proc_wr_strb_e2w_wsto=self.proc_packet_e2w_wsto[i]['wr_strb'],
proc_wr_addr_e2w_wsto=self.proc_packet_e2w_wsto[i]['wr_addr'],
proc_wr_data_e2w_wsto=self.proc_packet_e2w_wsto[i]['wr_data'],
proc_rd_en_e2w_wsto=self.proc_packet_e2w_wsto[i]['rd_en'],
proc_rd_addr_e2w_wsto=self.proc_packet_e2w_wsto[i]['rd_addr'],
proc_rd_data_e2w_wsto=self.proc_packet_e2w_wsto[i]['rd_data'],
proc_rd_data_valid_e2w_wsto=self.proc_packet_e2w_wsto[
i]['rd_data_valid'],
strm_wr_en_e2w_esti=self.strm_packet_e2w_esti[i]['wr_en'],
strm_wr_strb_e2w_esti=self.strm_packet_e2w_esti[i]['wr_strb'],
strm_wr_addr_e2w_esti=self.strm_packet_e2w_esti[i]['wr_addr'],
strm_wr_data_e2w_esti=self.strm_packet_e2w_esti[i]['wr_data'],
strm_rd_en_e2w_esti=self.strm_packet_e2w_esti[i]['rd_en'],
strm_rd_addr_e2w_esti=self.strm_packet_e2w_esti[i]['rd_addr'],
strm_rd_data_e2w_esti=self.strm_packet_e2w_esti[i]['rd_data'],
strm_rd_data_valid_e2w_esti=self.strm_packet_e2w_esti[
i]['rd_data_valid'],
strm_wr_en_w2e_esto=self.strm_packet_w2e_esto[i]['wr_en'],
strm_wr_strb_w2e_esto=self.strm_packet_w2e_esto[i]['wr_strb'],
strm_wr_addr_w2e_esto=self.strm_packet_w2e_esto[i]['wr_addr'],
strm_wr_data_w2e_esto=self.strm_packet_w2e_esto[i]['wr_data'],
strm_rd_en_w2e_esto=self.strm_packet_w2e_esto[i]['rd_en'],
strm_rd_addr_w2e_esto=self.strm_packet_w2e_esto[i]['rd_addr'],
strm_rd_data_w2e_esto=self.strm_packet_w2e_esto[i]['rd_data'],
strm_rd_data_valid_w2e_esto=self.strm_packet_w2e_esto[
i]['rd_data_valid'],
strm_wr_en_w2e_wsti=self.strm_packet_w2e_wsti[i]['wr_en'],
strm_wr_strb_w2e_wsti=self.strm_packet_w2e_wsti[i]['wr_strb'],
strm_wr_addr_w2e_wsti=self.strm_packet_w2e_wsti[i]['wr_addr'],
strm_wr_data_w2e_wsti=self.strm_packet_w2e_wsti[i]['wr_data'],
strm_rd_en_w2e_wsti=self.strm_packet_w2e_wsti[i]['rd_en'],
strm_rd_addr_w2e_wsti=self.strm_packet_w2e_wsti[i]['rd_addr'],
strm_rd_data_w2e_wsti=self.strm_packet_w2e_wsti[i]['rd_data'],
strm_rd_data_valid_w2e_wsti=self.strm_packet_w2e_wsti[
i]['rd_data_valid'],
strm_wr_en_e2w_wsto=self.strm_packet_e2w_wsto[i]['wr_en'],
strm_wr_strb_e2w_wsto=self.strm_packet_e2w_wsto[i]['wr_strb'],
strm_wr_addr_e2w_wsto=self.strm_packet_e2w_wsto[i]['wr_addr'],
strm_wr_data_e2w_wsto=self.strm_packet_e2w_wsto[i]['wr_data'],
strm_rd_en_e2w_wsto=self.strm_packet_e2w_wsto[i]['rd_en'],
strm_rd_addr_e2w_wsto=self.strm_packet_e2w_wsto[i]['rd_addr'],
strm_rd_data_e2w_wsto=self.strm_packet_e2w_wsto[i]['rd_data'],
strm_rd_data_valid_e2w_wsto=self.strm_packet_e2w_wsto[
i]['rd_data_valid'],
pcfg_rd_en_e2w_esti=self.pcfg_packet_e2w_esti[i]['rd_en'],
pcfg_rd_addr_e2w_esti=self.pcfg_packet_e2w_esti[i]['rd_addr'],
pcfg_rd_data_e2w_esti=self.pcfg_packet_e2w_esti[i]['rd_data'],
pcfg_rd_data_valid_e2w_esti=self.pcfg_packet_e2w_esti[
i]['rd_data_valid'],
pcfg_rd_en_w2e_esto=self.pcfg_packet_w2e_esto[i]['rd_en'],
pcfg_rd_addr_w2e_esto=self.pcfg_packet_w2e_esto[i]['rd_addr'],
pcfg_rd_data_w2e_esto=self.pcfg_packet_w2e_esto[i]['rd_data'],
pcfg_rd_data_valid_w2e_esto=self.pcfg_packet_w2e_esto[
i]['rd_data_valid'],
pcfg_rd_en_w2e_wsti=self.pcfg_packet_w2e_wsti[i]['rd_en'],
pcfg_rd_addr_w2e_wsti=self.pcfg_packet_w2e_wsti[i]['rd_addr'],
pcfg_rd_data_w2e_wsti=self.pcfg_packet_w2e_wsti[i]['rd_data'],
pcfg_rd_data_valid_w2e_wsti=self.pcfg_packet_w2e_wsti[
i]['rd_data_valid'],
pcfg_rd_en_e2w_wsto=self.pcfg_packet_e2w_wsto[i]['rd_en'],
pcfg_rd_addr_e2w_wsto=self.pcfg_packet_e2w_wsto[i]['rd_addr'],
pcfg_rd_data_e2w_wsto=self.pcfg_packet_e2w_wsto[i]['rd_data'],
pcfg_rd_data_valid_e2w_wsto=self.pcfg_packet_e2w_wsto[
i]['rd_data_valid'],
if_cfg_est_m_wr_en=self.if_cfg_list[i + 1].wr_en,
if_cfg_est_m_wr_addr=self.if_cfg_list[i + 1].wr_addr,
if_cfg_est_m_wr_data=self.if_cfg_list[i + 1].wr_data,
if_cfg_est_m_rd_en=self.if_cfg_list[i + 1].rd_en,
if_cfg_est_m_rd_addr=self.if_cfg_list[i + 1].rd_addr,
if_cfg_est_m_rd_data=self.if_cfg_list[i + 1].rd_data,
if_cfg_est_m_rd_data_valid=self.if_cfg_list[i
+ 1].rd_data_valid,
if_cfg_wst_s_wr_en=self.if_cfg_list[i].wr_en,
if_cfg_wst_s_wr_addr=self.if_cfg_list[i].wr_addr,
if_cfg_wst_s_wr_data=self.if_cfg_list[i].wr_data,
if_cfg_wst_s_rd_en=self.if_cfg_list[i].rd_en,
if_cfg_wst_s_rd_addr=self.if_cfg_list[i].rd_addr,
if_cfg_wst_s_rd_data=self.if_cfg_list[i].rd_data,
if_cfg_wst_s_rd_data_valid=self.if_cfg_list[i].rd_data_valid,
if_sram_cfg_est_m_wr_en=self.if_sram_cfg_list[i + 1].wr_en,
if_sram_cfg_est_m_wr_addr=self.if_sram_cfg_list[i + 1].wr_addr,
if_sram_cfg_est_m_wr_data=self.if_sram_cfg_list[i + 1].wr_data,
if_sram_cfg_est_m_rd_en=self.if_sram_cfg_list[i + 1].rd_en,
if_sram_cfg_est_m_rd_addr=self.if_sram_cfg_list[i + 1].rd_addr,
if_sram_cfg_est_m_rd_data=self.if_sram_cfg_list[i + 1].rd_data,
if_sram_cfg_est_m_rd_data_valid=self.if_sram_cfg_list[
i + 1].rd_data_valid,
if_sram_cfg_wst_s_wr_en=self.if_sram_cfg_list[i].wr_en,
if_sram_cfg_wst_s_wr_addr=self.if_sram_cfg_list[i].wr_addr,
if_sram_cfg_wst_s_wr_data=self.if_sram_cfg_list[i].wr_data,
if_sram_cfg_wst_s_rd_en=self.if_sram_cfg_list[i].rd_en,
if_sram_cfg_wst_s_rd_addr=self.if_sram_cfg_list[i].rd_addr,
if_sram_cfg_wst_s_rd_data=self.if_sram_cfg_list[i].rd_data,
if_sram_cfg_wst_s_rd_data_valid=self.if_sram_cfg_list[
i].rd_data_valid,
cfg_tile_connected_wsti=self.cfg_tile_connected[i],
cfg_tile_connected_esto=self.cfg_tile_connected[i + 1],
cfg_pcfg_tile_connected_wsti=self.cfg_pcfg_tile_connected[i],
cfg_pcfg_tile_connected_esto=self.cfg_pcfg_tile_connected[i + 1],
stream_data_f2g=self.stream_data_f2g_d[i],
stream_data_valid_f2g=self.stream_data_valid_f2g_d[i],
stream_data_g2f=self.stream_data_g2f_w[i],
stream_data_valid_g2f=self.stream_data_valid_g2f_w[i],
cgra_cfg_g2f_cfg_wr_en=self.cgra_cfg_g2f_cfg_wr_en_w[i],
cgra_cfg_g2f_cfg_rd_en=self.cgra_cfg_g2f_cfg_rd_en_w[i],
cgra_cfg_g2f_cfg_addr=self.cgra_cfg_g2f_cfg_addr_w[i],
cgra_cfg_g2f_cfg_data=self.cgra_cfg_g2f_cfg_data_w[i],
cgra_cfg_pcfg_wsti_wr_en=self.cgra_cfg_pcfg_wsti_wr_en[i],
cgra_cfg_pcfg_wsti_rd_en=self.cgra_cfg_pcfg_wsti_rd_en[i],
cgra_cfg_pcfg_wsti_addr=self.cgra_cfg_pcfg_wsti_addr[i],
cgra_cfg_pcfg_wsti_data=self.cgra_cfg_pcfg_wsti_data[i],
cgra_cfg_pcfg_esto_wr_en=self.cgra_cfg_pcfg_esto_wr_en[i],
cgra_cfg_pcfg_esto_rd_en=self.cgra_cfg_pcfg_esto_rd_en[i],
cgra_cfg_pcfg_esto_addr=self.cgra_cfg_pcfg_esto_addr[i],
cgra_cfg_pcfg_esto_data=self.cgra_cfg_pcfg_esto_data[i],
cgra_cfg_jtag_wsti_wr_en=self.cgra_cfg_jtag_wsti_wr_en[i],
cgra_cfg_jtag_wsti_rd_en=self.cgra_cfg_jtag_wsti_rd_en[i],
cgra_cfg_jtag_wsti_addr=self.cgra_cfg_jtag_wsti_addr[i],
cgra_cfg_jtag_wsti_data=self.cgra_cfg_jtag_wsti_data[i],
cgra_cfg_jtag_esto_wr_en=self.cgra_cfg_jtag_esto_wr_en[i],
cgra_cfg_jtag_esto_rd_en=self.cgra_cfg_jtag_esto_rd_en[i],
cgra_cfg_jtag_esto_addr=self.cgra_cfg_jtag_esto_addr[i],
cgra_cfg_jtag_esto_data=self.cgra_cfg_jtag_esto_data[i],
cgra_cfg_jtag_wsti_rd_en_bypass=self.cgra_cfg_jtag_wsti_rd_en_bypass[
i],
cgra_cfg_jtag_wsti_addr_bypass=self.cgra_cfg_jtag_wsti_addr_bypass[
i],
cgra_cfg_jtag_esto_rd_en_bypass=self.cgra_cfg_jtag_esto_rd_en_bypass[
i],
cgra_cfg_jtag_esto_addr_bypass=self.cgra_cfg_jtag_esto_addr_bypass[
i],
strm_g2f_start_pulse=self.strm_g2f_start_pulse_d[i],
strm_f2g_start_pulse=self.strm_f2g_start_pulse_d[i],
pcfg_start_pulse=self.pcfg_start_pulse_d[i],
strm_f2g_interrupt_pulse=self.strm_f2g_interrupt_pulse_w[i],
strm_g2f_interrupt_pulse=self.strm_g2f_interrupt_pulse_w[i],
pcfg_g2f_interrupt_pulse=self.pcfg_g2f_interrupt_pulse_w[i])
@always_ff((posedge, "clk"), (posedge, "reset"))
def interrupt_pipeline(self):
if self.reset:
for i in range(self._params.num_glb_tiles):
self.strm_f2g_interrupt_pulse_d[i] = 0
self.strm_g2f_interrupt_pulse_d[i] = 0
self.pcfg_g2f_interrupt_pulse_d[i] = 0
else:
for i in range(self._params.num_glb_tiles):
self.strm_f2g_interrupt_pulse_d[i] = self.strm_f2g_interrupt_pulse_w[i]
self.strm_g2f_interrupt_pulse_d[i] = self.strm_g2f_interrupt_pulse_w[i]
self.pcfg_g2f_interrupt_pulse_d[i] = self.pcfg_g2f_interrupt_pulse_w[i]
@always_ff((posedge, "clk"), (posedge, "reset"))
def start_pulse_pipeline(self):
if self.reset:
for i in range(self._params.num_glb_tiles):
self.strm_g2f_start_pulse_d[i] = 0
self.strm_f2g_start_pulse_d[i] = 0
self.pcfg_start_pulse_d[i] = 0
else:
for i in range(self._params.num_glb_tiles):
self.strm_g2f_start_pulse_d[i] = self.strm_g2f_start_pulse_w[i]
self.strm_f2g_start_pulse_d[i] = self.strm_f2g_start_pulse_w[i]
self.pcfg_start_pulse_d[i] = self.pcfg_start_pulse_w[i]
@always_ff((posedge, "clk"), (posedge, "reset"))
def stall_pipeline(self):
if self.reset:
for i in range(self._params.num_glb_tiles):
self.stall_d[i] = 0
self.cgra_stall_in_d[i] = 0
else:
for i in range(self._params.num_glb_tiles):
self.stall_d[i] = self.stall_w[i]
self.cgra_stall_in_d[i] = self.cgra_stall_in_w[i]
@always_ff((posedge, "clk"), (posedge, "reset"))
def stream_data_pipeline(self):
if self.reset:
for i in range(self._params.num_glb_tiles):
self.stream_data_g2f_d[i] = 0
self.stream_data_valid_g2f_d[i] = 0
self.stream_data_f2g_d[i] = 0
self.stream_data_valid_f2g_d[i] = 0
else:
for i in range(self._params.num_glb_tiles):
self.stream_data_g2f_d[i] = self.stream_data_g2f_w[i]
self.stream_data_valid_g2f_d[i] = self.stream_data_valid_g2f_w[i]
self.stream_data_f2g_d[i] = self.stream_data_f2g_w[i]
self.stream_data_valid_f2g_d[i] = self.stream_data_valid_f2g_w[i]
@always_ff((posedge, "clk"), (posedge, "reset"))
def cgra_cfg_pcfg_pipeline(self):
if self.reset:
for i in range(self._params.num_glb_tiles):
self.cgra_cfg_g2f_cfg_wr_en_d[i] = 0
self.cgra_cfg_g2f_cfg_rd_en_d[i] = 0
self.cgra_cfg_g2f_cfg_addr_d[i] = 0
self.cgra_cfg_g2f_cfg_data_d[i] = 0
else:
for i in range(self._params.num_glb_tiles):
self.cgra_cfg_g2f_cfg_wr_en_d[i] = self.cgra_cfg_g2f_cfg_wr_en_w[i]
self.cgra_cfg_g2f_cfg_rd_en_d[i] = self.cgra_cfg_g2f_cfg_rd_en_w[i]
self.cgra_cfg_g2f_cfg_addr_d[i] = self.cgra_cfg_g2f_cfg_addr_w[i]
self.cgra_cfg_g2f_cfg_data_d[i] = self.cgra_cfg_g2f_cfg_data_w[i]
def GlobalBufferMagma(params: GlobalBufferParams):
dut = GlobalBuffer(params)
circ = to_magma(dut, flatten_array=True)
return FromMagma(circ)
| 61.001377 | 118 | 0.630478 | 6,720 | 44,287 | 3.610268 | 0.018452 | 0.063188 | 0.059849 | 0.072544 | 0.945138 | 0.889164 | 0.802729 | 0.645645 | 0.519599 | 0.387618 | 0 | 0.019014 | 0.277982 | 44,287 | 725 | 119 | 61.085517 | 0.739711 | 0.001761 | 0 | 0.143533 | 0 | 0 | 0.072503 | 0.034091 | 0 | 0 | 0 | 0.001379 | 0 | 1 | 0.023659 | false | 0.018927 | 0.011041 | 0 | 0.037855 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1572b9d932a227e0f1af308a706b226074c2084e | 223 | py | Python | Control/IController.py | ace964/Azubot | b77416d6152efdc3a806ee590bac2272629bab5a | [
"MIT"
] | 1 | 2018-07-12T10:14:40.000Z | 2018-07-12T10:14:40.000Z | Control/IController.py | ace964/Azubot | b77416d6152efdc3a806ee590bac2272629bab5a | [
"MIT"
] | null | null | null | Control/IController.py | ace964/Azubot | b77416d6152efdc3a806ee590bac2272629bab5a | [
"MIT"
] | null | null | null | """
Interface for Controllers
functionality described in ps4.py ord xbox.py
"""
class IController:
def start(self):
raise NotImplementedError
def getActions(self):
raise NotImplementedError
| 20.272727 | 49 | 0.690583 | 23 | 223 | 6.695652 | 0.782609 | 0.116883 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005917 | 0.242152 | 223 | 10 | 50 | 22.3 | 0.905325 | 0.318386 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1584a1bc2e17f61c4173cce02e535e03e917f85d | 53 | py | Python | data/studio21_generated/introductory/4302/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/4302/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/4302/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | def better_than_average(class_points, your_points):
| 26.5 | 51 | 0.849057 | 8 | 53 | 5.125 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075472 | 53 | 2 | 52 | 26.5 | 0.836735 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
15924953c2e4ae2608a0cc8522236b8362983f00 | 16,706 | py | Python | query_research/query_research_handler.py | sjuenger/WikiMETA | 13ed293b4bda8ff0fc10b532907ca35c24a12616 | [
"MIT"
] | null | null | null | query_research/query_research_handler.py | sjuenger/WikiMETA | 13ed293b4bda8ff0fc10b532907ca35c24a12616 | [
"MIT"
] | null | null | null | query_research/query_research_handler.py | sjuenger/WikiMETA | 13ed293b4bda8ff0fc10b532907ca35c24a12616 | [
"MIT"
] | null | null | null | import query_research.transform_data.transform_data_handler as transform_data_handler
import query_research.scenario_detection_unit as scenario_detection_unit
import query_research.properties_counter as properties_counter
import query_research.statistical_information_handler as statistical_information_handler
import query_research.wikidata_dictionary_and_found_query_properties as wikidata_dictionary_and_found_query_properties
import query_research.ranks_counter as ranks_counter
import query_research.example_queries_in_data as example_queries_in_data
import query_research.amount_of_queries as amount_of_queries
TIMEFRAMES = [
"2017-06-12_2017-07-09_organic",
"2017-07-10_2017-08-06_organic",
"2017-08-07_2017-09-03_organic",
"2017-12-03_2017-12-30_organic",
"2018-01-01_2018-01-28_organic",
"2018-01-29_2018-02-25_organic",
"2018-02-26_2018-03-25_organic"
]
DATA_TYPES_REFERENCE = [
"reference_metadata/all_three",
"reference_metadata/derived_+_reference_node",
"reference_metadata/derived_+_reference_property",
"reference_metadata/only_derived",
"reference_metadata/only_reference_node",
"reference_metadata/only_reference_property",
"reference_metadata/reference_node_+_reference_property"
]
DATA_TYPES_QUALIFIER = [
"qualifier_metadata/property_qualifier"
]
DATA_TYPES_RANK = [
"rank_metadata/rank_property",
"rank_metadata/preferred_rank_+_rank_property",
"rank_metadata/normal_rank_+_rank_property",
"rank_metadata/deprecated_rank_+_rank_property",
"rank_metadata/preferred_+_normal_rank_+_rank_property",
"rank_metadata/preferred_+_deprecated_rank_+_rank_property",
"rank_metadata/normal_+_deprecated_rank_+_rank_property",
"rank_metadata/all_ranks_+_rank_property",
"rank_metadata/normal_rank",
"rank_metadata/deprecated_rank",
"rank_metadata/preferred_rank",
"rank_metadata/preferred_+_normal_rank",
"rank_metadata/preferred_+_deprecated_rank",
"rank_metadata/normal_+_deprecated_rank",
"rank_metadata/all_ranks",
"rank_metadata/best_rank_property",
"rank_metadata/rank_property_+_best_rank_property",
"rank_metadata/preferred_rank_+_rank_property_+_best_rank_property",
"rank_metadata/normal_rank_+_rank_property_+_best_rank_property",
"rank_metadata/deprecated_rank_+_rank_property_+_best_rank_property",
"rank_metadata/preferred_+_normal_rank_+_rank_property_+_best_rank_property",
"rank_metadata/preferred_+_deprecated_rank_+_rank_property_+_best_rank_property",
"rank_metadata/normal_+_deprecated_rank_+_rank_property_+_best_rank_property",
"rank_metadata/all_ranks_+_rank_property_+_best_rank_property",
"rank_metadata/normal_rank_+_best_rank_property",
"rank_metadata/deprecated_rank_+_best_rank_property",
"rank_metadata/preferred_rank_+_best_rank_property",
"rank_metadata/preferred_+_normal_rank_+_best_rank_property",
"rank_metadata/preferred_+_deprecated_rank_+_best_rank_property",
"rank_metadata/normal_+_deprecated_rank_+_best_rank_property",
"rank_metadata/all_ranks_+_best_rank_property"
]
def start_research_of_query_data(args, x):
# use a bit-like structure to tell the function, what actions to perform
# generate the data
if args[0] == 1:
print("Generate the query data.")
transform_data_handler. \
start_creating_data(TIMEFRAMES, [DATA_TYPES_REFERENCE, DATA_TYPES_QUALIFIER, DATA_TYPES_RANK])
# count the amount of queries with and without metadata (overall & per timeframe)
if args[1] == 1:
print("Count the amount of queries with and without metadata (overall & per timeframe).")
amount_of_queries.save_total_of_queries_amount_per_timeframe(TIMEFRAMES,
["qualifier_metadata",
"reference_metadata",
"rank_metadata"])
amount_of_queries.save_total_of_queries_amount_overall(TIMEFRAMES,
["qualifier_metadata",
"reference_metadata",
"rank_metadata"])
# detect scenarios
if args[2] == 1:
print("Detect the query scenarios.")
for timeframe in TIMEFRAMES:
print("Detecting the scenarios of: ", timeframe)
print("Reference")
for datatype in DATA_TYPES_REFERENCE:
scenario_detection_unit.detect_scenarios(timeframe, datatype, "redundant")
scenario_detection_unit.detect_scenarios(timeframe, datatype, "non_redundant")
print("Qualifier")
for datatype in DATA_TYPES_QUALIFIER:
scenario_detection_unit.detect_scenarios(timeframe, datatype, "redundant")
scenario_detection_unit.detect_scenarios(timeframe, datatype, "non_redundant")
print("Rank")
for datatype in DATA_TYPES_RANK:
scenario_detection_unit.detect_scenarios(timeframe, datatype, "redundant")
scenario_detection_unit.detect_scenarios(timeframe, datatype, "non_redundant")
# count the gathered properties and ranks
if args[3] == 1:
print("Count the gathered properties and ranks.")
for timeframe in TIMEFRAMES:
properties_counter.count_property_in(timeframe, "reference_metadata", DATA_TYPES_REFERENCE, "redundant")
properties_counter.count_property_in(timeframe, "reference_metadata", DATA_TYPES_REFERENCE, "non_redundant")
properties_counter.count_property_in(timeframe, "qualifier_metadata", DATA_TYPES_QUALIFIER, "redundant")
properties_counter.count_property_in(timeframe, "qualifier_metadata", DATA_TYPES_QUALIFIER, "non_redundant")
ranks_counter.count_ranks_in(timeframe, "rank_metadata", DATA_TYPES_RANK, "redundant")
ranks_counter.count_ranks_in(timeframe, "rank_metadata", DATA_TYPES_RANK, "non_redundant")
# create the statistical information about the counted properties in relation to the gathered facets/datatypes
# .. from Wikidata
if args[4] == 1:
print("Create the statistical information about the counted properties in relation to the gathered facets/datatypes"
"from Wikidata.")
for timeframe in TIMEFRAMES:
for metadata_mode in ["qualifier_metadata", "reference_metadata"]:
for redundancy_mode in ["redundant", "non_redundant"]:
wikidata_dictionary_and_found_query_properties. \
create_dict_based_on_properties_dict_timeframe_and_Wikidata_property_dict_per_timeframe(
timeframe, metadata_mode, redundancy_mode)
for recommended_mode in [True, False, None]:
statistical_information_handler. \
get_top_x_counted_properties_timeframe(timeframe, x, metadata_mode,
recommended_mode, redundancy_mode)
statistical_information_handler. \
get_top_x_counted_facets_timeframe(
timeframe, x, metadata_mode, recommended_mode, redundancy_mode)
statistical_information_handler. \
get_top_x_counted_datatypes_timeframe(
timeframe, x, metadata_mode, recommended_mode, redundancy_mode)
statistical_information_handler. \
get_top_x_counted_accumulated_facets_timeframe(
timeframe, x, metadata_mode, recommended_mode, redundancy_mode)
statistical_information_handler. \
get_top_x_counted_accumulated_datatypes_timeframe(
timeframe, x, metadata_mode, recommended_mode, redundancy_mode)
statistical_information_handler. \
get_top_x_counted_properties_timeframe(timeframe, x,
metadata_mode, recommended_mode, redundancy_mode)
statistical_information_handler. \
get_top_x_counted_facets_timeframe(
timeframe, x, metadata_mode, recommended_mode, redundancy_mode)
statistical_information_handler. \
get_top_x_counted_datatypes_timeframe(
timeframe, x, metadata_mode, recommended_mode, redundancy_mode)
statistical_information_handler. \
get_top_x_counted_accumulated_facets_timeframe(
timeframe, x, metadata_mode, recommended_mode, redundancy_mode)
statistical_information_handler. \
get_top_x_counted_accumulated_datatypes_timeframe(
timeframe, x, metadata_mode, recommended_mode, redundancy_mode)
# look for Wikidata Example Queries in the Query data
if args[5] == 1:
print("Look for Wikidata Example Queries in the Query data.")
for timeframe in TIMEFRAMES:
for (metadata_mode, datatype) in [("qualifier_metadata", DATA_TYPES_QUALIFIER),
("reference_metadata", DATA_TYPES_REFERENCE),
("rank_metadata", DATA_TYPES_RANK)]:
# count the example queries from the Wikidata SPARQL Endpoint in ALL queries
example_queries_in_data. \
count_example_queries_in_queries("Wikidata_Example_Queries",timeframe,
metadata_mode, datatype, False)
# count the example queries from the Wikidata SPARQL Endpoint in
# .. the 'marked as redundant' queries
example_queries_in_data. \
count_example_queries_in_queries("Wikidata_Example_Queries",timeframe,
metadata_mode, datatype, True)
# summarize the information about the timeframes
if args[6] == 1:
print("Summarize the information (scenarios + properties + ranks) about the timeframes")
statistical_information_handler.summarize_additional_scenario_information_about_BIND(TIMEFRAMES)
statistical_information_handler.summarize_additional_scenario_information_about_FILTER(TIMEFRAMES)
statistical_information_handler.summarize_additional_scenario_information_about_MINUS(TIMEFRAMES)
statistical_information_handler.summarize_additional_scenario_information_about_OPTIONAL(TIMEFRAMES)
statistical_information_handler.summarize_additional_scenario_information_about_PROP_PATH(TIMEFRAMES)
statistical_information_handler.summarize_additional_scenario_information_about_SUBSELECT(TIMEFRAMES)
statistical_information_handler.summarize_additional_scenario_information_about_UNION(TIMEFRAMES)
for timeframe in TIMEFRAMES:
for (metadata_mode, datatype) in [("qualifier_metadata", DATA_TYPES_QUALIFIER),
("reference_metadata", DATA_TYPES_REFERENCE),
("rank_metadata", DATA_TYPES_RANK)]:
for redundancy_mode in ["redundant", "non_redundant"]:
statistical_information_handler. \
summarize_statistical_information_about_scenarios(timeframe,
datatype,
metadata_mode,
redundancy_mode)
for datatype in [DATA_TYPES_QUALIFIER, DATA_TYPES_REFERENCE, DATA_TYPES_RANK]:
# summarize the information about the detected / found Wikidata example queries in the data
example_queries_in_data.summarize_scenario_data_from_metadata_per_datatype_and_overall(TIMEFRAMES, datatype, True)
example_queries_in_data.summarize_scenario_data_from_metadata_per_datatype_and_overall(TIMEFRAMES, datatype, False)
for redundancy_mode in ["redundant", "non_redundant"]:
for metadata_mode in ["qualifier_metadata", "reference_metadata", "rank_metadata"]:
statistical_information_handler.summarize_statistical_information_about_timeframes(TIMEFRAMES,
metadata_mode,
redundancy_mode)
for metadata_mode in ["rank_metadata"]:
statistical_information_handler.summarize_statistical_information_about_counted_ranks(TIMEFRAMES,
metadata_mode,
redundancy_mode)
for metadata_mode in ["qualifier_metadata", "reference_metadata"]:
statistical_information_handler.summarize_statistical_information_about_counted_raw_properties(TIMEFRAMES,
metadata_mode,
redundancy_mode)
statistical_information_handler. \
get_top_x_counted_raw_properties_overall(x, metadata_mode, redundancy_mode)
for recommended_mode in [True, False, None]:
statistical_information_handler. \
summarize_timeframe_information_about_properties_and_get_top_x(x,
TIMEFRAMES,
metadata_mode,
recommended_mode,
redundancy_mode)
statistical_information_handler. \
summarize_timeframe_information_about_facets_and_get_top_x(x,
TIMEFRAMES,
metadata_mode,
recommended_mode,
redundancy_mode)
statistical_information_handler. \
summarize_timeframe_information_about_datatypes(TIMEFRAMES,
metadata_mode,
recommended_mode,
redundancy_mode)
statistical_information_handler. \
summarize_timeframe_information_about_accumulated_facets_and_get_top_x(x,
TIMEFRAMES,
metadata_mode,
recommended_mode,
redundancy_mode)
statistical_information_handler. \
summarize_timeframe_information_about_accumulated_datatypes(TIMEFRAMES,
metadata_mode,
recommended_mode,
redundancy_mode)
| 57.212329 | 127 | 0.584999 | 1,447 | 16,706 | 6.239115 | 0.093296 | 0.051839 | 0.093155 | 0.061143 | 0.800399 | 0.761852 | 0.72253 | 0.66615 | 0.597585 | 0.42778 | 0 | 0.01185 | 0.363522 | 16,706 | 291 | 128 | 57.408935 | 0.837205 | 0.042799 | 0 | 0.422727 | 0 | 0 | 0.199049 | 0.130195 | 0 | 0 | 0 | 0 | 0 | 1 | 0.004545 | false | 0 | 0.036364 | 0 | 0.040909 | 0.05 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
159fe5158d0dcf5a3a393dd47e3f68d9f23e12b4 | 408 | py | Python | tests/test_compiler.py | sheecegardezi/RobotChallenge | afce5d48d0f4bfe6e14e824be0c3f20b01337b3f | [
"Apache-2.0"
] | null | null | null | tests/test_compiler.py | sheecegardezi/RobotChallenge | afce5d48d0f4bfe6e14e824be0c3f20b01337b3f | [
"Apache-2.0"
] | 2 | 2022-03-02T15:25:00.000Z | 2022-03-03T05:18:12.000Z | tests/test_compiler.py | sheecegardezi/RobotChallenge | afce5d48d0f4bfe6e14e824be0c3f20b01337b3f | [
"Apache-2.0"
] | null | null | null | from robotchallenge.Compiler.compiler import Compiler
from robotchallenge.Compiler.compiler import CompilerError
def test_compiler():
try:
compiler = Compiler("INVALID_CMD")
compiler.compile()
assert False, "Should not reach here"
except CompilerError:
assert True, "Should reach here"
if __name__ == "__main__":
test_compiler()
print("All tests passed")
| 22.666667 | 58 | 0.698529 | 44 | 408 | 6.227273 | 0.590909 | 0.175182 | 0.189781 | 0.248175 | 0.291971 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218137 | 408 | 17 | 59 | 24 | 0.858934 | 0 | 0 | 0 | 0 | 0 | 0.178922 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.083333 | false | 0.083333 | 0.166667 | 0 | 0.25 | 0.083333 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
15a5b07fedafafc8e67ebfb5816d001133fca794 | 296 | py | Python | config_sample.py | juanino/weatherstation | a59234d3e780957a0632584a0dc3e8c89c755822 | [
"MIT"
] | null | null | null | config_sample.py | juanino/weatherstation | a59234d3e780957a0632584a0dc3e8c89c755822 | [
"MIT"
] | null | null | null | config_sample.py | juanino/weatherstation | a59234d3e780957a0632584a0dc3e8c89c755822 | [
"MIT"
] | null | null | null | # rename this file to config.py
# change with your info from adafruit.io
ADAFRUIT_IO_USERNAME = "XXXX"
ADAFRUIT_IO_KEY = "aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
APIURL="https://api.openweathermap.org/data/2.5/weather?lat=41.XXXXXX&lon=-73.XXXXXX&appid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&units=imperial"
| 49.333333 | 139 | 0.820946 | 41 | 296 | 5.804878 | 0.878049 | 0.12605 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021739 | 0.067568 | 296 | 5 | 140 | 59.2 | 0.84058 | 0.22973 | 0 | 0 | 0 | 0.333333 | 0.737778 | 0.142222 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
15b392fed00c2a51fde89f366114f39fb02a3508 | 1,302 | py | Python | src/server/server.py | Irsutoro/sesame | 142959a6e4c814c72f480b0252a028d8586b77da | [
"MIT"
] | null | null | null | src/server/server.py | Irsutoro/sesame | 142959a6e4c814c72f480b0252a028d8586b77da | [
"MIT"
] | null | null | null | src/server/server.py | Irsutoro/sesame | 142959a6e4c814c72f480b0252a028d8586b77da | [
"MIT"
] | null | null | null | import peewee as pw
import hashlib
import os
from base64 import b64decode, b64encode
from typing import List
class Server:
def __init__(self, database: pw.Database, base_model: pw.Model):
self.database = None
self.base_model = base_model
self.connect_to_database(database)
def create_tables(self):
self.database.create_tables(self.models())
def connect_to_database(self, database: pw.Database):
self.database = database
self._initialize_proxy()
def models(self) -> List[pw.Model]:
return self.base_model.__subclasses__()
def _initialize_proxy(self):
self.base_model._meta.database.initialize(self.database)
@staticmethod
def _generate_salt(length: int) -> bytes:
salt = os.urandom(length)
return salt
@staticmethod
def _hash_password(password: str, salt: bytes, iterations: int, algorithm: str) -> bytes:
hashed_password = hashlib.pbkdf2_hmac(algorithm, password.encode(), salt, iterations)
return hashed_password
@staticmethod
def _bytes_to_base(value: bytes) -> str:
result = b64encode(value).decode()
return result
@staticmethod
def _base_to_bytes(value: str) -> bytes:
result = b64decode(value)
return result | 28.933333 | 93 | 0.683564 | 155 | 1,302 | 5.503226 | 0.322581 | 0.084408 | 0.045721 | 0.051583 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010913 | 0.225806 | 1,302 | 45 | 94 | 28.933333 | 0.835317 | 0 | 0 | 0.171429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.257143 | false | 0.085714 | 0.142857 | 0.028571 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
ec7dc26d09ac44452b689a851285b05d5cd4e6ad | 697 | py | Python | Oving6/card_deck.py | JakubMroz4/PythonUiS | fc4f8ff15f280e07e21d55df31f9dfb81cf5a6cd | [
"MIT"
] | null | null | null | Oving6/card_deck.py | JakubMroz4/PythonUiS | fc4f8ff15f280e07e21d55df31f9dfb81cf5a6cd | [
"MIT"
] | null | null | null | Oving6/card_deck.py | JakubMroz4/PythonUiS | fc4f8ff15f280e07e21d55df31f9dfb81cf5a6cd | [
"MIT"
] | 1 | 2021-04-26T14:32:52.000Z | 2021-04-26T14:32:52.000Z | from card import Card
import random
class CardDeck:
cards: list
def __init__(self):
self.cards = []
for i in range(1, 14):
self.cards.append(Card("Club", i))
self.cards.append(Card("Diamond", i))
self.cards.append(Card("Heart", i))
self.cards.append(Card("Spade", i))
def shuffle(self):
random.shuffle(self.cards)
def take(self):
card = self.cards[-1]
del self.cards[-1]
return card
def __str__(self):
text = "Carddeck \n"
for card in self.cards:
text += str(card) + "\n"
return text
def __len__(self):
return len(self.cards)
| 21.78125 | 49 | 0.536585 | 89 | 697 | 4.067416 | 0.337079 | 0.248619 | 0.165746 | 0.209945 | 0.165746 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010753 | 0.332855 | 697 | 31 | 50 | 22.483871 | 0.767742 | 0 | 0 | 0 | 0 | 0 | 0.04878 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.208333 | false | 0 | 0.083333 | 0.041667 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec7ed378c2b87d37e8b3cf022e951a830a7b3c50 | 1,365 | py | Python | SRC/common/IO/pixelgroupparam.py | usnistgov/OOF3D | 4fd423a48aea9c5dc207520f02de53ae184be74c | [
"X11"
] | 31 | 2015-04-01T15:59:36.000Z | 2022-03-18T20:21:47.000Z | SRC/common/IO/pixelgroupparam.py | usnistgov/OOF3D | 4fd423a48aea9c5dc207520f02de53ae184be74c | [
"X11"
] | 3 | 2015-02-06T19:30:24.000Z | 2017-05-25T14:14:31.000Z | SRC/common/IO/pixelgroupparam.py | usnistgov/OOF3D | 4fd423a48aea9c5dc207520f02de53ae184be74c | [
"X11"
] | 7 | 2015-01-23T15:19:22.000Z | 2021-06-09T09:03:59.000Z | # -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we ask that before distributing modified
# versions of this software, you first contact the authors at
# oof_manager@nist.gov.
from ooflib.common.IO import parameter
from ooflib.common.IO import placeholder
import types
# Parameter subclass for choosing a PixelGroup in a Microstructure
class PixelGroupParameter(parameter.StringParameter):
def valueDesc(self):
return "The name of a PixelGroup."
# Parameter subclass for choosing either a PixelGroup, every pixel, or
# the currently selected pixels.
class PixelAggregateParameter(placeholder.PlaceHolderParameter):
types = (types.StringType, placeholder.selection, placeholder.every)
def valueDesc(self):
return "The name of a PixelGroup, or <link linkend='Object-Placeholder'><constant>every</constant></link> or <link linkend='Object-Placeholder'><constant>selected</constant></link>."
#Interface branch
class PixelGroupInterfaceParameter(parameter.StringParameter):
def valueDesc(self):
return "The name of a PixelGroup or <No pixelgroup>."
| 39 | 190 | 0.772894 | 172 | 1,365 | 6.127907 | 0.546512 | 0.052182 | 0.045541 | 0.062619 | 0.28463 | 0.239089 | 0.16888 | 0.16888 | 0.16888 | 0.16888 | 0 | 0 | 0.147985 | 1,365 | 34 | 191 | 40.147059 | 0.906277 | 0.443956 | 0 | 0.230769 | 0 | 0.076923 | 0.33244 | 0.171582 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.230769 | 0.230769 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ec9b96ae1653b158cdbe45e4dc4eb4ef67dbb03d | 358 | py | Python | homeworks/210215/hw_1/returning_values_from_decorated_functions.py | ObukhovVladislav/python-adv | ffab71d28e54d2c9b9c53c5fec453873242291f3 | [
"Apache-2.0"
] | null | null | null | homeworks/210215/hw_1/returning_values_from_decorated_functions.py | ObukhovVladislav/python-adv | ffab71d28e54d2c9b9c53c5fec453873242291f3 | [
"Apache-2.0"
] | null | null | null | homeworks/210215/hw_1/returning_values_from_decorated_functions.py | ObukhovVladislav/python-adv | ffab71d28e54d2c9b9c53c5fec453873242291f3 | [
"Apache-2.0"
] | 1 | 2021-03-29T05:44:02.000Z | 2021-03-29T05:44:02.000Z | # from decorators import do_twice
#
#
# @do_twice
def return_greeting(name):
print("Создание приветствия")
return f"Hi {name}"
hi_vlad = return_greeting("Vlad")
def do_twice(func):
def wrapper_do_twice(*args, **kwargs):
func(*args, **kwargs)
return func(*args, **kwargs)
return wrapper_do_twice
return_greeting("Vlad")
| 16.272727 | 42 | 0.670391 | 47 | 358 | 4.87234 | 0.404255 | 0.152838 | 0.157205 | 0.174672 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.198324 | 358 | 21 | 43 | 17.047619 | 0.797909 | 0.114525 | 0 | 0 | 0 | 0 | 0.11859 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0 | 0 | 0.6 | 0.1 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
ec9c4a5e7a842f7335bf3471003bae1f04cda881 | 4,985 | py | Python | upload_gamelog.py | jcferrara/fantasy-football-start-or-sit | 4c3ac7be9f086863912f0181bf2dafb87d8cd4d1 | [
"MIT"
] | null | null | null | upload_gamelog.py | jcferrara/fantasy-football-start-or-sit | 4c3ac7be9f086863912f0181bf2dafb87d8cd4d1 | [
"MIT"
] | null | null | null | upload_gamelog.py | jcferrara/fantasy-football-start-or-sit | 4c3ac7be9f086863912f0181bf2dafb87d8cd4d1 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 2 19:47:52 2021
@author: JustinFerrara
"""
import pandas as pd
import pymysql
def upload_gamelog(data):
try:
db = pymysql.connect(host = host_name,
user = user_name,
passwd = password,
db = db_name)
if db.open:
cursor = db.cursor()
cursor.execute("select database();")
record = cursor.fetchone()
print("You're connected to database: ", record[0])
cursor.execute('DROP TABLE IF EXISTS Gamelog;')
print('Creating \'Gamelog\' table....')
cursor.execute('''
CREATE TABLE Gamelog(
date DATE,
week_number INT(2),
player_team VARCHAR(50),
game_setting VARCHAR(8),
game_opponent VARCHAR(3),
game_result VARCHAR(12),
passing_completions INT(4),
passing_attempts INT(4),
passing_completion_pct FLOAT(6),
passing_yards INT(4),
passing_td INT(2),
passing_int INT(2),
passing_qbr FLOAT(4),
passing_sacks FLOAT(3),
passing_yards_per_att FLOAT(8),
rushing_attempts INT(4),
rushing_yards INT(4),
rushing_yards_per_att FLOAT(8),
rushing_td INT(2),
receiving_targets INT(2),
receiving_receptions INT(2),
receiving_yards INT(3),
receiving_yards_per_reception FLOAT(8),
receiving_td INT(2),
receiving_catch_pct FLOAT(8),
receiving_yards_per_target FLOAT(8),
scoring_total_td INT(2),
scoring_total_points INT(3),
fumbles_num INT(2),
fumbles_num_lost INT(2),
fumbles_num_recovered INT(2),
num_off_snaps INT(3),
pct_off_snaps FLOAT(8),
num_st_snaps INT(3),
pct_st_snaps FLOAT(8),
player_code VARCHAR(50))
''')
print('Table created successfully....')
for i, row in data.iterrows():
sql = '''INSERT INTO `Gamelog`
(`date`,
`week_number`,
`player_team`,
`game_setting`,
`game_opponent`,
`game_result`,
`passing_completions`,
`passing_attempts`,
`passing_completion_pct`,
`passing_yards`,
`passing_td`,
`passing_int`,
`passing_qbr`,
`passing_sacks`,
`passing_yards_per_att`,
`rushing_attempts`,
`rushing_yards`,
`rushing_yards_per_att`,
`rushing_td`,
`receiving_targets`,
`receiving_receptions`,
`receiving_yards`,
`receiving_yards_per_reception`,
`receiving_td`,
`receiving_catch_pct`,
`receiving_yards_per_target`,
`scoring_total_td`,
`scoring_total_points`,
`fumbles_num`,
`fumbles_num_lost`,
`fumbles_num_recovered`,
`num_off_snaps`,
`pct_off_snaps`,
`num_st_snaps`,
`pct_st_snaps`,
`player_code`)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'''
cursor.execute(sql, tuple(row))
db.commit()
print("Table import complete!")
except:
print("Error while connecting to MySQL")
finally:
db.close()
print("Connection closed")
game_stats = pd.read_csv('game_stats_db.csv')
upload_gamelog(game_stats)
| 35.863309 | 107 | 0.392578 | 417 | 4,985 | 4.414868 | 0.302158 | 0.038023 | 0.055405 | 0.0717 | 0.045627 | 0.045627 | 0.019555 | 0.019555 | 0.019555 | 0.019555 | 0 | 0.021694 | 0.519157 | 4,985 | 138 | 108 | 36.123188 | 0.74635 | 0.020662 | 0 | 0 | 0 | 0.019048 | 0.785582 | 0.079688 | 0 | 0 | 0 | 0 | 0 | 1 | 0.009524 | false | 0.180952 | 0.028571 | 0 | 0.038095 | 0.057143 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
ecabf53a4a1d6faca514dcc9efdac505c2bebd47 | 338 | py | Python | test/_utils.py | rrobertsrgare/server-client-python | 3f4db45584fb352e9f21c870027a2302cb824909 | [
"CC0-1.0",
"MIT"
] | 1 | 2019-08-09T20:19:12.000Z | 2019-08-09T20:19:12.000Z | test/_utils.py | jorwoods/server-client-python | fefd6f18d8a6617829c6323879d2c3ed77a4cda6 | [
"CC0-1.0",
"MIT"
] | 1 | 2021-02-24T00:26:46.000Z | 2021-02-24T00:26:46.000Z | test/_utils.py | jorwoods/server-client-python | fefd6f18d8a6617829c6323879d2c3ed77a4cda6 | [
"CC0-1.0",
"MIT"
] | 1 | 2021-02-17T18:39:10.000Z | 2021-02-17T18:39:10.000Z | import os.path
TEST_ASSET_DIR = os.path.join(os.path.dirname(__file__), 'assets')
def asset(filename):
return os.path.join(TEST_ASSET_DIR, filename)
def read_xml_asset(filename):
with open(asset(filename), 'rb') as f:
return f.read().decode('utf-8')
def read_xml_assets(*args):
return map(read_xml_asset, args)
| 19.882353 | 66 | 0.704142 | 54 | 338 | 4.148148 | 0.462963 | 0.107143 | 0.107143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003497 | 0.153846 | 338 | 16 | 67 | 21.125 | 0.77972 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0.222222 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ecde0c77c9550d187f80e7e69b05bef9177bb610 | 137 | py | Python | backend/schemas/comment_like_schema.py | heshikirihasebe/fastapi-instagram-clone | 7bc265a62160171c5c5c1b2f18b3c86833cb64e7 | [
"MIT"
] | 1 | 2022-02-08T19:35:22.000Z | 2022-02-08T19:35:22.000Z | backend/schemas/comment_like_schema.py | heshikirihasebe/fastapi-instagram-clone | 7bc265a62160171c5c5c1b2f18b3c86833cb64e7 | [
"MIT"
] | null | null | null | backend/schemas/comment_like_schema.py | heshikirihasebe/fastapi-instagram-clone | 7bc265a62160171c5c5c1b2f18b3c86833cb64e7 | [
"MIT"
] | null | null | null | from pydantic import BaseModel
class RequestSchema(BaseModel):
comment_id: int
class ResponseSchema(BaseModel):
is_liked: bool
| 17.125 | 32 | 0.781022 | 16 | 137 | 6.5625 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160584 | 137 | 7 | 33 | 19.571429 | 0.913043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ecf470a19606b4ce4d78fa6432cb082e866f7c5b | 1,945 | py | Python | dm_control/suite/primitives.py | wpumacay/dm_control | e13b6941470cd6be618b0cc004b8ea20d69429fe | [
"Apache-2.0"
] | null | null | null | dm_control/suite/primitives.py | wpumacay/dm_control | e13b6941470cd6be618b0cc004b8ea20d69429fe | [
"Apache-2.0"
] | null | null | null | dm_control/suite/primitives.py | wpumacay/dm_control | e13b6941470cd6be618b0cc004b8ea20d69429fe | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Primitives domain (for testing purposes)"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
# Internal dependencies.
from dm_control import mujoco
from dm_control.rl import control
from dm_control.suite import base
from dm_control.suite import common
from dm_control.utils import containers
import numpy as np
_DEFAULT_TIME_LIMIT = 40
SUITE = containers.TaggedTasks()
def get_model_and_assets():
"""Returns a tuple containing the model XML string and a dict of assets."""
return common.read_model('primitives.xml'), common.ASSETS
@SUITE.add('benchmarking', 'test')
def test(time_limit=_DEFAULT_TIME_LIMIT, random=None):
"""Returns the easy point_mass task."""
physics = mujoco.Physics.from_xml_string(*get_model_and_assets())
task = Primitives(random=random)
return control.Environment(physics, task, time_limit=time_limit)
class Primitives(base.Task):
"""A test task for mujoco primitives"""
def __init__(self, random=None):
super(Primitives, self).__init__(random=random)
def initialize_episode(self, physics):
pass
def get_observation(self, physics):
obs = collections.OrderedDict()
return obs
def get_reward(self, physics):
return 0.0
| 30.390625 | 78 | 0.737789 | 268 | 1,945 | 5.16791 | 0.470149 | 0.038989 | 0.046931 | 0.023105 | 0.034657 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007203 | 0.143445 | 1,945 | 63 | 79 | 30.873016 | 0.82413 | 0.431877 | 0 | 0 | 0 | 0 | 0.028037 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.206897 | false | 0.034483 | 0.344828 | 0.034483 | 0.724138 | 0.034483 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
01bcf4694fddcd3d9ff256f4ba1b66e70b47f1f3 | 174 | py | Python | src/chapter3/exercise 2.py | group5BCS1/BCS-2021 | 696b53bdfc46799b4a527604fbd6cd6cfb3982eb | [
"MIT"
] | null | null | null | src/chapter3/exercise 2.py | group5BCS1/BCS-2021 | 696b53bdfc46799b4a527604fbd6cd6cfb3982eb | [
"MIT"
] | null | null | null | src/chapter3/exercise 2.py | group5BCS1/BCS-2021 | 696b53bdfc46799b4a527604fbd6cd6cfb3982eb | [
"MIT"
] | null | null | null | try:
hours = int(input("enter hours :"))
rate=int(input("enter rate :"))
pay = int(hours * rate)
print("pay")
except:
print("Error, enter numeric input!") | 24.857143 | 40 | 0.591954 | 23 | 174 | 4.478261 | 0.478261 | 0.15534 | 0.252427 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.224138 | 174 | 7 | 40 | 24.857143 | 0.762963 | 0 | 0 | 0 | 0 | 0 | 0.314286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.285714 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
01c02fb18c5d46f5a90f4f02fe24f31004bb3225 | 379 | py | Python | pages/themes/beginners/OOP_advanced/examples/method_overriding.py | ProgressBG-Python-Course/ProgressBG-VC2-Python | 03b892a42ee1fad3d4f97e328e06a4b1573fd356 | [
"MIT"
] | null | null | null | pages/themes/beginners/OOP_advanced/examples/method_overriding.py | ProgressBG-Python-Course/ProgressBG-VC2-Python | 03b892a42ee1fad3d4f97e328e06a4b1573fd356 | [
"MIT"
] | null | null | null | pages/themes/beginners/OOP_advanced/examples/method_overriding.py | ProgressBG-Python-Course/ProgressBG-VC2-Python | 03b892a42ee1fad3d4f97e328e06a4b1573fd356 | [
"MIT"
] | null | null | null | class Person():
"""docstring for Person"""
def __init__(self, name, age):
self.name = name
self.age = age
def __str__(self):
return "{} is {} years old".format(self.name, self.age)
class Employee(Person):
def __str__(self):
return "{} is employee".format(self.name)
maria = Person("Maria", 20)
pesho = Employee("Pesho",25)
print(maria)
print(pesho)
| 18.95 | 59 | 0.646438 | 52 | 379 | 4.480769 | 0.403846 | 0.137339 | 0.094421 | 0.137339 | 0.154506 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012987 | 0.187335 | 379 | 19 | 60 | 19.947368 | 0.743506 | 0.05277 | 0 | 0.153846 | 0 | 0 | 0.122159 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0 | 0.153846 | 0.538462 | 0.153846 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
01c0efdc2aa9327183caece60d6ad9e5fee6b366 | 87 | py | Python | rpi_d3m_primitives/featSelect/profiler.py | naiyuyin/rpi_d3m_primitives | f95553bee90916d241885d28fb71c8167116d9fa | [
"MIT"
] | 1 | 2019-05-02T21:05:27.000Z | 2019-05-02T21:05:27.000Z | rpi_d3m_primitives/featSelect/profiler.py | naiyuyin/rpi_d3m_primitives | f95553bee90916d241885d28fb71c8167116d9fa | [
"MIT"
] | 1 | 2021-03-18T15:52:27.000Z | 2021-03-26T17:54:04.000Z | rpi_d3m_primitives/featSelect/profiler.py | naiyuyin/rpi_d3m_primitives | f95553bee90916d241885d28fb71c8167116d9fa | [
"MIT"
] | null | null | null | import pstats
p = pstats.Stats('times.txt')
p.sort_stats('cumtime').print_stats(20) | 21.75 | 39 | 0.724138 | 14 | 87 | 4.357143 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.103448 | 87 | 4 | 39 | 21.75 | 0.75641 | 0 | 0 | 0 | 0 | 0 | 0.188235 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
01ca27d91088dd7bec765bb28f0e768dd211fabc | 499 | py | Python | UnitTests/ProxyTest.py | Valentijn1995/Kn0ckKn0ck | 6339f7f0e02c9b63f62539784ec6719b3c94de72 | [
"MIT"
] | null | null | null | UnitTests/ProxyTest.py | Valentijn1995/Kn0ckKn0ck | 6339f7f0e02c9b63f62539784ec6719b3c94de72 | [
"MIT"
] | null | null | null | UnitTests/ProxyTest.py | Valentijn1995/Kn0ckKn0ck | 6339f7f0e02c9b63f62539784ec6719b3c94de72 | [
"MIT"
] | null | null | null | from Proxies.DebugProxy import DebugProxy
from Proxies.Proxy import ProxyError
from Proxies.Protocols.NoProtocol import NoProtocol
from unittest import TestCase
class TestProxy(TestCase):
def setUp(self):
self._proxy = DebugProxy(False)
def test_send_error(self):
with self.assertRaises(ProxyError):
self._proxy.send(NoProtocol(b"Hello World!"))
def test_receive_error(self):
with self.assertRaises(ProxyError):
self._proxy.receive()
| 26.263158 | 57 | 0.719439 | 58 | 499 | 6.068966 | 0.431034 | 0.09375 | 0.073864 | 0.096591 | 0.272727 | 0.272727 | 0.272727 | 0.272727 | 0 | 0 | 0 | 0 | 0.198397 | 499 | 18 | 58 | 27.722222 | 0.88 | 0 | 0 | 0.153846 | 0 | 0 | 0.024048 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 1 | 0.230769 | false | 0 | 0.307692 | 0 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
01cea2af1f36f82d33231118be8f61a9bbdc3f63 | 218 | py | Python | python/physical/unit/bakers.py | afrl-quantum/physical | 71de3f7895b9bc1a1e9969701ad6980c5676b294 | [
"MIT"
] | 1 | 2020-10-01T21:21:54.000Z | 2020-10-01T21:21:54.000Z | python/physical/unit/bakers.py | afrl-quantum/physical | 71de3f7895b9bc1a1e9969701ad6980c5676b294 | [
"MIT"
] | null | null | null | python/physical/unit/bakers.py | afrl-quantum/physical | 71de3f7895b9bc1a1e9969701ad6980c5676b294 | [
"MIT"
] | 2 | 2018-03-21T15:53:27.000Z | 2018-07-26T09:29:37.000Z | from ..const import const
class bakers(const):
def __init__(self,prefix,unit):
const.__init__(self,prefix + 'bakers')
self.dozen = 13.0
self.doz = self.dozen
self.dz = self.dozen
| 19.818182 | 46 | 0.610092 | 29 | 218 | 4.310345 | 0.517241 | 0.216 | 0.224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018868 | 0.270642 | 218 | 10 | 47 | 21.8 | 0.767296 | 0 | 0 | 0 | 0 | 0 | 0.02765 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.428571 | 0 | 1 | 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 | 3 |
01d1643ad620c5a4e0ab1873d5c574b82879369d | 216 | py | Python | apis_core/apis_entities/templatetags/apis_templatetags.py | sviatoplok/apis-core | c23718af2a51598e32684b9b954b594ceef1f0f7 | [
"MIT"
] | 1 | 2019-09-02T09:14:06.000Z | 2019-09-02T09:14:06.000Z | apis_core/apis_entities/templatetags/apis_templatetags.py | sviatoplok/apis-core | c23718af2a51598e32684b9b954b594ceef1f0f7 | [
"MIT"
] | null | null | null | apis_core/apis_entities/templatetags/apis_templatetags.py | sviatoplok/apis-core | c23718af2a51598e32684b9b954b594ceef1f0f7 | [
"MIT"
] | null | null | null | from django import template
register = template.Library()
@register.inclusion_tag('apis_entities/apis_create_entities.html', takes_context=True)
def apis_create_entities(context):
values = {}
return values
| 24 | 86 | 0.787037 | 27 | 216 | 6.037037 | 0.666667 | 0.122699 | 0.220859 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12037 | 216 | 8 | 87 | 27 | 0.857895 | 0 | 0 | 0 | 0 | 0 | 0.180556 | 0.180556 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
01d4a78a88187074b1fbd9f890bf0b1570c7abb4 | 989 | py | Python | tests/test_editor_window.py | alexey4petrov/reinteract | 3e17f469467d065ff0d1f7970815bb49e21ca457 | [
"BSD-2-Clause"
] | 1 | 2020-11-11T05:20:35.000Z | 2020-11-11T05:20:35.000Z | tests/test_editor_window.py | alexey4petrov/reinteract | 3e17f469467d065ff0d1f7970815bb49e21ca457 | [
"BSD-2-Clause"
] | null | null | null | tests/test_editor_window.py | alexey4petrov/reinteract | 3e17f469467d065ff0d1f7970815bb49e21ca457 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python
########################################################################
#
# Copyright 2008-2009 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
#--------------------------------------------------------------------------------------
if __name__ == "__main__":
#--------------------------------------------------------------------------------------
from test_utils import adjust_environment
global_settings = adjust_environment()
from reinteract.editor_window import EditorWindow
a_window = EditorWindow()
a_window.window.show()
import gtk
gtk.main()
#--------------------------------------------------------------------------------------
pass
######################################################################
| 30.90625 | 91 | 0.364004 | 66 | 989 | 5.227273 | 0.712121 | 0.098551 | 0.110145 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009206 | 0.121335 | 989 | 31 | 92 | 31.903226 | 0.387802 | 0.469161 | 0 | 0 | 0 | 0 | 0.026667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.111111 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
01edbcc02dfa60cf6c6773bc7f71934bc01189de | 6,898 | py | Python | src/osyris/core/array.py | osyris-project/osyris | bff42d864a7d5d248f7023216e32fe97bc06dca6 | [
"BSD-3-Clause"
] | 2 | 2022-02-08T14:41:19.000Z | 2022-02-08T14:41:51.000Z | src/osyris/core/array.py | osyris-project/osyris | bff42d864a7d5d248f7023216e32fe97bc06dca6 | [
"BSD-3-Clause"
] | 20 | 2022-01-24T09:34:14.000Z | 2022-03-30T20:01:39.000Z | src/osyris/core/array.py | osyris-project/osyris | bff42d864a7d5d248f7023216e32fe97bc06dca6 | [
"BSD-3-Clause"
] | null | null | null | # SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2022 Osyris contributors (https://github.com/osyris-project/osyris)
import numpy as np
from pint.quantity import Quantity
from pint.errors import DimensionalityError
from .base import Base
from .tools import value_to_string
from .. import units
APPLY_OP_TO_UNIT = ("multiply", "true_divide", "sqrt", "power", "reciprocal")
def _binary_op(op, lhs, rhs, strict=True, **kwargs):
if not isinstance(rhs, lhs.__class__):
try:
rhs = lhs.__class__(rhs)
except NotImplementedError:
return NotImplemented
if strict:
rhs = rhs.to(lhs.unit)
else:
try:
rhs = rhs.to(lhs.unit)
except DimensionalityError:
pass
return op(lhs, rhs, **kwargs)
class Array(Base):
def __init__(self, values, unit=None, parent=None, name=""):
if isinstance(values, Base):
raise NotImplementedError("Cannot create Array from Array or Vector.")
if isinstance(values, Quantity):
if unit is not None:
raise ValueError(
"Cannot set unit when creating an Array from a Quantity.")
self._array = values.magnitude
self.unit = values.units
else:
self._array = values
self.unit = units(unit)
if not isinstance(self._array, np.ndarray):
self._array = np.asarray(self._array)
self.parent = parent
self.name = name
def __getitem__(self, slice_):
return self.__class__(values=self._array[slice_],
unit=self.unit,
parent=self.parent,
name=self.name)
def __len__(self):
if self._array.shape:
return len(self._array)
else:
return 0
def __str__(self):
name_str = "'" + self.name + "' "
if len(self) == 0:
values_str = "Value: " + value_to_string(self.values)
else:
values_str = "Min: " + value_to_string(
self.min().values) + " Max: " + value_to_string(self.max().values)
unit_str = " [{:~}] ".format(self.unit)
shape_str = str(self.shape)
return name_str + values_str + unit_str + shape_str
def copy(self):
return self.__class__(values=self._array.copy(),
unit=units(self.unit),
name=str(self.name))
@property
def values(self):
if not self._array.shape:
return self._array[()]
else:
return self._array
@values.setter
def values(self, values_):
self._array = values_
@property
def norm(self):
return self
@property
def ndim(self):
return self._array.ndim
@property
def shape(self):
return self._array.shape
@property
def dtype(self):
return self._array.dtype
def __add__(self, other):
return _binary_op(np.add, self, other)
def __iadd__(self, other):
return _binary_op(np.add, self, other, out=self)
def __sub__(self, other):
return _binary_op(np.subtract, self, other)
def __isub__(self, other):
return _binary_op(np.subtract, self, other, out=self)
def __mul__(self, other):
return _binary_op(np.multiply, self, other, strict=False)
def __imul__(self, other):
return _binary_op(np.multiply, self, other, strict=False, out=self)
def __truediv__(self, other):
return _binary_op(np.divide, self, other, strict=False)
def __itruediv__(self, other):
return _binary_op(np.divide, self, other, strict=False, out=self)
def __rmul__(self, other):
return self * other
def __rtruediv__(self, other):
return np.reciprocal(self / other)
def __pow__(self, number):
return np.power(self, number)
def __neg__(self):
return np.negative(self)
def __lt__(self, other):
return _binary_op(np.less, self, other)
def __le__(self, other):
return _binary_op(np.less_equal, self, other)
def __gt__(self, other):
return _binary_op(np.greater, self, other)
def __ge__(self, other):
return _binary_op(np.greater_equal, self, other)
def __eq__(self, other):
return _binary_op(np.equal, self, other)
def __ne__(self, other):
return _binary_op(np.not_equal, self, other)
def __and__(self, other):
return _binary_op(np.logical_and, self, other)
def __or__(self, other):
return _binary_op(np.logical_or, self, other)
def __xor__(self, other):
return _binary_op(np.logical_xor, self, other)
def __invert__(self):
return np.logical_not(self)
def to(self, unit):
new_unit = units(unit)
if self.unit == new_unit:
return self
ratio = (1.0 * self.unit).to(new_unit) / (1.0 * new_unit)
return self.__class__(values=self._array * ratio.magnitude, unit=new_unit)
def _maybe_array(self, arg):
if isinstance(arg, self.__class__):
return arg._array
if isinstance(arg, Quantity):
return arg.magnitude
return arg
def _extract_arrays_from_args(self, args):
return tuple(self._maybe_array(a) for a in args)
def _extract_arrays_from_kwargs(self, kwargs):
return {key: self._extract_arrays_from_args(a) for key, a in kwargs.items()}
def _maybe_unit(self, arg):
if hasattr(arg, "unit"):
return 1.0 * arg.unit
if hasattr(arg, "units"):
return 1.0 * arg.units
return arg
def _extract_units(self, args):
return tuple(self._maybe_unit(a) for a in args)
def _wrap_numpy(self, func, *args, **kwargs):
if isinstance(args[0], (tuple, list)):
array_args = (self._extract_arrays_from_args(
args[0]), ) + self._extract_arrays_from_args(args[1:])
else:
array_args = self._extract_arrays_from_args(args)
result = func(*array_args, **self._extract_arrays_from_kwargs(kwargs))
unit = None
if result.dtype in (int, float):
if func.__name__ in APPLY_OP_TO_UNIT:
unit = func(*self._extract_units(args),
**{key: a
for key, a in kwargs.items() if key != "out"}).units
else:
unit = self.unit
if "out" in kwargs:
kwargs["out"][0].unit = unit
return kwargs["out"][0]
else:
return self.__class__(values=result, unit=unit)
def reshape(self, *shape):
return self.__class__(values=self._array.reshape(*shape), unit=self.unit)
@property
def nbytes(self):
return self._array.nbytes
| 29.991304 | 84 | 0.592201 | 860 | 6,898 | 4.423256 | 0.169767 | 0.089905 | 0.074921 | 0.093849 | 0.293375 | 0.272082 | 0.1898 | 0.116193 | 0.096215 | 0.054679 | 0 | 0.004143 | 0.300087 | 6,898 | 229 | 85 | 30.122271 | 0.783761 | 0.017251 | 0 | 0.125 | 0 | 0 | 0.027155 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.244318 | false | 0.005682 | 0.034091 | 0.1875 | 0.568182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
01fd886cb003ce0ab587b3fc0b869e26c98aa84f | 631 | py | Python | problem/models/status.py | pwqbot/eoj3 | 46be6a6f192798e74eab7b327bb8df7ca73575d9 | [
"MIT"
] | 107 | 2017-03-15T11:53:45.000Z | 2019-09-06T11:23:44.000Z | problem/models/status.py | OS-EDU/eoj3 | f117dcd4e3cea7d150c3e3794e7255e00d486c88 | [
"MIT"
] | 27 | 2019-09-24T12:44:48.000Z | 2022-03-11T23:18:21.000Z | problem/models/status.py | OS-EDU/eoj3 | f117dcd4e3cea7d150c3e3794e7255e00d486c88 | [
"MIT"
] | 25 | 2019-10-11T10:39:12.000Z | 2022-03-18T05:15:57.000Z | from django.db import models
from account.models import User
class UserStatus(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="submission_status")
contest_id = models.PositiveIntegerField(db_index=True)
total_count = models.PositiveIntegerField()
total_list = models.TextField(blank=True)
ac_count = models.PositiveIntegerField()
ac_distinct_count = models.PositiveIntegerField()
ac_list = models.TextField(blank=True)
predict_list = models.TextField(blank=True)
update_time = models.DateTimeField(auto_now=True)
class Meta:
unique_together = ('user', 'contest_id')
| 33.210526 | 92 | 0.784469 | 78 | 631 | 6.141026 | 0.5 | 0.217119 | 0.194154 | 0.150313 | 0.175365 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115689 | 631 | 18 | 93 | 35.055556 | 0.858423 | 0 | 0 | 0 | 0 | 0 | 0.049128 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.928571 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
bf13d7b06159163175095faeb002b38702211e0b | 2,799 | py | Python | kikimr/public/api/grpc/ydb_export_v1_pb2_grpc.py | MihanixA/ydb-python-sdk | d1b93c6d2409a87c350acd604915576891d1e4f3 | [
"Apache-2.0"
] | 19 | 2019-07-01T08:25:29.000Z | 2022-01-26T14:46:51.000Z | kikimr/public/api/grpc/ydb_export_v1_pb2_grpc.py | MihanixA/ydb-python-sdk | d1b93c6d2409a87c350acd604915576891d1e4f3 | [
"Apache-2.0"
] | 5 | 2019-07-02T13:36:42.000Z | 2021-09-14T06:46:48.000Z | kikimr/public/api/grpc/ydb_export_v1_pb2_grpc.py | MihanixA/ydb-python-sdk | d1b93c6d2409a87c350acd604915576891d1e4f3 | [
"Apache-2.0"
] | 10 | 2019-06-07T10:36:19.000Z | 2021-10-15T08:58:11.000Z | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from kikimr.public.api.protos import ydb_export_pb2 as kikimr_dot_public_dot_api_dot_protos_dot_ydb__export__pb2
class ExportServiceStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.ExportToYt = channel.unary_unary(
'/Ydb.Export.V1.ExportService/ExportToYt',
request_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__export__pb2.ExportToYtRequest.SerializeToString,
response_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__export__pb2.ExportToYtResponse.FromString,
)
self.ExportToS3 = channel.unary_unary(
'/Ydb.Export.V1.ExportService/ExportToS3',
request_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__export__pb2.ExportToS3Request.SerializeToString,
response_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__export__pb2.ExportToS3Response.FromString,
)
class ExportServiceServicer(object):
# missing associated documentation comment in .proto file
pass
def ExportToYt(self, request, context):
"""Exports data to YT.
Method starts an asynchronous operation that can be cancelled while it is in progress.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ExportToS3(self, request, context):
"""Exports data to S3.
Method starts an asynchronous operation that can be cancelled while it is in progress.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_ExportServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'ExportToYt': grpc.unary_unary_rpc_method_handler(
servicer.ExportToYt,
request_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__export__pb2.ExportToYtRequest.FromString,
response_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__export__pb2.ExportToYtResponse.SerializeToString,
),
'ExportToS3': grpc.unary_unary_rpc_method_handler(
servicer.ExportToS3,
request_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__export__pb2.ExportToS3Request.FromString,
response_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__export__pb2.ExportToS3Response.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'Ydb.Export.V1.ExportService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
| 42.409091 | 125 | 0.78528 | 335 | 2,799 | 6.110448 | 0.268657 | 0.057157 | 0.058622 | 0.07914 | 0.724475 | 0.724475 | 0.694187 | 0.617 | 0.617 | 0.617 | 0 | 0.00964 | 0.147553 | 2,799 | 65 | 126 | 43.061538 | 0.848282 | 0.157556 | 0 | 0.243902 | 1 | 0 | 0.09398 | 0.045474 | 0 | 0 | 0 | 0 | 0 | 1 | 0.097561 | false | 0.04878 | 0.04878 | 0 | 0.195122 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bf13dd6f3eb3e631d63b8f42c16662040632e2a7 | 3,333 | py | Python | aurora.py | miriad/nanoleaf-aurora-python | d05088f16f229b4f33d4d82c97d2add4a16894dd | [
"Apache-2.0"
] | null | null | null | aurora.py | miriad/nanoleaf-aurora-python | d05088f16f229b4f33d4d82c97d2add4a16894dd | [
"Apache-2.0"
] | null | null | null | aurora.py | miriad/nanoleaf-aurora-python | d05088f16f229b4f33d4d82c97d2add4a16894dd | [
"Apache-2.0"
] | null | null | null | # aurora.py - Nanoleaf Aurora python library
#
# Copyright 2017 Zachary Cornelius
#
# 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 requests
import json
from pprint import pprint
class Aurora:
def __init__(self, auth_token, address, port=16021):
self.auth_token = auth_token
self.address = address
self.port = port
self.uri_base = "http://%s:%d/api/v1/%s" % (address, port, auth_token)
def _get_json(self, path):
uri = "%s%s" % (self.uri_base, path)
r = requests.get(uri)
if r.ok:
return r.json()
else:
r.raise_for_status()
def _put_json(self, path, data):
uri = "%s%s" % (self.uri_base, path)
print("PUT'ing to URI %s with data %s" % (uri, json.dumps(data)))
r = requests.put(uri, data=json.dumps(data))
if r.ok:
return True
else:
r.raise_for_status()
def get_info(self):
return self._get_json("")
def get_effects(self):
return self._get_json("/effects/effectsList")
def get_state(self):
return self._get_json("/state")
def get_power(self):
return self._get_json("/state/on")["value"]
def get_brightness(self):
return self._get_json("/state/brightness")["value"]
def get_brightness_max(self):
return self._get_json("/state/brightness")['max']
def get_brightness_min(self):
return self._get_json("/state/brightness")['min']
def set_brightness(self, new_brightness):
self._put_json("/state/brightness", {"brightness": {"value": int(new_brightness)}})
return self.get_brightness()
def increment_brightness(self, brightness_increment):
self._put_json("/state/brightness", {"brightness": {"incrememnt": int(brightness_increment)}})
return self.get_brightness()
def get_hue(self):
return self._get_json("/state/hue")["value"]
def get_hue_max(self):
return self._get_json("/state/hue")["max"]
def get_hue_min(self):
return self._get_json("/state/hue")["min"]
def set_hue(self, new_hue):
self._put_json("/state/hue", {"hue": {"value": int(new_hue)}})
return self.get_hue()
def increment_hue(self, hue_increment):
self._put_json("/state/hue", {"hue": {"increment": int(hue_increment)}})
return self.get_hue()
def delete_auth_token(self):
r = requests.delete(self.uri_base)
if r.ok:
return True
else:
r.raise_for_status()
@staticmethod
def get_auth_token(address, port=16021):
uri = "http://%s:%d/api/v1/new" % (address, port)
r = requests.post(uri)
if r.ok:
return r.json()["auth_token"]
else:
r.raise_for_status()
| 30.577982 | 102 | 0.626163 | 452 | 3,333 | 4.424779 | 0.267699 | 0.07 | 0.091 | 0.085 | 0.3935 | 0.273 | 0.1765 | 0.034 | 0.034 | 0.034 | 0 | 0.007943 | 0.244524 | 3,333 | 108 | 103 | 30.861111 | 0.786338 | 0.185119 | 0 | 0.285714 | 0 | 0 | 0.127778 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.271429 | false | 0 | 0.042857 | 0.142857 | 0.585714 | 0.028571 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
bf2eb22f2faeb74dacca055961c338188be8c5ba | 123 | py | Python | tests/syntax/assign_to_debug2.py | matan-h/friendly | 3ab0fc6541c837271e8865e247750007acdd18fb | [
"MIT"
] | 287 | 2019-04-08T13:18:29.000Z | 2021-03-14T19:10:21.000Z | tests/syntax/assign_to_debug2.py | matan-h/friendly | 3ab0fc6541c837271e8865e247750007acdd18fb | [
"MIT"
] | 191 | 2019-04-08T14:39:18.000Z | 2021-03-14T22:14:56.000Z | tests/syntax/assign_to_debug2.py | matan-h/friendly | 3ab0fc6541c837271e8865e247750007acdd18fb | [
"MIT"
] | 9 | 2019-04-08T12:54:08.000Z | 2020-11-20T02:26:27.000Z | """Should raise SyntaxError: cannot assign to __debug__ in Py 3.8
and assignment to keyword before."""
a.__debug__ = 1
| 24.6 | 65 | 0.731707 | 19 | 123 | 4.315789 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029703 | 0.178862 | 123 | 4 | 66 | 30.75 | 0.782178 | 0.780488 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bf3959165cfb6c5f3c2f6e23ef5118b2f1dfcfaf | 5,968 | py | Python | tests/measurement_test.py | GerasimovRM/influxalchemy | c6527dc99f18f58da0d2f6602759be40f24d4b44 | [
"MIT"
] | 42 | 2016-08-16T11:36:10.000Z | 2022-02-14T15:50:53.000Z | tests/measurement_test.py | GerasimovRM/influxalchemy | c6527dc99f18f58da0d2f6602759be40f24d4b44 | [
"MIT"
] | 10 | 2017-02-01T16:16:06.000Z | 2022-01-21T23:25:22.000Z | tests/measurement_test.py | GerasimovRM/influxalchemy | c6527dc99f18f58da0d2f6602759be40f24d4b44 | [
"MIT"
] | 6 | 2016-10-26T13:10:21.000Z | 2021-02-19T10:27:07.000Z | """ InfluxAlchemy Measurements. """
from datetime import datetime
from influxalchemy.measurement import Measurement
from influxalchemy.meta import Tag
from influxalchemy.meta import TagExp
from influxalchemy.operations import EQ
from influxalchemy.operations import NE
from influxalchemy.operations import GT
from influxalchemy.operations import LT
from influxalchemy.operations import GE
from influxalchemy.operations import LE
from influxalchemy.operations import LK
from influxalchemy.operations import NK
def test_meta_getattr():
meas = Measurement.new("fizz")
assert meas.buzz == Tag("buzz", meas)
def test_meta_str():
meas = Measurement.new("fizz")
assert str(meas) == "fizz"
def test_meta_ne():
meas0 = Measurement.new("fizz")
meas1 = Measurement.new("buzz")
assert meas0 != meas1
def test_meta_or():
meas0 = Measurement.new("fizz")
meas1 = Measurement.new("buzz")
assert (meas0 | meas1) == Measurement.new("/fizz|buzz/")
def test_meta_measurement():
meas = Measurement.new("fizz")
assert meas == meas.measurement
class Fizz(Measurement):
__measurement__ = "fizz"
def test_new():
assert Measurement.new("fizz") == Fizz
def test_tag_init():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
assert tag == meas.buzz
def test_tag_str():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
assert str(tag) == "buzz"
def test_tag_repr():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
assert repr(tag) == "<fizz.buzz>"
def test_tag_eq():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
exp = tag == "foo"
assert exp == TagExp("buzz", EQ, "foo")
def test_tag_ne():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
exp = tag != "foo"
assert exp == TagExp("buzz", NE, "foo")
def test_tag_gt():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
exp = tag > "foo"
assert exp == TagExp("buzz", GT, "foo")
def test_tag_lt():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
exp = tag < "foo"
assert exp == TagExp("buzz", LT, "foo")
def test_tag_ge():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
exp = tag >= "foo"
assert exp == TagExp("buzz", GE, "foo")
def test_tag_le():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
exp = tag <= "foo"
assert exp == TagExp("buzz", LE, "foo")
def test_tag_like():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
exp = tag.like("foo")
assert exp == TagExp("buzz", LK, "foo")
def test_tag_notlike():
meas = Measurement.new("fizz")
tag = Tag("buzz", meas)
exp = tag.notlike("foo")
assert exp == TagExp("buzz", NK, "foo")
def test_time_between():
meas = Measurement.new("fizz")
exp = meas.time.between("'2016-01-01'", "now() - 7d")
assert exp == \
TagExp(meas.time, " >= ", "'2016-01-01'") & \
TagExp(meas.time, " <= ", "now() - 7d")
def test_time_between_excl():
meas = Measurement.new("fizz")
exp = meas.time.between("'2016-01-01'", "now() - 7d", False, False)
assert exp == \
TagExp(meas.time, " > ", "'2016-01-01'") & \
TagExp(meas.time, " < ", "now() - 7d")
def test_time_between_dt():
meas = Measurement.new("fizz")
d = datetime(2016, 1, 1)
exp = meas.time.between(d, "now() - 7d")
assert exp == \
TagExp(meas.time, " >= ", d) & \
TagExp(meas.time, " <= ", "now() - 7d")
def test_exp_init():
meas = Measurement.new("fizz")
exp = TagExp(meas.buzz, " = ", "goo")
assert exp._left == meas.buzz
assert exp._op == " = "
assert exp._right == "'goo'"
def test_exp_str():
meas = Measurement.new("fizz")
exp = TagExp(meas.buzz, " = ", "goo")
assert str(exp) == "buzz = 'goo'"
def test_exp_repr():
meas = Measurement.new("fizz")
exp = TagExp(meas.buzz, " = ", "goo")
assert repr(exp) == "[ buzz = 'goo' ]"
def test_exp_ne():
meas = Measurement.new("fizz")
exp0 = TagExp(meas.buzz, " = ", "goo")
exp1 = TagExp(meas.guzz, " = ", "zoo")
assert exp0 != exp1
def test_exp_and():
meas = Measurement.new("fizz")
exp0 = TagExp(meas.buzz, " = ", "goo")
exp1 = TagExp(meas.guzz, " = ", "zoo")
assert (exp0 & exp1) == \
TagExp("buzz = 'goo'", " AND ", "guzz = 'zoo'")
def test_exp_or():
meas = Measurement.new("fizz")
exp0 = TagExp(meas.buzz, " = ", "goo")
exp1 = TagExp(meas.guzz, " = ", "zoo")
assert (exp0 | exp1) == \
TagExp("buzz = 'goo'", " OR ", "guzz = 'zoo'")
def test_exp_inv():
meas = Measurement.new("fizz")
exp = TagExp(meas.buzz, EQ, "goo")
assert ~exp == TagExp(meas.buzz, NE, "'goo'")
def test_equals():
meas = Measurement.new("fizz")
exp = TagExp.equals(meas.buzz, "goo")
assert exp == TagExp(meas.buzz, EQ, "goo")
def test_notequals():
meas = Measurement.new("fizz")
exp = TagExp.notequals(meas.buzz, "goo")
assert exp == TagExp(meas.buzz, NE, "goo")
def test_greater_than():
meas = Measurement.new("fizz")
exp = TagExp.greater_than(meas.buzz, "goo")
assert exp == TagExp(meas.buzz, GT, "goo")
def test_less_than():
meas = Measurement.new("fizz")
exp = TagExp.less_than(meas.buzz, "goo")
assert exp == TagExp(meas.buzz, LT, "goo")
def test_greater_equal():
meas = Measurement.new("fizz")
exp = TagExp.greater_equal(meas.buzz, "goo")
assert exp == TagExp(meas.buzz, GE, "goo")
def test_less_equal():
meas = Measurement.new("fizz")
exp = TagExp.less_equal(meas.buzz, "goo")
assert exp == TagExp(meas.buzz, LE, "goo")
def test_like():
meas = Measurement.new("fizz")
exp = TagExp.like(meas.buzz, "goo")
assert exp == TagExp(meas.buzz, LK, "goo")
def test_notlike():
meas = Measurement.new("fizz")
exp = TagExp.notlike(meas.buzz, "goo")
assert exp == TagExp(meas.buzz, NK, "goo")
| 24.260163 | 71 | 0.603552 | 785 | 5,968 | 4.489172 | 0.081529 | 0.150965 | 0.183882 | 0.199773 | 0.668558 | 0.623156 | 0.55647 | 0.494608 | 0.452327 | 0.372872 | 0 | 0.013693 | 0.216823 | 5,968 | 245 | 72 | 24.359184 | 0.740265 | 0.004524 | 0 | 0.356725 | 0 | 0 | 0.108377 | 0 | 0 | 0 | 0 | 0 | 0.216374 | 1 | 0.204678 | false | 0 | 0.070175 | 0 | 0.28655 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1726d2567e3a91f86f1caaf7fd11dbe6ea6a1494 | 161 | py | Python | np/reference/ch6code/pseudoinversion.py | focusunsink/study_python | 322326642db54df8725793d70a95d21ac40b6507 | [
"MIT"
] | null | null | null | np/reference/ch6code/pseudoinversion.py | focusunsink/study_python | 322326642db54df8725793d70a95d21ac40b6507 | [
"MIT"
] | null | null | null | np/reference/ch6code/pseudoinversion.py | focusunsink/study_python | 322326642db54df8725793d70a95d21ac40b6507 | [
"MIT"
] | null | null | null | import numpy as np
A = np.mat("4 11 14;8 7 -2")
print "A\n", A
pseudoinv = np.linalg.pinv(A)
print "Pseudo inverse\n", pseudoinv
print "Check", A * pseudoinv
| 16.1 | 35 | 0.664596 | 31 | 161 | 3.451613 | 0.645161 | 0.186916 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060606 | 0.180124 | 161 | 9 | 36 | 17.888889 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.236025 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.166667 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
173952435220a93ec84a74af4558313a84362688 | 1,460 | py | Python | tfsnippet/modules/container/lambda_.py | 897615138/tfsnippet-jill | 2fc898a4def866c8d3c685168df1fa22083bb143 | [
"MIT"
] | null | null | null | tfsnippet/modules/container/lambda_.py | 897615138/tfsnippet-jill | 2fc898a4def866c8d3c685168df1fa22083bb143 | [
"MIT"
] | null | null | null | tfsnippet/modules/container/lambda_.py | 897615138/tfsnippet-jill | 2fc898a4def866c8d3c685168df1fa22083bb143 | [
"MIT"
] | 1 | 2020-02-08T15:33:41.000Z | 2020-02-08T15:33:41.000Z | from ..base import Module
__all__ = ['Lambda']
class Lambda(Module):
"""
Wrapping arbitrary function into a neural network :class:`Module`.
This class wraps an arbitrary function or lambda expression into
a neural network :class:`Module`, reusing the variables created
within the specified function.
For example, one may wrap :func:`tensorflow.contrib.layers.fully_connected`
into a reusable module with :class:`Lambda` component as follows:
.. code-block:: python
import functools
from tensorflow.contrib import layers
dense = Lambda(
functools.partial(
layers.fully_connected,
num_outputs=100,
activation_fn=tf.nn.relu
)
)
"""
def __init__(self, f, name=None, scope=None):
"""
Construct the :class:`Lambda`.
Args:
f ((inputs, \**kwargs) -> outputs): The function or lambda
expression which derives the outputs.
name (str): Optional name of this module
(argument of :class:`~tfsnippet.utils.VarScopeObject`).
scope (str): Optional scope of this module
(argument of :class:`~tfsnippet.utils.VarScopeObject`).
"""
super(Lambda, self).__init__(name=name, scope=scope)
self._factory = f
def _forward(self, inputs, **kwargs):
return self._factory(inputs, **kwargs)
| 30.416667 | 79 | 0.608219 | 160 | 1,460 | 5.43125 | 0.49375 | 0.037975 | 0.025316 | 0.041427 | 0.193326 | 0.193326 | 0.126582 | 0.126582 | 0.126582 | 0 | 0 | 0.002915 | 0.295205 | 1,460 | 47 | 80 | 31.06383 | 0.841594 | 0.678767 | 0 | 0 | 0 | 0 | 0.019108 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
1741c93e41409ac97a6de4b0f30609e899e5373a | 703 | py | Python | app_portfolio_projects/models.py | MichaelDoctor/Portfolio | 41d9104ef6d34f8eb146230b19038b445351c713 | [
"MIT"
] | null | null | null | app_portfolio_projects/models.py | MichaelDoctor/Portfolio | 41d9104ef6d34f8eb146230b19038b445351c713 | [
"MIT"
] | 4 | 2021-06-09T18:02:18.000Z | 2022-01-13T03:06:24.000Z | app_portfolio_projects/models.py | MichaelDoctor/Portfolio | 41d9104ef6d34f8eb146230b19038b445351c713 | [
"MIT"
] | null | null | null | from django.db import models
from datetime import datetime
class Project(models.Model):
class_name = models.CharField(
max_length=150,
default='col-lg-3 col-md-4 portfolio-item isotope-item'
)
img = models.ImageField(upload_to='photos/%Y/%m/%d/')
title = models.CharField(max_length=100)
author = models.CharField(max_length=100)
date_time = models.DateTimeField(default=datetime.now, blank=True)
date = models.CharField(max_length=100, blank=True)
content = models.TextField(max_length=200, blank=True)
link = models.CharField(max_length=50, default='#')
class Meta:
ordering = ['id']
def __str__(self):
return self.title
| 30.565217 | 70 | 0.688478 | 94 | 703 | 5.010638 | 0.553191 | 0.11465 | 0.191083 | 0.254777 | 0.171975 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033333 | 0.189189 | 703 | 22 | 71 | 31.954545 | 0.792982 | 0 | 0 | 0 | 0 | 0 | 0.091038 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0.111111 | 0.055556 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
174fe247d922831acdf4549e52f6dd777b13736b | 165 | py | Python | settings.py | ChunGaoY/vehicle-distance | b7a92a8f602b652bf34957f37071ebe70de92b81 | [
"MIT"
] | 60 | 2018-11-25T10:53:31.000Z | 2021-09-05T09:55:34.000Z | settings.py | fuhao7i/Vehicle-Distance-Detection | b7a92a8f602b652bf34957f37071ebe70de92b81 | [
"MIT"
] | 3 | 2019-05-02T13:21:53.000Z | 2021-06-04T07:39:12.000Z | settings.py | fuhao7i/Vehicle-Distance-Detection | b7a92a8f602b652bf34957f37071ebe70de92b81 | [
"MIT"
] | 30 | 2019-03-25T08:19:13.000Z | 2021-09-13T08:51:02.000Z | CALIB_FILE_NAME = "calib.p"
PERSPECTIVE_FILE_NAME = "projection.p"
VIDEO_SIZE = 1280, 720
ORIGINAL_SIZE = 1280, 720
MODEL_SIZE = 608., 608.
UNWARPED_SIZE = 500, 600 | 23.571429 | 38 | 0.757576 | 26 | 165 | 4.5 | 0.615385 | 0.136752 | 0.188034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 0.133333 | 165 | 7 | 39 | 23.571429 | 0.636364 | 0 | 0 | 0 | 0 | 0 | 0.114458 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
175f6fea998cd851b5d19f586682721957c2e453 | 191 | py | Python | moto/transcribe/urls.py | orenmazor/moto | 4778377e8ecaf729d26602a2c5202b72c1438503 | [
"Apache-2.0"
] | 1 | 2021-12-12T04:23:06.000Z | 2021-12-12T04:23:06.000Z | moto/transcribe/urls.py | orenmazor/moto | 4778377e8ecaf729d26602a2c5202b72c1438503 | [
"Apache-2.0"
] | 4 | 2017-09-30T07:52:52.000Z | 2021-12-13T06:56:55.000Z | moto/transcribe/urls.py | orenmazor/moto | 4778377e8ecaf729d26602a2c5202b72c1438503 | [
"Apache-2.0"
] | 2 | 2021-11-24T08:05:43.000Z | 2021-11-25T16:18:48.000Z | from __future__ import unicode_literals
from .responses import TranscribeResponse
url_bases = ["https?://transcribe.(.+).amazonaws.com"]
url_paths = {"{0}/$": TranscribeResponse.dispatch}
| 23.875 | 54 | 0.759162 | 20 | 191 | 6.9 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00578 | 0.094241 | 191 | 7 | 55 | 27.285714 | 0.791908 | 0 | 0 | 0 | 0 | 0 | 0.225131 | 0.198953 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
176a76bbe9888382d9a3abc774dede79b852884a | 180 | py | Python | setup.py | artizirk/noby | 162716086fdaea53f08c623ae17751be29201246 | [
"MIT"
] | 1 | 2017-07-01T13:19:22.000Z | 2017-07-01T13:19:22.000Z | setup.py | artizirk/noby | 162716086fdaea53f08c623ae17751be29201246 | [
"MIT"
] | 5 | 2017-09-08T08:33:21.000Z | 2019-02-05T09:03:58.000Z | setup.py | artizirk/noby | 162716086fdaea53f08c623ae17751be29201246 | [
"MIT"
] | 2 | 2018-06-25T10:06:12.000Z | 2021-03-09T17:03:18.000Z | #!/usr/bin/env python
from setuptools import setup
from noby import __version__
setup(
version = __version__,
entry_points = {'console_scripts': ['noby = noby:main']}
)
| 16.363636 | 60 | 0.705556 | 22 | 180 | 5.318182 | 0.681818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177778 | 180 | 10 | 61 | 18 | 0.790541 | 0.111111 | 0 | 0 | 0 | 0 | 0.194969 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
178953a7d7f87958ac58bb8129f5bfe80890531e | 80 | py | Python | .history/ClassFiles/DataTypes/Number_20201230220753.py | minefarmer/Comprehensive-Python | f97b9b83ec328fc4e4815607e6a65de90bb8de66 | [
"Unlicense"
] | null | null | null | .history/ClassFiles/DataTypes/Number_20201230220753.py | minefarmer/Comprehensive-Python | f97b9b83ec328fc4e4815607e6a65de90bb8de66 | [
"Unlicense"
] | null | null | null | .history/ClassFiles/DataTypes/Number_20201230220753.py | minefarmer/Comprehensive-Python | f97b9b83ec328fc4e4815607e6a65de90bb8de66 | [
"Unlicense"
] | null | null | null | """ Number Data types
Integers(int)
Floating Point(float)
Integer
"""
| 10 | 29 | 0.6375 | 9 | 80 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2375 | 80 | 7 | 30 | 11.428571 | 0.836066 | 0.7625 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
178999d8d0f76b6ef43110aa3fd5e40618498d28 | 531 | py | Python | qcloudsdkcam/ListGroupsForUserRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdkcam/ListGroupsForUserRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdkcam/ListGroupsForUserRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class ListGroupsForUserRequest(Request):
def __init__(self):
super(ListGroupsForUserRequest, self).__init__(
'cam', 'qcloudcliV1', 'ListGroupsForUser', 'cam.api.qcloud.com')
def get_page(self):
return self.get_params().get('page')
def set_page(self, page):
self.add_param('page', page)
def get_rp(self):
return self.get_params().get('rp')
def set_rp(self, rp):
self.add_param('rp', rp)
| 24.136364 | 76 | 0.634652 | 65 | 531 | 4.938462 | 0.415385 | 0.074766 | 0.087227 | 0.105919 | 0.161994 | 0.161994 | 0 | 0 | 0 | 0 | 0 | 0.004819 | 0.218456 | 531 | 21 | 77 | 25.285714 | 0.768675 | 0.039548 | 0 | 0 | 0 | 0 | 0.120079 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.384615 | false | 0 | 0.076923 | 0.153846 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
bd6b63a4491d0865f3aaac155b3d650c899ee9d4 | 658 | py | Python | language/python_rasa/personal/example_core/second/bot.py | Wabri/Notes | a194fbecf97f5b45157049693ae1741ec7f0a60b | [
"MIT"
] | 9 | 2018-06-26T11:36:51.000Z | 2021-07-26T10:47:42.000Z | language/python_rasa/personal/example_core/second/bot.py | Wabri/Notes | a194fbecf97f5b45157049693ae1741ec7f0a60b | [
"MIT"
] | 3 | 2018-06-27T14:41:28.000Z | 2018-07-12T08:08:47.000Z | language/python_rasa/personal/example_core/second/bot.py | Wabri/Notes | a194fbecf97f5b45157049693ae1741ec7f0a60b | [
"MIT"
] | 2 | 2019-05-09T09:17:48.000Z | 2021-07-26T10:47:44.000Z | from rasa_core import utils
from rasa_core.actions import Action
from rasa_core.agent import Agent
from rasa_core.events import SlotSet
from rasa_core.interpreter import RasaNLUInterpreter
class RestaurantAPI(object):
def search(self, info):
return "papi's pizza place"
class ActionSearchRestaurants(Action):
def name(self):
return 'action_ricerca_ristoranti'
def run(self, dispatcher, tracker, domain):
dispatcher.utter_message("Loocking for restaurants")
restaurant_api = RestaurantAPI()
restaurants = restaurant_api.search(tracker.get_slot("cucina"))
return [SlotSet("matches", restaurants)]
| 32.9 | 71 | 0.746201 | 78 | 658 | 6.153846 | 0.551282 | 0.083333 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.174772 | 658 | 19 | 72 | 34.631579 | 0.883978 | 0 | 0 | 0 | 0 | 0 | 0.121581 | 0.037994 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1875 | false | 0 | 0.3125 | 0.125 | 0.8125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
bd8d007c562528c72a6e2ea38f1cdd6e42955e00 | 321 | py | Python | solutions/python3/732.py | sm2774us/amazon_interview_prep_2021 | f580080e4a6b712b0b295bb429bf676eb15668de | [
"MIT"
] | 42 | 2020-08-02T07:03:49.000Z | 2022-03-26T07:50:15.000Z | solutions/python3/732.py | ajayv13/leetcode | de02576a9503be6054816b7444ccadcc0c31c59d | [
"MIT"
] | null | null | null | solutions/python3/732.py | ajayv13/leetcode | de02576a9503be6054816b7444ccadcc0c31c59d | [
"MIT"
] | 40 | 2020-02-08T02:50:24.000Z | 2022-03-26T15:38:10.000Z | class MyCalendarThree:
def __init__(self):
self.times = []
def book(self, start, end):
bisect.insort(self.times, (start, 1))
bisect.insort(self.times, (end, -1))
res = cur = 0
for _, x in self.times:
cur += x
res = max(res, cur)
return res | 24.692308 | 45 | 0.507788 | 40 | 321 | 3.95 | 0.5 | 0.227848 | 0.202532 | 0.265823 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014706 | 0.364486 | 321 | 13 | 46 | 24.692308 | 0.759804 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0 | 0 | 0.363636 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bd9928f8fbdba56af3a044655219e0495f9c037d | 57 | py | Python | make/photon/prepare/migrations/__init__.py | mjthomp95/harbor | d82dfaf11e3a4f52ed1d54c32b884a79290d477d | [
"Apache-2.0"
] | 1 | 2019-06-06T02:39:40.000Z | 2019-06-06T02:39:40.000Z | make/photon/prepare/migrations/__init__.py | koulq/harbor | fdb82ae4fa1d5e8987caa076feb7a61f5baae902 | [
"Apache-2.0"
] | null | null | null | make/photon/prepare/migrations/__init__.py | koulq/harbor | fdb82ae4fa1d5e8987caa076feb7a61f5baae902 | [
"Apache-2.0"
] | null | null | null | import os
MIGRATION_BASE_DIR = os.path.dirname(__file__) | 19 | 46 | 0.824561 | 9 | 57 | 4.555556 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087719 | 57 | 3 | 46 | 19 | 0.788462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bda67452945e02b8b6136af05f8303db562d88ee | 583 | py | Python | tests/test_webapp.py | patymori/packtools | ab6e2e2de1c9fcb25feabc55e571b8eddcbf3d14 | [
"BSD-2-Clause"
] | 8 | 2017-05-26T23:21:13.000Z | 2019-11-23T17:38:17.000Z | tests/test_webapp.py | patymori/packtools | ab6e2e2de1c9fcb25feabc55e571b8eddcbf3d14 | [
"BSD-2-Clause"
] | 198 | 2015-01-26T16:34:03.000Z | 2022-03-12T00:14:44.000Z | tests/test_webapp.py | patymori/packtools | ab6e2e2de1c9fcb25feabc55e571b8eddcbf3d14 | [
"BSD-2-Clause"
] | 13 | 2015-04-03T13:39:49.000Z | 2021-09-12T11:58:39.000Z | import unittest
import os
from flask_testing import TestCase
from packtools.webapp import app
class TestWebAppTests(TestCase):
def create_app(self):
return app.create_app("packtools.webapp.config.default.TestingConfig")
def test_packtools_stylechecker(self):
response = self.client.get("/stylechecker")
self.assertIn("SciELO Style Checker",response.data.decode("utf-8"))
def test_packtools_preview_html(self):
response = self.client.get("/previews")
self.assertIn("SciELO HTML Previewer",response.data.decode("utf-8"))
| 22.423077 | 78 | 0.722127 | 71 | 583 | 5.816901 | 0.507042 | 0.072639 | 0.077482 | 0.106538 | 0.227603 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004124 | 0.168096 | 583 | 25 | 79 | 23.32 | 0.847423 | 0 | 0 | 0 | 0 | 0 | 0.203098 | 0.077453 | 0 | 0 | 0 | 0 | 0.153846 | 1 | 0.230769 | false | 0 | 0.307692 | 0.076923 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
bdaaad946f1b2ea96476d1fb7bf5639f8b9584bc | 527 | py | Python | July 2021/Count Vowels Permutation.py | parikshitgupta1/leetcode | eba6c11740dc7597204af127c0f4c2163376294f | [
"MIT"
] | null | null | null | July 2021/Count Vowels Permutation.py | parikshitgupta1/leetcode | eba6c11740dc7597204af127c0f4c2163376294f | [
"MIT"
] | null | null | null | July 2021/Count Vowels Permutation.py | parikshitgupta1/leetcode | eba6c11740dc7597204af127c0f4c2163376294f | [
"MIT"
] | null | null | null | class Solution:
def countVowelPermutation(self, n: int) -> int:
mod = 10**9 + 7
dp = [[0] * 5 for _ in range(n)]
for j in range(5):
dp[0][j] = 1
for i in range(1, n):
dp[i][0] = (dp[i-1][1] + dp[i-1][2] + dp[i-1][4]) % mod
dp[i][1] = (dp[i-1][0] + dp[i-1][2]) % mod
dp[i][2] = (dp[i-1][1] + dp[i-1][3]) % mod
dp[i][3] = (dp[i-1][2]) % mod
dp[i][4] = (dp[i-1][2] + dp[i-1][3]) % mod
return sum(dp[-1]) % mod
| 31 | 67 | 0.381404 | 99 | 527 | 2.020202 | 0.252525 | 0.225 | 0.22 | 0.1 | 0.31 | 0.27 | 0.27 | 0 | 0 | 0 | 0 | 0.107784 | 0.366224 | 527 | 16 | 68 | 32.9375 | 0.491018 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0 | 0 | 0.230769 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bdd284e9c4e203861c2d0f8ae9f348617a8b36ef | 184 | py | Python | rabbitmq_client/exceptions.py | latonaio/rabbitmq-python-client | 2e5146756b13016a6f6ccbe7f687fce79568841a | [
"MIT"
] | 8 | 2021-10-01T07:10:58.000Z | 2021-11-13T06:14:21.000Z | rabbitmq_client/exceptions.py | latonaio/rabbitmq-python-client | 2e5146756b13016a6f6ccbe7f687fce79568841a | [
"MIT"
] | null | null | null | rabbitmq_client/exceptions.py | latonaio/rabbitmq-python-client | 2e5146756b13016a6f6ccbe7f687fce79568841a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
class RabbitmqClientError(Exception):
pass
class RabbitmqConnectionError(RabbitmqClientError):
pass
class QueueNotFoundError(RabbitmqClientError):
pass
| 14.153846 | 51 | 0.782609 | 15 | 184 | 9.6 | 0.6 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006173 | 0.119565 | 184 | 12 | 52 | 15.333333 | 0.882716 | 0.11413 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
bdd2e61d28268488ae73ba6d84ed974430a42926 | 1,094 | py | Python | cliva_fl/utils/validation_buffer.py | DataManagementLab/thesis-fl_client-side_validation | 0f6a35d08966133e6a8c13a110b9307d91f2d9cb | [
"MIT"
] | null | null | null | cliva_fl/utils/validation_buffer.py | DataManagementLab/thesis-fl_client-side_validation | 0f6a35d08966133e6a8c13a110b9307d91f2d9cb | [
"MIT"
] | null | null | null | cliva_fl/utils/validation_buffer.py | DataManagementLab/thesis-fl_client-side_validation | 0f6a35d08966133e6a8c13a110b9307d91f2d9cb | [
"MIT"
] | null | null | null |
from cliva_fl.utils import ValidationSet
class ValidationBuffer:
def __init__(self, epoch, buffer_size):
self.epoch = epoch
self.buffer_size = buffer_size
self.buffer = dict()
def set_init_model_state(self, model):
self.init_model_state_dict = { k: v.detach().clone().cpu() for k, v in model.state_dict().items() }
def get_init_model_state(self):
return self.init_model_state_dict
def add(self, batch: int, vset: ValidationSet):
assert not self.full(), 'Buffer is full and more items can not be added.'
self.buffer[batch] = vset
def get(self, batch: int):
return self.buffer[batch]
def keys(self):
return self.buffer.keys()
def values(self):
return self.buffer.values()
def items(self):
return self.buffer.items()
def full(self):
return self.size() >= self.buffer_size
def size(self):
return len(self.buffer)
def clear(self):
del self.init_model_state_dict
self.buffer.clear()
| 26.047619 | 107 | 0.613346 | 145 | 1,094 | 4.455172 | 0.317241 | 0.154799 | 0.108359 | 0.083591 | 0.102167 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.28245 | 1,094 | 41 | 108 | 26.682927 | 0.82293 | 0 | 0 | 0 | 0 | 0 | 0.043001 | 0 | 0 | 0 | 0 | 0 | 0.035714 | 1 | 0.392857 | false | 0 | 0.035714 | 0.25 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
bdd508385184a646cb52dea1ab5be8b54294a5e6 | 77 | py | Python | login.py | xingchenyues/python18 | 49bf34ed98050f7be512f6cbbd43045ad0fdc888 | [
"MIT"
] | null | null | null | login.py | xingchenyues/python18 | 49bf34ed98050f7be512f6cbbd43045ad0fdc888 | [
"MIT"
] | null | null | null | login.py | xingchenyues/python18 | 49bf34ed98050f7be512f6cbbd43045ad0fdc888 | [
"MIT"
] | null | null | null | def login():
return 'login info'
a = 18
num1 = 30
num2 = 10
num2 = 20
| 5.923077 | 20 | 0.571429 | 13 | 77 | 3.384615 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207547 | 0.311688 | 77 | 12 | 21 | 6.416667 | 0.622642 | 0 | 0 | 0 | 0 | 0 | 0.12987 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0.166667 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
bdff2d438944d8aa88f687cc39b8e841091e0dc9 | 4,541 | py | Python | backend/data_import/pipeline/label.py | stungkit/doccano | 922d5f0e2f6ced6cd0d5ca7cafa0ae57cf07bea9 | [
"MIT"
] | 2,082 | 2018-05-09T07:16:21.000Z | 2019-12-01T16:41:50.000Z | backend/data_import/pipeline/label.py | stungkit/doccano | 922d5f0e2f6ced6cd0d5ca7cafa0ae57cf07bea9 | [
"MIT"
] | 365 | 2018-07-31T13:49:05.000Z | 2019-11-29T11:25:17.000Z | backend/data_import/pipeline/label.py | admariner/doccano | 922d5f0e2f6ced6cd0d5ca7cafa0ae57cf07bea9 | [
"MIT"
] | 476 | 2018-08-17T06:43:57.000Z | 2019-12-01T09:47:08.000Z | import abc
import uuid
from typing import Any, Optional
from pydantic import UUID4, BaseModel, ConstrainedStr, NonNegativeInt, root_validator
from .label_types import LabelTypes
from examples.models import Example
from label_types.models import CategoryType, LabelType, RelationType, SpanType
from labels.models import Category as CategoryModel
from labels.models import Label as LabelModel
from labels.models import Relation as RelationModel
from labels.models import Span as SpanModel
from labels.models import TextLabel as TextLabelModel
from projects.models import Project
class NonEmptyStr(ConstrainedStr):
min_length = 1
class Label(BaseModel, abc.ABC):
id: int = -1
uuid: UUID4
example_uuid: UUID4
def __init__(self, **data):
data["uuid"] = uuid.uuid4()
super().__init__(**data)
@abc.abstractmethod
def __lt__(self, other):
raise NotImplementedError()
@classmethod
def parse(cls, example_uuid: UUID4, obj: Any):
raise NotImplementedError()
@abc.abstractmethod
def create_type(self, project: Project) -> Optional[LabelType]:
raise NotImplementedError()
@abc.abstractmethod
def create(self, user, example: Example, types: LabelTypes, **kwargs) -> LabelModel:
raise NotImplementedError
def __hash__(self):
return hash(tuple(self.dict()))
class CategoryLabel(Label):
label: NonEmptyStr
def __lt__(self, other):
return self.label < other.label
@classmethod
def parse(cls, example_uuid: UUID4, obj: Any):
return cls(example_uuid=example_uuid, label=obj)
def create_type(self, project: Project) -> Optional[LabelType]:
return CategoryType(text=self.label, project=project)
def create(self, user, example: Example, types: LabelTypes, **kwargs):
return CategoryModel(uuid=self.uuid, user=user, example=example, label=types[self.label])
class SpanLabel(Label):
label: NonEmptyStr
start_offset: NonNegativeInt
end_offset: NonNegativeInt
def __lt__(self, other):
return self.start_offset < other.start_offset
@root_validator
def check_start_offset_is_less_than_end_offset(cls, values):
start_offset, end_offset = values.get("start_offset"), values.get("end_offset")
if start_offset >= end_offset:
raise ValueError("start_offset must be less than end_offset.")
return values
@classmethod
def parse(cls, example_uuid: UUID4, obj: Any):
if isinstance(obj, list) or isinstance(obj, tuple):
columns = ["start_offset", "end_offset", "label"]
obj = zip(columns, obj)
return cls(example_uuid=example_uuid, **dict(obj))
elif isinstance(obj, dict):
return cls(example_uuid=example_uuid, **obj)
raise ValueError("SpanLabel.parse()")
def create_type(self, project: Project) -> Optional[LabelType]:
return SpanType(text=self.label, project=project)
def create(self, user, example: Example, types: LabelTypes, **kwargs):
return SpanModel(
uuid=self.uuid,
user=user,
example=example,
start_offset=self.start_offset,
end_offset=self.end_offset,
label=types[self.label],
)
class TextLabel(Label):
text: NonEmptyStr
def __lt__(self, other):
return self.text < other.text
@classmethod
def parse(cls, example_uuid: UUID4, obj: Any):
return cls(example_uuid=example_uuid, text=obj)
def create_type(self, project: Project) -> Optional[LabelType]:
return None
def create(self, user, example: Example, types: LabelTypes, **kwargs):
return TextLabelModel(uuid=self.uuid, user=user, example=example, text=self.text)
class RelationLabel(Label):
from_id: int
to_id: int
type: NonEmptyStr
def __lt__(self, other):
return self.from_id < other.from_id
@classmethod
def parse(cls, example_uuid: UUID4, obj: Any):
return cls(example_uuid=example_uuid, **obj)
def create_type(self, project: Project) -> Optional[LabelType]:
return RelationType(text=self.type, project=project)
def create(self, user, example: Example, types: LabelTypes, **kwargs):
return RelationModel(
uuid=self.uuid,
user=user,
example=example,
type=types[self.type],
from_id=kwargs["id_to_span"][self.from_id],
to_id=kwargs["id_to_span"][self.to_id],
)
| 30.682432 | 97 | 0.676283 | 544 | 4,541 | 5.470588 | 0.167279 | 0.05914 | 0.047043 | 0.036962 | 0.483199 | 0.46707 | 0.407594 | 0.315188 | 0.299059 | 0.233871 | 0 | 0.003123 | 0.2244 | 4,541 | 147 | 98 | 30.891156 | 0.841851 | 0 | 0 | 0.363636 | 0 | 0 | 0.029068 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.209091 | false | 0 | 0.118182 | 0.145455 | 0.663636 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
da20dcff16fdb5aed074c40b7419e7ef2e8ce9ba | 241 | py | Python | release/scripts/mgear/animbits/cache_manager/__init__.py | yamahigashi/mgear4 | d439a69bbdc0ec727cded924a616b14194dfbe00 | [
"MIT"
] | 72 | 2020-09-28T20:00:59.000Z | 2022-03-25T14:35:14.000Z | release/scripts/mgear/animbits/cache_manager/__init__.py | Mikfr83/mgear4 | 2fa28080027f1004e8e0139ccf93f7ec2448b1fd | [
"MIT"
] | 101 | 2020-09-28T19:53:53.000Z | 2022-03-31T01:44:41.000Z | release/scripts/mgear/animbits/cache_manager/__init__.py | Mikfr83/mgear4 | 2fa28080027f1004e8e0139ccf93f7ec2448b1fd | [
"MIT"
] | 32 | 2020-10-09T10:49:45.000Z | 2022-03-31T08:27:37.000Z | """ ANIMATION CACHE MANAGER
mGear's animation cache manager is a tool that allows generating a Alembic GPU
cache representation of references rigs inside Autodesk Maya.
:module: mgear.animbits.cache_manager.__init__
"""
__version__ = 1.0
| 24.1 | 78 | 0.79668 | 34 | 241 | 5.382353 | 0.764706 | 0.196721 | 0.229508 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009662 | 0.141079 | 241 | 9 | 79 | 26.777778 | 0.874396 | 0.883817 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
da217da852a1f46c24a82a6831deb8486ccbca7a | 522 | py | Python | src/sima/simo/soilfriction.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/simo/soilfriction.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/simo/soilfriction.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | # Generated with SoilFriction
#
from enum import Enum
from enum import auto
class SoilFriction(Enum):
""""""
OPEN_COMPARTMENT = auto()
SOIL_FRACTURE = auto()
OPEN_COMPARTMENT_HORSLIDING = auto()
def label(self):
if self == SoilFriction.OPEN_COMPARTMENT:
return "Open compartment"
if self == SoilFriction.SOIL_FRACTURE:
return "Soil fracture"
if self == SoilFriction.OPEN_COMPARTMENT_HORSLIDING:
return "Open compartment horizontal sliding" | 29 | 60 | 0.668582 | 54 | 522 | 6.314815 | 0.37037 | 0.26393 | 0.158358 | 0.129032 | 0.193548 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.252874 | 522 | 18 | 61 | 29 | 0.874359 | 0.051724 | 0 | 0 | 1 | 0 | 0.131687 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.153846 | 0 | 0.769231 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
da3ca6db7224a5e99109c8982546475cfbb82a2c | 156 | py | Python | fesom2_prefect/__init__.py | pgierz/fesom2_prefect | 504fd975ca84fa4e439ce56bebb5aee42bb6dbb3 | [
"MIT"
] | null | null | null | fesom2_prefect/__init__.py | pgierz/fesom2_prefect | 504fd975ca84fa4e439ce56bebb5aee42bb6dbb3 | [
"MIT"
] | null | null | null | fesom2_prefect/__init__.py | pgierz/fesom2_prefect | 504fd975ca84fa4e439ce56bebb5aee42bb6dbb3 | [
"MIT"
] | null | null | null | """fesom2_prefect - Prefect 1.0 Workflows For FESOM 2"""
__version__ = "0.1.0"
__author__ = "Paul Gierz <paul.gierz@awi.de>"
from . import compile_fesom2
| 22.285714 | 56 | 0.717949 | 24 | 156 | 4.25 | 0.708333 | 0.039216 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.059701 | 0.141026 | 156 | 6 | 57 | 26 | 0.701493 | 0.320513 | 0 | 0 | 0 | 0 | 0.35 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
da4ecc1bca77282c0063c5b2345d6a284338c670 | 1,154 | py | Python | components/topmenu/dropmenu.py | Solomon1999/kivystudio | 1eeee68b1437bf4d26f6bb222dc6c127ca67ee58 | [
"MIT"
] | 1 | 2020-02-18T17:41:07.000Z | 2020-02-18T17:41:07.000Z | components/topmenu/dropmenu.py | Solomon1999/kivystudio | 1eeee68b1437bf4d26f6bb222dc6c127ca67ee58 | [
"MIT"
] | null | null | null | components/topmenu/dropmenu.py | Solomon1999/kivystudio | 1eeee68b1437bf4d26f6bb222dc6c127ca67ee58 | [
"MIT"
] | null | null | null | from kivy.uix.dropdown import DropDown
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivystudio.behaviors import HoverBehavior
from kivystudio.widgets.dropdown import DropDownBase
import os
filepath = os.path.dirname(__file__)
Builder.load_file(os.path.join(filepath,'dropmenu.kv'))
class MenuButton(HoverBehavior, ButtonBehavior, BoxLayout):
pass
class FileTopMenu(DropDownBase):
def __init__(self, **k):
super(FileTopMenu, self).__init__(**k)
def open_file(self):
pass
def open_folder(self):
pass
def open_recent(self):
pass
def exit_window(self):
pass
def save(self):
pass
def save_all(self):
pass
def save_as(self):
pass
class EditTopMenu(DropDownBase):
def __init__(self, **k):
super(FileTopMenu, self).__init__(**k)
class ViewTopMenu(DropDownBase):
def __init__(self, **k):
super(FileTopMenu, self).__init__(**k)
class HelpTopMenu(DropDownBase):
def __init__(self, **k):
super(FileTopMenu, self).__init__(**k)
| 20.607143 | 59 | 0.682842 | 138 | 1,154 | 5.398551 | 0.311594 | 0.075168 | 0.088591 | 0.12349 | 0.27651 | 0.27651 | 0.27651 | 0.27651 | 0.27651 | 0.27651 | 0 | 0 | 0.213172 | 1,154 | 55 | 60 | 20.981818 | 0.820485 | 0 | 0 | 0.432432 | 0 | 0 | 0.009532 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.297297 | false | 0.216216 | 0.189189 | 0 | 0.621622 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
da527eee402053793a4ed8f9b2a12009e60d0029 | 461 | py | Python | tensorbox/__init__.py | SvenGronauer/tensorbox | 8ca0da9a8fe345572bccdbda55bcd75f1bc1b28c | [
"MIT"
] | null | null | null | tensorbox/__init__.py | SvenGronauer/tensorbox | 8ca0da9a8fe345572bccdbda55bcd75f1bc1b28c | [
"MIT"
] | null | null | null | tensorbox/__init__.py | SvenGronauer/tensorbox | 8ca0da9a8fe345572bccdbda55bcd75f1bc1b28c | [
"MIT"
] | null | null | null | from gym.envs.registration import register
""" Register custom environments at OpenAI Gym
"""
register(
id='Sawtooth-v0',
entry_point='tensorbox.data_driven_control.sawtooth_env:SawtoothWaveEnv',
max_episode_steps=512,
)
register(
id='PT1System-v0',
entry_point='tensorbox.data_driven_control.control_systems:PT1SystemEnv'
)
register(
id='PT2System-v0',
entry_point='tensorbox.data_driven_control.control_systems:PT2SystemEnv'
)
| 21.952381 | 77 | 0.767896 | 55 | 461 | 6.181818 | 0.545455 | 0.088235 | 0.105882 | 0.185294 | 0.417647 | 0.417647 | 0.417647 | 0.305882 | 0.305882 | 0 | 0 | 0.024752 | 0.123644 | 461 | 20 | 78 | 23.05 | 0.816832 | 0 | 0 | 0.214286 | 0 | 0 | 0.508516 | 0.423358 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.071429 | 0 | 0.071429 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
da68599db1b2b538f99b3e6d36625939515b56a7 | 301 | py | Python | custom_auth_user/user/commands/register_command.py | westofpluto/django_custom_auth_user | e8dd1bbbdf943982d68a3183b4931a34b2b2c3f5 | [
"MIT"
] | null | null | null | custom_auth_user/user/commands/register_command.py | westofpluto/django_custom_auth_user | e8dd1bbbdf943982d68a3183b4931a34b2b2c3f5 | [
"MIT"
] | null | null | null | custom_auth_user/user/commands/register_command.py | westofpluto/django_custom_auth_user | e8dd1bbbdf943982d68a3183b4931a34b2b2c3f5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8
def register(user_store, email, username, first_name, last_name, password):
"""
Register command
"""
return user_store.create(
email=email,
username=username,
first_name=first_name,
last_name=last_name,
password=password)
| 20.066667 | 75 | 0.624585 | 34 | 301 | 5.294118 | 0.470588 | 0.15 | 0.2 | 0.188889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004545 | 0.269103 | 301 | 14 | 76 | 21.5 | 0.813636 | 0.116279 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.285714 | 0 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
da7b72b5f2f0de1286212b0ee73492ee8a5b6c0e | 323 | py | Python | examples/play_tvz.py | Yousazoe/oxBot | f677595c97369ac0548329f074cd44b916a84848 | [
"MIT"
] | null | null | null | examples/play_tvz.py | Yousazoe/oxBot | f677595c97369ac0548329f074cd44b916a84848 | [
"MIT"
] | null | null | null | examples/play_tvz.py | Yousazoe/oxBot | f677595c97369ac0548329f074cd44b916a84848 | [
"MIT"
] | null | null | null | from examples.zerg.zerg_rush import ZergRushBot
from sc2 import maps
from sc2.data import Race
from sc2.main import run_game
from sc2.player import Bot, Human
def main():
run_game(maps.get("Abyssal Reef LE"), [Human(Race.Terran), Bot(Race.Zerg, ZergRushBot())], realtime=True)
if __name__ == "__main__":
main()
| 23.071429 | 109 | 0.736842 | 50 | 323 | 4.54 | 0.52 | 0.123348 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.145511 | 323 | 13 | 110 | 24.846154 | 0.807971 | 0 | 0 | 0 | 0 | 0 | 0.071207 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | true | 0 | 0.555556 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
da7d97d2654f6237585d311d4f1e8a33d9255ff3 | 3,113 | py | Python | Wateks/filter_functions.py | jziemer1996/Wateks | 362dc46abf4ab428d6ccce7a61ad879eddc07ef1 | [
"MIT"
] | null | null | null | Wateks/filter_functions.py | jziemer1996/Wateks | 362dc46abf4ab428d6ccce7a61ad879eddc07ef1 | [
"MIT"
] | null | null | null | Wateks/filter_functions.py | jziemer1996/Wateks | 362dc46abf4ab428d6ccce7a61ad879eddc07ef1 | [
"MIT"
] | null | null | null | # ----------------------------------------FILTER FUNCTIONS MODULE----------------------------------- #
# Module to filter the preprocessed raster stacks to minimize the influence of soil moisture a.s.o.
# It is highly recommended to execute this module before analyzing the raster stack!
# Make use of small filter sizes to smooth the curve not too much!
# ------------------------------------------------------------------------------------------------- #
def mean_filter(arr1d, kernel):
"""
reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.convolve.html
simple mean filter for the time series applied along time axis in parallel_apply_along_axis()
----------
arr1d: numpy.array
1D array representing the time series for one pixel
kernel: int
should be set between 3 and 21 for best results, but values need to be uneven, e.g. {"kernel": 3}
Returns
----------
numpy.ndarray
returns mean-filtered numpy array
"""
import numpy as np
kernel = (1 / float(kernel)) * np.ones(kernel)
# !!! ATTENTION: np.convolve with mode set to "valid" will cut n//2 values (kernel size = n) off the beginning and
# end of the time series, bigger kernel sizes produces shorter time series with more data loss.
out = np.float32(np.convolve(arr1d, kernel, "valid"))
return out
def median_filter(arr1d, kernel):
"""
reference: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.medfilt.html
simple median filter for the time series applied along time axis in parallel_apply_along_axis()
----------
arr1d: numpy.array
1D array representing the time series for one pixel
kernel: int
should be set between 3 and 21 for best results, but values need to be uneven, e.g. {"kernel": 3}
Returns
----------
numpy.ndarray
returns median-filtered numpy array
"""
import scipy.signal as sig
import numpy as np
out = np.float32(sig.medfilt(arr1d, kernel_size=kernel))
return out
def sobel_filter(arr1d, kernel):
"""
reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.convolve.html
!!! STACK SHOULD BE MEDIAN-FILTERED BEFORE USE OF THIS FUNCTION !!!
(simply use median_filter() first and use output as new input)
simple sobel filter for the time series applied along time axis in parallel_apply_along_axis()
----------
arr1d: numpy.array
1D array representing the time series for one pixel
kernel: int
series of integers in a list, e. g. {"kernel": [-5, -5, 0, 5, 5]}
should be set between 3 and 21 for best results, but values need to be uneven
Returns
----------
numpy.ndarray
returns sobel-filtered numpy array
"""
import numpy as np
# !!! ATTENTION: np.convolve with mode set to "valid" will cut n//2 values (kernel size = n) off the beginning and
# end of the time series, bigger kernel sizes produces shorter time series with more data loss.
out = np.float32(np.convolve(arr1d, kernel, "valid"))
return out | 43.236111 | 118 | 0.640218 | 430 | 3,113 | 4.602326 | 0.288372 | 0.050531 | 0.052552 | 0.039414 | 0.679131 | 0.679131 | 0.679131 | 0.645781 | 0.645781 | 0.622537 | 0 | 0.015114 | 0.21362 | 3,113 | 72 | 119 | 43.236111 | 0.793301 | 0.773209 | 0 | 0.571429 | 0 | 0 | 0.019268 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.285714 | 0 | 0.714286 | 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 | 1 | 0 | 0 | 3 |
16f8578dccd9954dbd3b085c7b1d34bb1fc12bb0 | 153 | py | Python | project/base/models.py | iMerica/dj-models-demo | f03837e1d26c5bc8de836937074df172c409b404 | [
"MIT"
] | null | null | null | project/base/models.py | iMerica/dj-models-demo | f03837e1d26c5bc8de836937074df172c409b404 | [
"MIT"
] | null | null | null | project/base/models.py | iMerica/dj-models-demo | f03837e1d26c5bc8de836937074df172c409b404 | [
"MIT"
] | null | null | null | from djmodels.db import models
class Person(models.Model):
name = models.CharField(max_length=50)
age = models.PositiveIntegerField(default=1)
| 21.857143 | 48 | 0.75817 | 20 | 153 | 5.75 | 0.85 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022901 | 0.143791 | 153 | 6 | 49 | 25.5 | 0.854962 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
16f98334081be427e864a05eb1f539f993125806 | 432 | py | Python | bugtests/test125.py | doom38/jython_v2.2.1 | 0803a0c953c294e6d14f9fc7d08edf6a3e630a15 | [
"CNRI-Jython"
] | null | null | null | bugtests/test125.py | doom38/jython_v2.2.1 | 0803a0c953c294e6d14f9fc7d08edf6a3e630a15 | [
"CNRI-Jython"
] | null | null | null | bugtests/test125.py | doom38/jython_v2.2.1 | 0803a0c953c294e6d14f9fc7d08edf6a3e630a15 | [
"CNRI-Jython"
] | null | null | null | """
Check reload of module.
"""
import support
src = """
def fun2():
return %s
"""
def mk(v):
f = open("test125m.py", "w")
f.write(src % v)
f.close()
mk("1")
import test125m
from test125m import fun2
support.compare(fun2(), "1")
import time
time.sleep(2)
mk("2")
reload(test125m)
support.compare(fun2(), "1")
from test125m import fun2
support.compare(fun2(), "2")
support.compare(test125m.fun2(), "2")
| 11.076923 | 37 | 0.622685 | 63 | 432 | 4.269841 | 0.412698 | 0.208178 | 0.200743 | 0.163569 | 0.297398 | 0.297398 | 0.297398 | 0 | 0 | 0 | 0 | 0.090909 | 0.185185 | 432 | 38 | 38 | 11.368421 | 0.673295 | 0.053241 | 0 | 0.190476 | 0 | 0 | 0.1125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0 | 0.238095 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e52d61a4c3bcd02e9f551f0f66c7b5bdf56abfc5 | 488 | py | Python | cli/utils.py | Exia-Aix-2016/Data-Project | f8f40cb001dbd74e630b42b930532a364ae0aa5d | [
"MIT"
] | null | null | null | cli/utils.py | Exia-Aix-2016/Data-Project | f8f40cb001dbd74e630b42b930532a364ae0aa5d | [
"MIT"
] | null | null | null | cli/utils.py | Exia-Aix-2016/Data-Project | f8f40cb001dbd74e630b42b930532a364ae0aa5d | [
"MIT"
] | null | null | null | from PyInquirer import Validator, ValidationError
class NumberValidator(Validator):
def validate(self, document):
try:
int(document.text)
except ValueError:
raise ValidationError(
message='Please enter a number',
cursor_position=len(document.text)) # Move cursor to end
def whenMenu(m):
return lambda answers: answers['menu'] == m
def toInt(val): return int(val)
def toFloat(val): return float(val)
| 22.181818 | 73 | 0.641393 | 55 | 488 | 5.672727 | 0.690909 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.268443 | 488 | 21 | 74 | 23.238095 | 0.87395 | 0.036885 | 0 | 0 | 0 | 0 | 0.053419 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0.076923 | 0.230769 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e56ee79a471a4876911430d9c6d1d9700b957b1d | 468 | py | Python | backend/users/tests/utils.py | kindziora/doccano | 68eac2e7d3a9cf720997074fba36ed2c151571b4 | [
"MIT"
] | null | null | null | backend/users/tests/utils.py | kindziora/doccano | 68eac2e7d3a9cf720997074fba36ed2c151571b4 | [
"MIT"
] | null | null | null | backend/users/tests/utils.py | kindziora/doccano | 68eac2e7d3a9cf720997074fba36ed2c151571b4 | [
"MIT"
] | null | null | null | from django.contrib.auth import get_user_model
from rest_framework.authtoken.models import Token
def make_user(username: str = "bob"):
user_model = get_user_model()
user, _ = user_model.objects.get_or_create(username=username, password="pass")
return user
def get_user(id: int):
user_model = get_user_model()
return user_model.objects.get(id=id)
def get_user_token(id: int):
user = get_user(id)
return Token.objects.create(user=user).key | 31.2 | 82 | 0.745726 | 73 | 468 | 4.520548 | 0.369863 | 0.190909 | 0.109091 | 0.09697 | 0.127273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147436 | 468 | 15 | 83 | 31.2 | 0.827068 | 0 | 0 | 0.166667 | 0 | 0 | 0.014925 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.083333 | 0.166667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
e57ab65df21c3a0ad9c6c12c12d8d6ce90d2e99d | 640 | py | Python | homewizard_energy/errors.py | DCSBL/python-homewizard-energy | e3b08f8f5327e41f1cc2a0389b527ae9e94da80e | [
"Apache-2.0"
] | 1 | 2022-02-28T14:06:08.000Z | 2022-02-28T14:06:08.000Z | homewizard_energy/errors.py | DCSBL/python-homewizard-energy | e3b08f8f5327e41f1cc2a0389b527ae9e94da80e | [
"Apache-2.0"
] | 32 | 2022-02-11T04:38:57.000Z | 2022-03-30T04:43:11.000Z | homewizard_energy/errors.py | DCSBL/python-homewizard-energy | e3b08f8f5327e41f1cc2a0389b527ae9e94da80e | [
"Apache-2.0"
] | 1 | 2022-03-14T08:44:08.000Z | 2022-03-14T08:44:08.000Z | """python-homewizard-energy errors."""
class HomeWizardEnergyException(Exception):
"""Base error for python-homewizard-energy."""
class RequestError(HomeWizardEnergyException):
"""Unable to fulfill request.
Raised when host or API cannot be reached.
"""
class InvalidStateError(HomeWizardEnergyException):
"""Raised when the device is not in the correct state."""
class UnsupportedError(HomeWizardEnergyException):
"""Raised when the device is not supported from this library."""
class DisabledError(HomeWizardEnergyException):
"""Raised when device API is disabled. User has to enable API in app."""
| 25.6 | 76 | 0.74375 | 70 | 640 | 6.8 | 0.6 | 0.084034 | 0.220588 | 0.159664 | 0.205882 | 0.205882 | 0.205882 | 0 | 0 | 0 | 0 | 0 | 0.157813 | 640 | 24 | 77 | 26.666667 | 0.883117 | 0.503125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
e5b986b666f713cf7cd7e743ede00ca7199e5886 | 543 | py | Python | store/utils/constants.py | rodrigoarenas456/Backend_Python | 7f787723bb29637be8f4513f073a56d90e6a3316 | [
"MIT"
] | 1 | 2021-07-23T04:53:26.000Z | 2021-07-23T04:53:26.000Z | store/utils/constants.py | rodrigo-arenas/Backend_Python | 7f787723bb29637be8f4513f073a56d90e6a3316 | [
"MIT"
] | 1 | 2020-06-14T23:38:57.000Z | 2020-06-14T23:38:57.000Z | store/utils/constants.py | rodrigo-arenas/Backend_Python | 7f787723bb29637be8f4513f073a56d90e6a3316 | [
"MIT"
] | null | null | null | # Generate key with openssl rand -hex 32
JWT_SECRET_KEY = "46e5c95a2d980476afb2d679b37bb2c8990c25b4ea1075514f67f62f77daf306"
JWT_ALGORITHM = "HS256"
JWT_EXPIRATION_MINUTES = 15
# TODO: Move to environment variables
DB_HOST = 'localhost'
DB_NAME = 'bookstore'
DB_USER = 'postgres'
DB_PASSWORD = 'postgres'
DB_PORT = 5432
REDIS_URL = 'redis://localhost'
TEST = True
TEST_DB_HOST = 'localhost'
TEST_DB_NAME = 'test_bookstore'
TEST_DB_USER = 'postgres'
TEST_DB_PASSWORD = 'postgres'
TEST_DB_PORT = 5432
TEST_REDIS_URL = 'redis://localhost/1'
| 22.625 | 83 | 0.782689 | 71 | 543 | 5.647887 | 0.492958 | 0.074813 | 0.074813 | 0.109726 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121849 | 0.123389 | 543 | 23 | 84 | 23.608696 | 0.720588 | 0.13628 | 0 | 0 | 1 | 0 | 0.381974 | 0.137339 | 0 | 0 | 0 | 0.043478 | 0 | 1 | 0 | false | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e5c88a0025a9d579379f6ae8e1bf14b1bcc4f393 | 171 | py | Python | tests/timezones/urls.py | bpeschier/django | f54c0ec06e390dc5bce95fdccbcb51d6423da4f9 | [
"BSD-3-Clause"
] | null | null | null | tests/timezones/urls.py | bpeschier/django | f54c0ec06e390dc5bce95fdccbcb51d6423da4f9 | [
"BSD-3-Clause"
] | null | null | null | tests/timezones/urls.py | bpeschier/django | f54c0ec06e390dc5bce95fdccbcb51d6423da4f9 | [
"BSD-3-Clause"
] | 1 | 2019-11-25T15:01:05.000Z | 2019-11-25T15:01:05.000Z | from django.conf.urls import include, url
from . import admin as tz_admin # NOQA: register tz_admin
urlpatterns = [
url(r'^admin/', include(tz_admin.site.urls)),
]
| 21.375 | 58 | 0.71345 | 26 | 171 | 4.576923 | 0.576923 | 0.176471 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163743 | 171 | 7 | 59 | 24.428571 | 0.832168 | 0.134503 | 0 | 0 | 0 | 0 | 0.047945 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e5e09e6a1c6e9499683ec54b6dac83f509faf222 | 63,900 | py | Python | tasks/crypto/numeric/task/secret.py | keltecc/ctfcup-2020-quals | a8d3702b3449c4e459e80aea781bed85175fee02 | [
"MIT"
] | null | null | null | tasks/crypto/numeric/task/secret.py | keltecc/ctfcup-2020-quals | a8d3702b3449c4e459e80aea781bed85175fee02 | [
"MIT"
] | null | null | null | tasks/crypto/numeric/task/secret.py | keltecc/ctfcup-2020-quals | a8d3702b3449c4e459e80aea781bed85175fee02 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3.7
import numpy as np
key = np.matrix([
[8534, 9129, 9740, 3384, 3110, 16129, 15401, 12987, 3753, 12697, 10306, 9469, 14973, 15168, 3567, 4454, 13392, 1261, 12089, 8777, 5854, 6955, 12953, 5847, 1667, 2847, 12872, 5088, 6779, 502, 11055, 16209, 11007, 15250, 12842, 3324, 16223, 8843, 10701, 967, 9785, 10476, 2580, 7786, 2720, 6651, 4437, 7393, 11405, 12750, 13227, 6746, 324, 14980, 4382, 5432, 5395, 13554, 1691, 8317, 10882, 12371, 14656, 8791, 2379, 8871, 823, 2442, 15588, 4351, 10119, 8355, 1000, 8744, 11280, 2663, 4198, 2856, 15373, 3575, 4139, 8918, 2883, 14978, 5423, 10582, 2045, 1648, 10460, 10508, 14398, 137, 3762, 6467, 14364, 4309, 9657, 12747, 6027, 1032],
[9040, 12256, 7665, 14523, 3335, 10112, 12926, 3669, 4985, 1305, 6317, 4547, 10996, 1759, 3879, 5825, 16373, 13670, 6025, 9312, 7230, 10069, 13915, 3246, 987, 16245, 3903, 14861, 12391, 11171, 11564, 6967, 3911, 4958, 10703, 11051, 10213, 979, 13251, 15845, 9760, 14340, 2905, 1571, 3027, 468, 10332, 6991, 2054, 4547, 16085, 5381, 8225, 3826, 14368, 2590, 14751, 107, 7271, 7398, 11016, 9695, 7575, 11158, 6365, 8517, 12179, 11498, 4561, 5455, 5443, 11333, 15789, 9633, 13801, 12780, 5707, 11048, 14398, 6754, 15508, 12802, 958, 3231, 14215, 14150, 11777, 4294, 15044, 14990, 599, 10129, 4817, 11188, 15998, 3941, 4890, 2877, 5385, 5205],
[13659, 8394, 9814, 2227, 4801, 1818, 1570, 11176, 13808, 5871, 10304, 1112, 8301, 8336, 5116, 15040, 14774, 13105, 14693, 3779, 46, 1868, 10840, 11950, 4599, 12976, 15429, 13709, 9489, 10906, 1841, 13776, 3170, 11277, 6628, 14329, 8740, 15764, 12526, 7118, 7328, 11211, 15129, 10299, 111, 13201, 7291, 301, 13363, 7410, 5904, 6910, 11177, 12683, 5128, 7243, 671, 1166, 7862, 15106, 4145, 6345, 3584, 14584, 10666, 12255, 9132, 5115, 1438, 429, 10798, 2895, 9856, 15804, 11597, 15126, 16035, 1728, 11591, 11545, 14766, 10419, 6374, 8040, 1149, 5969, 1626, 13447, 8169, 9256, 5688, 14912, 10169, 99, 11215, 13440, 7713, 3364, 605, 2483],
[7898, 3661, 8693, 10641, 14868, 8180, 6656, 10730, 12595, 797, 13564, 11955, 12954, 10783, 6367, 14772, 12791, 6192, 8860, 3308, 13282, 15956, 2364, 11147, 11941, 14223, 6321, 3263, 10223, 8744, 13327, 4435, 4579, 1148, 5672, 3082, 5031, 7718, 7722, 14385, 15422, 8946, 5985, 659, 6810, 9438, 7039, 15194, 7046, 10744, 10231, 1580, 6941, 17, 385, 3626, 5859, 7774, 5319, 12519, 12776, 8922, 5769, 15301, 1849, 7328, 9450, 14516, 15068, 1111, 10662, 15072, 13082, 3236, 6162, 12985, 15945, 12181, 14583, 3973, 6034, 1039, 9512, 7694, 402, 5632, 12401, 4018, 13956, 7021, 9250, 14310, 11234, 3263, 14239, 2174, 6905, 4339, 1013, 10956],
[8900, 15338, 6979, 15027, 4280, 10399, 15532, 9791, 5123, 2286, 851, 13193, 12928, 6271, 9291, 5946, 6700, 12895, 2844, 4555, 2236, 9260, 8112, 14014, 12027, 11741, 7328, 5255, 3869, 1784, 16054, 15030, 6894, 8177, 3527, 2600, 11134, 13466, 13106, 1605, 10105, 4023, 8198, 16305, 1266, 6351, 5132, 1725, 6656, 3171, 3119, 15951, 9492, 11487, 13799, 5511, 13424, 11185, 11314, 7234, 9636, 10104, 1050, 9787, 1734, 12599, 4629, 13444, 15761, 16256, 7172, 5795, 559, 6775, 3323, 174, 13875, 8419, 15262, 2777, 4198, 7860, 11885, 12104, 12965, 4514, 11739, 16265, 2725, 6222, 7741, 10872, 5904, 3238, 14865, 15591, 1285, 5982, 11742, 8802],
[1037, 13680, 5177, 6342, 6517, 656, 5772, 9643, 14889, 4757, 2381, 10234, 812, 1009, 881, 11234, 7187, 6080, 9457, 6235, 12746, 7989, 6370, 15096, 6929, 890, 13013, 7030, 7705, 9353, 224, 10728, 6889, 11082, 3117, 13893, 11320, 4754, 6717, 9403, 4865, 6312, 4503, 1106, 11515, 4543, 6731, 105, 2462, 11830, 2383, 15281, 11383, 12187, 1655, 8616, 2975, 2807, 14093, 10132, 4784, 4241, 16050, 4167, 1054, 14311, 6611, 13999, 9242, 2514, 12545, 15656, 3116, 14864, 577, 11878, 1310, 3363, 43, 3799, 216, 11321, 1145, 2087, 11056, 11086, 8374, 7925, 7946, 10493, 14561, 583, 13217, 8266, 2010, 15278, 11675, 6119, 9346, 12695],
[4466, 7067, 9334, 10324, 1759, 15635, 16, 3596, 4553, 7698, 3321, 8738, 11866, 13629, 9303, 9835, 7116, 16357, 774, 15381, 15854, 4286, 9625, 3218, 13375, 4846, 1552, 14879, 12628, 6091, 2731, 16260, 1477, 527, 11323, 2318, 8187, 14042, 9721, 902, 11296, 16141, 10891, 2153, 10765, 15168, 7002, 11874, 95, 15029, 9470, 1634, 5834, 3809, 1832, 9748, 8803, 5826, 8764, 8760, 7671, 9631, 7133, 5485, 12412, 3016, 2014, 5260, 157, 10318, 5204, 12905, 12716, 4982, 15371, 15610, 7877, 8444, 14656, 3601, 12285, 4103, 11072, 14963, 8162, 3880, 6132, 6067, 10790, 8072, 7916, 8294, 15655, 3003, 8339, 9598, 3347, 11516, 14326, 2589],
[4973, 16102, 13072, 1586, 11411, 16150, 3737, 8683, 12556, 2457, 10966, 116, 12537, 1299, 6632, 2666, 10414, 14846, 16223, 13569, 13056, 13977, 5764, 8640, 15749, 15841, 9163, 5784, 13913, 9502, 5354, 8600, 5564, 14461, 2930, 12710, 8564, 4378, 2314, 7507, 14283, 11639, 15318, 10678, 1721, 2740, 11495, 8566, 10868, 8856, 10595, 2054, 16340, 12915, 9925, 14167, 6264, 4012, 1267, 10910, 2089, 153, 4551, 13165, 15357, 16120, 13708, 12892, 1753, 15804, 15041, 7955, 3059, 9910, 9832, 13958, 7030, 10567, 12893, 4268, 12152, 4924, 7908, 3820, 12184, 636, 13457, 15132, 3385, 14823, 12285, 1766, 13258, 5655, 12170, 13009, 5008, 13583, 10733, 6142],
[15364, 12604, 6618, 15633, 3690, 3339, 15479, 7626, 14999, 5211, 12068, 2559, 8057, 9487, 12357, 4190, 10989, 2243, 14950, 14916, 14910, 11253, 8965, 597, 8642, 9182, 8119, 10087, 2196, 2754, 13267, 2801, 6666, 14708, 12898, 1828, 1239, 10198, 15412, 6208, 9049, 13479, 8684, 4788, 14855, 10703, 261, 14906, 2937, 10467, 4963, 12618, 14745, 10860, 6799, 3324, 6170, 4466, 13511, 2793, 4434, 14537, 10242, 15608, 14698, 7660, 6522, 850, 9665, 8507, 12750, 12322, 10612, 15062, 5289, 3237, 5831, 10, 4244, 13921, 14501, 14269, 11256, 3307, 12668, 1332, 403, 4465, 7831, 12940, 10029, 13689, 603, 13323, 2276, 10791, 8035, 1939, 1791, 16375],
[9615, 9373, 2456, 5155, 10364, 15761, 8429, 3808, 11061, 14203, 13750, 1955, 7829, 15572, 11377, 4620, 9135, 11197, 15620, 5298, 13600, 13687, 9602, 8228, 4806, 15545, 11242, 4035, 4572, 1888, 13440, 9872, 5868, 8823, 10859, 13646, 13079, 12557, 2642, 13290, 6519, 15796, 6037, 3841, 8097, 15941, 450, 3501, 11453, 9776, 6998, 8907, 5905, 14494, 6755, 1409, 11667, 5934, 15154, 3505, 7691, 7186, 12198, 1040, 15210, 12810, 2696, 948, 4784, 10359, 15986, 10199, 10995, 1330, 9492, 12137, 5636, 616, 10796, 15279, 5188, 9765, 13822, 11581, 12259, 3203, 8858, 8243, 5906, 9291, 7478, 1782, 11077, 9809, 9522, 74, 5521, 11548, 5186, 3267],
[1171, 4800, 10898, 6234, 14133, 4865, 15046, 14084, 6929, 8876, 13871, 7285, 871, 9413, 13227, 4502, 9326, 14553, 13158, 534, 12625, 10147, 13844, 3390, 2546, 14346, 6579, 11314, 105, 13594, 4896, 9221, 9315, 6845, 361, 5902, 251, 7021, 4156, 11826, 12804, 9813, 501, 9594, 12467, 3244, 6783, 5826, 4865, 9064, 6932, 5661, 8497, 3985, 15297, 1813, 8146, 3096, 5312, 16232, 8606, 13166, 8240, 16057, 13124, 15847, 14256, 89, 11276, 244, 13270, 9206, 6610, 14856, 2478, 4548, 6874, 5269, 6714, 1498, 11068, 3512, 10084, 14816, 2553, 1582, 7601, 12914, 7086, 7645, 4117, 13112, 4968, 15671, 12358, 14107, 112, 8823, 13133, 2869],
[13474, 13412, 7421, 10178, 13937, 10239, 13954, 4028, 8277, 6768, 16029, 3791, 4940, 10485, 15244, 1402, 1715, 4114, 8556, 12442, 910, 3639, 1233, 11830, 10700, 11060, 14447, 8256, 418, 4486, 12665, 2616, 15318, 14241, 13583, 14527, 1432, 10719, 8664, 3011, 8954, 14901, 7035, 10374, 8576, 10786, 7756, 7216, 6723, 9145, 13608, 6815, 7430, 13234, 460, 7567, 3742, 2971, 13888, 14279, 12586, 14672, 11061, 14218, 8088, 10069, 8489, 7918, 7974, 5116, 11230, 13780, 8485, 15175, 13990, 8417, 11930, 14806, 15657, 13968, 5103, 12734, 13660, 13462, 5866, 8336, 2212, 2215, 3933, 7642, 2503, 76, 15565, 10831, 1105, 11566, 4738, 12259, 13884, 8486],
[7494, 2077, 2427, 4630, 8603, 11701, 6165, 14351, 12284, 9133, 13664, 13468, 6799, 6234, 13296, 12276, 7001, 15605, 4277, 1378, 250, 8175, 4532, 15912, 5397, 8530, 3936, 7784, 10895, 10679, 773, 10804, 6702, 10930, 155, 11366, 14683, 14003, 15593, 5582, 5026, 9265, 3192, 7637, 8664, 11020, 2943, 2757, 12291, 7297, 12887, 10752, 9960, 8658, 4564, 14448, 14406, 10773, 8811, 7937, 10784, 4458, 14388, 12198, 8591, 5946, 2335, 10267, 3541, 15378, 11925, 6156, 6333, 2641, 6015, 11560, 14478, 4658, 14647, 9421, 10458, 13283, 4884, 15548, 8012, 13546, 3445, 1099, 5436, 2544, 16265, 10940, 12214, 7347, 2816, 14933, 2698, 2670, 6716, 10917],
[1338, 13548, 12695, 16181, 4281, 7624, 5896, 3383, 4806, 834, 12891, 15725, 4231, 13084, 648, 11806, 3440, 8359, 14428, 12972, 3606, 27, 8473, 12943, 16343, 12277, 4025, 14444, 7219, 6453, 15611, 8259, 10970, 3987, 10483, 657, 1479, 13602, 10686, 4376, 5273, 56, 4647, 2948, 12848, 7654, 4901, 12644, 5709, 16071, 14902, 1591, 12763, 7708, 11918, 7590, 9874, 10823, 15460, 543, 9659, 744, 2839, 6345, 6263, 698, 6402, 14436, 10005, 7096, 12529, 7946, 4150, 987, 8326, 10756, 10047, 14612, 2850, 16372, 4033, 2676, 3355, 1444, 15454, 11444, 10992, 1430, 16145, 4064, 15988, 8966, 8551, 5147, 4377, 11650, 6313, 5342, 14109, 13052],
[14132, 9489, 15596, 16068, 10700, 13613, 13986, 12420, 10980, 2959, 12778, 8101, 2666, 7846, 3517, 14264, 5852, 8249, 16055, 4306, 4792, 11924, 255, 12312, 3145, 14331, 6250, 6688, 4918, 2051, 8002, 9116, 8601, 13846, 3703, 15497, 10179, 10918, 8817, 13417, 12307, 10832, 571, 12375, 4162, 6493, 13449, 11481, 13206, 13771, 1376, 6590, 10983, 15928, 12071, 3472, 572, 5534, 7622, 5340, 10488, 14479, 9742, 3288, 14327, 12145, 1329, 10917, 3989, 12759, 9423, 9926, 5770, 15371, 594, 4254, 5565, 118, 398, 12850, 7527, 9192, 12984, 1408, 423, 2918, 7985, 10823, 1484, 15892, 1086, 12520, 3857, 12140, 1333, 7252, 981, 11794, 15056, 15371],
[8923, 14056, 3291, 11798, 7125, 1288, 8852, 4796, 1954, 6054, 843, 12242, 12598, 11126, 2962, 7988, 746, 3664, 4831, 5976, 7974, 12670, 4931, 5327, 15045, 13810, 1593, 1133, 2361, 5244, 4858, 10142, 62, 9397, 6648, 1728, 7875, 1879, 15908, 5293, 8435, 3756, 10563, 7559, 15648, 2590, 885, 9802, 11734, 6369, 12209, 1771, 7631, 3831, 10598, 3535, 16156, 16355, 15053, 2410, 15391, 6175, 1503, 2351, 7803, 6957, 8688, 7870, 4205, 3296, 1047, 3127, 4853, 15397, 6411, 4521, 2470, 751, 7407, 14404, 11977, 14499, 4911, 7787, 7245, 1493, 13538, 11170, 15103, 2421, 916, 11913, 1713, 8951, 16007, 2799, 7964, 3088, 5714, 12765],
[14330, 2757, 8448, 7150, 13615, 625, 1020, 12078, 5918, 8115, 12813, 3527, 12507, 5316, 16103, 9513, 14218, 9420, 14198, 16223, 14412, 10210, 6786, 6067, 4016, 810, 3395, 15648, 13461, 12039, 12366, 4518, 13409, 12747, 14895, 6576, 404, 11943, 1102, 8457, 5030, 12678, 2078, 15168, 12289, 8797, 16012, 10579, 15094, 5049, 3405, 1110, 14879, 7276, 1341, 11002, 15277, 7252, 3011, 8484, 4144, 8332, 1674, 5690, 7549, 14943, 5176, 2279, 6145, 1073, 9345, 432, 6764, 13238, 8245, 4147, 10566, 10733, 11588, 11248, 9851, 16038, 11280, 6624, 14920, 2857, 13844, 2646, 340, 1553, 49, 7414, 9662, 12631, 1470, 13519, 5665, 1831, 5946, 2273],
[16244, 13800, 4927, 4451, 5470, 2690, 8324, 8451, 2744, 14116, 4479, 12268, 6094, 5594, 14856, 14320, 13296, 5608, 965, 8065, 13790, 1522, 6783, 7407, 15251, 9493, 1632, 14938, 13896, 479, 14398, 14809, 9458, 12872, 1906, 2206, 15683, 3048, 3899, 5831, 3749, 8364, 6599, 9012, 6774, 5426, 3713, 15252, 6981, 14828, 46, 12559, 4756, 10361, 1375, 8920, 16270, 3567, 14129, 15867, 15522, 14833, 10055, 8869, 11535, 7122, 9641, 10792, 3852, 13662, 6129, 13588, 1424, 5783, 3136, 5338, 6477, 2249, 1488, 5615, 4655, 5321, 10517, 4747, 8205, 13411, 524, 12944, 11422, 7791, 9002, 13746, 15051, 1084, 2216, 7782, 14801, 12714, 5917, 3717],
[12967, 4931, 16185, 12229, 11368, 11342, 11243, 5619, 4324, 7654, 14657, 8607, 3503, 10823, 3554, 15871, 5759, 8374, 10334, 6451, 16376, 2815, 1141, 9593, 6193, 4566, 11300, 4027, 6269, 16336, 877, 9746, 7636, 3941, 4018, 14684, 11198, 6900, 1178, 8434, 8708, 14128, 5972, 9300, 5508, 3598, 4391, 4379, 6562, 8745, 13371, 13493, 12198, 1953, 1844, 13712, 8820, 5346, 4537, 468, 1472, 4421, 15680, 6987, 16235, 3729, 13251, 1880, 14909, 8036, 14257, 15951, 10930, 6847, 13922, 3857, 8095, 2473, 842, 2768, 11441, 6083, 15860, 5636, 8918, 3717, 13366, 7683, 7978, 13336, 15453, 13937, 3087, 10282, 14186, 8478, 7234, 4581, 9970, 11595],
[3907, 10723, 6570, 6930, 3120, 1368, 1215, 8187, 15314, 14889, 10411, 2987, 7206, 5709, 12510, 4911, 6908, 1265, 12200, 13565, 6142, 12117, 16343, 7891, 13901, 4565, 3233, 13577, 16093, 4026, 9051, 12773, 8334, 4982, 7045, 1954, 12283, 9984, 8917, 4760, 1071, 13214, 9067, 7067, 15041, 9793, 10317, 6447, 12905, 13679, 2706, 6798, 6916, 10136, 1254, 8286, 8643, 13005, 3485, 3662, 1597, 16112, 13044, 2755, 4195, 3382, 7811, 3989, 1736, 12924, 6302, 8948, 12408, 6682, 14073, 3791, 13482, 4, 10785, 2317, 13892, 15111, 8329, 14874, 8599, 10287, 14392, 14242, 14934, 9127, 8964, 8402, 5867, 14418, 13283, 9258, 665, 15275, 14819, 7834],
[5129, 603, 11912, 15994, 2037, 4673, 9799, 15684, 3785, 15621, 6134, 2715, 3526, 7934, 12284, 3842, 911, 16007, 5410, 1670, 6636, 2713, 11044, 15540, 2198, 6373, 9849, 10677, 10991, 7913, 4794, 10277, 3282, 8079, 8849, 3628, 13230, 12631, 288, 13173, 4583, 2191, 11884, 1072, 13309, 3788, 3851, 11966, 5628, 8641, 6013, 10084, 6140, 1954, 11425, 4338, 1715, 10469, 2431, 9343, 15002, 1755, 16265, 9813, 12303, 11953, 7256, 1530, 16047, 13880, 12293, 4408, 7872, 7302, 10153, 3999, 9898, 5587, 4143, 7821, 10568, 9369, 2284, 7994, 2515, 3748, 13631, 12527, 14735, 803, 14622, 6827, 7403, 2826, 9847, 9021, 15623, 15401, 16249, 10410],
[1734, 6151, 2079, 2307, 12649, 7973, 12470, 1757, 7637, 1318, 11643, 2491, 3521, 11950, 15315, 11348, 8970, 8397, 9876, 2550, 6462, 6961, 14034, 1765, 7409, 4779, 5842, 8249, 10685, 14087, 1011, 10836, 5821, 598, 4314, 7424, 2581, 7851, 5635, 12506, 12795, 8322, 7307, 2538, 8901, 15761, 13594, 9512, 14335, 13955, 570, 10159, 1135, 6158, 13885, 6448, 6038, 15786, 11268, 5971, 4060, 8705, 4312, 4002, 5943, 11964, 4621, 1620, 9204, 6099, 13413, 14088, 14218, 271, 4599, 8713, 216, 1991, 11366, 15033, 11518, 10937, 3792, 9053, 6172, 2684, 12295, 13493, 5346, 16199, 2799, 10049, 5608, 8797, 4897, 10022, 9050, 3650, 10404, 1747],
[978, 15251, 8554, 14779, 6862, 10204, 4310, 2222, 2302, 1481, 989, 9181, 12607, 3146, 14018, 9886, 2664, 2585, 13644, 12084, 6947, 12979, 3980, 455, 9610, 5163, 3775, 7443, 8836, 12892, 14022, 3108, 9929, 5251, 12728, 12872, 12545, 12623, 3364, 7969, 4727, 7779, 1165, 1519, 7716, 504, 10951, 14546, 13608, 5167, 8571, 3778, 4177, 14088, 1426, 12510, 1183, 10602, 6867, 8810, 3117, 15256, 13928, 2810, 879, 4224, 15956, 5735, 167, 4283, 1316, 15360, 11058, 5437, 15343, 8384, 472, 10330, 8955, 10997, 6507, 15742, 14751, 15029, 8550, 10061, 9189, 16124, 9479, 3087, 8670, 1774, 7690, 4790, 10165, 3049, 6537, 7844, 863, 134],
[14597, 4786, 7604, 9089, 4027, 12855, 13234, 14534, 4100, 7640, 13334, 9655, 14291, 2752, 15083, 15883, 14707, 11293, 11743, 5007, 16340, 14270, 2525, 1464, 11910, 10541, 5230, 5637, 10909, 2196, 11562, 9278, 13151, 1847, 7378, 5294, 9291, 849, 13638, 10967, 14743, 3308, 6768, 15621, 9754, 9361, 6357, 11581, 1282, 13213, 12380, 8434, 3054, 9806, 564, 12427, 746, 15086, 8802, 5986, 6160, 9185, 3927, 13519, 1643, 12361, 12125, 9520, 4996, 500, 16002, 1402, 16180, 13779, 9784, 15940, 13600, 9660, 15751, 12673, 11972, 8064, 12591, 2620, 2846, 295, 10329, 14019, 4737, 4998, 7679, 12121, 8033, 7023, 10908, 5120, 5713, 441, 4953, 14827],
[10169, 16222, 11373, 4248, 4586, 3237, 8737, 11309, 7930, 4717, 3860, 11655, 740, 14795, 5131, 15743, 10645, 9516, 3238, 14637, 12851, 6043, 9565, 10608, 7018, 10290, 14569, 3330, 8992, 14550, 14177, 6746, 4076, 14138, 9603, 16330, 3851, 3480, 15863, 9805, 2565, 707, 8325, 9512, 11990, 11333, 6581, 14241, 13092, 606, 1044, 6290, 12648, 8678, 9690, 14825, 6144, 744, 2640, 7370, 11426, 7021, 930, 12966, 197, 3266, 9955, 3818, 4312, 10085, 14620, 13828, 9326, 12969, 2885, 10512, 7710, 3291, 16116, 4719, 1683, 6817, 15860, 13670, 4260, 15304, 3622, 11770, 84, 13535, 9662, 13051, 4948, 16014, 7906, 9749, 13350, 13482, 9662, 5305],
[5954, 1659, 7643, 6669, 4743, 10041, 7510, 6990, 15497, 14259, 14935, 5811, 8331, 7466, 13994, 6359, 4686, 6354, 5684, 8835, 12388, 10811, 13000, 3811, 2292, 8250, 1682, 9611, 16144, 7780, 7715, 4042, 937, 14004, 2988, 7597, 9659, 15652, 5804, 3608, 8462, 13770, 5312, 12108, 14631, 5154, 11266, 14619, 13768, 14767, 3992, 467, 15964, 14194, 5401, 8888, 10109, 7892, 5683, 99, 11205, 15364, 8478, 12725, 15488, 279, 3601, 7176, 13204, 10622, 16353, 7485, 1239, 12125, 1625, 7513, 14207, 15440, 5118, 7142, 6321, 10832, 3282, 11414, 15246, 10924, 12052, 6754, 13820, 8715, 14654, 1553, 1406, 9435, 9271, 11221, 14155, 13020, 374, 8112],
[4639, 6218, 11015, 11649, 4006, 2798, 13634, 3042, 6447, 13150, 2739, 6399, 100, 12460, 9180, 13743, 2125, 14610, 8255, 14889, 4483, 2586, 4627, 12249, 11491, 3807, 6263, 3595, 10359, 3367, 10, 15862, 421, 4502, 2822, 3211, 6631, 4933, 6389, 1736, 5616, 697, 8206, 2052, 10167, 1975, 12454, 13200, 6109, 5043, 3995, 2715, 2970, 14101, 3870, 12633, 6761, 10689, 10646, 14027, 13110, 703, 12118, 14848, 7475, 5985, 1950, 15636, 5061, 15580, 8144, 590, 2129, 15213, 2734, 15009, 8216, 2112, 14050, 9401, 11506, 489, 3154, 5953, 11574, 4474, 11551, 15302, 12684, 7187, 154, 7091, 1917, 1282, 15304, 15204, 1623, 11118, 4036, 11299],
[7574, 1160, 13989, 12790, 8062, 5787, 9815, 5312, 4268, 3221, 15140, 15052, 13453, 1847, 11375, 9617, 5303, 886, 6995, 15185, 11435, 11713, 3077, 12969, 1442, 2894, 9563, 11951, 10678, 3914, 5578, 2332, 6794, 10585, 6565, 4017, 12574, 14241, 15999, 12424, 2101, 14459, 3, 5010, 6414, 1272, 8920, 1645, 9232, 4876, 14311, 10281, 15249, 911, 14969, 119, 13425, 1215, 8303, 7390, 9460, 6125, 15737, 4047, 5335, 8627, 1282, 13257, 16186, 11592, 14798, 3432, 2536, 15316, 12820, 6856, 13686, 9678, 4688, 14773, 5817, 13325, 1609, 15058, 16078, 3883, 6015, 12221, 3458, 4076, 13602, 3494, 7227, 4123, 14378, 11563, 4808, 14454, 2364, 9616],
[11945, 9841, 9432, 353, 3917, 13803, 7597, 2727, 15423, 2473, 8456, 6627, 5378, 13612, 2400, 2304, 15295, 958, 15990, 9030, 11957, 12395, 10109, 5542, 3094, 11669, 4840, 12381, 7937, 7664, 7552, 6111, 14516, 5323, 8246, 14880, 129, 10799, 6728, 16369, 4032, 1212, 6364, 7118, 11004, 9861, 864, 5234, 8583, 3224, 15416, 7189, 7268, 5822, 2960, 16179, 5095, 4849, 1278, 14958, 12259, 1287, 12281, 4230, 7073, 15033, 15620, 4884, 12132, 12390, 14773, 2181, 6718, 6735, 2000, 3789, 9706, 7307, 12516, 10300, 8702, 16362, 7137, 12064, 693, 11981, 13706, 3503, 12717, 10894, 1229, 7814, 9499, 5380, 9544, 8703, 5111, 2565, 15839, 10969],
[8529, 11819, 11407, 15886, 5638, 14105, 16011, 14740, 3222, 10173, 2884, 11442, 11160, 4301, 3206, 14843, 3812, 10365, 8233, 571, 6139, 13880, 16062, 14451, 14484, 2802, 1358, 13004, 3246, 7833, 11841, 783, 14460, 248, 5021, 1816, 7035, 12066, 10715, 12340, 3121, 4154, 13471, 1844, 11434, 6987, 6335, 7930, 8537, 12576, 5481, 11448, 14189, 4407, 8440, 15367, 14571, 5887, 546, 2988, 15755, 1794, 9669, 4424, 1308, 8487, 10878, 10826, 9315, 3592, 1129, 10636, 8348, 7242, 9905, 6981, 5288, 10072, 12252, 8601, 1057, 15431, 10843, 9893, 14866, 6734, 1949, 10522, 2670, 9004, 12860, 4940, 5085, 14338, 8033, 13011, 11735, 2693, 7717, 4847],
[10017, 3932, 8271, 13954, 13328, 13012, 4757, 10583, 16368, 944, 10290, 14382, 8871, 6129, 14752, 476, 5021, 7692, 11103, 10313, 11819, 15811, 14643, 6227, 4272, 1717, 6805, 1808, 9728, 15241, 10580, 11578, 9348, 1506, 1781, 11313, 4011, 11079, 9774, 11358, 3494, 4395, 14493, 4439, 6388, 10985, 14166, 7978, 14627, 14862, 6139, 376, 11624, 10565, 4321, 4776, 3007, 51, 4075, 12802, 3604, 3626, 809, 2976, 8532, 9682, 13507, 6055, 1493, 10902, 12076, 7989, 14389, 7589, 800, 12344, 15491, 8066, 10261, 13749, 10756, 1577, 15711, 6665, 6226, 14459, 1869, 12586, 7478, 10396, 11418, 6643, 7900, 4066, 8538, 15972, 4912, 13407, 1608, 2100],
[15921, 5012, 4928, 7501, 207, 6087, 3985, 11376, 5089, 16231, 5255, 6902, 10437, 15907, 5761, 852, 12785, 1338, 518, 6955, 6530, 12364, 4970, 8087, 3409, 7748, 6745, 3619, 16324, 1057, 12632, 1723, 15870, 870, 16194, 12162, 2338, 12229, 303, 10522, 4180, 8565, 2747, 7066, 7139, 12411, 7970, 12942, 5569, 883, 15610, 6629, 9985, 11144, 4728, 13923, 14792, 2485, 6673, 10435, 15418, 6832, 3798, 8054, 4173, 7599, 6825, 11101, 9605, 10370, 6604, 8434, 9694, 8308, 7519, 9905, 15058, 7224, 15271, 7088, 5494, 12585, 8249, 380, 5318, 9970, 3804, 13000, 2678, 8625, 12497, 2691, 15021, 16351, 6239, 6544, 8854, 3506, 21, 14705],
[5643, 945, 6620, 596, 15852, 5585, 10206, 6354, 7957, 11444, 11056, 15351, 4022, 246, 8141, 5400, 12586, 5909, 13695, 15173, 12186, 9118, 15653, 4148, 55, 2082, 8090, 4545, 3370, 14505, 1917, 1162, 13669, 13636, 4784, 3694, 5095, 4374, 8574, 3167, 2410, 15923, 2957, 15700, 6119, 996, 13463, 11012, 9258, 9402, 5330, 6193, 1641, 4434, 15705, 12128, 6969, 8897, 3924, 10883, 663, 10021, 10431, 14599, 15240, 16298, 8170, 13317, 12722, 5297, 9273, 6755, 13059, 3063, 7553, 4295, 2545, 8853, 4444, 198, 2870, 13731, 3518, 15344, 12755, 14568, 12045, 6620, 11433, 1981, 1442, 14325, 2548, 15533, 3069, 13902, 1939, 3566, 4826, 8992],
[2467, 9226, 4185, 6580, 1684, 10579, 2704, 1161, 12580, 7745, 14353, 250, 1949, 11322, 7601, 7086, 5873, 3514, 8839, 10699, 13237, 10419, 5114, 6317, 4997, 241, 8313, 2921, 10325, 12555, 10113, 3362, 15092, 6474, 10113, 6102, 15368, 9406, 13987, 13167, 4313, 7098, 8186, 7441, 15990, 74, 1198, 5948, 3229, 1808, 5392, 10120, 1895, 3647, 7250, 15608, 2964, 10245, 4235, 375, 10770, 5143, 13356, 12750, 13647, 13133, 3588, 7154, 12638, 7067, 3606, 16264, 7386, 8300, 11253, 7369, 9212, 14607, 5663, 8798, 5619, 14622, 7040, 8331, 11247, 12207, 8161, 11594, 7674, 16272, 13581, 16352, 10105, 15949, 15844, 5397, 7824, 14413, 3997, 3853],
[4550, 4259, 3921, 8922, 10333, 13544, 12965, 12572, 10892, 9, 2124, 14500, 13011, 11584, 12078, 8248, 10097, 14211, 9983, 14571, 10101, 10923, 452, 12729, 9250, 13353, 12969, 5242, 14834, 5413, 9068, 11010, 6119, 14719, 9800, 13599, 10096, 14150, 9708, 6248, 6889, 7409, 1721, 6332, 12710, 6541, 13382, 3766, 14401, 11641, 16145, 9364, 910, 8360, 10215, 8120, 2297, 4282, 13476, 11019, 7124, 11960, 1462, 15704, 7510, 11695, 1478, 3621, 11095, 15346, 9855, 3703, 10198, 1238, 10265, 12960, 4383, 14343, 15486, 12988, 10194, 12961, 4766, 4379, 10572, 5104, 2396, 6668, 11979, 10660, 3801, 8512, 15925, 10287, 7236, 14299, 7274, 3662, 14218, 577],
[5952, 13609, 5976, 11295, 7409, 7758, 448, 7169, 2936, 691, 9750, 12512, 6946, 1090, 4159, 11243, 147, 6844, 2082, 8477, 6495, 3766, 6657, 12558, 13865, 2785, 14747, 8956, 8421, 10165, 1780, 5860, 5323, 706, 1394, 1111, 6597, 8940, 7979, 3142, 3590, 610, 7655, 1163, 2822, 5344, 6459, 8450, 11325, 7862, 306, 11384, 9175, 12904, 8650, 11873, 5633, 4084, 2200, 2095, 10054, 9321, 140, 3992, 9105, 10235, 7734, 13909, 3703, 7262, 10742, 6867, 8226, 9599, 9752, 2422, 3353, 9316, 11571, 1119, 9527, 10613, 14959, 8298, 2817, 12645, 10101, 12365, 1993, 9746, 8048, 7644, 6181, 15201, 7354, 10793, 5402, 15756, 11277, 7944],
[16178, 16289, 5533, 4819, 11639, 1986, 15896, 9031, 5124, 11630, 1725, 8769, 9818, 740, 9292, 2754, 3797, 10230, 12366, 9231, 3652, 6131, 14965, 5052, 3965, 9172, 7686, 7960, 386, 5854, 4198, 7489, 4688, 84, 16183, 11817, 7693, 4260, 12374, 12243, 11480, 926, 6555, 1051, 9178, 12343, 2648, 8082, 1916, 6498, 13685, 14839, 6207, 13705, 13532, 4224, 11709, 7374, 11333, 15612, 14633, 7994, 15646, 13962, 1988, 580, 12631, 12032, 15067, 348, 4679, 11084, 1506, 9100, 9206, 990, 11789, 12569, 8297, 3315, 2332, 10755, 6452, 1753, 3002, 10110, 4734, 5469, 3025, 11695, 8760, 8176, 11727, 12554, 2583, 10065, 16265, 10839, 6873, 4609],
[2646, 6439, 10549, 5862, 1075, 14678, 8796, 1464, 16178, 9017, 10845, 13302, 10957, 3255, 5835, 10961, 2675, 6097, 14268, 9162, 10087, 9009, 4584, 11947, 1902, 3147, 10170, 11808, 14728, 7156, 3792, 7540, 6151, 7008, 13913, 10289, 5300, 2181, 6380, 16219, 13655, 8876, 3059, 11273, 9367, 4382, 5427, 10079, 4804, 3559, 12127, 13901, 6001, 13837, 5350, 10041, 6404, 14978, 2168, 11617, 5993, 4173, 4817, 3229, 6684, 5391, 10930, 12948, 11810, 15314, 3648, 12609, 2448, 13284, 14084, 6508, 14795, 6029, 2670, 15705, 1408, 666, 13726, 3204, 13886, 7530, 1121, 5474, 10100, 12449, 5266, 10487, 11900, 6431, 11974, 8310, 9021, 12586, 14962, 8892],
[2565, 3626, 8281, 11319, 2329, 1198, 12056, 9961, 6609, 5014, 38, 8691, 11630, 5818, 1772, 4803, 4135, 848, 8486, 5191, 13785, 6879, 4619, 4982, 3994, 5957, 15860, 12733, 3340, 14294, 2536, 6961, 11978, 5095, 4274, 1363, 14080, 15595, 15714, 10966, 1716, 5396, 6878, 13705, 14430, 12961, 15274, 14086, 3015, 14945, 12844, 8974, 10225, 3509, 4077, 9390, 7852, 14640, 15963, 14030, 5353, 15471, 4167, 12038, 6317, 3913, 1550, 14784, 14319, 8794, 936, 8629, 5915, 9868, 14480, 4368, 13200, 11154, 14946, 1273, 10286, 13788, 5274, 15475, 12460, 7919, 11758, 16219, 13521, 4395, 10642, 13063, 8874, 3968, 15027, 14857, 3338, 7422, 14858, 7736],
[3892, 12233, 4359, 6065, 15351, 15478, 14060, 10390, 12425, 1876, 15813, 7723, 12599, 15326, 12555, 8756, 15252, 6922, 6284, 2106, 4256, 2163, 14554, 2598, 10950, 4203, 14959, 3891, 6827, 10751, 5683, 11673, 14846, 12437, 6883, 9082, 14323, 9809, 7012, 5814, 1559, 14155, 7798, 14611, 13806, 8232, 12108, 3568, 5969, 11892, 526, 7021, 1038, 15512, 3949, 11150, 5976, 13949, 15987, 14290, 9213, 4688, 8039, 16293, 4442, 11480, 2352, 15452, 14832, 4970, 10039, 4271, 14213, 697, 2880, 13261, 13899, 11586, 5217, 12677, 3701, 5383, 3344, 13828, 11719, 1786, 14616, 7011, 15654, 3754, 734, 3767, 6427, 9873, 15811, 10513, 16037, 11644, 11575, 12241],
[7557, 2034, 599, 15364, 16020, 6611, 12258, 12054, 2516, 5133, 6246, 16025, 13469, 7764, 2027, 8532, 1838, 274, 7905, 11761, 10668, 3066, 8597, 8865, 12092, 9100, 3358, 15133, 1444, 15153, 11450, 7351, 16218, 15600, 9119, 15076, 6378, 3952, 8767, 6740, 5890, 8061, 5109, 6477, 11022, 9418, 14382, 12038, 14471, 2706, 7801, 4339, 14691, 5882, 3938, 2163, 659, 8087, 11002, 186, 7273, 15931, 10598, 10261, 10589, 222, 14695, 3799, 9693, 2578, 14653, 1349, 10143, 14004, 14470, 6406, 6780, 8223, 1531, 12634, 16232, 5415, 8972, 863, 3064, 15563, 8759, 307, 4732, 732, 13161, 7149, 10506, 6401, 3033, 14500, 10238, 11010, 15712, 10996],
[8111, 14922, 2546, 13094, 7946, 9925, 8825, 15287, 11591, 14639, 5393, 15293, 11274, 2621, 8703, 12674, 16197, 4334, 747, 6856, 6310, 3143, 3961, 15724, 5029, 5411, 16043, 10543, 8135, 10049, 10979, 6519, 2653, 8744, 13297, 16070, 2724, 9894, 3234, 10645, 11960, 4886, 5484, 4710, 14947, 11383, 7029, 9901, 9610, 11992, 14509, 529, 8348, 159, 9246, 11500, 14821, 5175, 5577, 6932, 15619, 13259, 11046, 15230, 5409, 8567, 10585, 15304, 14518, 68, 7073, 333, 7267, 635, 13451, 15373, 13574, 5547, 3134, 8116, 1973, 16020, 8587, 239, 1039, 8993, 2307, 11104, 9691, 10438, 11378, 8715, 117, 275, 13364, 5117, 6630, 4449, 12358, 14061],
[3445, 2836, 14486, 15279, 3562, 8634, 4654, 1207, 12609, 758, 10425, 15487, 13022, 10454, 6807, 2, 11712, 13656, 14372, 9068, 14897, 9364, 6369, 2272, 4486, 12588, 12472, 12586, 12690, 1756, 2929, 12864, 5745, 6667, 3635, 14918, 9762, 9369, 16045, 6656, 4933, 12380, 13327, 7645, 6028, 8652, 7346, 13553, 12858, 7808, 9475, 9942, 14079, 860, 13662, 6871, 7581, 7519, 6496, 13333, 5322, 11104, 13067, 2692, 8064, 13939, 3901, 5688, 16224, 12219, 7281, 11473, 13918, 11023, 8397, 7130, 7740, 7927, 14552, 6377, 10718, 7515, 11756, 3829, 16209, 8554, 12061, 7664, 8830, 3148, 9912, 10014, 1211, 15763, 12288, 4739, 13321, 8858, 11813, 6486],
[7358, 4489, 8869, 3591, 7524, 16137, 4116, 4937, 8362, 8853, 9685, 14660, 5774, 1819, 12865, 13933, 4643, 10093, 6092, 12710, 9387, 9875, 6824, 7330, 11798, 1801, 379, 10856, 9626, 8800, 6804, 5251, 9978, 2403, 7064, 11481, 12330, 1160, 10152, 12153, 12342, 12041, 7868, 2297, 16049, 722, 5333, 414, 7234, 4099, 5224, 9740, 10068, 4979, 733, 8176, 1778, 12765, 15524, 10334, 6760, 8564, 5496, 8753, 13695, 8160, 11366, 3581, 2322, 1823, 883, 10482, 9509, 6879, 8625, 2245, 8161, 3903, 332, 16183, 5677, 2108, 3797, 11966, 2356, 11599, 12161, 4757, 1995, 805, 10756, 8933, 13842, 13474, 8111, 16221, 3479, 13129, 4822, 5558],
[2634, 13377, 9817, 14182, 4998, 4506, 15631, 5386, 15225, 7889, 11300, 15933, 12509, 13399, 921, 14917, 749, 3419, 13174, 709, 13123, 13376, 10336, 9147, 10642, 12437, 9397, 754, 2520, 1477, 2823, 613, 6308, 9212, 7091, 7334, 12661, 6760, 4609, 8223, 9472, 8354, 581, 7401, 16324, 15656, 5442, 3980, 12031, 2018, 10687, 9234, 5869, 6927, 3499, 9649, 8034, 14423, 8797, 4046, 1632, 9263, 12327, 14654, 2932, 140, 16215, 15843, 11821, 7018, 14114, 12495, 3696, 15615, 8536, 7894, 7350, 9869, 11970, 8391, 3880, 9951, 1666, 14992, 6053, 415, 6562, 12529, 4133, 4154, 6598, 8570, 5844, 5078, 66, 5207, 9849, 1228, 12986, 4018],
[12146, 5102, 282, 5346, 5352, 5052, 13293, 10107, 15678, 1158, 11144, 5406, 155, 9077, 14403, 4541, 1161, 6799, 4976, 15451, 2355, 14382, 14383, 7593, 6774, 15909, 15823, 10694, 5250, 13286, 6538, 10274, 8316, 7623, 11949, 9816, 4034, 3803, 6083, 3459, 8221, 16322, 13684, 6248, 9249, 15561, 4180, 4103, 15053, 13055, 11702, 7484, 14642, 6127, 15445, 16010, 937, 9762, 5603, 3394, 12790, 10983, 3956, 12768, 6794, 13714, 4113, 16315, 9437, 11966, 9687, 5020, 6595, 10875, 9260, 11988, 2532, 3103, 13725, 8690, 10362, 13791, 11274, 5545, 8834, 4449, 4353, 3318, 7367, 12331, 8225, 6097, 5584, 2662, 1948, 12394, 10919, 935, 3244, 7388],
[14096, 859, 4345, 445, 4443, 10784, 9499, 8259, 12550, 2202, 8099, 5303, 5131, 5691, 1053, 2141, 12140, 13796, 3011, 13272, 7811, 2983, 4951, 16058, 5751, 13835, 5648, 3990, 14576, 8427, 4297, 9260, 11443, 1573, 16196, 4920, 5017, 2301, 9642, 8538, 11113, 1652, 9591, 6310, 13561, 10668, 6807, 10619, 3434, 1623, 13554, 10010, 15582, 10221, 10875, 11193, 3567, 4044, 8005, 10848, 14049, 1844, 14322, 3790, 8435, 13291, 4411, 2972, 13013, 959, 8220, 14022, 10555, 2521, 5867, 4409, 4297, 8497, 14616, 6357, 12766, 3950, 11866, 3459, 7276, 15519, 1089, 5421, 6006, 7255, 15729, 12910, 11233, 10431, 5617, 7985, 4697, 3544, 8855, 8199],
[6570, 2184, 12547, 14675, 347, 3228, 14683, 4152, 5337, 13353, 6632, 12572, 8348, 3167, 5437, 8364, 1878, 11932, 2637, 4215, 9302, 5936, 4324, 13794, 9216, 726, 13596, 14636, 7699, 1889, 5801, 9036, 3955, 8576, 10862, 11407, 10120, 9619, 10723, 661, 923, 6295, 16246, 8996, 5458, 8701, 619, 10393, 15038, 3326, 2145, 790, 15725, 5884, 11158, 16212, 216, 14482, 15688, 1523, 13764, 9284, 15261, 629, 14226, 10920, 12208, 6192, 3760, 3663, 3081, 3292, 11603, 5461, 5695, 3629, 13836, 3918, 3312, 1213, 14088, 13839, 376, 14166, 13363, 5243, 1864, 2525, 8540, 12638, 1849, 11477, 818, 11530, 10412, 8626, 15918, 3024, 5087, 15792],
[2061, 14373, 9368, 3886, 3999, 10773, 8801, 1671, 11881, 10102, 3517, 11693, 4036, 11890, 14702, 2798, 14022, 12099, 9964, 298, 7182, 13369, 15639, 14068, 11144, 495, 4019, 2922, 3051, 7119, 4838, 1117, 11369, 5153, 6706, 10042, 11565, 4746, 12607, 2468, 15735, 3289, 8401, 15985, 1165, 13119, 2137, 6160, 9300, 2485, 14958, 13714, 12646, 3867, 13813, 11001, 12763, 16271, 12776, 14587, 3260, 2839, 14973, 3199, 12210, 16334, 10046, 10381, 2267, 15383, 16022, 6964, 9428, 15674, 15668, 10852, 10157, 9071, 13812, 11440, 4652, 15583, 3787, 10311, 12681, 2496, 12292, 7354, 5432, 1663, 12886, 6278, 15985, 11920, 12262, 2188, 147, 330, 12449, 2886],
[2234, 1019, 6755, 6771, 8646, 7019, 10275, 9662, 9602, 6961, 4952, 5478, 16249, 12632, 13928, 1200, 3087, 14898, 2069, 15224, 4407, 6077, 1670, 9677, 11673, 10447, 15310, 3044, 6447, 16328, 5460, 8736, 1629, 10168, 15084, 4887, 1245, 3885, 6304, 10552, 12093, 13738, 6712, 4204, 15048, 10384, 11246, 6233, 4651, 1232, 3289, 3527, 5706, 10175, 6475, 8358, 2959, 10234, 650, 15026, 7319, 1887, 13470, 11484, 14015, 14335, 836, 8599, 7106, 3077, 5523, 15751, 7166, 5244, 9163, 15135, 9111, 15115, 2926, 4699, 2559, 8491, 6424, 14683, 1810, 8327, 1379, 9080, 6492, 3525, 12448, 991, 7253, 974, 12787, 10621, 7880, 11360, 14038, 13618],
[1365, 15802, 4439, 4848, 11682, 7816, 8581, 12813, 3502, 15855, 1106, 11228, 2222, 6088, 10935, 10897, 9556, 9053, 255, 1693, 13222, 4598, 13592, 15474, 4498, 2485, 12061, 5114, 14219, 6261, 12524, 12897, 1765, 13604, 13721, 4161, 5043, 13027, 15085, 15577, 3771, 2165, 535, 5426, 4429, 10588, 3867, 8698, 13399, 5737, 1551, 10180, 5699, 14626, 3213, 9817, 11479, 14463, 11405, 6268, 2482, 3000, 4727, 9057, 331, 1513, 7748, 8725, 1340, 7827, 10608, 14330, 15641, 6541, 10668, 9746, 3143, 1438, 6305, 3129, 1896, 6105, 4393, 14582, 3723, 1739, 5667, 362, 10839, 11123, 12253, 10425, 2578, 14840, 8250, 9125, 11669, 8545, 2640, 3822],
[12384, 14262, 3551, 8626, 470, 13548, 188, 5074, 15561, 6784, 14694, 8506, 16228, 15334, 15367, 2689, 12209, 264, 10681, 16109, 9711, 12682, 9671, 9928, 7618, 2093, 3330, 14413, 16111, 12096, 6098, 11866, 10014, 4814, 6701, 12490, 9947, 15080, 13501, 13000, 4396, 7393, 16169, 8598, 2723, 2552, 15785, 9022, 15603, 10110, 9, 8300, 7111, 3308, 458, 609, 6391, 6432, 11917, 3828, 16384, 12134, 11274, 8826, 12393, 12346, 9401, 11866, 15794, 9204, 11923, 11947, 4402, 3626, 12063, 5160, 5749, 12117, 12460, 13945, 6331, 11360, 12137, 5850, 14202, 12417, 15393, 624, 13909, 6140, 12948, 4926, 2342, 13219, 11969, 12337, 8213, 8073, 14758, 168],
[3346, 5933, 13477, 16135, 183, 2566, 5740, 9369, 13096, 9155, 7647, 7946, 12755, 13301, 13431, 7753, 9579, 13667, 11217, 10039, 13917, 11015, 3156, 4712, 78, 1776, 11522, 13767, 13868, 4943, 13753, 14631, 15883, 14677, 1922, 9480, 13512, 3560, 10530, 2852, 7468, 9364, 766, 1884, 5987, 9974, 16040, 7021, 8452, 1028, 3105, 7078, 11671, 3934, 12938, 8570, 9345, 15372, 7212, 12787, 4259, 12546, 12237, 7894, 12964, 8633, 6389, 11225, 8323, 2719, 4538, 4722, 7839, 14417, 5466, 12934, 11615, 6545, 15468, 3354, 8438, 11938, 9543, 980, 14739, 8016, 7143, 989, 13746, 7271, 3952, 7066, 9193, 328, 3995, 2871, 6889, 670, 5262, 5548],
[9408, 2977, 8451, 15815, 448, 14945, 15605, 2320, 6455, 1318, 14368, 8172, 11572, 12, 8738, 5441, 5802, 13850, 6197, 5808, 4514, 14421, 1477, 11795, 7116, 6487, 13386, 11697, 9698, 6196, 429, 14826, 6113, 1111, 10276, 11491, 6695, 4791, 7007, 10912, 14417, 8763, 10093, 822, 15373, 1431, 9014, 15904, 991, 15102, 4085, 7568, 5, 10494, 16000, 3226, 2074, 891, 11451, 1957, 11658, 12812, 13950, 4772, 4317, 9110, 12807, 12986, 2531, 10337, 12447, 13830, 10660, 3153, 9460, 5266, 978, 3688, 8023, 16349, 5029, 8215, 10585, 13855, 725, 16011, 9065, 15485, 7684, 14182, 3061, 3751, 15326, 8370, 15335, 13853, 6307, 2675, 11540, 11603],
[6678, 10814, 9343, 6629, 14224, 1563, 2655, 14474, 8605, 13667, 1290, 4535, 6295, 11464, 4511, 15025, 11035, 4650, 6123, 14712, 9447, 10844, 10942, 15192, 15458, 6191, 14940, 343, 2353, 11247, 12749, 4343, 8219, 7178, 14389, 1825, 6164, 8251, 43, 12187, 14125, 2155, 10598, 7273, 13962, 8612, 6748, 9400, 4164, 5481, 10211, 7909, 8189, 10769, 4982, 9079, 1970, 11498, 2508, 11735, 6778, 10817, 12496, 10633, 15184, 15546, 14436, 13337, 10890, 6996, 7948, 10230, 2179, 632, 14498, 9426, 715, 9393, 12657, 12745, 9253, 12784, 2396, 3331, 5533, 6336, 3232, 14764, 9675, 9765, 9074, 2439, 16185, 12495, 6440, 14235, 13633, 5620, 1701, 5777],
[14335, 10604, 14782, 14367, 10280, 4213, 6908, 14962, 2332, 3398, 9674, 11745, 9447, 9346, 5925, 13736, 1558, 3757, 15556, 75, 4888, 1844, 5507, 11311, 4095, 13036, 15486, 7575, 4414, 11741, 2742, 6411, 7909, 8198, 237, 3848, 3741, 11227, 7240, 1699, 1562, 13519, 14011, 8668, 8624, 15977, 6304, 15350, 13101, 11565, 13265, 12650, 10017, 205, 14838, 6372, 2270, 2616, 7288, 9789, 14667, 10812, 13899, 13965, 485, 12725, 982, 10834, 14802, 12062, 6315, 7169, 9833, 1322, 1942, 3891, 8800, 8532, 6264, 12112, 808, 8480, 8285, 9921, 7101, 2760, 9546, 4694, 8388, 15408, 9284, 2568, 1895, 14443, 11894, 12863, 3071, 2953, 11546, 16272],
[4584, 6891, 3844, 3557, 9051, 6056, 8801, 7911, 9052, 123, 1252, 14978, 10023, 10430, 6936, 652, 650, 8723, 14065, 4161, 13123, 233, 5215, 4195, 13402, 7712, 15351, 8983, 14498, 7438, 3818, 9031, 492, 6640, 9670, 11589, 7401, 575, 15665, 3740, 2690, 15494, 3695, 437, 14942, 14032, 14661, 15926, 459, 9401, 4173, 423, 1488, 15638, 7473, 6223, 14446, 11840, 7613, 12432, 11554, 14807, 10963, 111, 13350, 2081, 2433, 4750, 9889, 11136, 990, 13486, 3035, 8736, 4648, 13212, 12838, 6280, 13394, 3317, 3117, 5643, 13854, 1608, 2489, 9716, 3783, 14852, 962, 9266, 11007, 6258, 14835, 7981, 12131, 2057, 2835, 15849, 654, 8420],
[5622, 5324, 4437, 9751, 248, 308, 9227, 10728, 2205, 10634, 6341, 11237, 10737, 7621, 9305, 4712, 11083, 11607, 1199, 15070, 1766, 3305, 16380, 1273, 6228, 15526, 9272, 7242, 45, 1341, 746, 9778, 10316, 12440, 3873, 1314, 1908, 12951, 8350, 8832, 9894, 14581, 7056, 14834, 15935, 8039, 11549, 6044, 929, 3380, 11523, 6348, 11493, 1704, 15967, 9648, 125, 14187, 7180, 5196, 9154, 8037, 10292, 600, 7862, 10807, 15328, 9366, 16176, 1173, 9631, 3350, 5804, 1221, 18, 14262, 11910, 12548, 11783, 2709, 1387, 13706, 1760, 4500, 1516, 5916, 7345, 10008, 9933, 9191, 13655, 15624, 13077, 5319, 10272, 2045, 97, 14875, 7371, 9881],
[5179, 7901, 8154, 5575, 13280, 15866, 14354, 12476, 13750, 6014, 6398, 13750, 7322, 7619, 8308, 2909, 15599, 13180, 6734, 8399, 4336, 7344, 9729, 13605, 5023, 6421, 4426, 8642, 12302, 7312, 4311, 7888, 3887, 604, 8115, 405, 8649, 12711, 1704, 11850, 5944, 6267, 11208, 10173, 15899, 7166, 15859, 14786, 8316, 13154, 15269, 11292, 6563, 1229, 4576, 15600, 14175, 1302, 3490, 12960, 12648, 12486, 8609, 10374, 8192, 142, 2931, 697, 8280, 8038, 1953, 12801, 3192, 1593, 10927, 15117, 2920, 1753, 6439, 2800, 928, 4926, 6133, 12867, 3969, 4487, 4893, 16255, 14893, 9826, 4943, 3736, 14436, 390, 14034, 15387, 11125, 12228, 8836, 10885],
[12185, 10297, 8637, 10951, 9679, 16130, 1578, 15572, 4418, 5922, 11056, 6067, 4002, 1955, 8909, 3002, 7206, 4567, 16195, 11514, 838, 8663, 1011, 8132, 2809, 12369, 7469, 6164, 5237, 16146, 6049, 11652, 2173, 4525, 3775, 12656, 942, 14157, 869, 5132, 8257, 7059, 7529, 4050, 11927, 7341, 5770, 4814, 15426, 13665, 974, 46, 8285, 3739, 4383, 9675, 16249, 2120, 9098, 2170, 7835, 4124, 15601, 3892, 1580, 4274, 880, 14209, 10289, 8933, 3286, 15291, 3495, 15158, 1040, 14436, 287, 11998, 15154, 14753, 4234, 5792, 14848, 7222, 11659, 12971, 15448, 12721, 372, 672, 1957, 7634, 7560, 8239, 1185, 3139, 15483, 2030, 13652, 9636],
[2238, 15723, 10767, 4626, 10840, 609, 11367, 13381, 5704, 13795, 12324, 8255, 852, 5863, 11982, 15851, 7480, 5772, 3914, 8100, 11929, 14251, 1947, 11172, 5803, 4854, 3726, 1339, 16299, 13304, 5048, 10370, 895, 7694, 7339, 11643, 14437, 3311, 2930, 10030, 10462, 4604, 1629, 1388, 6208, 9727, 5107, 11812, 14015, 7788, 6282, 15165, 832, 8745, 2394, 7646, 202, 9609, 14028, 14707, 10321, 14240, 11457, 5338, 1956, 14035, 5687, 7831, 13005, 12993, 11360, 13456, 5171, 12970, 104, 8481, 1999, 4507, 1073, 1839, 3193, 1094, 5144, 5150, 8389, 15404, 374, 11838, 15388, 14474, 7794, 2401, 7461, 14550, 14013, 7828, 5070, 12799, 5090, 5634],
[14663, 8452, 9226, 9884, 15725, 593, 12714, 2542, 15682, 13887, 9722, 13289, 10735, 13, 5733, 11149, 11222, 2755, 2644, 695, 5087, 3501, 4638, 12568, 5757, 9205, 10426, 13101, 8006, 5413, 13514, 9086, 16358, 5360, 6300, 15957, 5941, 125, 6809, 11375, 11107, 4867, 4193, 827, 12895, 5763, 6717, 15904, 10579, 10961, 9512, 6367, 302, 15233, 15522, 5659, 14128, 11237, 15055, 10964, 5471, 5097, 896, 2520, 4904, 14995, 8510, 1451, 1784, 4969, 2794, 485, 2015, 2763, 5002, 11432, 654, 6789, 7393, 6731, 6293, 9621, 8203, 160, 15513, 12608, 2586, 9923, 3302, 2546, 6449, 539, 2152, 2837, 12312, 15510, 12371, 6236, 1551, 5489],
[8644, 7145, 223, 6120, 4412, 15570, 3756, 9456, 12736, 3670, 10860, 4399, 9332, 2571, 6782, 940, 6083, 9870, 3635, 11744, 6790, 14002, 5096, 4370, 6373, 2313, 5856, 3028, 7080, 15487, 10391, 6190, 10582, 6150, 685, 3105, 1356, 4844, 5262, 14544, 13472, 11984, 5334, 3962, 13116, 12634, 11102, 10017, 6799, 12434, 13209, 2100, 7166, 1333, 13363, 5290, 16197, 12067, 14243, 4018, 11246, 7223, 15001, 10218, 3898, 6208, 1341, 3958, 2729, 14199, 16303, 9027, 6229, 12920, 5927, 13874, 9944, 6454, 3277, 5839, 103, 5240, 14947, 6076, 6974, 1982, 2665, 9476, 13751, 12861, 9464, 6721, 14478, 12830, 690, 2943, 1425, 5010, 7363, 10747],
[11888, 13409, 3529, 9400, 2406, 5675, 15403, 5401, 15276, 15580, 10119, 11190, 14697, 15094, 8581, 13395, 13624, 12487, 738, 3363, 807, 4032, 3375, 1742, 5492, 16154, 14481, 126, 12967, 9734, 6457, 14561, 12543, 12146, 7479, 12910, 7518, 11201, 1215, 15641, 4776, 7444, 7177, 13622, 3751, 12483, 12837, 15831, 14155, 5225, 10248, 16197, 11858, 2094, 2398, 1678, 8525, 2027, 2618, 11576, 6050, 12446, 3168, 13913, 2939, 12379, 16258, 5865, 11061, 13298, 15791, 10053, 12315, 16256, 8615, 10099, 11121, 9, 10494, 5379, 4909, 3129, 14596, 1911, 1100, 4875, 12068, 13307, 8950, 11630, 4519, 11035, 10332, 9292, 3440, 10181, 69, 11121, 2151, 7767],
[2970, 1438, 446, 12247, 9676, 1011, 8399, 7476, 9309, 4786, 5361, 2649, 3871, 5518, 15143, 3264, 10042, 7426, 7189, 14604, 13082, 5831, 6210, 10987, 7762, 11003, 15647, 2367, 13227, 10905, 16345, 3946, 6877, 9440, 7865, 925, 5431, 1205, 15523, 15714, 7774, 10623, 12515, 6485, 8067, 11021, 557, 15763, 14896, 14104, 120, 15429, 6325, 10317, 1441, 13285, 13202, 2635, 11299, 14814, 7022, 2685, 3238, 10089, 3764, 15703, 11628, 2526, 12702, 14938, 9084, 8465, 6015, 4749, 14050, 8926, 12740, 15248, 11675, 6866, 457, 3499, 2097, 15412, 6547, 10913, 261, 2650, 11277, 8719, 11157, 113, 12900, 4903, 12953, 12410, 9464, 5914, 4174, 7575],
[12493, 8887, 8442, 15688, 14564, 12215, 10647, 15237, 592, 14739, 11288, 7272, 12913, 13450, 1684, 4894, 9632, 5736, 13449, 1346, 15013, 9024, 12487, 10976, 4549, 14498, 7574, 4503, 4046, 14842, 5688, 15672, 1876, 8189, 4507, 11060, 14852, 5709, 7637, 8575, 10252, 7759, 11265, 12111, 509, 7887, 16363, 3048, 1009, 1651, 9323, 1591, 10869, 12635, 14610, 2868, 1793, 8824, 572, 3518, 8441, 7466, 4865, 285, 12798, 7073, 8086, 10123, 11450, 11632, 1551, 13158, 311, 7919, 2676, 8235, 5989, 13947, 3193, 8626, 13432, 12839, 10195, 11270, 2602, 12505, 3396, 12784, 7449, 3832, 4231, 13578, 6992, 12248, 4680, 4673, 11127, 3258, 3684, 9167],
[9437, 6077, 10909, 7667, 8688, 9537, 3219, 11916, 15184, 9054, 12799, 3662, 15827, 8583, 2755, 5689, 7043, 6021, 12447, 2563, 3052, 6888, 1905, 6251, 11121, 15290, 7624, 2553, 12666, 5570, 8671, 1394, 14208, 6424, 10131, 12798, 11538, 16095, 11856, 9737, 5882, 14074, 14547, 15373, 7075, 12248, 6528, 5017, 12572, 13639, 11774, 936, 8841, 5545, 6388, 12861, 11663, 4444, 3933, 2431, 15670, 11470, 13481, 14775, 12809, 10287, 4937, 1238, 1235, 15986, 7544, 5347, 9473, 8859, 5851, 13932, 2537, 10761, 7510, 14294, 16314, 9020, 6153, 14234, 8376, 8667, 3456, 4544, 9191, 8440, 5883, 4597, 8058, 13175, 7610, 8027, 5244, 1239, 15347, 9297],
[15342, 5783, 10841, 1428, 12478, 4313, 15104, 12448, 2396, 6828, 9467, 16120, 9513, 14105, 9441, 5340, 10857, 730, 9565, 4184, 2673, 15396, 8922, 4138, 12303, 10248, 14568, 12876, 13736, 12878, 9681, 6125, 6946, 3873, 5899, 14847, 8490, 360, 4404, 10953, 13757, 6941, 12827, 12516, 13143, 2070, 11081, 198, 13200, 7240, 13198, 9769, 3796, 7648, 2819, 6416, 13559, 14064, 7311, 6133, 144, 7956, 1266, 4592, 15355, 4482, 4233, 16016, 11858, 9153, 3597, 2694, 2460, 10741, 9511, 16212, 6993, 12086, 14433, 6609, 7425, 5883, 11102, 4678, 10129, 6348, 10912, 9749, 15136, 1580, 3178, 3043, 5296, 10584, 6889, 15642, 578, 4891, 1686, 13445],
[9289, 13321, 13786, 6435, 5535, 10369, 6167, 9748, 5746, 1947, 9959, 10539, 13073, 7698, 13639, 2419, 3718, 14618, 13021, 7046, 2866, 10579, 2759, 9360, 5061, 1112, 8073, 5168, 11215, 8470, 4062, 5384, 14001, 1164, 5462, 6076, 7033, 3088, 14164, 11262, 14276, 3578, 3080, 1309, 14069, 7745, 3817, 6851, 13324, 7095, 16351, 460, 15949, 4185, 1052, 9822, 8000, 15905, 2766, 10114, 13828, 5138, 2483, 1104, 15626, 3961, 9926, 3057, 2732, 7516, 7911, 7703, 1638, 8986, 8467, 15093, 14918, 7134, 268, 10271, 6920, 3948, 11645, 12380, 14395, 12301, 5087, 8879, 1259, 4804, 16302, 15124, 15332, 2368, 5147, 215, 11833, 5930, 7060, 10557],
[3764, 1524, 11953, 10644, 4538, 3510, 4976, 2677, 4332, 8261, 16061, 1272, 4383, 4207, 2695, 13738, 11751, 14152, 7905, 7072, 11653, 14400, 9819, 10668, 4710, 10309, 1160, 15043, 9912, 7496, 16231, 16218, 14015, 15109, 2541, 10061, 2273, 3893, 6264, 4809, 2115, 14308, 5905, 5663, 1311, 10997, 4832, 3283, 3102, 8541, 6364, 6021, 13058, 6562, 13622, 7490, 958, 5320, 4572, 10540, 10273, 720, 10720, 9860, 9586, 2548, 10914, 5847, 5278, 1102, 2552, 10784, 10085, 7734, 11813, 15488, 9634, 11029, 15141, 16165, 2117, 5059, 9081, 5992, 3049, 834, 15472, 12608, 15424, 6266, 2022, 4819, 7614, 224, 5818, 14884, 3620, 9857, 10527, 9354],
[8440, 9595, 12108, 9141, 7413, 7555, 1669, 5019, 1258, 9176, 4879, 13184, 4805, 11153, 8280, 10981, 1730, 732, 11623, 14179, 1332, 14796, 10735, 8800, 5972, 7418, 1955, 15229, 1380, 3049, 13298, 6296, 12033, 358, 2355, 7306, 15964, 8817, 11559, 14298, 12153, 2544, 5509, 11145, 1605, 1275, 15025, 9549, 5549, 6771, 10043, 3324, 2322, 11458, 16245, 15497, 15923, 1249, 2335, 12152, 3029, 7485, 7978, 15002, 8744, 2757, 2136, 13423, 10742, 9303, 8221, 13268, 900, 6354, 133, 8013, 15383, 9885, 10696, 5056, 6913, 14135, 7882, 14125, 9636, 11160, 8831, 10695, 13123, 4152, 6993, 12954, 8539, 3635, 3564, 12184, 14973, 13108, 8913, 10637],
[12345, 8128, 13240, 8685, 6222, 4131, 12072, 13952, 8416, 7430, 6595, 10475, 13176, 14172, 6783, 6473, 11199, 11759, 3912, 15295, 13984, 8558, 16092, 1613, 8176, 14345, 11317, 6325, 8406, 8206, 11801, 11916, 8388, 12131, 14502, 13288, 7855, 2119, 10331, 4765, 8295, 8931, 15140, 6185, 2902, 172, 8706, 7027, 10026, 2681, 3323, 12866, 8584, 5270, 6356, 7483, 14327, 1310, 11900, 4678, 5460, 12497, 9553, 8074, 6517, 8880, 7594, 60, 3043, 2334, 1819, 3776, 8276, 1790, 1221, 6332, 2897, 15809, 2334, 4896, 12316, 8854, 1699, 9379, 12642, 11778, 13883, 10071, 7860, 996, 772, 8958, 7452, 2788, 15631, 5461, 9234, 16035, 16139, 3568],
[7395, 8690, 14903, 4889, 12932, 13530, 8470, 14180, 3739, 12653, 14433, 12359, 6170, 14893, 9546, 2404, 14790, 2076, 12405, 1460, 3476, 9937, 14314, 2117, 485, 7595, 7810, 11123, 1222, 8148, 8393, 15795, 10866, 1306, 15384, 7251, 2045, 12931, 11819, 289, 7678, 408, 15668, 15886, 2108, 3011, 6233, 4149, 3040, 13303, 991, 8624, 15035, 13459, 4771, 2081, 10478, 10648, 5787, 10682, 734, 3332, 762, 9135, 422, 6762, 186, 12775, 1870, 3761, 12324, 9868, 14532, 7518, 10349, 12030, 13742, 1411, 11997, 8347, 15592, 5668, 8937, 13879, 6236, 12217, 3912, 7317, 15618, 4983, 9656, 3408, 6470, 10874, 8368, 5973, 12065, 5861, 453, 2636],
[6396, 3388, 11603, 4723, 1159, 10616, 1683, 4831, 9481, 5503, 9909, 8171, 9202, 5121, 10046, 14702, 865, 9172, 2333, 15995, 13286, 12594, 4166, 8526, 6495, 2019, 5928, 12946, 10424, 15017, 16367, 10563, 5567, 8301, 15709, 16242, 11581, 5291, 5383, 1850, 9569, 4871, 5317, 13863, 9343, 4125, 6919, 6017, 7383, 1830, 11181, 16252, 13668, 2389, 12760, 5560, 6818, 12793, 8481, 7023, 12360, 874, 14932, 12574, 10884, 1849, 13901, 15725, 6150, 15525, 2727, 9609, 14973, 13348, 14206, 14253, 5763, 3676, 1515, 7193, 1729, 990, 9254, 2388, 12304, 14217, 2243, 14551, 12668, 10280, 15661, 11996, 10746, 15047, 14776, 9403, 12500, 14843, 1287, 7934],
[5824, 13632, 7001, 7931, 8738, 8146, 4583, 12994, 11731, 13556, 16308, 12967, 9602, 1558, 442, 1635, 7737, 10323, 2161, 4271, 12077, 14975, 10145, 1315, 929, 10226, 4527, 3919, 15942, 7865, 12299, 14375, 9566, 9742, 1892, 4023, 10358, 1345, 8273, 11566, 2337, 8395, 14113, 838, 7531, 1648, 4651, 9675, 7704, 8478, 402, 897, 1478, 8142, 13971, 10324, 16340, 3214, 4415, 998, 9663, 6286, 6988, 2609, 13727, 6748, 6890, 3090, 3527, 14074, 1131, 16188, 15319, 638, 6236, 382, 11631, 4486, 11831, 16177, 11362, 4077, 5104, 947, 16257, 2836, 5607, 15399, 11232, 848, 9139, 15188, 8818, 2992, 9622, 5505, 14869, 4891, 16204, 10489],
[8858, 12385, 4671, 4900, 7335, 909, 10044, 1645, 5263, 3581, 9430, 11912, 10443, 2292, 9031, 15958, 2622, 10915, 8587, 4860, 12448, 15927, 7817, 10878, 2802, 7800, 1507, 16155, 11526, 672, 7125, 8763, 1513, 2784, 2182, 1062, 1260, 10074, 4978, 10025, 2017, 14494, 3237, 6664, 8421, 3254, 10964, 875, 15058, 12890, 2613, 4937, 12148, 10532, 247, 7308, 14234, 10728, 14038, 1187, 3049, 12452, 15387, 5152, 8945, 11863, 5127, 13300, 2621, 3783, 9521, 12920, 15037, 876, 672, 14087, 10188, 5231, 5794, 2104, 15378, 10735, 7235, 2556, 2627, 7211, 2961, 9026, 2728, 8754, 812, 16174, 7464, 11854, 656, 3672, 6486, 15295, 7436, 13131],
[967, 9319, 10415, 7027, 10035, 14006, 14793, 1664, 2476, 1734, 4165, 13287, 11569, 13448, 13435, 8511, 2222, 449, 10201, 13230, 6796, 7832, 3487, 2622, 6095, 15939, 9848, 4162, 2797, 4189, 77, 4750, 15255, 13322, 11448, 2379, 9403, 3002, 2936, 254, 5416, 6389, 8976, 13033, 8457, 8458, 12677, 6365, 2838, 843, 3036, 1864, 3839, 13021, 8904, 1673, 7372, 12454, 9016, 14643, 12852, 4395, 1636, 10975, 15992, 16239, 15688, 253, 5419, 7424, 4785, 5829, 7517, 941, 1990, 13724, 9056, 11647, 7190, 16343, 5220, 9410, 12575, 11477, 14339, 15275, 7706, 12133, 2962, 2573, 15999, 7927, 10268, 10344, 9146, 7130, 14376, 10372, 8847, 10856],
[3807, 11182, 13741, 10538, 13013, 15358, 14054, 13769, 8555, 5247, 2544, 2718, 1942, 14170, 3918, 685, 1852, 3552, 12854, 1619, 11398, 6893, 14338, 7052, 15179, 8639, 1814, 3758, 8937, 12070, 5757, 7857, 9001, 3891, 3675, 3817, 6245, 2110, 6215, 12846, 599, 15175, 4754, 1186, 7008, 7479, 12425, 12860, 8372, 3000, 9998, 13626, 4334, 12911, 10486, 791, 200, 1674, 9246, 1274, 11738, 7277, 10299, 6623, 6286, 4042, 3461, 11051, 1019, 12043, 2515, 4838, 11377, 14987, 394, 9494, 11442, 5722, 3898, 4159, 15135, 11539, 9142, 14129, 9782, 449, 1350, 15271, 6481, 15505, 6523, 4393, 2926, 4423, 11035, 204, 14907, 11845, 5353, 14454],
[8062, 11161, 6484, 6863, 1371, 6739, 10049, 7950, 6105, 3135, 13911, 8584, 10206, 9895, 9226, 5916, 1079, 15102, 6636, 2318, 6282, 208, 2795, 8966, 13517, 15591, 3221, 14799, 1140, 3864, 2500, 1610, 11265, 14524, 4413, 11473, 6664, 12393, 6469, 6417, 7819, 11627, 5387, 6225, 13008, 12193, 7804, 12290, 13501, 15227, 12535, 4157, 8530, 12275, 1092, 11113, 14402, 14843, 7156, 6700, 4279, 4456, 11116, 16074, 5282, 1126, 5030, 4351, 6049, 13854, 13631, 11966, 15163, 3964, 5200, 5003, 1954, 88, 669, 13837, 11648, 2148, 15717, 15695, 3494, 15569, 6469, 1704, 3879, 12894, 9016, 8111, 4535, 12261, 9027, 12334, 805, 15935, 7361, 10012],
[15282, 947, 6466, 12123, 7205, 2228, 13694, 15701, 13272, 6005, 10673, 14181, 4418, 5067, 11081, 452, 16022, 5658, 9503, 14575, 10913, 3979, 2715, 11064, 8520, 14294, 14943, 163, 4373, 15870, 1186, 6524, 11882, 5681, 9207, 11506, 4677, 12221, 727, 14908, 3476, 9989, 15879, 10092, 11430, 11181, 1348, 3642, 11120, 14381, 15961, 4628, 13111, 1081, 4754, 11955, 5025, 15197, 9165, 11509, 7310, 15625, 1531, 14397, 1077, 16179, 4660, 7119, 8893, 12091, 8710, 5691, 3532, 15008, 13317, 14278, 8772, 14854, 8273, 11827, 8596, 2613, 9812, 4012, 4628, 626, 2592, 11536, 2708, 8090, 4234, 5902, 1060, 10591, 13325, 521, 10836, 9118, 11171, 14716],
[13577, 15015, 4579, 420, 7115, 13837, 9306, 1382, 14334, 10645, 8542, 5273, 2727, 12874, 2054, 3311, 12258, 14767, 12845, 106, 3416, 13885, 5043, 1077, 4866, 11377, 5236, 7460, 13444, 16026, 5925, 14655, 422, 1437, 10462, 16035, 14532, 3481, 2646, 9487, 7936, 7164, 13609, 13813, 55, 13050, 14035, 14785, 11636, 7640, 12069, 2251, 13605, 1398, 543, 10703, 9556, 11629, 10345, 3625, 11097, 15417, 11017, 13637, 3803, 7686, 12105, 5248, 5989, 1147, 4214, 12368, 11866, 5888, 7, 2226, 8934, 59, 3581, 13420, 14309, 13101, 15260, 13298, 7303, 6997, 13084, 15833, 3838, 3081, 4387, 14124, 7914, 11734, 1604, 3942, 6346, 520, 15218, 7593],
[1669, 3620, 13336, 15564, 8962, 14950, 7190, 8043, 5193, 12661, 128, 7634, 3816, 6335, 13794, 3275, 11099, 8308, 120, 7007, 3342, 11743, 11043, 12735, 15770, 3413, 10289, 10104, 4782, 4434, 12226, 5598, 7984, 10365, 6397, 3196, 11628, 5504, 7608, 12906, 15175, 7574, 10185, 2562, 11964, 15401, 1804, 4205, 5318, 1782, 13841, 15741, 30, 11526, 2668, 987, 146, 11168, 2792, 6895, 4868, 9902, 7279, 12437, 4729, 12322, 14583, 9174, 12848, 4, 7606, 6406, 8266, 1496, 6147, 6394, 8608, 16002, 6889, 12101, 8158, 3159, 9210, 8212, 10661, 12735, 5561, 6009, 15850, 10365, 15394, 4235, 9647, 7479, 1833, 15600, 3335, 7243, 5941, 5711],
[8840, 8675, 8308, 6930, 10348, 14944, 15933, 13800, 680, 5033, 11974, 10163, 1676, 1984, 16341, 15557, 8334, 12269, 8138, 8953, 5648, 15046, 6171, 11309, 5119, 1398, 6943, 8315, 4782, 12951, 14711, 2092, 14151, 2787, 15415, 3026, 13166, 4217, 9676, 12298, 13324, 7684, 5782, 13648, 7183, 10496, 9700, 14889, 650, 14863, 709, 7433, 11725, 648, 15183, 14332, 5222, 2852, 7612, 1014, 6972, 9007, 4679, 8586, 416, 9763, 16120, 12740, 2277, 7472, 3484, 1265, 3477, 2338, 8813, 1084, 5241, 8678, 8176, 398, 14061, 12852, 2449, 660, 15967, 12524, 1302, 878, 6550, 4981, 11788, 2232, 10986, 8016, 14849, 840, 5368, 13404, 4818, 11010],
[12095, 12853, 12844, 8428, 9090, 3334, 527, 1014, 9471, 7840, 9240, 12646, 4350, 4488, 5993, 396, 933, 10450, 10612, 465, 1410, 13958, 7485, 11155, 9918, 15633, 782, 7685, 2471, 16024, 7671, 12836, 9655, 7022, 11192, 1150, 8634, 2145, 9399, 1782, 10572, 4385, 11669, 2236, 10990, 14140, 14237, 5970, 10120, 9505, 2496, 51, 1650, 10646, 5279, 3178, 2613, 15589, 4067, 3159, 12401, 11908, 15489, 16274, 15977, 4960, 16079, 3752, 8186, 6263, 10539, 4753, 8107, 10003, 11079, 4513, 15718, 10075, 623, 5321, 2566, 11519, 3252, 2953, 15794, 3462, 2203, 1842, 12673, 2614, 8478, 15062, 11893, 12726, 1249, 16344, 6656, 36, 9048, 6305],
[14782, 14439, 5391, 3632, 14446, 5475, 10739, 2243, 5449, 10617, 5484, 14194, 7750, 6191, 12003, 8373, 13005, 395, 12878, 1197, 1386, 6351, 9718, 15192, 8843, 10568, 8686, 14610, 8819, 11208, 8954, 14899, 7432, 12612, 8232, 4963, 6801, 4517, 4435, 5096, 585, 811, 8154, 13302, 12557, 4888, 5874, 7355, 13768, 4774, 13339, 669, 7503, 8878, 7557, 2725, 2022, 7727, 11860, 8778, 2452, 15185, 4408, 6248, 35, 8493, 5613, 3151, 1548, 15456, 13322, 11730, 8399, 11816, 4641, 3554, 8350, 2956, 15808, 6919, 6206, 6517, 10868, 5369, 2125, 10962, 6622, 7096, 5084, 7500, 7165, 2139, 14110, 7863, 1149, 8614, 5674, 11614, 15106, 11163],
[2105, 12147, 3935, 15689, 11570, 7354, 6992, 3779, 2299, 14240, 6553, 2732, 12468, 11406, 1560, 4060, 9782, 8132, 12010, 8906, 6415, 6064, 2184, 276, 5582, 4729, 12492, 11895, 2143, 3263, 6064, 11462, 14096, 3097, 14579, 16013, 3263, 12510, 13103, 15830, 14320, 13415, 13546, 16162, 9667, 8708, 1807, 3796, 1070, 2556, 352, 5903, 14630, 12755, 9967, 15028, 13786, 6951, 11602, 3781, 8666, 2525, 11339, 13907, 10953, 11950, 3283, 309, 14198, 15293, 2112, 9077, 2765, 76, 12503, 14320, 869, 216, 2645, 7187, 10657, 5440, 2764, 7021, 6802, 8950, 715, 1751, 6231, 10253, 4667, 10031, 9822, 6237, 1786, 15852, 5482, 15482, 13703, 9411],
[5228, 15960, 12408, 6765, 267, 7409, 11, 5841, 5357, 7656, 5078, 4170, 13185, 10892, 16091, 8629, 2617, 6894, 16284, 1937, 766, 16186, 15611, 9392, 6389, 8612, 13671, 8967, 11933, 12200, 12165, 15689, 6992, 387, 15465, 8396, 7676, 6332, 4429, 330, 13341, 12086, 350, 6880, 9590, 6414, 177, 11138, 8089, 6051, 4964, 9977, 5771, 15696, 14412, 4589, 7204, 4835, 14366, 6832, 4608, 6718, 4920, 8616, 14613, 210, 7904, 7666, 903, 10259, 14165, 12249, 15720, 2848, 6357, 11349, 7931, 15511, 1966, 2272, 6293, 496, 4592, 12761, 11937, 570, 5358, 800, 13877, 4025, 6517, 4911, 4535, 14218, 13852, 7641, 3412, 897, 6699, 10787],
[11100, 915, 1509, 6973, 880, 5258, 3721, 7030, 1878, 6439, 9085, 12589, 14425, 2854, 8550, 6158, 11182, 13543, 1239, 15508, 16116, 16329, 754, 8891, 1080, 1314, 7878, 14041, 2507, 15459, 14243, 10303, 16190, 4076, 5694, 8558, 15604, 2410, 1758, 12045, 11635, 3170, 1638, 6311, 2040, 15619, 11913, 16156, 11461, 7602, 3781, 3894, 8086, 15409, 4971, 9200, 689, 11337, 16022, 13651, 389, 7740, 1762, 14163, 920, 14691, 2274, 4851, 8157, 12982, 4810, 5052, 13637, 8811, 15420, 5480, 4722, 14881, 14511, 12101, 9146, 440, 13264, 1338, 15134, 9221, 12311, 16265, 6229, 9657, 8013, 11731, 14701, 5931, 5290, 737, 9393, 3111, 5248, 14234],
[223, 7091, 1276, 12717, 3257, 9872, 10530, 7764, 929, 3612, 710, 14506, 12027, 12324, 7102, 7499, 15038, 12961, 15726, 12539, 9317, 16333, 4935, 3152, 7566, 6600, 3906, 15532, 294, 4881, 10859, 1372, 16383, 1769, 4976, 15068, 11382, 10871, 16199, 10758, 10885, 16082, 7476, 10674, 7405, 16355, 13661, 12026, 12856, 4694, 9353, 6955, 8241, 9804, 1171, 13039, 8209, 2939, 11932, 5618, 13258, 11260, 9000, 1503, 2596, 5918, 9345, 15633, 8654, 15978, 7180, 12123, 11770, 13566, 11167, 1996, 13621, 14799, 9741, 14701, 8476, 857, 7162, 11089, 15644, 15709, 11454, 8044, 124, 3246, 11298, 8306, 7922, 4654, 4399, 11709, 12098, 965, 12324, 4513],
[2909, 4871, 8622, 4167, 16236, 2759, 14311, 8901, 10893, 12861, 1604, 3212, 12508, 7590, 2914, 15261, 1344, 6157, 15202, 11875, 11274, 9202, 118, 10333, 11445, 4136, 14831, 9572, 6894, 4948, 15550, 6087, 12702, 13928, 15032, 14725, 10957, 14268, 5991, 546, 9496, 4050, 8939, 9317, 14015, 14352, 3782, 12686, 2401, 7376, 10651, 77, 4826, 5303, 11831, 3099, 15437, 12489, 8769, 13211, 13001, 4961, 13790, 12976, 2011, 2407, 9417, 13712, 9266, 4556, 9314, 8885, 3298, 10778, 11036, 1184, 11099, 9928, 13679, 5622, 14911, 2241, 7585, 13173, 1616, 12960, 10191, 4381, 2625, 1755, 4197, 12437, 15507, 3589, 1698, 7249, 6856, 4700, 6128, 13251],
[15047, 14878, 16345, 11310, 4305, 16220, 1276, 5260, 1652, 12161, 2687, 5694, 13044, 11011, 15837, 2080, 1097, 6236, 6948, 14380, 1290, 6759, 1410, 5087, 6663, 11453, 3562, 7620, 10752, 15804, 980, 9178, 15772, 8646, 3559, 8247, 4878, 13363, 5443, 5387, 11134, 13221, 12166, 15602, 7798, 8768, 10895, 13520, 7980, 52, 4020, 3537, 11143, 15310, 2522, 16350, 7026, 15375, 2407, 13143, 2175, 13221, 356, 6636, 2097, 9855, 12280, 11150, 10091, 16014, 13575, 8729, 11327, 7056, 4191, 12103, 8834, 12192, 10713, 10375, 11595, 3874, 2013, 6116, 11912, 5466, 840, 851, 5180, 3590, 1799, 12262, 3065, 4327, 13967, 15413, 15291, 10127, 6526, 4939],
[4943, 12155, 123, 8962, 5907, 16000, 15228, 12205, 13735, 1343, 16193, 10586, 1551, 14817, 6760, 6852, 12279, 13600, 15133, 9091, 3799, 7251, 11405, 16087, 1190, 8736, 8563, 8964, 6212, 780, 5760, 9508, 2246, 8505, 7626, 103, 3084, 10952, 993, 325, 10344, 6894, 12711, 13037, 12515, 4120, 12029, 4688, 12648, 14134, 12306, 2408, 14767, 12847, 7087, 137, 15130, 7165, 15563, 10534, 9049, 4877, 906, 7614, 784, 15679, 6784, 4983, 14137, 423, 3079, 9782, 4845, 9163, 831, 8430, 14923, 9279, 8146, 6959, 5018, 5961, 8820, 769, 12382, 13940, 2952, 3140, 4599, 14817, 11939, 670, 6470, 2423, 3789, 1082, 498, 1354, 7177, 6286],
[2261, 5750, 7084, 4243, 3923, 4935, 3235, 14246, 12630, 5444, 51, 11617, 4001, 15917, 898, 5284, 9052, 7582, 3757, 5148, 13834, 13265, 901, 8304, 14882, 14644, 16056, 9135, 5921, 4507, 13276, 14563, 2713, 8007, 5738, 6614, 14798, 6704, 12946, 8308, 857, 12492, 380, 11622, 14087, 5888, 12184, 7230, 16100, 6420, 2815, 7775, 7026, 744, 10073, 4096, 14273, 8982, 4052, 15730, 9221, 15092, 2057, 12753, 2186, 15457, 3785, 11665, 1921, 7661, 16020, 401, 8049, 3580, 4663, 12474, 11117, 651, 5797, 4340, 7605, 11045, 14905, 10743, 10151, 15897, 2585, 54, 4962, 14367, 15017, 8650, 3017, 4434, 1110, 11668, 1152, 792, 1333, 14276],
[9293, 15378, 4132, 3574, 4394, 14330, 2016, 3260, 8909, 9296, 10427, 1760, 13203, 5437, 12262, 12215, 9185, 1382, 12332, 8467, 15456, 9112, 5430, 498, 10307, 3359, 3028, 14229, 14157, 15975, 5389, 10051, 9938, 10517, 10437, 11437, 6076, 8234, 9737, 13505, 4457, 9755, 6943, 13522, 8525, 16093, 11800, 6480, 7720, 14949, 10207, 11466, 11678, 558, 6682, 10504, 14357, 3722, 7598, 10629, 925, 7436, 220, 309, 5302, 1076, 935, 11189, 9438, 4692, 8532, 15226, 12008, 2295, 10587, 6687, 13437, 15954, 6422, 16013, 3363, 14935, 3578, 6667, 8642, 4783, 9651, 1876, 9042, 9262, 1784, 7155, 10361, 3000, 15138, 10426, 12890, 11219, 10825, 7187],
[11307, 8066, 1200, 5095, 585, 16155, 1810, 349, 15670, 15435, 11727, 3056, 16053, 16325, 6071, 2195, 13611, 15460, 6681, 15401, 13256, 15822, 12244, 15270, 12060, 9713, 14128, 15637, 7178, 12503, 6577, 2289, 4974, 6274, 12134, 331, 4598, 14882, 11145, 3076, 1786, 11645, 3174, 839, 1922, 7553, 460, 2298, 14918, 10079, 9007, 364, 14718, 15963, 1558, 12100, 2646, 7338, 16196, 174, 14322, 12888, 11951, 8924, 14734, 16026, 12031, 2539, 6937, 2762, 1710, 15618, 6038, 6283, 8025, 4692, 681, 7470, 3047, 2281, 4410, 4331, 8496, 3561, 14691, 11655, 138, 2965, 1408, 13562, 3309, 9191, 9899, 1258, 4109, 13399, 6116, 3971, 13515, 14227],
[4337, 14894, 9695, 11657, 6208, 13501, 12512, 15306, 1345, 12761, 16229, 435, 807, 2813, 5659, 2432, 15980, 943, 13009, 8616, 13837, 13713, 2962, 13317, 5365, 925, 12436, 12105, 1972, 5424, 999, 5824, 13354, 14227, 8902, 13581, 4001, 12065, 14483, 16167, 1794, 10462, 9257, 10699, 2262, 11650, 7805, 12934, 5687, 4768, 1637, 5613, 837, 4098, 1836, 1871, 10572, 1002, 12050, 6574, 14657, 2060, 14710, 14269, 8764, 1675, 7068, 2277, 963, 10470, 11327, 15443, 7520, 12666, 7878, 8083, 14559, 9934, 13661, 5555, 3603, 10700, 9375, 4997, 9486, 5140, 2237, 1747, 706, 212, 11891, 4936, 1006, 319, 7744, 7909, 8508, 2937, 8986, 10973],
[1861, 12030, 3090, 3641, 5492, 13427, 2580, 8009, 2568, 13671, 9761, 1056, 691, 8018, 8316, 6008, 8913, 4919, 3666, 7539, 12884, 4177, 8730, 15099, 9052, 15617, 9600, 4443, 4132, 844, 15914, 4783, 11521, 13837, 12584, 5553, 10106, 14439, 1230, 10486, 1320, 14015, 12043, 11784, 12146, 31, 10677, 928, 10082, 13437, 15318, 4732, 9700, 5854, 8790, 15501, 381, 8587, 6055, 13067, 6231, 3311, 7041, 250, 5508, 1304, 9407, 3342, 4201, 6869, 485, 8554, 15798, 9765, 12561, 9518, 6038, 6023, 3397, 5758, 6077, 9545, 6290, 2515, 9482, 15184, 13012, 13829, 10278, 1388, 2115, 2970, 10204, 11203, 7173, 9395, 11386, 15914, 7449, 15301],
[12352, 13652, 10554, 10609, 7959, 11339, 8243, 13850, 14565, 15585, 10835, 15516, 3993, 2724, 7964, 10671, 1195, 14001, 15898, 10502, 4928, 12962, 8371, 15795, 8869, 1625, 13660, 7382, 1402, 13856, 11625, 4931, 4009, 6522, 15531, 4057, 13509, 3438, 11669, 8350, 6137, 6749, 11110, 6781, 1442, 16186, 9407, 1395, 7922, 12008, 10489, 3266, 9508, 12919, 11583, 8034, 2217, 13286, 14280, 11747, 2301, 14258, 11108, 14077, 693, 1459, 14331, 13918, 7451, 15803, 14612, 3147, 6060, 12062, 12052, 7708, 15490, 9013, 5216, 13960, 15119, 10728, 6209, 299, 8654, 8350, 5160, 14996, 13099, 4698, 4442, 3834, 15448, 9144, 12249, 6129, 3937, 4649, 6740, 7865],
[10249, 3074, 14720, 10805, 8264, 10863, 1785, 7212, 8302, 11024, 14486, 16312, 11749, 16324, 4084, 6785, 9697, 6296, 10194, 5022, 9048, 4197, 10517, 3387, 7298, 11895, 4812, 10445, 13410, 4571, 1097, 9146, 7087, 7066, 1658, 7140, 2592, 2688, 8526, 3100, 3651, 16114, 13758, 9570, 7903, 1499, 13619, 6594, 11115, 7105, 1768, 11857, 31, 13088, 13714, 6508, 10672, 434, 9813, 15185, 978, 12128, 333, 10179, 5395, 11874, 12264, 2766, 7154, 3957, 15743, 708, 2143, 13882, 12684, 8106, 6738, 2570, 14221, 2545, 3725, 15885, 6274, 14091, 14250, 3952, 8144, 13906, 2394, 15572, 8073, 7814, 4592, 6133, 15517, 735, 12809, 10019, 6377, 14819],
[7663, 4687, 8955, 15623, 8901, 5984, 10537, 229, 12006, 2662, 4737, 3004, 15516, 6522, 9939, 7279, 805, 5761, 14754, 12535, 2746, 8624, 13074, 5367, 12829, 14918, 10872, 3805, 8350, 12120, 13175, 6240, 2687, 6738, 6838, 16179, 12963, 11095, 6606, 7463, 10077, 14882, 3089, 2688, 5281, 7622, 8875, 8061, 13879, 5278, 476, 12729, 8071, 8824, 954, 12205, 6156, 15463, 13860, 2491, 6035, 14701, 8203, 4516, 9243, 9205, 12153, 13484, 2647, 1629, 208, 8203, 13162, 3107, 13717, 6525, 8687, 12647, 11266, 42, 11802, 10031, 14015, 3619, 8701, 1560, 13167, 4364, 10158, 9780, 3345, 16345, 9119, 13044, 10916, 7026, 6611, 16224, 9332, 5683]
])
| 591.666667 | 652 | 0.677246 | 10,012 | 63,900 | 4.322413 | 0.747703 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.808327 | 0.162958 | 63,900 | 107 | 653 | 597.196262 | 0.000767 | 0.00036 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.009709 | 0 | 0.009709 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e5e2b191812e3848da4d017234d62614f7a5925f | 1,248 | py | Python | BOJ11800.py | INYEONGKIM/BOJ | 5e83d77a92d18b0d20d26645c7cfe4ba3e2d25bc | [
"MIT"
] | 2 | 2019-03-05T15:42:46.000Z | 2019-07-24T15:52:36.000Z | BOJ11800.py | INYEONGKIM/BOJ | 5e83d77a92d18b0d20d26645c7cfe4ba3e2d25bc | [
"MIT"
] | null | null | null | BOJ11800.py | INYEONGKIM/BOJ | 5e83d77a92d18b0d20d26645c7cfe4ba3e2d25bc | [
"MIT"
] | null | null | null | n=int(input());r=""
for i in range(1,n+1):
s=input().strip()
if s=="5 6" or s=="6 5":
r+="Case "+str(i)+": Sheesh Beesh\n"
else:
a=[int(k) for k in s.split()]
a.sort(reverse=True)
if a[0]==a[1]:
if a[0]==1:
r+="Case "+str(i)+": Habb Yakk\n"
elif a[0]==2:
r += "Case " + str(i) + ": Dobara\n"
elif a[0]==3:
r += "Case " + str(i) + ": Dousa\n"
elif a[0]==4:
r += "Case " + str(i) + ": Dorgy\n"
elif a[0]==5:
r += "Case " + str(i) + ": Dabash\n"
else:
r += "Case " + str(i) + ": Dosh\n"
else:
r += "Case " + str(i)+": "
for k in range(2):
if a[k]==1:
r+="Yakk"
elif a[k]==2:
r+="Doh"
elif a[k]==3:
r+="Seh"
elif a[k]==4:
r+="Ghar"
elif a[k]==5:
r+="Bang"
else:
r+="Sheesh"
if k==0:
r+=" "
else:
r+="\n"
print(r,end="")
| 29.714286 | 52 | 0.282051 | 158 | 1,248 | 2.227848 | 0.278481 | 0.113636 | 0.181818 | 0.204545 | 0.136364 | 0.079545 | 0 | 0 | 0 | 0 | 0 | 0.042017 | 0.523237 | 1,248 | 41 | 53 | 30.439024 | 0.54958 | 0 | 0 | 0.121951 | 0 | 0 | 0.120192 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.02439 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e5fbf57c70916767996825a3c2fe2fba0aebf5ad | 294 | py | Python | lab0/student_code.py | YaelBenShalom/Intro-to-AI | 37df1fc9316544338b8acfa5264316c4d5ce5915 | [
"MIT"
] | null | null | null | lab0/student_code.py | YaelBenShalom/Intro-to-AI | 37df1fc9316544338b8acfa5264316c4d5ce5915 | [
"MIT"
] | null | null | null | lab0/student_code.py | YaelBenShalom/Intro-to-AI | 37df1fc9316544338b8acfa5264316c4d5ce5915 | [
"MIT"
] | null | null | null | def order(data):
# new_data = []
for i in range(len(data)):
for j in range(len(data) - 1):
if (data[j] > data[j + 1]):
temp_data_j = data[j]
data[j] = data[j + 1]
data[j + 1] = temp_data_j
return data
| 24.5 | 42 | 0.421769 | 42 | 294 | 2.833333 | 0.333333 | 0.336134 | 0.302521 | 0.336134 | 0.428571 | 0.378151 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0.442177 | 294 | 11 | 43 | 26.727273 | 0.70122 | 0.044218 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f9025cc207b024bd75ec0f503ac992e842fd018e | 848 | py | Python | loader/__init__.py | MikeLagunes/centroids-triplet-network | e6430c0b090ef04a31738502d056f9169fd70393 | [
"MIT"
] | null | null | null | loader/__init__.py | MikeLagunes/centroids-triplet-network | e6430c0b090ef04a31738502d056f9169fd70393 | [
"MIT"
] | null | null | null | loader/__init__.py | MikeLagunes/centroids-triplet-network | e6430c0b090ef04a31738502d056f9169fd70393 | [
"MIT"
] | null | null | null | import json
from loader.cnn_household import cnn_household
from loader.triplet_resnet_household_softmax import triplet_resnet_household_softmax
from loader.cnn_core50 import cnn_core50
from loader.triplet_resnet_core50_softmax import triplet_resnet_core50_softmax
def get_loader(name):
"""get_loader
:param name:
"""
return {
'cnn_household':cnn_household,
'triplet_resnet_household_softmax':triplet_resnet_household_softmax,
'cnn_core50':cnn_core50,
'triplet_resnet_core50_softmax': triplet_resnet_core50_softmax,
}[name]
#def get_data_path(name, config_file='../config.json'):
def get_data_path(name, config_file='config.json'):
"""get_data_path
:param name:
:param config_file:
"""
data = json.load(open(config_file))
return data[name]['data_path']
| 24.228571 | 84 | 0.738208 | 109 | 848 | 5.330275 | 0.192661 | 0.179002 | 0.151463 | 0.199656 | 0.130809 | 0.130809 | 0.130809 | 0.130809 | 0.130809 | 0 | 0 | 0.02276 | 0.170991 | 848 | 34 | 85 | 24.941176 | 0.803698 | 0.149764 | 0 | 0 | 0 | 0 | 0.151163 | 0.088663 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0.333333 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f908502920597ba157459fbecb55b8fb06e72a4c | 446 | py | Python | wagtail/documents/signal_handlers.py | wlcrs/wagtail | 8afbc6c3eccef9eb0f09ed56c54cd36779451882 | [
"BSD-3-Clause"
] | 3 | 2019-05-14T13:43:08.000Z | 2021-11-09T11:27:18.000Z | wagtail/documents/signal_handlers.py | denza/wagtail | 3939397850f2c73d3f960cea5cc9c2cfae2d005d | [
"BSD-3-Clause"
] | 163 | 2019-06-14T20:45:06.000Z | 2022-03-23T01:41:07.000Z | wagtail/documents/signal_handlers.py | denza/wagtail | 3939397850f2c73d3f960cea5cc9c2cfae2d005d | [
"BSD-3-Clause"
] | 1 | 2021-05-11T00:05:26.000Z | 2021-05-11T00:05:26.000Z | from django.db import transaction
from django.db.models.signals import post_delete
from wagtail.documents.models import get_document_model
def post_delete_file_cleanup(instance, **kwargs):
# Pass false so FileField doesn't save the model.
transaction.on_commit(lambda: instance.file.delete(False))
def register_signal_handlers():
Document = get_document_model()
post_delete.connect(post_delete_file_cleanup, sender=Document)
| 29.733333 | 66 | 0.802691 | 62 | 446 | 5.532258 | 0.564516 | 0.116618 | 0.069971 | 0.122449 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121076 | 446 | 14 | 67 | 31.857143 | 0.875 | 0.105381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.375 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f92297e66062159f370ea1db59deb0882116ec70 | 170 | py | Python | zocalo_dls/__init__.py | jacobfilik/python-zocalo-dls | 57e73ff613ea1ac516b015edb37ea472c15200e2 | [
"BSD-3-Clause"
] | null | null | null | zocalo_dls/__init__.py | jacobfilik/python-zocalo-dls | 57e73ff613ea1ac516b015edb37ea472c15200e2 | [
"BSD-3-Clause"
] | null | null | null | zocalo_dls/__init__.py | jacobfilik/python-zocalo-dls | 57e73ff613ea1ac516b015edb37ea472c15200e2 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import, division, print_function
import logging
__version__ = "0.2.0"
logging.getLogger("zocalo_dls").addHandler(logging.NullHandler())
| 24.285714 | 65 | 0.811765 | 21 | 170 | 6.047619 | 0.761905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0.082353 | 170 | 6 | 66 | 28.333333 | 0.794872 | 0 | 0 | 0 | 0 | 0 | 0.088235 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
f928f15006f9ec95c517b7886236786861dacafa | 2,116 | py | Python | tests/test_metadata.py | proio-org/py-proio | aa5202baf3ca958771b081f984a99927551a128c | [
"BSD-3-Clause"
] | 1 | 2018-10-02T07:50:35.000Z | 2018-10-02T07:50:35.000Z | tests/test_metadata.py | proio-org/py-proio | aa5202baf3ca958771b081f984a99927551a128c | [
"BSD-3-Clause"
] | 4 | 2018-08-29T22:10:25.000Z | 2018-09-26T20:31:28.000Z | tests/test_metadata.py | proio-org/py-proio | aa5202baf3ca958771b081f984a99927551a128c | [
"BSD-3-Clause"
] | 1 | 2020-04-06T12:08:48.000Z | 2020-04-06T12:08:48.000Z | import io
import pytest
import proio
def test_header1():
buf = io.BytesIO(b'')
with proio.Writer(fileobj = buf) as writer:
event = proio.Event()
writer.push(event)
writer.push(event)
writer.flush()
writer.push(event)
buf.seek(0, 0)
with proio.Reader(fileobj = buf) as reader:
reader.skip(0)
assert(reader._bucket_header.nEvents == 2)
reader.skip(2)
assert(reader._bucket_header.nEvents == 1)
reader.skip(1)
assert(reader._bucket_header is None)
def test_push_update1():
buf = io.BytesIO(b'')
with proio.Writer(fileobj = buf) as writer:
writer.push_metadata('key1', b'value1')
writer.push_metadata('key2', b'value2')
event = proio.Event()
writer.push(event)
writer.push_metadata('key2', b'value3')
writer.push(event)
writer.push_metadata('key1', b'value4')
writer.push_metadata('key2', b'value5')
writer.push(event)
buf.seek(0, 0)
with proio.Reader(fileobj = buf) as reader:
event1 = next(reader)
event2 = next(reader)
event3 = next(reader)
assert(event1.metadata['key1'] == b'value1')
assert(event1.metadata['key2'] == b'value2')
assert(event2.metadata['key1'] == b'value1')
assert(event2.metadata['key2'] == b'value3')
assert(event3.metadata['key1'] == b'value4')
assert(event3.metadata['key2'] == b'value5')
buf = io.BytesIO(b'')
with proio.Writer(fileobj = buf) as writer:
writer.push(event1)
writer.push(event2)
writer.push(event3)
buf.seek(0, 0)
with proio.Reader(fileobj = buf) as reader:
event1 = next(reader)
event2 = next(reader)
event3 = next(reader)
assert(event1.metadata['key1'] == b'value1')
assert(event1.metadata['key2'] == b'value2')
assert(event2.metadata['key1'] == b'value1')
assert(event2.metadata['key2'] == b'value3')
assert(event3.metadata['key1'] == b'value4')
assert(event3.metadata['key2'] == b'value5')
| 31.117647 | 52 | 0.595463 | 261 | 2,116 | 4.773946 | 0.16092 | 0.11236 | 0.0939 | 0.076244 | 0.838684 | 0.724719 | 0.691814 | 0.691814 | 0.627608 | 0.627608 | 0 | 0.043093 | 0.254253 | 2,116 | 67 | 53 | 31.58209 | 0.746515 | 0 | 0 | 0.655172 | 0 | 0 | 0.080378 | 0 | 0 | 0 | 0 | 0 | 0.258621 | 1 | 0.034483 | false | 0 | 0.051724 | 0 | 0.086207 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
008fba76401f61e8dc0ea4e76fbbb97a270231e8 | 259 | py | Python | data_models/zoom_activity_data_model.py | panther-labs/panther-cli | 4e5c0a21570e1a02dada990fd91e324416afac96 | [
"MIT"
] | 4 | 2019-10-17T19:33:29.000Z | 2019-10-21T15:23:30.000Z | data_models/zoom_activity_data_model.py | jacknagz/panther-analysis | fceab78ba5624136776596ee1b25fa0dc8a02a42 | [
"Apache-2.0"
] | null | null | null | data_models/zoom_activity_data_model.py | jacknagz/panther-analysis | fceab78ba5624136776596ee1b25fa0dc8a02a42 | [
"Apache-2.0"
] | null | null | null | import panther_event_type_helpers as event_type
def get_event_type(event):
if event.get("type") == "Sign in":
return event_type.SUCCESSFUL_LOGIN
if event.get("type") == "Sign out":
return event_type.SUCCESSFUL_LOGOUT
return None
| 25.9 | 47 | 0.702703 | 37 | 259 | 4.648649 | 0.459459 | 0.261628 | 0.116279 | 0.162791 | 0.209302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.200772 | 259 | 9 | 48 | 28.777778 | 0.830918 | 0 | 0 | 0 | 0 | 0 | 0.088803 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 1 | 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 | 3 |
009a4611ff0b925eb4d8cad017fff525cf9121b1 | 83 | py | Python | tests/helpers.py | SebastiaanZ/aoc-2019 | e1fe4630b0f375be0b79398e07e23b9c0196efbb | [
"MIT"
] | 3 | 2019-12-02T19:38:14.000Z | 2020-01-28T00:06:09.000Z | tests/helpers.py | SebastiaanZ/aoc-2019 | e1fe4630b0f375be0b79398e07e23b9c0196efbb | [
"MIT"
] | 6 | 2020-03-24T17:58:40.000Z | 2022-03-12T00:18:45.000Z | tests/helpers.py | SebastiaanZ/aoc-2019 | e1fe4630b0f375be0b79398e07e23b9c0196efbb | [
"MIT"
] | null | null | null | import collections
Puzzle = collections.namedtuple("Puzzle", ("data", "answer"))
| 16.6 | 61 | 0.722892 | 8 | 83 | 7.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108434 | 83 | 4 | 62 | 20.75 | 0.810811 | 0 | 0 | 0 | 0 | 0 | 0.192771 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
009dac2a08665ca4b87073c1b59cffd0ddf1eab2 | 63 | py | Python | python/testData/refactoring/rename/renameLocalWithComprehension2_after.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/refactoring/rename/renameLocalWithComprehension2_after.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/refactoring/rename/renameLocalWithComprehension2_after.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | bar = 2
elements = [x for x in range(5) if x == bar]
print bar
| 15.75 | 44 | 0.619048 | 14 | 63 | 2.785714 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042553 | 0.253968 | 63 | 3 | 45 | 21 | 0.787234 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
00b6b87379e6f00b03f8138b4d0a28007e01a2f5 | 879 | py | Python | notebook/list_flatten_timeit.py | puyopop/python-snippets | 9d70aa3b2a867dd22f5a5e6178a5c0c5081add73 | [
"MIT"
] | 1 | 2020-07-18T17:58:43.000Z | 2020-07-18T17:58:43.000Z | notebook/list_flatten_timeit.py | puyopop/python-snippets | 9d70aa3b2a867dd22f5a5e6178a5c0c5081add73 | [
"MIT"
] | null | null | null | notebook/list_flatten_timeit.py | puyopop/python-snippets | 9d70aa3b2a867dd22f5a5e6178a5c0c5081add73 | [
"MIT"
] | null | null | null | import itertools
l_2d_5 = [[0, 1, 2]] * 5
print(l_2d_5)
# [[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]]
%%timeit
list(itertools.chain.from_iterable(l_2d_5))
# 711 ns ± 21.2 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
%%timeit
sum(l_2d_5, [])
# 448 ns ± 10.8 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
l_2d_100 = [[0, 1, 2]] * 100
%%timeit
list(itertools.chain.from_iterable(l_2d_100))
# 7.27 µs ± 390 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
%%timeit
sum(l_2d_100, [])
# 41 µs ± 1.34 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
l_2d_10000 = [[0, 1, 2]] * 10000
%%timeit
list(itertools.chain.from_iterable(l_2d_10000))
# 513 µs ± 15.5 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
%%timeit
sum(l_2d_10000, [])
# 418 ms ± 22.8 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
| 25.852941 | 76 | 0.631399 | 192 | 879 | 2.833333 | 0.244792 | 0.055147 | 0.044118 | 0.132353 | 0.715074 | 0.715074 | 0.595588 | 0.595588 | 0.380515 | 0.334559 | 0 | 0.200849 | 0.195677 | 879 | 33 | 77 | 26.636364 | 0.551627 | 0.558589 | 0 | 0.352941 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.058824 | null | null | 0.058824 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
00b75d7c6b8b5487e5f4facc5c4b54803d9443c1 | 599 | py | Python | pymongo/pymongo_connect.py | yunzhang599/Python3_Package_Examples | 3e479925f3f6818bf35e46123f720839acf075eb | [
"MIT"
] | 1 | 2019-11-16T05:06:01.000Z | 2019-11-16T05:06:01.000Z | pymongo/pymongo_connect.py | yunzhang599/Python3_Package_Examples | 3e479925f3f6818bf35e46123f720839acf075eb | [
"MIT"
] | null | null | null | pymongo/pymongo_connect.py | yunzhang599/Python3_Package_Examples | 3e479925f3f6818bf35e46123f720839acf075eb | [
"MIT"
] | null | null | null |
# full pymongo documentation
# http://api.mongodb.org/python/current/
import pymongo
client = pymongo.MongoClient("localhost", 27017)
db = client.test
print db.name
print db.my_collection
db.my_collection.save({"x": 10})
db.my_collection.save({"x": 8})
db.my_collection.save({"x": 11})
db.my_collection.find_one()
for item in db.my_collection.find():
print item["x"]
db.my_collection.create_index("x")
for item in db.my_collection.find().sort("x", pymongo.ASCENDING):
print item["x"]
print [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
| 22.185185 | 71 | 0.684474 | 93 | 599 | 4.290323 | 0.408602 | 0.090226 | 0.315789 | 0.180451 | 0.350877 | 0.20802 | 0.20802 | 0.140351 | 0 | 0 | 0 | 0.023576 | 0.15025 | 599 | 26 | 72 | 23.038462 | 0.760314 | 0.108514 | 0 | 0.133333 | 0 | 0 | 0.03373 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.066667 | null | null | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
00c4474d6af6fbe8b3af5359f2123d3f04acf127 | 2,826 | py | Python | edabit/longest_substring.py | sci-c0/python-misc-problems | a0827cc9cd290ca142bba3b7dda307234da63c3c | [
"BSD-3-Clause"
] | null | null | null | edabit/longest_substring.py | sci-c0/python-misc-problems | a0827cc9cd290ca142bba3b7dda307234da63c3c | [
"BSD-3-Clause"
] | null | null | null | edabit/longest_substring.py | sci-c0/python-misc-problems | a0827cc9cd290ca142bba3b7dda307234da63c3c | [
"BSD-3-Clause"
] | null | null | null | """
Original Problem: https://edabit.com/challenge/RB6iWFrCd6rXWH3vi
"""
import re
from utils import Test
def remainder(divisor):
def _find_rem(dividend):
return dividend % divisor
return _find_rem
def span_len(span: tuple[int, int]) -> int:
return span[1] - span[0]
def longest_substring(digits: str) -> str:
if len(digits) < 2:
return ''
# Find the remainder string
remainder_str = ''.join(map(str, map(remainder(2), map(int, digits))))
# Match multiple occurences (at least 1) of '01' followed by at most single '0' (if any)
# Or similarly,
# Match multiple occurences (at least 1) of '10' followed by at most single '1' (if any)
pat = r"((?:01)+0?)|((?:10)+1?)"
max_len_span = ()
max_len = 0
for match in re.finditer(pat, remainder_str):
if max_len < (spln := span_len(spn := match.span())):
max_len = spln
max_len_span = spn
return digits[max_len_span[0]:max_len_span[1]]
if __name__ == '__main__':
# Test Cases copied from edabit's problem's test cases
Test.assert_equals(longest_substring("844929328912985315632725682153"), "56327256")
Test.assert_equals(longest_substring("769697538272129475593767931733"), "27212947")
Test.assert_equals(longest_substring("937948289456111258444958189244"), "894561")
Test.assert_equals(longest_substring("736237766362158694825822899262"), "636")
Test.assert_equals(longest_substring("369715978955362655737322836233"), "369")
Test.assert_equals(longest_substring("345724969853525333273796592356"), "496985")
Test.assert_equals(longest_substring("548915548581127334254139969136"), "8581")
Test.assert_equals(longest_substring("417922164857852157775176959188"), "78521")
Test.assert_equals(longest_substring("251346385699223913113161144327"), "638569")
Test.assert_equals(longest_substring("483563951878576456268539849244"), "18785")
Test.assert_equals(longest_substring("853667717122615664748443484823"), "474")
Test.assert_equals(longest_substring("398785511683322662883368457392"), "98785")
Test.assert_equals(longest_substring("368293545763611759335443678239"), "76361")
Test.assert_equals(longest_substring("775195358448494712934755311372"), "4947")
Test.assert_equals(longest_substring("646113733929969155976523363762"), "76523")
Test.assert_equals(longest_substring("575337321726324966478369152265"), "478369")
Test.assert_equals(longest_substring("754388489999793138912431545258"), "545258")
Test.assert_equals(longest_substring("198644286258141856918653955964"), "2581418569")
Test.assert_equals(longest_substring("643349187319779695864213682274"), "349")
Test.assert_equals(longest_substring("919331281193713636178478295857"), "36361")
print("All Tests Passed !!")
| 42.179104 | 92 | 0.738854 | 302 | 2,826 | 6.688742 | 0.360927 | 0.166337 | 0.158416 | 0.227723 | 0.371287 | 0.032673 | 0.032673 | 0 | 0 | 0 | 0 | 0.299549 | 0.13765 | 2,826 | 66 | 93 | 42.818182 | 0.529339 | 0.117481 | 0 | 0 | 0 | 0 | 0.305331 | 0.251616 | 0 | 0 | 0 | 0 | 0.47619 | 1 | 0.095238 | false | 0.02381 | 0.047619 | 0.047619 | 0.261905 | 0.02381 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
00c9e630e719edcf1a4930bc16475771f1103db7 | 2,614 | py | Python | src/metrics.py | AIRI-Institute/DeepCT | 8e23fda101bd4a2bce2c98c5a73d97072a3892de | [
"Apache-2.0"
] | null | null | null | src/metrics.py | AIRI-Institute/DeepCT | 8e23fda101bd4a2bce2c98c5a73d97072a3892de | [
"Apache-2.0"
] | null | null | null | src/metrics.py | AIRI-Institute/DeepCT | 8e23fda101bd4a2bce2c98c5a73d97072a3892de | [
"Apache-2.0"
] | null | null | null | import functools
import numpy as np
import scipy.stats
import sklearn.metrics as metrics
# Metric helpers which convert float values to binary (0/1).
# Regression metrics helper functions.
def _to_binary(x: np.ndarray, threshold=0.5) -> np.ndarray:
return np.where(x > threshold, 1, 0).astype(int)
def binary_inputs(score_func):
"""Wrapper function for input binarization using specified threshold(s)"""
def binary_wrapper(y_true, y_pred, threshold=0.5, **kwargs):
if isinstance(threshold, float):
binary_y_true = _to_binary(y_true, threshold)
binary_y_pred = _to_binary(y_pred, threshold)
else:
mask = np.logical_or(y_pred > threshold[1], y_pred < threshold[0])
binarization_thresh = (threshold[0] + threshold[1]) / 2
y_pred = _to_binary(y_pred, binarization_thresh)
binary_y_true = y_true[mask]
binary_y_pred = y_pred[mask]
return score_func(binary_y_true, binary_y_pred, **kwargs)
return binary_wrapper
def threshold_wrapper(score_func, threshold):
return functools.partial(score_func, threshold=threshold)
@binary_inputs
def accuracy_score(y_true: np.ndarray, y_pred: np.ndarray, **kwargs) -> float:
return metrics.accuracy_score(y_true, y_pred, **kwargs)
@binary_inputs
def f1_score(y_true: np.ndarray, y_pred: np.ndarray, **kwargs) -> float:
return metrics.f1_score(y_true, y_pred, **kwargs)
@binary_inputs
def precision_score(y_true: np.ndarray, y_pred: np.ndarray, **kwargs) -> float:
return metrics.precision_score(y_true, y_pred, **kwargs)
@binary_inputs
def recall_score(y_true: np.ndarray, y_pred: np.ndarray, **kwargs) -> float:
return metrics.recall_score(y_true, y_pred, **kwargs)
@binary_inputs
def jaccard_score(y_true: np.ndarray, y_pred: np.ndarray, **kwargs) -> float:
return metrics.jaccard_score(y_true, y_pred, **kwargs)
def jaccard_multi_threshold(
y_true: np.ndarray,
y_pred: np.ndarray,
thresholds=[0.1, 0.3, 0.5, 0.7, 0.9],
**kwargs
) -> float:
multi_thresh_jaccard = []
for threshold in thresholds:
multi_thresh_jaccard.append(jaccard_score(y_true, y_pred, threshold=threshold))
multi_thresh_jaccard = np.array(multi_thresh_jaccard)
return multi_thresh_jaccard
def spearmanr_cc(y_true: np.ndarray, y_pred: np.ndarray) -> float:
# Returns Spearman's correlation coefficient
return scipy.stats.spearmanr(y_true, y_pred)[0]
def pearsonr_cc(y_true: np.ndarray, y_pred: np.ndarray) -> float:
# Returns Pearson's r
return scipy.stats.pearsonr(y_true, y_pred)[0]
| 31.493976 | 87 | 0.713083 | 386 | 2,614 | 4.562176 | 0.199482 | 0.073822 | 0.062465 | 0.051107 | 0.384441 | 0.356048 | 0.307212 | 0.307212 | 0.291312 | 0.20954 | 0 | 0.012517 | 0.174828 | 2,614 | 82 | 88 | 31.878049 | 0.803894 | 0.087223 | 0 | 0.098039 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.078431 | 0.176471 | 0.54902 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
da9d6cf099aeb2bcd0ee3647198432bf96f4ff40 | 16,147 | py | Python | test/test_parse_pronoun_data.py | phseiff/gender-render | 51db02193b46b38284290c4f5bde500208bf1605 | [
"MIT"
] | 24 | 2021-01-08T00:32:50.000Z | 2022-03-06T11:20:26.000Z | test/test_parse_pronoun_data.py | phseiff/gender-render | 51db02193b46b38284290c4f5bde500208bf1605 | [
"MIT"
] | 6 | 2021-01-08T00:19:25.000Z | 2021-03-22T16:27:40.000Z | test/test_parse_pronoun_data.py | phseiff/gender-render | 51db02193b46b38284290c4f5bde500208bf1605 | [
"MIT"
] | null | null | null |
import unittest
import warnings
import src.parse_pronoun_data as ppd
import src.errors as err
import src.warnings as ws
# pairs of valid json and its parsed version:
VALID_JSON_1 = """{"foo": "bar"}""", {"foo": "bar"}
VALID_JSON_2 = """{"foo": 1, "bar": ["a", "b"]}""", {"foo": 1, "bar": ["a", "b"]}
VALID_JSON_3 = """{}""", {}
VALID_JSON_4 = """{"foo": {"bar": "baz"}}""", {"foo": {"bar": "baz"}}
# invalid json data:
INVALID_JSON_1 = """{"foo":}"""
INVALID_JSON_2 = """{"foo"}"""
INVALID_JSON_3 = """{"foo": "bar" """
INVALID_JSON_4 = """kk"""
INVALID_JSON = [INVALID_JSON_1, INVALID_JSON_2, INVALID_JSON_3, INVALID_JSON_4]
# valid pronoun data:
IDPD_W_NO_PROPERTIES = """{}""", {}
IDPD_W_ONE_PROPERTY = """{"they": "xe"}""", {"they": "xe"}
IDPD_W_SEVERAL_PROPERTIES = """{"they": "xe", "them": "xen"}""", {"they": "xe", "them": "xen"}
GRPD_W_ONE_IDPD_1 = """{"foo": {}}""", {"foo": {}}
GRPD_W_ONE_IDPD_2 = """{"foo": {"they": "xe"}}""", {"foo": {"they": "xe"}}
GRPD_W_ONE_IDPD_3 = """{"foo": {"they": "xe", "them": "xen"}}""", {"foo": {"they": "xe", "them": "xen"}}
GRPD_W_MULTIPLE_ID = ("""{"foo": {"they": "xe", "them": "xen"}, "bar": {"they": "xe"}}""",
{"foo": {"they": "xe", "them": "xen"}, "bar": {"they": "xe"}})
VALID_IDPDS = [IDPD_W_NO_PROPERTIES, IDPD_W_ONE_PROPERTY, IDPD_W_SEVERAL_PROPERTIES]
VALID_GRPDS = [GRPD_W_ONE_IDPD_1, GRPD_W_ONE_IDPD_2, GRPD_W_ONE_IDPD_3, GRPD_W_MULTIPLE_ID]
class TestGRPDParser(unittest.TestCase):
def test_pd_string_to_dict(self):
# test for valid json data:
self.assertEqual(ppd.GRPDParser.pd_string_to_dict(VALID_JSON_1[0]), VALID_JSON_1[1])
self.assertEqual(ppd.GRPDParser.pd_string_to_dict(VALID_JSON_2[0]), VALID_JSON_2[1])
self.assertEqual(ppd.GRPDParser.pd_string_to_dict(VALID_JSON_3[0]), VALID_JSON_3[1])
self.assertEqual(ppd.GRPDParser.pd_string_to_dict(VALID_JSON_4[0]), VALID_JSON_4[1])
# test for invalid json data:
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.pd_string_to_dict(INVALID_JSON_1))
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.pd_string_to_dict(INVALID_JSON_2))
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.pd_string_to_dict(INVALID_JSON_3))
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.pd_string_to_dict(INVALID_JSON_4))
# get the right results for the valid pronoun data examples we prepared:
for inp, out in VALID_IDPDS + VALID_GRPDS:
self.assertEqual(ppd.GRPDParser.pd_string_to_dict(inp), out)
def test_type_of_pd(self):
# error if input is not a dict:
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.type_of_pd("{\"they\": \"xe\"}"))
# error if values are of different types (since it can't be either idpd or grpd then):
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.type_of_pd({"a": "foo", "b": ["a"]}))
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.type_of_pd({"a": "foo", "b": 1}))
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.type_of_pd({"a": "foo", "b": {"c": "bar"}}))
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.type_of_pd({"a": {"c": "bar"}, "b": ["a"]}))
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.type_of_pd({"a": {"c": "bar"}, "b": 1}))
# even if we have multiple values:
self.assertRaises(err.InvalidPDError,
lambda: ppd.GRPDParser.type_of_pd({"a": "foo", "b": {"c": "bar"}, "c": "c"}))
# error if values are something else than all string or all dict, in cases where all values are the same type:
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.type_of_pd({"a": ["b"], "b": ["c"]}))
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.type_of_pd({"a": 1, "b": 2, "c": 3}))
# but accept if we have a valid all-values-are-strings or all-values-are-dicts:
ppd.GRPDParser.type_of_pd({"foo": "bar", "foo2": "baz"})
ppd.GRPDParser.type_of_pd({"foo": {"bar": "baz"}, "foo2": {"bar2": "baz"}})
# raise error if an id is an empty string:
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.type_of_pd({"": {"wuwu": "wuiwui"}}))
# but not if the key in idpd is a string:
ppd.GRPDParser.type_of_pd({"": "wuwu"})
ppd.GRPDParser.type_of_pd({"wuwu": {"": "wuiwui"}})
# raise error if a value in a dict in a string-to-dict-mapping is invalid:
self.assertRaises(err.InvalidPDError,
lambda: ppd.GRPDParser.type_of_pd({"foo": {"bar": "baz"}, "bar": {"baz": 1}}))
self.assertRaises(err.InvalidPDError,
lambda: ppd.GRPDParser.type_of_pd({"foo": {"bar": "baz"}, "bar": {"baz": ["a"]}}))
self.assertRaises(err.InvalidPDError,
lambda: ppd.GRPDParser.type_of_pd({"foo": {"bar": {"bar": "baz"}}, "bar": {"baz": "a"}}))
# make sure that empty dicts are accepted, but the result is not relevant:
self.assertIn(ppd.GRPDParser.type_of_pd({}), (ppd.IDPD, ppd.GRPD))
# be okay with one as several key-value pairs in a string-to-dict-mapping,
# and return IDPD for such values:
self.assertEqual(ppd.GRPDParser.type_of_pd({"foo": "bar"}), ppd.IDPD)
self.assertEqual(ppd.GRPDParser.type_of_pd({"foo": "bar", "bar": "baz"}), ppd.IDPD)
# be okay with zero, one as well as several key-value-pairs in a singular string-dict-mapping:
self.assertEqual(ppd.GRPDParser.type_of_pd({"foo": {}}), ppd.GRPD)
self.assertEqual(ppd.GRPDParser.type_of_pd({"foo": {"bar": "baz"}}), ppd.GRPD)
self.assertEqual(ppd.GRPDParser.type_of_pd({"foo": {"bar": "baz", "baz": "bar"}}), ppd.GRPD)
# be okay with combinations thereof:
self.assertEqual(ppd.GRPDParser.type_of_pd(
{"foo": {}, "foo2": {"bar": "baz"}, "foo3": {"baz": "bar", "bar": "baz"}}), ppd.GRPD)
# accept the test values we prepared for valid pronoun data:
for _, inp in VALID_IDPDS:
if inp != {}:
self.assertEqual(ppd.GRPDParser.type_of_pd(inp), ppd.IDPD)
for _, inp in VALID_GRPDS:
if inp != {}:
self.assertEqual(ppd.GRPDParser.type_of_pd(inp), ppd.GRPD)
def test_return_pd_if_it_is_valid(self):
# testing is limited to our pre-defined test cases since this function internally calls test_type_of_dict and
# should therefore not be wrong in determining if something is valid or not:
# test pre-defined valid pronoun data:
for _, inp in VALID_IDPDS + VALID_GRPDS:
out = ppd.GRPDParser.return_pd_if_it_is_valid(inp)
self.assertEqual(id(inp), id(out))
self.assertEqual(inp, out)
# test the same for some other values to be sure that the exact value of strings doesn not matter and only
# the structure is looked at:
ppd.GRPDParser.return_pd_if_it_is_valid(
{"foo": {}, "foo2": {"bar": "baz"}, "foo3": {"baz": "bar", "bar": "baz"}})
ppd.GRPDParser.return_pd_if_it_is_valid({"foo": "bar", "bar": "baz"})
# make sure the errors raised by type_of_dict are raised by this function as well:
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.return_pd_if_it_is_valid({"a": "foo", "b": ["a"]}))
self.assertRaises(err.InvalidPDError, lambda: ppd.GRPDParser.return_pd_if_it_is_valid({"bar": {"baz": 1}}))
def test_pd_dict_to_grpd_dict(self):
# test for idpd values:
for _, inp in VALID_IDPDS:
if inp != {}: # <- special case, since it is undefined whether "{}" is an idpd or an grpd.
self.assertEqual(ppd.GRPDParser.pd_dict_to_grpd_dict(inp), {"": inp})
# test for grpd values:
for _, inp in VALID_GRPDS:
if inp != {}: # <- special case, since it is undefined whether "{}" is an idpd or an grpd.
self.assertEqual(ppd.GRPDParser.pd_dict_to_grpd_dict(inp), inp)
# confirm that this also works if the words for randomly-looking dicts with "non-official" keywords:
self.assertEqual(ppd.GRPDParser.pd_dict_to_grpd_dict({"foo": "bar"}), {"": {"foo": "bar"}})
self.assertEqual(ppd.GRPDParser.pd_dict_to_grpd_dict({"baz": {"foo": "bar"}}), {"baz": {"foo": "bar"}})
# two manual tests in case our testing with the predefined valid pronoun data examples happens to be wrong:
self.assertEqual(ppd.GRPDParser.pd_dict_to_grpd_dict({"they": "xe", "them": "xen"}),
{"": {"they": "xe", "them": "xen"}})
self.assertEqual(ppd.GRPDParser.pd_dict_to_grpd_dict({"foo": {"they": "xe", "them": "xen"}}),
{"foo": {"they": "xe", "them": "xen"}})
def test_grpd_dict_to_canonical_grpd_dict(self):
# test for one id, one non-con property:
self.assertEqual(ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict(
{"foo": {"they": "xe"}}),
{"foo": {"subject": "xe"}})
# test for one id, one con property:
self.assertEqual(ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict(
{"foo": {"subject": "xe"}}),
{"foo": {"subject": "xe"}})
# test for one id, two non-con properties:
self.assertEqual(ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict(
{"foo": {"they": "xe", "them": "xen"}}),
{"foo": {"subject": "xe", "object": "xen"}})
# test for one id, one non-con and one con property:
self.assertEqual(ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict(
{"foo": {"they": "xe", "address": "Mr"}}),
{"foo": {"subject": "xe", "address": "Mr"}})
# test for one id, two con properties:
self.assertEqual(ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict(
{"foo": {"subject": "xe", "address": "Mr"}}),
{"foo": {"subject": "xe", "address": "Mr"}})
# combined: test for multiple ids with multiple properties:
self.assertEqual(ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict(
{"foo": {"they": "xe", "address": "Mr"}, "bar": {"obj": "them"}}),
{"foo": {"subject": "xe", "address": "Mr"}, "bar": {"object": "them"}})
# special cases (further covered by the unittests for `handle_context_values.py`):
# custom properties - in this case, canonical:
self.assertEqual(ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict(
{"foo": {"<wuwu>": "wawa"}}),
{"foo": {"<wuwu>": "wawa"}})
self.assertEqual(ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict(
{"foo": {"_wuwu": "wawa"}}),
{"foo": {"<wuwu>": "wawa"}})
# and in this case, not canonical and raising a warning:
with warnings.catch_warnings(record=True) as w:
self.assertEqual(ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict(
{"foo": {"wuwu": "wawa"}}),
{"foo": {"<wuwu>": "wawa"}})
self.assertTrue(len(w) == 1 and issubclass(w[-1].category, ws.UnknownPropertyWarning))
# error for invalid information
self.assertRaises(err.InvalidInformationError,
lambda: ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict({"foo": {"gender-nouns": "fufu"}}))
self.assertRaises(err.InvalidInformationError,
lambda: ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict({"foo": {"gender-addressing": "hi"}}))
ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict({"foo": {"gender-nouns": "neutral"}})
ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict({"foo": {"gender-addressing": "t"}})
# error for doubled information
self.assertRaises(err.DoubledInformationError,
lambda: ppd.GRPDParser.grpd_dict_to_canonical_grpd_dict({"foo": {"they": "a", "subj": "b"}}))
def test_full_parsing_pipeline(self):
# error when given pd is neither grpd nor idpd:
self.assertRaises(err.InvalidPDError,
lambda: ppd.GRPDParser.full_parsing_pipeline({"foo": {"bar": {"baz": "wuwu"}}}))
self.assertRaises(err.InvalidPDError,
lambda: ppd.GRPDParser.full_parsing_pipeline({"foo": {"bar": "baz", "baz": 1}}))
self.assertRaises(err.InvalidPDError,
lambda: ppd.GRPDParser.full_parsing_pipeline({"": {"they": "xe"}}))
# turn grpd as well as idpd into grpd in the end:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"subject": "they"}}),
{"foo": {"subject": "they"}})
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"subject": "they"}),
{"": {"subject": "they"}})
# accepts grpd with multiple ids:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"subject": "they"}, "bar": {"object": "them"}}),
{"foo": {"subject": "they"}, "bar": {"object": "them"}})
# tests done when converting properties to canonical properties - copied from tests for the dedicated function:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"they": "xe"}}),
{"foo": {"subject": "xe"}})
# test for one id, one con property:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"subject": "xe"}}),
{"foo": {"subject": "xe"}})
# test for one id, two non-con properties:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"they": "xe", "them": "xen"}}),
{"foo": {"subject": "xe", "object": "xen"}})
# test for one id, one non-con and one con property:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"they": "xe", "address": "Mr"}}),
{"foo": {"subject": "xe", "address": "Mr"}})
# test for one id, two con properties:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"subject": "xe", "address": "Mr"}}),
{"foo": {"subject": "xe", "address": "Mr"}})
# combined: test for multiple ids with multiple properties:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"they": "xe", "address": "Mr"}, "bar": {"obj": "them"}}),
{"foo": {"subject": "xe", "address": "Mr"}, "bar": {"object": "them"}})
# special cases (further covered by the unittests for `handle_context_values.py`):
# custom properties - in this case, canonical:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"<wuwu>": "wawa"}}),
{"foo": {"<wuwu>": "wawa"}})
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"_wuwu": "wawa"}}),
{"foo": {"<wuwu>": "wawa"}})
# and in this case, not canonical and raising a warning:
with warnings.catch_warnings(record=True) as w:
self.assertEqual(ppd.GRPDParser.full_parsing_pipeline(
{"foo": {"wuwu": "wawa"}}),
{"foo": {"<wuwu>": "wawa"}})
self.assertTrue(len(w) == 1 and issubclass(w[-1].category, ws.UnknownPropertyWarning))
# error for invalid information
self.assertRaises(err.InvalidInformationError,
lambda: ppd.GRPDParser.full_parsing_pipeline({"foo": {"gender-nouns": "fufu"}}))
self.assertRaises(err.InvalidInformationError,
lambda: ppd.GRPDParser.full_parsing_pipeline({"foo": {"gender-addressing": "lolol"}}))
ppd.GRPDParser.full_parsing_pipeline({"foo": {"gender-nouns": "neutral"}})
ppd.GRPDParser.full_parsing_pipeline({"foo": {"gender-addressing": "t"}})
# error for doubled information
self.assertRaises(err.DoubledInformationError,
lambda: ppd.GRPDParser.full_parsing_pipeline({"foo": {"they": "a", "subj": "b"}}))
| 54.921769 | 120 | 0.603084 | 2,042 | 16,147 | 4.576885 | 0.112635 | 0.111278 | 0.077038 | 0.119837 | 0.762786 | 0.732292 | 0.71346 | 0.68532 | 0.631393 | 0.60443 | 0 | 0.004702 | 0.222952 | 16,147 | 293 | 121 | 55.109215 | 0.740177 | 0.191924 | 0 | 0.44086 | 0 | 0.005376 | 0.129571 | 0 | 0 | 0 | 0 | 0 | 0.392473 | 1 | 0.032258 | false | 0 | 0.026882 | 0 | 0.064516 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
da9e090f052456fd45f6f5506237319270ee1cfb | 1,069 | py | Python | orm/data_base.py | caoziyao/orm | 24121b8b10910c121a5dff19c6fd9f25ec7f425c | [
"MIT"
] | 1 | 2016-10-30T14:41:39.000Z | 2016-10-30T14:41:39.000Z | orm/data_base.py | caoziyao/orm | 24121b8b10910c121a5dff19c6fd9f25ec7f425c | [
"MIT"
] | null | null | null | orm/data_base.py | caoziyao/orm | 24121b8b10910c121a5dff19c6fd9f25ec7f425c | [
"MIT"
] | null | null | null | # coding: utf-8
"""
@author: csy
@license: (C) Copyright 2017-2018
@contact: wyzycao@gmail.com
@time: 2018/11/22
@desc:
"""
import pymysql
from sqlalchemy import create_engine, exc, inspect, text
from sqlalchemy.ext.declarative import declarative_base
from orm.connection import Connection
class Database(object):
"""
Database
"""
def __init__(self, db_url, **kwargs):
self.db_url = db_url
if not self.db_url:
raise ValueError('You must provide a db_url.')
# Create an engine.
pymysql.install_as_MySQLdb()
self._engine = create_engine(self.db_url, **kwargs)
BaseModel = declarative_base()
def close(self):
"""
close database
:return:
"""
pass
def get_connection(self):
"""
:return:
"""
return Connection(self._engine.connect())
def query(self, query):
"""
query
:param query:
:return:
"""
conn = self.get_connection()
return conn.query(query)
| 20.169811 | 59 | 0.585594 | 120 | 1,069 | 5.05 | 0.516667 | 0.049505 | 0.059406 | 0.049505 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022727 | 0.300281 | 1,069 | 52 | 60 | 20.557692 | 0.787433 | 0.190833 | 0 | 0 | 0 | 0 | 0.034806 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0.052632 | 0.210526 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
daa22a10e3b85c5aa358215cdbd70d7d7e9b7377 | 786 | py | Python | 4/4-3/test_index.py | softwaretestbook/apitest_book | 29f640363ab6ef301ea685196b43805a4ed5a3d4 | [
"Apache-2.0"
] | null | null | null | 4/4-3/test_index.py | softwaretestbook/apitest_book | 29f640363ab6ef301ea685196b43805a4ed5a3d4 | [
"Apache-2.0"
] | null | null | null | 4/4-3/test_index.py | softwaretestbook/apitest_book | 29f640363ab6ef301ea685196b43805a4ed5a3d4 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File : test_index.py
@Time : 2021/09/28 14:10:13
@Author : CrissChan
@Version : 1.0
@Site : https://blog.csdn.net/crisschan
@Desc : 主页接口
'''
from unittest import TestCase
import unittest
from unittest.main import main
import requests
class TestIndex(TestCase):
def setUp(self) -> None:
return super().setUp()
def tearDown(self) -> None:
return super().tearDown()
def test_index(self):
url = 'http://127.0.0.1:12356'
res_index = requests.get(url)
self.assertEqual(res_index.status_code,requests.codes.ok,msg="返回状态码是200")
self.assertIn('username',res_index.text,msg='response include username')
# if __name__ == '__main__':
# unittest.main()
| 24.5625 | 81 | 0.637405 | 103 | 786 | 4.728155 | 0.631068 | 0.049281 | 0.057495 | 0.078029 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.050162 | 0.21374 | 786 | 31 | 82 | 25.354839 | 0.737864 | 0.321883 | 0 | 0 | 0 | 0 | 0.122605 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.214286 | false | 0 | 0.285714 | 0.142857 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
dabdc67d7f67d1d84f3b0c3755029b9e81f0d469 | 582 | py | Python | src/OrderedStage.py | sergey-serebryakov/mpipe | 5a1804cf64271931f0cd3e4fff3e2b38291212dd | [
"MIT"
] | null | null | null | src/OrderedStage.py | sergey-serebryakov/mpipe | 5a1804cf64271931f0cd3e4fff3e2b38291212dd | [
"MIT"
] | null | null | null | src/OrderedStage.py | sergey-serebryakov/mpipe | 5a1804cf64271931f0cd3e4fff3e2b38291212dd | [
"MIT"
] | null | null | null | """Implements OrderedStage class."""
from .Stage import Stage
from .OrderedWorker import OrderedWorker
class OrderedStage(Stage):
"""A specialized :class:`~mpipe.Stage`,
internally creating :class:`~mpipe.OrderedWorker` objects."""
def __init__(self, target, size=1, disable_result=False):
"""Constructor takes a function implementing
:meth:`OrderedWorker.doTask`."""
class wclass(OrderedWorker):
def doTask(self, task):
return target(task)
super(OrderedStage, self).__init__(wclass, size, disable_result)
| 36.375 | 72 | 0.678694 | 60 | 582 | 6.416667 | 0.533333 | 0.051948 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002155 | 0.202749 | 582 | 15 | 73 | 38.8 | 0.827586 | 0.343643 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.125 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
dad9445df7e4b260a45a10454891d017658def3a | 417 | py | Python | lib/cork/backends.py | jimeggleston/wombatwiki | 5e0d7c8e6e4037de4040585b91fd5f8db7293b36 | [
"MIT"
] | null | null | null | lib/cork/backends.py | jimeggleston/wombatwiki | 5e0d7c8e6e4037de4040585b91fd5f8db7293b36 | [
"MIT"
] | null | null | null | lib/cork/backends.py | jimeggleston/wombatwiki | 5e0d7c8e6e4037de4040585b91fd5f8db7293b36 | [
"MIT"
] | null | null | null | # Cork - Authentication module for tyyhe Bottle web framework
# Copyright (C) 2013 Federico Ceratto and others, see AUTHORS file.
# Released under LGPLv3+ license, see LICENSE.txt
#
# Backends API - used to make backends available for importing
#
from json_backend import JsonBackend
from mongodb_backend import MongoDBBackend
from sqlalchemy_backend import SqlAlchemyBackend
from sqlite_backend import SQLiteBackend
| 37.909091 | 67 | 0.827338 | 54 | 417 | 6.314815 | 0.759259 | 0.152493 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013889 | 0.136691 | 417 | 10 | 68 | 41.7 | 0.933333 | 0.561151 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
daf9c059842880d542a5a00badf6026bbe5bed0e | 901 | py | Python | src/onegov/activity/matching/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/activity/matching/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/activity/matching/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from onegov.activity.matching.core import deferred_acceptance
from onegov.activity.matching.core import deferred_acceptance_from_database
from onegov.activity.matching.interfaces import MatchableBooking
from onegov.activity.matching.interfaces import MatchableOccasion
from onegov.activity.matching.score import PreferAdminChildren
from onegov.activity.matching.score import PreferGroups
from onegov.activity.matching.score import PreferInAgeBracket
from onegov.activity.matching.score import PreferMotivated
from onegov.activity.matching.score import PreferOrganiserChildren
from onegov.activity.matching.score import Scoring
__all__ = [
'deferred_acceptance',
'deferred_acceptance_from_database',
'MatchableBooking',
'MatchableOccasion',
'Scoring',
'PreferGroups',
'PreferMotivated',
'PreferInAgeBracket',
'PreferOrganiserChildren',
'PreferAdminChildren',
]
| 37.541667 | 75 | 0.824639 | 89 | 901 | 8.213483 | 0.224719 | 0.136799 | 0.246238 | 0.355677 | 0.571819 | 0.571819 | 0.153215 | 0.153215 | 0.153215 | 0 | 0 | 0 | 0.105438 | 901 | 23 | 76 | 39.173913 | 0.906948 | 0 | 0 | 0 | 0 | 0 | 0.198668 | 0.062153 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.454545 | 0 | 0.454545 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
9710c05effdef623c2a69d678143df5d4b732310 | 242 | py | Python | Python/libraries/recognizers-choice/recognizers_choice/choice/constants.py | AhmedLeithy/Recognizers-Text | f5426e38a09d3974fc0979b7803a4cd17258ea62 | [
"MIT"
] | 688 | 2019-05-08T02:56:21.000Z | 2022-03-30T07:26:15.000Z | Python/libraries/recognizers-choice/recognizers_choice/choice/constants.py | AhmedLeithy/Recognizers-Text | f5426e38a09d3974fc0979b7803a4cd17258ea62 | [
"MIT"
] | 840 | 2019-05-07T07:00:02.000Z | 2022-03-30T14:52:11.000Z | Python/libraries/recognizers-choice/recognizers_choice/choice/constants.py | AhmedLeithy/Recognizers-Text | f5426e38a09d3974fc0979b7803a4cd17258ea62 | [
"MIT"
] | 283 | 2019-05-07T07:52:12.000Z | 2022-03-27T02:27:58.000Z | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
class Constants:
SYS_BOOLEAN: str = "boolean"
SYS_BOOLEAN_TRUE: str = "boolean-true"
SYS_BOOLEAN_FALSE: str = "boolean-false"
| 30.25 | 61 | 0.702479 | 30 | 242 | 5.5 | 0.633333 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.206612 | 242 | 7 | 62 | 34.571429 | 0.859375 | 0.371901 | 0 | 0 | 0 | 0 | 0.22695 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
971d9136995da82d92f3987e0fb85559762fcc29 | 215 | py | Python | tuitse/widget.py | i3thuan5/TuiTse-TsuSin | b2e12d0565ca2a5c09af0e9f91048233724d8d6c | [
"MIT"
] | null | null | null | tuitse/widget.py | i3thuan5/TuiTse-TsuSin | b2e12d0565ca2a5c09af0e9f91048233724d8d6c | [
"MIT"
] | 4 | 2020-02-17T02:46:07.000Z | 2021-10-14T06:52:11.000Z | tuitse/widget.py | i3thuan5/TuiTse-TsuSin | b2e12d0565ca2a5c09af0e9f91048233724d8d6c | [
"MIT"
] | null | null | null | import json
from tuitse.html import tuitse_html
class KiamTsaNuaUi():
def 檢查結果(self, obj):
if not obj.檢查:
return ''
tinliat = json.loads(obj.檢查)
return tuitse_html(tinliat)
| 19.545455 | 36 | 0.618605 | 28 | 215 | 4.678571 | 0.607143 | 0.229008 | 0.167939 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.293023 | 215 | 10 | 37 | 21.5 | 0.861842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
9730533de3f0de6931d99c4b0e666601660c28ee | 11,625 | py | Python | mare/evaluation/evaluation_strategies.py | MSLars/mare | a1cd3c231b9262d6597ab81ae23068ae64982c38 | [
"MIT"
] | null | null | null | mare/evaluation/evaluation_strategies.py | MSLars/mare | a1cd3c231b9262d6597ab81ae23068ae64982c38 | [
"MIT"
] | null | null | null | mare/evaluation/evaluation_strategies.py | MSLars/mare | a1cd3c231b9262d6597ab81ae23068ae64982c38 | [
"MIT"
] | 1 | 2021-12-04T00:00:52.000Z | 2021-12-04T00:00:52.000Z | # JSON Structure:
#
# {
# "relations": [
# {
# "name": name,
# "ents": [
# {
# "name": role,
# "start": start,
# "end": end
# "mandatory": true (optional, just for gold)
# }
# ]
# }
# ]
# }
import copy
from mare.defs import relation_mandatory_args
NO_MATCH = "NO_MATCH"
def sort_entities_of_rel(relation):
return {"name": relation["name"], "ents": sort_entities(relation["ents"])}
def sort_entities(ents):
return sorted(ents, key=lambda x: x["start"])
def sort_relations(rels):
return sorted(rels, key=lambda x: x["name"])
def reduce_to_mandatory_arguments(relation):
return {"name": relation["name"],
"ents": sort_entities(
[ele for ele in relation["ents"] if
ele["name"] in relation_mandatory_args[relation["name"]]])}
def reduce_relations_to_mandatory_arguments(relations):
rels_reduced = []
for rel in relations:
rel_reduced = reduce_to_mandatory_arguments(rel)
rels_reduced.append(rel_reduced)
return rels_reduced
def copy_dict(source):
return copy.deepcopy(source)
def named_entity_recognition(gold, prediction):
gold_copy = copy_dict(gold)
pred_copy = copy_dict(prediction)
gold_ner = []
pred_ner = []
gold_ents = [ent for rel in gold_copy["relations"] for ent in rel["ents"]]
pred_ents = [ent for rel in pred_copy["relations"] for ent in rel["ents"]]
for pred_ent in pred_ents:
if pred_ent in gold_ents:
pred_ner.append(pred_ent["name"])
gold_ner.append(pred_ent["name"])
gold_ents.remove(pred_ent)
else:
pred_ner.append(pred_ent["name"])
gold_ner.append(NO_MATCH)
for gold_ent in gold_ents:
pred_ner.append(NO_MATCH)
gold_ner.append(gold_ent["name"])
return pred_ner, gold_ner
def named_entity_recognition_v2(gold, prediction):
gold_copy = copy_dict(gold)
pred_copy = copy_dict(prediction)
gold_ner = []
pred_ner = []
def extract_ents(relations):
ents = []
for rel in relations:
for ent in rel["ents"]:
ent["name"] = f"{rel['name']}-{ent['name']}"
ents.append(ent)
return ents
gold_ents = extract_ents(gold_copy["relations"])
pred_ents = extract_ents(pred_copy["relations"])
for pred_ent in pred_ents:
if pred_ent in gold_ents:
pred_ner.append(pred_ent["name"])
gold_ner.append(pred_ent["name"])
gold_ents.remove(pred_ent)
else:
pred_ner.append(pred_ent["name"])
gold_ner.append(NO_MATCH)
for gold_ent in gold_ents:
pred_ner.append(NO_MATCH)
gold_ner.append(gold_ent["name"])
return pred_ner, gold_ner
def named_entity_recognition_v2_no_trigger(gold, prediction):
gold_copy = copy_dict(gold)
pred_copy = copy_dict(prediction)
gold_ner = []
pred_ner = []
def extract_ents(relations):
ents = []
for rel in relations:
for ent in rel["ents"]:
if ent["name"].lower() != "trigger":
ent["name"] = f"{rel['name']}-{ent['name']}"
ents.append(ent)
return ents
gold_ents = extract_ents(gold_copy["relations"])
pred_ents = extract_ents(pred_copy["relations"])
for pred_ent in pred_ents:
if pred_ent in gold_ents:
pred_ner.append(pred_ent["name"])
gold_ner.append(pred_ent["name"])
gold_ents.remove(pred_ent)
else:
pred_ner.append(pred_ent["name"])
gold_ner.append(NO_MATCH)
for gold_ent in gold_ents:
pred_ner.append(NO_MATCH)
gold_ner.append(gold_ent["name"])
return pred_ner, gold_ner
def only_relation_classification(gold, prediction):
"""
Returns prediction_rel, gold_rel
"""
gold_rel_names = [rel["name"] for rel in gold["relations"]]
prediction_rel_names = [rel["name"] for rel in prediction["relations"]]
prediction_relations = []
gold_relations = []
for pred in prediction_rel_names:
if pred in gold_rel_names:
prediction_relations.append(pred)
gold_relations.append(pred)
gold_rel_names.remove(pred)
else:
prediction_relations.append(pred)
gold_relations.append(NO_MATCH)
for gold_rel in gold_rel_names:
prediction_relations.append(NO_MATCH)
gold_relations.append(gold_rel)
return prediction_relations, gold_relations
def respect_only_mandatory_args(gold, prediction):
gold_copy = copy_dict(gold)
prediction_copy = copy_dict(prediction)
prediction_relations = []
gold_relations = []
gold_rels_reduced = []
for gold_rel in gold_copy["relations"]:
gold_rel_reduced = reduce_to_mandatory_arguments(gold_rel)
gold_rels_reduced.append(gold_rel_reduced)
for pred in prediction_copy["relations"]:
pred_reduced = reduce_to_mandatory_arguments(pred)
if pred_reduced in gold_rels_reduced:
prediction_relations.append(pred_reduced["name"])
gold_relations.append(pred_reduced["name"])
gold_rels_reduced.remove(pred_reduced)
else:
prediction_relations.append(pred_reduced["name"])
gold_relations.append(NO_MATCH)
for gold_rel in gold_rels_reduced:
prediction_relations.append(NO_MATCH)
gold_relations.append(gold_rel["name"])
return prediction_relations, gold_relations
def filter_role(rel, role="trigger"):
new_rel = {"name": rel["name"]}
new_ents = []
for ent in rel["ents"]:
if ent["name"].lower() != role:
new_ent = {"name": ent["name"],
"start": ent["start"],
"end": ent["end"]
}
new_ents.append(new_ent)
new_rel["ents"] = new_ents
return new_rel
def respect_only_mandatory_args_no_trigger(gold, prediction):
gold_copy = copy_dict(gold)
prediction_copy = copy_dict(prediction)
prediction_relations = []
gold_relations = []
gold_rels_reduced = []
for gold_rel in gold_copy["relations"]:
gold_rel_reduced = filter_role(reduce_to_mandatory_arguments(gold_rel))
gold_rels_reduced.append(gold_rel_reduced)
for pred in prediction_copy["relations"]:
pred_reduced = filter_role(reduce_to_mandatory_arguments(pred))
if pred_reduced in gold_rels_reduced:
prediction_relations.append(pred_reduced["name"])
gold_relations.append(pred_reduced["name"])
gold_rels_reduced.remove(pred_reduced)
else:
prediction_relations.append(pred_reduced["name"])
gold_relations.append(NO_MATCH)
for gold_rel in gold_rels_reduced:
prediction_relations.append(NO_MATCH)
gold_relations.append(gold_rel["name"])
return prediction_relations, gold_relations
def spert_only_two_mandatory_args(gold, prediction):
gold_copy = copy_dict(gold)
prediction_copy = copy_dict(prediction)
prediction_relations = []
gold_relations = []
gold_rels_tmp = []
for gold_rel in gold_copy["relations"]:
gold_rel_reduced = reduce_to_mandatory_arguments(gold_rel)
gold_rels_tmp.append(gold_rel_reduced)
if sum([len(rel["ents"]) != 2 for rel in gold_rels_tmp]) > 0:
return [], []
gold_rels_reduced = [rel for rel in gold_rels_tmp if len(rel["ents"]) == 2]
#gold_rels_reduced = gold_rels_tmp
for pred in prediction_copy["relations"]:
pred_reduced = reduce_to_mandatory_arguments(pred)
if pred_reduced in gold_rels_reduced:
prediction_relations.append(pred_reduced["name"])
gold_relations.append(pred_reduced["name"])
gold_rels_reduced.remove(pred_reduced)
else:
prediction_relations.append(pred_reduced["name"])
gold_relations.append(NO_MATCH)
for gold_rel in gold_rels_reduced:
prediction_relations.append(NO_MATCH)
gold_relations.append(gold_rel["name"])
return prediction_relations, gold_relations
def spert_only_two_mandatory_args_v2(gold, prediction):
union = set()
def to_tuples(rels):
result = []
for rel in rels:
rel = reduce_to_mandatory_arguments(rel)
#attrs = tuple([tuple(ent.values()) for ent in sort_entities(rel["ents"])])
attrs = tuple([tuple(ent.values()) for ent in rel["ents"]])
result += [(rel["name"], attrs)]
return result
gold_tuples = to_tuples(copy_dict(gold["relations"]))
pred_tuples = to_tuples(copy_dict(prediction["relations"]))
union.update(gold_tuples)
union.update(pred_tuples)
gt_flat = []
pred_flat = []
for s in union:
if s in gold_tuples:
gt_flat.append(s[0])
else:
gt_flat.append(NO_MATCH)
if s in pred_tuples:
pred_flat.append(s[0])
else:
pred_flat.append(NO_MATCH)
return pred_flat, gt_flat
def all_args_mandatory(gold, prediction):
gold_copy = copy_dict(gold)
prediction_copy = copy_dict(prediction)
prediction_relations = []
gold_relations = []
gold_rels_sorted = []
for gold_rel in gold_copy["relations"]:
gold_rel_sorted = sort_entities_of_rel(gold_rel)
gold_rels_sorted.append(gold_rel_sorted)
for pred in prediction_copy["relations"]:
pred_sorted = sort_entities_of_rel(pred)
if pred_sorted in gold_rels_sorted:
prediction_relations.append(pred_sorted["name"])
gold_relations.append(pred_sorted["name"])
gold_rels_sorted.remove(pred_sorted)
else:
prediction_relations.append(pred_sorted["name"])
gold_relations.append(NO_MATCH)
for gold_rel in gold_rels_sorted:
prediction_relations.append(NO_MATCH)
gold_relations.append(gold_rel["name"])
return prediction_relations, gold_relations
if __name__ == "__main__":
gold = {
"relations": [
{
"name": "Obstruction",
"ents": [
{
"name": "location",
"start": 0,
"end": 0
},
{
"name": "trigger",
"start": 5,
"end": 5
},
{
"name": "something_different",
"start": 10,
"end": 5
}
]
}
]
}
prediction = {
"relations": [
{
"name": "Obstruction",
"ents": [
{
"name": "location",
"start": 0,
"end": 0
},
{
"name": "trigger",
"start": 5,
"end": 5
},
{
"name": "something_different",
"start": 10,
"end": 5
}
]
}
]
}
respect_only_mandatory_args(gold, prediction) | 29.135338 | 87 | 0.584946 | 1,340 | 11,625 | 4.745522 | 0.068657 | 0.034125 | 0.036798 | 0.050322 | 0.767416 | 0.731247 | 0.702626 | 0.658751 | 0.634219 | 0.60434 | 0 | 0.002748 | 0.311398 | 11,625 | 399 | 88 | 29.135338 | 0.79163 | 0.040258 | 0 | 0.602076 | 0 | 0 | 0.062837 | 0.004854 | 0 | 0 | 0 | 0 | 0 | 1 | 0.065744 | false | 0 | 0.00692 | 0.017301 | 0.141869 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.