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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
90aea83101d8643fb627bac0217a5a6fd1cebe23 | 280 | py | Python | zephyrus_sc2_parser/__init__.py | dermorz/zephyrus-sc2-parser | fdcc298ced9f2f8194d4c864ef2943382214c0bd | [
"MIT"
] | 28 | 2020-03-11T14:07:12.000Z | 2022-03-24T23:53:08.000Z | zephyrus_sc2_parser/__init__.py | dermorz/zephyrus-sc2-parser | fdcc298ced9f2f8194d4c864ef2943382214c0bd | [
"MIT"
] | 19 | 2020-06-25T11:59:43.000Z | 2022-03-27T23:11:00.000Z | zephyrus_sc2_parser/__init__.py | dermorz/zephyrus-sc2-parser | fdcc298ced9f2f8194d4c864ef2943382214c0bd | [
"MIT"
] | 4 | 2020-06-24T21:12:15.000Z | 2021-11-19T15:27:35.000Z | import logging
from logging import NullHandler
from zephyrus_sc2_parser.parser import parse_replay
logging.getLogger(__name__).addHandler(NullHandler())
# to prevent unknown event warnings
util_logger = logging.getLogger(f'{__name__}.utils')
util_logger.setLevel(logging.ERROR)
| 28 | 53 | 0.835714 | 36 | 280 | 6.138889 | 0.638889 | 0.144796 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003891 | 0.082143 | 280 | 9 | 54 | 31.111111 | 0.856031 | 0.117857 | 0 | 0 | 0 | 0 | 0.065306 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
90b598a3e85c0003c20b1f9d672b64601fe42650 | 609 | py | Python | Unittest/test_phonebook.py | ahaile505/PythonUnitTesting | a0b1099ad2aa5130e6a6dd8abbb1a570f8e0e0f6 | [
"MIT"
] | null | null | null | Unittest/test_phonebook.py | ahaile505/PythonUnitTesting | a0b1099ad2aa5130e6a6dd8abbb1a570f8e0e0f6 | [
"MIT"
] | null | null | null | Unittest/test_phonebook.py | ahaile505/PythonUnitTesting | a0b1099ad2aa5130e6a6dd8abbb1a570f8e0e0f6 | [
"MIT"
] | null | null | null |
import unittest
from phonebook import PhoneBook
class PhoneBookTest(unittest.TestCase):
def setUp(self):
self.phonebook = PhoneBook()
def tearDown(self):
pass
def test_lookup_by_name(self):
self.phonebook.add("Bob", "1234")
number = self.phonebook.lookup("Bob")
self.assertEqual("1234", number)
def test_missing_name(self):
with self.assertRaises(KeyError):
self.phonebook.lookup("missing")
@unittest.skip("WIP")
def test_empty_phonebook_is_consistent(self):
self.assertTrue(self.phonebook.is_consistant())
| 22.555556 | 55 | 0.665025 | 69 | 609 | 5.724638 | 0.463768 | 0.164557 | 0.086076 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016913 | 0.223317 | 609 | 26 | 56 | 23.423077 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0.039604 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 1 | 0.294118 | false | 0.058824 | 0.117647 | 0 | 0.470588 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
90b6cb39a08d423966c609f7b150d91ff086205f | 439 | py | Python | website/canvas/management/commands/rethumbnail_images.py | bopopescu/drawquest-web | 8d8f9149b6efeb65202809a5f8916386f58a1b3b | [
"BSD-3-Clause"
] | 61 | 2015-11-10T17:13:46.000Z | 2021-08-06T17:58:30.000Z | website/canvas/management/commands/rethumbnail_images.py | bopopescu/drawquest-web | 8d8f9149b6efeb65202809a5f8916386f58a1b3b | [
"BSD-3-Clause"
] | 13 | 2015-11-11T07:49:41.000Z | 2021-06-09T03:45:31.000Z | website/canvas/management/commands/rethumbnail_images.py | bopopescu/drawquest-web | 8d8f9149b6efeb65202809a5f8916386f58a1b3b | [
"BSD-3-Clause"
] | 18 | 2015-11-11T04:50:04.000Z | 2021-08-20T00:57:11.000Z | from django.core.management.base import BaseCommand, CommandError
from canvas.thumbnailer import update_all_content
from canvas.models import Content
from canvas.upload import get_fs
from configuration import Config
from django.conf import settings
class Command(BaseCommand):
args = ''
help = 'Recreates all the thumbnails.'
def handle(self, *args, **options):
update_all_content(get_fs(*settings.IMAGE_FS), *args)
| 29.266667 | 65 | 0.774487 | 58 | 439 | 5.741379 | 0.568966 | 0.09009 | 0.096096 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148064 | 439 | 14 | 66 | 31.357143 | 0.890374 | 0 | 0 | 0 | 0 | 0 | 0.06621 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.545455 | 0 | 0.909091 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
90b971004a855bce91e00f8f8346ca9ab2c8e144 | 2,381 | py | Python | morfessorcognate/constructions/base.py | Waino/morfessor-cognates | ef214eae484d92e6e66dd53a62d012567b1e3033 | [
"BSD-2-Clause"
] | 2 | 2019-07-29T13:33:04.000Z | 2019-11-01T11:42:35.000Z | morfessorcognate/constructions/base.py | Waino/morfessor-cognates | ef214eae484d92e6e66dd53a62d012567b1e3033 | [
"BSD-2-Clause"
] | null | null | null | morfessorcognate/constructions/base.py | Waino/morfessor-cognates | ef214eae484d92e6e66dd53a62d012567b1e3033 | [
"BSD-2-Clause"
] | 1 | 2019-04-17T08:14:14.000Z | 2019-04-17T08:14:14.000Z | import re
class BaseConstructionMethods(object):
def __init__(self, force_splits=None, nosplit_re=None):
self._force_splits = set(force_splits) if force_splits is not None else set()
self._nosplit = re.compile(nosplit_re, re.UNICODE) if nosplit_re is not None else None
def force_split_locations(self, construction):
prev = 0
for i in range(len(construction)):
if construction[i] in self._force_splits:
if i-prev > 0:
yield i
if i+1 < len(construction):
yield i+1
prev = i+1
def split_locations(self, construction, start=None, stop=None):
"""
Return all possible split-locations between start and end. Start and end will not be returned.
"""
start = start if start is not None else 0
stop = stop if stop is not None else len(construction)
for i in range(start+1, stop):
if self._nosplit and self._nosplit.match(construction[i-1:i+1]):
continue
yield i
@staticmethod
def split(construction, loc):
assert 0 < loc < len(construction)
return construction[:loc], construction[loc:]
@classmethod
def splitn(cls, construction, locs):
if not hasattr(locs, '__iter__'):
for p in cls.split(construction, locs):
yield p
return
prev = 0
for l in locs:
assert prev < l < len(construction)
yield construction[prev:l]
prev = l
yield construction[prev:]
@staticmethod
def parts_to_splitlocs(parts):
cur_len = 0
for p in parts[:-1]:
cur_len += len(p)
yield cur_len
@staticmethod
def slice(construction, start=None, stop=None):
return construction[start:stop]
@staticmethod
def from_string(string):
return string
@staticmethod
def to_string(construction):
return construction
@staticmethod
def corpus_key(construction):
return construction
@staticmethod
def lex_key(construction):
return construction
@staticmethod
def atoms(construction):
return construction
@classmethod
def is_atom(cls, construction):
return len(cls.corpus_key(construction) == 1)
| 28.345238 | 102 | 0.599748 | 284 | 2,381 | 4.90493 | 0.235915 | 0.086145 | 0.107681 | 0.03733 | 0.151472 | 0.119167 | 0 | 0 | 0 | 0 | 0 | 0.008663 | 0.321294 | 2,381 | 83 | 103 | 28.686747 | 0.853342 | 0.039479 | 0 | 0.28125 | 0 | 0 | 0.003535 | 0 | 0 | 0 | 0 | 0 | 0.03125 | 1 | 0.203125 | false | 0 | 0.015625 | 0.109375 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
90c3d3aa3d6a53659ffa0122ca5c9b18bbecc9de | 893 | py | Python | wpkit/services/CloudOS.py | Peiiii/wpkit | 23a07548be766b559b80e3114ecc24e3f2f65ea5 | [
"MIT"
] | null | null | null | wpkit/services/CloudOS.py | Peiiii/wpkit | 23a07548be766b559b80e3114ecc24e3f2f65ea5 | [
"MIT"
] | null | null | null | wpkit/services/CloudOS.py | Peiiii/wpkit | 23a07548be766b559b80e3114ecc24e3f2f65ea5 | [
"MIT"
] | null | null | null | import threading
def run_server1(import_name,host,port=80):
import wpkit
from wpkit.web.applications.all import BluePan
from wpkit.web import MyBlueprint
app = wpkit.web.get_default_app(import_name)
bp_pan = pan.BluePan(import_name)
app.add_blueprint(bp_pan)
print(app.url_map)
print(app.sitemap)
app.run(port=port,host=host)
def run_server2(import_name,host,port=8002):
from wpkit.services import LocalFSServer
app = LocalFSServer(import_name, path="./")
print(app.url_map)
app.run(port=port,host=host)
def start_server(import_name,host='127.0.0.1',port1=80,port2=8002):
t1 = threading.Thread(target=run_server1,args=[import_name,host,port1])
t2 = threading.Thread(target=run_server2,args=[import_name,host,port2])
t1.start()
t2.start()
t1.join()
t2.join()
if __name__ == '__main__':
start_server(__name__) | 28.806452 | 75 | 0.717805 | 134 | 893 | 4.537313 | 0.350746 | 0.131579 | 0.115132 | 0.059211 | 0.082237 | 0.082237 | 0.082237 | 0 | 0 | 0 | 0 | 0.042384 | 0.154535 | 893 | 31 | 76 | 28.806452 | 0.762914 | 0 | 0 | 0.16 | 0 | 0 | 0.021253 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.12 | false | 0 | 0.52 | 0 | 0.64 | 0.2 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
90c55abcd014981c5d4ab62f822178ab7cc2f5e3 | 33,354 | py | Python | test_files/uctable_N.py | garrettluu/js-adler32 | b40011c6f76bb2a0b78126fc8412ff380c905dcd | [
"Apache-2.0"
] | 224 | 2015-01-07T06:06:33.000Z | 2022-03-29T08:52:49.000Z | test_files/uctable_N.py | stof/js-adler32 | b7700fd5fa4c1ecfb4e67d20ed0248154940fcdb | [
"Apache-2.0"
] | 18 | 2015-05-06T22:30:17.000Z | 2022-03-30T18:15:51.000Z | test_files/uctable_N.py | stof/js-adler32 | b7700fd5fa4c1ecfb4e67d20ed0248154940fcdb | [
"Apache-2.0"
] | 38 | 2015-01-28T03:34:17.000Z | 2022-02-10T03:28:14.000Z | uctable = [ [ 48 ],
[ 49 ],
[ 50 ],
[ 51 ],
[ 52 ],
[ 53 ],
[ 54 ],
[ 55 ],
[ 56 ],
[ 57 ],
[ 194, 178 ],
[ 194, 179 ],
[ 194, 185 ],
[ 194, 188 ],
[ 194, 189 ],
[ 194, 190 ],
[ 217, 160 ],
[ 217, 161 ],
[ 217, 162 ],
[ 217, 163 ],
[ 217, 164 ],
[ 217, 165 ],
[ 217, 166 ],
[ 217, 167 ],
[ 217, 168 ],
[ 217, 169 ],
[ 219, 176 ],
[ 219, 177 ],
[ 219, 178 ],
[ 219, 179 ],
[ 219, 180 ],
[ 219, 181 ],
[ 219, 182 ],
[ 219, 183 ],
[ 219, 184 ],
[ 219, 185 ],
[ 223, 128 ],
[ 223, 129 ],
[ 223, 130 ],
[ 223, 131 ],
[ 223, 132 ],
[ 223, 133 ],
[ 223, 134 ],
[ 223, 135 ],
[ 223, 136 ],
[ 223, 137 ],
[ 224, 165, 166 ],
[ 224, 165, 167 ],
[ 224, 165, 168 ],
[ 224, 165, 169 ],
[ 224, 165, 170 ],
[ 224, 165, 171 ],
[ 224, 165, 172 ],
[ 224, 165, 173 ],
[ 224, 165, 174 ],
[ 224, 165, 175 ],
[ 224, 167, 166 ],
[ 224, 167, 167 ],
[ 224, 167, 168 ],
[ 224, 167, 169 ],
[ 224, 167, 170 ],
[ 224, 167, 171 ],
[ 224, 167, 172 ],
[ 224, 167, 173 ],
[ 224, 167, 174 ],
[ 224, 167, 175 ],
[ 224, 167, 180 ],
[ 224, 167, 181 ],
[ 224, 167, 182 ],
[ 224, 167, 183 ],
[ 224, 167, 184 ],
[ 224, 167, 185 ],
[ 224, 169, 166 ],
[ 224, 169, 167 ],
[ 224, 169, 168 ],
[ 224, 169, 169 ],
[ 224, 169, 170 ],
[ 224, 169, 171 ],
[ 224, 169, 172 ],
[ 224, 169, 173 ],
[ 224, 169, 174 ],
[ 224, 169, 175 ],
[ 224, 171, 166 ],
[ 224, 171, 167 ],
[ 224, 171, 168 ],
[ 224, 171, 169 ],
[ 224, 171, 170 ],
[ 224, 171, 171 ],
[ 224, 171, 172 ],
[ 224, 171, 173 ],
[ 224, 171, 174 ],
[ 224, 171, 175 ],
[ 224, 173, 166 ],
[ 224, 173, 167 ],
[ 224, 173, 168 ],
[ 224, 173, 169 ],
[ 224, 173, 170 ],
[ 224, 173, 171 ],
[ 224, 173, 172 ],
[ 224, 173, 173 ],
[ 224, 173, 174 ],
[ 224, 173, 175 ],
[ 224, 173, 178 ],
[ 224, 173, 179 ],
[ 224, 173, 180 ],
[ 224, 173, 181 ],
[ 224, 173, 182 ],
[ 224, 173, 183 ],
[ 224, 175, 166 ],
[ 224, 175, 167 ],
[ 224, 175, 168 ],
[ 224, 175, 169 ],
[ 224, 175, 170 ],
[ 224, 175, 171 ],
[ 224, 175, 172 ],
[ 224, 175, 173 ],
[ 224, 175, 174 ],
[ 224, 175, 175 ],
[ 224, 175, 176 ],
[ 224, 175, 177 ],
[ 224, 175, 178 ],
[ 224, 177, 166 ],
[ 224, 177, 167 ],
[ 224, 177, 168 ],
[ 224, 177, 169 ],
[ 224, 177, 170 ],
[ 224, 177, 171 ],
[ 224, 177, 172 ],
[ 224, 177, 173 ],
[ 224, 177, 174 ],
[ 224, 177, 175 ],
[ 224, 177, 184 ],
[ 224, 177, 185 ],
[ 224, 177, 186 ],
[ 224, 177, 187 ],
[ 224, 177, 188 ],
[ 224, 177, 189 ],
[ 224, 177, 190 ],
[ 224, 179, 166 ],
[ 224, 179, 167 ],
[ 224, 179, 168 ],
[ 224, 179, 169 ],
[ 224, 179, 170 ],
[ 224, 179, 171 ],
[ 224, 179, 172 ],
[ 224, 179, 173 ],
[ 224, 179, 174 ],
[ 224, 179, 175 ],
[ 224, 181, 166 ],
[ 224, 181, 167 ],
[ 224, 181, 168 ],
[ 224, 181, 169 ],
[ 224, 181, 170 ],
[ 224, 181, 171 ],
[ 224, 181, 172 ],
[ 224, 181, 173 ],
[ 224, 181, 174 ],
[ 224, 181, 175 ],
[ 224, 181, 176 ],
[ 224, 181, 177 ],
[ 224, 181, 178 ],
[ 224, 181, 179 ],
[ 224, 181, 180 ],
[ 224, 181, 181 ],
[ 224, 183, 166 ],
[ 224, 183, 167 ],
[ 224, 183, 168 ],
[ 224, 183, 169 ],
[ 224, 183, 170 ],
[ 224, 183, 171 ],
[ 224, 183, 172 ],
[ 224, 183, 173 ],
[ 224, 183, 174 ],
[ 224, 183, 175 ],
[ 224, 185, 144 ],
[ 224, 185, 145 ],
[ 224, 185, 146 ],
[ 224, 185, 147 ],
[ 224, 185, 148 ],
[ 224, 185, 149 ],
[ 224, 185, 150 ],
[ 224, 185, 151 ],
[ 224, 185, 152 ],
[ 224, 185, 153 ],
[ 224, 187, 144 ],
[ 224, 187, 145 ],
[ 224, 187, 146 ],
[ 224, 187, 147 ],
[ 224, 187, 148 ],
[ 224, 187, 149 ],
[ 224, 187, 150 ],
[ 224, 187, 151 ],
[ 224, 187, 152 ],
[ 224, 187, 153 ],
[ 224, 188, 160 ],
[ 224, 188, 161 ],
[ 224, 188, 162 ],
[ 224, 188, 163 ],
[ 224, 188, 164 ],
[ 224, 188, 165 ],
[ 224, 188, 166 ],
[ 224, 188, 167 ],
[ 224, 188, 168 ],
[ 224, 188, 169 ],
[ 224, 188, 170 ],
[ 224, 188, 171 ],
[ 224, 188, 172 ],
[ 224, 188, 173 ],
[ 224, 188, 174 ],
[ 224, 188, 175 ],
[ 224, 188, 176 ],
[ 224, 188, 177 ],
[ 224, 188, 178 ],
[ 224, 188, 179 ],
[ 225, 129, 128 ],
[ 225, 129, 129 ],
[ 225, 129, 130 ],
[ 225, 129, 131 ],
[ 225, 129, 132 ],
[ 225, 129, 133 ],
[ 225, 129, 134 ],
[ 225, 129, 135 ],
[ 225, 129, 136 ],
[ 225, 129, 137 ],
[ 225, 130, 144 ],
[ 225, 130, 145 ],
[ 225, 130, 146 ],
[ 225, 130, 147 ],
[ 225, 130, 148 ],
[ 225, 130, 149 ],
[ 225, 130, 150 ],
[ 225, 130, 151 ],
[ 225, 130, 152 ],
[ 225, 130, 153 ],
[ 225, 141, 169 ],
[ 225, 141, 170 ],
[ 225, 141, 171 ],
[ 225, 141, 172 ],
[ 225, 141, 173 ],
[ 225, 141, 174 ],
[ 225, 141, 175 ],
[ 225, 141, 176 ],
[ 225, 141, 177 ],
[ 225, 141, 178 ],
[ 225, 141, 179 ],
[ 225, 141, 180 ],
[ 225, 141, 181 ],
[ 225, 141, 182 ],
[ 225, 141, 183 ],
[ 225, 141, 184 ],
[ 225, 141, 185 ],
[ 225, 141, 186 ],
[ 225, 141, 187 ],
[ 225, 141, 188 ],
[ 225, 155, 174 ],
[ 225, 155, 175 ],
[ 225, 155, 176 ],
[ 225, 159, 160 ],
[ 225, 159, 161 ],
[ 225, 159, 162 ],
[ 225, 159, 163 ],
[ 225, 159, 164 ],
[ 225, 159, 165 ],
[ 225, 159, 166 ],
[ 225, 159, 167 ],
[ 225, 159, 168 ],
[ 225, 159, 169 ],
[ 225, 159, 176 ],
[ 225, 159, 177 ],
[ 225, 159, 178 ],
[ 225, 159, 179 ],
[ 225, 159, 180 ],
[ 225, 159, 181 ],
[ 225, 159, 182 ],
[ 225, 159, 183 ],
[ 225, 159, 184 ],
[ 225, 159, 185 ],
[ 225, 160, 144 ],
[ 225, 160, 145 ],
[ 225, 160, 146 ],
[ 225, 160, 147 ],
[ 225, 160, 148 ],
[ 225, 160, 149 ],
[ 225, 160, 150 ],
[ 225, 160, 151 ],
[ 225, 160, 152 ],
[ 225, 160, 153 ],
[ 225, 165, 134 ],
[ 225, 165, 135 ],
[ 225, 165, 136 ],
[ 225, 165, 137 ],
[ 225, 165, 138 ],
[ 225, 165, 139 ],
[ 225, 165, 140 ],
[ 225, 165, 141 ],
[ 225, 165, 142 ],
[ 225, 165, 143 ],
[ 225, 167, 144 ],
[ 225, 167, 145 ],
[ 225, 167, 146 ],
[ 225, 167, 147 ],
[ 225, 167, 148 ],
[ 225, 167, 149 ],
[ 225, 167, 150 ],
[ 225, 167, 151 ],
[ 225, 167, 152 ],
[ 225, 167, 153 ],
[ 225, 167, 154 ],
[ 225, 170, 128 ],
[ 225, 170, 129 ],
[ 225, 170, 130 ],
[ 225, 170, 131 ],
[ 225, 170, 132 ],
[ 225, 170, 133 ],
[ 225, 170, 134 ],
[ 225, 170, 135 ],
[ 225, 170, 136 ],
[ 225, 170, 137 ],
[ 225, 170, 144 ],
[ 225, 170, 145 ],
[ 225, 170, 146 ],
[ 225, 170, 147 ],
[ 225, 170, 148 ],
[ 225, 170, 149 ],
[ 225, 170, 150 ],
[ 225, 170, 151 ],
[ 225, 170, 152 ],
[ 225, 170, 153 ],
[ 225, 173, 144 ],
[ 225, 173, 145 ],
[ 225, 173, 146 ],
[ 225, 173, 147 ],
[ 225, 173, 148 ],
[ 225, 173, 149 ],
[ 225, 173, 150 ],
[ 225, 173, 151 ],
[ 225, 173, 152 ],
[ 225, 173, 153 ],
[ 225, 174, 176 ],
[ 225, 174, 177 ],
[ 225, 174, 178 ],
[ 225, 174, 179 ],
[ 225, 174, 180 ],
[ 225, 174, 181 ],
[ 225, 174, 182 ],
[ 225, 174, 183 ],
[ 225, 174, 184 ],
[ 225, 174, 185 ],
[ 225, 177, 128 ],
[ 225, 177, 129 ],
[ 225, 177, 130 ],
[ 225, 177, 131 ],
[ 225, 177, 132 ],
[ 225, 177, 133 ],
[ 225, 177, 134 ],
[ 225, 177, 135 ],
[ 225, 177, 136 ],
[ 225, 177, 137 ],
[ 225, 177, 144 ],
[ 225, 177, 145 ],
[ 225, 177, 146 ],
[ 225, 177, 147 ],
[ 225, 177, 148 ],
[ 225, 177, 149 ],
[ 225, 177, 150 ],
[ 225, 177, 151 ],
[ 225, 177, 152 ],
[ 225, 177, 153 ],
[ 226, 129, 176 ],
[ 226, 129, 180 ],
[ 226, 129, 181 ],
[ 226, 129, 182 ],
[ 226, 129, 183 ],
[ 226, 129, 184 ],
[ 226, 129, 185 ],
[ 226, 130, 128 ],
[ 226, 130, 129 ],
[ 226, 130, 130 ],
[ 226, 130, 131 ],
[ 226, 130, 132 ],
[ 226, 130, 133 ],
[ 226, 130, 134 ],
[ 226, 130, 135 ],
[ 226, 130, 136 ],
[ 226, 130, 137 ],
[ 226, 133, 144 ],
[ 226, 133, 145 ],
[ 226, 133, 146 ],
[ 226, 133, 147 ],
[ 226, 133, 148 ],
[ 226, 133, 149 ],
[ 226, 133, 150 ],
[ 226, 133, 151 ],
[ 226, 133, 152 ],
[ 226, 133, 153 ],
[ 226, 133, 154 ],
[ 226, 133, 155 ],
[ 226, 133, 156 ],
[ 226, 133, 157 ],
[ 226, 133, 158 ],
[ 226, 133, 159 ],
[ 226, 133, 160 ],
[ 226, 133, 161 ],
[ 226, 133, 162 ],
[ 226, 133, 163 ],
[ 226, 133, 164 ],
[ 226, 133, 165 ],
[ 226, 133, 166 ],
[ 226, 133, 167 ],
[ 226, 133, 168 ],
[ 226, 133, 169 ],
[ 226, 133, 170 ],
[ 226, 133, 171 ],
[ 226, 133, 172 ],
[ 226, 133, 173 ],
[ 226, 133, 174 ],
[ 226, 133, 175 ],
[ 226, 133, 176 ],
[ 226, 133, 177 ],
[ 226, 133, 178 ],
[ 226, 133, 179 ],
[ 226, 133, 180 ],
[ 226, 133, 181 ],
[ 226, 133, 182 ],
[ 226, 133, 183 ],
[ 226, 133, 184 ],
[ 226, 133, 185 ],
[ 226, 133, 186 ],
[ 226, 133, 187 ],
[ 226, 133, 188 ],
[ 226, 133, 189 ],
[ 226, 133, 190 ],
[ 226, 133, 191 ],
[ 226, 134, 128 ],
[ 226, 134, 129 ],
[ 226, 134, 130 ],
[ 226, 134, 133 ],
[ 226, 134, 134 ],
[ 226, 134, 135 ],
[ 226, 134, 136 ],
[ 226, 134, 137 ],
[ 226, 145, 160 ],
[ 226, 145, 161 ],
[ 226, 145, 162 ],
[ 226, 145, 163 ],
[ 226, 145, 164 ],
[ 226, 145, 165 ],
[ 226, 145, 166 ],
[ 226, 145, 167 ],
[ 226, 145, 168 ],
[ 226, 145, 169 ],
[ 226, 145, 170 ],
[ 226, 145, 171 ],
[ 226, 145, 172 ],
[ 226, 145, 173 ],
[ 226, 145, 174 ],
[ 226, 145, 175 ],
[ 226, 145, 176 ],
[ 226, 145, 177 ],
[ 226, 145, 178 ],
[ 226, 145, 179 ],
[ 226, 145, 180 ],
[ 226, 145, 181 ],
[ 226, 145, 182 ],
[ 226, 145, 183 ],
[ 226, 145, 184 ],
[ 226, 145, 185 ],
[ 226, 145, 186 ],
[ 226, 145, 187 ],
[ 226, 145, 188 ],
[ 226, 145, 189 ],
[ 226, 145, 190 ],
[ 226, 145, 191 ],
[ 226, 146, 128 ],
[ 226, 146, 129 ],
[ 226, 146, 130 ],
[ 226, 146, 131 ],
[ 226, 146, 132 ],
[ 226, 146, 133 ],
[ 226, 146, 134 ],
[ 226, 146, 135 ],
[ 226, 146, 136 ],
[ 226, 146, 137 ],
[ 226, 146, 138 ],
[ 226, 146, 139 ],
[ 226, 146, 140 ],
[ 226, 146, 141 ],
[ 226, 146, 142 ],
[ 226, 146, 143 ],
[ 226, 146, 144 ],
[ 226, 146, 145 ],
[ 226, 146, 146 ],
[ 226, 146, 147 ],
[ 226, 146, 148 ],
[ 226, 146, 149 ],
[ 226, 146, 150 ],
[ 226, 146, 151 ],
[ 226, 146, 152 ],
[ 226, 146, 153 ],
[ 226, 146, 154 ],
[ 226, 146, 155 ],
[ 226, 147, 170 ],
[ 226, 147, 171 ],
[ 226, 147, 172 ],
[ 226, 147, 173 ],
[ 226, 147, 174 ],
[ 226, 147, 175 ],
[ 226, 147, 176 ],
[ 226, 147, 177 ],
[ 226, 147, 178 ],
[ 226, 147, 179 ],
[ 226, 147, 180 ],
[ 226, 147, 181 ],
[ 226, 147, 182 ],
[ 226, 147, 183 ],
[ 226, 147, 184 ],
[ 226, 147, 185 ],
[ 226, 147, 186 ],
[ 226, 147, 187 ],
[ 226, 147, 188 ],
[ 226, 147, 189 ],
[ 226, 147, 190 ],
[ 226, 147, 191 ],
[ 226, 157, 182 ],
[ 226, 157, 183 ],
[ 226, 157, 184 ],
[ 226, 157, 185 ],
[ 226, 157, 186 ],
[ 226, 157, 187 ],
[ 226, 157, 188 ],
[ 226, 157, 189 ],
[ 226, 157, 190 ],
[ 226, 157, 191 ],
[ 226, 158, 128 ],
[ 226, 158, 129 ],
[ 226, 158, 130 ],
[ 226, 158, 131 ],
[ 226, 158, 132 ],
[ 226, 158, 133 ],
[ 226, 158, 134 ],
[ 226, 158, 135 ],
[ 226, 158, 136 ],
[ 226, 158, 137 ],
[ 226, 158, 138 ],
[ 226, 158, 139 ],
[ 226, 158, 140 ],
[ 226, 158, 141 ],
[ 226, 158, 142 ],
[ 226, 158, 143 ],
[ 226, 158, 144 ],
[ 226, 158, 145 ],
[ 226, 158, 146 ],
[ 226, 158, 147 ],
[ 226, 179, 189 ],
[ 227, 128, 135 ],
[ 227, 128, 161 ],
[ 227, 128, 162 ],
[ 227, 128, 163 ],
[ 227, 128, 164 ],
[ 227, 128, 165 ],
[ 227, 128, 166 ],
[ 227, 128, 167 ],
[ 227, 128, 168 ],
[ 227, 128, 169 ],
[ 227, 128, 184 ],
[ 227, 128, 185 ],
[ 227, 128, 186 ],
[ 227, 134, 146 ],
[ 227, 134, 147 ],
[ 227, 134, 148 ],
[ 227, 134, 149 ],
[ 227, 136, 160 ],
[ 227, 136, 161 ],
[ 227, 136, 162 ],
[ 227, 136, 163 ],
[ 227, 136, 164 ],
[ 227, 136, 165 ],
[ 227, 136, 166 ],
[ 227, 136, 167 ],
[ 227, 136, 168 ],
[ 227, 136, 169 ],
[ 227, 137, 136 ],
[ 227, 137, 137 ],
[ 227, 137, 138 ],
[ 227, 137, 139 ],
[ 227, 137, 140 ],
[ 227, 137, 141 ],
[ 227, 137, 142 ],
[ 227, 137, 143 ],
[ 227, 137, 145 ],
[ 227, 137, 146 ],
[ 227, 137, 147 ],
[ 227, 137, 148 ],
[ 227, 137, 149 ],
[ 227, 137, 150 ],
[ 227, 137, 151 ],
[ 227, 137, 152 ],
[ 227, 137, 153 ],
[ 227, 137, 154 ],
[ 227, 137, 155 ],
[ 227, 137, 156 ],
[ 227, 137, 157 ],
[ 227, 137, 158 ],
[ 227, 137, 159 ],
[ 227, 138, 128 ],
[ 227, 138, 129 ],
[ 227, 138, 130 ],
[ 227, 138, 131 ],
[ 227, 138, 132 ],
[ 227, 138, 133 ],
[ 227, 138, 134 ],
[ 227, 138, 135 ],
[ 227, 138, 136 ],
[ 227, 138, 137 ],
[ 227, 138, 177 ],
[ 227, 138, 178 ],
[ 227, 138, 179 ],
[ 227, 138, 180 ],
[ 227, 138, 181 ],
[ 227, 138, 182 ],
[ 227, 138, 183 ],
[ 227, 138, 184 ],
[ 227, 138, 185 ],
[ 227, 138, 186 ],
[ 227, 138, 187 ],
[ 227, 138, 188 ],
[ 227, 138, 189 ],
[ 227, 138, 190 ],
[ 227, 138, 191 ],
[ 234, 152, 160 ],
[ 234, 152, 161 ],
[ 234, 152, 162 ],
[ 234, 152, 163 ],
[ 234, 152, 164 ],
[ 234, 152, 165 ],
[ 234, 152, 166 ],
[ 234, 152, 167 ],
[ 234, 152, 168 ],
[ 234, 152, 169 ],
[ 234, 155, 166 ],
[ 234, 155, 167 ],
[ 234, 155, 168 ],
[ 234, 155, 169 ],
[ 234, 155, 170 ],
[ 234, 155, 171 ],
[ 234, 155, 172 ],
[ 234, 155, 173 ],
[ 234, 155, 174 ],
[ 234, 155, 175 ],
[ 234, 160, 176 ],
[ 234, 160, 177 ],
[ 234, 160, 178 ],
[ 234, 160, 179 ],
[ 234, 160, 180 ],
[ 234, 160, 181 ],
[ 234, 163, 144 ],
[ 234, 163, 145 ],
[ 234, 163, 146 ],
[ 234, 163, 147 ],
[ 234, 163, 148 ],
[ 234, 163, 149 ],
[ 234, 163, 150 ],
[ 234, 163, 151 ],
[ 234, 163, 152 ],
[ 234, 163, 153 ],
[ 234, 164, 128 ],
[ 234, 164, 129 ],
[ 234, 164, 130 ],
[ 234, 164, 131 ],
[ 234, 164, 132 ],
[ 234, 164, 133 ],
[ 234, 164, 134 ],
[ 234, 164, 135 ],
[ 234, 164, 136 ],
[ 234, 164, 137 ],
[ 234, 167, 144 ],
[ 234, 167, 145 ],
[ 234, 167, 146 ],
[ 234, 167, 147 ],
[ 234, 167, 148 ],
[ 234, 167, 149 ],
[ 234, 167, 150 ],
[ 234, 167, 151 ],
[ 234, 167, 152 ],
[ 234, 167, 153 ],
[ 234, 167, 176 ],
[ 234, 167, 177 ],
[ 234, 167, 178 ],
[ 234, 167, 179 ],
[ 234, 167, 180 ],
[ 234, 167, 181 ],
[ 234, 167, 182 ],
[ 234, 167, 183 ],
[ 234, 167, 184 ],
[ 234, 167, 185 ],
[ 234, 169, 144 ],
[ 234, 169, 145 ],
[ 234, 169, 146 ],
[ 234, 169, 147 ],
[ 234, 169, 148 ],
[ 234, 169, 149 ],
[ 234, 169, 150 ],
[ 234, 169, 151 ],
[ 234, 169, 152 ],
[ 234, 169, 153 ],
[ 234, 175, 176 ],
[ 234, 175, 177 ],
[ 234, 175, 178 ],
[ 234, 175, 179 ],
[ 234, 175, 180 ],
[ 234, 175, 181 ],
[ 234, 175, 182 ],
[ 234, 175, 183 ],
[ 234, 175, 184 ],
[ 234, 175, 185 ],
[ 239, 188, 144 ],
[ 239, 188, 145 ],
[ 239, 188, 146 ],
[ 239, 188, 147 ],
[ 239, 188, 148 ],
[ 239, 188, 149 ],
[ 239, 188, 150 ],
[ 239, 188, 151 ],
[ 239, 188, 152 ],
[ 239, 188, 153 ],
[ 240, 144, 132, 135 ],
[ 240, 144, 132, 136 ],
[ 240, 144, 132, 137 ],
[ 240, 144, 132, 138 ],
[ 240, 144, 132, 139 ],
[ 240, 144, 132, 140 ],
[ 240, 144, 132, 141 ],
[ 240, 144, 132, 142 ],
[ 240, 144, 132, 143 ],
[ 240, 144, 132, 144 ],
[ 240, 144, 132, 145 ],
[ 240, 144, 132, 146 ],
[ 240, 144, 132, 147 ],
[ 240, 144, 132, 148 ],
[ 240, 144, 132, 149 ],
[ 240, 144, 132, 150 ],
[ 240, 144, 132, 151 ],
[ 240, 144, 132, 152 ],
[ 240, 144, 132, 153 ],
[ 240, 144, 132, 154 ],
[ 240, 144, 132, 155 ],
[ 240, 144, 132, 156 ],
[ 240, 144, 132, 157 ],
[ 240, 144, 132, 158 ],
[ 240, 144, 132, 159 ],
[ 240, 144, 132, 160 ],
[ 240, 144, 132, 161 ],
[ 240, 144, 132, 162 ],
[ 240, 144, 132, 163 ],
[ 240, 144, 132, 164 ],
[ 240, 144, 132, 165 ],
[ 240, 144, 132, 166 ],
[ 240, 144, 132, 167 ],
[ 240, 144, 132, 168 ],
[ 240, 144, 132, 169 ],
[ 240, 144, 132, 170 ],
[ 240, 144, 132, 171 ],
[ 240, 144, 132, 172 ],
[ 240, 144, 132, 173 ],
[ 240, 144, 132, 174 ],
[ 240, 144, 132, 175 ],
[ 240, 144, 132, 176 ],
[ 240, 144, 132, 177 ],
[ 240, 144, 132, 178 ],
[ 240, 144, 132, 179 ],
[ 240, 144, 133, 128 ],
[ 240, 144, 133, 129 ],
[ 240, 144, 133, 130 ],
[ 240, 144, 133, 131 ],
[ 240, 144, 133, 132 ],
[ 240, 144, 133, 133 ],
[ 240, 144, 133, 134 ],
[ 240, 144, 133, 135 ],
[ 240, 144, 133, 136 ],
[ 240, 144, 133, 137 ],
[ 240, 144, 133, 138 ],
[ 240, 144, 133, 139 ],
[ 240, 144, 133, 140 ],
[ 240, 144, 133, 141 ],
[ 240, 144, 133, 142 ],
[ 240, 144, 133, 143 ],
[ 240, 144, 133, 144 ],
[ 240, 144, 133, 145 ],
[ 240, 144, 133, 146 ],
[ 240, 144, 133, 147 ],
[ 240, 144, 133, 148 ],
[ 240, 144, 133, 149 ],
[ 240, 144, 133, 150 ],
[ 240, 144, 133, 151 ],
[ 240, 144, 133, 152 ],
[ 240, 144, 133, 153 ],
[ 240, 144, 133, 154 ],
[ 240, 144, 133, 155 ],
[ 240, 144, 133, 156 ],
[ 240, 144, 133, 157 ],
[ 240, 144, 133, 158 ],
[ 240, 144, 133, 159 ],
[ 240, 144, 133, 160 ],
[ 240, 144, 133, 161 ],
[ 240, 144, 133, 162 ],
[ 240, 144, 133, 163 ],
[ 240, 144, 133, 164 ],
[ 240, 144, 133, 165 ],
[ 240, 144, 133, 166 ],
[ 240, 144, 133, 167 ],
[ 240, 144, 133, 168 ],
[ 240, 144, 133, 169 ],
[ 240, 144, 133, 170 ],
[ 240, 144, 133, 171 ],
[ 240, 144, 133, 172 ],
[ 240, 144, 133, 173 ],
[ 240, 144, 133, 174 ],
[ 240, 144, 133, 175 ],
[ 240, 144, 133, 176 ],
[ 240, 144, 133, 177 ],
[ 240, 144, 133, 178 ],
[ 240, 144, 133, 179 ],
[ 240, 144, 133, 180 ],
[ 240, 144, 133, 181 ],
[ 240, 144, 133, 182 ],
[ 240, 144, 133, 183 ],
[ 240, 144, 133, 184 ],
[ 240, 144, 134, 138 ],
[ 240, 144, 134, 139 ],
[ 240, 144, 139, 161 ],
[ 240, 144, 139, 162 ],
[ 240, 144, 139, 163 ],
[ 240, 144, 139, 164 ],
[ 240, 144, 139, 165 ],
[ 240, 144, 139, 166 ],
[ 240, 144, 139, 167 ],
[ 240, 144, 139, 168 ],
[ 240, 144, 139, 169 ],
[ 240, 144, 139, 170 ],
[ 240, 144, 139, 171 ],
[ 240, 144, 139, 172 ],
[ 240, 144, 139, 173 ],
[ 240, 144, 139, 174 ],
[ 240, 144, 139, 175 ],
[ 240, 144, 139, 176 ],
[ 240, 144, 139, 177 ],
[ 240, 144, 139, 178 ],
[ 240, 144, 139, 179 ],
[ 240, 144, 139, 180 ],
[ 240, 144, 139, 181 ],
[ 240, 144, 139, 182 ],
[ 240, 144, 139, 183 ],
[ 240, 144, 139, 184 ],
[ 240, 144, 139, 185 ],
[ 240, 144, 139, 186 ],
[ 240, 144, 139, 187 ],
[ 240, 144, 140, 160 ],
[ 240, 144, 140, 161 ],
[ 240, 144, 140, 162 ],
[ 240, 144, 140, 163 ],
[ 240, 144, 141, 129 ],
[ 240, 144, 141, 138 ],
[ 240, 144, 143, 145 ],
[ 240, 144, 143, 146 ],
[ 240, 144, 143, 147 ],
[ 240, 144, 143, 148 ],
[ 240, 144, 143, 149 ],
[ 240, 144, 146, 160 ],
[ 240, 144, 146, 161 ],
[ 240, 144, 146, 162 ],
[ 240, 144, 146, 163 ],
[ 240, 144, 146, 164 ],
[ 240, 144, 146, 165 ],
[ 240, 144, 146, 166 ],
[ 240, 144, 146, 167 ],
[ 240, 144, 146, 168 ],
[ 240, 144, 146, 169 ],
[ 240, 144, 161, 152 ],
[ 240, 144, 161, 153 ],
[ 240, 144, 161, 154 ],
[ 240, 144, 161, 155 ],
[ 240, 144, 161, 156 ],
[ 240, 144, 161, 157 ],
[ 240, 144, 161, 158 ],
[ 240, 144, 161, 159 ],
[ 240, 144, 161, 185 ],
[ 240, 144, 161, 186 ],
[ 240, 144, 161, 187 ],
[ 240, 144, 161, 188 ],
[ 240, 144, 161, 189 ],
[ 240, 144, 161, 190 ],
[ 240, 144, 161, 191 ],
[ 240, 144, 162, 167 ],
[ 240, 144, 162, 168 ],
[ 240, 144, 162, 169 ],
[ 240, 144, 162, 170 ],
[ 240, 144, 162, 171 ],
[ 240, 144, 162, 172 ],
[ 240, 144, 162, 173 ],
[ 240, 144, 162, 174 ],
[ 240, 144, 162, 175 ],
[ 240, 144, 163, 187 ],
[ 240, 144, 163, 188 ],
[ 240, 144, 163, 189 ],
[ 240, 144, 163, 190 ],
[ 240, 144, 163, 191 ],
[ 240, 144, 164, 150 ],
[ 240, 144, 164, 151 ],
[ 240, 144, 164, 152 ],
[ 240, 144, 164, 153 ],
[ 240, 144, 164, 154 ],
[ 240, 144, 164, 155 ],
[ 240, 144, 166, 188 ],
[ 240, 144, 166, 189 ],
[ 240, 144, 167, 128 ],
[ 240, 144, 167, 129 ],
[ 240, 144, 167, 130 ],
[ 240, 144, 167, 131 ],
[ 240, 144, 167, 132 ],
[ 240, 144, 167, 133 ],
[ 240, 144, 167, 134 ],
[ 240, 144, 167, 135 ],
[ 240, 144, 167, 136 ],
[ 240, 144, 167, 137 ],
[ 240, 144, 167, 138 ],
[ 240, 144, 167, 139 ],
[ 240, 144, 167, 140 ],
[ 240, 144, 167, 141 ],
[ 240, 144, 167, 142 ],
[ 240, 144, 167, 143 ],
[ 240, 144, 167, 146 ],
[ 240, 144, 167, 147 ],
[ 240, 144, 167, 148 ],
[ 240, 144, 167, 149 ],
[ 240, 144, 167, 150 ],
[ 240, 144, 167, 151 ],
[ 240, 144, 167, 152 ],
[ 240, 144, 167, 153 ],
[ 240, 144, 167, 154 ],
[ 240, 144, 167, 155 ],
[ 240, 144, 167, 156 ],
[ 240, 144, 167, 157 ],
[ 240, 144, 167, 158 ],
[ 240, 144, 167, 159 ],
[ 240, 144, 167, 160 ],
[ 240, 144, 167, 161 ],
[ 240, 144, 167, 162 ],
[ 240, 144, 167, 163 ],
[ 240, 144, 167, 164 ],
[ 240, 144, 167, 165 ],
[ 240, 144, 167, 166 ],
[ 240, 144, 167, 167 ],
[ 240, 144, 167, 168 ],
[ 240, 144, 167, 169 ],
[ 240, 144, 167, 170 ],
[ 240, 144, 167, 171 ],
[ 240, 144, 167, 172 ],
[ 240, 144, 167, 173 ],
[ 240, 144, 167, 174 ],
[ 240, 144, 167, 175 ],
[ 240, 144, 167, 176 ],
[ 240, 144, 167, 177 ],
[ 240, 144, 167, 178 ],
[ 240, 144, 167, 179 ],
[ 240, 144, 167, 180 ],
[ 240, 144, 167, 181 ],
[ 240, 144, 167, 182 ],
[ 240, 144, 167, 183 ],
[ 240, 144, 167, 184 ],
[ 240, 144, 167, 185 ],
[ 240, 144, 167, 186 ],
[ 240, 144, 167, 187 ],
[ 240, 144, 167, 188 ],
[ 240, 144, 167, 189 ],
[ 240, 144, 167, 190 ],
[ 240, 144, 167, 191 ],
[ 240, 144, 169, 128 ],
[ 240, 144, 169, 129 ],
[ 240, 144, 169, 130 ],
[ 240, 144, 169, 131 ],
[ 240, 144, 169, 132 ],
[ 240, 144, 169, 133 ],
[ 240, 144, 169, 134 ],
[ 240, 144, 169, 135 ],
[ 240, 144, 169, 189 ],
[ 240, 144, 169, 190 ],
[ 240, 144, 170, 157 ],
[ 240, 144, 170, 158 ],
[ 240, 144, 170, 159 ],
[ 240, 144, 171, 171 ],
[ 240, 144, 171, 172 ],
[ 240, 144, 171, 173 ],
[ 240, 144, 171, 174 ],
[ 240, 144, 171, 175 ],
[ 240, 144, 173, 152 ],
[ 240, 144, 173, 153 ],
[ 240, 144, 173, 154 ],
[ 240, 144, 173, 155 ],
[ 240, 144, 173, 156 ],
[ 240, 144, 173, 157 ],
[ 240, 144, 173, 158 ],
[ 240, 144, 173, 159 ],
[ 240, 144, 173, 184 ],
[ 240, 144, 173, 185 ],
[ 240, 144, 173, 186 ],
[ 240, 144, 173, 187 ],
[ 240, 144, 173, 188 ],
[ 240, 144, 173, 189 ],
[ 240, 144, 173, 190 ],
[ 240, 144, 173, 191 ],
[ 240, 144, 174, 169 ],
[ 240, 144, 174, 170 ],
[ 240, 144, 174, 171 ],
[ 240, 144, 174, 172 ],
[ 240, 144, 174, 173 ],
[ 240, 144, 174, 174 ],
[ 240, 144, 174, 175 ],
[ 240, 144, 179, 186 ],
[ 240, 144, 179, 187 ],
[ 240, 144, 179, 188 ],
[ 240, 144, 179, 189 ],
[ 240, 144, 179, 190 ],
[ 240, 144, 179, 191 ],
[ 240, 144, 185, 160 ],
[ 240, 144, 185, 161 ],
[ 240, 144, 185, 162 ],
[ 240, 144, 185, 163 ],
[ 240, 144, 185, 164 ],
[ 240, 144, 185, 165 ],
[ 240, 144, 185, 166 ],
[ 240, 144, 185, 167 ],
[ 240, 144, 185, 168 ],
[ 240, 144, 185, 169 ],
[ 240, 144, 185, 170 ],
[ 240, 144, 185, 171 ],
[ 240, 144, 185, 172 ],
[ 240, 144, 185, 173 ],
[ 240, 144, 185, 174 ],
[ 240, 144, 185, 175 ],
[ 240, 144, 185, 176 ],
[ 240, 144, 185, 177 ],
[ 240, 144, 185, 178 ],
[ 240, 144, 185, 179 ],
[ 240, 144, 185, 180 ],
[ 240, 144, 185, 181 ],
[ 240, 144, 185, 182 ],
[ 240, 144, 185, 183 ],
[ 240, 144, 185, 184 ],
[ 240, 144, 185, 185 ],
[ 240, 144, 185, 186 ],
[ 240, 144, 185, 187 ],
[ 240, 144, 185, 188 ],
[ 240, 144, 185, 189 ],
[ 240, 144, 185, 190 ],
[ 240, 145, 129, 146 ],
[ 240, 145, 129, 147 ],
[ 240, 145, 129, 148 ],
[ 240, 145, 129, 149 ],
[ 240, 145, 129, 150 ],
[ 240, 145, 129, 151 ],
[ 240, 145, 129, 152 ],
[ 240, 145, 129, 153 ],
[ 240, 145, 129, 154 ],
[ 240, 145, 129, 155 ],
[ 240, 145, 129, 156 ],
[ 240, 145, 129, 157 ],
[ 240, 145, 129, 158 ],
[ 240, 145, 129, 159 ],
[ 240, 145, 129, 160 ],
[ 240, 145, 129, 161 ],
[ 240, 145, 129, 162 ],
[ 240, 145, 129, 163 ],
[ 240, 145, 129, 164 ],
[ 240, 145, 129, 165 ],
[ 240, 145, 129, 166 ],
[ 240, 145, 129, 167 ],
[ 240, 145, 129, 168 ],
[ 240, 145, 129, 169 ],
[ 240, 145, 129, 170 ],
[ 240, 145, 129, 171 ],
[ 240, 145, 129, 172 ],
[ 240, 145, 129, 173 ],
[ 240, 145, 129, 174 ],
[ 240, 145, 129, 175 ],
[ 240, 145, 131, 176 ],
[ 240, 145, 131, 177 ],
[ 240, 145, 131, 178 ],
[ 240, 145, 131, 179 ],
[ 240, 145, 131, 180 ],
[ 240, 145, 131, 181 ],
[ 240, 145, 131, 182 ],
[ 240, 145, 131, 183 ],
[ 240, 145, 131, 184 ],
[ 240, 145, 131, 185 ],
[ 240, 145, 132, 182 ],
[ 240, 145, 132, 183 ],
[ 240, 145, 132, 184 ],
[ 240, 145, 132, 185 ],
[ 240, 145, 132, 186 ],
[ 240, 145, 132, 187 ],
[ 240, 145, 132, 188 ],
[ 240, 145, 132, 189 ],
[ 240, 145, 132, 190 ],
[ 240, 145, 132, 191 ],
[ 240, 145, 135, 144 ],
[ 240, 145, 135, 145 ],
[ 240, 145, 135, 146 ],
[ 240, 145, 135, 147 ],
[ 240, 145, 135, 148 ],
[ 240, 145, 135, 149 ],
[ 240, 145, 135, 150 ],
[ 240, 145, 135, 151 ],
[ 240, 145, 135, 152 ],
[ 240, 145, 135, 153 ],
[ 240, 145, 135, 161 ],
[ 240, 145, 135, 162 ],
[ 240, 145, 135, 163 ],
[ 240, 145, 135, 164 ],
[ 240, 145, 135, 165 ],
[ 240, 145, 135, 166 ],
[ 240, 145, 135, 167 ],
[ 240, 145, 135, 168 ],
[ 240, 145, 135, 169 ],
[ 240, 145, 135, 170 ],
[ 240, 145, 135, 171 ],
[ 240, 145, 135, 172 ],
[ 240, 145, 135, 173 ],
[ 240, 145, 135, 174 ],
[ 240, 145, 135, 175 ],
[ 240, 145, 135, 176 ],
[ 240, 145, 135, 177 ],
[ 240, 145, 135, 178 ],
[ 240, 145, 135, 179 ],
[ 240, 145, 135, 180 ],
[ 240, 145, 139, 176 ],
[ 240, 145, 139, 177 ],
[ 240, 145, 139, 178 ],
[ 240, 145, 139, 179 ],
[ 240, 145, 139, 180 ],
[ 240, 145, 139, 181 ],
[ 240, 145, 139, 182 ],
[ 240, 145, 139, 183 ],
[ 240, 145, 139, 184 ],
[ 240, 145, 139, 185 ],
[ 240, 145, 147, 144 ],
[ 240, 145, 147, 145 ],
[ 240, 145, 147, 146 ],
[ 240, 145, 147, 147 ],
[ 240, 145, 147, 148 ],
[ 240, 145, 147, 149 ],
[ 240, 145, 147, 150 ],
[ 240, 145, 147, 151 ],
[ 240, 145, 147, 152 ],
[ 240, 145, 147, 153 ],
[ 240, 145, 153, 144 ],
[ 240, 145, 153, 145 ],
[ 240, 145, 153, 146 ],
[ 240, 145, 153, 147 ],
[ 240, 145, 153, 148 ],
[ 240, 145, 153, 149 ],
[ 240, 145, 153, 150 ],
[ 240, 145, 153, 151 ],
[ 240, 145, 153, 152 ],
[ 240, 145, 153, 153 ],
[ 240, 145, 155, 128 ],
[ 240, 145, 155, 129 ],
[ 240, 145, 155, 130 ],
[ 240, 145, 155, 131 ],
[ 240, 145, 155, 132 ],
[ 240, 145, 155, 133 ],
[ 240, 145, 155, 134 ],
[ 240, 145, 155, 135 ],
[ 240, 145, 155, 136 ],
[ 240, 145, 155, 137 ],
[ 240, 145, 156, 176 ],
[ 240, 145, 156, 177 ],
[ 240, 145, 156, 178 ],
[ 240, 145, 156, 179 ],
[ 240, 145, 156, 180 ],
[ 240, 145, 156, 181 ],
[ 240, 145, 156, 182 ],
[ 240, 145, 156, 183 ],
[ 240, 145, 156, 184 ],
[ 240, 145, 156, 185 ],
[ 240, 145, 156, 186 ],
[ 240, 145, 156, 187 ],
[ 240, 145, 163, 160 ],
[ 240, 145, 163, 161 ],
[ 240, 145, 163, 162 ],
[ 240, 145, 163, 163 ],
[ 240, 145, 163, 164 ],
[ 240, 145, 163, 165 ],
[ 240, 145, 163, 166 ],
[ 240, 145, 163, 167 ],
[ 240, 145, 163, 168 ],
[ 240, 145, 163, 169 ],
[ 240, 145, 163, 170 ],
[ 240, 145, 163, 171 ],
[ 240, 145, 163, 172 ],
[ 240, 145, 163, 173 ],
[ 240, 145, 163, 174 ],
[ 240, 145, 163, 175 ],
[ 240, 145, 163, 176 ],
[ 240, 145, 163, 177 ],
[ 240, 145, 163, 178 ],
[ 240, 146, 144, 128 ],
[ 240, 146, 144, 129 ],
[ 240, 146, 144, 130 ],
[ 240, 146, 144, 131 ],
[ 240, 146, 144, 132 ],
[ 240, 146, 144, 133 ],
[ 240, 146, 144, 134 ],
[ 240, 146, 144, 135 ],
[ 240, 146, 144, 136 ],
[ 240, 146, 144, 137 ],
[ 240, 146, 144, 138 ],
[ 240, 146, 144, 139 ],
[ 240, 146, 144, 140 ],
[ 240, 146, 144, 141 ],
[ 240, 146, 144, 142 ],
[ 240, 146, 144, 143 ],
[ 240, 146, 144, 144 ],
[ 240, 146, 144, 145 ],
[ 240, 146, 144, 146 ],
[ 240, 146, 144, 147 ],
[ 240, 146, 144, 148 ],
[ 240, 146, 144, 149 ],
[ 240, 146, 144, 150 ],
[ 240, 146, 144, 151 ],
[ 240, 146, 144, 152 ],
[ 240, 146, 144, 153 ],
[ 240, 146, 144, 154 ],
[ 240, 146, 144, 155 ],
[ 240, 146, 144, 156 ],
[ 240, 146, 144, 157 ],
[ 240, 146, 144, 158 ],
[ 240, 146, 144, 159 ],
[ 240, 146, 144, 160 ],
[ 240, 146, 144, 161 ],
[ 240, 146, 144, 162 ],
[ 240, 146, 144, 163 ],
[ 240, 146, 144, 164 ],
[ 240, 146, 144, 165 ],
[ 240, 146, 144, 166 ],
[ 240, 146, 144, 167 ],
[ 240, 146, 144, 168 ],
[ 240, 146, 144, 169 ],
[ 240, 146, 144, 170 ],
[ 240, 146, 144, 171 ],
[ 240, 146, 144, 172 ],
[ 240, 146, 144, 173 ],
[ 240, 146, 144, 174 ],
[ 240, 146, 144, 175 ],
[ 240, 146, 144, 176 ],
[ 240, 146, 144, 177 ],
[ 240, 146, 144, 178 ],
[ 240, 146, 144, 179 ],
[ 240, 146, 144, 180 ],
[ 240, 146, 144, 181 ],
[ 240, 146, 144, 182 ],
[ 240, 146, 144, 183 ],
[ 240, 146, 144, 184 ],
[ 240, 146, 144, 185 ],
[ 240, 146, 144, 186 ],
[ 240, 146, 144, 187 ],
[ 240, 146, 144, 188 ],
[ 240, 146, 144, 189 ],
[ 240, 146, 144, 190 ],
[ 240, 146, 144, 191 ],
[ 240, 146, 145, 128 ],
[ 240, 146, 145, 129 ],
[ 240, 146, 145, 130 ],
[ 240, 146, 145, 131 ],
[ 240, 146, 145, 132 ],
[ 240, 146, 145, 133 ],
[ 240, 146, 145, 134 ],
[ 240, 146, 145, 135 ],
[ 240, 146, 145, 136 ],
[ 240, 146, 145, 137 ],
[ 240, 146, 145, 138 ],
[ 240, 146, 145, 139 ],
[ 240, 146, 145, 140 ],
[ 240, 146, 145, 141 ],
[ 240, 146, 145, 142 ],
[ 240, 146, 145, 143 ],
[ 240, 146, 145, 144 ],
[ 240, 146, 145, 145 ],
[ 240, 146, 145, 146 ],
[ 240, 146, 145, 147 ],
[ 240, 146, 145, 148 ],
[ 240, 146, 145, 149 ],
[ 240, 146, 145, 150 ],
[ 240, 146, 145, 151 ],
[ 240, 146, 145, 152 ],
[ 240, 146, 145, 153 ],
[ 240, 146, 145, 154 ],
[ 240, 146, 145, 155 ],
[ 240, 146, 145, 156 ],
[ 240, 146, 145, 157 ],
[ 240, 146, 145, 158 ],
[ 240, 146, 145, 159 ],
[ 240, 146, 145, 160 ],
[ 240, 146, 145, 161 ],
[ 240, 146, 145, 162 ],
[ 240, 146, 145, 163 ],
[ 240, 146, 145, 164 ],
[ 240, 146, 145, 165 ],
[ 240, 146, 145, 166 ],
[ 240, 146, 145, 167 ],
[ 240, 146, 145, 168 ],
[ 240, 146, 145, 169 ],
[ 240, 146, 145, 170 ],
[ 240, 146, 145, 171 ],
[ 240, 146, 145, 172 ],
[ 240, 146, 145, 173 ],
[ 240, 146, 145, 174 ],
[ 240, 150, 169, 160 ],
[ 240, 150, 169, 161 ],
[ 240, 150, 169, 162 ],
[ 240, 150, 169, 163 ],
[ 240, 150, 169, 164 ],
[ 240, 150, 169, 165 ],
[ 240, 150, 169, 166 ],
[ 240, 150, 169, 167 ],
[ 240, 150, 169, 168 ],
[ 240, 150, 169, 169 ],
[ 240, 150, 173, 144 ],
[ 240, 150, 173, 145 ],
[ 240, 150, 173, 146 ],
[ 240, 150, 173, 147 ],
[ 240, 150, 173, 148 ],
[ 240, 150, 173, 149 ],
[ 240, 150, 173, 150 ],
[ 240, 150, 173, 151 ],
[ 240, 150, 173, 152 ],
[ 240, 150, 173, 153 ],
[ 240, 150, 173, 155 ],
[ 240, 150, 173, 156 ],
[ 240, 150, 173, 157 ],
[ 240, 150, 173, 158 ],
[ 240, 150, 173, 159 ],
[ 240, 150, 173, 160 ],
[ 240, 150, 173, 161 ],
[ 240, 157, 141, 160 ],
[ 240, 157, 141, 161 ],
[ 240, 157, 141, 162 ],
[ 240, 157, 141, 163 ],
[ 240, 157, 141, 164 ],
[ 240, 157, 141, 165 ],
[ 240, 157, 141, 166 ],
[ 240, 157, 141, 167 ],
[ 240, 157, 141, 168 ],
[ 240, 157, 141, 169 ],
[ 240, 157, 141, 170 ],
[ 240, 157, 141, 171 ],
[ 240, 157, 141, 172 ],
[ 240, 157, 141, 173 ],
[ 240, 157, 141, 174 ],
[ 240, 157, 141, 175 ],
[ 240, 157, 141, 176 ],
[ 240, 157, 141, 177 ],
[ 240, 157, 159, 142 ],
[ 240, 157, 159, 143 ],
[ 240, 157, 159, 144 ],
[ 240, 157, 159, 145 ],
[ 240, 157, 159, 146 ],
[ 240, 157, 159, 147 ],
[ 240, 157, 159, 148 ],
[ 240, 157, 159, 149 ],
[ 240, 157, 159, 150 ],
[ 240, 157, 159, 151 ],
[ 240, 157, 159, 152 ],
[ 240, 157, 159, 153 ],
[ 240, 157, 159, 154 ],
[ 240, 157, 159, 155 ],
[ 240, 157, 159, 156 ],
[ 240, 157, 159, 157 ],
[ 240, 157, 159, 158 ],
[ 240, 157, 159, 159 ],
[ 240, 157, 159, 160 ],
[ 240, 157, 159, 161 ],
[ 240, 157, 159, 162 ],
[ 240, 157, 159, 163 ],
[ 240, 157, 159, 164 ],
[ 240, 157, 159, 165 ],
[ 240, 157, 159, 166 ],
[ 240, 157, 159, 167 ],
[ 240, 157, 159, 168 ],
[ 240, 157, 159, 169 ],
[ 240, 157, 159, 170 ],
[ 240, 157, 159, 171 ],
[ 240, 157, 159, 172 ],
[ 240, 157, 159, 173 ],
[ 240, 157, 159, 174 ],
[ 240, 157, 159, 175 ],
[ 240, 157, 159, 176 ],
[ 240, 157, 159, 177 ],
[ 240, 157, 159, 178 ],
[ 240, 157, 159, 179 ],
[ 240, 157, 159, 180 ],
[ 240, 157, 159, 181 ],
[ 240, 157, 159, 182 ],
[ 240, 157, 159, 183 ],
[ 240, 157, 159, 184 ],
[ 240, 157, 159, 185 ],
[ 240, 157, 159, 186 ],
[ 240, 157, 159, 187 ],
[ 240, 157, 159, 188 ],
[ 240, 157, 159, 189 ],
[ 240, 157, 159, 190 ],
[ 240, 157, 159, 191 ],
[ 240, 158, 163, 135 ],
[ 240, 158, 163, 136 ],
[ 240, 158, 163, 137 ],
[ 240, 158, 163, 138 ],
[ 240, 158, 163, 139 ],
[ 240, 158, 163, 140 ],
[ 240, 158, 163, 141 ],
[ 240, 158, 163, 142 ],
[ 240, 158, 163, 143 ],
[ 240, 159, 132, 128 ],
[ 240, 159, 132, 129 ],
[ 240, 159, 132, 130 ],
[ 240, 159, 132, 131 ],
[ 240, 159, 132, 132 ],
[ 240, 159, 132, 133 ],
[ 240, 159, 132, 134 ],
[ 240, 159, 132, 135 ],
[ 240, 159, 132, 136 ],
[ 240, 159, 132, 137 ],
[ 240, 159, 132, 138 ],
[ 240, 159, 132, 139 ],
[ 240, 159, 132, 140 ] ]
| 23.259414 | 26 | 0.445224 | 4,952 | 33,354 | 2.998788 | 0.017367 | 0.132929 | 0.038788 | 0.001616 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.654771 | 0.320351 | 33,354 | 1,433 | 27 | 23.275646 | 0.000309 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
90cdee84fa927e670dab02c3e23806e7a224c6ba | 127 | py | Python | zeroml/__init__.py | i008/zeroml | 849258d34606698aba44c5f0028254025755e8ff | [
"MIT"
] | null | null | null | zeroml/__init__.py | i008/zeroml | 849258d34606698aba44c5f0028254025755e8ff | [
"MIT"
] | null | null | null | zeroml/__init__.py | i008/zeroml | 849258d34606698aba44c5f0028254025755e8ff | [
"MIT"
] | null | null | null | """Top-level package for zeroml."""
__author__ = """kuba cieslik"""
__email__ = 'kubacieslik@gmail.com'
__version__ = '0.3.3'
| 21.166667 | 35 | 0.685039 | 16 | 127 | 4.6875 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026786 | 0.11811 | 127 | 5 | 36 | 25.4 | 0.642857 | 0.228346 | 0 | 0 | 0 | 0 | 0.413043 | 0.228261 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
90d65b3d778c9b4451f5dac01f537c0caa751192 | 1,233 | py | Python | Ska/engarchive/lazy.py | jmodelcxc/eng_archive | 04017f062ef1ab023a58b6d9e5bde19992c8398c | [
"BSD-3-Clause"
] | null | null | null | Ska/engarchive/lazy.py | jmodelcxc/eng_archive | 04017f062ef1ab023a58b6d9e5bde19992c8398c | [
"BSD-3-Clause"
] | 64 | 2015-02-25T20:25:41.000Z | 2022-03-26T23:39:03.000Z | Ska/engarchive/lazy.py | jmodelcxc/eng_archive | 04017f062ef1ab023a58b6d9e5bde19992c8398c | [
"BSD-3-Clause"
] | 4 | 2016-01-28T19:48:53.000Z | 2021-02-04T16:38:03.000Z | class LazyDict(dict):
def __init__(self, load_func, *args, **kwargs):
self._load_func = load_func
self._args = args
self._kwargs = kwargs
self._loaded = False
super().__init__()
def load(self):
if not self._loaded:
self.update(self._load_func(*self._args, **self._kwargs))
self._loaded = True
# Clear these out so pickling always works (pickling a func can fail)
self._load_func = None
self._args = None
self._kwargs = None
def __getitem__(self, item):
try:
return super().__getitem__(item)
except KeyError:
self.load()
return super().__getitem__(item)
def __contains__(self, item):
self.load()
return super().__contains__(item)
def keys(self):
self.load()
return super().keys()
def values(self):
self.load()
return super().values()
def items(self):
self.load()
return super().items()
def __len__(self):
self.load()
return super().__len__()
def get(self, key, default=None):
self.load()
return super().get(key, default)
| 25.163265 | 81 | 0.5515 | 139 | 1,233 | 4.510791 | 0.302158 | 0.140351 | 0.1563 | 0.212121 | 0.14673 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.332522 | 1,233 | 48 | 82 | 25.6875 | 0.761847 | 0.054339 | 0 | 0.236842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.236842 | false | 0 | 0 | 0 | 0.473684 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
90e41f31d865ffd02f6ac0d878d3eb7163ca29b8 | 192 | py | Python | allocate/__init__.py | BraeWebb/allocate | b68d7eb63623002bad2e445729d5904c4b7cadb5 | [
"MIT"
] | null | null | null | allocate/__init__.py | BraeWebb/allocate | b68d7eb63623002bad2e445729d5904c4b7cadb5 | [
"MIT"
] | 13 | 2020-02-06T11:24:20.000Z | 2020-07-27T07:37:49.000Z | allocate/__init__.py | BraeWebb/allocate | b68d7eb63623002bad2e445729d5904c4b7cadb5 | [
"MIT"
] | null | null | null | """
Tutor allocation algorithm for allocating tutors to the optimal sessions.
"""
__author__ = "Henry O'Brien, Brae Webb"
__all__ = ['allocation', 'doodle', 'model', 'solver', 'csvalidator']
| 27.428571 | 73 | 0.713542 | 22 | 192 | 5.863636 | 0.954545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135417 | 192 | 6 | 74 | 32 | 0.777108 | 0.380208 | 0 | 0 | 0 | 0 | 0.558559 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
90e49c6f0f7df62bd0819c21270fba853167f6b1 | 230 | py | Python | will_it_saturate/django/async_settings.py | ephes/will_it_saturate | dafcfcb3aa2785b885f0533aff221ec2f38f0278 | [
"Apache-2.0"
] | 1 | 2021-06-11T17:58:27.000Z | 2021-06-11T17:58:27.000Z | will_it_saturate/django/async_settings.py | ephes/will_it_saturate | dafcfcb3aa2785b885f0533aff221ec2f38f0278 | [
"Apache-2.0"
] | null | null | null | will_it_saturate/django/async_settings.py | ephes/will_it_saturate | dafcfcb3aa2785b885f0533aff221ec2f38f0278 | [
"Apache-2.0"
] | null | null | null | # AUTOGENERATED! DO NOT EDIT! File to edit: 15_django_async_settings.ipynb (unless otherwise specified).
__all__ = ['ROOT_URLCONF']
# Cell
# dont_test
from .settings import *
ROOT_URLCONF = "will_it_saturate.django.async_urls" | 23 | 104 | 0.778261 | 32 | 230 | 5.1875 | 0.8125 | 0.13253 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00995 | 0.126087 | 230 | 10 | 105 | 23 | 0.81592 | 0.508696 | 0 | 0 | 1 | 0 | 0.418182 | 0.309091 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
90e62467b0e0a22392dc01f6011f308075aa3ac0 | 485 | py | Python | nasa/warnings.py | wrap-api/python-nasa | 575d86afa8782d7681e3f97f38451964bffa1ac8 | [
"MIT"
] | null | null | null | nasa/warnings.py | wrap-api/python-nasa | 575d86afa8782d7681e3f97f38451964bffa1ac8 | [
"MIT"
] | 8 | 2021-11-08T04:08:16.000Z | 2021-11-15T02:09:15.000Z | nasa/warnings.py | wrap-api/python-nasa | 575d86afa8782d7681e3f97f38451964bffa1ac8 | [
"MIT"
] | null | null | null | from typing import Text
class BaseNASAWarning(Warning):
CODE: Text = "NASA-WARN-001"
def __init__(self, message: Text) -> None:
coded_message: Text = f"{self.CODE} - {message}"
super().__init__(coded_message)
class InvalidInputWarning(BaseNASAWarning):
CODE: Text = "NASA-WARN-002"
class AttributesCollussionWarning(BaseNASAWarning):
CODE: Text = "NASA-WARN-003"
class UnsupportedInputWarning(BaseNASAWarning):
CODE: Text = "NASA-WARN-004"
| 22.045455 | 56 | 0.703093 | 53 | 485 | 6.245283 | 0.471698 | 0.096677 | 0.145015 | 0.193353 | 0.280967 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030075 | 0.17732 | 485 | 21 | 57 | 23.095238 | 0.799499 | 0 | 0 | 0 | 0 | 0 | 0.154639 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.083333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
90e8ab4b94e586021c07981c5b4b03e666f5fa1f | 1,944 | py | Python | opensfm/geometry.py | leejaeyong7/OpenSfM | 893354cdd2f131782407d7d0be88c8fe92911b6f | [
"BSD-2-Clause"
] | 1 | 2020-10-24T11:12:54.000Z | 2020-10-24T11:12:54.000Z | opensfm/geometry.py | leejaeyong7/OpenSfM | 893354cdd2f131782407d7d0be88c8fe92911b6f | [
"BSD-2-Clause"
] | 3 | 2021-06-08T22:22:02.000Z | 2022-03-12T00:47:52.000Z | opensfm/geometry.py | leejaeyong7/OpenSfM | 893354cdd2f131782407d7d0be88c8fe92911b6f | [
"BSD-2-Clause"
] | 2 | 2020-08-04T19:08:34.000Z | 2020-08-18T15:32:45.000Z | from __future__ import division
import cv2
import numpy as np
from opensfm import transformations
def rotation_from_angle_axis(angle_axis):
return cv2.Rodrigues(np.asarray(angle_axis))[0]
def rotation_from_ptr(pan, tilt, roll):
"""Camera rotation matrix from pan, tilt and roll."""
R1 = rotation_from_angle_axis([0.0, 0.0, roll])
R2 = rotation_from_angle_axis([tilt + np.pi/2, 0.0, 0.0])
R3 = rotation_from_angle_axis([0.0, 0.0, pan])
return R1.dot(R2).dot(R3)
def ptr_from_rotation(rotation_matrix):
"""Pan tilt and roll from camera rotation matrix"""
pan = pan_from_rotation(rotation_matrix)
tilt = tilt_from_rotation(rotation_matrix)
roll = roll_from_rotation(rotation_matrix)
return pan, tilt, roll
def pan_from_rotation(rotation_matrix):
Rt_ez = np.dot(rotation_matrix.T, [0, 0, 1])
return np.arctan2(Rt_ez[0], Rt_ez[1])
def tilt_from_rotation(rotation_matrix):
Rt_ez = np.dot(rotation_matrix.T, [0, 0, 1])
l = np.linalg.norm(Rt_ez[:2])
return np.arctan2(-Rt_ez[2], l)
def roll_from_rotation(rotation_matrix):
Rt_ex = np.dot(rotation_matrix.T, [1, 0, 0])
Rt_ez = np.dot(rotation_matrix.T, [0, 0, 1])
a = np.cross(Rt_ez, [0, 0, 1])
a /= np.linalg.norm(a)
b = np.cross(Rt_ex, a)
return np.arcsin(np.dot(Rt_ez, b))
def rotation_from_ptr_v2(pan, tilt, roll):
"""Camera rotation matrix from pan, tilt and roll.
This is the implementation used in the Single Image Calibration code.
"""
tilt += np.pi / 2
return transformations.euler_matrix(pan, tilt, roll, 'szxz')[:3, :3]
def ptr_from_rotation_v2(rotation_matrix):
"""Pan tilt and roll from camera rotation matrix.
This is the implementation used in the Single Image Calibration code.
"""
T = np.identity(4)
T[:3, :3] = rotation_matrix
pan, tilt, roll = transformations.euler_from_matrix(T, 'szxz')
return pan, tilt - np.pi / 2, roll
| 29.014925 | 73 | 0.686214 | 319 | 1,944 | 3.971787 | 0.188088 | 0.187845 | 0.110497 | 0.143646 | 0.549329 | 0.395422 | 0.395422 | 0.395422 | 0.355959 | 0.355959 | 0 | 0.032932 | 0.187757 | 1,944 | 66 | 74 | 29.454545 | 0.769474 | 0.169753 | 0 | 0.078947 | 0 | 0 | 0.005092 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0 | 0.105263 | 0.026316 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
90f73c6f14025f223869453bd4954c9ddef1e84c | 4,147 | py | Python | Code/InnoSchedule/tests/reg_tests.py | Eng-MFQ/InnoCalendar | 06837d689027428d91a7c5fe8923a26b14aadffd | [
"MIT"
] | null | null | null | Code/InnoSchedule/tests/reg_tests.py | Eng-MFQ/InnoCalendar | 06837d689027428d91a7c5fe8923a26b14aadffd | [
"MIT"
] | null | null | null | Code/InnoSchedule/tests/reg_tests.py | Eng-MFQ/InnoCalendar | 06837d689027428d91a7c5fe8923a26b14aadffd | [
"MIT"
] | 1 | 2019-11-28T10:55:37.000Z | 2019-11-28T10:55:37.000Z | import datetime
from unittest.mock import MagicMock, patch, Mock
from nose.tools import assert_equal
from parameterized import parameterized
import unittest
from telebot.types import Message, User, Chat
from modules.core.source import attach_core_module
from modules.schedule import permanent
from modules.schedule.source import attach_schedule_module
(schedule_command_handler, process_course_step, process_group_step) = attach_schedule_module()
messages = []
def send_message(chat_id, message, reply_markup=None):
messages.append(message)
class TestUserRegistration(unittest.TestCase):
@parameterized.expand([
(Message(from_user=User(first_name="Oleg", id=3847590291, is_bot=False,
username="Soler"),
message_id=2211, date=datetime.datetime.now(),
chat=Chat(id=381278125782, type="private", username="Soler"),
content_type="text", options=[], json_string=""), 12)
])
def test_registration(self, message, value):
message.text = "/configure_schedule"
get_user = Mock(return_value=["Hi"])
with patch('modules.schedule.controller.get_user', new=get_user):
with patch('modules.schedule.controller.set_user_configured'):
with patch('modules.core.source.bot.send_message',side_effect=send_message):
with patch('modules.core.source.bot.register_next_step_handler'):
schedule_command_handler(message)
assert_equal(messages.pop(), permanent.REQUEST_COURSE)
messages.clear()
@parameterized.expand([
(Message(from_user=User(first_name="Oleg", id=3847590291, is_bot=False,
username="Soler"),
message_id=2211, date=datetime.datetime.now(),
chat=Chat(id=381278125782, type="private", username="Soler"),
content_type="text", options=[], json_string=""), 12)
])
def test_course_set(self, message, value):
message.text = "B19"
with patch('modules.schedule.controller.append_user_group'):
with patch('modules.core.source.bot.send_message', side_effect = send_message):
with patch('modules.core.source.bot.register_next_step_handler'):
process_course_step(message)
assert_equal(messages.pop(), permanent.REQUEST_GROUP)
@parameterized.expand([
(Message(from_user=User(first_name="Oleg", id=3847590291, is_bot=False,
username="Soler"),
message_id=2211, date=datetime.datetime.now(),
chat=Chat(id=381278125782, type="private", username="Soler"),
content_type="text", options=[], json_string=""), 12)
])
def test_group_set(self, message, value):
message.text = "B16-SE-01"
with patch('modules.schedule.controller.append_user_group'):
with patch('modules.core.source.bot.send_message', side_effect = send_message):
with patch('modules.core.source.bot.register_next_step_handler'):
with patch('modules.schedule.controller.set_user_configured'):
process_group_step(message)
assert_equal(messages.pop(), permanent.MESSAGE_SETTINGS_SAVED)
@parameterized.expand([
(Message(from_user=User(first_name="Oleg", id=3847590291, is_bot=False,
username="Soler"),
message_id=2211, date=datetime.datetime.now(),
chat=Chat(id=381278125782, type="private", username="Soler"),
content_type="text", options=[], json_string=""), 12)
])
def test_wrong_course_set(self, message, value):
message.text = "Cake is a lie"
with patch('modules.schedule.controller.append_user_group'):
with patch('modules.core.source.bot.send_message', side_effect = send_message):
with patch('modules.core.source.bot.register_next_step_handler'):
process_course_step(message)
assert_equal(messages.pop(), permanent.MESSAGE_ERROR)
| 46.595506 | 94 | 0.647215 | 467 | 4,147 | 5.524625 | 0.201285 | 0.048837 | 0.086822 | 0.062016 | 0.743411 | 0.719767 | 0.70814 | 0.660078 | 0.598837 | 0.598837 | 0 | 0.037259 | 0.236315 | 4,147 | 88 | 95 | 47.125 | 0.777392 | 0 | 0 | 0.581081 | 0 | 0 | 0.182059 | 0.146853 | 0 | 0 | 0 | 0 | 0.067568 | 1 | 0.067568 | false | 0 | 0.121622 | 0 | 0.202703 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
29050bb995546f9e5545c3a653d834b0ab173735 | 1,606 | py | Python | software_Non_AI/systemcontrols/systemcontrol.py | KKshitiz/J.A.R.V.I.S | 620cffec86991c948839a5f9ceaceb59e0a69e78 | [
"MIT"
] | 5 | 2020-08-29T12:58:40.000Z | 2022-01-23T14:20:02.000Z | software_Non_AI/systemcontrols/systemcontrol.py | KKshitiz/J.A.R.V.I.S | 620cffec86991c948839a5f9ceaceb59e0a69e78 | [
"MIT"
] | null | null | null | software_Non_AI/systemcontrols/systemcontrol.py | KKshitiz/J.A.R.V.I.S | 620cffec86991c948839a5f9ceaceb59e0a69e78 | [
"MIT"
] | 5 | 2020-08-30T19:22:44.000Z | 2021-11-19T03:35:08.000Z | from datetime import date
from key import Key
from sys import path
# path.insert(1,'C:\\Users\\skili\\Documents\\GitHub\\J.A.R.V.I.S\\nlp')
#this misc feature is made for windows systems, some functions may not work
#this module handles basic media control features
def mute():
try:
Key.mute()
except:
return False
def volumeup():
try:
Key.volume_up()
except:
return False
def volumedown():
try:
Key.volume_down()
except:
return False
def volumemin():
try:
Key.volume_min()
except:
return False
def volumemax():
try:
Key.volume_max()
except:
return False
def setvolume(v):
try:
Key.volume_set(v)
except:
return False
def playpause():
try:
Key.playpause()
except:
return False
def prevtrack():
try:
Key.previoustrack()
except:
return False
def nexttrack():
try:
Key.nexttrack()
except:
return False
#now time for some browser controls
def browserback():
try:
Key.browserback()
except:
return False
def browsernext():
try:
Key.browsernext()
except:
return False
def browserhome():
try:
Key.browserhome()
except:
return False
def browserrefresh():
try:
Key.browserrefresh()
except:
return False
def browserfav():
try:
Key.browserfav()
except:
return False
def browserback():
try:
Key.nexttrack()
except:
return False
browserback() | 15.745098 | 75 | 0.579701 | 181 | 1,606 | 5.116022 | 0.38674 | 0.097192 | 0.275378 | 0.280778 | 0.069114 | 0.069114 | 0 | 0 | 0 | 0 | 0 | 0.000924 | 0.326276 | 1,606 | 102 | 76 | 15.745098 | 0.854898 | 0.140722 | 0 | 0.620253 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.189873 | false | 0 | 0.037975 | 0 | 0.417722 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
290567e2cd39df6e62afae05c30712bf41f29a0c | 2,045 | py | Python | pyzx/graph/graph.py | mnm-team/pyzx-heuristics | 636ca151f325087c0e6ce8ed1e2ee1cb896cab56 | [
"Apache-2.0"
] | 219 | 2018-07-04T09:50:27.000Z | 2022-03-30T11:39:53.000Z | pyzx/graph/graph.py | mnm-team/pyzx-heuristics | 636ca151f325087c0e6ce8ed1e2ee1cb896cab56 | [
"Apache-2.0"
] | 74 | 2018-07-17T13:56:49.000Z | 2022-03-30T16:11:56.000Z | pyzx/graph/graph.py | mnm-team/pyzx-heuristics | 636ca151f325087c0e6ce8ed1e2ee1cb896cab56 | [
"Apache-2.0"
] | 73 | 2018-07-10T13:58:38.000Z | 2022-02-15T14:59:45.000Z | # PyZX - Python library for quantum circuit rewriting
# and optimization using the ZX-calculus
# Copyright (C) 2018 - Aleks Kissinger and John van de Wetering
# 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 typing import Optional
from .base import BaseGraph
from .graph_s import GraphS
try:
import quizx # type: ignore
except ImportError:
quizx = None
backends = { 'simple': True, 'quizx-vec': True }
def Graph(backend:Optional[str]=None) -> BaseGraph:
"""Returns an instance of an implementation of :class:`~pyzx.graph.base.BaseGraph`.
By default :class:`~pyzx.graph.graph_s.GraphS` is used.
Currently ``backend`` is allowed to be `simple` (for the default),
or 'graph_tool' and 'igraph'.
This method is the preferred way to instantiate a ZX-diagram in PyZX.
Example:
To construct an empty ZX-diagram, just write::
g = zx.Graph()
"""
if backend is None: backend = 'simple'
if backend not in backends:
raise KeyError("Unavailable backend '{}'".format(backend))
if backend == 'simple': return GraphS()
if backend == 'graph_tool':
return GraphGT()
if backend == 'igraph': return GraphIG()
if backend == 'quizx-vec': return quizx.VecGraph() # type: ignore
return GraphS()
Graph.from_json = GraphS.from_json # type: ignore
Graph.from_tikz = GraphS.from_tikz # type: ignore
try:
import graph_tool.all as gt
from .graph_gt import GraphGT
backends['graph_tool'] = gt
except ImportError:
pass
try:
import igraph as ig
from .graph_ig import GraphIG
backends['igraph'] = ig
except ImportError:
pass
| 30.522388 | 85 | 0.733985 | 301 | 2,045 | 4.946844 | 0.45515 | 0.040296 | 0.017461 | 0.021491 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00472 | 0.171149 | 2,045 | 66 | 86 | 30.984848 | 0.873746 | 0.560391 | 0 | 0.25 | 0 | 0 | 0.102679 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.03125 | false | 0.0625 | 0.34375 | 0 | 0.4375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
2909e1c228332071a6db4659aff74543d32b4a5f | 519 | py | Python | Aulasatualizada/execicio_curso em video/execicio_Analise_de_dados_em_Tuplas.py | swellington231/AulaPaython | 7b72ddec4d85f4660c0c395de07a133993aa2c70 | [
"MIT"
] | null | null | null | Aulasatualizada/execicio_curso em video/execicio_Analise_de_dados_em_Tuplas.py | swellington231/AulaPaython | 7b72ddec4d85f4660c0c395de07a133993aa2c70 | [
"MIT"
] | null | null | null | Aulasatualizada/execicio_curso em video/execicio_Analise_de_dados_em_Tuplas.py | swellington231/AulaPaython | 7b72ddec4d85f4660c0c395de07a133993aa2c70 | [
"MIT"
] | null | null | null | num = (int(input('Digite um numero: ')),
int(input('Digite outro numero: ')),
int(input('Digite mais um numero: ')),
int(input('Digite o ultimo numero: ')))
print(f'Os numero digitados foram: {num}')
print(f'O numero 9 apareceu {num.count(9)} vezes')
if 3 in num:
print(f'\nO numero 3 foi digita a primeira vez na posição: {num.index(3)+1}ª')
else:
print('O valor três não foi digitado: ')
print('Os numeros pares são: ')
for n in num:
if n % 2 == 0:
print(f'{n}',end= ' ')
| 32.4375 | 82 | 0.603083 | 86 | 519 | 3.639535 | 0.523256 | 0.102236 | 0.178914 | 0.191693 | 0.140575 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019901 | 0.225434 | 519 | 15 | 83 | 34.6 | 0.758706 | 0 | 0 | 0 | 0 | 0.071429 | 0.546332 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
290dca7ac8b4603691f218b7c746412909047984 | 1,497 | py | Python | test_files/test_interpolation.py | slash-segmentation/DP2 | 6f768e4b8a75a3ab2bf1359ae94704332426a4d6 | [
"Unlicense"
] | null | null | null | test_files/test_interpolation.py | slash-segmentation/DP2 | 6f768e4b8a75a3ab2bf1359ae94704332426a4d6 | [
"Unlicense"
] | null | null | null | test_files/test_interpolation.py | slash-segmentation/DP2 | 6f768e4b8a75a3ab2bf1359ae94704332426a4d6 | [
"Unlicense"
] | null | null | null | #http://www.scipy.org/Cookbook/Interpolation
from scipy import ogrid, sin, mgrid, ndimage, array
import numpy
x,y = ogrid[-1:1:3j,-1:1:3j]
fvals = sin(x)*sin(y)
newx,newy = mgrid[-1:1:6j,-1:1:6j]
x0 = x[0,0]
y0 = y[0,0]
dx = x[1,0] - x0
dy = y[0,1] - y0
# make indicies go from 0 to n-1 considering n is number of rows or cols in the x matrix (or the y matrix)
ivals = (newx - x0)/dx
jvals = (newy - y0)/dy
coords = array([ivals, jvals])
#coords1 = mgrid[0:2:6j,0:2:6j] #this works with ndimage.map_coordinates
#coords1 = ogrid[0:2:6j,0:2:6j] #this does not work with ndimage.map_coordinates
print "fvals"
print fvals
#print "coords1"
#print coords1
print "-----------"
#print numpy.abs(coords1[0])
newf = ndimage.map_coordinates(fvals, coords)
#newf = ndimage.map_coordinates(fvals, coords1)
#newf = ndimage.map_coordinates(fvals, numpy.abs(coords1))
print "newf"
print newf
if 0:
print newx.shape
print newy.shape
#print mgrid[1:3,1:3,1:3]
xtest,ytest = mgrid[1:3,1:3]
print 'xtest'
print xtest
print 'ytest'
print ytest
values = array([[50,60],[70,80]])
coordinates = array([[2,3,4,5],[0,1,2,3]])
print coordinates
print '------------------'
print ndimage.map_coordinates(values, coordinates)
# checking how output is arranged into rows and colums, what coordinate is for rows and what is for columns
print 'zeros'
#a = numpy.zeros(3,4)
a = numpy.zeros((3,5))
print a
| 23.390625 | 112 | 0.636607 | 250 | 1,497 | 3.788 | 0.332 | 0.063358 | 0.133052 | 0.079197 | 0.139388 | 0.025343 | 0.025343 | 0 | 0 | 0 | 0 | 0.066331 | 0.204409 | 1,497 | 63 | 113 | 23.761905 | 0.728799 | 0.404142 | 0 | 0 | 0 | 0 | 0.060364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.058824 | null | null | 0.470588 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
290f9c61154a9c9fd6b73ca7ff66fb7eb1dfbfdc | 1,140 | py | Python | generator.py | citrus1998/Non-Saturating-GAN | 2b6fc6c5a84977916d4e27c31ccfca7ce4c35821 | [
"MIT"
] | null | null | null | generator.py | citrus1998/Non-Saturating-GAN | 2b6fc6c5a84977916d4e27c31ccfca7ce4c35821 | [
"MIT"
] | null | null | null | generator.py | citrus1998/Non-Saturating-GAN | 2b6fc6c5a84977916d4e27c31ccfca7ce4c35821 | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
class Generator(nn.Module) :
# gray => n_channel = 1, color => n_channel = 3
def __init__(self, z_dim = 100, g_n_channel = 64, n_channel = 3) :
super(Generator, self).__init__()
self.layers = nn.Sequential(
nn.ConvTranspose2d(z_dim, g_n_channel * 8, 4, 1, 0, bias=False),
nn.BatchNorm2d(g_n_channel * 8),
nn.ReLU(inplace=True),
nn.ConvTranspose2d(g_n_channel * 8, g_n_channel * 4, 4, 2, 1, bias=False),
nn.BatchNorm2d(g_n_channel * 4),
nn.ReLU(inplace=True),
nn.ConvTranspose2d(g_n_channel * 4, g_n_channel * 2, 4, 2, 1, bias=False),
nn.BatchNorm2d(g_n_channel * 2),
nn.ReLU(inplace=True),
nn.ConvTranspose2d(g_n_channel * 2, g_n_channel * 1, 4, 2, 1, bias=False),
nn.BatchNorm2d(g_n_channel * 1),
nn.ReLU(inplace=True),
nn.ConvTranspose2d(g_n_channel * 1, n_channel, 4, 2, 1, bias=False),
nn.Tanh()
)
def forward(self, z) :
return self.layers(z)
| 35.625 | 87 | 0.55614 | 161 | 1,140 | 3.689441 | 0.236025 | 0.228956 | 0.19697 | 0.148148 | 0.537037 | 0.537037 | 0.513468 | 0.461279 | 0.461279 | 0.171717 | 0 | 0.056774 | 0.320175 | 1,140 | 31 | 88 | 36.774194 | 0.709677 | 0.039474 | 0 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.086957 | false | 0 | 0.086957 | 0.043478 | 0.26087 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
2917d6056f1a8b753aa0271541877960ebb72dae | 1,935 | py | Python | tensorflow/contrib/kernel_methods/python/mappers/dense_kernel_mapper.py | uve/tensorflow | e08079463bf43e5963acc41da1f57e95603f8080 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/kernel_methods/python/mappers/dense_kernel_mapper.py | uve/tensorflow | e08079463bf43e5963acc41da1f57e95603f8080 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/kernel_methods/python/mappers/dense_kernel_mapper.py | uve/tensorflow | e08079463bf43e5963acc41da1f57e95603f8080 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""API class for dense (approximate) kernel mappers.
See ./random_fourier_features.py for a concrete instantiation of this class.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import six
class InvalidShapeError(Exception):
"""Exception thrown when a tensor's shape deviates from an expected shape."""
@six.add_metaclass(abc.ABCMeta)
class DenseKernelMapper(object):
"""Abstract class for a kernel mapper that maps dense inputs to dense outputs.
This class is abstract. Users should not create instances of this class.
"""
@abc.abstractmethod
def map(self, input_tensor):
"""Main Dense-Tensor-In-Dense-Tensor-Out (DTIDTO) map method.
Should be implemented by subclasses.
Args:
input_tensor: The dense input tensor to be mapped using the (approximate)
kernel mapper.
"""
raise NotImplementedError('map is not implemented for {}.'.format(self))
@abc.abstractproperty
def name(self):
"""Returns the name of the kernel mapper."""
pass
@abc.abstractproperty
def output_dim(self):
"""Returns the output dimension of the mapping."""
pass
| 32.79661 | 81 | 0.692506 | 252 | 1,935 | 5.238095 | 0.543651 | 0.045455 | 0.036364 | 0.024242 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005131 | 0.194315 | 1,935 | 58 | 82 | 33.362069 | 0.841565 | 0.667183 | 0 | 0.235294 | 0 | 0 | 0.058252 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0.117647 | 0.294118 | 0 | 0.588235 | 0.058824 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
291e415954915adfd28205baebffe3ba7fa8c0cd | 3,797 | py | Python | consent.py | yawgmoth/NVHanabi | d87d17ec3326bffa29e6f2525227e7e79945a728 | [
"BSD-3-Clause"
] | null | null | null | consent.py | yawgmoth/NVHanabi | d87d17ec3326bffa29e6f2525227e7e79945a728 | [
"BSD-3-Clause"
] | null | null | null | consent.py | yawgmoth/NVHanabi | d87d17ec3326bffa29e6f2525227e7e79945a728 | [
"BSD-3-Clause"
] | null | null | null |
consent = """<center><table width="800px"><tr><td>
<font size="16"><b>University of Costa Rica<br/> </font>
INFORMED CONSENT FORM for RESEARCH<br/></b>
<b>Title of Study:</b> Hanabi AI Agents<br/>
<b>Principal Investigator:</b> Dr. Markus Eger <br/>
<h2>What are some general things you should know about research studies?</h2>
<p>You are being asked to take part in a research study. Your participation in this study is voluntary. You have the right to be a part of this study, to choose not to participate or to stop participating at any time without penalty. The purpose of research studies is to gain a better understanding of a certain topic or issue. </p>
<p>You are not guaranteed any personal benefits from being in a study. Research studies also may pose risks to those that participate. In this consent form you will find specific details about the research in which you are being asked to participate. If you do not understand something in this form it is your right to ask the researcher for clarification or more information. A copy of this consent form will be provided to you. If at any time you have questions about your participation, do not hesitate to contact the researcher(s) named above. </p>
<h2>What is the purpose of this study?</h2>
<p>The purpose of the study is to determine which type of AI plays well with humans in the cooperative card game Hanabi. <b>You must be between 18 and 64 years to participate.</b></p>
<h2>What will happen if you take part in the study?</h2>
<p>If you agree to participate in this study, you will play two games of a browser-based implementation of Hanabi with an AI controlled player, and then answer some questions about your experience with the AI and board games in general. If you enjoy your experience (and we hope you do), you can also play more often. </p>
<h2>Risks</h2>
<p>The risks of this study do not exceed normal computer use. </p>
<h2>Benefits</h2>
<p>There are no direct benefits to your participation in the research. The indirect benefits are that you may actually enjoy playing the game with the AI. For participating in this study you will receive <b>no compensation.</b></p>
<h2>Confidentiality</h2>
<p>The information in the study records will be kept confidential to the full extent allowed by law. Data will be stored securely on a secure computer that only the researchers can access. No reference will be made in oral or written reports which could link you to the study. After the conclusion of the study, the information we gathered will be released to the public to foster further research. Note that none of this information can be linked back to you personally, and that you can choose if you want to be included in the published data at the end of the experiment.
</p>
<h2>What if you are a UCR student?</h2>
<p>Participation in this study is not a course requirement and your participation or lack thereof, will not affect your class standing or grades at UCR.</p>
<h2>What if you are a UCR employee?</h2>
<p>Participation in this study is not a requirement of your employment at UCR, and your participation or lack thereof, will not affect your job.</p>
<h2>What if you have questions about this study?</h2>
<p>If you have questions at any time about the study itself or the procedures implemented in this study, you may contact the researcher, Markus Eger by email: markus.eger@ucr.ac.cr
<h2>Consent To Participate</h2>
I have read and understand the above information. I have received a copy of this form. I agree to participate in this study with the understanding that I may choose not to participate or to stop participating at any time without penalty or loss of benefits to which I am otherwise entitled.</td></tr></table></center>
""" | 88.302326 | 576 | 0.762444 | 671 | 3,797 | 4.314456 | 0.33234 | 0.034197 | 0.026598 | 0.02487 | 0.179275 | 0.136097 | 0.116062 | 0.116062 | 0.102936 | 0.080138 | 0 | 0.009277 | 0.176718 | 3,797 | 43 | 577 | 88.302326 | 0.916827 | 0 | 0 | 0 | 0 | 0.357143 | 0.995472 | 0.039158 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
292b0fff0a1c5514dcb3ed5cdc8beaf3e6cb6ba6 | 322 | py | Python | operators/readers/csv/reader_json.py | OrcaWorkflows/orca | 77e849812a439cdfd1755c95915a9de2af12095f | [
"Apache-2.0"
] | null | null | null | operators/readers/csv/reader_json.py | OrcaWorkflows/orca | 77e849812a439cdfd1755c95915a9de2af12095f | [
"Apache-2.0"
] | null | null | null | operators/readers/csv/reader_json.py | OrcaWorkflows/orca | 77e849812a439cdfd1755c95915a9de2af12095f | [
"Apache-2.0"
] | null | null | null | from readers.base.reader_strategy import ReaderStrategy
import pandas as pd
import io
import json
class ReaderJSON(ReaderStrategy):
def read_file(self, file: io.BytesIO):
json_data = json.loads(file.read())
return json_data
def read_file_as_pandas(self, file):
return pd.read_json(file)
| 23 | 55 | 0.726708 | 46 | 322 | 4.913043 | 0.478261 | 0.061947 | 0.097345 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195652 | 322 | 13 | 56 | 24.769231 | 0.872587 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0.1 | 0.9 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
292c94ecab96fb9cbd65e1e1a1728b661546558e | 1,312 | py | Python | sdk/python/pulumi_azure_native/automanage/v20200630preview/_enums.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | 31 | 2020-09-21T09:41:01.000Z | 2021-02-26T13:21:59.000Z | sdk/python/pulumi_azure_native/automanage/v20200630preview/_enums.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | 231 | 2020-09-21T09:38:45.000Z | 2021-03-01T11:16:03.000Z | sdk/python/pulumi_azure_native/automanage/v20200630preview/_enums.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | 4 | 2020-09-29T14:14:59.000Z | 2021-02-10T20:38:16.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'ConfigurationProfile',
'EnableRealTimeProtection',
'ResourceIdentityType',
'RunScheduledScan',
'ScanType',
]
class ConfigurationProfile(str, Enum):
"""
A value indicating configuration profile.
"""
AZURE_VIRTUAL_MACHINE_BEST_PRACTICES_DEV_TEST = "Azure virtual machine best practices – Dev/Test"
AZURE_VIRTUAL_MACHINE_BEST_PRACTICES_PRODUCTION = "Azure virtual machine best practices – Production"
class EnableRealTimeProtection(str, Enum):
"""
Enables or disables Real Time Protection
"""
TRUE = "True"
FALSE = "False"
class ResourceIdentityType(str, Enum):
"""
The type of identity used for the Automanage account. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity.
"""
SYSTEM_ASSIGNED = "SystemAssigned"
NONE = "None"
class RunScheduledScan(str, Enum):
"""
Enables or disables a periodic scan for antimalware
"""
TRUE = "True"
FALSE = "False"
class ScanType(str, Enum):
"""
Type of scheduled scan
"""
QUICK = "Quick"
FULL = "Full"
| 24.296296 | 151 | 0.682165 | 147 | 1,312 | 5.993197 | 0.564626 | 0.039728 | 0.086266 | 0.104427 | 0.270148 | 0.127128 | 0.088536 | 0 | 0 | 0 | 0 | 0.000977 | 0.219512 | 1,312 | 53 | 152 | 24.754717 | 0.857422 | 0.356707 | 0 | 0.173913 | 1 | 0 | 0.298956 | 0.031332 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.043478 | 0 | 0.695652 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
293619452892e01e35482d91ba6f91688bb63d7c | 452 | py | Python | CrackingCodingInterview/2.1_remove_duplicates.py | HeyIamJames/CodingInterviewPractice | ea7f849e4eba9c4c7269b52aa7be48e7995c0f37 | [
"MIT"
] | null | null | null | CrackingCodingInterview/2.1_remove_duplicates.py | HeyIamJames/CodingInterviewPractice | ea7f849e4eba9c4c7269b52aa7be48e7995c0f37 | [
"MIT"
] | null | null | null | CrackingCodingInterview/2.1_remove_duplicates.py | HeyIamJames/CodingInterviewPractice | ea7f849e4eba9c4c7269b52aa7be48e7995c0f37 | [
"MIT"
] | null | null | null | #remove duplicates from an unsorted linked list
def foo(linkedlist):
current_node = linkedlist.head
while current_node is not None:
checker_node = current_node
while checker_node.next is not None:
if checker_node.next.value == current_node.value:
checker_node.next = checker_node.next.next
else:
checker_node = checker_node.next
current_node = current_node.next
| 32.285714 | 61 | 0.659292 | 57 | 452 | 5 | 0.385965 | 0.270175 | 0.263158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.285398 | 452 | 13 | 62 | 34.769231 | 0.882353 | 0.10177 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
295304b863733aeca90fac96c4ea0082dfc8e3ad | 7,970 | py | Python | lexer.py | andyv/sse | 61878eb77b5a48595e0f571c37826bccae16e1f5 | [
"BSD-2-Clause"
] | null | null | null | lexer.py | andyv/sse | 61878eb77b5a48595e0f571c37826bccae16e1f5 | [
"BSD-2-Clause"
] | null | null | null | lexer.py | andyv/sse | 61878eb77b5a48595e0f571c37826bccae16e1f5 | [
"BSD-2-Clause"
] | null | null | null |
# (C) 2014 Andrew Vaught
#
# 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.
#
# 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 OWNER 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.
# Lexical analyzer for the SSE compiler
import re
from kw import *
class lex_error(Exception):
pass
word_re = re.compile(r'[A-Za-z_][A-Za-z0-9_]*')
float_re = re.compile(r'\d+\.\d*([EeDd][+-]?\d+)?')
int_re = re.compile(r'\d+')
# The lexer takes a file object and returns a sequence of tokens.
class lexer:
def __init__(self, filename):
self.filename = filename
self.fd = open(filename, 'r')
self.token_queue = []
self.line = 0
self.current_line = ''
self.lex_map = {} # Map characters to lexers
for c in '0123456789':
self.lex_map[c] = self.parse_number
pass
for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_':
self.lex_map[c] = self.parse_word
self.lex_map[c.lower()] = self.parse_word
pass
# Unigrams and digram tokens
self.uni_map = {}
self.di_map = {}
for t in token_list:
if len(t.name) == 1:
self.uni_map[t.name] = t
if t.name not in self.lex_map:
self.lex_map[t.name] = self.parse_unigram
pass
pass
elif len(t.name) == 2:
self.lex_map[t.name[0]] = self.parse_digram
if t.name[0] not in self.di_map:
self.di_map[t.name[0]] = { t.name[1]: t }
else:
self.di_map[t.name[0]][t.name[1]] = t
pass
pass
else:
raise lex_error, 'Token name with more than two characters!'
pass
# keywords, typenames
self.kw_dict = {}
for t in keyword_list + type_names + intrinsic_names:
self.kw_dict[t.name] = t
pass
return
def current_locus(self):
col = len(self.original_line) - len(self.current_line) + 1
return self.current_line, col
# error()-- Come here to build an error message associated with the
# current position. Returns the string message.
def error(self, msg):
line, col = self.current_locus()
print self.original_line.rstrip()
print (col - 1) * ' ' + '^'
print 'In line %d of %s: %s' % (self.line, self.filename, msg)
raise SystemExit, 1
# next_line()-- Get another non-blank line if nothing is left of the
# current line. Returns True if we are at the end of file, False
# otherwise.
def next_line(self):
while len(self.current_line) == 0:
self.line += 1
line = self.fd.readline()
if len(line) == 0:
self.at_eof = True
return True
line = line.rstrip()
self.original_line = line
self.current_line = line.lstrip()
pass
return False
# eat_comment()-- Eat a /* to */ comment. A regular expression won't
# work because they are greedy, we need to find the first '*/', not
# the last.
def eat_comment(self):
self.current_line = self.current_line[2:]
while True:
n = self.current_line.find('*/')
if n >= 0:
break
self.current_line = ''
if self.next_line():
raise lex_error, 'File ended inside comment'
pass
self.current_line = self.current_line[n+2:]
return
def parse_number(self):
m = float_re.match(self.current_line)
if m is not None:
self.current_line = self.current_line[len(m.group()):]
return constant(float(m.group()), type_node(type_float4, 0))
value = int_re.match(self.current_line).group()
self.current_line = self.current_line[len(value):]
return constant(int(value), type_node(type_int4, 0))
def parse_unigram(self):
t = self.uni_map[self.current_line[0]]
self.current_line = self.current_line[1:]
return t
# parse_digrams()-- All digrams have unigram interpretations, so if
# things don't work out here, try parse_unigram().
def parse_digram(self):
if len(self.current_line) == 1:
return self.parse_unigram()
a = self.current_line[0]
b = self.current_line[1]
dg = self.di_map[a]
if b not in dg:
return self.parse_unigram()
self.current_line = self.current_line[2:]
return dg[b]
# parse_word()-- Parse a word. Returns an instance of some sort. If
# the word isn't a reserved name, create a word() instance.
def parse_word(self):
m = word_re.match(self.current_line)
name = m.group()
self.current_line = self.current_line[len(name):]
return self.kw_dict.get(name, word(name))
# next_token()-- Return the next token on the input.
def next_token(self):
if len(self.token_queue) > 0:
return self.token_queue.pop(0)
while True:
self.current_line = self.current_line.lstrip()
if self.next_line():
return tok_eof
if self.current_line.startswith('//'): # End of line comment
self.current_line = ''
continue
if self.current_line.startswith('/*'): # Regular comment start
self.eat_comment()
continue
break
# We've hit something at this point
c = self.current_line[0]
if c not in self.lex_map:
raise lex_error, "Bad character '%s' found" % c
return self.lex_map[c]()
# push()-- Push a token back on the input. Maximun of one push.
def push(self, token):
self.token_queue.insert(0, token)
return
# peek_token()-- Peek at the next token, return True and consume the
# token if it is 't', leave the input alone if not.
def peek_token(self, t):
n = self.next_token()
if t == n:
return True
self.push(n)
return False
def required_token(self, t):
if self.next_token() == t:
return
raise lex_error, "Syntax error, '%s' not found" % t.name
pass
def test_lexer():
import sys
if len(sys.argv) < 2:
raise SystemExit, 'No filename'
filename = sys.argv[1]
lex = lexer(filename)
line_width = 0
while True:
t = lex.next_token()
s = str(t)
w = len(s)
if line_width + w > 70:
print
line_width = 0
pass
print s,
line_width += w
if t == tok_eof:
break
pass
print
return
| 25.960912 | 80 | 0.587327 | 1,084 | 7,970 | 4.20203 | 0.261993 | 0.084523 | 0.111965 | 0.037541 | 0.188804 | 0.124698 | 0.089791 | 0.056202 | 0.039517 | 0.039517 | 0 | 0.010288 | 0.317064 | 7,970 | 306 | 81 | 26.045752 | 0.826566 | 0.299247 | 0 | 0.285714 | 0 | 0 | 0.044272 | 0.013372 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.086957 | 0.018634 | null | null | 0.037267 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
296f3d08d7bf630899e3dd3bf6901a45985662f1 | 241 | py | Python | examples/ariadne_django/api/queries.py | danhitchcock/neo4j-graphql-py | 195b78f61aaf6f9c5c5b2d06f4a52380dcd1e076 | [
"Apache-2.0"
] | 17 | 2020-08-19T08:41:55.000Z | 2022-03-10T08:26:58.000Z | examples/ariadne_django/api/queries.py | danhitchcock/neo4j-graphql-py | 195b78f61aaf6f9c5c5b2d06f4a52380dcd1e076 | [
"Apache-2.0"
] | 10 | 2021-03-30T14:10:30.000Z | 2022-01-03T14:20:48.000Z | examples/ariadne_django/api/queries.py | danhitchcock/neo4j-graphql-py | 195b78f61aaf6f9c5c5b2d06f4a52380dcd1e076 | [
"Apache-2.0"
] | 7 | 2020-09-16T22:49:53.000Z | 2021-12-17T22:33:56.000Z | from ariadne import QueryType
from neo4j_graphql_py import neo4j_graphql
query = QueryType()
@query.field('Movie')
@query.field('MoviesByYear')
def resolve(obj, info, **kwargs):
return neo4j_graphql(obj, info.context, info, **kwargs)
| 21.909091 | 59 | 0.755187 | 32 | 241 | 5.5625 | 0.5625 | 0.202247 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014151 | 0.120332 | 241 | 10 | 60 | 24.1 | 0.825472 | 0 | 0 | 0 | 0 | 0 | 0.070539 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0.142857 | 0.571429 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
2971fb3466b99b14843329d05bb505162364a44b | 500 | py | Python | hacker-rank/algorithms/strings/two-strings/two-strings.py | palash24/algorithms | 0e46cbaa3f2826b6ff9d4ebd150b5e2330e66859 | [
"MIT"
] | 113 | 2016-09-13T13:39:08.000Z | 2021-12-26T09:02:18.000Z | hacker-rank/algorithms/strings/two-strings/two-strings.py | palash24/algorithms | 0e46cbaa3f2826b6ff9d4ebd150b5e2330e66859 | [
"MIT"
] | null | null | null | hacker-rank/algorithms/strings/two-strings/two-strings.py | palash24/algorithms | 0e46cbaa3f2826b6ff9d4ebd150b5e2330e66859 | [
"MIT"
] | 49 | 2016-08-27T07:55:25.000Z | 2022-03-17T15:54:18.000Z | #!/usr/bin/env python
import sys
def char_set(string):
chars = {}
for c in string:
chars[c] = True
return chars
def test_case():
A = sys.stdin.readline().strip()
B = sys.stdin.readline().strip()
bCharSet = char_set(B)
for c in A:
if (c in bCharSet):
print("YES")
return
print("NO")
def main():
T = int(sys.stdin.readline())
while (T > 0):
test_case()
T -= 1
if __name__ == '__main__':
main()
| 15.625 | 36 | 0.52 | 68 | 500 | 3.647059 | 0.514706 | 0.03629 | 0.193548 | 0.169355 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005988 | 0.332 | 500 | 31 | 37 | 16.129032 | 0.736527 | 0.04 | 0 | 0 | 0 | 0 | 0.02714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.136364 | false | 0 | 0.045455 | 0 | 0.272727 | 0.090909 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
29783e686a3cab60f96af292d5f2a8cf3ba1bdd9 | 326 | py | Python | tools.train.py | ferferga/MMM-NEXT-FacialRecognition | 90159182de2a944b041581e16b707c4551385690 | [
"MIT"
] | 47 | 2018-02-01T09:19:02.000Z | 2021-11-05T13:43:29.000Z | tools.train.py | ferferga/MMM-NEXT-FacialRecognition | 90159182de2a944b041581e16b707c4551385690 | [
"MIT"
] | 37 | 2018-02-10T23:21:22.000Z | 2021-09-18T11:43:45.000Z | tools.train.py | ferferga/MMM-NEXT-FacialRecognition | 90159182de2a944b041581e16b707c4551385690 | [
"MIT"
] | 18 | 2018-02-01T04:13:04.000Z | 2021-10-20T07:41:46.000Z | #!/usr/bin/env python
# coding: utf8
"""MMMM-Facial-Recognition-OCV3 - MagicMirror Module
The MIT License (MIT)
Copyright (c) 2018 Mathieu Goulène (MIT License)
Based on work by Paul-Vincent Roll (Copyright 2016) (MIT License)
"""
from lib.tools.train import ToolsTrain
if __name__ == '__main__':
ToolsTrain().train()
| 21.733333 | 65 | 0.730061 | 45 | 326 | 5.111111 | 0.822222 | 0.130435 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035971 | 0.147239 | 326 | 14 | 66 | 23.285714 | 0.791367 | 0.677914 | 0 | 0 | 0 | 0 | 0.082474 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
2983c216c060d97ee739cde0d096fd7eaf031890 | 667 | py | Python | transcode/filters/video/keyframes/qkeyframes.py | shersonb/python-transcode | db42e82f019ef4c3b7f59f34587576205e19eb96 | [
"MIT"
] | 1 | 2020-06-25T01:00:15.000Z | 2020-06-25T01:00:15.000Z | transcode/filters/video/keyframes/qkeyframes.py | shersonb/python-transcode | db42e82f019ef4c3b7f59f34587576205e19eb96 | [
"MIT"
] | null | null | null | transcode/filters/video/keyframes/qkeyframes.py | shersonb/python-transcode | db42e82f019ef4c3b7f59f34587576205e19eb96 | [
"MIT"
] | null | null | null | from transcode.pyqtgui.qframetablecolumn import BaseColumn
from PyQt5.QtCore import Qt
class KeyFrameCol(BaseColumn):
headerdisplay = "K"
display = ""
width = 48
flags = Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable
def __init__(self, forcekeyframes):
self.forcekeyframes = forcekeyframes
def setcheckstate(self, index, obj, data):
if self.checkstate(index, obj):
self.forcekeyframes.remove(obj)
return True
else:
self.forcekeyframes.add(obj)
return True
def checkstate(self, index, obj):
return 2 if obj in self.forcekeyframes else 0
| 26.68 | 75 | 0.664168 | 71 | 667 | 6.183099 | 0.535211 | 0.205011 | 0.05467 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010121 | 0.25937 | 667 | 24 | 76 | 27.791667 | 0.878543 | 0 | 0 | 0.111111 | 0 | 0 | 0.001499 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.111111 | 0.055556 | 0.722222 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
2984f144fe952c084402df958ee3dcd34487ed2e | 239 | bzl | Python | extra_deps.bzl | hxtk/rules_anchore | 604ab3d9509113b8d20a371725636ff0ddb3e1fd | [
"Apache-2.0"
] | 1 | 2022-01-10T20:26:06.000Z | 2022-01-10T20:26:06.000Z | extra_deps.bzl | hxtk/rules_anchore | 604ab3d9509113b8d20a371725636ff0ddb3e1fd | [
"Apache-2.0"
] | 6 | 2021-12-29T13:45:58.000Z | 2022-01-07T01:10:07.000Z | extra_deps.bzl | hxtk/rules_anchore | 604ab3d9509113b8d20a371725636ff0ddb3e1fd | [
"Apache-2.0"
] | null | null | null | load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
def anchore_extra_deps(configure_go=True):
if configure_go:
go_rules_dependencies()
go_register_toolchains(version = "1.17.1")
| 34.142857 | 90 | 0.74477 | 34 | 239 | 4.794118 | 0.558824 | 0.04908 | 0.245399 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019324 | 0.133891 | 239 | 6 | 91 | 39.833333 | 0.768116 | 0 | 0 | 0 | 0 | 0 | 0.334728 | 0.309623 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4624fcbbf181c27e4e153a5be253ea1eec373ecb | 2,530 | py | Python | norm/executable/expression/argument.py | reasoned-ai/norm | 5e45d5917ce8745c9a757a0c6b5e689ea0cac19f | [
"Apache-2.0"
] | 8 | 2019-07-22T08:57:20.000Z | 2021-03-26T13:51:02.000Z | norm/executable/expression/argument.py | xumiao/norm | 5e45d5917ce8745c9a757a0c6b5e689ea0cac19f | [
"Apache-2.0"
] | null | null | null | norm/executable/expression/argument.py | xumiao/norm | 5e45d5917ce8745c9a757a0c6b5e689ea0cac19f | [
"Apache-2.0"
] | 1 | 2019-11-16T13:37:35.000Z | 2019-11-16T13:37:35.000Z | from norm.grammar.literals import COP
from norm.executable import Projection
from norm.executable.constant import Constant
from norm.executable.expression import NormExpression
from typing import Union
import logging
logger = logging.getLogger(__name__)
class ArgumentExpr(NormExpression):
def __init__(self, variable=None, op=None, expr=None, projection=None):
"""
The argument expression project to a new variable, either assigning or conditional.
:param variable: the variable
:type variable: VariableName
:param expr: the arithmetic expression for the variable
:type expr: Union[norm.executable.expression.arithmetic.ArithmeticExpr,
norm.executable.expression.slice.SliceExpr,
norm.executable.expression.evaluation.EvaluationExpr,
norm.executable.variable.VariableName]
:param op: the conditional operation
:type op: COP
:param projection: the projection
:type projection: Projection
"""
super().__init__()
from norm.executable.expression.arithmetic import ArithmeticExpr
from norm.executable.expression.slice import SliceExpr
from norm.executable.expression.evaluation import EvaluationExpr
from norm.executable.schema.variable import VariableName
self.variable: VariableName = variable
self.expr: Union[ArithmeticExpr, SliceExpr, EvaluationExpr, VariableName] = expr
self.op: COP = op
self.projection: Projection = projection
def __str__(self):
return '{} {} {} {}'.format(self.variable if self.variable is not None else '',
self.op if self.op is not None else '',
self.expr if self.expr is not None else '',
self.projection if self.projection is not None else '')
@property
def is_constant(self):
return isinstance(self.expr, Constant)
@property
def is_assign_operator(self):
return self.op is None
def compile(self, context):
from norm.executable.expression.evaluation import EvaluationExpr
from norm.executable.schema.variable import VariableName
if self.is_assign_operator and self.projection is not None and isinstance(self.expr, VariableName):
self.expr = EvaluationExpr([], self.expr, self.projection).compile(context)
self.projection = None
return self
| 42.166667 | 107 | 0.665217 | 271 | 2,530 | 6.132841 | 0.232472 | 0.109507 | 0.097473 | 0.084236 | 0.188327 | 0.129964 | 0.129964 | 0.129964 | 0.129964 | 0.129964 | 0 | 0 | 0.262451 | 2,530 | 59 | 108 | 42.881356 | 0.890675 | 0.227273 | 0 | 0.166667 | 0 | 0 | 0.005972 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.138889 | false | 0 | 0.333333 | 0.083333 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4631b8da6150299ffd856101738cfbe592fa50af | 263 | py | Python | src/hataraku/urls.py | HNJ755329/Hatarako | 253d107db7a15caaf63794d9b8a4acc99168fba0 | [
"MIT"
] | null | null | null | src/hataraku/urls.py | HNJ755329/Hatarako | 253d107db7a15caaf63794d9b8a4acc99168fba0 | [
"MIT"
] | null | null | null | src/hataraku/urls.py | HNJ755329/Hatarako | 253d107db7a15caaf63794d9b8a4acc99168fba0 | [
"MIT"
] | null | null | null |
from django.urls import path
from . import views
urlpatterns = [
path("", views.hataraku_index, name="hataraku_index"),
path("result", views.hataraku_result, name="hataraku_result"),
path("<uuid:uuid>/", views.hataraku_uuid, name="hataraku_uuid"),
] | 29.222222 | 68 | 0.711027 | 33 | 263 | 5.484848 | 0.363636 | 0.21547 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129278 | 263 | 9 | 69 | 29.222222 | 0.790393 | 0 | 0 | 0 | 0 | 0 | 0.228137 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4638439d203bf03e33cbbf7989255a7d6a8ad7bf | 2,099 | py | Python | healthvaultlib/exceptions.py | orcasgit/python-healthvault | 0a97ed15614efb4429ead781458582901d0a2627 | [
"MIT"
] | 4 | 2016-03-04T14:50:04.000Z | 2019-08-13T22:34:04.000Z | healthvaultlib/exceptions.py | orcasgit/python-healthvault | 0a97ed15614efb4429ead781458582901d0a2627 | [
"MIT"
] | 1 | 2016-09-18T20:16:35.000Z | 2016-09-18T20:43:56.000Z | healthvaultlib/exceptions.py | orcasgit/python-healthvault | 0a97ed15614efb4429ead781458582901d0a2627 | [
"MIT"
] | 3 | 2018-02-20T08:41:45.000Z | 2022-01-31T21:20:10.000Z | from healthvaultlib.status_codes import HealthVaultStatus
def _get_exception_class_for(code):
"""Given a status code from healthvault, return the most appropriate exception class
to raise for it.
Returns a class so the exception can be constructed from the proper place
in the code instead of here.
:param integer code: A status code from HealthVault
:returns: The HealthVaultException class or a subclass
:rtype: class
"""
if code in (HealthVaultStatus.CREDENTIAL_TOKEN_EXPIRED,
HealthVaultStatus.AUTHENTICATED_SESSION_TOKEN_EXPIRED):
return HealthVaultTokenExpiredException
elif code == HealthVaultStatus.ACCESS_DENIED:
return HealthVaultAccessDeniedException
else:
return HealthVaultException
class HealthVaultException(Exception):
"""This exception is raised for any error in the python-healthvault library
that doesn't have a more specific exception. The more specific exceptions
inherit from it.
It has a :py:attr:`code` attribute that'll be set to the
`HealthVault status code <http://msdn.microsoft.com/en-us/library/hh567902.aspx>`_,
if one is available. Otherwise it's None.
"""
def __init__(self, *args, **kwargs):
self.code = kwargs.pop('code', None)
super(HealthVaultException, self).__init__(*args, **kwargs)
class HealthVaultTokenExpiredException(HealthVaultException):
"""Raised when the user access token (wctoken) has expired, healthvault
error 7: CREDENTIAL_TOKEN_EXPIRED
Credential token has expired need a new one.
"""
pass
class HealthVaultAccessDeniedException(HealthVaultException):
"""Raised for error 11: ACCESS_DENIED. Could mean the user went to HealthVault
and removed the application's authorization. Ask the user for it again.
"""
pass
class HealthVaultHTTPException(HealthVaultException):
"""Raises when the HTTP request fails for any reason.
The :py:attr:`code` attribute is set to the HTTP response code
and the exception message to the response message.
"""
pass
| 36.189655 | 88 | 0.735112 | 257 | 2,099 | 5.914397 | 0.447471 | 0.019737 | 0.014474 | 0.019737 | 0.034211 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005357 | 0.199619 | 2,099 | 57 | 89 | 36.824561 | 0.899405 | 0.540257 | 0 | 0.157895 | 0 | 0 | 0.004706 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0.157895 | 0.052632 | 0 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
463c160e120491fa647da9db2ad986cad9278d7f | 187 | py | Python | week5/opcionais/maximo.py | jotavev/usp-computer-science-python | 82aaa410f245e339c25e4a2b1a61e410259d0f8c | [
"MIT"
] | 1 | 2020-06-10T03:39:07.000Z | 2020-06-10T03:39:07.000Z | week5/opcionais/maximo.py | jotavev/usp-computer-science-python | 82aaa410f245e339c25e4a2b1a61e410259d0f8c | [
"MIT"
] | null | null | null | week5/opcionais/maximo.py | jotavev/usp-computer-science-python | 82aaa410f245e339c25e4a2b1a61e410259d0f8c | [
"MIT"
] | null | null | null | def maximo(a, b, c):
if a > b and a > c:
return a
elif b > c and b > a:
return b
elif c > a and c > b:
return c
elif a == b == c:
return a
| 18.7 | 25 | 0.417112 | 35 | 187 | 2.228571 | 0.257143 | 0.076923 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.481283 | 187 | 9 | 26 | 20.777778 | 0.804124 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4648aeea1b4931e74805e05e34b17915cd53ab9c | 2,602 | py | Python | test/unit/test_jvm_service_status.py | elabeca/service-manager | 67f4da08900ae629a171a01b7f89c322697d6e33 | [
"Apache-2.0"
] | null | null | null | test/unit/test_jvm_service_status.py | elabeca/service-manager | 67f4da08900ae629a171a01b7f89c322697d6e33 | [
"Apache-2.0"
] | null | null | null | test/unit/test_jvm_service_status.py | elabeca/service-manager | 67f4da08900ae629a171a01b7f89c322697d6e33 | [
"Apache-2.0"
] | null | null | null | from mock import *
import unittest
from hamcrest import *
from service.smjvmservice import SmJvmService
from smcontext import ServiceManagerException
from smprocess import SmProcess
class JvmServiceMock(SmJvmService):
def __init__(self, context, service_name):
SmJvmService.__init__(self, context, service_name, "")
def post_stop(self):
pass
def get_port_argument(self):
pass
def get_running_healthcheck_port(self, process):
pass
def get_details_url(self):
pass
class TestSmJvmServiceStatus(unittest.TestCase):
def setUp(self):
self.context = MagicMock()
self.context.exception = lambda message: ServiceManagerException(message)
self.context.service_type = lambda x: ''
def process(self, cmdline):
return SmProcess(ppid=10, pid=1, uptime=30, mem=10, args=cmdline.split())
def test_matches_running_service(self):
mock = JvmServiceMock(self.context, "TEST")
status = mock.status([self.process("service.manager.serviceName=TEST")])
assert_that(status, is_not(empty()))
assert_that(status, contains(has_property("service_name", "TEST")))
def test_fails_to_match_other_service(self):
mock = JvmServiceMock(self.context, "TEST")
status = mock.status([self.process("service.manager.serviceName=NOTEST")])
assert_that(status, is_(empty()))
def test_fails_to_match_service_with_prefix_of_this_service(self):
mock = JvmServiceMock(self.context, "TEST")
status = mock.status([self.process("service.manager.serviceName=TEST-STUBS")])
assert_that(status, is_(empty()))
def test_fails_to_match_service_with_multiple_cmdline_args(self):
mock = JvmServiceMock(self.context, "TEST")
status = mock.status(
[self.process("-Dhttp.port=9051 -Dservice.manager.serviceName=TEST -Dservice.manager.runFrom=SOURCE")])
assert_that(status, is_not(empty()))
def test_return_pass_when_healthcheck_passes(self):
mock = JvmServiceMock(self.context, "TEST")
mock.run_healthcheck = lambda x: True
status = mock.status([self.process("service.manager.serviceName=TEST")])
assert_that(status, contains(has_property("healthcheck", "PASS")))
def test_return_boot_when_healthcheck_is_booting(self):
mock = JvmServiceMock(self.context, "TEST")
mock.run_healthcheck = lambda x: False
status = mock.status([self.process("service.manager.serviceName=TEST")])
assert_that(status, contains(has_property("healthcheck", "BOOT"))) | 37.710145 | 115 | 0.703689 | 306 | 2,602 | 5.748366 | 0.27451 | 0.068789 | 0.063673 | 0.088687 | 0.541217 | 0.500853 | 0.460489 | 0.460489 | 0.460489 | 0.460489 | 0 | 0.005172 | 0.182552 | 2,602 | 69 | 116 | 37.710145 | 0.821815 | 0 | 0 | 0.326923 | 0 | 0.019231 | 0.123703 | 0.089896 | 0 | 0 | 0 | 0 | 0.134615 | 1 | 0.25 | false | 0.115385 | 0.115385 | 0.019231 | 0.423077 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
464b332a1ed50e0918c134ba7910ce1ce63d2897 | 1,524 | py | Python | root/os/DSAA/DataStructuresAndAlgorithms/python/chutils/chutils/chweb/flask_app.py | chyidl/chyidlTutorial | a033e0a57abf84fdbb61e57736822f9126db6ff7 | [
"MIT"
] | 5 | 2018-10-17T05:57:39.000Z | 2021-07-05T15:38:24.000Z | root/os/DSAA/DataStructuresAndAlgorithms/python/chutils/chutils/chweb/flask_app.py | chyidl/chyidlTutorial | a033e0a57abf84fdbb61e57736822f9126db6ff7 | [
"MIT"
] | 2 | 2021-04-14T00:48:43.000Z | 2021-04-14T02:20:50.000Z | root/os/DSAA/DataStructuresAndAlgorithms/python/chutils/chutils/chweb/flask_app.py | chyidl/chyidlTutorial | a033e0a57abf84fdbb61e57736822f9126db6ff7 | [
"MIT"
] | 3 | 2019-03-02T14:36:19.000Z | 2022-03-18T10:12:09.000Z | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# flask_app.py
# chweb
#
# 🎂"Here's to the crazy ones. The misfits. The rebels.
# The troublemakers. The round pegs in the square holes.
# The ones who see things differently. They're not found
# of rules. And they have no respect for the status quo.
# You can quote them, disagree with them, glority or vilify
# them. About the only thing you can't do is ignore them.
# Because they change things. They push the human race forward.
# And while some may see them as the creazy ones, we see genius.
# Because the poeple who are crazy enough to think thay can change
# the world, are the ones who do."
#
# Created by Chyi Yaqing on 03/07/19 17:30.
# Copyright © 2019. Chyi Yaqing.
# All rights reserved.
#
# Distributed under terms of the
# MIT
"""
Flask编写Web App比WSGI接口简单
"""
from flask import Flask
from flask import request, render_template
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
return render_template('index.html')
@app.route('/signin', methods=['GET'])
def signin_form():
return render_template('form.html')
@app.route('/signin', methods=['POST'])
def signin():
username = request.form['username']
password = request.form['password']
if username == 'admin' and password == 'password':
return render_template('signin_ok.html', username=username)
return render_template(
'form.html', message='Bad username or password', username=username)
if __name__ == '__main__':
app.run()
| 26.736842 | 79 | 0.697507 | 226 | 1,524 | 4.623894 | 0.553097 | 0.066986 | 0.076555 | 0.03445 | 0.097608 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01281 | 0.180446 | 1,524 | 56 | 80 | 27.214286 | 0.822258 | 0.505906 | 0 | 0 | 0 | 0 | 0.182573 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.157895 | false | 0.157895 | 0.105263 | 0.105263 | 0.473684 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 2 |
46504354a6f71165725540147230875f7e7d4326 | 1,061 | py | Python | lib_rovpp/tests/yaml_system_tests/superprefix_prefix_graph_13_02/test_superprefix_prefix_08.py | jfuruness/lib_rovpp | 67032c2dc296fa1804a8305d8cb671339b8e45e0 | [
"BSD-3-Clause"
] | 1 | 2021-09-27T14:20:12.000Z | 2021-09-27T14:20:12.000Z | lib_rovpp/tests/yaml_system_tests/superprefix_prefix_graph_13_02/test_superprefix_prefix_08.py | jfuruness/lib_rovpp | 67032c2dc296fa1804a8305d8cb671339b8e45e0 | [
"BSD-3-Clause"
] | null | null | null | lib_rovpp/tests/yaml_system_tests/superprefix_prefix_graph_13_02/test_superprefix_prefix_08.py | jfuruness/lib_rovpp | 67032c2dc296fa1804a8305d8cb671339b8e45e0 | [
"BSD-3-Clause"
] | 1 | 2021-10-01T16:30:33.000Z | 2021-10-01T16:30:33.000Z | from pathlib import Path
from lib_bgp_simulator import BaseGraphSystemTester
from lib_bgp_simulator import BGPSimpleAS
from lib_bgp_simulator import ROVSimpleAS
from lib_bgp_simulator import Graph013
from ..unstable import Unstable
from ....as_classes import ROVPPV1SimpleAS
from ....as_classes import ROVPPV2SimpleAS
from ....as_classes import ROVPPV2aSimpleAS
from ....engine_input import ROVPPSuperprefixPrefixHijack
class BaseSuperPrefixPrefix08Tester(Unstable, BaseGraphSystemTester):
GraphInfoCls = Graph013
BaseASCls = BGPSimpleAS
EngineInputCls = ROVPPSuperprefixPrefixHijack
base_dir = Path(__file__).parent
adopting_asns = (2, )
class Test061SupreprefixPrefix08(BaseSuperPrefixPrefix08Tester):
AdoptASCls = ROVSimpleAS
class Test062SupreprefixPrefix08(BaseSuperPrefixPrefix08Tester):
AdoptASCls = ROVPPV1SimpleAS
class Test063SupreprefixPrefix08(BaseSuperPrefixPrefix08Tester):
AdoptASCls = ROVPPV2SimpleAS
class Test064SupreprefixPrefix08(BaseSuperPrefixPrefix08Tester):
AdoptASCls = ROVPPV2aSimpleAS
| 27.921053 | 69 | 0.833176 | 90 | 1,061 | 9.622222 | 0.411111 | 0.032333 | 0.046189 | 0.08776 | 0.115473 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046088 | 0.120641 | 1,061 | 37 | 70 | 28.675676 | 0.882101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.416667 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
46511f19c141addedb85daa3f97c439e09afe09e | 8,723 | py | Python | tests/tasks/tasks/instr/test_transfer_pulse_sequence_task.py | Exopy/ecpy_hqc_legacy | 3e31a8865d130907a82005e6cd78d99c6da7a951 | [
"BSD-3-Clause"
] | null | null | null | tests/tasks/tasks/instr/test_transfer_pulse_sequence_task.py | Exopy/ecpy_hqc_legacy | 3e31a8865d130907a82005e6cd78d99c6da7a951 | [
"BSD-3-Clause"
] | 34 | 2015-12-14T22:06:57.000Z | 2018-02-07T08:40:47.000Z | tests/tasks/tasks/instr/test_transfer_pulse_sequence_task.py | Exopy/ecpy_hqc_legacy | 3e31a8865d130907a82005e6cd78d99c6da7a951 | [
"BSD-3-Clause"
] | 6 | 2018-04-20T14:48:54.000Z | 2021-06-23T22:25:17.000Z | ## -*- coding: utf-8 -*-
## =============================================================================
## module : test_transfer_pulse_sequence_task.py
## author : Matthieu Dartiailh
## license : MIT license
## =============================================================================
#"""
#"""
#from nose.tools import (assert_equal, assert_true, assert_false, assert_in,
# assert_is_instance, assert_is, assert_not_in)
#from nose.plugins.attrib import attr
#from multiprocessing import Event
#from enaml.workbench.api import Workbench
#
#from hqc_meas.tasks.api import RootTask
#from hqc_meas.pulses.api import RootSequence, Pulse
#from hqc_meas.pulses.contexts.awg_context import AWGContext
#from hqc_meas.tasks.tasks_instr.transfer_pulse_sequence_task\
# import (TransferPulseSequenceTask, AWGTransferInterface)
#
#import enaml
#with enaml.imports():
# from enaml.workbench.core.core_manifest import CoreManifest
# from hqc_meas.utils.state.manifest import StateManifest
# from hqc_meas.utils.preferences.manifest import PreferencesManifest
# from hqc_meas.tasks.manager.manifest import TaskManagerManifest
# from hqc_meas.instruments.manager.manifest import InstrManagerManifest
# from hqc_meas.pulses.manager.manifest import PulsesManagerManifest
#
# from hqc_meas.tasks.tasks_instr.views.transfer_pulse_sequence_views\
# import TransferPulseSequenceView
#
#from ...util import process_app_events, close_all_windows
#from .instr_helper import InstrHelper
#
#
#class TestTransferPulseSequenceTask(object):
#
# def setup(self):
# self.root = RootTask(should_stop=Event(), should_pause=Event())
# self.task = TransferPulseSequenceTask(task_name='Test')
# self.root.children_task.append(self.task)
# self.root.run_time['drivers'] = {'AWG5014B': InstrHelper}
# self.root.write_in_database('int', 2)
#
# self.sequence = RootSequence()
# self.context = AWGContext()
# self.sequence.context = self.context
# self.sequence.external_vars = {'a': None}
# pulse1 = Pulse(def_1='1.0', def_2='{a}', channel='Ch1_M1')
# pulse2 = Pulse(def_1='{a} + 1.0', def_2='4.0', channel='Ch1_M1')
# pulse3 = Pulse(def_1='{2_stop} + 0.5', def_2='10', channel='Ch1_M1')
# self.sequence.items.extend([pulse1, pulse2, pulse3])
#
# self.task.sequence = self.sequence
# self.task.sequence_vars = {'a': '{Root_int}'}
#
# interface = AWGTransferInterface(task=self.task)
# self.task.interface = interface
#
# self.task.selected_driver = 'AWG5014B'
# self.task.selected_profile = 'Test1'
#
# def test_check_no_sequence(self):
# self.task.sequence = None
# test, traceback = self.task.check()
# assert_false(test)
# assert_equal(len(traceback), 1)
#
# def test_check_no_interface(self):
# self.task.interface = None
# test, traceback = self.task.check()
# assert_false(test)
# assert_equal(len(traceback), 2)
#
# def test_check_errors_in_vars(self):
# self.task.sequence_vars = {'a': '**'}
# test, traceback = self.task.check()
# assert_false(test)
# assert_equal(len(traceback), 1)
#
# def test_check_compilation_errors(self):
# self.task.sequence.items[0].def_1 = 'b'
# test, traceback = self.task.check()
# assert_false(test)
# assert_equal(len(traceback), 1)
#
# def test_check_wrong_context(self):
# self.task.sequence.context = None
# test, traceback = self.task.check()
# assert_false(test)
# assert_equal(len(traceback), 1)
#
# def test_check_ok(self):
# test, traceback = self.task.check()
# assert_true(test)
#
# def test_register_preferences_seq_path(self):
# self.task.sequence_path = 'toto'
# self.task.register_preferences()
# assert_in('sequence_path', self.task.task_preferences)
# assert_not_in('sequence', self.task.task_preferences)
#
# def test_register_preferences_seq(self):
# self.task.register_preferences()
# assert_not_in('sequence_path', self.task.task_preferences)
# assert_in('sequence', self.task.task_preferences)
#
#
#class TestAWGTransferInterface(object):
#
# def setup(self):
# self.root = RootTask(should_stop=Event(), should_pause=Event())
# self.task = TransferPulseSequenceTask(task_name='Test')
# self.root.children_task.append(self.task)
# self.root.run_time['drivers'] = {'AWG5014B': InstrHelper}
# self.root.write_in_database('int', 2)
#
# self.sequence = RootSequence()
# self.context = AWGContext()
# self.sequence.context = self.context
# self.sequence.external_vars = {'a': None}
# pulse1 = Pulse(def_1='1.0', def_2='{a}', channel='Ch1_M1')
# pulse2 = Pulse(def_1='{a} + 1.0', def_2='4.0', channel='Ch1_M1')
# pulse3 = Pulse(def_1='{2_stop} + 0.5', def_2='10', channel='Ch1_M1')
# self.sequence.items.extend([pulse1, pulse2, pulse3])
#
# self.task.sequence = self.sequence
# self.task.sequence_vars = {'a': '{Root_int}'}
#
# interface = AWGTransferInterface(task=self.task)
# self.task.interface = interface
#
# self.task.selected_driver = 'AWG5014B'
# self.task.selected_profile = 'Test1'
#
# def get_ch(s, ch):
# return InstrHelper(({'output_state': 'OFF'},
# {'select_sequence': lambda s, se: None}))
# prof = ({'owner': [None], 'defined_channels': ('Ch1',)},
# {'get_channel': get_ch, 'to_send': lambda s, se: None})
# self.root.run_time['profiles'] = {'Test1': prof}
#
# def test_perform(self):
# self.task.perform()
#
#
#@attr('ui')
#class TestTransferPulseSequenceView(object):
#
# def setup(self):
# self.workbench = Workbench()
# self.workbench.register(CoreManifest())
# self.workbench.register(StateManifest())
# self.workbench.register(PreferencesManifest())
# self.workbench.register(InstrManagerManifest())
# self.workbench.register(PulsesManagerManifest())
# self.workbench.register(TaskManagerManifest())
#
# self.root = RootTask(should_stop=Event(), should_pause=Event())
# self.task = TransferPulseSequenceTask(task_name='Test')
# self.root.children_task.append(self.task)
# self.root.run_time['drivers'] = {'Test': InstrHelper}
#
# self.sequence = RootSequence()
# self.context = AWGContext()
# self.sequence.context = self.context
# self.sequence.external_vars = {'a': None}
# pulse1 = Pulse(def_1='1.0', def_2='{a}', channel='Ch1_M1')
# pulse2 = Pulse(def_1='{a} + 1.0', def_2='4.0', channel='Ch1_M1')
# pulse3 = Pulse(def_1='{2_stop} + 0.5', def_2='10', channel='Ch1_M1')
# self.sequence.items.extend([pulse1, pulse2, pulse3])
#
# def teardown(self):
# close_all_windows()
#
# self.workbench.unregister(u'hqc_meas.task_manager')
# self.workbench.unregister(u'hqc_meas.pulses')
# self.workbench.unregister(u'hqc_meas.instr_manager')
# self.workbench.unregister(u'hqc_meas.preferences')
# self.workbench.unregister(u'hqc_meas.state')
# self.workbench.unregister(u'enaml.workbench.core')
#
# def test_view1(self):
# # Intantiate a view with no selected interface and select one after
# # Then add a sequence.
# window = enaml.widgets.api.Window()
# core = self.workbench.get_plugin('enaml.workbench.core')
# view = TransferPulseSequenceView(window, task=self.task, core=core)
# window.show()
#
# process_app_events()
#
# assert_in('AWG5014B', view.drivers)
# self.task.selected_driver = 'AWG5014B'
# process_app_events()
# assert_is_instance(self.task.interface,
# AWGTransferInterface)
#
# self.task.sequence = self.sequence
# process_app_events()
# # If everything goes smoothly we are probably good.
#
# def test_view2(self):
# # Intantiate a view with a selected interface and a sequence.
# interface = AWGTransferInterface(task=self.task)
# self.task.interface = interface
# self.task.selected_driver = 'AWG5014B'
# self.task.sequence = self.sequence
# interface = self.task.interface
#
# window = enaml.widgets.api.Window()
# core = self.workbench.get_plugin('enaml.workbench.core')
# TransferPulseSequenceView(window, task=self.task, core=core)
# window.show()
#
# process_app_events()
#
# assert_is(self.task.interface, interface)
| 39.65 | 80 | 0.64072 | 1,009 | 8,723 | 5.353816 | 0.172448 | 0.071085 | 0.032581 | 0.006664 | 0.597927 | 0.538134 | 0.493151 | 0.479082 | 0.463162 | 0.463162 | 0 | 0.018835 | 0.202683 | 8,723 | 219 | 81 | 39.83105 | 0.757872 | 0.948527 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4659ffa25a9065d0f39415a26b03f5b31bf42afe | 487 | py | Python | ex012.py | heltonsdl/python-3---curso-em-video | 2bb0408ec041628323443cf902fca593f7575941 | [
"MIT"
] | null | null | null | ex012.py | heltonsdl/python-3---curso-em-video | 2bb0408ec041628323443cf902fca593f7575941 | [
"MIT"
] | null | null | null | ex012.py | heltonsdl/python-3---curso-em-video | 2bb0408ec041628323443cf902fca593f7575941 | [
"MIT"
] | null | null | null | valor = float(input('Quanto custa o produto? R$'))
avista = valor - (valor *10/100)
parcelado = valor + ( valor *12/100)
#desc = valor - novo
#print ( 'O valor com o desconto de 5% fica de R$ {}.' .format(desc))
print (' O poduto que custava R$ {}, com o desconto de 10% do pagamento avista sai a R$ {} e com o acrescimo de.12% no parcelado fica {}.'.format (valor, avista, parcelado))
'''Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto.''' | 54.111111 | 173 | 0.673511 | 83 | 487 | 3.951807 | 0.46988 | 0.036585 | 0.073171 | 0.085366 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040404 | 0.186858 | 487 | 9 | 174 | 54.111111 | 0.787879 | 0.178645 | 0 | 0 | 0 | 0.25 | 0.516667 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
466697f06f74981ca5f4ccced2217db514bafbeb | 487 | py | Python | test.py | sparseinference/argmaxnet | ff1e090a662d384f2ba4349494c9630079d2545b | [
"MIT"
] | null | null | null | test.py | sparseinference/argmaxnet | ff1e090a662d384f2ba4349494c9630079d2545b | [
"MIT"
] | null | null | null | test.py | sparseinference/argmaxnet | ff1e090a662d384f2ba4349494c9630079d2545b | [
"MIT"
] | null | null | null | """
File: test.py
By: Peter Caven, peter@sparseinference.com
Description:
Test the net.
"""
from argmaxnet import ArgMaxNet
import os
#=================================================================
modelPath = os.path.expanduser('~/models/argmaxnet/ArgMaxNet : StackDepth=3, Block(10,60),[111][0.02220].model')
#==================================================================================================
net = ArgMaxNet(3, 10, 60)
net.load(modelPath)
net.test(100, 500)
| 22.136364 | 112 | 0.474333 | 47 | 487 | 4.914894 | 0.659574 | 0.12987 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.056054 | 0.084189 | 487 | 21 | 113 | 23.190476 | 0.461883 | 0.50924 | 0 | 0 | 0 | 0.166667 | 0.343612 | 0.268722 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
466cfc85b33947f233f1267002ff2b4d9e2b3812 | 212 | py | Python | _solved/solutions/case-trump-vote09.py | DuongVit/scipy2018-geospatial-data | 603b69be540bcc7a47b652173b41240df9862a0a | [
"BSD-3-Clause"
] | 333 | 2018-06-17T03:40:25.000Z | 2022-03-11T15:35:43.000Z | _solved/solutions/case-trump-vote09.py | DuongVit/scipy2018-geospatial-data | 603b69be540bcc7a47b652173b41240df9862a0a | [
"BSD-3-Clause"
] | 22 | 2018-06-15T23:19:27.000Z | 2020-03-23T11:08:55.000Z | _solved/solutions/case-trump-vote09.py | DuongVit/scipy2018-geospatial-data | 603b69be540bcc7a47b652173b41240df9862a0a | [
"BSD-3-Clause"
] | 197 | 2018-06-15T18:34:53.000Z | 2022-02-27T11:33:15.000Z | f = plt.figure(figsize=(6,6))
plt.scatter(pres.swing_full, lp.weights.lag_spatial(w, pres.swing_full))
plt.plot((-.3,.1),(-.3,.1), color='k')
plt.title('$I = {:.3f} \ \ (p < {:.3f})$'.format(moran.I,moran.p_sim)) | 53 | 72 | 0.617925 | 39 | 212 | 3.25641 | 0.666667 | 0.141732 | 0.204724 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040609 | 0.070755 | 212 | 4 | 73 | 53 | 0.604061 | 0 | 0 | 0 | 0 | 0 | 0.140845 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4671c2bf61391fb09fb7ef694e8f0a69c2e47eba | 670 | py | Python | server/utils/logger.py | dsalfran/flask-vue-template | 00bec85c0a66632e24c3db49567975c6d29540de | [
"MIT"
] | 1 | 2020-03-06T19:48:04.000Z | 2020-03-06T19:48:04.000Z | server/utils/logger.py | dsalfran/flask-vue-template | 00bec85c0a66632e24c3db49567975c6d29540de | [
"MIT"
] | 5 | 2020-06-08T15:57:47.000Z | 2022-02-27T00:47:58.000Z | server/utils/logger.py | dsalfran/flask-vue-template | 00bec85c0a66632e24c3db49567975c6d29540de | [
"MIT"
] | null | null | null | """This module abstracts logging configuration"""
# ---------------------------------------------
# System modules
# ---------------------------------------------
import logging
# ---------------------------------------------
# External dependencies
# ---------------------------------------------
# ---------------------------------------------
# Local dependencies
# ---------------------------------------------
import coloredlogs
# ---------------------------------------------
logging.basicConfig(level=logging.INFO)
logging.getLogger("html_tools").setLevel(logging.WARNING)
logger = logging.getLogger(__name__)
coloredlogs.install(level="INFO", logger=logger)
| 30.454545 | 57 | 0.402985 | 37 | 670 | 7.162162 | 0.621622 | 0.120755 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064179 | 670 | 21 | 58 | 31.904762 | 0.422648 | 0.629851 | 0 | 0 | 0 | 0 | 0.060086 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
4686560084a145b3c7c2d80796910b9d08813e8d | 650 | py | Python | tests/plugins/test_vidio.py | hymer-up/streamlink | f09bf6e04cddc78eceb9ded655f716ef3ee4b84f | [
"BSD-2-Clause"
] | 5 | 2017-03-21T19:43:17.000Z | 2018-10-03T14:04:29.000Z | tests/plugins/test_vidio.py | hymer-up/streamlink | f09bf6e04cddc78eceb9ded655f716ef3ee4b84f | [
"BSD-2-Clause"
] | 7 | 2016-10-13T23:29:31.000Z | 2018-06-28T14:04:32.000Z | tests/plugins/test_vidio.py | bumplzz69/streamlink | 34abc43875d7663ebafa241573dece272e93d88b | [
"BSD-2-Clause"
] | 2 | 2016-11-24T18:37:33.000Z | 2017-03-21T19:43:49.000Z | import unittest
from streamlink.plugins.vidio import Vidio
class TestPluginVidio(unittest.TestCase):
def test_can_handle_url(self):
# should match
self.assertTrue(Vidio.can_handle_url('https://www.vidio.com/live/204-sctv-tv-stream'))
self.assertTrue(Vidio.can_handle_url('https://www.vidio.com/live/5075-dw-tv-stream'))
self.assertTrue(Vidio.can_handle_url('https://www.vidio.com/watch/766861-5-rekor-fantastis-zidane-bersama-real-madrid'))
# shouldn't match
self.assertFalse(Vidio.can_handle_url('http://www.vidio.com'))
self.assertFalse(Vidio.can_handle_url('https://www.vidio.com'))
| 40.625 | 128 | 0.721538 | 92 | 650 | 4.956522 | 0.445652 | 0.118421 | 0.157895 | 0.186404 | 0.537281 | 0.537281 | 0.434211 | 0.434211 | 0.361842 | 0.361842 | 0 | 0.024779 | 0.130769 | 650 | 15 | 129 | 43.333333 | 0.782301 | 0.043077 | 0 | 0 | 0 | 0.111111 | 0.337641 | 0 | 0 | 0 | 0 | 0 | 0.555556 | 1 | 0.111111 | false | 0 | 0.222222 | 0 | 0.444444 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4689c2d071a25a4a5162d88f9f7b3b803771726f | 130 | py | Python | Robofont-scripts/select/unsel Alternates.py | casasin/RobofontTools | c473b4346e66a14c4f490e4504c04f9384e1153f | [
"MIT"
] | 5 | 2015-05-21T14:25:40.000Z | 2019-11-16T22:41:00.000Z | Robofont-scripts/select/unsel Glyph with Extension.py | casasin/RobofontTools | c473b4346e66a14c4f490e4504c04f9384e1153f | [
"MIT"
] | null | null | null | Robofont-scripts/select/unsel Glyph with Extension.py | casasin/RobofontTools | c473b4346e66a14c4f490e4504c04f9384e1153f | [
"MIT"
] | null | null | null | # unselectGlyphsWithExtension.py
f = CurrentFont()
for gname in f.selection:
if '.' in gname:
f[gname].selected = 0
| 16.25 | 32 | 0.653846 | 16 | 130 | 5.3125 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01 | 0.230769 | 130 | 7 | 33 | 18.571429 | 0.84 | 0.230769 | 0 | 0 | 0 | 0 | 0.010204 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
468d4828614802e2c56c1470c8f00a538b8f67f9 | 439 | py | Python | cmsplugin_filer_utils/__init__.py | rescale/cmsplugin-filer | cd9e4cfbf937b59cad43401fe9440037f7e84f28 | [
"BSD-3-Clause"
] | null | null | null | cmsplugin_filer_utils/__init__.py | rescale/cmsplugin-filer | cd9e4cfbf937b59cad43401fe9440037f7e84f28 | [
"BSD-3-Clause"
] | null | null | null | cmsplugin_filer_utils/__init__.py | rescale/cmsplugin-filer | cd9e4cfbf937b59cad43401fe9440037f7e84f28 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from django.db import models
class FilerPluginManager(models.Manager):
def __init__(self, select_related=None):
self._select_related = select_related
super(FilerPluginManager, self).__init__()
def get_query_set(self):
qs = super(FilerPluginManager, self).get_query_set()
if self._select_related:
qs = qs.select_related(*self._select_related)
return qs
| 29.266667 | 60 | 0.681093 | 52 | 439 | 5.346154 | 0.461538 | 0.280576 | 0.244604 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002907 | 0.216401 | 439 | 14 | 61 | 31.357143 | 0.805233 | 0.047836 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.1 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
46943e266d16f83ef787d86d3e638c00d1d01b17 | 2,034 | py | Python | pyfixit2/image.py | Dynnammo/pyfixit | d0b18819b43acb1dc6c1b515da83f1fe157c686c | [
"WTFPL"
] | 1 | 2019-08-21T12:27:36.000Z | 2019-08-21T12:27:36.000Z | pyfixit2/image.py | Dynnammo/pyfixit | d0b18819b43acb1dc6c1b515da83f1fe157c686c | [
"WTFPL"
] | null | null | null | pyfixit2/image.py | Dynnammo/pyfixit | d0b18819b43acb1dc6c1b515da83f1fe157c686c | [
"WTFPL"
] | 1 | 2019-12-08T20:30:28.000Z | 2019-12-08T20:30:28.000Z |
import requests
from .base import Base
from .constants import API_BASE_URL
class Image(Base):
'''An image that has been uploaded to the site.
:var int id: The id of this image. Ex: ``26674``.
:var int height: *(Lazy)* Height in pixels. Ex: ``1200``.
:var int width: *(Lazy)* Width in pixels. Ex: ``1600``.
:var string original: *(Lazy, Optional)* URL to the originally-uploaded
image.
:var string mini: *(Lazy, Optional)* URL to the mini size of the image.
:var string thumbnail: *(Lazy, Optional)* URL to the thumbnail size of the
image.
:var string standard: *(Lazy, Optional)* URL to the standard size of the
image.
:var string medium: *(Lazy, Optional)* URL to the medium size of the image.
:var string large: *(Lazy, Optional)* URL to the large size of the image.
:var string huge: *(Lazy, Optional)* URL to the huge size of the image.
'''
def __init__(self, id):
self.id = id
def __str__(self):
return self.name # FIXME
def __repr__(self):
return '<Image %s>' % self.id
def __eq__(self, other):
if not isinstance(other, Image):
return false
return self.id == other.id
def refresh(self):
'''Refetch instance data from the API.
'''
response = requests.get('%s/media/images/%s' % (API_BASE_URL, self.id))
attributes = response.json()
#self.exif = attributes['exif']
self.height = attributes['height']
self.width = attributes['width']
#self.ratio = attributes['ratio']
#self.markup = attributes['markup']
#self.srcid = attributes['srcid']
image = attributes['image']
# Images are allowed to have different sizes, depending on the dimensions
# of the original image. To avoid doing a bunch of explicit 'in' checks,
# splat the variables into scope.
del(image['id'])
for size in image:
vars(self)[size] = image[size]
| 33.9 | 79 | 0.606195 | 271 | 2,034 | 4.476015 | 0.339483 | 0.032976 | 0.086562 | 0.098104 | 0.210223 | 0.094806 | 0 | 0 | 0 | 0 | 0 | 0.008856 | 0.278269 | 2,034 | 59 | 80 | 34.474576 | 0.817439 | 0.572763 | 0 | 0 | 0 | 0 | 0.057285 | 0 | 0 | 0 | 0 | 0.016949 | 0 | 1 | 0.217391 | false | 0 | 0.130435 | 0.086957 | 0.565217 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
469518d8ca99179163d60303bf41572a02b8167f | 682 | py | Python | python-mip/mip_helper/mip_helper/models.py | woken-ml/python-base-docker-images | 00afb12cf41b1d70f3fd964c5761c5a52b5b3d88 | [
"Apache-2.0"
] | 5 | 2018-03-01T08:18:22.000Z | 2019-10-09T14:20:52.000Z | python-mip/mip_helper/mip_helper/models.py | woken-ml/python-base-docker-images | 00afb12cf41b1d70f3fd964c5761c5a52b5b3d88 | [
"Apache-2.0"
] | 13 | 2018-03-18T17:47:49.000Z | 2019-02-13T11:45:06.000Z | python-mip/mip_helper/mip_helper/models.py | woken-ml/python-base-docker-images | 00afb12cf41b1d70f3fd964c5761c5a52b5b3d88 | [
"Apache-2.0"
] | 3 | 2017-05-31T07:42:05.000Z | 2019-10-25T01:27:59.000Z | #!/usr/bin/env python3
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, DateTime
from sqlalchemy.sql import func
from sqlalchemy.dialects.postgresql import JSONB
Base = declarative_base()
class JobResult(Base):
__tablename__ = 'job_result'
job_id = Column(String(128), primary_key=True)
node = Column(String(32), primary_key=True)
timestamp = Column(DateTime, server_default=func.now())
data = Column(String)
error = Column(String)
shape = Column(String(256))
function = Column(String(256))
parameters = Column(JSONB)
result_name = Column(String(32))
result_title = Column(String(256))
| 27.28 | 59 | 0.731672 | 86 | 682 | 5.651163 | 0.488372 | 0.222222 | 0.092593 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029772 | 0.162757 | 682 | 24 | 60 | 28.416667 | 0.821366 | 0.030792 | 0 | 0 | 0 | 0 | 0.015152 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.235294 | 0 | 0.941176 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
46952c8bffa6edd26ee106b4a601c41e2ff7c8d7 | 268 | py | Python | Tutorials/01. 10 Days of Statistics/002. Day 0 - Weighted Mean.py | Snehakri022/HackerrankPractice | 15c2da0bfb4bce744b345c4a3613ae9a769f2676 | [
"MIT"
] | 831 | 2018-05-12T19:06:09.000Z | 2022-03-31T19:33:54.000Z | Tutorials/01. 10 Days of Statistics/002. Day 0 - Weighted Mean.py | Snehakri022/HackerrankPractice | 15c2da0bfb4bce744b345c4a3613ae9a769f2676 | [
"MIT"
] | 2 | 2019-06-17T14:58:56.000Z | 2021-03-05T23:49:59.000Z | Tutorials/01. 10 Days of Statistics/002. Day 0 - Weighted Mean.py | Snehakri022/HackerrankPractice | 15c2da0bfb4bce744b345c4a3613ae9a769f2676 | [
"MIT"
] | 457 | 2018-06-11T07:01:57.000Z | 2022-03-28T11:08:34.000Z | # Problem: https://www.hackerrank.com/challenges/s10-weighted-mean/problem
# Score: 30
n = int(input())
arr = list(map(int, input().split()))
weights = list(map(int, input().split()))
print(round(sum([arr[x]*weights[x] for x in range(len(arr))]) / sum(weights), 1))
| 29.777778 | 81 | 0.66791 | 43 | 268 | 4.162791 | 0.651163 | 0.134078 | 0.111732 | 0.167598 | 0.223464 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020747 | 0.100746 | 268 | 8 | 82 | 33.5 | 0.721992 | 0.30597 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4695d2ccf582b6ff954038693f2be61713fb5128 | 2,069 | py | Python | recipe_tagger/foodcategory.py | TurconiAndrea/recipe-tagger | b5227a2a8a3575ac18b4c47e792353fba8841132 | [
"MIT"
] | 1 | 2021-12-27T17:34:47.000Z | 2021-12-27T17:34:47.000Z | recipe_tagger/foodcategory.py | TurconiAndrea/recipe-tagger | b5227a2a8a3575ac18b4c47e792353fba8841132 | [
"MIT"
] | null | null | null | recipe_tagger/foodcategory.py | TurconiAndrea/recipe-tagger | b5227a2a8a3575ac18b4c47e792353fba8841132 | [
"MIT"
] | null | null | null | """
Module containg all the necessary class for the package.
FoodCategory is a Enum class representing the category of ingredient.
CategorySynset is a class representing the wordnet synset of a category.
"""
from enum import Enum
from nltk.corpus import wordnet
class FoodCategory(Enum):
"""
Enum class used to represent the category of ingredients.
"""
vegetable = 0
fruit = 1
legume = 2
meat = 3
egg = 4
dairy = 5
staple = 6
condiment = 7
nut = 8
seafood = 9
snack = 10
mushroom = 11
dessert = 12
beverage = 13
class CategorySynset:
"""
Class used to represent the Wordnet Synset of catagories.
Attributes
----------
categories: list
a list containing all synset of the above categories
"""
categories = [
wordnet.synset(f"{FoodCategory.vegetable.name}.n.01"),
wordnet.synset(f"{FoodCategory.fruit.name}.n.01"),
wordnet.synset(f"{FoodCategory.legume.name}.n.01"),
wordnet.synset(f"{FoodCategory.meat.name}.n.01"),
wordnet.synset(f"{FoodCategory.egg.name}.n.01"),
wordnet.synset(f"{FoodCategory.dairy.name}.n.01"),
wordnet.synset(f"{FoodCategory.staple.name}.n.01"),
wordnet.synset(f"{FoodCategory.condiment.name}.n.01"),
wordnet.synset(f"{FoodCategory.nut.name}.n.01"),
wordnet.synset(f"{FoodCategory.seafood.name}.n.01"),
wordnet.synset(f"{FoodCategory.snack.name}.n.01"),
wordnet.synset(f"{FoodCategory.mushroom.name}.n.01"),
wordnet.synset(f"{FoodCategory.dessert.name}.n.01"),
wordnet.synset(f"{FoodCategory.beverage.name}.n.01"),
]
class FoodCategoryWaterFootprint(Enum):
"""
Enum class used to represent the default water footprint
of category of ingredients.
"""
vegetable = 354
fruit = 962
legume = 4055
meat = 8623
egg = 3265
dairy = 3178
staple = 1644
condiment = 2364
nut = 9063
seafood = 2590
snack = 2980
mushroom = 322
dessert = 3140
beverage = 732
| 25.54321 | 72 | 0.637506 | 259 | 2,069 | 5.092664 | 0.320463 | 0.157695 | 0.148597 | 0.275967 | 0.389689 | 0.372252 | 0.372252 | 0 | 0 | 0 | 0 | 0.06254 | 0.242629 | 2,069 | 80 | 73 | 25.8625 | 0.779196 | 0.240213 | 0 | 0 | 0 | 0 | 0.290193 | 0.290193 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.040816 | 0 | 0.693878 | 0.020408 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
46972a73fb0a5e01523e03f32bed0dcde02554cf | 636 | py | Python | blog/models.py | abdukhashimov/django-rest-test-1 | d438be36a7892001e121e0fa3e6df504c23aeab0 | [
"MIT"
] | null | null | null | blog/models.py | abdukhashimov/django-rest-test-1 | d438be36a7892001e121e0fa3e6df504c23aeab0 | [
"MIT"
] | null | null | null | blog/models.py | abdukhashimov/django-rest-test-1 | d438be36a7892001e121e0fa3e6df504c23aeab0 | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth import get_user_model
class Category(models.Model):
title = models.CharField(max_length=255)
def __str__(self):
if len(str(self.title)) > 20:
return self.title[:20]
return self.title
class Post(models.Model):
title = models.CharField(max_length=255)
content = models.TextField()
author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
category = models.ManyToManyField(Category)
def __str__(self):
if len(str(self.title)) > 20:
return self.title[:20] + '...'
return self.title
| 26.5 | 74 | 0.663522 | 82 | 636 | 4.963415 | 0.402439 | 0.132678 | 0.108108 | 0.167076 | 0.511057 | 0.511057 | 0.511057 | 0.511057 | 0.299754 | 0.299754 | 0 | 0.028226 | 0.220126 | 636 | 23 | 75 | 27.652174 | 0.792339 | 0 | 0 | 0.470588 | 0 | 0 | 0.004717 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.117647 | false | 0 | 0.117647 | 0 | 0.882353 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
469765462a7b28bf668f0b29cf186c599dd173dd | 335 | py | Python | Book/chap6/Supporting Materials/quadsolns.py | lorenghoh/pyman | 9b4ddd52c5577fc85e2601ae3128f398f0eb673c | [
"CC0-1.0"
] | 3 | 2020-04-30T19:50:11.000Z | 2020-10-17T02:07:00.000Z | Book/chap6/Supporting Materials/quadsolns.py | lorenghoh/pyman | 9b4ddd52c5577fc85e2601ae3128f398f0eb673c | [
"CC0-1.0"
] | 35 | 2020-04-21T04:25:31.000Z | 2021-11-06T22:49:44.000Z | Book/chap6/Supporting Materials/quadsolns.py | lorenghoh/pyman | 9b4ddd52c5577fc85e2601ae3128f398f0eb673c | [
"CC0-1.0"
] | 11 | 2020-04-21T04:33:48.000Z | 2020-10-23T21:12:12.000Z | a = float(raw_input("What is the coefficients a? "))
b = float(raw_input("What is the coefficients b? "))
c = float(raw_input("What is the coefficients c? "))
d = b*b - 4.*a*c
if d >= 0.0:
print("Solutions are real")
elif b == 0.0:
print("Solutions are imaginary")
else:
print("Solutions are complex")
print("Finished!") | 23.928571 | 52 | 0.647761 | 56 | 335 | 3.821429 | 0.410714 | 0.11215 | 0.182243 | 0.238318 | 0.654206 | 0.476636 | 0.476636 | 0 | 0 | 0 | 0 | 0.018315 | 0.185075 | 335 | 14 | 53 | 23.928571 | 0.765568 | 0 | 0 | 0 | 0 | 0 | 0.46131 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.363636 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
46a251324b0e540256e0de589d985b10ccf3f4d5 | 51 | py | Python | python/benchmarks/comparison/__init__.py | tbvanderwoude/research-project | 1c5cb09a424a0db83f18dae3278ecb7ad6866d2c | [
"Apache-2.0",
"MIT"
] | null | null | null | python/benchmarks/comparison/__init__.py | tbvanderwoude/research-project | 1c5cb09a424a0db83f18dae3278ecb7ad6866d2c | [
"Apache-2.0",
"MIT"
] | null | null | null | python/benchmarks/comparison/__init__.py | tbvanderwoude/research-project | 1c5cb09a424a0db83f18dae3278ecb7ad6866d2c | [
"Apache-2.0",
"MIT"
] | null | null | null | __all__ = ["EPEAStar", "CBM", "AStarODID", "ICTS"]
| 25.5 | 50 | 0.607843 | 5 | 51 | 5.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117647 | 51 | 1 | 51 | 51 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0.470588 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
46a6623a8ddd42fd11a30d7ade6634159399939a | 1,884 | py | Python | propeller/paddle/data/feature_column.py | JZZ-NOTE/ERNIE | ff89c2a6baef9fd662a5b847224ca39e67d6ad11 | [
"Apache-2.0"
] | 3,712 | 2019-07-19T08:40:57.000Z | 2022-03-31T08:52:43.000Z | propeller/paddle/data/feature_column.py | JZZ-NOTE/ERNIE | ff89c2a6baef9fd662a5b847224ca39e67d6ad11 | [
"Apache-2.0"
] | 541 | 2019-07-21T08:57:11.000Z | 2022-03-22T12:13:28.000Z | propeller/paddle/data/feature_column.py | JZZ-NOTE/ERNIE | ff89c2a6baef9fd662a5b847224ca39e67d6ad11 | [
"Apache-2.0"
] | 857 | 2019-07-19T08:40:52.000Z | 2022-03-30T03:23:27.000Z | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""FeatureColumns and many Column"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import sys
import struct
from six.moves import zip, map
import itertools
import gzip
from functools import partial
import six
import logging
import numpy as np
from glob import glob
from propeller.data.feature_column import FeatureColumns as FCBase
from propeller.paddle.data.functional import Dataset
import multiprocessing
log = logging.getLogger(__name__)
__all__ = ['FeatureColumns']
class FeatureColumns(FCBase):
"""A Dataset Factory object"""
def build_dataset(self, *args, **kwargs):
"""
build `Dataset` from `data_dir` or `data_file`
if `use_gz`, will try to convert data_files to gz format and save to `gz_dir`, if `gz_dir` not given, will create one.
"""
ds = super(FeatureColumns, self).build_dataset(*args, **kwargs)
ds.__class__ = Dataset
return ds
def build_dataset_from_stdin(self, *args, **kwargs):
"""doc"""
ds = super(FeatureColumns, self).build_dataset_from_stdin(*args,
**kwargs)
ds.__class__ = Dataset
return ds
| 31.932203 | 126 | 0.707537 | 252 | 1,884 | 5.107143 | 0.511905 | 0.04662 | 0.037296 | 0.024864 | 0.107226 | 0.107226 | 0.049728 | 0 | 0 | 0 | 0 | 0.005424 | 0.217091 | 1,884 | 58 | 127 | 32.482759 | 0.867119 | 0.430998 | 0 | 0.137931 | 0 | 0 | 0.01382 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.068966 | false | 0 | 0.586207 | 0 | 0.758621 | 0.034483 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
46a6a7637ef1e46f27bc4a05db0dddfb2d495768 | 1,002 | py | Python | backend_server/operations_test.py | rishavgiri6/News4U | d426eba97039a3d1afd90ecd14c454856b91f9d8 | [
"Unlicense"
] | 2 | 2021-08-02T09:41:42.000Z | 2021-08-10T05:26:52.000Z | backend_server/operations_test.py | rishavgiri6/News4U | d426eba97039a3d1afd90ecd14c454856b91f9d8 | [
"Unlicense"
] | null | null | null | backend_server/operations_test.py | rishavgiri6/News4U | d426eba97039a3d1afd90ecd14c454856b91f9d8 | [
"Unlicense"
] | null | null | null | import operations
def test_getOneNews_basic():
news = operations.getOneNews()
print(news)
assert news is not None
print('test_getOneNews_basic passed!')
def test_getNewsSummariesForUser_basic():
news = operations.getNewsSummariesForUser('test', 1)
assert len(news) > 0
print('test_getNewsSummariesForUser_basic passed!')
def test_getNewsSummariesForUser_pagination():
news_page_1 = operations.getNewsSummariesForUser('test', 1)
news_page_2 = operations.getNewsSummariesForUser('test', 2)
# Assert that there is no dupe news in two pages.
digests_page_1_set = set([news['digest'] for news in news_page_1])
digests_page_2_set = set([news['digest'] for news in news_page_2])
assert len(digests_page_1_set.intersection(digests_page_2_set)) == 0
print('test_getNewsSummariesForUser_pagination passed!')
if __name__ == "__main__":
test_getOneNews_basic()
test_getNewsSummariesForUser_basic()
test_getNewsSummariesForUser_pagination()
| 34.551724 | 72 | 0.759481 | 122 | 1,002 | 5.860656 | 0.286885 | 0.226573 | 0.07972 | 0.05035 | 0.206993 | 0.092308 | 0.092308 | 0.092308 | 0.092308 | 0 | 0 | 0.01524 | 0.148703 | 1,002 | 28 | 73 | 35.785714 | 0.822978 | 0.046906 | 0 | 0 | 0 | 0 | 0.157398 | 0.098636 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.142857 | false | 0.142857 | 0.047619 | 0 | 0.190476 | 0.190476 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
46aa44448e2130ff8a32352c01d4353b460c9459 | 838 | py | Python | corehq/apps/hqcase/management/commands/ptop_generate_mapping.py | SEL-Columbia/commcare-hq | 992ee34a679c37f063f86200e6df5a197d5e3ff6 | [
"BSD-3-Clause"
] | 1 | 2015-02-10T23:26:39.000Z | 2015-02-10T23:26:39.000Z | corehq/apps/hqcase/management/commands/ptop_generate_mapping.py | SEL-Columbia/commcare-hq | 992ee34a679c37f063f86200e6df5a197d5e3ff6 | [
"BSD-3-Clause"
] | null | null | null | corehq/apps/hqcase/management/commands/ptop_generate_mapping.py | SEL-Columbia/commcare-hq | 992ee34a679c37f063f86200e6df5a197d5e3ff6 | [
"BSD-3-Clause"
] | null | null | null | from django.core.management.base import NoArgsCommand, BaseCommand
import sys
from dimagi.utils.modules import to_function
class MappingOutputCommand(BaseCommand):
help="Generate mapping JSON of our ES indexed types. Generic"
option_list = NoArgsCommand.option_list + (
)
doc_class_str = None
doc_class = None
def finish_handle(self):
raise NotImplemented("Finish this!")
def handle(self, *args, **options):
if self.doc_class is None and self.doc_class_str is None:
#in the case where we want to make this a generic anyclass user
if len(args) != 1:
print "\tEnter a doc class!\n"
sys.exit(1)
self.doc_class_str = args[0].split('.')[-1]
self.doc_class = to_function(args[0])
self.finish_handle()
| 29.928571 | 75 | 0.643198 | 112 | 838 | 4.678571 | 0.544643 | 0.10687 | 0.091603 | 0.057252 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008143 | 0.267303 | 838 | 27 | 76 | 31.037037 | 0.845277 | 0.073986 | 0 | 0 | 1 | 0 | 0.115285 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.157895 | null | null | 0.052632 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d3b51cab9d06dfc73bac6c37f6f9024091020dcb | 348 | py | Python | greydot/runtest.py | TralahM/greydot-api | 34982c34bf878b2728e934147ca4ea38a78523e4 | [
"MIT"
] | null | null | null | greydot/runtest.py | TralahM/greydot-api | 34982c34bf878b2728e934147ca4ea38a78523e4 | [
"MIT"
] | null | null | null | greydot/runtest.py | TralahM/greydot-api | 34982c34bf878b2728e934147ca4ea38a78523e4 | [
"MIT"
] | null | null | null | import tests
def run():
print("Testing airtime...")
tests.test_airtime()
print("Testing b2c...")
tests.test_b2c()
print("Testing wallet...")
tests.test_wallet()
print("Testing signup...")
tests.test_signup()
print("Testing sms...")
tests.test_sms()
print("DONE")
if __name__ == "__main__":
run()
| 17.4 | 31 | 0.594828 | 40 | 348 | 4.85 | 0.4 | 0.309278 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00738 | 0.221264 | 348 | 19 | 32 | 18.315789 | 0.708487 | 0 | 0 | 0 | 0 | 0 | 0.264368 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | true | 0 | 0.066667 | 0 | 0.133333 | 0.4 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d3ba47ccfbc6c0360afdfcfb198970eb94b414df | 6,601 | py | Python | darling_ansible/python_venv/lib/python3.7/site-packages/oci/os_management/models/installable_package_summary.py | revnav/sandbox | f9c8422233d093b76821686b6c249417502cf61d | [
"Apache-2.0"
] | null | null | null | darling_ansible/python_venv/lib/python3.7/site-packages/oci/os_management/models/installable_package_summary.py | revnav/sandbox | f9c8422233d093b76821686b6c249417502cf61d | [
"Apache-2.0"
] | null | null | null | darling_ansible/python_venv/lib/python3.7/site-packages/oci/os_management/models/installable_package_summary.py | revnav/sandbox | f9c8422233d093b76821686b6c249417502cf61d | [
"Apache-2.0"
] | 1 | 2020-06-25T03:12:58.000Z | 2020-06-25T03:12:58.000Z | # coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401
from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class InstallablePackageSummary(object):
"""
A software package available for install on a managed instance
"""
def __init__(self, **kwargs):
"""
Initializes a new InstallablePackageSummary object with values from keyword arguments.
The following keyword arguments are supported (corresponding to the getters/setters of this class):
:param display_name:
The value to assign to the display_name property of this InstallablePackageSummary.
:type display_name: str
:param name:
The value to assign to the name property of this InstallablePackageSummary.
:type name: str
:param type:
The value to assign to the type property of this InstallablePackageSummary.
:type type: str
:param version:
The value to assign to the version property of this InstallablePackageSummary.
:type version: str
:param architecture:
The value to assign to the architecture property of this InstallablePackageSummary.
:type architecture: str
:param software_sources:
The value to assign to the software_sources property of this InstallablePackageSummary.
:type software_sources: list[SoftwareSourceId]
"""
self.swagger_types = {
'display_name': 'str',
'name': 'str',
'type': 'str',
'version': 'str',
'architecture': 'str',
'software_sources': 'list[SoftwareSourceId]'
}
self.attribute_map = {
'display_name': 'displayName',
'name': 'name',
'type': 'type',
'version': 'version',
'architecture': 'architecture',
'software_sources': 'softwareSources'
}
self._display_name = None
self._name = None
self._type = None
self._version = None
self._architecture = None
self._software_sources = None
@property
def display_name(self):
"""
**[Required]** Gets the display_name of this InstallablePackageSummary.
Package name
:return: The display_name of this InstallablePackageSummary.
:rtype: str
"""
return self._display_name
@display_name.setter
def display_name(self, display_name):
"""
Sets the display_name of this InstallablePackageSummary.
Package name
:param display_name: The display_name of this InstallablePackageSummary.
:type: str
"""
self._display_name = display_name
@property
def name(self):
"""
**[Required]** Gets the name of this InstallablePackageSummary.
Unique identifier for the package. NOTE - This is not an OCID
:return: The name of this InstallablePackageSummary.
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""
Sets the name of this InstallablePackageSummary.
Unique identifier for the package. NOTE - This is not an OCID
:param name: The name of this InstallablePackageSummary.
:type: str
"""
self._name = name
@property
def type(self):
"""
**[Required]** Gets the type of this InstallablePackageSummary.
Type of the package
:return: The type of this InstallablePackageSummary.
:rtype: str
"""
return self._type
@type.setter
def type(self, type):
"""
Sets the type of this InstallablePackageSummary.
Type of the package
:param type: The type of this InstallablePackageSummary.
:type: str
"""
self._type = type
@property
def version(self):
"""
**[Required]** Gets the version of this InstallablePackageSummary.
Version of the package
:return: The version of this InstallablePackageSummary.
:rtype: str
"""
return self._version
@version.setter
def version(self, version):
"""
Sets the version of this InstallablePackageSummary.
Version of the package
:param version: The version of this InstallablePackageSummary.
:type: str
"""
self._version = version
@property
def architecture(self):
"""
Gets the architecture of this InstallablePackageSummary.
The architecture for which this package was built
:return: The architecture of this InstallablePackageSummary.
:rtype: str
"""
return self._architecture
@architecture.setter
def architecture(self, architecture):
"""
Sets the architecture of this InstallablePackageSummary.
The architecture for which this package was built
:param architecture: The architecture of this InstallablePackageSummary.
:type: str
"""
self._architecture = architecture
@property
def software_sources(self):
"""
Gets the software_sources of this InstallablePackageSummary.
list of software sources that provide the software package
:return: The software_sources of this InstallablePackageSummary.
:rtype: list[SoftwareSourceId]
"""
return self._software_sources
@software_sources.setter
def software_sources(self, software_sources):
"""
Sets the software_sources of this InstallablePackageSummary.
list of software sources that provide the software package
:param software_sources: The software_sources of this InstallablePackageSummary.
:type: list[SoftwareSourceId]
"""
self._software_sources = software_sources
def __repr__(self):
return formatted_flat_dict(self)
def __eq__(self, other):
if other is None:
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
return not self == other
| 29.207965 | 245 | 0.634752 | 697 | 6,601 | 5.870875 | 0.186514 | 0.045455 | 0.227273 | 0.119746 | 0.546188 | 0.417889 | 0.31305 | 0.242424 | 0.18915 | 0.133431 | 0 | 0.003866 | 0.294652 | 6,601 | 225 | 246 | 29.337778 | 0.875 | 0.528102 | 0 | 0.084507 | 0 | 0 | 0.08489 | 0.009338 | 0 | 0 | 0 | 0 | 0 | 1 | 0.225352 | false | 0 | 0.028169 | 0.028169 | 0.408451 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d3c1466a5b16aa396a7a1626545f7b8b035076b7 | 8,690 | py | Python | pgoapi/protos/pogoprotos/data/battle/battle_action_pb2.py | z3cr3t/api | 960c0c10a76e1f46e99de7f8de8644b00cf95d0d | [
"MIT"
] | null | null | null | pgoapi/protos/pogoprotos/data/battle/battle_action_pb2.py | z3cr3t/api | 960c0c10a76e1f46e99de7f8de8644b00cf95d0d | [
"MIT"
] | null | null | null | pgoapi/protos/pogoprotos/data/battle/battle_action_pb2.py | z3cr3t/api | 960c0c10a76e1f46e99de7f8de8644b00cf95d0d | [
"MIT"
] | null | null | null | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/data/battle/battle_action.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from pogoprotos.data.battle import battle_results_pb2 as pogoprotos_dot_data_dot_battle_dot_battle__results__pb2
from pogoprotos.data.battle import battle_action_type_pb2 as pogoprotos_dot_data_dot_battle_dot_battle__action__type__pb2
from pogoprotos.data.battle import battle_participant_pb2 as pogoprotos_dot_data_dot_battle_dot_battle__participant__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='pogoprotos/data/battle/battle_action.proto',
package='pogoprotos.data.battle',
syntax='proto3',
serialized_pb=_b('\n*pogoprotos/data/battle/battle_action.proto\x12\x16pogoprotos.data.battle\x1a+pogoprotos/data/battle/battle_results.proto\x1a/pogoprotos/data/battle/battle_action_type.proto\x1a/pogoprotos/data/battle/battle_participant.proto\"\x83\x04\n\x0c\x42\x61ttleAction\x12\x36\n\x04type\x18\x01 \x01(\x0e\x32(.pogoprotos.data.battle.BattleActionType\x12\x17\n\x0f\x61\x63tion_start_ms\x18\x02 \x01(\x03\x12\x13\n\x0b\x64uration_ms\x18\x03 \x01(\x05\x12\x14\n\x0c\x65nergy_delta\x18\x05 \x01(\x05\x12\x16\n\x0e\x61ttacker_index\x18\x06 \x01(\x05\x12\x14\n\x0ctarget_index\x18\x07 \x01(\x05\x12\x19\n\x11\x61\x63tive_pokemon_id\x18\x08 \x01(\x06\x12@\n\rplayer_joined\x18\t \x01(\x0b\x32).pogoprotos.data.battle.BattleParticipant\x12=\n\x0e\x62\x61ttle_results\x18\n \x01(\x0b\x32%.pogoprotos.data.battle.BattleResults\x12)\n!damage_windows_start_timestamp_ms\x18\x0b \x01(\x03\x12\'\n\x1f\x64\x61mage_windows_end_timestamp_ms\x18\x0c \x01(\x03\x12>\n\x0bplayer_left\x18\r \x01(\x0b\x32).pogoprotos.data.battle.BattleParticipant\x12\x19\n\x11target_pokemon_id\x18\x0e \x01(\x06\x62\x06proto3')
,
dependencies=[pogoprotos_dot_data_dot_battle_dot_battle__results__pb2.DESCRIPTOR,pogoprotos_dot_data_dot_battle_dot_battle__action__type__pb2.DESCRIPTOR,pogoprotos_dot_data_dot_battle_dot_battle__participant__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_BATTLEACTION = _descriptor.Descriptor(
name='BattleAction',
full_name='pogoprotos.data.battle.BattleAction',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='pogoprotos.data.battle.BattleAction.type', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='action_start_ms', full_name='pogoprotos.data.battle.BattleAction.action_start_ms', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='duration_ms', full_name='pogoprotos.data.battle.BattleAction.duration_ms', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='energy_delta', full_name='pogoprotos.data.battle.BattleAction.energy_delta', index=3,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='attacker_index', full_name='pogoprotos.data.battle.BattleAction.attacker_index', index=4,
number=6, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='target_index', full_name='pogoprotos.data.battle.BattleAction.target_index', index=5,
number=7, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='active_pokemon_id', full_name='pogoprotos.data.battle.BattleAction.active_pokemon_id', index=6,
number=8, type=6, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='player_joined', full_name='pogoprotos.data.battle.BattleAction.player_joined', index=7,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='battle_results', full_name='pogoprotos.data.battle.BattleAction.battle_results', index=8,
number=10, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='damage_windows_start_timestamp_ms', full_name='pogoprotos.data.battle.BattleAction.damage_windows_start_timestamp_ms', index=9,
number=11, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='damage_windows_end_timestamp_ms', full_name='pogoprotos.data.battle.BattleAction.damage_windows_end_timestamp_ms', index=10,
number=12, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='player_left', full_name='pogoprotos.data.battle.BattleAction.player_left', index=11,
number=13, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='target_pokemon_id', full_name='pogoprotos.data.battle.BattleAction.target_pokemon_id', index=12,
number=14, type=6, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=214,
serialized_end=729,
)
_BATTLEACTION.fields_by_name['type'].enum_type = pogoprotos_dot_data_dot_battle_dot_battle__action__type__pb2._BATTLEACTIONTYPE
_BATTLEACTION.fields_by_name['player_joined'].message_type = pogoprotos_dot_data_dot_battle_dot_battle__participant__pb2._BATTLEPARTICIPANT
_BATTLEACTION.fields_by_name['battle_results'].message_type = pogoprotos_dot_data_dot_battle_dot_battle__results__pb2._BATTLERESULTS
_BATTLEACTION.fields_by_name['player_left'].message_type = pogoprotos_dot_data_dot_battle_dot_battle__participant__pb2._BATTLEPARTICIPANT
DESCRIPTOR.message_types_by_name['BattleAction'] = _BATTLEACTION
BattleAction = _reflection.GeneratedProtocolMessageType('BattleAction', (_message.Message,), dict(
DESCRIPTOR = _BATTLEACTION,
__module__ = 'pogoprotos.data.battle.battle_action_pb2'
# @@protoc_insertion_point(class_scope:pogoprotos.data.battle.BattleAction)
))
_sym_db.RegisterMessage(BattleAction)
# @@protoc_insertion_point(module_scope)
| 53.641975 | 1,105 | 0.763061 | 1,175 | 8,690 | 5.302979 | 0.145532 | 0.051356 | 0.096293 | 0.057776 | 0.676135 | 0.629915 | 0.565078 | 0.508907 | 0.47681 | 0.447761 | 0 | 0.041458 | 0.128423 | 8,690 | 161 | 1,106 | 53.975155 | 0.781225 | 0.029229 | 0 | 0.5 | 1 | 0.007042 | 0.239932 | 0.20849 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.06338 | 0 | 0.06338 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d3d134d90f334e2d6c04f1ab6a5b7792c4af3943 | 1,228 | py | Python | list_1/common_end.py | nhutnamhcmus/coding-bat-solutions | 5f780a4027a6c3523a72961db1bad547c997fdc6 | [
"MIT"
] | 1 | 2020-09-19T18:02:13.000Z | 2020-09-19T18:02:13.000Z | list_1/common_end.py | nhutnamhcmus/coding-bat-solutions | 5f780a4027a6c3523a72961db1bad547c997fdc6 | [
"MIT"
] | null | null | null | list_1/common_end.py | nhutnamhcmus/coding-bat-solutions | 5f780a4027a6c3523a72961db1bad547c997fdc6 | [
"MIT"
] | null | null | null | # =======================================================================================================================================
# VNU-HCM, University of Science
# Department Computer Science, Faculty of Information Technology
# Authors: Nhut-Nam Le (Tich Phan Suy Rong)
# © 2020
import unittest
"""
Given 2 arrays of ints, a and b, return True if they have the same first element or they have the same last element. Both arrays will be length 1 or more.
common_end([1, 2, 3], [7, 3]) → True
common_end([1, 2, 3], [7, 3, 2]) → False
common_end([1, 2, 3], [1, 3]) → True
"""
def common_end(a, b):
return (False, True)[a[0] == b[0] or a[len(a) - 1] == b[len(b) - 1]]
class TestCommonEnd(unittest.TestCase):
def test_case_00(self):
self.assertEqual(common_end([1, 2, 3], [7, 3]), True)
def test_case_01(self):
self.assertEqual(common_end([1, 2, 3], [7, 3, 2]), False)
def test_case_02(self):
self.assertEqual(common_end([1, 2, 3], [1, 3]), True)
def test_case_03(self):
self.assertEqual(common_end([1, 2, 3], [1]), True)
def test_case_04(self):
self.assertEqual(common_end([1, 2, 3], [2]), False)
if __name__ == "__main__":
unittest.main()
| 29.238095 | 154 | 0.557818 | 188 | 1,228 | 3.521277 | 0.367021 | 0.122357 | 0.120846 | 0.132931 | 0.356495 | 0.311178 | 0.311178 | 0.267372 | 0.196375 | 0.099698 | 0 | 0.06 | 0.185668 | 1,228 | 41 | 155 | 29.95122 | 0.598 | 0.226384 | 0 | 0 | 0 | 0 | 0.01203 | 0 | 0 | 0 | 0 | 0 | 0.3125 | 1 | 0.375 | false | 0 | 0.0625 | 0.0625 | 0.5625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
d3d878d702bcf7bcfd8acd07db854f4a75346a71 | 4,335 | py | Python | env/lib/python3.8/site-packages/arcade/csscolor/__init__.py | iodaniel/cse210-project | abc7a4e64d35707d04900f8535961fc57ed8f4e1 | [
"MIT"
] | 1 | 2021-07-11T02:51:52.000Z | 2021-07-11T02:51:52.000Z | env/lib/python3.8/site-packages/arcade/csscolor/__init__.py | iodaniel/cse210-project | abc7a4e64d35707d04900f8535961fc57ed8f4e1 | [
"MIT"
] | null | null | null | env/lib/python3.8/site-packages/arcade/csscolor/__init__.py | iodaniel/cse210-project | abc7a4e64d35707d04900f8535961fc57ed8f4e1 | [
"MIT"
] | null | null | null | """
This module pre-defines colors as defined by the W3C CSS standard:
https://www.w3.org/TR/2018/PR-css-color-3-20180315/
"""
ALICE_BLUE = (240, 248, 255)
ANTIQUE_WHITE = (250, 235, 215)
AQUA = (0, 255, 255)
AQUAMARINE = (127, 255, 212)
AZURE = (240, 255, 255)
BEIGE = (245, 245, 220)
BISQUE = (255, 228, 196)
BLACK = (0, 0, 0)
BLANCHED_ALMOND = (255, 235, 205)
BLUE = (0, 0, 255)
BLUE_VIOLET = (138, 43, 226)
BROWN = (165, 42, 42)
BURLYWOOD = (222, 184, 135)
CADET_BLUE = (95, 158, 160)
CHARTREUSE = (127, 255, 0)
CHOCOLATE = (210, 105, 30)
CORAL = (255, 127, 80)
CORNFLOWER_BLUE = (100, 149, 237)
CORNSILK = (255, 248, 220)
CRIMSON = (220, 20, 60)
CYAN = (0, 255, 255)
DARK_BLUE = (0, 0, 139)
DARK_CYAN = (0, 139, 139)
DARK_GOLDENROD = (184, 134, 11)
DARK_GRAY = (169, 169, 169)
DARK_GREEN = (0, 100, 0)
DARK_GREY = (169, 169, 169)
DARK_KHAKI = (189, 183, 107)
DARK_MAGENTA = (139, 0, 139)
DARK_OLIVE_GREEN = (85, 107, 47)
DARK_ORANGE = (255, 140, 0)
DARK_ORCHID = (153, 50, 204)
DARK_RED = (139, 0, 0)
DARK_SALMON = (233, 150, 122)
DARK_SEA_GREEN = (143, 188, 143)
DARK_SLATE_BLUE = (72, 61, 139)
DARK_SLATE_GRAY = (47, 79, 79)
DARK_SLATE_GREY = (47, 79, 79)
DARK_TURQUOISE = (0, 206, 209)
DARK_VIOLET = (148, 0, 211)
DEEP_PINK = (255, 20, 147)
DEEP_SKY_BLUE = (0, 191, 255)
DIM_GRAY = (105, 105, 105)
DIM_GREY = (105, 105, 105)
DODGER_BLUE = (30, 144, 255)
FIREBRICK = (178, 34, 34)
FLORAL_WHITE = (255, 250, 240)
FOREST_GREEN = (34, 139, 34)
FUCHSIA = (255, 0, 255)
GAINSBORO = (220, 220, 220)
GHOST_WHITE = (248, 248, 255)
GOLD = (255, 215, 0)
GOLDENROD = (218, 165, 32)
GRAY = (128, 128, 128)
GREEN = (0, 128, 0)
GREENYELLOW = (173, 255, 47)
GREY = (128, 128, 128)
HONEYDEW = (240, 255, 240)
HOTPINK = (255, 105, 180)
INDIANRED = (205, 92, 92)
INDIGO = (75, 0, 130)
IVORY = (255, 255, 240)
KHAKI = (240, 230, 140)
LAVENDER = (230, 230, 250)
LAVENDER_BLUSH = (255, 240, 245)
LAWNGREEN = (124, 252, 0)
LEMON_CHIFFON = (255, 250, 205)
LIGHT_BLUE = (173, 216, 230)
LIGHT_CORAL = (240, 128, 128)
LIGHT_CYAN = (224, 255, 255)
LIGHT_GOLDENROD_YELLOW = (250, 250, 210)
LIGHT_GRAY = (211, 211, 211)
LIGHT_GREEN = (144, 238, 144)
LIGHT_GREY = (211, 211, 211)
LIGHT_PINK = (255, 182, 193)
LIGHT_SALMON = (255, 160, 122)
LIGHT_SEA_GREEN = (32, 178, 170)
LIGHT_SKY_BLUE = (135, 206, 250)
LIGHT_SLATE_GRAY = (119, 136, 153)
LIGHT_SLATE_GREY = (119, 136, 153)
LIGHT_STEEL_BLUE = (176, 196, 222)
LIGHT_YELLOW = (255, 255, 224)
LIME = (0, 255, 0)
LIME_GREEN = (50, 205, 50)
LINEN = (250, 240, 230)
MAGENTA = (255, 0, 255)
MAROON = (128, 0, 0)
MEDIUM_AQUAMARINE = (102, 205, 170)
MEDIUM_BLUE = (0, 0, 205)
MEDIUM_ORCHID = (186, 85, 211)
MEDIUM_PURPLE = (147, 112, 219)
MEDIUM_SEA_GREEN = (60, 179, 113)
MEDIUM_SLATE_BLUE = (123, 104, 238)
MEDIUM_SPRING_GREEN = (0, 250, 154)
MEDIUM_TURQUOISE = (72, 209, 204)
MEDIUM_VIOLET_RED = (199, 21, 133)
MIDNIGHT_BLUE = (25, 25, 112)
MINT_CREAM = (245, 255, 250)
MISTY_ROSE = (255, 228, 225)
MOCCASIN = (255, 228, 181)
NAVAJO_WHITE = (255, 222, 173)
NAVY = (0, 0, 128)
OLD_LACE = (253, 245, 230)
OLIVE = (128, 128, 0)
OLIVE_DRAB = (107, 142, 35)
ORANGE = (255, 165, 0)
ORANGE_RED = (255, 69, 0)
ORCHID = (218, 112, 214)
PALE_GOLDENROD = (238, 232, 170)
PALE_GREEN = (152, 251, 152)
PALE_TURQUOISE = (175, 238, 238)
PALE_VIOLET_RED = (219, 112, 147)
PAPAYA_WHIP = (255, 239, 213)
PEACH_PUFF = (255, 218, 185)
PERU = (205, 133, 63)
PINK = (255, 192, 203)
PLUM = (221, 160, 221)
POWDER_BLUE = (176, 224, 230)
PURPLE = (128, 0, 128)
RED = (255, 0, 0)
ROSY_BROWN = (188, 143, 143)
ROYAL_BLUE = (65, 105, 225)
SADDLE_BROWN = (139, 69, 19)
SALMON = (250, 128, 114)
SANDY_BROWN = (244, 164, 96)
SEA_GREEN = (46, 139, 87)
SEASHELL = (255, 245, 238)
SIENNA = (160, 82, 45)
SILVER = (192, 192, 192)
SKY_BLUE = (135, 206, 235)
SLATE_BLUE = (106, 90, 205)
SLATE_GRAY = (112, 128, 144)
SLATE_GREY = (112, 128, 144)
SNOW = (255, 250, 250)
SPRING_GREEN = (0, 255, 127)
STEEL_BLUE = (70, 130, 180)
TAN = (210, 180, 140)
TEAL = (0, 128, 128)
THISTLE = (216, 191, 216)
TOMATO = (255, 99, 71)
TURQUOISE = (64, 224, 208)
VIOLET = (238, 130, 238)
WHEAT = (245, 222, 179)
WHITE = (255, 255, 255)
WHITE_SMOKE = (245, 245, 245)
YELLOW = (255, 255, 0)
YELLOW_GREEN = (154, 205)
| 28.333333 | 67 | 0.617993 | 714 | 4,335 | 3.606443 | 0.359944 | 0.020971 | 0.00699 | 0.010097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.346243 | 0.207843 | 4,335 | 152 | 68 | 28.519737 | 0.403611 | 0.02722 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d3e09bb779bbf2e537d4d07524acb538a4e20b56 | 636 | py | Python | Lib/site-packages/easyprocess/examples/cmd.py | caiyongji/tf2.3.1-py3.7.9-full-built | ace4efcbf05b2b494388739718a18c13eab83c71 | [
"CNRI-Python-GPL-Compatible"
] | 1 | 2021-06-07T17:07:58.000Z | 2021-06-07T17:07:58.000Z | Lib/site-packages/easyprocess/examples/cmd.py | caiyongji/tf2.3.1-py3.7.9-full-built | ace4efcbf05b2b494388739718a18c13eab83c71 | [
"CNRI-Python-GPL-Compatible"
] | null | null | null | Lib/site-packages/easyprocess/examples/cmd.py | caiyongji/tf2.3.1-py3.7.9-full-built | ace4efcbf05b2b494388739718a18c13eab83c71 | [
"CNRI-Python-GPL-Compatible"
] | 1 | 2022-03-31T06:46:19.000Z | 2022-03-31T06:46:19.000Z | import sys
from easyprocess import EasyProcess
python = sys.executable
print("-- Run program, wait for it to complete, get stdout:")
s = EasyProcess([python, "-c", "print(3)"]).call().stdout
print(s)
print("-- Run program, wait for it to complete, get stderr:")
s = EasyProcess([python, "-c", "import sys;sys.stderr.write('4\\n')"]).call().stderr
print(s)
print("-- Run program, wait for it to complete, get return code:")
s = EasyProcess([python, "--version"]).call().return_code
print(s)
print("-- Run program, wait 1 second, stop it, get stdout:")
s = EasyProcess(["ping", "localhost"]).start().sleep(1).stop().stdout
print(s)
| 28.909091 | 84 | 0.680818 | 95 | 636 | 4.547368 | 0.357895 | 0.157407 | 0.138889 | 0.175926 | 0.342593 | 0.342593 | 0.284722 | 0.284722 | 0.284722 | 0.199074 | 0 | 0.007181 | 0.124214 | 636 | 21 | 85 | 30.285714 | 0.768402 | 0 | 0 | 0.266667 | 0 | 0 | 0.441824 | 0.044025 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.6 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
d3f0263c1029fc8074ff0ba2ade5f3885f319e79 | 478 | py | Python | frappe-bench/apps/erpnext/erpnext/patches/v7_1/save_stock_settings.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | 1 | 2021-04-29T14:55:29.000Z | 2021-04-29T14:55:29.000Z | frappe-bench/apps/erpnext/erpnext/patches/v7_1/save_stock_settings.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/apps/erpnext/erpnext/patches/v7_1/save_stock_settings.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | 1 | 2021-04-29T14:39:01.000Z | 2021-04-29T14:39:01.000Z | from __future__ import unicode_literals
import frappe
def execute():
stock_settings = frappe.get_doc('Stock Settings')
if stock_settings.default_warehouse \
and not frappe.db.exists("Warehouse", stock_settings.default_warehouse):
stock_settings.default_warehouse = None
if stock_settings.stock_uom and not frappe.db.exists("UOM", stock_settings.stock_uom):
stock_settings.stock_uom = None
stock_settings.flags.ignore_mandatory = True
stock_settings.save()
| 29.875 | 87 | 0.797071 | 65 | 478 | 5.523077 | 0.4 | 0.362117 | 0.167131 | 0.24234 | 0.423398 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119247 | 478 | 15 | 88 | 31.866667 | 0.852732 | 0 | 0 | 0 | 0 | 0 | 0.054393 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.181818 | 0 | 0.272727 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d3f6428fa096b6d7b677fce82fdf4af97411d396 | 1,194 | py | Python | moozy_admin/models.py | meetthecoder/moozy | e21dab01f2aab4c5a4b2c4151f8408138cf681a5 | [
"MIT"
] | null | null | null | moozy_admin/models.py | meetthecoder/moozy | e21dab01f2aab4c5a4b2c4151f8408138cf681a5 | [
"MIT"
] | null | null | null | moozy_admin/models.py | meetthecoder/moozy | e21dab01f2aab4c5a4b2c4151f8408138cf681a5 | [
"MIT"
] | null | null | null | from django.db import models
from user.models import RestaurantUser
class FoodCategory(models.Model):
"""Admin Food Category"""
name = models.CharField(max_length=50, verbose_name='Name')
image = models.ImageField(upload_to="media/food_category/", verbose_name='Image')
def __str__(self):
return self.name
class Menu(models.Model):
"""Admin Menu"""
name = models.CharField(max_length=50, verbose_name='Name')
image = models.ImageField(upload_to="media/menu_images/", verbose_name='Image')
category = models.ForeignKey(FoodCategory, on_delete=models.CASCADE, related_name='cat', verbose_name='Category')
food_choices = (
('Veg', 'Veg'),
('Nonveg', 'Nonveg'),
('Both', 'Both'),
)
food_type = models.CharField(max_length=50, blank=False, null=True, choices=food_choices, verbose_name='Food Type')
def __str__(self):
return self.name
class AttributeCategory(models.Model):
"""Attribute Category"""
name = models.CharField(max_length=100, verbose_name='Name')
image = models.ImageField(upload_to="media/attr_images/", verbose_name='Image')
def __str__(self):
return self.name
| 30.615385 | 119 | 0.68928 | 147 | 1,194 | 5.360544 | 0.333333 | 0.111675 | 0.091371 | 0.121827 | 0.496193 | 0.463198 | 0.40736 | 0.364213 | 0.364213 | 0.200508 | 0 | 0.009091 | 0.170854 | 1,194 | 38 | 120 | 31.421053 | 0.786869 | 0.041039 | 0 | 0.333333 | 0 | 0 | 0.114463 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.083333 | 0.125 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
d3f7920f049abb12f76555efe08c640adcfd2dc8 | 2,555 | py | Python | arpwatch/tests.py | manens/nadine | 4938afa2d2c69ae5ac54f4360b081d10521a0a2f | [
"Apache-2.0"
] | null | null | null | arpwatch/tests.py | manens/nadine | 4938afa2d2c69ae5ac54f4360b081d10521a0a2f | [
"Apache-2.0"
] | null | null | null | arpwatch/tests.py | manens/nadine | 4938afa2d2c69ae5ac54f4360b081d10521a0a2f | [
"Apache-2.0"
] | null | null | null | import json
import traceback
from datetime import datetime, timedelta, date
from django.test import TestCase
from django.core import management
from django.contrib.auth.models import User
from django.conf import settings
from django.db import IntegrityError
from django.utils.timezone import localtime, now
from . import arp
from arpwatch.models import *
class ArpWatchTest(TestCase):
def test_duplicate_device(self):
MAC = "AA:AA:AA:AA:AA:AA"
device1 = UserDevice.objects.create(mac_address=MAC)
with self.assertRaises(IntegrityError):
device2 = UserDevice.objects.create(mac_address=MAC)
def test_dir_lock(self):
arp.unlock_import_dir()
self.assertFalse(arp.import_dir_locked())
arp.lock_import_dir()
self.assertTrue(arp.import_dir_locked())
arp.unlock_import_dir()
self.assertFalse(arp.import_dir_locked())
def test_log_message(self):
arp.unlock_import_dir()
arp.log_message("testing")
self.assertFalse(arp.import_dir_locked())
def test_arpwatch_for_user(self):
# Register user1 with device1
user1 = User.objects.create(username='member_one', first_name='Member', last_name='One')
device1 = UserDevice.objects.create(user=user1, device_name="Device One", mac_address="90:A2:DA:00:EE:5D", ignore=False)
ip1 = "127.0.0.1"
# Create 5 hours of logs with device1
s = start = localtime(now()) - timedelta(hours=6)
end = localtime(now()) - timedelta(hours=1)
while (s < end):
ArpLog.objects.create(runtime=s, device=device1, ip_address=ip1)
s = s + timedelta(minutes=5)
# Pull the logs for user1 and make sure we have 5 hours worth
logs = ArpLog.objects.for_user(user1, start, end)
self.assertEqual(1, len(logs))
five_hours_in_seconds = 5 * 60 * 60
self.assertEqual(logs[0].diff.seconds, five_hours_in_seconds)
# Copyright 2019 Office Nomads LLC (http://www.officenomads.com/) 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.
| 44.051724 | 583 | 0.710763 | 362 | 2,555 | 4.903315 | 0.439227 | 0.040563 | 0.013521 | 0.040563 | 0.157746 | 0.124507 | 0.083944 | 0.083944 | 0.057465 | 0.057465 | 0 | 0.021941 | 0.19726 | 2,555 | 57 | 584 | 44.824561 | 0.843491 | 0.27593 | 0 | 0.146341 | 0 | 0 | 0.042818 | 0 | 0 | 0 | 0 | 0 | 0.170732 | 1 | 0.097561 | false | 0 | 0.463415 | 0 | 0.585366 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
d3fed7ed81beeaa3a86c2d0c1c23666a6ddc070f | 1,418 | py | Python | fedot/core/utilities/grouped_condition.py | vishalbelsare/FEDOT | 3a6f06b29cf2f173008d119f7cb5dc705a45f695 | [
"BSD-3-Clause"
] | null | null | null | fedot/core/utilities/grouped_condition.py | vishalbelsare/FEDOT | 3a6f06b29cf2f173008d119f7cb5dc705a45f695 | [
"BSD-3-Clause"
] | null | null | null | fedot/core/utilities/grouped_condition.py | vishalbelsare/FEDOT | 3a6f06b29cf2f173008d119f7cb5dc705a45f695 | [
"BSD-3-Clause"
] | null | null | null | from typing import Optional, List, Callable, Tuple, Iterable
from fedot.core.log import default_log, Log
ConditionType = Callable[[], bool]
ConditionEntryType = Tuple[ConditionType, Optional[str]]
class GroupedCondition:
"""Represents sequence of ordinary conditions with logging.
All composed conditions are combined with reduce function on booleans.
By the default 'any' is used, so in this case the grouped condition is True
if any of the composed conditions is True. The message corresponding
to the actual fired condition is logged (if it was provided)."""
def __init__(self, log: Log = None, conditions_reduce: Callable[[Iterable[bool]], bool] = any):
self._reduce = conditions_reduce
self._conditions: List[ConditionEntryType] = []
self._log = log or default_log(__name__)
def add_condition(self, condition: ConditionType, log_msg: Optional[str] = None) -> 'GroupedCondition':
"""Builder-like method for adding conditions."""
self._conditions.append((condition, log_msg))
return self
def __bool__(self):
return self()
def __call__(self) -> bool:
return self._reduce(map(self._check_condition, self._conditions))
def _check_condition(self, entry: ConditionEntryType) -> bool:
cond, msg = entry
res = cond()
if res and msg:
self._log.info(msg)
return res
| 36.358974 | 107 | 0.692525 | 174 | 1,418 | 5.448276 | 0.448276 | 0.018987 | 0.021097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217207 | 1,418 | 38 | 108 | 37.315789 | 0.854054 | 0.266573 | 0 | 0 | 0 | 0 | 0.015795 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.227273 | false | 0 | 0.090909 | 0.090909 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
31051398c9d6c13d69a8a95ba8cbe1cfc6ef0869 | 393 | py | Python | pointers/pointers.py | lootek/govspy | 0f8a6d01115965581533340ede96f6f1439fc5b3 | [
"CNRI-Python"
] | 106 | 2015-02-16T09:09:37.000Z | 2022-03-16T14:34:29.000Z | pointers/pointers.py | lootek/govspy | 0f8a6d01115965581533340ede96f6f1439fc5b3 | [
"CNRI-Python"
] | 13 | 2017-02-20T01:34:45.000Z | 2022-03-11T10:48:58.000Z | pointers/pointers.py | lootek/govspy | 0f8a6d01115965581533340ede96f6f1439fc5b3 | [
"CNRI-Python"
] | 13 | 2016-02-25T01:24:24.000Z | 2020-11-10T01:27:56.000Z | # There is no equivalent to pointers in python
def upit(str):
return str.upper()
def uplist(mylist):
for i in range(len(mylist)):
mylist[i] = mylist[i].upper()
name = "peter"
upit(name)
print name # peter
name = upit(name)
print name # PETER
# but you can do a useless cheat and make it mutable
name = list("peter")
uplist(name)
name = ''.join(name)
print name # PETER
| 17.863636 | 52 | 0.664122 | 63 | 393 | 4.142857 | 0.555556 | 0.137931 | 0.149425 | 0.206897 | 0.168582 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.21374 | 393 | 21 | 53 | 18.714286 | 0.84466 | 0.287532 | 0 | 0.214286 | 0 | 0 | 0.036496 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.214286 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
310e667de61bbe3cf0a6de6c2bc197d46ec22650 | 10,244 | py | Python | datahub/oauth/admin/test/test_views.py | uktrade/data-hub-api-actions-test | a72439dfeb34e4179491db42fea290b9c2afadb1 | [
"MIT"
] | null | null | null | datahub/oauth/admin/test/test_views.py | uktrade/data-hub-api-actions-test | a72439dfeb34e4179491db42fea290b9c2afadb1 | [
"MIT"
] | 16 | 2020-04-01T15:25:35.000Z | 2020-04-14T14:07:30.000Z | datahub/oauth/admin/test/test_views.py | uktrade/data-hub-api-actions-test | a72439dfeb34e4179491db42fea290b9c2afadb1 | [
"MIT"
] | null | null | null | from secrets import token_urlsafe
from unittest.mock import patch
from urllib.parse import urlencode, urljoin
import pytest
from django.conf import settings
from django.urls import reverse
from rest_framework import status
from datahub.company.test.factories import AdviserFactory
from datahub.oauth.admin.test.utils import (
extract_next_url_from_redirect_url,
extract_next_url_from_url,
get_request_with_session,
)
from datahub.oauth.admin.views import callback, login, logout
pytestmark = pytest.mark.django_db
@patch('datahub.oauth.admin.views.token_urlsafe')
def test_login_view_redirects_to_sso_auth_url(_token_urlsafe):
"""Tests that login view redirects to Staff SSO Auth URL."""
_token_urlsafe.return_value = 'aZFsiJfbDLF9bwve8f2HTBeC1rCnhFUn4K6c_iq-wLo'
request = get_request_with_session(reverse('admin:login'))
response = login(request)
oauth_url_params = {
'response_type': 'code',
'client_id': settings.ADMIN_OAUTH2_CLIENT_ID,
'redirect_uri': request.build_absolute_uri(reverse('admin_oauth_callback')),
'state': _token_urlsafe.return_value,
'idp': 'cirrus',
}
redirect_url = urljoin(settings.ADMIN_OAUTH2_BASE_URL, settings.ADMIN_OAUTH2_AUTH_PATH)
expected_url = f'{redirect_url}?{urlencode(oauth_url_params)}'
assert response.status_code == status.HTTP_302_FOUND
assert response.url == expected_url
assert request.session['oauth.state'] == _token_urlsafe.return_value
def test_login_view_redirects_with_next_url():
"""Tests that login view redirects to Staff SSO with next URL."""
login_url = reverse('admin:login')
request = get_request_with_session(f'{login_url}?next=/protected-area')
response = login(request)
assert response.status_code == status.HTTP_302_FOUND
next_url = extract_next_url_from_redirect_url(response.url)
assert next_url == '/protected-area'
@pytest.mark.parametrize(
'dangerous_redirect',
(
'https://external-dangerous-website/protected-area',
'javascript:alert("Meow!")',
),
)
def test_login_view_validates_next_url(dangerous_redirect):
"""Tests that login view checks redirect URLs for safety."""
login_url = reverse('admin:login')
request = get_request_with_session(
f'{login_url}?next={dangerous_redirect}',
)
response = login(request)
assert response.status_code == status.HTTP_302_FOUND
assert extract_next_url_from_redirect_url(response.url) is None
def test_logout():
"""Test that logout view clears session data and redirects to SSO Logout URL."""
request = get_request_with_session(reverse('admin:logout'))
fake_state_id = token_urlsafe(settings.ADMIN_OAUTH2_TOKEN_BYTE_LENGTH)
request.session['oauth.state'] = fake_state_id
response = logout(request)
assert response.status_code == status.HTTP_302_FOUND
expected_path = urljoin(settings.ADMIN_OAUTH2_BASE_URL, settings.ADMIN_OAUTH2_LOGOUT_PATH)
assert response.url == expected_path
assert 'oauth.state' not in request.session
assert not request.user.is_authenticated
def test_callback_without_state():
"""Test that a callback without provided state will restart login process."""
request = get_request_with_session('/oauth/callback')
response = callback(request)
assert response.status_code == status.HTTP_302_FOUND
assert response.url == request.build_absolute_uri(reverse('admin:login'))
def test_callback_without_state_includes_next_url():
"""
Test that a callback without provided state will restart login process including next URL.
"""
request = get_request_with_session('/oauth/callback/?next=/protected-area')
response = callback(request)
assert response.status_code == status.HTTP_302_FOUND
next_url = extract_next_url_from_url(response.url)
assert next_url == '/protected-area'
def test_callback_with_state_mismatch():
"""Test that a callback without matching state will return an error page."""
fake_state_id = token_urlsafe(settings.ADMIN_OAUTH2_TOKEN_BYTE_LENGTH)
request = get_request_with_session('/oauth/callback/?state=wrong-one')
request.session['oauth.state'] = fake_state_id
response = callback(request)
assert response.status_code == status.HTTP_403_FORBIDDEN
response.render()
response_content = str(response.content)
assert 'State mismatch.' in response_content
assert not request.user.is_authenticated
def test_callback_without_access_code():
"""Test that a callback without a code will return an error page."""
fake_state_id = token_urlsafe(settings.ADMIN_OAUTH2_TOKEN_BYTE_LENGTH)
request = get_request_with_session(f'/oauth/callback/?state={fake_state_id}')
request.session['oauth.state'] = fake_state_id
response = callback(request)
assert response.status_code == status.HTTP_403_FORBIDDEN
response.render()
response_content = str(response.content)
assert 'Forbidden.' in response_content
assert not request.user.is_authenticated
@patch('datahub.oauth.admin.views.get_access_token')
@patch('datahub.oauth.admin.views.get_sso_user_profile')
def test_callback_requests_sso_profile_no_user(get_sso_user_profile, get_access_token):
"""Test that if SSO user is not found then no access is granted."""
get_access_token.return_value = {'access_token': 'access-token', 'expires_in': 3600}
get_sso_user_profile.return_value = {'email': 'some@email'}
fake_state_id = token_urlsafe(settings.ADMIN_OAUTH2_TOKEN_BYTE_LENGTH)
request = get_request_with_session(f'/oauth/callback/?state={fake_state_id}&code=code')
request.session['oauth.state'] = fake_state_id
response = callback(request)
assert response.status_code == status.HTTP_403_FORBIDDEN
response.render()
response_content = str(response.content)
assert 'Forbidden.' in response_content
assert not request.user.is_authenticated
@patch('datahub.oauth.admin.views.get_access_token')
@patch('datahub.oauth.admin.views.get_sso_user_profile')
@pytest.mark.parametrize(
'flags',
(
{'is_staff': False, 'is_active': True},
{'is_staff': True, 'is_active': False},
{'is_staff': False, 'is_active': False},
),
)
def test_callback_requests_sso_profile_valid_non_staff_user_by_email(
get_sso_user_profile,
get_access_token,
flags,
caplog,
):
"""
Test that if SSO user has a matching email, but Data Hub user has `is_staff` or `is_active`
flag not set, then the access is forbidden.
"""
AdviserFactory(email='some@email', **flags)
get_access_token.return_value = {'access_token': 'access-token'}
get_sso_user_profile.return_value = {'email': 'some@email'}
request = get_request_with_session('/oauth/callback/?state=original&code=code')
request.session['oauth.state'] = 'original'
response = callback(request)
response.render()
assert response.status_code == status.HTTP_403_FORBIDDEN
assert 'Forbidden.' in str(response.content)
assert not request.user.is_authenticated
assert len(caplog.records) == 1
assert 'Django Admin OAuth2 authentication failed: User not found.' in caplog.text
@pytest.mark.usefixtures('local_memory_cache')
@patch('datahub.oauth.admin.views.get_access_token')
@patch('datahub.oauth.admin.views.get_sso_user_profile')
def test_callback_requests_sso_profile_valid_email(get_sso_user_profile, get_access_token):
"""
Test that if SSO user has a matching email (and relevant flags), then the access is granted.
"""
fake_state_id = token_urlsafe(settings.ADMIN_OAUTH2_TOKEN_BYTE_LENGTH)
adviser = AdviserFactory(email='some@email', is_staff=True, is_active=True)
get_access_token.return_value = {'access_token': 'access-token', 'expires_in': 3600}
get_sso_user_profile.return_value = {'email': 'some@email'}
request = get_request_with_session(f'/oauth/callback/?state={fake_state_id}&code=code')
request.session['oauth.state'] = fake_state_id
response = callback(request)
assert response.status_code == status.HTTP_302_FOUND
assert response.url == reverse('admin:index')
assert request.user.is_authenticated
assert request.user == adviser
@patch('datahub.oauth.admin.views.get_access_token')
@patch('datahub.oauth.admin.views.get_sso_user_profile')
def test_callback_redirects_to_next_url(get_sso_user_profile, get_access_token):
"""Test that successful login redirects user to `next_url`."""
fake_state_id = token_urlsafe(settings.ADMIN_OAUTH2_TOKEN_BYTE_LENGTH)
AdviserFactory(email='some@email', is_staff=True, is_active=True)
get_access_token.return_value = {'access_token': 'access-token', 'expires_in': 3600}
get_sso_user_profile.return_value = {'email': 'some@email'}
request = get_request_with_session(
f'/oauth/callback/?next=/some-location&state={fake_state_id}&code=code',
)
request.session['oauth.state'] = fake_state_id
response = callback(request)
assert response.status_code == status.HTTP_302_FOUND
assert response.url == '/some-location'
@pytest.mark.usefixtures('local_memory_cache')
@patch('datahub.oauth.admin.views.get_access_token')
@patch('datahub.oauth.admin.views.get_sso_user_profile')
@pytest.mark.parametrize(
'dangerous_redirect',
(
'https://external-dangerous-website/protected-area',
'javascript:alert("Meow!")',
),
)
def test_callback_validates_next_url(get_sso_user_profile, get_access_token, dangerous_redirect):
"""Test that successful login redirects user to `next_url`."""
fake_state_id = token_urlsafe(settings.ADMIN_OAUTH2_TOKEN_BYTE_LENGTH)
AdviserFactory(email='some@email', is_staff=True, is_active=True)
get_access_token.return_value = {'access_token': 'access-token', 'expires_in': 3600}
get_sso_user_profile.return_value = {'email': 'some@email'}
request = get_request_with_session(
f'/oauth/callback/?next={dangerous_redirect}&state={fake_state_id}&code=code',
)
request.session['oauth.state'] = fake_state_id
response = callback(request)
assert response.status_code == status.HTTP_302_FOUND
assert response.url == reverse('admin:index')
| 36.716846 | 97 | 0.749121 | 1,371 | 10,244 | 5.280817 | 0.121809 | 0.037983 | 0.028867 | 0.035221 | 0.778315 | 0.729834 | 0.708011 | 0.679696 | 0.622928 | 0.575414 | 0 | 0.00855 | 0.143694 | 10,244 | 278 | 98 | 36.848921 | 0.816803 | 0.092347 | 0 | 0.526596 | 0 | 0 | 0.217656 | 0.116438 | 0 | 0 | 0 | 0 | 0.196809 | 1 | 0.069149 | false | 0 | 0.053191 | 0 | 0.12234 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3114c95298775d8514f82e0e3ad111b6b19976c1 | 1,770 | py | Python | to_functions/inline_functions.py | pedrovdsc/romervaldo | f767570ab9fa9e9a0eddbcff104dfc765908f5d9 | [
"MIT"
] | 3 | 2020-06-23T00:10:35.000Z | 2020-08-03T19:09:44.000Z | to_functions/inline_functions.py | pedrovdsc/romervaldo | f767570ab9fa9e9a0eddbcff104dfc765908f5d9 | [
"MIT"
] | 13 | 2020-06-23T00:43:47.000Z | 2020-08-12T02:03:59.000Z | to_functions/inline_functions.py | pedrovdsc/romervaldo | f767570ab9fa9e9a0eddbcff104dfc765908f5d9 | [
"MIT"
] | null | null | null | import telegram
from telegram import InlineQueryResultArticle, InputTextMessageContent
from telegram.ext import InlineQueryHandler
from googletrans import Translator
translator = Translator()
def inline_to_language(update, context):
query = update.inline_query.query
if not query:
return
results = list()
results.append(
InlineQueryResultArticle(
id='Portuguese',
title='Portuguese',
input_message_content=InputTextMessageContent(translator.translate(query, dest='pt').text)
)
)
results.append(
InlineQueryResultArticle(
id='French',
title='French',
input_message_content=InputTextMessageContent(translator.translate(query, dest='fr').text)
)
)
results.append(
InlineQueryResultArticle(
id='Italian',
title='Italian',
input_message_content=InputTextMessageContent(translator.translate(query, dest='it').text)
)
)
results.append(
InlineQueryResultArticle(
id='Japanese',
title='Japanese',
input_message_content=InputTextMessageContent(translator.translate(query, dest='ja').text)
)
)
results.append(
InlineQueryResultArticle(
id='English',
title='English',
input_message_content=InputTextMessageContent(translator.translate(query, dest='en').text)
)
)
results.append(
InlineQueryResultArticle(
id='Spanish',
title='Spanish',
input_message_content=InputTextMessageContent(translator.translate(query, dest='es').text)
)
)
context.bot.answer_inline_query(update.inline_query.id, results)
| 31.607143 | 102 | 0.641808 | 147 | 1,770 | 7.605442 | 0.29932 | 0.069767 | 0.198569 | 0.209302 | 0.567979 | 0.375671 | 0.375671 | 0.375671 | 0 | 0 | 0 | 0 | 0.263842 | 1,770 | 55 | 103 | 32.181818 | 0.85802 | 0 | 0 | 0.226415 | 0 | 0 | 0.057627 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.018868 | false | 0 | 0.075472 | 0 | 0.113208 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
312333692b65940f044dfbebd837a3431811debb | 305 | py | Python | src/textbook/rosalind_ba9g.py | cowboysmall/rosalind | 021e4392a8fc946b97bbf86bbb8227b28bb5e462 | [
"MIT"
] | null | null | null | src/textbook/rosalind_ba9g.py | cowboysmall/rosalind | 021e4392a8fc946b97bbf86bbb8227b28bb5e462 | [
"MIT"
] | null | null | null | src/textbook/rosalind_ba9g.py | cowboysmall/rosalind | 021e4392a8fc946b97bbf86bbb8227b28bb5e462 | [
"MIT"
] | null | null | null | import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import arrays
def main(argv):
text = files.read_line(argv[0])
sa = arrays.suffix_array(text)
print ', '.join(str(v[0]) for v in sa)
if __name__ == "__main__":
main(sys.argv[1:])
| 16.944444 | 68 | 0.652459 | 49 | 305 | 3.77551 | 0.591837 | 0.064865 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011952 | 0.177049 | 305 | 17 | 69 | 17.941176 | 0.7251 | 0 | 0 | 0 | 0 | 0 | 0.059016 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.363636 | null | null | 0.090909 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
312862c0d55bef6b9e39735f25e9b04d706ee117 | 340 | py | Python | onnx_verify.py | thaint2901/deep_sort_pytorch | 547215c8456f02238c520f88e08ae08b004a9194 | [
"MIT"
] | null | null | null | onnx_verify.py | thaint2901/deep_sort_pytorch | 547215c8456f02238c520f88e08ae08b004a9194 | [
"MIT"
] | null | null | null | onnx_verify.py | thaint2901/deep_sort_pytorch | 547215c8456f02238c520f88e08ae08b004a9194 | [
"MIT"
] | 1 | 2021-12-17T09:11:46.000Z | 2021-12-17T09:11:46.000Z | import onnxruntime as rt
sess = rt.InferenceSession("pretrained/original_ckpt.onnx")
print("====INPUT====")
for i in sess.get_inputs():
print("Name: {}, Shape: {}, Dtype: {}".format(i.name, i.shape, i.type))
print("====OUTPUT====")
for i in sess.get_outputs():
print("Name: {}, Shape: {}, Dtype: {}".format(i.name, i.shape, i.type)) | 42.5 | 75 | 0.629412 | 49 | 340 | 4.306122 | 0.489796 | 0.037915 | 0.056872 | 0.094787 | 0.511848 | 0.388626 | 0.388626 | 0.388626 | 0.388626 | 0.388626 | 0 | 0 | 0.117647 | 340 | 8 | 76 | 42.5 | 0.703333 | 0 | 0 | 0.25 | 0 | 0 | 0.340176 | 0.085044 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
31327d86717a95195a24172db1cef745eb5f5905 | 853 | py | Python | phonebook/admin.py | ROLOBOOK/PhoneBookAPI | 70536248b5a76c21ac3e21f620a572f42a7996dc | [
"MIT"
] | null | null | null | phonebook/admin.py | ROLOBOOK/PhoneBookAPI | 70536248b5a76c21ac3e21f620a572f42a7996dc | [
"MIT"
] | null | null | null | phonebook/admin.py | ROLOBOOK/PhoneBookAPI | 70536248b5a76c21ac3e21f620a572f42a7996dc | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import PhoneNumber, Employee, Organization
class PhoneNumberAdmin(admin.ModelAdmin):
list_display = ('phone_number', 'phone_type', 'employee',)
admin.site.register(PhoneNumber, PhoneNumberAdmin)
class EmployeeAdmin(admin.ModelAdmin):
list_display = ('full_name', 'current_position', 'organization', 'display_phone_number')
def display_phone_number(self, obj):
return ', '.join(str(phone_number) for phone_number in obj.phone_numbers.all())
admin.site.register(Employee, EmployeeAdmin)
class OrganizationAdmin(admin.ModelAdmin):
list_display = ('name', 'address', 'descriptions', 'display_employees')
def display_employees(self, obj):
return ', '.join(str(full_name) for full_name in obj.employees.all())
admin.site.register(Organization, OrganizationAdmin)
| 28.433333 | 92 | 0.751465 | 98 | 853 | 6.357143 | 0.387755 | 0.088283 | 0.091493 | 0.125201 | 0.064205 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127784 | 853 | 29 | 93 | 29.413793 | 0.837366 | 0 | 0 | 0 | 0 | 0 | 0.153576 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0.133333 | 0.133333 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
314cf90ea2b6d93acde98ecd19dc3b3f52660600 | 371 | py | Python | problems/problem-0097/problem_0097.py | bkaid/project-euler | d3d91086ff109e2737237a8ecf32cfbef58949ca | [
"MIT"
] | null | null | null | problems/problem-0097/problem_0097.py | bkaid/project-euler | d3d91086ff109e2737237a8ecf32cfbef58949ca | [
"MIT"
] | null | null | null | problems/problem-0097/problem_0097.py | bkaid/project-euler | d3d91086ff109e2737237a8ecf32cfbef58949ca | [
"MIT"
] | null | null | null | import time
import math
def project_euler_97():
return (28433 * pow(2, 7830457) + 1) % 10**10
if __name__ == '__main__':
print('Project Euler #97')
print('Find the last ten digits of 28433×2^7830457 + 1.')
START_TIME = time.time()
print('Result: {}'.format(project_euler_97()))
print('Elapsed time: {} seconds'.format(time.time() - START_TIME))
| 28.538462 | 70 | 0.652291 | 54 | 371 | 4.240741 | 0.555556 | 0.157205 | 0.183406 | 0.165939 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125413 | 0.183288 | 371 | 12 | 71 | 30.916667 | 0.627063 | 0 | 0 | 0 | 0 | 0 | 0.28841 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.2 | 0.1 | 0.4 | 0.4 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
31543e140eaa36083065fff266c3ed75465d19ee | 1,949 | py | Python | tests/test_api_votes.py | jacebrowning/crowdsorter | 1c847f1f0284fc810ec1f2dd501acb4dbfa16bbb | [
"MIT"
] | 2 | 2020-05-09T23:46:23.000Z | 2021-03-23T18:40:26.000Z | tests/test_api_votes.py | jacebrowning/crowdsorter | 1c847f1f0284fc810ec1f2dd501acb4dbfa16bbb | [
"MIT"
] | 1 | 2020-10-18T17:15:49.000Z | 2020-11-11T18:25:05.000Z | tests/test_api_votes.py | jacebrowning/crowdsorter | 1c847f1f0284fc810ec1f2dd501acb4dbfa16bbb | [
"MIT"
] | 1 | 2021-03-23T18:41:16.000Z | 2021-03-23T18:41:16.000Z | # pylint: disable=unused-variable,unused-argument,expression-not-assigned,singleton-comparison
import pytest
from expecter import expect
from .utils import load
def describe_votes():
@pytest.fixture
def url():
return "/api/collections/_c/votes/"
def describe_GET():
def it_returns_a_prioritized_list(client, url, collection):
status, content = load(client.get(url))
expect(status) == 200
expect(content['_links']) == {
'self': "http://localhost/api/collections/_c/votes/",
'collection': "http://localhost/api/collections/_c",
},
expect(content['name']) == "Sample List"
expect(len(content['item_data'])) == 3
def describe_POST():
def it_records_a_new_vote(client, url, collection):
data = {'winner': "foo", 'loser': "bar"}
status, content = load(client.post(url, data=data))
expect(status) == 200
# TODO: check for vote
def it_requires_winner_and_loser(client, url, collection):
status, content = load(client.post(url))
expect(status) == 422
expect(content) == {
'message': "Loser and winner are required.",
}
def with_unknown_collection(client):
url = "/api/collections/unknown/votes/"
data = {'winner': "foo", 'loser': "bar"}
status, content = load(client.post(url, data=data))
expect(status) == 404
def describe_DELETE():
def it_clears_all_votes(client, url, collection):
status, content = load(client.delete(url))
expect(status) == 200
expect(content['vote_count']) == 0
def with_unknown_collection(client):
url = "/api/collections/unknown/votes/"
status, content = load(client.delete(url))
expect(status) == 404
| 29.984615 | 94 | 0.574654 | 209 | 1,949 | 5.220096 | 0.344498 | 0.049496 | 0.093492 | 0.126489 | 0.514207 | 0.462878 | 0.413382 | 0.318973 | 0.238313 | 0.238313 | 0 | 0.014535 | 0.293997 | 1,949 | 64 | 95 | 30.453125 | 0.778343 | 0.057978 | 0 | 0.357143 | 0 | 0 | 0.158211 | 0.048009 | 0 | 0 | 0 | 0.015625 | 0 | 1 | 0.261905 | false | 0 | 0.071429 | 0.02381 | 0.357143 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
315a8fb72ed591df83c6f13b8b856c5cb31b17c5 | 10,520 | py | Python | ansys/mapdl/core/_commands/solution/solid_surface_loads.py | JourneyG/pymapdl | 23fdc008c151c0546504e4ef8257a64f5f169100 | [
"MIT"
] | 1 | 2021-07-28T00:42:53.000Z | 2021-07-28T00:42:53.000Z | ansys/mapdl/core/_commands/solution/solid_surface_loads.py | JourneyG/pymapdl | 23fdc008c151c0546504e4ef8257a64f5f169100 | [
"MIT"
] | null | null | null | ansys/mapdl/core/_commands/solution/solid_surface_loads.py | JourneyG/pymapdl | 23fdc008c151c0546504e4ef8257a64f5f169100 | [
"MIT"
] | null | null | null | class SolidSurfaceLoads:
def sfa(self, area="", lkey="", lab="", value="", value2="", **kwargs):
"""Specifies surface loads on the selected areas.
APDL Command: SFA
Parameters
----------
area
Area to which surface load applies. If ALL, apply load to all
selected areas [ASEL]. A component may be substituted for Area.
lkey
Load key associated with surface load (defaults to 1). Load keys
(1,2,3, etc.) are listed under "Surface Loads" in the input data
table for each element type in the Element Reference. LKEY is
ignored if the area is the face of a volume region meshed with
volume elements.
lab
Valid surface load label. Load labels are listed under "Surface
Loads" in the input table for each area type in the Element
Reference.
value
Surface load value or table name reference for specifying tabular
boundary conditions.
value2
Second surface load value (if any).
Notes
-----
Surface loads may be transferred from areas to elements with the SFTRAN
or SBCTRAN commands. See the SFGRAD command for an alternate tapered
load capability.
Tabular boundary conditions (VALUE = %tabname% and/or VALUE2 =
%tabname%) are available for the following surface load labels (Lab)
only: : PRES (real and/or imaginary components), CONV (film coefficient
and/or bulk temperature) or HFLUX, and RAD (surface emissivity and
ambient temperature). Use the *DIM command to define a table.
This command is also valid in PREP7.
Examples
--------
Select areas with coordinates in the range ``0.4 < Y < 1.0``
>>> mapdl.asel('S', 'LOC', 'Y', 0.4, 1.0)
Set pressure to 250e3 on all areas.
>>> mapdl.sfa('ALL', '', 'PRES', 250e3)
"""
command = f"SFA,{area},{lkey},{lab},{value},{value2}"
return self.run(command, **kwargs)
def sfadele(self, area="", lkey="", lab="", **kwargs):
"""Deletes surface loads from areas.
APDL Command: SFADELE
Parameters
----------
area
Area to which surface load deletion applies. If ALL, delete load
from all selected areas [ASEL]. A component name may be substituted for AREA.
lkey
Load key associated with surface load (defaults to 1). See the SFA
command for details.
lab
Valid surface load label. If ALL, use all appropriate labels. See
the SFA command for labels.
Notes
-----
Deletes surface loads (and all corresponding finite element loads) from
selected areas.
This command is also valid in PREP7.
Examples
--------
Delete all convections applied to all areas where ``-1 < X < -0.5``
>>> mapdl.asel('S', 'LOC', 'X', -1, -0.5)
>>> mapdl.sfadele('ALL', 'CONV')
"""
command = f"SFADELE,{area},{lkey},{lab}"
return self.run(command, **kwargs)
def sfalist(self, area="", lab="", **kwargs):
"""Lists the surface loads for the specified area.
APDL Command: SFALIST
Parameters
----------
area
Area at which surface load is to be listed. If ALL (or blank),
list for all selected areas [ASEL]. If AREA = P, graphical picking
is enabled and all remaining command fields are ignored (valid only
in the GUI). A component name may be substituted for AREA.
lab
Valid surface load label. If ALL (or blank), use all appropriate
labels. See the SFA command for labels.
Notes
-----
This command is valid in any processor.
"""
command = f"SFALIST,{area},{lab}"
return self.run(command, **kwargs)
def sfl(self, line="", lab="", vali="", valj="", val2i="", val2j="",
**kwargs):
"""Specifies surface loads on lines of an area.
APDL Command: SFL
Parameters
----------
line
Line to which surface load applies. If ALL, apply load to all
selected lines [LSEL]. If Line = P, graphical picking is enabled
and all remaining command fields are ignored (valid only in the
GUI). A component name may be substituted for Line.
lab
Valid surface load label. Load labels are listed under "Surface
Loads" in the input table for each element type in the Element
Reference.
vali, valj
Surface load values at the first keypoint (VALI) and at the second
keypoint (VALJ) of the line, or table name for specifying tabular
boundary conditions. If VALJ is blank, it defaults to VALI. If
VALJ is zero, a zero is used. If Lab = CONV, VALI and VALJ are the
film coefficients and VAL2I and VAL2J are the bulk temperatures.
To specify a table, enclose the table name in percent signs (%),
e.g., %tabname%. Use the *DIM command to define a table. If Lab =
CONV and VALI = -N, the film coefficient may be a function of
temperature and is determined from the HF property table for
material N [MP]. If Lab = RAD, VALI and VALJ values are surface
emissivities and VAL2I and VAL2J are ambient temperatures. The
temperature used to evaluate the film coefficient is usually the
average between the bulk and wall temperatures, but may be user
defined for some elements. If Lab = RDSF, VALI is the emissivity
value; the following condition apply: If VALI = -N, the emissivity
may be a function of the temperature and is determined from the
EMISS property table for material N [MP]. If Lab = FSIN in a Multi-
field solver (single or multiple code coupling) analysis, VALI is
the surface interface number. If Lab = FSIN in a unidirectional
ANSYS to CFX analysis, VALJ is the surface interface number (not
available from within the GUI) and VALI is not used unless the
ANSYS analysis is performed using the Multi-field solver.
val2i, val2j
Second surface load values (if any). If Lab = CONV, VAL2I and
VAL2J are the bulk temperatures. If Lab = RAD, VAL2I and VAL2J are
the ambient temperatures. If Lab = RDSF, VAL2I is the enclosure
number. Radiation will occur between surfaces flagged with the same
enclosure numbers. If the enclosure is open, radiation will occur
to the ambient. VAL2I and VAL2J are not used for other surface load
labels. If VAL2J is blank, it defaults to VAL2I. If VAL2J is
zero, a zero is used. To specify a table (Lab = CONV), enclose the
table name in percent signs (%), e.g., %tabname%. Use the *DIM
command to define a table.
Notes
-----
Specifies surface loads on the selected lines of area regions. The
lines represent either the edges of area elements or axisymmetric shell
elements themselves. Surface loads may be transferred from lines to
elements with the SFTRAN or SBCTRAN commands. See the SFE command for
a description of surface loads. Loads input on this command may be
tapered. See the SFGRAD command for an alternate tapered load
capability.
You can specify a table name only when using structural (PRES) and
thermal (CONV [film coefficient and/or bulk temperature], HFLUX), and
surface emissivity and ambient temperature (RAD) surface load labels.
VALJ and VAL2J are ignored for tabular boundary conditions.
This command is also valid in PREP7.
"""
command = f"SFL,{line},{lab},{vali},{valj},{val2i},{val2j}"
return self.run(command, **kwargs)
def sfldele(self, line="", lab="", **kwargs):
"""Deletes surface loads from lines.
APDL Command: SFLDELE
Parameters
----------
line
Line to which surface load deletion applies. If ALL, delete load
from all selected lines [LSEL]. If LINE = P, graphical picking is
enabled and all remaining command fields are ignored (valid only in
the GUI). A component name may be substituted for LINE.
lab
Valid surface load label. If ALL, use all appropriate labels. See
the SFL command for labels.
Notes
-----
Deletes surface loads (and all corresponding finite element loads) from
selected lines.
This command is also valid in PREP7.
"""
command = f"SFLDELE,{line},{lab}"
return self.run(command, **kwargs)
def sfllist(self, line="", lab="", **kwargs):
"""Lists the surface loads for lines.
APDL Command: SFLLIST
Parameters
----------
line
Line at which surface load is to be listed. If ALL (or blank),
list for all selected lines [LSEL]. If LINE = P, graphical picking
is enabled and all remaining command fields are ignored (valid only
in the GUI). A component name may be substituted for LINE.
lab
Valid surface load label. If ALL (or blank), use all appropriate
labels. See the SFL command for labels.
Notes
-----
Lists the surface loads for the specified line.
This command is valid in any processor.
"""
command = f"SFLLIST,{line},{lab}"
return self.run(command, **kwargs)
def sftran(self, **kwargs):
"""Transfer the solid model surface loads to the finite element model.
APDL Command: SFTRAN
Notes
-----
Surface loads are transferred only from selected lines and areas to all
selected elements. The SFTRAN operation is also done if the SBCTRAN
command is issued or automatically done upon initiation of the solution
calculations [SOLVE].
This command is also valid in PREP7.
"""
command = f"SFTRAN,"
return self.run(command, **kwargs)
| 39.848485 | 90 | 0.603802 | 1,359 | 10,520 | 4.674025 | 0.18543 | 0.036367 | 0.014326 | 0.02204 | 0.607053 | 0.530699 | 0.462689 | 0.400504 | 0.354219 | 0.312185 | 0 | 0.008007 | 0.323289 | 10,520 | 263 | 91 | 40 | 0.884253 | 0.75038 | 0 | 0.304348 | 0 | 0 | 0.15748 | 0.098863 | 0 | 0 | 0 | 0 | 0 | 1 | 0.304348 | false | 0 | 0 | 0 | 0.652174 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
315db34bc3557f995f2d3c7d8c414923e32eaade | 1,196 | py | Python | rlp/exceptions.py | vaporyco/pyrlp | bdef65842a310d610e277096b403d284999ecbaa | [
"MIT"
] | null | null | null | rlp/exceptions.py | vaporyco/pyrlp | bdef65842a310d610e277096b403d284999ecbaa | [
"MIT"
] | null | null | null | rlp/exceptions.py | vaporyco/pyrlp | bdef65842a310d610e277096b403d284999ecbaa | [
"MIT"
] | null | null | null | class RLPException(Exception):
"""Base class for exceptions raised by this package."""
pass
class EncodingError(RLPException):
"""Exception raised if encoding fails.
:ivar obj: the object that could not be encoded
"""
def __init__(self, message, obj):
super(EncodingError, self).__init__(message)
self.obj = obj
class DecodingError(RLPException):
"""Exception raised if decoding fails.
:ivar rlp: the RLP string that could not be decoded
"""
def __init__(self, message, rlp):
super(DecodingError, self).__init__(message)
self.rlp = rlp
class SerializationError(RLPException):
"""Exception raised if serialization fails.
:ivar obj: the object that could not be serialized
"""
def __init__(self, message, obj):
super(SerializationError, self).__init__(message)
self.obj = obj
class DeserializationError(RLPException):
"""Exception raised if deserialization fails.
:ivar serial: the decoded RLP string that could not be deserialized
"""
def __init__(self, message, serial):
super(DeserializationError, self).__init__(message)
self.serial = serial
| 24.916667 | 71 | 0.682274 | 135 | 1,196 | 5.807407 | 0.303704 | 0.133929 | 0.137755 | 0.147959 | 0.290816 | 0.290816 | 0.165816 | 0.089286 | 0.089286 | 0 | 0 | 0 | 0.225753 | 1,196 | 47 | 72 | 25.446809 | 0.846652 | 0.35786 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.055556 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
3161f190c7747d0dc726464f9d4fdd9af62d395e | 2,505 | py | Python | boids/test/test_flight.py | CDTjamie/The_Boids | 4380d1b883ea4d0d6b8ddb4f18c65fed66c26173 | [
"MIT"
] | null | null | null | boids/test/test_flight.py | CDTjamie/The_Boids | 4380d1b883ea4d0d6b8ddb4f18c65fed66c26173 | [
"MIT"
] | null | null | null | boids/test/test_flight.py | CDTjamie/The_Boids | 4380d1b883ea4d0d6b8ddb4f18c65fed66c26173 | [
"MIT"
] | null | null | null |
from nose.tools import assert_raises, assert_equal
from boids.flock import Flock
from boids.flight import Flight
import yaml
import os
def test_init():
_ROOT = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(_ROOT,'config_correct.yaml')) as config_file:
config = yaml.load(config_file)
boid_number = config["boid_number"]
x_position_limits = config["x_position_limits"]
y_position_limits = config["y_position_limits"]
x_velocity_limits = config["x_velocity_limits"]
y_velocity_limits = config["y_velocity_limits"]
avoid_distance = config["avoid_distance"]
match_speed_distance = config["match_speed_distance"]
middle_scaling = config["middle_scaling"]
match_scaling = config["match_scaling"]
boid_positions = 50.0
boid_velocities = "velocity"
with assert_raises(TypeError) as exception: Flight(boid_number, ([5.,5.],[5.,5.]), boid_velocities, avoid_distance, match_speed_distance, middle_scaling, match_scaling)
with assert_raises(TypeError) as exception: Flight(boid_number, boid_positions, ([5.,5.],[5.,5.]), avoid_distance, match_speed_distance, middle_scaling, match_scaling)
def test_update_boids():
_ROOT = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(_ROOT,'config_correct.yaml')) as config_file:
config = yaml.load(config_file)
boid_number = config["boid_number"]
x_position_limits = config["x_position_limits"]
y_position_limits = config["y_position_limits"]
x_velocity_limits = config["x_velocity_limits"]
y_velocity_limits = config["y_velocity_limits"]
avoid_distance = config["avoid_distance"]
match_speed_distance = config["match_speed_distance"]
middle_scaling = config["middle_scaling"]
match_scaling = config["match_scaling"]
temp_flock = Flock(boid_number, x_position_limits, y_position_limits, x_velocity_limits, y_velocity_limits)
boid_positions, boid_velocities = temp_flock.new_flock()
temp_flight = Flight(boid_number, boid_positions, boid_velocities, avoid_distance, match_speed_distance, middle_scaling, match_scaling)
boid_positions, boid_velocities = temp_flight.update_boids()
assert type(boid_positions) == tuple
assert type(boid_velocities) == tuple
assert type(boid_positions[0][0]) == float
assert type(boid_positions[1][0]) == float
assert type(boid_velocities[0][0]) == float
assert type(boid_velocities[1][0]) == float | 45.545455 | 172 | 0.74012 | 333 | 2,505 | 5.177177 | 0.162162 | 0.081207 | 0.073086 | 0.066705 | 0.803944 | 0.737819 | 0.655452 | 0.655452 | 0.655452 | 0.562645 | 0 | 0.008958 | 0.153293 | 2,505 | 55 | 173 | 45.545455 | 0.803866 | 0 | 0 | 0.533333 | 0 | 0 | 0.13014 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.044444 | false | 0 | 0.111111 | 0 | 0.155556 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
316a3c041ba006c4b4566cc6e71d05b1fa960d92 | 6,747 | py | Python | src/the_tale/the_tale/game/heroes/preferences.py | SilentWrangler/the-tale | a121128edd2a9e36133eb047946ccb9593801ea6 | [
"BSD-3-Clause"
] | null | null | null | src/the_tale/the_tale/game/heroes/preferences.py | SilentWrangler/the-tale | a121128edd2a9e36133eb047946ccb9593801ea6 | [
"BSD-3-Clause"
] | null | null | null | src/the_tale/the_tale/game/heroes/preferences.py | SilentWrangler/the-tale | a121128edd2a9e36133eb047946ccb9593801ea6 | [
"BSD-3-Clause"
] | null | null | null |
import smart_imports
smart_imports.all()
class _PreferencesMetaclass(type):
@classmethod
def create_preference_getter(cls, preference):
def getter(self):
return self._get(preference)
getter.__name__ = preference.base_name
return getter
def __new__(mcs, name, bases, attributes):
for preference in relations.PREFERENCE_TYPE.records:
getter = mcs.create_preference_getter(preference)
attributes[getter.__name__] = property(getter)
return super(_PreferencesMetaclass, mcs).__new__(mcs, name, bases, attributes)
class HeroPreferences(object, metaclass=_PreferencesMetaclass):
__slots__ = ('data', 'hero')
def __init__(self):
self.data = {}
self.hero = None
def serialize(self):
return self.data
@classmethod
def deserialize(cls, data):
obj = cls()
obj.data = data
return obj
def value_to_set(self, value):
if isinstance(value, utils_prototypes.BasePrototype):
return value.id if value is not None else None
if isinstance(value, mobs_objects.MobRecord):
return value.id if value is not None else None
if isinstance(value, places_objects.Place):
return value.id if value is not None else None
if isinstance(value, persons_objects.Person):
return value.id if value is not None else None
if isinstance(value, rels.Record):
return value.value if value is not None else None
return value
def set(self, preferences_type, value):
value = self.value_to_set(value)
if preferences_type.base_name in self.data and value == self.data[preferences_type.base_name]['value']:
return False
self.data[preferences_type.base_name] = {'value': value}
models.HeroPreferences.update(self.hero.id, preferences_type.base_name, value)
self.hero.reset_accessors_cache()
return True
def _prepair_value(self, value):
return value
def _prepair_mob(self, mob_id):
mob = mobs_storage.mobs.get(mob_id)
if mob and not mob.state.is_ENABLED:
self.set(relations.PREFERENCE_TYPE.MOB, None)
return None
return mob
def _prepair_place(self, place_id):
return places_storage.places.get(place_id)
def _prepair_person(self, person_id):
return persons_storage.persons.get(person_id)
def _prepair_energy_regeneration(self, energy_regeneration_id):
return relations.ENERGY_REGENERATION.index_value.get(int(energy_regeneration_id))
def _prepair_equipment_slot(self, slot_id):
if slot_id is None:
return None
return relations.EQUIPMENT_SLOT.index_value.get(int(slot_id))
def _prepair_risk_level(self, risk_id):
if risk_id is None:
return None
return relations.RISK_LEVEL.index_value.get(int(risk_id))
def _prepair_archetype(self, archetype_id):
if archetype_id is None:
return None
return game_relations.ARCHETYPE.index_value.get(int(archetype_id))
def _prepair_companion_dedication(self, companion_dedication_id):
if companion_dedication_id is None:
return None
return relations.COMPANION_DEDICATION.index_value.get(int(companion_dedication_id))
def _prepair_companion_empathy(self, companion_empathy_id):
if companion_empathy_id is None:
return None
return relations.COMPANION_EMPATHY.index_value.get(int(companion_empathy_id))
def _prepair_quests_region_size(self, value):
return int(value)
def _get(self, preferences_type):
if preferences_type.base_name not in self.data:
return None
value = self.data[preferences_type.base_name]['value']
return getattr(self, preferences_type.prepair_method)(value)
# helpers
def place_is_hometown(self, place):
return self.place is not None and self.place.id == place.id
def has_person_in_preferences(self, person):
return ((self.friend is not None and self.friend.id == person.id) or
(self.enemy is not None and self.enemy.id == person.id))
@classmethod
def _preferences_query(cls, all):
current_time = datetime.datetime.now()
filter = django_models.Q(hero__premium_state_end_at__gte=current_time)
if all:
filter |= django_models.Q(hero__active_state_end_at__gte=current_time)
return models.HeroPreferences.objects.filter(filter, hero__is_fast=False, hero__ban_state_end_at__lt=current_time)
@classmethod
def _heroes_query(cls, all):
current_time = datetime.datetime.now()
filter = django_models.Q(premium_state_end_at__gte=current_time)
if all:
filter |= django_models.Q(active_state_end_at__gte=current_time)
return models.Hero.objects.filter(filter, is_fast=False, ban_state_end_at__lt=current_time)
@classmethod
def _place_heroes_query(cls, place, all):
persons_ids = [person.id for person in place.persons]
db_filter = django_models.Q(place_id=place.id)
db_filter |= django_models.Q(friend_id__in=persons_ids)
db_filter |= django_models.Q(enemy_id__in=persons_ids)
return cls._preferences_query(all=all).filter(db_filter)
@classmethod
def get_friends_of(cls, person, all):
return [logic.load_hero(hero_model=record) for record in cls._heroes_query(all=all).filter(heropreferences__friend_id=person.id)]
@classmethod
def get_enemies_of(cls, person, all):
return [logic.load_hero(hero_model=record) for record in cls._heroes_query(all=all).filter(heropreferences__enemy_id=person.id)]
@classmethod
def get_citizens_of(cls, place, all):
return [logic.load_hero(hero_model=record) for record in cls._heroes_query(all=all).filter(heropreferences__place_id=place.id)]
@classmethod
def count_habit_values(cls, place, all):
honor_positive = 0
honor_negative = 0
peacefulness_positive = 0
peacefulness_negative = 0
for honor, peacefulness in cls._place_heroes_query(place, all=all).values_list('hero__habit_honor', 'hero__habit_peacefulness'):
if honor > 0:
honor_positive += honor
elif honor < 0:
honor_negative += honor
if peacefulness > 0:
peacefulness_positive += peacefulness
elif peacefulness < 0:
peacefulness_negative += peacefulness
return ((honor_positive, honor_negative),
(peacefulness_positive, peacefulness_negative))
| 33.40099 | 137 | 0.683118 | 862 | 6,747 | 5.029002 | 0.155452 | 0.029988 | 0.016609 | 0.030681 | 0.371857 | 0.303345 | 0.277509 | 0.248443 | 0.229066 | 0.16955 | 0 | 0.001552 | 0.236253 | 6,747 | 201 | 138 | 33.567164 | 0.839705 | 0.001038 | 0 | 0.18705 | 0 | 0 | 0.0095 | 0.003562 | 0 | 0 | 0 | 0 | 0 | 1 | 0.208633 | false | 0 | 0.014388 | 0.086331 | 0.539568 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
317b892e652bfd10802a162a31ad10f57e84242c | 1,561 | py | Python | setup.py | aicenter/roadmap-processing | 4cd42efe48fa43459d9302c9722ac166a6da7387 | [
"MIT"
] | 14 | 2017-08-21T09:22:22.000Z | 2021-03-13T07:05:41.000Z | setup.py | aicenter/roadmap-processing | 4cd42efe48fa43459d9302c9722ac166a6da7387 | [
"MIT"
] | 16 | 2017-08-21T11:17:42.000Z | 2019-10-01T15:03:22.000Z | setup.py | aicenter/roadmap-processing | 4cd42efe48fa43459d9302c9722ac166a6da7387 | [
"MIT"
] | 6 | 2017-08-21T09:28:21.000Z | 2020-07-13T16:02:22.000Z | #
# Copyright (c) 2021 Czech Technical University in Prague.
#
# This file is part of Roadmaptools
# (see https://github.com/aicenter/roadmap-processing).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import setuptools
from setuptools import setup
setup(
name='roadmaptools',
version='4.1.0',
description='Tools for road graph processing',
author='David Fiedler, Martin Korytak',
author_email='david.fiedler@agents.fel.cvut.cz',
license='MIT',
packages=setuptools.find_packages(),
url = 'https://github.com/aicenter/roadmap-processing',
# DO NOT remove the utm packege despite it is not detected by pipreqs
install_requires=['fconfig', 'numpy', 'pandas', 'googlemaps', 'typing', 'gpx_lite', 'tqdm', 'overpass', 'shapely',
'setuptools', 'rtree', 'osmread', 'scipy', 'networkx>=2.0', 'geojson', 'utm'],
python_requires='>=3',
package_data={'roadmaptools.resources': ['*.cfg']}
)
| 41.078947 | 118 | 0.713645 | 215 | 1,561 | 5.153488 | 0.64186 | 0.029783 | 0.032491 | 0.051444 | 0.16065 | 0.16065 | 0.061372 | 0 | 0 | 0 | 0 | 0.008507 | 0.171685 | 1,561 | 37 | 119 | 42.189189 | 0.848415 | 0.540038 | 0 | 0 | 0 | 0 | 0.428981 | 0.077475 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.0625 | 0.125 | 0 | 0.125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
317cb3676880a8702fc2ab7b98aff25c16a4d4dd | 785 | py | Python | solutions/python/80.remove-duplicates-from-sorted-array-ii.py | znculee/leetcode | 56420e28806c6cedc84fb0e65a6522a52af90672 | [
"CC0-1.0"
] | 1 | 2020-10-16T01:38:28.000Z | 2020-10-16T01:38:28.000Z | solutions/python/80.remove-duplicates-from-sorted-array-ii.py | znculee/leetcode | 56420e28806c6cedc84fb0e65a6522a52af90672 | [
"CC0-1.0"
] | null | null | null | solutions/python/80.remove-duplicates-from-sorted-array-ii.py | znculee/leetcode | 56420e28806c6cedc84fb0e65a6522a52af90672 | [
"CC0-1.0"
] | null | null | null | # 80. Remove Duplicates from Sorted Array II
from typing import List
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
if len(nums) == 0: return 0
i = 0
for num in nums:
if i < 2 or num > nums[i-2]:
nums[i] = num
i += 1
return i
def test():
s = Solution()
nums = [1]
length = s.removeDuplicates(nums)
print(f'{nums=}\n{length=}\n')
nums = [1,2]
length = s.removeDuplicates(nums)
print(f'{nums=}\n{length=}\n')
nums = [1,1,1,2,2,3]
length = s.removeDuplicates(nums)
print(f'{nums=}\n{length=}\n')
nums = [0,0,1,1,1,1,2,3,3]
length = s.removeDuplicates(nums)
print(f'{nums=}\n{length=}')
if __name__ == '__main__':
test()
| 20.128205 | 55 | 0.533758 | 116 | 785 | 3.543103 | 0.318966 | 0.024331 | 0.223844 | 0.262774 | 0.474453 | 0.474453 | 0.474453 | 0.474453 | 0.474453 | 0.474453 | 0 | 0.047187 | 0.298089 | 785 | 38 | 56 | 20.657895 | 0.69873 | 0.053503 | 0 | 0.269231 | 0 | 0 | 0.116059 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.038462 | 0 | 0.192308 | 0.153846 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
31886dfda97a0058caae1e3674aec8b02a39e380 | 361 | py | Python | inkscape-figures/.config/inkscape-figures/config.py | Elyk8/dotrice | 68924c7d1e3026ab94edd8c4f35c4ae30cf28f0c | [
"BSD-3-Clause"
] | null | null | null | inkscape-figures/.config/inkscape-figures/config.py | Elyk8/dotrice | 68924c7d1e3026ab94edd8c4f35c4ae30cf28f0c | [
"BSD-3-Clause"
] | null | null | null | inkscape-figures/.config/inkscape-figures/config.py | Elyk8/dotrice | 68924c7d1e3026ab94edd8c4f35c4ae30cf28f0c | [
"BSD-3-Clause"
] | null | null | null | def latex_template(name, title):
return '\n'.join((r"\begin{figure}[H]",
r" \centering",
rf" \incfig[0.8]{{{name}}}",
rf" \caption{{{title}}}",
rf" \label{{fig:{name}}}",
r" \vspace{-0.5cm}",
r"\end{figure}"))
| 40.111111 | 53 | 0.34072 | 33 | 361 | 3.69697 | 0.69697 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020619 | 0.462604 | 361 | 8 | 54 | 45.125 | 0.608247 | 0 | 0 | 0 | 0 | 0 | 0.379501 | 0.060942 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0.125 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
319d33f74661319df6d5280a8a475e2532c1fdec | 241 | py | Python | individual/individual 1/zzz.py | Mirror-Shard/L2.13 | 160c33f653875830b6a7d324b0dc05d846679534 | [
"MIT"
] | null | null | null | individual/individual 1/zzz.py | Mirror-Shard/L2.13 | 160c33f653875830b6a7d324b0dc05d846679534 | [
"MIT"
] | null | null | null | individual/individual 1/zzz.py | Mirror-Shard/L2.13 | 160c33f653875830b6a7d324b0dc05d846679534 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Замыкание функций которое увеличивает аргумент на 3
def func(a):
# Функция, несмотря на отсутсвие аргументов, успешно вычисляет а+3
def mul():
return a + 3
return mul()
| 20.083333 | 70 | 0.647303 | 33 | 241 | 4.727273 | 0.787879 | 0.051282 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027174 | 0.236515 | 241 | 11 | 71 | 21.909091 | 0.820652 | 0.6639 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.25 | 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 | 0 | 0 | 0 | 2 |
31af20c6c87aa8a8c4683c3582f14ab000e0abc1 | 893 | py | Python | 3-mouth04/day06/mysite6/mysite6/views.py | gary-gggggg/gary | d8ba30ea4bc2b662a2d6a87d247f813e5680d63e | [
"Apache-2.0"
] | 4 | 2021-02-01T10:28:11.000Z | 2021-02-01T10:34:40.000Z | 3-mouth04/day06/mysite6/mysite6/views.py | gary-gggggg/gary | d8ba30ea4bc2b662a2d6a87d247f813e5680d63e | [
"Apache-2.0"
] | null | null | null | 3-mouth04/day06/mysite6/mysite6/views.py | gary-gggggg/gary | d8ba30ea4bc2b662a2d6a87d247f813e5680d63e | [
"Apache-2.0"
] | null | null | null | from django.http import HttpResponse
def set_cookies(request):
resp = HttpResponse('set cookies successfully')
resp.set_cookie('uname', 'giaoid673248932', 60)
return resp
def get_cookies(request):
uname = request.COOKIES.get('uname', 'default value')
result = f'uname is {uname}'
return HttpResponse(result)
def del_cookies(request):
resp = HttpResponse('delete cookies successfully')
resp.delete_cookie('uname')
return resp
def set_session(request):
request.session['uname'] = 'giao'
return HttpResponse('set session successfully')
def get_session(request):
uname1 = request.session.get('uname', 'default value')
result = f'uname is {uname1}'
return HttpResponse(result)
def del_session(request):
if 'uname' in request.session:
del request.session['uname']
return HttpResponse('delete session successfully')
| 24.135135 | 58 | 0.707727 | 106 | 893 | 5.886792 | 0.273585 | 0.115385 | 0.057692 | 0.096154 | 0.205128 | 0.108974 | 0.108974 | 0.108974 | 0 | 0 | 0 | 0.017711 | 0.178052 | 893 | 36 | 59 | 24.805556 | 0.832425 | 0 | 0 | 0.166667 | 0 | 0 | 0.240761 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.041667 | 0 | 0.541667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
31b68dd3066032f370848f6e25c83d507d62c29a | 10,891 | py | Python | iiitd_policy_chatbot/bert/bm25_bert.py | kracr/iiitd-chatbot | c52df5f1c5e402c3427d577091cc03b29ce5ec87 | [
"Apache-2.0"
] | null | null | null | iiitd_policy_chatbot/bert/bm25_bert.py | kracr/iiitd-chatbot | c52df5f1c5e402c3427d577091cc03b29ce5ec87 | [
"Apache-2.0"
] | null | null | null | iiitd_policy_chatbot/bert/bm25_bert.py | kracr/iiitd-chatbot | c52df5f1c5e402c3427d577091cc03b29ce5ec87 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""bm25_bert.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1gGMMyFBKSJvZNuYsNRGcewX76rpctCOI
Importing required modules
"""
import nltk
import itertools
import os
from gensim.summarization.bm25 import BM25
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, QuestionAnsweringPipeline
import json
import spacy
import math
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from collections import defaultdict
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
from sentence_transformers import SentenceTransformer, util
from qa_helper import KnowledgeGraph
class bm25:
def __init__(self, nlp):
self.tokenize = lambda text: [token.lemma_ for token in nlp(text)]
self.bm25 = None
self.passages = None
def preprocess(self, doc):
passages = [p for p in doc.split('\n') if p and not p.startswith('=')]
return passages
def fit(self, docs):
# passages = list(itertools.chain(*map(self.preprocess, docs)))
corpus = [self.tokenize(p) for p in passages]
self.bm25 = BM25(corpus)
self.passages = passages
def most_similar(self, question, topn=10):
tokens = self.tokenize(question)
# average_idf = sum(map(lambda k: float(self.bm25.idf[k]), self.bm25.idf.keys())) / len(self.bm25.idf.keys())
scores = self.bm25.get_scores(tokens)
pairs = [(s, i) for i, s in enumerate(scores)]
pairs.sort(reverse=True)
passages = [self.passages[i] for _, i in pairs[:topn]]
return passages
def rankDocuments(self, query):
tokens = self.tokenize(query)
# average_idf = sum(map(lambda k: float(self.bm25.idf[k]), self.bm25.idf.keys())) / len(self.bm25.idf.keys())
scores = self.bm25.get_scores(tokens)
return np.array([s for i,s in enumerate(scores)]).reshape((1,133))
class tfidf:
def __init__(self, nlp):
self.nlp = nlp
self.tfidf_model = None
self.documents = None
def processSentence(self, sentence):
sentence = sentence.lower() #Lowering sentences
#Removing punctuations
symbols = "!\"#$%&()*+-./:;<=>?@[\]^_`{|}~\n"
sentence = sentence.translate(str.maketrans(symbols,' '*len(symbols)))
#removing stopwords
stop_words = set(stopwords.words('english'))
word_tokens = word_tokenize(sentence)
filtered_sentence = " ".join([w for w in word_tokens if w not in stop_words and len(w) > 1])
#lemmatization
doc = self.nlp(filtered_sentence)
lemmatized_sentence = [t.lemma_ for t in doc]
return lemmatized_sentence
def preprocessDocument(self, passages):
vocabulary = set()
processed_passages = list()
for p in range(len(passages)):
lemmatized_sentence = self.processSentence(passages[p])
processed_passages.append(" ".join(lemmatized_sentence))
vocabulary.update(set(lemmatized_sentence))
self.tfidf_model = TfidfVectorizer(vocabulary = list(vocabulary))
self.documents = self.tfidf_model.fit_transform(processed_passages)
def rankDocuments(self, query):
query = " ".join(self.processSentence(query))
queryVector = self.tfidf_model.transform([query])
return np.transpose(cosine_similarity(self.documents, queryVector))
class sbert:
def __init__(self):
self.model = SentenceTransformer('msmarco-distilroberta-base-v2')
self.document = None
def fit(self, docs):
self.document = self.model.encode(docs)
def rankDocuments(self, query):
query_encoded = self.model.encode(query)
return util.pytorch_cos_sim(query_encoded, self.document).numpy()
class rerankPassages:
def __init__(self, nlp):
self.bm25_ranking = bm25(nlp)
self.tfidf_ranking = tfidf(nlp)
self.sbert_ranking = sbert()
self.document = None
def fit(self, document):
self.document = document
self.bm25_ranking.fit(document)
self.tfidf_ranking.preprocessDocument(document)
self.sbert_ranking.fit(document)
def rankDocuments(self, query, mu, k):
bm25_scores = self.bm25_ranking.rankDocuments(query)
tfidf_scores = self.tfidf_ranking.rankDocuments(query)
sbert_scores = self.sbert_ranking.rankDocuments(query)
#Combined scoring
# mu = 0.7
# k = 10
c = mu*sbert_scores + (1-mu)*tfidf_scores
# rrf = 1/(k+c) + 1/(k + bm25_scores)
rrf = c
# print(rrf)
# print(np.shape(rrf))
#retrive top k passages
scores = rrf.tolist()
print(len(scores[0]))
score_passage = [(s,i) for i, s in enumerate(scores[0])]
score_passage.sort(reverse = True)
return [self.document[i[1]] for i in score_passage[:3]]
class bert:
def __init__(self, model):
self.tokenizer = AutoTokenizer.from_pretrained(model)
self.model = AutoModelForQuestionAnswering.from_pretrained(model)
self.bert = QuestionAnsweringPipeline(model = self.model, tokenizer = self.tokenizer)
def evaluateAnswer(self, question, sentence):
answer = self.bert(question = question, context = sentence)
return answer
def completeAnswer(answer, para):
for p in para:
if answer in p:
return p
return None
def getTopics(filename):
with open(filename) as file:
data = json.load(file)
topics = ['' for i in range(len(data["vertices"]["topics"]))]
edges = data["edges"]["main"]
count = 0
# print(edges)
for e in edges:
if e[1] == "about_concept":
# print(e)
topic_id = int(str(e[2])[2:])
para_id = int(str(e[0])[2:])
# print(topic_id, para_id)
topics[topic_id] += data["vertices"]["paragraphs"][para_id]["text"]
count += 1
return topics
def getPassages(filename):
with open(filename) as file:
data = json.load(file)
passages = list()
for i in data["vertices"]["paragraphs"]:
passages.append(i["text"])
return passages
passages = getPassages("../data/handbook_graph.json")
print(len(passages))
SPACY_MODEL = os.environ.get("SPACY_MODEL", "en_core_web_sm")
nlp = spacy.load(SPACY_MODEL, disable = ["ner","parser","textcat"])
retreivePassage = rerankPassages(nlp)
retreivePassage.fit(passages)
questions = [
"How do I calculate cgpa",
"What is the normal load for UG students",
"If I fail a course and take it again in the later semester, will my earlier course with F grade be removed from the transcript",
" what is the process of registration?",
"how many seats are there in cse for admission?",
" what is the admission criteria for btech",
"I am in 1st year. Can I take overload?",
"I am in 2nd year. Can I take overload?",
"what happens if I miss the endsem because of a medical reason?",
"what happens if I fail a course?",
" what happens if I get an F grade in a course?",
"How can I calculate sgpa",
"What if I pass all my semesters",
"What about canteen",
"Will I get hostel",
"I dont know anything about IIIT",
"Who was abraham lincoln",
"Can i take 8 credits of online courses in a semester",
"how many credits do i need to graduate",
"how is my semester graded",
"what if I do more than 156 credits in my btech course",
"can I take up internships during a semester?",
"what is the i grade",
"can I replace a core course on getting an F grade?",
"how can I get the grade given to me in a course changed?",
"how will my cgpa be computed if I do more than 156 credits?",
"is there any rule for attendance?",
"how can I apply for a semester leave?",
"how can I apply for branch transfer from ece to cse",
"what is the minimum credit requirement for graduation?",
"what are the requirements to get an honors degree?",
"when is the convocation held?"
]
for q in questions:
print(q,"\n",retreivePassage.rankDocuments(q, 0.5,50))
# SPACY_MODEL = os.environ.get("SPACY_MODEL", "en_core_web_sm")
# nlp = spacy.load(SPACY_MODEL, disable = ["ner","parser","textcat"])
# retreivePassage = PassageRetrieval(nlp)
# retreivePassage.fit(passages)
# bertModel = bert("deepset/bert-base-cased-squad2")
# questions = [
# "How do I calculate cgpa",
# "What is the normal load for UG students",
# "If I fail a course and take it again in the later semester, will my earlier course with F grade be removed from the transcript",
# " what is the process of registration?",
# "how many seats are there in cse for admission?",
# " what is the admission criteria for btech",
# "I am in 1st year. Can I take overload?",
# "I am in 2nd year. Can I take overload?",
# "what happens if I miss the endsem because of a medical reason?",
# "what happens if I fail a course?",
# " what happens if I get an F grade in a course?",
# "How can I calculate sgpa",
# "What if I pass all my semesters",
# "What about canteen",
# "Will I get hostel",
# "I dont know anything about IIIT",
# "Who was abraham lincoln",
# "Can i take 8 credits of online courses in a semester",
# "how many credits do i need to graduate",
# "how is my semester graded",
# "what if I do more than 156 credits in my btech course",
# "can I take up internships during a semester?",
# "what is the i grade",
# "can I replace a core course on getting an F grade?",
# "how can I get the grade given to me in a course changed?",
# "how will my cgpa be computed if I do more than 156 credits?",
# "is there any rule for attendance?",
# "how can I apply for a semester leave?",
# "how can I apply for branch transfer from ece to cse",
# "what is the minimum credit requirement for graduation?",
# "what are the requirements to get an honors degree?",
# "when is the convocation held?"
# ]
# for q in questions:
# topAnswer = retreivePassage.rankDocuments(q, 0.5, 20)
# # print(topAnswer)
# sentence = ""
# for i in topAnswer:
# # print(i)
# sentence += i + " "
# ans = bertModel.evaluateAnswer(q, sentence)
# print(len(sentence.split()))
# print("Q:",q)
# print("Ans:",ans,completeAnswer(ans["answer"], topAnswer))
# # print(len(sentence.split()))
# print("---------------------") | 37.297945 | 144 | 0.638325 | 1,438 | 10,891 | 4.764951 | 0.229485 | 0.010508 | 0.013135 | 0.012259 | 0.447315 | 0.408056 | 0.397256 | 0.397256 | 0.390251 | 0.390251 | 0 | 0.012138 | 0.251125 | 10,891 | 292 | 145 | 37.297945 | 0.827979 | 0.299605 | 0 | 0.109827 | 1 | 0.00578 | 0.200927 | 0.007417 | 0 | 0 | 0 | 0 | 0 | 1 | 0.115607 | false | 0.156069 | 0.092486 | 0 | 0.306358 | 0.017341 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
31cd09c98bad4af7e705b344d8fa9f8e310666d8 | 769 | py | Python | unsupervised_learning/0x01-clustering/11-main.py | kyeeh/holbertonschool-machine_learning | 8e4894c2b036ec7f4750de5bf99b95aee5b94449 | [
"MIT"
] | null | null | null | unsupervised_learning/0x01-clustering/11-main.py | kyeeh/holbertonschool-machine_learning | 8e4894c2b036ec7f4750de5bf99b95aee5b94449 | [
"MIT"
] | null | null | null | unsupervised_learning/0x01-clustering/11-main.py | kyeeh/holbertonschool-machine_learning | 8e4894c2b036ec7f4750de5bf99b95aee5b94449 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
gmm = __import__('11-gmm').gmm
if __name__ == '__main__':
np.random.seed(11)
a = np.random.multivariate_normal([30, 40], [[75, 5], [5, 75]], size=10000)
b = np.random.multivariate_normal([5, 25], [[16, 10], [10, 16]], size=750)
c = np.random.multivariate_normal([60, 30], [[16, 0], [0, 16]], size=750)
d = np.random.multivariate_normal([20, 70], [[35, 10], [10, 35]], size=1000)
X = np.concatenate((a, b, c, d), axis=0)
np.random.shuffle(X)
pi, m, S, clss, bic = gmm(X, 4)
print(pi)
print(m)
print(S)
print(bic)
plt.scatter(X[:, 0], X[:, 1], s=10, c=clss)
plt.scatter(m[:, 0], m[:, 1], s=50, marker='*', c=list(range(4)))
plt.show()
| 33.434783 | 80 | 0.574772 | 131 | 769 | 3.251908 | 0.442748 | 0.112676 | 0.187793 | 0.244131 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119548 | 0.195059 | 769 | 22 | 81 | 34.954545 | 0.568659 | 0.027308 | 0 | 0 | 0 | 0 | 0.02008 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.157895 | 0 | 0.157895 | 0.210526 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
31d65085d3e94fc32301078a9e991914e51d7917 | 1,027 | py | Python | kivy_tutorial_1.py | Khajaalmedki/Kivy_trial | 76ebf8dc8ba7d9ae33c8460d3c71a5a71d62ed4a | [
"Apache-2.0"
] | null | null | null | kivy_tutorial_1.py | Khajaalmedki/Kivy_trial | 76ebf8dc8ba7d9ae33c8460d3c71a5a71d62ed4a | [
"Apache-2.0"
] | null | null | null | kivy_tutorial_1.py | Khajaalmedki/Kivy_trial | 76ebf8dc8ba7d9ae33c8460d3c71a5a71d62ed4a | [
"Apache-2.0"
] | null | null | null | from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.popup import Popup
from kivy.uix.screenmanager import ScreenManager , Screen
from kivy.lang import Builder
from kivy.properties import ObjectProperty
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
from kivy.core.window import Window
#Window.size = (300, 100)
class MainWindow(Screen):
pass
class SecondWindow(Screen):
school_name = ObjectProperty(None)
portal_name = ObjectProperty(None)
date_exam = ObjectProperty(None)
time_h = ObjectProperty(None)
time_m = ObjectProperty(None)
time_s = ObjectProperty(None)
class second_cpaper_window(Screen):
pass
class WindowManager(ScreenManager):
pass
kv = Builder.load_file('my.kv')
Window.clearcolor = (1, 1, 1, 1)
class ExamPortal(App):
def build(self):
return kv
if __name__ == "__main__":
ExamPortal().run() | 22.326087 | 59 | 0.709834 | 129 | 1,027 | 5.503876 | 0.44186 | 0.101408 | 0.061972 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012165 | 0.199611 | 1,027 | 46 | 60 | 22.326087 | 0.851582 | 0.023369 | 0 | 0.1 | 0 | 0 | 0.051148 | 0.02714 | 0 | 0 | 0 | 0 | 0 | 1 | 0.033333 | false | 0.1 | 0.3 | 0.033333 | 0.733333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
31d6b39ceb3a1b9359f0804688856af99d4cb2a3 | 1,064 | py | Python | backend/services/amazon/stores.py | ukibbb/goodmood-inc | 006b3bb91125df15480b08832403ee22b10537ac | [
"MIT"
] | null | null | null | backend/services/amazon/stores.py | ukibbb/goodmood-inc | 006b3bb91125df15480b08832403ee22b10537ac | [
"MIT"
] | null | null | null | backend/services/amazon/stores.py | ukibbb/goodmood-inc | 006b3bb91125df15480b08832403ee22b10537ac | [
"MIT"
] | null | null | null | from abc import ABC
from dataclasses import dataclass
from services.stores import (CANADA_STORES, EUR_STORES, GBP_STORES, MXN_STORES,
US_STORES)
class Stores(ABC):
pass
@dataclass
class UnitedStatesStores(Stores):
"""
Dataclass for united states amazon marketplaces .
"""
channels: tuple = US_STORES
currency_code: str = "USD"
@dataclass
class CanadaStores(Stores):
"""
Base class for canada marketplaces.
"""
channels: tuple = CANADA_STORES
currency_code: str = "CAD"
@dataclass
class UnitedKingdomStores(Stores):
"""
Base class for united kingdom marketplaces.
"""
channels: tuple = GBP_STORES
currency_code: str = "GBP"
@dataclass
class EuropeanUnionStores(Stores):
"""
Base class for european union marketplaces.
"""
channels: tuple = EUR_STORES
currency_code: str = "EUR"
@dataclass
class MexicoStores(Stores):
"""Base class for mexico union marketplaces."""
channels: tuple = MXN_STORES
currency_code: str = "MXN"
| 18.033898 | 79 | 0.670113 | 115 | 1,064 | 6.069565 | 0.313043 | 0.100287 | 0.179083 | 0.15043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.240602 | 1,064 | 58 | 80 | 18.344828 | 0.863861 | 0.202068 | 0 | 0.192308 | 0 | 0 | 0.019182 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.038462 | 0.115385 | 0 | 0.730769 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
31e7dd3ecfdd6db7bdcdbcfdb868d6f78bda1964 | 1,939 | py | Python | openapi_server/controllers/cart_controller.py | Atadzhan/sample-python-cfd | 5100bef299108f2d9c1879313d27c1860307e376 | [
"MIT"
] | 2 | 2021-11-28T16:17:10.000Z | 2022-01-18T02:18:50.000Z | openapi_server/controllers/cart_controller.py | Atadzhan/sample-python-cfd | 5100bef299108f2d9c1879313d27c1860307e376 | [
"MIT"
] | 3 | 2021-01-07T16:30:12.000Z | 2021-11-18T10:04:02.000Z | openapi_server/controllers/cart_controller.py | Atadzhan/sample-python-cfd | 5100bef299108f2d9c1879313d27c1860307e376 | [
"MIT"
] | 24 | 2020-12-07T21:11:13.000Z | 2022-03-28T23:35:29.000Z | import connexion
import six
from sqlalchemy import exc
from sqlalchemy.sql.functions import mode
from openapi_server.models.error import Error # noqa: E501
from openapi_server.models.menu_item import MenuItem # noqa: E501
from openapi_server import util
from openapi_server.database import models
from sqlalchemy.exc import SQLAlchemyError, IntegrityError
def add_cart_item(): # noqa: E501
"""Add a menu item a cart
Creates a new item in the cart. Duplicates are allowed # noqa: E501
:param menu_item: Item to add to the cart
:type menu_item: dict | bytes
:rtype: None
"""
if connexion.request.is_json:
menu_item = MenuItem.from_dict(connexion.request.get_json()) # noqa: E501
try:
models.Cart.add_item(connexion.request.remote_addr, menu_item)
# models.Cart.add_item(connexion.request.host.split(':')[0], menu_item)
except (SQLAlchemyError, TypeError, AttributeError):
models.db.session.rollback()
return Error(400), 400
def delete_cart_item(item_id): # noqa: E501
"""Remove item from cart
The item must be in the cart. If multiple of same item, call this twice # noqa: E501
:param item_id: The menu item to delete from cart
:type item_id: int
:rtype: None
"""
# this is by no means efficient
try:
models.Cart.delete_item_by_id(connexion.request.remote_addr, item_id)
except (SQLAlchemyError, TypeError):
models.db.session.rollback()
return Error(403), 403 # cart is already devoid of this item
def list_cart(limit=None): # noqa: E501
"""List all cart items
# noqa: E501
:param limit: How many items to return at one time (max 100)
:type limit: int
:rtype: List[MenuItem]
"""
if cart := models.Cart.query_by_host(connexion.request.remote_addr):
return [_.serialize() for _ in cart.items]
else:
return []
| 29.378788 | 89 | 0.683342 | 272 | 1,939 | 4.746324 | 0.341912 | 0.055771 | 0.052672 | 0.060418 | 0.142525 | 0.103796 | 0 | 0 | 0 | 0 | 0 | 0.028782 | 0.2295 | 1,939 | 65 | 90 | 29.830769 | 0.835341 | 0.3672 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.107143 | false | 0 | 0.321429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
9ec3f898565d20a153caeacc1776470c4fe56e4e | 961 | py | Python | selenuim_frame.py | whitecat-22/selenium_frame | f4f956f0a9ba7fbadfc4d733d2f70b21c83f4223 | [
"MIT"
] | null | null | null | selenuim_frame.py | whitecat-22/selenium_frame | f4f956f0a9ba7fbadfc4d733d2f70b21c83f4223 | [
"MIT"
] | null | null | null | selenuim_frame.py | whitecat-22/selenium_frame | f4f956f0a9ba7fbadfc4d733d2f70b21c83f4223 | [
"MIT"
] | null | null | null | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options # 追加
import time
options = Options() # 追加
driver = webdriver.Chrome(executable_path='C:\Program Files\chromedriver\chromedriver.exe', options=options) # options=options 追加
driver.get("http://aaa/bbb/ccc.asp")
time.sleep(3) # 3-10秒ほど待つと良いです
# フレームを切り替えて、該当の要素を取得する
searchElement = driver.switch_to_frame(driver.find_element_by_name("txtUser")) # 変更
print(driver.page_source) # もしくは、print(searchElement)
# もとのフレームに戻る
driver.switch_to.default_content() # 追加
# ドライバを閉じて、処理を終了する
driver.close() # 追加
# 参照元;
# - [[Python] seleniumのフレーム移動(switch_to_frame)](https://hacknote.jp/archives/51263/)
# - [Selenium with Python - 3. Navigating -- 3.4. Moving between windows and frames](https://selenium-python.readthedocs.io/navigating.html#moving-between-windows-and-frames)
| 33.137931 | 177 | 0.768991 | 127 | 961 | 5.732283 | 0.535433 | 0.065934 | 0.086538 | 0.074176 | 0.07967 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013953 | 0.105099 | 961 | 28 | 178 | 34.321429 | 0.832558 | 0.402706 | 0 | 0 | 0 | 0 | 0.134409 | 0.062724 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.384615 | null | null | 0.076923 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
9ec61b6e1e69f65141e3578dc32c0ede51b3d222 | 306 | py | Python | Coin/test.py | skyriv213/Project_Clone | b873861e25f2550460e5c545997c6f0ab6b7cedd | [
"MIT"
] | null | null | null | Coin/test.py | skyriv213/Project_Clone | b873861e25f2550460e5c545997c6f0ab6b7cedd | [
"MIT"
] | null | null | null | Coin/test.py | skyriv213/Project_Clone | b873861e25f2550460e5c545997c6f0ab6b7cedd | [
"MIT"
] | null | null | null | import pyupbit
access = "ZHzEZMrzgVXsPbTjJnSGM8GUgY5UMST3K1ua8D5y" # 본인 값으로 변경
secret = "x6Zqr3ykxvxuTxgJIDHBix4nKAQqYBAbdJpsUPR9" # 본인 값으로 변경
upbit = pyupbit.Upbit(access, secret)
print(upbit.get_balance("KRW-SNT")) # KRW-XRP 조회
print(upbit.get_balance("KRW")) # 보유 현금 조회
| 30.6 | 72 | 0.696078 | 34 | 306 | 6.205882 | 0.558824 | 0.047393 | 0.066351 | 0.189573 | 0.218009 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040984 | 0.202614 | 306 | 9 | 73 | 34 | 0.82377 | 0.127451 | 0 | 0 | 0 | 0 | 0.344828 | 0.306513 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.333333 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9ef66747b03d487b1c4eafda14398347c61a3b97 | 592 | py | Python | src/py4vasp/control/__init__.py | vasp-dev/py4vasp | 576c5c23d740b11687e37b6dd332165bc339cf16 | [
"Apache-2.0"
] | 27 | 2022-02-18T18:43:17.000Z | 2022-03-29T22:05:41.000Z | src/py4vasp/control/__init__.py | vasp-dev/py4vasp | 576c5c23d740b11687e37b6dd332165bc339cf16 | [
"Apache-2.0"
] | 3 | 2022-02-18T18:52:33.000Z | 2022-03-28T13:26:59.000Z | src/py4vasp/control/__init__.py | vasp-dev/py4vasp | 576c5c23d740b11687e37b6dd332165bc339cf16 | [
"Apache-2.0"
] | 4 | 2022-02-07T12:21:23.000Z | 2022-03-13T21:36:03.000Z | # Copyright © VASP Software GmbH,
# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Setup input data for VASP calculations.
VASP requires several input files to execute. We provide some simple helper classes and
routines to generate these files from python. You can also use the routines to extract
the input files from a path.
"""
from .incar import INCAR
from .kpoints import KPOINTS
from .poscar import POSCAR
import inspect
import sys
_this_mod = sys.modules[__name__]
__all__ = [name for name, _ in inspect.getmembers(_this_mod, inspect.isclass)]
| 34.823529 | 87 | 0.783784 | 93 | 592 | 4.860215 | 0.634409 | 0.035398 | 0.039823 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007905 | 0.14527 | 592 | 16 | 88 | 37 | 0.883399 | 0.608108 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.714286 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
7305d371daa3ec5eff358284391d9be4363ef4a6 | 1,486 | py | Python | PyProjManCore/proj_stats.py | aawadall/PyProjMan | 49b341b79db5fba45ae347a760d05dea7a49df40 | [
"MIT"
] | 5 | 2017-09-06T00:06:12.000Z | 2021-01-20T23:04:47.000Z | PyProjManCore/proj_stats.py | aawadall/PyProjMan | 49b341b79db5fba45ae347a760d05dea7a49df40 | [
"MIT"
] | 80 | 2017-09-03T18:06:40.000Z | 2017-09-21T17:50:26.000Z | PyProjManCore/proj_stats.py | aawadall/PyProjMan | 49b341b79db5fba45ae347a760d05dea7a49df40 | [
"MIT"
] | 3 | 2017-09-05T19:18:58.000Z | 2017-09-16T19:56:21.000Z | from PyProjManCore.task import Task
class ProjStats:
"""Project Statistics Object, used for reporting purposes"""
def __init__(self, name=None):
"""empty object"""
self._project_name = name
self._first_task = None
self._last_task = None
self._task_count = 0
self._project_duration = None
self._list_tasks = []
@property
def name(self):
return self._project_name
@name.setter
def name(self, value):
self._project_name = value
@property
def first(self):
return self._first_task
@first.setter
def first(self, value: Task):
self._first_task = value
@property
def last(self):
return self._last_task
@last.setter
def last(self, value: Task):
self._last_task = value
@property
def count(self):
return self._task_count
@count.setter
def count(self, value):
self._task_count = value
@property
def duration(self):
return self._project_duration
@duration.setter
def duration(self, value):
self._project_duration = value
@property
def tasks(self):
return self._list_tasks
@tasks.setter
def tasks(self, value):
self._list_tasks = value
def append_task(self, value):
self._list_tasks.append(value)
def remove_task(self, value):
while value in self._list_tasks:
self._list_tasks.remove(value)
| 21.536232 | 64 | 0.621803 | 180 | 1,486 | 4.866667 | 0.188889 | 0.082192 | 0.089041 | 0.043379 | 0.050228 | 0 | 0 | 0 | 0 | 0 | 0 | 0.000947 | 0.289367 | 1,486 | 68 | 65 | 21.852941 | 0.828598 | 0.045087 | 0 | 0.12 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.02 | 0.12 | 0.46 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
7306859ada5841ec8edcec37d72ea2f31d03ab4f | 6,857 | py | Python | ros/src/waypoint_updater/waypoint_updater.py | waelterm/Udacity_Project9-SystemIntegration | e652b7d72415cd33706bcd398f2fbe7d17e1fdb4 | [
"MIT"
] | null | null | null | ros/src/waypoint_updater/waypoint_updater.py | waelterm/Udacity_Project9-SystemIntegration | e652b7d72415cd33706bcd398f2fbe7d17e1fdb4 | [
"MIT"
] | 10 | 2020-01-28T23:01:15.000Z | 2022-03-12T00:00:25.000Z | ros/src/waypoint_updater/waypoint_updater.py | waelterm/Udacity_Project9-SystemIntegration | e652b7d72415cd33706bcd398f2fbe7d17e1fdb4 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import rospy
import numpy as np
from geometry_msgs.msg import PoseStamped
from styx_msgs.msg import Lane, Waypoint
from scipy.spatial import KDTree
import math
from std_msgs.msg import Int32
'''
This node will publish waypoints from the car's current position to some `x` distance ahead.
As mentioned in the doc, you should ideally first implement a version which does not care
about traffic lights or obstacles.
Once you have created dbw_node, you will update this node to use the status of traffic lights too.
Please note that our simulator also provides the exact location of traffic lights and their
current status in `/vehicle/traffic_lights` message. You can use this message to build this node
as well as to verify your TL classifier.
TODO (for Yousuf and Aaron): Stopline location for each traffic light.
'''
LOOKAHEAD_WPS = 50 # Number of waypoints we will publish. You can change this number
MAX_DECEL = .5
class WaypointUpdater(object):
def __init__(self):
rospy.init_node('waypoint_updater')
# Variable Declarations
#self.pose = None
self.base_lane = None
self.stopline_wp_idx = -1
self.x = None
self.y = None
#self.base_waypoints = None
self.waypoints_2d = None
self.waypoint_tree = None
self.previous_index = None
self.traffic_waypoint = None
# Subscriber Declarations
rospy.Subscriber('/current_pose', PoseStamped, self.pose_cb)
rospy.Subscriber('/base_waypoints', Lane, self.waypoints_cb)
rospy.Subscriber('/traffic_waypoint', Int32, self.traffic_cb)
# TODO: Add a subscriber for /traffic_waypoint and /obstacle_waypoint below
# Variable declarations
self.final_waypoints_pub = rospy.Publisher('final_waypoints', Lane, queue_size=1)
self.loop()
def loop(self):
rate = rospy.Rate(10) #Running at 50Hz
while not rospy.is_shutdown():
#Check if vehicle position and list of waypoints have been received at least once
if self.x and self.base_lane and self.waypoint_tree: #self.x and self.y and self.base_waypoints and self.waypoint_tree:
self.publish_waypoints()
#closest_waypoint_ahead_index = self.get_closest_waypoint_idx()
#self.publish_waypoints(closest_waypoint_ahead_index)
rate.sleep()
def get_closest_waypoint_idx(self):
reference_point = [self.x, self.y]
number_of_nearest_neighbors = 1
search_range = 50
if self.previous_index is not None:
self.waypoint_tree = KDTree(self.waypoints_2d[self.previous_index-search_range:self.previous_index+search_range])
nn_distance, nn_index = self.waypoint_tree.query(reference_point, number_of_nearest_neighbors)
nn_index = nn_index + self.previous_index - search_range
else:
nn_distance, nn_index = self.waypoint_tree.query(reference_point, number_of_nearest_neighbors)
self.previous_index = nn_index
nearest_waypoint = self.waypoints_2d[nn_index]
previous_waypoint = self.waypoints_2d[nn_index-1]
road_direction_vector = np.array([nearest_waypoint[0] - previous_waypoint[0], nearest_waypoint[1] - previous_waypoint[1]])
vehicle_waypoint_direction = np.array([nearest_waypoint[0] - self.x, nearest_waypoint[1]-self.y])
# The dot product gives information about the angle of the two vectors.
# If the dot product is 0, the angles are perpendiculat
# If the value is positive , the angles generally point in a similar direction (-90deg to 90 deg)
# If the value is negative, the angles generally point in the opposite direction( 90 to 270 deg)
dot_product = np.dot(road_direction_vector, vehicle_waypoint_direction)
# If the dot product is negative, it means that the vehicle to waypoint vector points in the opposite direction of the road. This means the point is behind the vehicle
if dot_product < 0:
closest_waypoint_ahead_index = nn_index +1
else:
closest_waypoint_ahead_index = nn_index
return closest_waypoint_ahead_index
def publish_waypoints(self ):
final_lane = self.generate_lane()
self.final_waypoints_pub.publish(final_lane)
def generate_lane(self):
lane = Lane()
closest_idx = self.get_closest_waypoint_idx()
farthest_idx = closest_idx + LOOKAHEAD_WPS
base_waypoints = self.base_lane.waypoints[closest_idx:farthest_idx]
if self.stopline_wp_idx == -1 or (self.stopline_wp_idx >= farthest_idx):
lane.waypoints = base_waypoints
else:
lane.waypoints = self.decelerate_waypoints(base_waypoints, closest_idx)
return lane
def decelerate_waypoints(self, waypoints, closest_idx):
temp = []
for i, wp in enumerate(waypoints):
p = Waypoint()
p.pose = wp.pose
stop_idx = max(self.stopline_wp_idx - closest_idx -2, 0)
dist = self.distance(waypoints, i, stop_idx)
vel = math.sqrt(2* MAX_DECEL*dist)
if vel <1.0:
vel = 0.0
p.twist.twist.linear.x = min(vel, wp.twist.twist.linear.x)
temp.append(p)
return temp
def pose_cb(self, msg):
self.x = msg.pose.position.x
self.y = msg.pose.position.y
# TODO: Implement
pass
def waypoints_cb(self, waypoints):
# TODO: Implement
self.base_lane = waypoints
if not self.waypoints_2d:
self.waypoints_2d = [[waypoint.pose.pose.position.x, waypoint.pose.pose.position.y]for waypoint in waypoints.waypoints]
self.waypoint_tree = KDTree(self.waypoints_2d)
def traffic_cb(self, msg):
# TODO: Callback for /traffic_waypoint message. Implement
print(msg)
self.stopline_wp_idx = msg.data
def obstacle_cb(self, msg):
# TODO: Callback for /obstacle_waypoint message. We will implement it later
pass
def get_waypoint_velocity(self, waypoint):
return waypoint.twist.twist.linear.x
def set_waypoint_velocity(self, waypoints, waypoint, velocity):
waypoints[waypoint].twist.twist.linear.x = velocity
def distance(self, waypoints, wp1, wp2):
dist = 0
dl = lambda a, b: math.sqrt((a.x-b.x)**2 + (a.y-b.y)**2 + (a.z-b.z)**2)
for i in range(wp1, wp2+1):
dist += dl(waypoints[wp1].pose.pose.position, waypoints[i].pose.pose.position)
wp1 = i
return dist
if __name__ == '__main__':
try:
WaypointUpdater()
except rospy.ROSInterruptException:
rospy.logerr('Could not start waypoint updater node.')
| 39.866279 | 175 | 0.671576 | 926 | 6,857 | 4.781857 | 0.24406 | 0.03523 | 0.023713 | 0.019196 | 0.204381 | 0.110208 | 0.071364 | 0.034327 | 0.034327 | 0.034327 | 0 | 0.011858 | 0.249818 | 6,857 | 171 | 176 | 40.099415 | 0.84895 | 0.172816 | 0 | 0.064815 | 0 | 0 | 0.024303 | 0 | 0 | 0 | 0 | 0.011696 | 0 | 0 | null | null | 0.018519 | 0.064815 | null | null | 0.009259 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
73214773919180a13a452308191d6501eb3c81f2 | 135 | py | Python | src/moderate/predict-the-number/solutions/python/solution.py | rdtsc/codeeval-solutions | d5c06baf89125e9e9f4b163ee57e5a8f7e73e717 | [
"MIT"
] | null | null | null | src/moderate/predict-the-number/solutions/python/solution.py | rdtsc/codeeval-solutions | d5c06baf89125e9e9f4b163ee57e5a8f7e73e717 | [
"MIT"
] | null | null | null | src/moderate/predict-the-number/solutions/python/solution.py | rdtsc/codeeval-solutions | d5c06baf89125e9e9f4b163ee57e5a8f7e73e717 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
with open(sys.argv[1]) as file:
for n in(int(n) for n in file):
print(bin(n).count('1') % 3)
| 16.875 | 33 | 0.614815 | 28 | 135 | 2.964286 | 0.678571 | 0.096386 | 0.144578 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036697 | 0.192593 | 135 | 7 | 34 | 19.285714 | 0.724771 | 0.155556 | 0 | 0 | 0 | 0 | 0.00885 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7326b1ffc9b8c36d05209357480fd1f774f20075 | 1,817 | py | Python | health-insurance-lead-prediction/src/preprocess/custom.py | sudhirln92/analytics-vidhya-competitions | 2e284f1ae7e3ddd4d810714db0b8eca5770756ee | [
"MIT"
] | null | null | null | health-insurance-lead-prediction/src/preprocess/custom.py | sudhirln92/analytics-vidhya-competitions | 2e284f1ae7e3ddd4d810714db0b8eca5770756ee | [
"MIT"
] | null | null | null | health-insurance-lead-prediction/src/preprocess/custom.py | sudhirln92/analytics-vidhya-competitions | 2e284f1ae7e3ddd4d810714db0b8eca5770756ee | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 28 09:13:14 2021
@author: sudhir
"""
# =============================================================================
# Import library
# =============================================================================
import pandas as pd
import numpy as np
from sklearn.base import TransformerMixin, BaseEstimator
from sklearn.preprocessing import StandardScaler
# =============================================================================
# Drop Column
# =============================================================================
class DropColumn(TransformerMixin, BaseEstimator):
"""Drop Columns from original Data Frame:
Parameters
----------
columns: list, The list of column names.
Returns
-------
DataFrame
Size: (row, old columns - columns)
"""
def __init__(self, cols):
if isinstance(cols, str):
self.cols = [cols]
else:
self.cols = cols
def fit(self, X, y=None):
return self
def transform(self, X):
Xdrop = X.drop(self.cols, axis=1)
return Xdrop
# =============================================================================
# Extract Column
# =============================================================================
class ExtractColumn(TransformerMixin, BaseEstimator):
"""Extract Columns from original Data Frame:
Parameters
----------
columns: list, The list of column names.
Returns
-------
DataFrame with only extracted columns
Size: (row, columns)
"""
def __init__(self, columns, **kwargs):
self.columns = columns
def fit(self, X, y=None):
return self
def transform(self, X):
Xcol = X[self.columns]
return Xcol
| 23.294872 | 79 | 0.450193 | 157 | 1,817 | 5.159236 | 0.471338 | 0.039506 | 0.046914 | 0.05679 | 0.316049 | 0.316049 | 0.316049 | 0.316049 | 0.316049 | 0.316049 | 0 | 0.010402 | 0.206384 | 1,817 | 77 | 80 | 23.597403 | 0.551318 | 0.526142 | 0 | 0.26087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0 | 0.173913 | 0.086957 | 0.695652 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
733a2cf70272defa599076f290441de12a9cca30 | 2,403 | py | Python | machine-learning/nlp/text-paraphrasing/paraphrasing_with_transformers_pythoncode.py | hollyyph/ObjectDirection1 | c2bf47432f1c1cbf73155d59016e8f184a309ac1 | [
"MIT"
] | 3 | 2022-02-04T08:24:30.000Z | 2022-03-07T16:05:01.000Z | machine-learning/nlp/text-paraphrasing/paraphrasing_with_transformers_pythoncode.py | RorisangMalebye/pythoncode-tutorials | 87cbf87088905f8bc09fdc87292a4367df0e9c08 | [
"MIT"
] | 3 | 2022-01-25T00:08:22.000Z | 2022-03-11T21:22:03.000Z | machine-learning/nlp/text-paraphrasing/paraphrasing_with_transformers_pythoncode.py | RorisangMalebye/pythoncode-tutorials | 87cbf87088905f8bc09fdc87292a4367df0e9c08 | [
"MIT"
] | 1 | 2022-02-04T19:04:51.000Z | 2022-02-04T19:04:51.000Z | # -*- coding: utf-8 -*-
"""Paraphrasing-with-Transformers_PythonCode.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1bPfvSF7bJqDfw9ZMgfIZPd1Bk-fW7AJY
"""
!pip install transformers sentencepiece
from transformers import *
# models we gonna use for this tutorial
model_names = [
"tuner007/pegasus_paraphrase",
"Vamsi/T5_Paraphrase_Paws",
"prithivida/parrot_paraphraser_on_T5", # Parrot
]
model = PegasusForConditionalGeneration.from_pretrained("tuner007/pegasus_paraphrase")
tokenizer = PegasusTokenizerFast.from_pretrained("tuner007/pegasus_paraphrase")
def get_paraphrased_sentences(model, tokenizer, sentence, num_return_sequences=5, num_beams=5):
# tokenize the text to be form of a list of token IDs
inputs = tokenizer([sentence], truncation=True, padding="longest", return_tensors="pt")
# generate the paraphrased sentences
outputs = model.generate(
**inputs,
num_beams=num_beams,
num_return_sequences=num_return_sequences,
)
# decode the generated sentences using the tokenizer to get them back to text
return tokenizer.batch_decode(outputs, skip_special_tokens=True)
sentence = "Learning is the process of acquiring new understanding, knowledge, behaviors, skills, values, attitudes, and preferences."
get_paraphrased_sentences(model, tokenizer, sentence, num_beams=10, num_return_sequences=10)
get_paraphrased_sentences(model, tokenizer, "To paraphrase a source, you have to rewrite a passage without changing the meaning of the original text.", num_beams=10, num_return_sequences=10)
tokenizer = AutoTokenizer.from_pretrained("Vamsi/T5_Paraphrase_Paws")
model = AutoModelForSeq2SeqLM.from_pretrained("Vamsi/T5_Paraphrase_Paws")
get_paraphrased_sentences(model, tokenizer, "paraphrase: " + "One of the best ways to learn is to teach what you've already learned")
!pip install git+https://github.com/PrithivirajDamodaran/Parrot_Paraphraser.git
from parrot import Parrot
parrot = Parrot()
phrases = [
sentence,
"One of the best ways to learn is to teach what you've already learned",
"Paraphrasing is the process of coming up with someone else's ideas in your own words"
]
for phrase in phrases:
print("-"*100)
print("Input_phrase: ", phrase)
print("-"*100)
paraphrases = parrot.augment(input_phrase=phrase)
for paraphrase in paraphrases:
print(paraphrase)
| 35.865672 | 190 | 0.786101 | 313 | 2,403 | 5.881789 | 0.456869 | 0.054318 | 0.048886 | 0.060837 | 0.263444 | 0.18088 | 0.142857 | 0.05975 | 0.05975 | 0.05975 | 0 | 0.017159 | 0.126925 | 2,403 | 66 | 191 | 36.409091 | 0.860343 | 0.095298 | 0 | 0.052632 | 1 | 0.026316 | 0.342333 | 0.095772 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.026316 | 0.052632 | null | null | 0.105263 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7340ca1584ed96ce9eed3fe5894ea1b59667a110 | 959 | py | Python | covid_graphs/setup.py | michalburger1/COVID-19-simulation | ea063ac61c7042fd3896650fb0a8bb20587a3eeb | [
"Unlicense"
] | null | null | null | covid_graphs/setup.py | michalburger1/COVID-19-simulation | ea063ac61c7042fd3896650fb0a8bb20587a3eeb | [
"Unlicense"
] | null | null | null | covid_graphs/setup.py | michalburger1/COVID-19-simulation | ea063ac61c7042fd3896650fb0a8bb20587a3eeb | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python3
from setuptools import find_namespace_packages, setup
setup(
name="covid_graphs",
version="1.0",
description="COVID-19 graph plotting",
install_requires=[
"click",
"click_pathlib",
"dash",
"Flask",
"numpy",
"pandas",
"protobuf",
"plotly",
"pytest",
"scipy",
],
dependency_links=[],
python_requires=">=3.7",
packages=find_namespace_packages(),
entry_points={
"console_scripts": [
"covid_graphs.run_server = covid_graphs.scripts.server:run_server",
"covid_graphs.show_country_plot = covid_graphs.country:main",
"covid_graphs.show_heat_map = covid_graphs.heat_map:main",
"covid_graphs.show_scatter_plot = covid_graphs.scatter_plot:main",
"covid_graphs.prepare_data = covid_graphs.prepare_data:main"
]
},
package_data={"": ["*.html"]},
)
| 27.4 | 79 | 0.602711 | 101 | 959 | 5.386139 | 0.544554 | 0.222426 | 0.082721 | 0.073529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009915 | 0.263816 | 959 | 34 | 80 | 28.205882 | 0.760623 | 0.021898 | 0 | 0 | 0 | 0 | 0.453575 | 0.302028 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.032258 | 0 | 0.032258 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7349a76967a256a551b5dcf858527d957159cfae | 4,014 | py | Python | certbot-dns-google/certbot_dns_google/__init__.py | mausinixterra/letsencrypt | 2d4f36cc9fedafa91b9877ec2ec1f9f83da4ecd3 | [
"Apache-2.0"
] | 2 | 2018-10-03T15:33:57.000Z | 2020-06-09T20:28:29.000Z | certbot-dns-google/certbot_dns_google/__init__.py | schu/certbot | f3b23662f1fddedcea702c6ea5b54d5f97d1b0a8 | [
"Apache-2.0"
] | 808 | 2018-11-09T05:14:26.000Z | 2021-08-03T05:26:10.000Z | certbot-dns-google/certbot_dns_google/__init__.py | schu/certbot | f3b23662f1fddedcea702c6ea5b54d5f97d1b0a8 | [
"Apache-2.0"
] | 3 | 2018-02-09T21:05:38.000Z | 2019-06-10T00:39:00.000Z | """
The `~certbot_dns_google.dns_google` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using the Google Cloud DNS API.
Named Arguments
---------------
======================================== =====================================
``--dns-google-credentials`` Google Cloud Platform credentials_
JSON file.
(Required - Optional on Google Compute Engine)
``--dns-google-propagation-seconds`` The number of seconds to wait for DNS
to propagate before asking the ACME
server to verify the DNS record.
(Default: 60)
======================================== =====================================
Credentials
-----------
Use of this plugin requires Google Cloud Platform API credentials
for an account with the following permissions:
* ``dns.changes.create``
* ``dns.changes.get``
* ``dns.managedZones.list``
* ``dns.resourceRecordSets.create``
* ``dns.resourceRecordSets.delete``
Google provides instructions for `creating a service account <https://developers
.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount>`_ and
`information about the required permissions <https://cloud.google.com/dns/access
-control#permissions_and_roles>`_. If you're running on Google Compute Engine,
you can `assign the service account to the instance <https://cloud.google.com/
compute/docs/access/create-enable-service-accounts-for-instances>`_ which
is running certbot. A credentials file is not required in this case, as they
are automatically obtained by certbot through the `metadata service
<https://cloud.google.com/compute/docs/storing-retrieving-metadata>`_ .
.. code-block:: json
:name: credentials.json
:caption: Example credentials file:
{
"type": "service_account",
...
}
The path to this file can be provided interactively or using the
``--dns-google-credentials`` command-line argument. Certbot records the path
to this file for use during renewal, but does not store the file's contents.
.. caution::
You should protect these API credentials as you would a password. Users who
can read this file can use these credentials to issue some types of API calls
on your behalf, limited by the permissions assigned to the account. Users who
can cause Certbot to run using these credentials can complete a ``dns-01``
challenge to acquire new certificates or revoke existing certificates for
domains these credentials are authorized to manage.
Certbot will emit a warning if it detects that the credentials file can be
accessed by other users on your system. The warning reads "Unsafe permissions
on credentials configuration file", followed by the path to the credentials
file. This warning will be emitted each time Certbot uses the credentials file,
including for renewal, and cannot be silenced except by addressing the issue
(e.g., by using a command like ``chmod 600`` to restrict access to the file).
Examples
--------
.. code-block:: bash
:caption: To acquire a certificate for ``example.com``
certbot certonly \\
--dns-google \\
--dns-google-credentials ~/.secrets/certbot/google.json \\
-d example.com
.. code-block:: bash
:caption: To acquire a single certificate for both ``example.com`` and
``www.example.com``
certbot certonly \\
--dns-google \\
--dns-google-credentials ~/.secrets/certbot/google.json \\
-d example.com \\
-d www.example.com
.. code-block:: bash
:caption: To acquire a certificate for ``example.com``, waiting 120 seconds
for DNS propagation
certbot certonly \\
--dns-google \\
--dns-google-credentials ~/.secrets/certbot/google.ini \\
--dns-google-propagation-seconds 120 \\
-d example.com
"""
| 38.596154 | 88 | 0.664425 | 499 | 4,014 | 5.322645 | 0.388778 | 0.040663 | 0.037651 | 0.027108 | 0.178464 | 0.165663 | 0.143072 | 0.143072 | 0.143072 | 0.128012 | 0 | 0.005646 | 0.20578 | 4,014 | 103 | 89 | 38.970874 | 0.827478 | 0.994768 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7363b9ba7dce18a152971e0cad6209884eb0aa76 | 369 | py | Python | haemapod/handlers/events/bounding_box.py | globalspin/haemapod | 990440d7c8f369bc5082f0aae5867a0a150613f1 | [
"MIT"
] | null | null | null | haemapod/handlers/events/bounding_box.py | globalspin/haemapod | 990440d7c8f369bc5082f0aae5867a0a150613f1 | [
"MIT"
] | 1 | 2015-03-24T21:25:45.000Z | 2015-03-24T21:25:45.000Z | haemapod/handlers/events/bounding_box.py | globalspin/haemapod | 990440d7c8f369bc5082f0aae5867a0a150613f1 | [
"MIT"
] | null | null | null | from model import Event
from geo.geomodel import geotypes
def get(handler, response):
lat1 = handler.request.get('lat1')
lon1 = handler.request.get('lng1')
lat2 = handler.request.get('lat2')
lon2 = handler.request.get('lng2')
response.events = Event.bounding_box_fetch(
Event.all(),
geotypes.Box(float(lat1),float(lon2),float(lat2),float(lon1)),
)
| 28.384615 | 66 | 0.710027 | 51 | 369 | 5.098039 | 0.470588 | 0.215385 | 0.261538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037618 | 0.135501 | 369 | 12 | 67 | 30.75 | 0.777429 | 0 | 0 | 0 | 0 | 0 | 0.04336 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.181818 | 0 | 0.272727 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b4076d994b1ee1f6d360fd4a1433e0e7ea105704 | 2,980 | py | Python | tests/unit/hypernode_vagrant_runner/vagrant/set_up/test_create_hypernode_vagrant.py | vdloo/hypernode-vagrant-runner | 241b9612769b74b536a43f4e6821003c5f1ea2c3 | [
"MIT"
] | null | null | null | tests/unit/hypernode_vagrant_runner/vagrant/set_up/test_create_hypernode_vagrant.py | vdloo/hypernode-vagrant-runner | 241b9612769b74b536a43f4e6821003c5f1ea2c3 | [
"MIT"
] | null | null | null | tests/unit/hypernode_vagrant_runner/vagrant/set_up/test_create_hypernode_vagrant.py | vdloo/hypernode-vagrant-runner | 241b9612769b74b536a43f4e6821003c5f1ea2c3 | [
"MIT"
] | null | null | null | from hypernode_vagrant_runner.settings import HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION
from hypernode_vagrant_runner.vagrant import create_hypernode_vagrant
from tests.testcase import TestCase
class TestCreateHypernodeVagrant(TestCase):
def setUp(self):
self.try_sudo = self.set_up_patch(
'hypernode_vagrant_runner.vagrant.set_up.try_sudo'
)
self.ensure_directory_for_checkout = self.set_up_patch(
'hypernode_vagrant_runner.vagrant.set_up.ensure_directory_for_checkout'
)
self.ensure_hypernode_vagrant_checkout = self.set_up_patch(
'hypernode_vagrant_runner.vagrant.set_up.ensure_hypernode_vagrant_checkout'
)
self.ensure_required_plugins_are_installed = self.set_up_patch(
'hypernode_vagrant_runner.vagrant.set_up.ensure_required_plugins_are_installed'
)
self.start_hypernode_vagrant = self.set_up_patch(
'hypernode_vagrant_runner.vagrant.set_up.start_hypernode_vagrant'
)
def test_create_hypernode_vagrant_tries_sudo(self):
create_hypernode_vagrant()
self.try_sudo.assert_called_once_with()
def test_create_hypernode_vagrant_ensures_directory_for_checkout(self):
create_hypernode_vagrant()
self.ensure_directory_for_checkout.assert_called_once_with(
directory=None
)
def test_create_hypernode_vagrant_uses_specified_pre_existing_directory_if_specified(self):
create_hypernode_vagrant(directory='/tmp/some/pre/existing/directory')
self.ensure_directory_for_checkout.assert_called_once_with(
directory='/tmp/some/pre/existing/directory'
)
def test_create_hypernode_vagrant_ensures_hypernode_vagrant_checkout(self):
create_hypernode_vagrant()
self.ensure_hypernode_vagrant_checkout.assert_called_once_with(
directory=self.ensure_directory_for_checkout.return_value
)
def test_create_hypernode_vagrant_ensures_required_plugins_are_installed(self):
create_hypernode_vagrant()
self.ensure_required_plugins_are_installed.assert_called_once_with()
def test_create_hypernode_vagrant_starts_hypernode_vagrant_in_ensured_path(self):
create_hypernode_vagrant()
self.start_hypernode_vagrant.assert_called_once_with(
self.ensure_directory_for_checkout.return_value,
php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION
)
def test_create_hypernode_vagrant_starts_hypernode_vagrant_with_specified_php_version(self):
create_hypernode_vagrant(php_version='5.5')
self.start_hypernode_vagrant.assert_called_once_with(
self.ensure_directory_for_checkout.return_value,
php_version='5.5'
)
def test_create_hypernode_vagrant_returns_ensured_directory(self):
ret = create_hypernode_vagrant()
self.assertEqual(ret, self.ensure_directory_for_checkout.return_value)
| 39.733333 | 96 | 0.764094 | 354 | 2,980 | 5.864407 | 0.158192 | 0.277457 | 0.180154 | 0.100193 | 0.75578 | 0.590077 | 0.440751 | 0.36368 | 0.328516 | 0.28131 | 0 | 0.001635 | 0.179195 | 2,980 | 74 | 97 | 40.27027 | 0.847097 | 0 | 0 | 0.196429 | 0 | 0 | 0.134228 | 0.132215 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.160714 | false | 0 | 0.053571 | 0 | 0.232143 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b41db37cbbfec2aa0b565f4b305cb2103fd47e96 | 157 | py | Python | zadanie/primer/prim 2.py | Adrenaline1a/demo-2.13 | ef72aa50ff8291c64ee3c90d8091e79cc452c4e3 | [
"MIT"
] | null | null | null | zadanie/primer/prim 2.py | Adrenaline1a/demo-2.13 | ef72aa50ff8291c64ee3c90d8091e79cc452c4e3 | [
"MIT"
] | null | null | null | zadanie/primer/prim 2.py | Adrenaline1a/demo-2.13 | ef72aa50ff8291c64ee3c90d8091e79cc452c4e3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math, datetime
if __name__ == '__main__':
math.cos(math.pi / 4)
datetime.date(2017, 3, 21)
| 14.272727 | 30 | 0.605096 | 23 | 157 | 3.782609 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08 | 0.203822 | 157 | 10 | 31 | 15.7 | 0.616 | 0.273885 | 0 | 0 | 0 | 0 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b422fdbf47c42376bcbca91d68f5ddba3802c93e | 1,709 | py | Python | bento/__init__.py | abadger/Bento | 3f1ddefd8d21decbc018d097d3ec5da4dc9364df | [
"BSD-3-Clause"
] | 1 | 2015-10-25T13:08:36.000Z | 2015-10-25T13:08:36.000Z | bento/__init__.py | abadger/Bento | 3f1ddefd8d21decbc018d097d3ec5da4dc9364df | [
"BSD-3-Clause"
] | null | null | null | bento/__init__.py | abadger/Bento | 3f1ddefd8d21decbc018d097d3ec5da4dc9364df | [
"BSD-3-Clause"
] | null | null | null | """
Bento, a pythonic packaging solution for python software.
Bento is a packaging solution which aims at being simple and extensible, using
as little magic as possible. Packages are described in a bento.info file which
has a straightforward syntax, and the packaging is driven through bentomaker,
the command line interfance to bento. Sane API are provided so that people can
build their own deployment facilities on top of it.
The code is currently organized as follows:
- bento.core.parser: ply-based lexer/parser for the format
- bento.core: core facilities to build package representation
- bento.commands: commands as provided by bentomaker
- bento.private: bundled packages
- bento.compat: compatibility code to provide consistent API to all
supported python versions (2.4 -> 2.7 ATM)
"""
import sys
import os
import os.path as op
from bento._config \
import \
USE_PRIVATE_MODULES
# FIXME: there has to be a better way to do this ?
for bundled_pkg in ["_ply", "_simplejson", "_yaku"]:
v = "BENTO_UNBUNDLE%s" % bundled_pkg.upper()
if USE_PRIVATE_MODULES and not os.environ.get(v, False):
m_path = op.join(op.dirname(__file__), "private", bundled_pkg)
if op.exists(m_path):
sys.path.insert(0, m_path)
from bento.core.package import \
PackageDescription, static_representation
from bento.conv import \
distutils_to_package_description
try:
from bento.__dev_version import version as __version__
from bento.__dev_version import git_revision as __git_revision__
except ImportError:
from bento.__version import version as __version__
from bento.__version import git_revision as __git_revision__
| 37.152174 | 78 | 0.749561 | 249 | 1,709 | 4.931727 | 0.51004 | 0.051303 | 0.027687 | 0.030945 | 0.134365 | 0.12215 | 0.12215 | 0 | 0 | 0 | 0 | 0.00361 | 0.189585 | 1,709 | 45 | 79 | 37.977778 | 0.883032 | 0.506144 | 0 | 0 | 0 | 0 | 0.051435 | 0 | 0 | 0 | 0 | 0.022222 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.