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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
27cc87579130596a5f982e491914c12914cc402e | 81 | py | Python | infinityMusicBot/services/downloaders/__init__.py | INFINITY00800/infinitymusicbot | 84c878103a1098147d505ad57f47af4233fa6bb8 | [
"BSD-3-Clause"
] | 3 | 2021-07-22T09:33:07.000Z | 2021-08-31T11:40:30.000Z | infinityMusicBot/services/downloaders/__init__.py | INFINITY00800/infinitymusicbot | 84c878103a1098147d505ad57f47af4233fa6bb8 | [
"BSD-3-Clause"
] | null | null | null | infinityMusicBot/services/downloaders/__init__.py | INFINITY00800/infinitymusicbot | 84c878103a1098147d505ad57f47af4233fa6bb8 | [
"BSD-3-Clause"
] | null | null | null | from infinityMusicBot.services.downloaders import youtube
__all__ = ["youtube"]
| 20.25 | 57 | 0.814815 | 8 | 81 | 7.75 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.098765 | 81 | 3 | 58 | 27 | 0.849315 | 0 | 0 | 0 | 0 | 0 | 0.08642 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
27cf0ebe2e30c9108d6faaf1076c478f6a3656d5 | 17,292 | py | Python | learning/clustering/lsh_tree_test.py | dibakch/differential-privacy | ae9c6b6d5b7e772837ae336d1b3092683481ec16 | [
"Apache-2.0"
] | 2,550 | 2019-09-04T13:13:24.000Z | 2022-03-31T16:05:50.000Z | learning/clustering/lsh_tree_test.py | fbalicchia/differential-privacy | 099080e49c4c047802d785bc818898c0caf84d45 | [
"Apache-2.0"
] | 90 | 2019-09-10T15:37:10.000Z | 2022-03-28T12:55:03.000Z | learning/clustering/lsh_tree_test.py | fbalicchia/differential-privacy | 099080e49c4c047802d785bc818898c0caf84d45 | [
"Apache-2.0"
] | 324 | 2019-09-05T11:52:06.000Z | 2022-03-31T03:30:26.000Z | # Copyright 2021 Google LLC.
#
# 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.
"""Tests for lsh_tree."""
import typing
from unittest import mock
from absl.testing import absltest
import numpy as np
from scipy import stats
from clustering import clustering_params
from clustering import lsh
from clustering import lsh_tree
from clustering import test_utils
def get_test_origin_points(nonprivate_count=5, dim=10):
"""Points with defaults for parameters not needed for the test."""
return np.zeros((nonprivate_count, dim))
def get_test_sim_hash(dim=10, max_hash_len=1):
"""SimHash with defaults for parameters not needed for the test."""
return lsh.SimHash(dim=dim, max_hash_len=max_hash_len)
class TestLshTreeNode(lsh_tree.LshTreeNode):
"""Test node for testing without the real children hashing logic.
This test implementation always returns a fraction of the points with the next
hash_prefix containing 0, and the rest with 1, setting the private count equal
to the real count + 1. Equality is checked by just checking the hash_prefix
and private_count.
"""
# Fraction of the nonprivate_points to add a 0 to the hash_prefix.
frac_zero: float
def __init__(self, *args, frac_zero: float = 0.5, **kwargs):
"""Initializes test node.
Args:
*args: extra arguments for the parent class
frac_zero: fraction of the nonprivate_points to add a 0 to the hash_prefix
**kwargs: extra arguments for the parent class
"""
super(TestLshTreeNode, self).__init__(*args, **kwargs)
self.frac_zero = frac_zero
def get_private_count(self) -> int:
"""Returns a fake private count."""
self.private_count = len(self.nonprivate_points) + 1
return self.private_count
def children(self) -> typing.List[lsh_tree.LshTreeNode]:
"""Returns fake children for this node."""
cutoff = int(len(self.nonprivate_points) * self.frac_zero)
return [
TestLshTreeNode(
self.hash_prefix + '0',
self.nonprivate_points[:cutoff],
self.clustering_param,
self.sim_hash,
private_count=cutoff + 1,
frac_zero=self.frac_zero),
TestLshTreeNode(
self.hash_prefix + '1',
self.nonprivate_points[cutoff:],
self.clustering_param,
self.sim_hash,
private_count=len(self.nonprivate_points) - cutoff + 1,
frac_zero=self.frac_zero)
]
def __eq__(self, other):
"""Returns whether hash_prefix and private_count are the same for tests."""
if not isinstance(other, TestLshTreeNode):
return False
return self.hash_prefix == other.hash_prefix and (self.private_count
== other.private_count)
class LshTreeTest(absltest.TestCase):
@mock.patch.object(stats.dlaplace, 'rvs', return_value=-5, autospec=True)
def test_get_private_count_basic(self, mock_dlaplace_fn):
nonprivate_count = 30
nonprivate_points = get_test_origin_points(
nonprivate_count=nonprivate_count)
clustering_param = test_utils.get_test_clustering_param(
epsilon=5, frac_sum=0.2, frac_group_count=0.8, max_depth=9)
sim_hash = get_test_sim_hash()
lsh_tree_node = lsh_tree.LshTreeNode(
hash_prefix='',
nonprivate_points=nonprivate_points,
clustering_param=clustering_param,
sim_hash=sim_hash)
self.assertEqual(lsh_tree_node.get_private_count(), 25)
mock_dlaplace_fn.assert_called_once_with(0.4)
def test_get_private_count_cache(self):
nonprivate_count = 30
nonprivate_points = get_test_origin_points(
nonprivate_count=nonprivate_count)
clustering_param = test_utils.get_test_clustering_param(epsilon=0.01)
sim_hash = get_test_sim_hash()
lsh_tree_node = lsh_tree.LshTreeNode(
hash_prefix='',
nonprivate_points=nonprivate_points,
clustering_param=clustering_param,
sim_hash=sim_hash)
first_private_count = lsh_tree_node.get_private_count()
self.assertEqual(first_private_count, lsh_tree_node.get_private_count())
def test_get_children(self):
hash_prefix, dim, max_hash_len = '0', 5, 2
datapoints = np.array([[1.5, 0, 1, 0.5, 0], [1, 1, 0, 0.7, 0.1],
[0.8, 0.1, 1, 0.2, 0.4], [0.1, 0.5, 0.3, 0.7, 0.8],
[-0.5, 0.1, -0.3, -0.4, 0.2]])
# Returns children regardless of whether the node should branch. The
# filtering in the algorithm is done after.
clustering_param = test_utils.get_test_clustering_param(
max_depth=max_hash_len)
projection_vectors = np.array([[0, 1, 1, -1, 0], [1, 0, -1, 0, 0]])
sh = lsh.SimHash(dim, max_hash_len, projection_vectors)
node = lsh_tree.LshTreeNode(hash_prefix, datapoints, clustering_param, sh)
children = node.children()
self.assertSameElements([child.hash_prefix for child in children],
['00', '01'])
for child in children:
self.assertEqual(child.clustering_param, clustering_param)
self.assertEqual(child.sim_hash, sh)
if child.hash_prefix == '00':
self.assertTrue((child.nonprivate_points == datapoints[[0, 1]]).all())
if child.hash_prefix == '01':
self.assertTrue((child.nonprivate_points == datapoints[[2, 3,
4]]).all())
def test_get_children_one_empty(self):
hash_prefix, dim, max_hash_len = '0', 5, 2
datapoints = np.array([[1.5, 0, 1, 0.5, 0], [1, 1, 0, 0.7, 0.1]])
# Returns children regardless of whether the node should branch. The
# filtering in the algorithm is done after.
clustering_param = test_utils.get_test_clustering_param(
max_depth=max_hash_len)
projection_vectors = np.array([[0, 1, 1, -1, 0], [1, 0, -1, 0, 0]])
sh = lsh.SimHash(dim, max_hash_len, projection_vectors)
node = lsh_tree.LshTreeNode(hash_prefix, datapoints, clustering_param, sh)
children = node.children()
self.assertSameElements([child.hash_prefix for child in children],
['00', '01'])
for child in children:
self.assertEqual(child.clustering_param, clustering_param)
self.assertEqual(child.sim_hash, sh)
if child.hash_prefix == '00':
self.assertTrue((child.nonprivate_points == datapoints[[0, 1]]).all())
if child.hash_prefix == '01':
self.assertEmpty(child.nonprivate_points)
def test_get_children_error(self):
hash_prefix, dim, max_hash_len = '00', 5, 2
datapoints = np.array([[1.5, 0, 1, 0.5, 0], [1, 1, 0, 0.7, 0.1]])
# Returns children regardless of whether the node should branch. The
# filtering in the algorithm is done after.
clustering_param = test_utils.get_test_clustering_param(
max_depth=max_hash_len)
projection_vectors = np.array([[0, 1, 1, -1, 0], [1, 0, -1, 0, 0]])
sh = lsh.SimHash(dim, max_hash_len, projection_vectors)
node = lsh_tree.LshTreeNode(hash_prefix, datapoints, clustering_param, sh)
with self.assertRaises(ValueError):
node.children()
def test_filter_branching_nodes_too_few_points(self):
sim_hash = get_test_sim_hash()
# private_count, not the nonprivate_count, should be used for the check.
level: lsh_tree.LshTreeLevel = [
lsh_tree.LshTreeNode(
'0',
get_test_origin_points(nonprivate_count=15),
test_utils.get_test_clustering_param(
min_num_points_in_branching_node=10),
sim_hash,
private_count=1),
]
self.assertEmpty(lsh_tree.LshTree.filter_branching_nodes(level))
def test_filter_branching_nodes_enough_points(self):
sim_hash = get_test_sim_hash()
level: lsh_tree.LshTreeLevel = [
lsh_tree.LshTreeNode(
'0',
get_test_origin_points(nonprivate_count=15),
test_utils.get_test_clustering_param(
min_num_points_in_branching_node=10),
sim_hash,
private_count=20),
]
self.assertSequenceEqual(
lsh_tree.LshTree.filter_branching_nodes(level), level)
def test_get_next_level_empty_list(self):
self.assertEmpty(lsh_tree.LshTree.get_next_level([]))
def test_get_next_level(self):
sim_hash = get_test_sim_hash()
clustering_param = test_utils.get_test_clustering_param(
min_num_points_in_branching_node=10, min_num_points_in_node=5)
level: lsh_tree.LshTreeLevel = [
TestLshTreeNode(
'0',
get_test_origin_points(nonprivate_count=16),
clustering_param,
sim_hash,
private_count=20),
]
expected_next_level = [
TestLshTreeNode(
'00',
get_test_origin_points(nonprivate_count=8),
clustering_param,
sim_hash,
private_count=9),
TestLshTreeNode(
'01',
get_test_origin_points(nonprivate_count=8),
clustering_param,
sim_hash,
private_count=9),
]
branching_nodes = lsh_tree.LshTree.filter_branching_nodes(level)
self.assertSequenceEqual(
lsh_tree.LshTree.get_next_level(branching_nodes), expected_next_level)
def test_get_next_level_filters_children_node(self):
sim_hash = get_test_sim_hash()
clustering_param = test_utils.get_test_clustering_param(
min_num_points_in_branching_node=10, min_num_points_in_node=9)
level: lsh_tree.LshTreeLevel = [
# The children test nodes have a private count of 6, which is less than
# min_num_points_in_node.
TestLshTreeNode(
'0',
get_test_origin_points(nonprivate_count=10),
clustering_param,
sim_hash,
private_count=11),
# The children test nodes have a private count of 3 and 9, only the node
# with 9 should be in the result.
TestLshTreeNode(
'1',
get_test_origin_points(nonprivate_count=10),
clustering_param,
sim_hash,
private_count=11,
frac_zero=0.2),
]
expected_next_level = [
TestLshTreeNode(
'11',
get_test_origin_points(nonprivate_count=8),
clustering_param,
sim_hash,
private_count=9),
]
branching_nodes = lsh_tree.LshTree.filter_branching_nodes(level)
self.assertSequenceEqual(
lsh_tree.LshTree.get_next_level(branching_nodes), expected_next_level)
def test_root_node(self):
nonprivate_points = [[1, 2, 1], [0.4, 0.2, 0.8], [3, 0, 3]]
data = clustering_params.Data(nonprivate_points, radius=4.3)
clustering_param = test_utils.get_test_clustering_param(
radius=4.3, max_depth=20)
root = lsh_tree.root_node(data, clustering_param)
self.assertEqual(root.hash_prefix, '')
self.assertSequenceEqual(root.nonprivate_points, nonprivate_points)
self.assertEqual(root.clustering_param, clustering_param)
self.assertEqual(root.sim_hash.dim, 3)
self.assertEqual(root.sim_hash.max_hash_len, 20)
self.assertIsNotNone(root.private_count)
def test_root_node_provide_private_count(self):
nonprivate_points = [[1, 2, 1], [0.4, 0.2, 0.8], [3, 0, 3]]
data = clustering_params.Data(nonprivate_points, radius=4.3)
clustering_param = test_utils.get_test_clustering_param(
radius=4.3, max_depth=20)
root = lsh_tree.root_node(data, clustering_param, private_count=10)
self.assertEqual(root.hash_prefix, '')
self.assertSequenceEqual(root.nonprivate_points, nonprivate_points)
self.assertEqual(root.clustering_param, clustering_param)
self.assertEqual(root.sim_hash.dim, 3)
self.assertEqual(root.sim_hash.max_hash_len, 20)
self.assertEqual(root.private_count, 10)
def test_lsh_tree_empty_root_errors(self):
test_root = lsh_tree.LshTreeNode(
'0',
get_test_origin_points(nonprivate_count=15),
test_utils.get_test_clustering_param(),
get_test_sim_hash(),
private_count=0)
with self.assertRaises(ValueError):
lsh_tree.LshTree(test_root)
def test_lsh_tree_negative_count_root_errors(self):
test_root = lsh_tree.LshTreeNode(
'0',
get_test_origin_points(nonprivate_count=15),
test_utils.get_test_clustering_param(),
get_test_sim_hash(),
private_count=-10)
with self.assertRaises(ValueError):
lsh_tree.LshTree(test_root)
def test_lsh_tree(self):
# Test tree:
# Nodes are nonprivate count + 1.
# Branches to the left are 0, to the right are 1.
# Nodes in parentheses are filtered out.
# 64+1
# / \
# 8+1 56+1
# / \ / \
# (1+1) 7+1 7+1 49+1
# / \
# (6+1) 43+1
nonprivate_count = 64
sh = get_test_sim_hash()
cp = test_utils.get_test_clustering_param(
min_num_points_in_node=8,
min_num_points_in_branching_node=9,
max_depth=3)
test_root = TestLshTreeNode(
'', get_test_origin_points(nonprivate_count), cp, sh, frac_zero=0.125)
expected_tree = {
0: [TestLshTreeNode('', get_test_origin_points(64), cp, sh)],
1: [
TestLshTreeNode('0', get_test_origin_points(8), cp, sh),
TestLshTreeNode('1', get_test_origin_points(56), cp, sh)
],
2: [
TestLshTreeNode('01', get_test_origin_points(7), cp, sh),
TestLshTreeNode('10', get_test_origin_points(7), cp, sh),
TestLshTreeNode('11', get_test_origin_points(49), cp, sh)
],
3: [TestLshTreeNode('111', get_test_origin_points(43), cp, sh)],
}
tree = lsh_tree.LshTree(test_root)
self.assertEqual(tree.tree, expected_tree)
def test_lsh_tree_branching_node_becomes_leaf(self):
# Test tree:
# Nodes are nonprivate count + 1.
# Branches to the left are 0, to the right are 1.
# Nodes in parentheses are filtered out.
# 64+1
# / \
# 32+1 32+1
# / \ / \
# (16+1) (16+1) (16+1) (16+1)
nonprivate_count = 64
sh = get_test_sim_hash()
cp = test_utils.get_test_clustering_param(
min_num_points_in_node=20,
min_num_points_in_branching_node=30,
max_depth=5)
test_root = TestLshTreeNode(
'', get_test_origin_points(nonprivate_count), cp, sh, frac_zero=0.5)
expected_tree = {
0: [TestLshTreeNode('', get_test_origin_points(64), cp, sh)],
1: [
TestLshTreeNode('0', get_test_origin_points(32), cp, sh),
TestLshTreeNode('1', get_test_origin_points(32), cp, sh),
]
}
tree = lsh_tree.LshTree(test_root)
self.assertEqual(tree.tree, expected_tree)
def test_lsh_tree_leaves(self):
# Test tree:
# Nodes are nonprivate count + 1.
# Branches to the left are 0, to the right are 1.
# Nodes in parentheses are filtered out.
# 64+1
# / \
# 8+1 56+1
# / \ / \
# (1+1) 7+1 7+1 49+1
# / \
# (6+1) 43+1
nonprivate_count = 64
sh = get_test_sim_hash()
cp = test_utils.get_test_clustering_param(
min_num_points_in_node=8,
min_num_points_in_branching_node=9,
max_depth=3)
test_root = TestLshTreeNode(
'', get_test_origin_points(nonprivate_count), cp, sh, frac_zero=0.125)
expected_leaves = [
TestLshTreeNode('01', get_test_origin_points(7), cp, sh),
TestLshTreeNode('10', get_test_origin_points(7), cp, sh),
TestLshTreeNode('111', get_test_origin_points(43), cp, sh)
]
tree = lsh_tree.LshTree(test_root)
self.assertEqual(tree.leaves, expected_leaves)
def test_lsh_tree_leaves_branching_node_becomes_leaf(self):
# Test tree:
# Nodes are nonprivate count + 1.
# Branches to the left are 0, to the right are 1.
# Nodes in parentheses are filtered out.
# 64+1
# / \
# 32+1 32+1
# / \ / \
# (16+1) (16+1) (16+1) (16+1)
nonprivate_count = 64
sh = get_test_sim_hash()
cp = test_utils.get_test_clustering_param(
min_num_points_in_node=20,
min_num_points_in_branching_node=30,
max_depth=5)
test_root = TestLshTreeNode(
'', get_test_origin_points(nonprivate_count), cp, sh, frac_zero=0.5)
expected_leaves = [
TestLshTreeNode('0', get_test_origin_points(32), cp, sh),
TestLshTreeNode('1', get_test_origin_points(32), cp, sh),
]
tree = lsh_tree.LshTree(test_root)
self.assertEqual(tree.leaves, expected_leaves)
if __name__ == '__main__':
absltest.main()
| 38.426667 | 80 | 0.655968 | 2,329 | 17,292 | 4.568055 | 0.110348 | 0.040793 | 0.039101 | 0.057148 | 0.767271 | 0.743397 | 0.707773 | 0.689069 | 0.673372 | 0.657957 | 0 | 0.03613 | 0.244506 | 17,292 | 449 | 81 | 38.512249 | 0.778246 | 0.176093 | 0 | 0.658462 | 0 | 0 | 0.004819 | 0 | 0 | 0 | 0 | 0 | 0.113846 | 1 | 0.073846 | false | 0 | 0.027692 | 0 | 0.129231 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
27d127c0f0c85b43548124299fcaf06f62f50791 | 265 | py | Python | src/app/shopping_cart/models/shopping_cart_item.py | daniellima/desafio-lojaintegrada | 3cb17f4ec9769472e111adfe6d550e668518aabd | [
"MIT"
] | null | null | null | src/app/shopping_cart/models/shopping_cart_item.py | daniellima/desafio-lojaintegrada | 3cb17f4ec9769472e111adfe6d550e668518aabd | [
"MIT"
] | null | null | null | src/app/shopping_cart/models/shopping_cart_item.py | daniellima/desafio-lojaintegrada | 3cb17f4ec9769472e111adfe6d550e668518aabd | [
"MIT"
] | null | null | null | class ShoppingCartItem:
def __init__(self, id, name, price, quantity):
self.id = id
self.name = name
self.price = price
self.quantity = quantity
@property
def total_price(self):
return self.price * self.quantity | 24.090909 | 50 | 0.611321 | 31 | 265 | 5.064516 | 0.387097 | 0.171975 | 0.216561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.301887 | 265 | 11 | 51 | 24.090909 | 0.848649 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 0.111111 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
27d7b9398c07d22903a3dc5cf67b52a318be7203 | 44,298 | py | Python | analyze_foldamers/parameters/angle_distributions.py | shirtsgroup/analyze_foldamers | 17a7b948d1d0d4fbfb1d84d58753289404fb99a9 | [
"MIT"
] | null | null | null | analyze_foldamers/parameters/angle_distributions.py | shirtsgroup/analyze_foldamers | 17a7b948d1d0d4fbfb1d84d58753289404fb99a9 | [
"MIT"
] | 33 | 2020-08-05T23:00:56.000Z | 2022-03-21T22:37:03.000Z | analyze_foldamers/parameters/angle_distributions.py | shirtsgroup/analyze_foldamers | 17a7b948d1d0d4fbfb1d84d58753289404fb99a9 | [
"MIT"
] | null | null | null | import os
import numpy as np
import mdtraj as md
from simtk import unit
from cg_openmm.cg_model.cgmodel import CGModel
from analyze_foldamers.utilities.plot import plot_distribution
from analyze_foldamers.parameters.bond_distributions import *
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib.backends.backend_pdf import PdfPages
from scipy.optimize import curve_fit
# These functions calculate and plot bond angle and torsion distributions from a CGModel object and pdb trajectory
def assign_angle_types(cgmodel, angle_list):
"""Internal function for assigning angle types"""
ang_types = [] # List of angle types for each angle in angle_list
ang_array = np.zeros((len(angle_list),3))
# Relevant angle types are added to a dictionary as they are discovered
ang_dict = {}
# Create an inverse dictionary for getting angle string name from integer type
inv_ang_dict = {}
# Counter for number of angle types found:
i_angle_type = 0
# Assign angle types:
for i in range(len(angle_list)):
ang_array[i,0] = angle_list[i][0]
ang_array[i,1] = angle_list[i][1]
ang_array[i,2] = angle_list[i][2]
particle_types = [
CGModel.get_particle_type_name(cgmodel,angle_list[i][0]),
CGModel.get_particle_type_name(cgmodel,angle_list[i][1]),
CGModel.get_particle_type_name(cgmodel,angle_list[i][2])
]
string_name = ""
reverse_string_name = ""
for particle in particle_types:
string_name += f"{particle}_"
string_name = string_name[:-1]
for particle in reversed(particle_types):
reverse_string_name += f"{particle}_"
reverse_string_name = reverse_string_name[:-1]
if (string_name in ang_dict.keys()) == False:
# New angle type found, add to angle dictionary
i_angle_type += 1
ang_dict[string_name] = i_angle_type
ang_dict[reverse_string_name] = i_angle_type
# For inverse dict we will use only the forward name based on first encounter
inv_ang_dict[str(i_angle_type)] = string_name
# print(f"adding new angle type {i_angle_type}: {string_name} to dictionary")
# print(f"adding reverse version {i_angle_type}: {reverse_string_name} to dictionary")
ang_types.append(ang_dict[string_name])
# Sort angles by type into separate sub arrays for mdtraj compute_angles
ang_sub_arrays = {}
for i in range(i_angle_type):
ang_sub_arrays[str(i+1)] = np.zeros((ang_types.count(i+1),3))
# Counter vector for all angle types
n_i = np.zeros((i_angle_type,1), dtype=int)
for i in range(len(angle_list)):
ang_sub_arrays[str(ang_types[i])][n_i[ang_types[i]-1],:] = ang_array[i,:]
n_i[ang_types[i]-1] += 1
return ang_types, ang_array, ang_sub_arrays, n_i, i_angle_type, ang_dict, inv_ang_dict
def assign_torsion_types(cgmodel, torsion_list):
"""Internal function for assigning torsion types"""
torsion_types = [] # List of torsion types for each torsion in torsion_list
torsion_array = np.zeros((len(torsion_list),4))
# Relevant torsion types are added to a dictionary as they are discovered
torsion_dict = {}
# Create an inverse dictionary for getting torsion string name from integer type
inv_torsion_dict = {}
# Counter for number of torsion types found:
i_torsion_type = 0
for i in range(len(torsion_list)):
torsion_array[i,0] = torsion_list[i][0]
torsion_array[i,1] = torsion_list[i][1]
torsion_array[i,2] = torsion_list[i][2]
torsion_array[i,3] = torsion_list[i][3]
particle_types = [
CGModel.get_particle_type_name(cgmodel,torsion_list[i][0]),
CGModel.get_particle_type_name(cgmodel,torsion_list[i][1]),
CGModel.get_particle_type_name(cgmodel,torsion_list[i][2]),
CGModel.get_particle_type_name(cgmodel,torsion_list[i][3])
]
string_name = ""
reverse_string_name = ""
for particle in particle_types:
string_name += f"{particle}_"
string_name = string_name[:-1]
for particle in reversed(particle_types):
reverse_string_name += f"{particle}_"
reverse_string_name = reverse_string_name[:-1]
if (string_name in torsion_dict.keys()) == False:
# New torsion type found, add to torsion dictionary
i_torsion_type += 1
torsion_dict[string_name] = i_torsion_type
torsion_dict[reverse_string_name] = i_torsion_type
# For inverse dict we will use only the forward name based on first encounter
inv_torsion_dict[str(i_torsion_type)] = string_name
# print(f"adding new torsion type {i_torsion_type}: {string_name} to dictionary")
# print(f"adding reverse version {i_torsion_type}: {reverse_string_name} to dictionary")
torsion_types.append(torsion_dict[string_name])
# Sort torsions by type into separate sub arrays for mdtraj compute_dihedrals
torsion_sub_arrays = {}
for i in range(i_torsion_type):
torsion_sub_arrays[str(i+1)] = np.zeros((torsion_types.count(i+1),4))
# Counter vector for all angle types
n_i = np.zeros((i_torsion_type,1), dtype=int)
for i in range(len(torsion_list)):
torsion_sub_arrays[str(torsion_types[i])][n_i[torsion_types[i]-1],:] = torsion_array[i,:]
n_i[torsion_types[i]-1] += 1
return torsion_types, torsion_array, torsion_sub_arrays, n_i, i_torsion_type, torsion_dict, inv_torsion_dict
def calc_bond_angle_distribution(
cgmodel, file_list, nbins=90, frame_start=0, frame_stride=1, frame_end=-1,
plot_per_page=2, temperature_list=None, plotfile="angle_hist.pdf"
):
"""
Calculate and plot all bond angle distributions from a CGModel object and pdb trajectory
:param cgmodel: CGModel() object
:type cgmodel: class
:param file_list: path to pdb or dcd trajectory file(s)
:type file_list: str or list(str)
:param nbins: number of bins spanning the range of 0 to 180 degrees, default = 90
:type nbins: int
:param frame_start: First frame in trajectory file to use for analysis.
:type frame_start: int
:param frame_stride: Advance by this many frames when reading trajectories.
:type frame_stride: int
:param frame_end: Last frame in trajectory file to use for analysis.
:type frame_end: int
:param plot_per_page: number of subplots to display on each page (default=2)
:type plot_per_page: int
:param temperature_list: list of temperatures corresponding to file_list. If None, file names will be the plot labels.
:type temperature_list: list(Quantity())
:param plotfile: Base filename for saving bond angle distribution pdf plots
:type plotfile: str
:returns:
- angle_hist_data ( dict )
"""
# Convert file_list to list if a single string:
if type(file_list) == str:
# Single file
file_list = file_list.split()
# Get angle list
angle_list = CGModel.get_bond_angle_list(cgmodel)
# Assign angle types:
ang_types, ang_array, ang_sub_arrays, n_i, i_angle_type, ang_dict, inv_ang_dict = \
assign_angle_types(cgmodel, angle_list)
# Create dictionary for saving angle histogram data:
angle_hist_data = {}
# Set bin edges:
angle_bin_edges = np.linspace(0,180,nbins+1)
angle_bin_centers = np.zeros((len(angle_bin_edges)-1,1))
for i in range(len(angle_bin_edges)-1):
angle_bin_centers[i] = (angle_bin_edges[i]+angle_bin_edges[i+1])/2
file_index = 0
for file in file_list:
# Load in a trajectory file:
if file[-3:] == 'dcd':
traj = md.load(file,top=md.Topology.from_openmm(cgmodel.topology))
else:
traj = md.load(file)
# Select frames for analysis:
if frame_end == -1:
frame_end = traj.n_frames
traj = traj[frame_start:frame_end:frame_stride]
nframes = traj.n_frames
# Create inner dictionary for current file:
if temperature_list is not None:
file_key = f"{temperature_list[file_index].value_in_unit(unit.kelvin):.2f}"
else:
file_key = file[:-4]
angle_hist_data[file_key] = {}
for i in range(i_angle_type):
# Compute all angle values in trajectory
# This returns an [nframes x n_angles] array
ang_val_array = md.compute_angles(traj,ang_sub_arrays[str(i+1)])
# Reshape arrays and convert to degrees:
ang_val_array = (180/np.pi)*np.reshape(ang_val_array, (nframes*n_i[i][0],1))
# Histogram and plot results:
n_out, bin_edges_out = np.histogram(
ang_val_array, bins=angle_bin_edges,density=True)
angle_hist_data[file_key][f"{inv_ang_dict[str(i+1)]}_density"]=n_out
angle_hist_data[file_key][f"{inv_ang_dict[str(i+1)]}_bin_centers"]=angle_bin_centers
file_index += 1
plot_distribution(
inv_ang_dict,
angle_hist_data,
xlabel="Bond angle (degrees)",
ylabel="Probability density",
xlim=[0,180],
figure_title="Angle distributions",
file_name=f"{plotfile}",
plot_per_page=plot_per_page
)
return angle_hist_data
def calc_torsion_distribution(
cgmodel, file_list, nbins=180, frame_start=0, frame_stride=1, frame_end=-1,
plot_per_page=2, temperature_list=None, plotfile="torsion_hist.pdf"
):
"""
Calculate and plot all torsion distributions from a CGModel object and pdb or dcd trajectory
:param cgmodel: CGModel() object
:type cgmodel: class
:param file_list: path to pdb or dcd trajectory file(s)
:type file_list: str or list(str)
:param nbins: number of bins spanning the range of -180 to 180 degrees, default = 180
:type nbins: int
:param frame_start: First frame in trajectory file to use for analysis.
:type frame_start: int
:param frame_stride: Advance by this many frames when reading trajectories.
:type frame_stride: int
:param frame_end: Last frame in trajectory file to use for analysis.
:type frame_end: int
:param plot_per_page: number of subplots to display on each page (default=2)
:type plot_per_page: int
:param temperature_list: list of temperatures corresponding to file_list. If None, file names will be the plot labels.
:type temperature_list: list(Quantity())
:param plotfile: Base filename for saving torsion distribution pdf plots
:type plotfile: str
:returns:
- torsion_hist_data ( dict )
"""
# Convert file_list to list if a single string:
if type(file_list) == str:
# Single file
file_list = file_list.split()
# Get torsion list
torsion_list = CGModel.get_torsion_list(cgmodel)
# Assign torsion types
torsion_types, torsion_array, torsion_sub_arrays, n_i, i_torsion_type, torsion_dict, inv_torsion_dict = \
assign_torsion_types(cgmodel, torsion_list)
# Create dictionary for saving torsion histogram data:
torsion_hist_data = {}
# Set bin edges:
torsion_bin_edges = np.linspace(-180,180,nbins+1)
torsion_bin_centers = np.zeros((len(torsion_bin_edges)-1,1))
for i in range(len(torsion_bin_edges)-1):
torsion_bin_centers[i] = (torsion_bin_edges[i]+torsion_bin_edges[i+1])/2
file_index = 0
for file in file_list:
# Load in a trajectory file:
if file[-3:] == 'dcd':
traj = md.load(file,top=md.Topology.from_openmm(cgmodel.topology))
else:
traj = md.load(file)
# Select frames for analysis:
if frame_end == -1:
frame_end = traj.n_frames
traj = traj[frame_start:frame_end:frame_stride]
nframes = traj.n_frames
# Create inner dictionary for current file:
if temperature_list is not None:
file_key = f"{temperature_list[file_index].value_in_unit(unit.kelvin):.2f}"
else:
file_key = file[:-4]
torsion_hist_data[file_key] = {}
for i in range(i_torsion_type):
# Compute all torsion values in trajectory
# This returns an [nframes x n_torsions] array
torsion_val_array = md.compute_dihedrals(
traj,torsion_sub_arrays[str(i+1)])
# Reshape arrays and convert to degrees:
torsion_val_array = (180/np.pi)*np.reshape(torsion_val_array, (nframes*n_i[i][0],1))
# Histogram and plot results:
n_out, bin_edges_out = np.histogram(
torsion_val_array, bins=torsion_bin_edges,density=True)
torsion_hist_data[file_key][f"{inv_torsion_dict[str(i+1)]}_density"]=n_out
torsion_hist_data[file_key][f"{inv_torsion_dict[str(i+1)]}_bin_centers"]=torsion_bin_centers
file_index += 1
plot_distribution(
inv_torsion_dict,
torsion_hist_data,
xlabel="Torsion angle (degrees)",
ylabel="Probability density",
xlim=[-180,180],
figure_title="Torsion_distributions",
file_name=f"{plotfile}",
plot_per_page=plot_per_page,
)
return torsion_hist_data
def calc_2d_distribution(
cgmodel,
file_list,
nbin_xvar=180,
nbin_yvar=180,
frame_start=0,
frame_stride=1,
frame_end=-1,
plotfile="2d_hist.pdf",
xvar_name = "bb_bb_bb",
yvar_name = "bb_bb_bb_bb",
colormap="nipy_spectral",
temperature_list=None,
):
"""
Calculate and plot 2d histogram for any 2 bonded variables,
given a CGModel object and pdb or dcd trajectory.
:param cgmodel: CGModel() object
:type cgmodel: class
:param file_list: path to pdb or dcd trajectory file(s) - can be a list or single string
:type file_list: str or list(str)
:param nbin_xvar: number of bins for x bonded variable
:type nbin_xvar: int
:param nbin_yvar: number of bins for y bonded variable
:type nbin_yvar:
:param frame_start: First frame in trajectory file to use for analysis.
:type frame_start: int
:param frame_stride: Advance by this many frames when reading trajectories.
:type frame_stride: int
:param frame_end: Last frame in trajectory file to use for analysis.
:type frame_end: int
:param plotfile: Filename for saving torsion distribution pdf plots
:type plotfile: str
:param xvar_name: particle sequence of the x bonded parameter (default="bb_bb_bb")
:type xvar_name: str
:param yvar_name: particle sequence of the y bonded parameter (default="bb_bb_bb_bb")
:type yvar_name: str
:param colormap: matplotlib pyplot colormap to use (default='nipy_spectral')
:type colormap: str (case sensitive)
:param temperature_list: list of temperatures corresponding to file_list. If None, no subplot labels will be used.
:type temperature_list: list(Quantity())
:returns:
- hist_data ( dict )
- xedges ( dict )
- yedges ( dict )
"""
# Convert file_list to list if a single string:
if type(file_list) == str:
# Single file
file_list = file_list.split()
# Store angle, torsion values by filename for computing global colormap
xvar_val_array = {}
yvar_val_array = {}
# Store the reverse name of the bonded type (need to check both)
# x variable
particle_list = []
particle = ""
for c in xvar_name:
if c == '_':
particle_list.append(particle)
particle = ""
else:
particle += c
particle_list.append(particle)
particle_list_reverse = particle_list[::-1]
xvar_name_reverse = ""
for par in particle_list_reverse:
xvar_name_reverse += par
xvar_name_reverse += "_"
xvar_name_reverse = xvar_name_reverse[:-1]
# y variable
particle_list = []
particle = ""
for c in yvar_name:
if c == '_':
particle_list.append(particle)
particle = ""
else:
particle += c
particle_list.append(particle)
particle_list_reverse = particle_list[::-1]
yvar_name_reverse = ""
for par in particle_list_reverse:
yvar_name_reverse += par
yvar_name_reverse += "_"
yvar_name_reverse = yvar_name_reverse[:-1]
for file in file_list:
# Load in a trajectory file:
if file[-3:] == 'dcd':
traj = md.load(file,top=md.Topology.from_openmm(cgmodel.topology))
else:
traj = md.load(file)
# Select frames for analysis:
if frame_end == -1:
frame_end = traj.n_frames
traj = traj[frame_start:frame_end:frame_stride]
nframes = traj.n_frames
# x variable
# Determine parameter type of xvar:
n_particle_x = xvar_name.count('_')+1
if n_particle_x == 2:
# Bond
# Get bond list
bond_list = CGModel.get_bond_list(cgmodel)
# Assign bond types:
bond_types, bond_array, bond_sub_arrays, n_i, i_bond_type, bond_dict, inv_bond_dict = \
assign_bond_types(cgmodel, bond_list)
for i in range(i_bond_type):
if inv_bond_dict[str(i+1)] == xvar_name or inv_bond_dict[str(i+1)] == xvar_name_reverse:
# Compute all bond length values in trajectory
# This returns an [nframes x n_bonds] array
xvar_val_array[file] = md.compute_distances(traj,bond_sub_arrays[str(i+1)])
# Get equilibrium value:
b_eq = cgmodel.get_bond_length(bond_sub_arrays[str(i+1)][0])
# Set bin edges:
# This should be the same across all files - use heuristic from equilibrium bond length
b_min = 0.5*b_eq.value_in_unit(unit.nanometer)
b_max = 1.5*b_eq.value_in_unit(unit.nanometer)
xvar_bin_edges = np.linspace(b_min,b_max,nbin_xvar+1)
xvar_bin_centers = np.zeros((len(xvar_bin_edges)-1,1))
for i in range(len(xvar_bin_edges)-1):
xvar_bin_centers[i] = (xvar_bin_edges[i]+xvar_bin_edges[i+1])/2
xlabel = f'{xvar_name} distance ({unit.nanometer})'
elif n_particle_x == 3:
# Angle
# Get angle list
angle_list = CGModel.get_bond_angle_list(cgmodel)
# Assign angle types:
ang_types, ang_array, ang_sub_arrays, n_i, i_angle_type, ang_dict, inv_ang_dict = \
assign_angle_types(cgmodel, angle_list)
# Set bin edges:
xvar_bin_edges = np.linspace(0,180,nbin_xvar+1)
xvar_bin_centers = np.zeros((len(xvar_bin_edges)-1,1))
for i in range(len(xvar_bin_edges)-1):
xvar_bin_centers[i] = (xvar_bin_edges[i]+xvar_bin_edges[i+1])/2
for i in range(i_angle_type):
if inv_ang_dict[str(i+1)] == xvar_name or inv_ang_dict[str(i+1)] == xvar_name_reverse:
# Compute all angle values in trajectory
# This returns an [nframes x n_angles] array
xvar_val_array[file] = md.compute_angles(traj,ang_sub_arrays[str(i+1)])
# Convert to degrees:
xvar_val_array[file] *= (180/np.pi)
xlabel = f'{xvar_name} angle (degrees)'
elif n_particle_x == 4:
# Torsion
# Get torsion list
torsion_list = CGModel.get_torsion_list(cgmodel)
# Assign torsion types
torsion_types, torsion_array, torsion_sub_arrays, n_j, i_torsion_type, torsion_dict, inv_torsion_dict = \
assign_torsion_types(cgmodel, torsion_list)
# Set bin edges:
xvar_bin_edges = np.linspace(-180,180,nbin_xvar+1)
xvar_bin_centers = np.zeros((len(xvar_bin_edges)-1,1))
for i in range(len(xvar_bin_edges)-1):
xvar_bin_centers[i] = (xvar_bin_edges[i]+xvar_bin_edges[i+1])/2
for i in range(i_torsion_type):
if inv_torsion_dict[str(i+1)] == xvar_name or inv_torsion_dict[str(i+1)] == xvar_name_reverse:
# Compute all torsion values in trajectory
# This returns an [nframes x n_torsions] array
xvar_val_array[file] = md.compute_dihedrals(
traj,torsion_sub_arrays[str(i+1)])
# Convert to degrees:
xvar_val_array[file] *= (180/np.pi)
xlabel = f'{xvar_name} angle (degrees)'
# y variable
# Determine parameter type of yvar:
n_particle_y = yvar_name.count('_')+1
if n_particle_y == 2:
# Bond
# Get bond list
bond_list = CGModel.get_bond_list(cgmodel)
# Assign bond types:
bond_types, bond_array, bond_sub_arrays, n_i, i_bond_type, bond_dict, inv_bond_dict = \
assign_bond_types(cgmodel, bond_list)
for i in range(i_bond_type):
if inv_bond_dict[str(i+1)] == yvar_name or inv_bond_dict[str(i+1)] == yvar_name_reverse:
# Compute all bond length values in trajectory
# This returns an [nframes x n_bonds] array
yvar_val_array[file] = md.compute_distances(traj,bond_sub_arrays[str(i+1)])
# Get equilibrium value:
b_eq = cgmodel.get_bond_length(bond_sub_arrays[str(i+1)][0])
# Set bin edges:
# This should be the same across all files - use heuristic from equilibrium bond length
b_min = 0.5*b_eq.value_in_unit(unit.nanometer)
b_max = 1.5*b_eq.value_in_unit(unit.nanometer)
yvar_bin_edges = np.linspace(b_min,b_max,nbin_yvar+1)
yvar_bin_centers = np.zeros((len(yvar_bin_edges)-1,1))
for i in range(len(yvar_bin_edges)-1):
yvar_bin_centers[i] = (yvar_bin_edges[i]+yvar_bin_edges[i+1])/2
ylabel = f'{yvar_name} distance ({unit.nanometer})'
elif n_particle_y == 3:
# Angle
# Get angle list
angle_list = CGModel.get_bond_angle_list(cgmodel)
# Assign angle types:
ang_types, ang_array, ang_sub_arrays, n_i, i_angle_type, ang_dict, inv_ang_dict = \
assign_angle_types(cgmodel, angle_list)
# Set bin edges:
yvar_bin_edges = np.linspace(0,180,nbin_yvar+1)
yvar_bin_centers = np.zeros((len(yvar_bin_edges)-1,1))
for i in range(len(yvar_bin_edges)-1):
yvar_bin_centers[i] = (yvar_bin_edges[i]+yvar_bin_edges[i+1])/2
for i in range(i_angle_type):
if inv_ang_dict[str(i+1)] == yvar_name or inv_ang_dict[str(i+1)] == yvar_name_reverse:
# Compute all angle values in trajectory
# This returns an [nframes x n_angles] array
yvar_val_array[file] = md.compute_angles(traj,ang_sub_arrays[str(i+1)])
# Convert to degrees:
yvar_val_array[file] *= (180/np.pi)
ylabel = f'{yvar_name} angle (degrees)'
elif n_particle_y == 4:
# Torsion
# Get torsion list
torsion_list = CGModel.get_torsion_list(cgmodel)
# Assign torsion types
torsion_types, torsion_array, torsion_sub_arrays, n_j, i_torsion_type, torsion_dict, inv_torsion_dict = \
assign_torsion_types(cgmodel, torsion_list)
# Set bin edges:
yvar_bin_edges = np.linspace(-180,180,nbin_yvar+1)
yvar_bin_centers = np.zeros((len(yvar_bin_edges)-1,1))
for i in range(len(yvar_bin_edges)-1):
yvar_bin_centers[i] = (yvar_bin_edges[i]+yvar_bin_edges[i+1])/2
for i in range(i_torsion_type):
if inv_torsion_dict[str(i+1)] == yvar_name or inv_torsion_dict[str(i+1)] == yvar_name_reverse:
# Compute all torsion values in trajectory
# This returns an [nframes x n_torsions] array
yvar_val_array[file] = md.compute_dihedrals(
traj,torsion_sub_arrays[str(i+1)])
# Convert to degrees:
yvar_val_array[file] *= (180/np.pi)
ylabel = f'{yvar_name} angle (degrees)'
# Since the bonded variables may have different numbers of observables, we can use all
# combinations of the 2 parameter observables to create the histograms.
xvar_val_array_combo = {}
yvar_val_array_combo = {}
# Each array of single observables is [n_frames x n_occurances]
# x value arrays should be [xval0_y0, xval1_y0, ...xvaln_y0, ... xval0_yn, xval1_yn, xvaln_yn]
# y value arrays should be [yval0_x0, yval0_x1, ...yval0_xn, ... yvaln_x0, yvaln_x1, yvaln_xn]
for file in file_list:
n_occ_x = xvar_val_array[file].shape[1]
n_occ_y = yvar_val_array[file].shape[1]
xvar_val_array_combo[file] = np.zeros((nframes,n_occ_x*n_occ_y))
yvar_val_array_combo[file] = np.zeros_like(xvar_val_array_combo[file])
for iy in range(n_occ_y):
xvar_val_array_combo[file][:,(iy*n_occ_x):((iy+1)*n_occ_x)] = xvar_val_array[file]
for ix in range(n_occ_x):
yvar_val_array_combo[file][:,ix+iy*n_occ_x] = yvar_val_array[file][:,iy]
# Reshape arrays for histogramming:
xvar_val_array_combo[file] = np.reshape(xvar_val_array_combo[file], (nframes*n_occ_x*n_occ_y,1))
yvar_val_array_combo[file] = np.reshape(yvar_val_array_combo[file], (nframes*n_occ_x*n_occ_y,1))
# 2d histogram the data and plot:
hist_data, xedges, yedges = plot_2d_distribution(
file_list, xvar_val_array_combo, yvar_val_array_combo, xvar_bin_edges, yvar_bin_edges,
plotfile, colormap, xlabel, ylabel, temperature_list=temperature_list)
return hist_data, xedges, yedges
def calc_ramachandran(
cgmodel,
file_list,
nbin_theta=180,
nbin_alpha=180,
frame_start=0,
frame_stride=1,
frame_end=-1,
plotfile="ramachandran.pdf",
backbone_angle_type = "bb_bb_bb",
backbone_torsion_type = "bb_bb_bb_bb",
colormap="nipy_spectral",
temperature_list=None,
):
"""
Calculate and plot ramachandran plot for backbone bond bending-angle and torsion
angle, given a CGModel object and pdb or dcd trajectory.
:param cgmodel: CGModel() object
:type cgmodel: class
:param file_list: path to pdb or dcd trajectory file(s) - can be a list or single string
:type file_list: str or list(str)
:param nbin_theta: number of bins for bond-bending angle (spanning from 0 to 180 degrees)
:type nbin_theta: int
:param nbin_alpha: number of bins for torsion angle (spanning from -180 to +180 degrees)
:type nbin_alpha:
:param frame_start: First frame in trajectory file to use for analysis.
:type frame_start: int
:param frame_stride: Advance by this many frames when reading trajectories.
:type frame_stride: int
:param frame_end: Last frame in trajectory file to use for analysis.
:type frame_end: int
:param plotfile: Filename for saving torsion distribution pdf plots
:type plotfile: str
:param backbone_angle_type: particle sequence of the backbone angles (default="bb_bb_bb") - for now only single sequence permitted
:type backbone_angle_type: str
:param backbone_torsion_type: particle sequence of the backbone angles (default="bb_bb_bb_bb") - for now only single sequence permitted
:type backbone_torsion_type: str
:param colormap: matplotlib pyplot colormap to use (default='nipy_spectral')
:type colormap: str (case sensitive)
:param temperature_list: list of temperatures corresponding to file_list. If None, no subplot labels will be used.
:type temperature_list: list(Quantity())
:returns:
- hist_data ( dict )
- xedges ( dict )
- yedges ( dict )
"""
# Convert file_list to list if a single string:
if type(file_list) == str:
# Single file
file_list = file_list.split()
# Store angle, torsion values by filename for computing global colormap
ang_val_array = {}
torsion_val_array = {}
for file in file_list:
# Load in a trajectory file:
if file[-3:] == 'dcd':
traj = md.load(file,top=md.Topology.from_openmm(cgmodel.topology))
else:
traj = md.load(file)
# Select frames for analysis:
if frame_end == -1:
frame_end = traj.n_frames
traj = traj[frame_start:frame_end:frame_stride]
nframes = traj.n_frames
# Get angle list
angle_list = CGModel.get_bond_angle_list(cgmodel)
# Assign angle types:
ang_types, ang_array, ang_sub_arrays, n_i, i_angle_type, ang_dict, inv_ang_dict = \
assign_angle_types(cgmodel, angle_list)
# Set bin edges:
angle_bin_edges = np.linspace(0,180,nbin_theta+1)
angle_bin_centers = np.zeros((len(angle_bin_edges)-1,1))
for i in range(len(angle_bin_edges)-1):
angle_bin_centers[i] = (angle_bin_edges[i]+angle_bin_edges[i+1])/2
for i in range(i_angle_type):
if inv_ang_dict[str(i+1)] == backbone_angle_type:
# Compute all angle values in trajectory
# This returns an [nframes x n_angles] array
ang_val_array[file] = md.compute_angles(traj,ang_sub_arrays[str(i+1)])
# We will have different numbers of bond-bending angle and torsion angle.
# We will set a convention of omitting the last angle value.
# Convert to degrees and exclude last angle:
ang_val_array[file] = (180/np.pi)*ang_val_array[file][:,:-1]
# Reshape array:
ang_val_array[file] = np.reshape(ang_val_array[file], (nframes*(n_i[i]-1)[0],1))
# Get torsion list
torsion_list = CGModel.get_torsion_list(cgmodel)
# Assign torsion types
torsion_types, torsion_array, torsion_sub_arrays, n_j, i_torsion_type, torsion_dict, inv_torsion_dict = \
assign_torsion_types(cgmodel, torsion_list)
# Set bin edges:
torsion_bin_edges = np.linspace(-180,180,nbin_alpha+1)
torsion_bin_centers = np.zeros((len(torsion_bin_edges)-1,1))
for i in range(len(torsion_bin_edges)-1):
torsion_bin_centers[i] = (torsion_bin_edges[i]+torsion_bin_edges[i+1])/2
for i in range(i_torsion_type):
if inv_torsion_dict[str(i+1)] == backbone_torsion_type:
# Compute all torsion values in trajectory
# This returns an [nframes x n_torsions] array
torsion_val_array[file] = md.compute_dihedrals(
traj,torsion_sub_arrays[str(i+1)])
# Convert to degrees:
torsion_val_array[file] *= (180/np.pi)
# Reshape array
torsion_val_array[file] = np.reshape(torsion_val_array[file], (nframes*n_j[i][0],1))
# 2d histogram the data and plot:
hist_data, xedges, yedges = plot_2d_distribution(
file_list, torsion_val_array, ang_val_array, torsion_bin_edges, angle_bin_edges,
plotfile, colormap, xlabel='Alpha (degrees)', ylabel='Theta (degrees)', temperature_list=temperature_list)
return hist_data, xedges, yedges
def plot_2d_distribution(file_list, xvar_val_array, yvar_val_array, xvar_bin_edges, yvar_bin_edges,
plotfile, colormap, xlabel, ylabel, temperature_list=None):
"""Internal function for 2d histogramming bonded observable data and creating 2d plots"""
# Store 2d histogram output
hist_data = {}
xedges = {}
yedges = {}
image = {}
# Determine optimal subplot layout
nseries = len(file_list)
# This favors more rows instead of more columns:
# If not a square number of series, an extra row is needed:
nrow = int(np.ceil(np.sqrt(nseries)))+2+(nseries%(np.ceil(np.sqrt(nseries)))!=0)
ncol = int(np.ceil(nseries/(nrow-1)))+2
# Initialize plot
figure = plt.figure(
constrained_layout=True,
figsize=(11,8.5),
)
# Gridspec width and height ratios:
# Add extra space on sides for labels / colorbar
widths = np.ones(ncol)
widths[0]=0.1
widths[-1]=0.01
heights = np.ones(nrow)
heights[0] = 0.1
heights[-1] = 0.1
fig_specs = figure.add_gridspec(
ncols=ncol, nrows=nrow, width_ratios=widths, height_ratios=heights
)
subplot_id = 1
for file in file_list:
# Accounting for blank gridspec at the borders:
row = int(np.ceil(subplot_id/(ncol-2)))
col = 1+int((subplot_id-1)%(ncol-2))
# axs subplot object is only subscriptable in dimensions it has multiple entries in
if nrow > 1 and ncol > 1:
ax = figure.add_subplot(fig_specs[row,col])
hist_data_out, xedges_out, yedges_out, image_out = ax.hist2d(
xvar_val_array[file][:,0],
yvar_val_array[file][:,0],
bins=[xvar_bin_edges,yvar_bin_edges],
density=True,
)
if ncol > 1 and nrow == 1:
ax = figure.add_subplot(fig_specs[row,col])
hist_data_out, xedges_out, yedges_out, image_out = ax.hist2d(
xvar_val_array[file][:,0],
yvar_val_array[file][:,0],
bins=[xvar_bin_edges,yvar_bin_edges],
density=True,
)
if ncol == 1 and nrow == 1:
ax = figure.add_subplot(fig_specs[row,col])
hist_data_out, xedges_out, yedges_out, image_out = ax.hist2d(
xvar_val_array[file][:,0],
yvar_val_array[file][:,0],
bins=[xvar_bin_edges,yvar_bin_edges],
density=True,
)
hist_data[file[:-4]] = hist_data_out
xedges[file[:-4]] = xedges_out
yedges[file[:-4]] = yedges_out
image[file[:-4]] = image_out
#axs[row,col].set_title(file)
subplot_id += 1
plt.close()
# Renormalize data to global maximum:
max_global = 0
for key, val in hist_data.items():
max_i = np.amax(val)
if max_i > max_global:
max_global = max_i
# Re-initialize plot
figure = plt.figure(
constrained_layout=True,
figsize=(11,8.5),
)
fig_specs = figure.add_gridspec(
ncols=ncol, nrows=nrow, width_ratios=widths, height_ratios=heights
)
# Update the colormap normalization:
cmap=plt.get_cmap(colormap)
norm=matplotlib.colors.Normalize(vmin=0,vmax=max_global)
subplot_id = 1
for file in file_list:
# Renormalize quadmesh images
# There should be a way to do this using QuadMesh.set_norm.
# For now just replot the data:
# Accounting for blank gridspec at the borders:
row = int(np.ceil(subplot_id/(ncol-2)))
col = 1+int((subplot_id-1)%(ncol-2))
if nrow > 1 and ncol > 1:
ax = figure.add_subplot(fig_specs[row,col])
hist_data_out, xedges_out, yedges_out, image_out = ax.hist2d(
xvar_val_array[file][:,0],
yvar_val_array[file][:,0],
bins=[xvar_bin_edges,yvar_bin_edges],
density=True,
cmap=cmap,
norm=norm,
)
if temperature_list is not None:
xlim = ax.get_xlim()
ylim = ax.get_ylim()
ax.text(
(xlim[0]+0.1*(xlim[1]-xlim[0])),
(ylim[0]+0.1*(ylim[1]-ylim[0])),
f'{temperature_list[subplot_id-1].value_in_unit(unit.kelvin):<.2f} K',
{'fontsize': 10,'color': 'w'},
)
if ncol > 1 and nrow == 1:
ax = figure.add_subplot(fig_specs[row,col])
hist_data_out, xedges_out, yedges_out, image_out = ax.hist2d(
xvar_val_array[file][:,0],
yvar_val_array[file][:,0],
bins=[xvar_bin_edges,yvar_bin_edges],
density=True,
cmap=cmap,
norm=norm,
)
if temperature_list is not None:
xlim = ax.get_xlim()
ylim = ax.get_ylim()
ax.text(
(xlim[0]+0.1*(xlim[1]-xlim[0])),
(ylim[0]+0.1*(ylim[1]-ylim[0])),
f'{temperature_list[subplot_id-1].value_in_unit(unit.kelvin):<.2f} K',
{'fontsize': 10,'color': 'w'},
)
if ncol == 1 and nrow == 1:
ax = figure.add_subplot(fig_specs[row,col])
hist_data_out, xedges_out, yedges_out, image_out = ax.hist2d(
xvar_val_array[file][:,0],
yvar_val_array[file][:,0],
bins=[xvar_bin_edges,yvar_bin_edges],
density=True,
cmap=cmap,
norm=norm,
)
if temperature_list is not None:
xlim = ax.get_xlim()
ylim = ax.get_ylim()
ax.text(
(xlim[0]+0.1*(xlim[1]-xlim[0])),
(ylim[0]+0.1*(ylim[1]-ylim[0])),
f'{temperature_list[subplot_id-1].value_in_unit(unit.kelvin):<.2f} K',
{'fontsize': 10,'color': 'w'},
)
hist_data[file[:-4]] = hist_data_out
xedges[file[:-4]] = xedges_out
yedges[file[:-4]] = yedges_out
image[file[:-4]] = image_out
subplot_id += 1
# Add common axis labels to border gridspec axes:
ax_west = figure.add_subplot(fig_specs[:,0], frameon=False)
ax_east = figure.add_subplot(fig_specs[:,-1], frameon=False)
ax_south = figure.add_subplot(fig_specs[-1,1:-1], frameon=False)
ax_north = figure.add_subplot(fig_specs[0,1:-1], frameon=False)
# Add colorbar to right side:
plt.colorbar(
matplotlib.cm.ScalarMappable(norm=norm, cmap=cmap),
ax=ax_east,
shrink=0.5,
fraction=1.0,
pad=0,
label='probability density')
ax_south.set_xlabel(xlabel, fontsize=14)
ax_south.xaxis.set_label_coords(0.5,0.5)
ax_west.set_ylabel(ylabel, fontsize=14)
ax_west.yaxis.set_label_coords(0.5,0.5)
ax_east.tick_params(labelcolor='none', top=False, bottom=False, left=False, right=False)
ax_west.tick_params(labelcolor='none', top=False, bottom=False, left=False, right=False)
ax_south.tick_params(labelcolor='none', top=False, bottom=False, left=False, right=False)
ax_north.tick_params(labelcolor='none', top=False, bottom=False, left=False, right=False)
plt.savefig(plotfile)
plt.close()
return hist_data, xedges, yedges
def fit_ramachandran_data(hist_data, xedges, yedges):
"""
Calculate and plot ramachandran plot for backbone bond bending-angle and torsion
angle, given a CGModel object and pdb or dcd trajectory.
:param hist_data: dictionary containing 2D histogram data for one or more data series
:type hist_data: dict {series_name: 2D numpy array}
:param xedges: dictionary containing bin edges corresponding to x dimension of hist_data
:type xedges: dict {series_name: 1D numpy array}
:param yedges: dictionary containing bin edges corresponding to y dimension of hist_data
:type yedges: dict {series_name: 1D numpy array}
"""
# Fit to 2d symmetric gaussian:
def two_gauss(xy,a,x0,y0,c):
x, y = xy
return a*np.exp(-((np.power((x-x0),2) + 0.5*np.power((y-y0),2))/(2*np.power(c,2))))
param_opt = {}
param_cov = {}
for key,value in hist_data.items():
z_data = value
max_xy_index = np.unravel_index(np.argmax(z_data, axis=None), z_data.shape)
max_x = (xedges[key][max_xy_index[0]]+xedges[key][max_xy_index[0]+1])/2
max_y = (yedges[key][max_xy_index[1]]+yedges[key][max_xy_index[1]+1])/2
param_guess = [0.01,max_x,max_y,5]
x_centers = xedges[key][:-1] + (xedges[key][1]-xedges[key][0])/2
y_centers = yedges[key][:-1] + (yedges[key][1]-yedges[key][0])/2
x_data, y_data = np.meshgrid(x_centers, y_centers)
# Ravel x,y data to a pair of 1D arrays
xy_data = np.vstack((x_data.ravel(), y_data.ravel()))
param_opt[key], param_cov[key] = curve_fit(two_gauss, xy_data, z_data.ravel(), param_guess)
return param_opt, param_cov
| 39.167109 | 140 | 0.581922 | 5,781 | 44,298 | 4.204117 | 0.075247 | 0.02765 | 0.017281 | 0.011768 | 0.799539 | 0.756707 | 0.707332 | 0.680094 | 0.651745 | 0.621914 | 0 | 0.017695 | 0.327667 | 44,298 | 1,130 | 141 | 39.20177 | 0.798341 | 0.260892 | 0 | 0.556326 | 0 | 0 | 0.035111 | 0.015558 | 0 | 0 | 0 | 0 | 0 | 1 | 0.015598 | false | 0 | 0.020797 | 0 | 0.051993 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
27e9e714cffe99cb6be45c29744ab5043b823c28 | 3,343 | py | Python | app/models.py | Anitha987/Blog-web | 354a886892553277787a4abc1e5f68a57059144c | [
"Unlicense"
] | null | null | null | app/models.py | Anitha987/Blog-web | 354a886892553277787a4abc1e5f68a57059144c | [
"Unlicense"
] | null | null | null | app/models.py | Anitha987/Blog-web | 354a886892553277787a4abc1e5f68a57059144c | [
"Unlicense"
] | null | null | null | from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import UserMixin
from .import db,login_manager
from datetime import datetime
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class Quote:
'''
Quote class to define Quote Objects
'''
def __init__(self,id,author,quote):
self.id =id
self.author = author
self.quote= quote
class User(UserMixin, db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer,primary_key = True)
username = db.Column(db.String(255),index=True)
email= db.Column(db.String(225),unique=True,index=True)
pass_secure=db.Column(db.String(255))
blogs= db.relationship('Blog',backref='user',lazy = "dynamic")
comments= db.relationship('Comment',backref='user',lazy = "dynamic")
bio = db.Column(db.String(255))
profile_pic_path = db.Column(db.String())
password_hash = db.Column(db.String(255))
photoprofiles = db.relationship('PhotoProfile',backref='user',lazy = "dynamic")
@property
def password(self):
raise AttributeError('You cannot read the password attribute')
@password.setter
def password(self, password):
self.pass_secure = generate_password_hash(password)
def verify_password(self,password):
return check_password_hash(self.pass_secure,password)
def __repr__(self):
return f'User {self.username}'
class Blog(db.Model):
__tablename__ = 'blogs'
id = db.Column(db.Integer,primary_key = True)
name = db.Column(db.String(255))
content=db.Column(db.String(255))
category = db.Column(db.Integer,db.ForeignKey('categories.id'))
posted = db.Column(db.DateTime,default=datetime.utcnow)
user_id= db.Column(db.Integer,db.ForeignKey('users.id'))
comments = db.relationship('Comment',backref = 'blogs',lazy="dynamic")
def __repr__(self):
return f'User {self.name}'
def save_blog(self):
db.session.add(self)
db.session.commit()
@classmethod
def get_blogs(cls):
blog = blog.query.all()
return blogs
class Category(db.Model):
__tablename__= 'categories'
id = db.Column(db.Integer,primary_key=True)
name = db.Column(db.String(255))
def save_category(self):
db.session.add(self)
db.session.commit()
@classmethod
def get_categories(cls):
categories = Category.query.all()
# category= Category.get_categories()
return categories
class Comment(db.Model):
__tablename__='comments'
id = db.Column(db.Integer,primary_key=True)
comment =db.Column(db.String(1000))
user_id = db.Column(db.Integer,db.ForeignKey('users.id'))
blog_id = db.Column(db.Integer,db.ForeignKey('blogs.id'))
def save_comment(self):
db.session.add(self)
db.session.commit()
@classmethod
def get_comments(cls):
comment = comment.query.all()
return comments
def __repr__(self):
return f'Comment{self.comment}'
class Subcription(UserMixin,db.Model):
__tablename__ = 'subcription'
id = db.Column(db.Integer,primary_key=True)
email = db.Column(db.String(255),unique=True,index=True,nullable=False)
def __repr__(self):
return f'{self.email}'
class PhotoProfile(db.Model):
__tablename__='photoprofiles'
id=db.Column(db.Integer,primary_key=True)
pic_path = db.Column(db.String())
user_id=db.Column(db.Integer,db.ForeignKey("users.id"))
| 27.628099 | 81 | 0.715226 | 464 | 3,343 | 4.971983 | 0.200431 | 0.083225 | 0.104031 | 0.083225 | 0.405722 | 0.316428 | 0.263979 | 0.228002 | 0.170785 | 0.170785 | 0 | 0.010862 | 0.146276 | 3,343 | 120 | 82 | 27.858333 | 0.797477 | 0.021538 | 0 | 0.258427 | 1 | 0 | 0.085635 | 0.006446 | 0 | 0 | 0 | 0 | 0 | 1 | 0.168539 | false | 0.11236 | 0.044944 | 0.067416 | 0.775281 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
7e03e6ceed24a7e34e49ae1891b0a9c41609eac3 | 196 | py | Python | Python/december cls ex4.py | thebiebs/python-practise-exercises | 28db498f35ec6f9bdd437f54c91990027f4b9436 | [
"MIT"
] | null | null | null | Python/december cls ex4.py | thebiebs/python-practise-exercises | 28db498f35ec6f9bdd437f54c91990027f4b9436 | [
"MIT"
] | null | null | null | Python/december cls ex4.py | thebiebs/python-practise-exercises | 28db498f35ec6f9bdd437f54c91990027f4b9436 | [
"MIT"
] | null | null | null | a = [3, 8, 5, 1, 8, 9, 4, 9, 6, 4, 3, 7]
b = list (set (a))
for i in range (len(b)):
for j in range (i+1,len (b)):
if b[i]>b[j]:
b[i] , b[j] = b[j], b[i]
print (b) | 28 | 42 | 0.377551 | 46 | 196 | 1.608696 | 0.434783 | 0.081081 | 0.121622 | 0.108108 | 0.121622 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104839 | 0.367347 | 196 | 7 | 43 | 28 | 0.491935 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.142857 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
fd7ce0569f9a5ed0cc8230a24dcc7c7d0e559233 | 6,545 | py | Python | examples/get_albums.py | leerssej/freebase-python | a8a5ebfd56a11f6eb6e5a6e14a5429aa85a49727 | [
"BSD-2-Clause"
] | 1 | 2016-12-08T12:33:36.000Z | 2016-12-08T12:33:36.000Z | examples/get_albums.py | yuvadm/freebase-python | e1d4ab54c0b0816b87c3f9727100db37288d6818 | [
"BSD-2-Clause"
] | null | null | null | examples/get_albums.py | yuvadm/freebase-python | e1d4ab54c0b0816b87c3f9727100db37288d6818 | [
"BSD-2-Clause"
] | 2 | 2016-02-29T22:56:16.000Z | 2021-01-08T04:23:45.000Z | #!/usr/bin/python
# ========================================================================
# Copyright (c) 2007, Metaweb Technologies, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY METAWEB TECHNOLOGIES AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL METAWEB
# TECHNOLOGIES OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# ========================================================================
import freebase
query = {
"id" : "/en/the_beatles",
"type" : "/music/artist",
"album" : [{
"name" : None,
"release_date" : None,
"track": {
"return" : "count"
},
"sort" : "release_date"
}]
}
results = freebase.mqlread(query)
for album in results.album:
print "Album \"" + album.name + "\" has " + str(album.track) + " tracks."
# Album "Please Please Me" has 14 tracks.
# Album "From Me to You" has 2 tracks.
# Album "Introducing... The Beatles" has 24 tracks.
# Album "She Loves You" has 2 tracks.
# Album "With the Beatles" has 14 tracks.
# Album "I Want to Hold Your Hand" has 2 tracks.
# Album "Meet the Beatles" has 12 tracks.
# Album "Second Album" has 11 tracks.
# Album "Something New" has 11 tracks.
# Album "A Hard Day's Night" has 36 tracks.
# Album "I Feel Fine" has 2 tracks.
# Album "Beatles for Sale" has 14 tracks.
# Album "Beatles '65" has 11 tracks.
# Album "The Early Beatles" has 11 tracks.
# Album "Beatles VI" has 11 tracks.
# Album "Help! / I'm Down" has 2 tracks.
# Album "Help!" has 14 tracks.
# Album "Rubber Soul" has 14 tracks.
# Album "We Can Work It Out / Day Tripper" has 2 tracks.
# Album "Paperback Writer / Rain" has 2 tracks.
# Album "Yesterday... and Today" has 11 tracks.
# Album "Revolver" has 14 tracks.
# Album "Strawberry Fields Forever / Penny Lane" has 2 tracks.
# Album "Sgt. Pepper's Lonely Hearts Club Band" has 24 tracks.
# Album "Magical Mystery Tour" has 11 tracks.
# Album "Hello, Goodbye" has 2 tracks.
# Album "Magical Mystery Tour" has 6 tracks.
# Album "Lady Madonna" has 2 tracks.
# Album "Hey Jude" has 2 tracks.
# Album "The White Album" has 81 tracks.
# Album "Yellow Submarine" has 13 tracks.
# Album "Get Back" has 2 tracks.
# Album "Abbey Road" has 17 tracks.
# Album "Hey Jude" has 10 tracks.
# Album "Let It Be" has 12 tracks.
# Album "1962-1966" has 26 tracks.
# Album "1967-1970" has 28 tracks.
# Album "Love Songs" has 25 tracks.
# Album "The Beatles at the Hollywood Bowl" has 13 tracks.
# Album "Sgt. Pepper's Lonely Hearts Club Band" has 3 tracks.
# Album "Past Masters, Volume One" has 18 tracks.
# Album "Past Masters, Volume Two" has 15 tracks.
# Album "Rockin' at the Star-Club" has 16 tracks.
# Album "The Early Tapes of the Beatles" has 14 tracks.
# Album "Live at the BBC" has 69 tracks.
# Album "Anthology 1" has 60 tracks.
# Album "Free as a Bird" has 4 tracks.
# Album "The Best Of [26 Unforgetable Hit Songs]" has 26 tracks.
# Album "Real Love" has 4 tracks.
# Album "Anthology 2" has 45 tracks.
# Album "Anthology 3" has 50 tracks.
# Album "Yellow Submarine Songtrack" has 15 tracks.
# Album "1" has 27 tracks.
# Album "Let It Be... Naked" has 12 tracks.
# Album "The Capitol Albums, Volume 1" has 90 tracks.
# Album "The Capitol Albums, Volume 2" has 68 tracks.
# Album "16 Superhits, Volume 1" has 16 tracks.
# Album "16 Superhits, Volume 2" has 16 tracks.
# Album "16 Superhits, Volume 3" has 16 tracks.
# Album "16 Superhits, Volume 4" has 16 tracks.
# Album "1962 Live at Star Club in Hamburg" has 24 tracks.
# Album "1962 Live Recordings" has 30 tracks.
# Album "1962-1966 (Red Album)" has 26 tracks.
# Album "1962-1970" has 18 tracks.
# Album "A Collection of Beatles Oldies (UK Mono LP)" has 16 tracks.
# Album "Alternate Rubber Soul" has 28 tracks.
# Album "Anthology (disc 3)" has 22 tracks.
# Album "Beatles Tapes III: The 1964 World Tour" has 19 tracks.
# Album "Beatles VI (Stereo and Mono)" has 22 tracks.
# Album "Best Selection 1962-1968 Part 3" has 20 tracks.
# Album "Best, Volume 4: 1964" has 12 tracks.
# Album "Best, Volume 9: 1966" has 12 tracks.
# Album "Christmas" has 20 tracks.
# Album "Complete Rooftop Concert 1" has 22 tracks.
# Album "EP Collection (disc 1)" has 4 tracks.
# Album "EP Collection (disc 10)" has 4 tracks.
# Album "EP Collection (disc 11: Yesterday)" has 4 tracks.
# Album "EP Collection (disc 12)" has 4 tracks.
# Album "EP Collection" has 12 tracks.
# Album "EP Collection (disc 2: Twist and Shout)" has 4 tracks.
# Album "EP Collection (disc 3)" has 4 tracks.
# Album "EP Collection (disc 4)" has 4 tracks.
# Album "EP Collection (disc 5)" has 4 tracks.
# Album "EP Collection (disc 6)" has 4 tracks.
# Album "EP Collection (disc 7)" has 4 tracks.
# Album "EP Collection (disc 8)" has 4 tracks.
# Album "EP Collection (disc 9)" has 4 tracks.
# Album "EP Collection, Volume 1" has 32 tracks.
# Album "EP Collection, Volume 2" has 26 tracks.
# Album "From Yesterday Forever" has 22 tracks.
# Album "Get Back" has 20 tracks.
# Album "Golden Best 20, Volume 1" has 19 tracks.
# Album "In the Beginning" has 12 tracks.
# Album "Introducing the Beatles (Us Mono Ver. 2)" has 12 tracks.
# Album "Live at Star Club 1962, Volume 1" has 11 tracks.
# Album "Live in Adelaide & Houston, Texas" has 18 tracks.
# Album "Live in Japan 1964" has 22 tracks.
# Album "Live in Paris 1965 2" has 24 tracks.
# Album "Live in Paris, 1965" has 23 tracks.
# Album "Mythology 2 (disc 1)" has 21 tracks.
| 43.344371 | 77 | 0.686937 | 1,007 | 6,545 | 4.461768 | 0.304866 | 0.244825 | 0.043401 | 0.076786 | 0.30069 | 0.204986 | 0.140886 | 0.049855 | 0.049855 | 0.049855 | 0 | 0.057554 | 0.192972 | 6,545 | 150 | 78 | 43.633333 | 0.793071 | 0.897479 | 0 | 0 | 0 | 0 | 0.226937 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.0625 | null | null | 0.0625 | 0 | 0 | 0 | null | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
fd8cfb33c012f46d40d45da73acbed8d2676f8e6 | 399 | py | Python | Diena_9_sets_tuples/d9_17_u3.py | MarisKuz/Python-RTU | 12261d06dc81fa0d98190ca0eb5133d43d517070 | [
"MIT"
] | 8 | 2020-08-31T16:10:54.000Z | 2021-11-24T06:37:37.000Z | Diena_9_sets_tuples/d9_17_u3.py | MarisKuz/Python-RTU | 12261d06dc81fa0d98190ca0eb5133d43d517070 | [
"MIT"
] | 8 | 2021-06-08T22:30:29.000Z | 2022-03-12T00:48:55.000Z | Diena_9_sets_tuples/d9_17_u3.py | MarisKuz/Python-RTU | 12261d06dc81fa0d98190ca0eb5133d43d517070 | [
"MIT"
] | 12 | 2020-09-28T17:06:52.000Z | 2022-02-17T12:12:46.000Z | # Atstarpes ignorējam,un uzskatam ka lielais burts ir tikpat derīgs kā mazais, t.i. šeit A un a -> a
def is_pangram(mytext, a="abcdefghijklmnopqrstuvwxyz"):
return set(a) <= set(mytext.lower())
# mytext, a = set(mytext.lower()), set(a)
# return mytext >= a # or a <= mytext
print(is_pangram("The quick brown fox jumps over the lazy dog Ķēpa"))
print(is_pangram("nav pangramma")) | 39.9 | 100 | 0.684211 | 62 | 399 | 4.354839 | 0.596774 | 0.1 | 0.074074 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185464 | 399 | 10 | 101 | 39.9 | 0.830769 | 0.433584 | 0 | 0 | 0 | 0 | 0.391892 | 0.117117 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.25 | 0.5 | 0.5 | 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 | 1 | 0 | 3 |
fd9504c337369332adc3680dd5055af225d68881 | 188 | py | Python | setup.py | recursive-automata/graphspectra | 6467377016b217a104feaefcbb8c2cfa9cb865c6 | [
"MIT"
] | null | null | null | setup.py | recursive-automata/graphspectra | 6467377016b217a104feaefcbb8c2cfa9cb865c6 | [
"MIT"
] | 5 | 2020-03-24T16:14:04.000Z | 2021-06-01T22:49:22.000Z | setup.py | recursive-automata/graphspectra | 6467377016b217a104feaefcbb8c2cfa9cb865c6 | [
"MIT"
] | 1 | 2021-01-16T21:45:53.000Z | 2021-01-16T21:45:53.000Z | from distutils.core import setup
setup(
name='Graph Spectra',
version='0.0.0',
packages=['graphspectra',],
license='MIT',
long_description=open('README.md').read(),
)
| 18.8 | 46 | 0.643617 | 23 | 188 | 5.217391 | 0.869565 | 0.033333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019355 | 0.175532 | 188 | 9 | 47 | 20.888889 | 0.754839 | 0 | 0 | 0 | 0 | 0 | 0.223404 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.125 | 0 | 0.125 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
fd9ac2b41cab163d016c425520645de77b3d1b96 | 396 | py | Python | src/functions.py | rafaelcmm/py-deploy-server | 2af45f5b71636e1ca19dcf72cc724906693fd051 | [
"MIT"
] | 1 | 2021-03-03T16:15:55.000Z | 2021-03-03T16:15:55.000Z | src/functions.py | rafaelcmm/py-deploy-server | 2af45f5b71636e1ca19dcf72cc724906693fd051 | [
"MIT"
] | null | null | null | src/functions.py | rafaelcmm/py-deploy-server | 2af45f5b71636e1ca19dcf72cc724906693fd051 | [
"MIT"
] | null | null | null | import time
import datetime
import BaseHTTPServer, SimpleHTTPServer
def start_server( i, port ):
httpd = BaseHTTPServer.HTTPServer(('localhost', int(port)), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.serve_forever()
def get_time_diff_to_now( start_time ):
exec_time_in_seconds = time.time() - start_time
return time.strftime('%H:%M:%S', time.gmtime(exec_time_in_seconds)) | 33 | 106 | 0.770202 | 51 | 396 | 5.705882 | 0.588235 | 0.061856 | 0.068729 | 0.116838 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 396 | 12 | 107 | 33 | 0.836207 | 0 | 0 | 0 | 0 | 0 | 0.042821 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | 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 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
fdb48a8fa17a5c9734182e2be38518777d5e09f3 | 178 | py | Python | Course I/Алгоритмы Python/Part1/лекции/jupyter/lec06_modules/Graphics/Bmp.py | GeorgiyDemo/FA | 641a29d088904302f5f2164c9b3e1f1c813849ec | [
"WTFPL"
] | 27 | 2019-08-18T20:54:27.000Z | 2022-02-22T02:39:45.000Z | Course I/Алгоритмы Python/Part1/лекции/jupyter/lec06_modules/Graphics/Bmp.py | GeorgiyDemo/FA | 641a29d088904302f5f2164c9b3e1f1c813849ec | [
"WTFPL"
] | 217 | 2019-09-22T14:43:25.000Z | 2022-03-30T13:49:18.000Z | Course I/Алгоритмы Python/Part1/лекции/jupyter/lec06_modules/Graphics/Bmp.py | GeorgiyDemo/FA | 641a29d088904302f5f2164c9b3e1f1c813849ec | [
"WTFPL"
] | 42 | 2019-09-18T11:36:28.000Z | 2022-03-19T18:43:00.000Z | def g_load(file):
print("file {} loaded as BMP v2".format(file))
return None
if __name__ == "__main__":
print("Test Bmp.py")
print(g_load("test.bmp"))
| 19.777778 | 51 | 0.589888 | 26 | 178 | 3.653846 | 0.653846 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007463 | 0.247191 | 178 | 8 | 52 | 22.25 | 0.701493 | 0 | 0 | 0 | 0 | 0 | 0.305882 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
fddc51164f218680c487cfbaa04bffaa07ac864f | 339 | py | Python | Python/simple_Calculator.py | baroood/Hacktoberfest-2k17 | 87383df4bf705358866a5a4120dd678a3f2acd3e | [
"MIT"
] | 28 | 2017-10-04T19:42:26.000Z | 2021-03-26T04:00:48.000Z | Python/simple_Calculator.py | baroood/Hacktoberfest-2k17 | 87383df4bf705358866a5a4120dd678a3f2acd3e | [
"MIT"
] | 375 | 2017-09-28T02:58:37.000Z | 2019-10-31T09:10:38.000Z | Python/simple_Calculator.py | baroood/Hacktoberfest-2k17 | 87383df4bf705358866a5a4120dd678a3f2acd3e | [
"MIT"
] | 519 | 2017-09-28T02:40:29.000Z | 2021-02-15T08:29:17.000Z | print("enter the two number")
n1,n2=map(int,input().split())
print("press + for add")
print("press - for subb")
print("press * for mul")
print("press / for div")
e=input()
if e == "+":
print(n1+n2)
elif e == "-":
print(n1-n2)
elif e == "*":
print(n1*n2)
elif e == "/":
print(n1/n2)
else:
print("you entered wrong key")
| 18.833333 | 34 | 0.572271 | 55 | 339 | 3.527273 | 0.454545 | 0.103093 | 0.268041 | 0.206186 | 0.268041 | 0.268041 | 0.268041 | 0.268041 | 0.268041 | 0.268041 | 0 | 0.036765 | 0.19764 | 339 | 17 | 35 | 19.941176 | 0.676471 | 0 | 0 | 0 | 0 | 0 | 0.312684 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.588235 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
fde726d33154e3e42801b334dfebcbb56b6ea720 | 3,017 | py | Python | tick/hawkes/simulation/tests/hawkes_kernel_exp_test.py | sumau/tick | 1b56924a35463e12f7775bc0aec182364f26f2c6 | [
"BSD-3-Clause"
] | 411 | 2017-03-30T15:22:05.000Z | 2022-03-27T01:58:34.000Z | tick/hawkes/simulation/tests/hawkes_kernel_exp_test.py | saurabhdash/tick | bbc561804eb1fdcb4c71b9e3e2d83a66e7b13a48 | [
"BSD-3-Clause"
] | 345 | 2017-04-13T14:53:20.000Z | 2022-03-26T00:46:22.000Z | tick/hawkes/simulation/tests/hawkes_kernel_exp_test.py | saurabhdash/tick | bbc561804eb1fdcb4c71b9e3e2d83a66e7b13a48 | [
"BSD-3-Clause"
] | 102 | 2017-04-25T11:47:53.000Z | 2022-02-15T11:45:49.000Z | # License: BSD 3 clause
import unittest
from tick.hawkes import HawkesKernelExp
class Test(unittest.TestCase):
def setUp(self):
self.decay = 2
self.intensity = 3
self.hawkes_kernel_exp = HawkesKernelExp(self.intensity, self.decay)
def test_HawkesKernelExp_decay(self):
"""...Test HawkesKernelExp decay
"""
self.assertEqual(self.hawkes_kernel_exp.decay, self.decay)
def test_HawkesKernelExp_intensity(self):
"""...Test HawkesKernelExp intensity
"""
self.assertEqual(self.hawkes_kernel_exp.intensity, self.intensity)
def test_HawkesKernelExp_str(self):
"""...Test HawkesKernelExp string representation
"""
intensity = 3
decay = 2
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(str(hawkes_kernel_exp), "3 * 2 * exp(- 2 * t)")
intensity = 3
decay = 0
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(str(hawkes_kernel_exp), "3")
intensity = 0
decay = 2
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(str(hawkes_kernel_exp), "0")
def test_HawkesKernelExp_repr(self):
"""...Test HawkesKernelExp string in list representation
"""
intensity = 3
decay = 2
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(str([hawkes_kernel_exp]), "[3*2*exp(-2*t)]")
intensity = 3
decay = 0
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(str([hawkes_kernel_exp]), "[3]")
intensity = 0
decay = 2
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(str([hawkes_kernel_exp]), "[0]")
def test_HawkesKernelExp_strtex(self):
"""...Test HawkesKernelExp latex string representation
"""
decay = 2
intensity = 3
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(hawkes_kernel_exp.__strtex__(), "$6 e^{-2 t}$")
intensity = 3
decay = 0
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(hawkes_kernel_exp.__strtex__(), "$3$")
intensity = 0
decay = 2
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(hawkes_kernel_exp.__strtex__(), "$0$")
intensity = 0.5
decay = 2
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(hawkes_kernel_exp.__strtex__(), "$e^{-2 t}$")
decay = 1
intensity = 3
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(hawkes_kernel_exp.__strtex__(), "$3 e^{- t}$")
decay = 1
intensity = 1
hawkes_kernel_exp = HawkesKernelExp(intensity, decay)
self.assertEqual(hawkes_kernel_exp.__strtex__(), "$e^{-t}$")
if __name__ == "__main__":
unittest.main()
| 31.427083 | 76 | 0.632748 | 323 | 3,017 | 5.613003 | 0.120743 | 0.178709 | 0.223387 | 0.215113 | 0.729178 | 0.694981 | 0.657474 | 0.657474 | 0.657474 | 0.657474 | 0 | 0.019652 | 0.257872 | 3,017 | 95 | 77 | 31.757895 | 0.790085 | 0.093802 | 0 | 0.53125 | 0 | 0 | 0.036189 | 0 | 0 | 0 | 0 | 0 | 0.21875 | 1 | 0.09375 | false | 0 | 0.03125 | 0 | 0.140625 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 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 | 3 |
fdf51004c975cf1630ab8e9ee19c6df93e74fe1a | 1,164 | py | Python | tests/test_event_district_name_parser.py | tervay/the-blue-alliance | e14c15cb04b455f90a2fcfdf4c1cdbf8454e17f8 | [
"MIT"
] | 266 | 2015-01-04T00:10:48.000Z | 2022-03-28T18:42:05.000Z | tests/test_event_district_name_parser.py | gregmarra/the-blue-alliance | 5bedaf5c80b4623984760d3da3289640639112f9 | [
"MIT"
] | 2,673 | 2015-01-01T20:14:33.000Z | 2022-03-31T18:17:16.000Z | tests/test_event_district_name_parser.py | gregmarra/the-blue-alliance | 5bedaf5c80b4623984760d3da3289640639112f9 | [
"MIT"
] | 230 | 2015-01-04T00:10:48.000Z | 2022-03-26T18:12:04.000Z | import unittest2
from consts.district_type import DistrictType
from helpers.event_helper import EventHelper
class TestEventDistrictNameParser(unittest2.TestCase):
def test_event_parse_district_name(self):
"""
A bunch of tests from various years
"""
self.assertEqual(EventHelper.parseDistrictName('FIRST in Michigan'), DistrictType.MICHIGAN)
self.assertEqual(EventHelper.parseDistrictName('Mid-Atlantic Robotics'), DistrictType.MID_ATLANTIC)
self.assertEqual(EventHelper.parseDistrictName('New England'), DistrictType.NEW_ENGLAND)
self.assertEqual(EventHelper.parseDistrictName('Pacific Northwest'), DistrictType.PACIFIC_NORTHWEST)
self.assertEqual(EventHelper.parseDistrictName('IndianaFIRST'), DistrictType.INDIANA)
self.assertEqual(EventHelper.parseDistrictName('Not a valid district'), DistrictType.NO_DISTRICT)
self.assertEqual(EventHelper.parseDistrictName('California'), DistrictType.NO_DISTRICT)
self.assertEqual(EventHelper.parseDistrictName(None), DistrictType.NO_DISTRICT)
self.assertEqual(EventHelper.parseDistrictName(''), DistrictType.NO_DISTRICT)
| 55.428571 | 108 | 0.780069 | 110 | 1,164 | 8.136364 | 0.4 | 0.150838 | 0.261453 | 0.432402 | 0.217877 | 0.217877 | 0.217877 | 0 | 0 | 0 | 0 | 0.001976 | 0.130584 | 1,164 | 20 | 109 | 58.2 | 0.882411 | 0.030069 | 0 | 0 | 0 | 0 | 0.097738 | 0 | 0 | 0 | 0 | 0 | 0.642857 | 1 | 0.071429 | false | 0 | 0.214286 | 0 | 0.357143 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
fdf524b6ebf6b8b5952fbae8a624716d0962d3b3 | 139 | py | Python | collections/namedtuple.py | Brunokrk/Learning-Python | 36a3b1c4782dbb21af189760a451fd2e9c083bb6 | [
"MIT"
] | null | null | null | collections/namedtuple.py | Brunokrk/Learning-Python | 36a3b1c4782dbb21af189760a451fd2e9c083bb6 | [
"MIT"
] | null | null | null | collections/namedtuple.py | Brunokrk/Learning-Python | 36a3b1c4782dbb21af189760a451fd2e9c083bb6 | [
"MIT"
] | null | null | null | from collections import namedtuple
from typing import Dict, List
Point = namedtuple('Point', 'x, y')
pt = Point(1, -4)
print(List[Point]) | 19.857143 | 35 | 0.719424 | 21 | 139 | 4.761905 | 0.666667 | 0.18 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016807 | 0.143885 | 139 | 7 | 36 | 19.857143 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0.064286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8bf1bbb5c5fb857624ed28b896f0af4e33744581 | 1,234 | py | Python | miepy/particles/sphere.py | johnaparker/MiePy | 5c5bb5a07c8ab79e9e2a9fc79fb9779e690147be | [
"MIT"
] | 3 | 2016-05-30T06:45:29.000Z | 2017-08-30T19:58:56.000Z | miepy/particles/sphere.py | johnaparker/MiePy | 5c5bb5a07c8ab79e9e2a9fc79fb9779e690147be | [
"MIT"
] | null | null | null | miepy/particles/sphere.py | johnaparker/MiePy | 5c5bb5a07c8ab79e9e2a9fc79fb9779e690147be | [
"MIT"
] | 5 | 2016-12-13T02:05:31.000Z | 2018-03-23T07:11:30.000Z | import miepy
from .particle_base import particle
class sphere(particle):
def __init__(self, position, radius, material):
"""A sphere object
Arguments:
position[3] x,y,z position of particle
radius sphere radius
material particle material (miepy.material object)
"""
super().__init__(position, None, material)
self.radius = radius
def __repr__(self):
return f'''{self.__class__.__name__}:
position = {self.position} m
radius = {self.radius:.2e} m
material = {self.material}'''
def is_inside(self, pos):
pass
def compute_tmatrix(self, lmax, wavelength, eps_m, **kwargs):
self.tmatrix = miepy.tmatrix.tmatrix_sphere(self.radius, wavelength,
self.material.eps(wavelength), eps_m, lmax, conducting=self.conducting)
self.tmatrix_fixed = self.tmatrix
return self.tmatrix
def enclosed_radius(self):
return self.radius
def _rotate_fixed_tmatrix(self):
self.tmatrix = self.tmatrix_fixed
def _dict_key(self, wavelength):
return (sphere, self.radius, self.material.eps(wavelength).item(), self.material.mu(wavelength).item())
| 30.85 | 111 | 0.641815 | 143 | 1,234 | 5.300699 | 0.328671 | 0.087071 | 0.036939 | 0.065963 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002169 | 0.252836 | 1,234 | 39 | 112 | 31.641026 | 0.819957 | 0.132901 | 0 | 0 | 0 | 0 | 0.120235 | 0.025415 | 0 | 0 | 0 | 0 | 0 | 1 | 0.291667 | false | 0.041667 | 0.083333 | 0.125 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e3134793f0df6cd881cbd1cd94c1e38c3f462fb7 | 201 | py | Python | hoist/__init__.py | 2231puppy/Hoist | a751e125102e4de20daf975866ac8479bf341e95 | [
"MIT"
] | null | null | null | hoist/__init__.py | 2231puppy/Hoist | a751e125102e4de20daf975866ac8479bf341e95 | [
"MIT"
] | null | null | null | hoist/__init__.py | 2231puppy/Hoist | a751e125102e4de20daf975866ac8479bf341e95 | [
"MIT"
] | null | null | null | from .client import Client
from .flask_wrapper import FlaskWrapper
from .external_server import ExternalServer
from .server import HoistServer
from .get_ip import get_ip
from .get_host import get_host
| 28.714286 | 43 | 0.850746 | 30 | 201 | 5.5 | 0.433333 | 0.145455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119403 | 201 | 6 | 44 | 33.5 | 0.932203 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e318871f9110f26342eed67604ef6fd349c14c89 | 64 | py | Python | modules/persons/application/update/__init__.py | eduardolujan/hexagonal_architecture_django | 8055927cb460bc40f3a2651c01a9d1da696177e8 | [
"BSD-3-Clause"
] | 6 | 2020-08-09T23:41:08.000Z | 2021-03-16T22:05:40.000Z | modules/persons/application/update/__init__.py | eduardolujan/hexagonal_architecture_django | 8055927cb460bc40f3a2651c01a9d1da696177e8 | [
"BSD-3-Clause"
] | 1 | 2020-10-02T02:59:38.000Z | 2020-10-02T02:59:38.000Z | modules/persons/application/update/__init__.py | eduardolujan/hexagonal_architecture_django | 8055927cb460bc40f3a2651c01a9d1da696177e8 | [
"BSD-3-Clause"
] | 2 | 2021-03-16T22:05:43.000Z | 2021-04-30T06:35:25.000Z | from .update_user import UpdateUser
__all__ = ('UpdateUser', )
| 16 | 35 | 0.75 | 7 | 64 | 6.142857 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140625 | 64 | 3 | 36 | 21.333333 | 0.781818 | 0 | 0 | 0 | 0 | 0 | 0.15625 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e3238200ba2c5d3c90d39a5455e78fc937cca226 | 189 | py | Python | src/chapter2/exercise3.py | ManuelA1000/BCS-2021 | 0bdf8a165b6e9e79c33257919a44b4be3cd49a57 | [
"MIT"
] | null | null | null | src/chapter2/exercise3.py | ManuelA1000/BCS-2021 | 0bdf8a165b6e9e79c33257919a44b4be3cd49a57 | [
"MIT"
] | null | null | null | src/chapter2/exercise3.py | ManuelA1000/BCS-2021 | 0bdf8a165b6e9e79c33257919a44b4be3cd49a57 | [
"MIT"
] | null | null | null | # Program to calculate the gross pay of a worker
hours_worked = input("Enter the hours worked:\n")
rate = input("Enter the payment rate:\n ")
pay = int(hours_worked)*float(rate)
print(pay)
| 31.5 | 49 | 0.73545 | 32 | 189 | 4.28125 | 0.59375 | 0.240876 | 0.189781 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 189 | 5 | 50 | 37.8 | 0.845679 | 0.243386 | 0 | 0 | 0 | 0 | 0.361702 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e3267546da7344a2bfce0eefac9818dabbcbe263 | 984 | py | Python | blog/models.py | pnwinkler/Django-blog | a5f459aa3a654a910aa301da12c4e69552f95ca8 | [
"MIT"
] | null | null | null | blog/models.py | pnwinkler/Django-blog | a5f459aa3a654a910aa301da12c4e69552f95ca8 | [
"MIT"
] | null | null | null | blog/models.py | pnwinkler/Django-blog | a5f459aa3a654a910aa301da12c4e69552f95ca8 | [
"MIT"
] | null | null | null | from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from django.urls import reverse
# each class will be its own table in db
class Post(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
# we don't use auto_add options because they don't allow manual updating
date_posted = models.DateTimeField(default=timezone.now)
# one-to-many relationship. And, if a user is deleted, delete post too
author = models.ForeignKey(User, on_delete=models.CASCADE)
# this means that querysets return something like this
# <QuerySet [<Post: First post on live site>, <Post: Blog 3 Updated>, ...]>
# instead of this: <QuerySet [<Post:>,<Post:>,<Post:>....]
def __str__(self):
return self.title
# need this so we have a URL to send users to after they post an entry
def get_absolute_url(self):
return reverse('post-detail', kwargs={'pk': self.pk})
| 39.36 | 79 | 0.707317 | 147 | 984 | 4.666667 | 0.639456 | 0.058309 | 0.046647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005025 | 0.191057 | 984 | 24 | 80 | 41 | 0.856784 | 0.438008 | 0 | 0 | 0 | 0 | 0.023853 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.307692 | 0.153846 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
e33ecd179bc16f7d47ae290d0833aa2f9018b0ae | 2,841 | py | Python | backend.py | AbRamazani/mahab-linux | 2deada37d9885ded2eef3eb665d21eb3a38e3cf3 | [
"MIT"
] | 3 | 2022-03-01T13:29:11.000Z | 2022-03-01T19:15:22.000Z | backend.py | esmaeelE/mahab-linux | 2deada37d9885ded2eef3eb665d21eb3a38e3cf3 | [
"MIT"
] | null | null | null | backend.py | esmaeelE/mahab-linux | 2deada37d9885ded2eef3eb665d21eb3a38e3cf3 | [
"MIT"
] | 1 | 2022-03-06T14:22:53.000Z | 2022-03-06T14:22:53.000Z | import sqlite3
path = "Completed/mahab.db"
def connect_user():
conn = sqlite3.connect(path)
cor = conn.cursor()
cor.execute(
'CREATE TABLE IF NOT EXISTS table_user (first_name text,last_name text,user_name text,password text,image text DEFAULT icon, login text, count_see text )'
)
conn.commit()
conn.close()
def connect_seeting():
conn = sqlite3.connect(path)
cor = conn.cursor()
cor.execute(
'CREATE TABLE IF NOT EXISTS setting (max_amount INTEGER , min_amount Integer , font text, font_size INTEGER ,start_with_win text, bg text, fg text)'
)
conn.commit()
conn.close()
def insert_user(first_name, last_name, user_name, password, image, login, count_see):
conn = sqlite3.connect(path)
cur = conn.cursor()
cur.execute(
"INSERT INTO table_user VALUES (?, ?, ?, ?, ?, ?, ?)", (first_name, last_name,user_name, password, image, login, count_see)
)
conn.commit()
conn.close()
def insert_setting(max_amount, min_amount, font, font_size, start_with_win, bg, fg):
conn = sqlite3.connect(path)
cur = conn.cursor()
cur.execute(
"INSERT INTO setting VALUES (?, ?, ?, ?, ?, ?, ?)", (max_amount, min_amount, font, font_size, start_with_win, bg, fg)
)
conn.commit()
conn.close()
def view_user():
conn = sqlite3.connect(path)
cur = conn.cursor()
cur.execute(
"SELECT * FROM table_user"
)
info = cur.fetchall()
conn.commit()
conn.close()
return info
def view_setting():
conn = sqlite3.connect(path)
cur = conn.cursor()
cur.execute(
"SELECT * FROM setting"
)
setting = cur.fetchall()
conn.commit()
conn.close()
return setting
def update_user(first_name, last_name,user_name, password, image, login, count_see):
conn = sqlite3.connect(path)
cur = conn.cursor()
cur.execute(
"UPDATE table_user SET first_name=?, last_name=?,user_name=?,password=?, image=?, login=?, count_see=?", (first_name, last_name,user_name,password, image, login, count_see)
)
conn.commit()
conn.close()
def update_setting(max_amount, min_amount, font, font_size, start_with_win, bg, fg):
conn = sqlite3.connect(path)
cur = conn.cursor()
cur.execute(
"UPDATE setting SET max_amount=?, min_amount=?, font=?, font_size=?, start_with_win=?, bg=?, fg=?", (max_amount, min_amount, font, font_size, start_with_win, bg, fg)
)
conn.commit()
conn.close()
def delete():
conn = sqlite3.connect(path)
cur = conn.cursor()
cur.execute(
"DELETE FROM table_user"
)
cur.execute(
"DELETE FROM setting"
)
conn.commit()
conn.close()
connect_user()
connect_seeting()
| 27.852941 | 181 | 0.620908 | 362 | 2,841 | 4.68232 | 0.157459 | 0.058407 | 0.095575 | 0.116814 | 0.731563 | 0.726844 | 0.689086 | 0.646608 | 0.646608 | 0.620059 | 0 | 0.00469 | 0.24956 | 2,841 | 101 | 182 | 28.128713 | 0.790338 | 0 | 0 | 0.554217 | 0 | 0.024096 | 0.254745 | 0.012774 | 0 | 0 | 0 | 0 | 0 | 1 | 0.108434 | false | 0.060241 | 0.012048 | 0 | 0.144578 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
8b4ed5ca04d8c948e8db2639a38f34549a15e7f9 | 121 | py | Python | titanfp/arithmetic/__init__.py | billzorn/fpunreal | 5ba896298f2acc53652112ea4426508483d85a04 | [
"MIT"
] | 4 | 2019-02-21T06:15:26.000Z | 2020-09-08T21:06:41.000Z | titanfp/arithmetic/__init__.py | billzorn/fpunreal | 5ba896298f2acc53652112ea4426508483d85a04 | [
"MIT"
] | 3 | 2019-02-22T02:21:09.000Z | 2021-08-31T20:25:23.000Z | titanfp/arithmetic/__init__.py | billzorn/fpunreal | 5ba896298f2acc53652112ea4426508483d85a04 | [
"MIT"
] | null | null | null | import os
mypath = os.path.abspath(os.path.dirname(__file__))
#print('hi from module arithmetic @ {:s}'.format(mypath))
| 24.2 | 57 | 0.727273 | 18 | 121 | 4.666667 | 0.777778 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099174 | 121 | 4 | 58 | 30.25 | 0.770642 | 0.46281 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8b51ae08e8f30713fc992cf4fb1f6236975331fc | 504 | py | Python | S4/S4 Library/simulation/sims/party.py | NeonOcean/Environment | ca658cf66e8fd6866c22a4a0136d415705b36d26 | [
"CC-BY-4.0"
] | 1 | 2021-05-20T19:33:37.000Z | 2021-05-20T19:33:37.000Z | S4/S4 Library/simulation/sims/party.py | NeonOcean/Environment | ca658cf66e8fd6866c22a4a0136d415705b36d26 | [
"CC-BY-4.0"
] | null | null | null | S4/S4 Library/simulation/sims/party.py | NeonOcean/Environment | ca658cf66e8fd6866c22a4a0136d415705b36d26 | [
"CC-BY-4.0"
] | null | null | null | from interactions import ParticipantType
from sims4.tuning.tunable import TunableList
from statistics.statistic_ops import TunableStatisticChange
class Party:
RALLY_FALSE_ADS = TunableList(description=' \n A list of false advertisement for rallyable interactions. Use this\n tunable to entice Sims to autonomously choose rallyable over non-\n rallyable interactions.\n ', tunable=TunableStatisticChange(locked_args={'subject': ParticipantType.Actor, 'advertise': True}))
| 72 | 343 | 0.781746 | 58 | 504 | 6.724138 | 0.689655 | 0.107692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002347 | 0.154762 | 504 | 6 | 344 | 84 | 0.913146 | 0 | 0 | 0 | 0 | 0.2 | 0.418651 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
8b678c634de5fa481035f4883d8f263fde9703a9 | 3,295 | py | Python | src/backend/config.py | logyball/raspberry-pi-vacation-planner | dc53ce34b8df696b97d43d8b2137a38c05f2b53d | [
"MIT"
] | 1 | 2020-01-16T04:23:07.000Z | 2020-01-16T04:23:07.000Z | src/backend/config.py | loganballard/raspberry-pi-vacation-planner | dc53ce34b8df696b97d43d8b2137a38c05f2b53d | [
"MIT"
] | 1 | 2021-06-02T00:48:46.000Z | 2021-06-02T00:48:46.000Z | src/backend/config.py | logyball/raspberry-pi-vacation-planner | dc53ce34b8df696b97d43d8b2137a38c05f2b53d | [
"MIT"
] | null | null | null | from yaml import load, FullLoader
from functools import lru_cache
from os import sep, getcwd
class ConfigFunctions(object):
conf_file_path: str = None
secrets_file_path: str = None
cwd: str = None
def __init__(self, test_environ: bool = False):
self.cwd = getcwd()
self.conf_file_path = self.cwd + sep + 'test' + sep + 'conf' + sep + 'tst_config.yaml' if test_environ else self.cwd + sep + 'config.yaml'
self.secrets_file_path = self.cwd + sep + 'test' + sep + 'conf' + sep + 'tst_secrets.yaml' if test_environ else self.cwd + sep + 'secrets.yaml'
pass
def get_maps_key(self):
return self._get_secrets().get("keys", {}).get("google_maps")
def get_amadeus_keys(self):
key = self._get_secrets().get("keys", {}).get("amadeus_key")
secret = self._get_secrets().get("keys", {}).get("amadeus_secret")
return key, secret
def get_weather_url(self):
return self._get_config().get('base_weather_url', '')
def get_origin_coordinates(self):
origin = self._get_secrets().get('origin', {})
return origin.get('latitude', ''), origin.get('longitude', '')
def get_resort_driving(self, resort_name: str):
resort = self._get_individual_resort(resort_name)
return bool(resort.get('driving', False))
def get_resort_airport_prefs(self, resort_name: str):
resort = self._get_individual_resort(resort_name)
return resort.get('airport'), bool(resort.get('nonstop', ''))
def get_resort_coordinates(self, resort_name: str):
""" returns (latitude, longitude) of the named resort"""
resort = self._get_individual_resort(resort_name)
return resort.get('latitude'), resort.get('longitude')
def get_airlines_pref(self):
prefs = self._get_secrets().get('preferences', {})
return prefs.get('airlines', '')
def get_origin_airport(self):
return self._get_secrets().get('origin', {}).get('airport', 'NYC')
def get_width(self):
return self._get_config().get('screen_size', {}).get('width', 480)
def get_height(self):
return self._get_config().get('screen_size', {}).get('height', 800)
def get_list_of_resorts(self):
return list(self._get_resorts().keys())
def get_db_path(self):
return self._get_config().get('db_path')
def get_stream_path(self, resort_name: str):
resort = self._get_individual_resort(resort_name)
return resort.get('stream')
def get_resort_proper_name(self, resort_name: str):
resort = self._get_individual_resort(resort_name)
return resort.get('name')
def _get_individual_resort(self, resort_name: str):
resorts = self._get_resorts()
return resorts.get(resort_name, {})
@lru_cache(maxsize=4)
def _get_resorts(self):
return self._get_config().get('resorts', {})
@lru_cache(maxsize=4)
def _get_config(self):
with open(self.conf_file_path) as c_file:
config_dict = load(c_file.read(), Loader=FullLoader)
return config_dict
@lru_cache(maxsize=4)
def _get_secrets(self):
with open(self.secrets_file_path) as c_file:
secrets = load(c_file.read(), Loader=FullLoader)
return secrets
| 35.815217 | 151 | 0.655235 | 438 | 3,295 | 4.627854 | 0.189498 | 0.056241 | 0.048347 | 0.058707 | 0.461273 | 0.432166 | 0.331031 | 0.26591 | 0.235323 | 0.196843 | 0 | 0.003456 | 0.209712 | 3,295 | 91 | 152 | 36.208791 | 0.774962 | 0.014871 | 0 | 0.119403 | 0 | 0 | 0.088635 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.298507 | false | 0.014925 | 0.044776 | 0.119403 | 0.686567 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8b889c0d438ab214a9420c8db96e36cac491bb7f | 3,883 | py | Python | tests/defxmlschema/test_chapter04.py | nimish/xsdata | 7afe2781b66982428cc1731f53c065086acd35c1 | [
"MIT"
] | null | null | null | tests/defxmlschema/test_chapter04.py | nimish/xsdata | 7afe2781b66982428cc1731f53c065086acd35c1 | [
"MIT"
] | null | null | null | tests/defxmlschema/test_chapter04.py | nimish/xsdata | 7afe2781b66982428cc1731f53c065086acd35c1 | [
"MIT"
] | null | null | null | import os
from pathlib import Path
from click.testing import CliRunner
from tests.conftest import load_class
from tests.conftest import validate_bindings
from xsdata import cli
os.chdir(Path(__file__).parent.parent.parent)
def test_integration():
schema = Path("tests/fixtures/defxmlschema/chapter04/chapter04.xsd")
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Order")
validate_bindings(schema, clazz)
def test_example04011():
schema = "tests/fixtures/defxmlschema/chapter04/example04011.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04012():
schema = "tests/fixtures/defxmlschema/chapter04/example04012.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04021():
schema = "tests/fixtures/defxmlschema/chapter04/example04021.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04022():
schema = "tests/fixtures/defxmlschema/chapter04/example04022.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04031():
schema = "tests/fixtures/defxmlschema/chapter04/example04031.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04032():
schema = "tests/fixtures/defxmlschema/chapter04/example04032.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04051():
schema = "tests/fixtures/defxmlschema/chapter04/example04051.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04052():
schema = "tests/fixtures/defxmlschema/chapter04/example04052.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04053():
schema = "tests/fixtures/defxmlschema/chapter04/example04053.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04061():
schema = "tests/fixtures/defxmlschema/chapter04/example04061.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
def test_example04062():
schema = "tests/fixtures/defxmlschema/chapter04/example04062.xsd"
package = "tests.fixtures.defxmlschema.chapter04"
runner = CliRunner()
result = runner.invoke(cli, [schema, "--package", package])
if result.exception:
raise result.exception
| 28.762963 | 72 | 0.710791 | 406 | 3,883 | 6.748768 | 0.12069 | 0.113869 | 0.218978 | 0.29781 | 0.786131 | 0.625547 | 0.625547 | 0.625547 | 0.625547 | 0.604745 | 0 | 0.049736 | 0.171517 | 3,883 | 134 | 73 | 28.977612 | 0.801989 | 0 | 0 | 0.634409 | 0 | 0 | 0.309554 | 0.280453 | 0 | 0 | 0 | 0 | 0 | 1 | 0.129032 | false | 0 | 0.064516 | 0 | 0.193548 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 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 | 3 |
8b97c59a0523b718057641a5d3977d67a48fb7a1 | 18,401 | py | Python | final_position_perturbation/generate_solver_soln.py | talsperre/task-perturbation-argmin | 32858fb1dc817da8e28f8d738b01d296efb67c3c | [
"MIT"
] | null | null | null | final_position_perturbation/generate_solver_soln.py | talsperre/task-perturbation-argmin | 32858fb1dc817da8e28f8d738b01d296efb67c3c | [
"MIT"
] | null | null | null | final_position_perturbation/generate_solver_soln.py | talsperre/task-perturbation-argmin | 32858fb1dc817da8e28f8d738b01d296efb67c3c | [
"MIT"
] | null | null | null | import os
import time
import json
import autograd
import argparse
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from copy import deepcopy
from scipy import optimize
from tqdm.notebook import tqdm
from transforms3d import euler
from autograd import grad, jacobian
from mpl_toolkits.mplot3d import Axes3D
from scipy.optimize import minimize, Bounds
from jax.config import config
config.update("jax_enable_x64", True)
import jax.numpy as jnp
import autograd.numpy as np
from jax import jit, jacfwd, jacrev, random, vmap
parser = argparse.ArgumentParser(description="Config parser")
parser.add_argument("--traj_num", help="Current trajectory number", type=int)
parser.add_argument("--dataset_path", help="Current trajectory number", type=str)
parser.add_argument("--results_path", help="Directory to save plots and trajectories", type=str)
args = parser.parse_args()
### Intializations
np.random.seed(42)
num = 50
rho_vel = 100
rho_acc = rho_vel * 10
rho_b = rho_vel * 10
rho_jerk = rho_vel * 100
weight_pos = 100.0
weight_orient = 10.0
roll_des = - 87.2 * np.pi / 180
pitch_des = - 41.0 * np.pi / 180
q_min = np.array([-165, -100, -165, -165, -165, -1.0, -165]) * np.pi / 180
q_max = np.array([ 165, 101, 165, 1.0, 165, 214, 165]) * np.pi / 180
q_min_traj = np.hstack((q_min[0] * np.ones(num), q_min[1] * np.ones(num), q_min[2] * np.ones(num), q_min[3] * np.ones(num), q_min[4] * np.ones(num), q_min[5] * np.ones(num), q_min[6] * np.ones(num)))
q_max_traj = np.hstack((q_max[0] * np.ones(num), q_max[1] * np.ones(num), q_max[2] * np.ones(num), q_max[3] * np.ones(num), q_max[4] * np.ones(num), q_max[5] * np.ones(num), q_max[6] * np.ones(num)))
A = np.identity(num)
A_vel = np.diff(A, axis=0)
A_acc = np.diff(A_vel, axis=0)
A_jerk = np.diff(A_acc, axis=0)
cur_pos = args.traj_num
data = np.load(args.dataset_path, allow_pickle=True)
data = data.item()[cur_pos]
#### Initial and final positions of the manipulator
q_init = data['q_init']
# Choose any one of these final positions
q_fin = data['q_fin'][0]
q_1_init, q_2_init, q_3_init, q_4_init, q_5_init, q_6_init, q_7_init = q_init
q_1_fin, q_2_fin, q_3_fin, q_4_fin, q_5_fin, q_6_fin, q_7_fin = q_fin
#### Transforms
def get_transforms(q_1, q_2, q_3, q_4, q_5, q_6, q_7):
x = -0.107 * (((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.cos(q_4) - np.sin(q_2) * np.sin(q_4) * np.cos(q_1)) * np.cos(q_5) + (np.sin(q_1) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1) * np.cos(q_2)) * np.sin(q_5)) * np.sin(q_6) - 0.088 * (((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.cos(q_4) - np.sin(q_2) * np.sin(q_4) * np.cos(q_1)) * np.cos(q_5) + (np.sin(q_1) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1) * np.cos(q_2)) * np.sin(q_5)) * np.cos(q_6) + 0.088 * ((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.sin(q_4) + np.sin(q_2) * np.cos(q_1) * np.cos(q_4)) * np.sin(q_6) - 0.107 * ((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.sin(q_4) + np.sin(q_2) * np.cos(q_1) * np.cos(q_4)) * np.cos(q_6) + 0.384 * (np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.sin(q_4) + 0.0825 * (np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.cos(q_4) - 0.0825 * np.sin(q_1) * np.sin(q_3) - 0.0825 * np.sin(q_2) * np.sin(q_4) * np.cos(q_1) + 0.384 * np.sin(q_2) * np.cos(q_1) * np.cos(q_4) + 0.316 * np.sin(q_2) * np.cos(q_1) + 0.0825 * np.cos(q_1) * np.cos(q_2) * np.cos(q_3)
y = 0.107 * (((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.cos(q_4) + np.sin(q_1) * np.sin(q_2) * np.sin(q_4)) * np.cos(q_5) - (np.sin(q_1) * np.sin(q_3) * np.cos(q_2) - np.cos(q_1) * np.cos(q_3)) * np.sin(q_5)) * np.sin(q_6) + 0.088 * (((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.cos(q_4) + np.sin(q_1) * np.sin(q_2) * np.sin(q_4)) * np.cos(q_5) - (np.sin(q_1) * np.sin(q_3) * np.cos(q_2) - np.cos(q_1) * np.cos(q_3)) * np.sin(q_5)) * np.cos(q_6) - 0.088 * ((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.sin(q_4) - np.sin(q_1) * np.sin(q_2) * np.cos(q_4)) * np.sin(q_6) + 0.107 * ((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.sin(q_4) - np.sin(q_1) * np.sin(q_2) * np.cos(q_4)) * np.cos(q_6) - 0.384 * (np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.sin(q_4) - 0.0825 * (np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.cos(q_4) - 0.0825 * np.sin(q_1) * np.sin(q_2) * np.sin(q_4) + 0.384 * np.sin(q_1) * np.sin(q_2) * np.cos(q_4) + 0.316 * np.sin(q_1) * np.sin(q_2) + 0.0825 * np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + 0.0825 * np.sin(q_3) * np.cos(q_1)
z = -0.107 * ((np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - np.sin(q_4) * np.cos(q_2)) * np.cos(q_5) - np.sin(q_2) * np.sin(q_3) * np.sin(q_5)) * np.sin(q_6) - 0.088 * ((np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - np.sin(q_4) * np.cos(q_2)) * np.cos(q_5) - np.sin(q_2) * np.sin(q_3) * np.sin(q_5)) * np.cos(q_6) + 0.088 * (np.sin(q_2) * np.sin(q_4) * np.cos(q_3) + np.cos(q_2) * np.cos(q_4)) * np.sin(q_6) - 0.107 * (np.sin(q_2) * np.sin(q_4) * np.cos(q_3) + np.cos(q_2) * np.cos(q_4)) * np.cos(q_6) + 0.384 * np.sin(q_2) * np.sin(q_4) * np.cos(q_3) + 0.0825 * np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - 0.0825 * np.sin(q_2) * np.cos(q_3) - 0.0825 * np.sin(q_4) * np.cos(q_2) + 0.384 * np.cos(q_2) * np.cos(q_4) + 0.316 * np.cos(q_2) + 0.33
tr = np.sin(q_2) * np.sin(q_3) * np.sin(q_5) * np.sin(q_6) + np.sin(q_2) * np.sin(q_4) * np.sin(q_5) * np.sin(q_1 + q_7) - np.sin(q_2) * np.sin(q_4) * np.cos(q_3) * np.cos(q_6) + np.sin(q_2) * np.sin(q_4) * np.cos(q_5) * np.cos(q_6) * np.cos(q_1 + q_7) - np.sin(q_2) * np.sin(q_6) * np.cos(q_3) * np.cos(q_4) * np.cos(q_5) + np.sin(q_2) * np.sin(q_6) * np.cos(q_4) * np.cos(q_1 + q_7) + np.sin(q_3) * np.sin(q_4) * np.sin(q_6) * np.sin(q_1 + q_7) - np.sin(q_3) * np.sin(q_5) * np.cos(q_2) * np.cos(q_6) * np.cos(q_1 + q_7) + np.sin(q_3) * np.sin(q_5) * np.cos(q_4) * np.cos(q_1 + q_7) + np.sin(q_3) * np.sin(q_1 + q_7) * np.cos(q_2) * np.cos(q_5) - np.sin(q_3) * np.sin(q_1 + q_7) * np.cos(q_4) * np.cos(q_5) * np.cos(q_6) - np.sin(q_4) * np.sin(q_6) * np.cos(q_2) * np.cos(q_3) * np.cos(q_1 + q_7) + np.sin(q_4) * np.sin(q_6) * np.cos(q_2) * np.cos(q_5) + np.sin(q_5) * np.sin(q_1 + q_7) * np.cos(q_2) * np.cos(q_3) * np.cos(q_4) - np.sin(q_5) * np.sin(q_1 + q_7) * np.cos(q_3) * np.cos(q_6) + np.cos(q_2) * np.cos(q_3) * np.cos(q_4) * np.cos(q_5) * np.cos(q_6) * np.cos(q_1 + q_7) - np.cos(q_2) * np.cos(q_4) * np.cos(q_6) - np.cos(q_3) * np.cos(q_5) * np.cos(q_1 + q_7)
ax1 = -0.5 * (((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.cos(q_4) + np.sin(q_1) * np.sin(q_2) * np.sin(q_4)) * np.cos(q_5) - (np.sin(q_1) * np.sin(q_3) * np.cos(q_2) - np.cos(q_1) * np.cos(q_3)) * np.sin(q_5)) * np.sin(q_6) + 0.5 * (((np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - np.sin(q_4) * np.cos(q_2)) * np.cos(q_5) - np.sin(q_2) * np.sin(q_3) * np.sin(q_5)) * np.cos(q_6) - (np.sin(q_2) * np.sin(q_4) * np.cos(q_3) + np.cos(q_2) * np.cos(q_4)) * np.sin(q_6)) * np.sin(q_7) - 0.5 * ((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.sin(q_4) - np.sin(q_1) * np.sin(q_2) * np.cos(q_4)) * np.cos(q_6) - 0.5 * ((np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - np.sin(q_4) * np.cos(q_2)) * np.sin(q_5) + np.sin(q_2) * np.sin(q_3) * np.cos(q_5)) * np.cos(q_7)
ax2 = -0.5 * (((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.cos(q_4) - np.sin(q_2) * np.sin(q_4) * np.cos(q_1)) * np.cos(q_5) + (np.sin(q_1) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1) * np.cos(q_2)) * np.sin(q_5)) * np.sin(q_6) + 0.5 * (((np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - np.sin(q_4) * np.cos(q_2)) * np.cos(q_5) - np.sin(q_2) * np.sin(q_3) * np.sin(q_5)) * np.cos(q_6) - (np.sin(q_2) * np.sin(q_4) * np.cos(q_3) + np.cos(q_2) * np.cos(q_4)) * np.sin(q_6)) * np.cos(q_7) - 0.5 * ((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.sin(q_4) + np.sin(q_2) * np.cos(q_1) * np.cos(q_4)) * np.cos(q_6) + 0.5 * ((np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - np.sin(q_4) * np.cos(q_2)) * np.sin(q_5) + np.sin(q_2) * np.sin(q_3) * np.cos(q_5)) * np.sin(q_7)
ax3 = -0.5 * np.sin(q_2) * np.sin(q_4) * np.sin(q_5) * np.cos(q_1 + q_7) + 0.5 * np.sin(q_2) * np.sin(q_4) * np.sin(q_1 + q_7) * np.cos(q_5) * np.cos(q_6) + 0.5 * np.sin(q_2) * np.sin(q_6) * np.sin(q_1 + q_7) * np.cos(q_4) - 0.5 * np.sin(q_3) * np.sin(q_4) * np.sin(q_6) * np.cos(q_1 + q_7) - 0.5 * np.sin(q_3) * np.sin(q_5) * np.sin(q_1 + q_7) * np.cos(q_2) * np.cos(q_6) + 0.5 * np.sin(q_3) * np.sin(q_5) * np.sin(q_1 + q_7) * np.cos(q_4) - 0.5 * np.sin(q_3) * np.cos(q_2) * np.cos(q_5) * np.cos(q_1 + q_7) + 0.5 * np.sin(q_3) * np.cos(q_4) * np.cos(q_5) * np.cos(q_6) * np.cos(q_1 + q_7) - 0.5 * np.sin(q_4) * np.sin(q_6) * np.sin(q_1 + q_7) * np.cos(q_2) * np.cos(q_3) - 0.5 * np.sin(q_5) * np.cos(q_2) * np.cos(q_3) * np.cos(q_4) * np.cos(q_1 + q_7) + 0.5 * np.sin(q_5) * np.cos(q_3) * np.cos(q_6) * np.cos(q_1 + q_7) + 0.5 * np.sin(q_1 + q_7) * np.cos(q_2) * np.cos(q_3) * np.cos(q_4) * np.cos(q_5) * np.cos(q_6) - 0.5 * np.sin(q_1 + q_7) * np.cos(q_3) * np.cos(q_5)
return x, y, z, tr, ax1, ax2, ax3
def fk_franka(q):
q_1 = q[0]
q_2 = q[1]
q_3 = q[2]
q_4 = q[3]
q_5 = q[4]
q_6 = q[5]
q_7 = q[6]
x, y, z, tr, ax1, ax2, ax3 = get_transforms(q_1, q_2, q_3, q_4, q_5, q_6, q_7)
return x, y, z, tr, ax1, ax2, ax3
def fk_franka_traj(q):
q_1 = q[0:num]
q_2 = q[num:2*num]
q_3 = q[2*num:3*num]
q_4 = q[3*num:4*num]
q_5 = q[4*num:5*num]
q_6 = q[5*num:6*num]
q_7 = q[6*num:7*num]
x, y, z, tr, ax1, ax2, ax3 = get_transforms(q_1, q_2, q_3, q_4, q_5, q_6, q_7)
return x, y, z, tr, ax1, ax2, ax3
x_guess = data['traj'][0]['jointangles'].T.reshape(-1)
x_init, y_init, z_init, tr_init, ax1_init, ax2_init, ax3_init = fk_franka(np.hstack((q_1_init, q_2_init, q_3_init, q_4_init, q_5_init, q_6_init, q_7_init)))
x_fin, y_fin, z_fin, tr_fin, ax1_fin, ax2_fin, ax3_fin = fk_franka(np.hstack((q_1_fin, q_2_fin, q_3_fin, q_4_fin, q_5_fin, q_6_fin, q_7_fin)))
#### Cost Function
def cost_fun(q, params):
x_fin, y_fin, z_fin = params
q_1 = q[0:num]
q_2 = q[num:2*num]
q_3 = q[2*num:3*num]
q_4 = q[3*num:4*num]
q_5 = q[4*num:5*num]
q_6 = q[5*num:6*num]
q_7 = q[6*num:7*num]
cq1 = np.cos(q_1)
cq2 = np.cos(q_2)
cq3 = np.cos(q_3)
cq4 = np.cos(q_4)
cq5 = np.cos(q_5)
cq6 = np.cos(q_6)
cq7 = np.cos(q_7)
sq1 = np.sin(q_1)
sq2 = np.sin(q_2)
sq3 = np.sin(q_3)
sq4 = np.sin(q_4)
sq5 = np.sin(q_5)
sq6 = np.sin(q_6)
sq7 = np.sin(q_7)
x = -0.107 * (((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.cos(q_4) - np.sin(q_2) * np.sin(q_4) * np.cos(q_1)) * np.cos(q_5) + (np.sin(q_1) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1) * np.cos(q_2)) * np.sin(q_5)) * np.sin(q_6) - 0.088 * (((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.cos(q_4) - np.sin(q_2) * np.sin(q_4) * np.cos(q_1)) * np.cos(q_5) + (np.sin(q_1) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1) * np.cos(q_2)) * np.sin(q_5)) * np.cos(q_6) + 0.088 * ((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.sin(q_4) + np.sin(q_2) * np.cos(q_1) * np.cos(q_4)) * np.sin(q_6) - 0.107 * ((np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.sin(q_4) + np.sin(q_2) * np.cos(q_1) * np.cos(q_4)) * np.cos(q_6) + 0.384 * (np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.sin(q_4) + 0.0825 * (np.sin(q_1) * np.sin(q_3) - np.cos(q_1) * np.cos(q_2) * np.cos(q_3)) * np.cos(q_4) - 0.0825 * np.sin(q_1) * np.sin(q_3) - 0.0825 * np.sin(q_2) * np.sin(q_4) * np.cos(q_1) + 0.384 * np.sin(q_2) * np.cos(q_1) * np.cos(q_4) + 0.316 * np.sin(q_2) * np.cos(q_1) + 0.0825 * np.cos(q_1) * np.cos(q_2) * np.cos(q_3)
y = 0.107 * (((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.cos(q_4) + np.sin(q_1) * np.sin(q_2) * np.sin(q_4)) * np.cos(q_5) - (np.sin(q_1) * np.sin(q_3) * np.cos(q_2) - np.cos(q_1) * np.cos(q_3)) * np.sin(q_5)) * np.sin(q_6) + 0.088 * (((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.cos(q_4) + np.sin(q_1) * np.sin(q_2) * np.sin(q_4)) * np.cos(q_5) - (np.sin(q_1) * np.sin(q_3) * np.cos(q_2) - np.cos(q_1) * np.cos(q_3)) * np.sin(q_5)) * np.cos(q_6) - 0.088 * ((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.sin(q_4) - np.sin(q_1) * np.sin(q_2) * np.cos(q_4)) * np.sin(q_6) + 0.107 * ((np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.sin(q_4) - np.sin(q_1) * np.sin(q_2) * np.cos(q_4)) * np.cos(q_6) - 0.384 * (np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.sin(q_4) - 0.0825 * (np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + np.sin(q_3) * np.cos(q_1)) * np.cos(q_4) - 0.0825 * np.sin(q_1) * np.sin(q_2) * np.sin(q_4) + 0.384 * np.sin(q_1) * np.sin(q_2) * np.cos(q_4) + 0.316 * np.sin(q_1) * np.sin(q_2) + 0.0825 * np.sin(q_1) * np.cos(q_2) * np.cos(q_3) + 0.0825 * np.sin(q_3) * np.cos(q_1)
z = -0.107 * ((np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - np.sin(q_4) * np.cos(q_2)) * np.cos(q_5) - np.sin(q_2) * np.sin(q_3) * np.sin(q_5)) * np.sin(q_6) - 0.088 * ((np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - np.sin(q_4) * np.cos(q_2)) * np.cos(q_5) - np.sin(q_2) * np.sin(q_3) * np.sin(q_5)) * np.cos(q_6) + 0.088 * (np.sin(q_2) * np.sin(q_4) * np.cos(q_3) + np.cos(q_2) * np.cos(q_4)) * np.sin(q_6) - 0.107 * (np.sin(q_2) * np.sin(q_4) * np.cos(q_3) + np.cos(q_2) * np.cos(q_4)) * np.cos(q_6) + 0.384 * np.sin(q_2) * np.sin(q_4) * np.cos(q_3) + 0.0825 * np.sin(q_2) * np.cos(q_3) * np.cos(q_4) - 0.0825 * np.sin(q_2) * np.cos(q_3) - 0.0825 * np.sin(q_4) * np.cos(q_2) + 0.384 * np.cos(q_2) * np.cos(q_4) + 0.316 * np.cos(q_2) + 0.33
r_32 = -cq7 * (cq5 * sq2 * sq3 - sq5 * (cq2 * sq4 - cq3 * cq4 * sq2)) - sq7 * (cq6 * (cq5 * (cq2 * sq4 - cq3 * cq4 * sq2) + sq2 * sq3 * sq5) + sq6 * (cq2 * cq4 + cq3 * sq2 * sq4))
r_33 = -cq6 * (cq2 * cq4 + cq3 * sq2 * sq4) + sq6 * (cq5 * (cq2 * sq4 - cq3 * cq4 * sq2) + sq2 * sq3 * sq5)
r_31 = cq7 * (cq6 * (cq5 * (cq2 * sq4 - cq3 * cq4 * sq2) + sq2 * sq3 * sq5) + sq6 * (cq2 * cq4 + cq3 * sq2 * sq4)) - sq7 * (cq5 * sq2 * sq3 - sq5 * (cq2 * sq4 - cq3 * cq4 * sq2))
# Position cost
f_pos_cost = (x[-1] - x_fin) ** 2 + (y[-1] - y_fin) ** 2 + (z[-1] - z_fin) ** 2 + (x[0] - x_init) ** 2 + (y[0] - y_init) ** 2 + (z[0] - z_init) ** 2
# Orientation cost
f_orient_cost = np.sum((np.arctan2(r_32, r_33) - roll_des) ** 2 + (-np.arcsin(r_31) - pitch_des) ** 2)
# Smoothness cost
f_smoothness_vel = np.sum(np.dot(A_vel, q_1) ** 2) + np.sum(np.dot(A_vel, q_2) ** 2) + np.sum(np.dot(A_vel, q_3) ** 2) + np.sum(np.dot(A_vel, q_4) ** 2) + np.sum(np.dot(A_vel, q_5) ** 2) + np.sum(np.dot(A_vel, q_6) ** 2) + np.sum(np.dot(A_vel, q_7) ** 2)
f_smoothness_acc = np.sum(np.dot(A_acc, q_1) ** 2) + np.sum(np.dot(A_acc, q_2) ** 2) + np.sum(np.dot(A_acc, q_3) ** 2) + np.sum(np.dot(A_acc, q_4) ** 2) + np.sum(np.dot(A_acc, q_5) ** 2) + np.sum(np.dot(A_acc, q_6) ** 2) + np.sum(np.dot(A_acc, q_7) ** 2)
f_smoothness_jerk = np.sum(np.dot(A_jerk, q_1) ** 2) + np.sum(np.dot(A_jerk, q_2) ** 2) + np.sum(np.dot(A_jerk, q_3) ** 2) + np.sum(np.dot(A_jerk, q_4) ** 2) + np.sum(np.dot(A_jerk, q_5) ** 2) + np.sum(np.dot(A_jerk, q_6) ** 2) + np.sum(np.dot(A_jerk, q_7) ** 2)
f_smoothness_cost = rho_vel * f_smoothness_vel + rho_acc * f_smoothness_acc + rho_jerk * f_smoothness_jerk
cost = weight_orient * f_orient_cost + f_smoothness_cost + weight_pos * f_pos_cost
return cost
#### Compute solution
print("Computing initial solution")
opts = {
'maxiter': 600
}
bnds = Bounds(q_min_traj, q_max_traj)
cost_grad = grad(cost_fun)
init_params = np.array([x_fin, y_fin, z_fin])
start = time.time()
start_solver_process_time = time.process_time()
res = minimize(cost_fun, x_guess, init_params, method= 'SLSQP', jac=cost_grad, bounds=bnds, options=opts)
end_solver_process_time = time.process_time()
end_time = time.time()
print(end_time - start, res.message)
initial_cost1 = cost_fun(res.x, init_params)
print("Initial cost: {}".format(initial_cost1))
#### Generate argmin solutions and trajectories
num_samples = 6
flag = 1
cur_traj_cnt = 1
numpy_dict = {
"initial_soln": res.x
}
numpy_time_dict = {
"initial_soln": {
"cpu_time": end_time - start,
"process_time": end_solver_process_time - start_solver_process_time
}
}
for num_iter in range(1, num_samples + 1):
for sample_num in range(len(data['q_fin'][num_iter])):
print("ITERATION {}, Cur traj num: {}".format(num_iter, cur_traj_cnt))
print("Saving solution")
q_fin_new = data['q_fin'][num_iter][sample_num]
q_1_fin_new, q_2_fin_new, q_3_fin_new, q_4_fin_new, q_5_fin_new, q_6_fin_new, q_7_fin_new = q_fin_new
x_fin_new, y_fin_new, z_fin_new, _, _, _, _ = fk_franka(np.hstack((q_1_fin_new, q_2_fin_new, q_3_fin_new, q_4_fin_new, q_5_fin_new, q_6_fin_new, q_7_fin_new)))
perturbed_params = np.array([x_fin_new, y_fin_new, z_fin_new])
start_solver_time = time.time()
start_solver_process_time = time.process_time()
res_new = minimize(cost_fun, res.x, perturbed_params, method= 'SLSQP', jac=cost_grad, bounds=bnds, options=opts)
end_solver_process_time = time.process_time()
end_solver_time = time.time()
print("Solver time taken: {}".format(end_solver_time - start_solver_time))
print("Solver process time: {}".format(end_solver_process_time - start_solver_process_time))
print("Solver message: {}".format(res_new.message))
print("-"*100)
numpy_dict[cur_traj_cnt] = res_new.x
numpy_time_dict[cur_traj_cnt] = {
"cpu_time": end_solver_time - start_solver_time,
"process_time": end_solver_process_time - start_solver_process_time
}
cur_traj_cnt += 1
os.makedirs(args.results_path, exist_ok=True)
np_path = os.path.join(args.results_path, 'traj_{}.npy'.format(cur_pos + 1))
np.save(np_path, numpy_dict)
np_time_path = os.path.join(args.results_path, 'traj_time_{}.npy'.format(cur_pos + 1))
np.save(np_time_path, numpy_time_dict)
| 82.887387 | 1,232 | 0.595565 | 4,431 | 18,401 | 2.215076 | 0.05123 | 0.175242 | 0.21029 | 0.064901 | 0.732043 | 0.691187 | 0.680183 | 0.672134 | 0.624045 | 0.608355 | 0 | 0.093449 | 0.169556 | 18,401 | 221 | 1,233 | 83.262443 | 0.548852 | 0.012662 | 0 | 0.179191 | 0 | 0 | 0.024752 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.023121 | false | 0 | 0.104046 | 0 | 0.150289 | 0.052023 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8bb34711325850bceb50eb90e489a61bf3e9899a | 1,169 | py | Python | apps/fbschema/struct_models.py | pkuhad/dashfb | 0b1322d6238ea0b5b8cdc4d16001d3653b404877 | [
"MIT"
] | 3 | 2017-03-16T13:02:47.000Z | 2017-07-22T00:17:10.000Z | apps/fbschema/struct_models.py | pkuhad/dashfb | 0b1322d6238ea0b5b8cdc4d16001d3653b404877 | [
"MIT"
] | null | null | null | apps/fbschema/struct_models.py | pkuhad/dashfb | 0b1322d6238ea0b5b8cdc4d16001d3653b404877 | [
"MIT"
] | 2 | 2015-05-15T10:35:48.000Z | 2021-07-27T09:40:42.000Z | from django.db import models
class StructAgeRange(models.Model):
min = models.IntegerField()
max = models.IntegerField( blank=True, null=True )
class StructCommentInfo(models.Model):
can_comment = models.NullBooleanField( blank=True, null=True, help_text="Whether the comments are allowed on the object" )
comment_count = models.IntegerField( blank=True, null=True, help_text="The number of comments on this object." )
#comment_order = models.CharField( max_length=500, blank=True, null=True, help_text="The order that these comments are displayed on site.")
#comment_list = models.TextField( blank=True, null=True, help_text="The list of comments on the post")
#TODO: In next pass uncomment this line ^
class StructLikeInfo(models.Model):
can_like = models.NullBooleanField( blank=True, null=True, help_text="Whether the viewer can like the object" )
like_count = models.IntegerField( blank=True, null=True, help_text="The number of likes on this object." )
user_likes = models.NullBooleanField( blank=True, null=True, help_text="Whether the viewer likes this object" )
| 61.526316 | 144 | 0.719418 | 158 | 1,169 | 5.227848 | 0.335443 | 0.087167 | 0.125908 | 0.164649 | 0.474576 | 0.474576 | 0.432203 | 0.364407 | 0.364407 | 0.364407 | 0 | 0.003151 | 0.185629 | 1,169 | 18 | 145 | 64.944444 | 0.864496 | 0.241232 | 0 | 0 | 0 | 0 | 0.218326 | 0 | 0 | 0 | 0 | 0.055556 | 0 | 1 | 0 | false | 0 | 0.090909 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
8bb8032f2acd424e1966fbb1c6f8052ea48d1413 | 116 | py | Python | smashtheque/models/character.py | Retropen-Bar/pysmashtheque | 8da6fbdc11147c28bc09417104e7e0f688782c8f | [
"MIT"
] | null | null | null | smashtheque/models/character.py | Retropen-Bar/pysmashtheque | 8da6fbdc11147c28bc09417104e7e0f688782c8f | [
"MIT"
] | null | null | null | smashtheque/models/character.py | Retropen-Bar/pysmashtheque | 8da6fbdc11147c28bc09417104e7e0f688782c8f | [
"MIT"
] | null | null | null | from .api_record import *
class Character(ApiRecord):
api_path = "characters"
singular_resource = "character"
| 16.571429 | 33 | 0.75 | 13 | 116 | 6.461538 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155172 | 116 | 6 | 34 | 19.333333 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0.163793 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
8bbe7e89ac235d2b646670c3bd820a5f3e0af190 | 228 | py | Python | output/message.py | moehrenzahn/worktimer | ab92e8625652d94987c7da8ccdbf29be72bf3612 | [
"MIT"
] | 3 | 2018-07-29T20:48:15.000Z | 2019-03-29T10:42:19.000Z | output/message.py | moehrenzahn/worktimer | ab92e8625652d94987c7da8ccdbf29be72bf3612 | [
"MIT"
] | null | null | null | output/message.py | moehrenzahn/worktimer | ab92e8625652d94987c7da8ccdbf29be72bf3612 | [
"MIT"
] | null | null | null | import os
def message(recipient, text):
script = 'tell application "Messages" to send "{0}" to buddy "{1}" of (service 1 whose service type is iMessage)'.format(text, recipient)
os.system("osascript -e '%s'" % script)
| 32.571429 | 141 | 0.679825 | 33 | 228 | 4.69697 | 0.787879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015957 | 0.175439 | 228 | 6 | 142 | 38 | 0.808511 | 0 | 0 | 0 | 0 | 0.25 | 0.52193 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8bc62bf2c490498ea1dff6a417dc9c3797b16563 | 148 | py | Python | app/grandchallenge/policies/views.py | njmhendrix/grand-challenge.org | 9bc36f5e26561a78bd405e8ea5e4c0f86c95f011 | [
"Apache-2.0"
] | 101 | 2018-04-11T14:48:04.000Z | 2022-03-28T00:29:48.000Z | app/grandchallenge/policies/views.py | njmhendrix/grand-challenge.org | 9bc36f5e26561a78bd405e8ea5e4c0f86c95f011 | [
"Apache-2.0"
] | 1,733 | 2018-03-21T11:56:16.000Z | 2022-03-31T14:58:30.000Z | app/grandchallenge/policies/views.py | njmhendrix/grand-challenge.org | 9bc36f5e26561a78bd405e8ea5e4c0f86c95f011 | [
"Apache-2.0"
] | 42 | 2018-06-08T05:49:07.000Z | 2022-03-29T08:43:01.000Z | from django.views.generic import DetailView
from grandchallenge.policies.models import Policy
class PolicyDetail(DetailView):
model = Policy
| 18.5 | 49 | 0.810811 | 17 | 148 | 7.058824 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135135 | 148 | 7 | 50 | 21.142857 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8bd3dc2c2381df11d5ae0cbcc92302f073ababfb | 190 | py | Python | src/marketplace/authorization/common.py | abell5/marketplace | 474241801416e4699970f5684176e7351504b9c0 | [
"MIT"
] | null | null | null | src/marketplace/authorization/common.py | abell5/marketplace | 474241801416e4699970f5684176e7351504b9c0 | [
"MIT"
] | null | null | null | src/marketplace/authorization/common.py | abell5/marketplace | 474241801416e4699970f5684176e7351504b9c0 | [
"MIT"
] | null | null | null | from django.core.exceptions import PermissionDenied
def ensure_user_has_permission(user, target, permission):
if not user.has_perm(permission, target):
raise PermissionDenied()
| 31.666667 | 57 | 0.784211 | 23 | 190 | 6.304348 | 0.695652 | 0.096552 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142105 | 190 | 5 | 58 | 38 | 0.889571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8bdf2b9d6993b6248b64645d01d7bb5aff378a82 | 9,780 | py | Python | FDA/fda.py | bwelch21/secure-file-share | 69e693dad4eb02a4a7b8051244947115eea71abc | [
"MIT"
] | null | null | null | FDA/fda.py | bwelch21/secure-file-share | 69e693dad4eb02a4a7b8051244947115eea71abc | [
"MIT"
] | null | null | null | FDA/fda.py | bwelch21/secure-file-share | 69e693dad4eb02a4a7b8051244947115eea71abc | [
"MIT"
] | null | null | null | from contextlib import closing
from urllib.request import urlopen
from http.client import HTTPConnection
import sys
import json
import os
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
import io
import urllib
print ("------------------------SecureFileShare's File Download Application----------------------------" +"\n")
print ("Use this application to encrypt files and upload files or to decrypt and download files." + "\n" + "Please enter your username and password from your" +
" SecureFileShare account to begin.")
username = input('Enter Userid: ')
password = input('Enter Password: ')
def hashfile(afile):
blocksize = 4096
hasher = hashlib.sha256()
with open(afile, "rb") as f:
for chunk in iter(lambda: f.read(blocksize), b""):
hasher.update(chunk)
return hasher.hexdigest()
def pad(s):
return s + b"\0" * (AES.block_size - len(s) % AES.block_size)
def encrypt(message, key, key_size=256):
message = pad(message)
iv = Random.new().read(AES.block_size)
cipher = AES.new(key, AES.MODE_CBC, iv)
return iv + cipher.encrypt(message)
def decrypt(ciphertext, key):
iv = ciphertext[:AES.block_size]
cipher = AES.new(key, AES.MODE_CBC, iv)
plaintext = cipher.decrypt(ciphertext[AES.block_size:])
return plaintext.rstrip(b"\0")
def encrypt_file(file_name, key):
with open(file_name, 'rb') as fo:
plaintext = fo.read()
enc = encrypt(plaintext, key)
with open(file_name + ".enc", 'wb') as fo:
fo.write(enc)
def decrypt_file(file_name, key):
with open(file_name, 'rb') as fo:
ciphertext = fo.read()
dec = decrypt(ciphertext, key)
file_ending = file_name.split(".")
with io.FileIO(file_name.replace(".enc", "_decrypted.") + file_ending[1], "w") as file:
file.write(dec)
# with open(file_name[:-4], 'wb') as fo:
# fo.write(dec)
def display_report_files(report_id):
key = '00112233445566778899aabbccddeeff'
url="https://quiet-tundra-22071.herokuapp.com/fda_report_files/" + report_id
with closing(urlopen(url)) as response:
#print(response.read().decode())
json_data = response.read().decode()
print("")
print("List of files that can be downloaded.")
print("-------------------------------------------------------------------")
files = json.loads(json_data)
for file in files:
print("id:" + str(file["id"]) + ", is_encrypted:" + str(file['is_encrypted']) + ", file_name:" + file["file_name"] + "\n\t" + " ,file_hash:" + file["file_hash"] + "\n")
print("")
print("-------------------------------------------------------------------")
file_id = input("Please enter an id of a file to download: ")
file_url = ""
file_name = ""
for file in files:
if str(file["id"]) == file_id:
file_url = "https://quiet-tundra-22071.herokuapp.com/media/" + file["file_name"]
file_url_parts = file["file_name"].split('/')
file_name = file_url_parts[len(file_url_parts)-1]
file_hash_db = file["file_hash"]
if (file['is_encrypted']):
answer = input(
file_name + " is encrypted. You must decrypt it to view the file. Would you like to decrypt? Enter: 'y'" + "\n")
if (answer == 'y'):
print("downloading " + file_name)
response2 = urllib.request.urlopen(file_url)
thedata = response2.read()
# Write data to file
file_ = open(file_name, 'wb')
file_.write(thedata)
file_.close()
decrypt_file(file_name, key)
print(file_name + " has been decrypted")
print("")
file_hash = hashfile(file_name)
print("")
print("-------------------------------------------------------------------")
print("calculated file hash: " + file_hash)
print(" original file hash: " + file_hash_db)
if file_hash == file_hash_db:
print("")
print("File validated! File hash matches!")
else:
print("File hash does not match. Please try to download again.")
print("-------------------------------------------------------------------")
with open(file_name + ".sha256", 'w') as f:
f.write(file_hash)
print("")
print("Done!")
else:
print("Failed to download " + file_name + "Need to encrypt this file to view.")
break
else:
print("downloading " + file_name)
response2 = urllib.request.urlopen(file_url)
thedata = response2.read()
# Write data to file
file_ = open(file_name, 'wb')
file_.write(thedata)
file_.close()
print("")
file_hash = hashfile(file_name)
print("")
print("-------------------------------------------------------------------")
print("calculated file hash: " + file_hash)
print(" original file hash: " + file_hash_db)
if file_hash == file_hash_db:
print("")
print("File validated! File hash matches!")
else:
print("File hash does not match. Please try to download again.")
print("-------------------------------------------------------------------")
with open(file_name + ".sha256", 'w') as f:
f.write(file_hash)
print("")
print("Done!")
break
def display_reports(username,password):
key = '00112233445566778899aabbccddeeff'
url="https://quiet-tundra-22071.herokuapp.com/fda_getreports/" + username + "/" + password
with closing(urlopen(url)) as response:
#print(response.read().decode())
json_data = response.read().decode()
answer = (int)(input("Select an option:" + "\n" + "1. Encrypt a file to upload,"+ "\n" + "2. Decrypt a file to download" + "\n" + "3. Quit" + "\n"))
if (answer == 1):
file_to_encrypt = input("Enter the name of the file you want to encrypt: ")
encrypt_file(file_to_encrypt, key)
print(file_to_encrypt + "has been encrypted! Upload the desired file with the '.enc' ending.")
elif (answer ==2):
print("List of reports.")
print("-------------------------------------------------------------------")
reports = json.loads(json_data)
for report in reports:
print("report_id:" + str(report["report_id"]) + ", title:" + report["title"] + ", attachments:" + str(report["attachments"]))
print("")
print("-------------------------------------------------------------------")
report_id = input("Please enter a report_id with attachments to download: ")
print("-------------------------------------------------------------------")
display_report_files(report_id)
elif (answer==3):
sys.exit(0)
else:
answer = (int)(input("Select an option:" + "\n" + "1. Encrypt a file to upload,"+ "\n" + "2. Decrypt a file to download" + "\n" + "3. Quit" + "\n"))
def login(username,password):
url = "https://quiet-tundra-22071.herokuapp.com/fda_login/" + username + "/" + password
with closing(urlopen(url)) as response:
result = response.read()
if (result == b"true"):
display_reports(username,password)
else:
print("Invalid login. Please try again.")
username = input('Enter Userid: ')
password = input('Enter Password: ')
login(username,password)
login(username,password)
# from contextlib import closing
# from urllib.request import urlopen
# from http.client import HTTPConnection
# import sys
# import json
# import os
# import hashlib
# username = input('Enter Userid: ')
# password = input('Enter Password: ')
# def hashfile(afile):
# blocksize = 4096
# hasher = hashlib.sha256()
# with open(afile, "rb") as f:
# for chunk in iter(lambda: f.read(blocksize), b""):
# hasher.update(chunk)
# return hasher.hexdigest()
# def display_report_files(report_id):
# url="http://localhost:8000/fda_report_files/" + report_id
# with closing(urlopen(url)) as response:
# #print(response.read().decode())
# json_data = response.read().decode()
# print("")
# print("List of files that can be downloaded.")
# print("-------------------------------------------------------------------")
# files = json.loads(json_data)
# for file in files:
# print("id:" + str(file["id"]) + ", is_encrypted:" + str(file['is_encrypted']) + ", file_name:" + file["file_name"])
# print("")
# print("-------------------------------------------------------------------")
# file_id = input("Please enter an id of a file to download: ")
# file_url = ""
# file_name = ""
# for file in files:
# if str(file["id"]) == file_id:
# file_url = "http://localhost:8000/media/" + file["file_name"]
# file_url_parts = file["file_name"].split('/')
# file_name = file_url_parts[len(file_url_parts)-1]
# print("")
# #print(file_url)
# print("downloading " + file_name)
# break
# with closing(urlopen(file_url)) as response:
# data = response.read()
# with open(file_name, 'wb') as f:
# f.write(data)
# file_hash = hashfile(file_name)
# print("")
# print("-------------------------------------------------------------------")
# print("file hash: " + file_hash)
# print("-------------------------------------------------------------------")
# with open(file_name + ".sha256", 'w') as f:
# f.write(file_hash)
# print("")
# print("Done!")
# def display_reports():
# url="http://localhost:8000/fda_login/" + username + "/" + password
# with closing(urlopen(url)) as response:
# #print(response.read().decode())
# json_data = response.read().decode()
# print("Lis of reports.")
# print("-------------------------------------------------------------------")
# reports = json.loads(json_data)
# for report in reports:
# print("report_id:" + str(report["report_id"]) + ", title:" + report["title"] + ", attachments:" + str(report["attachments"]))
# print("")
# print("-------------------------------------------------------------------")
# report_id = input("Please enter a repor_id with attachments to download: ")
# print("-------------------------------------------------------------------")
# display_report_files(report_id)
# display_reports()
| 33.84083 | 170 | 0.575153 | 1,184 | 9,780 | 4.619088 | 0.152027 | 0.05266 | 0.021942 | 0.023405 | 0.714756 | 0.690986 | 0.680929 | 0.674895 | 0.652039 | 0.652039 | 0 | 0.014468 | 0.166053 | 9,780 | 288 | 171 | 33.958333 | 0.655959 | 0.287832 | 0 | 0.487654 | 0 | 0.006173 | 0.346897 | 0.10856 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.061728 | 0.067901 | null | null | 0.259259 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
47593322ad21fc9f6e4d230b4878f41c9d6cfe46 | 159 | py | Python | src/email_reader/scamchecker.py | Zaidek/discord-email-checking-bot | dcf51c15b49195908337070ec5c003fab7fb3419 | [
"Apache-2.0"
] | null | null | null | src/email_reader/scamchecker.py | Zaidek/discord-email-checking-bot | dcf51c15b49195908337070ec5c003fab7fb3419 | [
"Apache-2.0"
] | null | null | null | src/email_reader/scamchecker.py | Zaidek/discord-email-checking-bot | dcf51c15b49195908337070ec5c003fab7fb3419 | [
"Apache-2.0"
] | null | null | null | import os
import numpy as np
class Emailfilter():
def __init__(self):
def import_dataset(self, dataset):
def train(self):
def test(self): | 12.230769 | 38 | 0.660377 | 22 | 159 | 4.545455 | 0.590909 | 0.14 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.238994 | 159 | 13 | 39 | 12.230769 | 0.826446 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.428571 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
476be1370dde6fcccb9aed7d57665bfccc7d0dd2 | 1,687 | py | Python | Level2/Lessons49994/minari - 49994.py | StudyForCoding/ProgrammersLevel | dc957b1c02cc4383a93b8cbf3d739e6c4d88aa25 | [
"MIT"
] | null | null | null | Level2/Lessons49994/minari - 49994.py | StudyForCoding/ProgrammersLevel | dc957b1c02cc4383a93b8cbf3d739e6c4d88aa25 | [
"MIT"
] | null | null | null | Level2/Lessons49994/minari - 49994.py | StudyForCoding/ProgrammersLevel | dc957b1c02cc4383a93b8cbf3d739e6c4d88aa25 | [
"MIT"
] | 1 | 2021-04-05T07:35:59.000Z | 2021-04-05T07:35:59.000Z | # 방문 길이
```python
def solution(dirs):
answer = 0
length = [[0 for _ in range(11)] for _ in range(11)]
x,y = 5,5 # -5~5까지가 아니라 0~10로 했으니까 시작지점은 5,5
for i in range(len(dirs)):
if dirs[i] == 'U':
y += 1
length[x][y] += 1
if dirs[i] == 'D':
y -= 1
length[x][y] += 1
if dirs[i] == 'R':
x += 1
length[x][y] += 1
if dirs[i] == 'L':
x -= 1
length[x][y] += 1
```
```python
def solution(dirs):
x,y = 0,0
length = set() #중복 없는 집합 설정하기
# 좌표이동 저장한 for문
for i in dirs:
if i == 'U' and y < 5:
length.add(((x,y),(x,y+1)))
y += 1
elif i == 'D' and y > -5:
length.add(((x,y-1),(x,y)))
y -= 1
elif i == 'R' and x < 5:
length.add(((x,y),(x+1,y)))
x += 1
elif i == 'L' and x > -5:
length.add(((x-1,y),(x,y)))
x -= 1
return len(length)
```
for i in range(len(dirs)): 로 할거면 dirs[i] == 'U' 로 써줘야하ㅗ
for i in dirs: 로 할거면 i == 'U'로 써줘야하는데 뭔차이일까
```python
def solution(dirs):
x,y = 0,0
length = set() #중복 없는 집합 설정하기
# 좌표이동 저장한 for문
for i in dirs:
if i == 'U' and y < 5:
length.add(((x,y),(x,y+1)))
y += 1
elif i == 'D' and y > -5:
length.add(((x,y),(x,y-1)))
y -= 1
elif i == 'R' and x < 5:
length.add(((x,y),(x+1,y)))
x += 1
elif i == 'L' and x > -5:
length.add(((x,y),(x-1,y)))
x -= 1
return len(length)
```
이렇게 진행하면 테스트8부터 실패해 왜?
| 22.197368 | 57 | 0.377593 | 274 | 1,687 | 2.317518 | 0.186131 | 0.059843 | 0.037795 | 0.138583 | 0.735433 | 0.735433 | 0.607874 | 0.607874 | 0.581102 | 0.524409 | 0 | 0.054223 | 0.431535 | 1,687 | 75 | 58 | 22.493333 | 0.607925 | 0.054535 | 0 | 0.75 | 0 | 0 | 0.008822 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
478daefbebfb1385d73fbfe914e9e46515a7bd63 | 307 | py | Python | pwnurl/models/mixin/created.py | donovan-duplessis/pwnurl | a13e27694f738228d186ea437b4d15ef5a925a87 | [
"MIT"
] | 2 | 2016-05-14T06:37:49.000Z | 2020-05-13T18:09:22.000Z | pwnurl/models/mixin/created.py | donovan-duplessis/pwnurl | a13e27694f738228d186ea437b4d15ef5a925a87 | [
"MIT"
] | null | null | null | pwnurl/models/mixin/created.py | donovan-duplessis/pwnurl | a13e27694f738228d186ea437b4d15ef5a925a87 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.sql.expression import func
from pwnurl.common.extensions import db
class CreatedMixin(object):
@declared_attr
def created(cls):
return db.Column(db.DateTime(timezone=True), default=func.now())
| 21.928571 | 72 | 0.739414 | 40 | 307 | 5.625 | 0.75 | 0.124444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003831 | 0.149837 | 307 | 13 | 73 | 23.615385 | 0.858238 | 0.068404 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0.142857 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
479ca8bb0fd0b91fcd5632f371b5a334f1a1b0de | 342 | py | Python | glob_example.py | jeffb4real/scripts | 349bc3d3d819684261281a05db7a5b9389d664f1 | [
"MIT"
] | null | null | null | glob_example.py | jeffb4real/scripts | 349bc3d3d819684261281a05db7a5b9389d664f1 | [
"MIT"
] | null | null | null | glob_example.py | jeffb4real/scripts | 349bc3d3d819684261281a05db7a5b9389d664f1 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# https://pymotw.com/2/glob/
import glob
myfiles = glob.glob('./*.py')
print 'Files that end in .py\n---------------------'
for eachfile in myfiles:
print eachfile
print
myfiles = glob.iglob('./*.py')
print myfiles[0]
exit()
print 'Files that end in .py\n---------------------'
for ifile in myfiles:
print ifile
print
| 17.1 | 52 | 0.605263 | 50 | 342 | 4.14 | 0.46 | 0.10628 | 0.135266 | 0.164251 | 0.241546 | 0.241546 | 0.241546 | 0.241546 | 0 | 0 | 0 | 0.006757 | 0.134503 | 342 | 19 | 53 | 18 | 0.692568 | 0.125731 | 0 | 0.307692 | 0 | 0 | 0.337838 | 0.175676 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.076923 | null | null | 0.538462 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
479d1918ee9178b0a6faec41bb48a717fb58c8e0 | 136 | py | Python | LPTHW/mystuff.py | YYMaker/PythonStarter | 49f7af6c5f4acf50be5d761f372ecdff8993aff9 | [
"CC0-1.0"
] | null | null | null | LPTHW/mystuff.py | YYMaker/PythonStarter | 49f7af6c5f4acf50be5d761f372ecdff8993aff9 | [
"CC0-1.0"
] | null | null | null | LPTHW/mystuff.py | YYMaker/PythonStarter | 49f7af6c5f4acf50be5d761f372ecdff8993aff9 | [
"CC0-1.0"
] | null | null | null | # this goes in mystuff.py
def apple():
print "I AM APPLES!"
# this is just a variable
tangerine = "Living reflection of a dream"
| 15.111111 | 42 | 0.683824 | 22 | 136 | 4.227273 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.227941 | 136 | 8 | 43 | 17 | 0.885714 | 0.345588 | 0 | 0 | 0 | 0 | 0.465116 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
47a94bc3d51d78b9ee4b905d6df9a3f4963ab8c1 | 191 | py | Python | python/license_key_formatting.py | anishLearnsToCode/leetcode-algorithms | d5a84e9179a4c3427890313a933fe1950fbcdabc | [
"MIT"
] | 17 | 2020-06-13T15:05:55.000Z | 2022-03-16T18:28:53.000Z | python/license_key_formatting.py | anishLearnsToCode/leetcode-algorithms | d5a84e9179a4c3427890313a933fe1950fbcdabc | [
"MIT"
] | null | null | null | python/license_key_formatting.py | anishLearnsToCode/leetcode-algorithms | d5a84e9179a4c3427890313a933fe1950fbcdabc | [
"MIT"
] | 9 | 2020-12-27T19:17:58.000Z | 2022-03-22T07:02:19.000Z | class Solution:
def licenseKeyFormatting(self, s: str, k: int) -> str:
s = s.replace('-', '').upper()[::-1]
return '-'.join(s[i:i + k] for i in range(0, len(s), k))[::-1]
| 38.2 | 70 | 0.513089 | 30 | 191 | 3.266667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020408 | 0.230366 | 191 | 4 | 71 | 47.75 | 0.646259 | 0 | 0 | 0 | 0 | 0 | 0.010471 | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
47c7ad8cfad15e5a249a114772fe06890077f111 | 747 | py | Python | tests/validators/test_protein_deletion.py | cancervariants/varlex | 3806317fa0125c3098e80124d5169fe6a13d50db | [
"MIT"
] | null | null | null | tests/validators/test_protein_deletion.py | cancervariants/varlex | 3806317fa0125c3098e80124d5169fe6a13d50db | [
"MIT"
] | 15 | 2019-10-23T17:35:42.000Z | 2020-05-05T21:04:01.000Z | tests/validators/test_protein_deletion.py | cancervariants/varlex | 3806317fa0125c3098e80124d5169fe6a13d50db | [
"MIT"
] | null | null | null | """Module for testing Protein Deletion Validator."""
import unittest
from variation.validators import ProteinDeletion
from variation.classifiers import ProteinDeletionClassifier
from .validator_base import ValidatorBase
class TestProteinDeletionValidator(ValidatorBase, unittest.TestCase):
"""A class to test the Protein Deletion Validator."""
def validator_instance(self):
"""Return protein deletion instance."""
return ProteinDeletion(*self.aa_params)
def classifier_instance(self):
"""Return the protein deletion classifier instance."""
return ProteinDeletionClassifier()
def fixture_name(self):
"""Return the fixture name for protein deletion."""
return "protein_deletion"
| 32.478261 | 69 | 0.745649 | 75 | 747 | 7.346667 | 0.426667 | 0.163339 | 0.087114 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.174029 | 747 | 22 | 70 | 33.954545 | 0.893031 | 0.298527 | 0 | 0 | 0 | 0 | 0.032129 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.363636 | 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 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
47e2994af71d8e5e8c51c10a3086a61b08cb481e | 156 | py | Python | exp/package_name.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 41 | 2016-01-21T05:14:45.000Z | 2021-11-24T20:37:21.000Z | exp/package_name.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 5 | 2016-01-21T05:36:37.000Z | 2016-08-22T19:26:51.000Z | exp/package_name.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 3 | 2016-01-23T04:03:44.000Z | 2016-08-21T15:58:38.000Z | import inspect
f = inspect.currentframe()
print(f.f_globals)
x = inspect.getfile(f)
print(inspect.getmodulename(x))
print(inspect.getmodule(f).__name__) | 15.6 | 36 | 0.769231 | 22 | 156 | 5.227273 | 0.5 | 0.208696 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089744 | 156 | 10 | 36 | 15.6 | 0.809859 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.5 | 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 | 1 | 0 | 3 |
47f8a77df02082e4d95413309981e2c4b2efbe9e | 255 | py | Python | FastDSP/structures/fdsp_types.py | JuanGGO/FastDSP | 652fdadbedd99b934cb6a82e3bfb07d4645425b8 | [
"BSD-3-Clause"
] | null | null | null | FastDSP/structures/fdsp_types.py | JuanGGO/FastDSP | 652fdadbedd99b934cb6a82e3bfb07d4645425b8 | [
"BSD-3-Clause"
] | null | null | null | FastDSP/structures/fdsp_types.py | JuanGGO/FastDSP | 652fdadbedd99b934cb6a82e3bfb07d4645425b8 | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
from FastDSP.structures import _data_structures
class Complex:
def __init__(self, real=0, imag=0):
self.real = real
self.imag = imag
def __str__(self):
return "{} + {}j".format(self.real, self.imag)
| 18.214286 | 54 | 0.635294 | 35 | 255 | 4.342857 | 0.571429 | 0.157895 | 0.157895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010471 | 0.25098 | 255 | 13 | 55 | 19.615385 | 0.78534 | 0 | 0 | 0 | 0 | 0 | 0.031496 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
9a11cafa20d407e6f3b31d9761380b2aff6bb751 | 26,619 | py | Python | Database/DB_dev.py | yashrajt/college_FAQ-chatbot | b3a2a1b4958068b652d019c13f31f6329b093c0a | [
"MIT"
] | 4 | 2020-10-02T20:27:03.000Z | 2021-09-28T16:11:04.000Z | Database/DB_dev.py | yashrajt/college_FAQ-chatbot | b3a2a1b4958068b652d019c13f31f6329b093c0a | [
"MIT"
] | 1 | 2020-11-25T10:23:14.000Z | 2020-11-25T10:23:14.000Z | Database/DB_dev.py | yashrajt/college_FAQ-chatbot | b3a2a1b4958068b652d019c13f31f6329b093c0a | [
"MIT"
] | 2 | 2020-10-12T18:16:16.000Z | 2021-09-28T16:11:15.000Z | import pprint
pp = pprint.PrettyPrinter(indent=3 ,depth=6,width=100)
import pickle
def add_compsdata():
comps = { "comps" :{
"Faculty" : {
"Dr.Deepak Sharma is the Head of Department"
"The Computer Department has a total of 30 faculty members consisting of highly skilled professors and assistant professors"
"For more information you can visit the given link!"
"<a href='https://kjsce.somaiya.edu/en/contact-us/faculty-directory'></a>"
#"https://kjsce.somaiya.edu/en/contact-us/faculty-directory"
},
"infrastructure" :{
"The Department houses classrooms and laboratories with modern infrastructure to facilitate their learning. The Teaching-Learning-Evaluation paradigm is a mix of traditional as well as active learning pedagogy and use of contemporary Information and communications technology (ICT) tools. The academic ambience encourages research, development and innovation activities."
"For detailed information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-computer-engineering'>Infrastructure</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-computer-engineering"
},
"syllabus" : {
"The syllabus is designed having wide choice for branch specific electives and more number of open or interdisciplinary electives."
"Extensive use of Open Sources Technologies for Teaching – Learning – Evaluation"
"Choice based Audit Courses, Add on Credit Courses, Add on Audit Courses, Exposure Courses, etc"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-computer-engineering'>syllabus</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-computer-engineering"
},
"placement" : {
"The Placement Process at KJSCE acts as a link between the expectations of the Recruiters with the dreams of the students. "
"In year 2019-2020, we had 84 Companies visiting for recruitment."
"The highest package received was Rs.18.75 lpa and overall average of Rs.5.55 lpa with over 600+ successfull placements."
"For more information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/placement/overview'>placement</a>"
#"https://kjsce.somaiya.edu/en/placement/overview"
},
"student" : {
"We at the K J Somaiya College of Engineering continuously strive to excel in academic along with various Co-curricular and extra-curricular activities. Extracurricular activities are not the components of the academic curriculum but an integral part of the educational environment for the intellectual development of an engineer. It will explore hidden talent inside you, it will make you more adaptive and flexible and help you to become a smart engineer not only just an engineering graduate."
"Codecell - KJSCE Codecell, a Codechef campus chapter was founded in 2014. The main goals of K J Somaiya College of Engineering Codecell are to promote a culture of competitive coding and to improve participation of the college in the prestigious competition ACM ICPC."
"CSI - The Computer Society of India established in the year 1965 is today the largest IT professionals’ society in India. Keeping in mind the interest of IT professionals & computer users, CSI works towards making a profession an area of choice among all sections of society."
"For information regarding all the councils and student organisations please visit the following link:"
"<a href='https://kjsce.somaiya.edu/en/students-association'>student_body</a>"
#"https://kjsce.somaiya.edu/en/students-association"
},
"programes":{
"Computer engineers are involved in the design of Computer-based systems to address highly specialized and specific application needs. The Department of Computer Engineering facilitates students to apply principles of Computer technology across a wide variety of fields for adapting to ever changing multidisciplinary converging technologies."
"For detailed information about the programmes offered please visit the following link:"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-computer-engineering'>programes</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-computer-engineering"
},
"admissions" :{
"For admission , intrested student are required to give Somaiya Entrance Test-Engineering(SET-E)."
"We are delighted that you are considering an B.Tech programme at K J Somaiya College of Engineering. Please read all instructions and requirements carefully to ensure a complete and correct application on the provided link:"
"<a href='https://kjsce.somaiya.edu/en/admission/btech'>admission</a>"
#"https://kjsce.somaiya.edu/en/admission/btech"
"Feel free to contact us on admission.engg@somaiya.edu in case of any queries."
}
}
}
return comps
def add_etrxdata():
ETRX = { "etrx" :{
"Faculty" :{
"Dr.Jagannath H Nirmal is the Head of Department."
"The Electronics Department has a total of 28 faculty members consisting of highly skilled professors and assistant professors who possess proficiency in both hardware and software areas. "
"For more information you can visit the given link :- "
"<a href='https://kjsce.somaiya.edu/en/contact-us/faculty-directory'>Faculty</a>"
},
"infrastructure" :{
"The electronics department has multiple fully equipped laborataries with state of art instruments for the students to have hands on experience in domains like Automation, Robotics,Machine Learning, Embedded systems, IOT with no hardware limitations."
"For detailed information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronics-engineering'>infrastructure</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronics-engineering"
},
"syllabus" : {
"The syllabus of Electronics department has a focused curriculum with a rigor towards hands-on experience and industry exposure. The syllabus is designed in consultation with Industrial experts and academia, to address the current industrial and social needs."
"Facility Centre with Festo for Industrial Automation and with National Instruments LabView are the key elements."
"Curriculum mapped to address current challenges with industry, designed through academia, industry and students participation"
"Focuses on a wide variety of core courses, electives including cutting edge technologies like Artificial Intelligence, Big Data Analytics, Machine Learning, IoT and more."
"For information about the detailed structure of syllabus and the subjects included, visit the link provided below!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronics-engineering'>syllabus</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronics-engineering"
},
"placement" : {
"The Placement Process at KJSCE acts as a link between the expectations of the Recruiters with the dreams of the students. "
"In year 2019-2020, we had 84 Companies visiting for recruitment."
"The highest package received was Rs.18.75 lpa and overall average of Rs.5.55 lpa with over 600+ successfull placements."
"For more information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/placement/overview'>placement</a>"
#"https://kjsce.somaiya.edu/en/placement/overview"
},
"student" : {
"We at the K J Somaiya College of Engineering continuously strive to excel in academic along with various Co-curricular and extra-curricular activities. Extracurricular activities are not the components of the academic curriculum but an integral part of the educational environment for the intellectual development of an engineer. It will explore hidden talent inside you, it will make you more adaptive and flexible and help you to become a smart engineer not only just an engineering graduate."
"EESA - The Electronics Engineers Students’ Association was established in the year 1988. The association promotes activities such as paper presentations, quizzes, seminars, etc.It arranges for preparatory guidance lectures and also conducts mock tests and group discussions for CAT, GRE etc."
"ISTE - The ISTE Student Chapter (MH 60) was established in 2000-2001 and it was inaugurated on Wednesday, 24th January 2001 by the Chief guest Shri Pratap Borde, Principal, MGM’s JNCOE, Aurangabad."
"For information regarding all the councils and student organisations please visit the following link:"
"<a href='https://kjsce.somaiya.edu/en/students-association'>student body</a>"
#"https://kjsce.somaiya.edu/en/students-association"
},
"programes" :{
"The curriculum offers a variety of audit courses, multi-disciplinary and core Electives. Faculty Members are trained in ICT Tools, pedagogy features, and innovative assessment methods along with sound technical base."
"Students gather a variety of learning experiences, where concepts are taught to the students through simulations, models, peer learning, personalized adaptive learning, etc. transforming students into industry-ready, competent Professionals."
"For more details please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronics-engineering'>programes</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronics-engineering"
},
"admissions" :{
"For admission , intrested student are required to give Somaiya Entrance Test-Engineering(SET-E)."
"We are delighted that you are considering an B.Tech programme at K J Somaiya College of Engineering. Please read all instructions and requirements carefully to ensure a complete and correct application on the provided link:"
#"https://kjsce.somaiya.edu/en/admission/btech"
"<a href='https://kjsce.somaiya.edu/en/admission/btech'>admission</a>"
"Feel free to contact us on admission.engg@somaiya.edu in case of any queries."
}
}
}
return ETRX
def add_extcdata():
EXTC = {"extc" :{
'Faculty' : {
"Dr. Ameya K. Naik is the Head of Department."
"The EXTC departement has a total of 29 faculty members consisting of highly skilled professors and assistant professors who possess proficiency in both hardware and software areas."
"For more information you can visit the given link!"
"<a href='https://kjsce.somaiya.edu/en/contact-us/faculty-directory'>faculty</a>"
#"https://kjsce.somaiya.edu/en/contact-us/faculty-directory"
},
"infrastructure": {
"The department of electronics and telecommunications has multiple fully equipped laborataries with state of art instruments"
"Hands on learning through laboratory experiments to develop knowledge, skills, and values from direct experiences beyond traditional academic course."
"For more information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronic-telecommunication'>infrastructure</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronic-telecommunication"
},
"syllabus" : {
"The curriculum is designed to develop technical and interpersonal skills offering wide choice for every learner."
"Curriculum mapped to address current challenges with industry, designed through academia, industry and students participation"
"Focuses on a wide variety of core courses, electives including cutting edge technologies like Artificial Intelligence, Big Data Analytics, Machine Learning, IoT and more."
"For detailed information about the curriculum please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronic-telecommunication'>syllabus</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronic-telecommunication"
},
"placement": {
"The Placement Process at KJSCE acts as a link between the expectations of the Recruiters with the dreams of the students. "
"In year 2019-2020, we had 84 Companies visiting for recruitment."
"The highest package received was Rs.18.75 lpa and overall average of Rs.5.55 lpa with over 600+ successfull placements."
"For more information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/placement/overview'>placement</a>"
#"https://kjsce.somaiya.edu/en/placement/overview"
},
"student" : {
"We at the K J Somaiya College of Engineering continuously strive to excel in academic along with various Co-curricular and extra-curricular activities. Extracurricular activities are not the components of the academic curriculum but an integral part of the educational environment for the intellectual development of an engineer. It will explore hidden talent inside you, it will make you more adaptive and flexible and help you to become a smart engineer not only just an engineering graduate."
"IETE - The Institute of Electronics & Telecommunication Engineers - Institute Students’ Forum, ( IETE – KJSISF ) , started in the year 2001."
"EESA - The Electronics Engineers Students’ Association was established in the year 1988. The association promotes activities such as paper presentations, quizzes, seminars, etc.It arranges for preparatory guidance lectures and also conducts mock tests and group discussions for CAT, GRE etc."
"For information regarding all the councils and student organisations please visit the following link:"
"<a href='https://kjsce.somaiya.edu/en/students-association'>student body</a>"
#"https://kjsce.somaiya.edu/en/students-association"
},
"programes" :{
"Electronics and Telecommunication Engineering department at K. J. Somaiya College of Engineering is committed to develop competent engineers ready to solve real world problems related to the field of electronics and communications. The department has always been on a high growth path and has experienced and dedicated faculty members with a strong devotion in the field of engineering education. The major areas of faculty expertise include Basic Electronics, Communication Systems, Computer Networks, Control Systems, Digital Signal Processing, Image Processing, Computer Vision, Instrumentation, Signal Processing, RF & Microwaves and VLSI Systems."
"For more information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronic-telecommunication'>programes</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-electronic-telecommunication"
},
"admissions" :{
"For admission , intrested student are required to give Somaiya Entrance Test-Engineering(SET-E)."
"We are delighted that you are considering an B.Tech programme at K J Somaiya College of Engineering. Please read all instructions and requirements carefully to ensure a complete and correct application on the provided link:"
#"https://kjsce.somaiya.edu/en/admission/btech"
"<a href='https://kjsce.somaiya.edu/en/admission/btech'>admission</a>"
"Feel free to contact us on admission.engg@somaiya.edu in case of any queries."
}
}
}
return EXTC
def add_ITdata():
IT = {"it" : {
"Faculty" : {
"Dr. IRFAN A SIDDAVATAM is the Head of Department."
"The IT Department has a total of 29 faculty members consisting of professors and assistant professors with high technical qualifications and industry required skills."
"For more information please visit the given link!"
"<a href='https://kjsce.somaiya.edu/en/contact-us/faculty-directory'>Faculty</a>"
#"https://kjsce.somaiya.edu/en/contact-us/faculty-directory"
},
"infrastructure" :{
"The department of Information Technology has sophisticated cutting edge laboratories with the latest infrastructure for parallel computing, cloud computing, Penetration Testing and Internet of Things provide quality academic experience for students."
"For more information please visit the given link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-information-technology'>infrastructure</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-information-technology"
},
"syllabus" :{
"Academia Curricula benchmarked with International Institutes of repute. Stream-based choices of electives in the curriculum help focused skill development and flexible credit courses for students opting higher studies abroad. Exposure to audit courses, Interdisciplinary courses, trending lab course makes a student ready for dynamically changing industry."
"IT involves development of applications that churns and infers every data point in the diversified domain of Data Science, Artificial Intelligence, Cyber Security, Cloud Computing, Blockchain Technology, Application Development, IOT, etc. IT department is mandated towards focused delivery of the content by aligning curriculum and infrastructure to cater to emerging industry needs."
"For more information please visit the given link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-information-technology'>syllabus</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-information-technology"
},
'placement' :{
"The Placement Process at KJSCE acts as a link between the expectations of the Recruiters with the dreams of the students. "
"In year 2019-2020, we had 84 Companies visiting for recruitment."
"The highest package received was Rs.18.75 lpa and overall average of Rs.5.55 lpa with over 600+ successfull placements."
"For more information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/placement/overview'>placement</a>"
#"https://kjsce.somaiya.edu/en/placement/overview"
},
'student': {
"We at the K J Somaiya College of Engineering continuously strive to excel in academic along with various Co-curricular and extra-curricular activities. Extracurricular activities are not the components of the academic curriculum but an integral part of the educational environment for the intellectual development of an engineer. It will explore hidden talent inside you, it will make you more adaptive and flexible and help you to become a smart engineer not only just an engineering graduate."
"Codecell - KJSCE Codecell, a Codechef campus chapter was founded in 2014. The main goals of K J Somaiya College of Engineering Codecell are to promote a culture of competitive coding and to improve participation of the college in the prestigious competition ACM ICPC."
"Bloombox - BloomBox is the entrepreneurship cell at K J Somaiya College of Engineering."
"For more information you can visit the given link!"
"<a href='https://kjsce.somaiya.edu/en/students-association'>student body</a>"
#"https://kjsce.somaiya.edu/en/students-association"
},
'programes' :{
"IT involves development of applications that churns and infers every data point in the diversified domain of Data Science, Artificial Intelligence, Cyber Security, Cloud Computing, Blockchain Technology, Application Development, IOT, etc."
"IT department is mandated towards focused delivery of the content by aligning curriculum and infrastructure to cater to emerging industry needs."
"Department aims at strengthening and preparing students for lifelong learning, research and successful adaptation of ever changing technology, which helps them to develop an ability to analyze, design and provide novel IT solutions for engineering problems."
"For more information you can visit the given link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-information-technology'>programes</a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-information-technology"
},
'admissions':{
"For admission , intrested student are required to give Somaiya Entrance Test-Engineering(SET-E)."
"We are delighted that you are considering an B.Tech programme at K J Somaiya College of Engineering. Please read all instructions and requirements carefully to ensure a complete and correct application on the provided link:"
#"https://kjsce.somaiya.edu/en/admission/btech"
"<a href='https://kjsce.somaiya.edu/en/admission/btech'>admissions</a>"
"Feel free to contact us on admission.engg@somaiya.edu in case of any queries."
}
}
}
return IT
def add_mechdata():
Mech = {'mech':{
'Faculty' : {
"Dr. Ramesh R Lekurwale is the Head of Department."
"The Mechanical Department has a total of 30 faculty members consisting of highly skilled professors and assistant professors with a good practical experience of the industry."
"For more information you can visit the given link!"
"<a href='https://kjsce.somaiya.edu/en/contact-us/faculty-directory'>Faculty</a>"
#"https://kjsce.somaiya.edu/en/contact-us/faculty-directory"
},
'infrastructure' : {
"The department of Mechanical Engineering has state of art laboratories and workshops where students can work on industry level projects with help of trained professoes and lab assistants."
"Special workshops are alloted to different teams like ROBOCON , Red shift Racing, Orion Racing where students can work after college hours on projects with full access to all the equipments."
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-mechanical-engineering"
},
'syllabus' : {
"The syllabus includes multiple technical subjexts covering complete repertoire of skills necessary for overall development in field of Mechanical Engineering with workshops on emerging areas, industry based UG projects as per thrust areas ."
"Projects are converted as Lab experiments. Virtual Lab Experiments and variety of internal assessment techniques such as, Open book test, MCQ, Research Presentations, Case studies, Mini Projects and many more Funded projects."
"For more information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-mechanical-engineering'></a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-mechanical-engineering"
},
'placement' :{
"The Placement Process at KJSCE acts as a link between the expectations of the Recruiters with the dreams of the students. "
"In year 2019-2020, we had 84 Companies visiting for recruitment."
"The highest package received was Rs.18.75 lpa and overall average of Rs.5.55 lpa with over 600+ successfull placements."
"For more information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/placement/overview'></a>"
#"https://kjsce.somaiya.edu/en/placement/overview"
},
'student':{
"We at the K J Somaiya College of Engineering continuously strive to excel in academic along with various Co-curricular and extra-curricular activities. Extracurricular activities are not the components of the academic curriculum but an integral part of the educational environment for the intellectual development of an engineer. It will explore hidden talent inside you, it will make you more adaptive and flexible and help you to become a smart engineer not only just an engineering graduate."
"MESA - The Mechanical Engineering Students’ Association, a student organization, was founded in the year 2000.G-Force, the annual tech fest held by MESA serves as an opportunity for students to showcase their talents and technical skills."
"For more information you can visit the given link!"
"<a href='https://kjsce.somaiya.edu/en/students-association'>student body</a>"
#"https://kjsce.somaiya.edu/en/students-association"
},
'programes' :{
"The department imparts the skills and expertise in the areas of design, manufacturing and thermal sciences that are the backbone of most sectors of industry. The department is committed to provide quality education in mechanical engineering that enables students to achieve excellence in their field of specialization. It strives to ensure an academic ambience that is important for encouraging the culture of research, development and innovation amongst students."
"For more information please visit the following link!"
"<a href='https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-mechanical-engineering'></a>"
#"https://kjsce.somaiya.edu/en/programme/bachelor-of-technology-mechanical-engineering"
},
'admissions' :{
"For admission , intrested student are required to give Somaiya Entrance Test-Engineering(SET-E)."
"We are delighted that you are considering an B.Tech programme at K J Somaiya College of Engineering. Please read all instructions and requirements carefully to ensure a complete and correct application on the provided link:"
#"https://kjsce.somaiya.edu/en/admission/btech"
"<a href='https://kjsce.somaiya.edu/en/admission/btech'></a>"
"Feel free to contact us on admission.engg@somaiya.edu in case of any queries."
}
}
}
return Mech
def add_all():
db_dict = {}
Comps = add_compsdata()
Etrx = add_etrxdata()
EXTC = add_extcdata()
IT = add_ITdata()
Mech = add_mechdata()
branch = [Comps , Etrx , EXTC , IT , Mech]
for w in branch:
db_dict.update(w)
with open('db_dict.pickle', 'wb') as handle:
pickle.dump(db_dict, handle, protocol=pickle.HIGHEST_PROTOCOL)
print("Dict created")
#return db_dict
add_all()
| 82.925234 | 661 | 0.736241 | 3,535 | 26,619 | 5.539463 | 0.176238 | 0.037279 | 0.059034 | 0.069452 | 0.701512 | 0.694975 | 0.688847 | 0.683025 | 0.683025 | 0.68037 | 0 | 0.007348 | 0.187047 | 26,619 | 320 | 662 | 83.184375 | 0.897412 | 0.085841 | 0 | 0.447471 | 0 | 0.330739 | 0.855861 | 0.011442 | 0 | 0 | 0 | 0 | 0 | 1 | 0.023346 | false | 0 | 0.011673 | 0 | 0.054475 | 0.011673 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9a1ae9444807c20b9bb104e21b57a2c96758c3be | 231 | py | Python | 05-Lists-and-Tuples/5-22-Simulating-a-Queue-with-a-List.py | rajevac/deitel-intro-to-python-exercises | 05f427d35ebb4bd315904f6919659335b1bf3fc9 | [
"MIT"
] | null | null | null | 05-Lists-and-Tuples/5-22-Simulating-a-Queue-with-a-List.py | rajevac/deitel-intro-to-python-exercises | 05f427d35ebb4bd315904f6919659335b1bf3fc9 | [
"MIT"
] | null | null | null | 05-Lists-and-Tuples/5-22-Simulating-a-Queue-with-a-List.py | rajevac/deitel-intro-to-python-exercises | 05f427d35ebb4bd315904f6919659335b1bf3fc9 | [
"MIT"
] | null | null | null | items = []
def enqueue(item):
items.append(item)
def dequeue():
if len(items) > 0:
items.pop(0)
enqueue(5)
enqueue(11)
enqueue('Jones')
enqueue(45)
print(items)
dequeue()
print(items)
dequeue()
print(items) | 9.625 | 22 | 0.632035 | 32 | 231 | 4.5625 | 0.46875 | 0.205479 | 0.232877 | 0.30137 | 0.30137 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037838 | 0.199134 | 231 | 24 | 23 | 9.625 | 0.751351 | 0 | 0 | 0.333333 | 0 | 0 | 0.021552 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0 | 0 | 0.133333 | 0.2 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9a5bc10af1438448d102ae2e91c97fd9ae14d543 | 103 | py | Python | algorithms/mergesort.py | mohit-surana/ds-algo-review | 7a70d0e417da8a9f31ad4d46b8293912aa20af00 | [
"MIT"
] | null | null | null | algorithms/mergesort.py | mohit-surana/ds-algo-review | 7a70d0e417da8a9f31ad4d46b8293912aa20af00 | [
"MIT"
] | null | null | null | algorithms/mergesort.py | mohit-surana/ds-algo-review | 7a70d0e417da8a9f31ad4d46b8293912aa20af00 | [
"MIT"
] | null | null | null | from data_structures.lists import LinkedList
my_list = LinkedList()
print('Algorithm that uses list') | 20.6 | 44 | 0.805825 | 14 | 103 | 5.785714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116505 | 103 | 5 | 45 | 20.6 | 0.89011 | 0 | 0 | 0 | 0 | 0 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
9a60a496f4cecf4779243ba10915a40c3a90a2fe | 316 | py | Python | Week1_PyThonBasic/Beginner/Exercise7.py | minhvip2001/pythonproject | 0ad9e70203fae2cd038872a8d1a71c0bc9416cf3 | [
"MIT"
] | null | null | null | Week1_PyThonBasic/Beginner/Exercise7.py | minhvip2001/pythonproject | 0ad9e70203fae2cd038872a8d1a71c0bc9416cf3 | [
"MIT"
] | null | null | null | Week1_PyThonBasic/Beginner/Exercise7.py | minhvip2001/pythonproject | 0ad9e70203fae2cd038872a8d1a71c0bc9416cf3 | [
"MIT"
] | null | null | null | def appearance(str, word):
count = 0
count = str.count(word)
if(count == 0): print(word, "appeared", count, "time")
elif(count < 2): print(word, "appeared", count, "time")
else: print(word, "appeared", count ,"times")
str = "Emma is good developer. Emma is a writer"
word = "ádasdasd"
appearance(str, word) | 35.111111 | 57 | 0.658228 | 46 | 316 | 4.521739 | 0.456522 | 0.129808 | 0.245192 | 0.317308 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011364 | 0.164557 | 316 | 9 | 58 | 35.111111 | 0.776515 | 0 | 0 | 0 | 0 | 0 | 0.268139 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0 | 0.111111 | 0.333333 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7bdd45db8bb0fdfc4b2e525876b31eadba2c0fbb | 154 | py | Python | puppet_diamond/__meta__.py | diamond-org/puppet-diamond | eb28f5b134f37b39c6acb53bbaa98ff6f59de39c | [
"MIT"
] | null | null | null | puppet_diamond/__meta__.py | diamond-org/puppet-diamond | eb28f5b134f37b39c6acb53bbaa98ff6f59de39c | [
"MIT"
] | null | null | null | puppet_diamond/__meta__.py | diamond-org/puppet-diamond | eb28f5b134f37b39c6acb53bbaa98ff6f59de39c | [
"MIT"
] | null | null | null | __version__ = '0.3.0'
__author__ = 'Ian Dennis Miller'
__email__ = 'iandennismiller@gmail.com'
__url__ = 'http://diamond-methods.org/puppet-diamond.html'
| 30.8 | 58 | 0.753247 | 20 | 154 | 5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021429 | 0.090909 | 154 | 4 | 59 | 38.5 | 0.692857 | 0 | 0 | 0 | 0 | 0 | 0.603896 | 0.162338 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7bedf0ea8ef61b690b8c6cbaaf715369a70abec9 | 181 | py | Python | srs/Observer.py | jokvedaras/game-framework | 9ff60e15d1beff54f94e280501929664ce59afe7 | [
"Apache-2.0"
] | null | null | null | srs/Observer.py | jokvedaras/game-framework | 9ff60e15d1beff54f94e280501929664ce59afe7 | [
"Apache-2.0"
] | null | null | null | srs/Observer.py | jokvedaras/game-framework | 9ff60e15d1beff54f94e280501929664ce59afe7 | [
"Apache-2.0"
] | null | null | null | __author__ = 'Pat and Tony'
#abstract class for the Observer interface
class Observer(object):
#must be implemented in all subclasses
def notify(self, msg):
pass | 18.1 | 42 | 0.701657 | 24 | 181 | 5.125 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.232044 | 181 | 10 | 43 | 18.1 | 0.884892 | 0.430939 | 0 | 0 | 0 | 0 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
d007252153060a74088b6191c79c62d0ce78837f | 132 | py | Python | app/schemas/ciphers.py | baloo1379/transposition-api | 23b7ee0c53776fda1e27643410761a3e0832b101 | [
"MIT"
] | null | null | null | app/schemas/ciphers.py | baloo1379/transposition-api | 23b7ee0c53776fda1e27643410761a3e0832b101 | [
"MIT"
] | null | null | null | app/schemas/ciphers.py | baloo1379/transposition-api | 23b7ee0c53776fda1e27643410761a3e0832b101 | [
"MIT"
] | null | null | null | from pydantic import BaseModel
class Request(BaseModel):
secret: str
text: str
class Response(BaseModel):
text: str
| 12 | 30 | 0.704545 | 16 | 132 | 5.8125 | 0.625 | 0.150538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.227273 | 132 | 10 | 31 | 13.2 | 0.911765 | 0 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 1 | 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 | 1 | 0 | 0 | 3 |
d00d1eae4b26b38f1229dad911b5f71d92f74175 | 51 | py | Python | keract/__init__.py | Stochastic13/keract | c42f4f9bd8304a6c5920d067a2b420297664ec88 | [
"MIT"
] | null | null | null | keract/__init__.py | Stochastic13/keract | c42f4f9bd8304a6c5920d067a2b420297664ec88 | [
"MIT"
] | null | null | null | keract/__init__.py | Stochastic13/keract | c42f4f9bd8304a6c5920d067a2b420297664ec88 | [
"MIT"
] | null | null | null | from keract.keract import *
__version__ = '2.5.0'
| 12.75 | 27 | 0.705882 | 8 | 51 | 4 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069767 | 0.156863 | 51 | 3 | 28 | 17 | 0.674419 | 0 | 0 | 0 | 0 | 0 | 0.098039 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d031fef43d50e86c575fe44dce3fc1a3a4947937 | 93 | py | Python | src/tests.py | arkavo/Maxwell-ecosystem | d956ea892ebe581b8b2c0325df59fa58a6d5db9a | [
"Apache-2.0"
] | null | null | null | src/tests.py | arkavo/Maxwell-ecosystem | d956ea892ebe581b8b2c0325df59fa58a6d5db9a | [
"Apache-2.0"
] | null | null | null | src/tests.py | arkavo/Maxwell-ecosystem | d956ea892ebe581b8b2c0325df59fa58a6d5db9a | [
"Apache-2.0"
] | null | null | null | from numba_vectormath import*
import timeit
a = [10,10]
b = [60,70]
print(distance(a,b))
| 9.3 | 29 | 0.677419 | 16 | 93 | 3.875 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103896 | 0.172043 | 93 | 9 | 30 | 10.333333 | 0.701299 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d036293e555adc9e1572601607dc8827d1cba05b | 52 | py | Python | code/lib/toscanfv/__init__.py | superfluidity/RDCL3D | 3c5717941bd4046aa1be178e9004db1dc1c469a0 | [
"Apache-2.0"
] | 8 | 2017-03-13T16:34:28.000Z | 2021-11-16T11:35:56.000Z | code/lib/toscanfv/__init__.py | superfluidity/RDCL3D | 3c5717941bd4046aa1be178e9004db1dc1c469a0 | [
"Apache-2.0"
] | null | null | null | code/lib/toscanfv/__init__.py | superfluidity/RDCL3D | 3c5717941bd4046aa1be178e9004db1dc1c469a0 | [
"Apache-2.0"
] | 3 | 2017-03-28T09:26:40.000Z | 2020-12-08T14:16:12.000Z | __all__ = ["toscanfv_parser", "toscanfv_rdcl_graph"] | 52 | 52 | 0.788462 | 6 | 52 | 5.666667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057692 | 52 | 1 | 52 | 52 | 0.693878 | 0 | 0 | 0 | 0 | 0 | 0.641509 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d0363799cef628865c32a9fcb555ed09c0bef88a | 2,828 | py | Python | src/pyon/ion/objstore.py | scionrep/scioncc_new | 086be085b69711ee24c4c86ed42f2109ca0db027 | [
"BSD-2-Clause"
] | 2 | 2015-06-09T16:07:09.000Z | 2015-07-28T10:06:31.000Z | src/pyon/ion/objstore.py | scionrep/scioncc_new | 086be085b69711ee24c4c86ed42f2109ca0db027 | [
"BSD-2-Clause"
] | 21 | 2015-03-18T14:39:32.000Z | 2016-07-01T17:16:29.000Z | src/pyon/ion/objstore.py | scionrep/scioncc_new | 086be085b69711ee24c4c86ed42f2109ca0db027 | [
"BSD-2-Clause"
] | 12 | 2015-03-18T10:53:49.000Z | 2018-06-21T11:19:57.000Z | #!/usr/bin/env python
"""General purpose Object store implementation"""
__author__ = 'Michael Meisinger'
from pyon.core import bootstrap
from pyon.datastore.datastore import DataStore
from pyon.util.containers import recursive_encode
class ObjectStore(object):
"""
Class that uses a data store to provide a general purpose key-value store.
Values can be either dict or IonObject.
"""
def __init__(self, datastore_manager=None, container=None):
self.container = container or bootstrap.container_instance
# Get an instance of datastore configured as resource registry.
datastore_manager = datastore_manager or self.container.datastore_manager
self.obj_store = datastore_manager.get_datastore("objects", DataStore.DS_PROFILE.OBJECTS)
self.name = 'container_object_store'
self.id = 'container_object_store'
def start(self):
pass
def stop(self):
self.close()
def close(self):
"""
Pass-through method to close the underlying datastore.
"""
self.obj_store.close()
def create(self, obj, object_id=None):
return self.obj_store.create(obj, object_id=object_id)
def create_doc(self, doc, object_id=None):
return self.obj_store.create_doc(doc, object_id=object_id)
def create_mult(self, objects, object_ids=None):
return self.obj_store.create_mult(objects, object_ids=object_ids)
def create_doc_mult(self, docs, object_ids=None):
return self.obj_store.create_doc_mult(docs, object_ids=object_ids)
def update(self, obj):
return self.obj_store.update(obj)
def update_doc(self, doc):
return self.obj_store.update_doc(doc)
def update_mult(self, objects):
return self.obj_store.update_mult(objects)
def update_doc_mult(self, docs):
return self.obj_store.update_doc_mult(docs)
def delete(self, obj):
return self.obj_store.delete(obj)
def delete_doc(self, doc):
return self.obj_store.delete_doc(doc)
def delete_mult(self, object_ids):
return self.obj_store.delete_mult(object_ids)
def delete_doc_mult(self, object_ids):
return self.obj_store.delete_doc_mult(object_ids)
def read(self, object_id):
return self.obj_store.read(object_id)
def read_doc(self, doc_id):
obj = self.obj_store.read_doc(doc_id)
obj = obj.copy()
recursive_encode(obj)
return obj
def read_mult(self, object_ids, strict=True):
return self.obj_store.read_mult(object_ids, strict=strict)
def read_doc_mult(self, object_ids, strict=True):
objs = self.obj_store.read_doc_mult(object_ids, strict=strict)
objs = [recursive_encode(obj) if obj is not None else None for obj in objs]
return objs
| 29.768421 | 97 | 0.696605 | 398 | 2,828 | 4.70603 | 0.21608 | 0.078484 | 0.115323 | 0.134544 | 0.378003 | 0.26268 | 0.154832 | 0.12173 | 0.04378 | 0 | 0 | 0 | 0.213932 | 2,828 | 94 | 98 | 30.085106 | 0.842555 | 0.104668 | 0 | 0 | 0 | 0 | 0.027386 | 0.017721 | 0 | 0 | 0 | 0 | 0 | 1 | 0.37037 | false | 0.018519 | 0.055556 | 0.259259 | 0.740741 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d03fcced615038e64a0fec36431fd76cee17c701 | 188 | py | Python | gen_retinopath_data.py | Nilay017/Generative-Deep-Neural-Network-Mixture-Modeling-with-Semi-Supervised-MinMax-EM-Learning | 705718823f50507f82ee1a657bba33b1c3d6d02b | [
"MIT"
] | 1 | 2021-09-05T22:54:59.000Z | 2021-09-05T22:54:59.000Z | gen_retinopath_data.py | Nilay017/Generative-Deep-Neural-Network-Mixture-Modeling-with-Semi-Supervised-MinMax-EM-Learning | 705718823f50507f82ee1a657bba33b1c3d6d02b | [
"MIT"
] | null | null | null | gen_retinopath_data.py | Nilay017/Generative-Deep-Neural-Network-Mixture-Modeling-with-Semi-Supervised-MinMax-EM-Learning | 705718823f50507f82ee1a657bba33b1c3d6d02b | [
"MIT"
] | null | null | null | from data_processing import *
for seed in [0.0, 1.0, 2.0, 3.0, 4.0]:
create_and_store_DiabeticRetinopathydataset('./Diabetic_retinopathy_Data',\
'../Diabetic_retinopathy', seed=seed)
| 26.857143 | 76 | 0.744681 | 28 | 188 | 4.75 | 0.642857 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.059524 | 0.106383 | 188 | 6 | 77 | 31.333333 | 0.732143 | 0 | 0 | 0 | 0 | 0 | 0.26738 | 0.26738 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d04c6c488c97bc4556d9f305f0ec039c73311f29 | 69 | py | Python | source_code/version.py | jinolshah/sudosolver | 0253cc03f7ed7c9541135a6f457eebbca5ab8272 | [
"MIT"
] | null | null | null | source_code/version.py | jinolshah/sudosolver | 0253cc03f7ed7c9541135a6f457eebbca5ab8272 | [
"MIT"
] | null | null | null | source_code/version.py | jinolshah/sudosolver | 0253cc03f7ed7c9541135a6f457eebbca5ab8272 | [
"MIT"
] | null | null | null | version = 'v1.0'
repolink = 'https://github.com/jinolshah/sudosolver' | 34.5 | 52 | 0.73913 | 9 | 69 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03125 | 0.072464 | 69 | 2 | 52 | 34.5 | 0.765625 | 0 | 0 | 0 | 0 | 0 | 0.614286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d05378379a6f1c3674c67988b267eab46be42511 | 108 | py | Python | sample7.py | HumanAcademy-AI-Cource/2021_02Sample | 8873c1d58e25dac10106271c809cab34001db588 | [
"Apache-2.0"
] | null | null | null | sample7.py | HumanAcademy-AI-Cource/2021_02Sample | 8873c1d58e25dac10106271c809cab34001db588 | [
"Apache-2.0"
] | null | null | null | sample7.py | HumanAcademy-AI-Cource/2021_02Sample | 8873c1d58e25dac10106271c809cab34001db588 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*
number = 10 # 10をnumberにコピー
print(number) # numberを表示 | 21.6 | 33 | 0.611111 | 13 | 108 | 5.076923 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.059524 | 0.222222 | 108 | 5 | 34 | 21.6 | 0.72619 | 0.611111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
d05706773be779d4e15a376c0615a24f792c05a4 | 370 | py | Python | tests/__init__.py | xuexianwu/interpolation | a9c40132f64ce8a448fce0c283623e8af63ea397 | [
"BSD-3-Clause"
] | 9 | 2016-12-05T15:16:59.000Z | 2021-08-16T16:37:19.000Z | tests/__init__.py | pmav99/interpolation | a9c40132f64ce8a448fce0c283623e8af63ea397 | [
"BSD-3-Clause"
] | null | null | null | tests/__init__.py | pmav99/interpolation | a9c40132f64ce8a448fce0c283623e8af63ea397 | [
"BSD-3-Clause"
] | 9 | 2015-02-15T17:57:49.000Z | 2021-03-08T21:09:42.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
author: Panagiotis Mavrogiorgos
email : gmail, pmav99
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import sys
if sys.version_info.major < 3:
from future_builtins import map, zip, hex, oct, filter, ascii
| 19.473684 | 65 | 0.762162 | 50 | 370 | 5.22 | 0.7 | 0.191571 | 0.245211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012739 | 0.151351 | 370 | 18 | 66 | 20.555556 | 0.818471 | 0.259459 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.857143 | 0 | 0.857143 | 0.142857 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d057654162c44c06e408b5479704dd3679ef1026 | 267 | py | Python | Python 301/python_301_lesson_6_class_interfaces.py | PacktPublishing/The-Complete-Python-Course-including-Django-Web-Framework | 402b35d4739ed91e50d6c3380cab6f085a46c52b | [
"MIT"
] | 3 | 2021-07-09T01:24:20.000Z | 2022-03-24T06:30:19.000Z | Python 301/python_301_lesson_6_class_interfaces.py | PacktPublishing/The-Complete-Python-Course-including-Django-Web-Framework | 402b35d4739ed91e50d6c3380cab6f085a46c52b | [
"MIT"
] | null | null | null | Python 301/python_301_lesson_6_class_interfaces.py | PacktPublishing/The-Complete-Python-Course-including-Django-Web-Framework | 402b35d4739ed91e50d6c3380cab6f085a46c52b | [
"MIT"
] | 3 | 2021-07-01T21:52:53.000Z | 2021-09-02T08:54:23.000Z | class Animal:
fur_color = "Orange"
def speak(self):
raise NotImplementedError
def eat(self):
pass
def chase(self):
pass
class HouseCat(Animal):
def speak(self):
print("Meeeeowwww")
cat = HouseCat()
cat.speak()
| 14.052632 | 33 | 0.588015 | 30 | 267 | 5.2 | 0.566667 | 0.102564 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.303371 | 267 | 18 | 34 | 14.833333 | 0.83871 | 0 | 0 | 0.307692 | 0 | 0 | 0.059925 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0.153846 | 0 | 0 | 0.538462 | 0.076923 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
d05861a2c1abd2136e025fb189285367d5e339b6 | 691 | py | Python | people/views.py | WebCampZg/conference-web | 76ccae83924fdcd040d9280db5cf3a249d668606 | [
"BSD-3-Clause"
] | 4 | 2015-03-03T17:48:14.000Z | 2019-02-27T20:28:42.000Z | people/views.py | WebCampZg/conference-web | 76ccae83924fdcd040d9280db5cf3a249d668606 | [
"BSD-3-Clause"
] | 104 | 2015-02-25T18:09:15.000Z | 2019-06-21T10:02:53.000Z | people/views.py | WebCampZg/conference-web | 76ccae83924fdcd040d9280db5cf3a249d668606 | [
"BSD-3-Clause"
] | 9 | 2015-03-01T18:59:14.000Z | 2019-06-10T06:48:45.000Z | from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from django.views.generic import TemplateView, UpdateView
from people.forms import UserProfileForm
UserModel = get_user_model()
class UserProfileView(LoginRequiredMixin, TemplateView):
template_name = 'people/user_profile.html'
class UserProfileUpdateView(LoginRequiredMixin, UpdateView):
model = UserModel
form_class = UserProfileForm
template_name = 'people/user_profile_update.html'
def get_object(self, queryset=None):
return self.request.user
def get_success_url(self):
return reverse('user_profile')
| 27.64 | 60 | 0.788712 | 81 | 691 | 6.555556 | 0.469136 | 0.07533 | 0.06403 | 0.079096 | 0.109228 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.143271 | 691 | 24 | 61 | 28.791667 | 0.896959 | 0 | 0 | 0 | 0 | 0 | 0.096961 | 0.079595 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.3125 | 0.125 | 0.9375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
d065e21c144884dd8623063877a016917ef4f78a | 994 | py | Python | app/mixins.py | msoedov/dpu-srv | 151ff4487fab7690a736bfd7f6dfa3782c8f3ac2 | [
"MIT"
] | null | null | null | app/mixins.py | msoedov/dpu-srv | 151ff4487fab7690a736bfd7f6dfa3782c8f3ac2 | [
"MIT"
] | null | null | null | app/mixins.py | msoedov/dpu-srv | 151ff4487fab7690a736bfd7f6dfa3782c8f3ac2 | [
"MIT"
] | null | null | null | from django.views.decorators.cache import cache_page
class GetCacheMixin:
"""
This mixin wraps CBS get into cache_page
"""
cache_timeout = 160
def get_cache_timeout(self):
return self.cache_timeout
def get(self, *args, **kwargs):
return cache_page(self.get_cache_timeout(), key_prefix="views")(super().get)(
*args, **kwargs
)
class PostCacheMixin:
"""
This mixin wraps CBS get into cache_page
"""
cache_timeout = 160
def get_cache_timeout(self):
return self.cache_timeout
def post(self, *args, **kwargs):
return cache_page(self.get_cache_timeout(), key_prefix="views")(super().post)(
*args, **kwargs
)
class BrowserCacheControl:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
response["Cache-Control"] = "max-age=600"
return response
| 22.590909 | 86 | 0.637827 | 119 | 994 | 5.067227 | 0.302521 | 0.159204 | 0.099502 | 0.056385 | 0.537313 | 0.537313 | 0.537313 | 0.537313 | 0.537313 | 0.537313 | 0 | 0.012129 | 0.253521 | 994 | 43 | 87 | 23.116279 | 0.800539 | 0.081489 | 0 | 0.333333 | 0 | 0 | 0.038549 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.041667 | 0.166667 | 0.708333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d077f719d8b09f3278afce4c89309f7d9fbcc646 | 495 | py | Python | ecomerce/config.py | AlexandruScrob/fast_api_proj_2 | 9aca5d48ab3e42933747b23ff04c6d4f3487d93e | [
"MIT"
] | null | null | null | ecomerce/config.py | AlexandruScrob/fast_api_proj_2 | 9aca5d48ab3e42933747b23ff04c6d4f3487d93e | [
"MIT"
] | null | null | null | ecomerce/config.py | AlexandruScrob/fast_api_proj_2 | 9aca5d48ab3e42933747b23ff04c6d4f3487d93e | [
"MIT"
] | null | null | null | import os
APP_ENV = os.getenv("APP_ENV", "development")
DATABASE_USERNAME = os.getenv("DATABASE_USERNAME", "postgres")
DATABASE_PASSWORD = os.getenv("DATABASE_PASSWORD", "admin")
DATABASE_HOST = os.getenv("DATABASE_HOST", "localhost")
DATABASE_NAME = os.getenv("DATABASE_NAME", "postgres")
TEST_DATABASE_NAME = os.getenv("TEST_DATABASE_NAME", "ecomerce_test")
REDIS_HOST = os.getenv("REDIS_HOST", "127.0.0.1")
REDIS_PORT = os.getenv("REDIS_PORT", "6379")
REDIS_DB = os.getenv("REDIS_DB", "0")
| 38.076923 | 69 | 0.749495 | 71 | 495 | 4.929577 | 0.323944 | 0.205714 | 0.182857 | 0.114286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024176 | 0.080808 | 495 | 12 | 70 | 41.25 | 0.745055 | 0 | 0 | 0 | 0 | 0 | 0.365657 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.1 | 0.1 | 0 | 0.1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
d08baac30f531fb144909ee42939bd0b06289d52 | 95 | py | Python | custom_components/hassio_info/const.py | tboyce021/hassio-info | ff7ceef3e9ba2ec5ec65e93c836866454e437c41 | [
"MIT"
] | null | null | null | custom_components/hassio_info/const.py | tboyce021/hassio-info | ff7ceef3e9ba2ec5ec65e93c836866454e437c41 | [
"MIT"
] | 4 | 2020-11-09T20:29:55.000Z | 2021-06-08T10:49:57.000Z | custom_components/hassio_info/const.py | tboyce021/hassio-info | ff7ceef3e9ba2ec5ec65e93c836866454e437c41 | [
"MIT"
] | 1 | 2020-10-29T15:41:51.000Z | 2020-10-29T15:41:51.000Z | """Constants for the Hassio Info integration."""
DOMAIN = "hassio_info"
TITLE = "Supervisor+"
| 19 | 48 | 0.715789 | 11 | 95 | 6.090909 | 0.818182 | 0.298507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136842 | 95 | 4 | 49 | 23.75 | 0.817073 | 0.442105 | 0 | 0 | 0 | 0 | 0.468085 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d08fcb9c33d89cd52eb7c75511f9d83fb3997987 | 129 | py | Python | manafa/tests/batterystats/test_batteryStatsService.py | greensoftwarelab/E-MANAFA | d0ccc01a821af5b02fdcb588a4d14ff56a26cd5d | [
"MIT"
] | null | null | null | manafa/tests/batterystats/test_batteryStatsService.py | greensoftwarelab/E-MANAFA | d0ccc01a821af5b02fdcb588a4d14ff56a26cd5d | [
"MIT"
] | null | null | null | manafa/tests/batterystats/test_batteryStatsService.py | greensoftwarelab/E-MANAFA | d0ccc01a821af5b02fdcb588a4d14ff56a26cd5d | [
"MIT"
] | null | null | null | from unittest import TestCase
class TestBatteryStatsService(TestCase):
def test_stop(self):
self.assertTrue(True)
| 16.125 | 40 | 0.744186 | 14 | 129 | 6.785714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186047 | 129 | 7 | 41 | 18.428571 | 0.904762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d0976c7529ffe4600b8f136c6eb338e521e79c17 | 5,665 | py | Python | app.py | pps-ti/computer-aided-diagnosys-system-prototype | d66f8561745853f5e61d928d8c2556f11adb3ecc | [
"CC0-1.0",
"0BSD"
] | null | null | null | app.py | pps-ti/computer-aided-diagnosys-system-prototype | d66f8561745853f5e61d928d8c2556f11adb3ecc | [
"CC0-1.0",
"0BSD"
] | null | null | null | app.py | pps-ti/computer-aided-diagnosys-system-prototype | d66f8561745853f5e61d928d8c2556f11adb3ecc | [
"CC0-1.0",
"0BSD"
] | null | null | null | # WEB FRAMEWORKS
from flask import Flask, render_template, redirect, request, url_for, session
# REFACTORED CODES
from src.db_storage.read import check_session, get_id_account, get_patients_data, data_users, user_dashboard, user_login
from src.db_storage.create import add_hospital_account, admin_add_new_user
from src.db_storage.delete import delete_session, delete_patient_data, delete_hospital_account
from src.db_storage.update import change_admin_pwd, change_patient_data, change_hospital_account, change_user_data, get_new_password, change_user_pwd
# FOR EMAIL SERVICES
from src.mail_services import send_email
# FOR DIAGNOSING
from src.model_serving.main_serve import diagnose_patient
# FLASK ROUTING AND SESSIONS
app = Flask(__name__)
app.secret_key = "rahasia"
# GENERAL - LANDING PAGE
@app.route('/')
def index():
return (check_session() if session else render_template("index.html"))
# GENERAL - LOGIN PAGE
@app.route('/login', methods=['GET', 'POST'])
def login():
return (redirect('/') if session else user_login())
# GENERAL - REGISTER PAGE
@app.route('/register', methods=['GET', 'POST'])
def register():
return (add_hospital_account() if request.method == 'POST' else render_template("auth/register.html"))
# GENERAL - LOG OUT
@app.route('/logout')
def logout():
return (redirect('/') if session and delete_session() else redirect('/'))
# ADMIN - DASHBOARD
@app.route('/admin/<id>')
def dashboard_admin(id):
return (render_template("admins/dashboard.html", id = get_id_account(id, sandi=True)) if session and id == session["admin"] else redirect('/'))
# ADMIN - CHANGE THE ADMIN PASSWORD
@app.route('/admin/<id>/changepwd', methods=['GET', 'POST'])
def change_pwd(id):
return (redirect('/') if session and id == session["admin"] and request.method == 'POST' and change_admin_pwd(id) else redirect('/'))
# ADMIN - SEE THE REGISTERED ACCOUNT
@app.route('/admin/<id>/registered_accounts', methods=['GET', 'POST'])
def registered_accounts(id):
return (render_template("admins/registered_accounts.html", id = get_id_account(id, sandi=True), data = data_users()) if session and id == session["admin"] else redirect('/'))
# ADMIN - ADD NEW ACCOUNT/USER
@app.route('/admin/<id>/add_new', methods=['GET', 'POST'])
def add_new_account(id):
return (admin_add_new_user(id) if session and id == session["admin"] else redirect('/'))
# ADMIN - SEE THE INACTIVE USER
@app.route('/admin/<id>/queue')
def queue_accounts(id):
return (render_template("admins/registered_accounts.html", id = get_id_account(id, sandi=True), data = data_users(verified='N')) if session and id == session["admin"] else redirect('/'))
# ADMIN - EDIT THE USER ACCOUNT
@app.route('/edit_user/<id>/<id_user>', methods=['GET', 'POST'])
def edit_user(id, id_user):
return (change_hospital_account(id, id_user) if session and id == session['admin'] else redirect('/'))
# ADMIN - DELETE THE USER ACCOUNT
@app.route('/delete_user/<id>/<id_user>')
def delete_user(id, id_user):
return (redirect('/') if session and id == session['admin'] and delete_hospital_account(id_user) else redirect('/'))
# USER - DASHBOARD
@app.route('/user/<id>', methods=['GET', 'POST'])
def dashboard_user(id):
return (user_dashboard(id) if session and id == session["user"] else redirect('/'))
# USER - GET NEW PASSWORD
@app.route('/reset-pwd', methods=['GET', 'POST'])
def reset_pwd():
return (get_new_password() if request.method == 'POST' else render_template("auth/forgot-password.html"))
# USER - RESET PASSWORD
@app.route('/reset-pwd/new-pwd', methods=['GET', 'POST'])
def new_pwd():
return (change_user_pwd() if request.method == 'POST' else render_template("auth/new_pwd.html"))
# USER - RESEND UNIQUE CODE TO ACTIVAE THE ACCOUNT
@app.route('/resend/<id>')
def resend(id):
if send_email("Activation Code", id=id): return redirect(url_for('dashboard_user', id=id))
# USER - SEND THE ISSUE THAT FOUND BY THE USER
@app.route('/complaint/<id>', methods=['GET', 'POST'])
def user_complaint(id):
return (redirect('/') if session and id == session['user'] and request.method == 'POST' and send_email('User complaint', id=id) else redirect('/'))
# USER - EDIT THE USER DATA
@app.route('/user_edit_data/<id>', methods=['GET', 'POST'])
def user_edit_data(id):
return (change_user_data(id) if session and id == session['user'] and request.method == 'POST' else redirect('/'))
# USER - DIAGNOSING
@app.route('/diagnose/<id>/', methods=['GET', 'POST'])
def diagnose(id):
return (diagnose_patient(id) if session and id == session['user'] else redirect('/'))
# USER - SEE THE DIAGNOSED PATIENTS
@app.route('/diagnosed/<id>/<disease>')
def diagnosed(id, disease):
return (render_template('users/diagnosed_list.html', id = get_id_account(id), data = get_patients_data(id, disease), disease = disease) if session and id == session['user'] else redirect('/'))
# USER - EDIT PATIENT DATA
@app.route('/edit_patient/<id>/<disease>/<id_patient>', methods=['GET', 'POST'])
def edit_patient(id, disease, id_patient):
return (change_patient_data(id, disease, id_patient) if session and id == session['user'] else redirect('/'))
# USER - DELETE PATIENT DATA
@app.route('/delete_patient/<id>/<disease>/<id_patient>')
def delete_patient(id, disease, id_patient):
return (redirect(url_for('diagnosed', id = id, disease = disease)) if session and id == session['user'] and delete_patient_data(id, disease, id_patient) else redirect('/'))
# ERROR HANDLERS
@app.errorhandler(404)
def page_not_found(e):
return render_template('error/404.html'), 404
@app.errorhandler(500)
def internal_server_error(e):
return render_template('error/500.html'), 500
#app.run(debug=True)
| 41.962963 | 194 | 0.721624 | 824 | 5,665 | 4.787621 | 0.139563 | 0.042586 | 0.045627 | 0.049683 | 0.432953 | 0.313561 | 0.248162 | 0.246895 | 0.190368 | 0.093283 | 0 | 0.003584 | 0.113327 | 5,665 | 134 | 195 | 42.276119 | 0.781804 | 0.124978 | 0 | 0 | 0 | 0 | 0.171875 | 0.070211 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294872 | false | 0.025641 | 0.089744 | 0.282051 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d0afc5dd38f26e49c163f05a009530fa16b4766f | 269 | py | Python | fastly/auth.py | JakeRoggenbuck/fastly-py | 3610d930adb17a57988f878e9b35db0b07e8aa66 | [
"MIT"
] | 59 | 2015-02-02T22:56:23.000Z | 2022-03-10T08:59:58.000Z | fastly/auth.py | JakeRoggenbuck/fastly-py | 3610d930adb17a57988f878e9b35db0b07e8aa66 | [
"MIT"
] | 44 | 2015-03-27T19:20:54.000Z | 2022-03-10T14:24:44.000Z | fastly/auth.py | JakeRoggenbuck/fastly-py | 3610d930adb17a57988f878e9b35db0b07e8aa66 | [
"MIT"
] | 49 | 2015-04-10T21:25:35.000Z | 2022-03-23T08:32:05.000Z | """
"""
from __future__ import absolute_import
from six.moves.urllib.parse import urlencode
import warnings
class KeyAuthenticator(object):
def __init__(self, key):
self.key = key
def add_auth(self, headers):
headers['Fastly-Key'] = self.key
| 19.214286 | 44 | 0.695167 | 34 | 269 | 5.205882 | 0.617647 | 0.118644 | 0.112994 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.197026 | 269 | 13 | 45 | 20.692308 | 0.819444 | 0 | 0 | 0 | 0 | 0 | 0.038168 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.375 | 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 | 1 | 0 | 1 | 0 | 0 | 3 |
d0cfbdb0a391606a9038c01ba04d418e03b9c7a9 | 670 | py | Python | src/halomod/__init__.py | sjforeman/halomod | 587db6bc71a77ea60a541b306fc3601eeb424bc9 | [
"MIT"
] | null | null | null | src/halomod/__init__.py | sjforeman/halomod | 587db6bc71a77ea60a541b306fc3601eeb424bc9 | [
"MIT"
] | null | null | null | src/halomod/__init__.py | sjforeman/halomod | 587db6bc71a77ea60a541b306fc3601eeb424bc9 | [
"MIT"
] | null | null | null | try:
from importlib.metadata import version, PackageNotFoundError
except ImportError:
from importlib_metadata import version, PackageNotFoundError
try:
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed
pass
from . import halo_model
from . import bias
from . import concentration
from . import cross_correlations
from . import functional
from . import halo_exclusion
from . import hod
from . import integrate_corr
from . import profiles
from . import tools
from . import wdm
from .halo_model import HaloModel, DMHaloModel, TracerHaloModel
from .integrate_corr import ProjectedCF, AngularCF, projected_corr_gal
| 25.769231 | 70 | 0.802985 | 79 | 670 | 6.594937 | 0.455696 | 0.211132 | 0.080614 | 0.103647 | 0.207294 | 0.207294 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155224 | 670 | 25 | 71 | 26.8 | 0.920495 | 0.035821 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.047619 | 0.761905 | 0 | 0.761905 | 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 | 1 | 0 | 0 | 3 |
efb504090026afebe849482fa8ef70e51843d137 | 5,116 | py | Python | castledice/playermat/migrations/0001_initial.py | Karins-Coils/CastleDice | 66397b1d50da89aaf1ba69ea33bc58e0eba43d73 | [
"MIT"
] | 2 | 2015-09-17T16:36:27.000Z | 2015-09-17T17:01:03.000Z | castledice/playermat/migrations/0001_initial.py | Karins-Coils/CastleDice | 66397b1d50da89aaf1ba69ea33bc58e0eba43d73 | [
"MIT"
] | 9 | 2019-12-04T21:49:50.000Z | 2021-10-02T09:08:01.000Z | castledice/playermat/migrations/0001_initial.py | khawley/CastleDice | 66397b1d50da89aaf1ba69ea33bc58e0eba43d73 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import annoying.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("game", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="PlayerBuilt",
fields=[
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
("card", models.CharField(max_length=52)),
("count", models.PositiveSmallIntegerField(default=1)),
(
"adds_animal",
models.CharField(
max_length=16,
choices=[
(b"pig", b"pig"),
(b"horse", b"horse"),
(b"chicken", b"chicken"),
(b"cow", b"cow"),
(b"", b""),
],
),
),
],
),
migrations.CreateModel(
name="PlayerMat",
fields=[
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
("victory_points", models.PositiveSmallIntegerField(default=0)),
("player_hand", annoying.fields.JSONField(null=True, blank=True)),
(
"player_merchant_hand",
annoying.fields.JSONField(null=True, blank=True),
),
("player_order", models.PositiveSmallIntegerField(default=0)),
("has_porkchopped", models.BooleanField(default=False)),
("has_first_gathered", models.BooleanField(default=False)),
("choice_dice", annoying.fields.JSONField(null=True, blank=True)),
("horses", models.PositiveSmallIntegerField(default=0)),
("pigs", models.PositiveSmallIntegerField(default=0)),
("cows", models.PositiveSmallIntegerField(default=0)),
("chickens", models.PositiveSmallIntegerField(default=0)),
("wood", models.PositiveSmallIntegerField(default=0)),
("stone", models.PositiveSmallIntegerField(default=0)),
("gold", models.PositiveSmallIntegerField(default=0)),
("land", models.PositiveSmallIntegerField(default=0)),
("iron", models.PositiveSmallIntegerField(default=0)),
("merchants", models.PositiveSmallIntegerField(default=0)),
("farmers", models.PositiveSmallIntegerField(default=0)),
("game", models.ForeignKey(to="game.Game", on_delete=models.CASCADE)),
(
"player",
models.ForeignKey(
to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE
),
),
],
),
migrations.CreateModel(
name="PlayerMatResourcePeople",
fields=[
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
(
"type",
models.CharField(
max_length=12,
choices=[
(b"guard", b"guard"),
(b"worker", b"worker"),
(b"barbarian", b"barbarian"),
],
),
),
("total", models.PositiveSmallIntegerField(default=0)),
("wood", models.PositiveSmallIntegerField(default=0)),
("stone", models.PositiveSmallIntegerField(default=0)),
("gold", models.PositiveSmallIntegerField(default=0)),
("land", models.PositiveSmallIntegerField(default=0)),
("iron", models.PositiveSmallIntegerField(default=0)),
(
"player_mat",
models.ForeignKey(
to="playermat.PlayerMat", on_delete=models.CASCADE
),
),
],
),
migrations.AddField(
model_name="playerbuilt",
name="player_mat",
field=models.ForeignKey(to="playermat.PlayerMat", on_delete=models.CASCADE),
),
]
| 39.053435 | 88 | 0.44527 | 340 | 5,116 | 6.582353 | 0.302941 | 0.277033 | 0.339589 | 0.331099 | 0.488382 | 0.447274 | 0.447274 | 0.429401 | 0.429401 | 0.33378 | 0 | 0.010885 | 0.443315 | 5,116 | 130 | 89 | 39.353846 | 0.77493 | 0.004105 | 0 | 0.516129 | 0 | 0 | 0.087375 | 0.004516 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.032258 | 0 | 0.056452 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
efbf65f7fab92ec0f8c78213a8e93c0e80213f4f | 814 | py | Python | src/py/lander/lib/controller.py | claymation/lander | 8c0fe715a8b32f2f580ecb30aaebf4c7d007a906 | [
"MIT"
] | 5 | 2016-10-15T15:35:06.000Z | 2020-11-10T14:25:48.000Z | src/py/lander/lib/controller.py | claymation/lander | 8c0fe715a8b32f2f580ecb30aaebf4c7d007a906 | [
"MIT"
] | null | null | null | src/py/lander/lib/controller.py | claymation/lander | 8c0fe715a8b32f2f580ecb30aaebf4c7d007a906 | [
"MIT"
] | 5 | 2017-03-03T15:49:18.000Z | 2020-12-29T20:48:34.000Z | #!/usr/bin/env python
# vim: set ts=4 sw=4 et:
class Controller(object):
"""
Encapsulates the control logic for each stage of flight
within its own controller class.
"""
def __init__(self, commander, vehicle):
self.commander = commander
self.vehicle = vehicle
def enter(self):
"""
Called by the commander when transitioning to this state.
"""
pass
def exit(self):
"""
Called by the commander when transitioning from this state.
"""
pass
def run(self):
"""
Called by the commander once per control loop.
"""
pass
def handle_track_message(self, msg):
"""
Called by the commander when it receives a TrackStamped message.
"""
pass
| 21.421053 | 72 | 0.570025 | 94 | 814 | 4.87234 | 0.56383 | 0.069869 | 0.09607 | 0.174672 | 0.283843 | 0.179039 | 0.179039 | 0 | 0 | 0 | 0 | 0.003745 | 0.34398 | 814 | 37 | 73 | 22 | 0.853933 | 0.444717 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0.333333 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
efd31195cb11930d566f8702ad5b95f9d60ad164 | 26,686 | py | Python | template_container_human/labels/slice_161.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | template_container_human/labels/slice_161.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | template_container_human/labels/slice_161.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | coordinates_E0E1E1 = ((126, 114),
(126, 116), (126, 117), (126, 118), (127, 114), (127, 120), (128, 114), (128, 115), (128, 119), (128, 121), (129, 105), (129, 108), (129, 115), (129, 120), (129, 121), (130, 101), (130, 103), (130, 104), (130, 109), (130, 120), (130, 121), (131, 101), (131, 105), (131, 106), (131, 107), (131, 108), (131, 110), (131, 119), (131, 120), (131, 122), (132, 101), (132, 103), (132, 104), (132, 105), (132, 106), (132, 107), (132, 108), (132, 109), (132, 111), (132, 119), (132, 122), (133, 101), (133, 103), (133, 104), (133, 105), (133, 106), (133, 107), (133, 108), (133, 110), (133, 118), (133, 121), (133, 132), (133, 134), (134, 101), (134, 103), (134, 104), (134, 105), (134, 106), (134, 107), (134, 108), (134, 110), (134, 117), (134, 119), (134, 121), (134, 132), (134, 135), (135, 101), (135, 103), (135, 104), (135, 105), (135, 106), (135, 107), (135, 108),
(135, 110), (135, 116), (135, 120), (135, 121), (135, 132), (135, 135), (136, 101), (136, 103), (136, 104), (136, 105), (136, 106), (136, 107), (136, 108), (136, 109), (136, 110), (136, 111), (136, 112), (136, 114), (136, 121), (136, 122), (136, 132), (136, 134), (137, 101), (137, 103), (137, 104), (137, 105), (137, 106), (137, 107), (137, 108), (137, 109), (137, 110), (137, 113), (137, 122), (137, 123), (137, 132), (138, 101), (138, 103), (138, 104), (138, 105), (138, 106), (138, 107), (138, 108), (138, 109), (138, 110), (138, 111), (138, 113), (138, 122), (138, 124), (138, 130), (139, 101), (139, 103), (139, 104), (139, 105), (139, 106), (139, 107), (139, 108), (139, 109), (139, 110), (139, 111), (139, 113), (139, 123), (139, 126), (139, 127), (139, 129), (140, 101), (140, 102), (140, 103), (140, 104), (140, 105), (140, 106), (140, 107), (140, 108),
(140, 109), (140, 110), (140, 111), (140, 112), (140, 114), (140, 116), (140, 123), (140, 128), (141, 102), (141, 104), (141, 105), (141, 106), (141, 107), (141, 108), (141, 109), (141, 113), (141, 115), (141, 124), (141, 126), (141, 128), (142, 102), (142, 104), (142, 105), (142, 106), (142, 107), (142, 108), (142, 111), (142, 112), (142, 124), (142, 126), (142, 128), (143, 102), (143, 104), (143, 105), (143, 106), (143, 107), (143, 109), (143, 124), (143, 126), (143, 128), (143, 140), (144, 102), (144, 104), (144, 105), (144, 106), (144, 108), (144, 109), (144, 123), (144, 129), (144, 133), (144, 134), (144, 135), (144, 136), (144, 137), (144, 138), (144, 140), (145, 103), (145, 105), (145, 106), (145, 108), (145, 120), (145, 122), (145, 123), (145, 124), (145, 125), (145, 126), (145, 128), (145, 131), (145, 132), (145, 134), (145, 139), (145, 140),
(146, 103), (146, 105), (146, 106), (146, 108), (146, 128), (146, 133), (146, 140), (147, 104), (147, 106), (147, 108), (147, 128), (147, 130), (147, 132), (148, 105), (148, 108), (148, 128), (148, 131), (149, 106), (149, 109), (149, 128), (149, 130), (150, 107), (150, 110), (150, 127), (150, 130), (151, 108), (151, 112), (151, 128), (151, 130), (152, 109), (152, 112), (152, 113), (152, 114), (152, 115), (152, 117), (152, 129), (152, 131), (153, 110), (153, 116), (153, 117), (153, 131), (153, 133), (153, 135), (154, 117), (154, 133), (154, 135), (155, 117), (155, 133), (156, 133), (157, 133), (159, 123), )
coordinates_E1E1E1 = ((86, 128),
(87, 128), (88, 125), (88, 127), (89, 125), (89, 127), (90, 126), (90, 127), (91, 126), (91, 127), (91, 135), (92, 127), (93, 127), (94, 102), (94, 120), (94, 127), (94, 137), (94, 138), (95, 101), (95, 102), (95, 104), (95, 115), (95, 117), (95, 118), (95, 127), (95, 128), (95, 136), (95, 140), (96, 105), (96, 116), (96, 120), (96, 127), (96, 136), (96, 138), (96, 140), (97, 105), (97, 106), (97, 117), (97, 119), (97, 127), (97, 136), (97, 138), (97, 139), (97, 141), (98, 105), (98, 106), (98, 117), (98, 119), (98, 126), (98, 127), (98, 136), (98, 138), (98, 139), (98, 141), (99, 105), (99, 117), (99, 118), (99, 135), (99, 142), (100, 105), (100, 117), (100, 119), (100, 134), (100, 136), (100, 137), (100, 138), (100, 139), (100, 140), (101, 105), (101, 106), (101, 116), (101, 118), (101, 120),
(101, 133), (102, 104), (102, 106), (102, 115), (102, 117), (102, 118), (102, 119), (102, 122), (102, 132), (103, 104), (103, 106), (103, 115), (103, 117), (103, 118), (103, 119), (103, 121), (103, 132), (104, 103), (104, 106), (104, 114), (104, 116), (104, 117), (104, 118), (104, 119), (104, 121), (104, 129), (104, 131), (105, 103), (105, 106), (105, 114), (105, 116), (105, 117), (105, 118), (105, 119), (105, 120), (105, 122), (105, 128), (105, 130), (106, 103), (106, 106), (106, 115), (106, 117), (106, 118), (106, 119), (106, 120), (106, 122), (106, 126), (106, 130), (107, 103), (107, 106), (107, 115), (107, 117), (107, 118), (107, 119), (107, 120), (107, 121), (107, 122), (107, 124), (107, 125), (107, 128), (107, 130), (108, 103), (108, 105), (108, 115), (108, 117), (108, 118), (108, 119), (108, 120), (108, 121), (108, 122), (108, 127), (108, 128),
(108, 130), (109, 102), (109, 104), (109, 115), (109, 117), (109, 118), (109, 119), (109, 120), (109, 121), (109, 122), (109, 125), (109, 126), (109, 129), (109, 131), (109, 136), (109, 138), (110, 102), (110, 103), (110, 114), (110, 116), (110, 117), (110, 118), (110, 119), (110, 120), (110, 121), (110, 124), (110, 125), (110, 126), (110, 127), (110, 133), (110, 134), (110, 135), (111, 103), (111, 114), (111, 116), (111, 117), (111, 118), (111, 119), (111, 120), (111, 122), (111, 129), (111, 131), (111, 132), (111, 133), (111, 134), (111, 136), (112, 101), (112, 103), (112, 113), (112, 115), (112, 118), (112, 119), (112, 121), (112, 135), (112, 136), (113, 103), (113, 108), (113, 110), (113, 111), (113, 112), (113, 117), (113, 119), (113, 121), (113, 136), (114, 101), (114, 105), (114, 106), (114, 107), (114, 108), (114, 109), (114, 118), (114, 120),
(114, 136), (115, 102), (115, 104), (115, 105), (115, 119), (115, 120), (115, 136), (115, 137), (116, 119), (116, 120), (116, 136), (116, 137), (117, 117), (117, 118), (117, 120), (117, 136), (117, 138), (118, 115), (118, 116), (118, 119), (118, 136), (119, 112), (119, 113), (119, 117), (119, 119), (120, 111), )
coordinates_60CC60 = ((94, 159),
(95, 158), (95, 159), (96, 152), (96, 157), (96, 159), (97, 152), (97, 156), (97, 158), (97, 160), (98, 152), (98, 156), (98, 157), (98, 158), (98, 160), (99, 149), (99, 152), (99, 156), (99, 157), (99, 158), (99, 159), (99, 161), (100, 149), (100, 151), (100, 152), (100, 153), (100, 155), (100, 156), (100, 157), (100, 158), (100, 159), (100, 160), (100, 162), (101, 149), (101, 151), (101, 152), (101, 153), (101, 154), (101, 155), (101, 156), (101, 157), (101, 158), (101, 159), (101, 160), (101, 162), (102, 149), (102, 151), (102, 152), (102, 153), (102, 154), (102, 155), (102, 156), (102, 157), (102, 158), (102, 159), (102, 160), (102, 162), (103, 148), (103, 150), (103, 151), (103, 152), (103, 153), (103, 154), (103, 155), (103, 156), (103, 157), (103, 158), (103, 159), (103, 160), (103, 162), (104, 148), (104, 150), (104, 151),
(104, 152), (104, 153), (104, 154), (104, 155), (104, 156), (104, 157), (104, 158), (104, 159), (104, 160), (104, 162), (105, 148), (105, 150), (105, 151), (105, 152), (105, 153), (105, 154), (105, 155), (105, 156), (105, 157), (105, 158), (105, 159), (105, 160), (105, 162), (106, 148), (106, 150), (106, 151), (106, 152), (106, 153), (106, 154), (106, 155), (106, 156), (106, 157), (106, 158), (106, 159), (106, 160), (106, 162), (107, 148), (107, 150), (107, 151), (107, 152), (107, 153), (107, 154), (107, 155), (107, 156), (107, 157), (107, 158), (107, 159), (107, 160), (107, 161), (107, 163), (108, 147), (108, 149), (108, 150), (108, 151), (108, 152), (108, 153), (108, 154), (108, 155), (108, 156), (108, 157), (108, 158), (108, 159), (108, 160), (108, 161), (108, 163), (109, 147), (109, 149), (109, 150), (109, 151), (109, 152), (109, 153), (109, 154),
(109, 155), (109, 156), (109, 157), (109, 158), (109, 159), (109, 160), (109, 161), (109, 163), (110, 147), (110, 149), (110, 150), (110, 151), (110, 152), (110, 153), (110, 154), (110, 155), (110, 156), (110, 157), (110, 158), (110, 159), (110, 160), (110, 161), (110, 163), (111, 147), (111, 149), (111, 150), (111, 151), (111, 152), (111, 153), (111, 154), (111, 155), (111, 156), (111, 157), (111, 158), (111, 159), (111, 160), (111, 161), (111, 163), (112, 146), (112, 147), (112, 149), (112, 150), (112, 151), (112, 152), (112, 153), (112, 154), (112, 155), (112, 156), (112, 157), (112, 158), (112, 159), (112, 160), (112, 161), (112, 163), (113, 146), (113, 148), (113, 149), (113, 150), (113, 151), (113, 152), (113, 153), (113, 154), (113, 155), (113, 156), (113, 157), (113, 158), (113, 159), (113, 160), (113, 161), (113, 163), (114, 145), (114, 147),
(114, 148), (114, 149), (114, 150), (114, 151), (114, 152), (114, 153), (114, 154), (114, 155), (114, 156), (114, 157), (114, 158), (114, 159), (114, 160), (114, 162), (115, 145), (115, 147), (115, 148), (115, 149), (115, 150), (115, 151), (115, 152), (115, 153), (115, 154), (115, 155), (115, 156), (115, 157), (115, 158), (115, 159), (115, 160), (115, 162), (116, 145), (116, 147), (116, 148), (116, 149), (116, 150), (116, 151), (116, 152), (116, 153), (116, 154), (116, 155), (116, 156), (116, 157), (116, 158), (116, 159), (116, 160), (117, 145), (117, 147), (117, 148), (117, 149), (117, 150), (117, 151), (117, 152), (117, 153), (117, 154), (117, 155), (117, 156), (117, 157), (117, 158), (117, 159), (117, 161), (118, 145), (118, 147), (118, 148), (118, 149), (118, 150), (118, 151), (118, 152), (118, 153), (118, 154), (118, 155), (118, 156), (118, 157),
(118, 158), (118, 160), (119, 146), (119, 147), (119, 148), (119, 149), (119, 150), (119, 151), (119, 152), (119, 153), (119, 154), (119, 155), (119, 156), (119, 157), (119, 159), (120, 146), (120, 150), (120, 151), (120, 152), (120, 153), (120, 154), (120, 155), (120, 156), (120, 158), (121, 147), (121, 155), (121, 157), (122, 150), (122, 151), (122, 153), (122, 154), (122, 157), (123, 156), )
coordinates_5FCC60 = ((130, 149),
(130, 151), (130, 152), (130, 153), (130, 154), (130, 156), (131, 148), (131, 158), (132, 147), (132, 149), (132, 150), (132, 151), (132, 152), (132, 153), (132, 154), (132, 155), (132, 156), (133, 147), (133, 149), (133, 150), (133, 151), (133, 152), (133, 153), (133, 154), (133, 155), (133, 156), (133, 157), (133, 159), (134, 146), (134, 148), (134, 149), (134, 150), (134, 151), (134, 152), (134, 153), (134, 154), (134, 155), (134, 156), (134, 157), (134, 158), (134, 160), (135, 146), (135, 148), (135, 149), (135, 150), (135, 151), (135, 152), (135, 153), (135, 154), (135, 155), (135, 156), (135, 157), (135, 158), (135, 160), (136, 145), (136, 147), (136, 148), (136, 149), (136, 150), (136, 151), (136, 152), (136, 153), (136, 154), (136, 155), (136, 156), (136, 157), (136, 158), (136, 159), (136, 161), (137, 145), (137, 147), (137, 148), (137, 149),
(137, 150), (137, 151), (137, 152), (137, 153), (137, 154), (137, 155), (137, 156), (137, 157), (137, 158), (137, 159), (137, 161), (138, 145), (138, 147), (138, 148), (138, 149), (138, 150), (138, 151), (138, 152), (138, 153), (138, 154), (138, 155), (138, 156), (138, 157), (138, 158), (138, 159), (138, 161), (139, 145), (139, 146), (139, 147), (139, 148), (139, 149), (139, 150), (139, 151), (139, 152), (139, 153), (139, 154), (139, 155), (139, 156), (139, 157), (139, 158), (139, 159), (139, 161), (140, 146), (140, 148), (140, 149), (140, 150), (140, 151), (140, 152), (140, 153), (140, 154), (140, 155), (140, 156), (140, 157), (140, 158), (140, 159), (140, 160), (140, 161), (140, 162), (141, 146), (141, 148), (141, 149), (141, 150), (141, 151), (141, 152), (141, 153), (141, 154), (141, 155), (141, 156), (141, 157), (141, 158), (141, 159), (141, 161),
(142, 147), (142, 149), (142, 150), (142, 151), (142, 152), (142, 153), (142, 154), (142, 155), (142, 156), (142, 157), (142, 158), (142, 159), (142, 161), (143, 147), (143, 149), (143, 150), (143, 151), (143, 152), (143, 153), (143, 154), (143, 155), (143, 156), (143, 157), (143, 158), (143, 159), (143, 161), (144, 148), (144, 150), (144, 151), (144, 152), (144, 153), (144, 154), (144, 155), (144, 156), (144, 157), (144, 158), (144, 160), (145, 147), (145, 149), (145, 150), (145, 151), (145, 152), (145, 153), (145, 154), (145, 155), (145, 156), (145, 157), (145, 159), (146, 148), (146, 150), (146, 151), (146, 152), (146, 153), (146, 154), (146, 155), (146, 156), (146, 158), (147, 149), (147, 154), (147, 155), (147, 156), (147, 158), (148, 150), (148, 152), (148, 156), (148, 158), (149, 154), (149, 157), (150, 157), (151, 150), (152, 150), )
coordinates_F4DEB3 = ((141, 92),
(142, 93), (142, 95), (142, 97), (143, 97), (144, 94), (144, 96), (145, 95), (145, 96), (146, 96), )
coordinates_26408B = ((132, 91),
(132, 93), (133, 91), (133, 94), (134, 91), (134, 93), (134, 95), (135, 91), (135, 93), (135, 95), (136, 91), (136, 93), (136, 95), (137, 91), (137, 93), (137, 95), (138, 91), (138, 95), (139, 91), (139, 93), (139, 94), (139, 96), (140, 95), (140, 97), )
coordinates_F5DEB3 = ((93, 101),
(94, 98), (94, 100), (95, 97), (95, 99), (96, 99), (97, 96), (97, 98), (98, 95), (98, 97), (99, 95), (99, 96), (100, 94), (100, 95), (101, 94), (101, 95), (102, 93), (102, 94), (103, 93), (103, 94), (104, 93), (105, 92), (106, 92), (107, 92), (108, 91), (109, 91), )
coordinates_016400 = ((125, 132),
(125, 136), (126, 132), (126, 134), (126, 135), (126, 137), (127, 132), (127, 138), (128, 132), (128, 134), (128, 135), (128, 136), (128, 137), (128, 139), (129, 132), (129, 134), (129, 135), (129, 136), (129, 137), (129, 138), (129, 140), (130, 132), (130, 135), (130, 136), (130, 137), (130, 138), (130, 139), (130, 141), (131, 132), (131, 134), (131, 137), (131, 138), (131, 139), (131, 141), (132, 136), (132, 137), (132, 138), (132, 139), (132, 141), (133, 137), (133, 139), (133, 141), (134, 137), (134, 139), (134, 141), (135, 137), (135, 139), (135, 141), (136, 137), (136, 139), (136, 141), (137, 136), (137, 138), (137, 141), (138, 134), (138, 139), (139, 131), (139, 132), (139, 133), (139, 136), (139, 138), (140, 134), )
coordinates_27408B = ((97, 101),
(98, 99), (98, 101), (99, 98), (99, 100), (100, 98), (101, 97), (101, 99), (102, 97), (102, 98), (103, 96), (103, 98), (104, 96), (104, 98), (109, 93), (110, 93), (111, 92), (111, 93), (112, 92), (112, 93), (113, 91), (113, 94), (114, 91), (114, 93), )
coordinates_006400 = ((105, 133),
(105, 135), (105, 136), (106, 132), (106, 137), (106, 139), (107, 132), (107, 135), (107, 136), (107, 137), (107, 140), (107, 141), (107, 142), (108, 133), (108, 139), (108, 143), (108, 145), (109, 140), (109, 142), (109, 145), (110, 140), (110, 143), (110, 145), (111, 139), (111, 140), (111, 143), (111, 145), (112, 138), (112, 140), (112, 141), (112, 142), (112, 144), (113, 129), (113, 131), (113, 132), (113, 134), (113, 138), (113, 140), (113, 144), (114, 129), (114, 134), (114, 139), (114, 140), (114, 141), (114, 143), (115, 128), (115, 129), (115, 130), (115, 131), (115, 132), (115, 134), (115, 139), (115, 141), (115, 143), (116, 128), (116, 130), (116, 131), (116, 132), (116, 134), (116, 140), (116, 143), (117, 128), (117, 130), (117, 131), (117, 132), (117, 134), (117, 140), (117, 142), (118, 127), (118, 129), (118, 130), (118, 131), (118, 132),
(118, 134), (118, 139), (118, 141), (119, 127), (119, 129), (119, 130), (119, 131), (119, 132), (119, 134), (119, 138), (119, 141), (120, 127), (120, 129), (120, 130), (120, 131), (120, 132), (120, 133), (120, 134), (120, 137), (120, 141), (121, 127), (121, 129), (121, 130), (121, 131), (121, 132), (121, 133), (121, 134), (121, 135), (122, 127), (122, 138), (123, 127), (123, 129), (123, 130), (123, 131), (123, 132), (123, 133), (123, 134), (123, 135), (123, 137), )
coordinates_CD5B45 = ((89, 100),
(90, 100), (90, 101), (91, 100), (91, 101), )
coordinates_6395ED = ((125, 128),
(125, 130), (126, 128), (126, 130), (127, 128), (127, 130), (128, 127), (128, 130), (129, 127), (129, 130), (130, 126), (130, 128), (130, 130), (131, 124), (131, 127), (131, 128), (131, 130), (132, 124), (132, 126), (132, 127), (132, 128), (132, 130), (133, 123), (133, 124), (133, 125), (133, 126), (133, 127), (133, 128), (133, 130), (134, 123), (134, 125), (134, 126), (134, 127), (134, 128), (134, 130), (135, 124), (135, 126), (135, 127), (135, 128), (135, 130), (136, 125), (136, 130), (137, 126), (137, 128), )
coordinates_00FFFE = ((138, 142),
(138, 143), (139, 141), (139, 143), (140, 140), (140, 142), (140, 144), (141, 136), (141, 138), (141, 139), (141, 140), (141, 141), (141, 142), (141, 144), (142, 136), (142, 138), (142, 142), (142, 144), (143, 142), (143, 144), (143, 145), (144, 142), (144, 144), (145, 142), (145, 144), (146, 142), (146, 144), (147, 138), (147, 142), (147, 144), (148, 139), (148, 142), (148, 144), (149, 139), (149, 141), (149, 142), (149, 144), (150, 140), (150, 141), (150, 142), (150, 144), (151, 140), (151, 142), (151, 144), (152, 141), (152, 144), (153, 141), (153, 144), (154, 143), )
coordinates_F98072 = ((124, 114),
(124, 115), (124, 116), (124, 117), (124, 118), (125, 107), (125, 109), (125, 110), (125, 112), (125, 120), (125, 122), (125, 123), (125, 124), (125, 126), (126, 105), (126, 112), (126, 122), (126, 126), (127, 100), (127, 103), (127, 104), (127, 105), (127, 106), (127, 107), (127, 108), (127, 110), (127, 112), (127, 123), (127, 125), (128, 100), (128, 102), (128, 112), (128, 123), (128, 125), (129, 110), (129, 112), (129, 117), (129, 123), (129, 124), (130, 113), (130, 116), (130, 118), (131, 115), (131, 117), (132, 114), (132, 116), (133, 113), (133, 115), (134, 112), (134, 114), )
coordinates_97FB98 = ((141, 132),
(142, 130), (142, 132), (142, 134), (143, 131), (146, 136), (147, 134), (147, 136), (148, 133), (148, 136), (149, 135), (149, 137), (150, 132), (150, 137), (151, 134), (151, 135), (151, 136), (151, 138), (152, 137), (152, 138), (153, 137), (153, 139), (154, 137), (154, 140), (155, 131), (155, 137), (155, 139), (155, 142), (156, 130), (156, 131), (156, 136), (156, 138), (156, 139), (156, 140), (156, 142), (157, 130), (157, 131), (157, 135), (157, 137), (157, 138), (157, 139), (157, 140), (157, 142), (158, 130), (158, 131), (158, 134), (158, 136), (158, 137), (158, 138), (158, 139), (158, 140), (158, 141), (159, 129), (159, 131), (159, 134), (159, 136), (159, 137), (159, 138), (159, 139), (159, 140), (159, 142), (160, 129), (160, 131), (160, 132), (160, 134), (160, 135), (160, 136), (160, 137), (160, 138), (160, 139), (160, 141), (161, 129), (161, 131),
(161, 134), (161, 140), (162, 129), (162, 131), (162, 132), (162, 133), (162, 138), (162, 139), (163, 129), (163, 134), (163, 135), (164, 129), (164, 131), (164, 133), )
coordinates_323287 = ((154, 129),
(155, 119), (155, 121), (155, 122), (155, 123), (155, 124), (155, 125), (155, 126), (155, 129), (156, 118), (156, 128), (157, 110), (157, 112), (157, 113), (157, 114), (157, 115), (157, 116), (157, 119), (157, 120), (157, 122), (157, 125), (157, 127), (158, 110), (158, 118), (158, 119), (158, 121), (158, 125), (158, 127), (159, 110), (159, 112), (159, 113), (159, 114), (159, 115), (159, 116), (159, 117), (159, 118), (159, 119), (159, 125), (159, 127), (160, 112), (160, 113), (160, 114), (160, 116), (160, 117), (160, 119), (160, 124), (160, 127), (161, 111), (161, 115), (161, 117), (161, 118), (161, 119), (161, 120), (161, 121), (161, 122), (161, 125), (161, 127), (162, 112), (162, 118), (162, 119), (162, 120), (162, 123), (162, 124), (162, 127), (163, 117), (163, 122), (163, 125), (163, 126), (164, 118), (164, 120), (164, 121), )
coordinates_6495ED = ((112, 124),
(112, 127), (113, 123), (113, 127), (114, 123), (114, 125), (114, 127), (115, 122), (115, 124), (115, 126), (116, 122), (116, 124), (116, 126), (117, 122), (117, 125), (118, 122), (118, 125), (119, 122), (119, 125), (120, 125), (121, 123), (121, 125), (122, 124), (122, 125), )
coordinates_01FFFF = ((101, 142),
(102, 137), (102, 140), (102, 141), (102, 144), (102, 146), (103, 134), (103, 136), (103, 137), (103, 142), (103, 143), (103, 146), (104, 138), (104, 139), (104, 140), (104, 144), (104, 146), (105, 141), (105, 143), (105, 146), (106, 144), (106, 146), )
coordinates_FA8072 = ((97, 103),
(98, 103), (99, 102), (99, 103), (100, 102), (100, 103), (101, 101), (101, 102), (102, 101), (102, 102), (103, 100), (103, 101), (104, 100), (104, 101), (105, 100), (105, 101), (106, 99), (106, 101), (107, 99), (108, 99), (108, 100), (109, 99), (109, 100), (110, 98), (110, 100), (111, 98), (111, 99), (112, 98), (112, 99), (113, 98), (114, 98), (115, 98), (115, 99), (115, 111), (115, 112), (115, 113), (115, 114), (115, 116), (115, 117), (116, 98), (116, 107), (116, 108), (116, 109), (116, 110), (116, 114), (116, 115), (116, 116), (117, 98), (117, 102), (117, 103), (117, 104), (117, 105), (117, 106), (117, 112), (117, 113), (118, 99), (118, 101), (118, 107), (118, 108), (118, 110), (119, 102), (119, 103), (119, 104), (119, 105), (119, 109), (120, 106), (120, 107), (120, 109), (120, 120), (121, 109), (121, 113), (121, 114), (121, 116),
(121, 119), (121, 121), (122, 110), (122, 112), (122, 113), (122, 114), (122, 115), (122, 116), (122, 117), (122, 118), (122, 119), (122, 121), )
coordinates_98FB98 = ((85, 136),
(85, 137), (86, 134), (86, 138), (86, 143), (87, 133), (87, 136), (87, 138), (87, 143), (87, 145), (88, 132), (88, 137), (88, 139), (88, 142), (88, 146), (89, 132), (89, 134), (89, 137), (89, 139), (89, 142), (89, 144), (89, 146), (90, 132), (90, 133), (90, 137), (90, 139), (90, 142), (90, 143), (90, 144), (90, 145), (90, 147), (91, 132), (91, 133), (91, 137), (91, 142), (91, 143), (91, 144), (91, 145), (91, 147), (92, 132), (92, 134), (92, 137), (92, 139), (92, 141), (92, 142), (92, 143), (92, 144), (92, 145), (92, 147), (93, 133), (93, 135), (93, 140), (93, 142), (93, 143), (93, 144), (93, 145), (93, 147), (94, 133), (94, 134), (94, 141), (94, 143), (94, 144), (94, 145), (94, 147), (95, 133), (95, 134), (95, 142), (95, 144), (95, 145), (95, 147), (96, 134), (96, 143), (96, 145),
(96, 147), (97, 134), (97, 143), (97, 145), (97, 147), (98, 133), (98, 147), (99, 132), (99, 144), (99, 147), (100, 131), (100, 147), )
coordinates_FEC0CB = ((130, 98),
(130, 99), (131, 98), (131, 99), (132, 98), (132, 99), (133, 98), (133, 99), (134, 98), (134, 99), (135, 99), (136, 99), (137, 99), (137, 116), (137, 118), (137, 119), (137, 120), (138, 99), (138, 115), (138, 120), (139, 99), (139, 118), (139, 121), (140, 99), (140, 119), (140, 121), (141, 99), (141, 118), (141, 119), (141, 121), (142, 99), (142, 100), (142, 117), (143, 99), (143, 100), (143, 115), (143, 118), (143, 119), (143, 121), (144, 99), (144, 100), (144, 111), (144, 113), (144, 118), (145, 100), (145, 110), (145, 114), (145, 115), (145, 116), (145, 117), (145, 118), (146, 100), (146, 101), (146, 110), (146, 112), (146, 113), (146, 114), (146, 115), (146, 116), (146, 117), (146, 118), (147, 101), (147, 110), (147, 112), (147, 113), (147, 114), (147, 115), (147, 116), (147, 117), (147, 118), (147, 119), (147, 120), (147, 121),
(147, 122), (147, 123), (147, 124), (147, 126), (148, 101), (148, 111), (148, 116), (148, 117), (148, 118), (148, 126), (149, 102), (149, 112), (149, 114), (149, 115), (149, 118), (149, 119), (149, 120), (149, 121), (149, 122), (149, 123), (149, 125), (150, 116), (150, 117), (150, 119), (150, 120), (150, 121), (150, 122), (150, 123), (150, 125), (151, 103), (151, 118), (151, 119), (151, 126), (152, 104), (152, 119), (152, 121), (152, 122), (152, 123), (152, 124), (152, 125), (152, 127), (153, 105), (154, 106), (154, 114), (155, 107), (155, 109), (155, 110), (155, 111), (155, 112), (155, 113), )
coordinates_333287 = ((80, 114),
(80, 116), (80, 117), (80, 120), (80, 122), (81, 112), (81, 118), (81, 119), (81, 123), (81, 127), (81, 128), (81, 129), (81, 131), (82, 111), (82, 114), (82, 115), (82, 116), (82, 117), (82, 120), (82, 121), (82, 122), (82, 124), (82, 125), (82, 126), (82, 132), (83, 110), (83, 114), (83, 117), (83, 119), (83, 120), (83, 123), (83, 126), (83, 130), (83, 132), (84, 108), (84, 111), (84, 112), (84, 114), (84, 118), (84, 120), (84, 122), (84, 125), (84, 127), (84, 130), (84, 132), (85, 106), (85, 109), (85, 110), (85, 111), (85, 112), (85, 114), (85, 118), (85, 120), (85, 123), (85, 126), (85, 130), (85, 132), (86, 104), (86, 108), (86, 109), (86, 110), (86, 111), (86, 112), (86, 113), (86, 114), (86, 118), (86, 120), (86, 124), (86, 125), (86, 130), (86, 132), (87, 103), (87, 106),
(87, 107), (87, 108), (87, 109), (87, 110), (87, 111), (87, 112), (87, 113), (87, 114), (87, 117), (87, 118), (87, 119), (87, 121), (87, 130), (87, 131), (88, 102), (88, 104), (88, 105), (88, 106), (88, 107), (88, 108), (88, 109), (88, 110), (88, 111), (88, 112), (88, 113), (88, 114), (88, 115), (88, 116), (88, 117), (88, 118), (88, 119), (88, 122), (88, 130), (89, 111), (89, 112), (89, 113), (89, 114), (89, 115), (89, 120), (89, 121), (89, 123), (89, 129), (89, 130), (90, 103), (90, 105), (90, 106), (90, 107), (90, 108), (90, 109), (90, 110), (90, 116), (90, 117), (90, 118), (90, 119), (90, 122), (90, 124), (90, 129), (90, 130), (91, 111), (91, 112), (91, 113), (91, 114), (91, 115), (91, 124), (91, 130), (92, 130), (93, 125), (93, 130), (94, 125), (94, 130), (94, 131), (95, 125),
(95, 130), (95, 131), (96, 130), (96, 131), (97, 130), (97, 131), (98, 129), (98, 131), (100, 128), (100, 129), )
coordinates_FFC0CB = ((92, 103),
(92, 109), (92, 117), (92, 118), (92, 119), (92, 120), (92, 122), (92, 123), (93, 105), (93, 107), (93, 109), (93, 113), (93, 115), (93, 116), (93, 117), (93, 123), (94, 106), (94, 110), (94, 123), (95, 107), (95, 109), (95, 123), (96, 108), (96, 110), (96, 113), (96, 122), (96, 123), (97, 108), (97, 110), (97, 111), (97, 112), (97, 115), (97, 122), (97, 124), (98, 108), (98, 110), (98, 111), (98, 112), (98, 113), (98, 115), (98, 121), (98, 124), (99, 109), (99, 111), (99, 112), (99, 113), (99, 115), (99, 121), (99, 124), (100, 109), (100, 111), (100, 112), (100, 114), (100, 121), (100, 123), (100, 124), (100, 126), (101, 109), (101, 111), (101, 112), (101, 114), (101, 124), (101, 127), (102, 109), (102, 111), (102, 113), (102, 124), (102, 128), (103, 108), (103, 110), (103, 112), (103, 123), (103, 124),
(103, 125), (103, 127), (104, 108), (104, 110), (104, 112), (104, 126), (105, 108), (105, 110), (105, 112), (105, 124), (105, 125), (106, 108), (106, 110), (106, 112), (107, 108), (107, 110), (107, 112), (108, 108), (108, 110), (108, 112), (109, 107), (109, 109), (109, 110), (109, 112), (110, 106), (110, 112), (111, 105), (111, 108), (111, 109), (111, 111), (112, 105), )
| 398.298507 | 865 | 0.49363 | 4,468 | 26,686 | 2.943151 | 0.024396 | 0.001369 | 0.001369 | 0.001825 | 0.003194 | 0.003194 | 0.003194 | 0 | 0 | 0 | 0 | 0.581545 | 0.172375 | 26,686 | 66 | 866 | 404.333333 | 0.013855 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
efde5cdde59b54bb2aa7e0c5cddb3bc980e73985 | 369 | py | Python | pyLearn/exercises/08_arithmetic_operations.py | sravanrekandar/pyLearn | 0d584b4d434b65ea23d7bfc810301861eac84c4d | [
"MIT"
] | null | null | null | pyLearn/exercises/08_arithmetic_operations.py | sravanrekandar/pyLearn | 0d584b4d434b65ea23d7bfc810301861eac84c4d | [
"MIT"
] | null | null | null | pyLearn/exercises/08_arithmetic_operations.py | sravanrekandar/pyLearn | 0d584b4d434b65ea23d7bfc810301861eac84c4d | [
"MIT"
] | null | null | null | """08_arithmetic_operations.py."""
a = 15
b = 2
sum = a + b
difference = a - b
product = a * b
division = a / b
remainder = a % b
print(f'{a} + {b} = {sum}') # 15 + 2 = 17
print(f'{a} - {b} = {difference}') # 15 - 2 = 13
print(f'{a} * {b} = {product}') # 15 * 2 = 30
print(f'{a} / {b} = {division}') # 15 / 2 = 7.5
print(f'{a} % {b} = {remainder}') # 15 % 2 = 1
| 23.0625 | 49 | 0.485095 | 64 | 369 | 2.765625 | 0.328125 | 0.112994 | 0.19774 | 0.225989 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105455 | 0.254743 | 369 | 15 | 50 | 24.6 | 0.538182 | 0.241192 | 0 | 0 | 0 | 0 | 0.396296 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.416667 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
effc4e511f2811d6fe865d6a31d6982372795f77 | 474 | py | Python | Practice Folder/Python_pracitce.py | titogithub123/PyPoll-with-Python | 6e104d1644d3ed34fdc6b0fc59685cfec413391b | [
"Apache-2.0"
] | null | null | null | Practice Folder/Python_pracitce.py | titogithub123/PyPoll-with-Python | 6e104d1644d3ed34fdc6b0fc59685cfec413391b | [
"Apache-2.0"
] | null | null | null | Practice Folder/Python_pracitce.py | titogithub123/PyPoll-with-Python | 6e104d1644d3ed34fdc6b0fc59685cfec413391b | [
"Apache-2.0"
] | null | null | null | #print("Hello World")
#temperature = int(input("What is the temperature outside?"))
#if temperature > 80:
#print("Turn on the AC.")
#else:
#print("Open the Windows.")
score = int(input("What is your test score?"))
if score >= 90:
print('Your grade is an A.')
elif score>= 80:
print('Your grade is a B')
elif score>= 70:
print('Your grade is a C')
elif score>= 60:
print('Your grade is a D')
else:
print('You Suck,, Drop Out of School')
| 19.75 | 61 | 0.618143 | 76 | 474 | 3.855263 | 0.486842 | 0.122867 | 0.191126 | 0.21843 | 0.174061 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027174 | 0.223629 | 474 | 23 | 62 | 20.608696 | 0.769022 | 0.327004 | 0 | 0 | 0 | 0 | 0.395498 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.454545 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
4bdae87dff626bd53fa62c8b23024d704623e8e1 | 204 | py | Python | ui.py | Benrflanders/Tetris | 33dfecd00bd6740ad378bcef7c6589ff2f076291 | [
"MIT"
] | null | null | null | ui.py | Benrflanders/Tetris | 33dfecd00bd6740ad378bcef7c6589ff2f076291 | [
"MIT"
] | null | null | null | ui.py | Benrflanders/Tetris | 33dfecd00bd6740ad378bcef7c6589ff2f076291 | [
"MIT"
] | null | null | null | """
User interface file
"""
from pyglet.gl import *
from pyglet.text import Label
class PauseMenu(object):
def __init__(self):
self.items.append(Label("Paused"))
self.reset()
| 13.6 | 42 | 0.637255 | 25 | 204 | 5.04 | 0.76 | 0.15873 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.235294 | 204 | 14 | 43 | 14.571429 | 0.807692 | 0.093137 | 0 | 0 | 0 | 0 | 0.034483 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
ef0143e318b07fe22ae04146b550db4a0ba334af | 295 | py | Python | tests/assertion.py | IshitaTakeshi/Tadataka | 852c7afb904503005e51884408e1492ef0be836f | [
"Apache-2.0"
] | 54 | 2019-11-15T16:30:34.000Z | 2022-01-13T15:18:54.000Z | tests/assertion.py | IshitaTakeshi/Tadataka | 852c7afb904503005e51884408e1492ef0be836f | [
"Apache-2.0"
] | 11 | 2019-02-28T08:28:24.000Z | 2020-04-07T04:47:12.000Z | tests/assertion.py | IshitaTakeshi/Tadataka | 852c7afb904503005e51884408e1492ef0be836f | [
"Apache-2.0"
] | 1 | 2020-02-26T13:59:40.000Z | 2020-02-26T13:59:40.000Z | from numpy.testing import assert_array_almost_equal
from tadataka.rigid_transform import transform
def assert_projection_equal(projection, pose, points, keypoints_pred):
assert_array_almost_equal(
projection.compute(transform(pose.R, pose.t, points)),
keypoints_pred
)
| 29.5 | 70 | 0.779661 | 37 | 295 | 5.918919 | 0.540541 | 0.100457 | 0.155251 | 0.200913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152542 | 295 | 9 | 71 | 32.777778 | 0.876 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.428571 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ef07535fa3153ace04ec89cfcbab4849d3254d67 | 51 | py | Python | imbox/__init__.py | Arrelis/imbox | f39a39faddda04468cb65cd10f9a13f31e95d2c5 | [
"MIT"
] | 648 | 2015-01-02T23:25:10.000Z | 2022-03-30T09:22:20.000Z | imbox/__init__.py | Arrelis/imbox | f39a39faddda04468cb65cd10f9a13f31e95d2c5 | [
"MIT"
] | 132 | 2015-01-13T14:11:47.000Z | 2022-01-18T23:44:05.000Z | imbox/__init__.py | Arrelis/imbox | f39a39faddda04468cb65cd10f9a13f31e95d2c5 | [
"MIT"
] | 171 | 2015-01-15T16:51:57.000Z | 2022-03-12T21:44:55.000Z | from imbox.imbox import Imbox
__all__ = ['Imbox']
| 12.75 | 29 | 0.72549 | 7 | 51 | 4.714286 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156863 | 51 | 3 | 30 | 17 | 0.767442 | 0 | 0 | 0 | 0 | 0 | 0.098039 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ef138b8b7c961fc4eb5f7cbdc1d96ab96d036765 | 1,251 | py | Python | python/hub/notifier.py | majjihari/0-hub | b4febc191595f1f36e0fe64eec4b631f1a40698a | [
"Apache-2.0"
] | null | null | null | python/hub/notifier.py | majjihari/0-hub | b4febc191595f1f36e0fe64eec4b631f1a40698a | [
"Apache-2.0"
] | 34 | 2018-08-01T12:52:35.000Z | 2022-01-24T18:41:48.000Z | python/hub/notifier.py | majjihari/0-hub | b4febc191595f1f36e0fe64eec4b631f1a40698a | [
"Apache-2.0"
] | 2 | 2020-12-26T11:34:14.000Z | 2021-01-05T20:08:24.000Z | import queue
import json
class EventNotifier:
def __init__(self):
self.listeners = {}
def initialize(self, id):
q = queue.Queue(maxsize=8192)
self.listeners[id] = q
return q
def error(self, msg):
return {"status": "error", "message": msg}
# flag this id as ended, should be cleaned up later
def finalize(self, id):
self.listeners[id].put_nowait(None)
return True
# clean the task id
def terminate(self, id):
print("[+] notify: cleaning up: %s" % id)
del self.listeners[id]
return True
# push an object to a channel
def push(self, id, item):
return self.announce(id, json.dumps(item))
# returns pushable object over the wire
def raw(self, item):
return self.format(json.dumps(item))
# grab queue channel if exists
def listen(self, id):
if id not in self.listeners:
return None
return self.listeners[id]
def format(self, data):
return "data: %s\n\n" % data
def announce(self, id, msg):
# print(id, msg)
msg = self.format(msg)
if id not in self.listeners:
return None
self.listeners[id].put_nowait(msg)
| 22.745455 | 55 | 0.584333 | 168 | 1,251 | 4.315476 | 0.386905 | 0.143448 | 0.103448 | 0.049655 | 0.154483 | 0.088276 | 0.088276 | 0.088276 | 0 | 0 | 0 | 0.00463 | 0.309353 | 1,251 | 54 | 56 | 23.166667 | 0.834491 | 0.141487 | 0 | 0.181818 | 0 | 0 | 0.053521 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.30303 | false | 0 | 0.060606 | 0.121212 | 0.69697 | 0.030303 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ef1ce027bc2d57cf6ed2dfd476eca7f658232d8f | 48 | py | Python | instance/config.py | jameskomo/personal-blog | d4756dbb0a21960edaef893379ef64286ed8b57d | [
"MIT"
] | null | null | null | instance/config.py | jameskomo/personal-blog | d4756dbb0a21960edaef893379ef64286ed8b57d | [
"MIT"
] | null | null | null | instance/config.py | jameskomo/personal-blog | d4756dbb0a21960edaef893379ef64286ed8b57d | [
"MIT"
] | null | null | null | BLOG_API_BASE_URL='KoMoH'
SECRET_KEY = 'KoMoH'
| 12 | 25 | 0.770833 | 8 | 48 | 4.125 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104167 | 48 | 3 | 26 | 16 | 0.767442 | 0 | 0 | 0 | 0 | 0 | 0.212766 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ef370acac3d226db771bdf39234e46897bf257ca | 57 | py | Python | example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/S/Stefan-Boltzmann constant.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | null | null | null | example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/S/Stefan-Boltzmann constant.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | null | null | null | example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/S/Stefan-Boltzmann constant.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | 1 | 2021-02-04T04:51:48.000Z | 2021-02-04T04:51:48.000Z | constants.physical_constants["Stefan-Boltzmann constant"] | 57 | 57 | 0.877193 | 6 | 57 | 8.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017544 | 57 | 1 | 57 | 57 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0.431034 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ef5e2277e7afed50f2af3f9bfc96199a38c138ca | 52 | py | Python | scratch/eyy/dummy_script.py | sasgc6/pysmurf | a370b515ab717c982781223da147bea3c8fb3a9c | [
"BSD-3-Clause-LBNL"
] | 3 | 2019-10-17T02:37:59.000Z | 2022-03-09T16:42:34.000Z | scratch/eyy/dummy_script.py | sasgc6/pysmurf | a370b515ab717c982781223da147bea3c8fb3a9c | [
"BSD-3-Clause-LBNL"
] | 446 | 2019-04-10T04:46:20.000Z | 2022-03-15T20:27:57.000Z | scratch/eyy/dummy_script.py | sasgc6/pysmurf | a370b515ab717c982781223da147bea3c8fb3a9c | [
"BSD-3-Clause-LBNL"
] | 13 | 2019-02-05T18:02:05.000Z | 2021-03-02T18:41:49.000Z | # This does nothing
import numpy as np
test = True
| 10.4 | 19 | 0.730769 | 9 | 52 | 4.222222 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | 52 | 4 | 20 | 13 | 0.95 | 0.326923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3232dd73b0a82fd0a1e7c6b58da1573424744668 | 522 | py | Python | pypixiv/user/model.py | ombe1229/pypixiv | db4ab6721b299e8f024537f053935201072742a7 | [
"MIT"
] | 4 | 2021-02-19T07:07:47.000Z | 2021-07-30T13:25:29.000Z | pypixiv/user/model.py | ombe1229/pypixiv | db4ab6721b299e8f024537f053935201072742a7 | [
"MIT"
] | 1 | 2021-07-30T04:52:12.000Z | 2021-08-01T16:51:42.000Z | pypixiv/user/model.py | ombe1229/pypixiv | db4ab6721b299e8f024537f053935201072742a7 | [
"MIT"
] | 1 | 2021-07-30T15:42:59.000Z | 2021-07-30T15:42:59.000Z | from pypixiv.user.body import UserFullInfoBody, UserInfoBody
from typing import Any
from pypixiv.abc import BasePixiv
class UserInfo(BasePixiv):
def __init__(self, response: Any):
super().__init__(response)
@property
def body(self) -> UserInfoBody:
return UserInfoBody(super().body)
class UserFullInfo(BasePixiv):
def __init__(self, response: Any):
super().__init__(response)
@property
def body(self) -> UserFullInfoBody:
return UserFullInfoBody(super().body)
| 23.727273 | 60 | 0.703065 | 56 | 522 | 6.267857 | 0.375 | 0.062678 | 0.091168 | 0.11396 | 0.381766 | 0.381766 | 0.381766 | 0.381766 | 0.381766 | 0.381766 | 0 | 0 | 0.197318 | 522 | 21 | 61 | 24.857143 | 0.837709 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.2 | 0.133333 | 0.733333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
3249bf88f110d6988cf2e68e0a788b8c2675a9f0 | 43 | py | Python | sfepy/fem/extmods/__init__.py | olivierverdier/sfepy | 83aefb7b33ea17f4acb83388ba8bc7314c77616c | [
"BSD-3-Clause"
] | 1 | 2015-07-30T13:47:23.000Z | 2015-07-30T13:47:23.000Z | sfepy/fem/extmods/__init__.py | olivierverdier/sfepy | 83aefb7b33ea17f4acb83388ba8bc7314c77616c | [
"BSD-3-Clause"
] | null | null | null | sfepy/fem/extmods/__init__.py | olivierverdier/sfepy | 83aefb7b33ea17f4acb83388ba8bc7314c77616c | [
"BSD-3-Clause"
] | null | null | null | __all__ = ['fem', 'geometry', 'meshutils']
| 21.5 | 42 | 0.627907 | 4 | 43 | 5.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116279 | 43 | 1 | 43 | 43 | 0.605263 | 0 | 0 | 0 | 0 | 0 | 0.465116 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3261cbf1f04fc704527f276189dbf3dce48d4e64 | 338 | py | Python | Bloggie/web/admin.py | ArunSankarKs/Bloggie | 5814c498d044a6cb5e047eec846d71ccea7cce7c | [
"BSD-3-Clause"
] | 4 | 2019-09-29T03:29:56.000Z | 2019-10-09T09:41:39.000Z | Bloggie/web/admin.py | ArunSankarKs/Bloggie | 5814c498d044a6cb5e047eec846d71ccea7cce7c | [
"BSD-3-Clause"
] | 10 | 2020-06-05T23:14:16.000Z | 2022-03-11T23:59:46.000Z | Bloggie/web/admin.py | ArunSankarKs/Bloggie | 5814c498d044a6cb5e047eec846d71ccea7cce7c | [
"BSD-3-Clause"
] | 1 | 2019-09-25T15:03:36.000Z | 2019-09-25T15:03:36.000Z | from django.contrib import admin
# Register your models here so that you can CRUD them from Django Admin Site
from web.models import Comment, Article, Topic, Business, Profile
admin.site.register(Article)
admin.site.register(Topic)
admin.site.register(Comment)
admin.site.register(Business)
admin.site.register(Profile) | 24.142857 | 77 | 0.772189 | 48 | 338 | 5.4375 | 0.458333 | 0.206897 | 0.325671 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147929 | 338 | 14 | 78 | 24.142857 | 0.90625 | 0.218935 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.285714 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
326978ec57d1402afb9f816b6f65f731f691584e | 848 | py | Python | spar_python/circuit_generation/ibm/ibm_batch.py | nathanawmk/SPARTA | 6eeb28b2dd147088b6e851876b36eeba3e700f16 | [
"BSD-2-Clause"
] | 37 | 2017-06-09T13:55:23.000Z | 2022-01-28T12:51:17.000Z | spar_python/circuit_generation/ibm/ibm_batch.py | nathanawmk/SPARTA | 6eeb28b2dd147088b6e851876b36eeba3e700f16 | [
"BSD-2-Clause"
] | null | null | null | spar_python/circuit_generation/ibm/ibm_batch.py | nathanawmk/SPARTA | 6eeb28b2dd147088b6e851876b36eeba3e700f16 | [
"BSD-2-Clause"
] | 5 | 2017-06-09T13:55:26.000Z | 2021-11-11T03:51:56.000Z |
# *****************************************************************
# Copyright 2015 MIT Lincoln Laboratory
# Project: SPAR
# Authors: SY
# Description: IBM TA2 batch class
#
# Modifications:
# Date Name Modification
# ---- ---- ------------
# 14 Nov 2012 SY Original Version
# *****************************************************************
class IBMBatch(list):
"""
This class represents a batched input.
"""
def __str__(self):
return "".join([str(int(inp_bit)) for inp_bit in self])
def get_num_values(self, value):
"""returns the number of instances of value in the batch"""
num_values = 0
for elt in self:
if elt == value:
num_values += 1
return num_values
| 30.285714 | 67 | 0.4375 | 79 | 848 | 4.556962 | 0.670886 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02253 | 0.319575 | 848 | 27 | 68 | 31.407407 | 0.601386 | 0.599057 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
32840e52e24b8d715d4a6e5f6b6ce4b1f3fdc56d | 145 | py | Python | src/core/repository/databases/__init__.py | lucassaporetti/bookstore | 9a33d3eebd1f099a27e8a7089a1d9c696613888a | [
"MIT"
] | 1 | 2021-02-11T18:44:53.000Z | 2021-02-11T18:44:53.000Z | src/core/repository/databases/__init__.py | lucassaporetti/bookstore | 9a33d3eebd1f099a27e8a7089a1d9c696613888a | [
"MIT"
] | null | null | null | src/core/repository/databases/__init__.py | lucassaporetti/bookstore | 9a33d3eebd1f099a27e8a7089a1d9c696613888a | [
"MIT"
] | null | null | null | # _*_ coding: utf-8 _*_
#
# Package: bookstore.src.core.repository.databases
__all__ = ["book_repository", "db_repository", "mysql_repository"]
| 24.166667 | 66 | 0.737931 | 16 | 145 | 6 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007692 | 0.103448 | 145 | 5 | 67 | 29 | 0.730769 | 0.482759 | 0 | 0 | 0 | 0 | 0.619718 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
328eabe575981d8554ab996b55554ba6d6c75230 | 207 | py | Python | doctotxt.py.py | harmydiano/yorubastopwords | dd3f6ead03522653004119c7222f9f3e1809e35a | [
"MIT"
] | null | null | null | doctotxt.py.py | harmydiano/yorubastopwords | dd3f6ead03522653004119c7222f9f3e1809e35a | [
"MIT"
] | null | null | null | doctotxt.py.py | harmydiano/yorubastopwords | dd3f6ead03522653004119c7222f9f3e1809e35a | [
"MIT"
] | null | null | null |
import docx2txt
def doctotxt(filename):
my_text = docx2txt.process(filename)
with open(".\\mynewdirectory\\Output2.txt", "w") as text_file:
return text_file.write((my_text).encode("utf-8"))
| 29.571429 | 66 | 0.695652 | 28 | 207 | 5 | 0.75 | 0.085714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022727 | 0.149758 | 207 | 6 | 67 | 34.5 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0.174757 | 0.145631 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
3290c6f05f72ccf7391cbf2c0321dd30215b5f53 | 226 | py | Python | tests/test_main.py | outloudvi/gu | 4070c15d9cf1e48284f5c27a8354c25523b44e41 | [
"MIT"
] | 2 | 2020-01-30T19:48:36.000Z | 2020-01-31T00:15:43.000Z | tests/test_main.py | outloudvi/gu | 4070c15d9cf1e48284f5c27a8354c25523b44e41 | [
"MIT"
] | 1 | 2020-01-31T16:59:51.000Z | 2020-01-31T17:01:56.000Z | tests/test_main.py | outloudvi/gu | 4070c15d9cf1e48284f5c27a8354c25523b44e41 | [
"MIT"
] | 2 | 2020-01-30T18:34:03.000Z | 2020-11-06T15:57:31.000Z | from gu import cli
from gu.sender import StdoutSender
import os
def test_stdout_package():
pkg = StdoutSender({})
pkg.sendText("hello, world")
def test_cli():
assert os.system("gu --sender stdout hello") == 0
| 16.142857 | 53 | 0.690265 | 32 | 226 | 4.78125 | 0.5625 | 0.078431 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005464 | 0.190265 | 226 | 13 | 54 | 17.384615 | 0.830601 | 0 | 0 | 0 | 0 | 0 | 0.159292 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.25 | false | 0 | 0.375 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
32a5df997f842bfde06d0eb50051eadd0a014101 | 821 | py | Python | loadlimit/__init__.py | arielmakestuff/loadlimit | 70d3d23eecfe7922699098ea4901cc8673d14576 | [
"MIT"
] | null | null | null | loadlimit/__init__.py | arielmakestuff/loadlimit | 70d3d23eecfe7922699098ea4901cc8673d14576 | [
"MIT"
] | 5 | 2016-11-28T16:59:44.000Z | 2017-03-18T17:10:40.000Z | loadlimit/__init__.py | arielmakestuff/loadlimit | 70d3d23eecfe7922699098ea4901cc8673d14576 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# loadlimit/__init__.py
# Copyright (C) 2016 authors and contributors (see AUTHORS file)
#
# This module is released under the MIT License.
"""loadlimit package"""
# ============================================================================
# Imports
# ============================================================================
# Local imports
from . import event
# ============================================================================
# Metadata
# ============================================================================
__author__ = 'Ariel De Ocampo'
__email__ = 'arielmakestuff@gmail.com'
__version__ = '0.1'
# ============================================================================
#
# ============================================================================
| 26.483871 | 78 | 0.294762 | 43 | 821 | 5.255814 | 0.930233 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009371 | 0.090134 | 821 | 30 | 79 | 27.366667 | 0.293173 | 0.809988 | 0 | 0 | 0 | 0 | 0.308824 | 0.176471 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
32ae6b29022d3e6eaea6a3b088df710df0d8428e | 595 | py | Python | lambda/stepfunction_create_solution_version.py | ksmin23/personalize-data-science-sdk-workflow | 402b7fe0a5356d10234c3261d939fc81e76b4a41 | [
"MIT-0"
] | null | null | null | lambda/stepfunction_create_solution_version.py | ksmin23/personalize-data-science-sdk-workflow | 402b7fe0a5356d10234c3261d939fc81e76b4a41 | [
"MIT-0"
] | null | null | null | lambda/stepfunction_create_solution_version.py | ksmin23/personalize-data-science-sdk-workflow | 402b7fe0a5356d10234c3261d939fc81e76b4a41 | [
"MIT-0"
] | null | null | null | import os
import json
import base64
import boto3
AWS_REGION_NAME = os.getenv('AWS_REGION_NAME', 'us-east-1')
personalize = boto3.client('personalize', region_name=AWS_REGION_NAME)
def lambda_handler(event, context):
create_solution_version_response = personalize.create_solution_version(
solutionArn = event['solution_arn']
)
solution_version_arn = create_solution_version_response['solutionVersionArn']
print(json.dumps(create_solution_version_response, indent=2))
return {
'statusCode': 200,
'solution_version_arn': solution_version_arn
}
| 25.869565 | 81 | 0.756303 | 71 | 595 | 5.971831 | 0.464789 | 0.247642 | 0.198113 | 0.205189 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017893 | 0.154622 | 595 | 22 | 82 | 27.045455 | 0.82505 | 0 | 0 | 0 | 0 | 0 | 0.159664 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0.25 | 0 | 0.375 | 0.0625 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
32b21b9e25faa3a8ec1fdabb4eecd30beaf17cd6 | 4,023 | py | Python | pybehome/__init__.py | bratanon/pybehome | 76fa46dc13dcccd23f6d08a966a2b7c59e351ae8 | [
"MIT"
] | 1 | 2020-02-16T19:56:15.000Z | 2020-02-16T19:56:15.000Z | pybehome/__init__.py | bratanon/pybehome | 76fa46dc13dcccd23f6d08a966a2b7c59e351ae8 | [
"MIT"
] | null | null | null | pybehome/__init__.py | bratanon/pybehome | 76fa46dc13dcccd23f6d08a966a2b7c59e351ae8 | [
"MIT"
] | null | null | null | import logging
from requests import RequestException
from pybehome import api
_LOGGER = logging.getLogger(__name__)
class PyBeHome:
def __init__(self, username, password):
self._username = username
self._password = password
self._token = None
self.session = None
self.devices = {}
self.location = None
def login(self) -> bool:
if self.get_auth_token():
return True
_LOGGER.warning("Unable to login to WeBeHome.")
return False
def get_auth_token(self):
_LOGGER.debug("Getting auth token from OPEN API.")
try:
self._token = api.request_token(self._username, self._password)
return True
except RequestException as error:
_LOGGER.warning(error)
return False
def update_devices(self):
_LOGGER.debug("Getting device data from OPEN API.")
try:
device_list = list(filter(lambda item: 'SubUnitID' in item,
api.request_devices(self._token)))
for device_data in device_list:
device = Device(device_data)
self.devices[device.device_id] = device
except RequestException as error:
_LOGGER.warning(error)
def get_device(self, device_id):
return self.devices.get(device_id)
def get_devices(self):
return self.devices.values()
def update_location(self):
_LOGGER.debug("Getting location data from OPEN API.")
try:
location_data = api.request_location(self._token)
del location_data['Tabs']
self.location = Location(location_data)
except RequestException as error:
_LOGGER.warning(error)
def get_location(self):
return self.location
def set_alarm_state(self, arm_state: str):
_LOGGER.debug("Setting arm state to %s.", arm_state)
try:
return api.request_set_arm_state(self._token, arm_state)
except RequestException as error:
_LOGGER.warning(error)
def token_destroy(self):
_LOGGER.debug("Destroying token.")
try:
return api.request_token_destroy(self._token)
except RequestException as error:
_LOGGER.warning(error)
class Device(object):
def __init__(self, device):
self._device = device
@property
def device(self):
return self._device
@property
def device_id(self):
return self.device.get('SubUnitUniqueID')
@property
def name(self):
return self.device.get('Descr')
@property
def type(self):
return self.device.get('SubUnitTypeDescr')
@property
def display_type(self):
return int(self.device.get('DisplayType'))
@property
def battery_level(self):
return int(self.device.get('BatteryLevel'))
@property
def operation_status(self):
return int(self.device.get('OperationStatus'))
@property
def last_event_time(self):
return self.device.get('ReadingUpdated')
@property
def last_event_data(self):
return self.device.get('LastDataEvent')
@property
def lost_connection(self):
return bool(self.device.get('LostConnection'))
def __str__(self):
return str(self.__class__) + ": " + str(self.__dict__)
class Location(object):
def __init__(self, location):
self._location = location
@property
def location(self):
return self._location
@property
def base_unit_id(self):
return self.location.get('BaseUnitID')
@property
def name(self):
return self.location.get('Descr')
@property
def operation_status(self):
return self.location.get('OperationStatus')
@property
def operation_status_info(self):
return self.location.get('OperationStatusInfo')
def __str__(self):
return str(self.__class__) + ": " + str(self.__dict__)
| 25.954839 | 75 | 0.627392 | 452 | 4,023 | 5.334071 | 0.205752 | 0.078805 | 0.075487 | 0.054749 | 0.331398 | 0.218167 | 0.136043 | 0.097055 | 0.076317 | 0.032352 | 0 | 0 | 0.278648 | 4,023 | 154 | 76 | 26.123377 | 0.830806 | 0 | 0 | 0.362069 | 0 | 0 | 0.087745 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.025862 | 0.025862 | 0.172414 | 0.525862 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
32c7b697bc756b025da320a229d596603bd41b6c | 1,272 | py | Python | Python/Jokenpo.py | TSCTiago/PythonTeste | f406db1d862965d9dfa4dee58c3a917041174f2d | [
"MIT"
] | null | null | null | Python/Jokenpo.py | TSCTiago/PythonTeste | f406db1d862965d9dfa4dee58c3a917041174f2d | [
"MIT"
] | null | null | null | Python/Jokenpo.py | TSCTiago/PythonTeste | f406db1d862965d9dfa4dee58c3a917041174f2d | [
"MIT"
] | null | null | null | import random
from time import sleep
print('GAME PEDRA-PAPEL- TESOURA')
print('''' OPÇÕES
[0] = PEDRA
[1] = PAPEL
[2] = TESOURA
''')
puter = random.randint(0, 2)
while True:
jog = int(input('SUA OPÇÃO: '))
if 0 != jog and jog != 1 and jog != 2:
print('Opção Inválida')
print('Tente novamente.....')
if 0 <= jog <= 2:
break
print('JO')
sleep(1)
print('KEN')
sleep(1)
print('PÔ')
if puter == 0:
if jog == 0:
print('Computador jogou Pedra')
print('Empate')
elif jog == 1:
print('Computador jogou Pedra')
print('Jogador Vence')
elif jog == 2:
print('Computador jogou Pedra')
print('Computador Vence')
elif puter == 1:
if jog == 0:
print('Computador jogou Papel')
print('Computador Vence')
elif jog == 1:
print('Computador jogou Papel')
print('Empate')
elif jog == 2:
print('Computador jogou Papel')
print('Jogador Vence')
elif puter == 2:
if jog == 0:
print('Computador jogou Tesoura')
print('jogador Vence')
elif jog == 1:
print('Computador jogou Tesoura')
print('Computador Vence')
elif jog == 2:
print('Computador jogou Tesoura')
print('Empate') | 24.941176 | 42 | 0.556604 | 157 | 1,272 | 4.509554 | 0.242038 | 0.254237 | 0.254237 | 0.04661 | 0.559322 | 0.375706 | 0.186441 | 0 | 0 | 0 | 0 | 0.026816 | 0.296384 | 1,272 | 51 | 43 | 24.941176 | 0.764246 | 0 | 0 | 0.54902 | 0 | 0 | 0.349568 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.039216 | 0 | 0.039216 | 0.490196 | 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 | 1 | 0 | 3 |
086d4d2b9412c3a5e11a76f770c222813bfb5129 | 1,025 | py | Python | src/projects/migrations/0027_auto_20170227_1242.py | MEEM-MLHD/territoire_conseil | a1213575bc4fa12574859aab0dfa90f4eff7c6eb | [
"BSD-3-Clause"
] | null | null | null | src/projects/migrations/0027_auto_20170227_1242.py | MEEM-MLHD/territoire_conseil | a1213575bc4fa12574859aab0dfa90f4eff7c6eb | [
"BSD-3-Clause"
] | null | null | null | src/projects/migrations/0027_auto_20170227_1242.py | MEEM-MLHD/territoire_conseil | a1213575bc4fa12574859aab0dfa90f4eff7c6eb | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-27 12:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0026_stakeholdertype_manager'),
]
operations = [
migrations.RemoveField(
model_name='project',
name='missing_skills',
),
migrations.RemoveField(
model_name='project',
name='missing_skills_others',
),
migrations.RemoveField(
model_name='project',
name='mobilized_skills',
),
migrations.RemoveField(
model_name='project',
name='mobilized_skills_others',
),
migrations.AlterField(
model_name='stakeholdertype',
name='manager',
field=models.BooleanField(default=None, verbose_name='Pilote'),
),
migrations.DeleteModel(
name='Skill',
),
]
| 25.625 | 75 | 0.570732 | 88 | 1,025 | 6.431818 | 0.534091 | 0.079505 | 0.183746 | 0.212014 | 0.388693 | 0.388693 | 0.388693 | 0.388693 | 0 | 0 | 0 | 0.028694 | 0.32 | 1,025 | 39 | 76 | 26.282051 | 0.783357 | 0.06439 | 0 | 0.4375 | 1 | 0 | 0.17887 | 0.075314 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.0625 | 0 | 0.15625 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0890600d9745f0a98d9c589c9db641b844d463bd | 205 | py | Python | hello/urls.py | narathip1598/gogodeploy | 625424ae616d50d1c31e408923b271271d5f267c | [
"MIT"
] | null | null | null | hello/urls.py | narathip1598/gogodeploy | 625424ae616d50d1c31e408923b271271d5f267c | [
"MIT"
] | null | null | null | hello/urls.py | narathip1598/gogodeploy | 625424ae616d50d1c31e408923b271271d5f267c | [
"MIT"
] | null | null | null | from django.urls import path
from django.contrib import admin
from . import views
urlpatterns = [
path('', views.loginForm),
path('admin/', admin.site.urls),
path('bet',views.betLotto),
]
| 20.5 | 36 | 0.673171 | 26 | 205 | 5.307692 | 0.5 | 0.144928 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185366 | 205 | 9 | 37 | 22.777778 | 0.826347 | 0 | 0 | 0 | 0 | 0 | 0.043902 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
08b966bbbdc9e3a560310c086b2453e55a46f151 | 144 | py | Python | collectData.py | Samleo8/OpenRadar | 5460891fd0ea1218dce5a9c279a22696a8936de2 | [
"Apache-2.0"
] | null | null | null | collectData.py | Samleo8/OpenRadar | 5460891fd0ea1218dce5a9c279a22696a8936de2 | [
"Apache-2.0"
] | null | null | null | collectData.py | Samleo8/OpenRadar | 5460891fd0ea1218dce5a9c279a22696a8936de2 | [
"Apache-2.0"
] | null | null | null | import mmwave as mm
from mmwave.dataloader import DCA1000
dca = DCA1000()
adc_data = dca.read()
radar_cube = mm.dsp.range_processing(adc_data) | 24 | 46 | 0.784722 | 23 | 144 | 4.73913 | 0.695652 | 0.12844 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063492 | 0.125 | 144 | 6 | 46 | 24 | 0.801587 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
08cc107468177099a1c1a6db7c38f10f30366004 | 151 | py | Python | banditpylib/learners/ordinary_fcbai_learner/__init__.py | XiGYmax/banditpylib | 07698a1c6b17720a8199dea76580546fe3dfb9be | [
"MIT"
] | null | null | null | banditpylib/learners/ordinary_fcbai_learner/__init__.py | XiGYmax/banditpylib | 07698a1c6b17720a8199dea76580546fe3dfb9be | [
"MIT"
] | null | null | null | banditpylib/learners/ordinary_fcbai_learner/__init__.py | XiGYmax/banditpylib | 07698a1c6b17720a8199dea76580546fe3dfb9be | [
"MIT"
] | null | null | null | from .utils import *
from .exp_gap import *
from .lilucb_heur import *
__all__ = [
'OrdinaryFCBAILearner',
'ExpGap',
'LilUCBHeuristic'
]
| 13.727273 | 27 | 0.668874 | 15 | 151 | 6.333333 | 0.733333 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218543 | 151 | 10 | 28 | 15.1 | 0.805085 | 0 | 0 | 0 | 0 | 0 | 0.271523 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
08f825646e1d1ef0b62e6018f093b3692876fa32 | 323 | py | Python | timely_beliefs/tests/test_utils.py | SeitaBV/timely-beliefs | 145ae53449393d27c140645fe4c289f4624cc77b | [
"MIT"
] | 12 | 2018-12-20T21:42:21.000Z | 2022-01-06T18:31:53.000Z | timely_beliefs/tests/test_utils.py | SeitaBV/timely-beliefs | 145ae53449393d27c140645fe4c289f4624cc77b | [
"MIT"
] | 51 | 2019-03-26T12:28:17.000Z | 2022-01-21T22:50:13.000Z | timely_beliefs/tests/test_utils.py | SeitaBV/timely-beliefs | 145ae53449393d27c140645fe4c289f4624cc77b | [
"MIT"
] | 5 | 2019-06-03T14:38:07.000Z | 2019-10-28T21:10:35.000Z | from timely_beliefs.utils import remove_class_init_kwargs
def test_remove_used_kwargs():
class MyCls:
def __init__(self, a, b):
pass
kwargs = dict(a=1, b=2, c=3, d=4, self=5)
remaining_kwargs = remove_class_init_kwargs(MyCls, kwargs)
assert remaining_kwargs == dict(c=3, d=4, self=5)
| 26.916667 | 62 | 0.678019 | 52 | 323 | 3.903846 | 0.519231 | 0.108374 | 0.147783 | 0.206897 | 0.08867 | 0.08867 | 0 | 0 | 0 | 0 | 0 | 0.031496 | 0.213622 | 323 | 11 | 63 | 29.363636 | 0.767717 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.25 | false | 0.125 | 0.125 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3ea92169e2326eac3ecc254d456606b9569818b0 | 378 | py | Python | old/music0/CountIter.py | InnovAnon-Inc/HafrenHaver | 5283ae3817c500f2365d1c8108dd3270aceb28fa | [
"Unlicense"
] | 2 | 2020-11-09T19:30:26.000Z | 2020-12-29T21:38:40.000Z | old/music0/CountIter.py | InnovAnon-Inc/HafrenHaver | 5283ae3817c500f2365d1c8108dd3270aceb28fa | [
"Unlicense"
] | null | null | null | old/music0/CountIter.py | InnovAnon-Inc/HafrenHaver | 5283ae3817c500f2365d1c8108dd3270aceb28fa | [
"Unlicense"
] | null | null | null | from __future__ import division
class CountIter:
def __init__ (self, bjork):
#self.bjork = cycle (bjork)
self.bjork = bjork.sequence.__iter__ ()
self.length = sum (bjork.sequence)
def __len__ (self):
return self.length
def __iter__ (self):
return self
def next (self):
count = 1
while True:
bj = self.bjork.next ()
if bj is 1: return count
count += 1 | 22.235294 | 41 | 0.679894 | 54 | 378 | 4.388889 | 0.462963 | 0.151899 | 0.118143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010067 | 0.21164 | 378 | 17 | 42 | 22.235294 | 0.785235 | 0.068783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.066667 | 0.133333 | 0.533333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
3eb99d1c6f029b26cdd18b5fe89b3bef3e3ad690 | 262 | py | Python | scripts/portal/aranTutorGuide2.py | Snewmy/swordie | ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17 | [
"MIT"
] | 2 | 2020-04-15T03:16:07.000Z | 2020-08-12T23:28:32.000Z | scripts/portal/aranTutorGuide2.py | Snewmy/swordie | ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17 | [
"MIT"
] | null | null | null | scripts/portal/aranTutorGuide2.py | Snewmy/swordie | ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17 | [
"MIT"
] | 3 | 2020-08-25T06:55:25.000Z | 2020-12-01T13:07:43.000Z | # 914000220
if not "cmd=o" in sm.getQRValue(21002):
sm.showFieldEffect("aran/tutorialGuide3")
sm.systemMessage("You can use a Command Attack by pressing both the arrow key and the attack key after a Consecutive Attack.")
sm.addQRValue(21002, "cmd=o") | 52.4 | 130 | 0.740458 | 40 | 262 | 4.85 | 0.725 | 0.041237 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090498 | 0.156489 | 262 | 5 | 131 | 52.4 | 0.78733 | 0.034351 | 0 | 0 | 0 | 0.25 | 0.535714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3ee2c90fe7e83796bdf182cecd8f3026177ffb41 | 741 | py | Python | gadget/journal/entry/metadata/bracket.py | rlnsanz/inspectional-rara-parakeet | 2c7919ed432616ec016a5afcd6718d16fa65e8af | [
"Apache-2.0"
] | 114 | 2018-04-18T16:43:11.000Z | 2022-02-21T20:28:22.000Z | gadget/journal/entry/metadata/bracket.py | rlnsanz/inspectional-rara-parakeet | 2c7919ed432616ec016a5afcd6718d16fa65e8af | [
"Apache-2.0"
] | 72 | 2018-06-28T18:12:11.000Z | 2022-02-16T05:27:44.000Z | flor/journal/entry/metadata/bracket.py | vishalbelsare/flor | bb06f7ba019a55802e9ad95f09d4afe68ea514f0 | [
"Apache-2.0"
] | 19 | 2018-04-26T05:30:24.000Z | 2021-12-16T02:20:28.000Z | from ..constants import *
from .abstract import Metadata
VALID_BRACKETS = (LBRACKET, RBRACKET)
class Bracket(Metadata):
def __init__(self, sk, gk, meta, predicate=None, timestamp=None):
assert meta in VALID_BRACKETS
super().__init__(sk, gk, meta)
self.predicate = predicate
self.timestamp = timestamp
def is_left(self):
return self.meta == LBRACKET
def is_right(self):
return self.meta == RBRACKET
@staticmethod
def is_superclass(json_dict: dict):
return METADATA in json_dict and json_dict[METADATA] in VALID_BRACKETS
@classmethod
def cons(cls, json_dict: dict):
return cls(json_dict[STATIC_KEY], json_dict[GLOBAL_KEY], json_dict[METADATA])
| 27.444444 | 85 | 0.68556 | 95 | 741 | 5.105263 | 0.4 | 0.115464 | 0.03299 | 0.074227 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.224022 | 741 | 26 | 86 | 28.5 | 0.843478 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 1 | 0.263158 | false | 0 | 0.105263 | 0.210526 | 0.631579 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
3eedf99191115048d2c36c7b3ae05dfaf8efb2cd | 164 | py | Python | list.py | ghandres/pythonworld | c30d3f411c9705384d557d5fd2c40e4e1fd00833 | [
"Apache-2.0"
] | null | null | null | list.py | ghandres/pythonworld | c30d3f411c9705384d557d5fd2c40e4e1fd00833 | [
"Apache-2.0"
] | 1 | 2021-03-05T22:29:47.000Z | 2021-03-05T22:31:02.000Z | list.py | ghandres/pythonworld | c30d3f411c9705384d557d5fd2c40e4e1fd00833 | [
"Apache-2.0"
] | null | null | null | import requests
import json
response = requests.get("https://swapi.dev/api/people")
json_data = json.loads(response.text)
print (json.dumps(json_data,indent=4))
| 18.222222 | 55 | 0.762195 | 25 | 164 | 4.92 | 0.68 | 0.130081 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006711 | 0.091463 | 164 | 8 | 56 | 20.5 | 0.818792 | 0 | 0 | 0 | 0 | 0 | 0.170732 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3efc3b1913b3401c817cd2fb6688957f8c21f20e | 1,051 | py | Python | tests/test_numeric.py | freywaid/dotted | 7781eec26a0169dc8b3e098cc2c79fbd38eb5f97 | [
"MIT"
] | 2 | 2020-05-05T18:15:22.000Z | 2021-03-24T09:03:24.000Z | tests/test_numeric.py | freywaid/dotted | 7781eec26a0169dc8b3e098cc2c79fbd38eb5f97 | [
"MIT"
] | null | null | null | tests/test_numeric.py | freywaid/dotted | 7781eec26a0169dc8b3e098cc2c79fbd38eb5f97 | [
"MIT"
] | null | null | null | import dotted
def test_numeric_get_key():
T = {111: {'stuff': 'hi'}}
m = dotted.get(T, '111.stuff')
assert m == 'hi'
m = dotted.get(T, '111.0.stuff')
assert m != 'hi'
# 111.0 == 111
m = dotted.get(T, '#"111.0".stuff')
assert m == 'hi'
def test_numeric_get_slot():
T = {111: {'stuff': 'hi'}}
m = dotted.get(T, '[111].stuff')
assert m == 'hi'
# 111.0 == 111
m = dotted.get(T, '[111.0].stuff')
assert m == 'hi'
# 111.0 == 111
m = dotted.get(T, '[#"111.0"].stuff')
assert m == 'hi'
def test_numeric_expand_int():
T = {111: {'stuff': 'hi'}}
m = dotted.expand(T, '*.*')
assert m == ('111.stuff',)
m = dotted.expand(T, '[*].*')
assert m == ('[111].stuff',)
def test_numeric_expand_float():
T = {111.0: {'stuff': 'hi'}}
m = dotted.expand(T, '*.*')
assert m == ("#'111.0'.stuff",)
m = dotted.expand(T, '[*].*')
assert m == ('[111.0].stuff',)
def test_numeric_update():
m = dotted.update({}, '07a', 8)
assert m == {'07a': 8}
| 18.767857 | 41 | 0.493815 | 153 | 1,051 | 3.300654 | 0.137255 | 0.152475 | 0.124752 | 0.130693 | 0.750495 | 0.750495 | 0.742574 | 0.742574 | 0.675248 | 0.481188 | 0 | 0.097311 | 0.256898 | 1,051 | 55 | 42 | 19.109091 | 0.549296 | 0.036156 | 0 | 0.375 | 0 | 0 | 0.181368 | 0 | 0 | 0 | 0 | 0 | 0.34375 | 1 | 0.15625 | false | 0 | 0.03125 | 0 | 0.1875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
41057ee692574e63a15d94641e6dd693e6d4d271 | 302 | py | Python | src/frameworks_and_drivers/blueprints/registereds_blueprints.py | diododias/flask-boilerplate | 1cdcee5b11f63e5ce3017d0c64ac76f69bf7df34 | [
"MIT"
] | null | null | null | src/frameworks_and_drivers/blueprints/registereds_blueprints.py | diododias/flask-boilerplate | 1cdcee5b11f63e5ce3017d0c64ac76f69bf7df34 | [
"MIT"
] | null | null | null | src/frameworks_and_drivers/blueprints/registereds_blueprints.py | diododias/flask-boilerplate | 1cdcee5b11f63e5ce3017d0c64ac76f69bf7df34 | [
"MIT"
] | null | null | null | """
Append new blueprints
"""
from src.frameworks_and_drivers.blueprints.auth_blueprint import auth_blueprint
from src.frameworks_and_drivers.blueprints.index_blueprint import index_blueprint
blueprints_store = list()
blueprints_store.append(auth_blueprint)
blueprints_store.append(index_blueprint)
| 25.166667 | 81 | 0.860927 | 38 | 302 | 6.5 | 0.368421 | 0.157895 | 0.137652 | 0.161943 | 0.299595 | 0.299595 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069536 | 302 | 11 | 82 | 27.454545 | 0.879004 | 0.069536 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 1 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 3 |
f5ade3bb96c68536d05bfd3bd6bcc7f238fcb949 | 130 | py | Python | python/many_vars.py | robotlightsyou/test | 015f13943fc402d8ce86c5f6d2f5a7d032b3340a | [
"MIT"
] | 2 | 2019-05-26T15:09:34.000Z | 2021-09-12T08:01:23.000Z | python/many_vars.py | robotlightsyou/test | 015f13943fc402d8ce86c5f6d2f5a7d032b3340a | [
"MIT"
] | null | null | null | python/many_vars.py | robotlightsyou/test | 015f13943fc402d8ce86c5f6d2f5a7d032b3340a | [
"MIT"
] | 1 | 2021-04-11T20:28:21.000Z | 2021-04-11T20:28:21.000Z | import dis
exec("""
def f():
""" + """
""".join(["X"+str(x)+"=" + str(x) for x in range(65539)]))
f()
print(dis.dis(f))
| 13 | 62 | 0.453846 | 21 | 130 | 2.809524 | 0.619048 | 0.135593 | 0.169492 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048544 | 0.207692 | 130 | 9 | 63 | 14.444444 | 0.524272 | 0 | 0 | 0 | 0 | 0 | 0.161538 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.142857 | 0 | 0.142857 | 0.142857 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.