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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11cb0485cd62599e53fadc0765d44e908fa5be0f | 729 | py | Python | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/util/url.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 3 | 2021-12-15T04:58:18.000Z | 2022-02-06T12:15:37.000Z | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/util/url.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | null | null | null | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/util/url.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 1 | 2019-01-02T14:38:50.000Z | 2019-01-02T14:38:50.000Z | """
Utility functions related to urls.
"""
import sys
from importlib import import_module, reload
from django.conf import settings
from django.urls import set_urlconf
def reload_django_url_config():
"""
Reloads Django's URL config.
This is useful, for example, when a test enables new URLs
with a django setting and the URL config needs to be refreshed.
"""
urlconf = settings.ROOT_URLCONF
if urlconf and urlconf in sys.modules:
reload(sys.modules[urlconf])
reloaded = import_module(urlconf)
reloaded_urls = reloaded.urlpatterns
set_urlconf(tuple(reloaded_urls))
def strip_port_from_host(host):
"""
Strips port number from host
"""
return host.split(':')[0]
| 22.78125 | 67 | 0.710562 | 100 | 729 | 5.05 | 0.53 | 0.053465 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001733 | 0.208505 | 729 | 31 | 68 | 23.516129 | 0.873484 | 0.293553 | 0 | 0 | 0 | 0 | 0.002132 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.384615 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
11ccd9a651b819f1fc57ce1eafed784fe72727c6 | 517 | py | Python | programs/signals.py | michael-xander/communique-webapp | 85b450d7f6d0313c5e5ef53a262a850b7e93c3d6 | [
"MIT"
] | null | null | null | programs/signals.py | michael-xander/communique-webapp | 85b450d7f6d0313c5e5ef53a262a850b7e93c3d6 | [
"MIT"
] | null | null | null | programs/signals.py | michael-xander/communique-webapp | 85b450d7f6d0313c5e5ef53a262a850b7e93c3d6 | [
"MIT"
] | null | null | null | from django.db.models.signals import post_save
from django.dispatch import receiver
from communique.utils.utils_signals import generate_notifications
from user.models import NotificationRegistration
from .models import Program
@receiver(post_save, sender=Program)
def post_program_save_callback(sender, **kwargs):
"""
Creates notifications for all users registered for these kind of notifications when a program is added/updated
"""
generate_notifications(NotificationRegistration.PROGRAMS, kwargs) | 36.928571 | 114 | 0.820116 | 64 | 517 | 6.5 | 0.546875 | 0.048077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121857 | 517 | 14 | 115 | 36.928571 | 0.9163 | 0.212766 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.625 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
11cd4ac47dd80be1874f5d5024dca04ec9d019ce | 4,947 | py | Python | tests/base/channels/test_channel.py | DHaspel/cavsim | a23e344b47b970e1a90e04c071e06860935d1694 | [
"Apache-2.0"
] | null | null | null | tests/base/channels/test_channel.py | DHaspel/cavsim | a23e344b47b970e1a90e04c071e06860935d1694 | [
"Apache-2.0"
] | null | null | null | tests/base/channels/test_channel.py | DHaspel/cavsim | a23e344b47b970e1a90e04c071e06860935d1694 | [
"Apache-2.0"
] | null | null | null | from unittest import TestCase
from cavsim.base.channels.base_channel import BaseChannel as Channel
from cavsim.measure import Measure
class TestChannel(TestCase):
def test___init__(self):
# Invalid tests
with self.assertRaises(TypeError):
Channel(123, False)
with self.assertRaises(TypeError):
Channel(Measure.pressureLast, 'abc')
with self.assertRaises(TypeError):
Channel(Measure.pressureLast, False, 'abc')
# Valid tests
c = Channel(Measure.pressureLast, False)
self.assertEqual(Measure.pressureLast, c._measure)
self.assertEqual(False, c._is_import)
self.assertEqual(None, c._connection)
self.assertEqual(False, c._optional)
c = Channel(Measure.pressureCurrent, True, True)
self.assertEqual(Measure.pressureCurrent, c._measure)
self.assertEqual(True, c._is_import)
self.assertEqual(None, c._connection)
self.assertEqual(True, c._optional)
def test_measure(self):
c = Channel(Measure.pressureLast, False)
self.assertEqual(Measure.pressureLast, c.measure)
c._measure = Measure.velocityPlusLast
self.assertEqual(Measure.velocityPlusLast, c.measure)
with self.assertRaises(AttributeError):
c.measure = Measure.pressureCurrent
def test_connected(self):
c = Channel(Measure.pressureLast, False)
self.assertEqual(False, c.connected)
c._connection = c
self.assertEqual(True, c.connected)
with self.assertRaises(AttributeError):
c.connected = False
def test_optional(self):
c = Channel(Measure.pressureLast, False)
self.assertEqual(False, c.optional)
c._optional = True
self.assertEqual(True, c.optional)
with self.assertRaises(AttributeError):
c.optional = False
def test_is_import(self):
c = Channel(Measure.pressureLast, False)
self.assertEqual(False, c.is_import)
c._is_import = True
self.assertEqual(True, c.is_import)
with self.assertRaises(AttributeError):
c.is_import = False
def test_is_export(self):
c = Channel(Measure.pressureLast, False)
self.assertEqual(True, c.is_export)
c._is_import = True
self.assertEqual(False, c.is_export)
with self.assertRaises(AttributeError):
c.is_export = False
def test_connectable(self):
# Invalid tests
c = Channel(Measure.pressureLast, False)
with self.assertRaises(TypeError):
c.connectable(123)
# Valid tests
c = Channel(Measure.pressureLast, False)
c2 = Channel(Measure.pressureCurrent, True)
self.assertEqual(False, c.connectable(c2))
c = Channel(Measure.pressureLast, False)
c2 = Channel(Measure.pressureLast, False)
self.assertEqual(False, c.connectable(c2))
c = Channel(Measure.pressureLast, False)
c2 = Channel(Measure.pressureLast, True)
self.assertEqual(True, c.connectable(c2))
c = Channel(Measure.pressureLast, False)
c2 = Channel(Measure.pressureLast, True)
c._connection = c2
self.assertEqual(False, c.connectable(c2))
c._connection = None
c2._connection = c
self.assertEqual(False, c.connectable(c2))
c._connection = c2
self.assertEqual(False, c.connectable(c2))
def test_connect(self):
# Invalid tests
c = Channel(Measure.pressureLast, False)
with self.assertRaises(TypeError):
c.connect(123)
# Valid tests
with self.assertRaises(TypeError):
c = Channel(Measure.pressureLast, False)
c2 = Channel(Measure.pressureCurrent, True)
c.connect(c2)
with self.assertRaises(TypeError):
c = Channel(Measure.pressureLast, False)
c2 = Channel(Measure.pressureLast, False)
c.connect(c2)
c = Channel(Measure.pressureLast, False)
c2 = Channel(Measure.pressureLast, True)
c._connection = c2
with self.assertRaises(AssertionError):
c.connect(c2)
c._connection = None
c2._connection = c
with self.assertRaises(AssertionError):
c.connect(c2)
c._connection = c2
with self.assertRaises(AssertionError):
c.connect(c2)
c = Channel(Measure.pressureLast, False)
c2 = Channel(Measure.pressureLast, True)
c.connect(c2)
self.assertEqual(c2, c._connection)
self.assertEqual(c, c2._connection)
def test_disconnect(self):
c = Channel(Measure.pressureLast, False)
c2 = Channel(Measure.pressureLast, False)
c._connection = c2
c2._connection = c
c.disconnect()
self.assertEqual(None, c._connection)
self.assertEqual(None, c2._connection)
| 37.195489 | 68 | 0.638771 | 528 | 4,947 | 5.88447 | 0.083333 | 0.130673 | 0.217573 | 0.209527 | 0.754747 | 0.679112 | 0.608948 | 0.54168 | 0.509495 | 0.466044 | 0 | 0.011273 | 0.264807 | 4,947 | 132 | 69 | 37.477273 | 0.843002 | 0.015565 | 0 | 0.582609 | 0 | 0 | 0.001234 | 0 | 0 | 0 | 0 | 0 | 0.373913 | 1 | 0.078261 | false | 0 | 0.095652 | 0 | 0.182609 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
11d4cd5f5c0f6b1acb6f517a8275c3bf6e006622 | 2,130 | py | Python | testing/test_block.py | eberharf/cfl | 077b99a05824f1371ac47d76dfed6bb160222668 | [
"BSD-3-Clause"
] | 6 | 2021-01-09T04:46:55.000Z | 2022-03-19T22:27:13.000Z | testing/test_block.py | eberharf/cfl | 077b99a05824f1371ac47d76dfed6bb160222668 | [
"BSD-3-Clause"
] | 12 | 2021-01-11T16:32:58.000Z | 2022-03-19T13:21:30.000Z | testing/test_block.py | eberharf/cfl | 077b99a05824f1371ac47d76dfed6bb160222668 | [
"BSD-3-Clause"
] | null | null | null | import pytest
from cfl.block import Block
# fake Block class for testing
class BabyBlock(Block):
def __init__(self, data_info, params):
super().__init__(data_info=data_info, params=params)
self.name = 'bb'
# functions that need to be instantiated but don't do anythin
def load_block(self, path):
pass
def save_block(self, path):
pass
def train(self, dataset, prev_results=None):
pass
def predict(self, dataset, prev_results=None):
pass
# the moneymaker - this is the thing we care about here
def _get_default_params(self):
default_params = {'param1' : 4,
'lr' : 1.0003,
'Drake' : False,
'hello' : 'hi'}
return default_params
def test_check_model_params():
'''make sure that unneeded params are successfully removed and needed
params are added, and that the input parameter values are used instead
of the defaults'''
# make a Block to test parameter checks
data_info = {'X_dims' : (100,10),
'Y_dims' : (100,2),
'Y_type' : 'categorical'}
params = { 'param1' : 10,
'chicken' : 'sandwich'}
bb = BabyBlock(data_info=data_info, params=params)
# check that 'param1' is overriden by input
assert bb.params['param1'] == 10, "'param1' value should be equal to value in input but instead is {}".format(bb.params['param1'])
# check that 'chicken' is removed
# UPDATE: we stopped pruning because Clusterers don't know what params they
# need - it depends on what kind of model is specified.
# assert 'chicken' not in bb.params.keys(), "'chicken' should no longer be in bb.params.keys()."
# check that 'lr', 'Drake', and 'hello' are added
assert 'lr' in bb.params.keys(), "Necessary param addition unsuccessful for 'lr'"
assert 'Drake' in bb.params.keys(), "Necessary param addition unsuccessful for 'Drake'"
assert 'hello' in bb.params.keys(), "Necessary param addition unsuccessful for 'hello'" | 38.035714 | 135 | 0.620188 | 278 | 2,130 | 4.647482 | 0.435252 | 0.043344 | 0.0387 | 0.05418 | 0.239164 | 0.208204 | 0.118421 | 0.118421 | 0.118421 | 0 | 0 | 0.016287 | 0.279343 | 2,130 | 56 | 136 | 38.035714 | 0.825407 | 0.323005 | 0 | 0.129032 | 0 | 0 | 0.215493 | 0 | 0 | 0 | 0 | 0 | 0.129032 | 1 | 0.225806 | false | 0.129032 | 0.064516 | 0 | 0.354839 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
11d8237ea5c0217a8705bf23c95f85b54b207529 | 77 | py | Python | config_vars.py | EPFL-LAP/fpl20-placement | 87b0fdc2252f0dca53dcd13801987e305d6c2619 | [
"MIT"
] | 3 | 2020-12-29T07:14:31.000Z | 2021-09-24T06:38:02.000Z | config_vars.py | stefannikolicns/fpl20-placement | 2175f6a4756c975c929278fe4180bec2e046a300 | [
"MIT"
] | null | null | null | config_vars.py | stefannikolicns/fpl20-placement | 2175f6a4756c975c929278fe4180bec2e046a300 | [
"MIT"
] | 1 | 2021-03-29T23:00:21.000Z | 2021-03-29T23:00:21.000Z | N = 10
I = 60
CROSSBAR_FEEDBACK_DELAY = 75e-12
CROSSBAR_INPUT_DELAY = 95e-12
| 15.4 | 32 | 0.766234 | 14 | 77 | 3.928571 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.184615 | 0.155844 | 77 | 4 | 33 | 19.25 | 0.661538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
11dcb7f792e6a6262ca0e365a04fce50fe48ad00 | 3,839 | py | Python | lib/kb_emirge/kb_emirgeClient.py | kbaseapps/kb_emirge | 6bc6bc71e0e17e6dcecb0376fb31123c9144d1cf | [
"MIT"
] | null | null | null | lib/kb_emirge/kb_emirgeClient.py | kbaseapps/kb_emirge | 6bc6bc71e0e17e6dcecb0376fb31123c9144d1cf | [
"MIT"
] | null | null | null | lib/kb_emirge/kb_emirgeClient.py | kbaseapps/kb_emirge | 6bc6bc71e0e17e6dcecb0376fb31123c9144d1cf | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
############################################################
#
# Autogenerated by the KBase type compiler -
# any changes made here will be overwritten
#
############################################################
from __future__ import print_function
# the following is a hack to get the baseclient to import whether we're in a
# package or not. This makes pep8 unhappy hence the annotations.
try:
# baseclient and this client are in a package
from .baseclient import BaseClient as _BaseClient # @UnusedImport
except:
# no they aren't
from baseclient import BaseClient as _BaseClient # @Reimport
class kb_emirge(object):
def __init__(
self, url=None, timeout=30 * 60, user_id=None,
password=None, token=None, ignore_authrc=False,
trust_all_ssl_certificates=False,
auth_svc='https://kbase.us/services/authorization/Sessions/Login'):
if url is None:
raise ValueError('A url is required')
self._service_ver = None
self._client = _BaseClient(
url, timeout=timeout, user_id=user_id, password=password,
token=token, ignore_authrc=ignore_authrc,
trust_all_ssl_certificates=trust_all_ssl_certificates,
auth_svc=auth_svc)
def run_emirge(self, input_params, context=None):
"""
:param input_params: instance of type "run_emirge_Input"
(run_emirge() ** ** to backend a KBase App, potentially operating
on ReadSets) -> structure: parameter "input_ws" of type
"workspace_name" (** Common types), parameter "input_reads_ref" of
type "data_obj_ref", parameter "output_ws" of type
"workspace_name" (** Common types), parameter "output_reads_name"
of type "data_obj_name"
:returns: instance of type "run_emirge_Output" -> structure:
parameter "report_name" of String, parameter "report_ref" of String
"""
return self._client.call_method(
'kb_emirge.run_emirge',
[input_params], self._service_ver, context)
def exec_emirge(self, input_params, context=None):
"""
:param input_params: instance of type "exec_emirge_Input"
(exec_emirge() ** ** the local method that runs EMIRGE on each
read library) -> structure: parameter "input_reads_ref" of type
"data_obj_ref", parameter "output_ws" of type "workspace_name" (**
Common types), parameter "output_reads_name" of type
"data_obj_name"
:returns: instance of type "exec_emirge_Output" -> structure:
parameter "output_sequences_ref" of type "data_obj_ref", parameter
"report" of String
"""
return self._client.call_method(
'kb_emirge.exec_emirge',
[input_params], self._service_ver, context)
def exec_emirge_SingleLibrary(self, input_params, context=None):
"""
:param input_params: instance of type "exec_emirge_Input"
(exec_emirge() ** ** the local method that runs EMIRGE on each
read library) -> structure: parameter "input_reads_ref" of type
"data_obj_ref", parameter "output_ws" of type "workspace_name" (**
Common types), parameter "output_reads_name" of type
"data_obj_name"
:returns: instance of type "exec_emirge_Output" -> structure:
parameter "output_sequences_ref" of type "data_obj_ref", parameter
"report" of String
"""
return self._client.call_method(
'kb_emirge.exec_emirge_SingleLibrary',
[input_params], self._service_ver, context)
def status(self, context=None):
return self._client.call_method('kb_emirge.status',
[], self._service_ver, context)
| 44.126437 | 79 | 0.632717 | 458 | 3,839 | 5.024017 | 0.286026 | 0.046936 | 0.034767 | 0.045198 | 0.601478 | 0.593655 | 0.557149 | 0.527162 | 0.513255 | 0.495002 | 0 | 0.002085 | 0.250326 | 3,839 | 86 | 80 | 44.639535 | 0.797429 | 0.480594 | 0 | 0.176471 | 1 | 0 | 0.101748 | 0.034956 | 0 | 0 | 0 | 0 | 0 | 1 | 0.147059 | false | 0.058824 | 0.088235 | 0.029412 | 0.382353 | 0.029412 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
11e1d94d8bb07397a346832506e980fb85edd72c | 302 | py | Python | hw_asr/model/__init__.py | kostyayatsok/asr_project_template | ee5fb8006fa4e4f5d4a2e5c6e9f6352c22ad5bbb | [
"MIT"
] | null | null | null | hw_asr/model/__init__.py | kostyayatsok/asr_project_template | ee5fb8006fa4e4f5d4a2e5c6e9f6352c22ad5bbb | [
"MIT"
] | null | null | null | hw_asr/model/__init__.py | kostyayatsok/asr_project_template | ee5fb8006fa4e4f5d4a2e5c6e9f6352c22ad5bbb | [
"MIT"
] | null | null | null | from hw_asr.model.baseline_model import BaselineModel
from hw_asr.model.gru_model import GRUModel
from hw_asr.model.jasper_model import JasperModel
from hw_asr.model.deepspeech2_model import DeepSpeech2Model
__all__ = [
"BaselineModel",
"GRUModel",
"JasperModel",
"DeepSpeech2Model"
]
| 25.166667 | 59 | 0.791391 | 37 | 302 | 6.135135 | 0.378378 | 0.105727 | 0.15859 | 0.246696 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011494 | 0.135762 | 302 | 11 | 60 | 27.454545 | 0.858238 | 0 | 0 | 0 | 0 | 0 | 0.15894 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 | 0 | 0 | 0 | 2 |
11e35234c41c3b351e68440d97668080b7a115b9 | 273 | py | Python | core_get/configuration/environment_settings.py | core-get/core-get | 8fb960e4e51d0d46b5e3b2f4832eb4a39e0e60f7 | [
"MIT"
] | null | null | null | core_get/configuration/environment_settings.py | core-get/core-get | 8fb960e4e51d0d46b5e3b2f4832eb4a39e0e60f7 | [
"MIT"
] | null | null | null | core_get/configuration/environment_settings.py | core-get/core-get | 8fb960e4e51d0d46b5e3b2f4832eb4a39e0e60f7 | [
"MIT"
] | null | null | null | from dataclasses import dataclass
from pathlib import PurePath
from typing import Optional
@dataclass(frozen=True)
class EnvironmentSettings:
working_dir: PurePath
project_dir: Optional[PurePath]
app_dir: PurePath
cache_dir: PurePath
catalog_url: str
| 21 | 35 | 0.783883 | 33 | 273 | 6.333333 | 0.606061 | 0.157895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172161 | 273 | 12 | 36 | 22.75 | 0.924779 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.3 | 0 | 0.9 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
11eb2c4b0e299910811b568a1822f17268b1d75c | 2,673 | py | Python | healthtools_ec/models/user.py | CodeForAfrica/healthtools-ezolwaluko | 21fac3c05e15c0b1492bb4f9004bc0d9e1d8392b | [
"Apache-2.0"
] | null | null | null | healthtools_ec/models/user.py | CodeForAfrica/healthtools-ezolwaluko | 21fac3c05e15c0b1492bb4f9004bc0d9e1d8392b | [
"Apache-2.0"
] | 1 | 2022-03-22T07:30:29.000Z | 2022-03-22T07:30:29.000Z | healthtools_ec/models/user.py | CodeForAfrica/healthtools-ezolwaluko | 21fac3c05e15c0b1492bb4f9004bc0d9e1d8392b | [
"Apache-2.0"
] | 1 | 2018-11-24T20:47:56.000Z | 2018-11-24T20:47:56.000Z | from flask_security import RoleMixin, Security, SQLAlchemyUserDatastore, UserMixin
from sqlalchemy import Boolean, Column, DateTime, Integer, String, func
from wtforms import PasswordField
from wtforms.fields import EmailField
from wtforms.validators import InputRequired
from ..app import app, db
from ..forms import Form
class User(db.Model, UserMixin):
"""
A user who can login and use Gibela.
"""
__tablename__ = "users"
id = Column(Integer, primary_key=True)
email = Column(String(50), index=True, nullable=False, unique=True)
password = Column(String(100), default="")
disabled = Column(Boolean, default=False)
created_at = Column(
DateTime(timezone=True),
index=True,
unique=False,
nullable=False,
server_default=func.now(),
)
updated_at = Column(
DateTime(timezone=True),
server_default=func.now(),
onupdate=func.current_timestamp(),
)
# associations
roles = db.relationship(
"Role", secondary="roles_users", backref=db.backref("users", lazy="dynamic")
)
def __repr__(self):
return "<User phone=%s>" % (self.phone,)
# Flask-Security requires an active attribute
@property
def active(self):
return not self.disabled
@active.setter
def active(self, value):
self.disabled = not value
@classmethod
def create_defaults(self):
from flask_security.utils import encrypt_password
admin_user = User()
admin_user.admin = True
admin_user.email = "matthew@opendata.durban"
admin_user.password = encrypt_password("admin")
return [admin_user]
class Role(db.Model, RoleMixin):
"""
A user who can login and use Gibela.
"""
__tablename__ = "roles"
id = db.Column(db.Integer(), primary_key=True)
name = db.Column(db.String(80), unique=True)
description = db.Column(db.String(255))
def __str__(self):
return self.name
@classmethod
def create_defaults(self):
return [
Role(name="admin", description="user can access admin panel"),
]
roles_users = db.Table(
"roles_users",
db.Column("user_id", db.Integer(), db.ForeignKey("users.id", ondelete="CASCADE")),
db.Column("role_id", db.Integer(), db.ForeignKey("roles.id", ondelete="CASCADE")),
)
class LoginForm(Form):
email = EmailField("Email", validators=[InputRequired()])
password = PasswordField("Password", validators=[InputRequired()])
# user authentication
user_datastore = SQLAlchemyUserDatastore(db, User, Role)
security = Security(app, user_datastore, login_form=LoginForm)
| 26.73 | 86 | 0.664796 | 309 | 2,673 | 5.614887 | 0.33657 | 0.025937 | 0.017291 | 0.01268 | 0.138329 | 0.042651 | 0.042651 | 0.042651 | 0.042651 | 0 | 0 | 0.004778 | 0.216985 | 2,673 | 99 | 87 | 27 | 0.824176 | 0.056491 | 0 | 0.121212 | 0 | 0 | 0.072318 | 0.009241 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0.075758 | 0.121212 | 0.060606 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
f50379671bb04ee79c8a9513109a69b9ef7c6c35 | 3,012 | py | Python | ifcb/tests/data/fileset_info.py | GobySoft/pyifcb | f465329e720c826069cdd02b55e35d780f24a3d5 | [
"MIT"
] | 5 | 2018-08-12T02:04:44.000Z | 2021-03-19T02:21:31.000Z | ifcb/tests/data/fileset_info.py | GobySoft/pyifcb | f465329e720c826069cdd02b55e35d780f24a3d5 | [
"MIT"
] | 46 | 2016-09-14T21:12:52.000Z | 2022-02-14T20:33:49.000Z | ifcb/tests/data/fileset_info.py | GobySoft/pyifcb | f465329e720c826069cdd02b55e35d780f24a3d5 | [
"MIT"
] | 3 | 2018-10-18T16:03:08.000Z | 2021-07-28T14:45:06.000Z | import os
import sys
import numpy as np
from ifcb import DataDirectory
TEST_DATA_DIR=os.path.join('ifcb','tests','data','test_data')
WHITELIST = ['data','white']
TEST_FILES = {
'D20130526T095207_IFCB013': {
'n_rois': 19,
'n_targets': 118,
'roi_numbers': [7, 11, 13, 21, 32, 33, 47, 49, 54, 61, 66, 68, 73, 78, 80, 92, 99, 102, 114],
'roi_number': 99,
'roi_shape': (34, 64),
'roi_slice_coords': [slice(0,5), slice(0,5)],
'roi_slice': np.array([[172, 168, 172, 166, 171],
[168, 170, 172, 171, 170],
[167, 174, 171, 175, 168],
[173, 171, 173, 170, 171],
[176, 169, 176, 173, 172]], dtype=np.uint8),
'sizes': {
'roi': 98472,
'hdr': 2885,
'adc': 19395
},
'headers': {
'KloehnPort': 'COM3',
'laserMotorSmallStep_ms': 1000,
'blobXgrowAmount': 20
}
},
'IFCB5_2012_028_081515': {
'n_rois': 6,
'n_targets': 7,
'roi_numbers': [1, 2, 3, 4, 5, 6],
'roi_number': 1,
'roi_shape': (45, 96),
'roi_slice_coords': [slice(0,5), slice(0,5)],
'roi_slice': np.array([[208, 207, 206, 206, 207],
[206, 206, 206, 207, 206],
[206, 207, 205, 206, 208],
[208, 208, 208, 208, 209],
[206, 206, 205, 207, 207]], dtype=np.uint8),
'stitched_roi_number': 3,
'roi_numbers_stitched': [1, 2, 3, 5, 6],
'stitched_roi_shape': (86, 263),
'stitched_roi_coords': [slice(23,27), slice(177,183)],
'stitched_roi_slice': np.array([[205, 204, 205, 0, 0, 0],
[202, 203, 206, 0, 0, 0],
[205, 206, 205, 204, 202, 202],
[204, 202, 205, 203, 202, 204]], dtype=np.uint8),
'stitched_corners': {1: [208, 204, 205, 205],
2: [205, 199, 203, 197],
3: [210, 203, 207, 203],
5: [210, 209, 212, 209],
6: [212, 206, 209, 208]},
'sizes': {
'roi': 71083,
'hdr': 301,
'adc': 1004
},
'headers': {
'binarizeThreshold': 30,
'fluorescencePhotomultiplierSetting': 0.6,
}
}
}
def data_dir():
for p in sys.path:
fp = os.path.join(p, TEST_DATA_DIR)
if os.path.exists(fp):
return fp
raise KeyError('cannot find %s on sys.path' % TEST_DATA_DIR)
def _dd():
return DataDirectory(data_dir(), whitelist=WHITELIST)
def get_fileset_bin(lid):
return _dd()[lid]
def list_test_bins():
return list(_dd())
def list_test_filesets():
return [b.fileset for b in list_test_bins()]
| 33.098901 | 101 | 0.448207 | 354 | 3,012 | 3.663842 | 0.40113 | 0.026985 | 0.021588 | 0.034695 | 0.087124 | 0.066307 | 0.066307 | 0.066307 | 0.066307 | 0.066307 | 0 | 0.241189 | 0.397078 | 3,012 | 90 | 102 | 33.466667 | 0.473018 | 0 | 0 | 0.075 | 0 | 0 | 0.164675 | 0.033533 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0.05 | 0.05 | 0.175 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
eebaa37e5ed357350d5509c1144985c77eebbf4a | 979 | py | Python | OnlineJudge/t2.py | flyinglandlord/BUAA-SAE-DataStructure-2021 | 7eb686465b18b125115e03b39e6d83e4ed7a30cb | [
"MIT"
] | 2 | 2022-03-31T01:43:24.000Z | 2022-03-31T02:05:14.000Z | OnlineJudge/t2.py | flyinglandlord/BUAA-SAE-DataStructure-2021 | 7eb686465b18b125115e03b39e6d83e4ed7a30cb | [
"MIT"
] | null | null | null | OnlineJudge/t2.py | flyinglandlord/BUAA-SAE-DataStructure-2021 | 7eb686465b18b125115e03b39e6d83e4ed7a30cb | [
"MIT"
] | null | null | null | class Node():
def __init__(self, data=None, left=None, right=None):
self.data = data
self.left = left
self.right = right
def tree_in(node_list):
list_in = input().split()
l = len(list_in)
node_list.append(Node(list_in[0]))
for i in range(1, l):
if list_in[i] == "None":
node_list.append(None)
else:
new_node = Node(list_in[i])
node_list.append(new_node)
if(i % 2 == 1):
k = (i-1)//2
while(node_list[k] == None):
k += 1
node_list[k].left = new_node
else:
k = (i-2)//2
while (node_list[k] == None):
k += 1
node_list[k].right = new_node
node_list = []
tree_in(node_list)
ans = 0
for i in node_list:
if(i == None):
pass
elif(i.left == None):
pass
else:
ans += int(i.left.data)
print(ans) | 24.475 | 57 | 0.466803 | 136 | 979 | 3.169118 | 0.242647 | 0.241299 | 0.092807 | 0.064965 | 0.139211 | 0.139211 | 0.139211 | 0.139211 | 0.139211 | 0.139211 | 0 | 0.018676 | 0.398366 | 979 | 40 | 58 | 24.475 | 0.713073 | 0 | 0 | 0.25 | 0 | 0 | 0.004082 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0.055556 | 0 | 0 | 0.083333 | 0.027778 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
eecdd6c3e3dd238b4b3b00bc6671ef0c38fefab9 | 331 | py | Python | roasttron/apps/roast/views.py | chrisvans/roasttron | c6bc2259419f5cfc1f60c84769b209b01798b040 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | roasttron/apps/roast/views.py | chrisvans/roasttron | c6bc2259419f5cfc1f60c84769b209b01798b040 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | roasttron/apps/roast/views.py | chrisvans/roasttron | c6bc2259419f5cfc1f60c84769b209b01798b040 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | import models
import serializers
# Third Party
from rest_framework import viewsets
class RoastViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows roastss to be viewed or edited.
"""
filter_fields = ['coffee', ]
queryset = models.Roast.objects.all()
serializer_class = serializers.RoastSerializer | 23.642857 | 60 | 0.73716 | 37 | 331 | 6.513514 | 0.837838 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.18429 | 331 | 14 | 61 | 23.642857 | 0.892593 | 0.208459 | 0 | 0 | 0 | 0 | 0.024292 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
eed0f91b37aeced886d9d4e13972054768b2074d | 403 | py | Python | vendors/models.py | jeffshek/betterself | 51468253fc31373eb96e0e82189b9413f3d76ff5 | [
"MIT"
] | 98 | 2017-07-29T14:26:36.000Z | 2022-02-28T04:10:15.000Z | vendors/models.py | jeffshek/betterself | 51468253fc31373eb96e0e82189b9413f3d76ff5 | [
"MIT"
] | 1,483 | 2017-05-30T00:05:56.000Z | 2022-03-31T12:37:06.000Z | vendors/models.py | lawrendran/betterself | 51468253fc31373eb96e0e82189b9413f3d76ff5 | [
"MIT"
] | 13 | 2017-11-08T00:02:35.000Z | 2022-02-28T04:10:32.000Z | from django.db import models
from betterself.base_models import BaseModelWithUserGeneratedContent
class Vendor(BaseModelWithUserGeneratedContent):
RESOURCE_NAME = 'vendors'
name = models.CharField(max_length=200)
email = models.EmailField(max_length=254, null=True, blank=True)
url = models.URLField(null=True, blank=True)
class Meta:
unique_together = ('name', 'user')
| 26.866667 | 68 | 0.746898 | 46 | 403 | 6.434783 | 0.630435 | 0.060811 | 0.087838 | 0.114865 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017699 | 0.158809 | 403 | 14 | 69 | 28.785714 | 0.855457 | 0 | 0 | 0 | 1 | 0 | 0.037221 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.888889 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
eed3d0c219432d297ec3678d33cb055903fd203a | 727 | py | Python | cmsplugin_blog/utils.py | Troyhy/cmsplugin-blog | 0354d7ade3f9c1987f08806f4c9bcfb11d7576c3 | [
"BSD-3-Clause"
] | null | null | null | cmsplugin_blog/utils.py | Troyhy/cmsplugin-blog | 0354d7ade3f9c1987f08806f4c9bcfb11d7576c3 | [
"BSD-3-Clause"
] | null | null | null | cmsplugin_blog/utils.py | Troyhy/cmsplugin-blog | 0354d7ade3f9c1987f08806f4c9bcfb11d7576c3 | [
"BSD-3-Clause"
] | null | null | null | from django.utils.translation import get_language, ugettext_lazy as _
from django.conf import settings
def module_exists(str):
try:
__import__(str)
except ImportError:
return False
return True
def is_multilingual():
return 'cmsplugin_blog.middleware.MultilingualBlogEntriesMiddleware' in settings.MIDDLEWARE_CLASSES
def get_lang_name(lang):
return _(dict(settings.LANGUAGES)[lang])
def add_current_root(url):
if is_multilingual() and module_exists('cms.middleware.multilingual') and not has_lang_prefix(url):
from cms.middleware.multilingual import has_lang_prefix
new_root = "/%s" % get_language()
url = new_root + url
return url
| 30.291667 | 104 | 0.715268 | 89 | 727 | 5.561798 | 0.516854 | 0.040404 | 0.10101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.209078 | 727 | 23 | 105 | 31.608696 | 0.86087 | 0 | 0 | 0 | 0 | 0 | 0.12642 | 0.122159 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.277778 | 0.111111 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
eee85802e52dc9ee47e14e55880c91331e6aa297 | 270 | py | Python | src/farrow_and_ball/__init__.py | vork/farrowandball | 9cd264310f9f09b2a29c0796c892800fb96386f9 | [
"MIT"
] | 1 | 2022-03-23T15:01:26.000Z | 2022-03-23T15:01:26.000Z | src/farrow_and_ball/__init__.py | vork/farrowandball | 9cd264310f9f09b2a29c0796c892800fb96386f9 | [
"MIT"
] | null | null | null | src/farrow_and_ball/__init__.py | vork/farrowandball | 9cd264310f9f09b2a29c0796c892800fb96386f9 | [
"MIT"
] | null | null | null | from farrow_and_ball.palettes import (
BaseColorPalette,
DivergentPalette,
MiscPalette,
PaletteNotFoundError,
PaletteTypeNotImplementedError,
SpectralPalette,
all_palettes,
build_colormap,
get_palette,
get_interpolated_palette,
)
| 20.769231 | 38 | 0.748148 | 21 | 270 | 9.285714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.203704 | 270 | 12 | 39 | 22.5 | 0.906977 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.083333 | 0 | 0.083333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
eeedd3f4ee012834b5e244692a5856ea9b3358d1 | 384 | py | Python | src/nl_rendering/utils.py | MeteoSwiss-APN/nl_rendering | ec7872b0ddbaa691e7591993d1523e1c94dcf1f8 | [
"MIT"
] | null | null | null | src/nl_rendering/utils.py | MeteoSwiss-APN/nl_rendering | ec7872b0ddbaa691e7591993d1523e1c94dcf1f8 | [
"MIT"
] | 2 | 2022-01-12T16:42:13.000Z | 2022-01-13T10:44:36.000Z | src/pytrajplot/utils.py | MeteoSwiss-APN/pytrajplot | aca49d89140b3568ff90c812e6b6ffce07cbdcaa | [
"MIT"
] | null | null | null | """Utils for the command line tool."""
# Standard library
import logging
def count_to_log_level(count: int) -> int:
"""Map occurrence of the command line option verbose to the log level."""
if count == 0:
return logging.ERROR
elif count == 1:
return logging.WARNING
elif count == 2:
return logging.INFO
else:
return logging.DEBUG
| 24 | 77 | 0.640625 | 52 | 384 | 4.673077 | 0.615385 | 0.213992 | 0.115226 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010676 | 0.268229 | 384 | 15 | 78 | 25.6 | 0.854093 | 0.307292 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.1 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
eef61a0f4beda7bc826861f9b490fde79a50cffb | 3,208 | py | Python | src/devlprd/filtering.py | FANTM/devlprd | 476383266c87b99870821279ae5a1502f290292f | [
"MIT"
] | 1 | 2022-01-07T17:53:21.000Z | 2022-01-07T17:53:21.000Z | src/devlprd/filtering.py | FANTM/devlprd | 476383266c87b99870821279ae5a1502f290292f | [
"MIT"
] | 1 | 2021-09-28T20:32:20.000Z | 2021-09-28T21:09:47.000Z | src/devlprd/filtering.py | FANTM/devlprd | 476383266c87b99870821279ae5a1502f290292f | [
"MIT"
] | null | null | null | import numpy as np
# NOTE: these all assume a sample rate of 1000Hz and 0-centered(ish)
BUTTER2_45_55_NOTCH = [[0.95654323, -1.82035157, 0.95654323, 1., -1.84458768, 0.9536256 ],
[1. , -1.90305207, 1. , 1., -1.87701816, 0.95947072]]
BUTTER4_45_55_NOTCH = [[0.92117099, -1.75303637, 0.92117099, 1., -1.83993124, 0.94153282],
[1. , -1.90305207, 1. , 1., -1.85827897, 0.94562794],
[1. , -1.90305207, 1. , 1., -1.85916949, 0.9741553 ],
[1. , -1.90305207, 1. , 1., -1.89861232, 0.9783552 ]]
BUTTER8_45_55_NOTCH = [[0.85123494, -1.61994442, 0.85123494, 1., -1.84135423, 0.93909556],
[1. , -1.90305207, 1. , 1., -1.85081373, 0.94130689],
[1. , -1.90305207, 1. , 1., -1.84098214, 0.94640431],
[1. , -1.90305207, 1. , 1., -1.86712758, 0.95177517],
[1. , -1.90305207, 1. , 1., -1.85070766, 0.96298756],
[1. , -1.90305207, 1. , 1., -1.88761855, 0.96842656],
[1. , -1.90305207, 1. , 1., -1.86966575, 0.98667654],
[1. , -1.90305207, 1. , 1., -1.90969867, 0.98897339]]
BUTTER2_55_65_NOTCH = [[0.95654323, -1.77962093, 0.95654323, 1., -1.80093517, 0.95415195],
[1. , -1.860471 , 1. , 1., -1.83739919, 0.95894143]]
BUTTER4_55_65_NOTCH = [[0.92117099, -1.71381192, 0.92117099, 1., -1.79756457, 0.94190374],
[1. , -1.860471 , 1. , 1., -1.81789764, 0.94525555],
[1. , -1.860471 , 1. , 1., -1.81413419, 0.97453194],
[1. , -1.860471 , 1. , 1., -1.8595667 , 0.97797707]]
BUTTER8_55_65_NOTCH = [[0.85123494, -1.58369793, 0.85123494, 1., -1.799555 , 0.93929634],
[1. , -1.860471 , 1. , 1., -1.81000016, 0.94110568],
[1. , -1.860471 , 1. , 1., -1.79799514, 0.94688937],
[1. , -1.860471 , 1. , 1., -1.82714508, 0.95128761],
[1. , -1.860471 , 1. , 1., -1.80636275, 0.96347614],
[1. , -1.860471 , 1. , 1., -1.84831785, 0.96793547],
[1. , -1.860471 , 1. , 1., -1.82397995, 0.98688239],
[1. , -1.860471 , 1. , 1., -1.87082063, 0.9887671 ]]
class ButterworthFilter():
def __init__(self, coeffs):
self.order = len(coeffs)
self.coeffs = np.array(coeffs)
self.z = np.array([[0.0]*2]*self.order) # order x 2 array of zeros
def next_sample(self, xn):
for s in range(self.order):
xn_tmp = xn # make a temp copy
xn = self.coeffs[s, 0] * xn_tmp + self.z[s, 0]
self.z[s, 0] = (self.coeffs[s, 1] * xn_tmp - self.coeffs[s, 4] * xn + self.z[s, 1])
self.z[s, 1] = (self.coeffs[s, 2] * xn_tmp - self.coeffs[s, 5] * xn)
return xn | 71.288889 | 95 | 0.435162 | 400 | 3,208 | 3.4225 | 0.295 | 0.105186 | 0.04821 | 0.088386 | 0.242513 | 0.192841 | 0 | 0 | 0 | 0 | 0 | 0.488991 | 0.391209 | 3,208 | 45 | 96 | 71.288889 | 0.211982 | 0.033666 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04878 | false | 0 | 0.02439 | 0 | 0.121951 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
eef7e700c93ea6ce87c91a15840cd37e161ee3c3 | 4,069 | py | Python | lib/vdlib/torrent/torrentplayer.py | vadyur/script.module.vd-common | c88cde1d2838e5d33d1e446f3bcc9518b20f2fc0 | [
"MIT"
] | null | null | null | lib/vdlib/torrent/torrentplayer.py | vadyur/script.module.vd-common | c88cde1d2838e5d33d1e446f3bcc9518b20f2fc0 | [
"MIT"
] | null | null | null | lib/vdlib/torrent/torrentplayer.py | vadyur/script.module.vd-common | c88cde1d2838e5d33d1e446f3bcc9518b20f2fc0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import os, sys
from ..util.log import debug, print_tb
from ..util import filesystem
from ..util.string import decode_string
if sys.version_info < (3, 0):
from .bencode import BTFailure as BTError
from .bencode import bdecode, bencode
else:
from .bencodepy import BencodeDecodeError as BTError
from .bencodepy import bdecode, bencode
def _log(s):
debug('TorrentPlayer: {}'.format(s))
def _(s):
try:
if isinstance(s, str):
return s.encode('utf-8')
except UnicodeEncodeError:
pass
return s
class TorrentPlayer(object):
def __init__(self):
self._decoded = None
self._info_hash = None
@property
def decoded(self):
if not self._decoded:
data = None
with filesystem.fopen(self.path, 'rb') as torr:
data = torr.read()
if data is None:
return None
try:
self._decoded = bdecode(data)
except BTError:
debug("Can't decode torrent data (invalid torrent link?)")
return None
return self._decoded
@property
def info_hash(self):
if not self._info_hash:
try:
import hashlib
info = self.decoded[_('info')]
self._info_hash = hashlib.sha1(bencode(info)).hexdigest()
except:
return None
# 878e51a0c03967e90fd3371a06d77f0d86ba5e1d
return self._info_hash
@staticmethod
def is_playable(name):
filename, file_extension = os.path.splitext(name)
return file_extension in ['.mkv', '.mp4', '.ts', '.avi', '.m2ts', '.mov']
def AddTorrent(self, path):
#raise NotImplementedError("def ###: not imlemented.\nPlease Implement this method")
self.path = path
def CheckTorrentAdded(self):
#raise NotImplementedError("def ###: not imlemented.\nPlease Implement this method")
return filesystem.exists(self.path)
def updateCheckingProgress(self, progressBar):
pass
@staticmethod
def Name(name):
try:
return decode_string(name)
except UnicodeDecodeError:
try:
import chardet
enc = chardet.detect(name)
debug('confidence: {0}'.format(enc['confidence']))
debug('encoding: {0}'.format(enc['encoding']))
if enc['confidence'] > 0.5:
try:
name = name.decode(enc['encoding'])
except UnicodeDecodeError:
pass
else:
print_tb()
except BaseException as e:
print_tb()
return name
def GetLastTorrentData(self):
decoded =self.decoded
if decoded is None:
return None
info = decoded[_('info')]
def info_name():
if _('name.utf-8') in info:
return info[_('name.utf-8')]
else:
return info[_('name')]
def f_path(f):
if _('path.utf-8') in f:
return f['path.utf-8']
else:
return f['path']
name = '.'
playable_items = []
try:
if _('files') in info:
for i, f in enumerate(info[_('files')]):
# debug(i)
# debug(f)
name = os.sep.join(f_path(f))
size = f[_('length')]
#debug(name)
if TorrentPlayer.is_playable(name):
playable_items.append({'index': i, 'name': TorrentPlayer.Name(name), 'size': size})
name = TorrentPlayer.Name(info_name())
else:
playable_items = [ {'index': 0, 'name': TorrentPlayer.Name(info_name()), 'size': info[_('length')] } ]
except UnicodeDecodeError:
return None
return { 'info_hash': self.info_hash, 'announce': decoded[_('announce')], 'files': playable_items, 'name': name }
def GetTorrentInfo(self):
try:
return { 'downloaded' : 100,
'size' : 100,
'dl_speed' : 1,
'ul_speed' : 0,
'num_seeds' : 1,
'num_peers' : 0
}
except:
pass
return None
def StartBufferFile(self, fileIndex):
pass
def CheckBufferComplete(self):
pass
def GetBufferingProgress(self):
pass
def GetStreamURL(self, playable_item):
pass
def updateDialogInfo(self, progress, progressBar):
pass
def GetBufferingProgress(self):
return 100
def CheckBufferComplete(self):
return True
def loop(self):
pass
def test():
file = '/Users/vd/.kodi/temp/lazyf1.torrent'
tp = TorrentPlayer()
tp.AddTorrent(file)
d = tp.decoded
ltd = tp.GetLastTorrentData()
pass | 21.415789 | 115 | 0.653232 | 506 | 4,069 | 5.144269 | 0.286561 | 0.029581 | 0.02305 | 0.009988 | 0.072993 | 0.050711 | 0.050711 | 0.050711 | 0.050711 | 0 | 0 | 0.0175 | 0.213566 | 4,069 | 190 | 116 | 21.415789 | 0.795625 | 0.061686 | 0 | 0.316901 | 0 | 0 | 0.100683 | 0.009201 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.077465 | 0.070423 | null | null | 0.021127 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e110a367030e87143db1bb8e6cb4efd92f25d661 | 1,012 | py | Python | tests/misc/aes.py | som-dev/QRL | 4d335d0c65c4f9bfad21e3ae918a249eff64b047 | [
"MIT"
] | 1 | 2020-07-11T15:32:52.000Z | 2020-07-11T15:32:52.000Z | tests/misc/aes.py | som-dev/QRL | 4d335d0c65c4f9bfad21e3ae918a249eff64b047 | [
"MIT"
] | null | null | null | tests/misc/aes.py | som-dev/QRL | 4d335d0c65c4f9bfad21e3ae918a249eff64b047 | [
"MIT"
] | null | null | null | # coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import base64
import hashlib
from Crypto import Random, Cipher
class AES(object):
def __init__(self, key):
self.bs = 32
self.key = hashlib.sha256(key).digest()
def encrypt(self, raw):
raw = self._pad(raw)
iv = Random.new().read(Cipher.AES.block_size)
cipher = Cipher.AES.new(self.key, Cipher.AES.MODE_CBC, iv)
return base64.b64encode(iv + cipher.encrypt(raw))
def decrypt(self, enc):
enc = base64.b64decode(enc)
iv = enc[:Cipher.AES.block_size]
cipher = Cipher.AES.new(self.key, Cipher.AES.MODE_CBC, iv)
return self._unpad(cipher.decrypt(enc[Cipher.AES.block_size:]))
def _pad(self, s):
return s + ((self.bs - len(s) % self.bs) * chr(self.bs - len(s) % self.bs)).encode()
@staticmethod
def _unpad(s):
return s[:-ord(s[len(s) - 1:])]
| 30.666667 | 92 | 0.636364 | 148 | 1,012 | 4.263514 | 0.405405 | 0.099842 | 0.066561 | 0.085578 | 0.301109 | 0.263074 | 0.212361 | 0.212361 | 0.212361 | 0.212361 | 0 | 0.021519 | 0.219368 | 1,012 | 32 | 93 | 31.625 | 0.777215 | 0.143281 | 0 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.227273 | false | 0 | 0.136364 | 0.090909 | 0.590909 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e11a41ff2514277c8475086153b08f6c0239f43e | 154 | py | Python | _aulas/aula007d.py | CarlosJunn/Aprendendo_Python | cddb29b5ee2058c3fb612574eb4af414770b7422 | [
"MIT"
] | null | null | null | _aulas/aula007d.py | CarlosJunn/Aprendendo_Python | cddb29b5ee2058c3fb612574eb4af414770b7422 | [
"MIT"
] | null | null | null | _aulas/aula007d.py | CarlosJunn/Aprendendo_Python | cddb29b5ee2058c3fb612574eb4af414770b7422 | [
"MIT"
] | null | null | null | m = float(input('Digite um valor em metros:'))
cm = m * 100
mm = m * 1000
print('Valor em centímetros: {:.2f}\nValor em milímetros: {:.2f}'.format(cm,mm)) | 38.5 | 80 | 0.649351 | 26 | 154 | 3.846154 | 0.692308 | 0.14 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068702 | 0.149351 | 154 | 4 | 80 | 38.5 | 0.694656 | 0 | 0 | 0 | 0 | 0 | 0.535484 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e122c0699fc3f41018c4055fde3e8bff4997246c | 10,814 | py | Python | pysnmp/EICON-MIB-TRACE.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/EICON-MIB-TRACE.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/EICON-MIB-TRACE.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module EICON-MIB-TRACE (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EICON-MIB-TRACE
# Produced by pysmi-0.3.4 at Mon Apr 29 18:45:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ValueRangeConstraint")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, ObjectIdentity, iso, Integer32, Gauge32, Unsigned32, enterprises, Bits, TimeTicks, Counter64, MibIdentifier, Counter32, ModuleIdentity, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "ObjectIdentity", "iso", "Integer32", "Gauge32", "Unsigned32", "enterprises", "Bits", "TimeTicks", "Counter64", "MibIdentifier", "Counter32", "ModuleIdentity", "IpAddress")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
eicon = MibIdentifier((1, 3, 6, 1, 4, 1, 434))
management = MibIdentifier((1, 3, 6, 1, 4, 1, 434, 2))
mibv2 = MibIdentifier((1, 3, 6, 1, 4, 1, 434, 2, 2))
module = MibIdentifier((1, 3, 6, 1, 4, 1, 434, 2, 2, 4))
class ActionState(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("done", 1), ("failed", 2), ("in-progress", 3))
class ControlOnOff(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("stop", 1), ("start", 2), ("invalid", 3))
class CardRef(Integer32):
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 6)
class PortRef(Integer32):
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 48)
class PositiveInteger(Integer32):
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 2147483647)
trace = MibIdentifier((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15))
traceFreeEntryIndex = MibScalar((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 1), PositiveInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: traceFreeEntryIndex.setStatus('mandatory')
traceControlTable = MibTable((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2), )
if mibBuilder.loadTexts: traceControlTable.setStatus('mandatory')
traceControlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1), ).setIndexNames((0, "EICON-MIB-TRACE", "traceCntrlIndex"))
if mibBuilder.loadTexts: traceControlEntry.setStatus('mandatory')
traceCntrlIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 1), PositiveInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: traceCntrlIndex.setStatus('mandatory')
traceCntrlEntryStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("invalid", 1), ("create", 2), ("valid", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlEntryStatus.setStatus('mandatory')
traceCntrlEntryOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 16))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlEntryOwner.setStatus('mandatory')
traceCntrlProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("x25", 1), ("sdlc", 2), ("frelay", 3), ("hdlc", 4), ("xportiso", 5), ("xporttgx", 6), ("llc", 7), ("sna", 8), ("ppp", 9), ("snafr", 10)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlProtocol.setStatus('mandatory')
traceCntrlEntryReclaimTime = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 5), TimeTicks()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlEntryReclaimTime.setStatus('mandatory')
traceCntrlOnOff = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("start", 1), ("read", 2), ("stop", 3), ("invalid", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlOnOff.setStatus('mandatory')
traceCntrlActionState = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 7), ActionState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: traceCntrlActionState.setStatus('mandatory')
traceCntrlActionError = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no-error", 1), ("bad-param", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: traceCntrlActionError.setStatus('mandatory')
traceCntrlFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlFileName.setStatus('mandatory')
traceCntrlCardRef = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 10), CardRef()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlCardRef.setStatus('mandatory')
traceCntrlPortRef = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 11), PortRef()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlPortRef.setStatus('mandatory')
traceCntrlConnectionRef = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 12), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlConnectionRef.setStatus('mandatory')
traceCntrlPURef = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 13), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlPURef.setStatus('mandatory')
traceCntrlModeRef = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 14), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlModeRef.setStatus('mandatory')
traceCntrlLURef = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 15), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlLURef.setStatus('mandatory')
traceCntrlStationRef = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 16), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlStationRef.setStatus('mandatory')
traceCntrlLLURef = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 17), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlLLURef.setStatus('mandatory')
traceCntrlRLURef = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 18), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlRLURef.setStatus('mandatory')
traceCntrlOption = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("append", 1), ("clear", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlOption.setStatus('mandatory')
traceCntrlPeriod = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 20), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlPeriod.setStatus('mandatory')
traceCntrlMask = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 21), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlMask.setStatus('mandatory')
traceCntrlBufSize = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 22), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlBufSize.setStatus('mandatory')
traceCntrlEntrySize = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 23), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlEntrySize.setStatus('mandatory')
traceCntrlBufFullAction = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 24), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("wrap", 1), ("stop", 2), ("stopAndAlarm", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlBufFullAction.setStatus('mandatory')
traceCntrlReadFromEntryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 25), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlReadFromEntryIndex.setStatus('mandatory')
traceCntrlFileType = MibTableColumn((1, 3, 6, 1, 4, 1, 434, 2, 2, 4, 15, 2, 1, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ascii", 1), ("ebcdic", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: traceCntrlFileType.setStatus('mandatory')
mibBuilder.exportSymbols("EICON-MIB-TRACE", mibv2=mibv2, traceCntrlOption=traceCntrlOption, traceCntrlLURef=traceCntrlLURef, traceCntrlProtocol=traceCntrlProtocol, traceCntrlEntryReclaimTime=traceCntrlEntryReclaimTime, traceCntrlBufFullAction=traceCntrlBufFullAction, traceCntrlModeRef=traceCntrlModeRef, PositiveInteger=PositiveInteger, ActionState=ActionState, trace=trace, traceCntrlActionError=traceCntrlActionError, traceCntrlBufSize=traceCntrlBufSize, traceCntrlEntrySize=traceCntrlEntrySize, traceControlTable=traceControlTable, traceCntrlMask=traceCntrlMask, management=management, traceCntrlFileType=traceCntrlFileType, traceCntrlEntryStatus=traceCntrlEntryStatus, traceCntrlReadFromEntryIndex=traceCntrlReadFromEntryIndex, PortRef=PortRef, traceCntrlPURef=traceCntrlPURef, traceCntrlPortRef=traceCntrlPortRef, traceControlEntry=traceControlEntry, ControlOnOff=ControlOnOff, traceCntrlStationRef=traceCntrlStationRef, traceFreeEntryIndex=traceFreeEntryIndex, traceCntrlFileName=traceCntrlFileName, traceCntrlEntryOwner=traceCntrlEntryOwner, traceCntrlConnectionRef=traceCntrlConnectionRef, traceCntrlLLURef=traceCntrlLLURef, traceCntrlActionState=traceCntrlActionState, traceCntrlIndex=traceCntrlIndex, traceCntrlOnOff=traceCntrlOnOff, eicon=eicon, traceCntrlRLURef=traceCntrlRLURef, traceCntrlPeriod=traceCntrlPeriod, module=module, traceCntrlCardRef=traceCntrlCardRef, CardRef=CardRef)
| 113.831579 | 1,396 | 0.75393 | 1,233 | 10,814 | 6.612328 | 0.153285 | 0.008586 | 0.012511 | 0.016681 | 0.489636 | 0.405618 | 0.319514 | 0.305532 | 0.302833 | 0.283331 | 0 | 0.079793 | 0.087942 | 10,814 | 94 | 1,397 | 115.042553 | 0.746832 | 0.029961 | 0 | 0.02439 | 0 | 0 | 0.112298 | 0.004198 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.073171 | 0 | 0.219512 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e129f49e255f7f1763b6acf780db8c1ec73ede0e | 271 | py | Python | airflow/dags/split_into_time.py | zkan/try-airflow | d2f008ce2e19983e88e77b46534824c214ad0399 | [
"MIT"
] | 1 | 2017-01-15T13:53:01.000Z | 2017-01-15T13:53:01.000Z | airflow/dags/split_into_time.py | zkan/try-airflow | d2f008ce2e19983e88e77b46534824c214ad0399 | [
"MIT"
] | 10 | 2017-02-15T07:31:08.000Z | 2022-03-29T22:28:10.000Z | airflow/dags/split_into_time.py | zkan/try-airflow | d2f008ce2e19983e88e77b46534824c214ad0399 | [
"MIT"
] | 1 | 2017-02-15T07:03:16.000Z | 2017-02-15T07:03:16.000Z | import os
AIRFLOW_HOME = os.environ.get('AIRFLOW_HOME')
with open(f'{AIRFLOW_HOME}/dags/data.txt') as f:
time_data = f.read()
time_list = time_data.split()
with open(f'{AIRFLOW_HOME}/dags/time.txt', 'w') as split_text:
split_text.write(str(time_list[3]))
| 22.583333 | 62 | 0.697417 | 47 | 271 | 3.808511 | 0.468085 | 0.24581 | 0.100559 | 0.178771 | 0.268156 | 0.268156 | 0 | 0 | 0 | 0 | 0 | 0.004274 | 0.136531 | 271 | 11 | 63 | 24.636364 | 0.760684 | 0 | 0 | 0 | 0 | 0 | 0.254613 | 0.206642 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
01097b6d0d34b2f2c8872ca2aaa8bdfbf9ab6ff5 | 227 | py | Python | part/mm/fixed_risk/part.py | fasiondog/hikyuu_house | 0f0b609f17d94ba60da193de9c753eae54693817 | [
"MIT"
] | null | null | null | part/mm/fixed_risk/part.py | fasiondog/hikyuu_house | 0f0b609f17d94ba60da193de9c753eae54693817 | [
"MIT"
] | null | null | null | part/mm/fixed_risk/part.py | fasiondog/hikyuu_house | 0f0b609f17d94ba60da193de9c753eae54693817 | [
"MIT"
] | 1 | 2021-12-22T06:31:26.000Z | 2021-12-22T06:31:26.000Z | from hikyuu import MM_FixedRisk
# 部件作者
author = "fasiondog"
# 版本
version = '20200825'
def part(risk=1000.00):
return MM_FixedRisk(risk)
part.__doc__ = MM_FixedRisk.__doc__
if __name__ == '__main__':
print(part()) | 13.352941 | 35 | 0.704846 | 30 | 227 | 4.7 | 0.733333 | 0.234043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074866 | 0.176211 | 227 | 17 | 36 | 13.352941 | 0.679144 | 0.030837 | 0 | 0 | 0 | 0 | 0.114679 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0.125 | 0.375 | 0.125 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
012b5d48823592d325c254481e3171a418a026d7 | 353 | py | Python | ReadXMLClass.py | exponential-decay/oais-du-jour | 8e83115954bc4ac32a0739dc2078158065b1222c | [
"MIT"
] | 1 | 2016-08-17T04:02:33.000Z | 2016-08-17T04:02:33.000Z | ReadXMLClass.py | exponential-decay/oais-du-jour | 8e83115954bc4ac32a0739dc2078158065b1222c | [
"MIT"
] | null | null | null | ReadXMLClass.py | exponential-decay/oais-du-jour | 8e83115954bc4ac32a0739dc2078158065b1222c | [
"MIT"
] | null | null | null | import os
import re
import sys
import urllib2
import xml.etree.ElementTree as etree
class read_xml:
def __init__(self, loc):
self.loc = loc
def scan_xml(self):
tree = etree.ElementTree(file=urllib2.urlopen(self.loc))
root = tree.getroot()
xml_iter = iter(root)
return xml_iter
| 18.578947 | 62 | 0.611898 | 47 | 353 | 4.446809 | 0.510638 | 0.100478 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008163 | 0.305949 | 353 | 18 | 63 | 19.611111 | 0.840816 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.384615 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
012b7485f33f1c0314a8922b86f328ca2e16a504 | 74 | py | Python | pynamodb/tests/integration/config.py | augustincouette/PynamoDB | e250948dd593beb878042d5b949e07a6e0478ae5 | [
"MIT"
] | 3 | 2017-06-06T07:38:48.000Z | 2021-07-21T21:38:34.000Z | pynamodb/tests/integration/config.py | augustincouette/PynamoDB | e250948dd593beb878042d5b949e07a6e0478ae5 | [
"MIT"
] | 8 | 2016-03-28T21:22:04.000Z | 2016-11-01T18:01:21.000Z | pynamodb/tests/integration/config.py | augustincouette/PynamoDB | e250948dd593beb878042d5b949e07a6e0478ae5 | [
"MIT"
] | 4 | 2019-08-17T20:02:28.000Z | 2020-12-01T01:11:25.000Z | """
Integration test settings
"""
DYNAMODB_HOST = 'http://localhost:8000' | 14.8 | 39 | 0.716216 | 8 | 74 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060606 | 0.108108 | 74 | 5 | 39 | 14.8 | 0.727273 | 0.337838 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
01306d3a435248c9dea724a91974caeef7bea61e | 1,861 | py | Python | manipulation_main/training/env_reset_demo.py | ama29/6.843-Final-Project | cc0628f32cd695e0a76ffb0b7daa8c7350b6f0ed | [
"MIT"
] | null | null | null | manipulation_main/training/env_reset_demo.py | ama29/6.843-Final-Project | cc0628f32cd695e0a76ffb0b7daa8c7350b6f0ed | [
"MIT"
] | null | null | null | manipulation_main/training/env_reset_demo.py | ama29/6.843-Final-Project | cc0628f32cd695e0a76ffb0b7daa8c7350b6f0ed | [
"MIT"
] | null | null | null | import argparse
from manipulation_main.training.imitation_utils import get_env_expert
train_parser = argparse.ArgumentParser()
train_parser.add_argument('--config', type=str, required=True)
train_parser.add_argument('--model_dir', type=str, required=True)
train_parser.add_argument('--algo', type=str, required=True)
train_parser.add_argument('--model', type=str)
train_parser.add_argument("--num_timesteps", type=int)
train_parser.add_argument("--num_episodes", type=int)
train_parser.add_argument("--rollout_file", type=str, required=True)
train_parser.add_argument("--num_epochs", type=int, default=1)
train_parser.add_argument("--num_test_episodes", type=int, default=None)
train_parser.add_argument("--log_dir", type=str, default=None)
train_parser.add_argument("--max_expert_demos", type=int, default=None)
train_parser.add_argument("--use_transformer", action="store_true")
train_parser.add_argument("--run_range", action="store_true")
train_parser.add_argument("--range_min", type=int, default=None)
train_parser.add_argument("--range_max", type=int, default=None)
train_parser.add_argument("--range_step", type=int, default=None)
train_parser.add_argument('--timestep', type=str)
train_parser.add_argument('-s', '--simple', action='store_true')
train_parser.add_argument('-sh', '--shaped', action='store_true')
train_parser.add_argument('-v', '--visualize', action='store_true')
train_parser.add_argument('-tf', '--timefeature', action='store_true')
args = train_parser.parse_args()
train_env, expert = get_env_expert(args)
robot_env = train_env.venv.venv.envs[0].env.env
# reset should change stae
train_env.reset()
train_env.reset()
train_env.reset()
# set rng to get same setup
rng_state = robot_env._rng.get_state()
train_env.reset()
robot_env._rng.set_state(rng_state)
train_env.reset()
robot_env._rng.set_state(rng_state)
train_env.reset()
| 41.355556 | 72 | 0.785599 | 281 | 1,861 | 4.871886 | 0.252669 | 0.184806 | 0.214755 | 0.337473 | 0.653031 | 0.624543 | 0.487217 | 0.352082 | 0.204529 | 0.071585 | 0 | 0.001139 | 0.056421 | 1,861 | 44 | 73 | 42.295455 | 0.778474 | 0.026867 | 0 | 0.222222 | 0 | 0 | 0.174226 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.055556 | 0 | 0.055556 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
013342991197bb6a70fe60bdda879124625e3e6f | 1,366 | py | Python | pip_services3_commons/commands/IEventListener.py | pip-services-python/pip-services-commons-python | ecfe0aab2b1442ed3b550115dd2c2472537452de | [
"MIT"
] | null | null | null | pip_services3_commons/commands/IEventListener.py | pip-services-python/pip-services-commons-python | ecfe0aab2b1442ed3b550115dd2c2472537452de | [
"MIT"
] | null | null | null | pip_services3_commons/commands/IEventListener.py | pip-services-python/pip-services-commons-python | ecfe0aab2b1442ed3b550115dd2c2472537452de | [
"MIT"
] | 2 | 2020-03-11T21:41:13.000Z | 2020-03-14T00:26:20.000Z | # -*- coding: utf-8 -*-
"""
pip_services3_commons.commands.IEventListener
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interface for event_name listeners.
:copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from abc import ABC
from typing import Optional
from ..commands import IEvent
from ..run import Parameters
class IEventListener(ABC):
"""
An interface for listener objects that receive notifications on fired events.
Example:
.. code-block:: python
class MyListener(IEventListener):
def on_event(self, correlation_id, event_name, args):
print "Fired event_name " + event_name.get_name()
event = Event("myevent")
event.addListener(MyListener())
event.notify("123", Parameters.from_tuples("param1", "ABC"))
"""
def on_event(self, correlation_id: Optional[str], event: IEvent, value: Parameters):
"""
A method called when events this listener is subscrubed to are fired.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param event: event_name reference
:param value: event_name arguments
"""
raise NotImplementedError('Method from interface definition')
| 29.695652 | 95 | 0.650073 | 152 | 1,366 | 5.743421 | 0.559211 | 0.061856 | 0.032073 | 0.032073 | 0.061856 | 0.061856 | 0 | 0 | 0 | 0 | 0 | 0.013346 | 0.232064 | 1,366 | 45 | 96 | 30.355556 | 0.818875 | 0.672767 | 0 | 0 | 0 | 0 | 0.102236 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.571429 | 0 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
0152e01f7ae429f061981780e28ac7078cacf1dd | 6,058 | py | Python | hscommon/cocoa/inter.py | hsoft/currency_server | 0fa5c9b159b93df98a399c5b0efeb61318925265 | [
"BSD-3-Clause"
] | null | null | null | hscommon/cocoa/inter.py | hsoft/currency_server | 0fa5c9b159b93df98a399c5b0efeb61318925265 | [
"BSD-3-Clause"
] | null | null | null | hscommon/cocoa/inter.py | hsoft/currency_server | 0fa5c9b159b93df98a399c5b0efeb61318925265 | [
"BSD-3-Clause"
] | null | null | null | # Created By: Virgil Dupras
# Created On: 2010-02-06
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
# Interfaces for proxies in cocoalib
import logging
import objc
from ..reg import InvalidCodeError
from .objcmin import NSObject
def signature(signature):
"""Returns an objc.signature with 'i' and 'f' letters changed to correct NSInteger and
CGFloat values.
"""
signature = bytes(signature, encoding='ascii')
signature = signature.replace(b'i', objc._C_NSInteger)
signature = signature.replace(b'I', objc._C_NSUInteger)
signature = signature.replace(b'f', objc._C_CGFloat)
return objc.typedSelector(signature)
class PyGUIObject(NSObject):
def initWithCocoa_pyParent_(self, cocoa, pyparent):
super(PyGUIObject, self).init()
self.cocoa = cocoa
self.py = self.py_class(self, pyparent.py)
return self
def connect(self):
if hasattr(self.py, 'connect'):
self.py.connect()
def disconnect(self):
if hasattr(self.py, 'disconnect'):
self.py.disconnect()
def free(self):
# call this method only when you don't need to use this proxy anymore. you need to call this
# if you want to release the cocoa side (self.cocoa is holding a refcount)
# We don't delete py, it might be called after the free. It will be garbage collected anyway.
# The if is because there is something happening giving a new ref to cocoa right after
# the free, and then the ref gets to 1 again, free is called again.
self.disconnect()
if hasattr(self, 'cocoa'):
del self.cocoa
#--- Python -> Cocoa
def refresh(self):
self.cocoa.refresh()
class PyOutline(PyGUIObject):
def cancelEdits(self):
self.py.cancel_edits()
@signature('c@:@@')
def canEditProperty_atPath_(self, propname, path):
node = self.py.get_node(path)
assert node is self.py.selected_node
return getattr(node, 'can_edit_' + propname, False)
def saveEdits(self):
self.py.save_edits()
def selectedPath(self):
return self.py.selected_path
def setSelectedPath_(self, path):
self.py.selected_path = path
def selectedPaths(self):
return self.py.selected_paths
def setSelectedPaths_(self, paths):
self.py.selected_paths = paths
def property_valueAtPath_(self, property, path):
try:
return getattr(self.py.get_node(path), property)
except IndexError:
logging.warning("%r doesn't have a node at path %r", self.py, path)
return ''
def setProperty_value_atPath_(self, property, value, path):
setattr(self.py.get_node(path), property, value)
#--- Python -> Cocoa
def start_editing(self):
self.cocoa.startEditing()
def stop_editing(self):
self.cocoa.stopEditing()
def update_selection(self):
self.cocoa.updateSelection()
class PyTable(PyGUIObject):
#--- Helpers
def _getrow(self, row):
try:
return self.py[row]
except IndexError:
msg = "Trying to get an out of bounds row ({} / {}) on table {}"
logging.warning(msg.format(row, len(self.py), self.py.__class__.__name__))
#--- Cocoa --> Python
def add(self):
self.py.add()
def cancelEdits(self):
self.py.cancel_edits()
@signature('c@:@i')
def canEditColumn_atRow_(self, column, row):
return self.py.can_edit_cell(column, row)
def deleteSelectedRows(self):
self.py.delete()
@signature('i@:')
def numberOfRows(self):
return len(self.py)
def saveEdits(self):
self.py.save_edits()
def selectRows_(self, rows):
self.py.select(list(rows))
def selectedRows(self):
return self.py.selected_indexes
def selectionAsCSV(self):
return self.py.selection_as_csv()
@signature('v@:@@i')
def setValue_forColumn_row_(self, value, column, row):
# this try except is important for the case while a row is in edition mode and the delete
# button is clicked.
try:
self._getrow(row).set_cell_value(column, value)
except AttributeError:
msg = "Trying to set an attribute that can't: {} with value {} at row {} on table {}"
logging.warning(msg.format(column, value, row, self.py.__class__.__name__))
raise
@signature('v@:@c')
def sortByColumn_desc_(self, column, desc):
self.py.sort_by(column, desc=desc)
@signature('@@:@i')
def valueForColumn_row_(self, column, row):
return self._getrow(row).get_cell_value(column)
#--- Python -> Cocoa
def show_selected_row(self):
self.cocoa.showSelectedRow()
def start_editing(self):
self.cocoa.startEditing()
def stop_editing(self):
self.cocoa.stopEditing()
def update_selection(self):
self.cocoa.updateSelection()
class PyFairware(NSObject):
def appName(self):
return ""
@signature('c@:')
def isRegistered(self):
return self.py.registered
@signature('c@:')
def isFirstRun(self):
return self.py.is_first_run
def isCodeValid_withEmail_(self, code, email):
try:
self.py.validate_code(code, email)
return None
except InvalidCodeError as e:
return str(e)
@signature('v@:@@c')
def setRegisteredCode_andEmail_registerOS_(self, code, email, registerOS):
self.py.set_registration(code, email, registerOS)
def unpaidHours(self):
return self.py.unpaid_hours
| 29.990099 | 101 | 0.625124 | 745 | 6,058 | 4.962416 | 0.326175 | 0.058426 | 0.029213 | 0.030295 | 0.217203 | 0.161212 | 0.147687 | 0.112524 | 0.09413 | 0.069786 | 0 | 0.002935 | 0.268901 | 6,058 | 201 | 102 | 30.139303 | 0.83179 | 0.174645 | 0 | 0.217054 | 0 | 0 | 0.049537 | 0 | 0 | 0 | 0 | 0 | 0.007752 | 1 | 0.317829 | false | 0 | 0.031008 | 0.085271 | 0.527132 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
017e467062f7e8a3b2f0787dc70fdcd00d69161d | 237 | py | Python | choreo/multirq/defaults.py | Mizzlr/triton | e8487b87d26640ea8826a42ef42514160decc373 | [
"MIT"
] | 3 | 2019-10-29T02:54:24.000Z | 2020-08-13T02:33:01.000Z | choreo/multirq/defaults.py | Mizzlr/choreo | e8487b87d26640ea8826a42ef42514160decc373 | [
"MIT"
] | null | null | null | choreo/multirq/defaults.py | Mizzlr/choreo | e8487b87d26640ea8826a42ef42514160decc373 | [
"MIT"
] | null | null | null | DEFAULT_JOB_CLASS = 'choreo.multirq.job.Job'
DEFAULT_QUEUE_CLASS = 'choreo.multirq.Queue'
DEFAULT_WORKER_CLASS = 'choreo.retry.RetryWorker'
DEFAULT_CONNECTION_CLASS = 'redis.StrictRedis'
DEFAULT_WORKER_TTL = 420
DEFAULT_RESULT_TTL = 500
| 33.857143 | 49 | 0.831224 | 32 | 237 | 5.78125 | 0.5 | 0.178378 | 0.194595 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027397 | 0.075949 | 237 | 6 | 50 | 39.5 | 0.817352 | 0 | 0 | 0 | 0 | 0 | 0.350211 | 0.194093 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0199625b73eab36efaab3f7590a7796bba06a540 | 138 | py | Python | spath/__init__.py | dimatura/spath.py | 881a86cf1197223aefc91204d30dc83e7741b980 | [
"BSD-3-Clause"
] | null | null | null | spath/__init__.py | dimatura/spath.py | 881a86cf1197223aefc91204d30dc83e7741b980 | [
"BSD-3-Clause"
] | 1 | 2021-11-15T18:23:50.000Z | 2021-11-15T18:23:50.000Z | spath/__init__.py | dimatura/spath.py | 881a86cf1197223aefc91204d30dc83e7741b980 | [
"BSD-3-Clause"
] | 1 | 2017-07-28T11:17:02.000Z | 2017-07-28T11:17:02.000Z | # -*- coding: utf-8 -*-
__author__ = """Daniel Maturana"""
__email__ = 'dimatura@cmu.edu'
__version__ = '0.1.5'
from .spath import Path
| 17.25 | 34 | 0.652174 | 18 | 138 | 4.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034188 | 0.152174 | 138 | 7 | 35 | 19.714286 | 0.632479 | 0.152174 | 0 | 0 | 0 | 0 | 0.313043 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6d6a22de0a959e1e74006e4abf40ed21b0007afa | 1,654 | py | Python | tests/test_validators.py | life4/vaa | d934e073966cacc1810419bed0ed8e5dca83fac8 | [
"MIT"
] | 5 | 2019-10-01T14:21:04.000Z | 2021-10-19T16:21:28.000Z | tests/test_validators.py | life4/vaa | d934e073966cacc1810419bed0ed8e5dca83fac8 | [
"MIT"
] | 2 | 2019-10-03T19:44:55.000Z | 2019-10-04T09:37:28.000Z | tests/test_validators.py | life4/vaa | d934e073966cacc1810419bed0ed8e5dca83fac8 | [
"MIT"
] | null | null | null | import pytest
from .validators.pre import prevalidators
from .validators.post import postvalidators
validators = prevalidators + postvalidators
@pytest.mark.parametrize('validator', validators)
def test_valid(validator):
data = {
'name': 'Oleg',
'mail': 'test@example.ru',
'count': 20,
}
v = validator(data=data)
assert v.is_valid() is True
assert v.cleaned_data == data
@pytest.mark.parametrize('validator', validators)
def test_no_field(validator):
data = {
'name': 'Oleg',
'mail': 'test@example.ru',
}
v = validator(data=data)
assert v.is_valid() is False
assert v.errors
@pytest.mark.parametrize('validator', validators)
def test_invalid_int(validator):
data = {
'name': 'Oleg',
'mail': 'test@example.ru',
'count': 'lol',
}
v = validator(data=data)
assert v.is_valid() is False
assert v.errors
@pytest.mark.parametrize('validator', prevalidators)
def test_types_converting(validator):
data = {
'name': 'Oleg',
'mail': 'test@example.ru',
'count': '10',
}
v = validator(request=True, data=data)
assert v.is_valid() is True
assert not v.errors
assert 'count' in v.cleaned_data
assert v.cleaned_data['count'] == 10
@pytest.mark.parametrize('validator', prevalidators)
def test_explicit_keys(validator):
data = {
'name': 'Oleg',
'mail': 'test@example.ru',
'count': 10,
'junk': 'test',
}
v = validator(request=True, data=data)
assert v.is_valid() is True
assert not v.errors
assert 'junk' not in v.cleaned_data
| 23.295775 | 52 | 0.622128 | 201 | 1,654 | 5.029851 | 0.21393 | 0.062315 | 0.065282 | 0.148368 | 0.736894 | 0.736894 | 0.736894 | 0.557864 | 0.520277 | 0.391691 | 0 | 0.006349 | 0.23821 | 1,654 | 70 | 53 | 23.628571 | 0.796032 | 0 | 0 | 0.596491 | 0 | 0 | 0.137243 | 0 | 0 | 0 | 0 | 0 | 0.22807 | 1 | 0.087719 | false | 0 | 0.052632 | 0 | 0.140351 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6d7118dd6958a79f48d08e347784b8d163821942 | 50,247 | py | Python | pysnmp-with-texts/TERAWAVE-terasystem-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 8 | 2019-05-09T17:04:00.000Z | 2021-06-09T06:50:51.000Z | pysnmp-with-texts/TERAWAVE-terasystem-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 4 | 2019-05-31T16:42:59.000Z | 2020-01-31T21:57:17.000Z | pysnmp-with-texts/TERAWAVE-terasystem-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module TERAWAVE-terasystem-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TERAWAVE-terasystem-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:16:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Integer32, Bits, Counter32, ObjectIdentity, NotificationType, TimeTicks, MibIdentifier, ModuleIdentity, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Unsigned32, iso, enterprises, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "Bits", "Counter32", "ObjectIdentity", "NotificationType", "TimeTicks", "MibIdentifier", "ModuleIdentity", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Unsigned32", "iso", "enterprises", "Gauge32")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
terawave = MibIdentifier((1, 3, 6, 1, 4, 1, 4513))
teraSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5))
teraSystemTime = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 1), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemTime.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemTime.setDescription('')
teraSystemCurrTime = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraSystemCurrTime.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemCurrTime.setDescription('')
teraLogGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 8))
teraLogNumberTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 8, 1), )
if mibBuilder.loadTexts: teraLogNumberTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogNumberTable.setDescription(' table teraLogNumberTable')
teraLogNumberTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 8, 1, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "teraLogNumber"))
if mibBuilder.loadTexts: teraLogNumberTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogNumberTableEntry.setDescription(' table entry teraLogNumberTableEntry ')
teraLogNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraLogNumber.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogNumber.setDescription('')
teraLogNumberDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 1, 1, 2), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraLogNumberDescr.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogNumberDescr.setDescription('')
teraLogNumberStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ok", 1), ("clear", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraLogNumberStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogNumberStatus.setDescription('')
teraLogClear = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 8, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ok", 1), ("clear", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraLogClear.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogClear.setDescription('')
teraLogTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3), )
if mibBuilder.loadTexts: teraLogTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogTable.setDescription(' table teraLogTable')
teraLogTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 4), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "teraInstallSlotNumber"), (0, "TERAWAVE-terasystem-MIB", "teraLogNumber"), (0, "TERAWAVE-terasystem-MIB", "teraLogMsgIndex"))
if mibBuilder.loadTexts: teraLogTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogTableEntry.setDescription(' table entry teraLogTableEntry ')
teraLogMsgIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 4, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraLogMsgIndex.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogMsgIndex.setDescription('')
teraLogMsgNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 4, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraLogMsgNumber.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogMsgNumber.setDescription('')
teraLogNumberOfParams = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 4, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraLogNumberOfParams.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogNumberOfParams.setDescription('')
teraLogParams = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 4, 4), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraLogParams.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogParams.setDescription('')
teraLogStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 4, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ok", 1), ("clear", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraLogStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogStatus.setDescription('')
teraAllLogsFilterGroup = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 5), )
if mibBuilder.loadTexts: teraAllLogsFilterGroup.setStatus('mandatory')
if mibBuilder.loadTexts: teraAllLogsFilterGroup.setDescription(' table teraAllLogsFilterGroup')
teraAllLogsFilterGroupEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 5, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "teraLogNumber"))
if mibBuilder.loadTexts: teraAllLogsFilterGroupEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraAllLogsFilterGroupEntry.setDescription(' table entry teraAllLogsFilterGroupEntry ')
teraLogFilterByNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 5, 1, 1), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraLogFilterByNumber.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogFilterByNumber.setDescription('')
teraLogFilterBySize = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("all", 1), ("last20", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraLogFilterBySize.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogFilterBySize.setDescription('')
teraLogFilterBySeverity = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 5))).clone(namedValues=NamedValues(("nominal", 1), ("minor", 2), ("major", 3), ("critical", 5)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraLogFilterBySeverity.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogFilterBySeverity.setDescription('')
teraLogFilterByTask = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 8, 3, 5, 1, 4), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraLogFilterByTask.setStatus('mandatory')
if mibBuilder.loadTexts: teraLogFilterByTask.setDescription('')
teraSlotInstTablePar = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 3))
teraSlotInstallTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1), )
if mibBuilder.loadTexts: teraSlotInstallTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraSlotInstallTable.setDescription(' table teraSlotInstallTable')
teraSlotInstallTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "teraInstallSlotNumber"))
if mibBuilder.loadTexts: teraSlotInstallTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraSlotInstallTableEntry.setDescription(' table entry teraSlotInstallTableEntry ')
teraInstallSlotNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 7))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraInstallSlotNumber.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallSlotNumber.setDescription('')
teraInstallUnitType = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 5000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraInstallUnitType.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallUnitType.setDescription('')
teraInstallEquippedUnitType = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraInstallEquippedUnitType.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallEquippedUnitType.setDescription('')
teraInstallUnitAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("provision", 1), ("none", 2), ("is", 3), ("moos", 4), ("reset", 5), ("trunk", 6), ("moos-trunk", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraInstallUnitAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallUnitAdminStatus.setDescription('')
teraInstallUnitOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("empty", 1), ("is", 2), ("moos", 3), ("removed", 4), ("unprovisioned", 5), ("mismatch", 6), ("oos", 7), ("init", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraInstallUnitOperStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallUnitOperStatus.setDescription('')
teraInstallUnitName = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 6), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraInstallUnitName.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallUnitName.setDescription('')
teraInstallUnitRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 7), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraInstallUnitRevision.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallUnitRevision.setDescription('')
teraInstallUnitSerial = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraInstallUnitSerial.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallUnitSerial.setDescription('')
teraInstallUnitSWVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraInstallUnitSWVersion.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallUnitSWVersion.setDescription('')
teraInstallUnitMfgData = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 1, 1, 10), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraInstallUnitMfgData.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstallUnitMfgData.setDescription('')
teraSystemInstallTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2), )
if mibBuilder.loadTexts: teraSystemInstallTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemInstallTable.setDescription(' table teraSystemInstallTable')
teraSystemInstallTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "teraInstallSlotNumber"), (0, "TERAWAVE-terasystem-MIB", "teraPonIndex"))
if mibBuilder.loadTexts: teraSystemInstallTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemInstallTableEntry.setDescription(' table entry teraSystemInstallTableEntry ')
teraSystemNEProvisionAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("provision", 1), ("none", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNEProvisionAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNEProvisionAdminStatus.setDescription('')
teraSystemNEName = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 2), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraSystemNEName.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNEName.setDescription('')
teraSystemNERangingCode = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 3), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNERangingCode.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNERangingCode.setDescription('')
teraSystemNEType = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 7))).clone(namedValues=NamedValues(("unknown", 0), ("tw300", 1), ("tw600", 2), ("tw1600", 3), ("tw100", 4), ("tw150RT", 5), ("oat", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraSystemNEType.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNEType.setDescription('')
teraSystemNEMaxLatency = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(8, 60))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNEMaxLatency.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNEMaxLatency.setDescription('')
teraSystemNEAponMaxLength = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 200))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNEAponMaxLength.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNEAponMaxLength.setDescription('')
teraSystemNEOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("empty", 1), ("provisioned", 2), ("linkDown", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraSystemNEOperStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNEOperStatus.setDescription('')
teraSystemNEEocMinBandWidth = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(128, 1536))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNEEocMinBandWidth.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNEEocMinBandWidth.setDescription('')
teraSystemNEEocMaxBandWidth = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(128, 1536))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNEEocMaxBandWidth.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNEEocMaxBandWidth.setDescription('')
teraSystemNEInventoryOverride = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("olt2ont", 1), ("ont2olt", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNEInventoryOverride.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNEInventoryOverride.setDescription('')
teraSystemNERanging = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNERanging.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNERanging.setDescription('')
teraSystemNECurrentDistance = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 3, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 20000))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraSystemNECurrentDistance.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNECurrentDistance.setDescription('')
teraNEInfoTableGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 3, 3))
teraNEInfoTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 3, 3, 1))
teraNERangingCode = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 3, 3, 1, 1), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraNERangingCode.setStatus('mandatory')
if mibBuilder.loadTexts: teraNERangingCode.setDescription('')
teraNEType = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 3, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 0), ("tw300", 1), ("tw600", 2), ("tw1600", 3), ("tw100", 4), ("tw150RT-ATM", 5), ("tw150RT-TDM", 6), ("oat", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraNEType.setStatus('mandatory')
if mibBuilder.loadTexts: teraNEType.setDescription('')
teraNEModel = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 3, 3, 1, 3), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraNEModel.setStatus('mandatory')
if mibBuilder.loadTexts: teraNEModel.setDescription('')
teraNESWVersion = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 3, 3, 1, 4), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraNESWVersion.setStatus('mandatory')
if mibBuilder.loadTexts: teraNESWVersion.setDescription('')
teraNESWRevision = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 3, 3, 1, 5), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraNESWRevision.setStatus('mandatory')
if mibBuilder.loadTexts: teraNESWRevision.setDescription('')
teraClockSyncTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 4))
teraClockSyncPrimarySource = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("bits-A", 1), ("nim", 2), ("freerun", 3), ("holdover", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraClockSyncPrimarySource.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncPrimarySource.setDescription('')
teraClockSyncPrimaryNIMSlot = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraClockSyncPrimaryNIMSlot.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncPrimaryNIMSlot.setDescription('')
teraClockSyncPrimaryNIMIfIndex = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraClockSyncPrimaryNIMIfIndex.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncPrimaryNIMIfIndex.setDescription('')
teraClockSyncSecondarySource = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("bits-B", 1), ("nim", 2), ("freerun", 3), ("holdover", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraClockSyncSecondarySource.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncSecondarySource.setDescription('')
teraClockSyncSecondaryNIMSlot = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraClockSyncSecondaryNIMSlot.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncSecondaryNIMSlot.setDescription('')
teraClockSyncSecondaryNIMIfIndex = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 6), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraClockSyncSecondaryNIMIfIndex.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncSecondaryNIMIfIndex.setDescription('')
teraClockSyncLastSource = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("freerun", 1), ("holdover", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraClockSyncLastSource.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncLastSource.setDescription('')
teraClockSyncRevertive = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraClockSyncRevertive.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncRevertive.setDescription('')
teraClockSyncActiveSource = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("bits-A", 1), ("bits-B", 2), ("nim", 3), ("freerun", 4), ("holdover", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraClockSyncActiveSource.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncActiveSource.setDescription('')
teraClockSyncActiveNIMSlot = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraClockSyncActiveNIMSlot.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncActiveNIMSlot.setDescription('')
teraClockSyncActiveNIMIfIndex = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraClockSyncActiveNIMIfIndex.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncActiveNIMIfIndex.setDescription('')
teraClockSyncActiveStatus = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("auto", 1), ("manual", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraClockSyncActiveStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncActiveStatus.setDescription('')
teraClockSyncPrimaryStatus = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("active", 1), ("idle", 2), ("fail", 3), ("oos", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraClockSyncPrimaryStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncPrimaryStatus.setDescription('')
teraClockSyncSecondaryStatus = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("active", 1), ("idle", 2), ("fail", 3), ("oos", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraClockSyncSecondaryStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncSecondaryStatus.setDescription('')
teraClockSyncOperStatus = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 4, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("configure", 1), ("switchToPrimary", 2), ("switchToSecondary", 3), ("switchToHoldover", 4), ("switchToFreerun", 5)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraClockSyncOperStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraClockSyncOperStatus.setDescription('')
teraCommunityGroupTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 5))
teraPublicCommunity = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 5, 1), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraPublicCommunity.setStatus('mandatory')
if mibBuilder.loadTexts: teraPublicCommunity.setDescription('')
teraSETCommunity = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 5, 2), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSETCommunity.setStatus('mandatory')
if mibBuilder.loadTexts: teraSETCommunity.setDescription('')
teraGETCommunity = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 5, 3), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraGETCommunity.setStatus('mandatory')
if mibBuilder.loadTexts: teraGETCommunity.setDescription('')
teraAdminCommunity = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 5, 4), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraAdminCommunity.setStatus('mandatory')
if mibBuilder.loadTexts: teraAdminCommunity.setDescription('')
teraTestCommunity = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 5, 5), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraTestCommunity.setStatus('mandatory')
if mibBuilder.loadTexts: teraTestCommunity.setDescription('')
teraMasterSlaveTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 6))
teraMasterSlotNumber = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 6, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraMasterSlotNumber.setStatus('mandatory')
if mibBuilder.loadTexts: teraMasterSlotNumber.setDescription('')
teraSlaveSlotNumber = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 6, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSlaveSlotNumber.setStatus('mandatory')
if mibBuilder.loadTexts: teraSlaveSlotNumber.setDescription('')
teraSystemIPGroupTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 7))
teraSystemIPAddress = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 7, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemIPAddress.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemIPAddress.setDescription('')
teraSystemIPNetMask = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 7, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemIPNetMask.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemIPNetMask.setDescription('')
teraSystemIPGateway = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 7, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemIPGateway.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemIPGateway.setDescription('')
teraNESlotTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 9), )
if mibBuilder.loadTexts: teraNESlotTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraNESlotTable.setDescription(' table teraNESlotTable')
teraNESlotTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 9, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "teraInstallSlotNumber"), (0, "TERAWAVE-terasystem-MIB", "teraPonIndex"), (0, "TERAWAVE-terasystem-MIB", "teraEventSlot"))
if mibBuilder.loadTexts: teraNESlotTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraNESlotTableEntry.setDescription(' table entry teraNESlotTableEntry ')
teraNESlotUnitType = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 9, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 1000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraNESlotUnitType.setStatus('mandatory')
if mibBuilder.loadTexts: teraNESlotUnitType.setDescription('')
teraNESlotUnitAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 9, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("provision", 1), ("none", 2), ("is", 3), ("moos", 4), ("reset", 5), ("trunk", 6)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraNESlotUnitAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraNESlotUnitAdminStatus.setDescription('')
teraWLinkIPTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 10), )
if mibBuilder.loadTexts: teraWLinkIPTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPTable.setDescription(' table teraWLinkIPTable')
teraWLinkIPTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 10, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "teraInstallSlotNumber"), (0, "TERAWAVE-terasystem-MIB", "teraPonIndex"))
if mibBuilder.loadTexts: teraWLinkIPTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPTableEntry.setDescription(' table entry teraWLinkIPTableEntry ')
teraWLinkIPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 10, 1, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraWLinkIPAddress.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPAddress.setDescription('')
teraWLinkIPNetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 10, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraWLinkIPNetMask.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPNetMask.setDescription('')
teraWLinkIPGateway = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 10, 1, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraWLinkIPGateway.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPGateway.setDescription('')
teraWLinkIPStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 10, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("set", 1), ("delete", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraWLinkIPStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPStatus.setDescription('')
teraNEMiscTableGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 11))
teraNEMiscTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 11, 1))
teraNELevel2Slot = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 11, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraNELevel2Slot.setStatus('mandatory')
if mibBuilder.loadTexts: teraNELevel2Slot.setDescription('')
teraNEZipSystem = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 11, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("no", 1), ("zip-active", 2), ("zip-stby", 3), ("zip-all", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraNEZipSystem.setStatus('mandatory')
if mibBuilder.loadTexts: teraNEZipSystem.setDescription('')
teraNEReset = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 11, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("reset", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraNEReset.setStatus('mandatory')
if mibBuilder.loadTexts: teraNEReset.setDescription('')
teraNETimeZone = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 11, 1, 4), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraNETimeZone.setStatus('mandatory')
if mibBuilder.loadTexts: teraNETimeZone.setDescription('')
teraNEInventoryOverride = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 11, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraNEInventoryOverride.setStatus('mandatory')
if mibBuilder.loadTexts: teraNEInventoryOverride.setDescription('')
teraNESerialPortType = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 11, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ppp", 1), ("dbshell", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraNESerialPortType.setStatus('mandatory')
if mibBuilder.loadTexts: teraNESerialPortType.setDescription('')
teraSysObjectIdTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 12))
teraTW300 = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 12, 1), ObjectIdentifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraTW300.setStatus('mandatory')
if mibBuilder.loadTexts: teraTW300.setDescription('')
teraTW600 = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 12, 2), ObjectIdentifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraTW600.setStatus('mandatory')
if mibBuilder.loadTexts: teraTW600.setDescription('')
teraTW1600 = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 12, 3), ObjectIdentifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraTW1600.setStatus('mandatory')
if mibBuilder.loadTexts: teraTW1600.setDescription('')
teraTW100 = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 12, 4), ObjectIdentifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraTW100.setStatus('mandatory')
if mibBuilder.loadTexts: teraTW100.setDescription('')
teraTW150RTATM = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 12, 5), ObjectIdentifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraTW150RTATM.setStatus('mandatory')
if mibBuilder.loadTexts: teraTW150RTATM.setDescription('')
teraTW150RTTDM = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 12, 6), ObjectIdentifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraTW150RTTDM.setStatus('mandatory')
if mibBuilder.loadTexts: teraTW150RTTDM.setDescription('')
teraOAT = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 12, 7), ObjectIdentifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraOAT.setStatus('mandatory')
if mibBuilder.loadTexts: teraOAT.setDescription('')
teraNEIDxTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 13), )
if mibBuilder.loadTexts: teraNEIDxTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraNEIDxTable.setDescription(' table teraNEIDxTable')
teraNEIDxTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 13, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "ifIndex"))
if mibBuilder.loadTexts: teraNEIDxTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraNEIDxTableEntry.setDescription(' table entry teraNEIDxTableEntry ')
teraNEIDxSlotLevel1 = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 13, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraNEIDxSlotLevel1.setStatus('mandatory')
if mibBuilder.loadTexts: teraNEIDxSlotLevel1.setDescription('')
teraNEIDxPonID = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 13, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraNEIDxPonID.setStatus('mandatory')
if mibBuilder.loadTexts: teraNEIDxPonID.setDescription('')
teraWLinkIPRangeTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 14), )
if mibBuilder.loadTexts: teraWLinkIPRangeTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPRangeTable.setDescription(' table teraWLinkIPRangeTable')
teraWLinkIPRangeTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 14, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "ifIndex"))
if mibBuilder.loadTexts: teraWLinkIPRangeTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPRangeTableEntry.setDescription(' table entry teraWLinkIPRangeTableEntry ')
teraWLinkIPRangeStart = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 14, 1, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraWLinkIPRangeStart.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPRangeStart.setDescription('')
teraWLinkIPRangeEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 14, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraWLinkIPRangeEnd.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPRangeEnd.setDescription('')
teraWLinkIPRangeRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 14, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ok", 1), ("delete", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraWLinkIPRangeRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts: teraWLinkIPRangeRowStatus.setDescription('')
teraSecondaryMasterSlaveTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 16))
teraSecondaryMasterSlotNumber = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 16, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSecondaryMasterSlotNumber.setStatus('mandatory')
if mibBuilder.loadTexts: teraSecondaryMasterSlotNumber.setDescription('')
teraSecondarySlaveSlotNumber = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 16, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSecondarySlaveSlotNumber.setStatus('mandatory')
if mibBuilder.loadTexts: teraSecondarySlaveSlotNumber.setDescription('')
teraMasterSlaveStateTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 17), )
if mibBuilder.loadTexts: teraMasterSlaveStateTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraMasterSlaveStateTable.setDescription(' table teraMasterSlaveStateTable')
teraMasterSlaveStateTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 17, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "teraMasterSlaveStateIndex"))
if mibBuilder.loadTexts: teraMasterSlaveStateTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraMasterSlaveStateTableEntry.setDescription(' table entry teraMasterSlaveStateTableEntry ')
teraMasterSlaveStateIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 17, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraMasterSlaveStateIndex.setStatus('mandatory')
if mibBuilder.loadTexts: teraMasterSlaveStateIndex.setDescription('')
teraMasterState = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 17, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("unknown", 0), ("nobody", 1), ("master", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraMasterState.setStatus('mandatory')
if mibBuilder.loadTexts: teraMasterState.setDescription('')
teraSlaveState = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 17, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 0), ("nobody", 1), ("slave", 3), ("slaveActive", 4), ("slaveFail", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraSlaveState.setStatus('mandatory')
if mibBuilder.loadTexts: teraSlaveState.setDescription('')
teraPPPBaudRateTbl = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 20))
teraPPPBaudRateTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 20, 1))
teraPPPAdminBaudRate = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 20, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("baud2400", 0), ("baud4800", 1), ("baud9600", 2), ("baud19200", 3), ("baud38400", 4), ("baud57600", 5), ("baud115200", 6), ("baud230400", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraPPPAdminBaudRate.setStatus('mandatory')
if mibBuilder.loadTexts: teraPPPAdminBaudRate.setDescription('')
teraPPPOperBaudRate = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 20, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("baud2400", 0), ("baud4800", 1), ("baud9600", 2), ("baud19200", 3), ("baud38400", 4), ("baud57600", 5), ("baud115200", 6), ("baud230400", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraPPPOperBaudRate.setStatus('mandatory')
if mibBuilder.loadTexts: teraPPPOperBaudRate.setDescription('')
teraPPPAdminFlowControl = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 20, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("xon-Xoff", 1), ("rTS-CTS", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraPPPAdminFlowControl.setStatus('mandatory')
if mibBuilder.loadTexts: teraPPPAdminFlowControl.setDescription('')
teraPPPOperFlowControl = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 20, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("xon-Xoff", 1), ("rTS-CTS", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraPPPOperFlowControl.setStatus('mandatory')
if mibBuilder.loadTexts: teraPPPOperFlowControl.setDescription('')
teraSystemNATGroupTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 24))
teraSystemNATSubnetAddress = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 24, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNATSubnetAddress.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNATSubnetAddress.setDescription('')
teraSystemNATSubnetMask = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 24, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNATSubnetMask.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNATSubnetMask.setDescription('')
teraSystemPCUNumTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 25))
teraSystemNumOfPCU = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 25, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("pCU4", 0), ("pCU5", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraSystemNumOfPCU.setStatus('mandatory')
if mibBuilder.loadTexts: teraSystemNumOfPCU.setDescription('')
teraInstalledSystemInfoTable = MibTable((1, 3, 6, 1, 4, 1, 4513, 5, 26), )
if mibBuilder.loadTexts: teraInstalledSystemInfoTable.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstalledSystemInfoTable.setDescription(' table teraInstalledSystemInfoTable')
teraInstalledSystemInfoTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4513, 5, 26, 1), ).setIndexNames((0, "TERAWAVE-terasystem-MIB", "teraInstallSlotNumber"), (0, "TERAWAVE-terasystem-MIB", "teraPonIndex"))
if mibBuilder.loadTexts: teraInstalledSystemInfoTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstalledSystemInfoTableEntry.setDescription(' table entry teraInstalledSystemInfoTableEntry ')
teraInstalledSystemName = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 26, 1, 1), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraInstalledSystemName.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstalledSystemName.setDescription('')
teraInstalledSystemLocation = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 26, 1, 2), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraInstalledSystemLocation.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstalledSystemLocation.setDescription('')
teraInstalledNEType = MibTableColumn((1, 3, 6, 1, 4, 1, 4513, 5, 26, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 7))).clone(namedValues=NamedValues(("unknown", 0), ("tw300", 1), ("tw600", 2), ("tw1600", 3), ("tw100", 4), ("tw150RT", 5), ("oat", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraInstalledNEType.setStatus('mandatory')
if mibBuilder.loadTexts: teraInstalledNEType.setDescription('')
teraCraftInterfaceGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 28))
teraCraftInterfaceTable = MibIdentifier((1, 3, 6, 1, 4, 1, 4513, 5, 28, 1))
teraCraftPortStat = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 28, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraCraftPortStat.setStatus('mandatory')
if mibBuilder.loadTexts: teraCraftPortStat.setDescription('')
teraCraftDefaultAddrStat = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 28, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: teraCraftDefaultAddrStat.setStatus('mandatory')
if mibBuilder.loadTexts: teraCraftDefaultAddrStat.setDescription('')
teraSNMPState = MibScalar((1, 3, 6, 1, 4, 1, 4513, 5, 28, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ready", 1), ("notReady", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: teraSNMPState.setStatus('mandatory')
if mibBuilder.loadTexts: teraSNMPState.setDescription('')
mibBuilder.exportSymbols("TERAWAVE-terasystem-MIB", teraClockSyncActiveNIMSlot=teraClockSyncActiveNIMSlot, teraCommunityGroupTable=teraCommunityGroupTable, teraLogMsgNumber=teraLogMsgNumber, teraSystemInstallTableEntry=teraSystemInstallTableEntry, teraNEModel=teraNEModel, teraLogNumberOfParams=teraLogNumberOfParams, teraNEInventoryOverride=teraNEInventoryOverride, teraWLinkIPGateway=teraWLinkIPGateway, teraNERangingCode=teraNERangingCode, teraLogNumber=teraLogNumber, teraClockSyncRevertive=teraClockSyncRevertive, teraNEType=teraNEType, teraWLinkIPRangeEnd=teraWLinkIPRangeEnd, teraLogFilterBySize=teraLogFilterBySize, teraSystemNECurrentDistance=teraSystemNECurrentDistance, teraNESlotUnitType=teraNESlotUnitType, teraNESerialPortType=teraNESerialPortType, teraSystemNEProvisionAdminStatus=teraSystemNEProvisionAdminStatus, teraClockSyncTable=teraClockSyncTable, teraAllLogsFilterGroupEntry=teraAllLogsFilterGroupEntry, teraInstallUnitAdminStatus=teraInstallUnitAdminStatus, teraInstallEquippedUnitType=teraInstallEquippedUnitType, teraNEInfoTableGroup=teraNEInfoTableGroup, teraLogTable=teraLogTable, teraLogGroup=teraLogGroup, teraNESlotTable=teraNESlotTable, teraPublicCommunity=teraPublicCommunity, teraNEZipSystem=teraNEZipSystem, teraPPPAdminBaudRate=teraPPPAdminBaudRate, teraNEIDxSlotLevel1=teraNEIDxSlotLevel1, teraMasterSlaveTable=teraMasterSlaveTable, teraPPPAdminFlowControl=teraPPPAdminFlowControl, teraSystemNEMaxLatency=teraSystemNEMaxLatency, teraCraftPortStat=teraCraftPortStat, teraInstallUnitOperStatus=teraInstallUnitOperStatus, teraSecondarySlaveSlotNumber=teraSecondarySlaveSlotNumber, teraPPPBaudRateTbl=teraPPPBaudRateTbl, teraNESWVersion=teraNESWVersion, teraPPPBaudRateTable=teraPPPBaudRateTable, teraLogMsgIndex=teraLogMsgIndex, teraClockSyncSecondaryStatus=teraClockSyncSecondaryStatus, teraWLinkIPRangeRowStatus=teraWLinkIPRangeRowStatus, teraNEIDxTable=teraNEIDxTable, teraWLinkIPNetMask=teraWLinkIPNetMask, teraSystemNERangingCode=teraSystemNERangingCode, teraTestCommunity=teraTestCommunity, teraSystemNATGroupTable=teraSystemNATGroupTable, teraSystemPCUNumTable=teraSystemPCUNumTable, teraCraftInterfaceGroup=teraCraftInterfaceGroup, teraSystemNumOfPCU=teraSystemNumOfPCU, teraSystemNEOperStatus=teraSystemNEOperStatus, teraSystemIPNetMask=teraSystemIPNetMask, teraInstallUnitRevision=teraInstallUnitRevision, teraMasterSlotNumber=teraMasterSlotNumber, teraClockSyncPrimarySource=teraClockSyncPrimarySource, teraCraftDefaultAddrStat=teraCraftDefaultAddrStat, teraInstalledSystemInfoTableEntry=teraInstalledSystemInfoTableEntry, teraInstallUnitName=teraInstallUnitName, teraSystemNEType=teraSystemNEType, teraInstallUnitType=teraInstallUnitType, teraLogStatus=teraLogStatus, teraOAT=teraOAT, teraMasterSlaveStateTableEntry=teraMasterSlaveStateTableEntry, teraWLinkIPTableEntry=teraWLinkIPTableEntry, teraSystem=teraSystem, teraLogFilterByNumber=teraLogFilterByNumber, teraTW1600=teraTW1600, teraClockSyncPrimaryNIMSlot=teraClockSyncPrimaryNIMSlot, teraClockSyncActiveStatus=teraClockSyncActiveStatus, teraSystemNEInventoryOverride=teraSystemNEInventoryOverride, teraAllLogsFilterGroup=teraAllLogsFilterGroup, teraLogParams=teraLogParams, teraWLinkIPTable=teraWLinkIPTable, teraWLinkIPRangeTableEntry=teraWLinkIPRangeTableEntry, teraSystemNEEocMaxBandWidth=teraSystemNEEocMaxBandWidth, terawave=terawave, teraSystemIPGroupTable=teraSystemIPGroupTable, teraLogNumberTableEntry=teraLogNumberTableEntry, teraLogFilterBySeverity=teraLogFilterBySeverity, teraWLinkIPAddress=teraWLinkIPAddress, teraSystemNERanging=teraSystemNERanging, teraInstallUnitSerial=teraInstallUnitSerial, teraInstalledNEType=teraInstalledNEType, teraInstallUnitSWVersion=teraInstallUnitSWVersion, teraInstalledSystemInfoTable=teraInstalledSystemInfoTable, teraSlotInstallTable=teraSlotInstallTable, teraSystemNEAponMaxLength=teraSystemNEAponMaxLength, teraClockSyncSecondaryNIMIfIndex=teraClockSyncSecondaryNIMIfIndex, teraSystemCurrTime=teraSystemCurrTime, teraClockSyncActiveSource=teraClockSyncActiveSource, teraClockSyncOperStatus=teraClockSyncOperStatus, teraNELevel2Slot=teraNELevel2Slot, teraMasterSlaveStateTable=teraMasterSlaveStateTable, teraAdminCommunity=teraAdminCommunity, teraWLinkIPRangeTable=teraWLinkIPRangeTable, teraSystemNATSubnetMask=teraSystemNATSubnetMask, teraSysObjectIdTable=teraSysObjectIdTable, teraTW100=teraTW100, teraSecondaryMasterSlaveTable=teraSecondaryMasterSlaveTable, teraSystemNATSubnetAddress=teraSystemNATSubnetAddress, teraTW150RTTDM=teraTW150RTTDM, teraTW300=teraTW300, teraInstalledSystemLocation=teraInstalledSystemLocation, teraNEReset=teraNEReset, teraPPPOperBaudRate=teraPPPOperBaudRate, teraSystemIPAddress=teraSystemIPAddress, teraNESlotTableEntry=teraNESlotTableEntry, teraNESlotUnitAdminStatus=teraNESlotUnitAdminStatus, teraTW600=teraTW600, teraNESWRevision=teraNESWRevision, teraInstallUnitMfgData=teraInstallUnitMfgData, teraSlotInstallTableEntry=teraSlotInstallTableEntry, teraLogTableEntry=teraLogTableEntry, teraSlotInstTablePar=teraSlotInstTablePar, teraSystemTime=teraSystemTime, teraGETCommunity=teraGETCommunity, teraSystemInstallTable=teraSystemInstallTable, teraClockSyncSecondaryNIMSlot=teraClockSyncSecondaryNIMSlot, teraClockSyncPrimaryNIMIfIndex=teraClockSyncPrimaryNIMIfIndex, teraNETimeZone=teraNETimeZone, teraLogNumberStatus=teraLogNumberStatus, teraNEIDxPonID=teraNEIDxPonID, teraClockSyncLastSource=teraClockSyncLastSource, teraLogClear=teraLogClear, teraSlaveState=teraSlaveState, teraMasterState=teraMasterState, teraCraftInterfaceTable=teraCraftInterfaceTable, teraWLinkIPStatus=teraWLinkIPStatus, teraClockSyncPrimaryStatus=teraClockSyncPrimaryStatus, teraTW150RTATM=teraTW150RTATM, teraMasterSlaveStateIndex=teraMasterSlaveStateIndex, teraPPPOperFlowControl=teraPPPOperFlowControl, teraInstallSlotNumber=teraInstallSlotNumber, teraInstalledSystemName=teraInstalledSystemName, teraNEMiscTableGroup=teraNEMiscTableGroup, teraSETCommunity=teraSETCommunity, teraClockSyncSecondarySource=teraClockSyncSecondarySource, teraClockSyncActiveNIMIfIndex=teraClockSyncActiveNIMIfIndex, teraSystemNEName=teraSystemNEName, teraSystemNEEocMinBandWidth=teraSystemNEEocMinBandWidth, teraNEMiscTable=teraNEMiscTable, teraSecondaryMasterSlotNumber=teraSecondaryMasterSlotNumber, teraSlaveSlotNumber=teraSlaveSlotNumber, teraLogNumberTable=teraLogNumberTable, teraLogNumberDescr=teraLogNumberDescr, teraNEIDxTableEntry=teraNEIDxTableEntry, teraWLinkIPRangeStart=teraWLinkIPRangeStart, teraNEInfoTable=teraNEInfoTable, teraLogFilterByTask=teraLogFilterByTask, teraSNMPState=teraSNMPState, teraSystemIPGateway=teraSystemIPGateway)
| 117.399533 | 6,594 | 0.782614 | 5,120 | 50,247 | 7.680469 | 0.069727 | 0.079951 | 0.139915 | 0.01536 | 0.527032 | 0.375598 | 0.322678 | 0.280745 | 0.26063 | 0.24377 | 0 | 0.063436 | 0.071367 | 50,247 | 427 | 6,595 | 117.674473 | 0.779323 | 0.006767 | 0 | 0 | 0 | 0 | 0.098601 | 0.019279 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.014286 | 0 | 0.014286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6d7a6a28b9a4622ae582ef18e268ad020262a8b0 | 506 | py | Python | src/python/examples/decorator.py | pierfied/apollo | d0ea477ef6814a3b322487fd25c30846db5d2988 | [
"MIT"
] | 14 | 2020-06-16T12:59:18.000Z | 2022-01-31T17:40:52.000Z | src/python/examples/decorator.py | pierfied/apollo | d0ea477ef6814a3b322487fd25c30846db5d2988 | [
"MIT"
] | 9 | 2020-08-11T01:18:26.000Z | 2022-02-18T16:33:02.000Z | src/python/examples/decorator.py | pierfied/apollo | d0ea477ef6814a3b322487fd25c30846db5d2988 | [
"MIT"
] | 8 | 2020-06-16T12:59:25.000Z | 2021-06-21T20:33:04.000Z | #!/usr/bin/env python
from __future__ import print_function
def printstuff(fun):
def fun_that_prints(*args, **kwargs):
print("calling %s" % fun.__name__)
fun(*args, **kwargs)
print("done with %s." % fun.__name__)
return fun_that_prints
def myfunction():
print("MYFUNCTION")
def myfunction2():
print("MYFUNCTION_decorated")
myfunction2 = printstuff(myfunction2)
if __name__ == "__main__":
myfunction()
print()
print()
myfunction2()
| 16.866667 | 45 | 0.640316 | 55 | 506 | 5.418182 | 0.490909 | 0.04698 | 0.087248 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010256 | 0.229249 | 506 | 29 | 46 | 17.448276 | 0.753846 | 0.039526 | 0 | 0.117647 | 0 | 0 | 0.126033 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.058824 | 0 | 0.352941 | 0.647059 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
6d899d7fdbc581791b146905752b8c79931b4c69 | 609 | py | Python | helloworld.py | joefroh/l2python | 7da298c9fed38df3605718a2fd4ffdd3640728a7 | [
"MIT"
] | null | null | null | helloworld.py | joefroh/l2python | 7da298c9fed38df3605718a2fd4ffdd3640728a7 | [
"MIT"
] | null | null | null | helloworld.py | joefroh/l2python | 7da298c9fed38df3605718a2fd4ffdd3640728a7 | [
"MIT"
] | null | null | null | print("Hello World")
# The basics
name = "joey"
age = 27
print(name + str(age))
testList = [0,1,2]
testList.append(3)
testList.append(4)
for member in testList:
print(member)
for index,member in enumerate(testList):
print("Index: " + str(index) + " item: " + str(member))
# List Combining
list1 = [1,3,5,7]
list2 = [2,4,6,8]
print(list1 + list2)
# String fun
mystring = "Hello World, I am a string!"
print(mystring[:4])
print(mystring[4:])
print(mystring[2:5])
print(mystring[-4:])
print(mystring[::2]) # skip every second character
print(mystring[::-1]) # reverse
print(mystring.split(" ")) | 17.4 | 59 | 0.663383 | 93 | 609 | 4.344086 | 0.462366 | 0.225248 | 0.10396 | 0.141089 | 0.173267 | 0.138614 | 0 | 0 | 0 | 0 | 0 | 0.050388 | 0.152709 | 609 | 35 | 60 | 17.4 | 0.732558 | 0.118227 | 0 | 0 | 0 | 0 | 0.107143 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.545455 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
6d8a301829e190af47578c501b784f8b9e8fdcd3 | 214 | py | Python | tests/other_models.py | BottleJia/Redis-astra | f27288c383ef4710c2a97416fc268242cdf95100 | [
"MIT"
] | 87 | 2016-03-07T08:38:56.000Z | 2021-11-12T11:42:34.000Z | tests/other_models.py | BottleJia/Redis-astra | f27288c383ef4710c2a97416fc268242cdf95100 | [
"MIT"
] | 5 | 2016-03-10T20:49:28.000Z | 2021-06-30T08:01:43.000Z | tests/other_models.py | BottleJia/Redis-astra | f27288c383ef4710c2a97416fc268242cdf95100 | [
"MIT"
] | 6 | 2016-03-17T21:28:25.000Z | 2021-07-29T05:49:59.000Z | from astra import models
import redis
db = redis.StrictRedis(host='127.0.0.1', decode_responses=True)
class SiteColorModel(models.Model):
color = models.CharField()
def get_db(self):
return db
| 16.461538 | 63 | 0.705607 | 30 | 214 | 4.966667 | 0.766667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034483 | 0.186916 | 214 | 12 | 64 | 17.833333 | 0.821839 | 0 | 0 | 0 | 0 | 0 | 0.042056 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0.142857 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
6d8c8cfc9f800371f7bee7266d3a26d2a3c52452 | 853 | py | Python | ski_trip.py | GYosifov88/Python-Basics | f4290061264aebc417bde4948948e4a64739fec9 | [
"MIT"
] | null | null | null | ski_trip.py | GYosifov88/Python-Basics | f4290061264aebc417bde4948948e4a64739fec9 | [
"MIT"
] | null | null | null | ski_trip.py | GYosifov88/Python-Basics | f4290061264aebc417bde4948948e4a64739fec9 | [
"MIT"
] | null | null | null | days = int(input())
type_of_room = input()
feedback = input()
price = 0
nights = days - 1
if type_of_room == 'room for one person':
price = 18
cost = nights * price
elif type_of_room == 'apartment':
price = 25
cost = nights * price
if days < 10:
cost = cost - (cost * 30 /100)
elif 10 <= days <= 15:
cost = cost - (cost * 35 / 100)
elif days > 15:
cost = cost - (cost * 50 / 100)
elif type_of_room == 'president apartment':
price = 35
cost = nights * price
if days < 10:
cost = cost - (cost * 10 /100)
elif 10 <= days <= 15:
cost = cost - (cost * 15 / 100)
elif days > 15:
cost = cost - (cost * 20 / 100)
if feedback == 'positive':
cost = cost + (cost * 25 /100)
elif feedback == 'negative':
cost = cost - (cost * 10 / 100)
print (f'{cost:.2f}') | 24.371429 | 43 | 0.539273 | 118 | 853 | 3.830508 | 0.279661 | 0.283186 | 0.212389 | 0.123894 | 0.426991 | 0.384956 | 0.384956 | 0.274336 | 0.154867 | 0 | 0 | 0.111684 | 0.317702 | 853 | 35 | 44 | 24.371429 | 0.664948 | 0 | 0 | 0.354839 | 0 | 0 | 0.08548 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.032258 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6d94ca809a5e5c811407fc2c1493922fffdcd45f | 1,170 | py | Python | hello/home/views.py | pratikd2124/Online-Library | e93ef1f42476d9f1b4b814f0a8254fd8cfbee178 | [
"MIT"
] | null | null | null | hello/home/views.py | pratikd2124/Online-Library | e93ef1f42476d9f1b4b814f0a8254fd8cfbee178 | [
"MIT"
] | null | null | null | hello/home/views.py | pratikd2124/Online-Library | e93ef1f42476d9f1b4b814f0a8254fd8cfbee178 | [
"MIT"
] | null | null | null | from django.shortcuts import render, HttpResponse
from home.models import Contact, Library, category
from datetime import datetime
from django.contrib import messages
# Create your views here.
def index(request):
return render(request, "index.html")
#return HttpResponse("Home page")
def about(request):
return render(request, "about.html")
#return HttpResponse("about page")
def Books(request):
return render(request, "books.html")
def Category(request):
lis = Library.objects.all()
return render(request, "category.html", {"lis":lis})
#return HttpResponse("Books page")
def contact(request):
if request.method == "POST":
name = request.POST.get("name")
email = request.POST.get("email")
phone = request.POST.get("phone")
contact = Contact(name=name, email= email, phone= phone, date= datetime.today())
contact.save()
messages.success(request, 'Your message has been sent.')
return render(request, "contact.html")
#return HttpResponse("contact page")
def signup(request):
return render(request, "signup.html") | 30 | 89 | 0.657265 | 136 | 1,170 | 5.654412 | 0.330882 | 0.093628 | 0.148244 | 0.135241 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.220513 | 1,170 | 39 | 90 | 30 | 0.843202 | 0.133333 | 0 | 0 | 0 | 0 | 0.117405 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.166667 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
6daf4aaf0e392d4ab98d2ea30238144060546619 | 80 | py | Python | gpu_kmer_counter/__init__.py | AMR-Hackathon-2021/gpu_kmer_counter | 1818663ffd270f402da98f2dc1d010ee81f8e9bf | [
"Apache-2.0"
] | null | null | null | gpu_kmer_counter/__init__.py | AMR-Hackathon-2021/gpu_kmer_counter | 1818663ffd270f402da98f2dc1d010ee81f8e9bf | [
"Apache-2.0"
] | null | null | null | gpu_kmer_counter/__init__.py | AMR-Hackathon-2021/gpu_kmer_counter | 1818663ffd270f402da98f2dc1d010ee81f8e9bf | [
"Apache-2.0"
] | null | null | null | # vim: set fileencoding=<utf-8> :
'''Counting k-mers'''
__version__ = '0.1.0'
| 13.333333 | 33 | 0.6125 | 12 | 80 | 3.75 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0.15 | 80 | 5 | 34 | 16 | 0.602941 | 0.6 | 0 | 0 | 0 | 0 | 0.192308 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6db23d75ee6bb5052f564f917e4e881078958216 | 1,213 | py | Python | simdeblur/utils/registry.py | ljzycmd/SimDeblur | dd2f60c41176b75c4eaf80d740f547c206aa8227 | [
"MIT"
] | 190 | 2021-03-22T13:59:42.000Z | 2022-03-08T21:14:41.000Z | utils/registry.py | Wang-jiahao/SimDeblur | 31d88e1fbec91d5cc9062f4a46538e4ba806ab29 | [
"MIT"
] | 9 | 2021-04-26T06:44:40.000Z | 2022-03-25T07:48:30.000Z | utils/registry.py | Wang-jiahao/SimDeblur | 31d88e1fbec91d5cc9062f4a46538e4ba806ab29 | [
"MIT"
] | 27 | 2021-03-23T03:11:00.000Z | 2022-03-19T21:26:02.000Z | # Registry Class
# CMD
# Refer this in Detectron2
class Registry:
def __init__(self, name):
self._name = name
self._obj_map = {}
def _do_register(self, name, obj):
assert (name not in self._obj_map), "The object named: {} was already registered in {} registry! ".format(name, self._name)
self._obj_map[name] = obj
def register(self, obj=None):
"""
Register the given object under the name obj.__name__.
Can be used as either a decorator or not.
"""
if obj is None:
# used as a decorator
def deco(func_or_class):
name = func_or_class.__name__
self._do_register(name, func_or_class)
return func_or_class
return deco
name = obj.__name__
self._do_register(name, obj)
def get(self, name):
ret = self._obj_map.get(name)
if ret is None:
raise KeyError("No object names {} found in {} registry!".format(name, self._name))
return ret
def __getitem__(self, name):
return self.get(name)
def keys(self):
return self._obj_map.keys() | 28.880952 | 131 | 0.567189 | 155 | 1,213 | 4.135484 | 0.316129 | 0.087363 | 0.078003 | 0.043682 | 0.156006 | 0.087363 | 0 | 0 | 0 | 0 | 0 | 0.001255 | 0.342951 | 1,213 | 42 | 132 | 28.880952 | 0.803011 | 0.133553 | 0 | 0 | 0 | 0 | 0.098328 | 0 | 0 | 0 | 0 | 0 | 0.04 | 1 | 0.28 | false | 0 | 0 | 0.08 | 0.52 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
6db2e7696dc3317f3e448a27d94f7eaacb044544 | 2,454 | py | Python | cache_fallback/cache.py | gelo-zhukov/django-cache-fallback | 6c8d3d7469f367a7fa90c0db3c37410ff012fe46 | [
"MIT"
] | 9 | 2017-04-05T20:20:32.000Z | 2020-06-23T10:28:52.000Z | cache_fallback/cache.py | gelo-zhukov/django-cache-fallback | 6c8d3d7469f367a7fa90c0db3c37410ff012fe46 | [
"MIT"
] | 2 | 2019-08-23T06:39:36.000Z | 2021-07-21T20:25:59.000Z | cache_fallback/cache.py | gelo-zhukov/django-cache-fallback | 6c8d3d7469f367a7fa90c0db3c37410ff012fe46 | [
"MIT"
] | 4 | 2018-12-24T22:41:35.000Z | 2020-07-25T10:08:26.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import django
from django.core import signals
from django.core.cache.backends.base import BaseCache
logging.basicConfig()
logger = logging.getLogger(__name__)
def get_cache(backend, **kwargs):
from django.core import cache as dj_cache
if django.VERSION <= (1, 6):
cache = dj_cache.get_cache(backend, **kwargs)
elif django.VERSION >= (3, 2):
cache = dj_cache.caches.create_connection(backend)
else: # Django 1.7 to 3.1
cache = dj_cache._create_cache(backend, **kwargs)
# Some caches -- python-memcached in particular -- need to do a cleanup at the
# end of a request cycle. If not implemented in a particular backend
# cache.close is a no-op. Not available in Django 1.5
if hasattr(cache, "close"):
signals.request_finished.connect(cache.close)
return cache
class FallbackCache(BaseCache):
_cache = None
_cache_fallback = None
def __init__(self, params=None, *args, **kwargs):
BaseCache.__init__(self, *args, **kwargs)
self._cache = get_cache("main_cache")
self._cache_fallback = get_cache("fallback_cache")
def add(self, key, value, timeout=None, version=None):
return self._call_with_fallback(
"add", key, value, timeout=timeout, version=version
)
def get(self, key, default=None, version=None):
return self._call_with_fallback("get", key, default=default, version=version)
def set(self, key, value, timeout=None, version=None, client=None):
return self._call_with_fallback(
"set", key, value, timeout=timeout, version=version
)
def delete(self, key, version=None):
return self._call_with_fallback("delete", key, version=version)
def clear(self):
return self._call_with_fallback("clear")
def _call_with_fallback(self, method, *args, **kwargs):
try:
return self._call_main_cache(args, kwargs, method)
except Exception as e:
logger.warning("Switch to fallback cache")
logger.exception(e)
return self._call_fallback_cache(args, kwargs, method)
def _call_main_cache(self, args, kwargs, method):
return getattr(self._cache, method)(*args, **kwargs)
def _call_fallback_cache(self, args, kwargs, method):
return getattr(self._cache_fallback, method)(*args, **kwargs)
| 34.083333 | 85 | 0.674002 | 320 | 2,454 | 4.95 | 0.29375 | 0.056818 | 0.061869 | 0.056818 | 0.252525 | 0.236111 | 0.217172 | 0.111111 | 0.059343 | 0 | 0 | 0.005726 | 0.217196 | 2,454 | 71 | 86 | 34.56338 | 0.818844 | 0.095762 | 0 | 0.04 | 0 | 0 | 0.032987 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.12 | 0.14 | 0.58 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
6db7eccb741e335135250a24570eb58f17d9af90 | 395 | py | Python | UnitTests/Commands/test_remove_command.py | pinventado/Tuffix-2 | eba19ae7b48cbd05dcb26d33b76bab0ccb6ad77c | [
"MIT"
] | null | null | null | UnitTests/Commands/test_remove_command.py | pinventado/Tuffix-2 | eba19ae7b48cbd05dcb26d33b76bab0ccb6ad77c | [
"MIT"
] | 6 | 2021-07-23T23:02:33.000Z | 2022-01-27T23:04:17.000Z | UnitTests/Commands/test_remove_command.py | pinventado/Tuffix-2 | eba19ae7b48cbd05dcb26d33b76bab0ccb6ad77c | [
"MIT"
] | 1 | 2021-07-24T22:46:48.000Z | 2021-07-24T22:46:48.000Z | from Tuffix.Commands import RemoveCommand, AbstractCommand
from Tuffix.Configuration import DEFAULT_BUILD_CONFIG
import unittest
class AddCommandTest(unittest.TestCase):
# NOTE: this test has been done in Commands/test_add_remove_helper.py
def test_init(self):
try:
RemoveCommand(DEFAULT_BUILD_CONFIG)
except ValueError:
self.assertTrue(False)
| 28.214286 | 73 | 0.744304 | 46 | 395 | 6.217391 | 0.717391 | 0.06993 | 0.125874 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202532 | 395 | 13 | 74 | 30.384615 | 0.907937 | 0.16962 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
6dd287dde07e38e6aa94548ac2131d592359fc33 | 416 | py | Python | dashboard/quickstart/views.py | spkuehl/rpm-dash | dc02c6d236fbfccd41ff4a67dae39abdc28f4e0f | [
"0BSD"
] | null | null | null | dashboard/quickstart/views.py | spkuehl/rpm-dash | dc02c6d236fbfccd41ff4a67dae39abdc28f4e0f | [
"0BSD"
] | null | null | null | dashboard/quickstart/views.py | spkuehl/rpm-dash | dc02c6d236fbfccd41ff4a67dae39abdc28f4e0f | [
"0BSD"
] | null | null | null | from .models import Signal
from rest_framework import viewsets
from dashboard.quickstart.serializers import SignalSerializer
from django.utils import timezone
class SignalViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows Signal to be viewed or edited.
"""
queryset = Signal.objects.filter(
time_recieved__startswith=timezone.now().date())
serializer_class = SignalSerializer
| 29.714286 | 61 | 0.771635 | 47 | 416 | 6.723404 | 0.744681 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.161058 | 416 | 13 | 62 | 32 | 0.905444 | 0.132212 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
6de101db61b0ea4e8a42fe66e006dde08a3c6681 | 143 | py | Python | emergency_response.py | secretbetta/Jetbot | c043020da55b425ef03e7e8b7529695015fd0faf | [
"MIT"
] | null | null | null | emergency_response.py | secretbetta/Jetbot | c043020da55b425ef03e7e8b7529695015fd0faf | [
"MIT"
] | null | null | null | emergency_response.py | secretbetta/Jetbot | c043020da55b425ef03e7e8b7529695015fd0faf | [
"MIT"
] | null | null | null | '''
Created on Feb 15, 2020
@author: andre
'''
import houndify
import sys
CLIENT_ID = sys.argv[1]
CLIENT_KEY = sys.argv[2]
| 9.533333 | 25 | 0.608392 | 21 | 143 | 4.047619 | 0.761905 | 0.164706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 0.272727 | 143 | 14 | 26 | 10.214286 | 0.740385 | 0.272727 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
6de43c1059d338560af918fa6e74dd4333889cfc | 1,922 | py | Python | hooqu/analyzers/mean.py | mfcabrera/hooqu | d0216e282186540eadfbae605ded62393a10332c | [
"Apache-2.0"
] | 17 | 2020-05-01T06:32:53.000Z | 2022-03-15T20:48:05.000Z | hooqu/analyzers/mean.py | mfcabrera/hooqu | d0216e282186540eadfbae605ded62393a10332c | [
"Apache-2.0"
] | 334 | 2020-05-01T11:32:16.000Z | 2022-03-28T23:32:36.000Z | hooqu/analyzers/mean.py | mfcabrera/hooqu | d0216e282186540eadfbae605ded62393a10332c | [
"Apache-2.0"
] | 2 | 2020-11-25T12:07:52.000Z | 2021-03-04T15:51:51.000Z | from dataclasses import dataclass
from typing import Callable, List, Optional
from hooqu.analyzers.analyzer import (AggDefinition, DoubledValuedState,
StandardScanShareableAnalyzer)
from hooqu.analyzers.preconditions import has_column, is_numeric
from hooqu.dataframe import DataFrameLike
@dataclass
class MeanState(DoubledValuedState["MeanState"]):
total: float
count: int
def sum(self, other: "MeanState") -> "MeanState":
return MeanState(self.total + other.total, self.count + other.count)
def metric_value(self) -> float:
if self.count == 0:
return float("nan")
return self.total / self.count
class Mean(StandardScanShareableAnalyzer[MeanState]):
def __init__(self, column: str, where: Optional[str] = None):
super().__init__("Mean", column, where=where)
def from_aggregation_result(
self, result: DataFrameLike, offset: int = 0
) -> Optional[MeanState]:
sum_ = 0
count = 0
if len(result): # otherwise an empty dataframe
sum_ = result.loc["sum"][self.instance]
count = result.loc["count"][self.instance]
return MeanState(sum_, count)
def _aggregation_functions(self, where: Optional[str] = None) -> AggDefinition:
# Defines the aggregations to compute on the data
# TODO: Handle the ConditionalCount for a dataframe (if possible)
# in the original implementation here a Spark.Column is returned
# with using the "SUM (exp(where)) As LONG INT"
# with Pandas-like dataframe the where clause need to be evaluated
# before as the API does not get translated into SQL as with spark
return {self.instance: {"sum", "count"}}
def additional_preconditions(self) -> List[Callable[[DataFrameLike], None]]:
return [has_column(self.instance), is_numeric(self.instance)]
| 36.961538 | 83 | 0.671696 | 223 | 1,922 | 5.695067 | 0.412556 | 0.047244 | 0.028346 | 0.031496 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002717 | 0.234131 | 1,922 | 51 | 84 | 37.686275 | 0.860054 | 0.197711 | 0 | 0 | 0 | 0 | 0.032595 | 0 | 0 | 0 | 0 | 0.019608 | 0 | 1 | 0.1875 | false | 0 | 0.15625 | 0.09375 | 0.65625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
6dea1bdcce930d374d25c37fab9164d545ecc602 | 171 | py | Python | learn/bb/dictionary.py | mksy61/python | 4465feaba38df4d0f96da5ae038c0a4c383f794b | [
"CC0-1.0"
] | 1 | 2020-07-27T14:00:50.000Z | 2020-07-27T14:00:50.000Z | learn/bb/dictionary.py | mksy61/python | 4465feaba38df4d0f96da5ae038c0a4c383f794b | [
"CC0-1.0"
] | null | null | null | learn/bb/dictionary.py | mksy61/python | 4465feaba38df4d0f96da5ae038c0a4c383f794b | [
"CC0-1.0"
] | null | null | null | sayilar = {"Bir": 1, "İki": 2, "Üç": 3, "Dört": 4, "Beş": 5}
sayilar["Altı"] = 6
sayilar[43] = "fds"
print(len(sayilar))
print()
for v in sayilar.values():
print(v)
| 17.1 | 60 | 0.561404 | 30 | 171 | 3.233333 | 0.766667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057143 | 0.181287 | 171 | 9 | 61 | 19 | 0.628571 | 0 | 0 | 0 | 0 | 0 | 0.128655 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
097385f369ae547721d94f5e7392c3fd26e91aa6 | 495 | py | Python | users/models.py | shacker/tangelo | 2976b370f483cfb77eab8d8f447cb768322e2f75 | [
"BSD-2-Clause"
] | null | null | null | users/models.py | shacker/tangelo | 2976b370f483cfb77eab8d8f447cb768322e2f75 | [
"BSD-2-Clause"
] | 3 | 2021-06-04T21:42:56.000Z | 2021-09-11T06:13:43.000Z | users/models.py | shacker/tangelo | 2976b370f483cfb77eab8d8f447cb768322e2f75 | [
"BSD-2-Clause"
] | null | null | null | from django.contrib.auth.models import AbstractUser
from django.urls import reverse
from django.db import models
class User(AbstractUser):
# First Name and Last Name do not cover all name patterns
name = models.CharField(verbose_name='Name of User', blank=True, max_length=255)
class Meta:
app_label = 'users'
def __str__(self):
return self.username
def get_absolute_url(self):
return reverse('users:detail', kwargs={'username': self.username})
| 26.052632 | 84 | 0.713131 | 68 | 495 | 5.058824 | 0.632353 | 0.087209 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007557 | 0.19798 | 495 | 18 | 85 | 27.5 | 0.858942 | 0.111111 | 0 | 0 | 0 | 0 | 0.084475 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.272727 | 0.181818 | 0.909091 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
097abbfbf1ae99eeb3eb90ef6dd826995a2cc988 | 4,647 | py | Python | source/gameengine/PyDoc/API_intro.py | wycivil08/blendocv | f6cce83e1f149fef39afa8043aade9c64378f33e | [
"Unlicense"
] | 30 | 2015-01-29T14:06:05.000Z | 2022-01-10T07:47:29.000Z | source/gameengine/PyDoc/API_intro.py | ttagu99/blendocv | f6cce83e1f149fef39afa8043aade9c64378f33e | [
"Unlicense"
] | 1 | 2017-02-20T20:57:48.000Z | 2018-12-19T23:44:38.000Z | source/gameengine/PyDoc/API_intro.py | ttagu99/blendocv | f6cce83e1f149fef39afa8043aade9c64378f33e | [
"Unlicense"
] | 15 | 2015-04-23T02:38:36.000Z | 2021-03-01T20:09:39.000Z | # This is not a real module, it's simply an introductory text.
"""
The Blender Game Engine Python API Reference
============================================
See U{release notes<http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.49/Game_Engine>} for updates, changes and new functionality in the Game Engine Python API.
Blender Game Engine Modules:
----------------------------
Modules that include methods for accessing GameEngine data and functions.
- L{GameLogic} utility functons for game logic.
- L{GameKeys} keyboard input and event conversion.
- L{Rasterizer} display and rendering.
- L{GameTypes} contains all the python types spesific to the GameEngine.
Modules with documentation in progress:
---------------------
- L{VideoTexture}
- L{PhysicsConstraints}
Additional Modules:
-------------------
These modules have no GameEngine specific functionality but are useful in many cases.
- L{mathutils}
- L{Geometry}
- L{BGL}
Introduction:
=============
This reference documents the Blender Python API, a growing collection of
Python modules (libraries) that give access to part of the program's internal
data and functions.
Through scripting Blender can be extended in real-time via
U{Python <www.python.org>}, an impressive high level, multi-paradigm, open
source language. Newcomers are recommended to start with the tutorial that
comes with it.
This opens many interesting possibilities not available with logic bricks.
Game Engine API Stability:
--------------------------
When writing python scripts there are a number of situations you should avoid to prevent crashes or unstable behavior.
While the API tries to prevent problems there are some situations where error checking would be too time consuming.
Known cases:
- Memory Limits.
There is nothing stopping you from filling a list or making a string so big that that causes blender to run out of memory, in this case python should rasie a MemoryError, but its likely blender will crash before this point.
- Accessing any data that has been freed.
For instance accessing a KX_GameObject after its End Object actuator runs.
This will cause a SystemError, however for L{KX_MeshProxy}, L{KX_VertexProxy} and L{KX_VertexProxy} it will crash the blender game engine.
See: L{GameTypes.PyObjectPlus.invalid} which many types inherit.
- Mixing L{KX_GameObject} between scenes.
For instance tracking/parenting an L{KX_GameObject} object to an object from other scene.
External Modules:
-----------------
Since 2.49 support for importing modules has been added.
This allows you to import any blender textblock with a .py extension.
External python scripts may be imported as modules when the script is in the same directory as the blend file.
The current blend files path is included in the sys.path for loading modules.
All linked libraries will also be included so you can be sure when linking in assets from another blend file the scripts will load too.
A note to newbie script writers:
--------------------------------
Interpreted languages are known to be much slower than compiled code, but for
many applications the difference is negligible or acceptable. Also, with
profiling (or even simple direct timing with L{Blender.sys.time<Sys.time>}) to
identify slow areas and well thought optimizations, the speed can be
I{considerably} improved in many cases. Try some of the best BPython scripts
to get an idea of what can be done, you may be surprised.
@author: The Blender Python Team
@requires: Blender 2.49 or newer.
@version: 2.49
@see: U{www.blender.org<http://www.blender.org>}: documentation and forum
@see: U{blenderartists.org<http://blenderartists.org>}: user forum
@see: U{projects.blender.org<http://projects.blender.org>}
@see: U{www.python.org<http://www.python.org>}
@see: U{www.python.org/doc<http://www.python.org/doc>}
@see: U{Blending into Python<en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python>}: User contributed documentation, featuring a blender/python cookbook with many examples.
@note: the official version of this reference guide is only updated for each
new Blender release. But you can build the current SVN
version yourself: install epydoc, grab all files in the
source/gameengine/PyDoc/ folder of Blender's SVN and use the
epy_docgen.sh script also found there to generate the html docs.
Naturally you will also need a recent Blender binary to try the new
features. If you prefer not to compile it yourself, there is a testing
builds forum at U{blender.org<http://www.blender.org>}.
"""
| 41.864865 | 227 | 0.735528 | 700 | 4,647 | 4.864286 | 0.452857 | 0.008223 | 0.017621 | 0.011747 | 0.027019 | 0.027019 | 0 | 0 | 0 | 0 | 0 | 0.00335 | 0.164838 | 4,647 | 110 | 228 | 42.245455 | 0.874002 | 1.176888 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
098137cb53c54b8a0d66172ed89f636e8fcf36aa | 576 | py | Python | orange3/Orange/regression/base_regression.py | rgschmitz1/BioDepot-workflow-builder | f74d904eeaf91ec52ec9b703d9fb38e9064e5a66 | [
"MIT"
] | 54 | 2017-01-08T17:21:49.000Z | 2021-11-02T08:46:07.000Z | orange3/Orange/regression/base_regression.py | Synthia-3/BioDepot-workflow-builder | 4ee93abe2d79465755e82a145af3b6a6e1e79fd4 | [
"MIT"
] | 22 | 2017-03-28T06:03:14.000Z | 2021-07-28T05:43:55.000Z | orange3/Orange/regression/base_regression.py | Synthia-3/BioDepot-workflow-builder | 4ee93abe2d79465755e82a145af3b6a6e1e79fd4 | [
"MIT"
] | 21 | 2017-01-26T21:12:09.000Z | 2022-01-31T21:34:59.000Z | from Orange.base import Learner, Model, SklLearner, SklModel
__all__ = [
"LearnerRegression",
"ModelRegression",
"SklModelRegression",
"SklLearnerRegression",
]
class LearnerRegression(Learner):
learner_adequacy_err_msg = "Continuous class variable expected."
def check_learner_adequacy(self, domain):
return domain.has_continuous_class
class ModelRegression(Model):
pass
class SklModelRegression(SklModel, ModelRegression):
pass
class SklLearnerRegression(SklLearner, LearnerRegression):
__returns__ = SklModelRegression
| 20.571429 | 68 | 0.760417 | 50 | 576 | 8.46 | 0.56 | 0.070922 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164931 | 576 | 27 | 69 | 21.333333 | 0.879418 | 0 | 0 | 0.117647 | 0 | 0 | 0.182292 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.058824 | false | 0.117647 | 0.058824 | 0.058824 | 0.529412 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
09853207f905c277ef4d3d8d925d8623ab4e4cec | 261 | py | Python | week1/ex8.py | zettrider/py_ans_course | f9ae41bda235868bc31526638e69cc92f1a6346d | [
"Apache-2.0"
] | null | null | null | week1/ex8.py | zettrider/py_ans_course | f9ae41bda235868bc31526638e69cc92f1a6346d | [
"Apache-2.0"
] | null | null | null | week1/ex8.py | zettrider/py_ans_course | f9ae41bda235868bc31526638e69cc92f1a6346d | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from ciscoconfparse import CiscoConfParse
cisco_cfg = CiscoConfParse("cisco_ipsec.txt")
cry_map = cisco_cfg.find_objects(r"^crypto map CRYPTO")
for cr in cry_map:
print cr.text
for child in cr.children:
print child.text
| 21.75 | 55 | 0.739464 | 40 | 261 | 4.675 | 0.6 | 0.203209 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172414 | 261 | 11 | 56 | 23.727273 | 0.865741 | 0.076628 | 0 | 0 | 0 | 0 | 0.1375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.142857 | null | null | 0.285714 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
098725933c61800afaf348ce06f2044fdece7999 | 5,755 | py | Python | day_22/second.py | Mizux/adventofcode | 8bca6b5db1b9f2e64b4038d32680d07766d14e2d | [
"Apache-2.0"
] | 1 | 2021-12-11T19:41:25.000Z | 2021-12-11T19:41:25.000Z | day_22/second.py | Mizux/adventofcode | 8bca6b5db1b9f2e64b4038d32680d07766d14e2d | [
"Apache-2.0"
] | null | null | null | day_22/second.py | Mizux/adventofcode | 8bca6b5db1b9f2e64b4038d32680d07766d14e2d | [
"Apache-2.0"
] | 1 | 2021-12-06T12:09:44.000Z | 2021-12-06T12:09:44.000Z | #!/usr/bin/env python3.10
from collections import defaultdict
import re
FILE = 'test.txt' # sol: 39769202357779
FILE='input.txt' # sol: 1160303042684776
pattern = re.compile('(on|off) x=([-]?\d+)..([-]?\d+),y=([-]?\d+)..([-]?\d+),z=([-]?\d+)..([-]?\d+)')
def parse_input(file):
rules = []
with open(file, 'r') as f:
for line in f:
match = pattern.search(line)
#print(match)
light_on = True if match.group(1) == 'on' else False
x_min = int(match.group(2))
x_max = int(match.group(3))
y_min = int(match.group(4))
y_max = int(match.group(5))
z_min = int(match.group(6))
z_max = int(match.group(7))
#print(f'line: {light_on}, x:[{x_min},{x_max}], y:[{y_min},{y_max}], z:[{z_min},{z_max}]')
rules.append({
'on': light_on,
'x1': x_min,
'x2': x_max,
'y1': y_min,
'y2': y_max,
'z1': z_min,
'z2': z_max})
#print(f'rules: {rules}')
return rules
def parse_recipe(recipes):
state = defaultdict(int)
blocks = []
for recipe in recipes:
r = {
'x1': recipe['x1'],
'y1': recipe['y1'],
'z1': recipe['z1'],
'x2': recipe['x2'],
'y2': recipe['y2'],
'z2': recipe['z2'],
}
new_blocks = []
for b in blocks:
intersect = all([r['x1'] <= b['x2'], r['y1'] <= b['y2'], r['z1'] <= b['z2']]) and all([b['x1'] <= r['x2'], b['y1'] <= r['y2'], b['z1'] <= r['z2']])
if not intersect:
new_blocks.append(b)
continue
# x-axis
if b['x1'] <= r['x2'] <= b['x2']: # Positive direction
new_blocks.append({
'x1': r['x2']+1,
'y1': b['y1'],
'z1': b['z1'],
'x2': b['x2'],
'y2': b['y2'],
'z2': b['z2'],
})
b = {
'x1': b['x1'],
'y1': b['y1'],
'z1': b['z1'],
'x2': r['x2'],
'y2': b['y2'],
'z2': b['z2'],
}
if b['x1'] <= r['x1'] <= b['x2']: # Negative direction
new_blocks.append({
'x1': b['x1'],
'y1': b['y1'],
'z1': b['z1'],
'x2': r['x1']-1,
'y2': b['y2'],
'z2': b['z2'],
})
b = {
'x1': r['x1'],
'y1': b['y1'],
'z1': b['z1'],
'x2': b['x2'],
'y2': b['y2'],
'z2': b['z2'],
}
# y-axis
if b['y1'] <= r['y2'] <= b['y2']: # Positive direction
new_blocks.append({
'x1': b['x1'],
'y1': r['y2']+1,
'z1': b['z1'],
'x2': b['x2'],
'y2': b['y2'],
'z2': b['z2'],
})
b = {
'x1': b['x1'],
'y1': b['y1'],
'z1': b['z1'],
'x2': b['x2'],
'y2': r['y2'],
'z2': b['z2'],
}
if b['y1'] <= r['y1'] <= b['y2']: # Negative direction
new_blocks.append({
'x1': b['x1'],
'y1': b['y1'],
'z1': b['z1'],
'x2': b['x2'],
'y2': r['y1']-1,
'z2': b['z2'],
})
b = {
'x1': b['x1'],
'y1': r['y1'],
'z1': b['z1'],
'x2': b['x2'],
'y2': b['y2'],
'z2': b['z2'],
}
# z-axis
if b['z1'] <= r['z2'] <= b['z2']: # Positive direction
new_blocks.append({
'x1': b['x1'],
'y1': b['y1'],
'z1': r['z2']+1,
'x2': b['x2'],
'y2': b['y2'],
'z2': b['z2'],
})
b = {
'x1': b['x1'],
'y1': b['y1'],
'z1': b['z1'],
'x2': b['x2'],
'y2': b['y2'],
'z2': r['z2'],
}
if b['z1'] <= r['z1'] <= b['z2']: # Negative direction
new_blocks.append({
'x1': b['x1'],
'y1': b['y1'],
'z1': b['z1'],
'x2': b['x2'],
'y2': b['y2'],
'z2': r['z1']-1,
})
b = {
'x1': b['x1'],
'y1': b['y1'],
'z1': r['z1'],
'x2': b['x2'],
'y2': b['y2'],
'z2': b['z2'],
}
# Process the operation
if recipe['on'] == True:
new_blocks.append(r)
blocks = new_blocks
return blocks
def count_on(blocks):
count = 0
for b in blocks:
count += (b['x2'] - b['x1'] + 1) * (b['y2'] - b['y1'] + 1) * (b['z2'] - b['z1'] + 1)
return count
# Main
rules = parse_input(FILE)
#print(f'init: {rules}')
blocks = parse_recipe(rules)
count = count_on(blocks)
print(f'result: {count}')
| 31.448087 | 159 | 0.288271 | 595 | 5,755 | 2.72605 | 0.144538 | 0.036991 | 0.033909 | 0.043157 | 0.354501 | 0.336621 | 0.307645 | 0.300247 | 0.274969 | 0.245993 | 0 | 0.086957 | 0.504431 | 5,755 | 182 | 160 | 31.620879 | 0.481767 | 0.065334 | 0 | 0.503145 | 0 | 0.006289 | 0.095505 | 0.012684 | 0 | 0 | 0 | 0 | 0 | 1 | 0.018868 | false | 0 | 0.012579 | 0 | 0.050314 | 0.006289 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
098ac05e4a948bf2bc2c35f2a7e2f94ff80b9c25 | 926 | py | Python | callbackQuery/main.py | flifloo/teleexit | b0e64a571e590c2fac692703f12a2bd481a7c127 | [
"MIT"
] | 1 | 2022-01-31T19:27:05.000Z | 2022-01-31T19:27:05.000Z | callbackQuery/main.py | flifloo/teleexit | b0e64a571e590c2fac692703f12a2bd481a7c127 | [
"MIT"
] | null | null | null | callbackQuery/main.py | flifloo/teleexit | b0e64a571e590c2fac692703f12a2bd481a7c127 | [
"MIT"
] | null | null | null | from telegram import Update
from telegram.ext import CallbackContext, CallbackQueryHandler
from callbackQuery.create import create
from callbackQuery.data import data
from callbackQuery.edit import edit
from callbackQuery.new import new
from callbackQuery.reason import reason
from commands.start import start
def callback_query(update: Update, context: CallbackContext):
if update.callback_query.data == "home":
start(update, context)
elif update.callback_query.data == "new":
new(update, context)
elif update.callback_query.data == "data":
data(update, context)
elif update.callback_query.data == "create":
create(update, context)
elif update.callback_query.data.startswith("edit_"):
edit(update, context)
elif update.callback_query.data.startswith("reason_"):
reason(update, context)
callback_query_handler = CallbackQueryHandler(callback_query)
| 33.071429 | 62 | 0.7527 | 109 | 926 | 6.284404 | 0.220183 | 0.170803 | 0.166423 | 0.20146 | 0.321168 | 0.321168 | 0.321168 | 0.145985 | 0 | 0 | 0 | 0 | 0.161987 | 926 | 27 | 63 | 34.296296 | 0.882732 | 0 | 0 | 0 | 0 | 0 | 0.031317 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.045455 | false | 0 | 0.363636 | 0 | 0.409091 | 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 | 0 | 0 | 0 | 2 |
098d96a5cac44ff245fcaa2fb714ac1f20fff990 | 7,646 | py | Python | app/models/common.py | BasementCat/globalhack7 | 198f4a734d4f7a94c6d5e85c130f7679a2a8779d | [
"MIT"
] | null | null | null | app/models/common.py | BasementCat/globalhack7 | 198f4a734d4f7a94c6d5e85c130f7679a2a8779d | [
"MIT"
] | null | null | null | app/models/common.py | BasementCat/globalhack7 | 198f4a734d4f7a94c6d5e85c130f7679a2a8779d | [
"MIT"
] | 1 | 2018-10-15T15:12:37.000Z | 2018-10-15T15:12:37.000Z | import re
import sqlalchemy_utils as sau
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from flask_babel import lazy_gettext
from app.main import login_manager
from app.lib.storage import upload_file, file_url
import arrow
from app.main import db
USER_RESOURCE_TYPES = [
('NEED', lazy_gettext('Need')),
('HAVE', lazy_gettext('Have')),
]
PRIMARY_ROLE = [
('IN_NEED_OF_AIDE', lazy_gettext('In Need Of Aide')),
('INDIVIDUAL_HELPER', lazy_gettext('Individual Helper')),
('CORPORATE_SPONSOR', lazy_gettext('Corporate Sponsor'))
]
class TimestampMixin(object):
created_at = db.Column(sau.ArrowType(), nullable=False, index=True, default=arrow.utcnow)
updated_at = db.Column(sau.ArrowType(), nullable=False, index=True, default=arrow.utcnow, onupdate=arrow.utcnow)
class User(UserMixin, TimestampMixin, db.Model):
__tablename__ = 'users'
id = db.Column(db.BigInteger, primary_key=True)
name = db.Column(db.UnicodeText, nullable=False)
username = db.Column(db.Unicode(64), unique=True, nullable=False)
password = db.Column(db.UnicodeText, nullable=False)
email = db.Column(db.UnicodeText(), nullable=True)
phone = db.Column(db.Unicode(255), nullable=True)
secondary_phone = db.Column(db.Unicode(255), nullable=True)
bio = db.Column(db.UnicodeText, nullable=False)
association = db.Column(db.Unicode(64), nullable=True)
primary_role = db.Column(sau.ChoiceType(PRIMARY_ROLE))
language = db.Column(db.String(2), nullable=False)
country = db.Column(db.String(2), nullable=False)
picture = db.Column(db.UnicodeText())
def __setattr__(self, name, value):
if name == 'picture':
filename = '{}.{}'.format(
self.id,
value.filename.split('.')[-1]
)
super().__setattr__('picture', upload_file(value, 'user_pictures', filename))
else:
super().__setattr__(name, value)
@property
def picture_url(self):
if not self.picture:
return None
return file_url(self.picture)
@login_manager.user_loader
def load_user(id):
return User.query.get(int(id))
def set_password(self, password):
self.password = generate_password_hash(password)
def check_password(self, password):
return check_password_hash(self.password, password)
@property
def resources_needed(self):
resources_needed = []
for resource in Resource.query.filter(Resource.user_id==self.id, Resource.type=='NEEDED'):
resources_needed.append(resource.name)
return ", ".join(resources_needed)
class Category(db.Model):
__tablename__ = 'categories'
id = db.Column(db.BigInteger, primary_key=True)
parent_id = db.Column(db.BigInteger, db.ForeignKey('categories.id', onupdate='CASCADE', ondelete='CASCADE'))
parent = db.relationship('Category', foreign_keys=[parent_id], remote_side=[id], backref='children')
name = db.Column(db.UnicodeText(), nullable=False)
fontawesome_icon = db.Column(db.UnicodeText())
linecon_icon = db.Column(db.UnicodeText())
@property
def fontawesome_icons(self):
if self.fontawesome_icon is None:
return ''
return list(re.split(r',\s*', self.fontawesome_icon))
@property
def fontawesome_icon_classes(self):
if self.fontawesome_icon is None:
return ''
return ['fas fa-' + i for i in re.split(r',\s*', self.fontawesome_icon)]
@property
def linecon_icons(self):
if self.linecon_icon is None:
return ''
return list(re.split(r',\s*', self.linecon_icon))
@property
def linecon_icon_classes(self):
if self.linecon_icon is None:
return ''
return ['linecon li_' + i for i in re.split(r',\s*', self.linecon_icon)]
class Resource(TimestampMixin, db.Model):
__tablename__ = 'resources'
id = db.Column(db.BigInteger, primary_key=True)
category_id = db.Column(db.BigInteger, db.ForeignKey('categories.id', onupdate='CASCADE', ondelete='RESTRICT'), nullable=False)
category = db.relationship('Category', backref='resources')
user_id = db.Column(db.BigInteger, db.ForeignKey('users.id', onupdate='CASCADE', ondelete='CASCADE'), nullable=False)
user = db.relationship('User', backref='resources')
description = db.Column(db.UnicodeText(), nullable=True)
type = db.Column(sau.ChoiceType(USER_RESOURCE_TYPES), index=True)
quantity_available = db.Column(db.BigInteger)
quantity_needed = db.Column(db.BigInteger)
fulfilled = db.Column(db.Boolean, nullable=False, default=False, server_default='0')
name = db.Column(db.UnicodeText(), nullable=False)
picture = db.Column(db.UnicodeText())
requested = db.Column(db.Boolean(), nullable=True, default=False)
def __setattr__(self, name, value):
if name == 'picture':
if value:
filename = '{}.{}'.format(
self.id,
value.filename.split('.')[-1]
)
super().__setattr__('picture', upload_file(value, 'resource_pictures', filename))
else:
super().__setattr__(name, value)
@property
def picture_url(self):
if not self.picture:
return None
return file_url(self.picture)
@property
def quantity_remaining(self):
if self.type != 'HAVE':
return None
fulfillment = ResourceFulfillment.query.filter(
ResourceFulfillment.fulfilling_resource == self,
ResourceFulfillment.confirmed_by_recipient == True,
)
return self.quantity_available - sum([f.fulfilled_quantity for f in fulfillment])
@property
def quantity_fulfilled(self):
if self.type != 'NEED':
return None
fulfillment = ResourceFulfillment.query.filter(
ResourceFulfillment.fulfilled_resource == self,
ResourceFulfillment.confirmed_by_recipient == True,
)
return self.quantity_needed - sum([f.fulfilled_quantity for f in fulfillment])
def serialize(self):
return {
'id': self.id,
'name': self.name,
'category': self.category.name,
'user_id': self.user.id,
'type': self.type.code,
'quantity_available': self.quantity_available,
'quantity_needed': self.quantity_needed,
'fulfilled': self.fulfilled,
}
class ResourceFulfillment(TimestampMixin, db.Model):
__tablename__ = 'user_resource_fulfillment'
id = db.Column(db.BigInteger, primary_key=True)
fulfilling_resource_id = db.Column(db.BigInteger, db.ForeignKey('resources.id', onupdate='CASCADE', ondelete='RESTRICT'), nullable=False)
fulfilling_resource = db.relationship('Resource', foreign_keys=[fulfilling_resource_id])
fulfilled_resource_id = db.Column(db.BigInteger, db.ForeignKey('resources.id', onupdate='CASCADE', ondelete='RESTRICT'), nullable=False)
fulfilled_resource = db.relationship('Resource', foreign_keys=[fulfilled_resource_id])
fulfilled_quantity = db.Column(db.BigInteger, nullable=False)
confirmed_by_recipient = db.Column(db.Boolean, nullable=False, default=False, server_default='0')
Resource.fulfilled_by = db.relationship(
'Resource',
secondary=ResourceFulfillment.__table__,
primaryjoin=Resource.id == ResourceFulfillment.fulfilled_resource_id,
secondaryjoin=ResourceFulfillment.fulfilling_resource_id == Resource.id,
backref='fulfills'
)
| 36.759615 | 141 | 0.671201 | 889 | 7,646 | 5.584927 | 0.181102 | 0.058006 | 0.064451 | 0.048338 | 0.520645 | 0.485599 | 0.442095 | 0.352064 | 0.278348 | 0.23565 | 0 | 0.002635 | 0.205859 | 7,646 | 207 | 142 | 36.937198 | 0.815053 | 0 | 0 | 0.319277 | 1 | 0 | 0.073372 | 0.00327 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090361 | false | 0.036145 | 0.054217 | 0.018072 | 0.566265 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
098e4e8b118b552d15dacaf33659bd91d618172d | 132 | py | Python | captcha_recog/config.py | VrunArya/Hacktoberfest2021 | 5e739e52310dabf8b131abe5ecf906e13711b9d6 | [
"MIT"
] | 1 | 2021-10-02T07:12:54.000Z | 2021-10-02T07:12:54.000Z | captcha_recog/config.py | VrunArya/Hacktoberfest2021 | 5e739e52310dabf8b131abe5ecf906e13711b9d6 | [
"MIT"
] | null | null | null | captcha_recog/config.py | VrunArya/Hacktoberfest2021 | 5e739e52310dabf8b131abe5ecf906e13711b9d6 | [
"MIT"
] | 1 | 2021-10-05T09:55:35.000Z | 2021-10-05T09:55:35.000Z | DATA_DIR = "data/captcha_images_v2"
BATCH_SIZE = 8
IMAGE_WIDTH = 300
IMAGE_HEIGHT = 75
NUM_WORKERS = 8
EPOCHS = 200
DEVICE = "cuda"
| 16.5 | 35 | 0.75 | 22 | 132 | 4.181818 | 0.863636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099099 | 0.159091 | 132 | 7 | 36 | 18.857143 | 0.72973 | 0 | 0 | 0 | 0 | 0 | 0.19697 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
099df04b51f1d4c4e0b8f7ba26b88785c5dad234 | 1,828 | py | Python | horizon/horizon/dashboards/syspanel/instances/views.py | citrix-openstack/horizon | 7987e68f135895728f891c2377b589f701d8106e | [
"Apache-2.0"
] | 2 | 2015-05-18T13:50:21.000Z | 2015-05-18T14:47:47.000Z | horizon/horizon/dashboards/syspanel/instances/views.py | andrewsmedina/horizon | 6892653c0573a6a55f359cce6c1796053ef65cbf | [
"Apache-2.0"
] | null | null | null | horizon/horizon/dashboards/syspanel/instances/views.py | andrewsmedina/horizon | 6892653c0573a6a55f359cce6c1796053ef65cbf | [
"Apache-2.0"
] | null | null | null | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import datetime
import logging
from django import template
from django import http
from django.conf import settings
from django.contrib import messages
from django.shortcuts import render_to_response, redirect
from django.utils.translation import ugettext as _
from horizon import api
from horizon import exceptions
from horizon import forms
from horizon import tables
from horizon.dashboards.nova.instances_and_volumes \
.instances.tables import InstancesTable
from horizon.dashboards.nova.instances_and_volumes \
.instances.views import console, DetailView, vnc
LOG = logging.getLogger(__name__)
class AdminIndexView(tables.DataTableView):
table_class = InstancesTable
template_name = 'syspanel/instances/index.html'
def get_data(self):
instances = []
try:
instances = api.admin_server_list(self.request)
except:
exceptions.handle(self.request,
_('Unable to retrieve instance list.'))
return instances
| 32.642857 | 78 | 0.742341 | 236 | 1,828 | 5.677966 | 0.572034 | 0.044776 | 0.050746 | 0.023881 | 0.079104 | 0.079104 | 0.079104 | 0.079104 | 0 | 0 | 0 | 0.010239 | 0.198578 | 1,828 | 55 | 79 | 33.236364 | 0.904437 | 0.421225 | 0 | 0.071429 | 0 | 0 | 0.059673 | 0.027911 | 0 | 0 | 0 | 0 | 0 | 1 | 0.035714 | false | 0 | 0.5 | 0 | 0.678571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
099ffe8299d6314f67a947a7f1cb3e9fa8801f30 | 2,241 | py | Python | 2020-11/201612226.py | Jeanca64091/CoronavirusML | 867f8e72579c60001719ede7211b86743c669fe6 | [
"Apache-2.0"
] | null | null | null | 2020-11/201612226.py | Jeanca64091/CoronavirusML | 867f8e72579c60001719ede7211b86743c669fe6 | [
"Apache-2.0"
] | null | null | null | 2020-11/201612226.py | Jeanca64091/CoronavirusML | 867f8e72579c60001719ede7211b86743c669fe6 | [
"Apache-2.0"
] | null | null | null | from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.pipeline import make_pipeline
import matplotlib.pyplot as plt
import numpy as np
import random
#===============================================================================================#
# Number of cases per day of covid 19 in the US for 218 days
cases = [
1,0,1,0,3,0,0,0,0,2,1,0,3,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,8,6,23,25,
20,66,47,64,147,225,290,278,414,267,338,1237,755,2797,3419,4777,3528,5836,8821,10934,
10115,13987,16916,17965,19332,18251,22635,22562,27043,26135,34864,30683,26065,43438,
21597,31534,31705,33251,33288,29145,24156,26385,27158,29164,29002,29916,25995,29468,
26490,25858,37144,29873,33161,29256,23371,23901,25512,31787,30369,29794,29763,19138,
22303,23366,30861,25996,26660,23792,18106,21467,20869,27191,22977,31967,13284,24481,
23405,22860,20522,24268,26229,15342,24958,16429,19680,21304,18123,23553,26177,14790,
24955,14676,20555,29034,29214,17919,17598,17376,20486,21744,22317,25468,21957,18577,
28392,22834,27828,32218,32411,27616,26657,34313,37667,40588,44602,44703,41390,35664,
43644,54357,52730,57718,52228,44361,46329,50304,64771,59260,66281,62918,60469,58858,
60971,67404,72045,74710,67574,63201,57777,63028,70106,72219,74818,64582,61795,54448,
59862,65935,68042,68605,58947,47576,49716,49988,53685,55836,62042,54590,48690,40522,
55540,56307,52799,56729,54686,41893,38986,39318,46500,44864,46754,45265,38679,33076,
37086,46393
]
days = list(range(len(cases)))
print(len(days))
days = np.asarray(days)
cases = np.asarray(cases)
days = days[:, np.newaxis]
cases = cases[:, np.newaxis]
plt.scatter(days, cases)
plt.show()
xseq = np.linspace(days.min(), days.max(), 300).reshape(-1,1)
regr = make_pipeline(PolynomialFeatures(12), LinearRegression())
regr.fit(days, cases)
plt.scatter(days, cases)
plt.plot(xseq, regr.predict(xseq), color = "red")
plt.show()
#===============================================================================================#
# Ref
# https://espanol.cdc.gov/coronavirus/2019-ncov/cases-updates/previouscases.html | 40.745455 | 97 | 0.688532 | 347 | 2,241 | 4.429395 | 0.726225 | 0.024723 | 0.029278 | 0.028627 | 0.051399 | 0.02147 | 0.02147 | 0 | 0 | 0 | 0 | 0.439166 | 0.079429 | 2,241 | 55 | 98 | 40.745455 | 0.305865 | 0.148148 | 0 | 0.108108 | 0 | 0 | 0.001576 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.189189 | 0 | 0.189189 | 0.027027 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
09a4ac343589822a5305a9c2acc5a501db4c1e59 | 547 | py | Python | common/utils_3dhp.py | paTRICK-swk/P-STMO | def1bff3fcc4f1e3b1dd69c8d3c2d77f412e3b75 | [
"MIT"
] | 8 | 2022-03-16T02:55:45.000Z | 2022-03-31T08:29:05.000Z | common/utils_3dhp.py | paTRICK-swk/P-STMO | def1bff3fcc4f1e3b1dd69c8d3c2d77f412e3b75 | [
"MIT"
] | 2 | 2022-03-24T23:29:23.000Z | 2022-03-31T02:59:39.000Z | common/utils_3dhp.py | paTRICK-swk/P-STMO | def1bff3fcc4f1e3b1dd69c8d3c2d77f412e3b75 | [
"MIT"
] | null | null | null |
def mpii_get_sequence_info(subject_id, sequence):
switcher = {
"1 1": [6416,25],
"1 2": [12430,50],
"2 1": [6502,25],
"2 2": [6081,25],
"3 1": [12488,50],
"3 2": [12283,50],
"4 1": [6171,25],
"4 2": [6675,25],
"5 1": [12820,50],
"5 2": [12312,50],
"6 1": [6188,25],
"6 2": [6145,25],
"7 1": [6239,25],
"7 2": [6320,25],
"8 1": [6468,25],
"8 2": [6054,25],
}
return switcher.get(subject_id+" "+sequence)
| 21.88 | 49 | 0.400366 | 79 | 547 | 2.708861 | 0.443038 | 0.084112 | 0.158879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.385507 | 0.369287 | 547 | 24 | 50 | 22.791667 | 0.234783 | 0 | 0 | 0 | 0 | 0 | 0.089908 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
09c814c7aea614c441a0a6a893a470b943e5d70c | 271 | py | Python | core/src/zeit/magazin/sources.py | rickdg/vivi | 16134ac954bf8425646d4ad47bdd1f372e089355 | [
"BSD-3-Clause"
] | 5 | 2019-05-16T09:51:29.000Z | 2021-05-31T09:30:03.000Z | core/src/zeit/magazin/sources.py | rickdg/vivi | 16134ac954bf8425646d4ad47bdd1f372e089355 | [
"BSD-3-Clause"
] | 107 | 2019-05-24T12:19:02.000Z | 2022-03-23T15:05:56.000Z | core/src/zeit/magazin/sources.py | rickdg/vivi | 16134ac954bf8425646d4ad47bdd1f372e089355 | [
"BSD-3-Clause"
] | 3 | 2020-08-14T11:01:17.000Z | 2022-01-08T17:32:19.000Z | import zeit.cms.content.sources
class ArticleRelatedLayoutSource(zeit.cms.content.sources.XMLSource):
product_configuration = 'zeit.magazin'
config_url = 'article-related-layout-source'
default_filename = 'article-related-layouts.xml'
attribute = 'id'
| 27.1 | 69 | 0.763838 | 30 | 271 | 6.8 | 0.766667 | 0.068627 | 0.137255 | 0.205882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129151 | 271 | 9 | 70 | 30.111111 | 0.864407 | 0 | 0 | 0 | 0 | 0 | 0.258303 | 0.206642 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
09cdc16d65291b7b356c72e8d1d476848e4493e6 | 259 | py | Python | Table.py | JonLinC07/Poker | f21ea29acb5a9e674c665cf56033471634955e68 | [
"MIT"
] | null | null | null | Table.py | JonLinC07/Poker | f21ea29acb5a9e674c665cf56033471634955e68 | [
"MIT"
] | null | null | null | Table.py | JonLinC07/Poker | f21ea29acb5a9e674c665cf56033471634955e68 | [
"MIT"
] | null | null | null | from Dealer import Dealer
from Player import Player
from Card import Card
class Table:
def __init__(self, players, board=[], pot=0):
self.players = players
self.board = board
self.pot = pot
# def table_status(self):
| 19.923077 | 49 | 0.633205 | 34 | 259 | 4.676471 | 0.441176 | 0.138365 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005405 | 0.285714 | 259 | 12 | 50 | 21.583333 | 0.854054 | 0.088803 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
09d9cf43b5503d0e1289a2df3dc734e71d874729 | 161 | py | Python | teste.py | lucascz37/PySoccer | b2b5c63bf0ca42f8769487db7bf0a8441e0f8394 | [
"MIT"
] | null | null | null | teste.py | lucascz37/PySoccer | b2b5c63bf0ca42f8769487db7bf0a8441e0f8394 | [
"MIT"
] | null | null | null | teste.py | lucascz37/PySoccer | b2b5c63bf0ca42f8769487db7bf0a8441e0f8394 | [
"MIT"
] | null | null | null | from PySoccer.leagues.LeagueBase import LeagueBase
league = LeagueBase()
test = league.leaderboard('italy_serie_a')
for t in test.teams:
print(t)
| 17.888889 | 51 | 0.720497 | 21 | 161 | 5.428571 | 0.761905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186335 | 161 | 8 | 52 | 20.125 | 0.870229 | 0 | 0 | 0 | 0 | 0 | 0.084967 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
09db292e9170fbc513fb4bd34e8dd9a65bdde4cd | 3,966 | py | Python | simplemooc/accounts/models.py | WesGtoX/simplemooc | efb50bc3cad54386286d46ece296b85f737ad005 | [
"MIT"
] | 3 | 2018-08-14T19:59:35.000Z | 2021-05-14T19:06:49.000Z | simplemooc/accounts/models.py | WesGtoX/simplemooc | efb50bc3cad54386286d46ece296b85f737ad005 | [
"MIT"
] | 4 | 2021-02-16T14:13:36.000Z | 2021-05-04T14:06:20.000Z | simplemooc/accounts/models.py | WesGtoX/simplemooc | efb50bc3cad54386286d46ece296b85f737ad005 | [
"MIT"
] | 2 | 2021-05-14T18:02:21.000Z | 2022-01-15T01:16:05.000Z | import re
from django.db import models
from django.core import validators
from django.conf import settings
from django.contrib.auth.models import (
AbstractBaseUser, PermissionsMixin, UserManager
)
class User(AbstractBaseUser, PermissionsMixin):
# Nome de usuário padrão, que também é único.
username = models.CharField(
'Nome de Usuário', max_length=30, unique=True,
# Valida se o nome de usuário recebeu os caracteres permitidos.
validators=[validators.RegexValidator(
re.compile('^[\w.@+-]+$'),
'O nome de usuário só pode conter letras, dígitos ou os seguintes caracteres: @/./+/-/_', 'invalid'
)]
)
# E-mail que nesse caso é único, é a grande diferença para o do Django.
email = models.EmailField('E-mail', unique=True)
# Campo do nome completo que vai ser opcional, ao invés de 'first_name' e 'last_name'.
name = models.CharField('Nome', max_length=100, blank=True)
# Vai verificar se o usuário está ativo e para logar, por padrão é 'True'.
is_active = models.BooleanField('Está ativo?', blank=True, default=True)
# Para o Django 'admin' saber se ele pode acessar a área administrativa,
# se é da equipe administrativa, por padrão é 'False'.
is_staff = models.BooleanField('É da equipe?', blank=True, default=False)
# Essa data é importante na criação do 'superuser', é uma recomendação para ser compatível com a 'app' Django.
date_joined = models.DateTimeField('Data de Entrada', auto_now_add=True)
# O 'manager' que tem algumas coisas úteis para nós.
objects = UserManager()
# Para ser compátivel com alguns comandos e algumas outras coisas do Django, 'app' de usuário.
# Indica o campo que é único e vai ser a referência na hora do 'login'.
# Por padrão é 'login', poderia ser o 'email'.
USERNAME_FIELD = 'username'
# Utilizado no comando de criação 'superusuario', vai utilizar esse comando porque vai precisar
# apagar o banco de dados, e vamos criar outro usuário atráves desse comando.
REQUIRED_FIELDS = ['email']
def __str__(self):
"""
Esse método é a representação do 'skin' do usuário.
Se tiver 'name', retorna o nome, caso contrário retorna o 'username'.
"""
return self.name or self.username
def get_short_name(self):
"""
A 'app' de usuário de Django também pega as implementações de alguns métodos,
não é obrigatório, mas é interessante para funcionamento do 'admin'.
:self.username: descrição curta do nome.
"""
return self.username
def get_full_name(self):
"""
O 'fullname' é a representação 'string' do próprio objeto.
"""
return str(self)
class Meta:
verbose_name = 'Usuário'
verbose_name_plural = 'Usuários'
class PasswordReset(models.Model):
"""
Esse 'model' tem um relacionamento de 'n' para '1' com o usuário,
o usuário pode ter um ou mais 'PasswordReset'.
"""
user = models.ForeignKey(
settings.AUTH_USER_MODEL, verbose_name='Usuário',
# 'on_delete' é obrigatório no Django 2.0.
related_name='resets', on_delete=models.CASCADE
)
key = models.CharField('Chave', max_length=100, unique=True)
# Vou permitir que esse usuário clique nesse 'link' randômico, em no máximo 2 horas.
created_at = models.DateTimeField('Criado em', auto_now_add=True)
# Vai indicar se o 'link' foi usado.
confirmed = models.BooleanField('Confirmado?', default=False, blank=True)
def __str__(self):
return '{0} em {1}'.format(self.user, self.created_at)
class Meta:
verbose_name = 'Nova Senha'
verbose_name_plural = 'Novas Senhas'
# Parâmetro da classe 'Meta' do 'model' que pode indicar qual o ordenamento,
# uma lista de atributos do 'model', que servirão para ordenamento padrão, default.
ordering = ['-created_at']
| 38.882353 | 114 | 0.671962 | 532 | 3,966 | 4.930451 | 0.422932 | 0.020587 | 0.019825 | 0.010675 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004613 | 0.234745 | 3,966 | 101 | 115 | 39.267327 | 0.859638 | 0.452849 | 0 | 0.086957 | 0 | 0 | 0.13536 | 0 | 0 | 0 | 0 | 0.019802 | 0 | 1 | 0.086957 | false | 0.021739 | 0.108696 | 0.021739 | 0.652174 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
09dc60632198a8f60b1707b16f3290811c0d09e3 | 847 | py | Python | project/migrations/0007_auto_20210910_1326.py | RawAnimal/esm | 9a83a2580940f2efd642882cad46745a8d88c9ca | [
"MIT"
] | null | null | null | project/migrations/0007_auto_20210910_1326.py | RawAnimal/esm | 9a83a2580940f2efd642882cad46745a8d88c9ca | [
"MIT"
] | null | null | null | project/migrations/0007_auto_20210910_1326.py | RawAnimal/esm | 9a83a2580940f2efd642882cad46745a8d88c9ca | [
"MIT"
] | null | null | null | # Generated by Django 3.2.7 on 2021-09-10 17:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project', '0006_auto_20210910_1323'),
]
operations = [
migrations.AlterField(
model_name='project',
name='project_address1',
field=models.CharField(max_length=100, verbose_name='Address'),
),
migrations.AlterField(
model_name='project',
name='project_address2',
field=models.CharField(blank=True, max_length=100, null=True, verbose_name=' '),
),
migrations.AlterField(
model_name='project',
name='project_details',
field=models.TextField(default=1, verbose_name='Details'),
preserve_default=False,
),
]
| 28.233333 | 92 | 0.596222 | 85 | 847 | 5.764706 | 0.552941 | 0.134694 | 0.153061 | 0.177551 | 0.287755 | 0.287755 | 0.287755 | 0 | 0 | 0 | 0 | 0.066335 | 0.288076 | 847 | 29 | 93 | 29.206897 | 0.746269 | 0.053129 | 0 | 0.391304 | 1 | 0 | 0.14125 | 0.02875 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.043478 | 0 | 0.173913 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
61cc9df6f156945b8303de5779f2b92212fe3b25 | 2,293 | py | Python | backtester/strategy/strategy.py | unbalancedparentheses/backtester_options | 46efd30e405f360c560f8eae8b2ee7d26f4532db | [
"MIT"
] | 91 | 2020-01-31T10:15:35.000Z | 2022-03-27T19:15:12.000Z | backtester/strategy/strategy.py | unbalancedparentheses/backtester_options | 46efd30e405f360c560f8eae8b2ee7d26f4532db | [
"MIT"
] | 38 | 2019-05-12T02:00:46.000Z | 2019-12-06T14:54:25.000Z | backtester/strategy/strategy.py | unbalancedparentheses/backtester_options | 46efd30e405f360c560f8eae8b2ee7d26f4532db | [
"MIT"
] | 20 | 2020-06-12T08:21:30.000Z | 2022-03-28T05:52:59.000Z | import math
import numpy as np
class Strategy:
"""Options strategy class.
Takes in a number of `StrategyLeg`'s (option contracts), and filters that determine
entry and exit conditions.
"""
def __init__(self, schema):
self.schema = schema
self.legs = []
self.conditions = []
self.exit_thresholds = (math.inf, math.inf)
def add_leg(self, leg):
"""Adds leg to the strategy"""
assert self.schema == leg.schema
leg.name = "leg_{}".format(len(self.legs) + 1)
self.legs.append(leg)
return self
def add_legs(self, legs):
"""Adds legs to the strategy"""
for leg in legs:
self.add_leg(leg)
return self
def remove_leg(self, leg_number):
"""Removes leg from the strategy"""
self.legs.pop(leg_number)
return self
def clear_legs(self):
"""Removes *all* legs from the strategy"""
self.legs = []
return self
def add_exit_thresholds(self, profit_pct=math.inf, loss_pct=math.inf):
"""Adds maximum profit/loss thresholds. Both **must** be >= 0.0
Args:
profit_pct (float, optional): Max profit level. Defaults to math.inf
loss_pct (float, optional): Max loss level. Defaults to math.inf
"""
assert profit_pct >= 0
assert loss_pct >= 0
self.exit_thresholds = (profit_pct, loss_pct)
def filter_thresholds(self, entry_cost, current_cost):
"""Returns a `pd.Series` of booleans indicating where profit (loss) levels
exceed the given thresholds.
Args:
entry_cost (pd.Series): Total _entry_ cost of inventory row.
current_cost (pd.Series): Present cost of inventory row.
Returns:
pd.Series: Indicator series with `True` for every row that
exceeds the specified profit/loss thresholds.
"""
profit_pct, loss_pct = self.exit_thresholds
excess_return = (current_cost / entry_cost + 1) * -np.sign(entry_cost)
return (excess_return >= profit_pct) | (excess_return <= -loss_pct)
def __repr__(self):
return "Strategy(legs={}, exit_thresholds={})".format(self.legs, self.exit_thresholds)
| 31.847222 | 94 | 0.607501 | 289 | 2,293 | 4.653979 | 0.307958 | 0.041636 | 0.053532 | 0.023792 | 0.105576 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003688 | 0.290449 | 2,293 | 71 | 95 | 32.295775 | 0.822987 | 0.369821 | 0 | 0.181818 | 0 | 0 | 0.033128 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 1 | 0.242424 | false | 0 | 0.060606 | 0.030303 | 0.515152 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
61f2b6b55f738de90527182108f47ce238ae647d | 7,018 | py | Python | corehq/warehouse/migrations/0001_initial.py | dborowiecki/commcare-hq | f2f4fa67faec09040a98502f5657444075b63f2e | [
"BSD-3-Clause"
] | null | null | null | corehq/warehouse/migrations/0001_initial.py | dborowiecki/commcare-hq | f2f4fa67faec09040a98502f5657444075b63f2e | [
"BSD-3-Clause"
] | null | null | null | corehq/warehouse/migrations/0001_initial.py | dborowiecki/commcare-hq | f2f4fa67faec09040a98502f5657444075b63f2e | [
"BSD-3-Clause"
] | null | null | null | # Generated by Django 1.10.7 on 2017-05-16 11:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='DomainDim',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain', models.CharField(max_length=255)),
('dim_last_modified', models.DateTimeField(auto_now=True)),
('dim_created_on', models.DateTimeField(auto_now_add=True)),
('domain_id', models.CharField(max_length=255)),
('default_timezone', models.CharField(max_length=255)),
('hr_name', models.CharField(max_length=255)),
('creating_user_id', models.CharField(max_length=255)),
('project_type', models.CharField(max_length=255)),
('is_active', models.BooleanField()),
('case_sharing', models.BooleanField()),
('commtrack_enabled', models.BooleanField()),
('is_test', models.BooleanField()),
('location_restriction_for_users', models.BooleanField()),
('use_sql_backend', models.BooleanField()),
('first_domain_for_user', models.BooleanField()),
('domain_last_modified', models.DateTimeField()),
('domain_created_on', models.DateTimeField()),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='GroupDim',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain', models.CharField(max_length=255)),
('dim_last_modified', models.DateTimeField(auto_now=True)),
('dim_created_on', models.DateTimeField(auto_now_add=True)),
('group_id', models.CharField(max_length=255)),
('name', models.CharField(max_length=255)),
('case_sharing', models.BooleanField()),
('reporting', models.BooleanField()),
('group_last_modified', models.DateTimeField()),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='LocationDim',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain', models.CharField(max_length=255)),
('dim_last_modified', models.DateTimeField(auto_now=True)),
('dim_created_on', models.DateTimeField(auto_now_add=True)),
('location_id', models.CharField(max_length=100)),
('name', models.CharField(max_length=255)),
('site_code', models.CharField(max_length=255)),
('external_id', models.CharField(max_length=255)),
('supply_point_id', models.CharField(max_length=255, null=True)),
('location_type_id', models.CharField(max_length=255)),
('location_type_name', models.CharField(max_length=255)),
('location_type_code', models.CharField(max_length=255)),
('is_archived', models.BooleanField()),
('latitude', models.DecimalField(decimal_places=10, max_digits=20, null=True)),
('longitude', models.DecimalField(decimal_places=10, max_digits=20, null=True)),
('location_last_modified', models.DateTimeField()),
('location_created_on', models.DateTimeField()),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='TableState',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.CharField(max_length=255)),
('last_modified', models.DateTimeField(auto_now=True)),
('last_batch_id', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='UserDim',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain', models.CharField(max_length=255)),
('dim_last_modified', models.DateTimeField(auto_now=True)),
('dim_created_on', models.DateTimeField(auto_now_add=True)),
('user_id', models.CharField(max_length=255)),
('username', models.CharField(max_length=150)),
('first_name', models.CharField(max_length=30)),
('last_name', models.CharField(max_length=30)),
('email', models.CharField(max_length=255)),
('user_type', models.CharField(max_length=100)),
('is_active', models.BooleanField()),
('is_staff', models.BooleanField()),
('is_superuser', models.BooleanField()),
('last_login', models.DateTimeField()),
('date_joined', models.DateTimeField()),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='UserGroupDim',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain', models.CharField(max_length=255)),
('dim_last_modified', models.DateTimeField(auto_now=True)),
('dim_created_on', models.DateTimeField(auto_now_add=True)),
('group_dim', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='warehouse.GroupDim')),
('user_dim', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='warehouse.UserDim')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='UserLocationDim',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain', models.CharField(max_length=255)),
('dim_last_modified', models.DateTimeField(auto_now=True)),
('dim_created_on', models.DateTimeField(auto_now_add=True)),
('location_dim', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='warehouse.LocationDim')),
('user_dim', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='warehouse.UserDim')),
],
options={
'abstract': False,
},
),
]
| 48.736111 | 125 | 0.560701 | 658 | 7,018 | 5.738602 | 0.170213 | 0.115201 | 0.138242 | 0.184322 | 0.735699 | 0.697299 | 0.58554 | 0.536282 | 0.502383 | 0.502383 | 0 | 0.02215 | 0.298803 | 7,018 | 143 | 126 | 49.076923 | 0.745174 | 0.006555 | 0 | 0.536765 | 1 | 0 | 0.149067 | 0.013486 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.014706 | 0 | 0.044118 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
61f34ea7a15548f7cd73bed1e05623774c51b0cc | 76 | py | Python | Curso_Python/laco_for.py | FranciscoCabrita1/Cabrita | af9dfb12dbc64cf6181d4e906156170c5449877e | [
"MIT"
] | 5 | 2020-08-24T23:29:58.000Z | 2022-02-07T19:58:07.000Z | Curso_Python/laco_for.py | lulavalenca/Curso-Completo-de-Python-no-Youtube | af9dfb12dbc64cf6181d4e906156170c5449877e | [
"MIT"
] | null | null | null | Curso_Python/laco_for.py | lulavalenca/Curso-Completo-de-Python-no-Youtube | af9dfb12dbc64cf6181d4e906156170c5449877e | [
"MIT"
] | 2 | 2020-08-24T23:30:06.000Z | 2021-12-23T18:23:38.000Z |
numeros = []
for n in range(1,101):
numeros.append(n)
print(numeros) | 9.5 | 22 | 0.631579 | 12 | 76 | 4 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 0.210526 | 76 | 8 | 23 | 9.5 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
110ff37f51555b75f1b11fc6d0a48e614705c489 | 540 | py | Python | tests/r/test_lost_letter.py | hajime9652/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | [
"Apache-2.0"
] | 199 | 2017-07-24T01:34:27.000Z | 2022-01-29T00:50:55.000Z | tests/r/test_lost_letter.py | hajime9652/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | [
"Apache-2.0"
] | 46 | 2017-09-05T19:27:20.000Z | 2019-01-07T09:47:26.000Z | tests/r/test_lost_letter.py | hajime9652/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | [
"Apache-2.0"
] | 45 | 2017-07-26T00:10:44.000Z | 2022-03-16T20:44:59.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.lost_letter import lost_letter
def test_lost_letter():
"""Test module lost_letter.py by downloading
lost_letter.csv and testing shape of
extracted data has 140 rows and 8 columns
"""
test_path = tempfile.mkdtemp()
x_train, metadata = lost_letter(test_path)
try:
assert x_train.shape == (140, 8)
except:
shutil.rmtree(test_path)
raise()
| 22.5 | 50 | 0.764815 | 78 | 540 | 4.961538 | 0.538462 | 0.155039 | 0.124031 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017897 | 0.172222 | 540 | 23 | 51 | 23.478261 | 0.847875 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 1 | 0.066667 | false | 0 | 0.466667 | 0 | 0.533333 | 0.066667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
1143db13c90464fbd2749970c59b6335a3621bac | 472 | py | Python | exercices/atbash-cipher/atbash_cipher.py | gkaeso/exercism-python | 00360effcc1eceadfdf6e342ff52bd6284b9bc87 | [
"MIT"
] | null | null | null | exercices/atbash-cipher/atbash_cipher.py | gkaeso/exercism-python | 00360effcc1eceadfdf6e342ff52bd6284b9bc87 | [
"MIT"
] | null | null | null | exercices/atbash-cipher/atbash_cipher.py | gkaeso/exercism-python | 00360effcc1eceadfdf6e342ff52bd6284b9bc87 | [
"MIT"
] | null | null | null | from string import ascii_lowercase
BLOCK_SIZE = 5
def _cipher(text):
translation_table = str.maketrans(ascii_lowercase, ascii_lowercase[::-1])
return ''.join([c.translate(translation_table) for c in text.replace(' ', '').lower() if c.isalnum()])
def encode(plain_text):
encoded = _cipher(plain_text)
return ' '.join(encoded[i:i + BLOCK_SIZE] for i in range(0, len(encoded), BLOCK_SIZE))
def decode(ciphered_text):
return _cipher(ciphered_text)
| 24.842105 | 106 | 0.713983 | 67 | 472 | 4.80597 | 0.522388 | 0.130435 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007481 | 0.150424 | 472 | 18 | 107 | 26.222222 | 0.795511 | 0 | 0 | 0 | 0 | 0 | 0.004237 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.1 | 0.1 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
1143fe85bb5b984ab6b64feaad277b6472d348d4 | 597 | py | Python | cifra/encoding/reverse.py | dante-signal31/cifra | 3914822ec49cd238fe31fd58424fa2b058116b9a | [
"BSD-3-Clause"
] | null | null | null | cifra/encoding/reverse.py | dante-signal31/cifra | 3914822ec49cd238fe31fd58424fa2b058116b9a | [
"BSD-3-Clause"
] | null | null | null | cifra/encoding/reverse.py | dante-signal31/cifra | 3914822ec49cd238fe31fd58424fa2b058116b9a | [
"BSD-3-Clause"
] | null | null | null | """
Reverse encoding functions.
Reverse encoding is the simplest of encoding methods. It just reverses order of
text characters.
"""
def encode(text: str) -> str:
"""
Reverse order of given text characters.
:param text: Text to reverse.
:return: Reversed text.
"""
reversed_text = "".join(char for char in text[-1::-1])
return reversed_text
def decode(text: str) -> str:
"""
Obtain original text from a reversed text.
:param text: Reversed text.
:return: Original text.
"""
# Reverse of reverse is original text.
return encode(text)
| 19.9 | 79 | 0.653266 | 78 | 597 | 4.974359 | 0.410256 | 0.154639 | 0.051546 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004415 | 0.241206 | 597 | 29 | 80 | 20.586207 | 0.852097 | 0.592965 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
115d4d0adca03af08b1918a46dc7f7acf8108326 | 726 | py | Python | mzmembership/mzmembership/doctype/membership/membership.py | nabeelnajeeb1/membership_ | c4d1746700b4feaf08748c1f44a6eef515c0c27c | [
"MIT"
] | null | null | null | mzmembership/mzmembership/doctype/membership/membership.py | nabeelnajeeb1/membership_ | c4d1746700b4feaf08748c1f44a6eef515c0c27c | [
"MIT"
] | null | null | null | mzmembership/mzmembership/doctype/membership/membership.py | nabeelnajeeb1/membership_ | c4d1746700b4feaf08748c1f44a6eef515c0c27c | [
"MIT"
] | 1 | 2022-03-16T12:34:31.000Z | 2022-03-16T12:34:31.000Z | # Copyright (c) 2021, M20Zero and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
class Membership(Document):
def on_submit(self):
self.make_invoice()
def make_invoice(self):
self.invoice_entry(self.name,self.member,self.member_name,self.membership_type,self.amount,self.income_account)
def invoice_entry(self, member,name,member_name,membership_type,amount,income_account):
gl=frappe.get_doc(dict(doctype="Invoice",date=frappe.utils.nowdate(),party_type="member",party=name,party_name=member_name,items=income_account,total=amount,total_qty="1"))
gl.save(ignore_permissions=True)
gl.submit()
| 38.210526 | 180 | 0.756198 | 101 | 726 | 5.257426 | 0.485149 | 0.07533 | 0.060264 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011094 | 0.130854 | 726 | 19 | 181 | 38.210526 | 0.830428 | 0.126722 | 0 | 0 | 0 | 0 | 0.022152 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.181818 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
1161b5d24e93fc5eb9ff699d54bb77e5913e4c81 | 4,816 | py | Python | rtmp/Message.py | hirokikana/rtmp-client | 858da74940c7e2caae56eaf2fd74bc7ca430b99a | [
"MIT"
] | 2 | 2020-02-14T12:57:42.000Z | 2020-02-16T08:48:17.000Z | rtmp/Message.py | hirokikana/rtmp-client | 858da74940c7e2caae56eaf2fd74bc7ca430b99a | [
"MIT"
] | null | null | null | rtmp/Message.py | hirokikana/rtmp-client | 858da74940c7e2caae56eaf2fd74bc7ca430b99a | [
"MIT"
] | null | null | null | #-*- coding: utf-8 -*-
import random
import time
import struct
class AMF0():
def __init__(self, message_type, message):
self.type_mapping = {
'string' : 2,
'number' : 0,
'object' : 3
}
self.message_type = message_type
self.message = message
def get_byte(self):
# type(1byte) + length(2byte) + value(length)
if (self.message_type == 'number'):
body = struct.pack('>d', self.message)
byte_message = (self.type_mapping[self.message_type]).to_bytes(1,'big') + body
elif(self.message_type == 'object'):
byte_message = (self.type_mapping[self.message_type]).to_bytes(1,'big')
for object_key in self.message:
byte_message += (len(object_key)).to_bytes(2,'big') + object_key
byte_message += (0x02).to_bytes(1,'big') + (len(self.message[object_key])).to_bytes(2,'big') + self.message[object_key] # TODO string type
else:
body = self.message
byte_message = (self.type_mapping[self.message_type]).to_bytes(1,'big') + (len(body)).to_bytes(2,'big') + body
return byte_message
class HandshakeMessage():
_message = ''
def get_message(self):
return self._message
class RTMPHeader():
_header_binary = None
def __init__(self, rtmp_body, chunk_stream_id, message_type, fmt):
if fmt == 0:
basic_header = chunk_stream_id.to_bytes(1, 'big')
elif fmt == 1:
basic_header = chunk_stream_id.to_bytes(1, 'big')
timestamp = (0).to_bytes(3,'big')
message_length = rtmp_body.get_length()
message_type = message_type.to_bytes(1,'big')
if fmt == 0:
message_stream_id = (0).to_bytes(4, 'little')
self._header_binary = basic_header + timestamp + message_length + message_type + message_stream_id
else:
self._header_binary = basic_header + timestamp + message_length + message_type
def get(self):
return self._header_binary
class RTMPBody():
_body_binary = None
def __init__(self, body_binary):
self._body_binary = body_binary
def get_length(self):
return len(self._body_binary).to_bytes(3, 'big')
def get(self):
return self._body_binary
class ConnectMessage():
_header = None
_body = None
def __init__(self, connect_param):
self._body = RTMPBody(AMF0('string', b'connect').get_byte() + AMF0('number', 1).get_byte() + AMF0('object', connect_param).get_byte() + 0x09.to_bytes(3,'big'))
self._header = RTMPHeader(self._body, 0x03, 0x14, 0)
def get_message(self):
return self._header.get() + self._body.get()
class PlayMessage():
_header = None
_body = None
def __init__(self):
self._body = RTMPBody(AMF0('string', b'play').get_byte() + AMF0('number', 5).get_byte() + (0x05).to_bytes(1,'big') + AMF0('string', b'test').get_byte())
self._header = RTMPHeader(self._body, 0x08, 0x14, 0)
def get_message(self):
return self._header.get() + self._body.get()
class CreateStreamMessage():
_header = None
_body = None
def __init__(self):
self._body = RTMPBody(AMF0('string', b'createStream').get_byte() + AMF0('number', 4).get_byte() + (0x05).to_bytes(1,'big'))
self._header = RTMPHeader(self._body, 0x43, 0x14, 1)
def get_message(self):
return self._header.get() + self._body.get()
class PublishMessage():
_header = None
_body = None
def __init__(self, app, stream):
self._body = RTMPBody(AMF0('string', b'publish').get_byte() +
AMF0('number', 5).get_byte() +
(0x05).to_bytes(1,'big') +
AMF0('string', stream).get_byte() +
AMF0('string', app).get_byte()
)
self._header = RTMPHeader(self._body, 0x8, 0x14, 0)
def get_message(self):
return self._header.get() + self._body.get()
class C0S0():
_version = 3
def __init__(self):
self._message = self._version.to_bytes(1, 'little')
def get_version(self):
return self._version
def get_message(self):
return self._message
class C1S1():
_timestamp = 0
_random = 0
_zero = 0
def __init__(self, timestamp):
self._timestamp = timestamp
self._random = random.getrandbits(1528 * 8)
self._zero = 0
self._message = self._timestamp.to_bytes(4, 'big') + self._zero.to_bytes(4, 'little') + self._random.to_bytes(1528, 'little')
def get_time(self):
return self._timestamp
def get_message(self):
return self._message
| 33.213793 | 167 | 0.594061 | 599 | 4,816 | 4.450751 | 0.141903 | 0.055139 | 0.033008 | 0.04126 | 0.514254 | 0.465116 | 0.399475 | 0.330458 | 0.3012 | 0.274944 | 0 | 0.030822 | 0.272425 | 4,816 | 144 | 168 | 33.444444 | 0.730023 | 0.017027 | 0 | 0.294643 | 0 | 0 | 0.045032 | 0 | 0 | 0 | 0.010782 | 0.006944 | 0 | 1 | 0.196429 | false | 0 | 0.026786 | 0.107143 | 0.5625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
1164cff7b0c7f2293faa282f7854f43009c2e23c | 2,634 | py | Python | predict_main.py | kashifcap/image_captioning | 233ff629eb7424eea88bd49b4b9d701f247dc111 | [
"MIT"
] | null | null | null | predict_main.py | kashifcap/image_captioning | 233ff629eb7424eea88bd49b4b9d701f247dc111 | [
"MIT"
] | null | null | null | predict_main.py | kashifcap/image_captioning | 233ff629eb7424eea88bd49b4b9d701f247dc111 | [
"MIT"
] | null | null | null | # %%
# Importing generic python libraries
import string
import os
import math
import glob
import numpy as np
from numpy import array
import pandas as pd
import matplotlib.pyplot as plt
from time import time
# Importing libraries for image manipulation, deep-learning and pickling
from PIL import Image, ImageOps
from pickle import dump, load
import tensorflow as tf
# Importing functionalities from 'keras' library
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers import LSTM, Embedding, TimeDistributed, Dense, RepeatVector, Activation, Flatten, Reshape, concatenate, Dropout, BatchNormalization
from keras.optimizers import Adam, RMSprop
from keras.layers.wrappers import Bidirectional
from keras.layers.merge import add
from keras.applications.inception_v3 import InceptionV3
from keras.preprocessing import image
from keras.models import Model
from keras import Input, layers
from keras import optimizers
from keras.applications.inception_v3 import preprocess_input
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from tensorflow.python.keras.backend import set_session
from keras.utils import to_categorical
#%%
def generate_caption(filepath):
# Importing custom modules
from utils import image_processing
from utils import caption_writer
# Loading files to map predicted indices to words and vice-versa
ixtoword=load(open('./resources/ixtoword.pkl','rb'))
wordtoix=load(open('./resources/wordtoix.pkl','rb'))
# Initializing and customizing the InceptionV3 Model
model=InceptionV3(weights="imagenet")
model_new=Model(model.input,model.layers[-2].output)
# Loading pre-trained weights and compiling the model
nlp_model=tf.keras.models.load_model('model_weights/final_model.h5')
nlp_model.compile(loss='categorical_crossentropy',optimizer=tf.compat.v1.train.AdamOptimizer(learning_rate=0.0001))
# Setting maximum length of caption
max_length=72
# Initializing empty dictionary for encoding custom images
new_encoding_test={}
# Selecting and processing single test image and mapping it into the encoding dictionary
new_encoding_test[0]=image_processing.encode(filepath, model_new)
# Reshaping encoded image and generating it's captions using 'nlp_model'
image=new_encoding_test[0].reshape((1,2048))
return(caption_writer.greedySearch(image, max_length, wordtoix, ixtoword, nlp_model))
# %%
#image_path = "1440465.jpg"
#caption = generate_caption(image_path)
#print(caption) | 32.121951 | 150 | 0.779043 | 344 | 2,634 | 5.869186 | 0.450581 | 0.071322 | 0.043586 | 0.027737 | 0.037642 | 0.037642 | 0 | 0 | 0 | 0 | 0 | 0.012993 | 0.15262 | 2,634 | 82 | 151 | 32.121951 | 0.891577 | 0.257403 | 0 | 0 | 0 | 0 | 0.057762 | 0.051573 | 0 | 0 | 0 | 0 | 0 | 1 | 0.02381 | false | 0 | 0.714286 | 0 | 0.738095 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
febd2fb77dd6246269157666b39569c865df1427 | 4,132 | py | Python | accounts/tests/tests_signup.py | oratosquilla-oratoria/django-blog | a821530ecabb3ab16d770d04c32c97db9d279177 | [
"MIT"
] | null | null | null | accounts/tests/tests_signup.py | oratosquilla-oratoria/django-blog | a821530ecabb3ab16d770d04c32c97db9d279177 | [
"MIT"
] | null | null | null | accounts/tests/tests_signup.py | oratosquilla-oratoria/django-blog | a821530ecabb3ab16d770d04c32c97db9d279177 | [
"MIT"
] | null | null | null | from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import resolve, reverse
from ..forms import SignUpForm
from ..views import SignUpView
class SignUpFormTest(TestCase):
def test_form_has_fields(self):
"""Tests if the form contains all the necessary fields"""
form = SignUpForm()
expected = ['username', 'email', 'password1', 'password2',]
actual = list(form.fields)
self.assertSequenceEqual(expected, actual)
class SignUpTests(TestCase):
def setUp(self):
signup_url = reverse('signup')
self.signup_response = self.client.get(signup_url)
def test_signup_status_code(self):
"""Tests if we get the signup page"""
self.assertEqual(self.signup_response.status_code, 200)
def test_signup_url_resolves_signup_view(self):
"""Tests if the login link maps SignUpView"""
view = resolve('/accounts/signup/')
self.assertEqual(view.func.view_class, SignUpView)
def test_csrf(self):
"""Tests if we get a csrf token"""
self.assertContains(self.signup_response, 'csrfmiddlewaretoken')
def test_contains_form(self):
"""Tests if the page contains the login form"""
form = self.signup_response.context.get('form')
self.assertIsInstance(form, SignUpForm)
def test_form_inputs(self):
"""Tests if the form looks like it should"""
# csrf, username, email, password1, password2 -> 5 inputs
self.assertContains(self.signup_response, '<input', 5)
self.assertContains(self.signup_response, 'type="text"', 1)
self.assertContains(self.signup_response, 'type="email"', 1)
self.assertContains(self.signup_response, 'type="password"', 2)
self.assertContains(self.signup_response, 'type="submit"', 1)
class SuccessfulSignUpTests(TestCase):
def setUp(self):
signup_url = reverse('signup')
data = {
'username': 'Vasyan',
'email': 'vasyan@vasyan.com',
'password1': '1234567v',
'password2': '1234567v'
}
self.signup_response = self.client.post(signup_url, data)
self.page_url = reverse('page', kwargs={'page': 1})
def test_redirection_without_parameter_next(self):
"""Tests the redirect after signing up to /page/1/
"""
self.assertRedirects(self.signup_response, self.page_url)
def test_redirection_with_parameter_next(self):
"""Tests the redirect after signing up to a page from
'next' parameter
"""
next_param = '?next={}'.format(reverse('about'))
signup_url = reverse('signup') + next_param
data = {
'username': 'Vasyan1',
'email': 'vasyan1@vasyan.com',
'password1': '1234567v',
'password2': '1234567v'
}
signup_response = self.client.post(signup_url, data)
page_url = reverse('about')
self.assertRedirects(signup_response, page_url)
def test_user_creation(self):
"""Tests if the user has been created"""
self.assertTrue(User.objects.exists())
def test_user_authentication(self):
"""Tests if a new user is authenticated after signing up"""
response = self.client.get(self.page_url)
user = response.context.get('user')
self.assertTrue(user.is_authenticated)
class InvalidSignUpTests(TestCase):
def setUp(self):
signup_url = reverse('signup')
self.signup_response = self.client.post(signup_url, {})
def test_signup_status_code(self):
"""Tests if an invalid form submission goes to the same page"""
self.assertEqual(self.signup_response.status_code, 200)
def test_form_errors(self):
"""Tests if we get errors after submissioning an invalid form"""
form = self.signup_response.context.get('form')
self.assertTrue(form.errors)
def test_dont_create_user(self):
"""Tests if a new user is not created after submissioning
an invalid form
"""
self.assertFalse(User.objects.exists())
| 36.892857 | 72 | 0.651258 | 488 | 4,132 | 5.368852 | 0.247951 | 0.064886 | 0.096183 | 0.064122 | 0.439313 | 0.361832 | 0.298473 | 0.251145 | 0.200763 | 0.167176 | 0 | 0.01643 | 0.234027 | 4,132 | 111 | 73 | 37.225225 | 0.811374 | 0.167473 | 0 | 0.246575 | 0 | 0 | 0.098204 | 0 | 0 | 0 | 0 | 0 | 0.232877 | 1 | 0.219178 | false | 0.082192 | 0.068493 | 0 | 0.342466 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
fed8e8b19e0b20a7818d74d02ccd0fe62fa3956a | 972 | py | Python | story.py | jonodrew/story_generator_p | 59f287290635f7bff2f7b86ddb9d226dde5dae1e | [
"Unlicense"
] | null | null | null | story.py | jonodrew/story_generator_p | 59f287290635f7bff2f7b86ddb9d226dde5dae1e | [
"Unlicense"
] | null | null | null | story.py | jonodrew/story_generator_p | 59f287290635f7bff2f7b86ddb9d226dde5dae1e | [
"Unlicense"
] | null | null | null | from flask import Flask
from faker import Faker
from faker.providers import company, job, person, geo
app = Flask(__name__)
@app.route('/')
def story():
fake = Faker()
mystory = "<html><body><p>In a(n) " + fake.company()
mystory = mystory + " a young "
mystory = mystory + fake.language_name()
mystory = mystory + " stumbles across a(n) "
mystory = mystory + fake.domain_word()
mystory = mystory + " which spurs him into conflict with "
mystory = mystory + fake.name()
mystory = mystory + " an " + fake.catch_phrase()
mystory = mystory + " with the help of a(n) "
mystory = mystory + fake.job()
mystory = mystory + " and her "
mystory = mystory + fake.file_name()
mystory = mystory + " culminating in a struggle in "
mystory = mystory + fake.company()
mystory = mystory + " where someone shouts "
mystory = mystory + fake.bs()
mystory = mystory + " </p></body></html>"
return mystory
| 30.375 | 64 | 0.627572 | 120 | 972 | 5.016667 | 0.416667 | 0.372093 | 0.209302 | 0.083056 | 0.066445 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.245885 | 972 | 31 | 65 | 31.354839 | 0.821282 | 0 | 0 | 0 | 0 | 0 | 0.203913 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0 | 0.12 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
fedde04a6b3f2b92694812b25ef8e4885694fa8a | 5,220 | py | Python | backend/app/settings.py | sudipbhujel/election | fae1cd97e93e18d96d26e46ed57649160b0e4335 | [
"MIT"
] | 3 | 2021-04-07T08:33:39.000Z | 2021-07-29T03:28:24.000Z | backend/app/settings.py | sudipbhujel/election | fae1cd97e93e18d96d26e46ed57649160b0e4335 | [
"MIT"
] | null | null | null | backend/app/settings.py | sudipbhujel/election | fae1cd97e93e18d96d26e46ed57649160b0e4335 | [
"MIT"
] | 4 | 2021-04-11T14:07:52.000Z | 2021-07-29T03:28:26.000Z | """
Django settings for app project.
Generated by 'django-admin startproject' using Django 3.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from datetime import timedelta
import os
from pathlib import Path
from django.conf.global_settings import MEDIA_ROOT, MEDIA_URL, STATIC_ROOT
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'corsheaders',
'rest_framework',
'rest_framework.authtoken',
'core.apps.CoreConfig',
'user.apps.UserConfig',
'eprofile.apps.EprofileConfig',
'vote.apps.VoteConfig',
'candidate.apps.CandidateConfig',
'party.apps.PartyConfig',
'state.apps.StateConfig',
'stats.apps.StatsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ckeditor'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'app.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR, os.path.join(BASE_DIR, 'templates'), ],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'app.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'HOST': os.environ.get('DB_HOST'),
'NAME': os.environ.get('DB_NAME'),
'USER': os.environ.get('DB_USER'),
'PASSWORD': os.environ.get('DB_PASS')
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Kathmandu'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = '/vol/web/static'
MEDIA_URL = '/media/'
MEDIA_ROOT = '/vol/web/media'
AUTH_USER_MODEL = 'core.User'
PASSWORD_RESET_TIMEOUT_DAYS = 1
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_BACKEND = os.environ.get('EMAIL_BACKEND')
CELERY_BROKER_URL = 'redis://redis:6379'
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication',
]
}
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=5),
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
}
EMAIL_USE_TLS = True
EMAIL_HOST = os.environ.get('EMAIL_HOST')
EMAIL_PORT = os.environ.get('EMAIL_PORT')
EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
CORS_ORIGIN_ALLOW_ALL = True
CKEDITOR_UPLOAD_PATH = "media/uploads/ckeditor"
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'Custom',
'toolbar_Custom': [
['Styles', 'Format', 'Font', 'FontSize'],
['Format'],
['Undo', 'Redo'],
['Bold', 'Italic', 'Underline'],
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Image', 'Table', 'HorizontalRule'],
['TextColor', 'BGColor'],
['SpecialChar',],
['Link', 'Unlink'],
['RemoveFormat', 'Source'],
['Maximize',]
]
}
} | 26.497462 | 140 | 0.676245 | 564 | 5,220 | 6.106383 | 0.416667 | 0.05662 | 0.034843 | 0.050813 | 0.141115 | 0.122822 | 0.077526 | 0.077526 | 0.034843 | 0 | 0 | 0.006779 | 0.18046 | 5,220 | 197 | 141 | 26.497462 | 0.79827 | 0.199042 | 0 | 0.016 | 1 | 0 | 0.483886 | 0.310005 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.064 | 0.032 | 0 | 0.032 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
fedfd3c2009606f4bff03b23fc21584de132dc8e | 1,380 | py | Python | src/ayeauth/models/user.py | ayeama/ayeauth | 5d8d999a2014e1df399e97a0ae6343a7434f7e80 | [
"MIT"
] | null | null | null | src/ayeauth/models/user.py | ayeama/ayeauth | 5d8d999a2014e1df399e97a0ae6343a7434f7e80 | [
"MIT"
] | 7 | 2020-05-09T10:58:33.000Z | 2020-05-31T05:04:30.000Z | src/ayeauth/models/user.py | ayeama/ayeauth | 5d8d999a2014e1df399e97a0ae6343a7434f7e80 | [
"MIT"
] | null | null | null | from flask_login import AnonymousUserMixin
from flask_login import UserMixin as BaseUserMixin
from werkzeug.datastructures import ImmutableList
from ayeauth import db
from ayeauth.auth.password import hash_password
from ayeauth.models import BaseModel
class UserMixin(BaseUserMixin):
@property
def is_active(self):
return self.active
def has_role(self, role):
if role in self.roles:
return True
return False
class User(BaseModel, UserMixin):
__tablename__ = "users"
username = db.Column(db.String(255), unique=True, nullable=False)
password = db.Column(db.String(255), nullable=False)
active = db.Column(db.Boolean(), default=True)
roles = db.relationship(
"Role", secondary="user_roles", backref=db.backref("users", lazy="dynamic")
)
authorized_applications = db.relationship(
"Application",
secondary="user_authorized_applications",
backref=db.backref("users", lazy="dynamic"),
)
def __init__(self, username, password):
super(User, self).__init__()
self.username = username
self.password = hash_password(password)
def __str__(self):
return str(self.username)
class AnonymousUser(AnonymousUserMixin):
def __init__(self):
self.roles = ImmutableList()
def has_role(self, *args):
return False
| 26.538462 | 83 | 0.687681 | 157 | 1,380 | 5.847134 | 0.356688 | 0.035948 | 0.03268 | 0.043573 | 0.111111 | 0.069717 | 0 | 0 | 0 | 0 | 0 | 0.005535 | 0.214493 | 1,380 | 51 | 84 | 27.058824 | 0.841328 | 0 | 0 | 0.052632 | 0 | 0 | 0.05942 | 0.02029 | 0 | 0 | 0 | 0 | 0 | 1 | 0.157895 | false | 0.105263 | 0.157895 | 0.078947 | 0.684211 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
fedfe519997357cc7e205716f67b06182af75e63 | 489 | py | Python | subtools/exceptions.py | huimingz/subtools | 185aff705f3730bac5e4d1725c5d24c549e8b0e4 | [
"MIT"
] | 4 | 2017-11-27T15:18:33.000Z | 2018-07-27T06:30:23.000Z | subtools/exceptions.py | Kairu-Madigan/subtools | 185aff705f3730bac5e4d1725c5d24c549e8b0e4 | [
"MIT"
] | 1 | 2021-06-01T22:06:59.000Z | 2021-06-01T22:06:59.000Z | subtools/exceptions.py | huimingz/subtools | 185aff705f3730bac5e4d1725c5d24c549e8b0e4 | [
"MIT"
] | 1 | 2017-11-27T08:37:35.000Z | 2017-11-27T08:37:35.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: "Kairu"
# contact:
# date: "2017/11/17"
class PySubError(Exception):
"""基本错误类型"""
pass
class SubFormatError(PySubError):
"""字幕格式错误"""
pass
class AssFilePathError(PySubError):
"""文件路径错误"""
pass
class AssParseError(PySubError):
"""解析Ass内容时发生错误"""
pass
class NoExists(PySubError):
"""没有找到目标对象"""
pass
class RequestError(PySubError):
"""请求错误"""
pass
| 15.774194 | 36 | 0.580777 | 44 | 489 | 6.454545 | 0.659091 | 0.158451 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027473 | 0.255624 | 489 | 30 | 37 | 16.3 | 0.752747 | 0.278119 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
3a28966133648d4eb4cea0252a1dbeab49c15f27 | 216 | py | Python | python_agent/moveTurn.py | Idewan/KalahAI | b9012180702fcdcb53d13c4d332b8f99a0b2296a | [
"MIT"
] | null | null | null | python_agent/moveTurn.py | Idewan/KalahAI | b9012180702fcdcb53d13c4d332b8f99a0b2296a | [
"MIT"
] | null | null | null | python_agent/moveTurn.py | Idewan/KalahAI | b9012180702fcdcb53d13c4d332b8f99a0b2296a | [
"MIT"
] | null | null | null | class MoveTurn(object):
def __init__(self):
self.end = False
self.again = False
self.move = None
if __name__ == "__main__":
Print('This class has been checked and works as expected.') | 27 | 63 | 0.62963 | 28 | 216 | 4.428571 | 0.821429 | 0.145161 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.268519 | 216 | 8 | 63 | 27 | 0.78481 | 0 | 0 | 0 | 0 | 0 | 0.267281 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.285714 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3a2e7a58098b267ac08371fbbd2c77db15f2c612 | 5,439 | py | Python | MDS_random_sampling.py | LCB0B/metric | 0686ce80326b60ddde77989b82c218d94a016cd2 | [
"MIT"
] | null | null | null | MDS_random_sampling.py | LCB0B/metric | 0686ce80326b60ddde77989b82c218d94a016cd2 | [
"MIT"
] | null | null | null | MDS_random_sampling.py | LCB0B/metric | 0686ce80326b60ddde77989b82c218d94a016cd2 | [
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
from copy import deepcopy
# Import all the packages
import torch
from torch.autograd import Variable
import torch.nn as nn
import numpy as np
import torch.optim as optim
import torch.nn.functional as f# create a dummy data
import matplotlib.pyplot as plt
import networkx as nx
import timeit
from sklearn import metrics
import scipy.sparse as sparse
import scipy.stats as stats
from sklearn import metrics
from scipy.io import loadmat # this is the SciPy module that loads mat-files
import pandas as pd
from torch_sparse import spspmm
import pandas as pd
class MDS(nn.Module):
def __init__(self,data,relation, input_size,latent_dim,sample_size,device):
super(MDS, self).__init__()
self.input_size=input_size
#self.scaling_factor=nn.Parameter(torch.randn(1,device=device))
self.latent_dim=latent_dim
self.gamma=nn.Parameter(torch.randn(self.input_size,device=device))
#self.alpha=nn.Parameter(torch.randn(self.input_size,device=device))
#create indices to index properly the receiver and senders variable
self.relation = relation
self.pdist = nn.PairwiseDistance(p=2,eps=0)
self.sampling_weights=torch.ones(self.input_size,device=device)
self.sample_size=sample_size
self.latent_z=nn.Parameter(torch.zeros(self.input_size,latent_dim,device=device))
self.latent_z.data=torch.randn(self.input_size,latent_dim,device=device)
def sample_network(self):
# USE torch_sparse lib i.e. : from torch_sparse import spspmm
# sample for undirected network
sample_idx=torch.multinomial(self.sampling_weights, self.sample_size,replacement=False)
# translate sampled indices w.r.t. to the full matrix, it is just a diagonal matrix
indices_translator=torch.cat([sample_idx.unsqueeze(0),sample_idx.unsqueeze(0)],0)
# adjacency matrix in edges format
edges=torch.cat([self.sparse_i_idx.unsqueeze(0),self.sparse_j_idx.unsqueeze(0)],0)
# matrix multiplication B = Adjacency x Indices translator
# see spspmm function, it give a multiplication between two matrices
# indexC is the indices where we have non-zero values and valueC the actual values (in this case ones)
indexC, valueC = spspmm(edges,torch.ones(edges.shape[1]), indices_translator,torch.ones(indices_translator.shape[1]),self.input_size,self.input_size,self.input_size,coalesced=True)
# second matrix multiplication C = Indices translator x B, indexC returns where we have edges inside the sample
indexC, valueC=spspmm(indices_translator,torch.ones(indices_translator.shape[1]),indexC,valueC,self.input_size,self.input_size,self.input_size,coalesced=True)
# edge row position
sparse_i_sample=indexC[0,:]
# edge column position
sparse_j_sample=indexC[1,:]
return sample_idx,sparse_i_sample,sparse_j_sample
def sample(self):
sample_idx=torch.multinomial(self.sampling_weights, self.sample_size,replacement=False)
return sample_idx
#introduce the likelihood function containing the two extra biases gamma_i and alpha_j
def MDS_likelihood(self,epoch):
'''
Poisson log-likelihood ignoring the log(k!) constant
'''
self.epoch=epoch
#sample_idx,sparse_sample_i,sparse_sample_j=self.sample_network()
# mat=torch.exp(-((self.latent_z[sample_idx].unsqueeze(1)-self.latent_z[sample_idx]+1e-06)**2).sum(-1)**0.5)
# z_pdist1=0.5*torch.mm(torch.exp(self.gamma[sample_idx].unsqueeze(0)),(torch.mm((mat-torch.diag(torch.diagonal(mat))),torch.exp(self.gamma[sample_idx]).unsqueeze(-1))))
# #take the sampled matrix indices in order to index gamma_i and alpha_j correctly and in agreement with the previous
# z_pdist2=(-((((self.latent_z[sparse_sample_i]-self.latent_z[sparse_sample_j]+1e-06)**2).sum(-1)))**0.5+self.gamma[sparse_sample_i]+self.gamma[sparse_sample_j]).sum()
# log_likelihood_sparse=z_pdist2-z_pdist1
sample_idx = self.sample()
log_likelihood = ((torch.cdist(self.latent_z[sample_idx],self.latent_z[sample_idx]) - self.relation[sample_idx][:,sample_idx])**2 / self.relation[sample_idx][:,sample_idx].fill_diagonal_(5) ).sum()**0.5
return log_likelihood
def link_prediction(self):
with torch.no_grad():
z_pdist_miss=(((self.latent_z[self.removed_i]-self.latent_z[self.removed_j])**2).sum(-1))**0.5
logit_u_miss=-z_pdist_miss+self.gamma[self.removed_i]+self.gamma[self.removed_j]
rates=torch.exp(logit_u_miss)
self.rates=rates
target=torch.cat((torch.zeros(self.non_sparse_i_idx_removed.shape[0]),torch.ones(self.sparse_i_idx_removed.shape[0])))
#fpr, tpr, thresholds = metrics.roc_curve(target.cpu().data.numpy(), rates.cpu().data.numpy())
precision, tpr, thresholds = metrics.precision_recall_curve(target.cpu().data.numpy(), rates.cpu().data.numpy())
return metrics.roc_auc_score(target.cpu().data.numpy(),rates.cpu().data.numpy()),metrics.auc(tpr,precision)
def get_latent_coord(self):
return self.latent_z.data
| 43.512 | 211 | 0.688178 | 776 | 5,439 | 4.640464 | 0.251289 | 0.044988 | 0.043321 | 0.018884 | 0.312969 | 0.24882 | 0.199111 | 0.154679 | 0.117745 | 0.069981 | 0 | 0.011073 | 0.202978 | 5,439 | 124 | 212 | 43.862903 | 0.819608 | 0.326898 | 0 | 0.103448 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.103448 | false | 0 | 0.310345 | 0.017241 | 0.517241 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
3a483c19268ec63170cdae11c5bf074a073956dc | 489 | py | Python | mmdet/core/bbox/assigners/__init__.py | Gitgigabyte/mmd | 02cf37884d3ac9a6018656d1871695669966dfb3 | [
"Apache-2.0"
] | 1 | 2020-03-13T08:37:35.000Z | 2020-03-13T08:37:35.000Z | mmdet/core/bbox/assigners/__init__.py | Gitgigabyte/mmd | 02cf37884d3ac9a6018656d1871695669966dfb3 | [
"Apache-2.0"
] | null | null | null | mmdet/core/bbox/assigners/__init__.py | Gitgigabyte/mmd | 02cf37884d3ac9a6018656d1871695669966dfb3 | [
"Apache-2.0"
] | null | null | null | from .approx_max_iou_assigner import ApproxMaxIoUAssigner
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
from .max_iou_assigner import MaxIoUAssigner
from .point_assigner import PointAssigner
from .max_iou_assigner_coeff import MaxIoUAssigner_coeff
from .max_iou_ud_assigner import MaxIoUUDAssigner
__all__ = [
'BaseAssigner', 'MaxIoUAssigner', 'ApproxMaxIoUAssigner', 'AssignResult',
'PointAssigner', 'MaxIoUAssigner_coeff', "MaxIoUUDAssigner"
]
| 37.615385 | 77 | 0.840491 | 52 | 489 | 7.519231 | 0.365385 | 0.179028 | 0.107417 | 0.102302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09816 | 489 | 12 | 78 | 40.75 | 0.886621 | 0 | 0 | 0 | 0 | 0 | 0.218814 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.636364 | 0 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
3a4e5a4c8c6d533507fa2336fb73e116e3cda8cb | 1,188 | py | Python | Week2/3 - Min Stack/Solution.py | SaiLikhith7/Leetcode-30-Day-Challenge-April | a8049571ed02e890a05f1004143e8f796b94c01b | [
"MIT"
] | null | null | null | Week2/3 - Min Stack/Solution.py | SaiLikhith7/Leetcode-30-Day-Challenge-April | a8049571ed02e890a05f1004143e8f796b94c01b | [
"MIT"
] | null | null | null | Week2/3 - Min Stack/Solution.py | SaiLikhith7/Leetcode-30-Day-Challenge-April | a8049571ed02e890a05f1004143e8f796b94c01b | [
"MIT"
] | null | null | null | #
# Created on Fri Apr 10 2020
#
# Title: Leetcode - Min Stack
#
# Author: Vatsal Mistry
# Web: mistryvatsal.github.io
#
class MinStack:
def __init__(self):
# Creating 2 stacks, stack : original data; currMinimum : to hold current minimum upon each push
self.stack = list()
self.currMinimum = list()
def push(self, x: int) -> None:
if len(self.stack) == 0 and len(self.currMinimum) == 0:
self.stack.append(x)
self.currMinimum.append(x)
else:
self.currMinimum.append(min(x, self.currMinimum[len(self.currMinimum) - 1]))
self.stack.append(x)
def pop(self) -> None:
if not len(self.stack) == 0:
self.stack.pop()
self.currMinimum.pop()
def top(self) -> int:
if not len(self.stack) == 0:
return self.stack[len(self.stack) - 1]
def getMin(self) -> int:
if not len(self.currMinimum) == 0:
return self.currMinimum[len(self.currMinimum) - 1]
# Your MinStack object will be instantiated and called as such:
# obj = MinStack()
# obj.push(x)
# obj.pop()
# param_3 = obj.top()
# param_4 = obj.getMin() | 27 | 104 | 0.5867 | 157 | 1,188 | 4.401274 | 0.401274 | 0.217077 | 0.069465 | 0.05644 | 0.188133 | 0.188133 | 0 | 0 | 0 | 0 | 0 | 0.019953 | 0.282828 | 1,188 | 44 | 105 | 27 | 0.79108 | 0.288721 | 0 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0 | 0 | 0.380952 | 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 | 0 | 0 | 0 | 2 |
3a50b5b95bc739d344a6cb77e019bdba1fc23ffd | 1,674 | py | Python | app/__main__.py | LostLuma/repo-import-test | 45273fc3543d21366ed3cc5007dc5680b1e3e546 | [
"MIT"
] | null | null | null | app/__main__.py | LostLuma/repo-import-test | 45273fc3543d21366ed3cc5007dc5680b1e3e546 | [
"MIT"
] | null | null | null | app/__main__.py | LostLuma/repo-import-test | 45273fc3543d21366ed3cc5007dc5680b1e3e546 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2018 Samuel Riches
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
import asyncio
import sentry_sdk
import uvloop
from sentry_sdk.integrations.sanic import SanicIntegration
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
from . import Server
from .logging import fix_access_log, setup_logging
sentry_sdk.init(
dsn="https://a2ab246b56f34179a4e2d2d54f0597d7@o970585.ingest.sentry.io/5921973",
integrations=[SanicIntegration(), AioHttpIntegration()],
request_bodies="always"
)
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
with setup_logging():
fix_access_log()
Server.with_config().run()
| 34.163265 | 84 | 0.795102 | 239 | 1,674 | 5.506276 | 0.556485 | 0.066869 | 0.019757 | 0.037994 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027235 | 0.144564 | 1,674 | 48 | 85 | 34.875 | 0.89176 | 0.65233 | 0 | 0 | 0 | 0 | 0.137631 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.4375 | 0 | 0.4375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
3a53da6e86d78573be2e3f866d87c706d51d6189 | 569 | py | Python | machlearn/naive_bayes/__init__.py | daniel-yj-yang/pyml | 2328ae1d73eab39f2774331fcfaa10e8fa2fc0de | [
"BSD-3-Clause"
] | 2 | 2020-11-18T13:25:25.000Z | 2020-11-18T13:25:27.000Z | machlearn/naive_bayes/__init__.py | daniel-yj-yang/pyml | 2328ae1d73eab39f2774331fcfaa10e8fa2fc0de | [
"BSD-3-Clause"
] | null | null | null | machlearn/naive_bayes/__init__.py | daniel-yj-yang/pyml | 2328ae1d73eab39f2774331fcfaa10e8fa2fc0de | [
"BSD-3-Clause"
] | 2 | 2020-11-18T04:46:07.000Z | 2020-11-25T16:19:39.000Z | # -*- coding: utf-8 -*-
# Author: Daniel Yang <daniel.yj.yang@gmail.com>
#
# License: BSD 3 clause
from ._naive_bayes import Bernoulli_NB_classifier, Multinomial_NB_classifier, Gaussian_NB_classifier, demo
from ._naive_bayes import Multinomial_NB_classifier_from_scratch, demo_from_scratch
# this is for "from <package_name>.naive_bayes import *"
__all__ = ["Multinomial_NB_classifier_from_scratch",
"demo_from_scratch",
"Bernoulli_NB_classifier",
"Multinomial_NB_classifier",
"Gaussian_NB_classifier",
"demo"]
| 33.470588 | 106 | 0.727592 | 69 | 569 | 5.507246 | 0.434783 | 0.252632 | 0.242105 | 0.105263 | 0.615789 | 0.615789 | 0.615789 | 0.615789 | 0.357895 | 0.357895 | 0 | 0.004283 | 0.179262 | 569 | 16 | 107 | 35.5625 | 0.809422 | 0.254833 | 0 | 0 | 0 | 0 | 0.308612 | 0.258373 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3a58d4aee94267ef7f594d426fd936cf5f8d422b | 381 | py | Python | Insertion Sort.py | MichaelWiciak/SortingAlgorithms | f3c83a59d302ff4795ac72c93a0269ef0de113b9 | [
"MIT"
] | null | null | null | Insertion Sort.py | MichaelWiciak/SortingAlgorithms | f3c83a59d302ff4795ac72c93a0269ef0de113b9 | [
"MIT"
] | null | null | null | Insertion Sort.py | MichaelWiciak/SortingAlgorithms | f3c83a59d302ff4795ac72c93a0269ef0de113b9 | [
"MIT"
] | null | null | null | def insertionSort(aList):
first = 0
last = len(aList)-1
for CurrentPointer in range(first+1, last+1):
CurrentValue = aList[CurrentPointer]
Pointer = CurrentPointer - 1
while aList[Pointer] > CurrentValue and Pointer >= 0:
aList[Pointer+1] = aList[Pointer]
Pointer -= 1
aList[Pointer+1] = CurrentValue
| 31.75 | 62 | 0.593176 | 41 | 381 | 5.512195 | 0.390244 | 0.212389 | 0.115044 | 0.176991 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034221 | 0.309711 | 381 | 11 | 63 | 34.636364 | 0.825095 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3a58ec4adf9925dd59ed003485fdc3d5bba2d64e | 717 | py | Python | Recursion_DynamicP/paint_fill.py | Randyjp/python_algorithms | 3271cf700ff1d8c38b0c32eba1f92cd8c49b27d9 | [
"MIT"
] | null | null | null | Recursion_DynamicP/paint_fill.py | Randyjp/python_algorithms | 3271cf700ff1d8c38b0c32eba1f92cd8c49b27d9 | [
"MIT"
] | null | null | null | Recursion_DynamicP/paint_fill.py | Randyjp/python_algorithms | 3271cf700ff1d8c38b0c32eba1f92cd8c49b27d9 | [
"MIT"
] | null | null | null | # 8.10) Implement a function to fill a matrix with a new color given a point and the matrix
def paint_fill(matrix, y, x, new_color):
# print(x, y)
len_x = len(matrix[0]) - 1
len_y = len(matrix[0][0]) - 1
if y < 0 or y > len_y or x < 0 or x > len_x:
return
if matrix[y][x] == new_color:
return
# set new color
matrix[y][x] = new_color
# call all adjacent points
paint_fill(matrix, y - 1, x, new_color)
paint_fill(matrix, y + 1, x, new_color)
paint_fill(matrix, y, x + 1, new_color)
paint_fill(matrix, y, x - 1, new_color)
#test code
w, h = 8, 5
Matrix = [['#fff' for x in range(w)] for y in range(h)]
paint_fill(Matrix, 2, 3, '#xoxo')
print(Matrix)
| 26.555556 | 91 | 0.6053 | 135 | 717 | 3.088889 | 0.318519 | 0.172662 | 0.215827 | 0.191847 | 0.386091 | 0.2494 | 0.2494 | 0.2494 | 0.2494 | 0.2494 | 0 | 0.033962 | 0.260809 | 717 | 26 | 92 | 27.576923 | 0.75283 | 0.20781 | 0 | 0.125 | 0 | 0 | 0.016014 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0 | 0 | 0.1875 | 0.0625 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3a5aa7a7805f0fdf246b8e16408ffa480f713c2f | 8,337 | py | Python | eylang/eylangparser.py | bxtkezhan/eylang | 899154f89359df30988a1c76caeb7d8921dbe3eb | [
"MIT"
] | 4 | 2019-04-24T20:28:00.000Z | 2019-11-02T10:14:02.000Z | eylang/eylangparser.py | bxtkezhan/Dragon | 899154f89359df30988a1c76caeb7d8921dbe3eb | [
"MIT"
] | null | null | null | eylang/eylangparser.py | bxtkezhan/Dragon | 899154f89359df30988a1c76caeb7d8921dbe3eb | [
"MIT"
] | 3 | 2019-05-23T01:56:58.000Z | 2019-06-12T14:11:57.000Z | from eylanglexer import reserved
from eylanglexer import rules as lex_rules
from eylanginterpreter import *
from rply import ParserGenerator
EYLANG_VARS = EylangVars()
pg = ParserGenerator(
list(reserved.values()) + [name for name, _ in lex_rules],
precedence=[
('left', ['AND', 'OR', 'NOT']),
('left', ['EQ', 'LT', 'LE', 'GT', 'GE', 'NE']),
('left', ['PLUS', 'MINUS']),
('left', ['MUL', 'DIV', 'MOD']),
('left', ['POWER']),
('right', ['SIGN']),
]
)
@pg.production('program : program statement')
@pg.production('program : statement')
def p_program(p):
if len(p) == 1:
line, stat = p[0]
return Program({line: stat})
elif len(p) == 2:
line, stat = p[1]
p[0].set(line, stat)
return p[0]
@pg.production('statement : command NEWLINE')
def p_statement(p):
return (p[1].getsourcepos().lineno, p[0])
@pg.production('statement : NEWLINE')
def p_statement_newline(p):
return (p[0].getsourcepos().lineno, Newline())
# @pg.production('command : IMPORT expr')
# def p_command_return(p):
# return ('IMPORT', p[1])
@pg.production('command : RETURN expr')
def p_command_return(p):
return Return(p[1])
@pg.production('command : DEF variable LPAR paralist RPAR NEWLINE program END')
@pg.production('command : DEF variable LPAR RPAR NEWLINE program END')
def p_command_def(p):
if len(p) > 7:
return DEF(p[1], p[6], p[3])
else:
return DEF(p[1], p[5])
@pg.production('command : FOR varlist IN expr NEWLINE program ELSE NEWLINE program END')
@pg.production('command : FOR varlist IN expr NEWLINE program END')
def p_command_for(p):
if len(p) > 7:
return For(p[1], p[3], p[5], p[8])
else:
return For(p[1], p[3], p[5])
@pg.production('command : WHILE expr NEWLINE program ELSE NEWLINE program END')
@pg.production('command : WHILE expr NEWLINE program END')
def p_command_while(p):
if len(p) > 5:
return While(p[1], p[3], p[6])
else:
return While(p[1], p[3])
@pg.production('command : ELIF expr')
def p_command_elif(p):
return ELIF(p[1])
@pg.production('command : IF expr NEWLINE program ELSE NEWLINE program END')
@pg.production('command : IF expr NEWLINE program END')
def p_command_if(p):
if len(p) > 5:
return IF(p[1], p[3], p[6])
else:
return IF(p[1], p[3])
@pg.production('command : varlist ASSIGN expr')
def p_command_assign(p):
return Assign(p[0], p[2])
@pg.production('command : PUTS expr')
def p_command_puts(p):
return Puts(p[1])
@pg.production('command : expr')
def p_command_expr(p):
return Expr(p[0])
@pg.production('expr : expr PLUS expr')
@pg.production('expr : expr MINUS expr')
@pg.production('expr : expr MUL expr')
@pg.production('expr : expr DIV expr')
@pg.production('expr : expr MOD expr')
@pg.production('expr : expr POWER expr')
@pg.production('expr : expr EQ expr')
@pg.production('expr : expr LT expr')
@pg.production('expr : expr LE expr')
@pg.production('expr : expr GT expr')
@pg.production('expr : expr GE expr')
@pg.production('expr : expr NE expr')
def p_expr_binop(p):
return BinaryOp(p[1], p[0], p[2])
@pg.production('expr : PLUS expr', precedence='SIGN')
@pg.production('expr : MINUS expr', precedence='SIGN')
def p_expr_sign(p):
return Sign(p[0], p[1])
@pg.production('expr : expr AND expr')
@pg.production('expr : expr OR expr')
@pg.production('expr : NOT expr')
def p_expr_logic(p):
if len(p) > 2:
return (p[1].gettokentype(), (p[0], p[2]))
else:
return (p[0].gettokentype(), (p[1], ))
@pg.production('expr : object')
def p_expr_object(p):
return p[0]
@pg.production('object : parensexpr')
@pg.production('object : func')
@pg.production('object : dict')
@pg.production('object : list')
@pg.production('object : index')
@pg.production('object : attrivar')
@pg.production('object : variable')
@pg.production('object : constant')
def p_object(p):
return p[0]
@pg.production('parensexpr : LPAR expr RPAR')
def p_parensexpr(p):
return Parens(p[1])
@pg.production('func : variable LPAR arglist RPAR')
@pg.production('func : attrivar LPAR arglist RPAR')
@pg.production('func : variable LPAR RPAR')
@pg.production('func : attrivar LPAR RPAR')
def p_func(p):
if len(p) > 3:
return Func(p[0], p[2])
else:
return Func(p[0])
@pg.production('dict : LBRACE pairlist RBRACE')
@pg.production('dict : LBRACE RBRACE')
def p_dict(p):
if len(p) > 2:
return Dictionary(p[1])
else:
return Dictionary()
@pg.production('pairlist : pairlist COMMA pair')
@pg.production('pairlist : pair')
def p_pairlist(p):
if len(p) > 1:
key, value = p[2]
p[0][key] = value
return p[0]
else:
key, value = p[0]
return {key: value}
@pg.production('pair : expr COLON expr')
@pg.production('pair : expr')
def p_pair(p):
if len(p) > 1:
return (p[0], p[2])
else:
return (p[0], None)
@pg.production('list : LSQB exprlist RSQB')
@pg.production('list : LSQB RSQB')
def p_list(p):
if len(p) > 2:
return List(p[1])
else:
return List()
@pg.production('exprlist : exprlist COMMA expr')
@pg.production('exprlist : expr')
def p_exprlist(p):
if len(p) > 1:
p[0].append(p[2])
return p[0]
else:
return [p[0]]
@pg.production('index : object LSQB indexlist RSQB')
def p_index(p):
return Index(p[0], p[2])
@pg.production('indexlist : indexlist COMMA indexexpr')
@pg.production('indexlist : indexexpr')
def p_indexlist(p):
if len(p) > 1:
p[0].append(p[2])
return p[0]
else:
return [p[0]]
@pg.production('indexexpr : expr COLON expr COLON expr')
def p_indexexprc(p): return (p[0], p[2], p[4])
@pg.production('indexexpr : expr COLON expr COLON')
def p_indexexprb(p): return (p[0], p[2], None)
@pg.production('indexexpr : expr COLON COLON expr')
def p_indexexpra(p): return (p[0], None, p[3])
@pg.production('indexexpr : COLON expr COLON expr')
def p_indexexpr9(p): return (None, p[1], p[3])
@pg.production('indexexpr : COLON expr COLON')
def p_indexexpr8(p): return (None, p[1], None)
@pg.production('indexexpr : COLON COLON expr')
def p_indexexpr7(p): return (None, None, p[2])
@pg.production('indexexpr : expr COLON COLON')
def p_indexexpr6(p): return (p[0], None, None)
@pg.production('indexexpr : expr COLON expr')
def p_indexexpr5(p): return (p[0], p[2], None)
@pg.production('indexexpr : COLON COLON')
def p_indexexpr4(p): return (None, None, None)
@pg.production('indexexpr : expr COLON')
def p_indexexpr3(p): return (p[0], None, None)
@pg.production('indexexpr : COLON expr')
def p_indexexpr2(p): return (None, p[1], None)
@pg.production('indexexpr : COLON')
def p_indexexpr1(p): return (None, None, None)
@pg.production('indexexpr : expr')
def p_indexexpr0(p): return (p[0], )
@pg.production('paralist : paralist COMMA parameter')
@pg.production('paralist : parameter')
def p_paralist(p):
if len(p) > 1:
p[0].append(p[2])
return p[0]
else:
return ParaList(p[0])
@pg.production('parameter : variable ASSIGN expr')
@pg.production('parameter : variable')
def p_parameter(p):
if len(p) > 1:
return (p[0], p[2])
else:
return (p[0], )
@pg.production('arglist : arglist COMMA argument')
@pg.production('arglist : argument')
def p_arglist(p):
if len(p) > 1:
p[0].append(p[2])
return p[0]
else:
return ArgList(p[0])
@pg.production('argument : variable ASSIGN expr')
@pg.production('argument : expr')
def p_argument(p):
if len(p) > 1:
return (p[0], p[2])
else:
return (p[0], )
@pg.production('varlist : varlist COMMA attrivar')
@pg.production('varlist : varlist COMMA variable')
@pg.production('varlist : attrivar')
@pg.production('varlist : variable')
def p_varlist(p):
if len(p) > 1:
p[0].append(p[2])
return p[0]
else:
return VarList([p[0]])
@pg.production('attrivar : object DOT variable')
def p_attrivar(p):
return Attribute(p[0], p[2], eylang_vars=EYLANG_VARS)
@pg.production('variable : NAME')
def p_variable(p):
return Variable(p[0], eylang_vars=EYLANG_VARS)
@pg.production('constant : NUMBER')
@pg.production('constant : STRING')
def p_constant(p):
return Constant(p[0])
parser = pg.build()
| 28.070707 | 88 | 0.634401 | 1,257 | 8,337 | 4.151154 | 0.098648 | 0.209276 | 0.039862 | 0.024147 | 0.503258 | 0.376006 | 0.267727 | 0.197585 | 0.168455 | 0.125335 | 0 | 0.020608 | 0.190956 | 8,337 | 296 | 89 | 28.165541 | 0.753002 | 0.011035 | 0 | 0.213439 | 0 | 0 | 0.284189 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.185771 | false | 0 | 0.01581 | 0.114625 | 0.407115 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
28bcaa1ac15b3db94c9394ad8bffc1fd508444f9 | 228 | py | Python | read_write_using_with_as.py | snalahi/Python-Functions-Files-and-Dictionaries | c86cb4a8e058244567c3d75491820c77ef3ce6e5 | [
"MIT"
] | 1 | 2021-06-07T14:07:05.000Z | 2021-06-07T14:07:05.000Z | read_write_using_with_as.py | snalahi/Python-Functions-Files-and-Dictionaries | c86cb4a8e058244567c3d75491820c77ef3ce6e5 | [
"MIT"
] | null | null | null | read_write_using_with_as.py | snalahi/Python-Functions-Files-and-Dictionaries | c86cb4a8e058244567c3d75491820c77ef3ce6e5 | [
"MIT"
] | null | null | null | fname = 'mydata.txt'
with open(fname, 'r') as md:
for line in md:
print(line)
# continue on with other code
fname = 'mydata2.txt'
with open(fname, 'w') as wr:
for i in range (20):
wr.write(str(i) + '\n')
| 22.8 | 31 | 0.583333 | 39 | 228 | 3.410256 | 0.641026 | 0.105263 | 0.165414 | 0.240602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017751 | 0.258772 | 228 | 9 | 32 | 25.333333 | 0.769231 | 0.118421 | 0 | 0 | 0 | 0 | 0.125628 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
28c36ea279e104daf592ff3b0232bdb41983293e | 634 | py | Python | djangopypi2/apps/pypi_frontend/models.py | MediaMath/djangopypi2 | 5d6f203b35378f140cd3791db81115aa722e5ee2 | [
"BSD-3-Clause"
] | 12 | 2015-03-27T22:45:21.000Z | 2017-09-13T03:18:12.000Z | djangopypi2/apps/pypi_frontend/models.py | MediaMath/djangopypi2 | 5d6f203b35378f140cd3791db81115aa722e5ee2 | [
"BSD-3-Clause"
] | 4 | 2015-12-09T20:28:21.000Z | 2019-07-05T03:23:34.000Z | djangopypi2/apps/pypi_frontend/models.py | MediaMath/djangopypi2 | 5d6f203b35378f140cd3791db81115aa722e5ee2 | [
"BSD-3-Clause"
] | 14 | 2015-01-13T15:41:42.000Z | 2020-08-07T20:17:54.000Z | from django.db import models
from django.utils.translation import ugettext_lazy as _
class MirrorSite(models.Model):
enabled = models.BooleanField(default=False)
name = models.CharField(max_length=64)
url = models.CharField(max_length=255, unique=True)
def __unicode__(self):
return self.name
class MirrorLog(models.Model):
mirror_site = models.ForeignKey(MirrorSite, related_name='logs')
created = models.DateTimeField(auto_now_add=True)
action = models.CharField(max_length=256)
def __unicode__(self):
return self.action
class Meta:
get_latest_by = 'created'
| 28.818182 | 68 | 0.719243 | 79 | 634 | 5.531646 | 0.594937 | 0.102975 | 0.12357 | 0.16476 | 0.10984 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015564 | 0.189274 | 634 | 21 | 69 | 30.190476 | 0.83463 | 0 | 0 | 0.125 | 0 | 0 | 0.01735 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0.125 | 0.9375 | 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 | 0 | 0 | 0 | 2 |
28c598e0020a4d2d823b498ab77301890926e5e5 | 544 | py | Python | src/pid.py | TamasSzepessy/DJITelloOpticalControl | 00b704afea1eb9e2bcb82fcde41baae83934c48e | [
"MIT"
] | 21 | 2020-01-08T04:40:48.000Z | 2022-03-28T21:16:35.000Z | pid.py | alijafari79/DJITelloOpticalControl | 50ab8883fcb3c8520cac14ee0c05e9050b9387c8 | [
"MIT"
] | null | null | null | pid.py | alijafari79/DJITelloOpticalControl | 50ab8883fcb3c8520cac14ee0c05e9050b9387c8 | [
"MIT"
] | 3 | 2021-01-17T19:11:51.000Z | 2021-10-30T03:26:05.000Z | class PID(object):
def __init__(self, kp, ki, kd):
self.kp = kp
self.ki = ki
self.kd = kd
self.error_int = 0
self.error_prev = None
def control(self, error):
self.error_int += error
if self.error_prev is None:
self.error_prev = error
error_deriv = error - self.error_prev
self.error_prev = error
return self.kp*error + self.ki*self.error_int + self.kd*error_deriv
def reset(self):
self.error_prev = None
self.error_int = 0 | 28.631579 | 75 | 0.579044 | 78 | 544 | 3.833333 | 0.25641 | 0.331104 | 0.26087 | 0.086957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005464 | 0.327206 | 544 | 19 | 76 | 28.631579 | 0.811475 | 0 | 0 | 0.352941 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0 | 0 | 0.294118 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
28d785a9a90e17a1d6a61189106140fb56ac8212 | 508 | py | Python | huoguoml/util/json.py | huoguoml/huoguoml | 749b0b2a24ddcf1ab34c36267eae7a2427b907f4 | [
"Apache-2.0"
] | 5 | 2021-08-02T16:35:29.000Z | 2022-03-28T13:07:38.000Z | huoguoml/util/json.py | huoguoml/huoguoml | 749b0b2a24ddcf1ab34c36267eae7a2427b907f4 | [
"Apache-2.0"
] | 12 | 2021-07-03T19:00:07.000Z | 2021-07-11T17:26:47.000Z | huoguoml/util/json.py | huoguoml/huoguoml | 749b0b2a24ddcf1ab34c36267eae7a2427b907f4 | [
"Apache-2.0"
] | null | null | null | """
The huoguoml.util.string module contains some utility functions for json operations.
"""
import json
from typing import Any
def read_json(json_path: str) -> Any:
"""Read a json file and return the content. Returns None if not exist
"""
with open(json_path) as json_file:
data = json.load(json_file)
return data
def save_json(json_path: str, data: Any):
"""Save data as json format
"""
with open(json_path, 'w') as json_file:
json.dump(data, json_file)
| 24.190476 | 84 | 0.67126 | 78 | 508 | 4.24359 | 0.5 | 0.120846 | 0.072508 | 0.090634 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.228346 | 508 | 20 | 85 | 25.4 | 0.844388 | 0.366142 | 0 | 0 | 0 | 0 | 0.003289 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
28eb714771d9076b8e0935222ef1139a2f907be1 | 153 | py | Python | mallenom/reports/urls.py | crowmurk/mallenom | c85bba2e657965879e6fac18bb762ca739ff4d98 | [
"MIT"
] | null | null | null | mallenom/reports/urls.py | crowmurk/mallenom | c85bba2e657965879e6fac18bb762ca739ff4d98 | [
"MIT"
] | 9 | 2020-02-12T01:04:30.000Z | 2022-02-10T09:22:09.000Z | mallenom/reports/urls.py | crowmurk/mallenom | c85bba2e657965879e6fac18bb762ca739ff4d98 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
app_name = 'reports'
urlpatterns = [
path('', views.ReportDownload.as_view(), name='report'),
]
| 13.909091 | 60 | 0.686275 | 19 | 153 | 5.421053 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.169935 | 153 | 10 | 61 | 15.3 | 0.811024 | 0 | 0 | 0 | 0 | 0 | 0.084967 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
e900bb00b3d9ba4b9bee5e1647de6700c99f19a7 | 722 | py | Python | eqbtest/util/data/regen.py | cryptotechguru/tesseract | 9b64c61483710c94390404c3d920c1059cbfcda7 | [
"MIT"
] | null | null | null | eqbtest/util/data/regen.py | cryptotechguru/tesseract | 9b64c61483710c94390404c3d920c1059cbfcda7 | [
"MIT"
] | 11 | 2019-04-23T20:37:03.000Z | 2021-08-11T11:03:13.000Z | eqbtest/util/data/regen.py | cryptotechguru/tesseract | 9b64c61483710c94390404c3d920c1059cbfcda7 | [
"MIT"
] | null | null | null | import os
import json
raw_data = open("bitcoin-util-test.json").read()
input_data = json.loads(raw_data)
for testObj in input_data:
inp = ""
out = ""
args = " ".join(testObj['args'])
if 'input' in testObj:
inp = testObj['input']
if 'output_cmp' in testObj:
out = testObj['output_cmp']
if out:
if inp:
# print("echo \"../../../src/tesseract-tx {} < {} > {}\"".format(args, inp, out))
# print("../../../src/tesseract-tx {} < {} > {}".format(args, inp, out))
pass
else:
# print("echo \"../../../src/tesseract-tx {} > {}\"".format(args, out))
print("../../../src/tesseract-tx {} > {}".format(args, out))
| 27.769231 | 93 | 0.49723 | 83 | 722 | 4.253012 | 0.361446 | 0.135977 | 0.15864 | 0.226629 | 0.402266 | 0.402266 | 0.393768 | 0 | 0 | 0 | 0 | 0 | 0.272853 | 722 | 25 | 94 | 28.88 | 0.672381 | 0.304709 | 0 | 0 | 0 | 0 | 0.180723 | 0.094378 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.058824 | 0.117647 | 0 | 0.117647 | 0.058824 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e908ab79c220c70a539792113ab957b27c6fca1e | 18,748 | py | Python | dbmanage/myapp/templates/include/pagejump/bak/function.py | bopopescu/sbdb_new | 52d57f2dd6e553f60a06c97e7a8631d41f8f2ea6 | [
"Apache-2.0"
] | 3 | 2018-01-13T14:56:07.000Z | 2019-04-20T06:11:03.000Z | dbmanage/myapp/templates/include/pagejump/bak/function.py | bopopescu/sbdb_new | 52d57f2dd6e553f60a06c97e7a8631d41f8f2ea6 | [
"Apache-2.0"
] | null | null | null | dbmanage/myapp/templates/include/pagejump/bak/function.py | bopopescu/sbdb_new | 52d57f2dd6e553f60a06c97e7a8631d41f8f2ea6 | [
"Apache-2.0"
] | 1 | 2020-07-22T02:37:30.000Z | 2020-07-22T02:37:30.000Z | #!/bin/env python
#-*-coding:utf-8-*-
import MySQLdb,sys,string,time,datetime,uuid
from django.contrib.auth.models import User,Permission,ContentType,Group
from myapp.models import Db_name,Db_account,Db_instance,Oper_log,Login_log,Db_group
from dbmanage.myapp.form import LoginForm,Captcha
reload(sys)
sys.setdefaultencoding('utf8')
import ConfigParser
import smtplib
from email.mime.text import MIMEText
from email.message import Message
from email.header import Header
def get_item(data_dict,item):
try:
item_value = data_dict[item]
return item_value
except:
return '-1'
def get_config(group,config_name):
config = ConfigParser.ConfigParser()
config.readfp(open('./myapp/etc/config.ini','r'))
#config.readfp(open('../etc/config.ini','r'))
config_value=config.get(group,config_name).strip(' ').strip('\'').strip('\"')
return config_value
def filters(data):
return data.strip(' ').strip('\n').strip('\br')
host = get_config('settings','host')
port = get_config('settings','port')
user = get_config('settings','user')
passwd = get_config('settings','passwd')
dbname = get_config('settings','dbname')
select_limit = int(get_config('settings','select_limit'))
export_limit = int(get_config('settings','export_limit'))
wrong_msg = get_config('settings','wrong_msg')
public_user = get_config('settings','public_user')
def mysql_query(sql,user=user,passwd=passwd,host=host,port=int(port),dbname=dbname,limitnum=select_limit):
try:
conn=MySQLdb.connect(host=host,user=user,passwd=passwd,port=int(port),connect_timeout=5,charset='utf8')
conn.select_db(dbname)
cursor = conn.cursor()
count=cursor.execute(sql)
index=cursor.description
col=[]
#get column name
for i in index:
col.append(i[0])
#result=cursor.fetchall()
result=cursor.fetchmany(size=int(limitnum))
cursor.close()
conn.close()
return (result,col)
except Exception,e:
return([str(e)],''),['error']
#获取下拉菜单列表
def get_mysql_hostlist(username,tag='tag'):
host_list=[]
if (tag=='tag'):
a = User.objects.get(username=username)
#如果没有对应role='read'或者role='all'的account账号,则不显示在下拉菜单中
for row in a.db_name_set.all().order_by("dbtag"):
if row.db_account_set.all().filter(role__in=['read','all']):
if row.instance.all().filter(role__in=['read','all']):
host_list.append(row.dbtag)
elif (tag=='log'):
for row in Db_name.objects.values('dbtag').distinct().order_by("dbtag"):
host_list.append(row['dbtag'])
elif (tag=='exec'):
a = User.objects.get(username=username)
#如果没有对应role='write'或者role='all'的account账号,则不显示在下拉菜单中
for row in a.db_name_set.all().order_by("dbtag"):
if row.db_account_set.all().filter(role__in=['write','all']):
#排除只读实例
if row.instance.all().filter(role__in=['write','all']):
host_list.append(row.dbtag)
elif (tag == 'incept'):
a = User.objects.get(username=username)
for row in a.db_name_set.all().order_by("dbtag"):
#find the account which is admin
if row.db_account_set.all().filter(role='admin'):
if row.instance.all().filter(role__in=['write','all']):
#if row.instance.all().exclude(role='read'):
host_list.append(row.dbtag)
elif (tag == 'meta'):
for row in Db_name.objects.all().order_by("dbtag"):
#find the account which is admin
if row.db_account_set.all().filter(role='admin'):
if row.instance.filter(role__in=['write','all','read']):
host_list.append(row.dbtag)
return host_list
def get_op_type(methods='get'):
#all表示所有种类
op_list=['all','incept','truncate','drop','create','delete','update','insert','select','explain','alter','show']
if (methods=='get'):
return op_list
def get_mysql_data(hosttag,sql,useraccount,request,limitnum):
#确认dbname
a = Db_name.objects.filter(dbtag=hosttag)[0]
#a = Db_name.objects.get(dbtag=hosttag)
tar_dbname = a.dbname
#如果instance中有备库role='read',则选择从备库读取
try:
if a.instance.all().filter(role='read')[0]:
tar_host = a.instance.all().filter(role='read')[0].ip
tar_port = a.instance.all().filter(role='read')[0].port
#如果没有设置或没有role=read,则选择第一个读到的all实例读取
except Exception,e:
tar_host = a.instance.filter(role='all')[0].ip
tar_port = a.instance.filter(role='all')[0].port
# tar_host = a.instance.all()[0].ip
# tar_port = a.instance.all()[0].port
for i in a.db_account_set.all():
if i.role!='write' and i.role!='admin':
# find the specified account for the user
if i.account.all().filter(username=useraccount):
tar_username = i.user
tar_passwd = i.passwd
break
#not find specified account for the user ,specified the public account to the user
if not vars().has_key('tar_username'):
for i in a.db_account_set.all():
if i.role != 'write' and i.role != 'admin':
# find the specified account for the user
if i.account.all().filter(username=public_user):
tar_username = i.user
tar_passwd = i.passwd
break
#print tar_port+tar_passwd+tar_username+tar_host
try:
if (cmp(sql,wrong_msg)):
log_mysql_op(useraccount,sql,tar_dbname,hosttag,request)
results,col = mysql_query(sql,tar_username,tar_passwd,tar_host,tar_port,tar_dbname,limitnum)
except Exception, e:
#防止日志库记录失败,返回一个wrong_message
results,col = ([str(e)],''),['error']
#results,col = mysql_query(wrong_msg,user,passwd,host,int(port),dbname)
return results,col,tar_dbname
#检查输入语句,并返回行限制数
def check_mysql_query(sqltext,user,type='select'):
#根据user确定能够select或者export 的行数
if (type=='export'):
try :
num = User.objects.get(username=user).user_profile.export_limit
except Exception, e:
num = export_limit
elif (type=='select'):
try :
num = User.objects.get(username=user).user_profile.select_limit
except Exception, e:
num = select_limit
num=str(num)
limit = ' limit '+ num
sqltext = sqltext.strip()
sqltype = sqltext.split()[0].lower()
list_type = ['select','show','desc','explain']
#flag 1位有效 0为list_type中的无效值
flag=0
while True:
sqltext = sqltext.strip()
lastletter = sqltext[len(sqltext)-1]
if (not cmp(lastletter,';')):
sqltext = sqltext[:-1]
else:
break
#判断语句中是否已经存在limit,has_limit 为0时说明原来语句中是有limit的
try:
has_limit = cmp(sqltext.split()[-2].lower(),'limit')
except Exception,e:
#prevent some input like '1' or 'ss' ...
return wrong_msg, num
for i in list_type:
if (not cmp(i,sqltype)):
flag=1
break
if (flag==1):
if (sqltype =='select' and has_limit!=0):
return sqltext+limit,num
elif (sqltype =='select' and has_limit==0):
if (int(sqltext.split()[-1])<= int(num) ):
return sqltext,num
else:
tempsql=''
numlimit=sqltext.split()[-1]
for i in sqltext.split()[0:-1]:
tempsql=tempsql+i+' '
return tempsql+num,num
else:
return sqltext,num
else:
return wrong_msg,num
#记录用户所有操作
def log_mysql_op(user,sqltext,mydbname,dbtag,request):
user = User.objects.get(username=user)
#lastlogin = user.last_login+datetime.timedelta(hours=8)
#create_time = timezone.now()+datetime.timedelta(hours=8)
lastlogin = user.last_login
create_time = timezone.now()
username = user.username
sqltype=sqltext.split()[0].lower()
#获取ip地址
ipaddr = get_client_ip(request)
log = Oper_log (user=username,sqltext=sqltext,sqltype=sqltype,login_time=lastlogin,create_time=create_time,dbname=mydbname,dbtag=dbtag,ipaddr=ipaddr)
log.save()
return 1
def log_userlogin(request):
username = request.user.username
user = User.objects.get(username=username)
ipaddr = get_client_ip(request)
action = 'login'
create_time = timezone.now()
log = Login_log(user=username,ipaddr=ipaddr,action=action,create_time=create_time)
log.save()
def log_loginfailed(request,username):
ipaddr = get_client_ip(request)
action = 'login_failed'
create_time = timezone.now()
log = Login_log(user=username, ipaddr=ipaddr, action=action,create_time=create_time)
log.save()
def get_log_data(dbtag,optype,begin,end):
if (optype=='all'):
#如果结束时间小于开始时间,则以结束时间为准
if (end > begin):
log = Oper_log.objects.filter(dbtag=dbtag).filter(create_time__lte=end).filter(create_time__gte=begin).order_by("-create_time")[0:100]
else:
log = Oper_log.objects.filter(dbtag=dbtag).filter(create_time__lte=end).order_by("-create_time")[0:100]
else:
if (end > begin):
log = Oper_log.objects.filter(dbtag=dbtag).filter(sqltype=optype).filter(create_time__lte=end).filter(create_time__gte=begin).order_by("-create_time")[0:100]
else:
log = Oper_log.objects.filter(dbtag=dbtag).filter(sqltype=optype).filter(create_time__lte=end).order_by("-create_time")[0:100]
return log
def check_explain (sqltext):
sqltext = sqltext.strip()
sqltype = sqltext.split()[0].lower()
if (sqltype =='select'):
sqltext = 'explain extended '+sqltext
return sqltext
else:
return wrong_msg
def my_key(group, request):
try:
real_ip = request.META['HTTP_X_FORWARDED_FOR']
regip = real_ip.split(",")[0]
except:
try:
regip = request.META['REMOTE_ADDR']
except:
regip = ""
form = LoginForm(request.POST)
myform = Captcha(request.POST)
#验证码正确情况下,错误密码登录次数
if form.is_valid() and myform.is_valid():
username = form.cleaned_data['username']
# password = form.cleaned_data['password']
return regip+username
#验证码错误不计算
else:
return regip+str(uuid.uuid1())
def get_client_ip(request):
try:
real_ip = request.META['HTTP_X_FORWARDED_FOR']
regip = real_ip.split(",")[0]
except:
try:
regip = request.META['REMOTE_ADDR']
except:
regip = ""
return regip
def check_mysql_exec(sqltext,request,type='dml'):
# request.user.has_perm('myapp.')
sqltext = sqltext.strip()
sqltype = sqltext.split()[0].lower()
list_type = ['insert','update','delete','create','alter','drop','truncate','replace']
if (sqltype=='insert'):
if request.user.has_perm('myapp.can_insert_mysql'):
return sqltext
else:
return "select 'Don\\'t have permission to \"insert\"'"
elif(sqltype=='update' or sqltype == 'replace'):
if request.user.has_perm('myapp.can_update_mysql'):
return sqltext
else:
return "select 'Don\\'t have permission to \"update\"'"
elif(sqltype=='delete'):
if request.user.has_perm('myapp.can_delete_mysql'):
return sqltext
else:
return "select 'Don\\'t have permission to \"delete\"'"
elif(sqltype=='truncate'):
if request.user.has_perm('myapp.can_truncate_mysql'):
return sqltext
else:
return "select 'Don\\'t have permission to \"truncate\"'"
elif(sqltype=='create'):
if request.user.has_perm('myapp.can_create_mysql'):
return sqltext
else:
return "select 'Don\\'t have permission to \"create\"'"
elif(sqltype=='drop'):
if request.user.has_perm('myapp.can_drop_mysql'):
return sqltext
else:
return "select 'Don\\'t have permission to \"drop\"'"
elif (sqltype == 'alter'):
if request.user.has_perm('myapp.can_alter_mysql'):
return sqltext
else:
return "select 'Don\\'t have permission to \"alter\"'"
else:
return wrong_msg
def run_mysql_exec(hosttag,sql,useraccount,request):
#确认dbname
a = Db_name.objects.filter(dbtag=hosttag)[0]
#a = Db_name.objects.get(dbtag=hosttag)
tar_dbname = a.dbname
if (not cmp(sql,wrong_msg)):
results,col = mysql_query(wrong_msg,user,passwd,host,int(port),dbname)
return results,col,tar_dbname
#如果instance中有备库role='write',则选择从主库读取
try:
if a.instance.all().filter(role='write')[0]:
tar_host = a.instance.all().filter(role='write')[0].ip
tar_port = a.instance.all().filter(role='write')[0].port
#如果没有设置或没有role=write,则选择第一个role=all的库读取
except Exception,e:
try:
tar_host = a.instance.all().filter(role='all')[0].ip
tar_port = a.instance.all().filter(role='all')[0].port
except Exception,e:
#没有找到role为all或者write的实例配置
wrongmsg = "select \"" +str(e).replace('"',"\"")+"\""
results,col = mysql_query(wrongmsg,user,passwd,host,int(port),dbname)
return results,col,tar_dbname
#find the useraccount and passwd for the user
for i in a.db_account_set.all():
if i.role != 'read' and i.role != 'admin':
#find the specified account for the user
if i.account.all().filter(username=useraccount):
tar_username = i.user
tar_passwd = i.passwd
break
#not find specified account for the user ,specified the public account to the user
if not vars().has_key('tar_username'):
for i in a.db_account_set.all():
if i.role != 'read' and i.role != 'admin':
# find the specified account for the user
if i.account.all().filter(username=public_user):
tar_username = i.user
tar_passwd = i.passwd
break
try:
#之前根据check_mysql_exec判断过权限,如果是select则说明没权限,不记录日志
if (sql.split()[0]!='select'):
log_mysql_op(useraccount,sql,tar_dbname,hosttag,request)
results,col = mysql_exec(sql,tar_username,tar_passwd,tar_host,tar_port,tar_dbname)
else:
results,col = mysql_query(sql,user,passwd,host,int(port),dbname)
except Exception, e:
#防止库连不上,返回一个wrong_message
results,col = ([str(e)],''),['error']
return results,col,tar_dbname
def mysql_exec(sql,user=user,passwd=passwd,host=host,port=int(port),dbname=dbname):
try:
conn=MySQLdb.connect(host=host,user=user,passwd=passwd,port=int(port),connect_timeout=5,charset='utf8')
conn.select_db(dbname)
curs = conn.cursor()
result=curs.execute(sql)
conn.commit()
curs.close()
conn.close()
return (['影响行数: '+str(result)],''),['success']
except Exception,e:
if str(e)=='(2014, "Commands out of sync; you can\'t run this command now")':
return (['只能输入单条sql语句'],''),['error']
else:
return([str(e)],''),['error']
def get_pre(dbtag):
db = Db_name.objects.get(dbtag=dbtag)
ins = db.instance.all()
acc = db.account.all()
acc_list = Db_account.objects.filter(dbname=db)
gp = db.db_group_set.all()
return acc_list,ins,acc,gp
def get_user_pre(username,request):
if len(username)<=30:
try :
info = "PRIVILEGES FOR " + username
dblist = User.objects.get(username=username).db_name_set.all()
except :
info = "PLEASE CHECK YOUR INPUT"
dblist = User.objects.get(username=request.user.username).db_name_set.all()
else:
info = "INPUT TOO LONG"
dblist = User.objects.get(username=request.user.username).db_name_set.all()
return dblist,info
#used in prequery.html
def get_groupdb(group):
grouplist = Db_group.objects.filter(groupname=group)
return grouplist
#used in prequery.html
def get_privileges(username):
pri = User.objects.get(username=username).user_permissions.all()
return pri
def get_UserAndGroup():
user_list = User.objects.exclude(username=public_user).order_by('username')
group_list = Db_group.objects.all().order_by('groupname')
# for row in User.objects.all():
# user_list.append(row.username)
return user_list,group_list
def get_user_grouppri(username):
user = User.objects.get(username=username)
a = user.db_group_set.all()
b = user.groups.all()
return a,b
def clear_userpri(username):
user = User.objects.get(username=username)
for i in Db_name.objects.all():
i.account.remove(user)
for i in Db_group.objects.all():
i.account.remove(user)
user.user_permissions.clear()
user.groups.clear()
def set_groupdb(username,li):
user = User.objects.get(username=username)
tag_list=[]
for i in li:
tmp_gp = Db_group.objects.get(id=i)
try:
tmp_gp.account.add(user)
except Exception,e:
pass
for x in tmp_gp.dbname.all():
tag_list.append(x.dbtag)
try:
x.account.add(user)
except Exception,e:
pass
tag_list = list(set(tag_list))
return tag_list
#create user in pre_set.html
def create_user(username,passwd):
if len(username)>0 and len(passwd)>0:
user = User.objects.create_user(username=username,password=passwd)
user.save()
return user
#delete user in pre_set.html
def delete_user(username):
user = User.objects.get(username=username)
user.delete()
#user dbtaglist and user to set user-db relation
def set_user_db(user,dblist):
setdblist = Db_name.objects.filter(dbtag__in=dblist)
for i in setdblist:
try:
i.account.add(user)
i.save()
except Exception,e:
pass
# a = Permission.objects.filter(codename__istartswith='can')
def set_usergroup(user,group):
# user.groups.clear()
grouplist = Group.objects.filter(name__in=group)
for i in grouplist:
try:
user.groups.add(i)
user.save()
except Exception,e:
pass
# for i in a:
# print i.codename
def get_usergp_list():
# perlist = Permission.objects.filter(codename__istartswith='can')
grouplist = Group.objects.all().order_by('name')
return grouplist
def main():
return 1
if __name__=='__main__':
main()
| 35.306968 | 169 | 0.62204 | 2,438 | 18,748 | 4.634126 | 0.132896 | 0.017702 | 0.018587 | 0.029209 | 0.532749 | 0.478049 | 0.431227 | 0.369623 | 0.337759 | 0.312445 | 0 | 0.005202 | 0.241306 | 18,748 | 530 | 170 | 35.373585 | 0.789089 | 0.108598 | 0 | 0.442308 | 0 | 0.021635 | 0.085706 | 0.009309 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.050481 | 0.021635 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e90b4086e9db3f0b3a375c307757f9134b7204de | 278 | py | Python | oands/forms.py | PARAVPREET17/OCR_WEB_APP | abe827a91035abe7f532df1811f20750cb6d52ce | [
"MIT"
] | null | null | null | oands/forms.py | PARAVPREET17/OCR_WEB_APP | abe827a91035abe7f532df1811f20750cb6d52ce | [
"MIT"
] | 1 | 2021-09-13T06:23:35.000Z | 2021-09-13T06:23:35.000Z | oands/forms.py | PARAVPREET17/OCR_WEB_APP | abe827a91035abe7f532df1811f20750cb6d52ce | [
"MIT"
] | null | null | null | from django import forms
from .models import Ocr,Contact
class ImageUpload(forms.ModelForm):
class Meta:
model = Ocr
fields = ['image']
class ContactForm(forms.ModelForm):
class Meta:
model=Contact
fields=['name', 'email', 'message']
| 18.533333 | 43 | 0.640288 | 31 | 278 | 5.741935 | 0.580645 | 0.157303 | 0.213483 | 0.258427 | 0.314607 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.251799 | 278 | 14 | 44 | 19.857143 | 0.855769 | 0 | 0 | 0.2 | 0 | 0 | 0.07554 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e913f40f2dc481ee0a80008a4315bfff04d5c2c0 | 228 | py | Python | pydis_site/constants.py | hannah-m-moore/site | b2f12acc82556b8d7a8ab1f60770b8325b8f3c38 | [
"MIT"
] | 700 | 2018-11-17T15:56:51.000Z | 2022-03-30T22:53:17.000Z | pydis_site/constants.py | foxy4096/site | 63b464b57ea0824570879f24baaaca6fd80393ee | [
"MIT"
] | 542 | 2018-11-17T13:39:42.000Z | 2022-03-31T11:24:00.000Z | pydis_site/constants.py | foxy4096/site | 63b464b57ea0824570879f24baaaca6fd80393ee | [
"MIT"
] | 178 | 2018-11-21T09:06:56.000Z | 2022-03-31T07:43:28.000Z | import os
GIT_SHA = os.environ.get("GIT_SHA", "development")
GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN")
# How long to wait for synchronous requests before timing out
TIMEOUT_PERIOD = int(os.environ.get("TIMEOUT_PERIOD", 5))
| 32.571429 | 61 | 0.767544 | 36 | 228 | 4.694444 | 0.638889 | 0.159763 | 0.213018 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004926 | 0.109649 | 228 | 6 | 62 | 38 | 0.827586 | 0.258772 | 0 | 0 | 0 | 0 | 0.263473 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e9214355d8ab4997ce1dc691f925d65e2d634a9a | 216 | py | Python | kafka/consumers.py | anderscui/nlpy3 | f9d927ea4cf1767eb4c21f1ad9ca3b061d5d16e8 | [
"MIT"
] | null | null | null | kafka/consumers.py | anderscui/nlpy3 | f9d927ea4cf1767eb4c21f1ad9ca3b061d5d16e8 | [
"MIT"
] | null | null | null | kafka/consumers.py | anderscui/nlpy3 | f9d927ea4cf1767eb4c21f1ad9ca3b061d5d16e8 | [
"MIT"
] | null | null | null | # coding=utf-8
from kafka import KafkaConsumer
consumer = KafkaConsumer('CDC', bootstrap_servers='ec2-54-223-226-77.cn-north-1.compute.amazonaws.com.cn:9092', group_id='cdcgrp')
for msg in consumer:
print(msg)
| 27 | 130 | 0.75463 | 34 | 216 | 4.735294 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087629 | 0.101852 | 216 | 7 | 131 | 30.857143 | 0.742268 | 0.055556 | 0 | 0 | 0 | 0.25 | 0.331683 | 0.287129 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e92cda2c8f63379d5b6e9edae4489d1e39a0d634 | 166 | py | Python | MITx6.00/pset1e2.py | dpanayotov/CS1314 | 8f5318c18fd2ea3aaec622eb5eb4d021065fc141 | [
"Apache-2.0"
] | null | null | null | MITx6.00/pset1e2.py | dpanayotov/CS1314 | 8f5318c18fd2ea3aaec622eb5eb4d021065fc141 | [
"Apache-2.0"
] | null | null | null | MITx6.00/pset1e2.py | dpanayotov/CS1314 | 8f5318c18fd2ea3aaec622eb5eb4d021065fc141 | [
"Apache-2.0"
] | null | null | null | s = 'azcbobobegghakl'
sub = 'bob'
count = 0
for i in range(0, len(s)):
if sub in s[i:i+3]:
count+=1
print "Number of times bob occurs is: " + str(count)
| 18.444444 | 52 | 0.590361 | 31 | 166 | 3.16129 | 0.677419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032258 | 0.253012 | 166 | 8 | 53 | 20.75 | 0.758065 | 0 | 0 | 0 | 0 | 0 | 0.295181 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.142857 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e93d752ab220da597cf6043df9542f8391127f83 | 1,387 | py | Python | myproject/boards/tests/test_templatetags.py | xiaohui100/AlfonsBlog | 1c9854331129ec695df1530d8d8289e8a0d2d5fa | [
"MIT"
] | null | null | null | myproject/boards/tests/test_templatetags.py | xiaohui100/AlfonsBlog | 1c9854331129ec695df1530d8d8289e8a0d2d5fa | [
"MIT"
] | 3 | 2020-06-05T18:11:15.000Z | 2021-06-10T20:18:28.000Z | myproject/boards/tests/test_templatetags.py | Alfonsxh/AlfonsBlog | 1c9854331129ec695df1530d8d8289e8a0d2d5fa | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# encoding: utf-8
"""
@author: Alfons
@contact: alfons_xh@163.com
@file: test_templatetags.py
@time: 18-3-25 上午11:38
@version: v1.0
"""
from django import forms
from django.test import TestCase
from ..templatetags.form_tags import field_type, input_class
class ExampleForm(forms.Form):
name = forms.CharField()
password = forms.CharField(widget=forms.PasswordInput())
class Meta:
fields = ('name', 'password')
class FieldTypeTests(TestCase):
def test_field_widget_type(self):
form = ExampleForm()
self.assertEquals('TextInput', field_type(form['name']))
self.assertEquals('PasswordInput', field_type(form['password']))
class InputClassTests(TestCase):
def test_unbound_field_initial_state(self):
form = ExampleForm() # unbound form
self.assertEquals('form-control ', input_class(form['name']))
def test_valid_bound_field(self):
form = ExampleForm({'name': 'john', 'password': '123'}) # bound form (field + data)
self.assertEquals('form-control is-valid', input_class(form['name']))
self.assertEquals('form-control ', input_class(form['password']))
def test_invalid_bound_field(self):
form = ExampleForm({'name': '', 'password': '123'}) # bound form (field + data)
self.assertEquals('form-control is-invalid', input_class(form['name']))
| 32.255814 | 92 | 0.68349 | 169 | 1,387 | 5.467456 | 0.366864 | 0.103896 | 0.082251 | 0.116883 | 0.285714 | 0.285714 | 0.214286 | 0.125541 | 0.125541 | 0.125541 | 0 | 0.018229 | 0.16943 | 1,387 | 42 | 93 | 33.02381 | 0.783854 | 0.152848 | 0 | 0.083333 | 0 | 0 | 0.146174 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.166667 | false | 0.25 | 0.125 | 0 | 0.541667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
3a5d43a45aa5c5f984d90cf4cd0fff59e0b06e9a | 78 | py | Python | login.py | changyuejia/PY04 | c1d1493988b991803d04d4a85325e4e45cf56735 | [
"MIT"
] | 1 | 2019-05-13T12:28:43.000Z | 2019-05-13T12:28:43.000Z | login.py | changyuejia/PY04 | c1d1493988b991803d04d4a85325e4e45cf56735 | [
"MIT"
] | null | null | null | login.py | changyuejia/PY04 | c1d1493988b991803d04d4a85325e4e45cf56735 | [
"MIT"
] | null | null | null | number1=10
number2=20
number4=40
number3=30
print('hello world')
print('镜湖')
| 9.75 | 20 | 0.74359 | 13 | 78 | 4.461538 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.171429 | 0.102564 | 78 | 7 | 21 | 11.142857 | 0.657143 | 0 | 0 | 0 | 0 | 0 | 0.168831 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
3a65e44f208a0550a7900155c9e81d64b8be3570 | 65 | py | Python | ABC181/ABC181_A.py | consommee/AtCoder | 9beccf6a1202ca48491b4fcf748aa3dba0f12fb3 | [
"MIT"
] | null | null | null | ABC181/ABC181_A.py | consommee/AtCoder | 9beccf6a1202ca48491b4fcf748aa3dba0f12fb3 | [
"MIT"
] | null | null | null | ABC181/ABC181_A.py | consommee/AtCoder | 9beccf6a1202ca48491b4fcf748aa3dba0f12fb3 | [
"MIT"
] | null | null | null | n=int(input())%2
if n==0:
print("White")
else:
print("Black") | 13 | 16 | 0.584615 | 12 | 65 | 3.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035714 | 0.138462 | 65 | 5 | 17 | 13 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0.151515 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3a802e288d09056bad6109e54b5cda224d4269aa | 55 | py | Python | simplewrapmat/__init__.py | yasutow/simplewrapmat | 1f397c9a57874c2ba793b00ecc48f90ae194d82e | [
"MIT"
] | null | null | null | simplewrapmat/__init__.py | yasutow/simplewrapmat | 1f397c9a57874c2ba793b00ecc48f90ae194d82e | [
"MIT"
] | null | null | null | simplewrapmat/__init__.py | yasutow/simplewrapmat | 1f397c9a57874c2ba793b00ecc48f90ae194d82e | [
"MIT"
] | null | null | null | from .func import (
plot_X,
)
__version__='0.0.1'
| 9.166667 | 19 | 0.618182 | 9 | 55 | 3.222222 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069767 | 0.218182 | 55 | 5 | 20 | 11 | 0.604651 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3aa91b9eb5fc9c25bda50c0abf2a515e50fb4d44 | 378 | py | Python | kao_decorators/lazy_property.py | cloew/KaoDecorators | 53e591f21bd6064237198423bf72ba9474ec5a55 | [
"MIT"
] | null | null | null | kao_decorators/lazy_property.py | cloew/KaoDecorators | 53e591f21bd6064237198423bf72ba9474ec5a55 | [
"MIT"
] | null | null | null | kao_decorators/lazy_property.py | cloew/KaoDecorators | 53e591f21bd6064237198423bf72ba9474ec5a55 | [
"MIT"
] | null | null | null |
def lazy_property(fn):
""" Convert function into a property where the function is
only called the first time the property is accessed """
varName = "__{0}".format(fn.__name__)
def lazyLoad(self):
if not hasattr(self, varName):
setattr(self, varName, fn(self))
return getattr(self, varName)
return property(lazyLoad) | 37.8 | 64 | 0.637566 | 47 | 378 | 4.978723 | 0.595745 | 0.141026 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00361 | 0.267196 | 378 | 10 | 65 | 37.8 | 0.841155 | 0.283069 | 0 | 0 | 0 | 0 | 0.020325 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.