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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
da32955b6a838809243690648ecdedc083802a70 | 344 | py | Python | shop/mainapp/urls.py | Monkey8bit/django-basics | c9df06c68a5d7470bc5a4da4dc55e1fe0217e063 | [
"MIT"
] | null | null | null | shop/mainapp/urls.py | Monkey8bit/django-basics | c9df06c68a5d7470bc5a4da4dc55e1fe0217e063 | [
"MIT"
] | null | null | null | shop/mainapp/urls.py | Monkey8bit/django-basics | c9df06c68a5d7470bc5a4da4dc55e1fe0217e063 | [
"MIT"
] | null | null | null | from django.urls import path
import mainapp.views as mainapp
app_name = "mainapp"
urlpatterns = [
path("", mainapp.product, name="index"),
path("<int:pk>/", mainapp.product, name="category"),
path("<int:pk>/page/<int:page>/", mainapp.product, name="page"),
path("product/<int:pk>/", mainapp.product_page, name="product"),
]
| 24.571429 | 68 | 0.659884 | 45 | 344 | 5 | 0.377778 | 0.248889 | 0.24 | 0.168889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136628 | 344 | 13 | 69 | 26.461538 | 0.757576 | 0 | 0 | 0 | 0 | 0 | 0.238372 | 0.072674 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
da6640d3525fee28eab50ae45f0fb7607c6877ec | 2,131 | py | Python | visa2.py | MA0R/Ref-Step-Algorithm | 7a30bbbd454339f5c3b634a81831d73e2cc2a688 | [
"Apache-2.0"
] | null | null | null | visa2.py | MA0R/Ref-Step-Algorithm | 7a30bbbd454339f5c3b634a81831d73e2cc2a688 | [
"Apache-2.0"
] | null | null | null | visa2.py | MA0R/Ref-Step-Algorithm | 7a30bbbd454339f5c3b634a81831d73e2cc2a688 | [
"Apache-2.0"
] | null | null | null | """
A simple class to allow quick testing of GPIB programs without instruments.
All reads from an instrument return a semi-randomised number regardless of
the specific command that may have been sent prior to reading.
"""
import stuff
import time
## VisaIOError = False
"""
Old pyvisa calls.
"""
def get_instruments_list():
#specific to this setup
return ['GPIB0::16', 'GPIB0::22']
class Gpib(object):
def send_ifc(self):
return
class GpibInstrument(object):
def __init__(self, name):
self.name = name
self.data = stuff.DataGen()
def write(self, command):
time.sleep(0.1)
return
def read_values(self):
time.sleep(0.2)
return [self.data.next()]
class VisaIOError(object):
"""Exception class for VISA I/O errors.
Please note that all values for "error_code" are negative according to the
specification (VPP-4.3.2, observation 3.3.2) and the NI implementation.
"""
def __init__(self, error_code):
abbreviation, description = _completion_and_error_messages[error_code]
Error.__init__(self, abbreviation + ": " + description)
self.error_code = error_code
"""
New pyVisa calls, post 1.4
"""
class SpecificItem(object):
"""
All the dummy methods that a specific item (instrument or bus)is expected
to have
"""
def __init__(self, name):
self.name = name
self.data = stuff.DataGen()
def send_ifc(self):
return
def write(self,something):
return
def read_raw(self):
time.sleep(0.2)
return self.data.next()
def read(self):
time.sleep(0.2)
return self.data.next()
class ResourceManager(object):
"""
Newer pyVisa approach
"""
def list_resources(self):
return ['GPIB0::10', 'GPIB0::16']
def open_resource(self, specific_item):
specific_item = SpecificItem(specific_item)
return specific_item
| 24.215909 | 79 | 0.596903 | 256 | 2,131 | 4.824219 | 0.425781 | 0.032389 | 0.032389 | 0.034008 | 0.19919 | 0.169231 | 0.169231 | 0.169231 | 0.169231 | 0.14251 | 0 | 0.018957 | 0.306898 | 2,131 | 87 | 80 | 24.494253 | 0.817197 | 0.256218 | 0 | 0.404762 | 0 | 0 | 0.027616 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.309524 | false | 0 | 0.047619 | 0.119048 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
da71e377e8640f7d0b437b9e9475e281b189b3c9 | 1,814 | py | Python | setup.py | cvzi/foodemoji | b43d80f5a6abada96d8383a5fb442e4bf4083631 | [
"MIT"
] | 1 | 2021-07-28T18:31:59.000Z | 2021-07-28T18:31:59.000Z | setup.py | cvzi/foodemoji | b43d80f5a6abada96d8383a5fb442e4bf4083631 | [
"MIT"
] | null | null | null | setup.py | cvzi/foodemoji | b43d80f5a6abada96d8383a5fb442e4bf4083631 | [
"MIT"
] | 1 | 2018-10-23T09:20:52.000Z | 2018-10-23T09:20:52.000Z | import setuptools
import os
import io
with io.open("README.md", encoding="utf-8") as f:
long_description = f.read().strip()
version = None
with io.open(os.path.join("foodemoji", "__init__.py"), encoding="utf-8") as f:
for line in f:
if line.strip().startswith("__version__"):
version = line.split("=")[1].strip()
version = version.replace('"', "").replace("'", "")
break
setuptools.setup(
name="german-foodemoji",
version=version,
author="cuzi",
author_email="cuzi@openmail.cc",
license="MIT",
description="Decorate German text with food specific emojis",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/cvzi/foodemoji",
packages=["foodemoji"],
package_dir={"foodemoji": "foodemoji"},
package_data={"foodemoji": ["foodemojis.json"]},
zip_safe=True,
test_suite="nose.collector",
tests_require=["emoji", "nose"],
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Communications :: Chat",
"Topic :: Printing",
"Topic :: Text Processing :: General"
]
)
| 35.568627 | 79 | 0.588754 | 190 | 1,814 | 5.521053 | 0.521053 | 0.181125 | 0.238322 | 0.173499 | 0.080076 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014022 | 0.253032 | 1,814 | 50 | 80 | 36.28 | 0.75941 | 0 | 0 | 0 | 0 | 0 | 0.465116 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.06383 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
da73a8bee13190d7e6ce04a2adb3a4da8ce14080 | 255 | py | Python | fetch.py | oosidat/pyphotoanalytics | 8206b4836d2dac8f4321cfc4c214fc6a076f00e5 | [
"MIT"
] | null | null | null | fetch.py | oosidat/pyphotoanalytics | 8206b4836d2dac8f4321cfc4c214fc6a076f00e5 | [
"MIT"
] | null | null | null | fetch.py | oosidat/pyphotoanalytics | 8206b4836d2dac8f4321cfc4c214fc6a076f00e5 | [
"MIT"
] | null | null | null | import requests
INSTAGRAM_MEDIA_LINK = "https://www.instagram.com/{username}/media/"
def fetch_user_photos(username):
print "fetching..."
url = INSTAGRAM_MEDIA_LINK.format(username=username)
response = requests.get(url);
return response
| 25.5 | 68 | 0.741176 | 31 | 255 | 5.903226 | 0.645161 | 0.153005 | 0.196721 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137255 | 255 | 9 | 69 | 28.333333 | 0.831818 | 0 | 0 | 0 | 0 | 0 | 0.211765 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.142857 | null | null | 0.142857 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
da8dea08257cffe7cb7b25d97d102c4ebef23d52 | 426 | py | Python | src/constants/datasets.py | shivanip14/semisupclustering | c13f007e5e5ca3788ea79623f9bf975ae1b4d5f2 | [
"MIT"
] | null | null | null | src/constants/datasets.py | shivanip14/semisupclustering | c13f007e5e5ca3788ea79623f9bf975ae1b4d5f2 | [
"MIT"
] | null | null | null | src/constants/datasets.py | shivanip14/semisupclustering | c13f007e5e5ca3788ea79623f9bf975ae1b4d5f2 | [
"MIT"
] | null | null | null | from src.runners.iris_runner import cluster as iris
from src.runners.twentynewsgroups_runner import cluster as twentynewsgroups
from src.runners.waveform_runner import cluster as waveform
available_datasets = {'iris': {'runner': iris, 'name': 'iris'},
'twentynewsgroups': {'runner': twentynewsgroups, 'name': 'twentynewsgroups'},
'waveform': {'runner': waveform, 'name': 'waveform'}} | 60.857143 | 98 | 0.694836 | 44 | 426 | 6.636364 | 0.295455 | 0.071918 | 0.143836 | 0.215753 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180751 | 426 | 7 | 99 | 60.857143 | 0.836676 | 0 | 0 | 0 | 0 | 0 | 0.201405 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
16ffb21ba479da8e4fa3cbea8fc419e69eeafed7 | 5,976 | py | Python | cpp_src/cmd/reindexer_server/test/specs/mixins/api_mixin.py | radiophysicist/reindexer | 5a6e82158665f6e9c78536cc4a907143a157f1d7 | [
"Apache-2.0"
] | null | null | null | cpp_src/cmd/reindexer_server/test/specs/mixins/api_mixin.py | radiophysicist/reindexer | 5a6e82158665f6e9c78536cc4a907143a157f1d7 | [
"Apache-2.0"
] | null | null | null | cpp_src/cmd/reindexer_server/test/specs/mixins/api_mixin.py | radiophysicist/reindexer | 5a6e82158665f6e9c78536cc4a907143a157f1d7 | [
"Apache-2.0"
] | null | null | null | import http.client
import json
from urllib.parse import urlencode
class ApiMixin(object):
API_STATUS = {
'success': 200,
'moved_permanently': 301,
'bad_request': 400,
'unauthorized': 401,
'forbidden': 403,
'not_found': 404
}
def _server_request(self, method, url, body=None, headers={}, as_json=True):
self.api = http.client.HTTPConnection('127.0.0.1', 9088)
if body is not None and as_json:
body = json.dumps(body)
self.api.request(method, url, body, headers)
response = self.api.getresponse()
content = response.read()
content = content.decode()
res_status = response.status
try:
res_body = json.loads(content)
except:
res_body = {'message': content}
self.api.close()
return res_status, res_body
def _api_call(self, method, url, body=None, headers={}, as_json=True, with_basic_auth=True):
api_base = self.SWAGGER['basePath']
content_type = 'application/json' if as_json else 'text/plain'
def_headers = {
'Content-type': content_type,
}
if with_basic_auth:
def_headers['Authorization'] = 'Basic ' + \
self.role_token(self.role)
req_headers = {**def_headers, **headers}
return self._server_request(method, api_base + url, body, req_headers, as_json)
def _web_call(self, url, with_basic_auth=True):
headers = {}
if with_basic_auth:
headers['Authorization'] = 'Basic ' + self.role_token(self.role)
return self._server_request('GET', url, headers=headers)
def web_face_redirect(self):
return self._web_call('/face')
def web_face(self):
return self._web_call('/face/')
def web_facestaging_redirect(self):
return self._web_call('/facestaging')
def web_facestaging(self):
return self._web_call('/facestaging/')
def web_swagger_redirect(self):
return self._web_call('/swagger')
def web_swagger(self):
return self._web_call('/swagger/')
def api_check(self):
return self._api_call('GET', '/check')
def api_get_dbs(self):
return self._api_call('GET', '/db')
def api_get_sorted_dbs(self, dir=''):
order = '?sort_order=' + dir
return self._api_call('GET', '/db' + order)
def api_create_db(self, dbname):
body = {'name': dbname}
return self._api_call('POST', '/db', body)
def api_delete_db(self, dbname):
return self._api_call('DELETE', '/db/' + dbname)
def api_get_namespaces(self, dbname):
return self._api_call('GET', '/db/' + dbname + '/namespaces')
def api_get_namespace(self, dbname, nsname):
return self._api_call('GET', '/db/' + dbname + '/namespaces/' + nsname)
def api_create_namespace(self, dbname, nsname, index_array_of_dicts=[]):
body = {
'name': nsname,
'storage': {
'enabled': True
}
}
if len(index_array_of_dicts):
body['indexes'] = index_array_of_dicts
return self._api_call('POST', '/db/' + dbname + '/namespaces', body)
def api_delete_namespace(self, dbname, nsname):
return self._api_call('DELETE', '/db/' + dbname + '/namespaces/' + nsname)
def api_get_sorted_namespaces(self, dbname, dir=''):
order = '?sort_order=' + dir
return self._api_call('GET', '/db/' + dbname + '/namespaces' + order)
def api_get_indexes(self, dbname, nsname):
return self._api_call('GET', '/db/' + dbname + '/namespaces/' + nsname + '/indexes')
def api_create_index(self, dbname, nsname, body):
return self._api_call('POST', '/db/' + dbname + '/namespaces/' + nsname + '/indexes', body)
def api_update_index(self, dbname, nsname, body):
return self._api_call('PUT', '/db/' + dbname + '/namespaces/' + nsname + '/indexes', body)
def api_delete_index(self, dbname, nsname, index_name):
return self._api_call('DELETE', '/db/' + dbname + '/namespaces/' + nsname + '/indexes/' + index_name)
def api_get_items(self, dbname, nsname):
return self._api_call('GET', '/db/' + dbname + '/namespaces/' + nsname + '/items')
def api_create_item(self, dbname, nsname, item_body):
return self._api_call('POST', '/db/' + dbname + '/namespaces/' + nsname + '/items', item_body)
def api_update_item(self, dbname, nsname, item_body):
return self._api_call('PUT', '/db/' + dbname + '/namespaces/' + nsname + '/items', item_body)
def api_delete_item(self, dbname, nsname, item_body):
return self._api_call('DELETE', '/db/' + dbname + '/namespaces/' + nsname + '/items', item_body)
def api_get_paginated_items(self, dbname, nsname, limit=10, offset=0):
return self._api_call('GET', '/db/' + dbname + '/namespaces/' + nsname + '/items?'
+ urlencode({'limit': limit, 'offset': offset}))
def api_get_sorted_items(self, dbname, nsname, field='', direction=''):
return self._api_call('GET', '/db/' + dbname + '/namespaces/' + nsname + '/items?'
+ urlencode({'sort_field': field, 'sort_order': direction}))
def api_sql_exec(self, dbname, sql_query=''):
return self._api_call('GET', '/db/' + dbname + '/query?' + urlencode({'q': sql_query}))
def api_sql_post(self, dbname, body):
return self._api_call('POST', '/db/' + dbname + '/sqlquery', body, headers={'Content-type': 'text/plain'}, as_json=False)
def api_query_dsl(self, dbname, body):
return self._api_call('POST', '/db/' + dbname + '/query', body)
def api_get_filtered_items(self, dbname, nsname, filter=''):
return self._api_call('GET', '/db/' + dbname + '/namespaces/' + nsname + '/items?'
+ urlencode({'filter': filter}))
| 34.744186 | 129 | 0.601908 | 724 | 5,976 | 4.708564 | 0.168508 | 0.093869 | 0.091522 | 0.119683 | 0.533294 | 0.515107 | 0.477266 | 0.441772 | 0.327075 | 0.239366 | 0 | 0.006874 | 0.245315 | 5,976 | 171 | 130 | 34.947368 | 0.749002 | 0 | 0 | 0.059829 | 0 | 0 | 0.135208 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.282051 | false | 0 | 0.025641 | 0.222222 | 0.606838 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e50338744ce1ce4fd32a84e23f93cd09469073ba | 4,343 | py | Python | unit_tests/sequence_tests.py | YuseqYaseq/gry-kombinatoryczne | 15e5d857cdbc6ec447c0028a90c4354ba25fc553 | [
"MIT"
] | 2 | 2020-04-26T16:57:37.000Z | 2020-04-26T16:57:40.000Z | unit_tests/sequence_tests.py | YuseqYaseq/gry-kombinatoryczne | 15e5d857cdbc6ec447c0028a90c4354ba25fc553 | [
"MIT"
] | null | null | null | unit_tests/sequence_tests.py | YuseqYaseq/gry-kombinatoryczne | 15e5d857cdbc6ec447c0028a90c4354ba25fc553 | [
"MIT"
] | null | null | null | from unit_tests.common import expect, is_none, is_arithmetic_sequnce
from game.sequence import Sequence
def search_with_startidx_equals_zero():
sequence = Sequence([2, 4, 6, 7, 11], 3)
res = sequence.search(1, 0)
expect(-1, res)
res = sequence.search(5, 0)
expect(-1, res)
res = sequence.search(8, 0)
expect(-1, res)
res = sequence.search(13, 0)
expect(-1, res)
res = sequence.search(2, 0)
expect(0, res)
res = sequence.search(6, 0)
expect(2, res)
res = sequence.search(11, 0)
expect(4, res)
def search_startidx_tests():
sequence = Sequence([2, 4, 6, 7, 11], 3)
res = sequence.search(2, 1)
expect(-1, res)
res = sequence.search(7, 1)
expect(3, res)
res = sequence.search(7, 3)
expect(3, res)
res = sequence.search(7, 4)
expect(-1, res)
def find_arithmethic_sequence_for_k_greater_than_n():
seq = Sequence([1], 2)
res = seq.find_arithmethic_sequence()
is_none(res)
seq = Sequence([1, 2], 3)
res = seq.find_arithmethic_sequence()
is_none(res)
seq = Sequence([1, 2], 4)
res = seq.find_arithmethic_sequence()
is_none(res)
def find_arithmethic_sequence_for_k_equals_two():
seq = Sequence([1], 2)
res = seq.find_arithmethic_sequence()
is_none(res)
seq = Sequence([1, 2], 2)
res = seq.find_arithmethic_sequence()
is_arithmetic_sequnce(res, 1, 1)
seq = Sequence([1, 2, 3], 2)
res = seq.find_arithmethic_sequence()
is_arithmetic_sequnce(res, 1, 1)
def find_arithmethic_sequence_tests():
seq = Sequence([1, 2, 3], 3)
res = seq.find_arithmethic_sequence()
is_arithmetic_sequnce(res, 1, 1)
seq = Sequence([0, 3, 4, 5], 3)
res = seq.find_arithmethic_sequence()
is_arithmetic_sequnce(res, 3, 1)
seq = Sequence([1, 3, 4, 5], 4)
res = seq.find_arithmethic_sequence()
is_none(res)
seq = Sequence([1, 3, 4, 5, 6], 4)
res = seq.find_arithmethic_sequence()
is_arithmetic_sequnce(res, 3, 1)
seq = Sequence([1, 2, 4, 5, 6, 7, 10], 4)
res = seq.find_arithmethic_sequence()
is_arithmetic_sequnce(res, 1, 3)
def is_term_tests():
seq = Sequence([1, 2, 4], 3)
res = seq.is_term()
expect(False, res)
seq = Sequence([1, 2, 3], 3)
res = seq.is_term()
expect(True, res)
def can_reach_last_element_of_arithmetic_sequence_tests():
seq = Sequence([1, 2, 4], 3)
res = seq.can_reach_last_element_of_arithmetic_sequence(1, 1)
expect(True, res)
seq = Sequence([1, 3, 4], 3)
res = seq.can_reach_last_element_of_arithmetic_sequence(1, 2)
expect(False, res)
seq = Sequence([1, 3, 5], 3)
res = seq.can_reach_last_element_of_arithmetic_sequence(1, 2)
expect(True, res)
def contains_arithmetic_sequence_tests():
seq = Sequence([1, 3, 5], 3)
res = seq.contains_arithmetic_sequence(3, 2, 1)
expect(True, res)
seq = Sequence([1, 3, 5, 6], 3)
res = seq.contains_arithmetic_sequence(3, 2, 2)
expect(False, res)
def evaluate_for_k_greater_than_n():
seq = Sequence([1], 2)
res = seq.evaluate()
expect(0, res)
seq = Sequence([1, 2], 3)
res = seq.evaluate()
expect(0, res)
def evaluate_for_k_equals_two():
seq = Sequence([1, 2], 2)
res = seq.evaluate()
expect(1, res)
seq = Sequence([1, 2, 3], 2)
res = seq.evaluate()
expect(3, res)
seq = Sequence([1, 2, 4, 7], 2)
res = seq.evaluate()
expect(6, res)
seq = Sequence([1, 2, 4, 7, 11], 2)
res = seq.evaluate()
expect(10, res)
def evaluate_tests():
seq = Sequence([1, 2, 3], 3)
res = seq.evaluate()
expect(1, res)
seq = Sequence([1, 2, 4], 3)
res = seq.evaluate()
expect(0, res)
seq = Sequence([1, 2, 4, 5, 6], 3)
res = seq.evaluate()
expect(2, res)
seq = Sequence([1, 2, 3, 4, 5], 3)
res = seq.evaluate()
expect(4, res)
def sequence_tests():
search_with_startidx_equals_zero()
search_startidx_tests()
find_arithmethic_sequence_for_k_greater_than_n()
find_arithmethic_sequence_for_k_equals_two()
find_arithmethic_sequence_tests()
is_term_tests()
can_reach_last_element_of_arithmetic_sequence_tests()
contains_arithmetic_sequence_tests()
evaluate_for_k_greater_than_n()
evaluate_for_k_equals_two()
evaluate_tests()
| 22.502591 | 68 | 0.633433 | 661 | 4,343 | 3.92587 | 0.075643 | 0.099422 | 0.124855 | 0.105202 | 0.840077 | 0.768015 | 0.704046 | 0.58921 | 0.443545 | 0.396146 | 0 | 0.060417 | 0.226341 | 4,343 | 192 | 69 | 22.619792 | 0.711905 | 0 | 0 | 0.601504 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090226 | false | 0 | 0.015038 | 0 | 0.105263 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e50c4316e567816ffac25b73b3ac2382e0a4cbc1 | 186 | py | Python | codigo/Live102/exemplo_2.py | cassiasamp/live-de-python | 00b5e51793097544ba9b75c97a0d30e63970bf45 | [
"MIT"
] | 572 | 2018-04-03T03:17:08.000Z | 2022-03-31T19:05:32.000Z | codigo/Live102/exemplo_2.py | cassiasamp/live-de-python | 00b5e51793097544ba9b75c97a0d30e63970bf45 | [
"MIT"
] | 176 | 2018-05-18T15:56:16.000Z | 2022-03-28T20:39:07.000Z | codigo/Live102/exemplo_2.py | cassiasamp/live-de-python | 00b5e51793097544ba9b75c97a0d30e63970bf45 | [
"MIT"
] | 140 | 2018-04-18T13:59:11.000Z | 2022-03-29T00:43:49.000Z |
from expects import expect, contain, be_an
class Bacon:
...
sanduiche = 'sanduiche com queijo'
expect(sanduiche).to(contain('queijo'))
expect(sanduiche).to_not(be_an(Bacon))
| 12.4 | 42 | 0.715054 | 25 | 186 | 5.2 | 0.56 | 0.061538 | 0.323077 | 0.353846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150538 | 186 | 14 | 43 | 13.285714 | 0.822785 | 0 | 0 | 0 | 0 | 0 | 0.141304 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.333333 | 0 | 1 | 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 | 3 |
e53e1ddf1ca570ccb7d5d49732fffcd4fe1ad53e | 619 | py | Python | pylisten/correlation.py | deeuu/pylisten | 3b8f9db7b7311a5a42ef7811acff284ca6854f30 | [
"MIT"
] | null | null | null | pylisten/correlation.py | deeuu/pylisten | 3b8f9db7b7311a5a42ef7811acff284ca6854f30 | [
"MIT"
] | null | null | null | pylisten/correlation.py | deeuu/pylisten | 3b8f9db7b7311a5a42ef7811acff284ca6854f30 | [
"MIT"
] | null | null | null | import krippendorff
import pandas as pd
import numpy as np
from . import utils
def r_to_z(r):
return np.arctanh(r)
def z_to_r(z):
return np.tanh(z)
def confidence_interval(r, conf_level=95, stat=np.mean):
z = r_to_z(r)
ci = utils.bootstrap_ci(z, stat=stat, conf_level=conf_level)
ci = z_to_r(ci)
return pd.Series({'lo': ci[0], 'hi': ci[1]})
def average(r):
return z_to_r(np.mean(r_to_z(r)))
def krippendorffs_alpha(data, level_of_measurement='ratio'):
return krippendorff.alpha(reliability_data=data,
level_of_measurement=level_of_measurement)
| 19.34375 | 72 | 0.675283 | 104 | 619 | 3.778846 | 0.365385 | 0.020356 | 0.030534 | 0.038168 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00813 | 0.20517 | 619 | 31 | 73 | 19.967742 | 0.79065 | 0 | 0 | 0 | 0 | 0 | 0.01454 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0 | 0.222222 | 0.222222 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e547a43a31f8d08ff1dadd100b2b71f483a15550 | 83 | py | Python | fastapi_amis_admin/__init__.py | cnss63/fastapi_amis_admin | 52537d153a002b3c468cb2634779010be956a9b4 | [
"Apache-2.0"
] | null | null | null | fastapi_amis_admin/__init__.py | cnss63/fastapi_amis_admin | 52537d153a002b3c468cb2634779010be956a9b4 | [
"Apache-2.0"
] | null | null | null | fastapi_amis_admin/__init__.py | cnss63/fastapi_amis_admin | 52537d153a002b3c468cb2634779010be956a9b4 | [
"Apache-2.0"
] | null | null | null | __version__ = "0.0.16"
__url__ = "https://github.com/amisadmin/fastapi_amis_admin"
| 27.666667 | 59 | 0.759036 | 12 | 83 | 4.416667 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051948 | 0.072289 | 83 | 2 | 60 | 41.5 | 0.636364 | 0 | 0 | 0 | 0 | 0 | 0.638554 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e550f4d5fb03eb8cb378fb56b59904fa75ad5cbc | 221 | py | Python | src/app_object.py | pockeleewout/DataCleaner-public | 242cd911b702a25fb2ad4751375c878e56127ef8 | [
"MIT"
] | 1 | 2019-05-09T15:38:29.000Z | 2019-05-09T15:38:29.000Z | src/app_object.py | pockeleewout/DataCleaner-public | 242cd911b702a25fb2ad4751375c878e56127ef8 | [
"MIT"
] | null | null | null | src/app_object.py | pockeleewout/DataCleaner-public | 242cd911b702a25fb2ad4751375c878e56127ef8 | [
"MIT"
] | null | null | null | import flask
import config
# The main flask app that will run the whole show
flask_app: flask.Flask = flask.Flask(__name__)
# Load the configuration from the Config class
flask_app.config.from_object(config.LocalConfig)
| 27.625 | 49 | 0.809955 | 35 | 221 | 4.914286 | 0.514286 | 0.139535 | 0.174419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131222 | 221 | 7 | 50 | 31.571429 | 0.895833 | 0.41629 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e55990f1b8fe2ffef3eee8d0535d849c05832134 | 2,127 | py | Python | server.py | Daerdemandt/blog | 2d9f95f57c84c1ac87ed62b449ddc4644d98c4bf | [
"MIT"
] | null | null | null | server.py | Daerdemandt/blog | 2d9f95f57c84c1ac87ed62b449ddc4644d98c4bf | [
"MIT"
] | null | null | null | server.py | Daerdemandt/blog | 2d9f95f57c84c1ac87ed62b449ddc4644d98c4bf | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import http.server
import socketserver
from urllib.parse import parse_qsl as parse_query, urlparse as parse_url
from abc import abstractmethod, ABC as abstractclass
import json
class ContentEncoder(abstractclass):
@abstractmethod
def get_type():
pass
@abstractmethod
def encode(self, content):
pass
class JsonEncoder(ContentEncoder):
def get_type(self):
return 'application/json'
def encode(self, content):
return bytes(json.dumps(content), 'UTF-8')
class TextEncoder(ContentEncoder):
def __init__(self, text_type='plain'):
self.text_type = text_type
def get_type(self):
return 'text/' + self.text_type
def encode(self, content):
return bytes(str(content), 'UTF-8')
class HtmlEncoder(TextEncoder):
def __init__(self):
super().__init__('html')
def set_head(self, head):
self.head = head
def encode(self, content):
return super().encode('<!DOCTYPE html><html><head>' + self.head + '</head><body>' + str(content) + '</body></html>')
def run_server(info, port, encoder = JsonEncoder(), response_cache = {}):
class MyHandler(http.server.SimpleHTTPRequestHandler):
def respond(self, content, code=200):
self.send_response(code)
self.send_header("Content-type", encoder.get_type())
self.end_headers()
self.wfile.write(encoder.encode(content))
def not_implemented(self):
self.respond({'error':'{} not implemented'.format(self.path)}, code=404)
def not_found(self, key = False):
key = key or self.path
self.respond({'error': key + ' not found'}, code=404)
def do_GET(self):
request = parse_url(self.path).path.split('/')[1]
query_vars = dict(parse_query(parse_url(self.path).query))
try:
if self.path not in response_cache:
info_getter = getattr(info, 'get_' + request)
response_cache[self.path] = info_getter(**query_vars)
self.respond(response_cache[self.path])
except AttributeError:
self.not_found()
except NotImplementedError:
self.not_implemented()
# todo: KeyError -> 404(key)
httpd = socketserver.TCPServer(("", port), MyHandler)
print("serving at port", port)
httpd.serve_forever()
| 29.957746 | 118 | 0.716032 | 286 | 2,127 | 5.164336 | 0.342657 | 0.037915 | 0.035207 | 0.054164 | 0.086662 | 0.041977 | 0 | 0 | 0 | 0 | 0 | 0.008767 | 0.141984 | 2,127 | 70 | 119 | 30.385714 | 0.800548 | 0.022567 | 0 | 0.172414 | 0 | 0 | 0.07896 | 0 | 0 | 0 | 0 | 0.014286 | 0 | 1 | 0.258621 | false | 0.034483 | 0.086207 | 0.086207 | 0.517241 | 0.017241 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
e57de3bc7fa48291a8d0d04475b14d2ef81827fc | 1,715 | py | Python | nncf/__init__.py | gnomonsis/nncf_pytorch | 9fc4a92b5cb1b2c240e633c4ffa69b4fae1917fb | [
"Apache-2.0"
] | null | null | null | nncf/__init__.py | gnomonsis/nncf_pytorch | 9fc4a92b5cb1b2c240e633c4ffa69b4fae1917fb | [
"Apache-2.0"
] | 4 | 2020-07-17T11:12:35.000Z | 2021-12-15T15:20:24.000Z | nncf/__init__.py | vshampor/nncf_pytorch | 9fc4a92b5cb1b2c240e633c4ffa69b4fae1917fb | [
"Apache-2.0"
] | null | null | null | """
Copyright (c) 2019-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from .version import __version__
# Required for correct COMPRESSION_ALGORITHMS registry functioning
from .binarization import algo as binarization_algo
from .quantization import algo as quantization_algo
from .sparsity.const import algo as const_sparsity_algo
from .sparsity.magnitude import algo as magnitude_sparsity_algo
from .sparsity.rb import algo as rb_sparsity_algo
from .pruning.filter_pruning import algo as filter_pruning_algo
# Functions most commonly used in integrating NNCF into training pipelines are
# listed below for importing convenience
from .model_creation import create_compressed_model
from .checkpoint_loading import load_state
from .config import NNCFConfig
from .nncf_logger import disable_logging
from .nncf_logger import set_log_level
from .initialization import register_default_init_args
# NNCF relies on tracing PyTorch operations. Each code that uses NNCF
# should be executed with PyTorch operators wrapped via a call to "patch_torch_operators",
# so this call is moved to package __init__ to ensure this.
from .dynamic_graph.patch_pytorch import patch_torch_operators
patch_torch_operators()
| 43.974359 | 90 | 0.82449 | 255 | 1,715 | 5.384314 | 0.545098 | 0.0437 | 0.05244 | 0.023307 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008114 | 0.137609 | 1,715 | 38 | 91 | 45.131579 | 0.920216 | 0.56035 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.933333 | 0 | 0.933333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
e58656a4c65591083cf0922e65119f0db2a03f9e | 863 | py | Python | data_cleanup/tests/test_views.py | yashpatel12/CPIMS-api-newtest | d5129eb3aa034f70414a2471a72c0a74ad95f6ca | [
"Apache-2.0"
] | 3 | 2022-02-18T13:25:29.000Z | 2022-02-25T11:49:11.000Z | data_cleanup/tests/test_views.py | yashpatel12/CPIMS-api-newtest | d5129eb3aa034f70414a2471a72c0a74ad95f6ca | [
"Apache-2.0"
] | null | null | null | data_cleanup/tests/test_views.py | yashpatel12/CPIMS-api-newtest | d5129eb3aa034f70414a2471a72c0a74ad95f6ca | [
"Apache-2.0"
] | 22 | 2022-02-05T13:43:53.000Z | 2022-02-26T14:29:06.000Z | from unittest import TestCase
from data_cleanup.views import validate_age
class TestAgeValidation(TestCase):
def test_age_provided_is_okay(self):
"""An integer is acceptable"""
self.assertTrue(validate_age(10))
def test_age_provided_is_not_valid(self):
"""Anything which is not an integer is not acceptable."""
self.assertFalse(validate_age('not_a_number'))
def test_age_range_provided_is_okay(self):
"""Integer ranges are acceptable"""
self.assertTrue(validate_age('10-20'))
def test_age_range_provided_is_not_valid(self):
"""Non integer ranges are not acceptable."""
self.assertFalse(validate_age('a-z'))
def test_age_range_provided_with_spaces_is_okay(self):
"""Ranges with spaces in between are acceptable."""
self.assertTrue(validate_age('10 - 100'))
| 33.192308 | 65 | 0.707995 | 116 | 863 | 4.956897 | 0.344828 | 0.114783 | 0.086957 | 0.166957 | 0.577391 | 0.426087 | 0.13913 | 0 | 0 | 0 | 0 | 0.015737 | 0.190035 | 863 | 25 | 66 | 34.52 | 0.806867 | 0.221321 | 0 | 0 | 0 | 0 | 0.043344 | 0 | 0 | 0 | 0 | 0 | 0.384615 | 1 | 0.384615 | false | 0 | 0.153846 | 0 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
e5aa4651626736cae0291004ae857c774922dfb4 | 418 | py | Python | app/admin.py | mugisha-thierry/online-shop | d6e9b1f5c9b031a87af50ff490d2222706530536 | [
"Unlicense"
] | 1 | 2021-03-26T07:35:57.000Z | 2021-03-26T07:35:57.000Z | app/admin.py | mugisha-thierry/online-shop | d6e9b1f5c9b031a87af50ff490d2222706530536 | [
"Unlicense"
] | null | null | null | app/admin.py | mugisha-thierry/online-shop | d6e9b1f5c9b031a87af50ff490d2222706530536 | [
"Unlicense"
] | null | null | null | from django.contrib import admin
from .models import Profile,Category,Product,OrderItem,Order,Transaction,Rate,Delivery
# Register your models here.
admin.site.register(Category)
admin.site.register(Delivery)
admin.site.register(Profile)
admin.site.register(Product)
admin.site.register(OrderItem)
admin.site.register(Order)
admin.site.register(Rate)
admin.site.register(Transaction)
# admin.site.register(OrderItem) | 29.857143 | 86 | 0.827751 | 56 | 418 | 6.178571 | 0.321429 | 0.234104 | 0.442197 | 0.150289 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057416 | 418 | 14 | 87 | 29.857143 | 0.878173 | 0.136364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e5b6836527d124d45d835502e7a3f43caa218c74 | 1,515 | py | Python | telnet_rtr_functions.py | karimjamali/Class-2 | 9051d0c43fa9d23b5821ba12f324640a112e8d0e | [
"Apache-2.0"
] | null | null | null | telnet_rtr_functions.py | karimjamali/Class-2 | 9051d0c43fa9d23b5821ba12f324640a112e8d0e | [
"Apache-2.0"
] | null | null | null | telnet_rtr_functions.py | karimjamali/Class-2 | 9051d0c43fa9d23b5821ba12f324640a112e8d0e | [
"Apache-2.0"
] | null | null | null | import telnetlib
import os
import sys
import time
ip_addr='50.76.53.27'
TELNET_PORT=23
TELNET_TIMEOUT=6
username = "pyclass"
password = "88newclass"
def telnet_connect(ip_addr, TELNET_PORT,TELNET_TIMEOUT):
try:
return telnetlib.Telnet(ip_addr, TELNET_PORT, TELNET_TIMEOUT)
except socket.error:
sys.exit('Connection Timed Out')
def login(remote_conn,username,password):
remote_conn.read_until('sername',TELNET_TIMEOUT)
remote_conn.write(username + '\n')
remote_conn.read_until('assword',TELNET_TIMEOUT)
remote_conn.write(password + '\n')
def send_command(remote_conn,cmd):
cmd=cmd.rstrip()
remote_conn.write(cmd + '\n')
time.sleep(1)
return remote_conn.read_very_eager()
def main():
ip_addr='50.76.53.27'
TELNET_PORT=23
TELNET_TIMEOUT=6
username = "pyclass"
password = "88newclass"
remote_conn=telnet_connect(ip_addr,TELNET_PORT,TELNET_TIMEOUT)
# remote_conn=telnetlib.Telnet(ip_addr, TELNET_PORT, TELNET_TIMEOUT)
#print dir(remote_conn)
#print type(remote_conn)
login(remote_conn,username,password)
#remote_conn.read_until('sername',TELNET_TIMEOUT)
#remote_conn.write(username + '\n')
#remote_conn.read_until('assword',TELNET_TIMEOUT)
#remote_conn.write(password + '\n')
#time.sleep(1)
#output=remote_conn.read_very_eager()
#print output
output=send_command(remote_conn,'show ip int brief')
#remote_conn.write('show ip int brief' + '\n')
#time.sleep(1)
#output=remote_conn.read_very_eager()
print output
remote_conn.close()
if __name__ == "__main__":
main()
| 23.307692 | 69 | 0.764356 | 225 | 1,515 | 4.853333 | 0.262222 | 0.201465 | 0.089744 | 0.105311 | 0.692308 | 0.671245 | 0.671245 | 0.671245 | 0.513736 | 0.513736 | 0 | 0.021386 | 0.104951 | 1,515 | 64 | 70 | 23.671875 | 0.783923 | 0.283828 | 0 | 0.27027 | 0 | 0 | 0.11319 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.135135 | 0.108108 | null | null | 0.027027 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e5e1b4447ba4303522437c28887d180da57f0e1f | 397 | py | Python | tools/leetcode.118.Pascal's Triangle/leetcode.118.Pascal's Triangle.submission9.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | 4 | 2015-10-10T00:30:55.000Z | 2020-07-27T19:45:54.000Z | tools/leetcode.118.Pascal's Triangle/leetcode.118.Pascal's Triangle.submission9.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | tools/leetcode.118.Pascal's Triangle/leetcode.118.Pascal's Triangle.submission9.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | class Solution:
# @param {integer} numRows
# @return {integer[][]}
def generate(self, numRows):
if numRows == 0: return []
if numRows == 1: return [[1]]
res = [[1]]
cnt = 1
while cnt < numRows:
cur = [0]+res[-1]+[0]
res.append([cur[i]+cur[i+1] for i in range(len(cur)-1)])
cnt += 1
return res
| 397 | 397 | 0.455919 | 50 | 397 | 3.62 | 0.44 | 0.099448 | 0.055249 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044715 | 0.380353 | 397 | 1 | 397 | 397 | 0.691057 | 0.115869 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0 | 0 | 0.272727 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e5e509fd20a9b4ab7170a3c1451b55b01d4539e0 | 13,514 | py | Python | cloudkittyclient/tests/unit/v1/test_hashmap.py | NeCTAR-RC/python-cloudkittyclient | 20003a58cec701dd39945246955d5434681e5184 | [
"Apache-2.0"
] | 19 | 2015-10-18T02:56:16.000Z | 2019-07-19T16:33:08.000Z | cloudkittyclient/tests/unit/v1/test_hashmap.py | NeCTAR-RC/python-cloudkittyclient | 20003a58cec701dd39945246955d5434681e5184 | [
"Apache-2.0"
] | 1 | 2018-12-17T13:11:24.000Z | 2018-12-17T13:11:24.000Z | cloudkittyclient/tests/unit/v1/test_hashmap.py | NeCTAR-RC/python-cloudkittyclient | 20003a58cec701dd39945246955d5434681e5184 | [
"Apache-2.0"
] | 11 | 2016-02-02T02:32:58.000Z | 2022-02-11T02:22:56.000Z | # -*- coding: utf-8 -*-
# Copyright 2018 Objectif Libre
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
from unittest import mock
from cloudkittyclient import exc
from cloudkittyclient.tests.unit.v1 import base
from cloudkittyclient.tests import utils
class TestHashmap(base.BaseAPIEndpointTestCase):
def test_get_mapping_types(self):
self.hashmap.get_mapping_types()
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/types/')
def test_get_service(self):
self.hashmap.get_service()
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/services/')
def test_get_service_service_id(self):
self.hashmap.get_service(service_id='service_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/services/service_id')
def test_create_service(self):
kwargs = dict(name='service')
self.hashmap.create_service(**kwargs)
self.api_client.post.assert_called_once_with(
'/v1/rating/module_config/hashmap/services/', json=kwargs)
def test_create_service_no_name(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.create_service)
def test_delete_service(self):
self.hashmap.delete_service(service_id='service_id')
self.api_client.delete.assert_called_once_with(
'/v1/rating/module_config/hashmap/services/',
json={'service_id': 'service_id'})
def test_delete_service_no_id(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.delete_service)
def test_get_fields_of_service(self):
self.hashmap.get_field(service_id='service_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/fields/?service_id=service_id')
def test_get_field(self):
self.hashmap.get_field(field_id='field_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/fields/field_id')
def test_get_field_no_args(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.get_field)
def test_get_field_with_service_id_and_field_id(self):
self.assertRaises(exc.InvalidArgumentError, self.hashmap.get_field,
service_id='service_id', field_id='field_id')
def test_create_field(self):
kwargs = dict(name='name', service_id='service_id')
self.hashmap.create_field(**kwargs)
self.api_client.post.assert_called_once_with(
'/v1/rating/module_config/hashmap/fields/', json=kwargs)
def test_create_field_no_name(self):
self.assertRaises(exc.ArgumentRequired,
self.hashmap.create_field,
service_id='service_id')
def test_create_field_no_service_id(self):
self.assertRaises(
exc.ArgumentRequired, self.hashmap.create_field, name='name')
def test_delete_field(self):
kwargs = dict(field_id='field_id')
self.hashmap.delete_field(**kwargs)
self.api_client.delete.assert_called_once_with(
'/v1/rating/module_config/hashmap/fields/', json=kwargs)
def test_delete_field_no_arg(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.delete_field)
def test_get_mapping_with_id(self):
self.hashmap.get_mapping(mapping_id='mapping_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/mappings/mapping_id')
def test_get_mapping_service_id(self):
self.hashmap.get_mapping(service_id='service_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/mappings/?service_id=service_id')
def test_get_mapping_no_args(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.get_mapping)
def test_create_mapping(self):
kwargs = dict(cost=2, value='value', field_id='field_id')
body = dict(
cost=kwargs.get('cost'),
value=kwargs.get('value'),
service_id=kwargs.get('service_id'),
field_id=kwargs.get('field_id'),
group_id=kwargs.get('group_id'),
tenant_id=kwargs.get('tenant_id'),
type=kwargs.get('type') or 'flat',
)
self.hashmap.create_mapping(**kwargs)
self.api_client.post.assert_called_once_with(
'/v1/rating/module_config/hashmap/mappings/', json=body)
def test_create_mapping_no_cost(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.create_mapping,
value='value', field_id='field_id')
def test_create_mapping_no_id(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.create_mapping,
value='value', cost=12)
def test_create_mapping_field_and_service_id(self):
self.assertRaises(
exc.InvalidArgumentError, self.hashmap.create_mapping, cost=12,
field_id='field_id', service_id='service_id')
def test_create_mapping_value_and_service_id(self):
self.assertRaises(
exc.InvalidArgumentError, self.hashmap.create_mapping,
value='value', service_id='service_id', cost=0.8)
def test_update_mapping(self):
kwargs = dict(
cost=12,
value='value',
service_id='service_id',
field_id='field_id',
tenant_id='tenant_id',
type='type',
mapping_id='mapping_id',
)
fake_get = mock.Mock(return_value=utils.FakeRequest(
cost='Bad value',
value='Bad value',
service_id='Bad value',
field_id='Bad value',
tenant_id='Bad value',
type='Bad value',
mapping_id='mapping_id',
))
self.api_client.get = fake_get
self.hashmap.update_mapping(**kwargs)
self.api_client.get.assert_called_with(
'/v1/rating/module_config/hashmap/mappings/mapping_id')
self.api_client.put.assert_called_once_with(
'/v1/rating/module_config/hashmap/mappings/', json=kwargs)
def test_update_mapping_no_arg(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.update_mapping)
def test_get_mapping_group(self):
self.hashmap.get_mapping_group(mapping_id='mapping_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/'
'hashmap/mappings/group?mapping_id=mapping_id')
def test_delete_mapping(self):
kwargs = dict(mapping_id='mapping_id')
self.hashmap.delete_mapping(**kwargs)
self.api_client.delete.assert_called_once_with(
'/v1/rating/module_config/hashmap/mappings/', json=kwargs)
def test_delete_mapping_no_arg(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.delete_mapping)
def test_get_mapping_group_no_arg(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.get_mapping_group)
def test_get_group_no_arg(self):
self.hashmap.get_group()
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/groups/')
def test_get_group(self):
self.hashmap.get_group(group_id='group_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/groups/group_id')
def test_create_group(self):
kwargs = dict(name='group')
self.hashmap.create_group(**kwargs)
self.api_client.post.assert_called_once_with(
'/v1/rating/module_config/hashmap/groups/',
json=kwargs)
def test_create_group_no_name(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.create_group)
def test_delete_group(self):
kwargs = dict(group_id='group_id')
self.hashmap.delete_group(**kwargs)
kwargs['recursive'] = False
self.api_client.delete.assert_called_once_with(
'/v1/rating/module_config/hashmap/groups/',
json=kwargs)
def test_delete_group_recursive(self):
kwargs = dict(group_id='group_id', recursive=True)
self.hashmap.delete_group(**kwargs)
self.api_client.delete.assert_called_once_with(
'/v1/rating/module_config/hashmap/groups/',
json=kwargs)
def test_delete_group_no_id(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.create_group)
def test_get_group_mappings(self):
self.hashmap.get_group_mappings(group_id='group_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/groups/mappings'
'?group_id=group_id')
def test_get_group_mappings_no_args(self):
self.assertRaises(
exc.ArgumentRequired, self.hashmap.get_group_mappings)
def test_get_group_thresholds(self):
self.hashmap.get_group_thresholds(group_id='group_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/groups/thresholds'
'?group_id=group_id')
def test_get_group_thresholds_no_args(self):
self.assertRaises(
exc.ArgumentRequired, self.hashmap.get_group_thresholds)
def test_get_threshold_with_id(self):
self.hashmap.get_threshold(threshold_id='threshold_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/thresholds/threshold_id')
def test_get_threshold_service_id(self):
self.hashmap.get_threshold(service_id='service_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/hashmap/thresholds/'
'?service_id=service_id')
def test_get_threshold_no_args(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.get_threshold)
def test_create_threshold(self):
kwargs = dict(cost=2, level=123, field_id='field_id')
body = dict(
cost=kwargs.get('cost'),
level=kwargs.get('level'),
service_id=kwargs.get('service_id'),
field_id=kwargs.get('field_id'),
group_id=kwargs.get('group_id'),
tenant_id=kwargs.get('tenant_id'),
type=kwargs.get('type') or 'flat',
)
self.hashmap.create_threshold(**kwargs)
self.api_client.post.assert_called_once_with(
'/v1/rating/module_config/hashmap/thresholds/', json=body)
def test_create_threshold_no_cost(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.create_threshold,
level=123, field_id='field_id')
def test_create_threshold_no_id(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.create_threshold,
level=123, cost=12)
def test_create_threshold_field_and_service_id(self):
self.assertRaises(
exc.ArgumentRequired, self.hashmap.create_threshold, cost=12,
field_id='field_id', service_id='service_id')
def test_delete_threshold(self):
kwargs = dict(threshold_id='threshold_id')
self.hashmap.delete_threshold(**kwargs)
self.api_client.delete.assert_called_once_with(
'/v1/rating/module_config/hashmap/thresholds/', json=kwargs)
def test_delete_threshold_no_arg(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.delete_threshold)
def test_update_threshold(self):
kwargs = dict(
cost=12,
level=123,
service_id='service_id',
field_id='field_id',
tenant_id='tenant_id',
type='type',
threshold_id='threshold_id'
)
fake_get = mock.Mock(return_value=utils.FakeRequest(
cost='Bad value',
level='Bad value',
service_id='Bad value',
field_id='Bad value',
tenant_id='Bad value',
type='Bad value',
threshold_id='threshold_id'
))
self.api_client.get = fake_get
self.hashmap.update_threshold(**kwargs)
self.api_client.get.assert_called_with(
'/v1/rating/module_config/hashmap/thresholds/threshold_id')
self.api_client.put.assert_called_once_with(
'/v1/rating/module_config/hashmap/thresholds/', json=kwargs)
def test_update_threshold_no_arg(self):
self.assertRaises(exc.ArgumentRequired, self.hashmap.update_threshold)
def test_get_threshold_group(self):
self.hashmap.get_threshold_group(threshold_id='threshold_id')
self.api_client.get.assert_called_once_with(
'/v1/rating/module_config/'
'hashmap/thresholds/group?threshold_id=threshold_id')
def test_get_threshold_group_no_arg(self):
self.assertRaises(
exc.ArgumentRequired, self.hashmap.get_threshold_group)
| 39.864307 | 79 | 0.674042 | 1,700 | 13,514 | 5.04 | 0.08 | 0.044118 | 0.048553 | 0.063025 | 0.835434 | 0.713469 | 0.676237 | 0.643441 | 0.613095 | 0.595588 | 0 | 0.006463 | 0.2214 | 13,514 | 338 | 80 | 39.982249 | 0.807831 | 0.044472 | 0 | 0.424812 | 0 | 0 | 0.168799 | 0.113282 | 0 | 0 | 0 | 0 | 0.210526 | 1 | 0.203008 | false | 0 | 0.015038 | 0 | 0.221805 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f910aba9281480f82e13d077280efed0a98dee09 | 156 | py | Python | kaldi/base/__init__.py | mxmpl/pykaldi | 0570307138c5391cc47b019450d08bcb9686dd98 | [
"Apache-2.0"
] | 916 | 2017-11-22T19:33:36.000Z | 2022-03-31T11:51:58.000Z | kaldi/base/__init__.py | mxmpl/pykaldi | 0570307138c5391cc47b019450d08bcb9686dd98 | [
"Apache-2.0"
] | 268 | 2018-01-16T22:06:45.000Z | 2022-03-29T03:24:41.000Z | kaldi/base/__init__.py | mxmpl/pykaldi | 0570307138c5391cc47b019450d08bcb9686dd98 | [
"Apache-2.0"
] | 260 | 2018-01-23T18:39:40.000Z | 2022-03-24T08:17:39.000Z | from ._kaldi_error import *
from ._timer import *
__all__ = [name for name in dir()
if name[0] != '_'
and not name.endswith('Base')]
| 22.285714 | 41 | 0.583333 | 21 | 156 | 3.952381 | 0.761905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009009 | 0.288462 | 156 | 6 | 42 | 26 | 0.738739 | 0 | 0 | 0 | 0 | 0 | 0.032051 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f923a5fbd964dbf16966cd0f142119498e714034 | 36,361 | py | Python | 2017/aoc_12.py | justanotherdot/advent-linguist | 4dfd4ef483ddbd40fb8cf7a1719705186d4ed823 | [
"MIT"
] | null | null | null | 2017/aoc_12.py | justanotherdot/advent-linguist | 4dfd4ef483ddbd40fb8cf7a1719705186d4ed823 | [
"MIT"
] | 4 | 2016-12-06T03:23:27.000Z | 2019-04-07T21:50:04.000Z | 2017/aoc_12.py | justanotherdot/advent-linguist | 4dfd4ef483ddbd40fb8cf7a1719705186d4ed823 | [
"MIT"
] | null | null | null | from collections import defaultdict
s = """
0 <-> 2
1 <-> 1
2 <-> 0, 3, 4
3 <-> 2, 4
4 <-> 2, 3, 6
5 <-> 6
6 <-> 4, 5
"""
s = """
0 <-> 659, 737
1 <-> 1, 1433
2 <-> 982, 1869
3 <-> 306, 380, 1462, 1827
4 <-> 1076
5 <-> 794, 1451
6 <-> 146, 1055
7 <-> 834, 1557
8 <-> 1333
9 <-> 849, 906, 1863
10 <-> 362, 505
11 <-> 33, 938, 1896
12 <-> 490, 913
13 <-> 189, 690
14 <-> 796
15 <-> 56, 280, 1288, 1721
16 <-> 16
17 <-> 904
18 <-> 150, 1394, 1458
19 <-> 1773
20 <-> 70
21 <-> 993
22 <-> 22
23 <-> 285, 1004
24 <-> 209, 727
25 <-> 614, 1590
26 <-> 113
27 <-> 1321, 1341
28 <-> 351, 730, 1037
29 <-> 29, 1828
30 <-> 1378, 1983
31 <-> 705, 1035
32 <-> 1042, 1519
33 <-> 11, 886
34 <-> 360, 1101, 1531, 1877
35 <-> 971, 1652
36 <-> 188
37 <-> 1935
38 <-> 38
39 <-> 39, 1472
40 <-> 84, 1110
41 <-> 483, 895, 1035, 1864, 1919
42 <-> 624, 813, 1484, 1517
43 <-> 492
44 <-> 947, 1572
45 <-> 45, 1589, 1748, 1836
46 <-> 1821
47 <-> 123, 206, 239
48 <-> 146
49 <-> 235, 871
50 <-> 172, 1672
51 <-> 504
52 <-> 585, 678, 878
53 <-> 484, 543, 1282
54 <-> 374, 723
55 <-> 1956
56 <-> 15
57 <-> 583, 1159, 1596
58 <-> 313, 580, 1101
59 <-> 1529, 1788
60 <-> 60
61 <-> 1033, 1857
62 <-> 874
63 <-> 63, 1007, 1316, 1673
64 <-> 1140
65 <-> 1136
66 <-> 1337, 1546
67 <-> 67, 1468
68 <-> 298, 951
69 <-> 906
70 <-> 20, 1977
71 <-> 1956
72 <-> 146, 1465
73 <-> 911
74 <-> 1345
75 <-> 711
76 <-> 732, 789, 1499, 1637
77 <-> 1897
78 <-> 78, 379
79 <-> 96, 462, 847
80 <-> 886, 907
81 <-> 1564
82 <-> 1362, 1680
83 <-> 225, 916
84 <-> 40, 1460
85 <-> 330
86 <-> 1370
87 <-> 87, 640
88 <-> 806, 1411
89 <-> 1732
90 <-> 603
91 <-> 547, 904
92 <-> 1106
93 <-> 782
94 <-> 401, 1039, 1148, 1356
95 <-> 95, 344, 1092
96 <-> 79
97 <-> 1555, 1649
98 <-> 133
99 <-> 866
100 <-> 116, 1183, 1450
101 <-> 964
102 <-> 521, 843
103 <-> 1002
104 <-> 675, 1752, 1760
105 <-> 447
106 <-> 625
107 <-> 200, 923, 1573
108 <-> 108, 1535
109 <-> 1938, 1984
110 <-> 992
111 <-> 410, 436, 1789, 1985
112 <-> 730, 1742
113 <-> 26, 774, 1620
114 <-> 891
115 <-> 556, 980, 1502
116 <-> 100, 405, 438
117 <-> 1220, 1747
118 <-> 417
119 <-> 1671
120 <-> 225
121 <-> 215, 1414
122 <-> 1421
123 <-> 47, 488, 1390
124 <-> 1750
125 <-> 1020, 1456, 1645, 1811
126 <-> 945, 988, 1558
127 <-> 1562
128 <-> 246, 419, 878, 1057
129 <-> 198, 214, 526
130 <-> 1572
131 <-> 624
132 <-> 1086
133 <-> 98, 430, 1950
134 <-> 1179
135 <-> 1603
136 <-> 136
137 <-> 137, 248
138 <-> 604
139 <-> 1080, 1744, 1829
140 <-> 786, 890, 1336
141 <-> 819, 835
142 <-> 142, 1657
143 <-> 590, 670
144 <-> 622
145 <-> 182, 930, 1164, 1741
146 <-> 6, 48, 72, 152
147 <-> 1880
148 <-> 1486
149 <-> 1595
150 <-> 18, 653
151 <-> 1834
152 <-> 146, 289, 1949
153 <-> 1379
154 <-> 694, 1025
155 <-> 1143, 1469
156 <-> 437, 1492, 1616
157 <-> 1044
158 <-> 410, 1391
159 <-> 1327
160 <-> 387, 892, 963, 1287
161 <-> 964, 1017
162 <-> 786, 1098, 1351, 1445, 1508
163 <-> 415
164 <-> 255, 790, 1410
165 <-> 252, 425, 1186, 1662, 1838
166 <-> 791, 1012
167 <-> 167, 836, 1922
168 <-> 1586, 1998
169 <-> 679, 914
170 <-> 1975
171 <-> 672
172 <-> 50
173 <-> 614
174 <-> 723
175 <-> 246, 747
176 <-> 400, 1338
177 <-> 573, 1617, 1724
178 <-> 473, 1572
179 <-> 183
180 <-> 200, 1380
181 <-> 1394, 1657
182 <-> 145, 1825
183 <-> 179, 399, 955, 1236, 1295, 1840
184 <-> 712
185 <-> 185
186 <-> 551, 1627
187 <-> 1195
188 <-> 36, 440, 1277, 1362
189 <-> 13
190 <-> 1111
191 <-> 985, 1372
192 <-> 496, 1137, 1283
193 <-> 827, 1053
194 <-> 610
195 <-> 1231, 1497
196 <-> 1960
197 <-> 584, 1359
198 <-> 129, 651, 714, 1663
199 <-> 1047, 1805
200 <-> 107, 180, 658, 1397
201 <-> 1590
202 <-> 1268, 1768
203 <-> 1683
204 <-> 567, 1848
205 <-> 276
206 <-> 47, 461, 1794
207 <-> 207
208 <-> 1248
209 <-> 24, 1589
210 <-> 1063, 1504
211 <-> 907, 1815
212 <-> 1948
213 <-> 388
214 <-> 129, 561, 793, 1569
215 <-> 121, 252
216 <-> 216, 1728
217 <-> 761
218 <-> 631, 816
219 <-> 459, 807, 1008
220 <-> 1231, 1447
221 <-> 713, 1541
222 <-> 856, 924, 1924
223 <-> 1103
224 <-> 1426, 1761
225 <-> 83, 120, 242, 784
226 <-> 311, 560
227 <-> 587, 667, 984, 1091
228 <-> 1852
229 <-> 229, 1198, 1204
230 <-> 1505, 1944
231 <-> 1158, 1594, 1925
232 <-> 232, 345, 1417
233 <-> 828, 1677
234 <-> 982
235 <-> 49, 1012, 1254, 1956
236 <-> 489, 893, 1545
237 <-> 988, 1450
238 <-> 1719, 1791
239 <-> 47, 736, 1027
240 <-> 1167, 1457
241 <-> 270
242 <-> 225, 814, 1873
243 <-> 243, 282, 914
244 <-> 302, 328, 559
245 <-> 1753
246 <-> 128, 175
247 <-> 1230, 1660, 1824
248 <-> 137, 537, 1423
249 <-> 1209, 1391, 1749
250 <-> 298
251 <-> 799
252 <-> 165, 215
253 <-> 1437, 1741
254 <-> 1356
255 <-> 164
256 <-> 310
257 <-> 1267, 1821
258 <-> 1177, 1876
259 <-> 1257, 1432
260 <-> 311, 1115
261 <-> 1504
262 <-> 1268
263 <-> 565, 1023
264 <-> 408, 1806
265 <-> 1009, 1144
266 <-> 599, 616
267 <-> 1182
268 <-> 1026, 1456, 1470, 1854
269 <-> 269, 686
270 <-> 241, 1445
271 <-> 1232
272 <-> 487, 863, 1286
273 <-> 1614, 1748
274 <-> 1332
275 <-> 1010, 1334
276 <-> 205, 478, 888, 1049
277 <-> 277, 1330
278 <-> 734, 1561
279 <-> 535, 1190, 1913
280 <-> 15
281 <-> 1206
282 <-> 243, 475, 1571
283 <-> 283, 1936
284 <-> 324, 702, 844, 1601
285 <-> 23
286 <-> 286, 1080, 1127
287 <-> 295
288 <-> 805
289 <-> 152, 656, 691, 993
290 <-> 595, 616, 1199
291 <-> 1028, 1218, 1844
292 <-> 1447
293 <-> 378, 1771
294 <-> 811, 1790
295 <-> 287, 367, 693
296 <-> 861, 1948, 1950
297 <-> 1631
298 <-> 68, 250, 641, 745
299 <-> 299, 898, 1152, 1574
300 <-> 353
301 <-> 990, 1340, 1960
302 <-> 244
303 <-> 1645
304 <-> 445, 448, 557, 1611
305 <-> 1350, 1442
306 <-> 3, 445
307 <-> 567
308 <-> 1799
309 <-> 864
310 <-> 256, 853, 1911
311 <-> 226, 260, 970
312 <-> 1308
313 <-> 58
314 <-> 1795
315 <-> 1225, 1627, 1903
316 <-> 1065, 1991
317 <-> 317
318 <-> 546, 1415
319 <-> 1883
320 <-> 417, 1040
321 <-> 1927
322 <-> 686
323 <-> 1018, 1619
324 <-> 284
325 <-> 1114
326 <-> 474, 872
327 <-> 439
328 <-> 244
329 <-> 329
330 <-> 85, 1868
331 <-> 331, 680, 1224, 1243, 1291
332 <-> 1748
333 <-> 1673
334 <-> 676, 1306
335 <-> 809
336 <-> 797, 1559, 1858
337 <-> 978, 1874
338 <-> 538, 1077
339 <-> 432, 1033
340 <-> 340
341 <-> 1267, 1683
342 <-> 587, 726
343 <-> 1560, 1705
344 <-> 95
345 <-> 232, 1032
346 <-> 581, 1992
347 <-> 530
348 <-> 667, 1479
349 <-> 1620
350 <-> 861, 998, 1069
351 <-> 28
352 <-> 352
353 <-> 300, 1513
354 <-> 1109, 1747
355 <-> 950, 965, 1394, 1616
356 <-> 1136
357 <-> 1443, 1698
358 <-> 973, 1814
359 <-> 1662
360 <-> 34, 921
361 <-> 1418
362 <-> 10, 668, 1656
363 <-> 450, 766
364 <-> 615, 1941
365 <-> 1071
366 <-> 749, 1375
367 <-> 295, 1708, 1925
368 <-> 383, 928
369 <-> 369
370 <-> 651, 1048
371 <-> 665, 1460, 1686
372 <-> 390, 958, 1682
373 <-> 1559
374 <-> 54, 1395, 1847
375 <-> 799, 1061, 1383, 1773
376 <-> 376
377 <-> 1463
378 <-> 293, 872, 917
379 <-> 78, 449
380 <-> 3, 1117
381 <-> 1995
382 <-> 846, 896, 1506, 1918
383 <-> 368, 477
384 <-> 1009, 1788
385 <-> 1926
386 <-> 1602
387 <-> 160, 667
388 <-> 213, 713
389 <-> 586
390 <-> 372, 1140
391 <-> 863
392 <-> 590, 1259, 1384
393 <-> 645
394 <-> 423, 1537
395 <-> 782, 1496, 1893
396 <-> 1497
397 <-> 397
398 <-> 847, 1265
399 <-> 183, 743, 1564
400 <-> 176
401 <-> 94
402 <-> 402
403 <-> 558
404 <-> 572
405 <-> 116
406 <-> 769, 1563
407 <-> 1790
408 <-> 264
409 <-> 847
410 <-> 111, 158, 1467, 1880, 1902
411 <-> 1221
412 <-> 858, 1088, 1848
413 <-> 1589
414 <-> 468, 637
415 <-> 163, 415
416 <-> 416, 817
417 <-> 118, 320, 1671
418 <-> 1029, 1987
419 <-> 128, 765
420 <-> 420, 1180
421 <-> 1170, 1766
422 <-> 563, 1400, 1904, 1926
423 <-> 394
424 <-> 730
425 <-> 165, 478, 957
426 <-> 1505
427 <-> 1478, 1780
428 <-> 1658
429 <-> 650
430 <-> 133
431 <-> 469, 1491
432 <-> 339
433 <-> 667, 1549
434 <-> 852
435 <-> 435
436 <-> 111
437 <-> 156
438 <-> 116, 874
439 <-> 327, 1387
440 <-> 188, 540
441 <-> 441
442 <-> 692
443 <-> 1037, 1153
444 <-> 758, 1064
445 <-> 304, 306
446 <-> 1072, 1495, 1890
447 <-> 105, 1665
448 <-> 304, 591
449 <-> 379
450 <-> 363, 450, 466
451 <-> 1135
452 <-> 990, 1344, 1604
453 <-> 1390, 1755
454 <-> 1853
455 <-> 1199, 1735, 1852
456 <-> 484
457 <-> 457, 1973
458 <-> 786
459 <-> 219
460 <-> 1655, 1777
461 <-> 206, 753
462 <-> 79, 668
463 <-> 699
464 <-> 1843
465 <-> 829, 978, 1820
466 <-> 450
467 <-> 770, 1475
468 <-> 414, 613, 1230
469 <-> 431, 1470
470 <-> 1292, 1659
471 <-> 603
472 <-> 719, 1398
473 <-> 178, 1419
474 <-> 326, 866
475 <-> 282
476 <-> 1512, 1669
477 <-> 383
478 <-> 276, 425
479 <-> 1029
480 <-> 603
481 <-> 991, 1878
482 <-> 1726, 1783
483 <-> 41, 855
484 <-> 53, 456
485 <-> 1814
486 <-> 1470
487 <-> 272, 1693
488 <-> 123
489 <-> 236, 1155, 1793
490 <-> 12, 1349, 1498
491 <-> 913
492 <-> 43, 1121, 1822
493 <-> 1148
494 <-> 619, 1528
495 <-> 1960
496 <-> 192
497 <-> 497
498 <-> 1185
499 <-> 1933
500 <-> 1948
501 <-> 1364, 1433, 1826
502 <-> 893, 933
503 <-> 514
504 <-> 51, 821, 1116
505 <-> 10, 905
506 <-> 506
507 <-> 892
508 <-> 508
509 <-> 1078
510 <-> 1716
511 <-> 1197, 1900
512 <-> 568, 1284, 1422
513 <-> 1604, 1817, 1927
514 <-> 503, 773, 1725, 1883
515 <-> 1396
516 <-> 542
517 <-> 1299
518 <-> 1562
519 <-> 1622
520 <-> 1254, 1868, 1881
521 <-> 102, 1765
522 <-> 1438, 1980
523 <-> 1779
524 <-> 1235, 1968
525 <-> 1267, 1484
526 <-> 129
527 <-> 1211
528 <-> 597, 1017
529 <-> 529, 609
530 <-> 347, 1737, 1890
531 <-> 851, 1320
532 <-> 709
533 <-> 819, 1091
534 <-> 856
535 <-> 279, 535
536 <-> 536
537 <-> 248, 1317, 1763
538 <-> 338, 1793
539 <-> 539, 1485
540 <-> 440, 1216
541 <-> 541
542 <-> 516, 1232, 1831
543 <-> 53, 1234
544 <-> 639, 1090
545 <-> 1898
546 <-> 318, 1208
547 <-> 91
548 <-> 569, 750, 1090
549 <-> 1720
550 <-> 660
551 <-> 186
552 <-> 642, 672, 723
553 <-> 1927
554 <-> 717, 1841, 1997
555 <-> 1938
556 <-> 115, 1453
557 <-> 304, 904
558 <-> 403, 1438
559 <-> 244, 1046
560 <-> 226
561 <-> 214, 793, 1570
562 <-> 1992
563 <-> 422
564 <-> 860
565 <-> 263, 804
566 <-> 566
567 <-> 204, 307
568 <-> 512, 1084
569 <-> 548, 985, 1910
570 <-> 665, 1844
571 <-> 735
572 <-> 404, 1026, 1111
573 <-> 177, 1994
574 <-> 846
575 <-> 723, 738, 795, 802, 926, 1215
576 <-> 1650, 1962, 1996
577 <-> 1501, 1670
578 <-> 1504
579 <-> 1016, 1729
580 <-> 58
581 <-> 346, 581
582 <-> 749
583 <-> 57, 613, 1219, 1941
584 <-> 197, 1366
585 <-> 52, 1518
586 <-> 389, 1597
587 <-> 227, 342
588 <-> 1408
589 <-> 1229
590 <-> 143, 392, 1044, 1078
591 <-> 448, 1289
592 <-> 592
593 <-> 711
594 <-> 770
595 <-> 290, 1169
596 <-> 1854
597 <-> 528, 755, 1241, 1982
598 <-> 663, 806
599 <-> 266
600 <-> 1065, 1694
601 <-> 746
602 <-> 827
603 <-> 90, 471, 480, 1083
604 <-> 138, 1003
605 <-> 1703
606 <-> 1289
607 <-> 1309
608 <-> 808, 1100
609 <-> 529, 1621, 1943
610 <-> 194, 610
611 <-> 1337, 1609
612 <-> 980, 1350
613 <-> 468, 583
614 <-> 25, 173, 1623, 1914
615 <-> 364, 775
616 <-> 266, 290
617 <-> 1514
618 <-> 1031
619 <-> 494, 1761
620 <-> 1126, 1150, 1221, 1513, 1712
621 <-> 1770
622 <-> 144, 1761
623 <-> 1367
624 <-> 42, 131
625 <-> 106, 914
626 <-> 1849
627 <-> 1477
628 <-> 1379
629 <-> 969
630 <-> 1114
631 <-> 218, 1935, 1979
632 <-> 1015, 1665, 1816, 1819
633 <-> 1326, 1628
634 <-> 1347, 1720
635 <-> 816
636 <-> 636
637 <-> 414, 1566
638 <-> 1668
639 <-> 544, 824, 1542
640 <-> 87
641 <-> 298, 1196
642 <-> 552, 1619
643 <-> 972
644 <-> 814
645 <-> 393, 1148, 1205, 1302
646 <-> 969
647 <-> 935, 1575
648 <-> 648, 1424
649 <-> 1794
650 <-> 429, 854, 1586, 1711
651 <-> 198, 370
652 <-> 996, 1996
653 <-> 150, 1919
654 <-> 654
655 <-> 658
656 <-> 289
657 <-> 978, 1954
658 <-> 200, 655
659 <-> 0, 825, 1258, 1792
660 <-> 550, 1232
661 <-> 661, 1405
662 <-> 662
663 <-> 598
664 <-> 1014
665 <-> 371, 570, 1247
666 <-> 989, 1778
667 <-> 227, 348, 387, 433
668 <-> 362, 462, 703, 1091
669 <-> 1184
670 <-> 143
671 <-> 671, 901
672 <-> 171, 552
673 <-> 1865
674 <-> 972, 1961
675 <-> 104, 1581, 1800
676 <-> 334, 1995
677 <-> 1836
678 <-> 52
679 <-> 169
680 <-> 331
681 <-> 823
682 <-> 921
683 <-> 1800
684 <-> 750, 1505
685 <-> 722, 1338, 1993
686 <-> 269, 322
687 <-> 989, 1178
688 <-> 1338
689 <-> 1535
690 <-> 13, 690
691 <-> 289, 721
692 <-> 442, 1014
693 <-> 295
694 <-> 154, 862
695 <-> 1552, 1735
696 <-> 1044
697 <-> 993, 1793, 1801
698 <-> 698
699 <-> 463, 1022, 1399
700 <-> 897, 1085
701 <-> 1782, 1987
702 <-> 284
703 <-> 668, 1031
704 <-> 704, 849
705 <-> 31
706 <-> 1909
707 <-> 1276
708 <-> 1301
709 <-> 532, 1607
710 <-> 1094
711 <-> 75, 593, 1251, 1297
712 <-> 184, 712
713 <-> 221, 388, 713
714 <-> 198
715 <-> 1607
716 <-> 1110
717 <-> 554, 1819
718 <-> 1755
719 <-> 472, 1942
720 <-> 1043, 1984
721 <-> 691, 1641
722 <-> 685, 1360, 1679
723 <-> 54, 174, 552, 575
724 <-> 1466
725 <-> 1231
726 <-> 342, 1023
727 <-> 24
728 <-> 1928
729 <-> 975, 1759
730 <-> 28, 112, 424, 1324
731 <-> 731
732 <-> 76, 1698
733 <-> 1895
734 <-> 278
735 <-> 571, 1440
736 <-> 239
737 <-> 0, 1214, 1949
738 <-> 575, 985
739 <-> 1467
740 <-> 740, 1449, 1885
741 <-> 1243
742 <-> 845, 1588, 1676, 1956, 1980
743 <-> 399
744 <-> 744, 1990
745 <-> 298, 1966
746 <-> 601, 1294, 1601
747 <-> 175, 1106
748 <-> 1433, 1565, 1795
749 <-> 366, 582
750 <-> 548, 684, 1210
751 <-> 751, 1967
752 <-> 765, 1297
753 <-> 461
754 <-> 754
755 <-> 597, 1089
756 <-> 756
757 <-> 1350, 1936
758 <-> 444, 1044, 1279
759 <-> 996, 1310
760 <-> 1943
761 <-> 217, 1333
762 <-> 1671
763 <-> 1761
764 <-> 1881
765 <-> 419, 752
766 <-> 363, 928, 1100
767 <-> 1220, 1986
768 <-> 1337
769 <-> 406, 1307
770 <-> 467, 594, 1707
771 <-> 1624, 1782
772 <-> 1230
773 <-> 514, 1266, 1305
774 <-> 113, 1198
775 <-> 615, 1753
776 <-> 1307
777 <-> 1785
778 <-> 778, 1776
779 <-> 992
780 <-> 1406
781 <-> 781, 1272
782 <-> 93, 395, 1207
783 <-> 1544, 1729
784 <-> 225, 1168, 1587
785 <-> 1050
786 <-> 140, 162, 458, 786, 1060
787 <-> 1210
788 <-> 1431
789 <-> 76
790 <-> 164, 882
791 <-> 166, 1688
792 <-> 792, 946
793 <-> 214, 561
794 <-> 5, 1561
795 <-> 575, 1208, 1875
796 <-> 14, 1205, 1427
797 <-> 336, 1006, 1352
798 <-> 1176, 1754
799 <-> 251, 375
800 <-> 840, 1471
801 <-> 801, 1246, 1897
802 <-> 575
803 <-> 1692
804 <-> 565, 859, 1978
805 <-> 288, 1447
806 <-> 88, 598
807 <-> 219, 1579
808 <-> 608
809 <-> 335, 867, 1734, 1843
810 <-> 1279
811 <-> 294, 1043, 1560, 1583, 1600
812 <-> 1487, 1527
813 <-> 42, 1405
814 <-> 242, 644, 1175, 1638
815 <-> 1050, 1177
816 <-> 218, 635, 1427
817 <-> 416
818 <-> 1765, 1999
819 <-> 141, 533
820 <-> 1238, 1393
821 <-> 504, 1755
822 <-> 1320, 1397
823 <-> 681, 1120, 1798
824 <-> 639
825 <-> 659
826 <-> 1722, 1834
827 <-> 193, 602, 968
828 <-> 233, 1835
829 <-> 465
830 <-> 951
831 <-> 1606
832 <-> 1619, 1964
833 <-> 1109
834 <-> 7, 962, 1869
835 <-> 141
836 <-> 167, 875, 1145
837 <-> 1752
838 <-> 838, 1146
839 <-> 1247
840 <-> 800
841 <-> 1337
842 <-> 1438, 1466
843 <-> 102
844 <-> 284
845 <-> 742
846 <-> 382, 574
847 <-> 79, 398, 409
848 <-> 959
849 <-> 9, 704
850 <-> 915, 1455, 1911, 1987
851 <-> 531, 1001
852 <-> 434, 1172
853 <-> 310, 1533
854 <-> 650
855 <-> 483, 868, 1598
856 <-> 222, 534, 1133
857 <-> 857, 1249, 1923
858 <-> 412, 1540, 1575, 1607
859 <-> 804, 1655
860 <-> 564, 1243
861 <-> 296, 350, 1130, 1521
862 <-> 694
863 <-> 272, 391, 1558
864 <-> 309, 1071, 1227
865 <-> 1537, 1669, 1825
866 <-> 99, 474
867 <-> 809, 867, 1004
868 <-> 855, 1539
869 <-> 1550
870 <-> 1885
871 <-> 49
872 <-> 326, 378, 1552
873 <-> 1307
874 <-> 62, 438
875 <-> 836, 1056, 1326
876 <-> 876
877 <-> 1933
878 <-> 52, 128, 1527
879 <-> 879
880 <-> 1292, 1561, 1770
881 <-> 881, 981
882 <-> 790, 882, 932
883 <-> 1322, 1963
884 <-> 1842
885 <-> 885
886 <-> 33, 80, 1765, 1959
887 <-> 1012
888 <-> 276
889 <-> 1391
890 <-> 140
891 <-> 114, 891
892 <-> 160, 507
893 <-> 236, 502, 1602
894 <-> 1525
895 <-> 41
896 <-> 382
897 <-> 700
898 <-> 299
899 <-> 1797
900 <-> 1736
901 <-> 671, 944, 1147
902 <-> 1597, 1940
903 <-> 1283
904 <-> 17, 91, 557, 1169, 1764
905 <-> 505
906 <-> 9, 69, 942
907 <-> 80, 211, 1348
908 <-> 1398
909 <-> 909
910 <-> 1683
911 <-> 73, 911
912 <-> 1929
913 <-> 12, 491, 1591
914 <-> 169, 243, 625, 1867
915 <-> 850, 1538
916 <-> 83
917 <-> 378
918 <-> 1438
919 <-> 1951
920 <-> 1814
921 <-> 360, 682, 1952
922 <-> 922
923 <-> 107, 1161, 1254
924 <-> 222
925 <-> 1691
926 <-> 575
927 <-> 1165, 1270
928 <-> 368, 766
929 <-> 1707, 1914
930 <-> 145, 1096, 1434, 1791
931 <-> 931, 1983
932 <-> 882
933 <-> 502, 1921
934 <-> 1297
935 <-> 647, 1319
936 <-> 1255
937 <-> 1210
938 <-> 11
939 <-> 1348, 1666
940 <-> 1408
941 <-> 1440
942 <-> 906
943 <-> 1977
944 <-> 901
945 <-> 126
946 <-> 792
947 <-> 44, 1400
948 <-> 948, 1045
949 <-> 967
950 <-> 355
951 <-> 68, 830, 969
952 <-> 1225, 1757, 1929
953 <-> 1534, 1726
954 <-> 1511, 1888
955 <-> 183, 1418
956 <-> 1702
957 <-> 425
958 <-> 372
959 <-> 848, 1512
960 <-> 1868
961 <-> 1509
962 <-> 834, 1678
963 <-> 160
964 <-> 101, 161
965 <-> 355
966 <-> 1740, 1866
967 <-> 949, 1802
968 <-> 827, 1534
969 <-> 629, 646, 951
970 <-> 311
971 <-> 35, 1670
972 <-> 643, 674, 1449
973 <-> 358
974 <-> 974
975 <-> 729, 1955
976 <-> 1495
977 <-> 1603, 1889
978 <-> 337, 465, 657, 1615, 1953
979 <-> 1801
980 <-> 115, 612, 1239
981 <-> 881
982 <-> 2, 234, 1411, 1511
983 <-> 1970
984 <-> 227, 984
985 <-> 191, 569, 738
986 <-> 1926
987 <-> 987
988 <-> 126, 237, 1894
989 <-> 666, 687, 1079
990 <-> 301, 452, 1903
991 <-> 481, 1435
992 <-> 110, 779, 1637
993 <-> 21, 289, 697, 1675
994 <-> 1151, 1639
995 <-> 1090, 1798
996 <-> 652, 759, 1229
997 <-> 1253, 1380, 1553
998 <-> 350, 1812
999 <-> 1128
1000 <-> 1566
1001 <-> 851
1002 <-> 103, 1229
1003 <-> 604, 1156, 1232, 1420
1004 <-> 23, 867
1005 <-> 1085, 1174, 1899
1006 <-> 797
1007 <-> 63, 1282
1008 <-> 219, 1008, 1977
1009 <-> 265, 384, 1731
1010 <-> 275, 1438, 1474
1011 <-> 1289
1012 <-> 166, 235, 887, 1342, 1471
1013 <-> 1013, 1886
1014 <-> 664, 692, 1229
1015 <-> 632, 1015
1016 <-> 579
1017 <-> 161, 528
1018 <-> 323
1019 <-> 1684
1020 <-> 125
1021 <-> 1036, 1450
1022 <-> 699, 1600, 1962
1023 <-> 263, 726
1024 <-> 1295
1025 <-> 154, 1025
1026 <-> 268, 572, 1610
1027 <-> 239, 1269
1028 <-> 291, 1275
1029 <-> 418, 479, 1957
1030 <-> 1184
1031 <-> 618, 703
1032 <-> 345
1033 <-> 61, 339, 1033
1034 <-> 1166, 1291
1035 <-> 31, 41
1036 <-> 1021, 1228
1037 <-> 28, 443, 1227
1038 <-> 1178
1039 <-> 94, 1578
1040 <-> 320, 1992
1041 <-> 1041
1042 <-> 32, 1486
1043 <-> 720, 811
1044 <-> 157, 590, 696, 758, 1433, 1739
1045 <-> 948
1046 <-> 559, 1241
1047 <-> 199, 1962
1048 <-> 370
1049 <-> 276, 1885
1050 <-> 785, 815
1051 <-> 1051, 1290
1052 <-> 1165
1053 <-> 193, 1446, 1488
1054 <-> 1081
1055 <-> 6
1056 <-> 875
1057 <-> 128, 1137
1058 <-> 1112, 1173
1059 <-> 1226, 1538
1060 <-> 786
1061 <-> 375, 1639, 1988
1062 <-> 1748
1063 <-> 210, 1692
1064 <-> 444
1065 <-> 316, 600, 1689
1066 <-> 1709
1067 <-> 1067
1068 <-> 1068
1069 <-> 350
1070 <-> 1196
1071 <-> 365, 864, 1827
1072 <-> 446, 1142
1073 <-> 1931
1074 <-> 1529
1075 <-> 1075
1076 <-> 4, 1717, 1879, 1969
1077 <-> 338
1078 <-> 509, 590
1079 <-> 989, 1282
1080 <-> 139, 286
1081 <-> 1054, 1992
1082 <-> 1115, 1451, 1704
1083 <-> 603, 1271
1084 <-> 568, 1233
1085 <-> 700, 1005, 1939
1086 <-> 132, 1745, 1901
1087 <-> 1519
1088 <-> 412
1089 <-> 755
1090 <-> 544, 548, 995, 1768
1091 <-> 227, 533, 668, 1141
1092 <-> 95
1093 <-> 1271, 1946
1094 <-> 710, 1102
1095 <-> 1546
1096 <-> 930
1097 <-> 1288
1098 <-> 162, 1933
1099 <-> 1456
1100 <-> 608, 766
1101 <-> 34, 58, 1108
1102 <-> 1094, 1938
1103 <-> 223, 1117
1104 <-> 1457, 1605, 1654
1105 <-> 1105
1106 <-> 92, 747
1107 <-> 1699
1108 <-> 1101, 1201
1109 <-> 354, 833, 1285, 1874
1110 <-> 40, 716
1111 <-> 190, 572, 1440
1112 <-> 1058, 1193
1113 <-> 1113
1114 <-> 325, 630, 1853
1115 <-> 260, 1082
1116 <-> 504
1117 <-> 380, 1103
1118 <-> 1118
1119 <-> 1353, 1871
1120 <-> 823
1121 <-> 492, 1196
1122 <-> 1122
1123 <-> 1725
1124 <-> 1892
1125 <-> 1344
1126 <-> 620
1127 <-> 286, 1138
1128 <-> 999, 1268
1129 <-> 1129
1130 <-> 861
1131 <-> 1874
1132 <-> 1913
1133 <-> 856
1134 <-> 1185, 1767
1135 <-> 451, 1975
1136 <-> 65, 356, 1487
1137 <-> 192, 1057
1138 <-> 1127, 1782
1139 <-> 1240
1140 <-> 64, 390, 1385
1141 <-> 1091
1142 <-> 1072, 1587
1143 <-> 155, 1143
1144 <-> 265
1145 <-> 836, 1401
1146 <-> 838
1147 <-> 901, 1483
1148 <-> 94, 493, 645, 1167
1149 <-> 1818
1150 <-> 620, 1237, 1264
1151 <-> 994, 1844
1152 <-> 299, 1167
1153 <-> 443, 1947
1154 <-> 1803
1155 <-> 489, 1163
1156 <-> 1003, 1635, 1668
1157 <-> 1340, 1809
1158 <-> 231
1159 <-> 57
1160 <-> 1558
1161 <-> 923
1162 <-> 1590
1163 <-> 1155
1164 <-> 145, 1164, 1283
1165 <-> 927, 1052, 1678, 1934
1166 <-> 1034
1167 <-> 240, 1148, 1152, 1462
1168 <-> 784
1169 <-> 595, 904
1170 <-> 421
1171 <-> 1667
1172 <-> 852, 1195, 1323, 1444
1173 <-> 1058, 1389
1174 <-> 1005
1175 <-> 814
1176 <-> 798
1177 <-> 258, 815, 1401
1178 <-> 687, 1038, 1331
1179 <-> 134, 1179
1180 <-> 420
1181 <-> 1181
1182 <-> 267, 1677
1183 <-> 100
1184 <-> 669, 1030, 1969
1185 <-> 498, 1134, 1673, 1750
1186 <-> 165
1187 <-> 1893
1188 <-> 1236, 1365
1189 <-> 1334, 1732
1190 <-> 279
1191 <-> 1620
1192 <-> 1257
1193 <-> 1112
1194 <-> 1770
1195 <-> 187, 1172, 1964
1196 <-> 641, 1070, 1121, 1729
1197 <-> 511, 1273, 1607
1198 <-> 229, 774
1199 <-> 290, 455, 1860
1200 <-> 1901
1201 <-> 1108
1202 <-> 1378
1203 <-> 1591
1204 <-> 229
1205 <-> 645, 796, 1250
1206 <-> 281, 1824
1207 <-> 782
1208 <-> 546, 795, 1700
1209 <-> 249
1210 <-> 750, 787, 937
1211 <-> 527, 1981
1212 <-> 1212, 1369
1213 <-> 1512
1214 <-> 737
1215 <-> 575
1216 <-> 540, 1216
1217 <-> 1312, 1340
1218 <-> 291, 1586
1219 <-> 583, 1554
1220 <-> 117, 767
1221 <-> 411, 620, 1221
1222 <-> 1612, 1710
1223 <-> 1223, 1374
1224 <-> 331
1225 <-> 315, 952, 1263
1226 <-> 1059, 1928
1227 <-> 864, 1037, 1823
1228 <-> 1036, 1613
1229 <-> 589, 996, 1002, 1014, 1906
1230 <-> 247, 468, 772, 1821, 1837
1231 <-> 195, 220, 725
1232 <-> 271, 542, 660, 1003, 1232, 1606
1233 <-> 1084, 1366, 1738
1234 <-> 543, 1408
1235 <-> 524
1236 <-> 183, 1188
1237 <-> 1150
1238 <-> 820, 1521
1239 <-> 980
1240 <-> 1139, 1240
1241 <-> 597, 1046
1242 <-> 1646
1243 <-> 331, 741, 860
1244 <-> 1522, 1870
1245 <-> 1245
1246 <-> 801
1247 <-> 665, 839
1248 <-> 208, 1932
1249 <-> 857
1250 <-> 1205
1251 <-> 711
1252 <-> 1888
1253 <-> 997, 1593
1254 <-> 235, 520, 923, 1382
1255 <-> 936
1256 <-> 1718
1257 <-> 259, 1192
1258 <-> 659, 1917
1259 <-> 392
1260 <-> 1260
1261 <-> 1261, 1376
1262 <-> 1936
1263 <-> 1225
1264 <-> 1150, 1567
1265 <-> 398
1266 <-> 773, 1373
1267 <-> 257, 341, 525
1268 <-> 202, 262, 1128
1269 <-> 1027
1270 <-> 927
1271 <-> 1083, 1093
1272 <-> 781
1273 <-> 1197
1274 <-> 1760
1275 <-> 1028, 1827
1276 <-> 707, 1900
1277 <-> 188
1278 <-> 1463
1279 <-> 758, 810
1280 <-> 1920
1281 <-> 1942
1282 <-> 53, 1007, 1079
1283 <-> 192, 903, 1164, 1690
1284 <-> 512, 1584
1285 <-> 1109, 1285
1286 <-> 272
1287 <-> 160
1288 <-> 15, 1097, 1905
1289 <-> 591, 606, 1011
1290 <-> 1051
1291 <-> 331, 1034
1292 <-> 470, 880
1293 <-> 1501, 1899
1294 <-> 746, 1294
1295 <-> 183, 1024
1296 <-> 1580
1297 <-> 711, 752, 934
1298 <-> 1298
1299 <-> 517, 1299
1300 <-> 1300
1301 <-> 708, 1301
1302 <-> 645
1303 <-> 1355, 1492
1304 <-> 1361, 1746
1305 <-> 773
1306 <-> 334, 1325
1307 <-> 769, 776, 873, 1333
1308 <-> 312, 1851, 1966
1309 <-> 607, 1459, 1496
1310 <-> 759
1311 <-> 1381, 1520
1312 <-> 1217
1313 <-> 1983
1314 <-> 1314
1315 <-> 1315, 1647
1316 <-> 63
1317 <-> 537
1318 <-> 1973
1319 <-> 935, 1517
1320 <-> 531, 822
1321 <-> 27, 1837
1322 <-> 883, 1664
1323 <-> 1172
1324 <-> 730
1325 <-> 1306
1326 <-> 633, 875
1327 <-> 159, 1553
1328 <-> 1974
1329 <-> 1939
1330 <-> 277, 1515
1331 <-> 1178, 1590
1332 <-> 274, 1332
1333 <-> 8, 761, 1307, 1333
1334 <-> 275, 1189, 1482
1335 <-> 1478
1336 <-> 140
1337 <-> 66, 611, 768, 841
1338 <-> 176, 685, 688, 1449
1339 <-> 1339
1340 <-> 301, 1157, 1217, 1630
1341 <-> 27
1342 <-> 1012
1343 <-> 1408
1344 <-> 452, 1125, 1622
1345 <-> 74, 1835
1346 <-> 1860
1347 <-> 634, 1428
1348 <-> 907, 939
1349 <-> 490, 1349
1350 <-> 305, 612, 757
1351 <-> 162
1352 <-> 797, 1818
1353 <-> 1119, 1353
1354 <-> 1436
1355 <-> 1303
1356 <-> 94, 254
1357 <-> 1419, 1664, 1680
1358 <-> 1358
1359 <-> 197
1360 <-> 722, 1909
1361 <-> 1304
1362 <-> 82, 188, 1448
1363 <-> 1752
1364 <-> 501
1365 <-> 1188, 1661
1366 <-> 584, 1233
1367 <-> 623, 1394, 1781
1368 <-> 1886
1369 <-> 1212
1370 <-> 86, 1370
1371 <-> 1772
1372 <-> 191, 1473
1373 <-> 1266
1374 <-> 1223, 1981
1375 <-> 366, 1375
1376 <-> 1261, 1599
1377 <-> 1675
1378 <-> 30, 1202, 1406, 1845
1379 <-> 153, 628, 1557
1380 <-> 180, 997
1381 <-> 1311, 1407, 1666
1382 <-> 1254
1383 <-> 375, 1714
1384 <-> 392
1385 <-> 1140, 1933
1386 <-> 1949
1387 <-> 439, 1387
1388 <-> 1770
1389 <-> 1173, 1679
1390 <-> 123, 453, 1733
1391 <-> 158, 249, 889, 1945
1392 <-> 1881
1393 <-> 820
1394 <-> 18, 181, 355, 1367
1395 <-> 374, 1404
1396 <-> 515, 1860
1397 <-> 200, 822
1398 <-> 472, 908, 1622, 1701
1399 <-> 699
1400 <-> 422, 947, 1551
1401 <-> 1145, 1177
1402 <-> 1764
1403 <-> 1875
1404 <-> 1395
1405 <-> 661, 813
1406 <-> 780, 1378
1407 <-> 1381
1408 <-> 588, 940, 1234, 1343, 1603, 1865
1409 <-> 1427
1410 <-> 164
1411 <-> 88, 982
1412 <-> 1452
1413 <-> 1707, 1766
1414 <-> 121
1415 <-> 318, 1415, 1612
1416 <-> 1416
1417 <-> 232
1418 <-> 361, 955, 1418, 1737
1419 <-> 473, 1357
1420 <-> 1003
1421 <-> 122, 1973
1422 <-> 512, 1870
1423 <-> 248
1424 <-> 648
1425 <-> 1425
1426 <-> 224, 1946
1427 <-> 796, 816, 1409
1428 <-> 1347
1429 <-> 1810, 1862
1430 <-> 1430
1431 <-> 788, 1488
1432 <-> 259, 1432
1433 <-> 1, 501, 748, 1044
1434 <-> 930
1435 <-> 991
1436 <-> 1354, 1436
1437 <-> 253
1438 <-> 522, 558, 842, 918, 1010
1439 <-> 1649
1440 <-> 735, 941, 1111
1441 <-> 1707
1442 <-> 305, 1930
1443 <-> 357
1444 <-> 1172
1445 <-> 162, 270, 1636
1446 <-> 1053
1447 <-> 220, 292, 805
1448 <-> 1362
1449 <-> 740, 972, 1338
1450 <-> 100, 237, 1021
1451 <-> 5, 1082
1452 <-> 1412, 1572
1453 <-> 556
1454 <-> 1454
1455 <-> 850
1456 <-> 125, 268, 1099
1457 <-> 240, 1104
1458 <-> 18, 1576
1459 <-> 1309, 1503
1460 <-> 84, 371
1461 <-> 1747, 1879
1462 <-> 3, 1167, 1807
1463 <-> 377, 1278, 1499, 1971
1464 <-> 1908
1465 <-> 72
1466 <-> 724, 842
1467 <-> 410, 739
1468 <-> 67
1469 <-> 155, 1652
1470 <-> 268, 469, 486
1471 <-> 800, 1012, 1471, 1510
1472 <-> 39
1473 <-> 1372
1474 <-> 1010, 1915
1475 <-> 467, 1658
1476 <-> 1476
1477 <-> 627, 1477
1478 <-> 427, 1335, 1907
1479 <-> 348
1480 <-> 1480
1481 <-> 1802
1482 <-> 1334
1483 <-> 1147, 1524
1484 <-> 42, 525
1485 <-> 539
1486 <-> 148, 1042, 1549
1487 <-> 812, 1136
1488 <-> 1053, 1431
1489 <-> 1708, 1931
1490 <-> 1807
1491 <-> 431
1492 <-> 156, 1303
1493 <-> 1493
1494 <-> 1853
1495 <-> 446, 976
1496 <-> 395, 1309
1497 <-> 195, 396, 1974
1498 <-> 490, 1626
1499 <-> 76, 1463
1500 <-> 1722
1501 <-> 577, 1293
1502 <-> 115
1503 <-> 1459, 1507
1504 <-> 210, 261, 578, 1521, 1718
1505 <-> 230, 426, 684, 1634
1506 <-> 382, 1921
1507 <-> 1503
1508 <-> 162, 1667
1509 <-> 961, 1509
1510 <-> 1471
1511 <-> 954, 982, 1582
1512 <-> 476, 959, 1213, 1703
1513 <-> 353, 620
1514 <-> 617, 1546
1515 <-> 1330, 1595
1516 <-> 1946
1517 <-> 42, 1319
1518 <-> 585
1519 <-> 32, 1087
1520 <-> 1311
1521 <-> 861, 1238, 1504
1522 <-> 1244, 1653
1523 <-> 1523
1524 <-> 1483
1525 <-> 894, 1525
1526 <-> 1924
1527 <-> 812, 878
1528 <-> 494
1529 <-> 59, 1074
1530 <-> 1530
1531 <-> 34, 1531
1532 <-> 1638
1533 <-> 853
1534 <-> 953, 968
1535 <-> 108, 689
1536 <-> 1589
1537 <-> 394, 865
1538 <-> 915, 1059
1539 <-> 868
1540 <-> 858, 1745
1541 <-> 221
1542 <-> 639
1543 <-> 1746
1544 <-> 783, 1544
1545 <-> 236
1546 <-> 66, 1095, 1514
1547 <-> 1628
1548 <-> 1548
1549 <-> 433, 1486
1550 <-> 869, 1550
1551 <-> 1400, 1787
1552 <-> 695, 872
1553 <-> 997, 1327
1554 <-> 1219
1555 <-> 97
1556 <-> 1840
1557 <-> 7, 1379
1558 <-> 126, 863, 1160
1559 <-> 336, 373
1560 <-> 343, 811
1561 <-> 278, 794, 880, 1561
1562 <-> 127, 518, 1562
1563 <-> 406
1564 <-> 81, 399
1565 <-> 748
1566 <-> 637, 1000
1567 <-> 1264
1568 <-> 1568
1569 <-> 214
1570 <-> 561, 1849
1571 <-> 282
1572 <-> 44, 130, 178, 1452
1573 <-> 107
1574 <-> 299
1575 <-> 647, 858
1576 <-> 1458, 1633
1577 <-> 1833, 1939
1578 <-> 1039, 1802
1579 <-> 807, 1853
1580 <-> 1296, 1580, 1907
1581 <-> 675
1582 <-> 1511, 1605, 1756
1583 <-> 811
1584 <-> 1284
1585 <-> 1817
1586 <-> 168, 650, 1218
1587 <-> 784, 1142
1588 <-> 742
1589 <-> 45, 209, 413, 1536
1590 <-> 25, 201, 1162, 1331
1591 <-> 913, 1203
1592 <-> 1820
1593 <-> 1253
1594 <-> 231
1595 <-> 149, 1515
1596 <-> 57, 1976
1597 <-> 586, 902
1598 <-> 855
1599 <-> 1376
1600 <-> 811, 1022
1601 <-> 284, 746
1602 <-> 386, 893
1603 <-> 135, 977, 1408
1604 <-> 452, 513
1605 <-> 1104, 1582
1606 <-> 831, 1232
1607 <-> 709, 715, 858, 1197
1608 <-> 1793
1609 <-> 611, 1808
1610 <-> 1026, 1964
1611 <-> 304
1612 <-> 1222, 1415, 1769
1613 <-> 1228, 1847
1614 <-> 273
1615 <-> 978
1616 <-> 156, 355
1617 <-> 177
1618 <-> 1618
1619 <-> 323, 642, 832
1620 <-> 113, 349, 1191, 1746
1621 <-> 609
1622 <-> 519, 1344, 1398
1623 <-> 614
1624 <-> 771, 1989
1625 <-> 1625
1626 <-> 1498
1627 <-> 186, 315
1628 <-> 633, 1547
1629 <-> 1706
1630 <-> 1340
1631 <-> 297, 1800
1632 <-> 1806
1633 <-> 1576
1634 <-> 1505
1635 <-> 1156
1636 <-> 1445
1637 <-> 76, 992, 1920, 1995
1638 <-> 814, 1532
1639 <-> 994, 1061
1640 <-> 1640
1641 <-> 721
1642 <-> 1739, 1945
1643 <-> 1643
1644 <-> 1644, 1908
1645 <-> 125, 303
1646 <-> 1242, 1646
1647 <-> 1315
1648 <-> 1957
1649 <-> 97, 1439, 1783
1650 <-> 576
1651 <-> 1651
1652 <-> 35, 1469
1653 <-> 1522
1654 <-> 1104
1655 <-> 460, 859
1656 <-> 362
1657 <-> 142, 181
1658 <-> 428, 1475
1659 <-> 470
1660 <-> 247
1661 <-> 1365
1662 <-> 165, 359
1663 <-> 198
1664 <-> 1322, 1357
1665 <-> 447, 632
1666 <-> 939, 1381
1667 <-> 1171, 1508
1668 <-> 638, 1156
1669 <-> 476, 865, 1699
1670 <-> 577, 971
1671 <-> 119, 417, 762, 1804
1672 <-> 50, 1672, 1687
1673 <-> 63, 333, 1185
1674 <-> 1674
1675 <-> 993, 1377
1676 <-> 742, 1813
1677 <-> 233, 1182, 1846
1678 <-> 962, 1165
1679 <-> 722, 1389
1680 <-> 82, 1357
1681 <-> 1681, 1702, 1895
1682 <-> 372
1683 <-> 203, 341, 910
1684 <-> 1019, 1948
1685 <-> 1982
1686 <-> 371
1687 <-> 1672
1688 <-> 791
1689 <-> 1065, 1689
1690 <-> 1283
1691 <-> 925, 1878
1692 <-> 803, 1063, 1732
1693 <-> 487
1694 <-> 600
1695 <-> 1695, 1794
1696 <-> 1696
1697 <-> 1802
1698 <-> 357, 732
1699 <-> 1107, 1669
1700 <-> 1208
1701 <-> 1398
1702 <-> 956, 1681
1703 <-> 605, 1512
1704 <-> 1082
1705 <-> 343
1706 <-> 1629, 1775
1707 <-> 770, 929, 1413, 1441
1708 <-> 367, 1489
1709 <-> 1066, 1862
1710 <-> 1222
1711 <-> 650
1712 <-> 620
1713 <-> 1713
1714 <-> 1383
1715 <-> 1911
1716 <-> 510, 1716
1717 <-> 1076
1718 <-> 1256, 1504
1719 <-> 238
1720 <-> 549, 634, 1720
1721 <-> 15
1722 <-> 826, 1500
1723 <-> 1880
1724 <-> 177, 1724
1725 <-> 514, 1123, 1797
1726 <-> 482, 953
1727 <-> 1914
1728 <-> 216, 1982
1729 <-> 579, 783, 1196, 1800
1730 <-> 1730, 1972
1731 <-> 1009
1732 <-> 89, 1189, 1692
1733 <-> 1390
1734 <-> 809
1735 <-> 455, 695
1736 <-> 900, 1736
1737 <-> 530, 1418
1738 <-> 1233, 1888
1739 <-> 1044, 1642, 1834
1740 <-> 966
1741 <-> 145, 253
1742 <-> 112
1743 <-> 1980
1744 <-> 139
1745 <-> 1086, 1540
1746 <-> 1304, 1543, 1620
1747 <-> 117, 354, 1461
1748 <-> 45, 273, 332, 1062
1749 <-> 249
1750 <-> 124, 1185
1751 <-> 1835
1752 <-> 104, 837, 1363
1753 <-> 245, 775
1754 <-> 798, 1876
1755 <-> 453, 718, 821
1756 <-> 1582
1757 <-> 952, 1772, 1841
1758 <-> 1758, 1830, 1878
1759 <-> 729
1760 <-> 104, 1274
1761 <-> 224, 619, 622, 763, 1868
1762 <-> 1762
1763 <-> 537
1764 <-> 904, 1402
1765 <-> 521, 818, 886, 1782
1766 <-> 421, 1413
1767 <-> 1134
1768 <-> 202, 1090
1769 <-> 1612
1770 <-> 621, 880, 1194, 1388
1771 <-> 293
1772 <-> 1371, 1757
1773 <-> 19, 375
1774 <-> 1774
1775 <-> 1706, 1915
1776 <-> 778
1777 <-> 460, 1918
1778 <-> 666
1779 <-> 523, 1846
1780 <-> 427
1781 <-> 1367
1782 <-> 701, 771, 1138, 1765
1783 <-> 482, 1649, 1783
1784 <-> 1784, 1872
1785 <-> 777, 1785
1786 <-> 1858
1787 <-> 1551
1788 <-> 59, 384, 1865
1789 <-> 111
1790 <-> 294, 407, 1969
1791 <-> 238, 930
1792 <-> 659
1793 <-> 489, 538, 697, 1608
1794 <-> 206, 649, 1695
1795 <-> 314, 748
1796 <-> 1796
1797 <-> 899, 1725, 1797
1798 <-> 823, 995
1799 <-> 308, 1799
1800 <-> 675, 683, 1631, 1729
1801 <-> 697, 979, 1858
1802 <-> 967, 1481, 1578, 1697
1803 <-> 1154, 1803
1804 <-> 1671
1805 <-> 199
1806 <-> 264, 1632, 1806
1807 <-> 1462, 1490
1808 <-> 1609, 1808
1809 <-> 1157
1810 <-> 1429
1811 <-> 125
1812 <-> 998
1813 <-> 1676
1814 <-> 358, 485, 920, 1814
1815 <-> 211
1816 <-> 632
1817 <-> 513, 1585
1818 <-> 1149, 1352
1819 <-> 632, 717
1820 <-> 465, 1592
1821 <-> 46, 257, 1230
1822 <-> 492
1823 <-> 1227, 1891
1824 <-> 247, 1206
1825 <-> 182, 865
1826 <-> 501
1827 <-> 3, 1071, 1275
1828 <-> 29
1829 <-> 139
1830 <-> 1758
1831 <-> 542
1832 <-> 1862
1833 <-> 1577
1834 <-> 151, 826, 1739, 1882
1835 <-> 828, 1345, 1751, 1835
1836 <-> 45, 677
1837 <-> 1230, 1321
1838 <-> 165, 1856
1839 <-> 1842, 1953
1840 <-> 183, 1556
1841 <-> 554, 1757
1842 <-> 884, 1839
1843 <-> 464, 809
1844 <-> 291, 570, 1151
1845 <-> 1378
1846 <-> 1677, 1779
1847 <-> 374, 1613
1848 <-> 204, 412
1849 <-> 626, 1570
1850 <-> 1850
1851 <-> 1308
1852 <-> 228, 455
1853 <-> 454, 1114, 1494, 1579
1854 <-> 268, 596
1855 <-> 1855
1856 <-> 1838
1857 <-> 61
1858 <-> 336, 1786, 1801, 1937
1859 <-> 1908
1860 <-> 1199, 1346, 1396
1861 <-> 1861
1862 <-> 1429, 1709, 1832, 1900
1863 <-> 9
1864 <-> 41, 1975
1865 <-> 673, 1408, 1788
1866 <-> 966, 1873
1867 <-> 914
1868 <-> 330, 520, 960, 1761
1869 <-> 2, 834
1870 <-> 1244, 1422
1871 <-> 1119
1872 <-> 1784
1873 <-> 242, 1866
1874 <-> 337, 1109, 1131
1875 <-> 795, 1403
1876 <-> 258, 1754
1877 <-> 34
1878 <-> 481, 1691, 1758
1879 <-> 1076, 1461
1880 <-> 147, 410, 1723
1881 <-> 520, 764, 1392, 1955
1882 <-> 1834
1883 <-> 319, 514
1884 <-> 1969
1885 <-> 740, 870, 1049
1886 <-> 1013, 1368
1887 <-> 1887
1888 <-> 954, 1252, 1738
1889 <-> 977
1890 <-> 446, 530
1891 <-> 1823
1892 <-> 1124, 1892
1893 <-> 395, 1187, 1893
1894 <-> 988
1895 <-> 733, 1681
1896 <-> 11
1897 <-> 77, 801
1898 <-> 545, 1898
1899 <-> 1005, 1293
1900 <-> 511, 1276, 1862
1901 <-> 1086, 1200
1902 <-> 410
1903 <-> 315, 990
1904 <-> 422
1905 <-> 1288, 1905
1906 <-> 1229
1907 <-> 1478, 1580
1908 <-> 1464, 1644, 1859
1909 <-> 706, 1360
1910 <-> 569
1911 <-> 310, 850, 1715
1912 <-> 1912
1913 <-> 279, 1132
1914 <-> 614, 929, 1727
1915 <-> 1474, 1775
1916 <-> 1916
1917 <-> 1258
1918 <-> 382, 1777
1919 <-> 41, 653
1920 <-> 1280, 1637
1921 <-> 933, 1506
1922 <-> 167
1923 <-> 857
1924 <-> 222, 1526, 1924
1925 <-> 231, 367, 1925
1926 <-> 385, 422, 986
1927 <-> 321, 513, 553
1928 <-> 728, 1226
1929 <-> 912, 952, 1965
1930 <-> 1442
1931 <-> 1073, 1489
1932 <-> 1248, 1932
1933 <-> 499, 877, 1098, 1385
1934 <-> 1165
1935 <-> 37, 631
1936 <-> 283, 757, 1262
1937 <-> 1858
1938 <-> 109, 555, 1102
1939 <-> 1085, 1329, 1577
1940 <-> 902, 1940
1941 <-> 364, 583
1942 <-> 719, 1281
1943 <-> 609, 760
1944 <-> 230
1945 <-> 1391, 1642
1946 <-> 1093, 1426, 1516
1947 <-> 1153
1948 <-> 212, 296, 500, 1684
1949 <-> 152, 737, 1386
1950 <-> 133, 296
1951 <-> 919, 1951
1952 <-> 921
1953 <-> 978, 1839
1954 <-> 657
1955 <-> 975, 1881
1956 <-> 55, 71, 235, 742
1957 <-> 1029, 1648
1958 <-> 1958
1959 <-> 886
1960 <-> 196, 301, 495
1961 <-> 674
1962 <-> 576, 1022, 1047
1963 <-> 883
1964 <-> 832, 1195, 1610
1965 <-> 1929
1966 <-> 745, 1308
1967 <-> 751
1968 <-> 524, 1968
1969 <-> 1076, 1184, 1790, 1884
1970 <-> 983, 1970
1971 <-> 1463
1972 <-> 1730
1973 <-> 457, 1318, 1421
1974 <-> 1328, 1497, 1974
1975 <-> 170, 1135, 1864
1976 <-> 1596
1977 <-> 70, 943, 1008
1978 <-> 804
1979 <-> 631
1980 <-> 522, 742, 1743
1981 <-> 1211, 1374
1982 <-> 597, 1685, 1728
1983 <-> 30, 931, 1313
1984 <-> 109, 720
1985 <-> 111
1986 <-> 767
1987 <-> 418, 701, 850
1988 <-> 1061
1989 <-> 1624
1990 <-> 744
1991 <-> 316
1992 <-> 346, 562, 1040, 1081
1993 <-> 685
1994 <-> 573
1995 <-> 381, 676, 1637, 1995
1996 <-> 576, 652
1997 <-> 554
1998 <-> 168
1999 <-> 818
"""
def parse(source_lines):
d = defaultdict(set)
for l in source_lines:
[n0, rst0] = l.split(' <-> ')
rst1 = map(int, rst0.split(', '))
n1 = int(n0)
for r in rst1:
d[n1] |= {r}
d[r] |= {n1}
return d
def related_nodes(nodes, target):
'''
All related nodes (transitively and reflexively) to `target'
'''
t = target
rv = {t}
visit = []
frontier = [t]
while len(frontier) > 0:
n = frontier.pop()
if n not in visit:
visit.append(n)
for c in nodes[n]:
rv |= {c}
frontier.append(c)
return rv
nodes = parse((l for l in s.splitlines() if l))
rel_nodes = related_nodes(nodes, 0)
print(len(rel_nodes))
| 17.728425 | 64 | 0.559226 | 5,908 | 36,361 | 3.440758 | 0.34631 | 0.001771 | 0.00059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.705106 | 0.222766 | 36,361 | 2,050 | 65 | 17.737073 | 0.014189 | 0.00165 | 0 | 0.001963 | 0 | 0 | 0.979385 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.000981 | false | 0 | 0.000491 | 0 | 0.002453 | 0.000491 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f924443256d91abd882927f0c2bb90dc099120f0 | 1,041 | py | Python | setup.py | AliyevH/elasticfeed | 15613ef5f545982c1e018e82fa9f47d1cf0f2684 | [
"MIT"
] | 3 | 2020-09-10T13:56:17.000Z | 2020-11-23T22:32:02.000Z | setup.py | AliyevH/elk_feeder | 15613ef5f545982c1e018e82fa9f47d1cf0f2684 | [
"MIT"
] | null | null | null | setup.py | AliyevH/elk_feeder | 15613ef5f545982c1e018e82fa9f47d1cf0f2684 | [
"MIT"
] | 1 | 2020-09-17T12:04:39.000Z | 2020-09-17T12:04:39.000Z | from setuptools import setup, find_packages
setup(
name="elasticfeed",
version="0.1.1",
include_package_data=True,
packages=find_packages(),
author="Hasan Aliyev",
author_email="hasan.aliyev.555@gmail.com",
description="Export csv data into Elasticsearch",
license="MIT",
url="https://github.com/AliyevH/elk_feeder",
install_requires=["click", "elasticsearch","coloredlogs"],
entry_points = {
'console_scripts': ['elasticfeed=elastic_feeder.scripts.commands:command'],
},
classifiers=[
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
) | 35.896552 | 83 | 0.632085 | 105 | 1,041 | 6.171429 | 0.647619 | 0.146605 | 0.192901 | 0.160494 | 0.08642 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014888 | 0.225744 | 1,041 | 29 | 84 | 35.896552 | 0.789082 | 0 | 0 | 0 | 0 | 0 | 0.566219 | 0.073896 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.035714 | 0 | 0.035714 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f92c3ddef01bd06b4fa574e22117773f52c66815 | 893 | py | Python | saas/dataops/api/dataset/APP-META-PRIVATE/postrun/00_init_job.py | iuskye/SREWorks | a2a7446767d97ec5f6d15bd00189c42150d6c894 | [
"Apache-2.0"
] | 407 | 2022-03-16T08:09:38.000Z | 2022-03-31T12:27:10.000Z | saas/dataops/api/dataset/APP-META-PRIVATE/postrun/00_init_job.py | iuskye/SREWorks | a2a7446767d97ec5f6d15bd00189c42150d6c894 | [
"Apache-2.0"
] | 25 | 2022-03-22T04:27:31.000Z | 2022-03-30T08:47:28.000Z | saas/dataops/api/dataset/APP-META-PRIVATE/postrun/00_init_job.py | iuskye/SREWorks | a2a7446767d97ec5f6d15bd00189c42150d6c894 | [
"Apache-2.0"
] | 109 | 2022-03-21T17:30:44.000Z | 2022-03-31T09:36:28.000Z | # coding: utf-8
from common import checker
from warehouse import entry as warehouse_entry
from pmdb import entry as pmdb_entry
from dataset import entry as dataset_entry
from health import entry as health_entry
from job import entry as job_entry
from es import entry as es_entry
checker.check_sreworks_data_service_ready()
print("======start init warehouse======")
warehouse_entry.init()
print("======end init warehouse======")
print("======start init pmdb======")
pmdb_entry.init()
print("======end init pmdb======")
print("======start init dataset======")
dataset_entry.init()
print("======end init dataset======")
print("======start init health======")
health_entry.init()
print("======end init health======")
print("======start init es======")
es_entry.init()
print("======end init es======")
print("======start init job======")
job_entry.init()
print("======end init job======")
| 24.135135 | 46 | 0.651736 | 121 | 893 | 4.677686 | 0.198347 | 0.116608 | 0.137809 | 0.180212 | 0.222615 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001253 | 0.106383 | 893 | 36 | 47 | 24.805556 | 0.70802 | 0.014558 | 0 | 0 | 0 | 0 | 0.371298 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.269231 | 0 | 0.269231 | 0.461538 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
007e4dff95a85a34ae18115aba2405eea01f19e6 | 371 | py | Python | {{cookiecutter.project}}/{{cookiecutter.project_slug}}/__init__.py | jhinAza/python-flask-microservice-template | 8c399f81dfbb61903c7090fde7ea3acbe5a1d133 | [
"MIT"
] | 2 | 2018-05-11T10:34:19.000Z | 2018-05-11T15:38:40.000Z | {{cookiecutter.project}}/{{cookiecutter.project_slug}}/__init__.py | jhinAza/python-flask-microservice-template | 8c399f81dfbb61903c7090fde7ea3acbe5a1d133 | [
"MIT"
] | 1 | 2019-07-23T19:17:13.000Z | 2019-07-23T19:17:13.000Z | {{cookiecutter.project}}/{{cookiecutter.project_slug}}/__init__.py | jhinAza/python-flask-microservice-template | 8c399f81dfbb61903c7090fde7ea3acbe5a1d133 | [
"MIT"
] | null | null | null | from flask import Flask
from {{cookiecutter.project_slug}}.{{cookiecutter.project_slug}}_root import {{cookiecutter.project_slug}}
__author__ = """{{cookiecutter.mantainer_name}}"""
__email__ = '{{cookiecutter.mantainer_email}}'
__version__ = '0.1.0'
def create_app():
app = Flask(__name__)
app.register_blueprint({{cookiecutter.project_slug}})
return app
| 28.538462 | 106 | 0.743935 | 42 | 371 | 5.97619 | 0.47619 | 0.302789 | 0.366534 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009063 | 0.107817 | 371 | 12 | 107 | 30.916667 | 0.749245 | 0 | 0 | 0 | 0 | 0 | 0.183288 | 0.169811 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.222222 | null | null | 0.111111 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0084357193a4b6b1663a56822a2584b81b55bed0 | 591 | py | Python | Chapter_3/try_3.2.py | charliealpha094/Python_Crash_Course_2nd_edition | 9d1548b775c861fd63890ccee19a9101eb0c5c6b | [
"MIT"
] | null | null | null | Chapter_3/try_3.2.py | charliealpha094/Python_Crash_Course_2nd_edition | 9d1548b775c861fd63890ccee19a9101eb0c5c6b | [
"MIT"
] | null | null | null | Chapter_3/try_3.2.py | charliealpha094/Python_Crash_Course_2nd_edition | 9d1548b775c861fd63890ccee19a9101eb0c5c6b | [
"MIT"
] | null | null | null | #Done by Carlos Amaral on 12/06/2020
"""
Start with the list you used in Exercise 3-1, but instead of just
printing each person’s name, print a message to them. The text of each mes-
sage should be the same, but each message should be personalized with the
person’s name.
"""
friends = ['Rita', 'Catarina', 'Emilia', 'Patrícia']
message = "Hello, " + friends[0].title() + "!!!"
print(message)
message = "Hello, " +friends[1].title() + "!!!"
print(message)
message = "Hello, " + friends[2].title() + "!!!"
print(message)
message = "Hello, " + friends[3].title() + "!!!"
print (message)
| 25.695652 | 75 | 0.658206 | 86 | 591 | 4.523256 | 0.55814 | 0.123393 | 0.195373 | 0.18509 | 0.277635 | 0.277635 | 0 | 0 | 0 | 0 | 0 | 0.028398 | 0.165821 | 591 | 22 | 76 | 26.863636 | 0.760649 | 0.450085 | 0 | 0.444444 | 0 | 0 | 0.208202 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.444444 | 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 | 1 | 0 | 3 |
00a29b6240cf24c82442f883dedd1272257afe95 | 203 | py | Python | src/core/repository/file/__init__.py | lucassaporetti/car-rental | 6e37032df3a399b78ed3d7998a2cb31a2a84d033 | [
"MIT"
] | 1 | 2021-02-11T18:45:12.000Z | 2021-02-11T18:45:12.000Z | src/core/repository/file/__init__.py | lucassaporetti/car-rental | 6e37032df3a399b78ed3d7998a2cb31a2a84d033 | [
"MIT"
] | null | null | null | src/core/repository/file/__init__.py | lucassaporetti/car-rental | 6e37032df3a399b78ed3d7998a2cb31a2a84d033 | [
"MIT"
] | null | null | null | # _*_ coding: utf-8 _*_
#
# Package: src.core.repository.file
__all__ = [
"car_repository",
"customer_repository",
"employee_repository",
"file_db",
"file_repository",
"rental_repository"
]
| 15.615385 | 35 | 0.689655 | 21 | 203 | 6 | 0.666667 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005848 | 0.157635 | 203 | 12 | 36 | 16.916667 | 0.730994 | 0.270936 | 0 | 0 | 0 | 0 | 0.631944 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
00b6cda207b6b419d6e64315af17b58474dfc10a | 319 | py | Python | isyntax2raw/cli/__init__.py | kkoz/isyntax2raw | 84510eced69b44f4180c43d6a7c210de5b0a563d | [
"BSD-3-Clause"
] | 6 | 2020-03-04T11:34:56.000Z | 2022-02-03T18:27:18.000Z | isyntax2raw/cli/__init__.py | kkoz/isyntax2raw | 84510eced69b44f4180c43d6a7c210de5b0a563d | [
"BSD-3-Clause"
] | 18 | 2020-03-26T21:01:41.000Z | 2022-03-04T18:40:20.000Z | isyntax2raw/cli/__init__.py | kkoz/isyntax2raw | 84510eced69b44f4180c43d6a7c210de5b0a563d | [
"BSD-3-Clause"
] | 12 | 2019-12-06T02:52:56.000Z | 2022-01-05T05:32:33.000Z | # encoding: utf-8
#
# Copyright (c) 2017 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle.
# If the file is missing please request a copy by contacting
# support@glencoesoftware.com.
| 35.444444 | 77 | 0.749216 | 48 | 319 | 4.979167 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01938 | 0.191223 | 319 | 8 | 78 | 39.875 | 0.906977 | 0.92163 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
00cd526f4a00619cb396b7855857ea58ac675dea | 15,522 | py | Python | test/ServerTest.py | wmde/catgraph-client-python | 69f87d86f809bb57b9d31e857e47f10bd370d703 | [
"Unlicense"
] | 1 | 2016-07-01T20:58:48.000Z | 2016-07-01T20:58:48.000Z | test/ServerTest.py | wmde/catgraph-client-python | 69f87d86f809bb57b9d31e857e47f10bd370d703 | [
"Unlicense"
] | null | null | null | test/ServerTest.py | wmde/catgraph-client-python | 69f87d86f809bb57b9d31e857e47f10bd370d703 | [
"Unlicense"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8
import unittest
import os
import tempfile
from TestBase import *
from gp.client import *
TestGraphName = 'test' + str(os.getpid())
TestFilePrefix = '/tmp/gptest-' + str(os.getpid())
class ServerTest (ClientTestBase, unittest.TestCase):
"""Test server functions via client lib."""
def test_createGraph(self):
"""Graph management functions"""
global TestGraphName
name = TestGraphName + "_2"
# create the graph
self.gp.create_graph(name)
#make sure we can't create it twice
ok = self.gp.try_create_graph(name)
self.assertFalse( ok, "should not be able to create graph again when it already exists" )
# see if we can use the graph from another connection
gp2 = self.newConnection()
gp2.use_graph(name)
# see if we can drop the graph while it's used
self.gp.drop_graph(name)
#TODO: gp2 should now report errors, because the grpah is gone. test that.
# see if we can re-create the graph after it was dropped
self.gp.create_graph(name)
self.gp.drop_graph(name)
#TODO: test name restrictions
def test_createNameRestrictions(self):
global TestGraphName
self.gp.strictArguments = False
# disable strict client-side validation
try:
n = ''
ok = self.gp.create_graph(n)
self.fail("empty graph names should be forbidden!" )
except gpException, ex:
pass
# ok
n = '1337'
ok = self.gp.try_create_graph(n)
self.assertFalse(ok, "numeric graph names should be forbidden! (name: `" + n + "`)" )
n = '1337' + TestGraphName
ok = self.gp.try_create_graph(n)
self.assertFalse( ok,
"graph names starting with a number should be forbidden! (name: `"
+ n + "`)" )
chars = " \r\n\t\0\x09^!\"§\$%&/()[]\ \ =?'#`\\*+~.:, ;<>|@"
for ch in chars:
try:
n = TestGraphName + ch + "test"
ok = self.gp.create_graph(n)
self.fail("graph names containing `"
+ ch + "` should be forbidden! (name: `"
+ n + "`)" )
except gpException, ex:
pass
# ok
try:
n = ch + TestGraphName
ok = self.gp.create_graph(n)
self.fail("graph names starting with `"
+ ch + "` should be forbidden! (name: `" + n + "`)")
except gpException, ex:
pass
# ok
n = 'test1337' + TestGraphName
ok = self.gp.try_create_graph(n)
self.assertEquals( 'OK', ok,
"graph names containing numbers should be allowd! (name: `"
+ n+ "`)")
self.gp.try_drop_graph(n)
chars = '-_8'
for ch in chars:
n = 'test' + ch + TestGraphName
ok = self.gp.try_create_graph(n)
self.assertEquals( 'OK', ok, "graph names containing `"
+ ch + "` should be allowd! (name: `" + n + "`)")
self.gp.try_drop_graph(n)
def test_dropGraph(self):
global TestGraphName
name = TestGraphName + "_2"
self.gp.create_graph(name)
self.gp.drop_graph(name)
ok = self.gp.try_use_graph(name)
self.assertFalse( ok,
"should not be able to use graph after dropping it" )
ok = self.gp.try_drop_graph(name)
self.assertEquals( 'NONE', ok, "should not be able to drop "
+ "graph again after it was already dropped." )
def test_listGraphs(self):
global TestGraphName
gp2 = self.newConnection()
graphs = gp2.capture_list_graphs()
graphs = extract_array_column(graphs, 0)
self.assertTrue( TestGraphName in graphs,
"test table TestGraphName should be in the list" )
self.gp.drop_graph(TestGraphName)
graphs = gp2.capture_list_graphs()
#print "graphs: " . var_export($graphs, true) . "\n"
graphs = extract_array_column( graphs, 0 )
#print "graphs: " . var_export($graphs, true) . "\n"
#print "containes: " . var_export(ConnectionTestBase::setContains( $graphs, TestGraphName ), true) . "\n"
self.assertFalse(
ConnectionTestBase.setContains(graphs, TestGraphName),
"test table TestGraphName should no longer be in the list" )
def test_shutdown(self):
global TestGraphName
gp2 = self.newConnection()
gp2.use_graph(TestGraphName)
gp2.stats()
self.assertSessionValue('ConnectedGraph', TestGraphName)
self.gp.shutdown() # <------------------
# self.assertSessionValue('ConnectedGraph', 'None');
# nice, but not reliable. race condition.
self.gp.try_stats()
self.assertEquals( 'FAILED', self.gp.getStatus(),
'fetching stats should fail after shutdown' )
gp2.try_stats()
self.assertEquals( 'FAILED', gp2.getStatus(),
'fetching stats should fail after shutdown' )
gp2.close()
gp3 = self.newConnection()
gp3.try_use_graph(TestGraphName)
self.assertEquals( 'FAILED', gp3.getStatus(),
'graph should be unavailable after shutdown' )
gp3.close()
def test_quit(self):
global TestGraphName
gp2 = self.newConnection()
gp2.use_graph(TestGraphName)
gp2.stats()
self.assertSessionValue('ConnectedGraph', TestGraphName)
self.gp.quit() # <------------------
self.assertStatus('OK')
try:
self.gp.try_stats()
self.fail( 'connection should be unusable after quit' )
except gpProtocolException, e:
pass
# ok
gp2.stats()
self.assertEquals( 'OK', gp2.getStatus(),
'connection should still be usable by others after quit; response: %s' % gp2.getResponse() )
gp2.close()
gp3 = self.newConnection()
gp3.use_graph(TestGraphName)
self.assertEquals( 'OK', gp3.getStatus(),
'graph should still be available to others after quit; response: %s' % gp2.getResponse() )
gp3.close()
# privileges
def test_createGraphPrivilege(self):
global TestGraphName
global TestAdmin, TestAdminPassword
global TestMaster, TestMasterPassword
name = TestGraphName + "_2"
gp = self.newConnection()
ok = gp.try_create_graph(name)
self.assertFalse( ok,
"should not be able to create a graph without authorizing" )
gp.authorize('password',
TestMaster + ":" + TestMasterPassword)
ok = gp.try_create_graph(name)
self.assertFalse( ok,
"should not be able to create a graph without admin privileges" )
gp.authorize('password',
TestAdmin + ":" + TestAdminPassword)
# re-authenticate
ok = gp.create_graph(name)
self.assertEquals( ok, 'OK',
"should be able to create graph with admin privileges; response: %s" % gp.getResponse() )
gp.try_drop_graph(name)
# cleanup
def test_dropGraphPrivilege(self):
global TestGraphName
global TestAdmin, TestAdminPassword
global TestMaster, TestMasterPassword
name = TestGraphName
gp = self.newConnection()
ok = gp.try_drop_graph(name)
self.assertFalse( ok, "should not be able to drop a graph without authorizing" )
gp.authorize('password',
TestMaster + ":" + TestMasterPassword)
ok = gp.try_drop_graph(name)
self.assertFalse( ok,
"should not be able to drop a graph without admin privileges" )
gp.authorize('password',
TestAdmin + ":" + TestAdminPassword)
# re-authenticate
ok = gp.drop_graph(name)
self.assertEquals( ok, 'OK',
"should be able to drop graph with admin privileges; response: %s" % gp.getResponse() )
def test_inputPipingPrivilege(self):
global TestGraphName, TestGraphServHost
global TestAdmin, TestAdminPassword
global TestMaster, TestMasterPassword
#XXX: this uses local files, so it will always fail
# if the server isn't on localhost!
if TestGraphServHost != 'localhost':
return None
f = os.path.dirname(os.path.abspath(__file__)) + '/gp.test.data'
gp = self.newConnection()
gp.use_graph(TestGraphName)
gp.allowPipes = True
gp.authorize('password',
TestMaster + ":" + TestMasterPassword)
try:
ok = gp.execute("add-arcs < " + f)
self.fail(
"should not be able to pipe without admin privileges!" )
except gpProcessorException, ex:
self.assertEquals( 'DENIED', gp.getStatus(),
"piping should be denied, not fail. Message: "
+ str(ex))
gp.authorize('password', TestAdmin + ":" + TestAdminPassword)
# re-authenticate
ok = gp.execute("add-arcs < " + f)
self.assertEquals( ok, 'OK',
"should be able to pipe with admin privileges; response: %s" % gp.getResponse() )
def test_outputPipingPrivilege(self):
global TestGraphName, TestGraphServHost
global TestAdmin, TestAdminPassword
global TestMaster, TestMasterPassword
#XXX: this uses local files, so it will always fail
# if the server isn't on localhost!
if TestGraphServHost != 'localhost':
return None
f = tempfile.mktemp(suffix='gpt')
gp = self.newConnection()
gp.use_graph(TestGraphName)
gp.allowPipes = True
try:
ok = gp.execute("list-roots > " + f)
self.fail(
"should not be able to pipe without admin privileges!" )
except gpProcessorException, ex:
self.assertEquals( 'DENIED', gp.getStatus(),
"piping should be denied, not fail. Message: "
+ str(ex))
gp.authorize(
'password', TestAdmin + ":" + TestAdminPassword)
# re-authenticate
ok = gp.execute("list-roots > " + f)
self.assertEquals(
ok, 'OK', "should be able to pipe with admin privileges; response: %s" % gp.getResponse() )
try:
unlink(f)
# cleanup
except:
pass
def test_addArcsPrivilege(self):
global TestGraphName
global TestMaster, TestMasterPassword
gp = self.newConnection()
gp.use_graph(TestGraphName)
ok = gp.try_add_arcs(((1, 11 ), (1, 12 ) ) )
self.assertFalse(
ok, "should not be able to add arcs without authorizing" )
self.assertEquals('DENIED', gp.getStatus(),
"command should be denied, not fail" )
gp.authorize('password',
TestMaster + ":" + TestMasterPassword)
ok = gp.try_add_arcs(((1, 11 ), (1, 12 ) ) )
self.assertEquals( 'OK', ok,
"should be able to add arcs with updater privileges; response: %s" % gp.getResponse() )
def test_removeArcsPrivilege(self):
global TestGraphName
global TestMaster, TestMasterPassword
self.gp.add_arcs(((1, 11 ), (1, 12 ) ) )
# add some arcs as admin
gp = self.newConnection()
gp.use_graph(TestGraphName)
ok = gp.try_remove_arcs(((1, 11 ), ) )
self.assertFalse( ok,
"should not be able to delete arcs without authorizing" )
self.assertEquals( 'DENIED', gp.getStatus(),
"command should be denied, not fail" )
gp.authorize('password',
TestMaster + ":" + TestMasterPassword)
ok = gp.try_remove_arcs(((1, 11 ), ) )
self.assertEquals( 'OK', ok,
"should be able to delete arcs with updater privileges; response: %s" % gp.getResponse() )
def test_replaceSuccessorsPrivilege(self):
global TestGraphName
global TestMaster, TestMasterPassword
self.gp.add_arcs(((1, 11 ), (1, 12 ) ) )
# add some arcs as admin
gp = self.newConnection()
gp.use_graph(TestGraphName)
ok = gp.try_replace_successors( 1, (17, ) )
self.assertFalse( ok,
"should not be able to replace arcs without authorizing" )
self.assertEquals( 'DENIED', gp.getStatus(),
"command should be denied, not fail" )
gp.authorize('password',
TestMaster + ":" + TestMasterPassword)
ok = gp.try_replace_successors( 1, (17, ) )
self.assertEquals( 'OK', ok,
"should be able to replace arcs with updater privileges; response: %s" % gp.getResponse() )
def test_replacePredecessorsPrivilege(self):
global TestGraphName
global TestMaster, TestMasterPassword
self.gp.add_arcs(((1, 11 ), (1, 12 ) ) )
# add some arcs as admin
gp = self.newConnection()
gp.use_graph(TestGraphName)
ok = gp.try_replace_predecessors( 1, (17, ) )
self.assertFalse( ok,
"should not be able to replace arcs without authorizing" )
self.assertEquals( 'DENIED', gp.getStatus(),
"command should be denied, not fail" )
gp.authorize('password',
TestMaster + ":" + TestMasterPassword)
ok = gp.try_replace_predecessors( 1, (17, ) )
self.assertEquals( 'OK', ok,
"should be able to replace arcs with updater privileges; response: %s" % gp.getResponse() )
def testClearPrivilege(self):
global TestGraphName
global TestAdmin, TestAdminPassword
global TestMaster, TestMasterPassword
gp = self.newConnection()
gp.use_graph(TestGraphName)
ok = gp.try_clear()
self.assertFalse( ok,
"should not be able to clear a graph without authorizing" )
gp.authorize('password',
TestMaster + ":" + TestMasterPassword)
ok = gp.try_clear()
self.assertEquals( ok, 'OK',
"should be able to clear graph with updater privileges" )
gp.authorize('password',
TestAdmin + ":" + TestAdminPassword)
# re-authenticate
ok = gp.try_clear()
self.assertEquals( ok, 'OK',
"should be able to clear graph with admin privileges" )
def test_shutdownPrivilege(self):
global TestGraphName
global TestAdmin, TestAdminPassword
global TestMaster, TestMasterPassword
gp = self.newConnection()
gp.use_graph(TestGraphName)
ok = gp.try_shutdown()
self.assertFalse( ok,
"should not be able to shut down a graph without authorizing" )
gp.authorize('password',
TestMaster + ":" + TestMasterPassword)
ok = gp.try_shutdown()
self.assertFalse( ok, "should not be able to shut down a graph "
+ "without admin privileges" )
gp.authorize('password',
TestAdmin + ":" + TestAdminPassword)
# re-authenticate
ok = gp.try_shutdown()
self.assertEquals( ok, 'OK',
"should be able to shut down graph with admin privileges" )
#TODO: (optionally) start server instance here! let it die when the test script dies.
#TODO: CLI interface behaviour of server (port config, etc)
if __name__ == '__main__':
unittest.main()
| 32.136646 | 113 | 0.587811 | 1,673 | 15,522 | 5.380155 | 0.151225 | 0.016665 | 0.023997 | 0.026664 | 0.763471 | 0.702033 | 0.663149 | 0.639262 | 0.590268 | 0.582713 | 0 | 0.009109 | 0.306855 | 15,522 | 482 | 114 | 32.20332 | 0.8274 | 0.079564 | 0 | 0.671827 | 0 | 0.024768 | 0.211176 | 0 | 0 | 0 | 0 | 0.002075 | 0.139319 | 0 | null | null | 0.151703 | 0.01548 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
00d16a3acb91e37537d431d492d21db547575a94 | 3,062 | py | Python | scripts/download_external_data.py | TomAugspurger/modis | eb8db853ce25cb7bb3bc03d3c6f1bcd181e083a0 | [
"Apache-2.0"
] | null | null | null | scripts/download_external_data.py | TomAugspurger/modis | eb8db853ce25cb7bb3bc03d3c6f1bcd181e083a0 | [
"Apache-2.0"
] | null | null | null | scripts/download_external_data.py | TomAugspurger/modis | eb8db853ce25cb7bb3bc03d3c6f1bcd181e083a0 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import os
import sys
from azure.storage.blob import BlobServiceClient
EXTERNAL_DATA_FILE_NAMES = [
"MCD15A2H.A2022025.h01v11.061.2022035062702.hdf",
"MCD15A3H.A2022033.h12v10.061.2022039062215.hdf",
"MCD43A4.A2022032.h14v10.061.2022041051831.hdf",
"MCD64A1.A2021335.h10v06.061.2022035055453.hdf",
"MOD09A1.A2022033.h19v10.061.2022042043514.hdf",
"MOD09Q1.A2022033.h10v10.061.2022042044048.hdf",
"MOD10A1.A2022040.h11v05.061.2022042042026.hdf",
"MOD10A2.A2022033.h09v05.061.2022042050729.hdf",
"MOD11A1.A2022041.h19v02.061.2022042095544.hdf",
"MOD11A2.A2022033.h19v10.061.2022042044121.hdf",
"MOD13A1.A2022017.h12v11.061.2022034232214.hdf",
"MOD13Q1.A2022017.h12v11.061.2022034232400.hdf",
"MOD14A1.A2022033.h11v05.061.2022041234759.hdf",
"MOD14A2.A2022033.h21v05.061.2022041234800.hdf",
"MOD15A2H.A2022033.h13v10.061.2022042045937.hdf",
"MOD16A3GF.A2021001.h11v02.061.2022024075208.hdf",
"MOD17A2H.A2022025.h08v05.061.2022035065002.hdf",
"MOD17A2HGF.A2021361.h10v06.061.2022020134637.hdf",
"MOD17A3HGF.A2021001.h14v02.061.2022020135800.hdf",
"MOD21A2.A2022033.h12v08.061.2022042050733.hdf",
"MYD09A1.A2022025.h09v08.061.2022035070021.hdf",
"MYD09Q1.A2022025.h02v08.061.2022035050917.hdf",
"MYD10A1.A2022043.h21v04.061.2022045035657.hdf",
"MYD10A2.A2022025.h10v05.061.2022035071201.hdf",
"MYD11A1.A2022039.h21v07.061.2022040192419.hdf",
"MYD11A2.A2022025.h17v00.061.2022035054130.hdf",
"MYD13A1.A2022009.h25v02.061.2022028071925.hdf",
"MYD13Q1.A2022009.h09v06.061.2022028072010.hdf",
"MYD14A1.A2022025.h01v07.061.2022035001141.hdf",
"MYD14A2.A2022025.h03v09.061.2022035001140.hdf",
"MYD15A2H.A2022025.h22v08.061.2022035072026.hdf",
"MYD16A3GF.A2021001.h11v02.061.2022024220526.hdf",
"MYD17A2H.A2022025.h22v08.061.2022035120601.hdf",
"MYD17A2HGF.A2021361.h13v09.061.2022021010829.hdf",
"MYD17A3HGF.A2021001.h13v09.061.2022021012736.hdf",
"MYD21A2.A2022025.h10v06.061.2022035072054.hdf",
]
sas = sys.argv[1]
outdir = sys.argv[2]
os.makedirs(outdir, exist_ok=True)
account_client = BlobServiceClient("https://modiseuwest.blob.core.windows.net",
credential=sas)
container_client = account_client.get_container_client("modis-061")
def download(path: str) -> None:
outpath = os.path.join(outdir, os.path.basename(path))
if os.path.exists(outpath):
print(f"Skipping {path}, already downloaded")
return
print(f"Downloading {path}")
blob = container_client.get_blob_client(path)
with open(outpath, "wb") as outfile:
stream = blob.download_blob()
outfile.write(stream.readall())
for file_name in EXTERNAL_DATA_FILE_NAMES:
parts = file_name.split(".")
product = parts[0]
date = parts[1][1:]
horizontal = parts[2][1:3]
vertical = parts[2][4:6]
hdf_path = f"{product}/{horizontal}/{vertical}/{date}/{file_name}"
xml_path = f"{hdf_path}.xml"
download(xml_path)
download(hdf_path)
| 39.766234 | 79 | 0.725996 | 369 | 3,062 | 5.95935 | 0.512195 | 0.012278 | 0.014552 | 0.0191 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.410507 | 0.129654 | 3,062 | 76 | 80 | 40.289474 | 0.414634 | 0.006532 | 0 | 0 | 0 | 0 | 0.596514 | 0.557054 | 0 | 0 | 0 | 0 | 0 | 1 | 0.014925 | false | 0 | 0.044776 | 0 | 0.074627 | 0.029851 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
00d429eeb206e1ec171b7d2d336c0e24af713f91 | 416 | py | Python | alarme/extras/sensor/web/views/home.py | insolite/alarme | 2312e88299a07d47435f475e5617213404e6d365 | [
"MIT"
] | null | null | null | alarme/extras/sensor/web/views/home.py | insolite/alarme | 2312e88299a07d47435f475e5617213404e6d365 | [
"MIT"
] | 1 | 2017-02-04T13:03:05.000Z | 2017-02-04T13:03:05.000Z | alarme/extras/sensor/web/views/home.py | insolite/alarme | 2312e88299a07d47435f475e5617213404e6d365 | [
"MIT"
] | null | null | null | from aiohttp.web import HTTPFound
from .core import CoreView
from ..util import login_required, handle_exception
class Home(CoreView):
@login_required
async def req(self):
return HTTPFound(self.request.app.router.get('control').url())
@handle_exception
async def get(self):
return await self.req()
@handle_exception
async def post(self):
return await self.req()
| 20.8 | 70 | 0.692308 | 54 | 416 | 5.240741 | 0.5 | 0.159011 | 0.141343 | 0.162544 | 0.155477 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.213942 | 416 | 19 | 71 | 21.894737 | 0.865443 | 0 | 0 | 0.307692 | 0 | 0 | 0.016827 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.230769 | 0 | 0.538462 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
00f5160d30c4f3b0da6d3f746cf783b4e5b156af | 449 | py | Python | feature_extraction/tests/tss_tool_test.py | ramseylab/cerenkov | 19570ad2a47416a70ae7bb066cc67842b3cdee1b | [
"Apache-2.0"
] | 1 | 2020-06-25T08:10:10.000Z | 2020-06-25T08:10:10.000Z | feature_extraction/tests/tss_tool_test.py | ramseylab/cerenkov | 19570ad2a47416a70ae7bb066cc67842b3cdee1b | [
"Apache-2.0"
] | 2 | 2017-08-23T21:09:10.000Z | 2018-03-28T23:42:24.000Z | feature_extraction/tests/tss_tool_test.py | ramseylab/cerenkov | 19570ad2a47416a70ae7bb066cc67842b3cdee1b | [
"Apache-2.0"
] | null | null | null | import unittest
from tss_tool import min_tss_dist
class TssToolTestCase(unittest.TestCase):
def test_min_tss_dist(self):
self.assertEqual(min_tss_dist([1, 2, 3]), 1)
self.assertEqual(min_tss_dist([-1, -2, -3]), -1)
self.assertEqual(min_tss_dist([1, -2, 3]), 1)
self.assertEqual(min_tss_dist([1, 1, 2]), 1)
self.assertEqual(min_tss_dist([-1, 1, 1]), -1)
if __name__ == '__main__':
unittest.main()
| 26.411765 | 56 | 0.643653 | 69 | 449 | 3.84058 | 0.289855 | 0.158491 | 0.264151 | 0.396226 | 0.535849 | 0.535849 | 0.535849 | 0.535849 | 0.426415 | 0.426415 | 0 | 0.055402 | 0.195991 | 449 | 16 | 57 | 28.0625 | 0.67867 | 0 | 0 | 0 | 0 | 0 | 0.017817 | 0 | 0 | 0 | 0 | 0 | 0.454545 | 1 | 0.090909 | false | 0 | 0.181818 | 0 | 0.363636 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
da979bee04c0f7f2ed748cd5e6ef72456594ed93 | 197 | py | Python | Chapter04/exercise1/test_calculator.py | sportstube28/Continuous-Delivery-with-Docker-and-Jenkins-Second-Edition | 0a9472a499b0ce0f181f95e2de6b1bee7f51ef59 | [
"MIT"
] | 51 | 2019-07-03T18:19:51.000Z | 2022-02-02T04:04:32.000Z | Chapter04/exercise1/test_calculator.py | sportstube28/Continuous-Delivery-with-Docker-and-Jenkins-Second-Edition | 0a9472a499b0ce0f181f95e2de6b1bee7f51ef59 | [
"MIT"
] | 1 | 2022-03-21T21:42:36.000Z | 2022-03-21T21:42:36.000Z | Chapter04/exercise1/test_calculator.py | sportstube28/Continuous-Delivery-with-Docker-and-Jenkins-Second-Edition | 0a9472a499b0ce0f181f95e2de6b1bee7f51ef59 | [
"MIT"
] | 69 | 2019-05-29T19:15:01.000Z | 2022-03-28T05:19:30.000Z | import unittest
from calculator import multiply
class TestSomething(unittest.TestCase):
def test_multiply(self):
self.assertEqual(6, multiply(2,3))
if __name__ == '__main__':
unittest.main()
| 19.7 | 39 | 0.771574 | 25 | 197 | 5.72 | 0.72 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017241 | 0.116751 | 197 | 9 | 40 | 21.888889 | 0.804598 | 0 | 0 | 0 | 0 | 0 | 0.040609 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
da9a71a5474b91b2b3a44d2706ab6ef85c4936e0 | 118 | py | Python | UTMDriver/__init__.py | maxpoint2point/UTMDriver | 75f5687fc0191eb2bf3005774cbde6e4935a6d04 | [
"Apache-2.0"
] | 1 | 2020-10-02T18:19:10.000Z | 2020-10-02T18:19:10.000Z | UTMDriver/__init__.py | maxpoint2point/UTMDriver | 75f5687fc0191eb2bf3005774cbde6e4935a6d04 | [
"Apache-2.0"
] | null | null | null | UTMDriver/__init__.py | maxpoint2point/UTMDriver | 75f5687fc0191eb2bf3005774cbde6e4935a6d04 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) maxpoint2point@gmail.com 2020.
__version__ = '0.5.3-alpha'
from UTMDriver.connector import Connector
| 29.5 | 47 | 0.779661 | 16 | 118 | 5.5 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.07619 | 0.110169 | 118 | 3 | 48 | 39.333333 | 0.761905 | 0.372881 | 0 | 0 | 0 | 0 | 0.15493 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
daa653fdc21a0be688aabf9338b59826c9898962 | 1,443 | py | Python | dopamine/generators/abstract_generator.py | K-Kielak/dopamine | f0bbc39825c7b769023901aa6c60e2b068390a42 | [
"Apache-2.0"
] | null | null | null | dopamine/generators/abstract_generator.py | K-Kielak/dopamine | f0bbc39825c7b769023901aa6c60e2b068390a42 | [
"Apache-2.0"
] | null | null | null | dopamine/generators/abstract_generator.py | K-Kielak/dopamine | f0bbc39825c7b769023901aa6c60e2b068390a42 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2019 Kacper Kielak.
#
# 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.
"""Abstract generator specifying required contract"""
from abc import abstractmethod
from dopamine.abstract_ml_model import AbstractMLModel
class AbstractGenerator(AbstractMLModel):
@abstractmethod
def generate(self, inputs):
"""Generates data based on the received input
Args:
inputs: tuple of numpy arrays, input based on which generator should
generate output.
Returns:
numpy array, generated output.
"""
pass
@abstractmethod
def train(self, inputs, expected_output):
"""Performs one training step based on the received training batch.
Args:
inputs: tuple of numpy arrays, input to the generator's network.
expected_output: numpy array, output that should be produced by the
generator given input.
Returns:
dict, train statistics.
"""
pass
| 27.75 | 74 | 0.727651 | 192 | 1,443 | 5.447917 | 0.598958 | 0.057361 | 0.024857 | 0.030593 | 0.063098 | 0.063098 | 0.063098 | 0 | 0 | 0 | 0 | 0.007874 | 0.2079 | 1,443 | 51 | 75 | 28.294118 | 0.907262 | 0.742204 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.222222 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
dad216695495d070eaa4da0e6de2ddd0a6c181fc | 55 | py | Python | data/studio21_generated/introductory/3074/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/3074/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/3074/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | def growing_plant(upSpeed, downSpeed, desiredHeight):
| 27.5 | 53 | 0.818182 | 6 | 55 | 7.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 55 | 2 | 54 | 27.5 | 0.88 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dad821bed88e971811e3c402e9d522872917d46d | 86 | py | Python | test1.py | LotosPage/enviromnent0 | fe2bf8912feb3fa59f87c69e29714ecacb202833 | [
"Apache-2.0"
] | 1 | 2019-02-10T17:11:43.000Z | 2019-02-10T17:11:43.000Z | test1.py | LotosPage/enviromnent0 | fe2bf8912feb3fa59f87c69e29714ecacb202833 | [
"Apache-2.0"
] | null | null | null | test1.py | LotosPage/enviromnent0 | fe2bf8912feb3fa59f87c69e29714ecacb202833 | [
"Apache-2.0"
] | null | null | null | a = 1
b = 1
while 32 >= a:
print(a,-b)
b *= 2
a += 1
print("Year",b/365)
| 9.555556 | 19 | 0.418605 | 18 | 86 | 2 | 0.5 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163636 | 0.360465 | 86 | 8 | 20 | 10.75 | 0.490909 | 0 | 0 | 0 | 0 | 0 | 0.046512 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.285714 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
97039496056b7e83ea410edfccaace315b1743cb | 1,842 | py | Python | k3rn3l-ctf-2021/non-square-freedom/nonsquarefreedom_hard.py | AZ-0/Writeups | 1420a51cbf55dae9ffd6d458aac6dec03aad6f1c | [
"MIT"
] | null | null | null | k3rn3l-ctf-2021/non-square-freedom/nonsquarefreedom_hard.py | AZ-0/Writeups | 1420a51cbf55dae9ffd6d458aac6dec03aad6f1c | [
"MIT"
] | null | null | null | k3rn3l-ctf-2021/non-square-freedom/nonsquarefreedom_hard.py | AZ-0/Writeups | 1420a51cbf55dae9ffd6d458aac6dec03aad6f1c | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from Crypto.Util.number import getPrime
import os
# Local imports
with open('flag.txt','rb') as f:
FLAG = f.read()
f.close()
# Key gen
P = getPrime(512//8)
Q = getPrime(256)
R = getPrime(256)
N = P**8 * Q * R
E = 0x10001
def pad_hard(m):
m <<= 256
m += int.from_bytes(os.urandom(256//8),'big')
m += -m % P**2
m += -m % P**3
return m
# Pad FLAG
M = pad_hard(int.from_bytes(FLAG,'big'))
print('M < N :',M < N)
print('M < P**8 :',M < (P**8))
print('M < Q*R :',M < (Q*R))
# Encrypt FLAG
C = pow(M, E, N)
print('\nn =', N)
print('e =', E)
print('c =', C)
# Hint
F = P**7 * (P-1) * (Q-1) * (R-1)
D = pow(E, -1, F)
print('\nD(C) =',pow(C,D,N))
#----------------------------------------------------
# Output
#----------------------------------------------------
# M < N : True
# M < P**8 : False
# M < Q*R : False
n = 51214772223826458947343903953001487476278631390021520449180482250318402223871910467589821176474724615270573620128351792442696435406924016685353662124634928276565604574767844305337546301974967758679072483930469188209450741154719808928273796360060047042981437882233649203901005093617276209822357002895662878141
e = 65537
c = 41328763458934302623886982279989290133391941143474825043156612786022747186181626092904440906629512249693098336428292454473471954816980834113337123971593864752166968333372184013915759408279871722264574280860701217968784830530130601590818131935509927605432477384634437968100579272192406391181345133757405127746
M = 36121865463995782277296293158498110427613111962414238045946490101935688033022876541418793886469647898078579120189419552431787379541843120009675223060979171856818401470674058515557901674369835328155371791544935440499813846484080003978652786490718806523938327240659684439275298596339460595405316567186468069580 | 36.84 | 312 | 0.718784 | 157 | 1,842 | 8.407643 | 0.388535 | 0.007576 | 0.006818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.593596 | 0.11835 | 1,842 | 50 | 313 | 36.84 | 0.219212 | 0.137351 | 0 | 0 | 0 | 0 | 0.041191 | 0 | 0 | 1 | 0.004436 | 0 | 0 | 1 | 0.032258 | false | 0 | 0.064516 | 0 | 0.129032 | 0.225806 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
970bc5d985c5ec7c1678258df3a9cea0543b131f | 97 | py | Python | Guanabara/desafio01.py | manuellaAlvesVarella/python | eedb8362f0ebc8074f87d15c9e629e319ff29394 | [
"MIT"
] | 1 | 2022-03-25T20:42:20.000Z | 2022-03-25T20:42:20.000Z | Guanabara/desafio01.py | manuellaAlvesVarella/python | eedb8362f0ebc8074f87d15c9e629e319ff29394 | [
"MIT"
] | null | null | null | Guanabara/desafio01.py | manuellaAlvesVarella/python | eedb8362f0ebc8074f87d15c9e629e319ff29394 | [
"MIT"
] | null | null | null | nome = (input('digite o seu nome:'))
print ('muito prazer {} seja muito bem vinda!'.format(nome)) | 48.5 | 60 | 0.680412 | 15 | 97 | 4.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134021 | 97 | 2 | 60 | 48.5 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0.561224 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
970dad092658f2157138a1a5f9f10c91aeb6717d | 172 | py | Python | dvc/utils/pkg.py | lucasalavapena/dvc | 230eb7087df7f063ded7422af7ae45bd04eb794a | [
"Apache-2.0"
] | 9,136 | 2018-05-30T05:10:44.000Z | 2022-03-31T16:58:52.000Z | dvc/utils/pkg.py | lucasalavapena/dvc | 230eb7087df7f063ded7422af7ae45bd04eb794a | [
"Apache-2.0"
] | 4,804 | 2018-05-30T00:36:42.000Z | 2022-03-31T18:34:54.000Z | dvc/utils/pkg.py | lucasalavapena/dvc | 230eb7087df7f063ded7422af7ae45bd04eb794a | [
"Apache-2.0"
] | 1,072 | 2018-05-30T07:59:35.000Z | 2022-03-28T20:43:49.000Z | try:
# file is created during dvc build
from .build import PKG # noqa, pylint:disable=unused-import
except ImportError:
PKG = None # type: ignore[assignment]
| 28.666667 | 64 | 0.703488 | 23 | 172 | 5.26087 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.215116 | 172 | 5 | 65 | 34.4 | 0.896296 | 0.534884 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
97185f3518d98406e32c428a023e22ba0091e6ee | 723 | py | Python | unmanic_api/exceptions.py | JeffResc/Unmanic-API | a68afccd90ac6fff7ad7eb4abae98fa1e086f239 | [
"MIT"
] | 1 | 2022-03-05T11:52:05.000Z | 2022-03-05T11:52:05.000Z | unmanic_api/exceptions.py | JeffResc/Unmanic-API | a68afccd90ac6fff7ad7eb4abae98fa1e086f239 | [
"MIT"
] | null | null | null | unmanic_api/exceptions.py | JeffResc/Unmanic-API | a68afccd90ac6fff7ad7eb4abae98fa1e086f239 | [
"MIT"
] | null | null | null | """Exceptions for Unmanic."""
class UnmanicError(Exception):
"""Generic Unmanic Exception."""
pass
class UnmanicBadRequestRequestedEndpointNotFoundError(UnmanicError):
"""Unmanic bad request endpoint not found exception."""
pass
class UnmanicBadRequestRequestedMethodNotAllowedError(UnmanicError):
"""Unmanic bad request method not allowed exception."""
pass
class UnmanicBadRequestValidationError(UnmanicError):
"""Unmanic bad request validation error exception."""
pass
class UnmanicConnectionError(UnmanicError):
"""Unmanic connection exception."""
pass
class UnmanicInternalServerError(UnmanicError):
"""Unmanic internal server error exception."""
pass
| 19.026316 | 68 | 0.744122 | 58 | 723 | 9.275862 | 0.431034 | 0.144981 | 0.167286 | 0.16171 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163209 | 723 | 37 | 69 | 19.540541 | 0.889256 | 0.372061 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
972265b6659ddfb725f1785ebeaecf84eb10e0d9 | 539 | py | Python | src/infra/factories/rest_repository_factory.py | marcelinoavelar/github-monitor | e0f850d05d1eaa7561eb3c838ae3cc35047ab033 | [
"MIT"
] | null | null | null | src/infra/factories/rest_repository_factory.py | marcelinoavelar/github-monitor | e0f850d05d1eaa7561eb3c838ae3cc35047ab033 | [
"MIT"
] | 1 | 2022-03-30T20:31:18.000Z | 2022-03-30T20:31:18.000Z | src/infra/factories/rest_repository_factory.py | marcelinoavelar/github-monitor | e0f850d05d1eaa7561eb3c838ae3cc35047ab033 | [
"MIT"
] | null | null | null | from abc import ABC
from src.domanin.factories.repository_factory import RepositoryFactory
from src.infra.repositories.rest.github_data_rest_repository import GithubDataRestRepository
from src.infra.repositories.rest.schedule_rest_repository import ScheduleJsonRepository
class RestRepositoryFactory(RepositoryFactory, ABC):
@property
def github_data_repository(self):
return GithubDataRestRepository()
@property
def schedule_repository(self) -> ScheduleJsonRepository:
return ScheduleJsonRepository()
| 31.705882 | 92 | 0.820037 | 53 | 539 | 8.169811 | 0.433962 | 0.048499 | 0.055427 | 0.110855 | 0.12933 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12616 | 539 | 16 | 93 | 33.6875 | 0.919321 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.363636 | 0.181818 | 0.818182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
973f92f26102c597df6a741cf04806779ca26948 | 956 | py | Python | scripts/scrape.py | sobostion/IG-reverse | acb914253e35bb5588b15d9ac169dcbd13833971 | [
"MIT"
] | null | null | null | scripts/scrape.py | sobostion/IG-reverse | acb914253e35bb5588b15d9ac169dcbd13833971 | [
"MIT"
] | null | null | null | scripts/scrape.py | sobostion/IG-reverse | acb914253e35bb5588b15d9ac169dcbd13833971 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# usage: python search.py <IG username>
import sys
import requests
from bs4 import BeautifulSoup
import urllib2
import re
import json
test_link = "https://www.google.com/searchbyimage?&image_url=https://scontent-iad3-1.cdninstagram.com/vp/63d07260370df51f9160551f3e800185/5AF88680/t51.2885-15/e35/22582543_1924170541154740_2332192569150144512_n.jpg"
test_link2 = "https://www.google.co.uk/search?tbs=sbi:AMhZZitnsN1grwUvVjPZ-rJHTZ1r2KHpXDnac4c7adzM7mzX0faXwApX1mOGY33bmYJa76AuVHCQhJzHzgn9zDaQK20X3-JFC2MXx1hKLg9o647afy22Q7gQJkGryv6zy3AttYqCRvdyiyHZNe0-oKYZj749V4x6USU7mcUwb_1VgCKXGauRY3Cx5xpJCnyA1uWj2vAxDl4ZPAOWljDC1IU8U9jCDJlqOhfki5dPUWE3kAhPOyWU7vXk6q-e8FjPbWGLZruJzPVR7zyifH5qri31gudh7fnd52tezNwWwxotfbaO38PXJYgC_1JAPYDD6DpnW6frYvXoFkLQrio4g2RJo8M9dacTuArg&gws_rd=cr&dcr=0&ei=f8hfWtjHDc3YwAK0-JrQDA"
html_page = urllib2.urlopen(test_link2)
soup = BeautifulSoup(html_page, "html5lib")
string_json = soup.body
print string_json
| 43.454545 | 453 | 0.873431 | 93 | 956 | 8.827957 | 0.752688 | 0.019488 | 0.034105 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177118 | 0.049163 | 956 | 21 | 454 | 45.52381 | 0.726073 | 0.057531 | 0 | 0 | 0 | 0.166667 | 0.719689 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.5 | null | null | 0.083333 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
97606bfba680da74ee543b3ac40d4aeb418faf69 | 21,045 | py | Python | rtk/hardware/component/resistor/fixed/Wirewound.py | rakhimov/rtk | adc35e218ccfdcf3a6e3082f6a1a1d308ed4ff63 | [
"BSD-3-Clause"
] | null | null | null | rtk/hardware/component/resistor/fixed/Wirewound.py | rakhimov/rtk | adc35e218ccfdcf3a6e3082f6a1a1d308ed4ff63 | [
"BSD-3-Clause"
] | null | null | null | rtk/hardware/component/resistor/fixed/Wirewound.py | rakhimov/rtk | adc35e218ccfdcf3a6e3082f6a1a1d308ed4ff63 | [
"BSD-3-Clause"
] | 2 | 2020-04-03T04:14:42.000Z | 2021-02-22T05:30:35.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# rtk.hardware.component.resistor.fixed.Wirewound.py is part of the RTK
# Project
#
# All rights reserved.
# Copyright 2007 - 2017 Andrew Rowland andrew.rowland <AT> reliaqual <DOT> com
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
##########################################################
Hardware.Component.Resistor.Fixed Package Wirewound Module
##########################################################
"""
import gettext
import locale
try:
import Configuration
import Utilities
from hardware.component.resistor.Resistor import Model as Resistor
except ImportError: # pragma: no cover
import rtk.Configuration as Configuration
import rtk.Utilities as Utilities
from rtk.hardware.component.resistor.Resistor import Model as Resistor
__author__ = 'Andrew Rowland'
__email__ = 'andrew.rowland@reliaqual.com'
__organization__ = 'ReliaQual Associates, LLC'
__copyright__ = 'Copyright 2007 - 2015 Andrew "weibullguy" Rowland'
# Add localization support.
try:
locale.setlocale(locale.LC_ALL, Configuration.LOCALE)
except locale.Error: # pragma: no cover
locale.setlocale(locale.LC_ALL, '')
_ = gettext.gettext
class Wirewound(Resistor):
"""
The Wirewound resistor data model contains the attributes and methods of
a Wirewound resistor. The attributes of a Wirewound resistor are:
:cvar list _lst_piR: list of MIL-HDBK-217FN2 resistance factor values.
:cvar list _lst_piE: list of MIL-HDBK-217FN2 operating environment factor
values.
:cvar list _lst_piQ_count: list of quality factor values for the
MIL-HDBK-217FN2 parts count method.
:cvar list _lst_piQ_stress: list of quality factor values for the
MIL-HDBK-217FN2 parts stress method.
:cvar list _lst_lambdab_count: list of base hazard rate values for the
MIL-HDBK-217FN2 parts count method.
:cvar int subcategory: default value: 29
Covers specifications MIL-R-93, MIL-R-39005.
Hazard Rate Models:
# MIL-HDBK-217F, section 9.5
"""
# MIL-HDK-217F hazard rate calculation variables.
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
_lst_piE = [1.0, 2.0, 11.0, 5.0, 18.0, 15.0, 18.0, 28.0, 35.0, 27.0, 0.8,
14.0, 38.0, 610.0]
_lst_piQ_count = [0.03, 0.1, 0.3, 1.0, 3.0, 10.0]
_lst_piQ_stress = [0.03, 0.1, 0.3, 1.0, 5.0, 15.0]
_lst_lambdab_count = [0.0085, 0.018, 0.10, 0.045, 0.16, 0.15, 0.17, 0.30,
0.38, 0.26, 0.0068, 0.13, 0.37, 5.4]
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
subcategory = 29 # Subcategory ID in rtkcom DB.
def __init__(self):
"""
Method to initialize a Wirewound resistor data model instance.
"""
super(Wirewound, self).__init__()
def calculate_part(self):
"""
Method to calculate the hazard rate for the Wirewound resistor data
model.
:return: False if successful or True if an error is encountered.
:rtype: bool
"""
from math import exp
self.hazard_rate_model = {}
if self.hazard_rate_type == 2:
self.hazard_rate_model['equation'] = 'lambdab * piR * piQ * piE'
# Base hazard rate.
_stress = self.operating_power / self.rated_power
try:
self.base_hr = 0.0031 * \
exp(((self.temperature_active + 273.0) / 398.0)**10.0) * \
exp((_stress * ((self.temperature_active + 273.0) /
273.0))**1.5)
self.hazard_rate_model['lambdab'] = self.base_hr
except OverflowError:
# TODO: Handle overflow error.
return True
# Resistance factor.
if self.resistance <= 10000.0:
self.piR = 1.0
elif self.resistance > 10000.0 and self.resistance <= 1.0E5:
self.piR = 1.7
elif self.resistance > 1.0E5 and self.resistance <= 1.0E6:
self.piR = 3.0
elif self.resistance > 1.0E6:
self.piR = 5.0
self.hazard_rate_model['piR'] = self.piR
return Resistor.calculate_part(self)
class WirewoundPower(Resistor):
"""
The Wirewound Power resistor data model contains the attributes and
methods of a Wirewound Power resistor. The attributes of a Wirewound
Power resistor are:
:cvar list _lst_piR: list of MIL-HDBK-217FN2 resistance factor values.
:cvar list _lst_piE: list of MIL-HDBK-217FN2 operating environment factor
values.
:cvar list _lst_piQ_count: list of quality factor values for the
MIL-HDBK-217FN2 parts count method.
:cvar list _lst_piQ_stress: list of quality factor values for the
MIL-HDBK-217FN2 parts stress method.
:cvar list _lst_lambdab_count: list of base hazard rate values for the
MIL-HDBK-217FN2 parts count method.
:cvar int subcategory: default value: 30
:ivar int specification: index of the specification applicable to the
resistor.
:ivar int style: index of the resistor style.
Covers specifications MIL-R-26 and MIL-R-39007.
Hazard Rate Models:
# MIL-HDBK-217F, section 9.6
"""
# MIL-HDK-217F hazard rate calculation variables.
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
_lst_piR = [[[1.0, 1.0, 1.2, 1.2, 1.6, 1.6, 1.6, 0.0],
[1.0, 1.0, 1.0, 1.2, 1.6, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.0, 1.2, 1.2, 1.2, 1.6],
[1.0, 1.2, 1.6, 1.6, 0.0, 0.0, 0.0, 0.0],
[1.0, 1.6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 1.6, 1.6, 0.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.1, 1.2, 1.2, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.4, 0.0, 0.0, 0.0, 0.0, 0.0]],
[[1.0, 1.0, 1.0, 1.0, 1.2, 1.6],
[1.0, 1.0, 1.0, 1.2, 1.6, 0.0],
[1.0, 1.0, 1.2, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.0, 2.0, 0.0, 0.0],
[1.0, 1.0, 1.0, 2.0, 0.0, 0.0],
[1.0, 1.0, 1.2, 2.0, 0.0, 0.0],
[1.0, 1.2, 1.4, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.6, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.2, 2.0, 0.0, 0.0],
[1.0, 1.0, 1.2, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.4, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.2, 0.0, 0.0],
[1.0, 1.0, 1.4, 0.0, 0.0, 0.0],
[1.0, 1.2, 1.6, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.4, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.2, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.4, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.4, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.4, 0.0, 0.0],
[1.0, 1.0, 1.2, 1.5, 0.0, 0.0],
[1.0, 1.0, 1.2, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.4, 1.6, 0.0],
[1.0, 1.0, 1.0, 1.4, 1.6, 2.0],
[1.0, 1.0, 1.0, 1.4, 1.6, 2.0],
[1.0, 1.0, 1.4, 2.4, 0.0, 0.0],
[1.0, 1.0, 1.2, 2.6, 0.0, 0.0],
[1.0, 1.0, 1.0, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.0, 0.0, 0.0, 0.0],
[1.0, 1.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 1.2, 1.4, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.2, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.4, 0.0, 0.0, 0.0],
[1.0, 1.2, 1.5, 0.0, 0.0, 0.0],
[1.0, 1.2, 0.0, 0.0, 0.0, 0.0]]]
_lst_piE = [1.0, 2.0, 10.0, 5.0, 16.0, 4.0, 8.0, 9.0, 18.0, 23.0, 0.3,
13.0, 34.0, 610.0]
_lst_piQ_count = [0.03, 0.1, 0.3, 1.0, 3.0, 10.0]
_lst_piQ_stress = [0.03, 0.1, 0.3, 1.0, 5.0, 15.0]
_lambdab_count = [[0.014, 0.031, 0.16, 0.077, 0.26, 0.073, 0.15, 0.19,
0.39, 0.42, 0.0042, 0.21, 0.62, 9.4],
[0.013, 0.028, 0.15, 0.070, 0.24, 0.065, 0.13, 0.18,
0.35, 0.38, 0.0038, 0.19, 0.56, 8.6]]
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
subcategory = 30 # Subcategory ID in rtkcom DB.
def __init__(self):
"""
Method to initialize a Wirewound Power resistor data model instance.
"""
super(WirewoundPower, self).__init__()
self._lst_lambdab_count = []
self.specification = 0
self.style = 0
def set_attributes(self, values):
"""
Method to set the Wirewound Power resistor data model attributes.
:param tuple values: tuple of values to assign to the instance
attributes.
:return: (_code, _msg); the error code and error message.
:rtype: tuple
"""
_code = 0
_msg = ''
(_code, _msg) = Resistor.set_attributes(self, values)
try:
self.specification = int(values[117])
self.style = int(values[118])
except IndexError as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Insufficient input values."
except(TypeError, ValueError) as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Converting one or more inputs to correct data type."
return(_code, _msg)
def get_attributes(self):
"""
Method to retrieve the current values of the Wirewound Power resistor
data model attributes.
:return: (specification, style)
:rtype: tuple
"""
_values = Resistor.get_attributes(self)
_values = _values + (self.specification, self.style)
return _values
def calculate_part(self):
"""
Method to calculate the hazard rate for the Wirewound Power resistor
data model.
:return: False if successful or True if an error is encountered.
:rtype: bool
"""
# WARNING: Refactor calculate_part; current McCabe Complexity metric = 19.
from math import exp
self.hazard_rate_model = {}
if self.hazard_rate_type == 1:
self._lst_lambdab_count = self._lambdab_count[self.specification - 1]
elif self.hazard_rate_type == 2:
self.hazard_rate_model['equation'] = 'lambdab * piR * piQ * piE'
# Base hazard rate.
_stress = self.operating_power / self.rated_power
try:
self.base_hr = \
0.00148 * \
exp(((self.temperature_active + 273.0) / 298.0)**2.0) * \
exp((_stress / 0.5) * ((self.temperature_active + 273.0) /
273.0))
self.hazard_rate_model['lambdab'] = self.base_hr
except OverflowError:
# TODO: Handle overflow error.
return True
# Resistance factor.
if self.specification == 1: # MIL-R-39007
if self.resistance <= 500.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][0]
elif self.resistance > 500.0 and self.resistance <= 1000.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][1]
elif self.resistance > 1000.0 and self.resistance <= 5000.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][2]
elif self.resistance > 5000.0 and self.resistance <= 7500.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][3]
elif self.resistance > 7500.0 and self.resistance <= 10000.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][4]
elif self.resistance > 10000.0 and self.resistance <= 15000.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][5]
elif self.resistance > 15000.0 and self.resistance <= 20000.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][6]
elif self.resistance > 20000.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][7]
elif self.specification == 2: # MIL-R-26
if self.resistance <= 100.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][0]
elif self.resistance > 100.0 and self.resistance <= 1000.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][1]
elif self.resistance > 1000.0 and self.resistance <= 10000.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][2]
elif self.resistance > 10000.0 and self.resistance <= 100000.0:
self.piR = self._lst_piR[self.specification - 1][self.style - 1][3]
elif(self.resistance > 100000.0 and
self.resistance <= 150000.0):
self.piR = self._lst_piR[self.specification - 1][self.style - 1][4]
elif(self.resistance > 150000.0 and
self.resistance <= 200000.0):
self.piR = self._lst_piR[self.specification - 1][self.style - 1][5]
self.hazard_rate_model['piR'] = self.piR
return Resistor.calculate_part(self)
class WirewoundChassisMount(Resistor):
"""
The Wirewound Chassis Mount Power resistor data model contains the
attributes and methods of a Wirewound Chassis Mount Power resistor. The
attributes of a Wirewound Chassis Mount Power resistor are:
:cvar list _lst_piR: list of MIL-HDBK-217FN2 resistance factor values.
:cvar list _lst_piE: list of MIL-HDBK-217FN2 operating environment factor
values.
:cvar list _lst_piQ_count: list of quality factor values for the
MIL-HDBK-217FN2 parts count method.
:cvar list _lst_piQ_stress: list of quality factor values for the
MIL-HDBK-217FN2 parts stress method.
:cvar list _lst_lambdab_count: list of base hazard rate values for the
MIL-HDBK-217FN2 parts count method.
:cvar int subcategory: default value: 31
Covers specifications MIL-R-18546 and MIL-R-39009.
Hazard Rate Models:
# MIL-HDBK-217F, section 9.7
"""
# MIL-HDK-217F hazard rate calculation variables.
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
_lst_piR = [[[1.0, 1.2, 1.2, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.2, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.2, 1.2, 1.6, 0.0],
[1.0, 1.0, 1.0, 1.1, 1.2, 1.6],
[1.0, 1.0, 1.0, 1.0, 1.2, 1.6],
[1.0, 1.0, 1.0, 1.0, 1.2, 1.6]],
[[1.0, 1.2, 1.6, 0.0, 0.0, 0.0],
[1.0, 1.2, 1.6, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.2, 1.6, 0.0, 0.0],
[1.0, 1.0, 1.1, 1.2, 1.4, 0.0],
[1.0, 1.0, 1.0, 1.2, 1.6, 0.0],
[1.0, 1.0, 1.0, 1.1, 1.4, 0.0]]]
_lst_piE = [1.0, 2.0, 10.0, 5.0, 16.0, 4.0, 8.0, 9.0, 18.0, 23.0, 0.5,
13.0, 34.0, 610.0]
_lst_piQ_count = [0.03, 0.1, 0.3, 1.0, 3.0, 10.0]
_lst_piQ_stress = [0.03, 0.1, 0.3, 1.0, 5.0, 15.0]
_lst_lambdab_count = [0.008, 0.18, 0.096, 0.045, 0.15, 0.044, 0.088, 0.12,
0.24, 0.25, 0.004, 0.13, 0.37, 5.5]
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
subcategory = 31 # Subcategory ID in rtkcom DB.
def __init__(self):
"""
Method to initialize a Wirewound Chassis Mount Power resistor data
model instance.
"""
super(WirewoundChassisMount, self).__init__()
self.characteristic = 0
self.style = 0
def set_attributes(self, values):
"""
Method to set the Wirewound Chassis Mount Power resistor data model
attributes.
:param tuple values: tuple of values to assign to the instance
attributes.
:return: (_code, _msg); the error code and error message.
:rtype: tuple
"""
_code = 0
_msg = ''
Resistor.set_attributes(self, values)
try:
self.characteristic = int(values[117])
self.style = int(values[118])
except IndexError as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Insufficient input values."
except(TypeError, ValueError) as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Converting one or more inputs to correct data type."
return(_code, _msg)
def get_attributes(self):
"""
Method to retrieve the current values of the Wirewound Chassis Mount
Power resistor data model attributes.
:return: (specification, style)
:rtype: tuple
"""
_values = Resistor.get_attributes(self)
_values = _values + (self.characteristic, self.style)
return _values
def calculate_part(self):
"""
Method to calculate the hazard rate for the Wirewound Chassis Mount
Power resistor data model.
:return: False if successful or True if an error is encountered.
:rtype: bool
"""
from math import exp
self.hazard_rate_model = {}
if self.hazard_rate_type == 2:
self.hazard_rate_model['equation'] = 'lambdab * piR * piQ * piE'
# Base hazard rate.
_stress = self.operating_power / self.rated_power
self.base_hr = 0.00015 * \
exp(2.64 * ((self.temperature_active + 273.0) /
273.0)) * \
exp((_stress / -.466) * ((self.temperature_active +
273.0) / 273.0))
self.hazard_rate_model['lambdab'] = self.base_hr
# Resistance factor.
if self.resistance <= 500.0:
self.piR = self._lst_piR[self.characteristic - 1][self.style - 1][0]
elif self.resistance > 500.0 and self.resistance <= 1000.0:
self.piR = self._lst_piR[self.characteristic - 1][self.style - 1][1]
elif self.resistance > 1000.0 and self.resistance <= 5000.0:
self.piR = self._lst_piR[self.characteristic - 1][self.style - 1][2]
elif self.resistance > 5000.0 and self.resistance <= 10000.0:
self.piR = self._lst_piR[self.characteristic - 1][self.style - 1][3]
elif self.resistance > 10000.0 and self.resistance <= 20000.0:
self.piR = self._lst_piR[self.characteristic - 1][self.style - 1][4]
elif self.resistance > 20000.0:
self.piR = self._lst_piR[self.characteristic - 1][self.style - 1][5]
self.hazard_rate_model['piR'] = self.piR
return Resistor.calculate_part(self)
| 41.922311 | 87 | 0.53186 | 2,987 | 21,045 | 3.653833 | 0.121527 | 0.036284 | 0.040407 | 0.041415 | 0.752886 | 0.732637 | 0.711288 | 0.693513 | 0.649258 | 0.647059 | 0 | 0.114075 | 0.328534 | 21,045 | 501 | 88 | 42.005988 | 0.658269 | 0.338608 | 0 | 0.5 | 0 | 0 | 0.032375 | 0.002123 | 0 | 0 | 0 | 0.003992 | 0 | 1 | 0.040323 | false | 0 | 0.048387 | 0 | 0.197581 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
977258c0034beba563dc5e0a6c129c209d3a7adb | 1,171 | py | Python | main_direct_child.py | Volkova-Natalia/python_abstract_class_variables_example | 66ac2f7646f6150e4f41b62d161fb379744e4f39 | [
"MIT"
] | null | null | null | main_direct_child.py | Volkova-Natalia/python_abstract_class_variables_example | 66ac2f7646f6150e4f41b62d161fb379744e4f39 | [
"MIT"
] | null | null | null | main_direct_child.py | Volkova-Natalia/python_abstract_class_variables_example | 66ac2f7646f6150e4f41b62d161fb379744e4f39 | [
"MIT"
] | null | null | null | """
A direct child HAS TO define required class variables (pseudo "abstract").
"""
class ClassWithAbstractVariables(object):
@classmethod
def __init_subclass__(cls):
required_class_variables = [
'abstract_class_variables_0',
'abstract_class_variables_1',
'abstract_class_variables_2',
]
for var in required_class_variables:
if not hasattr(cls, var):
raise NotImplementedError(
f'Class {cls} lacks required `{var}` class attribute'
)
class MainClassSuccess(ClassWithAbstractVariables):
abstract_class_variables_0 = None
abstract_class_variables_1 = None
abstract_class_variables_2 = None
pass
class MainClassFail(ClassWithAbstractVariables):
"""
Class <class '__main__.MainClassFail0'> lacks required `abstract_class_variables_0` class attribute
Class <class '__main__.MainClassFail0'> lacks required `abstract_class_variables_1` class attribute
Class <class '__main__.MainClassFail0'> lacks required `abstract_class_variables_2` class attribute
"""
pass
if __name__ == '__main__':
pass
| 29.275 | 103 | 0.69257 | 118 | 1,171 | 6.398305 | 0.330508 | 0.222517 | 0.262252 | 0.091391 | 0.287417 | 0.287417 | 0.287417 | 0.287417 | 0.287417 | 0.203974 | 0 | 0.013378 | 0.233988 | 1,171 | 39 | 104 | 30.025641 | 0.828317 | 0.319385 | 0 | 0.136364 | 0 | 0 | 0.177546 | 0.101828 | 0 | 0 | 0 | 0 | 0 | 1 | 0.045455 | false | 0.136364 | 0 | 0 | 0.318182 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
977d42e7ca844d53c6a215204b7d8a5ff0d065e2 | 346 | py | Python | dynamic programing/change_dp.py | younes-assou/some-data-structures-and-algos | 0ac46380d703d9bb58a4dcf5b03558973ff2ad99 | [
"MIT"
] | null | null | null | dynamic programing/change_dp.py | younes-assou/some-data-structures-and-algos | 0ac46380d703d9bb58a4dcf5b03558973ff2ad99 | [
"MIT"
] | null | null | null | dynamic programing/change_dp.py | younes-assou/some-data-structures-and-algos | 0ac46380d703d9bb58a4dcf5b03558973ff2ad99 | [
"MIT"
] | null | null | null | import math
def get_change(m, denominations=[1,3,4], memo={}):
#write your code here
if m in memo: return memo[m]
if m<0: return math.inf
if m==0: return 0
memo[m] = min(get_change(m-denominations[0])+1,get_change(m-denominations[1])+1,get_change(m-denominations[2])+1)
return memo[m]
m = int(input())
print(get_change(m)) | 34.6 | 117 | 0.66763 | 64 | 346 | 3.53125 | 0.390625 | 0.199115 | 0.221239 | 0.40708 | 0.323009 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041379 | 0.16185 | 346 | 10 | 118 | 34.6 | 0.737931 | 0.057803 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0 | 0.333333 | 0.111111 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
977fdeb278aee5c2843254083b77ca89cc2ce6fe | 19 | py | Python | dogebuild_fpc/__init__.py | dogebuild/dogebuild-fpc | 8b061cfe25d22ecb49d792a4e4b1bd5f773a7e51 | [
"MIT"
] | null | null | null | dogebuild_fpc/__init__.py | dogebuild/dogebuild-fpc | 8b061cfe25d22ecb49d792a4e4b1bd5f773a7e51 | [
"MIT"
] | null | null | null | dogebuild_fpc/__init__.py | dogebuild/dogebuild-fpc | 8b061cfe25d22ecb49d792a4e4b1bd5f773a7e51 | [
"MIT"
] | null | null | null | __author__ = 'kir'
| 9.5 | 18 | 0.684211 | 2 | 19 | 4.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157895 | 19 | 1 | 19 | 19 | 0.5625 | 0 | 0 | 0 | 0 | 0 | 0.157895 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9783fca2dbabb59f33769ff174e176227eafec8c | 220 | py | Python | src/deploy/builder/stacks/admin.py | werelaxe/drapo | 5f78da735819200f0e7efa6a5e6b3b45ba6e0d4b | [
"MIT"
] | null | null | null | src/deploy/builder/stacks/admin.py | werelaxe/drapo | 5f78da735819200f0e7efa6a5e6b3b45ba6e0d4b | [
"MIT"
] | null | null | null | src/deploy/builder/stacks/admin.py | werelaxe/drapo | 5f78da735819200f0e7efa6a5e6b3b45ba6e0d4b | [
"MIT"
] | null | null | null | from django.contrib import admin
from . import models
class StackAdmin(admin.ModelAdmin):
list_display = ('name', 'status', 'error_text', 'context', 'download_url')
admin.site.register(models.Stack, StackAdmin)
| 20 | 78 | 0.740909 | 27 | 220 | 5.925926 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127273 | 220 | 10 | 79 | 22 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0.177273 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
979b934b57180cfe73a1e57dbb59cdf300e41582 | 343 | py | Python | examples/django/0_drf_base_no_db/example_app/views.py | e-kor/yappa | 1ea3c4e6a5ffb7a3fbd02d810a62f73a13b9d649 | [
"MIT"
] | 41 | 2021-07-15T14:54:16.000Z | 2022-03-26T10:59:40.000Z | examples/django/0_drf_base_no_db/example_app/views.py | e-kor/yappa | 1ea3c4e6a5ffb7a3fbd02d810a62f73a13b9d649 | [
"MIT"
] | 29 | 2021-08-04T08:04:26.000Z | 2021-08-19T09:50:30.000Z | examples/django/0_drf_base_no_db/example_app/views.py | e-kor/yappa | 1ea3c4e6a5ffb7a3fbd02d810a62f73a13b9d649 | [
"MIT"
] | 3 | 2021-07-23T14:56:40.000Z | 2022-03-24T16:09:55.000Z | from django.db import connection
from rest_framework.decorators import api_view
from rest_framework.response import Response
@api_view()
def root(request):
return Response({"message": "Hello, from Yappa!",
"next step": "go to the next example: "
"connect you managed Postgresql!"})
| 31.181818 | 69 | 0.641399 | 40 | 343 | 5.4 | 0.7 | 0.074074 | 0.157407 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.271137 | 343 | 10 | 70 | 34.3 | 0.864 | 0 | 0 | 0 | 0 | 0 | 0.259475 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0.125 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
97a55329595ecfe4821d9aa4c929ccae964b38fa | 3,761 | py | Python | collections_loops.py | grzegorzwojdyga/SDA_excercises_3 | 83d47dfff97186254e39d2219b946f9cb31a036b | [
"MIT"
] | null | null | null | collections_loops.py | grzegorzwojdyga/SDA_excercises_3 | 83d47dfff97186254e39d2219b946f9cb31a036b | [
"MIT"
] | null | null | null | collections_loops.py | grzegorzwojdyga/SDA_excercises_3 | 83d47dfff97186254e39d2219b946f9cb31a036b | [
"MIT"
] | null | null | null | def task1(s):
"""
Function which receives a sequence of comma-separated numbers and generate a list and a tuple which contains
every number
Input: string with comma separated numbers
Output: list and tuple with all the numbers
"""
pass
def task2():
"""
Function which receives a sequence of comma-separated numbers and generate a result of their addition and
multiplication
Input: string with comma separated numbers
Output: two integers
"""
pass
def task3():
"""
Function which receives a sequence of comma-separated numbers from console and generate a result of their
addition and multiplication
Input: None
Output: two integers
"""
pass
def task4():
"""
Function which will print and find all such numbers which are divisible by 7 but are not a multiple of 5,
between from 0 to N (argument), both included.
Input: Integer N>0
Output: List of all the integers
"""
pass
def task5():
"""
Function which will check if argument is integer, if yes print and find all such numbers which are divisible by 7
but are not a multiple of 5, between from 0 to N (argument), both included. If not it will print error ant return
empty list.
Input: Integer N>0
Output: List of all the integers
"""
pass
def task6():
"""
Function which will check if arguments are integer, if yes print and find all such numbers which are divisible by
7 but are not a multiple of 5, between from N to M (arguments), both included. If not it will print error ant
return empty list.
Input: Integer M>N>0
Output: List of all the integers
"""
pass
def task7(N):
"""
Function which will calculate factorial of a given numbers (N!)
Input: Integer N>0
Output: N!
"""
pass
def task8():
"""
Function which will calculate factorial of a given numbers (N!)
Output should be string in "aa" notation (e.g. 10.000.000), created by yourself without any string functions.
Input: Integer N>0
Output: N! in aa notation
"""
pass
def task9():
"""
Function which will calculate factorial of a given numbers (N!)
Output should be rounded to milion in milions printed (e.g. "12 milions")
Input: Integer N>0
Output: N! in milions
"""
pass
def task10():
"""
Function which generates a dictionary that contains (i, i*i) such that i is an integral number between 1 and n (
both included) e.g. {1: 1, 2: 4, 3: 9, .... } and print it - in every line there must by key and value.
Input: Integer N>0
Output: Dictionary
"""
pass
def task11():
"""
Function that print and puts into list all sentences where subject is in list_1 and verb is in list_2 and the object is in list_3
Input: three lists (e.g. ["I", "You"], ["like", "dislike"], ["Basketball", "Football", "Volleyball"])
Output: list of sentences
"""
def task12(n: int) -> int:
"""
Create function that returns n-th element of fibonacci chain
Input: Single i nteger
Output: Integer
"""
pass
def task13():
"""
Function that find all such numbers between N and M (both included) such that each digit of the number is
an even number.
Input: Two integers
Output: List of numbers
"""
pass
def task14(a, b):
"""
Function that takes 2 numbers, I,J as input and generates a 2-dimensional array. The element value in the i-th
row and j-th column of the array should be i*j
Input: string
Output: string
"""
pass
if __name__ == '__main__':
num = 29
result = task12(num)
#print(result)
a, b = 7, 8
task14(a, b)
| 23.216049 | 133 | 0.645573 | 565 | 3,761 | 4.277876 | 0.277876 | 0.034754 | 0.023169 | 0.034754 | 0.519239 | 0.473728 | 0.465039 | 0.413322 | 0.413322 | 0.391394 | 0 | 0.023486 | 0.275459 | 3,761 | 161 | 134 | 23.360248 | 0.863486 | 0.756714 | 0 | 0.40625 | 1 | 0 | 0.015038 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4375 | false | 0.40625 | 0 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
97aa12a332ccb90915beee0fbbc02c5b1e6f7be1 | 809 | py | Python | sqlite_dissect/file/journal/jounal.py | Defense-Cyber-Crime-Center/sqlite-dissect | e1a6c19928bc092bf7aeaff71072634f77a452ea | [
"MIT"
] | 12 | 2021-10-21T21:23:51.000Z | 2022-03-13T03:01:53.000Z | sqlite_dissect/file/journal/jounal.py | hartescout/sqlite-dissect | c4cd1047837a8bc6bbfa69f448149d046a7cc703 | [
"MIT"
] | 21 | 2021-09-13T17:00:33.000Z | 2022-03-31T12:56:56.000Z | sqlite_dissect/file/journal/jounal.py | hartescout/sqlite-dissect | c4cd1047837a8bc6bbfa69f448149d046a7cc703 | [
"MIT"
] | 1 | 2021-10-21T22:00:07.000Z | 2021-10-21T22:00:07.000Z | from re import sub
from sqlite_dissect.constants import FILE_TYPE
from sqlite_dissect.file.file_handle import FileHandle
"""
journal.py
This script holds the class to parse the rollback journal file.
This script holds the following object(s):
RollbackJournal(object)
"""
class RollbackJournal(object):
def __init__(self, file_identifier, file_size=None):
self.file_handle = FileHandle(FILE_TYPE.ROLLBACK_JOURNAL, file_identifier, file_size=file_size)
def __repr__(self):
return self.__str__().encode("hex")
def __str__(self):
return sub("\t", "", sub("\n", " ", self.stringify()))
def stringify(self, padding=""):
string = padding + "File Handle:\n{}"
string = string.format(self.file_handle.stringify(padding + "\t"))
return string
| 24.515152 | 103 | 0.698393 | 104 | 809 | 5.153846 | 0.403846 | 0.074627 | 0.063433 | 0.067164 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.184178 | 809 | 32 | 104 | 25.28125 | 0.812121 | 0 | 0 | 0 | 0 | 0 | 0.039634 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.214286 | 0.142857 | 0.785714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
97ac51c2848f660af486a16579c5dc13497a5b73 | 160 | py | Python | main.py | vehne/Maiwagen | fb385d840fee298d073ab07306277ed3d3c5fea8 | [
"MIT"
] | null | null | null | main.py | vehne/Maiwagen | fb385d840fee298d073ab07306277ed3d3c5fea8 | [
"MIT"
] | null | null | null | main.py | vehne/Maiwagen | fb385d840fee298d073ab07306277ed3d3c5fea8 | [
"MIT"
] | null | null | null | import kivy
kivy.require('1.10.0') # Aktuell verwendete Kivy Version
from kivy.app import App
meineAnwendung=App()
print(meineAnwendung)
meineAnwendung.run() | 20 | 57 | 0.7875 | 22 | 160 | 5.727273 | 0.636364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027972 | 0.10625 | 160 | 8 | 58 | 20 | 0.853147 | 0.19375 | 0 | 0 | 0 | 0 | 0.046875 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
97bb092103a61f5af6ea9b2379b345b4e8352674 | 17,917 | py | Python | src/botModerationCommands.py | ScrappyCocco/ScroccoDiscordBot | 4af8a7202032ebe6faaf1e899edf60c2b0a7d8b3 | [
"MIT"
] | 1 | 2018-06-27T13:59:27.000Z | 2018-06-27T13:59:27.000Z | src/botModerationCommands.py | ScrappyCocco/ScroccoDiscordBot | 4af8a7202032ebe6faaf1e899edf60c2b0a7d8b3 | [
"MIT"
] | 6 | 2019-03-12T15:07:36.000Z | 2021-06-11T17:46:24.000Z | src/botModerationCommands.py | ScrappyCocco/ScroccoDiscordBot | 4af8a7202032ebe6faaf1e899edf60c2b0a7d8b3 | [
"MIT"
] | null | null | null | # ---------------------------------------------------------------------
# IMPORTS
from discord.ext import commands
import discord
from botMethodsClass import BotMethods
# ---------------------------------------------------------------------
class BotModerationCommands(commands.Cog):
""" Class with Bot 'Moderation' commands (for example ban and kick users) """
# ---------------------------------------------------------------------
async def checkcommandinserver(self, message: discord.message):
if message.guild is None:
await message.channel.send("*Can't execute this in private, execute the command in a server*")
return True
return False
# ---------------------------------------------------------------------
@commands.command()
async def banuser(self, ctx: discord.ext.commands.Context):
"""Function that ban a user from the server
Usage: !banuser @User
"""
# Check that the command is not executed in private message
message_channel: discord.abc.Messageable = ctx.message.channel
if await self.checkcommandinserver(ctx.message):
return
# Check that is a server admin that want to ban users (could check specifically for ban permission)
if BotMethods.is_server_admin(ctx.message.author):
if len(ctx.message.mentions) != 1:
await message_channel.send("Error with mentions...")
return
print("-------------------------")
# Try to ban the mentioned user
try:
async with message_channel.typing():
await ctx.message.guild.ban(ctx.message.mentions[0], delete_message_days=7)
await message_channel.send(str(ctx.message.mentions[0].name) + " has been banned")
except discord.errors.Forbidden:
await message_channel.send("Sorry, I don't have the `ban` permission")
print("-------------------------")
else:
await message_channel.send("You don't have access to this command :stuck_out_tongue: ")
# ---------------------------------------------------------------------
@commands.command()
async def unbanuser(self, ctx: discord.ext.commands.Context, *args):
"""Function that un-ban a user from the server
Usage: !unbanuser UserID
"""
# Check that the command is not executed in private message
message_channel: discord.abc.Messageable = ctx.message.channel
if await self.checkcommandinserver(ctx.message):
return
# Check that is a server admin that want to ban users (could check specifically for unbanuser permission)
if BotMethods.is_server_admin(ctx.message.author):
if len(args) != 1 or not str(args[0]).isdigit():
await message_channel.send("Error with UserID...")
return
print("-------------------------")
# Try to un-ban the mentioned user
try:
async with message_channel.typing():
await ctx.message.guild.unban(self.bot.get_user(int(args[0])))
await message_channel.send("A user has been un-banned!")
except discord.errors.Forbidden:
await message_channel.send("Sorry, I don't have the `unban` permission")
print("-------------------------")
else:
await message_channel.send("You don't have access to this command :stuck_out_tongue: ")
# ---------------------------------------------------------------------
@commands.command()
async def softban(self, ctx: discord.ext.commands.Context):
"""Function that soft-ban (=ban and unban deleting the messages) a user from the server
Usage: !softban @User
"""
# Check that the command is not executed in private message
message_channel: discord.abc.Messageable = ctx.message.channel
if await self.checkcommandinserver(ctx.message):
return
# Check that is a server admin that want to ban users (could check specifically for banuser permission)
if BotMethods.is_server_admin(ctx.message.author):
if len(ctx.message.mentions) != 1:
await message_channel.send("Error with mentions...")
return
print("-------------------------")
# Ban and unban the current user
try:
async with message_channel.typing():
await ctx.message.guild.ban(ctx.message.mentions[0], delete_message_days=7)
await ctx.message.guild.unban(self.bot.get_user(int(ctx.message.mentions[0].id)))
await message_channel.send(str(ctx.message.mentions[0].name) + " has been soft-banned ")
except discord.errors.Forbidden:
await message_channel.send("Sorry, I don't have the `softban` permission")
print("-------------------------")
else:
await message_channel.send("You don't have access to this command :stuck_out_tongue: ")
# ---------------------------------------------------------------------
@commands.command()
async def kickuser(self, ctx: discord.ext.commands.Context):
"""Function that kick a user from the server
Usage: !kickuser @User
"""
# Check that the command is not executed in private message
message_channel: discord.abc.Messageable = ctx.message.channel
if await self.checkcommandinserver(ctx.message):
return
# Check that is a server admin that want to ban users (could check specifically for kickuser permission)
if BotMethods.is_server_admin(ctx.message.author):
if len(ctx.message.mentions) != 1:
await message_channel.send("Error with mentions...")
return
print("-------------------------")
# Kick the mentioned user
try:
async with message_channel.typing():
await ctx.message.guild.kick(ctx.message.mentions[0])
await message_channel.send(str(ctx.message.mentions[0].name) + " has been kicked")
except discord.errors.Forbidden:
await message_channel.send("Sorry, I don't have the `kick` permission")
print("-------------------------")
else:
await message_channel.send("You don't have access to this command :stuck_out_tongue: ")
# ---------------------------------------------------------------------
@commands.command()
async def kickbyrole(self, ctx: discord.ext.commands.Context, *args):
"""Function that kick all the users with a role from the server (USE WITH CAUTION!)
Usage: !kickuser "NoobRole"
"""
# Check that the command is not executed in private message
message_channel: discord.abc.Messageable = ctx.message.channel
if await self.checkcommandinserver(ctx.message):
return
# Check that is a server admin that want to ban users (could check specifically for kickuser permission)
if BotMethods.is_server_admin(ctx.message.author):
if len(args) != 1:
await message_channel.send("Parameters not correct...")
return
# Get all the members and the role
server_members = ctx.message.guild.members
selected_role = discord.utils.get(ctx.message.guild.roles, name=str(args[0]))
# Check that the role exist
if selected_role is None:
await message_channel.send("Errors - can't find given role(no role called \"" + str(
args[0]) + "\" found)...")
return
print("Found " + str(len(server_members)) + " members to analyze")
counter = 0
# Try to kick all the users with that role
try:
async with message_channel.typing():
for current_member in server_members:
# Kick the user if he has that role
if selected_role in current_member.roles:
print("Found user to kick:" + current_member.name)
await ctx.message.guild.kick(current_member)
counter += 1
await message_channel.send("Successfully kicked " + str(counter) + " users with the given role!")
except discord.errors.Forbidden:
await message_channel.send("Sorry, I don't have the `kick` permission")
else:
await message_channel.send("You don't have access to this command :stuck_out_tongue: ")
# ---------------------------------------------------------------------
@commands.command(hidden=True)
async def editallroles(self, ctx: discord.ext.commands.Context, *args):
"""Function that change the role of ALL users (add/remove a role)
USE WITH CAUTION
Usage: !editallroles remove "NoobRole"
Usage: !editallroles add "ProRole"
"""
message_channel: discord.abc.Messageable = ctx.message.channel
if await self.checkcommandinserver(ctx.message):
return
if BotMethods.is_server_admin(ctx.message.author):
if len(args) != 2 or (str(args[0]).lower() != "remove" and str(args[0]).lower() != "add"):
await message_channel.send("Parameters not correct...")
return
print("-------------------------")
server_members = ctx.message.guild.members
action = str(args[0]).lower()
selected_role = discord.utils.get(ctx.message.guild.roles, name=str(args[1]))
if selected_role is None:
await message_channel.send("Errors - can't find given roles...")
return
print("Found " + str(len(server_members)) + " members to analyze")
counter = 0
async with message_channel.typing():
for current_member in server_members:
if (action == "remove") and (selected_role in current_member.roles): # remove the role
await current_member.remove_roles(selected_role)
print("Role removed for user:" + current_member.name)
counter += 1
if (action == "add") and (selected_role not in current_member.roles): # add the role
await current_member.add_roles(selected_role)
print("Role added for user:" + current_member.name)
counter += 1
await message_channel.send(
"Successfully executed '" + action + " role' for " + str(counter) + " users!")
print("-------------------------")
else:
await message_channel.send("You don't have access to this command :stuck_out_tongue: ")
# ---------------------------------------------------------------------
@commands.command(hidden=True)
async def editrole(self, ctx: discord.ext.commands.Context, *args):
"""Function that edit a user role (in the server where it's called)
Usage: !editrole remove "ScrappyCocco" "NoobRole"
Usage: !editrole add "ScrappyCocco" "ProRole"
"""
message_channel: discord.abc.Messageable = ctx.message.channel
if await self.checkcommandinserver(ctx.message):
return
if BotMethods.is_server_admin(ctx.message.author):
if len(args) != 3:
await message_channel.send("Parameters not correct...")
return
print("-------------------------")
action = str(args[0])
# Get the user
if len(ctx.message.mentions) == 1:
print("I've gon one mention")
user_found = discord.utils.get(ctx.message.guild.members, name=str(ctx.message.mentions[0].name))
else:
user_found = discord.utils.get(ctx.message.guild.members, name=str(args[1]))
# Get the role with the name
role_to_update = discord.utils.get(ctx.message.guild.roles, name=str(args[2]))
if role_to_update is None or user_found is None: # error searching the user
await message_channel.send("Errors - can't find given roles...")
else:
# Add or remove the role
if action == "add" or action == "+":
await user_found.add_roles(role_to_update)
if action == "remove" or action == "-":
await user_found.remove_roles(role_to_update)
await message_channel.send("Role Updated for user:" + user_found.name)
print("Role Updated for user:" + user_found.name)
print("-------------------------")
else:
await message_channel.send("You don't have access to this command :stuck_out_tongue: ")
# -------------------------------------------------------------------
@commands.command(hidden=True)
async def promoteusers(self, ctx: discord.ext.commands.Context, *args):
"""Function that change the role of ALL users from Old to New (in the server where it's called)
Usage: !promoteusers "NoobRole" "ProRole"
Usage: !promoteusers "EMPTY" "ProRole"
"""
message_channel: discord.abc.Messageable = ctx.message.channel
if await self.checkcommandinserver(ctx.message):
return
if BotMethods.is_server_admin(ctx.message.author):
if len(args) != 2:
await message_channel.send("Parameters not correct...")
return
print("-------------------------")
server_members = ctx.message.guild.members
empty_role = False
old_role = None
if str(args[0]).lower() == "empty": # promote users without a role
empty_role = True
else:
old_role = discord.utils.get(ctx.message.guild.roles, name=str(args[0]))
new_role = discord.utils.get(ctx.message.guild.roles, name=str(args[1]))
if (old_role is None or new_role is None) and not empty_role:
await message_channel.send("Errors - can't find given roles...")
return
print("Found " + str(len(server_members)) + " members to analyze")
counter = 0
# For every user check and add the role
async with message_channel.typing():
for current_member in server_members:
if len(current_member.roles) == 0 and empty_role:
await current_member.add_roles(new_role)
counter += 1
else:
if old_role in current_member.roles:
await current_member.remove_roles(old_role)
await current_member.add_roles(new_role)
print("Role Updated for user:" + current_member.name)
counter += 1
await message_channel.send("Successfully updated role for " + str(counter) + " users!")
print("-------------------------")
else:
await message_channel.send("You don't have access to this command :stuck_out_tongue: ")
# ---------------------------------------------------------------------
@commands.command(hidden=True)
async def countusers(self, ctx: discord.ext.commands.Context, *args):
"""Function that count the number of users with a specific role
Usage: !countusers "Role"
Usage: !countusers "EMPTY" (count users without a role)
"""
message_channel: discord.abc.Messageable = ctx.message.channel
if await self.checkcommandinserver(ctx.message):
return
if BotMethods.is_server_admin(ctx.message.author):
if len(args) != 1:
await message_channel.send("Parameter not correct...")
return
empty_role = False
role = None
if str(args[0]).lower() == "empty":
empty_role = True
else:
role = discord.utils.get(ctx.message.guild.roles, name=str(args[0]))
if role is None:
await message_channel.send("Error - can't find given role...")
return
server_members = ctx.message.guild.members
counter = 0
async with message_channel.typing():
for current_member in server_members:
if (len(current_member.roles) == 0 and empty_role) or (role in current_member.roles):
counter += 1
if empty_role:
await message_channel.send(str(counter) + " users have no role out of " + str(
len(server_members)) + " server users")
else:
await message_channel.send(str(counter) + " users have the role '" + role.name + "' out of " + str(
len(server_members)) + " server users")
print("-------------------------")
else:
await message_channel.send("You don't have access to this command :stuck_out_tongue: ")
# -------------------------------------------------------------------
def __init__(self, bot):
print("CALLING CLASS-->" + self.__class__.__name__ + " class called")
self.bot = bot
def __del__(self):
print("DESTROYING CLASS-->" + self.__class__.__name__ + " class called")
def setup(bot):
bot.add_cog(BotModerationCommands(bot))
| 50.187675 | 119 | 0.542948 | 1,943 | 17,917 | 4.901698 | 0.091096 | 0.095548 | 0.077803 | 0.094183 | 0.788324 | 0.75273 | 0.711046 | 0.694246 | 0.635447 | 0.609618 | 0 | 0.003822 | 0.299101 | 17,917 | 356 | 120 | 50.328652 | 0.754579 | 0.12396 | 0 | 0.654902 | 0 | 0 | 0.15118 | 0.026101 | 0 | 0 | 0 | 0 | 0 | 1 | 0.011765 | false | 0 | 0.011765 | 0 | 0.121569 | 0.101961 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
97c4b433234dc56623e5071a69e0f921aae6acae | 280 | py | Python | POP1/worksheets/one/ex15/code.py | silvafj/BBK-MSCCS-2017-18 | d97b0f8e7434d19a1a4006989c32c4c1deb93842 | [
"MIT"
] | 1 | 2021-12-29T19:38:56.000Z | 2021-12-29T19:38:56.000Z | POP1/worksheets/one/ex15/code.py | silvafj/BBK-MSCCS-2017-18 | d97b0f8e7434d19a1a4006989c32c4c1deb93842 | [
"MIT"
] | null | null | null | POP1/worksheets/one/ex15/code.py | silvafj/BBK-MSCCS-2017-18 | d97b0f8e7434d19a1a4006989c32c4c1deb93842 | [
"MIT"
] | 2 | 2021-04-08T22:58:03.000Z | 2021-04-09T01:16:51.000Z | # Suppose the cover price of a book is $24.95, but bookstores get a 40% discount.
# Shipping costs $3 for the first copy and 75 cents for each additional copy.
# What is the total wholesale cost for 60 copies?
print(round((24.95 - (24.95 * (40 / 100))) * 60 + 3 + 0.75 * 59, 2))
| 46.666667 | 81 | 0.678571 | 53 | 280 | 3.584906 | 0.716981 | 0.063158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148649 | 0.207143 | 280 | 5 | 82 | 56 | 0.707207 | 0.725 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
97d026b635066d5cf086038a8ca4235c00a5f2f4 | 618 | py | Python | app/validator/client_validator.py | JunFuruya/Ratsnake | ff7fe7f6b56663978d2ee2d94df5d88786a0eaa7 | [
"MIT"
] | null | null | null | app/validator/client_validator.py | JunFuruya/Ratsnake | ff7fe7f6b56663978d2ee2d94df5d88786a0eaa7 | [
"MIT"
] | 5 | 2018-05-17T04:03:39.000Z | 2021-09-08T01:03:17.000Z | app/validator/client_validator.py | JunFuruya/Hideout | ff7fe7f6b56663978d2ee2d94df5d88786a0eaa7 | [
"MIT"
] | null | null | null | # -*- coding: UTF-8 -*-
from app.validator.base_validator import BaseValidator
class ClientValidator(BaseValidator):
def __init__(self):
pass
def get_error_messages(self):
#self.__language_name = language_name
#self.__validate()
return super().get_error_messages()
def __validate(self):
#if(self.has_empty_error(self.__language_name)):
# super().error_messages.append('名称が入力されていません。')
#if(self.has_too_large_number_error(self.__language_name, 100)):
# super().error_messages.append('名称は50文字以内で入力してください。')
pass
| 28.090909 | 72 | 0.656958 | 67 | 618 | 5.597015 | 0.492537 | 0.138667 | 0.128 | 0.112 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012552 | 0.226537 | 618 | 22 | 73 | 28.090909 | 0.771967 | 0.469256 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0.25 | 0.125 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
8adb66241edd0a7ac39ba771a362637aa3498721 | 3,109 | py | Python | commons.py | ruslanrf/LoadBus-Scheduler | 8565379b5d35ec6acb802548d05786b651021e26 | [
"BSD-3-Clause"
] | null | null | null | commons.py | ruslanrf/LoadBus-Scheduler | 8565379b5d35ec6acb802548d05786b651021e26 | [
"BSD-3-Clause"
] | null | null | null | commons.py | ruslanrf/LoadBus-Scheduler | 8565379b5d35ec6acb802548d05786b651021e26 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
#burden -> n # нагрузка
#bandage -> k # шина
import numpy
import collections
class RepresentationBasic(object):
"""
Basic Representation of the current solution
"""
def __init__(self, burdens, bandage_n, zero_assignments=False,
burdens_assignmts=None, bandages_burdens=None, eval_repr=None):
self.burdens = burdens
self.bandage_n = bandage_n
if burdens_assignmts is None:
self.burdens_assignmts = self._burdens_init_zeroassignments(burdens, bandage_n) if zero_assignments \
else self._burdens_init_rndassignments(burdens, bandage_n)
else:
self.burdens_assignmts = burdens_assignmts
assert len(burdens) == len(self.burdens_assignmts)
self.bandages_burdens_mem = bandages_burdens
# self.bandages_burdens = self._get_updated_bandages_burdens() if bandages_burdens is None else bandages_burdens
self._eval_mem = eval_repr
self.duration = None
def _burdens_init_zeroassignments(self, burdens, bandage_n):
return [0]*len(burdens)
def _burdens_init_rndassignments(self, burdens, bandage_n):
return numpy.random.randint(bandage_n, size=len(burdens))
def all_burdens_assigned(self):
return all([a is not None for a in self.burdens_assignmts])
def get_bandages_burdens(self):
if self.bandages_burdens_mem is None:
self.bandages_burdens_mem = self._get_updated_bandages_burdens()
return self.bandages_burdens_mem
def _get_updated_bandages_burdens(self):
bandages_burdens = [0]*self.bandage_n
for i in range(len(self.burdens)):
if self.burdens_assignmts[i] is not None:
bandages_burdens[self.burdens_assignmts[i]] += self.burdens[i]
return bandages_burdens
def eval_repr(self):
if self._eval_mem is None:
self._eval_mem = eval_repr(self.get_bandages_burdens())
return self._eval_mem
def get_bandage_assignmts(self):
bandage_assignmts = collections.defaultdict(list)
for i in range(len(self.burdens_assignmts)):
bandage_assignmts[self.burdens_assignmts[i]].append(i)
return bandage_assignmts
def __str__(self):
return "burdens={}\nbandage_n={}\nburdens_assignmts= {}\nbandage_assignmts= {}\nbandages_burdens= {}\neval: {}" \
.format(self.burdens, self.bandage_n, self.burdens_assignmts,
self.get_bandage_assignmts().items(), self.get_bandages_burdens(),
self.eval_repr()) \
+ ("\nduration= {:.3f}s".format(self.duration) if self.duration is not None else "")
def __eq__(self, other):
if type(other) is type(self):
return self.__dict__ == other.__dict__
return False
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash(frozenset(self.__dict__.iterkeys()))
def eval_repr(bandages_burdens):
return numpy.std(bandages_burdens)
| 37.457831 | 121 | 0.664522 | 373 | 3,109 | 5.176944 | 0.211796 | 0.15536 | 0.093216 | 0.045572 | 0.14086 | 0.049715 | 0.025893 | 0 | 0 | 0 | 0 | 0.001699 | 0.242522 | 3,109 | 82 | 122 | 37.914634 | 0.818259 | 0.072371 | 0 | 0 | 0 | 0 | 0.042322 | 0.03043 | 0 | 0 | 0 | 0 | 0.017544 | 1 | 0.22807 | false | 0 | 0.035088 | 0.122807 | 0.508772 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c13152d4efb188b9f9014ada1985c451e4013c49 | 1,684 | py | Python | fairways/io/syn/oracle.py | dan-win/fairways_py | 771623c6f9ec40e8016b5cebb7951613d01e31f7 | [
"Apache-2.0"
] | null | null | null | fairways/io/syn/oracle.py | dan-win/fairways_py | 771623c6f9ec40e8016b5cebb7951613d01e31f7 | [
"Apache-2.0"
] | null | null | null | fairways/io/syn/oracle.py | dan-win/fairways_py | 771623c6f9ec40e8016b5cebb7951613d01e31f7 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import cx_Oracle
import re
from collections import namedtuple
from .base import (SynDataDriver)
import logging
log = logging.getLogger(__name__)
# RE_CONN_TEMPLATE = re.compile(r"(?:(?P<user>[^/]*)/(?P<password>[^@]*)@//)?(?P<host>[^:^/]*)(?::(?P<port>[^/|^?]*))?(?:/(?P<path>.*))?")
RE_CONN_TEMPLATE = re.compile(r"(?:(?P<user>[^/]*)/(?P<password>[^@]*)@//)?(?P<dsn>.*)")
OracleUriParts = namedtuple('OracleUriParts', 'user,password,dsn'.split(','))
class OracleConnMixin:
def _parse_uri(self, conn_uri):
"""Returns UriParts tuple
Arguments:
conn_uri {str} -- [description]
Returns:
[UriParts] -- Parts of uri
"""
match = RE_CONN_TEMPLATE.match(conn_uri)
m = match.group
return OracleUriParts(m('user'), m('password'), m('dsn'))
class OracleDb(SynDataDriver, OracleConnMixin):
autoclose = True
def is_connected(self):
return self.engine is not None
def _setup_cursor(self, cursor):
cursor.rowfactory = makeDictFactory(cursor)
return cursor
def _connect(self):
user, password, dsn = self.uri_parts
self.engine = cx_Oracle.connect(user, password, dsn, encoding="UTF-8")
# Thanks for: https://stackoverflow.com/a/35046018
def makeDictFactory(cursor):
columnNames = [d[0] for d in cursor.description]
def createRow(*args):
return dict(zip(columnNames, args))
return createRow
def makeNamedTupleFactory(cursor):
columnNames = [d[0].lower() for d in cursor.description]
import collections
Row = collections.namedtuple('Row', columnNames)
return Row | 28.542373 | 138 | 0.625891 | 192 | 1,684 | 5.375 | 0.411458 | 0.017442 | 0.040698 | 0.031008 | 0.120155 | 0.075581 | 0.075581 | 0.075581 | 0.075581 | 0.075581 | 0 | 0.008996 | 0.207838 | 1,684 | 59 | 139 | 28.542373 | 0.764618 | 0.190024 | 0 | 0 | 0 | 0 | 0.083846 | 0.041538 | 0 | 0 | 0 | 0 | 0 | 1 | 0.212121 | false | 0.151515 | 0.181818 | 0.060606 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
c14aa5619a97a25dfa92cb827d5d705545efa05e | 23 | py | Python | main_module/__init__.py | T-R0D/Smok3_Tagg3r | 87deec358a54275e440d02b2bf836550aed3b023 | [
"BSD-3-Clause"
] | 7 | 2017-03-13T17:32:26.000Z | 2021-09-27T16:51:22.000Z | main_module/__init__.py | T-R0D/Smok3_Tagg3r | 87deec358a54275e440d02b2bf836550aed3b023 | [
"BSD-3-Clause"
] | 1 | 2021-05-29T19:54:02.000Z | 2021-05-29T19:54:52.000Z | main_module/__init__.py | T-R0D/Smok3_Tagg3r | 87deec358a54275e440d02b2bf836550aed3b023 | [
"BSD-3-Clause"
] | 25 | 2016-10-18T03:31:44.000Z | 2020-12-29T13:23:10.000Z | __author__ = 'Terence'
| 11.5 | 22 | 0.73913 | 2 | 23 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 23 | 1 | 23 | 23 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c14df36ecc98c5023fbace51e528ab56c196d926 | 150 | py | Python | random_walk/__init__.py | NishanthVAnand/new_env_gym | 6ed044e8ab9b64fb3e6b3def432609833730a60a | [
"MIT"
] | null | null | null | random_walk/__init__.py | NishanthVAnand/new_env_gym | 6ed044e8ab9b64fb3e6b3def432609833730a60a | [
"MIT"
] | null | null | null | random_walk/__init__.py | NishanthVAnand/new_env_gym | 6ed044e8ab9b64fb3e6b3def432609833730a60a | [
"MIT"
] | null | null | null | from gym.envs.registration import register
register(
id='RandomWalk-v0',
entry_point='random_walk.envs:RandomWalk',
timestep_limit=100,
) | 21.428571 | 46 | 0.746667 | 19 | 150 | 5.736842 | 0.842105 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031008 | 0.14 | 150 | 7 | 47 | 21.428571 | 0.813953 | 0 | 0 | 0 | 0 | 0 | 0.264901 | 0.178808 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c15823e6a5d56df3ed84662395def47c143a1b77 | 17,366 | py | Python | gost/gost.py | kste/aeshash | 985ee3a8a3e9853580ac1ab745b446c82c97a095 | [
"MIT"
] | 5 | 2015-10-09T22:23:50.000Z | 2021-02-21T22:10:38.000Z | gost/gost.py | kste/aeshash | 985ee3a8a3e9853580ac1ab745b446c82c97a095 | [
"MIT"
] | null | null | null | gost/gost.py | kste/aeshash | 985ee3a8a3e9853580ac1ab745b446c82c97a095 | [
"MIT"
] | null | null | null | '''
Created on Jan 7, 2014
@author: Stefan Koelbl
'''
import random
class GOST:
"""
A basic implementation of the round function of the
GOST hash function.
"""
# Constant values for KeySchedule function
C = [
0xb1085bda1ecadae9ebcb2f81c0657c1f2f6a76432e45d016714eb88d7585c4fc4b7ce09192676901a2422a08a460d31505767436cc744d23dd806559f2a64507,
0x6fa3b58aa99d2f1a4fe39d460f70b5d7f3feea720a232b9861d55e0f16b501319ab5176b12d699585cb561c2db0aa7ca55dda21bd7cbcd56e679047021b19bb7,
0xf574dcac2bce2fc70a39fc286a3d843506f15e5f529c1f8bf2ea7514b1297b7bd3e20fe490359eb1c1c93a376062db09c2b6f443867adb31991e96f50aba0ab2,
0xef1fdfb3e81566d2f948e1a05d71e4dd488e857e335c3c7d9d721cad685e353fa9d72c82ed03d675d8b71333935203be3453eaa193e837f1220cbebc84e3d12e,
0x4bea6bacad4747999a3f410c6ca923637f151c1f1686104a359e35d7800fffbdbfcd1747253af5a3dfff00b723271a167a56a27ea9ea63f5601758fd7c6cfe57,
0xae4faeae1d3ad3d96fa4c33b7a3039c02d66c4f95142a46c187f9ab49af08ec6cffaa6b71c9ab7b40af21f66c2bec6b6bf71c57236904f35fa68407a46647d6e,
0xf4c70e16eeaac5ec51ac86febf240954399ec6c7e6bf87c9d3473e33197a93c90992abc52d822c3706476983284a05043517454ca23c4af38886564d3a14d493,
0x9b1f5b424d93c9a703e7aa020c6e41414eb7f8719c36de1e89b4443b4ddbc49af4892bcb929b069069d18d2bd1a5c42f36acc2355951a8d9a47f0dd4bf02e71e,
0x378f5a541631229b944c9ad8ec165fde3a7d3a1b258942243cd955b7e00d0984800a440bdbb2ceb17b2b8a9aa6079c540e38dc92cb1f2a607261445183235adb,
0xabbedea680056f52382ae548b2e4f3f38941e71cff8a78db1fffe18a1b3361039fe76702af69334b7a1e6c303b7652f43698fad1153bb6c374b4c7fb98459ced,
0x7bcd9ed0efc889fb3002c6cd635afe94d8fa6bbbebab076120018021148466798a1d71efea48b9caefbacd1d7d476e98dea2594ac06fd85d6bcaa4cd81f32d1b,
0x378ee767f11631bad21380b00449b17acda43c32bcdf1d77f82012d430219f9b5d80ef9d1891cc86e71da4aa88e12852faf417d5d9b21b9948bc924af11bd720
]
A = [
0x641c314b2b8ee083, 0xc83862965601dd1b,
0x8d70c431ac02a736, 0x07e095624504536c,
0x0edd37c48a08a6d8, 0x1ca76e95091051ad,
0x3853dc371220a247, 0x70a6a56e2440598e,
0xa48b474f9ef5dc18, 0x550b8e9e21f7a530,
0xaa16012142f35760, 0x492c024284fbaec0,
0x9258048415eb419d, 0x39b008152acb8227,
0x727d102a548b194e, 0xe4fa2054a80b329c,
0xf97d86d98a327728, 0xeffa11af0964ee50,
0xc3e9224312c8c1a0, 0x9bcf4486248d9f5d,
0x2b838811480723ba, 0x561b0d22900e4669,
0xac361a443d1c8cd2, 0x456c34887a3805b9,
0x5b068c651810a89e, 0xb60c05ca30204d21,
0x71180a8960409a42, 0xe230140fc0802984,
0xd960281e9d1d5215, 0xafc0503c273aa42a,
0x439da0784e745554, 0x86275df09ce8aaa8,
0x0321658cba93c138, 0x0642ca05693b9f70,
0x0c84890ad27623e0, 0x18150f14b9ec46dd,
0x302a1e286fc58ca7, 0x60543c50de970553,
0xc0a878a0a1330aa6, 0x9d4df05d5f661451,
0xaccc9ca9328a8950, 0x4585254f64090fa0,
0x8a174a9ec8121e5d, 0x092e94218d243cba,
0x125c354207487869, 0x24b86a840e90f0d2,
0x486dd4151c3dfdb9, 0x90dab52a387ae76f,
0x46b60f011a83988e, 0x8c711e02341b2d01,
0x05e23c0468365a02, 0x0ad97808d06cb404,
0x14aff010bdd87508, 0x2843fd2067adea10,
0x5086e740ce47c920, 0xa011d380818e8f40,
0x83478b07b2468764, 0x1b8e0b0e798c13c8,
0x3601161cf205268d, 0x6c022c38f90a4c07,
0xd8045870ef14980e, 0xad08b0e0c3282d1c,
0x47107ddd9b505a38, 0x8e20faa72ba0b470
]
Ainverse = [
0xdc6e36e95e0a310b,
0xa5dc6ccfbc146216,
0x57a5d8836528c42c,
0xae57ad1bca509558,
0x41ae473689a037b0,
0x82418e6c0f5d6e7d,
0x198201d81ebadcfa,
0x321902ad3c69a5e9,
0x49d9d1cb12a5f7b1,
0x92afbf8b2457f37f,
0x3943630b48aefbfe,
0x7286c6169041ebe1,
0xe411912c3d82cbdf,
0xd5223f587a198ba3,
0xb7447eb0f4320b5b,
0x7388fc7df56416b6,
0x32786fdea3a318a8,
0x64f0dea15b5b304d,
0xc8fda15fb6b6609a,
0x8de75fbe7171c029,
0x07d3be61e2e29d52,
0x0ebb61c2d9d927a4,
0x1c6bc299afaf4e55,
0x38d6992f43439caa,
0x70256d11ef564e51,
0xe04ada22c3ac9ca2,
0xdd94a9449b452559,
0xa7354f882b8a4ab2,
0x536a9e0d56099479,
0xa6d4211aac1235f2,
0x51b5423445246af9,
0xa27784688a48d4ef,
0x9813d5ff7fe3f8ad,
0x2d26b7e3fedbed47,
0x5a4c73dbe1abc78e,
0xb498e6abdf4b9301,
0x752dd14ba3963b02,
0xea5abf965b317604,
0xc9b46331b662ec08,
0x8f75c66271c4c510,
0x91073f14f6277fd0,
0x3f0e7e28f14efebd,
0x7e1cfc50ff9ce167,
0xfc38e5a0e325dfce,
0xe570d75ddb4aa381,
0xd7e0b3baab945b1f,
0xb3dd7b694b35b63e,
0x7ba7f6d2966a717c,
0xabf2017c29f19997,
0x4bf902f852ff2f33,
0x96ef04eda4e35e66,
0x31c308c755dbbccc,
0x629b1093aaab6585,
0xc42b203b494bca17,
0x955640769296892e,
0x37ac80ec39310f5c,
0xffb3d920c3520bec,
0xe37baf409ba416c5,
0xdbf643802b552c97,
0xabf1861d56aa5833,
0x4bff113aac49b066,
0x96e3227445927dcc,
0x31db44e88a39fa85,
0x62ab88cd0972e917
]
sub = [
252, 238, 221, 17, 207, 110, 49, 22, 251, 196, 250,
218, 35, 197, 4, 77, 233, 119, 240, 219, 147, 46,
153, 186, 23, 54, 241, 187, 20, 205, 95, 193, 249,
24, 101, 90, 226, 92, 239, 33, 129, 28, 60, 66,
139, 1, 142, 79, 5, 132, 2, 174, 227, 106, 143,
160, 6, 11, 237, 152, 127, 212, 211, 31, 235, 52,
44, 81, 234, 200, 72, 171, 242, 42, 104, 162, 253,
58, 206, 204, 181, 112, 14, 86, 8, 12, 118, 18,
191, 114, 19, 71, 156, 183, 93, 135, 21, 161, 150,
41, 16, 123, 154, 199, 243, 145, 120, 111, 157, 158,
178, 177, 50, 117, 25, 61, 255, 53, 138, 126, 109,
84, 198, 128, 195, 189, 13, 87, 223, 245, 36, 169,
62, 168, 67, 201, 215, 121, 214, 246, 124, 34, 185,
3, 224, 15, 236, 222, 122, 148, 176, 188, 220, 232,
40, 80, 78, 51, 10, 74, 167, 151, 96, 115, 30,
0, 98, 68, 26, 184, 56, 130, 100, 159, 38, 65,
173, 69, 70, 146, 39, 94, 85, 47, 140, 163, 165,
125, 105, 213, 149, 59, 7, 88, 179, 64, 134, 172,
29, 247, 48, 55, 107, 228, 136, 217, 231, 137, 225,
27, 131, 73, 76, 63, 248, 254, 141, 83, 170, 144,
202, 216, 133, 97, 32, 113, 103, 164, 45, 43, 9,
91, 203, 155, 37, 208, 190, 229, 108, 82, 89, 166,
116, 210, 230, 244, 180, 192, 209, 102, 175, 194, 57,
75, 99, 182
]
subInverse = [
165, 45, 50, 143, 14, 48, 56, 192, 84, 230, 158, 57, 85, 126, 82, 145,
100, 3, 87, 90, 28, 96, 7, 24, 33, 114, 168, 209, 41, 198, 164, 63, 224,
39, 141, 12, 130, 234, 174, 180, 154, 99, 73, 229, 66, 228, 21, 183,
200, 6, 112, 157, 65, 117, 25, 201, 170, 252, 77, 191, 42, 115, 132,
213, 195, 175, 43, 134, 167, 177, 178, 91, 70, 211, 159, 253, 212, 15,
156, 47, 155, 67, 239, 217, 121, 182, 83, 127, 193, 240, 35, 231, 37,
94, 181, 30, 162, 223, 166, 254, 172, 34, 249, 226, 74, 188, 53, 202,
238, 120, 5, 107, 81, 225, 89, 163, 242, 113, 86, 17, 106, 137, 148,
101, 140, 187, 119, 60, 123, 40, 171, 210, 49, 222, 196, 95, 204, 207,
118, 44, 184, 216, 46, 54, 219, 105, 179, 20, 149, 190, 98, 161, 59, 22,
102, 233, 92, 108, 109, 173, 55, 97, 75, 185, 227, 186, 241, 160, 133,
131, 218, 71, 197, 176, 51, 250, 150, 111, 110, 194, 246, 80, 255, 93,
169, 142, 23, 27, 151, 125, 236, 88, 247, 31, 251, 124, 9, 13, 122, 103,
69, 135, 220, 232, 79, 29, 78, 4, 235, 248, 243, 62, 61, 189, 138, 136,
221, 205, 11, 19, 152, 2, 147, 128, 144, 208, 36, 52, 203, 237, 244,
206, 153, 16, 68, 64, 146, 58, 1, 38, 18, 26, 72, 104, 245, 129, 139,
199, 214, 32, 10, 8, 0, 76, 215, 116
]
#Definition of the AES S-Box for comparison
subAES = [
99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171,
118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164,
114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113,
216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39,
178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227,
47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76,
88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60,
159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16,
255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61,
100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20,
222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98,
145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244,
234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221,
116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53,
87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155,
30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104,
65, 153, 45, 15, 176, 84, 187, 22
]
subAESInverse = [
82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215,
251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222,
233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250,
195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139,
209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93,
101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87,
167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88,
5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3,
1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206,
240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55,
232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183,
98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219,
192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18,
16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229,
122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200,
235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225,
105, 20, 99, 85, 33, 12, 125
]
def __init__(self):
self.values = [[0] * 8 for _ in range(8)]
def printState(self):
"""Print the state values to the console."""
for i in self.values:
print i
def printStateHex(self):
"""Print the state values as hexadecimal values to the console."""
for i in range(8):
out = "%x" % self.getRowHex(i)
print out.zfill(16)
def printStatesHex(self, listOfStates):
"""Print a list of states to the console."""
for row in range(8):
for state in listOfStates:
out = "%x" % state.getRowHex(row)
print out.zfill(16) + " ",
print ""
def NumberOfActiveBytes(self):
"""Return the number of non-zero bytes in the state."""
sumActiveBytes = 0
for y in range(8):
for x in range(8):
if(self.values[x][y] != 0):
sumActiveBytes += 1
return sumActiveBytes
def chunks(self, s, n):
"""Produce `n`-character chunks from `s`."""
chunkList = []
for start in range(0, len(s), n):
chunkList.append(s[start:start + n])
return chunkList
def setStateHex(self, value):
"""Sets the values of the state using hexvalues."""
# split value in 8 parts
chunkList = self.chunks(hex(value)[2:-1].zfill(128), 16)
for row in range(8):
self.setRowHex(int(chunkList[row], 16), row)
def setRandomNonZeroValue(self, x, y):
"""Set the byte at position (x, y) to a random values in range [1, 255]."""
self.values[y][x] = random.randint(1, 255)
def setRandomRow(self, row):
"""Sets a row to random values in range [0, 255]"""
self.values[row] = [random.randint(0, 255) for _ in range(8)]
def setRandomValue(self, x, y):
"""Set the byte at position (x, y) to a random values in range [0, 255]."""
self.values[y][x] = random.randint(0, 255)
def setValue(self, x, y, value):
"""Set the byte at position (x, y) to value."""
self.values[y][x] = value
def getValue(self, x, y):
"""Return the value of the byte at position (x, y)."""
return self.values[y][x]
def setFullActive(self):
"""Set all values in the state to 1."""
self.values = [[1 for _ in range(8)] for _ in range(8)]
def setActiveRow(self, x):
"""Set all values in a row to 1."""
self.values[x] = [1 for _ in range(8)]
def setActiveColumn(self, x):
"""Set all values in a column to 1."""
for rows in self.values:
rows[x] = 1
def Copy(self):
"""Returns a copy of the state."""
result = GOST()
for y in range(8):
for x in range(8):
result.values[x][y] = self.values[x][y]
return result
def AK(self, key):
"""Return the state XORed bytewise with the key."""
result = GOST()
for y in range(8):
for x in range(8):
result.values[x][y] = self.values[x][y] ^ key.values[x][y]
return result
def P(self):
"""Return the state transposed."""
result = GOST()
for y in range(8):
for x in range(8):
result.values[x][y] = self.values[y][x]
return result
def Pinverse(self):
"""Return the state transposed."""
return self.P()
def S(self):
"""Return the state after applying the S-Box bytewise."""
result = GOST()
result.values = [[self.sub[self.values[j][i]] for i in range(8)] for j in range(8)]
return result
def Sinverse(self):
"""Return the state after applying the inverse S-Box bytewise."""
result = GOST()
result.values = [[self.subInverse[self.values[j][i]] for i in range(8)] for j in range(8)]
return result
def getRow(self, index):
"""Return the row at index."""
row = []
for j in range(8):
row.append(self.values[index][j])
return row
def setRow(self, row, index):
"""Set the value of the row at index."""
for j in range(8):
self.values[index][j] = row[j]
return row
def getRowHex(self, index):
"""Return the row as a 64-bit hex value."""
row = 0
for j in range(8):
row ^= (self.values[index][j]) << ((7 - j) * 8)
return row
def setRowHex(self, row, index):
"""Set the row from a 64-bit hex value."""
for j in range(8):
self.values[index][j] = (row >> ((7 - j) * 8) & 0xFF)
def AddConstant(self, index):
"""Return the state after adding the round constant at index."""
result = GOST()
if(index >= 0):
constantState = GOST()
constantState.setStateHex(self.C[index])
result = self.AK(constantState)
return result
def L(self):
"""Return the state after multiplying each row with an 8x8 MDS matrix."""
result = GOST()
for rowIndex in range(8):
# store row in integer
row = self.getRowHex(rowIndex)
# perform multiplication
tmpRow = 0
for i in range(64):
if(row & 0x1):
tmpRow ^= self.A[i]
row = row >> 1
result.setRowHex(tmpRow, rowIndex)
return result
def Linverse(self):
"""Return the state after multiplying each row with the inverse of the 8x8 MDS matrix."""
result = GOST()
for rowIndex in range(8):
# store row in integer
row = self.getRowHex(rowIndex)
# perform multiplication
tmpRow = 0
for i in range(64):
if(row & 0x1):
tmpRow ^= self.Ainverse[i]
row = row >> 1
result.setRowHex(tmpRow, rowIndex)
return result
def SPL(self):
"""Return the state after applying S, P and L."""
return self.S().P().L()
def SPLinverse(self):
"""Return the state after applying Linverse, P and Sinverse."""
return self.Linverse().P().Sinverse()
| 42.356098 | 139 | 0.578141 | 2,042 | 17,366 | 4.912341 | 0.263957 | 0.022331 | 0.020736 | 0.008773 | 0.173761 | 0.146247 | 0.128402 | 0.108563 | 0.093909 | 0.084937 | 0 | 0.429912 | 0.306576 | 17,366 | 409 | 140 | 42.459658 | 0.403089 | 0.011114 | 0 | 0.144615 | 0 | 0 | 0.000322 | 0 | 0 | 0 | 0.249388 | 0 | 0 | 0 | null | null | 0 | 0.003077 | null | null | 0.021538 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c15d915fb2f7a1eeef57dff8cf3b37d511e45f85 | 665 | py | Python | xue/cms/middleware/dummylang.py | team-xue/xue | e6bd9539803a2bf902f48b65a9df86356b5d46b2 | [
"BSD-3-Clause"
] | 1 | 2015-11-23T02:33:07.000Z | 2015-11-23T02:33:07.000Z | xue/cms/middleware/dummylang.py | team-xue/xue | e6bd9539803a2bf902f48b65a9df86356b5d46b2 | [
"BSD-3-Clause"
] | null | null | null | xue/cms/middleware/dummylang.py | team-xue/xue | e6bd9539803a2bf902f48b65a9df86356b5d46b2 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from cms.utils.i18n import get_default_language
from django.conf import settings
from django.core.urlresolvers import reverse
from django.middleware.locale import LocaleMiddleware
from django.utils import translation
import re
import urllib
class DummyMultilingualURLMiddleware(object):
def get_language_from_request (self,request):
return 'zh_cn'
def process_request(self, request):
language = self.get_language_from_request(request)
translation.activate(language)
request.LANGUAGE_CODE = language
def process_response(self, request, response):
return response
| 31.666667 | 59 | 0.736842 | 77 | 665 | 6.207792 | 0.467532 | 0.083682 | 0.062762 | 0.09205 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005618 | 0.196992 | 665 | 20 | 60 | 33.25 | 0.889513 | 0.031579 | 0 | 0 | 0 | 0 | 0.008039 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1875 | false | 0 | 0.4375 | 0.125 | 0.8125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
c16c436a2613e1f0827e0c6745356317b569036c | 720 | py | Python | backend/flask/app/api/database/models/RandomSubscriberChallenge.py | tvdhout/twitchess | 398e6390a456d432893a7e1e1c880c92cdcadf7c | [
"MIT"
] | 1 | 2022-01-08T05:55:37.000Z | 2022-01-08T05:55:37.000Z | backend/flask/app/api/database/models/RandomSubscriberChallenge.py | tvdhout/twitchess | 398e6390a456d432893a7e1e1c880c92cdcadf7c | [
"MIT"
] | 1 | 2022-01-08T05:53:49.000Z | 2022-01-28T15:03:33.000Z | backend/flask/app/api/database/models/RandomSubscriberChallenge.py | tvdhout/twitchess | 398e6390a456d432893a7e1e1c880c92cdcadf7c | [
"MIT"
] | null | null | null | from sqlalchemy import Column, String
from app.api.database.models import Base
def make_subscriber_table(name: str) -> type:
"""
Return a new SQLAlchemy Table object representing the lichess - twitch pairs for a certain user.
"""
class Pair(Base):
__tablename__ = name
__table_args__ = {'extend_existing': True}
twitch = Column(String(25), primary_key=True)
lichess = Column(String(20), nullable=False)
def dict(self):
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
def __repr__(self):
return f'{self.__tablename__.capitalize()} subscriber(twitch={self.twitch}, lichess={self.lichess})'
return Pair
| 32.727273 | 112 | 0.665278 | 90 | 720 | 5.044444 | 0.566667 | 0.079295 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007194 | 0.227778 | 720 | 21 | 113 | 34.285714 | 0.809353 | 0.133333 | 0 | 0 | 0 | 0.076923 | 0.172697 | 0.144737 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.153846 | 0.153846 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c199c98ff5160fe020b451c8358768f938abf77c | 2,213 | py | Python | supermamas/areas/service.py | oasalonen/supermamas | 3ab2b2370de903cea614ea9dfa10ce1c0504a715 | [
"Apache-2.0"
] | null | null | null | supermamas/areas/service.py | oasalonen/supermamas | 3ab2b2370de903cea614ea9dfa10ce1c0504a715 | [
"Apache-2.0"
] | null | null | null | supermamas/areas/service.py | oasalonen/supermamas | 3ab2b2370de903cea614ea9dfa10ce1c0504a715 | [
"Apache-2.0"
] | null | null | null | from flask_babel import gettext
from dateutil import rrule, parser
from datetime import datetime, date, timedelta
from supermamas.areas.districts import District
from supermamas.areas.cities import City
class Service:
__instance = None
def __new__(cls, district_repository=None, city_repository=None):
if not Service.__instance:
Service.__instance = object.__new__(cls)
Service.__instance.district_repository = district_repository
Service.__instance.city_repository = city_repository
return Service.__instance
def _district_repository(self):
return Service.__instance.district_repository
def _city_repository(self):
return Service.__instance.city_repository
def cities(self):
return self._city_repository().get_all()
def districts(self):
return self._district_repository().get_all()
def get_city(self, city_id):
return self._city_repository().get(city_id)
def get_district(self, district_id):
return self._district_repository().get(district_id)
def get_districts_in_same_city_by_district(self, district_id):
city = self._city_repository().get_by_district(district_id)
return city.districts
def add_city(self, city_name):
errors = {}
if not city_name:
errors["city_name"] = gettext(u"City name is missing")
if not errors:
city = City()
city.name = city_name
city = self._city_repository().insert(city)
else:
city = None
return (city, errors)
def add_district(self, district_name):
errors = {}
if not district_name:
errors["district_name"] = gettext(u"District name is missing")
if not errors:
district = District()
district.name = district_name
district = self._district_repository().insert(district)
else:
district = None
return (district, errors)
def delete_city(self, city_id):
self._city_repository().remove(city_id)
def delete_district(self, district_id):
self._district_repository().remove(district_id) | 30.736111 | 74 | 0.66516 | 256 | 2,213 | 5.402344 | 0.179688 | 0.101229 | 0.065076 | 0.045553 | 0.169197 | 0.034707 | 0 | 0 | 0 | 0 | 0 | 0 | 0.253502 | 2,213 | 72 | 75 | 30.736111 | 0.837167 | 0 | 0 | 0.111111 | 0 | 0 | 0.02981 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.092593 | 0.111111 | 0.537037 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c1c2c75fd2e751b22e70beb1bfe8ea861e79916e | 312 | py | Python | FazCO2Monitor/main/views.py | fazerog02/FazCO2Monitor | a7ef0aba2f387ae2087e1d9458ff6156333e9421 | [
"MIT"
] | null | null | null | FazCO2Monitor/main/views.py | fazerog02/FazCO2Monitor | a7ef0aba2f387ae2087e1d9458ff6156333e9421 | [
"MIT"
] | null | null | null | FazCO2Monitor/main/views.py | fazerog02/FazCO2Monitor | a7ef0aba2f387ae2087e1d9458ff6156333e9421 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from api.models import NowPPM
from api.models import PPMData
import datetime
import matplotlib
from matplotlib import pyplot
# Create your views here.
def home(request):
nowppm = NowPPM.objects.get(id=1)
return render(request, 'home.html', {'nowppm': nowppm, })
| 18.352941 | 61 | 0.753205 | 43 | 312 | 5.465116 | 0.581395 | 0.059574 | 0.110638 | 0.161702 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003817 | 0.160256 | 312 | 16 | 62 | 19.5 | 0.89313 | 0.073718 | 0 | 0 | 0 | 0 | 0.052448 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.666667 | 0 | 0.888889 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
c1f25314101c6772ba72972d1b4fe3550c91083b | 787 | py | Python | variable_heuristic.py | HoSzyk/Map | d22e344cab7b14494f16884f7a4f29f46b752840 | [
"MIT"
] | null | null | null | variable_heuristic.py | HoSzyk/Map | d22e344cab7b14494f16884f7a4f29f46b752840 | [
"MIT"
] | null | null | null | variable_heuristic.py | HoSzyk/Map | d22e344cab7b14494f16884f7a4f29f46b752840 | [
"MIT"
] | null | null | null | from problem import CspProblem
class BaseVariableHeuristic:
def get_variables(self, problem: CspProblem):
return problem.variables
class NeighbourHeuristic(BaseVariableHeuristic):
def get_variables(self, problem: CspProblem):
return sorted(problem.variables, key=lambda x: len(problem.neighbours[x]), reverse=True)
class DegreeHeuristic(BaseVariableHeuristic):
def get_variables(self, problem: CspProblem):
sort_dict = {}
for constraint in problem.constraints:
for elem in constraint.elements:
if elem not in sort_dict:
sort_dict[elem] = 0
else:
sort_dict[elem] += 1
return sorted(problem.variables, key=lambda x: sort_dict[x], reverse=True)
| 29.148148 | 96 | 0.662008 | 85 | 787 | 6.035294 | 0.4 | 0.077973 | 0.157895 | 0.210526 | 0.493177 | 0.493177 | 0.493177 | 0.245614 | 0 | 0 | 0 | 0.003431 | 0.259212 | 787 | 26 | 97 | 30.269231 | 0.876501 | 0 | 0 | 0.176471 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0.058824 | 0.117647 | 0.588235 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
de0f5660ff8481c2a4f37f981967e6c65955ffe9 | 818 | py | Python | ssu-calculus-methods/cubic_spline.py | Imperat/SSU-Information-Security-Course | 24c04cb8b4da0231d65d587e981e15b1fefc19eb | [
"Apache-2.0"
] | null | null | null | ssu-calculus-methods/cubic_spline.py | Imperat/SSU-Information-Security-Course | 24c04cb8b4da0231d65d587e981e15b1fefc19eb | [
"Apache-2.0"
] | null | null | null | ssu-calculus-methods/cubic_spline.py | Imperat/SSU-Information-Security-Course | 24c04cb8b4da0231d65d587e981e15b1fefc19eb | [
"Apache-2.0"
] | null | null | null | from math import sin
ys = [sin(i) for i in range(1,3.14, 0.2)]
xs = range(1, 3.14, 0.2)
def h(k):
return xs[k] - xs[k-1]
def f_r(k):
return (ys[k] - ys[k-1]) / h(k)
lamba1 = (3 * f_r(2) - 3 * f_r(1)) / (2 * (h(1) + h(2)))
delta1 = - h(2) / (2 * (h(1) + h(2)))
deltas = [delta1]
lambas = [lamba1]
for k in range(3,n):
t = h(k) / (2 * h(k-1) + 2 * h(k) + h(k-1) * deltas[-1])
deltas.append(t)
for k in range(3,n):
t = 3 * (f_r(k) - f_r(k-1) - h(k-1)*lambas[k-2]) / (
2 * (h(k-1) + h(k)) + h(k-1)*deltas(k-2))
c = [0]
for k in range(n,2):
t = deltas[k-1]*c[-1] + lambas[k-1]
c.append(t)
def c_r(k):
c[k] - c[k-1]
d = [c_r(k) / (3 * h(k)) for k in range(1, len(xs) + 1)
b = [f_r(k) + 2.0 / 3 * h(k)c[k] + 1.0 / 3 * h(k)c[k-1]]
a = ys
| 21.526316 | 61 | 0.430318 | 192 | 818 | 1.791667 | 0.171875 | 0.075581 | 0.043605 | 0.127907 | 0.27907 | 0.25 | 0.122093 | 0 | 0 | 0 | 0 | 0.104167 | 0.295844 | 818 | 37 | 62 | 22.108108 | 0.493056 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.038462 | null | null | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a9b1e5f530f1eb2e2c4155ee70c812905ec0376e | 212 | py | Python | Python/Courses/Python-Tutorials.Zulkarnine-Mahmud/00.Fundamentals/02.01-Complicated-Logic.py | shihab4t/Books-Code | b637b6b2ad42e11faf87d29047311160fe3b2490 | [
"Unlicense"
] | null | null | null | Python/Courses/Python-Tutorials.Zulkarnine-Mahmud/00.Fundamentals/02.01-Complicated-Logic.py | shihab4t/Books-Code | b637b6b2ad42e11faf87d29047311160fe3b2490 | [
"Unlicense"
] | null | null | null | Python/Courses/Python-Tutorials.Zulkarnine-Mahmud/00.Fundamentals/02.01-Complicated-Logic.py | shihab4t/Books-Code | b637b6b2ad42e11faf87d29047311160fe3b2490 | [
"Unlicense"
] | null | null | null | def complicated_logic(first, second):
print(f"You passed: {first}, {second}")
# return first + second * 12 - 4 * 12
number1 = 10
number2 = 3
result = complicated_logic(number1, number2)
print(result)
| 17.666667 | 44 | 0.679245 | 28 | 212 | 5.071429 | 0.607143 | 0.232394 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070175 | 0.193396 | 212 | 11 | 45 | 19.272727 | 0.760234 | 0.165094 | 0 | 0 | 0 | 0 | 0.165714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0 | 0 | 0.166667 | 0.333333 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a9bbe238eec765d6219021e3850498a946086afe | 290 | py | Python | tests/conftest.py | chadwhitacre/confidant | dd788147b355f760767cf3b9487671c67948ade3 | [
"Apache-2.0"
] | 1,820 | 2015-11-04T17:57:16.000Z | 2022-03-31T16:47:24.000Z | tests/conftest.py | chadwhitacre/confidant | dd788147b355f760767cf3b9487671c67948ade3 | [
"Apache-2.0"
] | 186 | 2015-11-04T18:21:52.000Z | 2022-01-14T20:31:31.000Z | tests/conftest.py | isabella232/confidant | 3dac318c3e1f29bae5771084ad29a4bc121f1771 | [
"Apache-2.0"
] | 136 | 2015-11-04T19:23:14.000Z | 2022-02-25T01:51:29.000Z | import pytest
@pytest.fixture(autouse=True)
def encrypted_settings_mock(mocker):
mocker.patch('confidant.settings.encrypted_settings.secret_string', {})
mocker.patch(
'confidant.settings.encrypted_settings.decrypted_secrets',
{'SESSION_SECRET': 'TEST_KEY'},
)
| 26.363636 | 75 | 0.731034 | 31 | 290 | 6.580645 | 0.612903 | 0.25 | 0.196078 | 0.27451 | 0.441176 | 0.441176 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144828 | 290 | 10 | 76 | 29 | 0.822581 | 0 | 0 | 0 | 0 | 0 | 0.441379 | 0.365517 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a9c54ec758039b31ef7e9d1b505a7deab5022928 | 328 | py | Python | vbb_backend/session/apps.py | jcelynott/backend-vbb-portal | 4d5c4faab52e0e73112fb4bfd5b98ac5c5c7f795 | [
"MIT"
] | 3 | 2021-04-14T02:59:09.000Z | 2021-06-08T00:17:27.000Z | vbb_backend/session/apps.py | jcelynott/backend-vbb-portal | 4d5c4faab52e0e73112fb4bfd5b98ac5c5c7f795 | [
"MIT"
] | 81 | 2020-12-08T00:11:52.000Z | 2021-08-09T18:13:32.000Z | vbb_backend/session/apps.py | jcelynott/backend-vbb-portal | 4d5c4faab52e0e73112fb4bfd5b98ac5c5c7f795 | [
"MIT"
] | 5 | 2021-01-12T04:50:26.000Z | 2021-06-04T02:00:03.000Z | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class SessionConfig(AppConfig):
name = "vbb_backend.session"
verbose_name = _("Session")
def ready(self):
try:
import vbb_backend.session.signals # noqa F401
except ImportError:
pass
| 23.428571 | 59 | 0.670732 | 37 | 328 | 5.783784 | 0.72973 | 0.093458 | 0.158879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012346 | 0.259146 | 328 | 13 | 60 | 25.230769 | 0.868313 | 0.027439 | 0 | 0 | 0 | 0 | 0.082019 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0.1 | 0.4 | 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 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
a9c61be2035b4927ebed8f0ce6053f1053a8e921 | 111 | py | Python | ef/config/components/fields/field.py | JacobMSD/ef_python | 13d785c10dd293c60ab90065c518e5afb14e5a02 | [
"MIT"
] | null | null | null | ef/config/components/fields/field.py | JacobMSD/ef_python | 13d785c10dd293c60ab90065c518e5afb14e5a02 | [
"MIT"
] | null | null | null | ef/config/components/fields/field.py | JacobMSD/ef_python | 13d785c10dd293c60ab90065c518e5afb14e5a02 | [
"MIT"
] | null | null | null | __all__ = ["Field"]
from ef.config.component import ConfigComponent
class Field(ConfigComponent):
pass
| 12.333333 | 47 | 0.747748 | 12 | 111 | 6.583333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162162 | 111 | 8 | 48 | 13.875 | 0.849462 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.25 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e72f5c3abfd6eba31dcf3a6334d7ea2362fc6134 | 2,470 | py | Python | db_interfacer/interfacer.py | VenkatSubramaniam/SDI | 8701803f5a331dd44080eae72a64a99608157702 | [
"MIT"
] | null | null | null | db_interfacer/interfacer.py | VenkatSubramaniam/SDI | 8701803f5a331dd44080eae72a64a99608157702 | [
"MIT"
] | 2 | 2019-11-13T05:20:06.000Z | 2019-11-13T05:34:01.000Z | db_interfacer/interfacer.py | VenkatSubramaniam/SDI | 8701803f5a331dd44080eae72a64a99608157702 | [
"MIT"
] | 1 | 2019-12-12T18:30:57.000Z | 2019-12-12T18:30:57.000Z | #!/usr/bin/env python
# coding: utf-8
from typing import Dict
import psycopg2 as pg
class DBInterfacer:
def __init__(self, uname: str, pword: str, db: str, port: str) -> None:
self.connection, self.cursor = self._establish_postgres_connection(uname, pword, db, port)
def _establish_postgres_connection(self, uname: str, pword: str, db: str, port: str) -> None:
try:
self._create_db(uname, pword, db, port)
connection = pg.connect(user=uname, password=pword, port=port, database=db) # do we have to create this before? The db, I mean.
return connection, connection.cursor()
except (Exception, psycopg2.Error) as error:
raise Exception("We were unsuccessful in connecting to postgres. Are you sure you set up your database as requested?")
def commit(self) -> None:
self.connection.commit()
@staticmethod
def _create_db(uname: str, pword: str, db: str, port: str) -> None:
with pg.connect(user=uname, password=pword, port=port, database="postgres") as conn:
conn.set_isolation_level(pg.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cur = conn.cursor()
cur.execute(f"select exists(SELECT datname FROM pg_catalog.pg_database WHERE lower(datname) = lower('{db}'))")
if not cur.fetchone()[0]:
cur.execute(f"create database {db};")
def create_table(self, table: str, schema: Dict[str, str]) -> None:
self.cursor.execute(f"create table {table} ({self._parse_schema(schema)});")
self.commit()
@staticmethod
def _parse_schema(schema: Dict[str, str], key: bool=None) -> str:
if key:
pass #TODO
return ", ".join([" ".join(item) for item in schema.items()])
def stringify(self, table:str, row: Dict[str, str], keys: object) -> None:
stringify = ["'"+row[key]+"'" for key in keys]
query = f"insert into {table} ({', '.join(keys)}) values ({', '.join(stringify)})"
self.cursor.execute(query)
def insert_row(self, table:str, row: Dict[str, str]) -> None:
keys = row.keys()
self.cursor.execute(f"insert into {table} ({', '.join(keys)}) values ({', '.join([row[key] for key in keys])})")
# try:
# self.cursor.execute(f"insert into {table} ({', '.join(keys)}) values ({', '.join([row[key] for key in keys])})")
# except:
# self.stringify(table, row, keys)
| 44.107143 | 140 | 0.614575 | 324 | 2,470 | 4.604938 | 0.308642 | 0.023458 | 0.02681 | 0.032172 | 0.293566 | 0.293566 | 0.281501 | 0.247989 | 0.225201 | 0.140751 | 0 | 0.002123 | 0.237247 | 2,470 | 55 | 141 | 44.909091 | 0.789809 | 0.103239 | 0 | 0.054054 | 0 | 0.027027 | 0.198459 | 0.024015 | 0 | 0 | 0 | 0.018182 | 0 | 1 | 0.216216 | false | 0.081081 | 0.054054 | 0 | 0.351351 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e73e1231a7dbbebd9a6b46ae1a6d74595452059e | 1,026 | py | Python | muddery/server/statements/statement_func_set.py | dongwudanci/muddery | 669fbbdb394d04995470e32e94f10d42f3387996 | [
"BSD-3-Clause"
] | 127 | 2015-04-16T15:27:59.000Z | 2022-03-10T08:35:37.000Z | muddery/server/statements/statement_func_set.py | dongwudanci/muddery | 669fbbdb394d04995470e32e94f10d42f3387996 | [
"BSD-3-Clause"
] | 14 | 2015-12-17T08:02:18.000Z | 2022-01-30T15:15:38.000Z | muddery/server/statements/statement_func_set.py | dongwudanci/muddery | 669fbbdb394d04995470e32e94f10d42f3387996 | [
"BSD-3-Clause"
] | 54 | 2015-06-23T07:27:45.000Z | 2022-02-22T01:46:05.000Z | """
A statement function set holds a set of statement functions that can be used in statements.
"""
class BaseStatementFuncSet(object):
"""
A statement function set holds a set of statement functions that can be used in statements.
"""
def __init__(self):
self.funcs = {}
self.at_creation()
def at_creation(self):
"""
Load statement functions here.
"""
pass
def add(self, func_cls):
"""
Add a statement function's class.
Args:
func_cls: statement function's class
Returns:
None
"""
# save an instance of the function class
self.funcs[func_cls.key] = func_cls
def get_func_class(self, key):
"""
Get statement function's class.
Args:
key: statement function's key.
Returns:
function's class
"""
if key in self.funcs:
return self.funcs[key]
else:
return None
| 21.375 | 95 | 0.551657 | 119 | 1,026 | 4.655462 | 0.344538 | 0.184116 | 0.129964 | 0.124549 | 0.368231 | 0.270758 | 0.270758 | 0.270758 | 0.270758 | 0.270758 | 0 | 0 | 0.367446 | 1,026 | 47 | 96 | 21.829787 | 0.853621 | 0.448343 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0.076923 | 0 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
e76547971b03bf794f334ae41c909bfa4cbb46a9 | 178 | py | Python | selsearch/search.py | jeertmans/selsearch | d44cc530b3af67ecc5a65584e19dac258b277e09 | [
"MIT"
] | 8 | 2022-02-15T08:39:25.000Z | 2022-02-21T23:50:52.000Z | selsearch/search.py | jeertmans/selsearch | d44cc530b3af67ecc5a65584e19dac258b277e09 | [
"MIT"
] | null | null | null | selsearch/search.py | jeertmans/selsearch | d44cc530b3af67ecc5a65584e19dac258b277e09 | [
"MIT"
] | null | null | null | import urllib.parse
import webbrowser
def search_text(where, text):
urlsafe = urllib.parse.quote(text)
browser = webbrowser.get()
browser.open(f"{where}{urlsafe}")
| 19.777778 | 38 | 0.713483 | 23 | 178 | 5.478261 | 0.608696 | 0.174603 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157303 | 178 | 8 | 39 | 22.25 | 0.84 | 0 | 0 | 0 | 0 | 0 | 0.089888 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e76b3bdf3bbf6d5fa53a0c5a4a4518393542ef33 | 621 | py | Python | CodeWars/2019/AnagramFinder-5k.py | JLJTECH/TutorialTesting | f2dbbd49a86b3b086d0fc156ac3369fb74727f86 | [
"MIT"
] | null | null | null | CodeWars/2019/AnagramFinder-5k.py | JLJTECH/TutorialTesting | f2dbbd49a86b3b086d0fc156ac3369fb74727f86 | [
"MIT"
] | null | null | null | CodeWars/2019/AnagramFinder-5k.py | JLJTECH/TutorialTesting | f2dbbd49a86b3b086d0fc156ac3369fb74727f86 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
'''
Write a function that will find all the anagrams of a word from a list. You will be given two inputs a word and an array with words.
You should return an array of all the anagrams or an empty array if there are none.
'''
def anagrams(word, words):
analis = []
for item in words:
if (sorted(word) == sorted(item)):
analis.append(item)
return analis
#Alternative implementations
def anagrams(word, words):
return [item for item in words if sorted(item)==sorted(word)]
def anagrams(word, words):
return filter(lambda x: sorted(word) == sorted(x), words)
| 32.684211 | 133 | 0.689211 | 98 | 621 | 4.367347 | 0.479592 | 0.077103 | 0.10514 | 0.140187 | 0.224299 | 0.102804 | 0 | 0 | 0 | 0 | 0 | 0.002045 | 0.21256 | 621 | 18 | 134 | 34.5 | 0.873211 | 0.429952 | 0 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0 | 0.2 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e77c84914f38913704b0ff3827bf299d1d92b856 | 108 | py | Python | Robotix/apps/participant/utils.py | Robotix/rbtxportal | 3a63f8d90adee3b7adb7d203959fbf4ad5d9488b | [
"BSD-3-Clause"
] | null | null | null | Robotix/apps/participant/utils.py | Robotix/rbtxportal | 3a63f8d90adee3b7adb7d203959fbf4ad5d9488b | [
"BSD-3-Clause"
] | null | null | null | Robotix/apps/participant/utils.py | Robotix/rbtxportal | 3a63f8d90adee3b7adb7d203959fbf4ad5d9488b | [
"BSD-3-Clause"
] | null | null | null | YEAR_CHOICES = (
(1,'First'),
(2,'Second'),
(3,'Third'),
(4,'Fourth'),
(5,'Fifth'),
)
| 13.5 | 18 | 0.407407 | 12 | 108 | 3.583333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064935 | 0.287037 | 108 | 7 | 19 | 15.428571 | 0.493506 | 0 | 0 | 0 | 0 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7803f130f9b8bb6274cf1157d46b8e72bc9d9ac | 287 | py | Python | dit/other/__init__.py | chebee7i/dit | 59626e34c7938fddeec140522dd2a592ba4f42ef | [
"BSD-2-Clause"
] | null | null | null | dit/other/__init__.py | chebee7i/dit | 59626e34c7938fddeec140522dd2a592ba4f42ef | [
"BSD-2-Clause"
] | null | null | null | dit/other/__init__.py | chebee7i/dit | 59626e34c7938fddeec140522dd2a592ba4f42ef | [
"BSD-2-Clause"
] | null | null | null | """
Esoteric measures of information, typically fairly divorced from Shannon's
measures.
"""
from .cumulative_residual_entropy import *
from .extropy import extropy
from .perplexity import perplexity
from .renyi_entropy import renyi_entropy
from .tsallis_entropy import tsallis_entropy
| 26.090909 | 74 | 0.832753 | 36 | 287 | 6.472222 | 0.5 | 0.167382 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114983 | 287 | 10 | 75 | 28.7 | 0.917323 | 0.292683 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
e781a143b24022f2dcffe02d524452bd42cdb9f1 | 1,253 | py | Python | flexi/xml/serializer_registry.py | netaneld122/flexi | 03e564356cb3e4434cd2050624afa1a5f56bd99a | [
"MIT"
] | null | null | null | flexi/xml/serializer_registry.py | netaneld122/flexi | 03e564356cb3e4434cd2050624afa1a5f56bd99a | [
"MIT"
] | null | null | null | flexi/xml/serializer_registry.py | netaneld122/flexi | 03e564356cb3e4434cd2050624afa1a5f56bd99a | [
"MIT"
] | null | null | null | import lxml.etree
from flexi.xml.exceptions import UnsupportedElementException
from flexi.xml.exceptions import UnsupportedPythonTypeException
# Utility functions for xml elements filtering
def lower_dict(d):
return dict((key.lower(), d[key].lower()) for key in d)
def attributes_subset_of(attributes_a, attributes_b):
return lower_dict(attributes_a).viewitems() <= lower_dict(attributes_b).viewitems()
def tags_match(tag_a, tag_b):
return tag_a.lower().strip() == tag_b.lower().strip()
# Registry of serializers
# flexi.xml.matches decorators fill this list
xml_serializers = []
def get_xml_serializer(element):
for xml_serializer in xml_serializers:
if not tags_match(element.tag, xml_serializer.xml_element.tag):
continue
if not attributes_subset_of(xml_serializer.xml_element.attrib, element.attrib):
continue
return xml_serializer()
raise UnsupportedElementException(lxml.etree.tostring(element, pretty_print=True))
# flexi.xml.matches decorators fill this dict
tree_serializers = {}
def get_tree_serializer(value):
if type(value) not in tree_serializers:
raise UnsupportedPythonTypeException(type(value))
return tree_serializers[type(value)]()
| 26.659574 | 87 | 0.752594 | 161 | 1,253 | 5.652174 | 0.329193 | 0.071429 | 0.026374 | 0.048352 | 0.134066 | 0.072527 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157223 | 1,253 | 46 | 88 | 27.23913 | 0.861742 | 0.124501 | 0 | 0.086957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0.130435 | 0.130435 | 0.565217 | 0.043478 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e785b3be6e87a6ac65e2125dcfad43785cdbddfd | 26,003 | py | Python | assignment 5/hw5/submit_hw5.py | dhruvgairola/linearAlgebra-coursera | 20109133b9e53a7a38cbd17d8ca1fa1316bbf0d3 | [
"MIT"
] | 6 | 2015-09-18T02:07:21.000Z | 2020-04-22T17:05:11.000Z | submit_hw5.py | tri2sing/LinearAlgebraPython | f3dde94f02f146089607eb520ebd4467becb5f9e | [
"Apache-2.0"
] | null | null | null | submit_hw5.py | tri2sing/LinearAlgebraPython | f3dde94f02f146089607eb520ebd4467becb5f9e | [
"Apache-2.0"
] | 10 | 2015-09-05T03:54:00.000Z | 2020-04-21T12:56:40.000Z | # version code 941
######## ########
# Hi there, curious student. #
# #
# This submission script runs some tests on your #
# code and then uploads it to Coursera for grading. #
# #
# Changing anything in this script might cause your #
# submissions to fail. #
######## ########
import io, os, sys, doctest, traceback, importlib, urllib.request, urllib.parse, urllib.error, base64, hashlib, random, ast
SUBMIT_VERSION = "941"
URL = 'matrix-001'
part_friendly_names = ['Iterative Exchange Lemma', 'Another Iterative Exchange Lemma', 'Morph Lemma Coding', 'Row and Column Rank Practice', 'My Is Independent Procedure', 'Subset Basis', 'My Rank', 'Direct Sum Validity', 'Direct Sum Unique Representation', 'Is Invertible Function', 'Inverse of a Matrix over GF(2)', 'Inverse of a Triangular Matrix']
groups = [[('ikTo4RnnZJT4gzCi9374j37KggFkFnBz', 'Iterative Exchange Lemma', '>>> from solver import solve\n>>> from vec import Vec\n>>> from vecutil import list2vec\n>>> import independence\n>>> w0 = list2vec([1,0,0])\n>>> w1 = list2vec([0,1,0])\n>>> w2 = list2vec([0,0,1])\n>>> v0 = list2vec([1,2,3])\n>>> v1 = list2vec([1,3,3])\n>>> v2 = list2vec([0,3,3])\n>>> print(test_format(list(map(len, [exchange_S0, exchange_S1, exchange_S2, exchange_S3]))))\n>>> print(test_format(len(set(map(tf, exchange_S1)) & set(map(tf,[w0,w1,w2])))))\n>>> print(test_format(len(set(map(tf, exchange_S1)) & set(map(tf,[v0,v1,v2])))))\n>>> print(test_format(len(set(map(tf, exchange_S2)) & set(map(tf,[w0,w1,w2])))))\n>>> print(test_format(len(set(map(tf, exchange_S2)) & set(map(tf,[v0,v1,v2])))))\n>>> es = [exchange_S0, exchange_S1, exchange_S2, exchange_S3]\n>>> print(test_format(list(map(independence.is_independent, es))))\n')], [('ikTo4RnnZJT4gzCiU8r9hKTHrA1ZyViy', 'Another Iterative Exchange Lemma', '>>> from solver import solve\n>>> from vec import Vec\n>>> import independence\n>>> from vecutil import list2vec\n>>> from GF2 import one\n>>> w0 = list2vec([0,one,0])\n>>> w1 = list2vec([0,0,one])\n>>> w2 = list2vec([one,one,one])\n>>> v0 = list2vec([one,0,one])\n>>> v1 = list2vec([one,0,0])\n>>> v2 = list2vec([one,one,0])\n>>> print(test_format(list(map(len, [exchange_2_S0, exchange_2_S1, exchange_2_S2, exchange_2_S3]))))\n>>> print(test_format(len(set(map(tf, exchange_2_S1)) & set(map(tf,[w0,w1,w2])))))\n>>> print(test_format(len(set(map(tf, exchange_2_S1)) & set(map(tf,[v0,v1,v2])))))\n>>> print(test_format(len(set(map(tf, exchange_2_S2)) & set(map(tf,[w0,w1,w2])))))\n>>> print(test_format(len(set(map(tf, exchange_2_S2)) & set(map(tf,[v0,v1,v2])))))\n>>> es = [exchange_2_S0, exchange_2_S1, exchange_2_S2, exchange_2_S3]\n>>> print(test_format([independence.is_independent(e) for e in es]))\n')], [('ikTo4RnnZJT4gzCi4XeYoFwOTWCdATpi', 'Morph Lemma Coding', '>>> from vecutil import list2vec\n>>> from independence import rank\n>>> S = [list2vec(v) for v in [[2,4,0],[1,0,3],[0,4,4],[1,1,1]]]\n>>> B = [list2vec(v) for v in [[1,0,0],[0,1,0],[0,0,1]]]\n>>> m = morph(S, B)\n>>> injs, ejs = zip(*m)\n>>> print(test_format(S))\n>>> print(test_format([rank([x for x in S+list(injs[:i]) if x not in ejs[:i]]) for i in range(len(m))]))\n>>> print(test_format([(x in [y for y in injs if y not in ejs]) for x in B]))\n>>> S = [list2vec(v) for v in [[1,0,0,0],[0,3,0,0],[2,0,9,0],[0,2,0,1],[0,0,0,4]]]\n>>> B = [list2vec(v) for v in [[3,0,0,0],[0,7,0,0],[0,0,2,0],[0,0,0,6]]]\n>>> m = morph(S, B)\n>>> injs, ejs = zip(*m)\n>>> print(test_format([rank([x for x in S+list(injs[:i]) if x not in ejs[:i]]) for i in range(len(m))]))\n>>> print(test_format([(x in [y for y in injs if y not in ejs]) for x in B]))\n')], [('ikTo4RnnZJT4gzCicL0au22tGBfpPuPh', 'Row and Column Rank Practice, Part 1', '>>> import independence\n>>> from matutil import coldict2mat\n>>> from vecutil import list2vec \n>>> print(test_format(independence.is_independent(row_space_1)))\n>>> print(test_format(independence.rank(row_space_1)))\n>>> A = coldict2mat(row_space_1)\n>>> x =(list2vec([1,1,1]) - A*solve(A, list2vec([1,1,1])))\n>>> print(test_format(x*x < 1E-15))\n'), ('ikTo4RnnZJT4gzCisG3apsIrG7mV0uGC', 'Row and Column Rank Practice, Part 2', '>>> import independence\n>>> from matutil import coldict2mat\n>>> from vecutil import list2vec \n>>> print(test_format(independence.is_independent(col_space_1)))\n>>> print(test_format(independence.rank(col_space_1)))\n>>> A = coldict2mat(col_space_1)\n>>> x =(list2vec([1,1]) - A*solve(A, list2vec([1,1])))\n>>> print(test_format(x*x < 1E-15))\n'), ('ikTo4RnnZJT4gzCiKV9RTcf4fnnBnULX', 'Row and Column Rank Practice, Part 3', '>>> import independence\n>>> from matutil import coldict2mat\n>>> from vecutil import list2vec \n>>> print(test_format(independence.is_independent(row_space_2)))\n>>> print(test_format(independence.rank(row_space_2)))\n>>> A = coldict2mat(row_space_2)\n>>> x =(list2vec([1,1,1,1]) - A*solve(A, list2vec([1,1,1,1])))\n>>> print(test_format(x*x < 1E-15))\n'), ('ikTo4RnnZJT4gzCiJs86NKatUNhENDp1', 'Row and Column Rank Practice, Part 4', '>>> import independence\n>>> from matutil import coldict2mat\n>>> from vecutil import list2vec \n>>> print(test_format(independence.is_independent(col_space_2)))\n>>> print(test_format(independence.rank(col_space_2)))\n>>> A = coldict2mat(col_space_2)\n>>> x =(list2vec([1,1,1]) - A*solve(A, list2vec([1,1,1])))\n>>> print(test_format(x*x < 1E-15))\n'), ('ikTo4RnnZJT4gzCiQPscHcpNbgIu0acT', 'Row and Column Rank Practice, Part 5', '>>> import independence\n>>> from matutil import coldict2mat\n>>> from vecutil import list2vec \n>>> print(test_format(independence.is_independent(row_space_3)))\n>>> print(test_format(independence.rank(row_space_3)))\n>>> A = coldict2mat(row_space_3)\n>>> x =(list2vec([1]) - A*solve(A, list2vec([1])))\n>>> print(test_format(x*x < 1E-15))\n'), ('ikTo4RnnZJT4gzCijdpk57hlKnRunpLK', 'Row and Column Rank Practice, Part 6', '>>> import independence\n>>> from matutil import coldict2mat\n>>> from vecutil import list2vec \n>>> print(test_format(independence.is_independent(col_space_3)))\n>>> print(test_format(independence.rank(col_space_3)))\n>>> A = coldict2mat(col_space_3)\n>>> x =(list2vec([1,1,1]) - A*solve(A, list2vec([1,1,1])))\n>>> print(test_format(x*x < 1E-15))\n'), ('ikTo4RnnZJT4gzCixAyv0O1i7oPY9YJV', 'Row and Column Rank Practice, Part 7', '>>> import independence\n>>> from matutil import coldict2mat\n>>> from vecutil import list2vec \n>>> print(test_format(independence.is_independent(row_space_4)))\n>>> print(test_format(independence.rank(row_space_4)))\n>>> A = coldict2mat(row_space_4)\n>>> x =(list2vec([1,1]) - A*solve(A, list2vec([1,1])))\n>>> print(test_format(x*x < 1E-15))\n'), ('ikTo4RnnZJT4gzCiG7oDHFsETjfUQf61', 'Row and Column Rank Practice, Part 8', '>>> import independence\n>>> from matutil import coldict2mat\n>>> from vecutil import list2vec \n>>> print(test_format(independence.is_independent(col_space_4)))\n>>> print(test_format(independence.rank(col_space_4)))\n>>> A = coldict2mat(col_space_4)\n>>> x =(list2vec([1,1,1]) - A*solve(A, list2vec([1,1,1])))\n>>> print(test_format(x*x < 1E-15))\n')], [('ikTo4RnnZJT4gzCiTaizIiN0APYs8nr8', 'My Is Independent Procedure', '>>> import independence\n>>> independence.is_independent.__calls__ = 0\n>>> print(test_format(my_is_independent([list2vec(v) for v in [[1,0,0],[0,1,0],[0,0,1]]])))\n>>> print(test_format(my_is_independent([list2vec(v) for v in [[1,0,0],[0,1,0],[0,1,1]]])))\n>>> print(test_format(my_is_independent([list2vec(v) for v in [[1,0,0],[0,1,0],[1,1,1]]])))\n>>> print(test_format(my_is_independent([list2vec(v) for v in [[1,0,0],[0,1,0],[1,1,0]]])))\n>>> print(test_format(my_is_independent([list2vec(v) for v in [[1]]])))\n>>> from GF2 import one\n>>> print(test_format(my_is_independent([list2vec(v) for v in [[one,0,0,one],[one,one,one,0],[0,one,0,one]]])))\n>>> print(test_format(my_is_independent([list2vec(v) for v in [[one,one,one,one],[one,0,one,one],[0,one,0,0]]])))\n>>> print(test_format(independence.is_independent.__calls__))\n')], [('ikTo4RnnZJT4gzCi74CF90AgCuncUw8L', 'Subset Basis', ">>> from vec import Vec\n>>> a0 = Vec({'a','b','c','d'}, {'a':1})\n>>> a1 = Vec({'a','b','c','d'}, {'b':1})\n>>> a2 = Vec({'a','b','c','d'}, {'c':1})\n>>> a3 = Vec({'a','b','c','d'}, {'a':1,'c':3})\n>>> print(test_format(subset_basis([a0,a1,a2,a3])))\n>>> print(test_format(subset_basis([a0,a3,a1,a2])))\n")], [('ikTo4RnnZJT4gzCiFHQD6oJoQyLhtRhT', 'My Rank', '>>> from vec import Vec\n>>> import independence\n>>> independence.rank.__calls__ = 0\n>>> independence.is_independent.__calls__ = 0\n>>> print(test_format(independence.rank([])))\n>>> L = [Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 21, 1: 21, 2: 15, 3: 30, 4: 1, 5: 16, 6: 15, 7: 13, 8: 20, 9: 7}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 20, 1: 7, 2: 9, 3: 11, 4: 24, 5: 24, 6: 15, 7: 10, 8: 30, 9: 8}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 12, 1: 24, 2: 15, 3: 3, 4: 1, 5: 13, 6: 22, 7: 26, 8: 15, 9: 28}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 13, 1: 16, 2: 25, 3: 2, 4: 21, 5: 2, 6: 10, 7: 12, 8: 24, 9: 18}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 24, 1: 16, 2: 11, 3: 17, 4: 20, 5: 28, 6: 4, 7: 2, 8: 13, 9: 7}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 14, 1: 6, 2: 5, 3: 20, 4: 23, 5: 2, 6: 29, 7: 29, 8: 17, 9: 14}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 10, 1: 5, 2: 9, 3: 24, 4: 7, 5: 16, 6: 17, 7: 27, 8: 29, 9: 1}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 3, 1: 19, 2: 14, 3: 18, 4: 22, 5: 10, 6: 16, 7: 17, 8: 25, 9: 16}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 23, 1: 16, 2: 28, 3: 12, 4: 16, 5: 16, 6: 10, 7: 12, 8: 12, 9: 20}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 28, 1: 5, 2: 21, 3: 9, 4: 10, 5: 27, 6: 15, 7: 30, 8: 27, 9: 19}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 12, 1: 11, 2: 24, 3: 4, 4: 14, 5: 27, 6: 23, 7: 24, 8: 6, 9: 10}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 6, 1: 14, 2: 20, 3: 5, 4: 27, 5: 15, 6: 8, 7: 8, 8: 1, 9: 26}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 23, 1: 13, 2: 28, 3: 21, 4: 8, 5: 18, 6: 25, 7: 12, 8: 12, 9: 21}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 7, 1: 11, 2: 19, 3: 24, 4: 18, 5: 17, 6: 5, 7: 0, 8: 18, 9: 4}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 25, 1: 24, 2: 21, 3: 3, 4: 30, 5: 21, 6: 17, 7: 3, 8: 9, 9: 9}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 10, 1: 22, 2: 4, 3: 19, 4: 6, 5: 25, 6: 27, 7: 21, 8: 14, 9: 7}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 27, 1: 1, 2: 21, 3: 0, 4: 19, 5: 10, 6: 16, 7: 0, 8: 3, 9: 4}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 12, 1: 6, 2: 7, 3: 30, 4: 26, 5: 6, 6: 23, 7: 18, 8: 22, 9: 26}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 27, 1: 15, 2: 19, 3: 20, 4: 1, 5: 15, 6: 6, 7: 6, 8: 4, 9: 4}), Vec({0, 1, 2, 3, 4, 5, 6, 7, 8, 9},{0: 6, 1: 18, 2: 12, 3: 27, 4: 23, 5: 13, 6: 13, 7: 21, 8: 13, 9: 14})]\n>>> print(test_format(my_rank(L)))\n>>> L = [Vec({0, 1, 2},{0: 1, 1: 0, 2: 0}), Vec({0, 1, 2},{0: 0, 1: 2, 2: 0}), Vec({0, 1, 2},{0: 0, 1: 0, 2: 2}), Vec({0, 1, 2},{0: 1, 1: 0, 2: 1})]\n>>> print(test_format(my_rank(L)))\n>>> print(test_format(independence.rank.__calls__ - independence.is_independent.__calls__ < 0))\n')], [('ikTo4RnnZJT4gzCiGikUmXaRhxBTXbD2', 'Direct Sum Validity, Part 1', '>>> print(test_format(only_share_the_zero_vector_1))\n'), ('ikTo4RnnZJT4gzCiF5iUMzJrxwjJrgXK', 'Direct Sum Validity, Part 2', '>>> print(test_format(only_share_the_zero_vector_2))\n'), ('ikTo4RnnZJT4gzCiu9YmBZJGWB19JHOA', 'Direct Sum Validity, Part 3', '>>> print(test_format(only_share_the_zero_vector_3))\n')], [('ikTo4RnnZJT4gzCiY6uQO7PyIvdw3ShY', 'Direct Sum Unique Representation', '>>> from vec import Vec\n>>> d = {0,1,2,3,4,5}\n>>> dikt = lambda o: dict(enumerate(o))\n>>> u_basis = [Vec(d, dikt(f)) for f in [(2,1,0,0,6,0),(11,5,0,0,1,0),(3,1.5,0,0,7.5,0)]]\n>>> v_basis = [Vec(d, dikt(f)) for f in [(0,0,7,0,0,1),(0,0,15,0,0,2)]]\n>>> w1 = Vec(d, {0:2, 1:5, 4:1})\n>>> w2 = Vec(d, {2:3, 5:-4})\n>>> w3 = Vec(d, {0:1, 1:2, 4:2, 5:1})\n>>> w4 = Vec(d, {0:-6, 1:2, 2:4, 4:4, 5:5})\n>>> print(test_format(direct_sum_decompose(u_basis, v_basis, w1)))\n>>> print(test_format(direct_sum_decompose(u_basis, v_basis, w2)))\n>>> print(test_format(direct_sum_decompose(u_basis, v_basis, w3)))\n>>> print(test_format(direct_sum_decompose(u_basis, v_basis, w4)))\n')], [('ikTo4RnnZJT4gzCisePwrVxfXVpiAXYy', 'Is Invertible Function', '>>> A = Mat(({0, 1}, {0, 1, 2}), {(0, 1): 2, (1, 2): 1, (0, 0): 1, (1, 0): 3, (0, 2): 3, (1, 1): 1})\n>>> B = Mat(({0, 1, 2, 3}, {0, 1, 2, 3}), {(0, 1): 0, (1, 2): 1, (3, 2): 0, (0, 0): 1, (3, 3): 4, (3, 0): 0, (3, 1): 0, (1, 1): 2, (2, 1): 0, (0, 2): 1, (2, 0): 0, (1, 3): 0, (2, 3): 1, (2, 2): 3, (1, 0): 0, (0, 3): 0})\n>>> C = Mat(({0, 1, 2}, {0, 1}), {(0, 1): 0, (2, 0): 2, (0, 0): 1, (1, 0): 0, (1, 1): 1, (2, 1): 1})\n>>> D = Mat(({0, 1, 2}, {0, 1, 2}), {(0, 1): 5, (1, 2): 2, (0, 0): 1, (2, 0): 4, (1, 0): 2, (2, 2): 7, (0, 2): 8, (2, 1): 6, (1, 1): 5})\n>>> E = Mat(({0, 1, 2, 3, 4}, {0, 1, 2, 3, 4}), {(1, 2): 7, (3, 2): 7, (0, 0): 3, (3, 0): 1, (0, 4): 3, (1, 4): 2, (1, 3): 4, (2, 3): 0, (2, 1): 56, (2, 4): 5, (4, 2): 6, (1, 0): 2, (0, 3): 7, (4, 0): 2, (0, 1): 5, (3, 3): 4, (4, 1): 4, (3, 1): 23, (4, 4): 5, (0, 2): 7, (2, 0): 2, (4, 3): 8, (2, 2): 9, (3, 4): 2, (1, 1): 4})\n>>> print(test_format(is_invertible(A)))\n>>> print(test_format(is_invertible(B)))\n>>> print(test_format(is_invertible(C)))\n>>> print(test_format(is_invertible(D)))\n>>> print(test_format(is_invertible(E)))\n')], [('ikTo4RnnZJT4gzCihpi0EGyxJVEXZ7SN', 'Inverse of a Matrix over GF(2)', '>>> from matutil import listlist2mat\n>>> from GF2 import one\n>>> I5 = [[one]+[0]*4, [0,one,0,0,0], [0,0,one,0,0], [0,0,0,one,0], [0,0,0,0,one]]\n>>> M5 = Mat(({0, 1, 2, 3, 4}, {0, 1, 2, 3, 4}), {(1, 2): 0, (3, 2): 0, (0, 0): one, (3, 0): 0, (0, 4): 0, (1, 4): 0, (1, 3): 0, (2, 3): 0, (2, 1): 0, (2, 4): 0, (4, 2): 0, (1, 0): 0, (0, 3): 0, (4, 0): 0, (0, 1): 0, (3, 3): one, (4, 1): 0, (3, 1): 0, (4, 4): one, (0, 2): 0, (2, 0): 0, (4, 3): 0, (2, 2): one, (3, 4): 0, (1, 1): one})\n>>> print(test_format(find_matrix_inverse(M5)))\n>>> M2 = listlist2mat([list(map(sum,zip(I5[0],I5[1]))), I5[1], I5[2], I5[3], I5[4]])\n>>> N = find_matrix_inverse(M2)\n>>> print(test_format(M2 * N == M5))\n>>> print(test_format(M2 == N))\n>>> M3 = listlist2mat([I5[0], I5[2], I5[1], I5[3], I5[4]])\n>>> N = find_matrix_inverse(M3)\n>>> print(test_format(M3 * N == M5))\n>>> print(test_format(M3 == M2))\n>>> M23 = M2 * M3\n>>> N23 = find_matrix_inverse(M23)\n>>> print(test_format(M23 * N23 == M5))\n>>> print(test_format(N23))\n>>> M233 = M23 * M3\n>>> N233 = find_matrix_inverse(M233)\n>>> print(test_format(N233))\n>>> buckets = {0:[27,14,15,6,3,29,20,7,1,0,21,22,16,12,23,26],1:[21,19,0,5,13,2,17,6,12,25,3,4,9,27],2:[6,24,7,13,4,5,17,28,8,3,20,0],3:[2,23,11,17,4,29,10,13,7,24,12,1,18,21,26,28,8,9],4:[10,5,16,12,17,11,7,15,9,0,19,23,26,1,8,27,22,20,2,29],5:[24,21,10,20,0,6,15,28,5,18,14,23,16,12,25],6:[9,28,23,14,29,1,27,15,6,21,7,13,16,4,17,5],7:[5,2,15,29,26,6,19,28,11,20,13,14],8:[24,18,6,0,1,27,15,2,28,22,10,11],9:[0,21,9,19,7,8,29,18,15,28,17,5,26,3,16,13,23,11,24,12,1,22],10:[8,14,9,15,26,16,12,27,13,23,10,20,0,6,21,1,28],11:[5,22,27,16,9,14,7,18,6,28,0,10,20,2,24,17],12:[17,28,27,18,29,20,10,1,12,11,22,2,4,25,5,14,15],13:[13,26,3,12,11,10,29,15,28,8,27],14:[1,21,19,26,27,14,4,15,2,13],15:[11,4,16,25,8,14,29,15,23,22],16:[6,19,1,11,2,0,13,4,26,14,27,18],17:[25,13,18,24,5,10,16,4,9,2,23,8,1,0,21,26,19],18:[4,10,25,5,11,2,23,14,29,20,0,15,26,1],19:[19,4,24,18,7,27,12,21,26,15,0,20,29,17,2,22,11,25,10],20:[25,20,14,26,0,28,22,29,23,2,9,16,3,10,12,17,11],21:[6,15,5,14,26,23,3,12,21,10,19],22:[19,6,25,16,10,13,17,11,5,8,28,3,9,29,27,14,24],23:[28,6,27,18,8,11,23,0,25,10,22,3,24,17,2,15,4,16,29,14],24:[27,8,28,15,2,22,16,3,10,4,24,11,5,25,6,13,0],25:[15,3,28,27,2,11,1,10,0,4,20,9,5,29,18,8],26:[24,13,20,10,21,0,14,1,29,8,7,26,16,15,9,27,22],27:[21,6,24,12,16,5,10,19,14,18,4],28:[7,1,26,5,24,11,13,25,4,15,28,18,22,20,19,21,12,9,0],29:[26,16,8,10,21,2,15,20,1,7,13,18,12,24]}\n>>> keys = [(k,v) for k in buckets for v in buckets[k]]\n>>> M = Mat((set(range(30)),)*2, {k:one for k in keys})\n>>> N = find_matrix_inverse(M)\n>>> print(test_format([(1 if N[x] == one else 0) for x in [(0, 22), (18, 12), (17, 22), (23, 24), (4, 7), (9, 22)]]))\n')], [('ikTo4RnnZJT4gzCif1nv2o6uJGOYafNs', 'Inverse of a Triangular Matrix', '>>> from mat import Mat\n>>> A = Mat(({0, 1, 2, 3}, {0, 1, 2, 3}), {(0, 1): 2, (1, 2): 3, (3, 2): 0, (0, 0): 1, (3, 3): 4, (3, 0): 0, (3, 1): 0, (1, 1): 2, (2, 1): 0, (0, 2): 3, (2, 0): 0, (1, 3): 4, (2, 3): 4, (2, 2): 3, (1, 0): 0, (0, 3): 4})\n>>> B = Mat(({0, 1, 2, 3}, {0, 1, 2, 3}), {(0, 1): 4, (1, 2): 5, (3, 2): 0, (0, 0): 7, (3, 3): 4, (3, 0): 0, (3, 1): 0, (1, 1): 2, (2, 1): 0, (0, 2): 2, (2, 0): 0, (1, 3): 6, (2, 3): 4, (2, 2): 7, (1, 0): 0, (0, 3): 5})\n>>> C = Mat(({0, 1, 2, 3}, {0, 1, 2, 3}), {(0, 1): 3, (1, 2): 6, (3, 2): 0, (0, 0): 6, (3, 3): 2345, (3, 0): 0, (3, 1): 0, (1, 1): 4, (2, 1): 0, (0, 2): 4, (2, 0): 0, (1, 3): 23, (2, 3): 2, (2, 2): 6, (1, 0): 0, (0, 3): 8})\n>>> print(test_format(find_triangular_matrix_inverse(A)))\n>>> print(test_format(find_triangular_matrix_inverse(B)))\n>>> print(test_format(find_triangular_matrix_inverse(C)))\n')]]
source_files = ['hw5.py'] * len(sum(groups,[]))
try:
import hw5 as solution
test_vars = vars(solution).copy()
except Exception as exc:
print(exc)
print("!! It seems like you have an error in your stencil file. Please fix before submitting.")
sys.exit(1)
def find_lines(varname):
return list(filter(lambda l: varname in l, list(open("python_lab.py"))))
def find_line(varname):
ls = find_lines(varname)
return ls[0] if len(ls) else None
def use_comprehension(varname):
lines = find_lines(varname)
for line in lines:
try:
if "comprehension" in ast.dump(ast.parse(line)):
return True
except: pass
return False
def double_comprehension(varname):
line = find_line(varname)
return ast.dump(ast.parse(line)).count("comprehension") == 2
def line_contains_substr(varname, word):
lines = find_line(varname)
for line in lines:
if word in line:
return True
return False
def test_format(obj, precision=6):
tf = lambda o: test_format(o, precision)
delimit = lambda o: ', '.join(o)
otype = type(obj)
if otype is str:
return "'%s'" % obj
elif otype is float or otype is int:
if otype is int:
obj = float(obj)
if -0.000001 < obj < 0.000001:
obj = 0.0
fstr = '%%.%df' % precision
return fstr % obj
elif otype is set:
if len(obj) == 0:
return 'set()'
return '{%s}' % delimit(sorted(map(tf, obj)))
elif otype is dict:
return '{%s}' % delimit(sorted(tf(k)+': '+tf(v) for k,v in obj.items()))
elif otype is list:
return '[%s]' % delimit(map(tf, obj))
elif otype is tuple:
return '(%s%s)' % (delimit(map(tf, obj)), ',' if len(obj) is 1 else '')
elif otype.__name__ in ['Vec','Mat']:
entries = tf({x:obj.f[x] for x in obj.f if tf(obj.f[x]) != tf(0)})
return '%s(%s, %s)' % (otype.__name__, test_format(obj.D), entries)
else:
return str(obj)
def output(tests):
dtst = doctest.DocTestParser().get_doctest(tests, test_vars, 0, '<string>', 0)
runner = ModifiedDocTestRunner()
runner.run(dtst)
return runner.results
test_vars['test_format'] = test_vars['tf'] = test_format
test_vars['find_lines'] = find_lines
test_vars['find_line'] = find_line
test_vars['use_comprehension'] = use_comprehension
test_vars['double_comprehension'] = double_comprehension
test_vars['line_contains_substr'] = line_contains_substr
base_url = '://class.coursera.org/%s/assignment/' % URL
protocol = 'https'
colorize = False
verbose = False
class ModifiedDocTestRunner(doctest.DocTestRunner):
def __init__(self, *args, **kwargs):
self.results = []
return super(ModifiedDocTestRunner, self).__init__(*args, checker=OutputAccepter(), **kwargs)
def report_success(self, out, test, example, got):
self.results.append(got)
def report_unexpected_exception(self, out, test, example, exc_info):
exf = traceback.format_exception_only(exc_info[0], exc_info[1])[-1]
self.results.append(exf)
class OutputAccepter(doctest.OutputChecker):
def check_output(self, want, got, optionflags):
return True
def submit(parts_string, login, password):
print('= Coding the Matrix Homework and Lab Submission')
if not login:
login = login_prompt()
if not password:
password = password_prompt()
if not parts_string:
parts_string = parts_prompt()
parts = parse_parts(parts_string)
if not all([parts, login, password]):
return
for sid, name, part_tests in parts:
sys.stdout.write('== Submitting "%s"' % name)
if 'DEV' in os.environ: sid += '-dev'
(login, ch, state, ch_aux) = get_challenge(login, sid)
if not all([login, ch, state]):
print(' !! Error: %s\n' % login)
return
# to stop Coursera's strip() from doing anything, we surround in parens
results = output(part_tests)
prog_out = '(%s)' % ''.join(map(str.rstrip, results))
token = challenge_response(login, password, ch)
src = source(sid)
feedback = submit_solution(login, token, sid, prog_out, src, state, ch_aux)
if len(feedback.strip()) > 0:
if colorize:
good = 'incorrect' not in feedback.lower()
print(': \033[1;3%dm%s\033[0m' % (2 if good else 1, feedback.strip()))
else:
print(': %s' % feedback.strip())
if verbose:
for t, r in zip(part_tests.split('\n'), results):
sys.stdout.write('%s\n%s' % (t, r))
sys.stdout.write('\n\n')
def login_prompt():
return input('Login email address: ')
def password_prompt():
return input("One-time password from the assignment page (NOT your own account's password): ")
def parts_prompt():
print('These are the assignment parts that you can submit:')
for i, name in enumerate(part_friendly_names):
print(' %d) %s' % (i+1, name))
return input('\nWhich parts do you want to submit? (Ex: 1, 4-7): ')
def parse_parts(string):
def extract_range(s):
s = s.split('-')
if len(s) == 1: return [int(s[0])]
else: return list(range(int(s[0]), 1+int(s[1])))
parts = map(extract_range, string.split(','))
flat_parts = sum(parts, [])
return sum(list(map(lambda p: groups[p-1], flat_parts)),[])
def get_challenge(email, sid):
"""Gets the challenge salt from the server. Returns (email,ch,state,ch_aux)."""
params = {'email_address': email, 'assignment_part_sid': sid, 'response_encoding': 'delim'}
challenge_url = '%s%schallenge' % (protocol, base_url)
data = urllib.parse.urlencode(params).encode('utf-8')
req = urllib.request.Request(challenge_url, data)
resp = urllib.request.urlopen(req)
text = resp.readall().decode('utf-8').strip().split('|')
if len(text) != 9:
print(' !! %s' % '|'.join(text))
sys.exit(1)
return tuple(text[x] for x in [2,4,6,8])
def challenge_response(email, passwd, challenge):
return hashlib.sha1((challenge+passwd).encode('utf-8')).hexdigest()
def submit_solution(email_address, ch_resp, sid, output, source, state, ch_aux):
b64ize = lambda s: str(base64.encodebytes(s.encode('utf-8')), 'ascii')
values = { 'assignment_part_sid' : sid
, 'email_address' : email_address
, 'submission' : b64ize(output)
, 'submission_aux' : b64ize(source)
, 'challenge_response' : ch_resp
, 'state' : state
}
submit_url = '%s%ssubmit' % (protocol, base_url)
data = urllib.parse.urlencode(values).encode('utf-8')
req = urllib.request.Request(submit_url, data)
response = urllib.request.urlopen(req)
return response.readall().decode('utf-8').strip()
def source(sid):
src = ['# submit version: %s' % SUBMIT_VERSION]
for fn in set(source_files):
with open(fn) as source_f:
src.append(source_f.read())
return '\n\n'.join(src)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
env = os.environ
helps = [ 'numbers or ranges of tasks to submit'
, 'the email address on your Coursera account'
, 'your ONE-TIME password'
, 'use ANSI color escape sequences'
, 'show the test\'s interaction with your code'
, 'use an encrypted connection to Coursera'
, 'use an unencrypted connection to Coursera'
]
parser.add_argument('tasks', default=env.get('COURSERA_TASKS'), nargs='*', help=helps[0])
parser.add_argument('--email', default=env.get('COURSERA_EMAIL'), help=helps[1])
parser.add_argument('--password', default=env.get('COURSERA_PASS'), help=helps[2])
parser.add_argument('--colorize', default=False, action='store_true', help=helps[3])
parser.add_argument('--verbose', default=False, action='store_true', help=helps[4])
group = parser.add_mutually_exclusive_group()
group.add_argument('--https', dest="protocol", const="https", action="store_const", help=helps[-2])
group.add_argument('--http', dest="protocol", const="http", action="store_const", help=helps[-1])
args = parser.parse_args()
if args.protocol: protocol = args.protocol
colorize = args.colorize
verbose = args.verbose
submit(','.join(args.tasks), args.email, args.password)
| 97.389513 | 16,294 | 0.588971 | 4,783 | 26,003 | 3.112482 | 0.091574 | 0.013703 | 0.0796 | 0.081682 | 0.438436 | 0.385235 | 0.331967 | 0.300665 | 0.246255 | 0.238732 | 0 | 0.132209 | 0.172442 | 26,003 | 266 | 16,295 | 97.755639 | 0.559598 | 0.022805 | 0 | 0.075758 | 0 | 0.090909 | 0.691828 | 0.28723 | 0 | 0 | 0 | 0 | 0 | 1 | 0.106061 | false | 0.065657 | 0.020202 | 0.025253 | 0.282828 | 0.050505 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e797a7a5a91026acebbea8e62cd9af74a6081d82 | 130 | py | Python | tests/http/conftest.py | cuenca-mx/facturapi-python | a81f0c6e350d3782f845269c12ed201a7b448a29 | [
"MIT"
] | 1 | 2022-01-13T23:17:10.000Z | 2022-01-13T23:17:10.000Z | tests/http/conftest.py | cuenca-mx/facturapi-python | a81f0c6e350d3782f845269c12ed201a7b448a29 | [
"MIT"
] | 58 | 2020-12-03T00:41:13.000Z | 2022-03-30T17:07:21.000Z | tests/http/conftest.py | cuenca-mx/facturapi-python | a81f0c6e350d3782f845269c12ed201a7b448a29 | [
"MIT"
] | null | null | null | import pytest
@pytest.fixture
def facturapi_creds(monkeypatch) -> None:
monkeypatch.setenv('FACTURAPI_KEY', 'some_api_key')
| 18.571429 | 55 | 0.769231 | 16 | 130 | 6 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115385 | 130 | 6 | 56 | 21.666667 | 0.834783 | 0 | 0 | 0 | 0 | 0 | 0.192308 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7be6614443324013858185616d53e02b823673b | 152 | py | Python | data/contacts.py | MikhailDr/python_training | a30ef429eb968149285ee6b59a8e04069f62f92a | [
"Apache-2.0"
] | null | null | null | data/contacts.py | MikhailDr/python_training | a30ef429eb968149285ee6b59a8e04069f62f92a | [
"Apache-2.0"
] | null | null | null | data/contacts.py | MikhailDr/python_training | a30ef429eb968149285ee6b59a8e04069f62f92a | [
"Apache-2.0"
] | null | null | null | from model.contact import Contact
testdata = [
Contact(firstname="Mikhail", lastname="Kennett"),
Contact(firstname="Lily", lastname="Watson")
] | 25.333333 | 53 | 0.717105 | 16 | 152 | 6.8125 | 0.6875 | 0.293578 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131579 | 152 | 6 | 54 | 25.333333 | 0.825758 | 0 | 0 | 0 | 0 | 0 | 0.156863 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7cdd4dc73f41ed2b84ee42ef38c2bba0c5d9e7b | 168 | py | Python | test/test_credit_calculator_full.py | Verstuk/pyton_for_testers | 67c78ba72a201126f5808dd142e3446e587e5f83 | [
"Apache-2.0"
] | null | null | null | test/test_credit_calculator_full.py | Verstuk/pyton_for_testers | 67c78ba72a201126f5808dd142e3446e587e5f83 | [
"Apache-2.0"
] | null | null | null | test/test_credit_calculator_full.py | Verstuk/pyton_for_testers | 67c78ba72a201126f5808dd142e3446e587e5f83 | [
"Apache-2.0"
] | null | null | null |
from model.group import Group
def test_calculator_2(app):
app.credit_form_case_2(Group(loan = '100000', payment='50000', term='12'))
app.session.submit() | 28 | 79 | 0.702381 | 25 | 168 | 4.52 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105634 | 0.154762 | 168 | 6 | 80 | 28 | 0.690141 | 0 | 0 | 0 | 0 | 0 | 0.079755 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7cee237e4c2e2fcc39805a7da646d27ab0850ce | 169 | py | Python | harness/python/ext/__init__.py | tonyfast/tidy-harness | 905bb7e980d1c962a3cda97d0056ca1e2e88852a | [
"BSD-3-Clause"
] | 4 | 2016-11-06T17:54:12.000Z | 2017-03-08T13:37:20.000Z | harness/python/ext/__init__.py | tonyfast/tidy-harness | 905bb7e980d1c962a3cda97d0056ca1e2e88852a | [
"BSD-3-Clause"
] | null | null | null | harness/python/ext/__init__.py | tonyfast/tidy-harness | 905bb7e980d1c962a3cda97d0056ca1e2e88852a | [
"BSD-3-Clause"
] | null | null | null |
# coding: utf-8
# In[3]:
try:
from .base import HarnessExtension
except:
from harness.python.ext.base import HarnessExtension
__all__ = ['HarnessExtension']
| 14.083333 | 56 | 0.715976 | 20 | 169 | 5.85 | 0.75 | 0.17094 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014388 | 0.177515 | 169 | 11 | 57 | 15.363636 | 0.827338 | 0.118343 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e7dd7b060a46fd4c552b6f9a551306db94f44c9a | 924 | tac | Python | 6 复试/2 笔试/4 编译原理/编原/hw/2015_刘智峰_PA/PA3/TestCases/S3/output/test_q2.tac | ladike/912_project | 5178c1c93ac6ca30ffc72dd689f5c6932704b4ab | [
"MIT"
] | 1 | 2022-03-02T16:05:49.000Z | 2022-03-02T16:05:49.000Z | 6 复试/2 笔试/4 编译原理/编原/hw/2015_刘智峰_PA/PA3/TestCases/S3/output/test_q2.tac | ladike/912_project | 5178c1c93ac6ca30ffc72dd689f5c6932704b4ab | [
"MIT"
] | null | null | null | 6 复试/2 笔试/4 编译原理/编原/hw/2015_刘智峰_PA/PA3/TestCases/S3/output/test_q2.tac | ladike/912_project | 5178c1c93ac6ca30ffc72dd689f5c6932704b4ab | [
"MIT"
] | null | null | null | VTABLE(_Main) {
<empty>
Main
}
FUNCTION(_Main_New) {
memo ''
_Main_New:
_T1 = 4
parm _T1
_T2 = call _Alloc
_T3 = VTBL <_Main>
*(_T2 + 0) = _T3
return _T2
}
FUNCTION(main) {
memo ''
main:
_T7 = 1
_T5 = _T7
_T8 = 2
_T6 = _T8
_T9 = 1
_T4 = _T9
_T10 = 3
_T11 = (_T5 + _T10)
_T12 = (_T11 >= _T6)
_T13 = 0
if (_T12 == 0) branch _L10
_T14 = (_T5 + _T6)
_T13 = _T14
branch _L11
_L10:
_T15 = (_T5 - _T6)
_T13 = _T15
_L11:
_T4 = _T13
parm _T4
call _PrintInt
_T16 = "\n"
parm _T16
call _PrintString
_T17 = 3
_T18 = (_T5 + _T17)
_T19 = (_T18 < _T6)
_T20 = 0
if (_T19 == 0) branch _L12
_T21 = (_T5 + _T6)
_T20 = _T21
branch _L13
_L12:
_T22 = (_T5 - _T6)
_T20 = _T22
_L13:
_T4 = _T20
parm _T4
call _PrintInt
_T23 = "\n"
parm _T23
call _PrintString
}
| 14.4375 | 30 | 0.508658 | 123 | 924 | 3.146341 | 0.390244 | 0.041344 | 0.036176 | 0.093023 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.216169 | 0.384199 | 924 | 63 | 31 | 14.666667 | 0.463972 | 0 | 0 | 0.133333 | 0 | 0 | 0.004334 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
99b8d573463b35d5d61ce05aadc553e07aadc157 | 1,182 | py | Python | hierarchical_auth/admin.py | digitalemagine/django-hierarchical-auth | f7523038db62e49e5a460b602ec6b7713aafb511 | [
"BSD-3-Clause"
] | 1 | 2016-03-28T23:37:14.000Z | 2016-03-28T23:37:14.000Z | hierarchical_auth/admin.py | digitalemagine/django-hierarchical-auth | f7523038db62e49e5a460b602ec6b7713aafb511 | [
"BSD-3-Clause"
] | 1 | 2020-01-21T07:59:21.000Z | 2021-03-31T18:03:05.000Z | hierarchical_auth/admin.py | digitalemagine/django-hierarchical-auth | f7523038db62e49e5a460b602ec6b7713aafb511 | [
"BSD-3-Clause"
] | 1 | 2015-08-27T15:08:41.000Z | 2015-08-27T15:08:41.000Z | from django.contrib import admin
from django.conf import settings
from django.db.models import get_model
from models import Group, User # this takes care of custom users Etc.
from django.contrib.auth.admin import GroupAdmin
try:
module_name, class_name = settings.AUTH_USER_ADMIN_CLASS.rsplit('.', 1)
mod = __import__(module_name, fromlist=[class_name])
UserAdmin = getattr(mod, class_name)
except:
from django.contrib.auth.admin import UserAdmin
UserChangeForm = UserAdmin.form
from mptt.forms import TreeNodeMultipleChoiceField
if getattr(settings, 'MPTT_USE_FEINCMS', False):
from mptt.admin import FeinCMSModelAdmin
class GroupMPTTModelAdmin(GroupAdmin, FeinCMSModelAdmin):
pass
else:
from mptt.admin import MPTTModelAdmin
class GroupMPTTModelAdmin(GroupAdmin, MPTTModelAdmin):
pass
admin.site.unregister(Group)
admin.site.register(Group, GroupMPTTModelAdmin)
class UserWithMPTTChangeForm(UserChangeForm):
groups = TreeNodeMultipleChoiceField(queryset=Group.objects.all())
class UserWithMPTTAdmin(UserAdmin):
form = UserWithMPTTChangeForm
admin.site.unregister(User)
admin.site.register(User, UserWithMPTTAdmin)
| 30.307692 | 75 | 0.790186 | 136 | 1,182 | 6.757353 | 0.411765 | 0.054407 | 0.055495 | 0.045702 | 0.069641 | 0.069641 | 0 | 0 | 0 | 0 | 0 | 0.000977 | 0.133672 | 1,182 | 38 | 76 | 31.105263 | 0.896484 | 0.030457 | 0 | 0.068966 | 0 | 0 | 0.01486 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.068966 | 0.344828 | 0 | 0.551724 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
99b8e49380df60c3065a4db1ecf679733ac5e9a8 | 570 | py | Python | pyramid_learning_journal/routes.py | ChristopherSClosser/pyramid-learning-journal | 3cd3126d24baef23c20ee75adcaf4cdc892ed71d | [
"MIT"
] | null | null | null | pyramid_learning_journal/routes.py | ChristopherSClosser/pyramid-learning-journal | 3cd3126d24baef23c20ee75adcaf4cdc892ed71d | [
"MIT"
] | 10 | 2018-03-10T18:45:50.000Z | 2018-03-15T22:39:43.000Z | pyramid_learning_journal/routes.py | ChristopherSClosser/pyramid-learning-journal | 3cd3126d24baef23c20ee75adcaf4cdc892ed71d | [
"MIT"
] | null | null | null | """Define routes."""
def includeme(config):
"""App routes."""
config.add_static_view(
'static',
'pyramid_learning_journal:static',
cache_max_age=3600
)
config.add_route('home', '/')
config.add_route('detail', '/journal/{id:\d+}')
config.add_route('new', '/journal/new-entry')
config.add_route('edit', '/journal/{id:\d+}/edit-entry')
config.add_route('delete', '/journal/{id:\d+}/delete-entry')
config.add_route('login', '/login')
config.add_route('logout', '/logout')
config.add_route('api', '/api')
| 30 | 64 | 0.612281 | 71 | 570 | 4.71831 | 0.394366 | 0.241791 | 0.334328 | 0.170149 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008457 | 0.170175 | 570 | 18 | 65 | 31.666667 | 0.699789 | 0.045614 | 0 | 0 | 0 | 0 | 0.347092 | 0.166979 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0 | 0 | 0.071429 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
99c3b936df3f1f369811639c045e03aa308c0d9b | 193 | py | Python | python-scripts/brightness.py | niwhsa9/dwmblocks | 76c617a477f2b5496f146f3f9c4e3b089a9fcebd | [
"0BSD"
] | null | null | null | python-scripts/brightness.py | niwhsa9/dwmblocks | 76c617a477f2b5496f146f3f9c4e3b089a9fcebd | [
"0BSD"
] | null | null | null | python-scripts/brightness.py | niwhsa9/dwmblocks | 76c617a477f2b5496f146f3f9c4e3b089a9fcebd | [
"0BSD"
] | null | null | null | import os
import time
max_brightness = 26666
stream = os.popen("cat /sys/class/backlight/intel_backlight/brightness")
output = int(stream.read())
print(f"{int(output/max_brightness * 100)}%")
| 24.125 | 72 | 0.756477 | 28 | 193 | 5.107143 | 0.678571 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045714 | 0.093264 | 193 | 7 | 73 | 27.571429 | 0.771429 | 0 | 0 | 0 | 0 | 0 | 0.445596 | 0.378238 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
99de3cebf779065511c4dc367d298a621db5f1d9 | 275 | py | Python | scripts/servers.py | bakketun/electrumsv | 1ed5b3d5b3f7e25d742d8634258322eee616d31a | [
"MIT"
] | null | null | null | scripts/servers.py | bakketun/electrumsv | 1ed5b3d5b3f7e25d742d8634258322eee616d31a | [
"MIT"
] | null | null | null | scripts/servers.py | bakketun/electrumsv | 1ed5b3d5b3f7e25d742d8634258322eee616d31a | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import json
import util
from electrumsv.util import disable_verbose_logging
from electrumsv.network import filter_version
disable_verbose_logging()
servers = filter_version(util.get_peers())
print(json.dumps(servers, sort_keys = True, indent = 4))
| 21.153846 | 56 | 0.807273 | 39 | 275 | 5.487179 | 0.641026 | 0.130841 | 0.196262 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00813 | 0.105455 | 275 | 12 | 57 | 22.916667 | 0.861789 | 0.076364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 0 | 0.571429 | 0.142857 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
99e5160826888dd4d6b1ccad2c75cd0fc4183404 | 535 | py | Python | Simulation/BusinessProcesses/__init__.py | AlexWorldD/NetEmbs | ea3dc5769e2feb728dac8f21ec677a9807def3df | [
"Apache-2.0"
] | 1 | 2021-09-02T16:47:27.000Z | 2021-09-02T16:47:27.000Z | Simulation/BusinessProcesses/__init__.py | AlexWorldD/NetEmbs | ea3dc5769e2feb728dac8f21ec677a9807def3df | [
"Apache-2.0"
] | null | null | null | Simulation/BusinessProcesses/__init__.py | AlexWorldD/NetEmbs | ea3dc5769e2feb728dac8f21ec677a9807def3df | [
"Apache-2.0"
] | 1 | 2019-12-25T08:38:55.000Z | 2019-12-25T08:38:55.000Z | # encoding: utf-8
__author__ = 'Aleksei Maliutin'
"""
__init__.py.py
Created by lex at 2019-03-24.
"""
from BusinessProcesses.Collections import *
from BusinessProcesses.Depreciation import *
from BusinessProcesses.Disbursements import *
from BusinessProcesses.FixedAssets import *
from BusinessProcesses.GoodsDelivery import *
from BusinessProcesses.Payroll import *
from BusinessProcesses.PayrollDisbursements import *
from BusinessProcesses.Purchase import *
from BusinessProcesses.Sale import *
from BusinessProcesses.Tax import *
| 31.470588 | 52 | 0.828037 | 56 | 535 | 7.767857 | 0.5 | 0.482759 | 0.558621 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01875 | 0.102804 | 535 | 16 | 53 | 33.4375 | 0.8875 | 0.028037 | 0 | 0 | 0 | 0 | 0.034335 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.909091 | 0 | 0.909091 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
99ff7840ef3d048850570e98c659a5694aeb8fda | 1,033 | py | Python | challenges/re/espresso/example-solution/solve.py | RTN-Team/CTF-2021-01 | 6a198e2a63e362f07c0d1253519e4db506a55be9 | [
"CC0-1.0"
] | 8 | 2021-01-26T20:00:07.000Z | 2022-02-08T02:29:13.000Z | challenges/re/espresso/example-solution/solve.py | RTN-Team/CTF-2021-01 | 6a198e2a63e362f07c0d1253519e4db506a55be9 | [
"CC0-1.0"
] | null | null | null | challenges/re/espresso/example-solution/solve.py | RTN-Team/CTF-2021-01 | 6a198e2a63e362f07c0d1253519e4db506a55be9 | [
"CC0-1.0"
] | null | null | null |
def decode_flag(value, alphabet):
# Construct inverse alphabet.
map_inv = [0]*len(alphabet)
for i in range(len(alphabet)):
map_inv[alphabet[i]] = i
# Apply.
result = bytearray()
for i in range(len(value)):
c = value[i]
if i % 2 == 1:
c -= 1
cc = map_inv[c]
result.append(cc)
return result
encoded_flag = b"UwHEpXTXskOHiHFHT9s:W:nHhQsH_tJXhQ8Pa8wm"
alphabet = bytes.fromhex("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c432e2f614741385777597533633a3b3c3d3e3f40324d2d7b4b74314e7a6445624248726778556b765271346636795b5c5d5e7360304c394a6f58506e6d70537d6968656a564f5f46375435515a49447c6c7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff")
print(decode_flag(encoded_flag, alphabet).decode("utf-8")) | 44.913043 | 540 | 0.800581 | 71 | 1,033 | 11.535211 | 0.521127 | 0.021978 | 0.034188 | 0.026862 | 0.034188 | 0 | 0 | 0 | 0 | 0 | 0 | 0.366071 | 0.132623 | 1,033 | 23 | 541 | 44.913043 | 0.547991 | 0.032914 | 0 | 0 | 0 | 0 | 0.559237 | 0.554217 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0 | 0 | 0.133333 | 0.066667 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
821482077e4debe9a8e5c3c74a2bf366ec224351 | 1,233 | py | Python | setup.py | JotaSe/text2emotion-library | 314c8cf5bdc9e3e4ac2e8267f7c689232b2e1a34 | [
"MIT"
] | 30 | 2020-09-11T04:33:55.000Z | 2022-03-24T06:58:09.000Z | setup.py | JotaSe/text2emotion-library | 314c8cf5bdc9e3e4ac2e8267f7c689232b2e1a34 | [
"MIT"
] | 4 | 2021-06-29T17:07:09.000Z | 2022-01-28T19:48:50.000Z | setup.py | JotaSe/text2emotion-library | 314c8cf5bdc9e3e4ac2e8267f7c689232b2e1a34 | [
"MIT"
] | 19 | 2020-10-09T20:07:54.000Z | 2021-12-11T11:19:52.000Z | from setuptools import setup, find_packages
def readme():
with open('README.md', encoding="utf8") as f:
README = f.read()
return README
setup(
name="Text2Emotion",
version="0.0.1",
description="Detecting emotions behind the text, Text2Emotion package will help you to understand the emotions in textual meassages.",
long_description=readme(),
long_description_content_type="text/markdown",
url="https://github.com/aman2656/Text2Emotion",
author="Text2Emotion Team",
author_email="Text2Emotion@gmail.com",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.1",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8"
],
packages=find_packages(),
install_requires=["nltk", "emoji>=0.6.0"],
include_package_data=True
)
| 34.25 | 139 | 0.618005 | 135 | 1,233 | 5.57037 | 0.533333 | 0.227394 | 0.299202 | 0.31117 | 0.071809 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035484 | 0.245742 | 1,233 | 35 | 140 | 35.228571 | 0.773118 | 0 | 0 | 0 | 0 | 0 | 0.525042 | 0.018364 | 0 | 0 | 0 | 0 | 0 | 1 | 0.032258 | false | 0 | 0.032258 | 0 | 0.096774 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8216e760ef0dbd3c59bf47999ab281efb1835af7 | 187 | py | Python | blog/apps.py | suryakc/django-rest-api | 949a17c7ab64ecc67075a1586248d87944f507d3 | [
"MIT"
] | null | null | null | blog/apps.py | suryakc/django-rest-api | 949a17c7ab64ecc67075a1586248d87944f507d3 | [
"MIT"
] | null | null | null | blog/apps.py | suryakc/django-rest-api | 949a17c7ab64ecc67075a1586248d87944f507d3 | [
"MIT"
] | null | null | null | """ Blog App """
from django.apps import AppConfig
class BlogConfig(AppConfig):
""" Blog config """
default_auto_field = 'django.db.models.BigAutoField'
name = 'blog'
| 23.375 | 57 | 0.652406 | 21 | 187 | 5.714286 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.213904 | 187 | 7 | 58 | 26.714286 | 0.816327 | 0.112299 | 0 | 0 | 0 | 0 | 0.227586 | 0.2 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
821b431f3b9a9cc3c8f1539f5eda75278cab6ec7 | 339 | py | Python | python/matrix/matrix.py | jjkeyser/exercism | c2c21eb04a6564d9d41c8b317ebec53d63e5a3e8 | [
"MIT"
] | null | null | null | python/matrix/matrix.py | jjkeyser/exercism | c2c21eb04a6564d9d41c8b317ebec53d63e5a3e8 | [
"MIT"
] | null | null | null | python/matrix/matrix.py | jjkeyser/exercism | c2c21eb04a6564d9d41c8b317ebec53d63e5a3e8 | [
"MIT"
] | null | null | null | class Matrix:
def __init__(self, matrix_string):
self.row_string = matrix_string.splitlines()
self.matrix = [[int(num) for num in row.split()] for row in self.row_string]
def row(self, index):
return self.matrix[index -1]
def column(self, index):
return [row[index -1] for row in self.matrix]
| 30.818182 | 84 | 0.643068 | 50 | 339 | 4.2 | 0.34 | 0.190476 | 0.12381 | 0.114286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007752 | 0.238938 | 339 | 10 | 85 | 33.9 | 0.806202 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0 | 0 | 0.25 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
823b8414a5ebce717cbda2f3afcb3d67b380e0ab | 182 | py | Python | mundo 1/029.py | thiagofreitascarneiro/Curso-de-Python---Curso-em-Video | 0342e482780b5a1c6f78cddd51d9bfad785c79fa | [
"MIT"
] | 1 | 2021-08-04T13:21:22.000Z | 2021-08-04T13:21:22.000Z | mundo 1/029.py | thiagofreitascarneiro/Curso-de-Python---Curso-em-Video | 0342e482780b5a1c6f78cddd51d9bfad785c79fa | [
"MIT"
] | null | null | null | mundo 1/029.py | thiagofreitascarneiro/Curso-de-Python---Curso-em-Video | 0342e482780b5a1c6f78cddd51d9bfad785c79fa | [
"MIT"
] | null | null | null | vel = int(input('digite a velocidade do carro:'))
multa = (vel - 80)*7
if vel>80:
print(f'MULTADO! você excedeu o limite permitido que é 80Km/h e vai pagar uma multa de {multa}')
| 26 | 97 | 0.692308 | 34 | 182 | 3.705882 | 0.852941 | 0.079365 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04698 | 0.181319 | 182 | 6 | 98 | 30.333333 | 0.798658 | 0 | 0 | 0 | 0 | 0.25 | 0.638889 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4134e88b2ea7ef2e868dfdd0990314fba3bb9cb3 | 25 | py | Python | libs/__init__.py | lianwutech/datasync | cd07ac854d83b859d6bffcff85a58c44cfb7f8fb | [
"Apache-2.0"
] | 1 | 2022-03-16T14:45:35.000Z | 2022-03-16T14:45:35.000Z | libs/__init__.py | lianwutech/datasync | cd07ac854d83b859d6bffcff85a58c44cfb7f8fb | [
"Apache-2.0"
] | null | null | null | libs/__init__.py | lianwutech/datasync | cd07ac854d83b859d6bffcff85a58c44cfb7f8fb | [
"Apache-2.0"
] | null | null | null | __author__ = 'daviddeng'
| 12.5 | 24 | 0.76 | 2 | 25 | 7.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 25 | 1 | 25 | 25 | 0.681818 | 0 | 0 | 0 | 0 | 0 | 0.36 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4158da6a5412871514696eb15534b043b4cdfaa8 | 236 | py | Python | bug-dist-not-found/setup.py | maphew/scraps | 01bf3e7bb3cee0fd5691eedf787fbc134059a974 | [
"MIT"
] | null | null | null | bug-dist-not-found/setup.py | maphew/scraps | 01bf3e7bb3cee0fd5691eedf787fbc134059a974 | [
"MIT"
] | null | null | null | bug-dist-not-found/setup.py | maphew/scraps | 01bf3e7bb3cee0fd5691eedf787fbc134059a974 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(name='my_project',
version='0.1.0',
packages=['my_project'],
entry_points={
'console_scripts': [
'my_project = my_project.__main__:main'
]
},
)
| 19.666667 | 52 | 0.555085 | 25 | 236 | 4.84 | 0.64 | 0.297521 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018405 | 0.309322 | 236 | 11 | 53 | 21.454545 | 0.723926 | 0 | 0 | 0 | 0 | 0 | 0.342222 | 0.106667 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.1 | 0 | 0.1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
41654482609356835382912e76e6c71daf8e0c35 | 79 | py | Python | mindware/utils/constant.py | aman-gupta-1995/Machine-Learning-Mindware | 8b3050720711730520683c89949e3dbdfb168961 | [
"MIT"
] | 27 | 2021-07-19T09:03:34.000Z | 2022-03-31T06:19:23.000Z | mindware/utils/constant.py | aman-gupta-1995/Machine-Learning-Mindware | 8b3050720711730520683c89949e3dbdfb168961 | [
"MIT"
] | 4 | 2021-07-15T12:17:10.000Z | 2022-01-26T17:16:58.000Z | mindware/utils/constant.py | aman-gupta-1995/Machine-Learning-Mindware | 8b3050720711730520683c89949e3dbdfb168961 | [
"MIT"
] | 17 | 2020-05-12T20:24:50.000Z | 2021-07-11T03:31:38.000Z | """Constants used in Integer.
"""
MAX_INT = 2 ** 31 - 1
FAILED = -2147483646.0
| 15.8 | 29 | 0.632911 | 12 | 79 | 4.083333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.234375 | 0.189873 | 79 | 4 | 30 | 19.75 | 0.53125 | 0.329114 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
41790ebe5f5f127599395f466cada873263fbe37 | 753 | py | Python | vbdiar/kaldi/python_mfcc_features_extraction.py | Honghe/VBDiarization | 7a7f941ecb5e97bab02aa939cd30eb7519d67e21 | [
"Apache-2.0"
] | null | null | null | vbdiar/kaldi/python_mfcc_features_extraction.py | Honghe/VBDiarization | 7a7f941ecb5e97bab02aa939cd30eb7519d67e21 | [
"Apache-2.0"
] | null | null | null | vbdiar/kaldi/python_mfcc_features_extraction.py | Honghe/VBDiarization | 7a7f941ecb5e97bab02aa939cd30eb7519d67e21 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import numpy as np
import speechpy
from scipy.io import wavfile
from python_speech_features import mfcc
class PythonMFCCFeatureExtraction():
def __init__(self):
pass
def audio2features(self, input_path):
(rate, sig) = wavfile.read(input_path)
mfcc_feat = mfcc(sig, dither=0, highfreq=7700, useEnergy=True, wintype='povey', numcep=23)
# TODO temporarily add 2 feats to meet Kaldi_mfcc_features_extraction API
mfcc_feat = np.append(mfcc_feat, [mfcc_feat[-1]], axis=0)
mfcc_feat = np.append(mfcc_feat, [mfcc_feat[-1]], axis=0)
mfcc_cmvn = speechpy.processing.cmvnw(mfcc_feat, win_size=301, variance_normalization=False)
return mfcc_cmvn.astype(np.float32)
| 35.857143 | 100 | 0.705179 | 104 | 753 | 4.884615 | 0.615385 | 0.125984 | 0.070866 | 0.062992 | 0.15748 | 0.15748 | 0.15748 | 0.15748 | 0.15748 | 0.15748 | 0 | 0.031097 | 0.188579 | 753 | 20 | 101 | 37.65 | 0.800327 | 0.123506 | 0 | 0.142857 | 0 | 0 | 0.00761 | 0 | 0 | 0 | 0 | 0.05 | 0 | 1 | 0.142857 | false | 0.071429 | 0.285714 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
41ad9906c1085415e4a69dffa99b0120b61435c1 | 103 | py | Python | Programmieren_in_Python_2/NumPy_matplotlib/plot_random_numbers.py | ThomasGrafCode/EF_WF_Informatik | d875189bfdb56b5989e2aa567b8e5cf8f009585e | [
"MIT"
] | null | null | null | Programmieren_in_Python_2/NumPy_matplotlib/plot_random_numbers.py | ThomasGrafCode/EF_WF_Informatik | d875189bfdb56b5989e2aa567b8e5cf8f009585e | [
"MIT"
] | null | null | null | Programmieren_in_Python_2/NumPy_matplotlib/plot_random_numbers.py | ThomasGrafCode/EF_WF_Informatik | d875189bfdb56b5989e2aa567b8e5cf8f009585e | [
"MIT"
] | null | null | null | import numpy as np
from matplotlib import pyplot as plt
N = 30
y = np.random.rand(N)
plt.plot(y,'bo') | 14.714286 | 36 | 0.708738 | 21 | 103 | 3.47619 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023529 | 0.174757 | 103 | 7 | 37 | 14.714286 | 0.835294 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
41b57894f84cea820873a10a935510ce5d26741e | 2,445 | py | Python | restdf/utils/exceptions.py | Mukhopadhyay/restdf | adeb6c188a20ecd9ee7eeafc12111e260072777e | [
"MIT"
] | 3 | 2021-11-07T10:12:48.000Z | 2021-11-11T07:06:25.000Z | restdf/utils/exceptions.py | Mukhopadhyay/restdf | adeb6c188a20ecd9ee7eeafc12111e260072777e | [
"MIT"
] | null | null | null | restdf/utils/exceptions.py | Mukhopadhyay/restdf | adeb6c188a20ecd9ee7eeafc12111e260072777e | [
"MIT"
] | null | null | null | """
Exceptions for RestDF
"""
from typing import Union, List
class Error(Exception):
"""
Base class for exceptions in this module.
"""
pass
class PathError(Error):
"""
Exception raised when there's an error in the given path.
Attributes:
path: Union[str, list]: Path which caused the exception
message: str: Explanation of the error.
"""
def __init__(self, path: Union[List[str], str], message: str) -> None:
super().__init__(f'[{self.__class__.__name__}] {message}\nPath: {path}')
self.path = path
self.message = message
def __repr__(self) -> str:
return f'[{self.__class__.__name__}] {self.message}\nPath: {self.path}'
class DataFrameError(Error):
"""
Exception raised when the read file is not a dataframe.
Attributes:
path: Union[str, list]: Path which lead to non df object.
message: str: Explanation of the error.
"""
def __init__(self, path: Union[List[str], str], message: str) -> None:
super().__init__(f'[{self.__class__.__name__}] {message}\nPath: {path}')
self.path = path
self.message = message
def __repr__(self) -> str:
return f'[{self.__class__.__name__}] {self.message}\nPath: {self.path}'
class UnknownFileTypeError(Error):
"""
Exception raised when the File extension is not known, or no such io
method exists to deal with given extension.
Attributes:
extension: str: Extension of the file.
message: str: Explanation of the error.
"""
def __init__(self, extension: str, message: str) -> None:
super().__init__(f'[{self.__class__.__name__}] {message}\nExtension: {extension}')
self.extension = extension
self.message = message
def __repr__(self) -> str:
return f'[{self.__class__.__name__}] {self.message}\nExtension: {self.extension}'
class InvalidRequestBodyError(Error):
"""
Exception raised when passed request body has invalid values in them.
Attributes:
message: str: Explanation of the error.
"""
def __init__(self, message: str) -> None:
super().__init__(f'[{self.__class__.__name__}] {message}\n')
self.message = message
def __repr__(self) -> str:
return f'[{self.__class__.__name__}] {self.message}\n'
| 30.5625 | 90 | 0.611043 | 283 | 2,445 | 4.883392 | 0.265018 | 0.071635 | 0.057887 | 0.081042 | 0.607091 | 0.568017 | 0.568017 | 0.517366 | 0.517366 | 0.456585 | 0 | 0 | 0.266258 | 2,445 | 79 | 91 | 30.949367 | 0.770346 | 0.350511 | 0 | 0.533333 | 0 | 0 | 0.301304 | 0.209334 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0.033333 | 0.033333 | 0.133333 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
41b57a8acaa54b8ec6e98947784fbd39ad2dadcd | 15,100 | py | Python | pysnmp-with-texts/TFTIF-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/TFTIF-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/TFTIF-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 TFTIF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TFTIF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:16:16 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)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint")
micom_oscar, = mibBuilder.importSymbols("MICOM-OSCAR-MIB", "micom-oscar")
mcmSysAsciiTimeOfDay, = mibBuilder.importSymbols("MICOM-SYS-MIB", "mcmSysAsciiTimeOfDay")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Counter32, Counter64, ModuleIdentity, iso, ObjectIdentity, NotificationType, Unsigned32, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, IpAddress, Integer32, Gauge32, NotificationType, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Counter64", "ModuleIdentity", "iso", "ObjectIdentity", "NotificationType", "Unsigned32", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "IpAddress", "Integer32", "Gauge32", "NotificationType", "MibIdentifier")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
class MemAddress(OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(4, 4)
fixedLength = 4
mcmTFTP = MibIdentifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 3))
mcmTFTPParamGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 1))
mcmTFTPServerIpAddr = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 1, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mcmTFTPServerIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPServerIpAddr.setDescription('NAME = ; DESC = The IP Address of the TFTP Server.; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPFileName = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 1, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mcmTFTPFileName.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPFileName.setDescription('NAME = ; DESC = The Filename with path (ASCII) to be downloaded; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPTimeOut = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 900))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mcmTFTPTimeOut.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPTimeOut.setDescription('NAME = ; DESC = The TFTP timeout period in seconds.; HELP = Time is doubled for each retransmission.; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPRetransmissions = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mcmTFTPRetransmissions.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPRetransmissions.setDescription('NAME = ; DESC = The number of times the TFTP request \\ will be repeated for un-responsive \\ TFTP servers.; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPDownload = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("upldDefault", 1), ("upldSpecific", 2), ("dnldDefault", 3), ("dnldSpecific", 4), ("disabled", 5)))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: mcmTFTPDownload.setStatus('deprecated')
if mibBuilder.loadTexts: mcmTFTPDownload.setDescription('NAME = ; DESC = This object when enabled results in \\ the unit to attempt code download.; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPStart = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("upldDefault", 1), ("upldSpecific", 2), ("dnldDefault", 3), ("dnldSpecific", 4), ("disabled", 5)))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: mcmTFTPStart.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPStart.setDescription('NAME = ; DESC = initiates TFTP upload or download process\\ based on previously provisioned values \\ (default) or values passed at request \\ time(specific) ; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPPortNumber = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mcmTFTPPortNumber.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPPortNumber.setDescription('NAME = ; DESC = This object is used to specify the \\ port <socket> number sent to the TFTP\\ connection. ; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPConfigUploadBank = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("bank3", 1), ("bank4", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mcmTFTPConfigUploadBank.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPConfigUploadBank.setDescription('NAME = ; DESC = The configuration bank number which\\ will be uploaded to the TFTP host. ; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
nvmTFTPParamGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 2))
nvmTFTPServerIpAddr = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 2, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmTFTPServerIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: nvmTFTPServerIpAddr.setDescription('NAME = ; DESC = The IP Address of the TFTP Server.; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
nvmTFTPFileName = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 2, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmTFTPFileName.setStatus('mandatory')
if mibBuilder.loadTexts: nvmTFTPFileName.setDescription('NAME = ; DESC = The Filename with path (ASCII) to be \\ downloaded or to upload; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
nvmTFTPTimeOut = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 2, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmTFTPTimeOut.setStatus('mandatory')
if mibBuilder.loadTexts: nvmTFTPTimeOut.setDescription('NAME = ; DESC = The TFTP timeout period in seconds.; HELP = Time is doubled for each retransmission; CAPABILITIES = NET_CFG, VPN_NONE;')
nvmTFTPRetransmissions = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 2, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmTFTPRetransmissions.setStatus('mandatory')
if mibBuilder.loadTexts: nvmTFTPRetransmissions.setDescription('NAME = ; DESC = The number of times the TFTP request \\ will be repeated for un-responsive \\ TFTP servers.; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
nvmTFTPPortNumber = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 2, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmTFTPPortNumber.setStatus('mandatory')
if mibBuilder.loadTexts: nvmTFTPPortNumber.setDescription('NAME = ; DESC = This object is used to specify the \\ port <socket> number sent to the TFTP\\ connection. ; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
nvmTFTPConfigUploadBank = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 2, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("bank3", 1), ("bank4", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmTFTPConfigUploadBank.setStatus('mandatory')
if mibBuilder.loadTexts: nvmTFTPConfigUploadBank.setDescription('NAME = ; DESC = The configuration bank number which\\ will be uploaded to the TFTP host. ; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPStatusGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 3))
mcmTFTPCurrentState = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("idle", 1), ("retrieving-file", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mcmTFTPCurrentState.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPCurrentState.setDescription('NAME = ; DESC = This object shows the current status \\ of TFTP interface.; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPErrorStatusGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 4))
mcmTFTPLastErrorStatus = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 4, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 5, 6, 7, 8, 11, 13, 14, 15, 16, 17, 18))).clone(namedValues=NamedValues(("idle", 1), ("download-success", 2), ("out-of-memory", 4), ("flash-error", 5), ("download-failed", 6), ("upload-failed", 7), ("upload-success", 8), ("chksum-error", 11), ("transferring-file", 13), ("protocol-error", 14), ("server-error", 15), ("timeout", 16), ("connection-error", 17), ("bad-file", 18)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mcmTFTPLastErrorStatus.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPLastErrorStatus.setDescription('NAME = ; DESC = This object shows the error status of \\ last TFTP operation.; HELP = Error status values: \\ value meaning \\ --------------------------------------------------\\ idle No download has been done \\ download-success A download completed without error\\ out-of-memory Not enough free memory \\ flash-error Could not write to flash memory \\ download-failed Download failed for an unknown reason \\ chksum-error The file to download has a checksum error \\ retrieving-file The file to download is being retrieved \\ protocol-error TFTP had an error talking to server \\ server-error The TFTP server sent error message, Could be bad file name \\ timeout Could be bad ip address or network errors \\ connection-error Setup of connection failed \\ bad-file The file to be download was rejected; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPLastServerIpAddr = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 4, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mcmTFTPLastServerIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPLastServerIpAddr.setDescription('NAME = ; DESC = The IP Address of the last TFTP Server.; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPLastFileName = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 4, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mcmTFTPLastFileName.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPLastFileName.setDescription('NAME = ; DESC = The Filename path (ASCII) of the previously downloaded file.; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPTransferBank = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 4, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("none", 1), ("toboot", 2), ("toBank1", 3), ("toBank2", 4), ("toBank3", 5), ("toBank4", 6), ("fromBank3", 7), ("fromBank4", 8), ("fromDebug", 9)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mcmTFTPTransferBank.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPTransferBank.setDescription('NAME = ; DESC = Specifies which flash bank is currently\\ being uploaded/dwonloaded via the tftp \\ application process ; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPLastPortNumber = MibScalar((1, 3, 6, 1, 4, 1, 335, 1, 4, 3, 4, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mcmTFTPLastPortNumber.setStatus('mandatory')
if mibBuilder.loadTexts: mcmTFTPLastPortNumber.setDescription('NAME = ; DESC = This object is used to specify the \\ port <socket> number sent to the TFTP\\ connection. ; HELP = ; CAPABILITIES = NET_CFG, VPN_NONE;')
mcmTFTPDownloadFail = NotificationType((1, 3, 6, 1, 4, 1, 335, 1, 4, 3) + (0,1)).setObjects(("MICOM-SYS-MIB", "mcmSysAsciiTimeOfDay"), ("TFTIF-MIB", "mcmTFTPServerIpAddr"), ("TFTIF-MIB", "mcmTFTPFileName"))
if mibBuilder.loadTexts: mcmTFTPDownloadFail.setDescription('NAME = ; DESC = A TFTP Code download has failed between the \\ PP4400 and the Server.; HELP = Please check Network cables, Server being alive, and retry \\ again. If problem persists, contact Sys Admin., or Field \\ Personnel.;')
mcmTFTPUploadFail = NotificationType((1, 3, 6, 1, 4, 1, 335, 1, 4, 3) + (0,2)).setObjects(("MICOM-SYS-MIB", "mcmSysAsciiTimeOfDay"), ("TFTIF-MIB", "mcmTFTPServerIpAddr"), ("TFTIF-MIB", "mcmTFTPFileName"))
if mibBuilder.loadTexts: mcmTFTPUploadFail.setDescription('NAME = ; DESC = TFTP file upload to server has failed.; HELP = See error status for type of transfer failure.;')
mcmTFTPDownloadSuccess = NotificationType((1, 3, 6, 1, 4, 1, 335, 1, 4, 3) + (0,3)).setObjects(("MICOM-SYS-MIB", "mcmSysAsciiTimeOfDay"), ("TFTIF-MIB", "mcmTFTPServerIpAddr"), ("TFTIF-MIB", "mcmTFTPFileName"))
if mibBuilder.loadTexts: mcmTFTPDownloadSuccess.setDescription('NAME = ; DESC = A TFTP Code download has succeeded between the \\ PP4400 and the Server.; HELP = TFTP Code download was successful. \\ Normal Status Indicator.;')
mcmTFTPUploadSuccess = NotificationType((1, 3, 6, 1, 4, 1, 335, 1, 4, 3) + (0,4)).setObjects(("MICOM-SYS-MIB", "mcmSysAsciiTimeOfDay"), ("TFTIF-MIB", "mcmTFTPServerIpAddr"), ("TFTIF-MIB", "mcmTFTPFileName"))
if mibBuilder.loadTexts: mcmTFTPUploadSuccess.setDescription('NAME = ; DESC = A TFTP file upload has succeeded between the \\ 4400 and the Server.; HELP = TFTP file upload was successful. \\ Normal Status Indicator.;')
mibBuilder.exportSymbols("TFTIF-MIB", mcmTFTPCurrentState=mcmTFTPCurrentState, mcmTFTPLastServerIpAddr=mcmTFTPLastServerIpAddr, mcmTFTPTransferBank=mcmTFTPTransferBank, nvmTFTPPortNumber=nvmTFTPPortNumber, mcmTFTPRetransmissions=mcmTFTPRetransmissions, mcmTFTPLastErrorStatus=mcmTFTPLastErrorStatus, mcmTFTPParamGroup=mcmTFTPParamGroup, mcmTFTPServerIpAddr=mcmTFTPServerIpAddr, mcmTFTPUploadSuccess=mcmTFTPUploadSuccess, nvmTFTPFileName=nvmTFTPFileName, MemAddress=MemAddress, nvmTFTPServerIpAddr=nvmTFTPServerIpAddr, nvmTFTPParamGroup=nvmTFTPParamGroup, mcmTFTPConfigUploadBank=mcmTFTPConfigUploadBank, mcmTFTPFileName=mcmTFTPFileName, mcmTFTPStart=mcmTFTPStart, mcmTFTPTimeOut=mcmTFTPTimeOut, mcmTFTPErrorStatusGroup=mcmTFTPErrorStatusGroup, mcmTFTPUploadFail=mcmTFTPUploadFail, mcmTFTPPortNumber=mcmTFTPPortNumber, mcmTFTP=mcmTFTP, mcmTFTPDownloadFail=mcmTFTPDownloadFail, nvmTFTPConfigUploadBank=nvmTFTPConfigUploadBank, mcmTFTPLastPortNumber=mcmTFTPLastPortNumber, nvmTFTPRetransmissions=nvmTFTPRetransmissions, mcmTFTPStatusGroup=mcmTFTPStatusGroup, mcmTFTPDownload=mcmTFTPDownload, mcmTFTPDownloadSuccess=mcmTFTPDownloadSuccess, mcmTFTPLastFileName=mcmTFTPLastFileName, nvmTFTPTimeOut=nvmTFTPTimeOut)
| 160.638298 | 1,207 | 0.753444 | 1,789 | 15,100 | 6.336501 | 0.170486 | 0.010409 | 0.08151 | 0.010233 | 0.566426 | 0.425371 | 0.37403 | 0.355593 | 0.335127 | 0.335127 | 0 | 0.047173 | 0.102914 | 15,100 | 93 | 1,208 | 162.365591 | 0.78968 | 0.020662 | 0 | 0 | 0 | 0.282353 | 0.380743 | 0.006496 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.011765 | 0.094118 | 0 | 0.129412 | 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 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
68bf0b03006f00f183ed52d981b3c274ac0142ec | 700 | py | Python | materialist/commonconstants.py | srungta/i-materialist | 0899593e0de0f311ff2dd4e76900ee4bd07895d7 | [
"MIT"
] | null | null | null | materialist/commonconstants.py | srungta/i-materialist | 0899593e0de0f311ff2dd4e76900ee4bd07895d7 | [
"MIT"
] | null | null | null | materialist/commonconstants.py | srungta/i-materialist | 0899593e0de0f311ff2dd4e76900ee4bd07895d7 | [
"MIT"
] | null | null | null | DATA_FOLDER = './materialist/data'
TEST_FOLDER = './materialist/data/test'
TRAIN_FOLDER = './materialist/data/train'
VALIDATION_FOLDER = './materialist/data/validation'
TEST_FILE = './materialist/data/test.json'
TRAIN_FILE = './materialist/data/train.json'
VALIDATION_FILE = './materialist/data/validation.json'
TEST_PICKLE = './materialist/data/test.pickle'
TRAIN_PICKLE = './materialist/data/train.pickle'
VALIDATION_PICKLE = './materialist/data/validation.pickle'
TRAIN_LABEL_PICKLE = './materialist/data/train_label.pickle'
VALIDATION_LABEL_PICKLE = './materialist/data/validation_label.pickle'
RESULTS_FOLDER = './materialist/results/test/'
FINAL_RESULT = './materialist/results/final.csv'
| 35 | 70 | 0.78 | 82 | 700 | 6.439024 | 0.170732 | 0.340909 | 0.198864 | 0.094697 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.067143 | 700 | 19 | 71 | 36.842105 | 0.808576 | 0 | 0 | 0 | 0 | 0 | 0.598571 | 0.572857 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
68eee7aa3b47d93b19ed191e8a0f67696f548338 | 1,185 | py | Python | AtC_Beg_Con_071-080/ABC076/C.py | yosho-18/AtCoder | 50f6d5c92a01792552c31ac912ce1cd557b06fb0 | [
"MIT"
] | null | null | null | AtC_Beg_Con_071-080/ABC076/C.py | yosho-18/AtCoder | 50f6d5c92a01792552c31ac912ce1cd557b06fb0 | [
"MIT"
] | null | null | null | AtC_Beg_Con_071-080/ABC076/C.py | yosho-18/AtCoder | 50f6d5c92a01792552c31ac912ce1cd557b06fb0 | [
"MIT"
] | null | null | null | import copy as cp
s = input()
t = input()
u = list(s)
v = list(t)
w = cp.deepcopy(u)
p = 0
q = 0
for h in range(len(u) - 1, -1, -1):
if q == 1:
break
if v[-1] == u[h]:
#w[i] = v[0]
for j in range(len(v)):
if (v[-1 - j] == u[h - j]) and h - j >= 0:
pass
if j == len(v) - 1:
#for k in range(len(v)):
#w[h - k] = v[-1 - k]
q = 1
p = 1
else:
break
if q == 0:
for i in range(len(u) - 1, -1, -1):
if p == 1:
break
if v[-1] == u[i] or "?" == u[i]:
#w[i] = v[0]
for j in range(len(v)):
if (v[-1 - j] == u[i - j] or "?" == u[i - j]) and i - j >= 0:
pass
if j == len(v) - 1:
for k in range(len(v)):
w[i - k] = v[-1 - k]
p = 1
else:
break
if p == 1:
for m in range(len(u)):
if w[m] == "?":
w[m] = "a"
print("".join(w))
if p == 0:
print("UNRESTORABLE") | 25.76087 | 77 | 0.291983 | 179 | 1,185 | 1.932961 | 0.195531 | 0.046243 | 0.202312 | 0.127168 | 0.549133 | 0.473988 | 0.410405 | 0.410405 | 0.317919 | 0.317919 | 0 | 0.05036 | 0.530802 | 1,185 | 46 | 78 | 25.76087 | 0.571942 | 0.054852 | 0 | 0.390244 | 0 | 0 | 0.014324 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.04878 | 0.02439 | 0 | 0.02439 | 0.04878 | 0 | 0 | 1 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.