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
6b786af4900c32b3cb468c76d7d9ebef9379bab0
369
py
Python
utils/__init__.py
aasseman/mi-prometheus
c655c88cc6aec4d0724c19ea95209f1c2dd6770d
[ "Apache-2.0" ]
null
null
null
utils/__init__.py
aasseman/mi-prometheus
c655c88cc6aec4d0724c19ea95209f1c2dd6770d
[ "Apache-2.0" ]
null
null
null
utils/__init__.py
aasseman/mi-prometheus
c655c88cc6aec4d0724c19ea95209f1c2dd6770d
[ "Apache-2.0" ]
null
null
null
from .app_state import AppState from .param_interface import ParamInterface from .param_registry import MetaSingletonABC, ParamRegistry from .singleton import SingletonMetaClass from .statistics_collector import StatisticsCollector from .time_plot import TimePlot from .worker_utils import forward_step, check_and_set_cuda, recurrent_config_parse from .loss import *
33.545455
82
0.867209
46
369
6.695652
0.673913
0.058442
0
0
0
0
0
0
0
0
0
0
0.100271
369
10
83
36.9
0.927711
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
6b789e28b5150ada623d8613f5e9be124bf3e37f
61
py
Python
larger.py
usha324/python
7aa967b8dac8cd0c466652db448cb7e405821389
[ "bzip2-1.0.6" ]
null
null
null
larger.py
usha324/python
7aa967b8dac8cd0c466652db448cb7e405821389
[ "bzip2-1.0.6" ]
null
null
null
larger.py
usha324/python
7aa967b8dac8cd0c466652db448cb7e405821389
[ "bzip2-1.0.6" ]
null
null
null
n=int(input()) a=(input()for _ in range(n)) print(max(a))
15.25
29
0.590164
12
61
2.916667
0.75
0
0
0
0
0
0
0
0
0
0
0
0.147541
61
3
30
20.333333
0.673077
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
6bc36b40edac738602563cba13dbfad99ec241a9
1,923
py
Python
pages/register_page.py
Emmahgvchbjk/TAU_BDD-Reserved-Selenium-Python
bd36d2fcd7297d8e2ae8ae889bfec0b4fb270e00
[ "MIT" ]
null
null
null
pages/register_page.py
Emmahgvchbjk/TAU_BDD-Reserved-Selenium-Python
bd36d2fcd7297d8e2ae8ae889bfec0b4fb270e00
[ "MIT" ]
null
null
null
pages/register_page.py
Emmahgvchbjk/TAU_BDD-Reserved-Selenium-Python
bd36d2fcd7297d8e2ae8ae889bfec0b4fb270e00
[ "MIT" ]
null
null
null
import time from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC class RegisterPage: #URL URL = "https://www.reserved.com/ro/ro/customer/account/login/#register" #locators EMAIL_FIELD = (By.ID, "email_id") FIRSTNAME_FIELD = (By.ID, "firstname_id") LASTNAME_FIELD = (By.ID, "lastname_id") PASSWORD_FIELD = (By.ID, "password_id") CREATE_ACCOUNT_BUTTON = (By.CSS_SELECTOR, "button[data-selen='create-account-submit']") ACCEPT_COOKIES_BUTTON = (By.ID, 'cookiebotDialogOkButton') WARNING_TEXT = (By.CSS_SELECTOR, 'div.invalid>div') WARNING = "Vă rugăm să introduceți numai caractere valide" def __init__(self, browser): self.browser = browser def load_page(self): self.browser.get(self.URL) self.browser.find_element(*self.ACCEPT_COOKIES_BUTTON).click() def type_email(self, email): self.browser.find_element(*self.EMAIL_FIELD).send_keys(email) def type_firstname(self, firstname): self.browser.find_element(*self.FIRSTNAME_FIELD).send_keys(firstname) def type_lastname(self, lastname): self.browser.find_element(*self.LASTNAME_FIELD).send_keys(lastname) def type_password(self, password): self.browser.find_element(*self.PASSWORD_FIELD).send_keys(password) def click_create_account_button(self): WebDriverWait(self.browser, 10).until(EC.element_to_be_clickable(self.CREATE_ACCOUNT_BUTTON)).click() def is_warning_displayed(self, warning): assert warning in self.browser.find_element(*self.WARNING_TEXT).text def login(self, email, firstname, lastname, password): self.type_email(email) self.type_firstname(firstname) self.type_lastname(lastname) self.type_password(password) self.click_create_account_button()
36.283019
109
0.726469
249
1,923
5.373494
0.305221
0.082212
0.067265
0.098655
0.116592
0
0
0
0
0
0
0.001242
0.162767
1,923
52
110
36.980769
0.829814
0.00572
0
0
0
0
0.120942
0.034031
0
0
0
0
0.027027
1
0.243243
false
0.135135
0.108108
0
0.621622
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
6bce7bb94b49db97ad7c387e9e6f3e0828df3a8c
8,863
py
Python
test_naive_priority_queue.py
jillhubbard/cs261-priority-queue
76e7854d474118340d0d5e1c23c7e063fb4c9f1b
[ "FSFAP" ]
null
null
null
test_naive_priority_queue.py
jillhubbard/cs261-priority-queue
76e7854d474118340d0d5e1c23c7e063fb4c9f1b
[ "FSFAP" ]
null
null
null
test_naive_priority_queue.py
jillhubbard/cs261-priority-queue
76e7854d474118340d0d5e1c23c7e063fb4c9f1b
[ "FSFAP" ]
null
null
null
# DO NOT MODIFY THIS FILE # Run me via: python3 -m unittest test_naive_priority_queue import unittest import time from naive_priority_queue import NaivePriorityQueue from job import Job class TestNaivePriorityQueue(unittest.TestCase): """ Initialization """ def test_instantiation(self): """ A NaivePriorityQueue exists. """ try: NaivePriorityQueue() except NameError: self.fail("Could not instantiate NaivePriorityQueue.") # def test_internal(self): # """ # A NaivePriorityQueue uses a list to store its data. # """ # pq = NaivePriorityQueue() # self.assertEqual(list, type(pq.data)) # def test_enqueue_one_internal(self): # """ # Enqueueing a value adds it to the internal list. # """ # pq = NaivePriorityQueue() # j = Job(5, 'The') # pq.enqueue(j) # self.assertEqual(j, pq.data[0]) # def test_enqueue_two_internal(self): # """ # Enqueueing two values results in the first enqueued value being the first # one in the list, and the second value being the last one in the list. # """ # pq = NaivePriorityQueue() # first = Job(5, 'new') # second = Job(6, 'moon') # pq.enqueue(first) # pq.enqueue(second) # self.assertEqual(first, pq.data[0]) # self.assertEqual(second, pq.data[1]) # def test_enqueue_three_internal(self): # """ # Enqueueing three values results in the first enqueued value being the first # one in the list, and the third value being the last one in the list. # """ # pq = NaivePriorityQueue() # first = Job(5, 'rode') # second = Job(6, 'high') # third = Job(7, 'in') # pq.enqueue(first) # pq.enqueue(second) # pq.enqueue(third) # self.assertEqual(first, pq.data[0]) # self.assertEqual(second, pq.data[1]) # self.assertEqual(third, pq.data[2]) # def test_dequeue_one(self): # """ # Dequeuing from a single-element queue returns the single value. # """ # pq = NaivePriorityQueue() # j = Job(5, 'the') # pq.enqueue(j) # self.assertEqual(j, pq.dequeue()) # def test_dequeue_one_internal(self): # """ # Dequeuing from a single-element queue removes it from the internal list. # """ # pq = NaivePriorityQueue() # job = Job(5, 'crown') # pq.enqueue(job) # self.assertEqual(1, len(pq.data)) # _ = pq.dequeue() # self.assertEqual(0, len(pq.data)) # # Hint: NaivePriorityQueues perform a linear search. Don't optimize. # def test_dequeue_two(self): # """ # Dequeuing from a two-element queue returns the one with highest priority. # """ # pq = NaivePriorityQueue() # lower_priority = Job(1, 'of') # higher_priority = Job(3, 'the') # pq.enqueue(higher_priority) # pq.enqueue(lower_priority) # self.assertEqual(higher_priority, pq.dequeue()) # def test_dequeue_two_internal(self): # """ # Dequeuing from a two-element queue removes the job with the highest # priority from the list. # """ # pq = NaivePriorityQueue() # lower_priority = Job(1, 'metropolis') # higher_priority = Job(3, 'shining') # pq.enqueue(higher_priority) # pq.enqueue(lower_priority) # _ = pq.dequeue() # self.assertEqual(lower_priority, pq.data[0]) # self.assertEqual(1, len(pq.data)) # def test_dequeue_three(self): # """ # Dequeuing from a three-element queue returns the jobs with the highest # priority. # """ # pq = NaivePriorityQueue() # lower_priority = Job(1, 'like') # middle_priority = Job(3, 'who') # higher_priority = Job(5, 'on') # pq.enqueue(higher_priority) # pq.enqueue(lower_priority) # pq.enqueue(middle_priority) # self.assertEqual(higher_priority, pq.dequeue()) # self.assertEqual(middle_priority, pq.dequeue()) # self.assertEqual(lower_priority, pq.dequeue()) # def test_dequeue_three_internal(self): # """ # Dequeuing from a three-element queue removes each dequeued value from # the internal list, highest-priority first. # """ # pq = NaivePriorityQueue() # lower_priority = Job(1, 'top') # middle_priority = Job(3, 'of') # higher_priority = Job(5, 'this') # pq.enqueue(higher_priority) # pq.enqueue(lower_priority) # pq.enqueue(middle_priority) # _ = pq.dequeue() # self.assertEqual(lower_priority, pq.data[0]) # _ = pq.dequeue() # self.assertEqual(lower_priority, pq.data[0]) # """ # Emptiness # """ # def test_empty(self): # """ # A queue is initially empty. # """ # pq = NaivePriorityQueue() # self.assertTrue(pq.is_empty()) # def test_not_empty(self): # """ # A queue with one enqueued value is not empty. # """ # pq = NaivePriorityQueue() # pq.enqueue(Job(1, 'People')) # self.assertFalse(pq.is_empty()) # def test_empty_after_dequeue(self): # """ # A queue with one enqueued value is empty after dequeuing. # """ # pq = NaivePriorityQueue() # pq.enqueue(Job(1, 'was')) # _ = pq.dequeue() # self.assertTrue(pq.is_empty()) # def test_not_empty_multiple(self): # """ # A queue with two enqueued values is not empty after dequeuing only one. # """ # pq = NaivePriorityQueue() # pq.enqueue(Job(1, 'hustling')) # pq.enqueue(Job(3, 'arguing and bustling')) # _ = pq.dequeue() # self.assertFalse(pq.is_empty()) # def test_initial_dequeue(self): # """ # Dequeuing from an empty queue returns None. # """ # pq = NaivePriorityQueue() # self.assertIsNone(pq.dequeue()) # """ # Algorithmic complexity # """ # def test_enqueue_efficiency(self): # """ # Enqueing a value is always O(1). # """ # time_samples = [] # for _ in range(0, 1000): # pq = NaivePriorityQueue() # start_time = time.time() # pq.enqueue('fake') # end_time = time.time() # time_samples.append(end_time - start_time) # small_average_enqueue_time = sum(time_samples) / float(len(time_samples)) # large_queue = NaivePriorityQueue() # for _ in range(0, 1000000): # large_queue.enqueue('fake') # large_time_samples = [] # for _ in range(0, 1000): # start_time = time.time() # large_queue.enqueue('fake') # end_time = time.time() # large_time_samples.append(end_time - start_time) # large_average_enqueue_time = sum(large_time_samples) / float(len(large_time_samples)) # self.assertAlmostEqual(small_average_enqueue_time, large_average_enqueue_time, delta=small_average_enqueue_time) # # While enqueing naively is efficient... what is the complexity of dequeuing? # def test_dequeue_efficiency(self): # """ # Dequeuing a value is O(n). # """ # print("This test will take a while...") # See the comment below. # time_samples = [] # for _ in range(0, 1000): # pq = NaivePriorityQueue() # pq.enqueue('fake') # start_time = time.time() # pq.dequeue() # end_time = time.time() # time_samples.append(end_time - start_time) # small_average_dequeue_time = sum(time_samples) / float(len(time_samples)) # large_queue = NaivePriorityQueue() # for _ in range(0, 1000000): # large_queue.enqueue('fake') # large_time_samples = [] # for _ in range(0, 1000): # start_time = time.time() # large_queue.dequeue() # end_time = time.time() # large_time_samples.append(end_time - start_time) # large_average_dequeue_time = sum(large_time_samples) / float(len(large_time_samples)) # self.assertNotAlmostEqual(small_average_dequeue_time, large_average_dequeue_time, delta=small_average_dequeue_time) # Notice how the last test takes time to "prove." # By studying *algorithm analysis*, you can prove the efficiency deductively, # with formal proofs, rather than with long-running tests. def fake_value(): return f"FAKE {time.time()}" if __name__ == '__main__': unittest.main()
33.828244
125
0.576329
983
8,863
5.019329
0.185148
0.043778
0.024321
0.021889
0.569315
0.5227
0.454195
0.38407
0.3409
0.279692
0
0.011645
0.302381
8,863
261
126
33.957854
0.78635
0.801647
0
0
0
0
0.044459
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0.071429
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
6bfc078337cbbee9927dc195850691e92ba9a858
938
py
Python
generate_inv.py
jwechsler10/openshift-ansible-automation
a1df665556ec4e34803ba3af3b3310bc8897b66e
[ "MIT" ]
null
null
null
generate_inv.py
jwechsler10/openshift-ansible-automation
a1df665556ec4e34803ba3af3b3310bc8897b66e
[ "MIT" ]
null
null
null
generate_inv.py
jwechsler10/openshift-ansible-automation
a1df665556ec4e34803ba3af3b3310bc8897b66e
[ "MIT" ]
null
null
null
import yaml # Get the name/IP of the node to update def get_node_name(): node_name=raw_input("Enter the IP address or hostname of the node you wish to update: ") return node_name # Get ansible ssh user def get_ssh_user(): ssh_name=raw_input("Enter ansible ssh username: ") return ssh_name # Get ansible ssh password def get_ssh_pw(): ssh_pw=raw_input("Enter ansible ssh password: ") return ssh_pw # Create the inventory file in .yml format def generate_inventory_file(node_name, ssh_name, ssh_pw): inv = {'to_update': {'hosts': node_name, 'vars': {'ansible_ssh_user': ssh_name, 'ansible_ssh_pass': ssh_pw}}} with open('hosts', 'w') as outfile: yaml.dump(inv, outfile, default_flow_style=False) #call get name and generate file def main(): node_name = get_node_name() ssh_name = get_ssh_user() ssh_pw = get_ssh_pw() generate_inventory_file(node_name, ssh_name, ssh_pw) if __name__ == "__main__": main()
28.424242
111
0.735608
157
938
4.063694
0.324841
0.100313
0.061129
0.070533
0.200627
0.128527
0.128527
0.128527
0.128527
0
0
0
0.157783
938
32
112
29.3125
0.807595
0.165245
0
0
0
0
0.238095
0
0
0
0
0
0
1
0.238095
false
0.095238
0.047619
0
0.428571
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
6bffa50bd5a7ebc0be71f27da86fc0ec50324159
1,130
py
Python
CTCBestPath.py
ontaev/Todo_HTR_torch
4e7a95a206ef2466d8acb8461401016a38c46928
[ "BSD-3-Clause" ]
2
2020-01-23T14:42:08.000Z
2021-12-13T08:26:32.000Z
CTCBestPath.py
ontaev/Todo_HTR_torch
4e7a95a206ef2466d8acb8461401016a38c46928
[ "BSD-3-Clause" ]
null
null
null
CTCBestPath.py
ontaev/Todo_HTR_torch
4e7a95a206ef2466d8acb8461401016a38c46928
[ "BSD-3-Clause" ]
2
2021-06-19T16:01:55.000Z
2021-12-13T08:25:23.000Z
# ----------------------------------------------------------------- # # This code was taken from github repo: # # "Connectionist Temporal Classification (CTC) decoding algorithms" # # developed by Harald Scheidl # # https://github.com/githubharald/CTCDecoder/ # # Copyright (c) 2018 Harald Scheidl # # ----------------------------------------------------------------- # from __future__ import division from __future__ import print_function from itertools import groupby import numpy as np def ctcBestPath(mat, classes): "implements best path decoding as shown by Graves (Dissertation, p63)" # get char indices along best path best_path = np.argmax(mat, axis=1) # collapse best path (using itertools.groupby), map to chars, join char list to string blank_idx = 0 # index of CTC BLANK character (in original repo: blank_idx = len(classes)) best_chars_collapsed = [classes[k] for k, _ in groupby(best_path) if k != blank_idx] res = ''.join(best_chars_collapsed) return res
45.2
93
0.567257
122
1,130
5.098361
0.614754
0.064309
0.051447
0
0
0
0
0
0
0
0
0.009467
0.252212
1,130
25
94
45.2
0.726627
0.646018
0
0
0
0
0.15011
0
0
0
0
0
0
1
0.090909
false
0
0.363636
0
0.545455
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
0
0
0
0
1
0
1
0
0
2
d41092d4f0ef51e882cd11083635efbed45c6b67
1,016
py
Python
tools/generate_mesh_from_params.py
emiliopomares/flow-separation-prediction
ca4585a8263cd5933889fbd763154e2f3851969a
[ "MIT" ]
null
null
null
tools/generate_mesh_from_params.py
emiliopomares/flow-separation-prediction
ca4585a8263cd5933889fbd763154e2f3851969a
[ "MIT" ]
null
null
null
tools/generate_mesh_from_params.py
emiliopomares/flow-separation-prediction
ca4585a8263cd5933889fbd763154e2f3851969a
[ "MIT" ]
null
null
null
#import sys #if __name__ == "__main__": # # print(f"Arguments count: {len(sys.argv)}") # for i, arg in enumerate(sys.argv): # print(f"Argument {i:>6}: {arg}") # # parameters: # # 1 - Design coefficient of lift (real, 0.05 to 1) # 2 - Camber position & refex (integer, 1 to 9) # 3 - Thickness (real, 1 to 30) # 4 - distance to inlet (real, 1-??) # 5 - distance to outlet (real, 1-??) # 6 - Angle of response? attack? (0-60) #def print_usage(): # print(f"Usage: {sys.argv[0]} <dc> <cpr> <thick> <din> <dout> <aa>") # print("") # print("Where ") # print(" <dc>: Desgien coefficient of list (0.05 to 1)") # print(" <cpr>: Camber position & refex (integer, 1 to 9)") # print(" <thick>: Thickness (1 to 30)") # print(" <din>: Distance to inlet (1-20)") # print(" <dout>: Distance to outlet (1-20)") # print(" <aa>: Angle of attack (0-60)") # print("") #def generate_airfoil_points(fc, cpr, thick, npoints=101): # result = [] # for i in range(npoints): #if len(sys.argv) < 7: # print_usage()
25.4
69
0.595472
156
1,016
3.801282
0.429487
0.047218
0.033727
0.020236
0.10118
0.10118
0.10118
0
0
0
0
0.053724
0.193898
1,016
39
70
26.051282
0.67033
0.92815
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
d41cd55c299d942e91893f67a7412f31a996bc78
94
py
Python
Largest So Far Number.py
KunalRRathod/PythonPrograms
351e2fca5a5a116f709352e3576d8dc0fe41908b
[ "MIT" ]
2
2019-11-11T16:46:38.000Z
2021-03-27T15:46:22.000Z
Largest So Far Number.py
KunalRRathod/Python-Programs
351e2fca5a5a116f709352e3576d8dc0fe41908b
[ "MIT" ]
null
null
null
Largest So Far Number.py
KunalRRathod/Python-Programs
351e2fca5a5a116f709352e3576d8dc0fe41908b
[ "MIT" ]
null
null
null
zork = 0 for thing in [9, 41, 12, 3, 74, 15] : zork = zork + thing print('After', zork)
23.5
38
0.553191
17
94
3.058824
0.764706
0
0
0
0
0
0
0
0
0
0
0.161765
0.276596
94
4
39
23.5
0.602941
0
0
0
0
0
0.054348
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d44984ac2f7b69e79ec567951a4a6a80bf18680d
1,643
py
Python
algorithims.py
ParksBra/Sorting
71e119c856075d057f42367812c06d8635961a19
[ "MIT" ]
null
null
null
algorithims.py
ParksBra/Sorting
71e119c856075d057f42367812c06d8635961a19
[ "MIT" ]
null
null
null
algorithims.py
ParksBra/Sorting
71e119c856075d057f42367812c06d8635961a19
[ "MIT" ]
null
null
null
"""Hold algorithms for UI.py.""" from random import shuffle def insertion_sort(input_list, r): """Use insertion sort on list.""" if r: for i in range(len(input_list) - 1): if input_list[i] < input_list[i + 1]: input_list[i], input_list[i + 1] = \ input_list[i + 1], input_list[i] else: for i in range(len(input_list) - 1): if input_list[i] > input_list[i + 1]: input_list[i], input_list[i + 1] = \ input_list[i + 1], input_list[i] return input_list def selection_sort(input_list, iteration, r): """Use selection sort on list.""" if r: iteration = len(input_list) - 1 - iteration lowest = input_list[iteration] lowest_index = iteration for i in range(iteration, 0, -1): if input_list[i - 1] < lowest: lowest = input_list[i - 1] lowest_index = i - 1 input_list[iteration], input_list[lowest_index] = input_list[lowest_index], input_list[iteration] else: lowest = input_list[iteration] lowest_index = iteration for i in range(iteration, len(input_list) - 1): if input_list[i + 1] < lowest: lowest = input_list[i + 1] lowest_index = i + 1 input_list[iteration], input_list[lowest_index] = input_list[lowest_index], input_list[iteration] return input_list def bogo_sort(input_list): """Use bogo soort on list.""" shuffle(input_list) return input_list if __name__ == "__main__": print("Use 'UI.py' to run this program.")
32.86
105
0.58308
225
1,643
4.008889
0.173333
0.36918
0.177384
0.121951
0.685144
0.631929
0.631929
0.631929
0.618625
0.618625
0
0.015762
0.30493
1,643
49
106
33.530612
0.774081
0.064516
0
0.513514
0
0
0.026385
0
0
0
0
0
0
1
0.081081
false
0
0.027027
0
0.189189
0.027027
0
0
0
null
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d45938acee8b953e163f6872ab80054014f67de9
2,017
py
Python
data/train/python/d45938acee8b953e163f6872ab80054014f67de9fabfile.py
harshp8l/deep-learning-lang-detection
2a54293181c1c2b1a2b840ddee4d4d80177efb33
[ "MIT" ]
84
2017-10-25T15:49:21.000Z
2021-11-28T21:25:54.000Z
data/train/python/d45938acee8b953e163f6872ab80054014f67de9fabfile.py
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
5
2018-03-29T11:50:46.000Z
2021-04-26T13:33:18.000Z
data/train/python/d45938acee8b953e163f6872ab80054014f67de9fabfile.py
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
24
2017-11-22T08:31:00.000Z
2022-03-27T01:22:31.000Z
# -*- coding: utf-8 -*- # ROTD suggest a recipe to cook for dinner, changing the recipe every day. # Copyright © 2015 Xeryus Stokkel # ROTD is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # ROTD 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 Affero General Public # License for more details. # You should have received a copy of the GNU General Public License # along with ROTD. If not, see <http://www.gnu.org/licenses/>. from fabric.api import env, run def _get_base_folder(host): return '/var/www/sites/' + host def _get_manage_py(host): command = ('export $(cat /etc/www/gunicorn-{host}|xargs) && ' '{path}/virtualenv/bin/python {path}/source/manage.py '.format( host=host, path=_get_base_folder(host))) return command def reset_database(): run('{manage} flush --noinput'.format(manage=_get_manage_py(env.host))) def create_admin_on_server(username, password, email): run('{manage} create_admin {username} {password} {email}'.format( manage=_get_manage_py(env.host), username=username, password=password, email=email)) def create_testrecipe_on_server(name): slug = run('{manage} create_testrecipe {name}'.format( manage=_get_manage_py(env.host), name=name)) print(slug) def create_ingredient(name, type): pk = run('{manage} create_ingredient {name} -t {type}'.format(name=name, manage=_get_manage_py(env.host), type=type)) print(pk) def add_ingredient_to_recipe(pk, slug, quantity): command = '{manage} add_ingredient_to_recipe {pk} {slug} -q {quantity}' name = run(command.format(pk=pk, slug=slug, quantity=quantity, manage=_get_manage_py(env.host))) print(name)
38.788462
78
0.714923
298
2,017
4.704698
0.439597
0.039943
0.047076
0.060628
0.215407
0.182596
0.064194
0
0
0
0
0.00358
0.169063
2,017
51
79
39.54902
0.832339
0.359941
0
0
0
0
0.255286
0.083007
0
0
0
0
0
1
0.259259
false
0.111111
0.037037
0.037037
0.37037
0.111111
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
d484117d760cdb12d8363852a4a6c1f5f0065e7a
1,405
py
Python
tests/test_parser.py
seanbreckenridge/greasyfork_archive
24750f74c5729f32f18cee0b7b14311950276a6d
[ "MIT" ]
2
2020-04-01T03:23:52.000Z
2021-04-24T22:45:38.000Z
tests/test_parser.py
seanbreckenridge/greasyfork_archive
24750f74c5729f32f18cee0b7b14311950276a6d
[ "MIT" ]
1
2020-03-26T01:17:55.000Z
2020-03-26T01:33:53.000Z
tests/test_parser.py
seanbreckenridge/greasyfork_archive
24750f74c5729f32f18cee0b7b14311950276a6d
[ "MIT" ]
null
null
null
import os import json from unittest.mock import patch import pytest import vcr from greasyfork_archive import main_wrapper this_dir = os.path.abspath(os.path.dirname(__file__)) out_file = os.path.join(this_dir, "out.json") @patch("time.sleep", return_value=None) @vcr.use_cassette("tests/vcr_cassettes/response.yaml") def test_response(patched_sleep): main_wrapper(96096, out_file) with open(out_file) as json_dump: jscripts = json.load(json_dump) scripts = jscripts["greasyfork_scripts"] assert isinstance(scripts, list) assert len(scripts) == 20 first_entry = scripts[0] assert first_entry["script_id"] == 26678 assert first_entry["script_name"] == "MyAnimeList Remove Unnecessary Spacing" assert first_entry["daily_installs"] == 1 assert first_entry["total_installs"] == 109 assert first_entry["rating_score"] == 5.0 assert first_entry["created_date"] == '2017-01-19' assert first_entry["updated_date"] == '2019-02-01' assert first_entry["script_type"] == 'public' assert first_entry["script_version"] == "1.0.3" assert first_entry["sensitive"] == False assert first_entry["language"] == 'js' assert first_entry["css_available_as_js"] == False assert first_entry["url"] == 'https://greasyfork.org/en/scripts/26678-myanimelist-remove-unnecessary-spacing' assert ".user-profile-about" in first_entry["code"]
35.125
113
0.723843
193
1,405
5.025907
0.487047
0.154639
0.214433
0.090722
0.084536
0
0
0
0
0
0
0.035833
0.145907
1,405
39
114
36.025641
0.7725
0
0
0
0
0
0.277263
0.023521
0
0
0
0
0.5
1
0.03125
false
0
0.1875
0
0.21875
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
1
0
0
0
0
0
0
0
0
0
2
2e17cedf86b56faca30238f4e7a2c8de1db153bf
915
py
Python
mapper.py
prasunroy/air-writing
dbfc4e33188311ad9d5f616a43694e47a7abaf03
[ "MIT" ]
3
2018-05-18T11:59:36.000Z
2019-02-01T23:51:26.000Z
mapper.py
prasunroy/air-writing
dbfc4e33188311ad9d5f616a43694e47a7abaf03
[ "MIT" ]
null
null
null
mapper.py
prasunroy/air-writing
dbfc4e33188311ad9d5f616a43694e47a7abaf03
[ "MIT" ]
6
2018-09-04T21:12:07.000Z
2021-02-16T03:04:15.000Z
# -*- coding: utf-8 -*- """ Label mapping. Created on Tue May 15 22:00:00 2018 Author: Prasun Roy | CVPRU-ISICAL (http://www.isical.ac.in/~cvpr) GitHub: https://github.com/prasunroy/air-writing """ # English numerals map2ascii_en_numbers = { 0: 48, 1: 49, 2: 50, 3: 51, 4: 52, 5: 53, 6: 54, 7: 55, 8: 56, 9: 57 } # Bengali numerals map2unicode_bn_numbers = { 0: '\u09e6', 1: '\u09e7', 2: '\u09e8', 3: '\u09e9', 4: '\u09ea', 5: '\u09eb', 6: '\u09ec', 7: '\u09ed', 8: '\u09ee', 9: '\u09ef' } # Devanagari numerals map2unicode_dv_numbers = { 0: '\u0966', 1: '\u0967', 2: '\u0968', 3: '\u0969', 4: '\u096a', 5: '\u096b', 6: '\u096c', 7: '\u096d', 8: '\u096e', 9: '\u096f' }
17.596154
65
0.43388
107
915
3.654206
0.728972
0.061381
0
0
0
0
0
0
0
0
0
0.219469
0.382514
915
51
66
17.941176
0.472566
0.264481
0
0
0
0
0.181543
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
2e1e64106d1655c54f950214f2e56c8b930e7f9c
737
py
Python
FAS/__init__.py
mra1385/FindAStation
784bd38ab82a5f3d4524c359874d52ed0c39fc15
[ "MIT" ]
null
null
null
FAS/__init__.py
mra1385/FindAStation
784bd38ab82a5f3d4524c359874d52ed0c39fc15
[ "MIT" ]
null
null
null
FAS/__init__.py
mra1385/FindAStation
784bd38ab82a5f3d4524c359874d52ed0c39fc15
[ "MIT" ]
null
null
null
from flask import Flask from . import config app = Flask("FAS") app.config.from_object(config) from FAS import views # # For error logging when debugging is False # if not app.debug: # import logging # from logging.handlers import RotatingFileHandler # file_handler = RotatingFileHandler('API/tmp/{}.log'.format(app.config['APP_NAME']), # 'a', 1 * 1024 * 1024, 10) # file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: ' # '%(message)s [in %(pathname)s:%(lineno)d]')) # app.logger.setLevel(logging.INFO) # file_handler.setLevel(logging.INFO) # app.logger.addHandler(file_handler) # app.logger.info('{} startup'.format(app.config['APP_NAME']))
35.095238
89
0.662144
93
737
5.172043
0.494624
0.091476
0.06237
0.074844
0.091476
0
0
0
0
0
0
0.018425
0.189959
737
20
90
36.85
0.78727
0.800543
0
0
0
0
0.022727
0
0
0
0
0
0
1
0
false
0
0.6
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
2e2457a86a7a291f356badf48d0877667350459d
1,166
py
Python
satchmo/apps/satchmo_store/accounts/signals.py
predatell/satchmo
6ced1f845aadec240c7e433c3cbf4caca96e0d92
[ "BSD-3-Clause" ]
16
2015-03-06T14:42:27.000Z
2019-12-23T21:37:01.000Z
satchmo/apps/satchmo_store/accounts/signals.py
predatell/satchmo
6ced1f845aadec240c7e433c3cbf4caca96e0d92
[ "BSD-3-Clause" ]
null
null
null
satchmo/apps/satchmo_store/accounts/signals.py
predatell/satchmo
6ced1f845aadec240c7e433c3cbf4caca96e0d92
[ "BSD-3-Clause" ]
8
2015-01-28T16:02:37.000Z
2022-03-03T21:29:40.000Z
import django.dispatch #: Sent after a user has registered an account with the store. #: #: :param sender: The form which was submitted. #: :type sender: ``satchmo_store.accounts.forms.RegistrationForm`` #: #: :param contact: The contact that was saved to the database. #: :type contact: ``satchmo_store.contact.models.Contact`` #: #: :param subscribed: A boolean reflecting whether or not the user subscribed #: to a newsletter #: #: :default: False #: #: :param data: The ``cleaned_data`` dictionary of the submitted form. satchmo_registration = django.dispatch.Signal() #: Sent after a user account has been verified. This signal is also sent right #: after an account is created if account verification is disabled. #: #: :param sender: An instance of ``satchmo_store.models.Contact`` if the account #: was verified via email (Note: this is the same argument as ``contact``), or #: an instance of ``satchmo_store.accounts.forms.RegistrationForm`` if account #: verification is disabled. #: #: :param contact: The contact that was registered. #: :type contact: ``satchmo_store.models.Contact`` satchmo_registration_verified = django.dispatch.Signal()
38.866667
80
0.74271
157
1,166
5.458599
0.401274
0.070012
0.023337
0.032672
0.283547
0.145858
0
0
0
0
0
0
0.144082
1,166
29
81
40.206897
0.858717
0.847341
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
2e3d6e039a8d0a29d9ea06d3c009fb855cdadd6f
2,671
py
Python
examples/old-examples/GLWindow/conways_game_of_life_texel_fetch.py
asnt/moderngl
b39cedd8cf216c34e43371b4aec822f6084f0f79
[ "MIT" ]
96
2020-01-13T00:54:02.000Z
2022-02-13T10:07:43.000Z
examples/old-examples/GLWindow/conways_game_of_life_texel_fetch.py
asnt/moderngl
b39cedd8cf216c34e43371b4aec822f6084f0f79
[ "MIT" ]
null
null
null
examples/old-examples/GLWindow/conways_game_of_life_texel_fetch.py
asnt/moderngl
b39cedd8cf216c34e43371b4aec822f6084f0f79
[ "MIT" ]
17
2020-02-04T01:56:07.000Z
2022-02-10T19:06:56.000Z
import struct import numpy import GLWindow import ModernGL # This example is not working with NPOT Textures width, height = 640, 460 pixels = numpy.round(numpy.random.rand(width, height)).astype('float32') grid = numpy.dstack(numpy.mgrid[0:height, 0:width][::-1]).astype('int32') wnd = GLWindow.create_window(width, height) ctx = ModernGL.create_context() prog = ctx.program( ctx.vertex_shader(''' #version 330 in vec2 vert; out vec2 text; void main() { text = vert; gl_Position = vec4((vert * 2.0 - 1.0) * 1, 0.0, 1.0); } '''), ctx.fragment_shader(''' #version 330 uniform sampler2D Texture; in vec2 text; out vec4 color; void main() { color = texture(Texture, text); } '''), ]) trans = ctx.program( ctx.vertex_shader(''' #version 330 uniform sampler2D Texture; uniform int Width; uniform int Height; in ivec2 text; out float vert; #define LIVING 0.0 #define DEAD 1.0 bool cell(int x, int y) { return texelFetch(Texture, ivec2((x + Width) % Width, (y + Height) % Height), 0).r < 0.5; } void main() { bool living = cell(text.x, text.y); int neighbours = 0; if (cell(text.x - 1, text.y - 1)) neighbours++; if (cell(text.x - 1, text.y + 0)) neighbours++; if (cell(text.x - 1, text.y + 1)) neighbours++; if (cell(text.x + 1, text.y - 1)) neighbours++; if (cell(text.x + 1, text.y + 0)) neighbours++; if (cell(text.x + 1, text.y + 1)) neighbours++; if (cell(text.x + 0, text.y + 1)) neighbours++; if (cell(text.x + 0, text.y - 1)) neighbours++; if (living) { vert = (neighbours == 2 || neighbours == 3) ? LIVING : DEAD; } else { vert = (neighbours == 3) ? LIVING : DEAD; } } '''), varyings=['vert'] ) trans.uniforms['Width'].value = width trans.uniforms['Height'].value = height texture = ctx.texture((width, height), 1, pixels.tobytes(), floats=True) texture.filter = ModernGL.NEAREST texture.swizzle = 'RRR1' texture.use() vbo = ctx.buffer(struct.pack('8f', 0, 0, 0, 1, 1, 0, 1, 1)) vao = ctx.simple_vertex_array(prog, vbo, ['vert']) text = ctx.buffer(grid.tobytes()) tao = ctx.simple_vertex_array(trans, text, ['text']) pbo = ctx.buffer(reserve=pixels.nbytes) while wnd.update(): ctx.viewport = wnd.viewport tao.transform(pbo) texture.write(pbo) vao.render(ModernGL.TRIANGLE_STRIP)
25.198113
101
0.552602
343
2,671
4.271137
0.306122
0.049147
0.05529
0.060068
0.244369
0.244369
0.202048
0.154266
0.154266
0.154266
0
0.041534
0.296893
2,671
105
102
25.438095
0.738552
0
0
0.166667
0
0.025641
0.601982
0
0
0
0
0
0
0
null
null
0
0.051282
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
2e4ce2e620b29b7058181982a063062ae6e6a96e
269
py
Python
profutil.py
ahmedelmasri/twitter-analyzer
d7f14f646a0a3005c497d70227ac1cfffb85ef52
[ "MIT" ]
null
null
null
profutil.py
ahmedelmasri/twitter-analyzer
d7f14f646a0a3005c497d70227ac1cfffb85ef52
[ "MIT" ]
null
null
null
profutil.py
ahmedelmasri/twitter-analyzer
d7f14f646a0a3005c497d70227ac1cfffb85ef52
[ "MIT" ]
1
2020-04-26T04:35:48.000Z
2020-04-26T04:35:48.000Z
#!/usr/bin/env python # coding: utf-8 def write_tweet_tfile(file_to_populate, text): file_handler = open(file_to_populate,"a+") file_handler.writelines(text) file_handler.close() def strip_token(myword, chars_token): return myword.strip(chars_token)
22.416667
48
0.743494
40
269
4.7
0.625
0.175532
0.148936
0
0
0
0
0
0
0
0
0.00431
0.137546
269
11
49
24.454545
0.806034
0.126394
0
0
0
0
0.008584
0
0
0
0
0
0
1
0.333333
false
0
0
0.166667
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
0
0
1
0
0
0
2
2e5ef69b9accf879cd3252be8db6d3d6a12432c0
872
py
Python
notes/2018-05-14-single-view-continuous-svd/calculations/svd2.py
talonchandler/polharmonic
2aa3ca984e11050f901579b8eaa45a3a61d07957
[ "MIT" ]
null
null
null
notes/2018-05-14-single-view-continuous-svd/calculations/svd2.py
talonchandler/polharmonic
2aa3ca984e11050f901579b8eaa45a3a61d07957
[ "MIT" ]
null
null
null
notes/2018-05-14-single-view-continuous-svd/calculations/svd2.py
talonchandler/polharmonic
2aa3ca984e11050f901579b8eaa45a3a61d07957
[ "MIT" ]
null
null
null
from sympy import * # hlmn convention # Symbolic # H000 = Symbol('H000') # H002 = Symbol('H002') # H00_2 = Symbol('H00_2') # H200 = Symbol('H200') # H202 = Symbol('H202') # H20_2 = Symbol('H20_2') # H222 = Symbol('H222') # H400 = Symbol('H400') # H402 = Symbol('H402') # H40_2 = Symbol('H40_2') # H422 = Symbol('H422') A = Symbol('A') B = Symbol('B') C = Symbol('C') H000 = A + B H002 = C H00_2 = C H200 = A + B H202 = C H20_2 = C H222 = A H400 = A - B H402 = C H40_2 = C H422 = A K00 = H00_2**2 + H222**2 + H20_2**2 + H422**2 + H40_2**2 K11 = H000**2 + H200**2 + H400**2 K22 = H002**2 + H222**2 + H202**2 + H422**2 + H402**2 K10 = H00_2*H000 + H20_2*H200 + H40_2*H400 K02 = H00_2*H002 + H20_2*H202 + H40_2*H402 K12 = H000*H002 + H200*H202 + H400*H402 K = Matrix([[K00, K10, K02], [K10, K11, K12], [K02, K12, K22]]) import pdb; pdb.set_trace()
19.818182
56
0.574541
157
872
3.070064
0.210191
0.049793
0.024896
0
0
0
0
0
0
0
0
0.346097
0.22133
872
43
57
20.27907
0.36377
0.311927
0
0
0
0
0.005119
0
0
0
0
0
0
1
0
false
0
0.08
0
0.08
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
2e631dfbd3fa7b954b61de6434c1ea7be90cf621
1,188
py
Python
130.py
wilbertgeng/LintCode_exercise
e7a343b746e98ca3b4bc7b36655af7291f3150db
[ "MIT" ]
null
null
null
130.py
wilbertgeng/LintCode_exercise
e7a343b746e98ca3b4bc7b36655af7291f3150db
[ "MIT" ]
null
null
null
130.py
wilbertgeng/LintCode_exercise
e7a343b746e98ca3b4bc7b36655af7291f3150db
[ "MIT" ]
null
null
null
""" 130. Heapify""" class Solution: """ @param: A: Given an integer array @return: nothing """ def heapify(self, A): # write your code here for i in range(len(A) // 2, -1, -1): self.siftdown(A, i) def siftdown(self, A, k): while k < len(A): son = k if k * 2 + 1 < len(A) and A[k * 2 + 1] < A[son]: son = k * 2 + 1 if k * 2 + 2 < len(A) and A[k * 2 + 2] < A[son]: son = k * 2 + 2 if son == k: break A[son], A[k] = A[k], A[son] k = son for i in range(len(A) // 2, -1, -1): self.siftdown(A, i) def siftdown(self, A, index): n = len(A) while index < n: left = index * 2 + 1 right = index * 2 + 2 minIndex = index if left < n and A[left] < A[minIndex]: minIndex = left if right < n and A[right] < A[minIndex]: minIndex = right if minIndex == index: break A[minIndex], A[index] = A[index], A[minIndex] index = minIndex
25.826087
60
0.402357
160
1,188
2.9875
0.23125
0.050209
0.018828
0.046025
0.280335
0.242678
0.200837
0.200837
0.200837
0.200837
0
0.039246
0.463805
1,188
45
61
26.4
0.711146
0.016835
0
0.193548
0
0
0
0
0
0
0
0.022222
0
0
null
null
0
0
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
2e6f5d84e0c7aadbc5e9c31ca97fa994150687c2
233
py
Python
port_selection.py
aliostad/hexagon-rl
cd4180bda26f92c0bde11a08aa13c825cd151a10
[ "MIT" ]
5
2019-05-30T00:33:20.000Z
2021-05-21T06:42:09.000Z
port_selection.py
aliostad/hexagon-rl
cd4180bda26f92c0bde11a08aa13c825cd151a10
[ "MIT" ]
null
null
null
port_selection.py
aliostad/hexagon-rl
cd4180bda26f92c0bde11a08aa13c825cd151a10
[ "MIT" ]
1
2019-04-01T16:30:02.000Z
2019-04-01T16:30:02.000Z
import os def Select_port(default_port, *args): ''' :type default_port: int :param args: :return: port ''' port = default_port for arg in args: if arg in os.environ: port = int(os.environ[arg]) return port
16.642857
37
0.639485
35
233
4.142857
0.457143
0.227586
0.206897
0
0
0
0
0
0
0
0
0
0.244635
233
14
38
16.642857
0.823864
0.214592
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.428571
0
0
0
0
null
1
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
2e78bd7dc8274a0cbd7a23397e4ba1a5c39604a3
686
py
Python
indy/__init__.py
SusanJoven/digital-identity
27f8cf193a9a17d24a04a258f9cd1529997d0cc7
[ "Apache-2.0" ]
1
2020-06-05T19:17:54.000Z
2020-06-05T19:17:54.000Z
indy/__init__.py
SusanJoven/digital-identity
27f8cf193a9a17d24a04a258f9cd1529997d0cc7
[ "Apache-2.0" ]
null
null
null
indy/__init__.py
SusanJoven/digital-identity
27f8cf193a9a17d24a04a258f9cd1529997d0cc7
[ "Apache-2.0" ]
null
null
null
""" Code provided by Hyperledger Indy (v1.15.0). Use of this source code is governed by a Apache-2.0 license that can be found in the LICENSE file. https://github.com/hyperledger/indy-sdk """ from indy.error import IndyError from indy import anoncreds from indy import blob_storage from indy import crypto from indy import did from indy import ledger from indy import libindy from indy import non_secrets from indy import pairwise from indy import payment from indy import pool from indy import wallet __all__ = [ 'anoncreds', 'blob_storage', 'crypto', 'did', 'ledger', 'libindy', 'non_secrets', 'pairwise', 'payment', 'pool', 'wallet' ]
21.4375
99
0.714286
100
686
4.82
0.47
0.19917
0.319502
0
0
0
0
0
0
0
0
0.010969
0.202624
686
31
100
22.129032
0.870201
0.266764
0
0
0
0
0.160569
0
0
0
0
0
0
1
0
false
0
0.48
0
0.48
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
2e7cc3750ba1a19b0f20e1c1c12faa2e24103c7b
1,807
py
Python
tests/steps/common.py
arenadata/truly_automated_tests
8f578803f1990570d61034014572caee9a02238c
[ "MIT" ]
5
2021-08-25T13:02:51.000Z
2022-03-22T06:47:32.000Z
tests/steps/common.py
arenadata/truly_automated_tests
8f578803f1990570d61034014572caee9a02238c
[ "MIT" ]
null
null
null
tests/steps/common.py
arenadata/truly_automated_tests
8f578803f1990570d61034014572caee9a02238c
[ "MIT" ]
2
2021-10-14T20:58:00.000Z
2022-02-16T17:32:37.000Z
""" Assume step implementation for allure """ from contextlib import suppress from functools import wraps import allure from _pytest.outcomes import Skipped def assume_step(title, exception=None): """ Allows you to suppress exception within the Allure steps. Depending on the type of allowed exception, step will receive different statuses - - Skipped if suppress Skipped (from pytest.skip()) - Failed if suppress AssertionError - Broken if other :param title: same as allure.step() title :param exception: allowed exception Examples: with assume_step('Skipped step'): pytest.skip() with assume_step('Failed step', exception=AssertionError): raise AssertionError("This assert don't fail test") with assume_step('Broken step', exception=ValueError): raise ValueError("This is expected exception") """ if callable(title): return AssumeStepContext(title.__name__, exception)(title) else: return AssumeStepContext(title, exception) class AssumeStepContext: """ Step context class """ def __init__(self, title, exception=None): self.title = title self.exceptions = (Skipped, exception) if exception else Skipped self.allure_cm = allure.step(title) self.suppress = suppress(self.exceptions) def __call__(self, func): @wraps(func) def decorator(*args, **kwargs): with self.suppress: return allure.step(self.title)(func)(*args, **kwargs) return decorator def __enter__(self): return self.allure_cm.__enter__() def __exit__(self, exc_type, exc_val, exc_tb): self.allure_cm.__exit__(exc_type, exc_val, exc_tb) return self.suppress.__exit__(exc_type, exc_val, exc_tb)
28.68254
86
0.679579
215
1,807
5.483721
0.348837
0.042409
0.035623
0.033079
0.052587
0.052587
0.03732
0
0
0
0
0
0.229662
1,807
62
87
29.145161
0.846983
0.368567
0
0
0
0
0
0
0
0
0
0
0
1
0.230769
false
0
0.153846
0.038462
0.653846
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
2e88a08c53a1ca0d25decabf88f94408d7871e25
367
py
Python
app/app/tests.py
ChineduOkoronkwo/recipe-app-api
a8c4d9d8851d4f1480563328439d819c6d3b29e1
[ "MIT" ]
null
null
null
app/app/tests.py
ChineduOkoronkwo/recipe-app-api
a8c4d9d8851d4f1480563328439d819c6d3b29e1
[ "MIT" ]
null
null
null
app/app/tests.py
ChineduOkoronkwo/recipe-app-api
a8c4d9d8851d4f1480563328439d819c6d3b29e1
[ "MIT" ]
null
null
null
from django.test import TestCase from app.calc import add, subtract class CalcTests(TestCase): def test_add_numbers(self): """Test that two numbers are added together""" self.assertEqual(add(3, 8), 11) def test_subtract_numbers(self): """Test that numbers are subtracted and returned""" self.assertEqual(subtract(3, 8), 5)
26.214286
59
0.681199
50
367
4.92
0.54
0.056911
0.121951
0.154472
0
0
0
0
0
0
0
0.024306
0.215259
367
13
60
28.230769
0.829861
0.234332
0
0
0
0
0
0
0
0
0
0
0.285714
1
0.285714
false
0
0.285714
0
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
5ce94eb71877b17ae0b4971c50e46304b06afc61
326
py
Python
NEST/second_level/src/paths.py
late-goodbye/memristive-spinal-cord
f6d7bca154fb4cab503f416fa01b8dc9b0a7d046
[ "MIT" ]
null
null
null
NEST/second_level/src/paths.py
late-goodbye/memristive-spinal-cord
f6d7bca154fb4cab503f416fa01b8dc9b0a7d046
[ "MIT" ]
null
null
null
NEST/second_level/src/paths.py
late-goodbye/memristive-spinal-cord
f6d7bca154fb4cab503f416fa01b8dc9b0a7d046
[ "MIT" ]
null
null
null
import os from pkg_resources import resource_filename results_path = resource_filename('second_level', 'results') raw_data_path = os.path.join(results_path, 'raw_data') img_path = os.path.join(results_path, 'img') spiketimes_path = os.path.join(results_path, 'spiketimes.txt') topologies_path = 'second_level.src.topologies'
36.222222
62
0.803681
48
326
5.145833
0.395833
0.178138
0.121457
0.17004
0.303644
0.303644
0
0
0
0
0
0
0.079755
326
8
63
40.75
0.823333
0
0
0
0
0
0.217791
0.082822
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
cf03bd96e3277ca6a41d85743a5a8dd408e6e6b7
1,051
py
Python
medium/python/c0355_777_swap-adjacent-in-lr-string/00_leetcode_0355.py
drunkwater/leetcode
8cc4a07763e71efbaedb523015f0c1eff2927f60
[ "Ruby" ]
null
null
null
medium/python/c0355_777_swap-adjacent-in-lr-string/00_leetcode_0355.py
drunkwater/leetcode
8cc4a07763e71efbaedb523015f0c1eff2927f60
[ "Ruby" ]
null
null
null
medium/python/c0355_777_swap-adjacent-in-lr-string/00_leetcode_0355.py
drunkwater/leetcode
8cc4a07763e71efbaedb523015f0c1eff2927f60
[ "Ruby" ]
3
2018-02-09T02:46:48.000Z
2021-02-20T08:32:03.000Z
# DRUNKWATER TEMPLATE(add description and prototypes) # Question Title and Description on leetcode.com # Function Declaration and Function Prototypes on leetcode.com #777. Swap Adjacent in LR String #In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL" with "LX", or replacing one occurrence of "RX" with "XR". Given the starting string start and the ending string end, return True if and only if there exists a sequence of moves to transform one string to the other. #Example: #Input: start = "RXXLRXRXL", end = "XRLXXRRLX" #Output: True #Explanation: #We can transform start to end following these steps: #RXXLRXRXL -> #XRXLRXRXL -> #XRLXRXRXL -> #XRLXXRRXL -> #XRLXXRRLX #Note: #1 <= len(start) = len(end) <= 10000. #Both start and end will only consist of characters in {'L', 'R', 'X'}. #class Solution(object): # def canTransform(self, start, end): # """ # :type start: str # :type end: str # :rtype: bool # """ # Time Is Money
36.241379
346
0.694577
150
1,051
4.866667
0.6
0.027397
0.035616
0.065753
0
0
0
0
0
0
0
0.010626
0.194101
1,051
29
347
36.241379
0.85124
0.947669
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
cf08712e7b28fd9c492d3940e92a19846c443d79
2,597
py
Python
systori/apps/user/authorization.py
systori/systori
e309c63e735079ff6032fdaf1db354ec872b28b1
[ "BSD-3-Clause" ]
12
2018-01-30T00:44:06.000Z
2020-07-13T05:20:48.000Z
systori/apps/user/authorization.py
systori/systori
e309c63e735079ff6032fdaf1db354ec872b28b1
[ "BSD-3-Clause" ]
36
2018-03-06T17:49:50.000Z
2020-06-23T19:26:00.000Z
systori/apps/user/authorization.py
systori/systori
e309c63e735079ff6032fdaf1db354ec872b28b1
[ "BSD-3-Clause" ]
3
2018-08-03T07:03:09.000Z
2020-07-09T20:21:10.000Z
from functools import wraps from urllib.parse import urlparse from django.core.exceptions import PermissionDenied from django.shortcuts import resolve_url from django.utils.decorators import available_attrs from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME def owner_auth(view): def is_authorized(request): if not request.user.is_authenticated: return False if request.worker.has_owner: return True raise PermissionDenied return user_passes_test(is_authorized)(view) def office_auth(view): def is_authorized(request): if not request.user.is_authenticated: return False # redirect to login if request.worker.has_staff: return True # all good raise PermissionDenied # logged in but not allowed return user_passes_test(is_authorized)(view) def field_auth(view): def is_authorized(request): if not request.user.is_authenticated: return False # redirect to login if request.worker.has_laborer: return True # all good raise PermissionDenied # logged in but not allowed return user_passes_test(is_authorized)(view) def user_passes_test( test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME ): """ Decorator for views that checks that the user passes the given test, redirecting to the log-in page if necessary. The test should be a callable that takes the user object and returns True if the user passes. """ def decorator(view_func): @wraps(view_func, assigned=available_attrs(view_func)) def _wrapped_view(request, *args, **kwargs): if test_func(request): return view_func(request, *args, **kwargs) path = request.build_absolute_uri() resolved_login_url = resolve_url(login_url or settings.LOGIN_URL) # If the login url is the same scheme and net location then just # use the path as the "next" url. login_scheme, login_netloc = urlparse(resolved_login_url)[:2] current_scheme, current_netloc = urlparse(path)[:2] if (not login_scheme or login_scheme == current_scheme) and ( not login_netloc or login_netloc == current_netloc ): path = request.get_full_path() from django.contrib.auth.views import redirect_to_login return redirect_to_login(path, resolved_login_url, redirect_field_name) return _wrapped_view return decorator
34.626667
83
0.686561
338
2,597
5.06213
0.292899
0.032729
0.039743
0.022794
0.302162
0.302162
0.302162
0.302162
0.279369
0.279369
0
0.001032
0.253754
2,597
74
84
35.094595
0.881837
0.157489
0
0.392157
0
0
0
0
0
0
0
0
0
1
0.176471
false
0.078431
0.156863
0
0.588235
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
cf0bd15b22d35c2baa5b56a4b4ed8c548660e774
93
py
Python
Python/PycharmProjects/modulos e pacotes/uteis/calculos/__init__.py
MarcelaSamili/Desafios-do-curso-de-Python
f331e91821c0c25b3e32d2075254ef650292f280
[ "MIT" ]
null
null
null
Python/PycharmProjects/modulos e pacotes/uteis/calculos/__init__.py
MarcelaSamili/Desafios-do-curso-de-Python
f331e91821c0c25b3e32d2075254ef650292f280
[ "MIT" ]
null
null
null
Python/PycharmProjects/modulos e pacotes/uteis/calculos/__init__.py
MarcelaSamili/Desafios-do-curso-de-Python
f331e91821c0c25b3e32d2075254ef650292f280
[ "MIT" ]
null
null
null
def fatorial(numero): f = 1 for c in range(1, numero +1): f *= c return f
18.6
33
0.505376
16
93
2.9375
0.625
0
0
0
0
0
0
0
0
0
0
0.051724
0.376344
93
5
34
18.6
0.758621
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
cf101007915a3f0cc99d334b546f18a4fa4136ce
2,079
py
Python
tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[fr_BE-2020] 1.py
gour/holidata
89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13
[ "MIT" ]
32
2019-04-12T08:01:34.000Z
2022-02-28T04:41:50.000Z
tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[fr_BE-2020] 1.py
gour/holidata
89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13
[ "MIT" ]
74
2019-07-09T16:35:20.000Z
2022-03-09T16:41:34.000Z
tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[fr_BE-2020] 1.py
gour/holidata
89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13
[ "MIT" ]
20
2019-01-28T07:41:02.000Z
2022-02-16T02:38:57.000Z
[ { 'date': '2020-01-01', 'description': 'Nouvel An', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2020-04-12', 'description': 'Pâques', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2020-04-13', 'description': 'Lundi de Pâques', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2020-05-01', 'description': 'Fête du Travail', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2020-05-21', 'description': 'Ascension', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2020-05-31', 'description': 'Pentecôte', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2020-06-01', 'description': 'Lundi de Pentecôte', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2020-07-21', 'description': 'Fête nationale', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2020-08-15', 'description': 'Assomption', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NRF' }, { 'date': '2020-11-01', 'description': 'Toussaint', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NRF' }, { 'date': '2020-11-11', 'description': "Jour de l'armistice", 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2020-12-25', 'description': 'Noël', 'locale': 'fr-BE', 'notes': '', 'region': '', 'type': 'NRF' } ]
21.214286
45
0.353054
167
2,079
4.39521
0.251497
0.13079
0.163488
0.245232
0.623978
0.623978
0.623978
0.585831
0.585831
0.395095
0
0.078176
0.409331
2,079
98
46
21.214286
0.519544
0
0
0.489796
0
0
0.375481
0
0
0
0
0
0
1
0
true
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
cf113a690d4534363962b384dbf2892ebdc1ed2d
3,304
py
Python
tests/test_util.py
Orion-L/hyparviewpy
40a5b6a53ce5d1f0da6b9be318aac76cb1815f8b
[ "Unlicense" ]
null
null
null
tests/test_util.py
Orion-L/hyparviewpy
40a5b6a53ce5d1f0da6b9be318aac76cb1815f8b
[ "Unlicense" ]
null
null
null
tests/test_util.py
Orion-L/hyparviewpy
40a5b6a53ce5d1f0da6b9be318aac76cb1815f8b
[ "Unlicense" ]
null
null
null
"""Test the hyparviewpy.util module.""" import asyncio import inspect import io import random import unittest from hyparviewpy import util from .tools import async_test class Test_Util(unittest.TestCase): def test_log(self): """Test the debug logger.""" f = io.StringIO('') log = util.Log(f, False) util._out_fh = f log.write('hello world') self.assertEqual(f.getvalue(), '') log = util.Log(f, True) log.write('hello world') self.assertEqual(f.getvalue(), 'hello world') def test_unpack_data(self): """Test the util.unpack_data function.""" self.assertEqual((None, None), util.unpack_data('')) self.assertEqual(('a', None), util.unpack_data('a')) self.assertEqual(('a', ''), util.unpack_data('a ')) self.assertEqual(('a', 'b'), util.unpack_data('a b')) self.assertEqual(('a', 'b c'), util.unpack_data('a b c')) def test_unpack_nid(self): """Test the util.unpack_nid function.""" self.assertEqual((None, None, None), util.unpack_nid('')) self.assertEqual((None, None, None), util.unpack_nid('a')) self.assertEqual((None, None, None), util.unpack_nid('a@b')) self.assertEqual((None, None, None), util.unpack_nid('a:b')) self.assertEqual((None, None, None), util.unpack_nid('a:b@c')) self.assertEqual(('a', 'b', 'c'), util.unpack_nid('a@b:c')) self.assertEqual(('a@', 'b:', 'c'), util.unpack_nid('a@@b::c')) self.assertEqual(('a@b:c', 'd', 'e'), util.unpack_nid('a@b:c@d:e')) def test_sample(self): """Test the util.sample_set function.""" self.assertEqual([], util.sample_set(set(), 1)) self.assertEqual([], util.sample_set({1}, 0)) self.assertEqual([1], util.sample_set({1}, 1)) s = {1} self.assertEqual([1], util.sample_set(s, 1, True)) self.assertEqual(set(), s) self.assertEqual({1, 2}, set(util.sample_set({1, 2}, 2))) s = {1, 2} self.assertEqual({1, 2}, set(util.sample_set(s, 2, True))) self.assertEqual(set(), s) s = set() while len(s) < 20: s.add(random.randint(0, 100)) s_copy = s.copy() # get a sample without removal and check original is a superset lst = util.sample_set(s, 10) self.assertEqual(len(lst), 10) self.assertEqual(s, s_copy) self.assertTrue(s.issuperset(set(lst))) # get a sample with removal and check result is disjoint with set and # union is equal to original lst = util.sample_set(s, 10, True) self.assertEqual(len(lst), 10) self.assertEqual(len(s), 10) self.assertTrue(s.isdisjoint(set(lst))) self.assertEqual(s_copy, s.union(set(lst))) @async_test() async def test_callback(self): """Test the util.run_callback function.""" def fun(lst): lst.append(0) async def afun(lst): await asyncio.sleep(0.1) lst.append(1) lst = [] self.assertIsNone(util.run_callback(fun, lst)) self.assertEqual(lst, [0]) t = util.run_callback(afun, lst) self.assertTrue(inspect.isawaitable(t)) await t self.assertEqual(lst, [0, 1])
34.416667
77
0.582627
456
3,304
4.129386
0.184211
0.23898
0.014339
0.052045
0.494424
0.383431
0.323951
0.235794
0.134891
0.113117
0
0.016935
0.249395
3,304
95
78
34.778947
0.742339
0.096852
0
0.085714
0
0
0.034317
0
0
0
0
0
0.485714
1
0.071429
false
0
0.1
0
0.185714
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
1
0
0
0
0
0
0
0
0
0
2
cf114c9081fc86e7a424bf670982abe690912d7a
230
py
Python
setup.py
laijingtao/paramparser
50d353b98dd92542b43a88cc80ab96beb76f7a2c
[ "MIT" ]
null
null
null
setup.py
laijingtao/paramparser
50d353b98dd92542b43a88cc80ab96beb76f7a2c
[ "MIT" ]
null
null
null
setup.py
laijingtao/paramparser
50d353b98dd92542b43a88cc80ab96beb76f7a2c
[ "MIT" ]
null
null
null
#!/usr/bin/env python from setuptools import setup, find_packages setup(name='paramparser', version='0.1', description='Read parameters from file', author='Jingtao Lai', py_modules=['paramparser'] )
20.909091
46
0.66087
27
230
5.555556
0.888889
0
0
0
0
0
0
0
0
0
0
0.010989
0.208696
230
10
47
23
0.813187
0.086957
0
0
0
0
0.291866
0
0
0
0
0
0
1
0
true
0
0.142857
0
0.142857
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
cf32342669a13301e856415c460e11a5331089e3
461
py
Python
trello/exceptions.py
x-magic/py-trello
dd66f0d2176752a13dba4cd635bca132b2d8528a
[ "BSD-3-Clause" ]
740
2015-01-11T06:45:05.000Z
2022-03-20T02:00:21.000Z
trello/exceptions.py
x-magic/py-trello
dd66f0d2176752a13dba4cd635bca132b2d8528a
[ "BSD-3-Clause" ]
166
2015-01-09T20:17:03.000Z
2022-03-26T20:01:13.000Z
trello/exceptions.py
x-magic/py-trello
dd66f0d2176752a13dba4cd635bca132b2d8528a
[ "BSD-3-Clause" ]
316
2015-01-16T17:35:55.000Z
2022-03-28T02:39:37.000Z
# -*- coding: utf-8 -*- class ResourceUnavailable(Exception): """Exception representing a failed request to a resource""" def __init__(self, msg, http_response): Exception.__init__(self) self._msg = msg self._status = http_response.status_code def __str__(self): return "%s (HTTP status: %s)" % (self._msg, self._status) class Unauthorized(ResourceUnavailable): pass class TokenError(Exception): pass
20.954545
65
0.663774
52
461
5.519231
0.5
0.073171
0.090592
0
0
0
0
0
0
0
0
0.002786
0.221258
461
21
66
21.952381
0.796657
0.164859
0
0.181818
0
0
0.05277
0
0
0
0
0
0
1
0.181818
false
0.181818
0
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
0
0
1
0
0
1
0
0
2
cf42e137e005d2ff18340c8491e8e4767d97b639
84
py
Python
rockpaperscissors.py
alstn9008/gitkracken-demo
e62870fedf5f7a9f599e03987461e62552ff906a
[ "MIT" ]
null
null
null
rockpaperscissors.py
alstn9008/gitkracken-demo
e62870fedf5f7a9f599e03987461e62552ff906a
[ "MIT" ]
null
null
null
rockpaperscissors.py
alstn9008/gitkracken-demo
e62870fedf5f7a9f599e03987461e62552ff906a
[ "MIT" ]
null
null
null
play = ["Rock", "Paper", "Scissors"] computer = "Rock" print("") player = "Paper"
12
36
0.583333
9
84
5.444444
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.166667
84
6
37
14
0.7
0
0
0
0
0
0.309524
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
cf4ee35089ecef74887c775e5a540b0f17841063
240
py
Python
40-converting to executable.py
BatuhanUmay/Pygame-Python-Game-Development-
892f0bcdaf3db1e1a69aa3ac874b18c8f6d5c067
[ "MIT" ]
null
null
null
40-converting to executable.py
BatuhanUmay/Pygame-Python-Game-Development-
892f0bcdaf3db1e1a69aa3ac874b18c8f6d5c067
[ "MIT" ]
null
null
null
40-converting to executable.py
BatuhanUmay/Pygame-Python-Game-Development-
892f0bcdaf3db1e1a69aa3ac874b18c8f6d5c067
[ "MIT" ]
null
null
null
import cx_Freeze executables = [cx_Freeze.Executable("40-converting to executable.py")] cx_Freeze.setup( name = "Slither", options = {"build_exe" : {"packages" : ["pygame"], "include_files" : ["apple2.png", "snakehead2.png"]}}, )
26.666667
108
0.670833
28
240
5.571429
0.785714
0.153846
0
0
0
0
0
0
0
0
0
0.019324
0.1375
240
9
109
26.666667
0.7343
0
0
0
0
0
0.40249
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
cf53c766e00f9177d36a49d22b76ab74f310e121
2,104
py
Python
samples/rsa/helloimpl_py4j.py
svidoso/ipopo
1d4b81207e67890dfccc8f562336c7104f194c17
[ "Apache-2.0" ]
65
2015-04-21T10:41:18.000Z
2022-01-02T16:25:40.000Z
samples/rsa/helloimpl_py4j.py
svidoso/ipopo
1d4b81207e67890dfccc8f562336c7104f194c17
[ "Apache-2.0" ]
85
2015-01-20T14:23:52.000Z
2022-02-19T17:08:46.000Z
samples/rsa/helloimpl_py4j.py
svidoso/ipopo
1d4b81207e67890dfccc8f562336c7104f194c17
[ "Apache-2.0" ]
32
2015-03-13T07:43:05.000Z
2020-04-24T07:56:53.000Z
#!/usr/bin/python3 """ For export as a remote service, this impl requires the py4j distribution provider (in pelix.rsa.providers.distribution.py4j) package. The implementation below exports the org.eclipse.ecf.examples.hello.IHello service interface: https://github.com/ECF/AsyncRemoteServiceExamples/blob/master/hello/org.eclipse.ecf.examples.hello.javahost/src/org/eclipse/ecf/examples/hello/javahost/HelloImpl.java for access via some remote service consumer (java or python). When the IHello remote service is instantiated, the service properties given in the Instantiate decorator are used to export via the ecf.py4j.host.python distribution provider. On the Java-side, this will typically trigger a HelloConsumer instance e.g.: https://github.com/ECF/AsyncRemoteServiceExamples/blob/master/hello/org.eclipse.ecf.examples.hello.javahost/src/org/eclipse/ecf/examples/hello/javahost/HelloConsumer.java to have it's references to the IHello proxy... see @Reference(target='(service.imported=*)' which may then invoke the sayHello, sayHelloAsync, and/or sayHelloPromise on this remote service. """ from pelix.ipopo.decorators import Instantiate, ComponentFactory, Provides from samples.rsa.helloimpl import HelloImpl @ComponentFactory("helloimpl-py4j-factory") # Provides IHello interface as specified by Java interface. @Provides("org.eclipse.ecf.examples.hello.IHello") # See https://github.com/ECF/Py4j-RemoteServicesProvider/blob/master/examples/org.eclipse.ecf.examples.hello/src/org/eclipse/ecf/examples/hello/IHello.java @Instantiate( "helloimpl-py4j", { "service.exported.interfaces": "*", # Required for export # Required to use py4j python provider for export "service.exported.configs": "ecf.py4j.host.python", # Required to use osgi.async intent "service.intents": ["osgi.async"], "osgi.basic.timeout": 30000, }, ) # Timeout associated with remote calls (in ms) class Py4jHelloImpl(HelloImpl): """ All method implementations handled by HelloImpl super-class. See samples.rsa.helloimpl module. """ pass
43.833333
170
0.769487
278
2,104
5.823741
0.431655
0.049413
0.064237
0.103768
0.236566
0.220506
0.159358
0.159358
0.159358
0.159358
0
0.008157
0.125951
2,104
47
171
44.765957
0.872213
0.734791
0
0
0
0
0.358095
0.209524
0
0
0
0
0
1
0
true
0.066667
0.133333
0
0.2
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
cf54f5975f9811611e84c88996d8790ccb4300f7
117
py
Python
test.py
ngtrang/pytorch
f17ce4015db15dde778dbb801832ed213461a9eb
[ "MIT" ]
null
null
null
test.py
ngtrang/pytorch
f17ce4015db15dde778dbb801832ed213461a9eb
[ "MIT" ]
null
null
null
test.py
ngtrang/pytorch
f17ce4015db15dde778dbb801832ed213461a9eb
[ "MIT" ]
null
null
null
from pyvi import ViTokenizer str ="Chào Sarah, bạn khỏe không?" lst = ViTokenizer.tokenize(str).split(" ") print(lst)
29.25
42
0.74359
17
117
5.117647
0.823529
0
0
0
0
0
0
0
0
0
0
0
0.119658
117
4
43
29.25
0.84466
0
0
0
0
0
0.237288
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
cf5cd9abb4bbe571b1320f6d60a9399ee3ada2ce
2,863
py
Python
ChordalPy/Tables.py
P-bibs/PyChord
283177bb35f667c430298d739b9981b3fdd39c5e
[ "MIT" ]
2
2021-08-24T10:12:03.000Z
2021-09-13T15:31:25.000Z
ChordalPy/Tables.py
P-bibs/PyChord
283177bb35f667c430298d739b9981b3fdd39c5e
[ "MIT" ]
null
null
null
ChordalPy/Tables.py
P-bibs/PyChord
283177bb35f667c430298d739b9981b3fdd39c5e
[ "MIT" ]
null
null
null
"""Constant values needed for string parsing""" intervals = { "intervalToTuple": { "1": (1,0), "2": (2,2), "b3": (3,3), "3": (3,4), "4": (4,5), "b5": (5,6), "5": (5,7), "#5": (5,8), "6": (6,9), "bb7": (7,9), "b7": (7,10), "7": (7,11), "9": (9,14), "b9": (9,13), "#9": (9,15), "11": (11,17), "#11": (11,18), "b13": (13,20), "13": (13,21), "s5": (5,8), "s9": (9,15), "s11": (11,18) }, "shorthandToIntervals": { "maj": ("1", "3", "5"), "min": ("1", "b3", "5"), "dim": ("1", "b3", "b5"), "aug": ("1", "3", "#5"), "maj7": ("1", "3", "5", "7"), "min7": ("1", "b3", "5", "b7"), "7": ("1", "3", "5", "b7"), "dim7": ("1", "b3", "b5", "bb7"), "hdim7": ("1", "b3", "b5", "b7"), "minmaj7": ("1", "b3", "5", "7"), "maj6": ("1", "3", "5", "6"), "min6": ("1", "b3", "5", "6"), "9": ("1", "3", "5", "b7", "9"), "maj9": ("1", "3", "5", "7", "9"), "min9": ("1", "b3", "5", "b7", "9"), "9sus": ("1", "4", "5", "b7", "9"), "sus9": ("1", "4", "5", "b7", "9"), "11": ("1", "3", "5", "b7", "11"), "13": ("1", "3", "5", "b7", "13"), "sus2": ("1", "2", "5"), "sus4": ("1", "4", "5"), # Unofficial aliases, comment out for stricter interpretation "6": ("1", "3", "5", "6"), "hdim": ("1", "b3", "b5", "b7") } } notes = { "naturalToStep": { "C": 0, "D": 1, "E": 2, "F": 3, "G": 4, "A": 5, "B": 6, }, "naturalToHalfStep": { "Cbb": 10, "Cb": 11, "C": 0, "Dbb": 0, "Db": 1, "D": 2, "Ebb": 2, "Eb": 3, "E": 4, "Fb": 4, "F": 5, "Gb": 6, "G": 7, "Abb": 7, "Ab": 8, "A": 9, "Bbb": 9, "Bb": 10, "B": 11, "C#": 1, "C##": 2, "D#": 3, "E#": 5, "F#": 6, "G#": 8, "A#": 10, "B#": 12, }, "stepToNatural": { "0": "C", "1": "D", "2": "E", "3": "F", "4": "G", "5": "A", "6": "B", }, "natural": [ "A", "B", "C", "D", "E", "F", "G" ], "flat": [ "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B" ], "sharp": [ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" ] }
18.960265
69
0.221097
318
2,863
1.990566
0.27673
0.031596
0.047393
0.031596
0.018957
0
0
0
0
0
0
0.163279
0.467342
2,863
151
70
18.960265
0.251803
0.035627
0
0.167883
0
0
0.162917
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
cf81529fa604b112246ca0ca4800098ff6aff04e
437
py
Python
tests/stats/endpoints/test_gamestatslineups.py
yukikongju/audl
ecf8edea4508926313df1a34d8604aa905bf4258
[ "MIT" ]
null
null
null
tests/stats/endpoints/test_gamestatslineups.py
yukikongju/audl
ecf8edea4508926313df1a34d8604aa905bf4258
[ "MIT" ]
10
2021-08-04T03:01:12.000Z
2021-08-11T00:08:27.000Z
tests/stats/endpoints/test_gamestatslineups.py
yukikongju/audl
ecf8edea4508926313df1a34d8604aa905bf4258
[ "MIT" ]
null
null
null
#!/usr/bin/env/python import unittest from audl.stats.endpoints.gamestatslineups import GameStatsLineups class TestGameStatsLineups(unittest.TestCase): def test_get_lineups_home(self): print(GameStatsLineups( "2021-07-16-DAL-SEA").get_home_points_by_points_lineups()) def test_get_lineups_away(self): print(GameStatsLineups( "2021-07-16-DAL-SEA").get_away_points_by_points_lineups())
27.3125
70
0.736842
55
437
5.563636
0.527273
0.045752
0.065359
0.111111
0.27451
0.27451
0.27451
0.27451
0.27451
0
0
0.043597
0.160183
437
15
71
29.133333
0.790191
0.045767
0
0.222222
0
0
0.086538
0
0
0
0
0
0
1
0.222222
false
0
0.222222
0
0.555556
0.222222
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
d84d26deda46544d4e797e75e3abc6eb8e666905
2,084
py
Python
PuzzleGame/env/Lib/site-packages/bangtal/scene.py
kiissy/PuzzleGame
6bc6d35274f6fdedf48fe22cc658cd7b81b7fdd0
[ "Apache-2.0" ]
null
null
null
PuzzleGame/env/Lib/site-packages/bangtal/scene.py
kiissy/PuzzleGame
6bc6d35274f6fdedf48fe22cc658cd7b81b7fdd0
[ "Apache-2.0" ]
null
null
null
PuzzleGame/env/Lib/site-packages/bangtal/scene.py
kiissy/PuzzleGame
6bc6d35274f6fdedf48fe22cc658cd7b81b7fdd0
[ "Apache-2.0" ]
null
null
null
from bangtal.singleton import * from bangtal.game import * @CFUNCTYPE(None, c_int32, c_int32) def sceneCallback(scene, event): s = SceneManager.instance().getScene(scene) if event == EventID.ENTER_SCENE.value: SceneManager.instance().setCurrentScene(scene) s.onEnter() elif event == EventID.LEAVE_SCENE.value: s.onLeave() @CFUNCTYPE(None, c_int32, c_int32) def keyboardCallback(key, state): s = SceneManager.instance().getCurrentScene() s.onKeyboard(key, state == 1) class SceneManagerImpl: __list = {} __currentScene = None def __init__(self): global sceneCallback, keyboardCallback GameServer.instance().setSceneCallback(sceneCallback) GameServer.instance().setKeyboardCallback(keyboardCallback) def register(self, id, scene): self.__list[id] = scene def getScene(self, id): return self.__list[id] def setCurrentScene(self, id): self.__currentScene = id def getCurrentScene(self): return self.getScene(self.__currentScene) class SceneManager(SceneManagerImpl, SingletonInstance): pass class Scene: @staticmethod def onEnterDefault(scene): pass @staticmethod def onLeaveDefault(scene): pass @staticmethod def onKeyboardDefault(scene, key, pressed): pass def __init__(self, name, file): id = GameServer.instance().createScene(name, file) SceneManager.instance().register(id, self) self._name = name self._file = file self.ID = id def __str__(self): return self._name def setImage(self, file): GameServer.instance().setSceneImage(self.ID, file) def setLight(self, light): GameServer.instance().setSceneLight(self.ID, light) def enter(self): GameServer.instance().enterScene(self.ID) def onEnter(self): Scene.onEnterDefault(self) def onLeave(self): Scene.onLeaveDefault(self) def onKeyboard(self, key, pressed): Scene.onKeyboardDefault(self, key, pressed)
24.809524
67
0.666027
218
2,084
6.215596
0.284404
0.030996
0.020664
0.028044
0.041328
0.041328
0.041328
0
0
0
0
0.005601
0.228887
2,084
83
68
25.108434
0.837586
0
0
0.147541
0
0
0
0
0
0
0
0
0
1
0.295082
false
0.065574
0.032787
0.04918
0.459016
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
d8688982bd33c8d9d3d9648633e411bd1904929c
2,307
py
Python
tests/test_cgroup_subsystem.py
Lothiraldan/oscontainer
140504711372494f919b4de7bf84e80d11013fa0
[ "MIT" ]
null
null
null
tests/test_cgroup_subsystem.py
Lothiraldan/oscontainer
140504711372494f919b4de7bf84e80d11013fa0
[ "MIT" ]
null
null
null
tests/test_cgroup_subsystem.py
Lothiraldan/oscontainer
140504711372494f919b4de7bf84e80d11013fa0
[ "MIT" ]
null
null
null
from unittest.mock import MagicMock import pytest from oscontainer import NO_LIMIT, PER_CPU_SHARES from oscontainer.cgroup_subsystem import CgroupSubsystem TEST_HOST_CPU_COUNT = 8 @pytest.mark.parametrize( "quota, period, expected", [ (10000, 100000, 1), (100000, 100000, 1), (150000, 100000, 2), (200000, 100000, 2), (350000, 100000, 4) ] ) def test_active_processor_count_quota(quota, period, expected): sub_system = CgroupSubsystem() sub_system.cpu_quota = MagicMock(return_value=quota) sub_system.cpu_period = MagicMock(return_value=period) sub_system.cpu_shares = MagicMock(return_value=NO_LIMIT) cpu_count = sub_system.active_processor_count(prefer_container_quota=True, host_cpu_count=TEST_HOST_CPU_COUNT) assert cpu_count == expected, "wrong CPU count" @pytest.mark.parametrize( "shares, expected", [ (PER_CPU_SHARES, 1), (PER_CPU_SHARES * 2, 2), (PER_CPU_SHARES * 2.2, 3) ] ) def test_active_processor_count_shares(shares, expected): sub_system = CgroupSubsystem() sub_system.cpu_quota = MagicMock(return_value=NO_LIMIT) sub_system.cpu_period = MagicMock(return_value=0) sub_system.cpu_shares = MagicMock(return_value=shares) cpu_count = sub_system.active_processor_count(prefer_container_quota=False, host_cpu_count=TEST_HOST_CPU_COUNT) assert cpu_count == expected, "wrong CPU count" @pytest.mark.parametrize( "quota, period, shares, expected", [ (10000, 100000, PER_CPU_SHARES, 1), (100000, 100000, PER_CPU_SHARES, 1), (150000, 100000, PER_CPU_SHARES * 2.2, 2), (250000, 100000, PER_CPU_SHARES * 2.2, 3), ] ) def test_active_processor_count(quota, period, shares, expected): sub_system = CgroupSubsystem() sub_system.cpu_quota = MagicMock(return_value=quota) sub_system.cpu_period = MagicMock(return_value=period) sub_system.cpu_shares = MagicMock(return_value=shares) cpu_count = sub_system.active_processor_count(prefer_container_quota=False, host_cpu_count=TEST_HOST_CPU_COUNT) assert cpu_count == expected, "wrong CPU count"
33.434783
85
0.67837
286
2,307
5.122378
0.167832
0.087372
0.07372
0.043686
0.7843
0.709898
0.666894
0.640956
0.640956
0.640956
0
0.071509
0.230169
2,307
68
86
33.926471
0.753378
0
0
0.357143
0
0
0.049848
0
0
0
0
0
0.053571
1
0.053571
false
0
0.071429
0
0.125
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d888c45d4fefca84fcaa2e8e155cf4ccb15e8b08
116
py
Python
py3/server/workers/foo.py
goodagood/cross.lang.zmq
3834481249cdb47cbc027804d18e43e5396da2db
[ "Apache-2.0" ]
null
null
null
py3/server/workers/foo.py
goodagood/cross.lang.zmq
3834481249cdb47cbc027804d18e43e5396da2db
[ "Apache-2.0" ]
null
null
null
py3/server/workers/foo.py
goodagood/cross.lang.zmq
3834481249cdb47cbc027804d18e43e5396da2db
[ "Apache-2.0" ]
null
null
null
def foo(a=None): if a is not None: print('got a: ', a) print('foo /tmp/a/b/c, 1844') main = foo
11.6
33
0.5
22
116
2.636364
0.636364
0
0
0
0
0
0
0
0
0
0
0.050633
0.318966
116
9
34
12.888889
0.683544
0
0
0
0
0
0.234783
0
0
0
0
0
0
1
0.2
false
0
0
0
0.2
0.4
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d89344660e69a6db9d567d93457aaf02d109b5ba
2,546
py
Python
lab_assignment/lab_2/lab_2/windows/basic_opeartions_unit_test.py
TeamLab/introduction_to_pythoy_TEAMLAB_MOOC
ebf1ff02d6a341bfee8695eac478ff8297cb97e4
[ "MIT" ]
65
2017-11-01T01:57:21.000Z
2022-02-08T13:36:25.000Z
lab_assignment/lab_2/lab_2/windows/basic_opeartions_unit_test.py
TeamLab/introduction_to_pythoy_TEAMLAB_MOOC
ebf1ff02d6a341bfee8695eac478ff8297cb97e4
[ "MIT" ]
9
2017-11-03T15:05:30.000Z
2018-05-17T03:18:36.000Z
lab_assignment/lab_2/lab_2/windows/basic_opeartions_unit_test.py
TeamLab/introduction_to_pythoy_TEAMLAB_MOOC
ebf1ff02d6a341bfee8695eac478ff8297cb97e4
[ "MIT" ]
64
2017-11-01T01:57:23.000Z
2022-01-19T03:52:12.000Z
# -*- coding: utf8 -*- import unittest import basic_operations as bo class TestBasicOperations(unittest.TestCase): def test_str_to_int(self): self.assertEqual(10, bo.str_to_int("10")) self.assertEqual(15, bo.str_to_int("15")) self.assertEqual(40, bo.str_to_int("40")) self.assertEqual(155, bo.str_to_int("155")) def test_str_to_float(self): self.assertEqual(10.0, bo.str_to_float("10")) self.assertEqual(15.4, bo.str_to_float("15.4")) self.assertEqual(40.0, bo.str_to_float("40")) self.assertEqual(-132.28, bo.str_to_float("-132.28")) def test_number_to_str(self): self.assertEqual("10", bo.number_to_str(10)) self.assertEqual("15.4", bo.number_to_str(15.4)) self.assertEqual("40", bo.number_to_str(40)) self.assertEqual("-132.3", bo.number_to_str(-132.3)) def test_add_string_number(self): self.assertEqual("Seoul10", bo.add_string_number("Seoul", 10)) self.assertEqual("Seoul15.4", bo.add_string_number("Seoul", 15.4)) self.assertEqual("Seoul40", bo.add_string_number("Seoul", 40)) self.assertEqual("Seoul-132.3", bo.add_string_number("Seoul", -132.3)) def test_add_string_string(self): self.assertEqual( "Seoul Korea", bo.add_string_string("Seoul", " Korea")) self.assertEqual( "Hello World", bo.add_string_string("Hello", " World")) def test_associative_law_add(self): self.assertEqual( ((10 + 50) - 30), bo.associative_law_add(10, 50, -30)) self.assertEqual( ((10 + -50) + 100), bo.associative_law_add(10, -50, 100)) def test_associative_law_mutiple(self): self.assertEqual( ((10 * -5) * - 30), bo.associative_law_mutiple(10, -5, -30)) self.assertEqual( ((-10 * -5) * - 30), bo.associative_law_mutiple(-10, -5, -30)) self.assertEqual( ((-10 * -5) * 30), bo.associative_law_mutiple(-10, -5, 30)) def test_distributive_law(self): self.assertEqual( (10 * (-5 + - 30)), bo.distributive_law(10, -5, -30)) self.assertEqual( (3 * (4 + 5)), bo.distributive_law(3, 4, 5)) self.assertEqual( (-10 * (-5 + -5)), bo.distributive_law(-10, -5, -5)) def test_exponent(self): self.assertEqual( (10 ** 5), bo.exponent(10, 5)) self.assertEqual( (10), bo.exponent(10, 1)) self.assertEqual( (10.2 ** 5), bo.exponent(10.2, 5))
37.441176
78
0.594658
349
2,546
4.126075
0.140401
0.302083
0.153472
0.102083
0.403472
0.211111
0.120833
0.1
0.1
0.1
0
0.096907
0.23802
2,546
67
79
38
0.645361
0.007855
0
0.240741
0
0
0.053883
0
0
0
0
0
0.537037
1
0.166667
false
0
0.037037
0
0.222222
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
1
0
0
0
0
0
0
0
0
0
2
d8942793ead429d0bdedfc6b6eca1620556f2dde
11,596
py
Python
lib/wallet.py
jonathancross/p2wpkh-in-p2sh
27919a1669150665bbff50ab5d6ef5b66f5c3fd9
[ "MIT" ]
1
2017-12-13T17:44:55.000Z
2017-12-13T17:44:55.000Z
lib/wallet.py
jonathancross/p2wpkh-in-p2sh
27919a1669150665bbff50ab5d6ef5b66f5c3fd9
[ "MIT" ]
1
2018-10-29T22:18:29.000Z
2018-11-03T18:34:34.000Z
lib/wallet.py
jonathancross/p2wpkh-in-p2sh
27919a1669150665bbff50ab5d6ef5b66f5c3fd9
[ "MIT" ]
3
2018-05-21T01:03:05.000Z
2019-07-30T17:38:32.000Z
# Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, modify, merge, # publish, distribute, sublicense, and/or sell copies of the Software, # and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # Wallet classes: # - Imported_Wallet: imported address, no keystore # - Standard_Wallet: one keystore, P2PKH # - Multisig_Wallet: several keystores, P2SH import os import threading import json import copy from .util import PrintError from .bitcoin import * from .keystore import load_keystore from . import bitcoin class Abstract_Wallet(PrintError): """ Wallet classes are created to handle various address generation methods. Completion states (watching-only, single account, no seed, etc) are handled inside classes. """ def __init__(self, storage): self.storage = storage self.network = None self.gap_limit_for_change = 6 # constant # saved fields self.history = storage.get('addr_history',{}) # address -> list(txid, height) self.load_keystore() self.load_addresses() self.load_transactions() self.build_reverse_history() self.lock = threading.Lock() self.transaction_lock = threading.Lock() self.check_history() # save wallet type the first time if self.storage.get('wallet_type') is None: self.storage.put('wallet_type', self.wallet_type) def diagnostic_name(self): return self.basename() def __str__(self): return self.basename() def get_master_public_key(self): return None def load_transactions(self): self.txi = self.storage.get('txi', {}) self.txo = self.storage.get('txo', {}) self.tx_fees = self.storage.get('tx_fees', {}) self.pruned_txo = self.storage.get('pruned_txo', {}) tx_list = self.storage.get('transactions', {}) self.transactions = {} for tx_hash, raw in tx_list.items(): tx = Transaction(raw) self.transactions[tx_hash] = tx if self.txi.get(tx_hash) is None and self.txo.get(tx_hash) is None and (tx_hash not in self.pruned_txo.values()): self.print_error("removing unreferenced tx", tx_hash) self.transactions.pop(tx_hash) def save_transactions(self, write=False): with self.transaction_lock: tx = {} for k,v in self.transactions.items(): tx[k] = str(v) self.storage.put('transactions', tx) self.storage.put('txi', self.txi) self.storage.put('txo', self.txo) self.storage.put('tx_fees', self.tx_fees) self.storage.put('pruned_txo', self.pruned_txo) self.storage.put('addr_history', self.history) if write: self.storage.write() def build_reverse_history(self): self.tx_addr_hist = {} for addr, hist in self.history.items(): for tx_hash, h in hist: s = self.tx_addr_hist.get(tx_hash, set()) s.add(addr) self.tx_addr_hist[tx_hash] = s def check_history(self): save = False mine_addrs = list(filter(lambda k: self.is_mine(self.history[k]), self.history.keys())) if len(mine_addrs) != len(self.history.keys()): save = True for addr in mine_addrs: hist = self.history[addr] for tx_hash, tx_height in hist: if tx_hash in self.pruned_txo.values() or self.txi.get(tx_hash) or self.txo.get(tx_hash): continue tx = self.transactions.get(tx_hash) if tx is not None: self.add_transaction(tx_hash, tx) save = True if save: self.save_transactions() def basename(self): return os.path.basename(self.storage.path) def save_addresses(self): self.storage.put('addresses', {'receiving':self.receiving_addresses, 'change':self.change_addresses}) def load_addresses(self): d = self.storage.get('addresses', {}) if type(d) != dict: d={} self.receiving_addresses = d.get('receiving', []) self.change_addresses = d.get('change', []) def synchronize(self): pass def is_mine(self, address): return address in self.get_addresses() def get_address_index(self, address): if address in self.receiving_addresses: return False, self.receiving_addresses.index(address) if address in self.change_addresses: return True, self.change_addresses.index(address) raise Exception("Address not found", address) def get_local_height(self): """ return last known height if we are offline """ return self.network.get_local_height() if self.network else self.storage.get('stored_height', 0) # return the total amount ever received by an address # return the balance of a bitcoin address: confirmed and matured, unconfirmed, unmatured def get_addresses(self): out = [] out += self.get_receiving_addresses() out += self.get_change_addresses() return out def relayfee(self): return relayfee(self.network) def dust_threshold(self): return dust_threshold(self.network) def address_is_old(self, address, age_limit=2): age = -1 h = self.history.get(address, []) for tx_hash, tx_height in h: if tx_height == 0: tx_age = 0 else: tx_age = self.get_local_height() - tx_height + 1 if tx_age > age: age = tx_age return age > age_limit def can_sign(self, tx): if tx.is_complete(): return False for k in self.get_keystores(): if k.can_sign(tx): return True return False def add_address(self, address): if address not in self.history: self.history[address] = [] def has_password(self): return self.storage.get('use_encryption', False) def check_password(self, password): self.keystore.check_password(password) def sign_message(self, address, message, password): index = self.get_address_index(address) return self.keystore.sign_message(index, message, password) def decrypt_message(self, pubkey, message, password): addr = self.pubkeys_to_address(pubkey) index = self.get_address_index(addr) return self.keystore.decrypt_message(index, message, password) class Simple_Wallet(Abstract_Wallet): # wallet with a single keystore def get_keystores(self): return [self.keystore] def is_watching_only(self): return self.keystore.is_watching_only() def can_change_password(self): return self.keystore.can_change_password() def update_password(self, old_pw, new_pw, encrypt=False): if old_pw is None and self.has_password(): raise InvalidPassword() self.keystore.update_password(old_pw, new_pw) self.save_keystore() self.storage.set_password(new_pw, encrypt) self.storage.write() def save_keystore(self): self.storage.put('keystore', self.keystore.dump()) class Deterministic_Wallet(Abstract_Wallet): def __init__(self, storage): Abstract_Wallet.__init__(self, storage) self.gap_limit = storage.get('gap_limit', 20) def has_seed(self): return self.keystore.has_seed() def is_deterministic(self): return self.keystore.is_deterministic() def get_receiving_addresses(self): return self.receiving_addresses def get_change_addresses(self): return self.change_addresses def get_seed(self, password): return self.keystore.get_seed(password) def add_seed(self, seed, pw): self.keystore.add_seed(seed, pw) def create_new_address(self, for_change=False): assert type(for_change) is bool addr_list = self.change_addresses if for_change else self.receiving_addresses n = len(addr_list) x = self.derive_pubkeys(for_change, n) address = self.pubkeys_to_address(x) addr_list.append(address) self.save_addresses() self.add_address(address) return address def synchronize_sequence(self, for_change): limit = self.gap_limit_for_change if for_change else self.gap_limit while True: addresses = self.get_change_addresses() if for_change else self.get_receiving_addresses() if len(addresses) < limit: self.create_new_address(for_change) continue if list(map(lambda a: self.address_is_old(a), addresses[-limit:] )) == limit*[False]: break else: self.create_new_address(for_change) def synchronize(self): with self.lock: if self.is_deterministic(): self.synchronize_sequence(False) self.synchronize_sequence(True) else: if len(self.receiving_addresses) != len(self.keystore.keypairs): pubkeys = self.keystore.keypairs.keys() self.receiving_addresses = [self.pubkeys_to_address(i) for i in pubkeys] self.save_addresses() for addr in self.receiving_addresses: self.add_address(addr) class Simple_Deterministic_Wallet(Simple_Wallet, Deterministic_Wallet): """ Deterministic Wallet with a single pubkey per address """ def __init__(self, storage): Deterministic_Wallet.__init__(self, storage) def get_public_key(self, address): sequence = self.get_address_index(address) pubkey = self.get_pubkey(*sequence) return pubkey def load_keystore(self): self.keystore = load_keystore(self.storage, 'keystore') try: xtype = bitcoin.xpub_type(self.keystore.xpub) except: xtype = 'standard' self.txin_type = 'p2pkh' if xtype == 'standard' else xtype def get_pubkey(self, c, i): return self.derive_pubkeys(c, i) def get_master_public_key(self): return self.keystore.get_master_public_key() def derive_pubkeys(self, c, i): return self.keystore.derive_pubkey(c, i) class Standard_Wallet(Simple_Deterministic_Wallet): wallet_type = 'standard' def pubkeys_to_address(self, pubkey): return bitcoin.pubkey_to_address(self.txin_type, pubkey)
33.417867
125
0.641859
1,470
11,596
4.87551
0.190476
0.04451
0.021487
0.018418
0.105065
0.036556
0.018139
0
0
0
0
0.001879
0.265695
11,596
346
126
33.514451
0.839812
0.152121
0
0.104803
0
0
0.029279
0
0
0
0
0
0.004367
1
0.20524
false
0.074236
0.034935
0.087336
0.406114
0.004367
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
d8a23e29ea9877706f91a85d4082ddb835b61a65
28,832
py
Python
src-test/rogerthat_tests/mobicage/service/test_system_api.py
goubertbrent/oca-backend
b9f59cc02568aecb55d4b54aec05245790ea25fd
[ "Apache-2.0" ]
null
null
null
src-test/rogerthat_tests/mobicage/service/test_system_api.py
goubertbrent/oca-backend
b9f59cc02568aecb55d4b54aec05245790ea25fd
[ "Apache-2.0" ]
null
null
null
src-test/rogerthat_tests/mobicage/service/test_system_api.py
goubertbrent/oca-backend
b9f59cc02568aecb55d4b54aec05245790ea25fd
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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. # # @@license_version:1.7@@ import base64 import json import os import sys import time from StringIO import StringIO from google.appengine.ext import db import mc_unittest from mcfw.rpc import parse_complex_value, serialize_complex_value from rogerthat.bizz.friend_helper import FriendHelper from rogerthat.bizz.friends import makeFriends from rogerthat.bizz.i18n import get_all_translations, get_editable_translation_set from rogerthat.bizz.profile import create_service_profile, create_user_profile from rogerthat.bizz.service import ReservedMenuItemException, InvalidMenuItemCoordinatesException, \ FriendNotFoundException, InvalidJsonStringException from rogerthat.bizz.service.mfr import MessageFlowDesignInUseException, InvalidMessageFlowXmlException, \ MessageFlowDesignValidationException from rogerthat.dal.friend import get_friends_map from rogerthat.dal.profile import get_service_profile from rogerthat.dal.service import get_default_service_identity from rogerthat.models import ServiceIdentity, ServiceTranslation, UserData from rogerthat.rpc import users from rogerthat.service.api import qr from rogerthat.service.api.messaging import start_flow from rogerthat.service.api.system import put_identity, get_identity, get_translations, put_translations, delete_flow, \ put_menu_item, delete_menu_item, store_branding, put_reserved_menu_item_label, \ put_flow, put_user_data, del_user_data, get_user_data from rogerthat.to.friends import FriendTO, FRIEND_TYPE_SERVICE from rogerthat.to.messaging.flow import MessageFlowDesignTO from rogerthat.to.service import ServiceIdentityDetailsTO from rogerthat.to.system import TranslationSetTO, TranslationValueTO from rogerthat.utils.service import create_service_identity_user from rogerthat.utils.transactions import run_in_xg_transaction from rogerthat_tests import set_current_user from rogerthat_tests.mobicage.bizz import test_mfd VALID_XML1 = u'<messageFlowDefinition name="Flow 1" language="en" startReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9">\n <end id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=" waitForFollowUpMessage="false"/>\n <formMessage id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9" alertIntervalType="NONE" alertType="SILENT" positiveReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImZsdXNoXzEifQ==" vibrate="false" autoLock="true" negativeReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=">\n <content>Beste klant,\n\nBenader ons met al uw vragen inzake ons aanbod. Wij proberen u zo spoedig mogelijk te antwoorden.</content>\n <form positiveButtonConfirmation="" negativeButtonCaption="Cancel" positiveButtonCaption="Submit" negativeButtonConfirmation="">\n <widget xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TextBlockWidget" maxChars="50"/>\n </form>\n </formMessage>\n <resultsFlush id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImZsdXNoXzEifQ==" reference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0="/>\n </messageFlowDefinition>' VALID_XML2 = '<messageFlowDefinitionSet xmlns="https://rogerth.at/api/1/MessageFlow.xsd">\n <definition name="Flow 2" language="en" startReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9">\n <end id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=" waitForFollowUpMessage="false"/>\n <formMessage id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9" alertIntervalType="NONE" alertType="SILENT" positiveReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImZsdXNoXzEifQ==" vibrate="false" autoLock="true" negativeReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=">\n <content>Beste klant,\n\nBenader ons met al uw vragen inzake ons aanbod. Wij proberen u zo spoedig mogelijk te antwoorden.</content>\n <form positiveButtonConfirmation="" negativeButtonCaption="Cancel" positiveButtonCaption="Submit" negativeButtonConfirmation="">\n <widget xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TextBlockWidget" maxChars="50"/>\n </form>\n </formMessage>\n <resultsFlush id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImZsdXNoXzEifQ==" reference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0="/>\n </definition>\n</messageFlowDefinitionSet>\n' class Test(mc_unittest.TestCase): def _put_identity_json(self, json_dict): to = parse_complex_value(ServiceIdentityDetailsTO, json_dict, False) return put_identity(to) def _test_create_identity(self, service_user): json_dict = dict(description_branding_use_default=True, description_use_default=True, identifier=u'1', menu_branding_use_default=True, name=u'test', phone_call_popup_use_default=True, phone_number=u'123', qualified_identifier=u'si_test1@foo.com', recommend_enabled=False, search_use_default=True, home_branding_use_default=True) self._put_identity_json(json_dict) si_details = get_identity(u'1') self.assertEqual(json_dict['description_branding_use_default'], si_details.description_branding_use_default) self.assertIsNone(si_details.description_branding) self.assertEqual(json_dict['description_use_default'], si_details.description_use_default) self.assertTrue(si_details.description) self.assertEqual(json_dict['identifier'], si_details.identifier) self.assertEqual(json_dict['menu_branding_use_default'], si_details.menu_branding_use_default) self.assertIsNone(si_details.menu_branding) self.assertEqual(json_dict['name'], si_details.name) self.assertEqual(json_dict['phone_call_popup_use_default'], si_details.phone_call_popup_use_default) self.assertIsNone(si_details.phone_call_popup) self.assertEqual(json_dict['phone_number'], si_details.phone_number) self.assertFalse(si_details.phone_number_use_default) self.assertEqual(json_dict['qualified_identifier'], si_details.qualified_identifier) self.assertEqual(json_dict['recommend_enabled'], si_details.recommend_enabled) self.assertEqual(json_dict['search_use_default'], si_details.search_use_default) self.assertTrue(si_details.search_config) self.assertFalse(si_details.search_config.enabled) self.assertFalse(si_details.search_config.keywords) self.assertEqual(json_dict['home_branding_use_default'], si_details.home_branding_use_default) self.assertIsNone(si_details.home_branding_hash) return si_details def _test_update_identity(self): old_si_details = get_identity(u'1') # update the name of default identity (no identifier in json_dict) json_dict = dict(name=u'default_identity_name') self._put_identity_json(json_dict) self.assertEqual(json_dict['name'], get_identity(ServiceIdentity.DEFAULT).name) # update the name of identity 1 json_dict = dict(name=u'identity_1_name', identifier=u'1') self._put_identity_json(json_dict) new_si_details = get_identity(u'1') self._put_identity_json(json_dict) self.assertEqual(json_dict['name'], new_si_details.name) self.assertEqual(old_si_details.qualified_identifier, new_si_details.qualified_identifier) self.assertFalse(new_si_details.search_config.enabled) # enable the search_config of identity 1 json_dict = dict(identifier=u'1', search_config=dict(enabled=True, keywords=u'test')) self._put_identity_json(json_dict) new_si_details = get_identity(u'1') self.assertTrue(new_si_details.search_config.enabled) self.assertTrue(json_dict['search_config']['enabled'] is True) self.assertEquals(0, len(new_si_details.search_config.locations)) # test app_data app_data = dict(test1='1', test2='2') json_dict = dict(app_data=json.dumps(app_data).decode('utf8')) self._put_identity_json(json_dict) new_si_details = get_identity() self.assertDictEqual(json.loads(new_si_details.app_data), app_data) return new_si_details def _prepare_svc(self, email=None): service_user = users.User(email or u'svc_test%s@foo.com' % time.time()) create_service_profile(service_user, u'Test Name') set_current_user(service_user) return service_user def test_put_service_identity(self): service_user = self._prepare_svc() self._test_create_identity(service_user) self._test_update_identity() def test_put_translations(self): service_user = self._prepare_svc() service_profile = get_service_profile(service_user) service_profile.supportedLanguages.extend([u'nl']) service_profile.put() def trans(): si = get_default_service_identity(service_user) si.description = u"Test Description" si.put() return si si = db.run_in_transaction(trans) put_flow(VALID_XML1) put_menu_item("3d", "label", "tag", [1, 1, 0], "999999") translation_set = get_translations() assert translation_set.export_id assert service_user.email() == translation_set.email print print 'TranslationSet in datastore:' print get_all_translations(get_editable_translation_set(service_user)) print print 'TranslationSet transfer object:' print serialize_complex_value(translation_set, TranslationSetTO, False) # Name and description are the only properties that are filled in # Let's translate them in Dutch NL_NAME = u'Test Naam' NL_DESCR = u'Test Beschrijving' name_found = description_found = False for translation in translation_set.translations: if translation.type == ServiceTranslation.IDENTITY_TEXT: if translation.key == si.name: name_found = True assert not translation.values nl_value = TranslationValueTO() nl_value.language = u'nl' nl_value.value = NL_NAME translation.values = [nl_value] if translation.key == si.description: description_found = True assert not translation.values nl_value = TranslationValueTO() nl_value.language = u'nl' nl_value.value = NL_DESCR translation.values = [nl_value] print print 'Updated TranslationSet transfer object:' print serialize_complex_value(translation_set, TranslationSetTO, False) assert name_found assert description_found put_translations(translation_set) print print 'Updated TranslationSet in datastore:' print get_all_translations(get_editable_translation_set(service_user)) # Test that nl name and description are in FriendTO human_user = users.User(u'a@foo.com') create_user_profile(human_user, human_user.email(), language=u'nl') makeFriends(human_user, service_user, None, None, None) helper = FriendHelper.from_data_store(service_user, FRIEND_TYPE_SERVICE) friendTO = FriendTO.fromDBFriendMap(helper, get_friends_map(human_user), service_user, includeServiceDetails=True, targetUser=human_user) assert friendTO.name == NL_NAME assert friendTO.description == NL_DESCR # Test protection against overwriting time.sleep(1) # making sure export_id is unique, since it's the current epoch in seconds get_translations() # will save new export_id self.assertRaises(Exception, put_translations, translation_set) # translation_set still has old export_id translations = get_translations() translations.email = u"another_email@foo.com" self.assertRaises(Exception, put_translations, translation_set) def _create_flow(self, flow_or_list): utils = test_mfd.Test('setUp') if isinstance(flow_or_list, (list, tuple)): return [MessageFlowDesignTO.fromMessageFlowDesign(o[1]) for o in utils.createLinearHierarchy(flow_or_list)] else: return MessageFlowDesignTO.fromMessageFlowDesign(utils.createLinearHierarchy(flow_or_list)[0][1]) def test_menu_items(self): if sys.platform == "win32": return self._prepare_svc() icon_name = u"chat emoticon" tag = u"tag" label = u"label" self.assertRaises(ReservedMenuItemException, put_menu_item, icon_name, label, tag, [0, 0, 0]) self.assertRaises(InvalidMenuItemCoordinatesException, put_menu_item, icon_name, label, tag, [4, 0, 0]) self.assertRaises(ReservedMenuItemException, delete_menu_item, [0, 0, 0]) self.assertRaises(ReservedMenuItemException, delete_menu_item, [1, 0, 0]) self.assertRaises(ReservedMenuItemException, delete_menu_item, [2, 0, 0]) self.assertRaises(ReservedMenuItemException, delete_menu_item, [3, 0, 0]) self.assertRaises(InvalidMenuItemCoordinatesException, delete_menu_item, [4, 0, 0]) mfd_a = self._create_flow('a') put_menu_item(icon_name, label, tag, [1, 1, 1], static_flow=mfd_a.identifier) put_menu_item(icon_name, label, tag, [1, 1, 1], static_flow=mfd_a.name) with open(os.path.join(os.path.dirname(__file__), "..", "bizz", "nuntiuz.zip")) as f: stream = StringIO() stream.write(f.read()) stream.seek(0) branding = store_branding(u'description', base64.b64encode(stream.read())) put_menu_item(icon_name, label, tag, [0, 1, 0], screen_branding=branding.id) put_menu_item(icon_name, label, tag, [0, 1, 0]) self.assertTrue(delete_menu_item([1, 1, 1])) self.assertTrue(delete_menu_item([0, 1, 0])) self.assertFalse(delete_menu_item([2, 1, 1])) put_reserved_menu_item_label(0, 'About 2') put_reserved_menu_item_label(0, 'Messages 2') put_reserved_menu_item_label(0, 'Call 2') put_reserved_menu_item_label(0, 'Recommend 2') self.assertRaises(InvalidMenuItemCoordinatesException, put_reserved_menu_item_label, 5, 'Invalid') def test_delete_flow(self): self._prepare_svc() mfd_a, mfd_b, mfd_c = self._create_flow(['a', 'b', 'c']) self.assertRaises(MessageFlowDesignInUseException, delete_flow, mfd_c.identifier) self.assertRaises(MessageFlowDesignInUseException, delete_flow, mfd_c.name) self.assertRaises(MessageFlowDesignInUseException, delete_flow, mfd_b.identifier) self.assertRaises(MessageFlowDesignInUseException, delete_flow, mfd_b.name) self.assertTrue(delete_flow(mfd_a.name)) self.assertTrue(delete_flow(mfd_b.identifier)) self.assertTrue(delete_flow(mfd_c.name)) self.assertFalse(delete_flow('I dont exist')) mfd_d = self._create_flow('d') qr.create('description d', 'tag d', None, None, mfd_d.name) self.assertRaises(MessageFlowDesignInUseException, delete_flow, mfd_d.name) mfd_e = self._create_flow('e') qr.create('description e', 'tag e', None, None, mfd_e.identifier) self.assertRaises(MessageFlowDesignInUseException, delete_flow, mfd_e.identifier) def test_put_flow(self): service_user = self._prepare_svc() # Test rubbish xml self.assertRaises(InvalidMessageFlowXmlException, put_flow, '<div></div>') self.assertRaises(InvalidMessageFlowXmlException, put_flow, 'invalid') # Test valid xml mfd1 = put_flow(VALID_XML1) self.assertEqual('Flow 1', mfd1.name) self.assertTrue(mfd1.identifier) mfd2 = put_flow(VALID_XML2) self.assertEqual('Flow 2', mfd2.name) self.assertTrue(mfd2.identifier) # Test breaking flows invalid_xml1 = '<messageFlowDefinition name="Stel een vraag" language="en" startReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9">\n <end id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=" waitForFollowUpMessage="false"/>\n <formMessage id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9" alertIntervalType="NONE" alertType="SILENT" positiveReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImZsdXNoXzEifQ==" vibrate="false" autoLock="true" negativeReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=">\n <content>Beste klant,\n\nBenader ons met al uw vragen inzake ons aanbod. Wij proberen u zo spoedig mogelijk te antwoorden.</content>\n <form positiveButtonConfirmation="" negativeButtonCaption="Cancel" positiveButtonCaption="Submit" negativeButtonConfirmation="">\n <widget xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TextBlockWidget" maxChars="50"/>\n </form>\n </formMessage>\n</messageFlowDefinition>' self.assertRaises(MessageFlowDesignValidationException, put_flow, invalid_xml1) # referencing unknown element invalid_xml2 = '<messageFlowDefinition name="Stel een vraag" language="en" startReference="base64:XXXeyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9">\n <end id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=" waitForFollowUpMessage="false"/>\n <formMessage id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9" alertIntervalType="NONE" alertType="SILENT" positiveReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImZsdXNoXzEifQ==" vibrate="false" autoLock="true" negativeReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=">\n <content>Beste klant,\n\nBenader ons met al uw vragen inzake ons aanbod. Wij proberen u zo spoedig mogelijk te antwoorden.</content>\n <form positiveButtonConfirmation="" negativeButtonCaption="Cancel" positiveButtonCaption="Submit" negativeButtonConfirmation="">\n <widget xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TextBlockWidget" maxChars="50"/>\n </form>\n </formMessage>\n <resultsFlush id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImZsdXNoXzEifQ==" reference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0="/>\n </messageFlowDefinition>' self.assertRaises(MessageFlowDesignValidationException, put_flow, invalid_xml2) # unknown startReference invalid_xml3 = '<messageFlowDefinition name="" language="en" startReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9">\n <end id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=" waitForFollowUpMessage="false"/>\n <formMessage id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogIm1lc3NhZ2VfMSJ9" alertIntervalType="NONE" alertType="SILENT" positiveReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImZsdXNoXzEifQ==" vibrate="false" autoLock="true" negativeReference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0=">\n <content>Beste klant,\n\nBenader ons met al uw vragen inzake ons aanbod. Wij proberen u zo spoedig mogelijk te antwoorden.</content>\n <form positiveButtonConfirmation="" negativeButtonCaption="Cancel" positiveButtonCaption="Submit" negativeButtonConfirmation="">\n <widget xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TextBlockWidget" maxChars="50"/>\n </form>\n </formMessage>\n <resultsFlush id="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImZsdXNoXzEifQ==" reference="base64:eyJsYW5nIjogImVuIiwgIm1mZCI6ICJhaE5rWlhaLWJXOWlhV05oWjJWamJHOTFaR2h5Y2o4TEVncHRZeTEwY21GamEyVnlJZ3B5TVVCbWIyOHVZMjl0REFzU0VVMWxjM05oWjJWR2JHOTNSR1Z6YVdkdUlnNVRkR1ZzSUdWbGJpQjJjbUZoWnd3IiwgImlkIjogImVuZF8xIn0="/>\n </messageFlowDefinition>' self.assertRaises(InvalidMessageFlowXmlException, put_flow, invalid_xml3) # name is empty # Test start_flow human_user = users.User(u'a@foo.com') create_user_profile(human_user, human_user.email(), language=u'nl') makeFriends(human_user, service_user, None, None, None) start_flow(None, None, mfd2.identifier, [human_user.email()]) def test_user_data(self): service_user = self._prepare_svc() friend_email = u"a%s@foo.com" % time.time() data = json.dumps(dict(test="hihihi")).decode('utf8') self.assertRaises(FriendNotFoundException, put_user_data, friend_email, data) # non-existing user human_user = users.User(friend_email) create_user_profile(human_user, friend_email, language=u'nl') self.assertRaises(FriendNotFoundException, put_user_data, friend_email, data) # user is no friend makeFriends(human_user, service_user, None, None, None) data = json.dumps(dict(test="ikkel", moe="hahaha")).decode('utf8') put_user_data(friend_email, data) data = json.dumps(dict(test="tikkel", john="doe")).decode('utf8') put_user_data(friend_email, data) get_helper = lambda: FriendHelper.from_data_store(service_user, FRIEND_TYPE_SERVICE) get_friendto = lambda: run_in_xg_transaction(lambda: FriendTO.fromDBFriendMap(get_helper(), get_friends_map(human_user), service_user, True, True, human_user)) ud = db.get(UserData.createKey(human_user, create_service_identity_user(service_user))) ud_dict = json.loads(ud.data) self.assertDictEqual({'test': "tikkel", 'moe': "hahaha", 'john': "doe"}, ud_dict) self.assertTrue(get_friendto().hasUserData) self.assertRaises(InvalidJsonStringException, put_user_data, friend_email, "invalid user data") self.assertRaises(InvalidJsonStringException, put_user_data, friend_email, "") del_user_data(friend_email, ["test"]) self.assertTrue(get_friendto().hasUserData) del_user_data(friend_email, ["moe", "john"]) self.assertFalse(get_friendto().hasUserData) japanese = u"スキーに行くのが好きです。" data_dict = dict(test="ikkel", moe="hahaha", japanese=japanese) data = json.dumps(data_dict).decode('utf8') put_user_data(friend_email, data) data = json.loads(get_user_data(friend_email, ["japanese"])) self.assertEqual(japanese, data["japanese"]) data = json.loads(get_user_data(friend_email, ["japanese", "test", "moe"])) self.assertDictEqual(data, data_dict)
74.309278
2,424
0.768244
2,608
28,832
8.259586
0.153758
0.014205
0.011467
0.013881
0.674667
0.618495
0.586695
0.548953
0.517385
0.497981
0
0.043573
0.154655
28,832
387
2,425
74.501292
0.840233
0.043008
0
0.172043
0
0.017921
0.440936
0.334132
0
0
0
0
0.27957
0
null
null
0
0.111111
null
null
0.043011
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
d8ab5f2fe7a0f16d5766496b4eb8280a2a35fcc2
1,585
py
Python
aioethereum/management/miner.py
h8is2w8/aioethereum
eb23e28068c34cda28bbef45c3f288d16936d88e
[ "MIT" ]
16
2017-10-04T17:44:51.000Z
2021-03-07T12:55:04.000Z
aioethereum/management/miner.py
h8is2w8/aioethereum
eb23e28068c34cda28bbef45c3f288d16936d88e
[ "MIT" ]
8
2017-10-04T22:53:08.000Z
2021-01-15T18:04:41.000Z
aioethereum/management/miner.py
h8is2w8/aioethereum
eb23e28068c34cda28bbef45c3f288d16936d88e
[ "MIT" ]
5
2018-02-22T15:56:34.000Z
2021-01-03T21:25:22.000Z
import asyncio class MinerMixin: @asyncio.coroutine def miner_setExtra(self, data): """https://github.com/ethereum/go-ethereum/wiki/Management-APIs#miner_setextra :param data: Extra data a miner can include when miner blocks :type data: str :rtype: bool """ return (yield from self.rpc_call('miner_setExtra', [data])) @asyncio.coroutine def miner_setGasPrice(self, number): """https://github.com/ethereum/go-ethereum/wiki/Management-APIs#miner_setgasprice :param number: Minimal accepted gas price when mining transactions :type number: int :rtype: bool """ return (yield from self.rpc_call('miner_setGasPrice', [hex(number)])) @asyncio.coroutine def miner_start(self, number): """https://github.com/ethereum/go-ethereum/wiki/Management-APIs#miner_start :param number: CPU mining process with the given number of threads :type number: int :rtype: None """ return (yield from self.rpc_call('miner_start', [number])) @asyncio.coroutine def miner_stop(self): """https://github.com/ethereum/go-ethereum/wiki/Management-APIs#miner_stop :rtype: bool """ return (yield from self.rpc_call('miner_stop')) @asyncio.coroutine def miner_setEtherBase(self, address): """https://github.com/ethereum/go-ethereum/wiki/Management-APIs#miner_setetherbase NOT AVAILABLE """ return (yield from self.rpc_call('miner_setEtherBase', [address]))
29.351852
90
0.650473
188
1,585
5.37766
0.308511
0.07913
0.093966
0.118694
0.531157
0.47181
0.47181
0.410485
0.410485
0.29179
0
0
0.233438
1,585
53
91
29.90566
0.832099
0.442271
0
0.294118
0
0
0.096552
0
0
0
0
0
0
1
0.294118
false
0
0.058824
0
0.705882
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
d8adad2f777b85bcef9cd306dfaac2c228734017
1,228
py
Python
pyautospell/spellchecker.py
adam-faulkner/PyAutoSpell
9fb6e519d0f09c1971de99a80297d6a0205371c8
[ "MIT" ]
6
2018-09-18T12:44:19.000Z
2021-05-04T15:51:52.000Z
pyautospell/spellchecker.py
adam-faulkner/PyAutoSpell
9fb6e519d0f09c1971de99a80297d6a0205371c8
[ "MIT" ]
1
2018-09-18T12:31:26.000Z
2018-09-30T16:00:24.000Z
pyautospell/spellchecker.py
adam-faulkner/PyAutoSpell
9fb6e519d0f09c1971de99a80297d6a0205371c8
[ "MIT" ]
null
null
null
from abc import ABC, abstractmethod class SpellChecker(ABC): def __init__(self): super().__init__() @abstractmethod def check_spelling(self, text, num_suggestions): ''' :param text: :param num_suggestions: :return: a list of objects of type misspelling ''' pass @abstractmethod def check_spelling(self, text, num_suggestions): ''' :param text: :param num_suggestions: :return: a list of objects of type Misspelling ''' pass @abstractmethod def check_word(self, text, num_suggestions): ''' Given a single word (no tokenization) return the corrected version :param text: :param num_suggestions: :return: an object of type Misspelling, which comtains the misspelled word and corrections ''' pass @abstractmethod def correct_spelling(self, text): ''' :param text: :return: object of type Correction ''' pass @abstractmethod def in_dict(self, text): ''' Is the word in the dictionary? :param text: :return: boolean ''' pass
22.740741
86
0.572476
125
1,228
5.472
0.368
0.122807
0.122807
0.096491
0.435673
0.435673
0.385965
0.385965
0.385965
0.385965
0
0
0.346091
1,228
53
87
23.169811
0.851806
0.384365
0
0.631579
0
0
0
0
0
0
0
0
0
1
0.315789
false
0.263158
0.052632
0
0.421053
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
d8c9bd2f23afecfc8dac2810fb61ef05cea20a64
2,864
py
Python
vaskitsa/python/file.py
hile/vaskitsa
acebf6cc970e9c342f6b8dc15f0c8d37b272aa5b
[ "PSF-2.0" ]
null
null
null
vaskitsa/python/file.py
hile/vaskitsa
acebf6cc970e9c342f6b8dc15f0c8d37b272aa5b
[ "PSF-2.0" ]
null
null
null
vaskitsa/python/file.py
hile/vaskitsa
acebf6cc970e9c342f6b8dc15f0c8d37b272aa5b
[ "PSF-2.0" ]
null
null
null
""" Base class for python file """ from pathlib import Path import os from pathlib_tree.exceptions import FilesystemError EMPTY_FILE = '''""" Automatically generated file """ ''' class PythonFile: """ Python code file """ def __init__(self, path, module=None, create_missing=False): self.module = module self.path = Path(path) if not self.path.is_file() and create_missing: with open(self.path, 'w', encoding='utf-8') as filedescriptor: filedescriptor.write(EMPTY_FILE) self.module_root = self.path.name == '__init__.py' def __repr__(self): if self.import_path is not None: if self.path.name == '__init__.py': return self.path.name return self.import_path return str(self.path) @property def relative_path(self): """ Return path relative to package """ if self.module and self.module.package: return self.path.relative_to(self.module.package) return None @property def relative_directory(self): """ Return parent directory relativve to package root """ if self.relative_path: return self.relative_path.parent return None @property def import_path(self): """ Return file import path """ path = self.relative_path if path is not None: if path.name == '__init__.py': path = path.with_suffix('').parent else: path = path.with_suffix('') return str(path).replace(os.sep, '.') return None @property def is_index(self): """ Check if this is file is module root index (__init__.py) """ return self.path.name == '__init__.py' @property def is_module_index(self): """ Check if this is file is modle root index (__init__) """ return self.module and self.module.parent is None and self.path.name == '__init__.py' @property def name(self): """ Return name of file without extension """ return self.path.stem def debug(self, *args): """ Pass debug message to parent """ if self.module: return self.module.debug(*args) raise FilesystemError('File not linked to a module') def error(self, *args): """ Pass error message to parent """ if self.module: return self.module.error(*args) raise FilesystemError('File not linked to a module') def message(self, *args): """ Pass messages to parent """ if self.module: return self.module.message(*args) raise FilesystemError('File not linked to a module')
25.571429
93
0.568436
334
2,864
4.703593
0.218563
0.08275
0.038192
0.044558
0.332272
0.264799
0.241884
0.204965
0.146404
0.062381
0
0.000522
0.331355
2,864
111
94
25.801802
0.819843
0.132332
0
0.241935
1
0
0.079823
0
0
0
0
0
0
1
0.177419
false
0
0.096774
0
0.532258
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
d8dc10a5d93f399bddb9c174fd03fa5085a93a40
232
py
Python
setup.py
pedropazzini/participacao_feminina_nas_empresas
641136468aa8b40cc9c5ef52313d1a2def1e3c76
[ "MIT" ]
null
null
null
setup.py
pedropazzini/participacao_feminina_nas_empresas
641136468aa8b40cc9c5ef52313d1a2def1e3c76
[ "MIT" ]
null
null
null
setup.py
pedropazzini/participacao_feminina_nas_empresas
641136468aa8b40cc9c5ef52313d1a2def1e3c76
[ "MIT" ]
null
null
null
from setuptools import find_packages, setup setup( name='src', packages=find_packages(), version='0.1.0', description='Analisa a participacao feminina nas empresas', author='Pedro Pazzini', license='MIT', )
21.090909
63
0.685345
28
232
5.607143
0.821429
0.152866
0
0
0
0
0
0
0
0
0
0.015957
0.189655
232
10
64
23.2
0.819149
0
0
0
0
0
0.293103
0
0
0
0
0
0
1
0
true
0
0.111111
0
0.111111
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
d8e1c4b7c0473ae420d3f7291de5a68bd190d94a
21,515
py
Python
geocube/pb/geocube_pb2.py
airbusgeo/geocube-client-python
adc41a98386be4e14d004f2af39a62930f710c9e
[ "Apache-2.0" ]
2
2021-07-05T06:47:14.000Z
2021-08-15T03:53:13.000Z
geocube/pb/geocube_pb2.py
airbusgeo/geocube-client-python
adc41a98386be4e14d004f2af39a62930f710c9e
[ "Apache-2.0" ]
null
null
null
geocube/pb/geocube_pb2.py
airbusgeo/geocube-client-python
adc41a98386be4e14d004f2af39a62930f710c9e
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: geocube/pb/geocube.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 from geocube.pb import catalog_pb2 as geocube_dot_pb_dot_catalog__pb2 from geocube.pb import records_pb2 as geocube_dot_pb_dot_records__pb2 from geocube.pb import variables_pb2 as geocube_dot_pb_dot_variables__pb2 from geocube.pb import layouts_pb2 as geocube_dot_pb_dot_layouts__pb2 from geocube.pb import operations_pb2 as geocube_dot_pb_dot_operations__pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='geocube/pb/geocube.proto', package='geocube', syntax='proto3', serialized_options=b'Z\014./pb;geocube', create_key=_descriptor._internal_create_key, serialized_pb=b'\n\x18geocube/pb/geocube.proto\x12\x07geocube\x1a\x1cgoogle/api/annotations.proto\x1a\x18geocube/pb/catalog.proto\x1a\x18geocube/pb/records.proto\x1a\x1ageocube/pb/variables.proto\x1a\x18geocube/pb/layouts.proto\x1a\x1bgeocube/pb/operations.proto\"\x13\n\x11GetVersionRequest\"%\n\x12GetVersionResponse\x12\x0f\n\x07Version\x18\x01 \x01(\t2\xd6\x16\n\x07Geocube\x12P\n\x0bListRecords\x12\x1b.geocube.ListRecordsRequest\x1a .geocube.ListRecordsResponseItem\"\x00\x30\x01\x12P\n\rCreateRecords\x12\x1d.geocube.CreateRecordsRequest\x1a\x1e.geocube.CreateRecordsResponse\"\x00\x12P\n\rDeleteRecords\x12\x1d.geocube.DeleteRecordsRequest\x1a\x1e.geocube.DeleteRecordsResponse\"\x00\x12S\n\x0e\x41\x64\x64RecordsTags\x12\x1e.geocube.AddRecordsTagsRequest\x1a\x1f.geocube.AddRecordsTagsResponse\"\x00\x12\\\n\x11RemoveRecordsTags\x12!.geocube.RemoveRecordsTagsRequest\x1a\".geocube.RemoveRecordsTagsResponse\"\x00\x12\x44\n\tCreateAOI\x12\x19.geocube.CreateAOIRequest\x1a\x1a.geocube.CreateAOIResponse\"\x00\x12;\n\x06GetAOI\x12\x16.geocube.GetAOIRequest\x1a\x17.geocube.GetAOIResponse\"\x00\x12S\n\x0e\x43reateVariable\x12\x1e.geocube.CreateVariableRequest\x1a\x1f.geocube.CreateVariableResponse\"\x00\x12\x62\n\x13InstantiateVariable\x12#.geocube.InstantiateVariableRequest\x1a$.geocube.InstantiateVariableResponse\"\x00\x12J\n\x0bGetVariable\x12\x1b.geocube.GetVariableRequest\x1a\x1c.geocube.GetVariableResponse\"\x00\x12V\n\rListVariables\x12\x1d.geocube.ListVariablesRequest\x1a\".geocube.ListVariablesResponseItem\"\x00\x30\x01\x12S\n\x0eUpdateVariable\x12\x1e.geocube.UpdateVariableRequest\x1a\x1f.geocube.UpdateVariableResponse\"\x00\x12S\n\x0eUpdateInstance\x12\x1e.geocube.UpdateInstanceRequest\x1a\x1f.geocube.UpdateInstanceResponse\"\x00\x12S\n\x0e\x44\x65leteVariable\x12\x1e.geocube.DeleteVariableRequest\x1a\x1f.geocube.DeleteVariableResponse\"\x00\x12S\n\x0e\x44\x65leteInstance\x12\x1e.geocube.DeleteInstanceRequest\x1a\x1f.geocube.DeleteInstanceResponse\"\x00\x12P\n\rCreatePalette\x12\x1d.geocube.CreatePaletteRequest\x1a\x1e.geocube.CreatePaletteResponse\"\x00\x12P\n\rIndexDatasets\x12\x1d.geocube.IndexDatasetsRequest\x1a\x1e.geocube.IndexDatasetsResponse\"\x00\x12\x62\n\x13\x43onfigConsolidation\x12#.geocube.ConfigConsolidationRequest\x1a$.geocube.ConfigConsolidationResponse\"\x00\x12k\n\x16GetConsolidationParams\x12&.geocube.GetConsolidationParamsRequest\x1a\'.geocube.GetConsolidationParamsResponse\"\x00\x12J\n\x0b\x43onsolidate\x12\x1b.geocube.ConsolidateRequest\x1a\x1c.geocube.ConsolidateResponse\"\x00\x12\x41\n\x08ListJobs\x12\x18.geocube.ListJobsRequest\x1a\x19.geocube.ListJobsResponse\"\x00\x12;\n\x06GetJob\x12\x16.geocube.GetJobRequest\x1a\x17.geocube.GetJobResponse\"\x00\x12\x44\n\tCleanJobs\x12\x19.geocube.CleanJobsRequest\x1a\x1a.geocube.CleanJobsResponse\"\x00\x12\x41\n\x08RetryJob\x12\x18.geocube.RetryJobRequest\x1a\x19.geocube.RetryJobResponse\"\x00\x12\x44\n\tCancelJob\x12\x19.geocube.CancelJobRequest\x1a\x1a.geocube.CancelJobResponse\"\x00\x12J\n\x0b\x43ontinueJob\x12\x1b.geocube.ContinueJobRequest\x1a\x1c.geocube.ContinueJobResponse\"\x00\x12@\n\x07GetCube\x12\x17.geocube.GetCubeRequest\x1a\x18.geocube.GetCubeResponse\"\x00\x30\x01\x12\x85\x01\n\nGetXYZTile\x12\x17.geocube.GetTileRequest\x1a\x18.geocube.GetTileResponse\"D\x82\xd3\xe4\x93\x02>\x12\x30/v1/catalog/mosaic/{instance_id}/{x}/{y}/{z}/pngb\nimage.data\x12M\n\x0c\x43reateLayout\x12\x1c.geocube.CreateLayoutRequest\x1a\x1d.geocube.CreateLayoutResponse\"\x00\x12M\n\x0c\x44\x65leteLayout\x12\x1c.geocube.DeleteLayoutRequest\x1a\x1d.geocube.DeleteLayoutResponse\"\x00\x12J\n\x0bListLayouts\x12\x1b.geocube.ListLayoutsRequest\x1a\x1c.geocube.ListLayoutsResponse\"\x00\x12@\n\x07TileAOI\x12\x17.geocube.TileAOIRequest\x1a\x18.geocube.TileAOIResponse\"\x00\x30\x01\x12G\n\nCreateGrid\x12\x1a.geocube.CreateGridRequest\x1a\x1b.geocube.CreateGridResponse\"\x00\x12G\n\nDeleteGrid\x12\x1a.geocube.DeleteGridRequest\x1a\x1b.geocube.DeleteGridResponse\"\x00\x12\x44\n\tListGrids\x12\x19.geocube.ListGridsRequest\x1a\x1a.geocube.ListGridsResponse\"\x00\x12\x44\n\x07Version\x12\x1a.geocube.GetVersionRequest\x1a\x1b.geocube.GetVersionResponse\"\x00\x42\x0eZ\x0c./pb;geocubeb\x06proto3' , dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,geocube_dot_pb_dot_catalog__pb2.DESCRIPTOR,geocube_dot_pb_dot_records__pb2.DESCRIPTOR,geocube_dot_pb_dot_variables__pb2.DESCRIPTOR,geocube_dot_pb_dot_layouts__pb2.DESCRIPTOR,geocube_dot_pb_dot_operations__pb2.DESCRIPTOR,]) _GETVERSIONREQUEST = _descriptor.Descriptor( name='GetVersionRequest', full_name='geocube.GetVersionRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=202, serialized_end=221, ) _GETVERSIONRESPONSE = _descriptor.Descriptor( name='GetVersionResponse', full_name='geocube.GetVersionResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='Version', full_name='geocube.GetVersionResponse.Version', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=223, serialized_end=260, ) DESCRIPTOR.message_types_by_name['GetVersionRequest'] = _GETVERSIONREQUEST DESCRIPTOR.message_types_by_name['GetVersionResponse'] = _GETVERSIONRESPONSE _sym_db.RegisterFileDescriptor(DESCRIPTOR) GetVersionRequest = _reflection.GeneratedProtocolMessageType('GetVersionRequest', (_message.Message,), { 'DESCRIPTOR' : _GETVERSIONREQUEST, '__module__' : 'geocube.pb.geocube_pb2' # @@protoc_insertion_point(class_scope:geocube.GetVersionRequest) }) _sym_db.RegisterMessage(GetVersionRequest) GetVersionResponse = _reflection.GeneratedProtocolMessageType('GetVersionResponse', (_message.Message,), { 'DESCRIPTOR' : _GETVERSIONRESPONSE, '__module__' : 'geocube.pb.geocube_pb2' # @@protoc_insertion_point(class_scope:geocube.GetVersionResponse) }) _sym_db.RegisterMessage(GetVersionResponse) DESCRIPTOR._options = None _GEOCUBE = _descriptor.ServiceDescriptor( name='Geocube', full_name='geocube.Geocube', file=DESCRIPTOR, index=0, serialized_options=None, create_key=_descriptor._internal_create_key, serialized_start=263, serialized_end=3165, methods=[ _descriptor.MethodDescriptor( name='ListRecords', full_name='geocube.Geocube.ListRecords', index=0, containing_service=None, input_type=geocube_dot_pb_dot_records__pb2._LISTRECORDSREQUEST, output_type=geocube_dot_pb_dot_records__pb2._LISTRECORDSRESPONSEITEM, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='CreateRecords', full_name='geocube.Geocube.CreateRecords', index=1, containing_service=None, input_type=geocube_dot_pb_dot_records__pb2._CREATERECORDSREQUEST, output_type=geocube_dot_pb_dot_records__pb2._CREATERECORDSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='DeleteRecords', full_name='geocube.Geocube.DeleteRecords', index=2, containing_service=None, input_type=geocube_dot_pb_dot_records__pb2._DELETERECORDSREQUEST, output_type=geocube_dot_pb_dot_records__pb2._DELETERECORDSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='AddRecordsTags', full_name='geocube.Geocube.AddRecordsTags', index=3, containing_service=None, input_type=geocube_dot_pb_dot_records__pb2._ADDRECORDSTAGSREQUEST, output_type=geocube_dot_pb_dot_records__pb2._ADDRECORDSTAGSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='RemoveRecordsTags', full_name='geocube.Geocube.RemoveRecordsTags', index=4, containing_service=None, input_type=geocube_dot_pb_dot_records__pb2._REMOVERECORDSTAGSREQUEST, output_type=geocube_dot_pb_dot_records__pb2._REMOVERECORDSTAGSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='CreateAOI', full_name='geocube.Geocube.CreateAOI', index=5, containing_service=None, input_type=geocube_dot_pb_dot_records__pb2._CREATEAOIREQUEST, output_type=geocube_dot_pb_dot_records__pb2._CREATEAOIRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='GetAOI', full_name='geocube.Geocube.GetAOI', index=6, containing_service=None, input_type=geocube_dot_pb_dot_records__pb2._GETAOIREQUEST, output_type=geocube_dot_pb_dot_records__pb2._GETAOIRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='CreateVariable', full_name='geocube.Geocube.CreateVariable', index=7, containing_service=None, input_type=geocube_dot_pb_dot_variables__pb2._CREATEVARIABLEREQUEST, output_type=geocube_dot_pb_dot_variables__pb2._CREATEVARIABLERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='InstantiateVariable', full_name='geocube.Geocube.InstantiateVariable', index=8, containing_service=None, input_type=geocube_dot_pb_dot_variables__pb2._INSTANTIATEVARIABLEREQUEST, output_type=geocube_dot_pb_dot_variables__pb2._INSTANTIATEVARIABLERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='GetVariable', full_name='geocube.Geocube.GetVariable', index=9, containing_service=None, input_type=geocube_dot_pb_dot_variables__pb2._GETVARIABLEREQUEST, output_type=geocube_dot_pb_dot_variables__pb2._GETVARIABLERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='ListVariables', full_name='geocube.Geocube.ListVariables', index=10, containing_service=None, input_type=geocube_dot_pb_dot_variables__pb2._LISTVARIABLESREQUEST, output_type=geocube_dot_pb_dot_variables__pb2._LISTVARIABLESRESPONSEITEM, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='UpdateVariable', full_name='geocube.Geocube.UpdateVariable', index=11, containing_service=None, input_type=geocube_dot_pb_dot_variables__pb2._UPDATEVARIABLEREQUEST, output_type=geocube_dot_pb_dot_variables__pb2._UPDATEVARIABLERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='UpdateInstance', full_name='geocube.Geocube.UpdateInstance', index=12, containing_service=None, input_type=geocube_dot_pb_dot_variables__pb2._UPDATEINSTANCEREQUEST, output_type=geocube_dot_pb_dot_variables__pb2._UPDATEINSTANCERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='DeleteVariable', full_name='geocube.Geocube.DeleteVariable', index=13, containing_service=None, input_type=geocube_dot_pb_dot_variables__pb2._DELETEVARIABLEREQUEST, output_type=geocube_dot_pb_dot_variables__pb2._DELETEVARIABLERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='DeleteInstance', full_name='geocube.Geocube.DeleteInstance', index=14, containing_service=None, input_type=geocube_dot_pb_dot_variables__pb2._DELETEINSTANCEREQUEST, output_type=geocube_dot_pb_dot_variables__pb2._DELETEINSTANCERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='CreatePalette', full_name='geocube.Geocube.CreatePalette', index=15, containing_service=None, input_type=geocube_dot_pb_dot_variables__pb2._CREATEPALETTEREQUEST, output_type=geocube_dot_pb_dot_variables__pb2._CREATEPALETTERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='IndexDatasets', full_name='geocube.Geocube.IndexDatasets', index=16, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._INDEXDATASETSREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._INDEXDATASETSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='ConfigConsolidation', full_name='geocube.Geocube.ConfigConsolidation', index=17, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._CONFIGCONSOLIDATIONREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._CONFIGCONSOLIDATIONRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='GetConsolidationParams', full_name='geocube.Geocube.GetConsolidationParams', index=18, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._GETCONSOLIDATIONPARAMSREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._GETCONSOLIDATIONPARAMSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='Consolidate', full_name='geocube.Geocube.Consolidate', index=19, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._CONSOLIDATEREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._CONSOLIDATERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='ListJobs', full_name='geocube.Geocube.ListJobs', index=20, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._LISTJOBSREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._LISTJOBSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='GetJob', full_name='geocube.Geocube.GetJob', index=21, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._GETJOBREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._GETJOBRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='CleanJobs', full_name='geocube.Geocube.CleanJobs', index=22, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._CLEANJOBSREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._CLEANJOBSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='RetryJob', full_name='geocube.Geocube.RetryJob', index=23, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._RETRYJOBREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._RETRYJOBRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='CancelJob', full_name='geocube.Geocube.CancelJob', index=24, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._CANCELJOBREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._CANCELJOBRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='ContinueJob', full_name='geocube.Geocube.ContinueJob', index=25, containing_service=None, input_type=geocube_dot_pb_dot_operations__pb2._CONTINUEJOBREQUEST, output_type=geocube_dot_pb_dot_operations__pb2._CONTINUEJOBRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='GetCube', full_name='geocube.Geocube.GetCube', index=26, containing_service=None, input_type=geocube_dot_pb_dot_catalog__pb2._GETCUBEREQUEST, output_type=geocube_dot_pb_dot_catalog__pb2._GETCUBERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='GetXYZTile', full_name='geocube.Geocube.GetXYZTile', index=27, containing_service=None, input_type=geocube_dot_pb_dot_catalog__pb2._GETTILEREQUEST, output_type=geocube_dot_pb_dot_catalog__pb2._GETTILERESPONSE, serialized_options=b'\202\323\344\223\002>\0220/v1/catalog/mosaic/{instance_id}/{x}/{y}/{z}/pngb\nimage.data', create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='CreateLayout', full_name='geocube.Geocube.CreateLayout', index=28, containing_service=None, input_type=geocube_dot_pb_dot_layouts__pb2._CREATELAYOUTREQUEST, output_type=geocube_dot_pb_dot_layouts__pb2._CREATELAYOUTRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='DeleteLayout', full_name='geocube.Geocube.DeleteLayout', index=29, containing_service=None, input_type=geocube_dot_pb_dot_layouts__pb2._DELETELAYOUTREQUEST, output_type=geocube_dot_pb_dot_layouts__pb2._DELETELAYOUTRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='ListLayouts', full_name='geocube.Geocube.ListLayouts', index=30, containing_service=None, input_type=geocube_dot_pb_dot_layouts__pb2._LISTLAYOUTSREQUEST, output_type=geocube_dot_pb_dot_layouts__pb2._LISTLAYOUTSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='TileAOI', full_name='geocube.Geocube.TileAOI', index=31, containing_service=None, input_type=geocube_dot_pb_dot_layouts__pb2._TILEAOIREQUEST, output_type=geocube_dot_pb_dot_layouts__pb2._TILEAOIRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='CreateGrid', full_name='geocube.Geocube.CreateGrid', index=32, containing_service=None, input_type=geocube_dot_pb_dot_layouts__pb2._CREATEGRIDREQUEST, output_type=geocube_dot_pb_dot_layouts__pb2._CREATEGRIDRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='DeleteGrid', full_name='geocube.Geocube.DeleteGrid', index=33, containing_service=None, input_type=geocube_dot_pb_dot_layouts__pb2._DELETEGRIDREQUEST, output_type=geocube_dot_pb_dot_layouts__pb2._DELETEGRIDRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='ListGrids', full_name='geocube.Geocube.ListGrids', index=34, containing_service=None, input_type=geocube_dot_pb_dot_layouts__pb2._LISTGRIDSREQUEST, output_type=geocube_dot_pb_dot_layouts__pb2._LISTGRIDSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='Version', full_name='geocube.Geocube.Version', index=35, containing_service=None, input_type=_GETVERSIONREQUEST, output_type=_GETVERSIONRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), ]) _sym_db.RegisterServiceDescriptor(_GEOCUBE) DESCRIPTOR.services_by_name['Geocube'] = _GEOCUBE # @@protoc_insertion_point(module_scope)
44.088115
4,205
0.805996
2,482
21,515
6.545931
0.139807
0.045424
0.059088
0.07386
0.477504
0.461685
0.438727
0.430603
0.35225
0.341171
0
0.036014
0.096584
21,515
487
4,206
44.178645
0.799866
0.016082
0
0.486957
1
0.023913
0.242189
0.212507
0
0
0
0
0
1
0
false
0
0.021739
0
0.021739
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
2b00d0ed08a6f57c57ca541871594b7f898c314e
278
py
Python
EX 20 Ordem aleatoria.py
RODRIGOKTK/Python-exercicios
f7985f2c277aae8b158bdeea4f2493febaaf06c5
[ "Unlicense" ]
null
null
null
EX 20 Ordem aleatoria.py
RODRIGOKTK/Python-exercicios
f7985f2c277aae8b158bdeea4f2493febaaf06c5
[ "Unlicense" ]
null
null
null
EX 20 Ordem aleatoria.py
RODRIGOKTK/Python-exercicios
f7985f2c277aae8b158bdeea4f2493febaaf06c5
[ "Unlicense" ]
null
null
null
from random import shuffle n1 = str(input('O primeiro aluno: ')) n2 = str(input('O segundo aluno: ')) n3 = str(input('O terciro aluno: ')) n4 = str(input('O quarto aluno: ')) lista = [n1, n2, n3, n4] shuffle(lista) print('A ordem de apresentação será {} !'.format(lista))
34.75
56
0.647482
43
278
4.186047
0.55814
0.177778
0.2
0
0
0
0
0
0
0
0
0.034783
0.172662
278
8
56
34.75
0.747826
0
0
0
0
0
0.371324
0
0
0
0
0
0
1
0
false
0
0.125
0
0.125
0.125
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
2b01f6e3245dc5ba4a4c6e77434c48294daf284f
3,188
py
Python
test/countries/test_estonia.py
m-ganko/python-holidays
f0d5a91f8bee8661ef3440bde2302332a364877e
[ "MIT" ]
654
2018-01-19T06:48:53.000Z
2022-03-26T07:44:58.000Z
test/countries/test_estonia.py
m-ganko/python-holidays
f0d5a91f8bee8661ef3440bde2302332a364877e
[ "MIT" ]
525
2018-01-16T20:16:43.000Z
2022-03-31T13:19:02.000Z
test/countries/test_estonia.py
m-ganko/python-holidays
f0d5a91f8bee8661ef3440bde2302332a364877e
[ "MIT" ]
320
2017-11-20T16:06:22.000Z
2022-03-18T12:55:13.000Z
# -*- coding: utf-8 -*- # python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Author: ryanss <ryanssdev@icloud.com> (c) 2014-2017 # dr-prodigy <maurizio.montel@gmail.com> (c) 2017-2021 # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) import unittest from datetime import date, datetime import holidays class TestEstonia(unittest.TestCase): def setUp(self): self.holidays = holidays.EE() self.cur_date = datetime.now() def test_new_years(self): test_date = date(self.cur_date.year, 1, 1) self.assertEqual(self.holidays.get(test_date), "uusaasta") self.assertIn(test_date, self.holidays) def test_independence_day(self): test_date = date(self.cur_date.year, 2, 24) self.assertEqual(self.holidays.get(test_date), "iseseisvuspäev") self.assertIn(test_date, self.holidays) def test_good_friday(self): test_date = date(2019, 4, 19) self.assertEqual(self.holidays.get(test_date), "suur reede") self.assertIn(test_date, self.holidays) def test_easter_sunday(self): test_date = date(2019, 4, 21) self.assertEqual( self.holidays.get(test_date), "ülestõusmispühade 1. püha" ) self.assertIn(test_date, self.holidays) def test_spring_day(self): test_date = date(self.cur_date.year, 5, 1) self.assertEqual(self.holidays.get(test_date), "kevadpüha") self.assertIn(test_date, self.holidays) def test_pentecost(self): test_date = date(2019, 6, 9) self.assertEqual(self.holidays.get(test_date), "nelipühade 1. püha") self.assertIn(test_date, self.holidays) def test_victory_day(self): test_date = date(self.cur_date.year, 6, 23) self.assertEqual(self.holidays.get(test_date), "võidupüha") self.assertIn(test_date, self.holidays) def test_midsummers_day(self): test_date = date(self.cur_date.year, 6, 24) self.assertEqual(self.holidays.get(test_date), "jaanipäev") self.assertIn(test_date, self.holidays) def test_restoration_of_independence_day(self): test_date = date(self.cur_date.year, 8, 20) self.assertEqual(self.holidays.get(test_date), "taasiseseisvumispäev") self.assertIn(test_date, self.holidays) def test_christmas_eve(self): test_date = date(self.cur_date.year, 12, 24) self.assertEqual(self.holidays.get(test_date), "jõululaupäev") self.assertIn(test_date, self.holidays) def test_christmas_day(self): test_date = date(self.cur_date.year, 12, 25) self.assertEqual(self.holidays.get(test_date), "esimene jõulupüha") self.assertIn(test_date, self.holidays) def test_boxing_day(self): test_date = date(self.cur_date.year, 12, 26) self.assertEqual(self.holidays.get(test_date), "teine jõulupüha") self.assertIn(test_date, self.holidays)
36.643678
78
0.678795
431
3,188
4.856148
0.273782
0.137602
0.068801
0.091734
0.652174
0.642618
0.622551
0.471572
0.231725
0.153846
0
0.026316
0.20138
3,188
86
79
37.069767
0.795758
0.149624
0
0.210526
0
0
0.061504
0
0
0
0
0
0.421053
1
0.22807
false
0
0.052632
0
0.298246
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
1
0
1
0
0
0
0
0
0
0
2
2b04e81e938bf63431dac1088044fdca7515cc33
8,060
py
Python
pysnmp/ENTERASYS-VRRP-EXT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/ENTERASYS-VRRP-EXT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/ENTERASYS-VRRP-EXT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module ENTERASYS-VRRP-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-VRRP-EXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:50:36 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection") etsysModules, = mibBuilder.importSymbols("ENTERASYS-MIB-NAMES", "etsysModules") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") ObjectIdentity, IpAddress, Counter64, ModuleIdentity, Unsigned32, Bits, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, MibIdentifier, Integer32, iso, NotificationType, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "IpAddress", "Counter64", "ModuleIdentity", "Unsigned32", "Bits", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "MibIdentifier", "Integer32", "iso", "NotificationType", "Gauge32") TextualConvention, DisplayString, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "RowStatus") VrId, vrrpOperationsInetAddrType = mibBuilder.importSymbols("VRRP-MIB", "VrId", "vrrpOperationsInetAddrType") etsysVrrpExtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64)) etsysVrrpExtMIB.setRevisions(('2009-08-10 19:43',)) if mibBuilder.loadTexts: etsysVrrpExtMIB.setLastUpdated('200908101943Z') if mibBuilder.loadTexts: etsysVrrpExtMIB.setOrganization('Enterasys Networks, Inc') etsysVrrpExtOperations = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1)) etsysVrrpExtConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 2)) etsysVrrpExtOperTable = MibTable((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 1), ) if mibBuilder.loadTexts: etsysVrrpExtOperTable.setStatus('current') etsysVrrpExtOperEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtOperVrId")) if mibBuilder.loadTexts: etsysVrrpExtOperEntry.setStatus('current') etsysVrrpExtOperVrId = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 1, 1, 1), VrId()) if mibBuilder.loadTexts: etsysVrrpExtOperVrId.setStatus('current') etsysVrrpExtOperState = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("initialize", 1), ("backup", 2), ("master", 3), ("ifDown", 4), ("preemptDelay", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: etsysVrrpExtOperState.setStatus('current') etsysVrrpExtOperAcceptMode = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: etsysVrrpExtOperAcceptMode.setStatus('current') etsysVrrpExtOperPreemptModeDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 1, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: etsysVrrpExtOperPreemptModeDelay.setStatus('current') etsysVrrpExtOperCriticalIpAddrCount = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: etsysVrrpExtOperCriticalIpAddrCount.setStatus('current') etsysVrrpExtCriticalIpAddrTable = MibTable((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 2), ) if mibBuilder.loadTexts: etsysVrrpExtCriticalIpAddrTable.setStatus('current') etsysVrrpExtCriticalIpAddrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtOperVrId"), (0, "VRRP-MIB", "vrrpOperationsInetAddrType"), (0, "ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtCriticalIpAddr")) if mibBuilder.loadTexts: etsysVrrpExtCriticalIpAddrEntry.setStatus('current') etsysVrrpExtCriticalIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 2, 1, 1), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), ))) if mibBuilder.loadTexts: etsysVrrpExtCriticalIpAddr.setStatus('current') etsysVrrpExtCriticalIpAddrPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 254)).clone(10)).setMaxAccess("readcreate") if mibBuilder.loadTexts: etsysVrrpExtCriticalIpAddrPriority.setStatus('current') etsysVrrpExtCriticalIpAddrState = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: etsysVrrpExtCriticalIpAddrState.setStatus('current') etsysVrrpExtCriticalIpAddrRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 1, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: etsysVrrpExtCriticalIpAddrRowStatus.setStatus('current') etsysVrrpExtMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 2, 1)) etsysVrrpExtMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 2, 2)) etsysVrrpExtMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 2, 2, 1)).setObjects(("ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtOperState"), ("ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtOperAcceptMode"), ("ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtOperPreemptModeDelay"), ("ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtOperCriticalIpAddrCount"), ("ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtCriticalIpAddrPriority"), ("ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtCriticalIpAddrState"), ("ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtCriticalIpAddrRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsysVrrpExtMIBGroup = etsysVrrpExtMIBGroup.setStatus('current') etsysVrrpExtMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 5624, 1, 2, 64, 2, 1, 1)).setObjects(("ENTERASYS-VRRP-EXT-MIB", "etsysVrrpExtMIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsysVrrpExtMIBCompliance = etsysVrrpExtMIBCompliance.setStatus('current') mibBuilder.exportSymbols("ENTERASYS-VRRP-EXT-MIB", etsysVrrpExtMIBGroup=etsysVrrpExtMIBGroup, etsysVrrpExtOperPreemptModeDelay=etsysVrrpExtOperPreemptModeDelay, etsysVrrpExtCriticalIpAddrTable=etsysVrrpExtCriticalIpAddrTable, etsysVrrpExtConformance=etsysVrrpExtConformance, etsysVrrpExtOperations=etsysVrrpExtOperations, etsysVrrpExtCriticalIpAddrRowStatus=etsysVrrpExtCriticalIpAddrRowStatus, etsysVrrpExtMIBCompliances=etsysVrrpExtMIBCompliances, etsysVrrpExtOperEntry=etsysVrrpExtOperEntry, etsysVrrpExtOperCriticalIpAddrCount=etsysVrrpExtOperCriticalIpAddrCount, etsysVrrpExtCriticalIpAddrState=etsysVrrpExtCriticalIpAddrState, etsysVrrpExtCriticalIpAddr=etsysVrrpExtCriticalIpAddr, etsysVrrpExtOperState=etsysVrrpExtOperState, etsysVrrpExtCriticalIpAddrPriority=etsysVrrpExtCriticalIpAddrPriority, etsysVrrpExtMIBCompliance=etsysVrrpExtMIBCompliance, PYSNMP_MODULE_ID=etsysVrrpExtMIB, etsysVrrpExtOperVrId=etsysVrrpExtOperVrId, etsysVrrpExtOperTable=etsysVrrpExtOperTable, etsysVrrpExtMIB=etsysVrrpExtMIB, etsysVrrpExtOperAcceptMode=etsysVrrpExtOperAcceptMode, etsysVrrpExtMIBGroups=etsysVrrpExtMIBGroups, etsysVrrpExtCriticalIpAddrEntry=etsysVrrpExtCriticalIpAddrEntry)
134.333333
1,176
0.778288
825
8,060
7.601212
0.195152
0.009887
0.009568
0.012757
0.317015
0.221496
0.211928
0.201403
0.201403
0.201403
0
0.066353
0.076303
8,060
59
1,177
136.610169
0.775957
0.041935
0
0.039216
0
0
0.194477
0.077791
0
0
0
0
0
1
0
false
0
0.196078
0
0.196078
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2b062b44871a31384b3526d78f22edb61d5886ec
358
py
Python
state_machine/states/base/_forced_transition_message.py
ragavsachdeva/shef
9475f0683422c200986de8e19526b3929361ac33
[ "MIT" ]
null
null
null
state_machine/states/base/_forced_transition_message.py
ragavsachdeva/shef
9475f0683422c200986de8e19526b3929361ac33
[ "MIT" ]
null
null
null
state_machine/states/base/_forced_transition_message.py
ragavsachdeva/shef
9475f0683422c200986de8e19526b3929361ac33
[ "MIT" ]
null
null
null
from dataclasses import dataclass from typing import List, Literal from dataclasses_json import dataclass_json @dataclass_json @dataclass class ForcedTransitionMessage: access_control: Literal["preempt_if_in_given_states", "ignore_if_in_given_states"] potential_current_states: List[str] target_state: str kill_state_machine: bool = False
25.571429
86
0.818436
46
358
6
0.586957
0.108696
0.15942
0.108696
0
0
0
0
0
0
0
0
0.131285
358
13
87
27.538462
0.88746
0
0
0
0
0
0.142458
0.142458
0
0
0
0
0
1
0
true
0
0.3
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
2
2b06d42592872874de290f9c5566de097f45c1f3
25,002
py
Python
utilities.py
Wolferz/wolfbot
43e6ecd144d0ec2f5d71609c7aa92aa77bde56d6
[ "BSD-2-Clause" ]
1
2019-06-14T13:25:06.000Z
2019-06-14T13:25:06.000Z
utilities.py
Wolferz/WolfBot
43e6ecd144d0ec2f5d71609c7aa92aa77bde56d6
[ "BSD-2-Clause" ]
null
null
null
utilities.py
Wolferz/WolfBot
43e6ecd144d0ec2f5d71609c7aa92aa77bde56d6
[ "BSD-2-Clause" ]
null
null
null
import discord import asyncio import random from discord.ext import commands from time import localtime, timezone modrole = 348838039302307840 class Utilities(commands.Cog): def __init__(self, client): self.client = client @commands.command(name='spam', description='Spams a message that follow the command', brief='Spams a Message') async def spam(self, ctx, *, msg): iti = 1 while iti != 6: await ctx.send(msg) iti = iti + 1 @commands.command(name='prunetest', description='Shows how many members will be removed if server is pruned for a number of days') async def prunetest(self, ctx, days): try: await ctx.send(await ctx.guild.estimate_pruned_members(days=int(days))) except Exception as error: await ctx.send('ERROR: \n{}'.format(error)) @commands.command() async def ping(self, ctx): ping = int(self.client.latency * 100) await ctx.send(':ping_pong: Pong! (In {}ms)'.format(str(ping))) @commands.command(name='changeplay', description='Changes the game that the bot is playing', brief='Change the Game') async def changeplay(self, ctx, game): await self.client.change_presence(game=discord.Game(name=game)) await ctx.send("Success! I'm now playing " + game) @commands.command(name='cdndr', description='Utility for Finding an Id for Development, Console Required', brief='follow with an @mention') async def cdndr(self, ctx, rle): print(rle) await ctx.send('`' + rle + '`') @commands.command(name='timer', description='Start a Timer', brief='Timer') async def timer(self, ctx, Minutes, Seconds): sender = ctx.message.author.mention await ctx.send('Timer started for ' + Minutes + ' minutes and ' + Seconds + ' seconds.') time = (int(Minutes) * 60) + int(Seconds) await asyncio.sleep(time) await ctx.send('The timer set by ' + sender + ', is done') @commands.command(name='dale', description='dale', brief='dale') async def dale(self, ctx): if ctx.message.server == 333534981831917570: ctx.send('<@164876392494792705>, You a bitch') @commands.command(name='rc', description='A ready Check', brief='Ready Check', aliases=['Readycheck', 'readycheck']) async def rc(self, ctx, tot): global ready global tim tot = int(tot) if tot <= 0: await ctx.send('You need to specify how many people we are waiting on') else: await ctx.send('Ready Check! Waiting on ' + str(tot) + 'People!' + '\n' + "Ready Up with '!r'") ready = 0 tim = 0 while ready < tot: if tim == (15 * 3): await ctx.send("The ready check has timed out") break tim = tim + 3 await asyncio.sleep(3) if ready >= tot: await ctx.send('Everyone is Ready!') @commands.command(name='r', brief='Used in a Ready Check', aliases=['R']) async def r(self, ctx): global ready global tim ready = ready + 1 tim = 0 await ctx.send(ctx.message.author.mention + 'has readied up!') @commands.command(name='opt', # FIXME Cant poll server for roles correctly brief='Opt in or out for mention notifications') async def opt(self, ctx, inorout, entered_role): team_list = ["Overwatch", "Ark", "WoW"] entered_team = entered_role.lower() role = discord.utils.get(ctx.message.server.roles, name=entered_team) #roles = [ # # IDs of the roles for the teams # '526447124821573642', # Overwatch # '526447129477120007', # Ark # '526447131641380885', # Wow #] print(role.name) if role is None or role.name not in team_list: # If the role wasn't found by discord.utils.get() or is a role that we don't want to add: await ctx.send('Unknown role, possible roles are Overwatch, Ark, and WoW') return elif role in ctx.message.author.roles: # If they already have the role await ctx.send("You already have this role.") else: try: await self.client.add_roles(ctx.message.author, role) await self.client.send_message(ctx.message.channel, "Successfully added role {0}".format(role.name)) except discord.Forbidden: await self.client.send_message(ctx.message.channel, "I don't have perms to add roles.") @commands.command(name='announce', brief='Mods Only', no_pm=True) async def announce(self, ctx, channel: discord.TextChannel, *, msg): if 'moderator' in [y.name.lower() for y in ctx.message.author.roles]: announcement = 'Announcement:' + '\n' + msg await channel.send(announcement) elif 'moderator' not in [y.name.lower() for y in ctx.message.author.roles]: ctx.send("You do not have permission to use this command") @commands.command(name='hello', description='It is good to be polite when meeting new friends', brief='Make a first impression', aliases=['hi, hia, hiya']) async def hello(self, ctx): await ctx.send('Hello, ' + ctx.message.author.mention) @commands.command(name='time', description='Returns the time of the bot', brief='Bot Time') async def time(self, ctx): await ctx.send( 'Time: ' + str(localtime().tm_hour) + ':' + str(localtime().tm_min) + '\n' + 'Timezone: ' + str( timezone) + '\n' + 'Daylight Savings: ' + str(localtime().tm_isdst)) @commands.command() async def shutdown(self, ctx): await ctx.send('Sorry ' + ctx.message.author.mention + ", I can't let you do that.") @commands.command() async def makemeasandwich(self, ctx): await ctx.send(':hamburger:') @commands.command() async def filemytaxes(self, ctx): await ctx.send('No, do them yourself:' + '\n' + 'https://www.irs.gov/forms-instructions') @commands.command() async def randomcatfact(self, ctx): facts = [ 'Unlike dogs, cats do not have a sweet tooth. Scientists believe this is due to a mutation in a key taste receptor.', 'When a cat chases its prey, it keeps its head level. Dogs and humans bob their heads up and down.', 'The technical term for a cat’s hairball is a “bezoar.”', 'A group of cats is called a “clowder.”', 'A cat can’t climb head first down a tree because every claw on a cat’s paw points the same way. To get down from a tree, a cat must back down.', 'Cats make about 100 different sounds. Dogs make only about 10.', 'There are more than 500 million domestic cats in the world, with approximately 40 recognized breeds.', 'Approximately 24 cat skins can make a coat.', 'While it is commonly thought that the ancient Egyptians were the first to domesticate cats, the oldest known pet cat was recently found in a 9,500-year-old grave on the Mediterranean island of Cyprus. This grave predates early Egyptian art depicting cats by 4,000 years or more.', 'During the time of the Spanish Inquisition, Pope Innocent VIII condemned cats as evil and thousands of cats were burned. Unfortunately, the widespread killing of cats led to an explosion of the rat population, which exacerbated the effects of the Black Death.', 'During the Middle Ages, cats were associated with withcraft, and on St. John’s Day, people all over Europe would stuff them into sacks and toss the cats into bonfires. On holy days, people celebrated by tossing cats from church towers.', 'The first cat in space was a French cat named Felicette (a.k.a. “Astrocat”) In 1963, France blasted the cat into outer space. Electrodes implanted in her brains sent neurological signals back to Earth. She survived the trip.', 'The group of words associated with cat (catt, cath, chat, katze) stem from the Latin catus, meaning domestic cat, as opposed to feles, or wild cat.', 'The term “puss” is the root of the principal word for “cat” in the Romanian term pisica and the root of secondary words in Lithuanian (puz) and Low German puus. Some scholars suggest that “puss” could be imitative of the hissing sound used to get a cat’s attention. As a slang word for the female pudenda, it could be associated with the connotation of a cat being soft, warm, and fuzzy.', 'Approximately 40,000 people are bitten by cats in the U.S. annually.', 'Cats are North America’s most popular pets: there are 73 million cats compared to 63 million dogs. Over 30% of households in North America own a cat.', 'According to Hebrew legend, Noah prayed to God for help protecting all the food he stored on the ark from being eaten by rats. In reply, God made the lion sneeze, and out popped a cat.', 'A cat’s hearing is better than a dog’s. And a cat can hear high-frequency sounds up to two octaves higher than a human.', 'A cat can travel at a top speed of approximately 31 mph (49 km) over a short distance.', 'A cat rubs against people not only to be affectionate but also to mark out its territory with scent glands around its face. The tail area and paws also carry the cat’s scent.', 'Researchers are unsure exactly how a cat purrs. Most veterinarians believe that a cat purrs by vibrating vocal folds deep in the throat. To do this, a muscle in the larynx opens and closes the air passage about 25 times per second.', 'When a family cat died in ancient Egypt, family members would mourn by shaving off their eyebrows. They also held elaborate funerals during which they drank wine and beat their breasts. The cat was embalmed with a sculpted wooden mask and the tiny mummy was placed in the family tomb or in a pet cemetery with tiny mummies of mice.', 'In 1888, more than 300,000 mummified cats were found an Egyptian cemetery. They were stripped of their wrappings and carted off to be used by farmers in England and the U.S. for fertilizer.', 'Most cats give birth to a litter of between one and nine kittens. The largest known litter ever produced was 19 kittens, of which 15 survived.', 'Smuggling a cat out of ancient Egypt was punishable by death. Phoenician traders eventually succeeded in smuggling felines, which they sold to rich people in Athens and other important cities.', 'The earliest ancestor of the modern cat lived about 30 million years ago. Scientists called it the Proailurus, which means “first cat” in Greek. The group of animals that pet cats belong to emerged around 12 million years ago.', 'The biggest wildcat today is the Siberian Tiger. It can be more than 12 feet (3.6 m) long (about the size of a small car) and weigh up to 700 pounds (317 kg).', 'A cat’s brain is biologically more similar to a human brain than it is to a dog’s. Both humans and cats have identical regions in their brains that are responsible for emotions.', 'Many Egyptians worshipped the goddess Bast, who had a woman’s body and a cat’s head.', 'Mohammed loved cats and reportedly his favorite cat, Muezza, was a tabby. Legend says that tabby cats have an “M” for Mohammed on top of their heads because Mohammad would often rest his hand on the cat’s head.', 'While many parts of Europe and North America consider the black cat a sign of bad luck, in Britain and Australia, black cats are considered lucky.', 'The most popular pedigreed cat is the Persian cat, followed by the Main Coon cat and the Siamese cat.', 'The smallest pedigreed cat is a Singapura, which can weigh just 4 lbs (1.8 kg), or about five large cans of cat food. The largest pedigreed cats are Maine Coon cats, which can weigh 25 lbs (11.3 kg), or nearly twice as much as an average cat weighs.', 'Some cats have survived falls of over 65 feet (20 meters), due largely to their “righting reflex.” The eyes and balance organs in the inner ear tell it where it is in space so the cat can land on its feet. Even cats without a tail have this ability.', 'Some Siamese cats appear cross-eyed because the nerves from the left side of the brain go to mostly the right eye and the nerves from the right side of the brain go mostly to the left eye. This causes some double vision, which the cat tries to correct by “crossing” its eyes.', 'Researchers believe the word “tabby” comes from Attabiyah, a neighborhood in Baghdad, Iraq. Tabbies got their name because their striped coats resembled the famous wavy patterns in the silk produced in this city.', 'A cat can jump up to five times its own height in a single bound.', 'Cats hate the water because their fur does not insulate well when it’s wet. The Turkish Van, however, is one cat that likes swimming. Bred in central Asia, its coat has a unique texture that makes it water resistant.', 'The Egyptian Mau is probably the oldest breed of cat. In fact, the breed is so ancient that its name is the Egyptian word for “cat.”', 'The first commercially cloned pet was a cat named "Little Nicky." He cost his owner $50,000, making him one of the most expensive cats ever.', 'A cat usually has about 12 whiskers on each side of its face.', 'A cat’s eyesight is both better and worse than humans. It is better because cats can see in much dimmer light and they have a wider peripheral view. It’s worse because they don’t see color as well as humans do. Scientists believe grass appears red to cats.', 'Spanish-Jewish folklore recounts that Adam’s first wife, Lilith, became a black vampire cat, sucking the blood from sleeping babies. This may be the root of the superstition that a cat will smother a sleeping baby or suck out the child’s breath.', 'Perhaps the most famous comic cat is the Cheshire Cat in Lewis Carroll’s Alice in Wonderland. With the ability to disappear, this mysterious character embodies the magic and sorcery historically associated with cats.', 'The smallest wildcat today is the Black-footed cat. The females are less than 20 inches (50 cm) long and can weigh as little as 2.5 lbs (1.2 kg).', 'On average, cats spend 2/3 of every day sleeping. That means a nine-year-old cat has been awake for only three years of its life.', 'In the original Italian version of Cinderella, the benevolent fairy godmother figure was a cat.', 'The little tufts of hair in a cat’s ear that help keep out dirt direct sounds into the ear, and insulate the ears are called “ear furnishings.”', 'The ability of a cat to find its way home is called “psi-traveling.” Experts think cats either use the angle of the sunlight to find their way or that cats have magnetized cells in their brains that act as compasses.', 'Isaac Newton invented the cat flap. Newton was experimenting in a pitch-black room. Spithead, one of his cats, kept opening the door and wrecking his experiment. The cat flap kept both Newton and Spithead happy.', 'The world’s rarest coffee, Kopi Luwak, comes from Indonesia where a wildcat known as the luwak lives. The cat eats coffee berries and the coffee beans inside pass through the stomach. The beans are harvested from the cat’s dung heaps and then cleaned and roasted. Kopi Luwak sells for about $500 for a 450 g (1 lb) bag.', 'A cat’s jaw can’t move sideways, so a cat can’t chew large chunks of food.', "Cats don't actually meow at each other, just at humans. Cats typically will spit, purr, and hiss at other cats.", 'Female cats tend to be right pawed, while male cats are more often left pawed. Interestingly, while 90% of humans are right handed, the remaining 10% of lefties also tend to be male.', 'A cat’s back is extremely flexible because it has up to 53 loosely fitting vertebrae. Humans only have 34.', 'All cats have claws, and all except the cheetah sheath them when at rest.', 'Two members of the cat family are distinct from all others: the clouded leopard and the cheetah. The clouded leopard does not roar like other big cats, nor does it groom or rest like small cats. The cheetah is unique because it is a running cat; all others are leaping cats. They are leaping cats because they slowly stalk their prey and then leap on it.', 'A cat lover is called an Ailurophilia (Greek: cat+lover).', 'In Japan, cats are thought to have the power to turn into super spirits when they die. This may be because according to the Buddhist religion, the body of the cat is the temporary resting place of very spiritual people.', 'Most cats had short hair until about 100 years ago, when it became fashionable to own cats and experiment with breeding.', 'One reason that kittens sleep so much is because a growth hormone is released only during sleep.', 'Cats have about 130,000 hairs per square inch (20,155 hairs per square centimeter).', 'The heaviest cat on record is Himmy, a Tabby from Queensland, Australia. He weighed nearly 47 pounds (21 kg). He died at the age of 10.', 'The oldest cat on record was Crème Puff from Austin, Texas, who lived from 1967 to August 6, 2005, three days after her 38th birthday. A cat typically can live up to 20 years, which is equivalent to about 96 human years.', 'The lightest cat on record is a blue point Himalayan called Tinker Toy, who weighed 1 pound, 6 ounces (616 g). Tinker Toy was 2.75 inches (7 cm) tall and 7.5 inches (19 cm) long.', 'Approximately 1/3 of cat owners think their pets are able to read their minds.', 'The tiniest cat on record is Mr. Pebbles, a 2-year-old cat that weighed 3 lbs (1.3 k) and was 6.1 inches (15.5 cm) high.', 'A commemorative tower was built in Scotland for a cat named Towser, who caught nearly 30,000 mice in her lifetime.', 'In the 1750s, Europeans introduced cats into the Americas to control pests.', 'The first cat show was organized in 1871 in London. Cat shows later became a worldwide craze.', 'The first cartoon cat was Felix the Cat in 1919. In 1940, Tom and Jerry starred in the first theatrical cartoon “Puss Gets the Boot.” In 1981 Andrew Lloyd Weber created the musical Cats, based on T.S. Eliot’s Old Possum’s Book of Practical Cats', 'The normal body temperature of a cat is between 100.5 ° and 102.5 °F. A cat is sick if its temperature goes below 100 ° or above 103 °F.', 'A cat has 230 bones in its body. A human has 206. A cat has no collarbone, so it can fit through any opening the size of its head.', 'Cats have 32 muscles that control the outer ear (humans have only 6). A cat can independently rotate its ears 180 degrees', 'A cat’s nose pad is ridged with a unique pattern, just like the fingerprint of a human.', 'If they have ample water, cats can tolerate temperatures up to 133 °F.', 'Foods that should not be given to cats include onions, garlic, green tomatoes, raw potatoes, chocolate, grapes, and raisins. Though milk is not toxic, it can cause an upset stomach and gas. Tylenol and aspirin are extremely toxic to cats, as are many common houseplants. Feeding cats dog food or canned tuna that’s for human consumption can cause malnutrition.', 'A 2007 Gallup poll revealed that both men and women were equally likely to own a cat.', 'A cat’s heart beats nearly twice as fast as a human heart, at 110 to 140 beats a minute.', 'In just seven years, a single pair of cats and their offspring could produce a staggering total of 420,000 kittens.', 'Relative to its body size, the clouded leopard has the biggest canines of all animals’ canines. Its dagger-like teeth can be as long as 1.8 inches (4.5 cm).', 'Cats spend nearly 1/3 of their waking hours cleaning themselves.', 'Grown cats have 30 teeth. Kittens have about 26 temporary teeth, which they lose when they are about 6 months old.', 'Cats don’t have sweat glands over their bodies like humans do. Instead, they sweat only through their paws.', 'A cat called Dusty has the known record for the most kittens. She had more than 420 kittens in her lifetime.', 'The largest cat breed is the Ragdoll. Male Ragdolls weigh between 12 and 20 lbs (5.4-9.0 k). Females weigh between 10 and 15 lbs (4.5-6.8 k).', 'Cats are extremely sensitive to vibrations. Cats are said to detect earthquake tremors 10 or 15 minutes before humans can.', 'In contrast to dogs, cats have not undergone major changes during their domestication process.', 'A female cat is called a queen or a molly.', 'In the 1930s, two Russian biologists discovered that color change in Siamese kittens depend on their body temperature. Siamese cats carry albino genes that work only when the body temperature is above 98° F. If these kittens are left in a very warm room, their points won’t darken and they will stay a creamy white.', 'There are up to 60 million feral cats in the United States alone.', 'The oldest cat to give birth was Kitty who, at the age of 30, gave birth to two kittens. During her life, she gave birth to 218 kittens.', 'The most traveled cat is Hamlet, who escaped from his carrier while on a flight. He hid for seven weeks behind a panel on the airplane. By the time he was discovered, he had traveled nearly 373,000 miles (600,000 km).', 'In Holland’s embassy in Moscow, Russia, the staff noticed that the two Siamese cats kept meowing and clawing at the walls of the building. Their owners finally investigated, thinking they would find mice. Instead, they discovered microphones hidden by Russian spies. The cats heard the microphones when they turned on.', 'The most expensive cat was an Asian Leopard cat (ALC)-Domestic Shorthair (DSH) hybrid named Zeus. Zeus, who is 90% ALC and 10% DSH, has an asking price of £100,000 ($154,000).', 'The cat who holds the record for the longest non-fatal fall is Andy. He fell from the 16th floor of an apartment building (about 200 ft/.06 km) and survived.', 'Rome has more homeless cats per square mile than any other city in the world.', 'The richest cat is Blackie who was left £15 million by his owner, Ben Rea.', 'The claws on the cat’s back paws aren’t as sharp as the claws on the front paws because the claws in the back don’t retract and, consequently, become worn.', 'Cats can drink seawater.'] await ctx.send(random.choice(facts)) @commands.command(name='patchnotes', brief='Patch Notes', alias=['patch,changes']) async def patchnotes(self, ctx): embed = discord.Embed( title="Wolfbot", description='Patch Notes', colour=discord.Color.blue(), ) embed.set_footer(text='Version: ' + '5') embed.set_thumbnail( url='https://cdn.discordapp.com/attachments/467509886272667649/490365802843734037/Wolfbot_Icon.png') embed.add_field(name='Change', value='Description', inline=False) embed.add_field(name='Ready check', value='Changed timeout to reset timer after someone readies', inline=False) embed.add_field(name='!aroll', value='Rolls a d20 with the ability modifier of a character', inline=False) embed.add_field(name='Note', value='!movechan does not work', inline=False) await ctx.send(embed=embed) def setup(client): client.add_cog(Utilities(client)) print('Utilities is loaded')
85.623288
403
0.662707
3,812
25,002
4.341028
0.331584
0.009911
0.015954
0.006949
0.025139
0.014987
0.009911
0.009911
0.004714
0.004714
0
0.02686
0.267379
25,002
291
404
85.917526
0.876126
0.012119
0
0.057915
0
0.289575
0.694884
0.000902
0.007722
0
0
0.003436
0
1
0.007722
false
0.011583
0.023166
0
0.03861
0.015444
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
2b17a9b554aa2ec5f0dc826c08529251f381a14b
258
py
Python
python/hackerrank/loops/counter/task.py
3keepmovingforward3/ENGR1102
b4f38a70560fc695d70706279047b1dec9f5c7f4
[ "MIT" ]
null
null
null
python/hackerrank/loops/counter/task.py
3keepmovingforward3/ENGR1102
b4f38a70560fc695d70706279047b1dec9f5c7f4
[ "MIT" ]
null
null
null
python/hackerrank/loops/counter/task.py
3keepmovingforward3/ENGR1102
b4f38a70560fc695d70706279047b1dec9f5c7f4
[ "MIT" ]
null
null
null
def counter(endCount): f = open("test.txt","w") # ***User Code Below*** # for __ in range(______): # Non User Code f.write(str(____)+"\n") # User Code print(_____) # ***End User Code*** # f.close
19.846154
31
0.472868
29
258
3.62069
0.724138
0.304762
0.171429
0
0
0
0
0
0
0
0
0
0.352713
258
13
32
19.846154
0.628743
0.255814
0
0
0
0
0.059459
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.166667
0.166667
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2b1af18a8772208ebc2c9c0adfaf3b05814fc391
15,643
py
Python
tests/fairness/fairness_metrics_test.py
TomBourgeade/allennlp
357691546bf65fc464bd0b564749bfa97e6db9aa
[ "Apache-2.0" ]
2
2022-01-02T12:15:21.000Z
2022-01-02T12:15:23.000Z
tests/fairness/fairness_metrics_test.py
TomBourgeade/allennlp
357691546bf65fc464bd0b564749bfa97e6db9aa
[ "Apache-2.0" ]
54
2021-02-11T01:11:57.000Z
2022-03-29T13:07:37.000Z
tests/fairness/fairness_metrics_test.py
TomBourgeade/allennlp
357691546bf65fc464bd0b564749bfa97e6db9aa
[ "Apache-2.0" ]
1
2018-11-29T11:51:29.000Z
2018-11-29T11:51:29.000Z
import pytest import torch import math import numpy as np from allennlp.common.checks import ConfigurationError from allennlp.common.testing import ( AllenNlpTestCase, multi_device, global_distributed_metric, run_distributed_test, ) from allennlp.fairness.fairness_metrics import ( Independence, Separation, Sufficiency, DemographicParityWithoutGroundTruth, ) class IndependenceTest(AllenNlpTestCase): def test_invalid_dimensions(self): independence = Independence(2, 2) C = torch.eye(3).long() A = torch.eye(4).long() with pytest.raises(ConfigurationError): independence(C, A) def test_invalid_num_classes(self): independence = Independence(1, 1) C = torch.eye(3).long() A = torch.eye(3).long() with pytest.raises(ConfigurationError): independence(C, A) @multi_device def test_independence_unmasked_computation(self, device: str): independence = Independence(4, 2) A = torch.eye(3, device=device).long() C = 2 * A # P(C) = [0.667, 0.0, 0.333, 0.0] # P(C | A = 0) = [1.0, 0.0, 0.0, 0.0] # P(C | A = 1) = [0.0, 0.0, 1.0, 0.0] # KL(P(C | A = 0) || P(C)) = 0.4055 # KL(P(C | A = 1) || P(C)) = 1.0986 expected_kl_divs = {0: 0.4055, 1: 1.0986} independence(C, A) test_kl_divs = {k: v.item() for k, v in independence.get_metric().items()} assert expected_kl_divs == pytest.approx(test_kl_divs, abs=1e-3) independence(C, A) test_kl_divs = {k: v.item() for k, v in independence.get_metric(reset=True).items()} assert expected_kl_divs == pytest.approx(test_kl_divs, abs=1e-3) test_kl_divs = { k: (v.item() if not math.isnan(v.item()) else np.nan) for k, v in independence.get_metric().items() } assert test_kl_divs == {0: np.nan, 1: np.nan} def test_distributed_independence_masked_computation(self): A = torch.eye(3).long() C = 2 * A mask = torch.ones_like(C).bool() expected_kl_divs = {0: 0.4055, 1: 1.0986} metric_kwargs = {"predicted_labels": C, "protected_variable_labels": A, "mask": mask} run_distributed_test( [-1, -1], global_distributed_metric, Independence(4, 2), metric_kwargs, expected_kl_divs, exact=False, ) class SeparationTest(AllenNlpTestCase): def test_invalid_dimensions(self): separation = Separation(2, 2) C = torch.eye(3).long() Y = torch.eye(4).long() A = torch.eye(3).long() with pytest.raises(ConfigurationError): separation(C, Y, A) def test_invalid_num_classes(self): separation = Separation(2, 2) C = 2 * torch.eye(3).long() Y = torch.eye(3).long() A = torch.eye(3).long() with pytest.raises(ConfigurationError): separation(C, Y, A) @multi_device def test_separation_unmasked_computation(self, device: str): separation = Separation(2, 2) C = torch.eye(3, device=device).long() Y = C A = C # P(C | Y = 0) = [1.0, 0.0] # P(C | A = 0, Y = 0) = [1.0, 0.0] # P(C | A = 1, Y = 0) = [0.0, 0.0] # KL(P(C | A = 0, Y = 0) || P(C | Y = 0)) = 0.0 # KL(P(C | A = 1, Y = 0) || P(C | Y = 0)) = NaN # P(C | Y = 1) = [0.0, 1.0] # P(C | A = 0, Y = 1) = [0.0, 0.0] # P(C | A = 1, Y = 1) = [0.0, 1.0] # KL(P(C | A = 0, Y = 1) || P(C | Y = 1)) = NaN # KL(P(C | A = 1, Y = 1) || P(C | Y = 1)) = 0.0 # KL divergence cannot be negative expected_kl_divs = {0: {0: 0.0, 1: np.nan}, 1: {0: np.nan, 1: 0.0}} separation(C, Y, A) test_kl_divs = { k1: {k2: (v2.item() if not math.isnan(v2.item()) else np.nan) for k2, v2 in v1.items()} for k1, v1 in separation.get_metric().items() } assert expected_kl_divs == test_kl_divs separation(C, Y, A) test_kl_divs = { k1: {k2: (v2.item() if not math.isnan(v2.item()) else np.nan) for k2, v2 in v1.items()} for k1, v1 in separation.get_metric(reset=True).items() } assert expected_kl_divs == test_kl_divs test_kl_divs = { k1: {k2: (v2.item() if not math.isnan(v2.item()) else np.nan) for k2, v2 in v1.items()} for k1, v1 in separation.get_metric().items() } assert test_kl_divs == {0: {0: np.nan, 1: np.nan}, 1: {0: np.nan, 1: np.nan}} def test_distributed_separation_masked_computation(self): C = torch.eye(3).long() Y = C A = C mask = torch.ones_like(C).bool() expected_kl_divs = { 0: {0: 0.0, 1: np.nan}, 1: {0: np.nan, 1: 0.0}, } metric_kwargs = { "predicted_labels": C, "gold_labels": Y, "protected_variable_labels": A, "mask": mask, } run_distributed_test( [-1, -1], global_distributed_metric, Separation(2, 2), metric_kwargs, expected_kl_divs, exact=True, ) class SufficiencyTest(AllenNlpTestCase): def test_invalid_dimensions(self): sufficiency = Sufficiency(2, 2) C = torch.eye(3).long() Y = torch.eye(4).long() A = torch.eye(3).long() with pytest.raises(ConfigurationError): sufficiency(C, Y, A) def test_invalid_num_classes(self): sufficiency = Sufficiency(2, 2) C = 2 * torch.eye(3).long() Y = torch.eye(3).long() A = torch.eye(3).long() with pytest.raises(ConfigurationError): sufficiency(C, Y, A) @multi_device def test_sufficiency_unmasked_computation(self, device: str): sufficiency = Sufficiency(2, 2) # Tests when C = 1 is not predicted C = torch.zeros(3, 3, device=device).long() Y = torch.eye(3, device=device).long() A = Y # P(Y | C = 0) = [0.667, 0.333] # P(Y | A = 0, C = 0) = [1.0, 0.0] # P(Y | A = 1, C = 0) = [0.0, 1.0] # KL(P(Y | A = 0, C = 0) || P(Y | C = 0)) = 0.4055 # KL(P(Y | A = 1, C = 0) || P(Y | C = 0)) = 1.0986 # P(Y | C = 1) = [0.0, 0.0] # P(Y | A = 0, C = 1) = [0.0, 0.0] # P(Y | A = 1, C = 1) = [0.0, 0.0] # KL(P(Y | A = 0, C = 1) || P(Y | C = 1)) = NaN # KL(P(Y | A = 1, C = 1) || P(Y | C = 1)) = NaN # KL divergence cannot be negative expected_kl_divs = {0: {0: 0.4055, 1: 1.0986}, 1: {0: np.nan, 1: np.nan}} sufficiency(C, Y, A) test_kl_divs = { k1: {k2: (v2.item() if not math.isnan(v2.item()) else np.nan) for k2, v2 in v1.items()} for k1, v1 in sufficiency.get_metric().items() } assert len(expected_kl_divs) == len(test_kl_divs) assert expected_kl_divs[0] == pytest.approx(test_kl_divs[0], abs=1e-3) assert expected_kl_divs[1] == test_kl_divs[1] sufficiency(C, Y, A) test_kl_divs = { k1: {k2: (v2.item() if not math.isnan(v2.item()) else np.nan) for k2, v2 in v1.items()} for k1, v1 in sufficiency.get_metric(reset=True).items() } assert len(expected_kl_divs) == len(test_kl_divs) assert expected_kl_divs[0] == pytest.approx(test_kl_divs[0], abs=1e-3) assert expected_kl_divs[1] == test_kl_divs[1] test_kl_divs = { k1: {k2: (v2.item() if not math.isnan(v2.item()) else np.nan) for k2, v2 in v1.items()} for k1, v1 in sufficiency.get_metric().items() } assert len(expected_kl_divs) == len(test_kl_divs) assert test_kl_divs == {0: {0: np.nan, 1: np.nan}, 1: {0: np.nan, 1: np.nan}} def test_distributed_sufficiency_masked_computation(self): C = torch.zeros(3, 3).long() Y = torch.eye(3).long() A = Y mask = torch.ones_like(C).bool() expected_kl_divs = {0: {0: 0.4055, 1: 1.0986}, 1: {0: np.nan, 1: np.nan}} metric_kwargs = { "predicted_labels": C, "gold_labels": Y, "protected_variable_labels": A, "mask": mask, } run_distributed_test( [-1, -1], global_distributed_metric, Sufficiency(2, 2), metric_kwargs, expected_kl_divs, exact=False, ) class DemographicParityWithoutGroundTruthTest(AllenNlpTestCase): def test_invalid_dimensions(self): ova_npmixy = DemographicParityWithoutGroundTruth(2, 2) Y = torch.eye(3).long() X = torch.eye(4).long() with pytest.raises(ConfigurationError): ova_npmixy(Y, X) def test_invalid_num_classes(self): ova_npmixy = DemographicParityWithoutGroundTruth(1, 1) Y = torch.eye(3).long() X = torch.eye(3).long() with pytest.raises(ConfigurationError): ova_npmixy(Y, X) @multi_device def test_pmi_unmasked_computation(self, device: str): ova_pmi = DemographicParityWithoutGroundTruth(2, 2, "pmi", "ova") pairwise_pmi = DemographicParityWithoutGroundTruth(2, 2, "pmi", "pairwise") Y = torch.ones(3, 3, device=device).long() X = torch.eye(3, device=device).long() # P(X = 0, Y = 0) = 0 # P(X = 0, Y = 1) = 2/3 # P(X = 1, Y = 0) = 0 # P(X = 1, Y = 1) = 1/3 # P(X = 0) = 2/3 # P(X = 1) = 1/3 # P(Y = 0) = 0 # P(Y = 1) = 1 # G(Y = 0 | X = 0, X = rest, PMI) = NaN # G(Y = 1 | X = 0, X = rest, PMI) = ln(1) - ln(1) = 0.0 # G(Y = 0 | X = 1, X = rest, PMI) = NaN # G(Y = 1 | X = 1, X = rest, PMI) = ln(1) - ln(1) = 0.0 expected_ova_pmi_gaps = { 0: [np.nan, 0.0], 1: [np.nan, 0.0], } ova_pmi(Y, X) test_ova_pmi_gaps = { k: [(e if not math.isnan(e) else np.nan) for e in v.tolist()] for k, v in ova_pmi.get_metric().items() } assert expected_ova_pmi_gaps == test_ova_pmi_gaps ova_pmi(Y, X) test_ova_pmi_gaps = { k: [(e if not math.isnan(e) else np.nan) for e in v.tolist()] for k, v in ova_pmi.get_metric(reset=True).items() } assert expected_ova_pmi_gaps == test_ova_pmi_gaps test_ova_pmi_gaps = { k: [(e if not math.isnan(e) else np.nan) for e in v.tolist()] for k, v in ova_pmi.get_metric(reset=True).items() } assert test_ova_pmi_gaps == {0: [np.nan, np.nan], 1: [np.nan, np.nan]} expected_pairwise_pmi_gaps = { 0: {0: [np.nan, 0.0], 1: [np.nan, 0.0]}, 1: {0: [np.nan, 0.0], 1: [np.nan, 0.0]}, } pairwise_pmi(Y, X) test_pairwise_pmi_gaps = { k1: { k2: [(e if not math.isnan(e) else np.nan) for e in v2.tolist()] for k2, v2 in v1.items() } for k1, v1 in pairwise_pmi.get_metric().items() } assert expected_pairwise_pmi_gaps == test_pairwise_pmi_gaps pairwise_pmi(Y, X) test_pairwise_pmi_gaps = { k1: { k2: [(e if not math.isnan(e) else np.nan) for e in v2.tolist()] for k2, v2 in v1.items() } for k1, v1 in pairwise_pmi.get_metric(reset=True).items() } assert expected_pairwise_pmi_gaps == test_pairwise_pmi_gaps test_pairwise_pmi_gaps = { k1: { k2: [(e if not math.isnan(e) else np.nan) for e in v2.tolist()] for k2, v2 in v1.items() } for k1, v1 in pairwise_pmi.get_metric(reset=True).items() } assert test_pairwise_pmi_gaps == { 0: {0: [np.nan, np.nan], 1: [np.nan, np.nan]}, 1: {0: [np.nan, np.nan], 1: [np.nan, np.nan]}, } @multi_device def test_pmisq_masked_computation(self, device: str): ova_pmisq = DemographicParityWithoutGroundTruth(2, 2, "pmisq", "ova") pairwise_pmisq = DemographicParityWithoutGroundTruth(2, 2, "pmisq", "pairwise") Y = torch.ones(3, 3, device=device).long() X = torch.eye(3, device=device).long() mask = torch.ones_like(Y).bool() expected_ova_pmisq_gaps = { 0: [np.nan, round(math.log(2), 3)], 1: [np.nan, round(math.log(0.5), 3)], } ova_pmisq(Y, X, mask) test_ova_pmisq_gaps = { k: [(round(e, 3) if not math.isnan(e) else np.nan) for e in v.tolist()] for k, v in ova_pmisq.get_metric().items() } assert expected_ova_pmisq_gaps == test_ova_pmisq_gaps expected_pairwise_pmisq_gaps = { 0: {0: [np.nan, 0.0], 1: [np.nan, round(math.log(2), 3)]}, 1: {0: [np.nan, round(math.log(0.5), 3)], 1: [np.nan, 0.0]}, } pairwise_pmisq(Y, X, mask) test_pairwise_pmisq_gaps = { k1: { k2: [(round(e, 3) if not math.isnan(e) else np.nan) for e in v2.tolist()] for k2, v2 in v1.items() } for k1, v1 in pairwise_pmisq.get_metric().items() } assert expected_pairwise_pmisq_gaps == test_pairwise_pmisq_gaps def test_distributed_npmiy_unmasked_computation(self): Y = torch.ones(3, 3).long() X = torch.eye(3).long() expected_ova_npmiy_gaps = { 0: [np.nan, np.nan], 1: [np.nan, np.nan], } metric_kwargs = {"predicted_labels": Y, "protected_variable_labels": X} run_distributed_test( [-1, -1], global_distributed_metric, DemographicParityWithoutGroundTruth(2, 2, "npmiy", "ova"), metric_kwargs, expected_ova_npmiy_gaps, exact=True, ) expected_pairwise_npmiy_gaps = { 0: {0: [np.nan, np.nan], 1: [np.nan, np.nan]}, 1: {0: [np.nan, np.nan], 1: [np.nan, np.nan]}, } run_distributed_test( [-1, -1], global_distributed_metric, DemographicParityWithoutGroundTruth(2, 2, "npmiy", "pairwise"), metric_kwargs, expected_pairwise_npmiy_gaps, exact=True, ) def test_distributed_npmixy_masked_computation(self): Y = torch.ones(3, 3).long() X = torch.eye(3).long() mask = torch.ones_like(Y).bool() expected_ova_npmixy_gaps = { 0: [np.nan, 0.0], 1: [np.nan, 0.0], } metric_kwargs = {"predicted_labels": Y, "protected_variable_labels": X, "mask": mask} run_distributed_test( [-1, -1], global_distributed_metric, DemographicParityWithoutGroundTruth(2, 2, "npmixy", "ova"), metric_kwargs, expected_ova_npmixy_gaps, exact=True, ) expected_pairwise_npmixy_gaps = { 0: {0: [np.nan, 0.0], 1: [np.nan, 0.0]}, 1: {0: [np.nan, 0.0], 1: [np.nan, 0.0]}, } metric_kwargs = {"predicted_labels": Y, "protected_variable_labels": X, "mask": mask} run_distributed_test( [-1, -1], global_distributed_metric, DemographicParityWithoutGroundTruth(2, 2, "npmixy", "pairwise"), metric_kwargs, expected_pairwise_npmixy_gaps, exact=True, )
35.073991
99
0.528415
2,210
15,643
3.577828
0.054751
0.0215
0.011762
0.034526
0.850133
0.752498
0.679398
0.664222
0.604907
0.532566
0
0.05399
0.32628
15,643
445
100
35.152809
0.696271
0.085725
0
0.609195
0
0
0.025945
0.010518
0
0
0
0
0.063218
1
0.051724
false
0
0.020115
0
0.083333
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
2b22ee893743a6d7caf304a80f2dd15c8b0f5bb7
355
py
Python
reporting/admin.py
bhagvank/voicepowerBI
63fd4c4e7d18b5a7a850b6fa93162dd1a2d1b69a
[ "Apache-2.0" ]
null
null
null
reporting/admin.py
bhagvank/voicepowerBI
63fd4c4e7d18b5a7a850b6fa93162dd1a2d1b69a
[ "Apache-2.0" ]
null
null
null
reporting/admin.py
bhagvank/voicepowerBI
63fd4c4e7d18b5a7a850b6fa93162dd1a2d1b69a
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin # Register your models here. from .models import Note from .models import Profile class NoteAdmin(admin.ModelAdmin): class Meta: model = Note class ProfileAdmin(admin.ModelAdmin): class Meta: model = Note admin.site.register(Note,NoteAdmin) admin.site.register(Profile,ProfileAdmin)
20.882353
41
0.721127
43
355
5.953488
0.418605
0.078125
0.125
0.1875
0.257813
0.257813
0
0
0
0
0
0
0.202817
355
16
42
22.1875
0.904594
0.073239
0
0.363636
0
0
0
0
0
0
0
0
0
1
0
false
0
0.272727
0
0.636364
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
2b23529ba7a8853f9124c211d37e2d8cb5cefc5a
490
py
Python
tests/test_schema.py
peytondmurray/conda-store
40fe4a0cecbefaff7cac819244f9862bd188b045
[ "BSD-3-Clause" ]
47
2020-05-23T10:02:57.000Z
2022-03-18T00:14:58.000Z
tests/test_schema.py
peytondmurray/conda-store
40fe4a0cecbefaff7cac819244f9862bd188b045
[ "BSD-3-Clause" ]
192
2020-06-12T02:05:14.000Z
2022-03-26T13:16:33.000Z
tests/test_schema.py
peytondmurray/conda-store
40fe4a0cecbefaff7cac819244f9862bd188b045
[ "BSD-3-Clause" ]
15
2020-06-12T12:38:23.000Z
2021-11-11T00:39:57.000Z
import pytest import yaml from conda_store import schema @pytest.mark.parametrize('environment_filename', [ 'tests/assets/environments/conda-store.yaml', 'tests/assets/environments/jupyterlab.yaml', 'tests/assets/environments/data-science.yaml', 'tests/assets/environments/web-development.yaml', ]) def test_schema_environment(environment_filename): with open(environment_filename) as f: data = yaml.safe_load(f) schema.CondaSpecification.parse_obj(data)
28.823529
53
0.765306
59
490
6.220339
0.508475
0.119891
0.250681
0.220708
0
0
0
0
0
0
0
0
0.122449
490
16
54
30.625
0.853488
0
0
0
0
0
0.391837
0.35102
0
0
0
0
0
1
0.076923
false
0
0.230769
0
0.307692
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
2b28e153bbf0a59a846c48548f62b96855b95e50
1,209
py
Python
catalog/models.py
edilson/django_ecommerce
bff333f902fe3d09d1452b732d649a7906020cd6
[ "Apache-2.0" ]
null
null
null
catalog/models.py
edilson/django_ecommerce
bff333f902fe3d09d1452b732d649a7906020cd6
[ "Apache-2.0" ]
7
2021-03-18T22:02:51.000Z
2021-09-22T18:13:51.000Z
catalog/models.py
edilson/django_ecommerce
bff333f902fe3d09d1452b732d649a7906020cd6
[ "Apache-2.0" ]
null
null
null
from django.db import models from django.urls import reverse from core.models import IndexedTimeStampedModel class Category(IndexedTimeStampedModel): name = models.CharField('Nome', max_length=200) slug = models.SlugField('Identificador', max_length=200) class Meta: verbose_name = 'Categoria' verbose_name_plural = 'Categorias' ordering = ['name'] def __str__(self): return self.name def get_absolute_url(self): return reverse('catalog:category', kwargs={'slug': self.slug}) class Product(IndexedTimeStampedModel): name = models.CharField('Produto', max_length=200) slug = models.SlugField('Identificador', max_length=200) category = models.ForeignKey(Category, on_delete=models.SET_NULL, verbose_name='Categoria', null=True) description = models.TextField('Descrição', blank=True) price = models.DecimalField('Preço', decimal_places=2, max_digits=8) class Meta: verbose_name = 'Produto' verbose_name_plural = 'Produtos' ordering = ['name'] def __str__(self): return self.name def get_absolute_url(self): return reverse('catalog:product', kwargs={'slug': self.slug})
31.815789
106
0.69727
139
1,209
5.870504
0.402878
0.067402
0.058824
0.102941
0.32598
0.32598
0.32598
0.32598
0.32598
0.32598
0
0.0143
0.19024
1,209
37
107
32.675676
0.819203
0
0
0.428571
0
0
0.116625
0
0
0
0
0
0
1
0.142857
false
0
0.107143
0.142857
0.785714
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
2b390b98c29f119bc3ce25838b24f8d6b1784c08
358
py
Python
ex035.py
dsjocimar/python
5716f46a9fa7f64aa78a39df9c262c5392571340
[ "MIT" ]
null
null
null
ex035.py
dsjocimar/python
5716f46a9fa7f64aa78a39df9c262c5392571340
[ "MIT" ]
null
null
null
ex035.py
dsjocimar/python
5716f46a9fa7f64aa78a39df9c262c5392571340
[ "MIT" ]
null
null
null
# Exercício 035 r1 = int(input('Digite o valor da primeira reta: ')) r2 = int(input('Digite o valor da segunda reta: ')) r3 = int(input('Digite o valor da terceira reta: ')) if r1 + r2 > r3 and r1 + r3 > r2 and r2 + r3 > r1: print('\033[1;36mÉ possivel formar um triângulo!\033[m') else: print('\033[1;31mNão é possivel formar um triângulo!\033[m')
35.8
64
0.659218
63
358
3.746032
0.460317
0.101695
0.177966
0.190678
0.525424
0.525424
0
0
0
0
0
0.114187
0.192737
358
9
65
39.777778
0.702422
0.036313
0
0
0
0
0.571429
0
0
0
0
0
0
1
0
false
0
0
0
0
0.285714
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
2b3c52cb9cf093498e1bcdcc9a4567f159130ac0
1,460
py
Python
tests/cash_machine_test.py
alexgarzao/caixa-eletronico-python
092aa4d6ea3d42f797131c6312c82f9b68e6cdd5
[ "MIT" ]
1
2018-12-20T17:23:52.000Z
2018-12-20T17:23:52.000Z
tests/cash_machine_test.py
alexgarzao/caixa-eletronico-python
092aa4d6ea3d42f797131c6312c82f9b68e6cdd5
[ "MIT" ]
null
null
null
tests/cash_machine_test.py
alexgarzao/caixa-eletronico-python
092aa4d6ea3d42f797131c6312c82f9b68e6cdd5
[ "MIT" ]
null
null
null
from nose.tools import eq_ from cash_machine.cash_machine import CashMachine, CashNotes def withdrawal_100_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(100), CashNotes(1, 0, 0, 0) ) def withdrawal_50_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(50), CashNotes(0, 1, 0, 0) ) def withdrawal_200_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(200), CashNotes(2, 0, 0, 0) ) def withdrawal_150_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(150), CashNotes(1, 1, 0, 0) ) def withdrawal_80_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(80), CashNotes(0, 1, 1, 1) ) def withdrawal_30_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(30), CashNotes(0, 0, 1, 1) ) def withdrawal_0_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(0), None ) def withdrawal_negative_number_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(-20), None ) def withdrawal_2540_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(2540), CashNotes(25, 0, 2, 0) ) def withdrawal_with_impossible_value_test(): cm = CashMachine() eq_( cm.cash_notes_for_withdrawal(33), None )
17.380952
60
0.60274
184
1,460
4.423913
0.184783
0.159705
0.208845
0.233415
0.60688
0.528256
0.528256
0.528256
0.528256
0
0
0.07026
0.288356
1,460
83
61
17.590361
0.713186
0
0
0.370968
0
0
0
0
0
0
0
0
0
1
0.16129
false
0
0.032258
0
0.193548
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
2b40582ceb3f65c2a6228527add108a97071d9dd
192
py
Python
examples/exons.py
endrebak/piedpiper
b329d2ba13b7d7e44d2717c0c283a873a58e9bd4
[ "MIT" ]
1
2019-04-16T06:05:00.000Z
2019-04-16T06:05:00.000Z
examples/exons.py
endrebak/piedpiper
b329d2ba13b7d7e44d2717c0c283a873a58e9bd4
[ "MIT" ]
null
null
null
examples/exons.py
endrebak/piedpiper
b329d2ba13b7d7e44d2717c0c283a873a58e9bd4
[ "MIT" ]
null
null
null
import pyranges as pr exons = pr.data.exons() cpg = pr.data.cpg() from piedpiper import Debug as D with D(): cpg.join(exons.unstrand())[["CpG"]](lambda df: df.head(3))["chrX"].slack(500)
24
81
0.666667
33
192
3.878788
0.636364
0.09375
0
0
0
0
0
0
0
0
0
0.024096
0.135417
192
7
82
27.428571
0.746988
0
0
0
0
0
0.036458
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
2b4223eb7353b445664957eb574e707f05ce614e
396
py
Python
catalog/bindings/gmd/abstract_curve.py
NIVANorge/s-enda-playground
56ae0a8978f0ba8a5546330786c882c31e17757a
[ "Apache-2.0" ]
null
null
null
catalog/bindings/gmd/abstract_curve.py
NIVANorge/s-enda-playground
56ae0a8978f0ba8a5546330786c882c31e17757a
[ "Apache-2.0" ]
null
null
null
catalog/bindings/gmd/abstract_curve.py
NIVANorge/s-enda-playground
56ae0a8978f0ba8a5546330786c882c31e17757a
[ "Apache-2.0" ]
null
null
null
from dataclasses import dataclass from bindings.gmd.abstract_curve_type import AbstractCurveType __NAMESPACE__ = "http://www.opengis.net/gml" @dataclass class AbstractCurve(AbstractCurveType): """ The AbstractCurve element is the abstract head of the substitution group for all (continuous) curve elements. """ class Meta: namespace = "http://www.opengis.net/gml"
24.75
76
0.739899
46
396
6.23913
0.652174
0.090592
0.111498
0.160279
0.202091
0.202091
0
0
0
0
0
0
0.174242
396
15
77
26.4
0.877676
0.275253
0
0
0
0
0.194757
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.571429
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
2b57baa48d9b90658a46b7a34081aeb2c0e425cf
1,129
py
Python
directread.py
zzxmllq/cnn_com
ca24c57b9b0b5c8e6db8a96a23dc8f9710b985be
[ "CC-BY-4.0" ]
3
2020-01-19T21:13:36.000Z
2021-11-09T11:20:30.000Z
directread.py
zzxmllq/cnncomplete_tf
ca24c57b9b0b5c8e6db8a96a23dc8f9710b985be
[ "CC-BY-4.0" ]
1
2020-02-21T14:54:56.000Z
2020-02-21T14:54:56.000Z
directread.py
zzxmllq/cnncomplete_tf
ca24c57b9b0b5c8e6db8a96a23dc8f9710b985be
[ "CC-BY-4.0" ]
3
2019-08-07T17:20:24.000Z
2020-01-25T17:45:51.000Z
import h5py import numpy as np def read(data_path): data_array_total = [] target_array_total = [] for i in range(2): path = data_path + "train_shape_voxel_data" + str(i) + ".h5" file = h5py.File(path, 'r') data_array = file['data'][:] target_array = file['target'][:] data_array_v = np.squeeze(data_array[:, 0])[:, :, :, :, np.newaxis] data_array_l = np.squeeze(data_array[:, 1])[:, :, :, :, np.newaxis] print data_array_v.shape data_array = np.concatenate([data_array_v, data_array_l], axis=4) target_array = target_array.reshape((-1, 32, 32, 32, 1)) data_array_total.append(data_array) target_array_total.append(target_array) # data_array=np.concatenate([data_array[:,0],data_array[:,1]]) result1 = np.concatenate(data_array_total, axis=0) result2 = np.concatenate(target_array_total, axis=0) return result1, result2 # # read('/home/zzxmllq/h5_shapenet_dim32_sdf/h5_shapenet_dim32_sdf/train_shape_voxel_data0.h5') # data=(5,5,5) # data[0] # data[1] # # data[0,0,0] # data[:,0,0] # # data[:,0,:]==data[:,0]
30.513514
94
0.636847
167
1,129
4.017964
0.281437
0.214605
0.062593
0.098361
0.092399
0.092399
0
0
0
0
0
0.047305
0.194863
1,129
36
95
31.361111
0.690869
0.202834
0
0
0
0
0.040541
0.024775
0
0
0
0
0
0
null
null
0
0.1
null
null
0.05
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
2b63d349f347c238cf181bfa7e07b01a40fef9da
2,405
py
Python
app/webauthn/rest.py
alphagov/notify-notifications-api
e604385e0cf4c2ab8c6451b7120ceb196cce21b5
[ "MIT" ]
51
2016-04-03T23:36:17.000Z
2022-03-21T20:04:52.000Z
app/webauthn/rest.py
alphagov/notify-notifications-api
e604385e0cf4c2ab8c6451b7120ceb196cce21b5
[ "MIT" ]
1,335
2015-12-15T14:28:50.000Z
2022-03-30T16:24:27.000Z
app/webauthn/rest.py
alphagov/notify-notifications-api
e604385e0cf4c2ab8c6451b7120ceb196cce21b5
[ "MIT" ]
30
2016-01-08T19:05:32.000Z
2021-12-20T16:37:23.000Z
from flask import Blueprint, jsonify, request from app.dao.users_dao import get_user_by_id from app.dao.webauthn_credential_dao import ( dao_create_webauthn_credential, dao_delete_webauthn_credential, dao_get_webauthn_credential_by_user_and_id, dao_update_webauthn_credential_name, ) from app.errors import InvalidRequest, register_errors from app.schema_validation import validate from app.webauthn.webauthn_schema import ( post_create_webauthn_credential_schema, post_update_webauthn_credential_schema, ) webauthn_blueprint = Blueprint('webauthn', __name__, url_prefix='/user/<uuid:user_id>/webauthn') register_errors(webauthn_blueprint) @webauthn_blueprint.route('', methods=['GET']) def get_webauthn_credentials(user_id): user = get_user_by_id(user_id) return jsonify(data=[cred.serialize() for cred in user.webauthn_credentials]), 200 @webauthn_blueprint.route('', methods=['POST']) def create_webauthn_credential(user_id): data = request.get_json() validate(data, post_create_webauthn_credential_schema) webauthn_credential = dao_create_webauthn_credential( user_id=user_id, name=data['name'], credential_data=data['credential_data'], registration_response=data['registration_response'] ) return jsonify(data=webauthn_credential.serialize()), 201 @webauthn_blueprint.route('/<uuid:webauthn_credential_id>', methods=['POST']) def update_webauthn_credential(user_id, webauthn_credential_id): data = request.get_json() validate(data, post_update_webauthn_credential_schema) webauthn_credential = dao_get_webauthn_credential_by_user_and_id(user_id, webauthn_credential_id) dao_update_webauthn_credential_name(webauthn_credential, data['name']) return jsonify(data=webauthn_credential.serialize()), 200 @webauthn_blueprint.route('/<uuid:webauthn_credential_id>', methods=['DELETE']) def delete_webauthn_credential(user_id, webauthn_credential_id): webauthn_credential = dao_get_webauthn_credential_by_user_and_id(user_id, webauthn_credential_id) user = get_user_by_id(user_id) if len(user.webauthn_credentials) == 1: # TODO: Only raise an error if user has auth type webauthn_auth raise InvalidRequest('Cannot delete last remaining webauthn credential for user', status_code=400) dao_delete_webauthn_credential(webauthn_credential) return '', 204
37
106
0.791268
310
2,405
5.712903
0.203226
0.315076
0.071146
0.054207
0.499153
0.443817
0.293055
0.244495
0.119142
0.119142
0
0.007576
0.12183
2,405
64
107
37.578125
0.830966
0.025364
0
0.130435
0
0
0.091802
0.046968
0
0
0
0.015625
0
1
0.086957
false
0
0.130435
0
0.304348
0.152174
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
1
0
0
0
0
0
0
0
0
0
0
2
2b7a5148ac5fa4a22b0467259bd10aec71c5d6c9
911
py
Python
proteuslib/edb/tests/test_schemas.py
lbianchi-lbl/watertap
8e727255240464b95c8b81eaead6ed3bd3e61a18
[ "BSD-3-Clause-LBNL" ]
null
null
null
proteuslib/edb/tests/test_schemas.py
lbianchi-lbl/watertap
8e727255240464b95c8b81eaead6ed3bd3e61a18
[ "BSD-3-Clause-LBNL" ]
1
2021-09-24T00:33:49.000Z
2021-09-24T00:33:49.000Z
proteuslib/edb/tests/test_schemas.py
lbianchi-lbl/proteuslib
8e727255240464b95c8b81eaead6ed3bd3e61a18
[ "BSD-3-Clause-LBNL" ]
null
null
null
############################################################################### # ProteusLib Copyright (c) 2021, The Regents of the University of California, # through Lawrence Berkeley National Laboratory, Oak Ridge National # Laboratory, National Renewable Energy Laboratory, and National Energy # Technology Laboratory (subject to receipt of any required approvals from # the U.S. Dept. of Energy). All rights reserved. # # Please see the files COPYRIGHT.md and LICENSE.md for full copyright and license # information, respectively. These files are also available online at the URL # "https://github.com/nawi-hub/proteuslib/" # ############################################################################### """ Test schemas module """ import pytest from ..schemas import schemas @pytest.mark.unit def test_schemas(): assert "$schema" in schemas["component"] assert "$schema" in schemas["reaction"]
39.608696
81
0.631175
102
911
5.627451
0.656863
0.062718
0.04878
0.073171
0
0
0
0
0
0
0
0.005006
0.122942
911
23
82
39.608696
0.713392
0.60483
0
0
0
0
0.166667
0
0
0
0
0
0.333333
1
0.166667
true
0
0.333333
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
99317a8082a1e749cd6b9d35ad194359e8ea9c9e
389
py
Python
adafruit_imageload/bmp/negative_height_check.py
matt-land/Adafruit_CircuitPython_ImageLoad
7c185385f716cbe0a191532e3fd8a37f60dafbe1
[ "MIT" ]
47
2021-02-15T23:02:36.000Z
2022-03-04T21:30:03.000Z
adafruit_imageload/bmp/negative_height_check.py
matt-land/Adafruit_CircuitPython_ImageLoad
7c185385f716cbe0a191532e3fd8a37f60dafbe1
[ "MIT" ]
35
2018-10-11T16:46:51.000Z
2021-09-27T17:39:52.000Z
adafruit_imageload/bmp/negative_height_check.py
matt-land/Adafruit_CircuitPython_ImageLoad
7c185385f716cbe0a191532e3fd8a37f60dafbe1
[ "MIT" ]
20
2018-10-02T23:05:49.000Z
2022-01-19T20:15:17.000Z
# SPDX-FileCopyrightText: 2018 Scott Shawcroft for Adafruit Industries # # SPDX-License-Identifier: MIT """ Check for negative height on the BMP. Seperated into it's own file to support builds without longint. """ def negative_height_check(height): """Check the height return modified if negative.""" if height > 0x7FFFFFFF: return height - 4294967296 return height
22.882353
70
0.735219
50
389
5.68
0.68
0.098592
0
0
0
0
0
0
0
0
0
0.050633
0.187661
389
16
71
24.3125
0.848101
0.632391
0
0
0
0
0
0
0
0
0.078125
0
0
1
0.25
false
0
0
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
993db96065f109d3d5d76b32a4d8be59528b6cb1
383
py
Python
Weboffice/woa_contacts/models/crm_phonecall.py
whoedl61/webinaroctubre
a22048838062999753860995d21328cb9d53d652
[ "MIT" ]
null
null
null
Weboffice/woa_contacts/models/crm_phonecall.py
whoedl61/webinaroctubre
a22048838062999753860995d21328cb9d53d652
[ "MIT" ]
null
null
null
Weboffice/woa_contacts/models/crm_phonecall.py
whoedl61/webinaroctubre
a22048838062999753860995d21328cb9d53d652
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from functools import reduce from odoo import api, fields, models, _ class CrmPhonecall(models.Model): _inherit = 'crm.phonecall' sale_order_ids = fields.Many2one( comodel_name='sale.order', ) class CrmPhonecall2(models.Model): _inherit = 'crm.phonecall' crm_lead_ids = fields.Many2one( comodel_name='crm.lead', )
20.157895
39
0.668407
45
383
5.488889
0.555556
0.089069
0.145749
0.17004
0.469636
0
0
0
0
0
0
0.013245
0.211488
383
19
40
20.157895
0.804636
0.05483
0
0.166667
0
0
0.121884
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
994d676ac01cd1ecf379f98bbd563dff40065d44
1,432
py
Python
Leak #5 - Lost In Translation/windows/Resources/ScRe/PyScripts/Lib/scre/mca/scre/cmd/sql/tasking.py
bidhata/EquationGroupLeaks
1ff4bc115cb2bd5bf2ed6bf769af44392926830c
[ "Unlicense" ]
9
2019-11-22T04:58:40.000Z
2022-02-26T16:47:28.000Z
Leak #5 - Lost In Translation/windows/Resources/ScRe/PyScripts/Lib/scre/mca/scre/cmd/sql/tasking.py
bidhata/EquationGroupLeaks
1ff4bc115cb2bd5bf2ed6bf769af44392926830c
[ "Unlicense" ]
null
null
null
Leak #5 - Lost In Translation/windows/Resources/ScRe/PyScripts/Lib/scre/mca/scre/cmd/sql/tasking.py
bidhata/EquationGroupLeaks
1ff4bc115cb2bd5bf2ed6bf769af44392926830c
[ "Unlicense" ]
8
2017-09-27T10:31:18.000Z
2022-01-08T10:30:46.000Z
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: tasking.py import mcl_platform.tasking from tasking_dsz import * from tasking_ur import * _fw = mcl_platform.tasking.GetFramework() if _fw == 'dsz': RPC_INFO_LIST_DRIVERS = dsz.RPC_INFO_LIST_DRIVERS RPC_INFO_LIST_DATASOURCES = dsz.RPC_INFO_LIST_DATASOURCES RPC_INFO_CONNECT = dsz.RPC_INFO_CONNECT RPC_INFO_LIST_SERVERS = dsz.RPC_INFO_LIST_SERVERS RPC_INFO_LIST_DATABASES = dsz.RPC_INFO_LIST_DATABASES RPC_INFO_LIST_TABLES = dsz.RPC_INFO_LIST_TABLES RPC_INFO_LIST_COLUMNS = dsz.RPC_INFO_LIST_COLUMNS RPC_INFO_EXEC = dsz.RPC_INFO_EXEC RPC_INFO_LIST_HANDLES = dsz.RPC_INFO_LIST_HANDLES RPC_INFO_DISCONNECT = dsz.RPC_INFO_DISCONNECT elif _fw == 'ur': RPC_INFO_DISCONNECT = ur.RPC_INFO_DISCONNECT RPC_INFO_EXEC = ur.RPC_INFO_EXEC RPC_INFO_LIST_COLUMNS = ur.RPC_INFO_LIST_COLUMNS RPC_INFO_LIST_DATASOURCES = ur.RPC_INFO_LIST_DATASOURCES RPC_INFO_LIST_SERVERS = ur.RPC_INFO_LIST_SERVERS RPC_INFO_LIST_DRIVERS = ur.RPC_INFO_LIST_DRIVERS RPC_INFO_LIST_DATABASES = ur.RPC_INFO_LIST_DATABASES RPC_INFO_LIST_TABLES = ur.RPC_INFO_LIST_TABLES RPC_INFO_LIST_HANDLES = ur.RPC_INFO_LIST_HANDLES RPC_INFO_CONNECT = ur.RPC_INFO_CONNECT else: raise RuntimeError('Unsupported framework (%s)' % _fw)
43.393939
67
0.796089
231
1,432
4.4329
0.242424
0.273438
0.300781
0.109375
0.460938
0.4375
0.240234
0.072266
0
0
0
0.031656
0.139665
1,432
33
68
43.393939
0.799513
0.119413
0
0
0
0
0.024682
0
0
0
0
0
0
1
0
false
0
0.107143
0
0.107143
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
99629c2abfa032c56d75b3eb6110d2e137384654
483
py
Python
formula.py
squiel91/FADU-PP
862eb7fab4f70e04532d24b80429f75e2b0c1494
[ "MIT" ]
null
null
null
formula.py
squiel91/FADU-PP
862eb7fab4f70e04532d24b80429f75e2b0c1494
[ "MIT" ]
null
null
null
formula.py
squiel91/FADU-PP
862eb7fab4f70e04532d24b80429f75e2b0c1494
[ "MIT" ]
null
null
null
import math class Formula: def __init__(self, nombre, computo, decimales): self.nombre = nombre self.computo = computo self.decimales = decimales or 2 def instanciar(self, vars_instanciadas): {**math.__dict__, **{'e':1}}['e'] self.evaluacion = round(eval(self.computo, {**math.__dict__, **vars_instanciadas}), self.decimales) return self.evaluacion def __str__(self): self.instanciar() return self.nombre + ':' + str(self.decimales) + ':' +str(self.evaluacion)
32.2
101
0.703934
60
483
5.366667
0.383333
0.093168
0
0
0
0
0
0
0
0
0
0.004808
0.138716
483
15
102
32.2
0.769231
0
0
0
0
0
0.008264
0
0
0
0
0
0
1
0.230769
false
0
0.076923
0
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
996eaf1a52a7297dc9f8fc8550b28d42f7056082
1,019
py
Python
Model/tabuleiro.py
FabioMoreiraFM/Gomoku-2.0
6ff96dd9aa3c01d11a5b073871e66edfb907fc5a
[ "MIT" ]
2
2018-09-11T00:48:47.000Z
2021-11-14T18:19:15.000Z
Model/tabuleiro.py
FabioMoreiraFM/Gomoku-2.0
6ff96dd9aa3c01d11a5b073871e66edfb907fc5a
[ "MIT" ]
null
null
null
Model/tabuleiro.py
FabioMoreiraFM/Gomoku-2.0
6ff96dd9aa3c01d11a5b073871e66edfb907fc5a
[ "MIT" ]
null
null
null
import Model.nodo as nodo from Model.jogador import * class Tabuleiro: _tabuleiro = None _nodos_disponiveis = None def __init__(self, tamanho): self._tabuleiro = [[nodo.Nodo([x,y], Jogador.ESPACO_LIVRE) for y in range(tamanho+1)] for x in range(tamanho+1)] self._criar_dict_nodos_disponiveis(tamanho) def _criar_dict_nodos_disponiveis(self, tamanho): self._nodos_disponiveis = dict(((x,y), self._tabuleiro[x][y]) for x in range(tamanho) for y in range(tamanho)) def inserir_peca(self, coordenada, novo_dono): nodo = self._tabuleiro[coordenada[0]][coordenada[1]] if (nodo.get_dono() == Jogador.ESPACO_LIVRE): nodo.set_dono(novo_dono) del self._nodos_disponiveis[(coordenada[0],coordenada[1])] return 0 return 1 def remover_peca(self, nodo): nodo.set_dono(Jogador.ESPACO_LIVRE) self._nodos_disponiveis[(nodo.get_coordenada()[0], nodo.get_coordenada()[1])] = nodo def get_nodos_disponiveis(self): return self._nodos_disponiveis def get_tabuleiro(self): return self._tabuleiro
29.970588
114
0.751717
151
1,019
4.794702
0.245033
0.176796
0.077348
0.030387
0.099448
0
0
0
0
0
0
0.011211
0.124632
1,019
33
115
30.878788
0.800448
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.083333
0.083333
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
996f29cb3f25053bc1e6d5353dab0001b818aade
1,216
py
Python
scripts/deploy_champions.py
raid-codex/data
b2c3c6a4ac0375cc5bec3c582caf3212a775d83b
[ "MIT" ]
3
2020-04-04T02:20:36.000Z
2020-10-18T00:59:26.000Z
scripts/deploy_champions.py
raid-codex/data
b2c3c6a4ac0375cc5bec3c582caf3212a775d83b
[ "MIT" ]
109
2019-11-27T20:13:59.000Z
2021-03-04T12:06:27.000Z
scripts/deploy_champions.py
raid-codex/data
b2c3c6a4ac0375cc5bec3c582caf3212a775d83b
[ "MIT" ]
2
2020-05-05T02:41:01.000Z
2020-06-09T00:20:25.000Z
#!/usr/bin/env python3 import ftplib import os import io base_dir = os.getenv("BASE_DIR", "{}/src/github.com/raid-codex/data".format( os.getenv("GOPATH"), )) + "/generated/champions/" def upload_file(filename, full_path, ftp): content = None with open(full_path) as f: content = bytes(f.read(), "utf-8") content = io.BytesIO(content) target = "www/generated/champions/{}".format(filename) print("should override {} with content".format(target)) ftp.storbinary("STOR {}".format(target), content) print("ok") print("host={}, user={}, password={}".format(os.getenv("FTP_HOST"), os.getenv("FTP_USER"), bool(os.getenv("FTP_PASSWORD")))) ftp = ftplib.FTP(host=os.getenv("FTP_HOST", "")) logged = ftp.login(user=os.getenv("FTP_USER", ""), passwd=os.getenv("FTP_PASSWORD", "")) print("logged={}".format(logged)) print("Logged in") for (_, _, filenames) in os.walk(base_dir): for filename in filenames: upload_file(filename=filename, full_path="{}{}".format(base_dir, filename), ftp=ftp) ftp.quit()
32
78
0.575658
145
1,216
4.710345
0.406897
0.093704
0.096633
0.043924
0.052709
0
0
0
0
0
0
0.002195
0.250822
1,216
37
79
32.864865
0.74753
0.01727
0
0
1
0
0.20603
0.067002
0
0
0
0
0
1
0.033333
false
0.1
0.1
0
0.133333
0.166667
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
996f9c032db29e34873288a19aa75f06cd0da93e
893
py
Python
nni/runtime/protocol.py
nbl97/nni
1530339d3e964a5ea95a0afde1775ec9167cdcc0
[ "MIT" ]
null
null
null
nni/runtime/protocol.py
nbl97/nni
1530339d3e964a5ea95a0afde1775ec9167cdcc0
[ "MIT" ]
null
null
null
nni/runtime/protocol.py
nbl97/nni
1530339d3e964a5ea95a0afde1775ec9167cdcc0
[ "MIT" ]
null
null
null
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. # pylint: disable=unused-import from __future__ import annotations from .tuner_command_channel.command_type import CommandType from .tuner_command_channel import legacy from .tuner_command_channel import shim _use_ws = False def connect_websocket(url: str): global _use_ws _use_ws = True shim.connect(url) def send(command: CommandType, data: str) -> None: if _use_ws: shim.send(command, data) else: legacy.send(command, data) def receive() -> tuple[CommandType, str] | tuple[None, None]: if _use_ws: return shim.receive() else: return legacy.receive() # for unit test compatibility def _set_in_file(in_file): legacy._in_file = in_file def _set_out_file(out_file): legacy._out_file = out_file def _get_out_file(): return legacy._out_file
22.325
61
0.722284
125
893
4.832
0.4
0.069536
0.07947
0.114238
0.096026
0
0
0
0
0
0
0
0.192609
893
39
62
22.897436
0.837725
0.141097
0
0.16
0
0
0
0
0
0
0
0
0
1
0.24
false
0
0.16
0.04
0.52
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
99a6a805830683c4904ffb7ebdc56e74bbfad176
152
py
Python
Estudo_Livro_De_Nilo Ney/Ex_2.1-2.2.py
FabioARodrigues/Python
20ffe6120fb5a2cbee5b8fd6d16b52193a261c3c
[ "MIT" ]
1
2021-02-28T01:12:14.000Z
2021-02-28T01:12:14.000Z
Estudo_Livro_De_Nilo Ney/Ex_2.1-2.2.py
FabioARodrigues/Python
20ffe6120fb5a2cbee5b8fd6d16b52193a261c3c
[ "MIT" ]
null
null
null
Estudo_Livro_De_Nilo Ney/Ex_2.1-2.2.py
FabioARodrigues/Python
20ffe6120fb5a2cbee5b8fd6d16b52193a261c3c
[ "MIT" ]
null
null
null
#Exercício 2.1 x = 10 + 20 *30 y = 4**2 / 30 z = (9**4 + 2) * 6 - 1 print(x, y, z) #Exercício 2.2 exp = 10 % 3 * (10**2) + 1 - 10 * 4 / 2 print(exp)
12.666667
39
0.460526
35
152
2
0.428571
0.085714
0
0
0
0
0
0
0
0
0
0.283019
0.302632
152
12
40
12.666667
0.377358
0.171053
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
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
41d82eded40c11f0a650006fca00695f0fc39b41
517
py
Python
orttraining/orttraining/python/training/ortmodule/_torch_module_factory.py
lchang20/onnxruntime
97b8f6f394ae02c73ed775f456fd85639c91ced1
[ "MIT" ]
6,036
2019-05-07T06:03:57.000Z
2022-03-31T17:59:54.000Z
orttraining/orttraining/python/training/ortmodule/_torch_module_factory.py
lchang20/onnxruntime
97b8f6f394ae02c73ed775f456fd85639c91ced1
[ "MIT" ]
5,730
2019-05-06T23:04:55.000Z
2022-03-31T23:55:56.000Z
orttraining/orttraining/python/training/ortmodule/_torch_module_factory.py
lchang20/onnxruntime
97b8f6f394ae02c73ed775f456fd85639c91ced1
[ "MIT" ]
1,566
2019-05-07T01:30:07.000Z
2022-03-31T17:06:50.000Z
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # _torch_module_factory.py from ._torch_module_ort import TorchModuleORT from .debug_options import DebugOptions from ._fallback import _FallbackManager class TorchModuleFactory: def __call__(self, module, debug_options: DebugOptions, fallback_manager: _FallbackManager): """Creates a TorchModule instance based on the input module.""" return TorchModuleORT(module, debug_options, fallback_manager)
34.466667
96
0.794971
59
517
6.661017
0.661017
0.091603
0.091603
0
0
0
0
0
0
0
0
0
0.143133
517
14
97
36.928571
0.887133
0.334623
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.5
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
41d97d12d67a485e0bb5965e16a94ca5822a7e18
304
py
Python
saleor/account/thumbnails.py
elwoodxblues/saleor
5e4e4a4259a011d24b04ebd24c77c689de843fa1
[ "CC-BY-4.0" ]
15,337
2015-01-12T02:11:52.000Z
2021-10-05T19:19:29.000Z
saleor/account/thumbnails.py
elwoodxblues/saleor
5e4e4a4259a011d24b04ebd24c77c689de843fa1
[ "CC-BY-4.0" ]
7,486
2015-02-11T10:52:13.000Z
2021-10-06T09:37:15.000Z
saleor/account/thumbnails.py
aminziadna/saleor
2e78fb5bcf8b83a6278af02551a104cfa555a1fb
[ "CC-BY-4.0" ]
5,864
2015-01-16T14:52:54.000Z
2021-10-05T23:01:15.000Z
from ..celeryconf import app from ..core.utils import create_thumbnails from .models import User @app.task def create_user_avatar_thumbnails(user_id): """Create thumbnails for user avatar.""" create_thumbnails( pk=user_id, model=User, size_set="user_avatars", image_attr="avatar" )
25.333333
76
0.740132
42
304
5.119048
0.52381
0.223256
0
0
0
0
0
0
0
0
0
0
0.157895
304
11
77
27.636364
0.839844
0.111842
0
0
0
0
0.068182
0
0
0
0
0
0
1
0.125
false
0
0.375
0
0.5
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
1
0
0
0
0
2
41eee10b4010c7b65584f5e6c63634ddc0ebf7da
619
py
Python
src/tests/samples/violations/except_pass.py
swellander/tryceratops
259bf9c1eb357f2ebf737f5b3f9c52220645490f
[ "MIT" ]
269
2021-06-21T07:13:23.000Z
2022-03-29T02:50:26.000Z
src/tests/samples/violations/except_pass.py
swellander/tryceratops
259bf9c1eb357f2ebf737f5b3f9c52220645490f
[ "MIT" ]
36
2021-07-08T14:35:24.000Z
2022-03-21T05:57:35.000Z
src/tests/samples/violations/except_pass.py
swellander/tryceratops
259bf9c1eb357f2ebf737f5b3f9c52220645490f
[ "MIT" ]
17
2021-07-08T13:59:59.000Z
2022-03-07T11:06:16.000Z
""" Violation: Except with pass """ class MyException(Exception): pass def somefunc(): try: a = 1 except MyException: pass # This is specific, so it should be fine except Exception: pass # This is broad, that's weird def someotherfunc(): try: a = 1 except MyException: ... # This is specific, so it should be fine except Exception: ... # This is broad, that's weird class SomeClass: def some_method(self): try: a = 1 except (MyException, Exception): pass # This is broad, that's weird
17.194444
54
0.567044
75
619
4.666667
0.386667
0.085714
0.042857
0.094286
0.674286
0.485714
0.425714
0.425714
0.257143
0.257143
0
0.007426
0.347334
619
35
55
17.685714
0.858911
0.308562
0
0.727273
0
0
0
0
0
0
0
0
0
1
0.136364
false
0.181818
0
0
0.227273
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
41eef9c16c30f77c02a5da7933dc191179bf2426
1,526
py
Python
daily_solutions/year_2021/tests/test_day_15.py
kasittig/advent_of_code
e536bfbe0a9a05cbee2b9c241bc2fea78db4ee27
[ "MIT" ]
null
null
null
daily_solutions/year_2021/tests/test_day_15.py
kasittig/advent_of_code
e536bfbe0a9a05cbee2b9c241bc2fea78db4ee27
[ "MIT" ]
1
2021-12-18T03:11:27.000Z
2021-12-18T03:11:27.000Z
daily_solutions/year_2021/tests/test_day_15.py
kasittig/advent_of_code
e536bfbe0a9a05cbee2b9c241bc2fea78db4ee27
[ "MIT" ]
null
null
null
from unittest import TestCase from daily_solutions.year_2021.day_15 import RiskMap, Year2021Day15Solution example = [ "1163751742", "1381373672", "2136511328", "3694931569", "7463417111", "1319128137", "1359912421", "3125421639", "1293138521", "2311944581", ] example_map = [ [1, 1, 6, 3, 7, 5, 1, 7, 4, 2], [1, 3, 8, 1, 3, 7, 3, 6, 7, 2], [2, 1, 3, 6, 5, 1, 1, 3, 2, 8], [3, 6, 9, 4, 9, 3, 1, 5, 6, 9], [7, 4, 6, 3, 4, 1, 7, 1, 1, 1], [1, 3, 1, 9, 1, 2, 8, 1, 3, 7], [1, 3, 5, 9, 9, 1, 2, 4, 2, 1], [3, 1, 2, 5, 4, 2, 1, 6, 3, 9], [1, 2, 9, 3, 1, 3, 8, 5, 2, 1], [2, 3, 1, 1, 9, 4, 4, 5, 8, 1], ] class Day15SolutionTestCase(TestCase): def setUp(self) -> None: self.solution = Year2021Day15Solution self.data = self.solution.format_data(example) def test_solve_part_1(self) -> None: self.assertEqual(40, self.solution.solve_part_1(self.data)) def test_solve_part_2(self) -> None: self.assertEqual(315, self.solution.solve_part_2(self.data)) class RiskMapTestCase(TestCase): def test_get_risk(self) -> None: risk_grid = [ [8, 9, 1, 2, 3], [9, 1, 2, 3, 4], [1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], ] risk_map = RiskMap([[8]], 5) for i in range(risk_map.max_rows): for j in range(risk_map.max_cols): self.assertEqual(risk_grid[i][j], risk_map.get_risk((i, j)))
26.77193
76
0.517038
247
1,526
3.089069
0.242915
0.023591
0.019659
0.010485
0.044561
0
0
0
0
0
0
0.2397
0.300131
1,526
56
77
27.25
0.474719
0
0
0
0
0
0.065531
0
0
0
0
0
0.06383
1
0.085106
false
0
0.042553
0
0.170213
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
510dee1e6e8fb3a061e3e97dbc185304b5dc2d53
2,162
py
Python
NUTS2.0/nuts/testhandling/reporter.py
EkoGuandor229/Network-Unit-Testing
cc486ec4e705db71ccc79a96427a134276776b20
[ "Apache-2.0" ]
1
2020-10-09T09:42:10.000Z
2020-10-09T09:42:10.000Z
NUTS2.0/nuts/testhandling/reporter.py
EkoGuandor229/Network-Unit-Testing
cc486ec4e705db71ccc79a96427a134276776b20
[ "Apache-2.0" ]
14
2020-02-24T15:22:00.000Z
2021-12-13T20:41:12.000Z
NUTS2.0/nuts/testhandling/reporter.py
EkoGuandor229/Network-Unit-Testing
cc486ec4e705db71ccc79a96427a134276776b20
[ "Apache-2.0" ]
null
null
null
import logging from colorama import Fore from nuts.utilities.file_handler import FileHandler class Reporter: """ The Reporter-class is responsible to print the test results to the console and write a logfile with the test information. ... Attributes ---------- logger Instance of the Logger Class file_handler Instane of the FileHandler Class """ def __init__(self): self.logger = logging.getLogger(__name__) self.file_handler = FileHandler() def print_results(self, results): """ Categorizes Tests in Passedand Failed and starts the matching method """ passed = results["Passed Tests"] failed = results["Failed Tests"] if len(passed) > 0: self.print_passed_results(passed) else: print(Fore.RED + "No tests passed") print(100*"-") if len(failed) > 0: self.print_failed_results(failed) else: print(Fore.GREEN + "No tests failed") def save_results(self, results): """ Saves the Results in a file """ self.file_handler.write_new_run() self.file_handler.write_passed_results(results["Passed Tests"]) self.file_handler.write_failed_results(results["Failed Tests"]) def print_passed_results(self, passed_results): """ Shows the Results of the Passed tests in the console """ print(Fore.GREEN + "Passed Tests") for test_result in passed_results: print(Fore.GREEN + f"| |-- Test: {test_result.get_test_name()} has PASSED") def print_failed_results(self, failed_results): """ Shows the Results of the failed tests in the console """ print(Fore.RED + "Failed Tests") for test_result in failed_results: print(Fore.RED + f"| |-- Test: {test_result.get_test_name()} has FAILED") print(Fore.RED + f"| | |-- Expected: {test_result.get_expected_value()}") print(Fore.RED + f"| | |-- Actual: {test_result.get_result()}") print(Fore.RED + "| |")
30.027778
89
0.601758
256
2,162
4.898438
0.257813
0.064593
0.057416
0.047847
0.162679
0.130782
0.046252
0.046252
0
0
0
0.00327
0.292784
2,162
71
90
30.450704
0.816874
0.20444
0
0.058824
0
0
0.20266
0.074731
0
0
0
0
0
1
0.147059
false
0.264706
0.088235
0
0.264706
0.441176
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
0
1
0
2
5114eb6e365ecdb37f5aecc78661e84cdfe4367f
233
py
Python
Session 4/web_explorer.py
davidvillaciscalderon/PythonLab
9250faee5da416ffe1dd7e670036e89cc6128925
[ "MIT" ]
null
null
null
Session 4/web_explorer.py
davidvillaciscalderon/PythonLab
9250faee5da416ffe1dd7e670036e89cc6128925
[ "MIT" ]
null
null
null
Session 4/web_explorer.py
davidvillaciscalderon/PythonLab
9250faee5da416ffe1dd7e670036e89cc6128925
[ "MIT" ]
null
null
null
from urllib2 import urlopen from bs4 import BeautifulSoup url = 'https://www.wunderground.com/us/va/blacksburg' raw_data=urlopen(url) soup=BeautifulSoup(raw_data, 'html.parser') #print(soup.prettify()) print(soup.find(id="curTemp"))
29.125
53
0.781116
34
233
5.294118
0.705882
0.077778
0
0
0
0
0
0
0
0
0
0.009217
0.06867
233
7
54
33.285714
0.820277
0.094421
0
0
0
0
0.3
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.166667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
511ac74a29f3dadd108f86038a04cf58852d92f8
3,697
py
Python
prediksi/models.py
valiantkevin/prediksi-saham-randomforest
927fba182e30c228300a55cb5f57b16f0147db76
[ "MIT" ]
null
null
null
prediksi/models.py
valiantkevin/prediksi-saham-randomforest
927fba182e30c228300a55cb5f57b16f0147db76
[ "MIT" ]
null
null
null
prediksi/models.py
valiantkevin/prediksi-saham-randomforest
927fba182e30c228300a55cb5f57b16f0147db76
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class Stocks(models.Model): ticker = models.CharField(max_length=5, default='STOCK',) date = models.DateField() open = models.IntegerField() high = models.IntegerField() low = models.IntegerField() close = models.IntegerField() volume = models.IntegerField() after1 = models.IntegerField() after5 = models.IntegerField() after20 = models.IntegerField() plain1 = models.IntegerField() plain5 = models.IntegerField() plain20 = models.IntegerField() grouped1 = models.IntegerField() grouped5 = models.IntegerField() grouped20 = models.IntegerField() onehot1 = models.IntegerField() onehot5 = models.IntegerField() onehot20 = models.IntegerField() class PlainStocks(models.Model): ticker = models.CharField(max_length=5, default='STOCK',) date = models.DateField() open = models.IntegerField() high = models.IntegerField() low = models.IntegerField() close = models.IntegerField() volume = models.IntegerField() obv = models.FloatField() co = models.FloatField() macd = models.FloatField() signal = models.FloatField() histogram = models.FloatField() bollinger_high = models.FloatField() bollinger_low = models.FloatField() class GroupedStocks(models.Model): ticker = models.CharField(max_length=5, default='STOCK',) date = models.DateField() obv_comparison = models.IntegerField() obv_position = models.IntegerField() co_comparison = models.IntegerField() co_position = models.IntegerField() macd_comparison = models.IntegerField() macd_position = models.IntegerField() signal_comparison = models.IntegerField() signal_position = models.IntegerField() histogram_comparison = models.IntegerField() histogram_position = models.IntegerField() bb_condition = models.IntegerField() class OneHotStocks(models.Model): ticker = models.CharField(max_length=5, default='STOCK',) date = models.DateField() obv_comparison_naik = models.IntegerField() obv_comparison_tetap = models.IntegerField() obv_comparison_turun = models.IntegerField() obv_position_positif = models.IntegerField() obv_position_negatif = models.IntegerField() obv_position_nol = models.IntegerField() co_position_positif = models.IntegerField() co_position_negatif = models.IntegerField() co_position_nol = models.IntegerField() co_comparison_naik = models.IntegerField() co_comparison_turun = models.IntegerField() co_comparison_tetap = models.IntegerField() macd_position_positif = models.IntegerField() macd_position_negatif = models.IntegerField() macd_position_nol = models.IntegerField() macd_comparison_naik = models.IntegerField() macd_comparison_turun = models.IntegerField() macd_comparison_tetap = models.IntegerField() signal_position_positif = models.IntegerField() signal_position_negatif = models.IntegerField() signal_position_nol = models.IntegerField() signal_comparison_naik = models.IntegerField() signal_comparison_turun = models.IntegerField() signal_comparison_tetap = models.IntegerField() histogram_position_positif = models.IntegerField() histogram_position_negatif = models.IntegerField() histogram_position_nol = models.IntegerField() histogram_comparison_naik = models.IntegerField() histogram_comparison_turun = models.IntegerField() histogram_comparison_tetap = models.IntegerField() bb_condition_overbought = models.IntegerField() bb_condition_oversold = models.IntegerField() bb_condition_normal = models.IntegerField()
40.184783
61
0.739519
367
3,697
7.223433
0.166213
0.448133
0.060355
0.060355
0.227839
0.204451
0.204451
0.204451
0.204451
0.204451
0
0.00645
0.161212
3,697
92
62
40.184783
0.848436
0.006492
0
0.209302
0
0
0.005447
0
0
0
0
0
0
1
0
false
0
0.011628
0
1
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
511edc9a86345edaf4769bd8e5ddade18defa3ed
1,673
py
Python
payroll/models.py
jsanchez2388/Dark-Theme-Employee-Payroll
870569eca17f801553f3877b5c0af533d395fc70
[ "MIT" ]
null
null
null
payroll/models.py
jsanchez2388/Dark-Theme-Employee-Payroll
870569eca17f801553f3877b5c0af533d395fc70
[ "MIT" ]
null
null
null
payroll/models.py
jsanchez2388/Dark-Theme-Employee-Payroll
870569eca17f801553f3877b5c0af533d395fc70
[ "MIT" ]
null
null
null
from django.db import models from django.db.models.fields import EmailField # Create your models here. class Person(models.Model): first_name = models.TextField() last_name = models.TextField() middle_name = models.TextField() address = models.TextField() birth_date = models.DateField() email = EmailField(('email address'), unique=True) class Employee(models.Model): person = models.OneToOneField( Person, on_delete = models.CASCADE, primary_key = True, ) date_hired = models.DateField() pay_rate = models.FloatField() status = models.BooleanField() from django.db import models class Paystub(models.Model): employee = models.ForeignKey( Employee, on_delete=models.CASCADE, ) pay_period_start = models.DateField() pay_period_end = models.DateField() hours_worked = models.FloatField() deductions = models.FloatField() taxes = models.FloatField() total_compensation = models.FloatField() class Schedule(models.Model): employee = models.ForeignKey( Employee, on_delete=models.CASCADE, ) mon_start = models.DateTimeField() mon_end = models.DateTimeField() tues_start = models.DateTimeField() tues_end = models.DateTimeField() wed_start = models.DateTimeField() wed_end = models.DateTimeField() thurs_start = models.DateTimeField() thurs_end = models.DateTimeField() fri_start = models.DateTimeField() fri_end = models.DateTimeField() sat_start = models.DateTimeField() sat_end = models.DateTimeField() sun_start = models.DateTimeField() sun_end = models.DateTimeField()
30.418182
54
0.694561
180
1,673
6.288889
0.322222
0.234982
0.14841
0.055654
0.155477
0.113074
0.113074
0.113074
0.113074
0.113074
0
0
0.203825
1,673
55
55
30.418182
0.84985
0.014345
0
0.183673
0
0
0.007888
0
0
0
0
0
0
1
0
false
0
0.061224
0
0.795918
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
51251ffa76ca5bf4395192aa3d24456b0eb1c622
582
py
Python
Python Code/MinecraftPi/ClientExtensions/pluginstuff.py
ona-li-toki-e-jan-Epiphany-tawa-mi/AkashicRecord
0a4882d2729da88c4fb7b7c8970bb00af82eb29c
[ "MIT" ]
1
2021-02-24T22:07:01.000Z
2021-02-24T22:07:01.000Z
Python Code/MinecraftPi/ClientExtensions/pluginstuff.py
ona-li-toki-e-jan-Epiphany-tawa-mi/AkashicRecord
0a4882d2729da88c4fb7b7c8970bb00af82eb29c
[ "MIT" ]
null
null
null
Python Code/MinecraftPi/ClientExtensions/pluginstuff.py
ona-li-toki-e-jan-Epiphany-tawa-mi/AkashicRecord
0a4882d2729da88c4fb7b7c8970bb00af82eb29c
[ "MIT" ]
null
null
null
''' Used to access the methods stored in the main module. ''' main_module = {} def _update(main_globals): ''' Gets the current state of the main module. ''' global main_module main_module = main_globals def get_instance(): ''' Gets the current instance of minecraft, or none if there is not an instance. ''' return main_module['_get_instance']() def set_instance(instance): ''' Sets the current instance of minecraft. ''' main_module['_set_instance'](instance) def stop_program(): ''' Stops the program. ''' main_module['_stop_program']()
25.304348
88
0.683849
78
582
4.871795
0.423077
0.210526
0.110526
0.105263
0.152632
0
0
0
0
0
0
0
0.195876
582
23
89
25.304348
0.811966
0.405498
0
0
0
0
0.12381
0
0
0
0
0
0
1
0.4
false
0
0
0
0.5
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
513e6eac4c1a04dde5964ee5793aa3b7437c248d
757
py
Python
solutions/solution165.py
Satily/leetcode_python_solution
3f05fff7758d650469862bc28df9e4aa7b1d3203
[ "MIT" ]
3
2018-11-22T10:31:09.000Z
2019-05-05T15:53:48.000Z
solutions/solution165.py
Satily/leetcode_python_solution
3f05fff7758d650469862bc28df9e4aa7b1d3203
[ "MIT" ]
null
null
null
solutions/solution165.py
Satily/leetcode_python_solution
3f05fff7758d650469862bc28df9e4aa7b1d3203
[ "MIT" ]
null
null
null
from itertools import zip_longest class Solution: def compareVersion(self, version1: str, version2: str) -> int: for v1n, v2n in zip_longest(map(int, version1.split('.')), map(int, version2.split('.')), fillvalue=0): if v1n > v2n: return 1 elif v1n < v2n: return -1 return 0 if __name__ == '__main__': print(Solution().compareVersion(version1="1.01", version2="1.001")) print(Solution().compareVersion(version1="1.0", version2="1.0.0")) print(Solution().compareVersion(version1="0.1", version2="1.1")) print(Solution().compareVersion(version1="1.0.1", version2="1")) print(Solution().compareVersion(version1="7.5.2.4", version2="7.5.3"))
37.85
112
0.60502
95
757
4.715789
0.378947
0.145089
0.301339
0.390625
0.328125
0.165179
0
0
0
0
0
0.086882
0.224571
757
19
113
39.842105
0.67632
0
0
0
0
0
0.069106
0
0
0
0
0
0
1
0.066667
false
0
0.066667
0
0.4
0.333333
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5148cd7d2bb9fd867bfb4849ecf61fdc15330903
504
py
Python
src/products_crawler/spiders/uastore.py
RyouMon/GoodsCrawer
81a679307adeccb9f0874567848735322023d687
[ "MIT" ]
null
null
null
src/products_crawler/spiders/uastore.py
RyouMon/GoodsCrawer
81a679307adeccb9f0874567848735322023d687
[ "MIT" ]
null
null
null
src/products_crawler/spiders/uastore.py
RyouMon/GoodsCrawer
81a679307adeccb9f0874567848735322023d687
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from scrapy.linkextractors import LinkExtractor from scrapy.spiders import Rule from . import GenericSpider class UastoreSpider(GenericSpider): name = 'uastore' allowed_domains = ['store.united-arrows.co.jp'] rules = ( # Match each product in product list. Rule(LinkExtractor(restrict_xpaths='//div[@id="itemList"]'), callback='parse'), # Match other pages. Rule(LinkExtractor(restrict_xpaths='//div[contains(@id, "pager")]')) )
29.647059
87
0.670635
55
504
6.090909
0.709091
0.059701
0.149254
0.185075
0.202985
0
0
0
0
0
0
0.002445
0.188492
504
16
88
31.5
0.816626
0.150794
0
0
0
0
0.205189
0.108491
0
0
0
0
0
1
0
false
0
0.3
0
0.7
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
5152d2fa75be8888d2a34f9d39fd9e914fb3927c
690
py
Python
parking_permits/tests/factories/order.py
SuviVappula/parking-permits
fb8689384ce4732de5a550778994ad63e88796e1
[ "MIT" ]
null
null
null
parking_permits/tests/factories/order.py
SuviVappula/parking-permits
fb8689384ce4732de5a550778994ad63e88796e1
[ "MIT" ]
102
2021-04-14T06:25:15.000Z
2022-03-31T12:04:50.000Z
parking_permits/tests/factories/order.py
SuviVappula/parking-permits
fb8689384ce4732de5a550778994ad63e88796e1
[ "MIT" ]
5
2021-04-29T09:55:26.000Z
2022-03-07T08:38:36.000Z
from decimal import Decimal import factory from parking_permits.models import Order, OrderItem from .customer import CustomerFactory from .parking_permit import ParkingPermitFactory from .product import ProductFactory class OrderFactory(factory.django.DjangoModelFactory): customer = factory.SubFactory(CustomerFactory) class Meta: model = Order class OrderItemFactory(factory.django.DjangoModelFactory): order = factory.SubFactory(OrderFactory) product = factory.SubFactory(ProductFactory) permit = factory.SubFactory(ParkingPermitFactory) unit_price = Decimal(30) vat = Decimal(0.24) quantity = 6 class Meta: model = OrderItem
23.793103
58
0.765217
70
690
7.5
0.442857
0.129524
0.118095
0
0
0
0
0
0
0
0
0.010508
0.172464
690
28
59
24.642857
0.908932
0
0
0.105263
0
0
0
0
0
0
0
0
0
1
0
false
0
0.315789
0
0.894737
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
5158298eacbdd9a8774ece91cb0ca286fcee9a00
938
py
Python
model_compiler/tests/model_compiler/models/test_data_format.py
yuanliya/Adlik
602074b44064002fc0bb054e17a989a5bcf22e92
[ "Apache-2.0" ]
548
2019-09-27T07:37:47.000Z
2022-03-31T05:12:38.000Z
model_compiler/tests/model_compiler/models/test_data_format.py
yuanliya/Adlik
602074b44064002fc0bb054e17a989a5bcf22e92
[ "Apache-2.0" ]
533
2019-09-27T06:30:41.000Z
2022-03-29T07:34:08.000Z
model_compiler/tests/model_compiler/models/test_data_format.py
yuanliya/Adlik
602074b44064002fc0bb054e17a989a5bcf22e92
[ "Apache-2.0" ]
54
2019-10-10T02:19:31.000Z
2021-12-28T03:37:45.000Z
# Copyright 2019 ZTE corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from unittest import TestCase from model_compiler.models import data_format from model_compiler.models.data_format import DataFormat from model_compiler.protos.generated.model_config_pb2 import ModelInput class AsModelConfigDataFormatTestCase(TestCase): def test_none(self): self.assertEqual(data_format.as_model_config_data_format(None), ModelInput.FORMAT_NONE) # pylint: disable=no-member def test_channels_first(self): self.assertEqual(data_format.as_model_config_data_format(DataFormat.CHANNELS_FIRST), ModelInput.FORMAT_NCHW) # pylint: disable=no-member def test_channels_last(self): self.assertEqual(data_format.as_model_config_data_format(DataFormat.CHANNELS_LAST), ModelInput.FORMAT_NHWC) # pylint: disable=no-member
40.782609
92
0.749467
114
938
5.885965
0.394737
0.119225
0.076006
0.102832
0.393443
0.393443
0.393443
0.28614
0.28614
0.28614
0
0.009115
0.181237
938
22
93
42.636364
0.864583
0.176972
0
0
0
0
0
0
0
0
0
0
0.214286
1
0.214286
false
0
0.285714
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
515927f96ea232746617edf4869fcba19f5d1ca0
11,414
py
Python
src/observations.py
Furqan-Code/Bundle_Adjustment
9ec486181745680c71cc24be842bf6fd792d2606
[ "Unlicense" ]
null
null
null
src/observations.py
Furqan-Code/Bundle_Adjustment
9ec486181745680c71cc24be842bf6fd792d2606
[ "Unlicense" ]
null
null
null
src/observations.py
Furqan-Code/Bundle_Adjustment
9ec486181745680c71cc24be842bf6fd792d2606
[ "Unlicense" ]
null
null
null
import numpy as np import cv2 from Feature_Matching import initial_guess from velocity import velocity def distance(velocity_estimate,frame_0_time,time_inc,base_frame,curr_frame): ''' function to calculate distance travelled between frames Parameters: ----------- velocity_estimate = Nx2 array of time,velocity frame_0_time = time at frame 0 curr_frame = current frame number Returns: -------- Distance travelled ''' base_time = frame_0_time +time_inc*base_frame curr_time = frame_0_time +time_inc*curr_frame total_time = curr_time - base_time base_index = (velocity_estimate[:,0]<=base_time).nonzero()[0][-1] curr_index = (velocity_estimate[:,0]<=curr_time).nonzero()[0][-1] avg_velocity = velocity_estimate[base_index:curr_index+1,1].mean() return avg_velocity*total_time def observations(frame_0_time,nth_frame,input_dir): ''' Retrieves: 1. Feature correspondences across camera frames 2. Initial guess for corresponding 3D points. 3. Initial guess for camera transformation matrices All 3D points and transformations are defined w.r.t the first frame Ouptut: ------- point_list = Nx4 numpy array containing the observation points in the format - <Camera Frame><Feature index><x,y feature coordinates in current Camera Frame> model_params = 1x4 list containing <total number of camera frames>,<total number of feature points>,<total number of observations> cam_transforms = Nx6 numpy array of camera extrensic parameters pt_3d_list = Nx3 numpy array of 3d points for matched features. The 3D points are defined w.r.t the first frame ''' # list of run 4 image files images_root = [ input_dir+'/run4_base_hr/mono_image/frame000050_2018_09_04_18_14_44_143406.png',\ input_dir+'/run4_base_hr/mono_image/frame000051_2018_09_04_18_14_44_342875.png',\ input_dir+'/run4_base_hr/mono_image/frame000052_2018_09_04_18_14_44_543322.png',\ input_dir+'/run4_base_hr/mono_image/frame000053_2018_09_04_18_14_44_745412.png',\ input_dir+'/run4_base_hr/mono_image/frame000054_2018_09_04_18_14_44_947120.png',\ input_dir+'/run4_base_hr/mono_image/frame000055_2018_09_04_18_14_45_145872.png',\ input_dir+'/run4_base_hr/mono_image/frame000056_2018_09_04_18_14_45_347874.png',\ input_dir+'/run4_base_hr/mono_image/frame000057_2018_09_04_18_14_45_548328.png',\ input_dir+'/run4_base_hr/mono_image/frame000058_2018_09_04_18_14_45_745208.png',\ input_dir+'/run4_base_hr/mono_image/frame000059_2018_09_04_18_14_45_942796.png',\ input_dir+'/run4_base_hr/mono_image/frame000060_2018_09_04_18_14_46_143434.png',\ input_dir+'/run4_base_hr/mono_image/frame000061_2018_09_04_18_14_46_343646.png',\ input_dir+'/run4_base_hr/mono_image/frame000062_2018_09_04_18_14_46_543835.png',\ input_dir+'/run4_base_hr/mono_image/frame000063_2018_09_04_18_14_46_747026.png',\ input_dir+'/run4_base_hr/mono_image/frame000064_2018_09_04_18_14_46_949385.png',\ input_dir+'/run4_base_hr/mono_image/frame000065_2018_09_04_18_14_47_146589.png',\ input_dir+'/run4_base_hr/mono_image/frame000066_2018_09_04_18_14_47_345159.png',\ input_dir+'/run4_base_hr/mono_image/frame000067_2018_09_04_18_14_47_544991.png',\ input_dir+'/run4_base_hr/mono_image/frame000068_2018_09_04_18_14_47_742937.png',\ input_dir+'/run4_base_hr/mono_image/frame000069_2018_09_04_18_14_47_942956.png',\ input_dir+'/run4_base_hr/mono_image/frame000070_2018_09_04_18_14_48_143949.png',\ input_dir+'/run4_base_hr/mono_image/frame000071_2018_09_04_18_14_48_343130.png',\ input_dir+'/run4_base_hr/mono_image/frame000072_2018_09_04_18_14_48_547100.png',\ input_dir+'/run4_base_hr/mono_image/frame000073_2018_09_04_18_14_48_748986.png',\ input_dir+'/run4_base_hr/mono_image/frame000074_2018_09_04_18_14_48_944920.png',\ input_dir+'/run4_base_hr/mono_image/frame000075_2018_09_04_18_14_49_145128.png',\ input_dir+'/run4_base_hr/mono_image/frame000076_2018_09_04_18_14_49_343308.png',\ input_dir+'/run4_base_hr/mono_image/frame000077_2018_09_04_18_14_49_543605.png',\ input_dir+'/run4_base_hr/mono_image/frame000078_2018_09_04_18_14_49_742891.png',\ input_dir+'/run4_base_hr/mono_image/frame000079_2018_09_04_18_14_49_945075.png',\ input_dir+'/run4_base_hr/mono_image/frame000080_2018_09_04_18_14_50_146393.png',\ input_dir+'/run4_base_hr/mono_image/frame000081_2018_09_04_18_14_50_346777.png',\ input_dir+'/run4_base_hr/mono_image/frame000082_2018_09_04_18_14_50_546128.png',\ input_dir+'/run4_base_hr/mono_image/frame000083_2018_09_04_18_14_50_743644.png',\ input_dir+'/run4_base_hr/mono_image/frame000084_2018_09_04_18_14_50_943493.png',\ input_dir+'/run4_base_hr/mono_image/frame000085_2018_09_04_18_14_51_144934.png',\ input_dir+'/run4_base_hr/mono_image/frame000086_2018_09_04_18_14_51_343637.png',\ input_dir+'/run4_base_hr/mono_image/frame000087_2018_09_04_18_14_51_544055.png',\ input_dir+'/run4_base_hr/mono_image/frame000088_2018_09_04_18_14_51_743875.png',\ input_dir+'/run4_base_hr/mono_image/frame000089_2018_09_04_18_14_51_946698.png',\ input_dir+'/run4_base_hr/mono_image/frame000090_2018_09_04_18_14_52_145009.png',\ input_dir+'/run4_base_hr/mono_image/frame000091_2018_09_04_18_14_52_345942.png',\ input_dir+'/run4_base_hr/mono_image/frame000092_2018_09_04_18_14_52_543475.png',\ input_dir+'/run4_base_hr/mono_image/frame000093_2018_09_04_18_14_52_743029.png',\ input_dir+'/run4_base_hr/mono_image/frame000094_2018_09_04_18_14_52_942685.png',\ input_dir+'/run4_base_hr/mono_image/frame000095_2018_09_04_18_14_53_144148.png',\ input_dir+'/run4_base_hr/mono_image/frame000096_2018_09_04_18_14_53_343962.png',\ input_dir+'/run4_base_hr/mono_image/frame000097_2018_09_04_18_14_53_547824.png',\ input_dir+'/run4_base_hr/mono_image/frame000098_2018_09_04_18_14_53_744450.png',\ input_dir+'/run4_base_hr/mono_image/frame000099_2018_09_04_18_14_53_945602.png',\ input_dir+'/run4_base_hr/mono_image/frame000100_2018_09_04_18_14_54_145016.png',\ input_dir+'/run4_base_hr/mono_image/frame000101_2018_09_04_18_14_54_343470.png',\ input_dir+'/run4_base_hr/mono_image/frame000102_2018_09_04_18_14_54_543084.png',\ input_dir+'/run4_base_hr/mono_image/frame000103_2018_09_04_18_14_54_743082.png',\ input_dir+'/run4_base_hr/mono_image/frame000104_2018_09_04_18_14_54_943012.png',\ input_dir+'/run4_base_hr/mono_image/frame000105_2018_09_04_18_14_55_145069.png',\ input_dir+'/run4_base_hr/mono_image/frame000106_2018_09_04_18_14_55_343661.png',\ input_dir+'/run4_base_hr/mono_image/frame000107_2018_09_04_18_14_55_546670.png',\ input_dir+'/run4_base_hr/mono_image/frame000108_2018_09_04_18_14_55_745882.png',\ input_dir+'/run4_base_hr/mono_image/frame000109_2018_09_04_18_14_55_945317.png',\ input_dir+'/run4_base_hr/mono_image/frame000110_2018_09_04_18_14_56_142818.png' ] #Retrieve velocity profiles velocity_estimate = np.asarray(velocity(input_dir)) time_inc = 0.2*nth_frame #images to be processed images = images_root[0::nth_frame] #Camera Calibration Matrix K =np.array([[904.04572636,0,645.74398382],[0,907.01811462,512.14951996],[0,0,1]]) Data_assoc=[np.zeros((1,2))]*len(images) cam_transforms = [np.identity(4)]*len(images) for i in range(len(images)): # pont matching is done upto 6 frames forward for j in range(i+1,min(i+6,len(images))): img1 = cv2.imread(images[i],0)[:500,:] img2 = cv2.imread(images[j],0)[:500,:] dist = distance(velocity_estimate,frame_0_time,time_inc,i,j) src,dst,pt_3d,R_t_mat=initial_guess(img1,img2,dist) # transform camera parameters w.r.t to frame 0 if j-i==1: cam_transforms[j]= cam_transforms[j-1]@R_t_mat # transform 3D points w.r.t frame 0 pt_3d = (cam_transforms[i]@np.hstack((pt_3d,np.ones((pt_3d.shape[0],1)))).T).T #Logic for creating list of matching point correspondences across multiple frames point_i_bool=(src[:,None]==Data_assoc[i]).all(-1).any(-1) if (~point_i_bool).all() == True: if Data_assoc[i].shape[0]==1: Data_assoc[i]=src Data_assoc[j]=dst pt_3d_list = pt_3d for iter in range(len(images)): if iter != i and iter != j: Data_assoc[iter]=np.zeros((src.shape[0],2)) else: for row_ind,row in enumerate(point_i_bool): if row.all() == False: Data_assoc[i]=np.vstack((Data_assoc[i],src[row_ind])) if Data_assoc[j].shape[0]<Data_assoc[i].shape[0]: diff = Data_assoc[i].shape[0]-Data_assoc[j].shape[0]-1 Data_assoc[j]=np.vstack((Data_assoc[j],np.zeros((diff,2)))) Data_assoc[j]=np.vstack((Data_assoc[j],dst[row_ind])) pt_3d_list = np.vstack((pt_3d_list,pt_3d[row_ind])) for iter in range(len(images)): if iter != i and iter != j: Data_assoc[iter]=np.vstack((Data_assoc[iter],np.zeros((1,2)))) else: j_ind = (Data_assoc[i]==src[row_ind]).all(axis=1).nonzero() j_ind = j_ind[0][0] if Data_assoc[j].shape[0]<=j_ind: diff = j_ind-Data_assoc[j].shape[0]+1 Data_assoc[j]=np.vstack((Data_assoc[j],np.zeros((diff,2)))) Data_assoc[j][j_ind]=dst[row_ind] # Reorder data for returning to main funciton point_list=[] for i in range(Data_assoc[0].shape[0]): for j in range(len(Data_assoc)): if len(Data_assoc[j][i].nonzero()[0]) != 0: point_list.append([j,i,Data_assoc[j][i][0],Data_assoc[j][i][1]]) point_list = np.asarray(point_list) camera_frames = len(Data_assoc) num_points = Data_assoc[0].shape[0] num_observation = len(point_list) model_params = [camera_frames,num_points,num_observation] for index,matrix in enumerate(cam_transforms): cam_transforms[index] = (np.vstack((cv2.Rodrigues(matrix[:3,:3])[0],matrix[:3,3].reshape(-1,1)))).T cam_transforms = np.asarray(cam_transforms).reshape(-1,6) return point_list,model_params,cam_transforms,pt_3d_list
57.646465
161
0.669791
1,750
11,414
3.900571
0.175429
0.073835
0.107237
0.142983
0.491064
0.468942
0.33138
0.327425
0.03516
0.03516
0
0.203953
0.224198
11,414
198
162
57.646465
0.566911
0.11372
0
0.06015
0
0
0.408537
0.408537
0
0
0
0
0
1
0.015038
false
0
0.030075
0
0.06015
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
516860b4b2e8c1cc8b6f7483ff2d8c8c3715d48f
1,806
py
Python
tic_tac_toe/strategies/basic.py
vikasmunshi/tic_tac_toe
94a5d53ec4c30211179e13eaa48b9caeb7bb19a6
[ "MIT" ]
null
null
null
tic_tac_toe/strategies/basic.py
vikasmunshi/tic_tac_toe
94a5d53ec4c30211179e13eaa48b9caeb7bb19a6
[ "MIT" ]
null
null
null
tic_tac_toe/strategies/basic.py
vikasmunshi/tic_tac_toe
94a5d53ec4c30211179e13eaa48b9caeb7bb19a6
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from tic_tac_toe import * __author__ = 'Vikas Munshi' @memoize def find_center_cell_moves(board): return tuple(c for c in get_possible_moves(board) if is_center_cell(c, board.size)) @memoize def find_corner_cell_moves(board): return tuple(c for c in get_possible_moves(board) if is_corner_cell(c, board.size)) @memoize def find_defensive_moves(board): return tuple(c for c in get_possible_moves(board) if last_move_has_won(Board(board.size, board.moves + ((), c)))) @memoize def find_winning_in_two_moves(board): return tuple(i for s in [(m1, m2) for n, m1 in enumerate(get_possible_moves(board)) for m2 in get_possible_moves(board)[n + 1:] if last_move_has_won(Board(board.size, board.moves + (m1, (), m2)))] for i in s) @memoize def find_winning_moves(board): return tuple(c for c in get_possible_moves(board) if last_move_has_won(Board(board.size, board.moves + (c,)))) @memoize def get_first_move(board): return () if not board.moves else find_center_cell_moves(board) @memoize def get_moves(board): return get_first_move(board) or \ find_winning_moves(board) or \ find_defensive_moves(board) or \ find_winning_in_two_moves(board) or \ find_corner_cell_moves(board) or \ find_center_cell_moves(board) or \ get_possible_moves(board) @memoize def is_center_cell(cell, board_size): return cell.row_id not in (0, board_size - 1) and cell.col_id not in (0, board_size - 1) @memoize def is_corner_cell(cell, board_size): return cell.row_id in (0, board_size - 1) and cell.col_id in (0, board_size - 1) def strategy(board: Board) -> Cell: return select_random_cell(get_moves(board))
28.21875
120
0.696567
294
1,806
3.986395
0.20068
0.170648
0.095563
0.125427
0.613481
0.518771
0.463311
0.399317
0.34471
0.302048
0
0.011732
0.197674
1,806
63
121
28.666667
0.797101
0.02381
0
0.225
0
0
0.006814
0
0
0
0
0
0
1
0.25
false
0
0.025
0.25
0.525
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
516aab5bf91a0b62e0891d26b961b5696a63a741
510
py
Python
tests/lib/test_scraping.py
WormBase/wbtools
70d07109182706b2a6cc333ef7a17dcd293cc3f3
[ "MIT" ]
1
2021-02-17T06:54:13.000Z
2021-02-17T06:54:13.000Z
tests/lib/test_scraping.py
WormBase/wbtools
70d07109182706b2a6cc333ef7a17dcd293cc3f3
[ "MIT" ]
1
2021-04-28T20:58:57.000Z
2021-04-28T20:58:57.000Z
tests/lib/test_scraping.py
WormBase/wbtools
70d07109182706b2a6cc333ef7a17dcd293cc3f3
[ "MIT" ]
1
2021-03-31T17:23:37.000Z
2021-03-31T17:23:37.000Z
import unittest from wbtools.lib.scraping import get_cgc_allele_designations, get_cgc_lab_designations class TestScraping(unittest.TestCase): def test_get_cgc_allele_designations(self): cgc_designations = get_cgc_allele_designations() self.assertTrue(len(cgc_designations) > 0) def test_get_cgc_lab_designations(self): cgc_lab_designations = get_cgc_lab_designations() self.assertTrue(len(cgc_lab_designations) > 0) if __name__ == '__main__': unittest.main()
26.842105
86
0.764706
64
510
5.5625
0.359375
0.101124
0.252809
0.202247
0.514045
0
0
0
0
0
0
0.004662
0.158824
510
18
87
28.333333
0.825175
0
0
0
0
0
0.015686
0
0
0
0
0
0.181818
1
0.181818
false
0
0.181818
0
0.454545
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5a9ada402afc0bbae20f8b8bedd51d19cedda119
222
py
Python
trans.py
Soosai007/Python-projects-
3cd61e7019a77ccf46a7805827bef2ac6371af3a
[ "MIT" ]
null
null
null
trans.py
Soosai007/Python-projects-
3cd61e7019a77ccf46a7805827bef2ac6371af3a
[ "MIT" ]
null
null
null
trans.py
Soosai007/Python-projects-
3cd61e7019a77ccf46a7805827bef2ac6371af3a
[ "MIT" ]
null
null
null
from googletrans import Translator translator = Translator() sample_text = 'Hi my name is subash' det = translator.detect(sample_text) print(det) output= translator.translate(sample_text, dest="ta") print(output)
24.666667
53
0.761261
29
222
5.724138
0.62069
0.180723
0
0
0
0
0
0
0
0
0
0
0.13964
222
8
54
27.75
0.86911
0
0
0
0
0
0.102804
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0.285714
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
5aa5de2c0f228720f33b28e448c854f9b8226f0c
374
py
Python
arxen-gui/communicator/models.py
bopopescu/arxen
11a813079aaf363966c76b4ec8b7252ddcead527
[ "MIT" ]
2
2020-03-16T18:24:44.000Z
2020-04-05T23:33:36.000Z
arxen-gui/communicator/models.py
bopopescu/arxen
11a813079aaf363966c76b4ec8b7252ddcead527
[ "MIT" ]
12
2020-04-21T13:39:58.000Z
2022-02-27T04:31:07.000Z
arxen-gui/communicator/models.py
bopopescu/arxen
11a813079aaf363966c76b4ec8b7252ddcead527
[ "MIT" ]
3
2020-04-27T15:50:01.000Z
2020-07-26T06:17:20.000Z
from django.db import models # Create your models here. class Chat(models.Model): uuid = models.CharField(max_length=100) class Message(models.Model): message_text = models.CharField(max_length=1000) pub_date = models.DateTimeField('date published') author = models.TextField(max_length=100) chat = models.ForeignKey(Chat, on_delete=models.CASCADE)
24.933333
60
0.748663
50
374
5.48
0.58
0.09854
0.131387
0.175182
0
0
0
0
0
0
0
0.031348
0.147059
374
14
61
26.714286
0.827586
0.064171
0
0
0
0
0.04023
0
0
0
0
0
0
1
0
false
0
0.125
0
1
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
5ab1290b7cd5fece4e19cf3b8314352ba13d1a05
881
py
Python
moastro/tests/test_settings.py
jonathansick/MoAstro
7047b9f4287f87a508b2af01f75a557547321ddf
[ "BSD-3-Clause" ]
2
2016-08-29T12:09:30.000Z
2018-03-27T14:18:44.000Z
moastro/tests/test_settings.py
jonathansick/MoAstro
7047b9f4287f87a508b2af01f75a557547321ddf
[ "BSD-3-Clause" ]
null
null
null
moastro/tests/test_settings.py
jonathansick/MoAstro
7047b9f4287f87a508b2af01f75a557547321ddf
[ "BSD-3-Clause" ]
null
null
null
import os from ..utils.pkgdata import data_path def setup_test_config(): """Make moastro/data/example_moastro.json the settings file.""" json_path = data_path('example_moastro.json') print json_path assert os.path.exists(json_path) == True os.putenv('MOASTROCONFIG', json_path) def test_read_settings(): from ..settings import read_settings # setup_test_config() # FIXME can't read package data from tests? conf = read_settings() assert 'servers' in conf assert 'local' in conf['servers'] assert 'localhost' == conf['servers']['local']['url'] assert 27017 == conf['servers']['local']['port'] def test_locate_server(): from ..settings import locate_server # setup_test_config() # FIXME can't read package data from tests? url, port = locate_server('local') assert url == 'localhost' assert port == 27017
29.366667
70
0.68899
118
881
4.957627
0.338983
0.054701
0.076923
0.068376
0.164103
0.164103
0.164103
0.164103
0.164103
0.164103
0
0.013966
0.187287
881
29
71
30.37931
0.803073
0.144154
0
0
0
0
0.154519
0
0
0
0
0.034483
0.368421
0
null
null
0
0.210526
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
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
5ab16c8c06efe527423d637404ed59fb82826ca4
786
py
Python
src/QuoteEngine/csv_ingestor.py
svd-007/Meme-Generator
09b3073bce11eb655d888a7ee789ba79a6f41862
[ "BSD-3-Clause" ]
1
2021-07-03T07:56:22.000Z
2021-07-03T07:56:22.000Z
src/QuoteEngine/csv_ingestor.py
svd-007/Meme-Generator
09b3073bce11eb655d888a7ee789ba79a6f41862
[ "BSD-3-Clause" ]
null
null
null
src/QuoteEngine/csv_ingestor.py
svd-007/Meme-Generator
09b3073bce11eb655d888a7ee789ba79a6f41862
[ "BSD-3-Clause" ]
null
null
null
"""Represent a sub-class of `IngestorInterface` to parse `.csv` files.""" from .ingestor_interface import IngestorInterface from .model import QuoteModel from pandas import read_csv from typing import List class CSVIngestor(IngestorInterface): """Sub-class of `IngestorInterface` to parse `.csv` files.""" allowed_extensions = ['csv'] @classmethod def parse(cls, path: str) -> List[QuoteModel]: """ Return a list of `QuoteModel` objects after parsing a `.csv` file. Parameters: ----------- `path`: str path of the `.csv` file to be parsed. """ df = read_csv(path) return [QuoteModel(body=row.body, author=row.author) for row in df.itertuples()]
28.071429
74
0.603053
89
786
5.280899
0.494382
0.034043
0.042553
0.114894
0.178723
0.178723
0.178723
0.178723
0
0
0
0
0.279898
786
27
75
29.111111
0.830389
0.342239
0
0
0
0
0.006652
0
0
0
0
0
0
1
0.083333
false
0
0.333333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
5ab6d34df759b2134e073ac7b94ee8100c9ec2d8
1,168
py
Python
examples/dcgan/experiment.py
Mikhail-M/ppln
11bacc40ec6808c0b7bae0f9fb6b36b860294417
[ "MIT" ]
null
null
null
examples/dcgan/experiment.py
Mikhail-M/ppln
11bacc40ec6808c0b7bae0f9fb6b36b860294417
[ "MIT" ]
null
null
null
examples/dcgan/experiment.py
Mikhail-M/ppln
11bacc40ec6808c0b7bae0f9fb6b36b860294417
[ "MIT" ]
null
null
null
import torchvision.transforms as transforms from torch.utils.data.distributed import DistributedSampler from torchvision import datasets from ppln.experiment import BaseExperiment from ppln.factory import make_optimizer from ppln.utils.misc import get_dist_info class GANExperiment(BaseExperiment): @property def optimizers(self): return { 'D': make_optimizer(self.model['D'], self.cfg.optimizer.D), 'G': make_optimizer(self.model['G'], self.cfg.optimizer.G) } def dataset(self, mode): return datasets.ImageFolder(root=self.cfg.data.data_root, transform=self.transform(mode)) def transform(self, mode): return transforms.Compose( [ transforms.Resize(self.cfg.data.image_size), transforms.CenterCrop(self.cfg.data.image_size), transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)), ] ) def sampler(self, mode, dataset): rank, world_size = get_dist_info() return DistributedSampler(dataset, num_replicas=world_size, rank=rank, shuffle=mode == 'train')
34.352941
103
0.65839
140
1,168
5.4
0.378571
0.015873
0.019841
0.026455
0.095238
0.095238
0.015873
0.015873
0.015873
0.015873
0
0.013363
0.231164
1,168
33
104
35.393939
0.828508
0
0
0
0
0
0.007705
0
0
0
0
0
0
1
0.148148
false
0
0.222222
0.111111
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
5abc43b5d7f120f14202201a850688c45523be2e
149
py
Python
app/utils/assets.py
TopKeingt/MHS-code
3173f16ef2cc625f9979eb382aee84633131bc29
[ "MIT" ]
null
null
null
app/utils/assets.py
TopKeingt/MHS-code
3173f16ef2cc625f9979eb382aee84633131bc29
[ "MIT" ]
null
null
null
app/utils/assets.py
TopKeingt/MHS-code
3173f16ef2cc625f9979eb382aee84633131bc29
[ "MIT" ]
null
null
null
from flask_assets import Bundle bundels = { 'main_js': Bundle(), 'main_css': Bundle(), 'admin_js': Bundle(), 'admin_css': Bundle() }
21.285714
32
0.610738
18
149
4.777778
0.555556
0.186047
0
0
0
0
0
0
0
0
0
0
0.214765
149
7
33
21.285714
0.735043
0
0
0
0
0
0.213333
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
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
5ad48ebb9e5603873638ac1671df77410bc6a264
340
py
Python
src/molp/solver.py
gokhanceyhan/momilp
d6b35509713be12b435ff71fd700a876ca4aa4a9
[ "MIT" ]
1
2020-04-14T13:37:10.000Z
2020-04-14T13:37:10.000Z
src/molp/solver.py
gokhanceyhan/momilp
d6b35509713be12b435ff71fd700a876ca4aa4a9
[ "MIT" ]
31
2019-10-27T19:08:14.000Z
2021-12-23T23:06:57.000Z
src/molp/solver.py
gokhanceyhan/momilp
d6b35509713be12b435ff71fd700a876ca4aa4a9
[ "MIT" ]
null
null
null
"""Implements multi-objective linear programming solver""" import abc class MolpSolver(metaclass=abc.ABCMeta): """Implements abstract MOLP solver""" def __init__(self, model): self._model = model @abc.abstractmethod def solve(self): """Solves the molp problem and returns the nondomminated frontier"""
21.25
76
0.694118
38
340
6.078947
0.710526
0.077922
0
0
0
0
0
0
0
0
0
0
0.202941
340
15
77
22.666667
0.852399
0.432353
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
5ae768061b1a42b0e643a85173916b245e52c79b
1,790
py
Python
desafios/desafio037.py
genisyskernel/cursoemvideo-python
dec301e33933388c886fe78010f38adfb24dae82
[ "MIT" ]
1
2020-10-26T04:33:14.000Z
2020-10-26T04:33:14.000Z
desafios/desafio037.py
genisyskernel/cursoemvideo-python
dec301e33933388c886fe78010f38adfb24dae82
[ "MIT" ]
null
null
null
desafios/desafio037.py
genisyskernel/cursoemvideo-python
dec301e33933388c886fe78010f38adfb24dae82
[ "MIT" ]
null
null
null
num = int(input("Digite um numero inteiro: ")) base_conversao = int(input("Digite o numero para conversao ( 1 = BINARIO | 2 = OCTAL | 3 = HEXADECIMAL ): ")) if base_conversao == 1: divisao_inteira = num resto_divisao = num binario = "" while divisao_inteira != 0: resto_divisao = divisao_inteira divisao_inteira = (divisao_inteira // 2) resto_divisao = (resto_divisao % 2) binario = str(resto_divisao) + binario print("O numero {0} em BINARIO e {1}.".format(num, binario)) elif base_conversao == 2: divisao_inteira = num resto_divisao = num octal = "" while divisao_inteira != 0: resto_divisao = divisao_inteira divisao_inteira = (divisao_inteira // 8) resto_divisao = (resto_divisao % 8) octal = str(resto_divisao) + octal print("O numero {0} em OCTAL e {1}.".format(num, octal)) elif base_conversao == 3: divisao_inteira = num resto_divisao = num hexadecimal = "" while divisao_inteira != 0: resto_divisao = divisao_inteira divisao_inteira = (divisao_inteira // 16) resto_divisao = (resto_divisao % 16) if(resto_divisao > 9): if(resto_divisao == 10): resto_divisao = "A" elif(resto_divisao == 11): resto_divisao = "B" elif(resto_divisao == 12): resto_divisao = "C" elif(resto_divisao == 13): resto_divisao = "D" elif(resto_divisao == 14): resto_divisao = "E" else: resto_divisao = "F" hexadecimal = str(resto_divisao) + hexadecimal print("O numero {0} em HEXADECIMAL e {1}.".format(num, hexadecimal)) else: print("Base invalida!")
25.942029
109
0.583799
204
1,790
4.897059
0.215686
0.324324
0.126126
0.168168
0.363363
0.318318
0.222222
0.222222
0.222222
0.222222
0
0.027508
0.309497
1,790
68
110
26.323529
0.780744
0
0
0.297872
0
0
0.12067
0
0
0
0
0
0
1
0
false
0
0
0
0
0.085106
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
850b1d38ad889b7cb5b4b02431213c0e46236583
1,090
py
Python
analysis/scripts/mx_extract.py
sbooeshaghi/azucar
0ced041aa9cfa52593109f79794ac6009adf909a
[ "BSD-2-Clause" ]
null
null
null
analysis/scripts/mx_extract.py
sbooeshaghi/azucar
0ced041aa9cfa52593109f79794ac6009adf909a
[ "BSD-2-Clause" ]
null
null
null
analysis/scripts/mx_extract.py
sbooeshaghi/azucar
0ced041aa9cfa52593109f79794ac6009adf909a
[ "BSD-2-Clause" ]
null
null
null
import numpy as np from scipy.io import mmread, mmwrite from scipy.sparse import csr_matrix from .utils import write_list, read_int_list, read_str_list def mx_extract(matrix_fn, md_fn, select_fn, out_matrix_fn, out_md_fn, axis=1): M = mmread(matrix_fn).toarray() # column indices to select from gene matrix sel = [] read_int_list(select_fn, sel) # read in axis metadata (in this case its the gene list) md = [] read_str_list(md_fn, md) # # markers.ec, maps groups (indices) to marker genes (indices) # markers_ec = defaultdict(list) # read_markers_ec(markers_ec_fn, markers_ec) # # the gene names # genes = [] # read_str_list(genes_fn, genes) # TODO MAKE SURE DROP GENES USED # drop_genes = np.arange(M.shape[1])[~col_mask] # drop_markers(markers_ec, set(drop_genes)) # mtx = M[row_mask][:,col_mask].astype(int) # mtx_ipf = do_ipf(mtx.copy()) # mmwrite(matrix_e_fn, csr_matrix(mtx_ipf[:,sel])) mmwrite(out_matrix_fn, csr_matrix(np.take(M, sel, axis=axis))) write_list(out_md_fn, np.take(md, sel))
30.277778
78
0.688073
178
1,090
3.938202
0.370787
0.077033
0.047076
0
0
0
0
0
0
0
0
0.002281
0.195413
1,090
35
79
31.142857
0.797035
0.484404
0
0
0
0
0
0
0
0
0
0.028571
0
1
0.083333
false
0
0.333333
0
0.416667
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
516b8f168d0dcb92d1747dd259f1d4350348be5c
2,079
py
Python
src/dbms/sf_con.py
ojjy/dbmsValCheck
ffb2f6151a2b5719158fe83730929f4cbfdfdcc2
[ "MIT" ]
null
null
null
src/dbms/sf_con.py
ojjy/dbmsValCheck
ffb2f6151a2b5719158fe83730929f4cbfdfdcc2
[ "MIT" ]
null
null
null
src/dbms/sf_con.py
ojjy/dbmsValCheck
ffb2f6151a2b5719158fe83730929f4cbfdfdcc2
[ "MIT" ]
null
null
null
import snowflake.connector from dbms.dbms_abs import DBMS class Snowflakedb(DBMS): def __init__(self, wh,schema, **kwargs): super().__init__(**kwargs) self.wh = wh self.schema = schema self._con = snowflake.connector.connect(user=self.user, password=self.pwd, account=self.host, schema = self.schema, warehouse=self.wh, database=self.db) self._cursor = self._con.cursor() def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): return self.close() @property def connection(self): return self._con @property def cursor(self): return self._cursor def execute(self, sql, params): return self._cursor.execute(sql, params or ()) def query(self, sql, params): self._cursor.execute(sql, params or ()) return self._cursor.fetchall() def fetchone(self): return self._cursor.fetchone() def fetchall(self): return self._cursor.fetchall() def commit(self): return self.commit() def close(self, commit=True): self.commit() return self.close() @classmethod def validate(self, **kwargs): try: con = snowflake.connector.connect(user = kwargs['user'], password=kwargs['pwd'], account=kwargs['account'], warehouse=kwargs['warehouse'], database=kwargs['database'], schema=kwargs['schema']) cur = con.cursor() version = cur.execute("SELECT current_version()").fetchone()[0] print(version) except Exception as e: print(e)
31.984615
76
0.482443
190
2,079
5.115789
0.305263
0.102881
0.08642
0.061728
0.179012
0.057613
0
0
0
0
0
0.000829
0.419432
2,079
65
77
31.984615
0.804474
0
0
0.115385
0
0
0.029327
0
0
0
0
0
0
1
0.230769
false
0.038462
0.038462
0.153846
0.480769
0.038462
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
516f6d237999342fbe6518ec06ecd0f4b126311b
435
py
Python
v1/PyNeko/_new_file.py
IPA-CyberLab/IPA_DN_PyNeko
a46ab415b92fb88df715fee25be496c13e71e8fa
[ "Apache-2.0" ]
null
null
null
v1/PyNeko/_new_file.py
IPA-CyberLab/IPA_DN_PyNeko
a46ab415b92fb88df715fee25be496c13e71e8fa
[ "Apache-2.0" ]
null
null
null
v1/PyNeko/_new_file.py
IPA-CyberLab/IPA_DN_PyNeko
a46ab415b92fb88df715fee25be496c13e71e8fa
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # IPA-DN-PyNeko-v1 # # Copyright (c) 2021- IPA CyberLab. # All Rights Reserved. # # Author: Daiyuu Nobori # Description import os import json import subprocess import inspect import typing import time as systime from typing import List, Tuple, Dict, Set, Callable, TypeVar, Type from datetime import timedelta, tzinfo, timezone, time, date, datetime from ._Imports import *
15
70
0.721839
60
435
5.233333
0.766667
0.076433
0
0
0
0
0
0
0
0
0
0.019499
0.174713
435
28
71
15.535714
0.852368
0.347126
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
1
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
2
517150ab7d3768d06c253322c5e4cb6f05d0ac11
1,695
py
Python
tests/test_user.py
oodennis20/Blogs
074338a69db1d759eb9050138c99b8abbb492cd2
[ "MIT" ]
null
null
null
tests/test_user.py
oodennis20/Blogs
074338a69db1d759eb9050138c99b8abbb492cd2
[ "MIT" ]
null
null
null
tests/test_user.py
oodennis20/Blogs
074338a69db1d759eb9050138c99b8abbb492cd2
[ "MIT" ]
1
2019-12-06T05:05:44.000Z
2019-12-06T05:05:44.000Z
import unittest from app.models import * def setUp(self): """ Will be called before every test """ db.create_all() # create test admin user admin = User(author="admin", password="admin2019", is_admin=True) # create test non-admin user hustler = User(author="test_user", password="test2019") # save users to database db.session.add(admin) db.session.add(hustler) db.session.commit() def tearDown(self): """ Will be called after every test """ db.session.remove() db.drop_all() class UserModelTest(unittest.TestCase): def setUp(self): self.new_user = User(password = 'banana') def test_password_setter(self): self.assertTrue(self.new_user.password_hash is not None) def test_no_access_password(self): with self.assertRaises(AttributeError): self.new_user.password def test_password_verification(self): self.assertTrue(self.new_user.verify_password('banana')) class CommentsModelTest(unittest.TestCase): def setUp(self): self.new_comment = Comments(id=1, user_id = 1, comment = 'cross buns',blogs_id = '1',date_posted='2019-12-01') def test_comment_variables(self): self.assertEquals(self.new_comment.comment,'cross buns') self.assertEquals(self.new_comment.date_posted,'2019-12-01') self.assertEquals(self.new_comment.user_id, 1) def test_save_comment(self): self.assertTrue(len(Comments.query.all())>0) class BlogsModelTest(unittest.TestCase): def test_save_blogs(self): self.assertTrue(len(Blogs.query.all())>0)
26.484375
117
0.652507
214
1,695
5.018692
0.345794
0.052142
0.040968
0.064246
0.236499
0.119181
0.065177
0
0
0
0
0.023041
0.231858
1,695
64
118
26.484375
0.801843
0.081416
0
0.088235
0
0
0.055666
0
0
0
0
0
0.235294
1
0.294118
false
0.264706
0.058824
0
0.441176
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