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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
56e6322f9be1289b2d9d34258e2cdef548121a3d | 299 | py | Python | mlm/apps/main/exceptions.py | pierreclaverkoko/django-mlm-system | abfd895003b1ab59c6d0bfb4a06051ac6e4ca90f | [
"MIT"
] | null | null | null | mlm/apps/main/exceptions.py | pierreclaverkoko/django-mlm-system | abfd895003b1ab59c6d0bfb4a06051ac6e4ca90f | [
"MIT"
] | null | null | null | mlm/apps/main/exceptions.py | pierreclaverkoko/django-mlm-system | abfd895003b1ab59c6d0bfb4a06051ac6e4ca90f | [
"MIT"
] | 1 | 2020-06-09T09:16:57.000Z | 2020-06-09T09:16:57.000Z | """
MLM Client Related Exceptions
"""
class MLMException(Exception):
pass
class InvalidClientParentError(MLMException):
pass
class InvalidAffiliationError(MLMException):
pass
class OperationAmountError(MLMException):
pass
class OperationClientError(MLMException):
pass
| 12.458333 | 45 | 0.759197 | 24 | 299 | 9.458333 | 0.5 | 0.15859 | 0.277533 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170569 | 299 | 23 | 46 | 13 | 0.915323 | 0.09699 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
56f452b9f19ee9abf7d4b3f6702ce8e0292f4421 | 182 | py | Python | python_challenges/tests/test_pandigital.py | bruckhaus/challenges | c53d13fa89bd5ac0436310a6cfe82cfc3b2d122f | [
"MIT"
] | 1 | 2015-09-28T18:05:39.000Z | 2015-09-28T18:05:39.000Z | python_challenges/tests/test_pandigital.py | bruckhaus/challenges | c53d13fa89bd5ac0436310a6cfe82cfc3b2d122f | [
"MIT"
] | null | null | null | python_challenges/tests/test_pandigital.py | bruckhaus/challenges | c53d13fa89bd5ac0436310a6cfe82cfc3b2d122f | [
"MIT"
] | 2 | 2016-09-21T00:42:51.000Z | 2017-11-28T19:56:00.000Z | import unittest
import pandigital
class TestPandigital(unittest.TestCase):
def test_pandigital(self):
self.assertEqual(7652413, pandigital.Pandigital().largest_prime()) | 26 | 74 | 0.78022 | 19 | 182 | 7.368421 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044025 | 0.126374 | 182 | 7 | 74 | 26 | 0.836478 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 4 |
710369b0521b5c48ad2b8214ee404037121e08d7 | 1,517 | py | Python | src/bos_consensus/common/message.py | LuffyEMonkey/isaac-consensus-protocol | 806d967d56ef8862a477b2515c7854af289c10a0 | [
"Apache-2.0"
] | 1 | 2018-04-10T11:00:59.000Z | 2018-04-10T11:00:59.000Z | src/bos_consensus/common/message.py | LuffyEMonkey/isaac-consensus-protocol | 806d967d56ef8862a477b2515c7854af289c10a0 | [
"Apache-2.0"
] | null | null | null | src/bos_consensus/common/message.py | LuffyEMonkey/isaac-consensus-protocol | 806d967d56ef8862a477b2515c7854af289c10a0 | [
"Apache-2.0"
] | null | null | null | import copy
import lorem
import json
from bos_consensus.util import get_uuid
class Message:
message_id = None
data = None
def __init__(self, message_id, data):
self.message_id = message_id
self.data = data
def __repr__(self):
return '<Message: message_id=%(message_id)s data="%(data)s">' % self.__dict__
def __eq__(self, a):
return self.message_id == a.message_id and self.data == a.data
def __gt__(self, rhs):
return self.message_id < rhs.message_id
def __ge__(self, rhs):
return self < rhs or self == rhs
def eq_id(self, rhs):
return self.message_id == rhs.message_id
def __copy__(self):
return self.__class__(
self.message_id,
copy.copy(self.data),
)
def serialize(self, to_string=False):
o = dict(
message_id=self.message_id,
data=self.data,
)
if not to_string:
return o
return json.dumps(o)
@classmethod
def new(cls, data=None):
if data is None:
data = '%s-%s' % (lorem.sentence().split()[0], get_uuid())
return cls(
get_uuid(),
data=data,
)
@classmethod
def from_string(cls, s):
o = json.loads(s)
return cls(
o['message_id'],
o['data'],
)
@classmethod
def from_dict(cls, o):
return cls(
o['message_id'],
o['data'],
)
| 20.780822 | 85 | 0.539222 | 192 | 1,517 | 3.958333 | 0.234375 | 0.201316 | 0.119737 | 0.075 | 0.226316 | 0.171053 | 0.171053 | 0.107895 | 0.107895 | 0.107895 | 0 | 0.001012 | 0.348715 | 1,517 | 72 | 86 | 21.069444 | 0.768219 | 0 | 0 | 0.185185 | 0 | 0 | 0.056032 | 0.01648 | 0 | 0 | 0 | 0 | 0 | 1 | 0.203704 | false | 0 | 0.074074 | 0.12963 | 0.537037 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
710473b8f82f52468b9000b9822ff7d36ffc9a44 | 32 | py | Python | tests/aws/__init__.py | bothejjms/treadmill-aws | 18d650be09d1054386066fb6993de3af6ec6a42e | [
"Apache-2.0"
] | 6 | 2018-05-24T17:17:51.000Z | 2020-06-06T02:21:59.000Z | tests/aws/__init__.py | bothejjms/treadmill-aws | 18d650be09d1054386066fb6993de3af6ec6a42e | [
"Apache-2.0"
] | 93 | 2018-04-16T16:14:40.000Z | 2019-09-17T22:10:28.000Z | tests/aws/__init__.py | bothejjms/treadmill-aws | 18d650be09d1054386066fb6993de3af6ec6a42e | [
"Apache-2.0"
] | 17 | 2017-09-29T10:30:47.000Z | 2019-01-28T21:52:03.000Z | """Tests for treadmill.aws.*"""
| 16 | 31 | 0.625 | 4 | 32 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09375 | 32 | 1 | 32 | 32 | 0.689655 | 0.78125 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
8535e39ab7f23e331daaca741065ac95ae1bd566 | 109 | py | Python | tarakania_rpg/rpg/items/alchemy_ingredient.py | MKokyn/discord-bot | 00f58512739be9b2eec1adb16214c72da59e696b | [
"MIT"
] | 1 | 2021-06-04T16:50:42.000Z | 2021-06-04T16:50:42.000Z | tarakania_rpg/rpg/items/alchemy_ingredient.py | MKokyn/discord-bot | 00f58512739be9b2eec1adb16214c72da59e696b | [
"MIT"
] | 3 | 2021-06-02T00:22:51.000Z | 2021-06-03T15:20:25.000Z | tarakania_rpg/rpg/items/alchemy_ingredient.py | MKokyn/discord-bot | 00f58512739be9b2eec1adb16214c72da59e696b | [
"MIT"
] | 2 | 2019-08-22T07:30:12.000Z | 2021-06-04T16:49:42.000Z | from rpg.items import Item
class AlchemyIngredient(Item):
config_filename = "alchemy_ingredients.yaml"
| 18.166667 | 48 | 0.788991 | 13 | 109 | 6.461538 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137615 | 109 | 5 | 49 | 21.8 | 0.893617 | 0 | 0 | 0 | 0 | 0 | 0.220183 | 0.220183 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 4 |
855d098f9540af73df2711efa1c821ff4d9f75eb | 21,384 | py | Python | src/jstools/screeps/classes/lodash.py | daboross/screeps-ai-v2 | 8bb49f59c8c745801d1aef54e1734e28414171e7 | [
"MIT"
] | 2 | 2020-08-28T01:26:05.000Z | 2021-04-04T03:03:34.000Z | src/jstools/screeps/classes/lodash.py | daboross/screeps-ai-v2 | 8bb49f59c8c745801d1aef54e1734e28414171e7 | [
"MIT"
] | null | null | null | src/jstools/screeps/classes/lodash.py | daboross/screeps-ai-v2 | 8bb49f59c8c745801d1aef54e1734e28414171e7 | [
"MIT"
] | null | null | null | from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union
_L1 = TypeVar('_L1')
_L2 = TypeVar('_L2')
_L3 = TypeVar('_L3', int, float)
_LodashPredicate = Union[Dict[str, Any], Callable[[_L1], bool], None, str]
_LodashIteratee = Union[str, Callable[[_L1], _L2], None]
_Collection = Union[List[_L1], Dict[Any, _L1]]
# noinspection PyPep8Naming
class _LodashChain:
def __init__(self, value):
self.__inner = value
def concat(self, other: _Collection) -> '_LodashChain':
pass
def chunk(self, size: int = 1) -> '_LodashChain':
pass
def compact(self) -> '_LodashChain':
pass
def difference(self, *other: List[_L1]) -> '_LodashChain':
pass
def drop(self, n: int = 1) -> '_LodashChain':
pass
def dropRight(self, n: int = 1) -> '_LodashChain':
pass
def dropRightWhile(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> '_LodashChain':
pass
def dropWhile(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> '_LodashChain':
pass
def fill(self, value: _L1, start: int = 0, end: int = 0) -> '_LodashChain':
pass
def first(self) -> Optional[_L1]:
pass
def flatten(self) -> '_LodashChain':
pass
def flattenDeep(self) -> '_LodashChain':
pass
def initial(self) -> List[_L1]:
pass
def intersection(self, arrays: List[List[_L1]]) -> '_LodashChain':
pass
def last(self) -> Optional[Any]:
pass
def lastIndexOf(self, value: _L1, fromIndex: Union[int, bool] = 0) -> int:
pass
def pull(self, values: List[_L1]) -> '_LodashChain':
pass
def pullAt(self, indices: List[int]) -> '_LodashChain':
pass
def remove(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> '_LodashChain':
pass
def rest(self) -> '_LodashChain':
pass
def slice(self, start: int = 0, end: int = 0) -> '_LodashChain':
pass
def sortedIndex(self, value: _L1, iteratee: _LodashIteratee = None, thisArg: Any = None) -> int:
pass
def sortedLastIndex(self, value: _L1, iteratee: _LodashIteratee = None, thisArg: Any = None) -> int:
pass
def take(self, n: int = 1) -> '_LodashChain':
pass
def takeRight(self, n: int = 1) -> '_LodashChain':
pass
def takeRightWhile(self, predicate: _LodashIteratee = None, thisArg: Any = None) -> '_LodashChain':
pass
def takeWhile(self, predicate: _LodashIteratee = None, thisArg: Any = None) -> '_LodashChain':
pass
def union(self, arrays: List[List[_L1]]) -> '_LodashChain':
pass
def unique(self, isSorted: bool = False, iteratee: _LodashIteratee = None, thisArg: Any = None):
pass
def uniq(self, isSorted: bool = False, iteratee: _LodashIteratee = None, thisArg: Any = None):
pass
def unzip(self) -> '_LodashChain':
pass
def unzipWith(self, iteratee: Optional[Callable[[Any, Any, Any, Any], Any]] = None,
thisArg: Any = None) -> '_LodashChain':
pass
def without(self, values: List[_L1]) -> '_LodashChain':
pass
def xor(self, arrays: List[List[_L1]]) -> '_LodashChain':
pass
def zip(self) -> '_LodashChain':
pass
def zipObject(self, values: Optional[List[Any]] = None) -> '_LodashChain':
pass
def zipWith(self, iteratee: Optional[Callable[[Any, Any, Any, Any]]] = None, thisArg: Any = None) -> '_LodashChain':
pass
def all(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> bool:
pass
def any(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> bool:
pass
def at(self, *props: Any) -> List[_L1]:
pass
def countBy(self, iteratee: _LodashIteratee = None, thisArg: Any = None) -> '_LodashChain':
pass
def every(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> bool:
pass
def filter(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> '_LodashChain':
pass
def find(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> _L1:
pass
def findLast(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> _L1:
pass
def findWhere(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> _L1:
pass
def forEach(self, iteratee: Callable[[_L1], Optional[bool]] = None, thisArg: Any = None):
pass
def forEachRight(self, iteratee: Callable[[_L1], Optional[bool]] = None, thisArg: Any = None):
pass
def groupBy(self, iteratee: _LodashIteratee = None, thisArg: Any = None) -> '_LodashChain':
pass
def includes(self, value: _L1, fromIndex: int = 0) -> bool:
pass
def indexBy(self, iteratee: _LodashIteratee = None, thisArg: Any = None) -> Dict[str, _L1]:
pass
def invoke(self, path: str, *args: Any) -> '_LodashChain':
pass
def map(self, iteratee: _LodashIteratee = None, thisArg: Any = None) -> '_LodashChain':
pass
def partition(self, predicate: _LodashPredicate = None, thisArg: Any = None) \
-> '_LodashChain':
pass
def pluck(self, path: Union[str, List[str]]) -> '_LodashChain':
pass
def reduce(self, iteratee: Callable[[_L2, _L1], _L2] = None, accumulator: _L2 = None,
thisArg: Any = None) -> _L2:
pass
def reduceRight(self, iteratee: Callable[[_L2, _L1], _L2] = None, accumulator: _L2 = None,
thisArg: Any = None) -> _L2:
pass
def reject(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> '_LodashChain':
pass
def sample(self) -> Any:
pass
def shuffle(self) -> '_LodashChain':
pass
def size(self) -> int:
pass
def some(self, predicate: _LodashPredicate = None, thisArg: Any = None) -> bool:
pass
def sortBy(self, iteratee: _LodashIteratee = None, thisArg: Any = None) -> '_LodashChain':
pass
def sortByAll(self, *iteratee: _LodashIteratee) -> '_LodashChain':
pass
def sortByOrder(self, iteratees: List[_LodashIteratee], orders: List[str]) -> '_LodashChain':
pass
def where(self, source: Any) -> '_LodashChain':
pass
def toArray(self) -> '_LodashChain':
pass
def toPlainObject(self) -> '_LodashChain':
pass
def sum(self, iteratee: _LodashIteratee = lambda x: x, thisArg: Any = None) -> _L2:
pass
def keys(self) -> '_LodashChain':
pass
def mapKeys(self, iteratee: Callable[[str], str] = None, thisArg: Any = None) -> '_LodashChain':
pass
def mapValues(self, iteratee: Callable[[Any], Any] = None, thisArg: Any = None) -> '_LodashChain':
pass
def omit(self, predicate: _LodashPredicate, thisArg: Any = None) -> '_LodashChain':
pass
def pairs(self) -> '_LodashChain':
pass
def values(self) -> '_LodashChain':
pass
def value(self) -> Any:
pass
def max(self, iteratee: Callable[[_L1], _L3] = None, thisArg: Any = None) -> _L1:
pass
def min(self, iteratee: Callable[[_L1], _L3] = None, thisArg: Any = None) -> _L1:
pass
# noinspection PyPep8Naming
class _:
def __new__(cls, value) -> _LodashChain:
return _LodashChain(value)
@staticmethod
def chunk(array: List[_L1], size: int = 1) -> List[List[_L1]]:
pass
@staticmethod
def compact(array: List[_L1]) -> List[_L1]:
pass
@staticmethod
def difference(array: List[_L1], *other: List[_L1]) -> List[_L1]:
pass
@staticmethod
def drop(array: List[_L1], n: int = 1) -> List[_L1]:
pass
@staticmethod
def dropRight(array: List[_L1], n: int = 1) -> List[_L1]:
pass
@staticmethod
def dropRightWhile(array: List[_L1], predicate: _LodashPredicate = None, thisArg: Any = None) -> List[_L1]:
pass
@staticmethod
def dropWhile(array: List[_L1], predicate: _LodashPredicate = None, thisArg: Any = None) -> List[_L1]:
pass
@staticmethod
def fill(array: List[_L1], value: _L1, start: int = 0, end: int = 0) -> List[_L1]:
pass
@staticmethod
def findIndex(array: List[_L1], predicate: _LodashPredicate = None, thisArg: Any = None) -> int:
pass
@staticmethod
def findLastIndex(array: List[_L1], predicate: _LodashPredicate = None, thisArg: Any = None) -> int:
pass
@staticmethod
def first(array: List[_L1]) -> Optional[_L1]:
pass
@staticmethod
def flatten(array: List[List[_L1]]) -> List[_L1]:
pass
@staticmethod
def flattenDeep(array: List[Any]) -> List[Any]:
pass
@staticmethod
def indexOf(array: List[_L1], value: _L1, fromIndex: Union[int, bool] = 0) -> int:
pass
@staticmethod
def initial(array: List[_L1]) -> List[_L1]:
pass
@staticmethod
def intersection(array: List[List[_L1]]) -> List[_L1]:
pass
@staticmethod
def last(array: List[_L1]) -> Optional[_L1]:
pass
@staticmethod
def lastIndexOf(array: List[_L1], value: _L1, fromIndex: Union[int, bool] = 0) -> int:
pass
@staticmethod
def pull(array: List[_L1], *values: _L1) -> List[_L1]:
pass
@staticmethod
def pullAt(array: List[_L1], *indices: int) -> List[_L1]:
pass
@staticmethod
def remove(array: List[_L1], predicate: _LodashPredicate = None, thisArg: Any = None) -> List[_L1]:
pass
@staticmethod
def rest(array: List[_L1]) -> List[_L1]:
pass
@staticmethod
def slice(array: List[_L1], start: int = 0, end: int = 0) -> List[_L1]:
pass
@staticmethod
def sortedIndex(array: List[_L1], value: _L1, iteratee: _LodashIteratee = None, thisArg: Any = None) -> int:
pass
@staticmethod
def sortedLastIndex(array: List[_L1], value: _L1, iteratee: _LodashIteratee = None, thisArg: Any = None) -> int:
pass
@staticmethod
def take(array: List[_L1], n: int = 1) -> List[_L1]:
pass
@staticmethod
def takeRight(array: List[_L1], n: int = 1) -> List[_L1]:
pass
@staticmethod
def takeRightWhile(array: List[_L1], predicate: _LodashIteratee = None, thisArg: Any = None) -> List[_L1]:
pass
@staticmethod
def takeWhile(array: List[_L1], predicate: _LodashIteratee = None, thisArg: Any = None) -> List[_L1]:
pass
@staticmethod
def union(array: List[List[_L1]]) -> List[_L1]:
pass
@staticmethod
def unique(array: List[_L1], isSorted: bool = False, iteratee: _LodashIteratee = None, thisArg: Any = None):
pass
@staticmethod
def uniq(array: List[_L1], isSorted: bool = False, iteratee: _LodashIteratee = None, thisArg: Any = None):
pass
@staticmethod
def unzip(array: List[Any]) -> List[Any]:
pass
@staticmethod
def unzipWith(array: List[Any], iteratee: Optional[Callable[[Any, Any, Any, Any], Any]] = None,
thisArg: Any = None):
pass
@staticmethod
def without(array: List[_L1], values: List[_L1]) -> List[_L1]:
pass
@staticmethod
def xor(array: List[List[_L1]]) -> List[_L1]:
pass
@staticmethod
def zip(array: List[Any]) -> List[Any]:
pass
@staticmethod
def zipObject(props: List[Any], values: Optional[List[Any]] = None) -> Any:
pass
@staticmethod
def zipWith(array: List[Any], iteratee: Optional[Callable[[Any, Any, Any, Any]]] = None, thisArg: Any = None):
pass
@staticmethod
def all(collection: List[_L1], predicate: _LodashPredicate = None, thisArg: Any = None) -> bool:
pass
@staticmethod
def any(collection: _Collection, predicate: _LodashPredicate = None, thisArg: Any = None) -> bool:
pass
@staticmethod
def at(collection: _Collection, *props: Any) -> List[_L1]:
pass
@staticmethod
def countBy(collection: _Collection, iteratee: _LodashIteratee = None, thisArg: Any = None) -> Dict[_L2, int]:
pass
@staticmethod
def every(collection: _Collection, predicate: _LodashPredicate = None, thisArg: Any = None) -> bool:
pass
@staticmethod
def filter(collection: _Collection, predicate: _LodashPredicate = None, thisArg: Any = None) -> List[_L1]:
pass
@staticmethod
def find(collection: _Collection, predicate: _LodashPredicate = None, thisArg: Any = None) -> _L1:
pass
@staticmethod
def findLast(collection: _Collection, predicate: _LodashPredicate = None, thisArg: Any = None) -> _L1:
pass
@staticmethod
def findWhere(collection: Any, predicate: _LodashPredicate = None, thisArg: Any = None) -> _L1:
pass
@staticmethod
def forEach(collection: _Collection, iteratee: Callable[[_L1], Optional[bool]] = None, thisArg: Any = None):
pass
@staticmethod
def forEachRight(collection: _Collection, iteratee: Callable[[_L1], Optional[bool]] = None, thisArg: Any = None):
pass
@staticmethod
def groupBy(collection: _Collection, iteratee: _LodashIteratee = None, thisArg: Any = None) -> Dict[_L2, List[_L1]]:
pass
@staticmethod
def includes(collection: Union[_Collection, str], value: _L1, fromIndex: int = 0) -> bool:
pass
@staticmethod
def indexBy(collection: _Collection, iteratee: _LodashIteratee = None, thisArg: Any = None) -> Dict[str, _L1]:
pass
@staticmethod
def invoke(collection: _Collection, path: str, *args: Any) -> Any:
pass
@staticmethod
def map(collection: _Collection, iteratee: _LodashIteratee = None, thisArg: Any = None) -> _L2:
pass
@staticmethod
def partition(collection: _Collection, predicate: _LodashPredicate = None, thisArg: Any = None) \
-> Tuple[List[_L1], List[_L1]]:
pass
@staticmethod
def pluck(collection: _Collection, path: Union[str, List[str]]) -> List[Any]:
pass
@staticmethod
def reduce(collection: _Collection, iteratee: Callable[[_L2, _L1], _L2] = None, accumulator: _L2 = None,
thisArg: Any = None) -> _L2:
pass
@staticmethod
def reduceRight(collection: _Collection, iteratee: Callable[[_L2, _L1], _L2] = None, accumulator: _L2 = None,
thisArg: Any = None) -> _L2:
pass
@staticmethod
def reject(collection: _Collection, predicate: _LodashPredicate = None, thisArg: Any = None) -> List[_L1]:
pass
@staticmethod
def sample(collection: _Collection) -> _L1:
pass
@staticmethod
def shuffle(collection: _Collection) -> List[_L1]:
pass
@staticmethod
def size(collection: Optional[_Collection]) -> int:
pass
@staticmethod
def some(collection: _Collection, predicate: _LodashPredicate = None, thisArg: Any = None) -> bool:
pass
@staticmethod
def sortBy(collection: _Collection, iteratee: _LodashIteratee = None, thisArg: Any = None) -> List[_L1]:
pass
@staticmethod
def sortByAll(collection: _Collection, *iteratee: _LodashIteratee) -> List[_L1]:
pass
@staticmethod
def sortByOrder(collection: _Collection, iteratees: List[_LodashIteratee], orders: List[str]) -> List[_L1]:
pass
@staticmethod
def where(collection: _Collection, source: Any) -> List[_L1]:
pass
@staticmethod
def clone(value: _L1) -> _L1:
pass
@staticmethod
def cloneDeep(value: _L1) -> _L1:
pass
@staticmethod
def gt(value: Any, other: Any) -> bool:
pass
@staticmethod
def gte(value: Any, other: Any) -> bool:
pass
@staticmethod
def isArguments(value: Any) -> bool:
pass
@staticmethod
def isArray(value: Any) -> bool:
pass
@staticmethod
def isBoolean(value: Any) -> bool:
pass
@staticmethod
def isDate(value: Any) -> bool:
pass
@staticmethod
def isElement(value: Any) -> bool:
pass
@staticmethod
def isEmpty(value: Any) -> bool:
pass
@staticmethod
def isEqual(value: Any, other: Any) -> bool:
pass
@staticmethod
def isError(value: Any) -> bool:
pass
@staticmethod
def isFinite(value: Any) -> bool:
pass
@staticmethod
def isFunction(value: Any) -> bool:
pass
@staticmethod
def isMatch(value: Any) -> bool:
pass
@staticmethod
def isNaN(value: Any) -> bool:
pass
@staticmethod
def isNative(value: Any) -> bool:
pass
@staticmethod
def isNull(value: Any) -> bool:
pass
@staticmethod
def isNumber(value: Any) -> bool:
pass
@staticmethod
def isObject(value: Any) -> bool:
pass
@staticmethod
def isPlainObject(value: Any) -> bool:
pass
@staticmethod
def isRegExp(value: Any) -> bool:
pass
@staticmethod
def isString(value: Any) -> bool:
pass
@staticmethod
def isTypedArray(value: Any) -> bool:
pass
@staticmethod
def isUndefined(value: Any) -> bool:
pass
@staticmethod
def lt(value: Any, other: Any) -> bool:
pass
@staticmethod
def lte(value: Any, other: Any) -> bool:
pass
@staticmethod
def toArray(value: Any) -> List[Any]:
pass
@staticmethod
def toPlainObject(value: Any) -> Any:
pass
@staticmethod
def add(augend: Union[int, float], addend: Union[int, float]) -> Union[int, float]:
pass
@staticmethod
def ceil(n: Union[int, float], precision: int = 0) -> Union[int, float]:
pass
@staticmethod
def floor(n: Union[int, float], precision: int = 0) -> Union[int, float]:
pass
@staticmethod
def max(collection: _Collection, iteratee: _LodashIteratee = lambda x: x, thisArg: Any = None) -> _L1:
pass
@staticmethod
def min(collection: _Collection, iteratee: _LodashIteratee = lambda x: x, thisArg: Any = None) -> _L1:
pass
@staticmethod
def round(n: Union[int, float], precision: int = 0) -> Union[int, float]:
pass
@staticmethod
def sum(collection: _Collection, iteratee: _LodashIteratee = lambda x: x, thisArg: Any = None) -> _L3:
pass
@staticmethod
def extend(_object: Any, *sources: Any) -> Any:
pass
@staticmethod
def assign(_object: Any, *sources: Any) -> Any:
pass
@staticmethod
def create(prototype: Type[_L1], properties: Any = None) -> _L1:
pass
@staticmethod
def defaults(_object: Any, *sources: Any) -> Any:
pass
@staticmethod
def defaultsDeep(_object: Any, *sources: Any) -> Any:
pass
@staticmethod
def findKey(_object: Any, predicate: _LodashPredicate = None, thisArg: Any = None) -> str:
pass
@staticmethod
def findLastKey(_object: Any, predicate: _LodashPredicate = None, thisArg: Any = None) -> str:
pass
@staticmethod
def forIn(_object: Any, iteratee: Callable[[_L1], Optional[bool]] = None, thisArg: Any = None):
pass
@staticmethod
def forInRight(_object: Any, iteratee: Callable[[_L1], Optional[bool]] = None, thisArg: Any = None):
pass
@staticmethod
def forOwn(_object: Any, iteratee: Callable[[_L1], Optional[bool]] = None, thisArg: Any = None):
pass
@staticmethod
def functions(_object: Any) -> List[str]:
pass
@staticmethod
def get(_object: Any, path: Union[str, List[str]], defaultValue: _L1 = None) -> _L1:
pass
@staticmethod
def has(_object: Any, path: str) -> bool:
pass
@staticmethod
def invert(_object: Any) -> Dict[str, str]:
pass
@staticmethod
def keys(_object: Any) -> List[str]:
pass
@staticmethod
def keysIn(_object: Any) -> List[str]:
pass
@staticmethod
def mapKeys(_object: Any, iteratee: Callable[[str], str] = None, thisArg: Any = None) -> Any:
pass
@staticmethod
def mapValues(_object: Any, iteratee: Callable[[Any], Any] = None, thisArg: Any = None) -> Any:
pass
@staticmethod
def merge(_object: Any, *sources: Any) -> Any:
pass
@staticmethod
def omit(_object: Any, predicate: _LodashPredicate, thisArg: Any = None) -> Any:
pass
@staticmethod
def pairs(_object: Any) -> List[Tuple[str, Any]]:
pass
@staticmethod
def pick(_object: Any, predicate: _LodashPredicate, thisArg: Any = None) -> Any:
pass
@staticmethod
def result(_object: Any, path: str, defaultValue: _L1 = None) -> _L1:
pass
@staticmethod
def set(_object: Any, path: str, value: Any):
pass
@staticmethod
def transform(_object: Any, iteratee: Callable[[_L2, _L1], _L2] = None, accumulator: _L2 = None,
thisArg: Any = None) -> _L2:
pass
@staticmethod
def values(_object: Union[Dict[str, _L2], Any]) -> List[_L2]:
pass
@staticmethod
def valuesIn(_object: Union[Dict[str, _L2], Any]) -> List[_L2]:
pass
| 27.102662 | 120 | 0.606809 | 2,328 | 21,384 | 5.419674 | 0.085481 | 0.155742 | 0.195768 | 0.105572 | 0.74249 | 0.704367 | 0.625268 | 0.588967 | 0.484267 | 0.453198 | 0 | 0.012792 | 0.268846 | 21,384 | 788 | 121 | 27.137056 | 0.79418 | 0.002385 | 0 | 0.604203 | 0 | 0 | 0.028551 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.369527 | false | 0.366025 | 0.001751 | 0.001751 | 0.376532 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
85857f56bf289ccb2ce259d9a4444ccf9e0de49f | 101 | py | Python | Tools/Builder/plugins/ninja.py | hung0913208/Base | 420b4ce8e08f9624b4e884039218ffd233b88335 | [
"BSD-3-Clause"
] | null | null | null | Tools/Builder/plugins/ninja.py | hung0913208/Base | 420b4ce8e08f9624b4e884039218ffd233b88335 | [
"BSD-3-Clause"
] | null | null | null | Tools/Builder/plugins/ninja.py | hung0913208/Base | 420b4ce8e08f9624b4e884039218ffd233b88335 | [
"BSD-3-Clause"
] | 2 | 2020-11-04T08:00:37.000Z | 2020-11-06T08:33:33.000Z | from . import BuildTool
class Ninja(BuildTool):
def __init__(self):
super(Ninja, self).__init__() | 20.2 | 31 | 0.742574 | 13 | 101 | 5.153846 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128713 | 101 | 5 | 31 | 20.2 | 0.761364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 4 |
85a745b4a66c067f0b265835f7641c65c3f33ba9 | 1,519 | py | Python | plugins/FTP.py | sooualil/atlas-feature-extraction-extension | d0f9284ff710d095b1b61c226a28de26f738dd0c | [
"BSD-3-Clause"
] | null | null | null | plugins/FTP.py | sooualil/atlas-feature-extraction-extension | d0f9284ff710d095b1b61c226a28de26f738dd0c | [
"BSD-3-Clause"
] | null | null | null | plugins/FTP.py | sooualil/atlas-feature-extraction-extension | d0f9284ff710d095b1b61c226a28de26f738dd0c | [
"BSD-3-Clause"
] | null | null | null | from nfstream import NFPlugin
from scapy.all import IP
class AuxFTPFeatures(NFPlugin):
"""
This pluguin extracts FTP flow features
Attributes
----------
flow.udps.ftp_command_ret_code: %FTP_COMMAND_RET_CODE FTP client command return code
"""
def on_init(self, packet, flow):
flow.udps.ftp_command_ret_code = 0
try:
if packet.protocol == 6 and (packet.dst_port == 21 or packet.src_port == 21) and packet.direction == 1:
s_packet = IP(packet.ip_packet)
if hasattr(s_packet.getlayer(2), 'load'):
load = s_packet.getlayer(2).load
numbs = [int(word) for word in load.split() if word.isdigit()]
if len(numbs) > 0 and numbs[0] <= 10068 and numbs[0] >= 100:
flow.udps.ftp_command_ret_code = numbs[0]
except:
pass
def on_update(self, packet, flow):
try:
if packet.protocol == 6 and (packet.dst_port == 21 or packet.src_port == 21) and packet.direction == 1:
s_packet = IP(packet.ip_packet )
if hasattr(s_packet.getlayer(2), 'load'):
load = s_packet.getlayer(2).load
numbs = [int(word) for word in load.split() if word.isdigit()]
if len(numbs) > 0 and numbs[0] <= 10068 and numbs[0] >= 100:
flow.udps.ftp_command_ret_code = numbs[0]
except:
pass
| 37.975 | 115 | 0.546412 | 195 | 1,519 | 4.107692 | 0.297436 | 0.059925 | 0.081149 | 0.106117 | 0.764045 | 0.739076 | 0.676654 | 0.676654 | 0.676654 | 0.676654 | 0 | 0.041289 | 0.34628 | 1,519 | 39 | 116 | 38.948718 | 0.765358 | 0.096774 | 0 | 0.769231 | 0 | 0 | 0.00597 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0.076923 | 0.076923 | 0 | 0.192308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
85ab2594a667500ba558fa7df3da7b20d1534b30 | 330 | py | Python | upwork/compatibility.py | alexandru-grajdeanu/python-upwork | ffe7994c084c88c455a386791e4ec62a93bb7b6a | [
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2020-05-17T17:13:28.000Z | 2020-05-17T17:13:28.000Z | upwork/compatibility.py | frolenkov-nikita/python-upwork | d052f5caedc632c73ad770b1f822a8a494f6b34b | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | upwork/compatibility.py | frolenkov-nikita/python-upwork | d052f5caedc632c73ad770b1f822a8a494f6b34b | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | import sys
if sys.version_info > (3, 0, 0):
from urllib import parse as urlparse
from urllib.parse import quote, urlencode
from urllib.error import HTTPError
from http import client as httplib
else:
import urlparse
import httplib
from urllib import quote, urlencode
from urllib2 import HTTPError
| 23.571429 | 45 | 0.730303 | 46 | 330 | 5.217391 | 0.456522 | 0.166667 | 0.133333 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01581 | 0.233333 | 330 | 13 | 46 | 25.384615 | 0.932806 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.818182 | 0 | 0.818182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
a4258d757abacd0bc85f4c31950e054e74b260b6 | 26 | py | Python | cogeo_siege/scripts/__init__.py | developmentseed/cogeo-siege | 85b6e67c30501a17d2acd452c7b10f7e85705a0f | [
"MIT"
] | 1 | 2022-02-24T00:07:28.000Z | 2022-02-24T00:07:28.000Z | cogeo_siege/scripts/__init__.py | developmentseed/cogeo-siege | 85b6e67c30501a17d2acd452c7b10f7e85705a0f | [
"MIT"
] | 1 | 2022-02-23T23:25:49.000Z | 2022-02-23T23:25:49.000Z | cogeo_siege/scripts/__init__.py | developmentseed/cogeo-siege | 85b6e67c30501a17d2acd452c7b10f7e85705a0f | [
"MIT"
] | null | null | null | """cogeo_siege.scripts"""
| 13 | 25 | 0.692308 | 3 | 26 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 26 | 1 | 26 | 26 | 0.68 | 0.730769 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
a4296bf385771bbac0af5379f404ef7fe29b0025 | 1,598 | py | Python | instagram_api/interfaces/storage/handler.py | Yuego/instagram_api | b53f72db36c505a2eb24ebac1ba8267a0cc295bb | [
"MIT"
] | 13 | 2019-08-07T21:24:34.000Z | 2020-12-12T12:23:50.000Z | instagram_api/interfaces/storage/handler.py | Yuego/instagram_api | b53f72db36c505a2eb24ebac1ba8267a0cc295bb | [
"MIT"
] | null | null | null | instagram_api/interfaces/storage/handler.py | Yuego/instagram_api | b53f72db36c505a2eb24ebac1ba8267a0cc295bb | [
"MIT"
] | null | null | null | from abc import ABCMeta, abstractmethod
from typing import Optional
from instagram_api.utils.http import ClientCookieJar
__all__ = ['StorageHandlerInterface']
class StorageHandlerInterface(metaclass=ABCMeta):
ON_CLOSE_USER = 'on_close_user'
SUPPORTED_CALLBACKS = [
ON_CLOSE_USER,
]
@abstractmethod
def has_user(self, username: str) -> bool: ...
@abstractmethod
def move_user(self, old_username: str, new_username: str): ...
@abstractmethod
def delete_user(self, username: str): ...
@abstractmethod
def set_active_user(self, username: str): ...
@abstractmethod
def is_maybe_logged_in(self) -> bool: ...
@abstractmethod
def erase_device_settings(self): ...
@abstractmethod
def get(self, key: str, default=None): ...
@abstractmethod
def set(self, key: str, value): ...
@abstractmethod
def has_cookies(self): ...
@abstractmethod
def get_cookies(self) -> Optional[ClientCookieJar]: ...
@abstractmethod
def set_cookies(self, jar: ClientCookieJar): ...
@abstractmethod
def reset_cookies(self): ...
@abstractmethod
def set_experiments(self, experiments: dict) -> dict: ...
@abstractmethod
def get_experiments(self) -> dict: ...
@abstractmethod
def set_rewrite_rules(self, rules: dict): ...
@abstractmethod
def get_rewrite_rules(self) -> dict: ...
# TODO: указать тип @auth
@abstractmethod
def set_fbns_auth(self, auth): ...
# TODO: указать тип возвращаемого значения
@abstractmethod
def get_fbns_auth(self): ...
| 22.828571 | 66 | 0.670839 | 171 | 1,598 | 6.046784 | 0.345029 | 0.295938 | 0.116054 | 0.055126 | 0.069633 | 0.069633 | 0 | 0 | 0 | 0 | 0 | 0 | 0.211514 | 1,598 | 69 | 67 | 23.15942 | 0.820635 | 0.04005 | 0 | 0.4 | 0 | 0 | 0.023514 | 0.015023 | 0 | 0 | 0 | 0.014493 | 0 | 1 | 0.4 | false | 0 | 0.066667 | 0 | 0.533333 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
a4641e3bd14fce6fd1cdf006810790f92c168c6b | 64 | py | Python | shipyard/rules/py/startup/build.py | clchiou/garage | 446ff34f86cdbd114b09b643da44988cf5d027a3 | [
"MIT"
] | 3 | 2016-01-04T06:28:52.000Z | 2020-09-20T13:18:40.000Z | shipyard/rules/py/startup/build.py | clchiou/garage | 446ff34f86cdbd114b09b643da44988cf5d027a3 | [
"MIT"
] | null | null | null | shipyard/rules/py/startup/build.py | clchiou/garage | 446ff34f86cdbd114b09b643da44988cf5d027a3 | [
"MIT"
] | null | null | null | from templates import py
py.define_package(package='startup')
| 12.8 | 36 | 0.796875 | 9 | 64 | 5.555556 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.109375 | 64 | 4 | 37 | 16 | 0.877193 | 0 | 0 | 0 | 0 | 0 | 0.109375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
a465c681bbcecbafcbbbef6e3236a642865ce721 | 186 | py | Python | pyleecan/Methods/Machine/CondType12/__init__.py | IrakozeFD/pyleecan | 5a93bd98755d880176c1ce8ac90f36ca1b907055 | [
"Apache-2.0"
] | 95 | 2019-01-23T04:19:45.000Z | 2022-03-17T18:22:10.000Z | pyleecan/Methods/Machine/CondType12/__init__.py | IrakozeFD/pyleecan | 5a93bd98755d880176c1ce8ac90f36ca1b907055 | [
"Apache-2.0"
] | 366 | 2019-02-20T07:15:08.000Z | 2022-03-31T13:37:23.000Z | pyleecan/Methods/Machine/CondType12/__init__.py | IrakozeFD/pyleecan | 5a93bd98755d880176c1ce8ac90f36ca1b907055 | [
"Apache-2.0"
] | 74 | 2019-01-24T01:47:31.000Z | 2022-02-25T05:44:42.000Z | from ....Methods.Machine.Conductor import CondCheckError
class Cond12CheckError(CondCheckError):
""" """
pass
class C12_WireDontFit(Cond12CheckError):
""" """
pass
| 13.285714 | 56 | 0.677419 | 15 | 186 | 8.333333 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0.193548 | 186 | 13 | 57 | 14.307692 | 0.793333 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.4 | 0.2 | 0 | 0.6 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 4 |
a49b6cc9f3755575a48e5f4a8edf7e048e7b253e | 46 | py | Python | ex 5.py | YasminMichels/Exercicios_LP_1b | ecd3e534ead6983be98225ce9c75362ce24fdfb9 | [
"MIT"
] | null | null | null | ex 5.py | YasminMichels/Exercicios_LP_1b | ecd3e534ead6983be98225ce9c75362ce24fdfb9 | [
"MIT"
] | null | null | null | ex 5.py | YasminMichels/Exercicios_LP_1b | ecd3e534ead6983be98225ce9c75362ce24fdfb9 | [
"MIT"
] | null | null | null | a= int(input("Digite algo: "))
print(type(a)) | 23 | 30 | 0.630435 | 8 | 46 | 3.625 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108696 | 46 | 2 | 31 | 23 | 0.707317 | 0 | 0 | 0 | 0 | 0 | 0.276596 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 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 | 1 | 0 | 4 |
f150d8462d1a30db8b58c296ae2511242b06049b | 89 | py | Python | django_gotolong/corpact/apps.py | ParikhKadam/gotolong | 839beb8aa37055a2078eaa289b8ae05b62e8905e | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 15 | 2019-12-06T16:19:45.000Z | 2021-08-20T13:22:22.000Z | django_gotolong/corpact/apps.py | ParikhKadam/gotolong | 839beb8aa37055a2078eaa289b8ae05b62e8905e | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 14 | 2020-12-08T10:45:05.000Z | 2021-09-21T17:23:45.000Z | django_gotolong/corpact/apps.py | ParikhKadam/gotolong | 839beb8aa37055a2078eaa289b8ae05b62e8905e | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 9 | 2020-01-01T03:04:29.000Z | 2021-04-18T08:42:30.000Z | from django.apps import AppConfig
class CorpactConfig(AppConfig):
name = 'corpact'
| 14.833333 | 33 | 0.752809 | 10 | 89 | 6.7 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168539 | 89 | 5 | 34 | 17.8 | 0.905405 | 0 | 0 | 0 | 0 | 0 | 0.078652 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 4 |
f16e2d9d7ac83793b0c32caba28b9fb527529452 | 3,198 | py | Python | scripts/__init__.py | kzbnb/numerical_bugs | bc22e72bcc06df6ce7889a25e0aeed027bde910b | [
"Apache-2.0"
] | 8 | 2021-06-30T06:55:14.000Z | 2022-03-18T01:57:14.000Z | scripts/__init__.py | kzbnb/numerical_bugs | bc22e72bcc06df6ce7889a25e0aeed027bde910b | [
"Apache-2.0"
] | 1 | 2021-06-30T03:08:15.000Z | 2021-06-30T03:08:15.000Z | scripts/__init__.py | kzbnb/numerical_bugs | bc22e72bcc06df6ce7889a25e0aeed027bde910b | [
"Apache-2.0"
] | 2 | 2021-11-17T11:19:48.000Z | 2021-11-18T03:05:58.000Z | # add '_grist' at the end of each path
case_dict = {
"GH_IPS1":["scripts.study_case.GH_IPS1.ghips1"],
"GH_IPS1_mutant":["scripts.study_case.GH_IPS1_mutant.ghips1_mutant"],
"GH_IPS6":["scripts.study_case.GH_IPS6.command_line.run_logistic_regression"],
"GH_IPS9":["scripts.study_case.GH_IPS9.ghips9"],
"handon_tensorflow":["scripts.study_case.handon_tensorflow.code_10_image"],
"MNIST":["scripts.study_case.MNIST.v3.train"],
"python_tensorflow":["scripts.study_case.python_tensorflow.mnist"],
"SO_IPS1":["scripts.study_case.SO_IPS1.soips1"],
"SO_IPS2":["scripts.study_case.SO_IPS2.soips2"],
"SO_IPS6":["scripts.study_case.SO_IPS6.soips6"],
"SO_IPS7":["scripts.study_case.SO_IPS7.soips7"],
"SO_IPS14":["scripts.study_case.SO_IPS14.soips14"],
"tensorflow_examples":["scripts.study_case.tensorflow_examples.logistic_regression"],
"tensorflow_examples_tutorials_mnist":["scripts.study_case.tensorflow_examples_tutorials_mnist.mnist_softmax"],
"Tensorflow_gesture_Demo":["scripts.study_case.Tensorflow_gesture_Demo.Mnist"],
"tensorflow_in_ml":["scripts.study_case.tensorflow_in_ml.softmax"],
"tensorflow_mnist":["scripts.study_case.tensorflow_mnist.mnist"],
"TensorFuzz":["scripts.study_case.TensorFuzz.nan_model_exp",
"scripts.study_case.TensorFuzz.nan_model_log"],
"tensorflow_value_iteration_networks_v1":["scripts.study_case.tensorflow_value_iteration_networks_v1.train"],
"generative_models_v1":["scripts.study_case.generative_models_v1.GAN.infogan.infogan_tensorflow"],
"generative_models_v2":["scripts.study_case.generative_models_v2.GAN.auxiliary_classifier_gan.ac_gan_tensorflow",
"scripts.study_case.generative_models_v2.GAN.ali_bigan.ali_bigan_tensorflow",
"scripts.study_case.generative_models_v2.GAN.boundary_seeking_gan.bgan_tensorflow",
"scripts.study_case.generative_models_v2.GAN.coupled_gan.cogan_tensorflow",
"scripts.study_case.generative_models_v2.GAN.disco_gan.discogan_tensorflow",
"scripts.study_case.generative_models_v2.GAN.mode_regularized_gan.mode_reg_gan_tensorflow",
"scripts.study_case.generative_models_v2.GAN.vanilla_gan.gan_tensorflow"],
"tf_unet":["scripts.study_case.tf_unet.test_toy"],
"pytorch_playground":["scripts.study_case.pytorch_playground.pytorch_pg"],
"SC_DNN":["scripts.study_case.SC_DNN.sc_train_creg"],
"skorch":["scripts.study_case.skorch.main"],
"RBM_grist":["scripts.study_case.RBM_grist.rbm"],
"pytorch_geometric_exp":["scripts.study_case.pytorch_geometric_exp.test.utils.test_softmax"],
"pytorch_geometric_fork":["scripts.study_case.pytorch_geometric_fork.test.nn.models.test_autoencoder"],
"Matchzoo":["scripts.study_case.MatchZoo_py.tests.test_losses"],
"MachineLearning":["scripts.study_case.MachineLearning.temp"],
"DeepLearningTest":["scripts.study_case.DeepLearning.deeplearningtest"],
"tensorflow_GAN_MNIST":["scripts.study_case.tensorflow_GAN_MNIST.GAN_MNIST"],
"gan_practice":["scripts.study_case.gan_practice.gan_mnist"]
} | 72.681818 | 119 | 0.74828 | 403 | 3,198 | 5.496278 | 0.263027 | 0.216704 | 0.288939 | 0.093905 | 0.33228 | 0.177427 | 0.146727 | 0.130023 | 0.045147 | 0 | 0 | 0.015564 | 0.11601 | 3,198 | 44 | 120 | 72.681818 | 0.767952 | 0.011257 | 0 | 0 | 0 | 0 | 0.791205 | 0.687441 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
f1849cfa0c662e04d3cd61cc922808d19f856851 | 128 | py | Python | tests/test_material.py | c-meyer/github-spielwiese | 0dad8df6277a09b2f250010b476854dc91d4d8ad | [
"BSD-3-Clause"
] | null | null | null | tests/test_material.py | c-meyer/github-spielwiese | 0dad8df6277a09b2f250010b476854dc91d4d8ad | [
"BSD-3-Clause"
] | null | null | null | tests/test_material.py | c-meyer/github-spielwiese | 0dad8df6277a09b2f250010b476854dc91d4d8ad | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 1 10:57:03 2015
@author: johannesr
"""
import scipy as sp
import numpy as np
| 11.636364 | 35 | 0.632813 | 22 | 128 | 3.681818 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 0.21875 | 128 | 10 | 36 | 12.8 | 0.69 | 0.609375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 4 |
74db8e1ef756d3d2c27f867212de0d8aeae4adac | 198 | py | Python | main.py | aliasav/smokeager-cli | e707c5df8145493e745e0e86cff84321118d95a5 | [
"MIT"
] | null | null | null | main.py | aliasav/smokeager-cli | e707c5df8145493e745e0e86cff84321118d95a5 | [
"MIT"
] | null | null | null | main.py | aliasav/smokeager-cli | e707c5df8145493e745e0e86cff84321118d95a5 | [
"MIT"
] | null | null | null | # maintain smoking habits via terminal
from smokeager import Smokeager
def main():
pass
def console_entry():
""" entry point for console scripts """
main()
if __name__=="__main__":
main()
| 13.2 | 40 | 0.707071 | 25 | 198 | 5.24 | 0.72 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 198 | 14 | 41 | 14.142857 | 0.808642 | 0.353535 | 0 | 0.285714 | 0 | 0 | 0.066667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | true | 0.142857 | 0.142857 | 0 | 0.428571 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
74e7099a6edef167dd2cf8fb2396d636285902ce | 288 | py | Python | spring_cloud/gateway/filter/__init__.py | haribo0915/Spring-Cloud-in-Python | 0bcd7093869c797df14428bf2d1b0a779f96e573 | [
"Apache-2.0"
] | 5 | 2020-10-06T09:48:23.000Z | 2020-10-07T13:19:46.000Z | spring_cloud/gateway/filter/__init__.py | haribo0915/Spring-Cloud-in-Python | 0bcd7093869c797df14428bf2d1b0a779f96e573 | [
"Apache-2.0"
] | 5 | 2020-10-05T09:57:01.000Z | 2020-10-12T19:52:48.000Z | spring_cloud/gateway/filter/__init__.py | haribo0915/Spring-Cloud-in-Python | 0bcd7093869c797df14428bf2d1b0a779f96e573 | [
"Apache-2.0"
] | 8 | 2020-10-05T06:34:49.000Z | 2020-10-07T13:19:46.000Z | # -*- coding: utf-8 -*-
from .filter import GatewayFilter, GatewayFilterChain, GlobalFilter, StaticGatewayFilterChain
from .http_headers_filter import (
HEADER_FILTERS,
ForwardedHeadersFilter,
HttpHeadersFilter,
RemoveHopByHopHeadersFilter,
XForwardedHeadersFilter,
)
| 28.8 | 93 | 0.78125 | 21 | 288 | 10.571429 | 0.857143 | 0.108108 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004065 | 0.145833 | 288 | 9 | 94 | 32 | 0.898374 | 0.072917 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 1 | 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 | 4 |
74e74d3afd9a20bd58d06142581bfc8c2798f671 | 2,359 | py | Python | test.py | mneeman/Removing_atmospheric_turbulence | cf0dc0ab503d6fe9dfa4f48d2fffc69f1e0899b6 | [
"MIT"
] | 4 | 2020-06-25T15:21:51.000Z | 2021-08-11T14:04:43.000Z | test.py | mneeman/Removing_atmospheric_turbulence | cf0dc0ab503d6fe9dfa4f48d2fffc69f1e0899b6 | [
"MIT"
] | 1 | 2021-05-29T08:22:30.000Z | 2021-05-29T08:22:30.000Z | test.py | mneeman/Removing_atmospheric_turbulence | cf0dc0ab503d6fe9dfa4f48d2fffc69f1e0899b6 | [
"MIT"
] | 2 | 2020-09-23T02:42:59.000Z | 2021-08-11T14:04:45.000Z | import torch
import os
from models import UNet
from data_util import MyDataset_test, MyDataset_test_moving
from functions import convert_im
def test(opt, log_dir, generator = None):
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
if generator == None:
generator = UNet(opt.sample_num, opt.channels, opt.batch_size, opt.alpha)
checkpoint = torch.load(opt.load_model, map_location=device)
generator.load_state_dict(checkpoint['g_state_dict'])
del checkpoint
torch.cuda.empty_cache()
generator.to(device)
generator.eval()
dataloader = torch.utils.data.DataLoader(MyDataset_test(opt), opt.batch_size, shuffle=True, num_workers=0)
for i, (imgs, filename) in enumerate(dataloader):
with torch.no_grad():
test_img = generator(imgs.to(device))
filename = filename[0].split('/')[-1]
filename = "test/" + filename +'.png'
test_img = convert_im(test_img, os.path.join(log_dir ,filename), nrow=5, normalize=True, save_im=True)
def test_moving(opt, log_dir, generator = None):
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
if generator == None:
generator = UNet(opt.sample_num, opt.channels, opt.batch_size, opt.alpha)
checkpoint = torch.load(opt.load_model, map_location=device)
generator.load_state_dict(checkpoint['g_state_dict'])
del checkpoint
torch.cuda.empty_cache()
generator.to(device)
generator.eval()
dataloader = torch.utils.data.DataLoader(MyDataset_test_moving(opt), opt.batch_size, shuffle=True, num_workers=opt.num_workers_dataloader)
for i, (imgs, filename) in enumerate(dataloader):
with torch.no_grad():
filename = filename[0].split('/')[-1]
for k in range(len(imgs)):
test_img = generator(imgs[k].to(device))
folder_path = os.path.join(log_dir, "test/%s" % filename)
os.makedirs(folder_path, exist_ok=True)
filename_ = filename + '_' + str(k) +'.png'
test_img = convert_im(test_img, os.path.join(folder_path ,filename_), nrow=5, normalize=True, save_im=True)
| 38.048387 | 142 | 0.635015 | 300 | 2,359 | 4.8 | 0.266667 | 0.029167 | 0.033333 | 0.025 | 0.759722 | 0.7125 | 0.7125 | 0.7125 | 0.6125 | 0.6125 | 0 | 0.003944 | 0.247563 | 2,359 | 61 | 143 | 38.672131 | 0.807324 | 0 | 0 | 0.571429 | 0 | 0 | 0.025913 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0 | 0.119048 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 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 | 4 |
2d300b2ec7e81709884aad112a2ebc3ca92877cf | 61 | py | Python | src/oc_stereo/builders/config_builder_util.py | adpon/oc_stereo | 6c0e3e1712047def0d3900d374291729056a726c | [
"MIT"
] | 3 | 2020-11-24T00:55:04.000Z | 2021-07-07T07:40:08.000Z | src/oc_stereo/builders/config_builder_util.py | adpon/oc_stereo | 6c0e3e1712047def0d3900d374291729056a726c | [
"MIT"
] | null | null | null | src/oc_stereo/builders/config_builder_util.py | adpon/oc_stereo | 6c0e3e1712047def0d3900d374291729056a726c | [
"MIT"
] | null | null | null | """Config file reader utils."""
class ConfigObj:
pass
| 8.714286 | 31 | 0.639344 | 7 | 61 | 5.571429 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.229508 | 61 | 6 | 32 | 10.166667 | 0.829787 | 0.409836 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
2d3d8716628e9d5b36c10eb7ba70dbca70f93757 | 252 | py | Python | aion/kanban/__init__.py | latonaio/python-base-images | 990561ef8e48e8db19410f88ef97eafe784589a5 | [
"MIT"
] | 10 | 2021-09-22T07:14:17.000Z | 2021-11-05T01:23:59.000Z | aion/kanban/__init__.py | latonaio/aion-related-python-library | 837e885e3368e3fc34ae41b07565a845c78970fd | [
"MIT"
] | null | null | null | aion/kanban/__init__.py | latonaio/aion-related-python-library | 837e885e3368e3fc34ae41b07565a845c78970fd | [
"MIT"
] | null | null | null | # coding: utf-8
# Copyright (c) 2019-2020 Latona. All rights reserved.
__all__ = ["kanban","async_kanban"]
from .kanban import KanbanConnection, KanbanNotFoundError, KanbanServerNotFoundError, Kanban
from .async_kanban import KanbanConnectionAsync
| 25.2 | 92 | 0.797619 | 27 | 252 | 7.222222 | 0.703704 | 0.112821 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040359 | 0.115079 | 252 | 9 | 93 | 28 | 0.834081 | 0.261905 | 0 | 0 | 0 | 0 | 0.098361 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 4 |
740f2d62c0a2aa9039bbed04d763e95627ecd184 | 99 | py | Python | atlas/deftcore/__init__.py | kiae-grid/panda-bigmon-atlas | babb883430de489e68c774bafe6c5f44f99d9a2d | [
"Apache-2.0"
] | null | null | null | atlas/deftcore/__init__.py | kiae-grid/panda-bigmon-atlas | babb883430de489e68c774bafe6c5f44f99d9a2d | [
"Apache-2.0"
] | 15 | 2015-01-06T13:41:52.000Z | 2022-03-30T10:37:25.000Z | atlas/deftcore/__init__.py | kiae-grid/panda-bigmon-atlas | babb883430de489e68c774bafe6c5f44f99d9a2d | [
"Apache-2.0"
] | 1 | 2017-07-20T08:01:24.000Z | 2017-07-20T08:01:24.000Z | """
DEFT API taken from https://github.com/retmas-dv/panda-deft/tree/master/deftcore/api/client
""" | 33 | 91 | 0.747475 | 16 | 99 | 4.625 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060606 | 99 | 3 | 92 | 33 | 0.795699 | 0.919192 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7431aef24f1494e51daa1bd1d7f9e892331bcfe0 | 82 | py | Python | python/testData/refactoring/rename/formatStringDictLiteral.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/refactoring/rename/formatStringDictLiteral.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/refactoring/rename/formatStringDictLiteral.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | "I want to rename this{to_be_r<caret>enamed}".format(**{"to_be_renamed": "value"}) | 82 | 82 | 0.719512 | 15 | 82 | 3.666667 | 0.8 | 0.145455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060976 | 82 | 1 | 82 | 82 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0.73494 | 0.313253 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
743419a88fc585315ab527df9c515504014d39a6 | 288 | py | Python | striatum/utils/misc.py | yangarbiter/dopamine | 408947981e18f22db308d695c8954112ca02041a | [
"BSD-2-Clause"
] | 108 | 2016-05-12T06:08:57.000Z | 2022-01-05T14:53:30.000Z | striatum/utils/misc.py | aldente0630/striatum | 408947981e18f22db308d695c8954112ca02041a | [
"BSD-2-Clause"
] | 77 | 2016-05-12T11:12:12.000Z | 2019-10-31T07:39:57.000Z | striatum/utils/misc.py | aldente0630/striatum | 408947981e18f22db308d695c8954112ca02041a | [
"BSD-2-Clause"
] | 39 | 2016-07-11T09:12:29.000Z | 2021-07-14T19:32:51.000Z | import numpy as np
def get_random_state(random_state=None):
if random_state is None:
random_state = np.random.RandomState()
elif not isinstance(random_state, np.random.RandomState):
random_state = np.random.RandomState(seed=random_state)
return random_state
| 28.8 | 63 | 0.743056 | 40 | 288 | 5.125 | 0.425 | 0.429268 | 0.190244 | 0.278049 | 0.439024 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180556 | 288 | 9 | 64 | 32 | 0.868644 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 1 | 1 | 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 | 4 |
744ef7e839c1076dfb3a86baf4fd540f07dce4bb | 168 | py | Python | src/urlfiller/forms.py | bartoszcholewa/promax-workflow | aef9ddd3fffe71e3c40eb622cd12c49bd4018f50 | [
"MIT"
] | null | null | null | src/urlfiller/forms.py | bartoszcholewa/promax-workflow | aef9ddd3fffe71e3c40eb622cd12c49bd4018f50 | [
"MIT"
] | null | null | null | src/urlfiller/forms.py | bartoszcholewa/promax-workflow | aef9ddd3fffe71e3c40eb622cd12c49bd4018f50 | [
"MIT"
] | null | null | null | from django import forms
class JoinForm(forms.Form):
url = forms.URLField(label='URL', widget=forms.TextInput(attrs={'placeholder': 'https://picturewall.pl/...'}))
| 28 | 111 | 0.720238 | 21 | 168 | 5.761905 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089286 | 168 | 6 | 112 | 28 | 0.79085 | 0 | 0 | 0 | 0 | 0 | 0.236686 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 4 |
7454080db49fb1b562273035d3aeca6265c63663 | 127 | py | Python | pyeccodes/defs/mars/grib_efhs_cd_def.py | ecmwf/pyeccodes | dce2c72d3adcc0cb801731366be53327ce13a00b | [
"Apache-2.0"
] | 7 | 2020-04-14T09:41:17.000Z | 2021-08-06T09:38:19.000Z | pyeccodes/defs/mars/grib_efhs_cd_def.py | ecmwf/pyeccodes | dce2c72d3adcc0cb801731366be53327ce13a00b | [
"Apache-2.0"
] | null | null | null | pyeccodes/defs/mars/grib_efhs_cd_def.py | ecmwf/pyeccodes | dce2c72d3adcc0cb801731366be53327ce13a00b | [
"Apache-2.0"
] | 3 | 2020-04-30T12:44:48.000Z | 2020-12-15T08:40:26.000Z | import pyeccodes.accessors as _
def load(h):
h.alias('mars.step', 'stepRange')
h.alias('mars.quantile', 'quantile')
| 15.875 | 40 | 0.661417 | 17 | 127 | 4.882353 | 0.705882 | 0.144578 | 0.240964 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165354 | 127 | 7 | 41 | 18.142857 | 0.783019 | 0 | 0 | 0 | 0 | 0 | 0.307087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
748bc89c951e4564bd5398241a4de07fca6b233e | 166 | py | Python | src/middleware/logger.py | shibuiwilliam/mlflow_hydra_optuna_the_easy_way | 484174a98937cf827db4efb8cc76bc6909e88a80 | [
"MIT"
] | 6 | 2021-10-13T23:40:00.000Z | 2021-11-16T14:58:15.000Z | src/middleware/logger.py | shibuiwilliam/mlflow_hydra_optuna_the_easy_way | 484174a98937cf827db4efb8cc76bc6909e88a80 | [
"MIT"
] | null | null | null | src/middleware/logger.py | shibuiwilliam/mlflow_hydra_optuna_the_easy_way | 484174a98937cf827db4efb8cc76bc6909e88a80 | [
"MIT"
] | null | null | null | import logging
import os
LOG_LEVEL = os.getenv("LOG_LEVEL", logging.DEBUG)
def configure_logger(name: str):
logger = logging.getLogger(name)
return logger
| 16.6 | 49 | 0.740964 | 23 | 166 | 5.217391 | 0.608696 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162651 | 166 | 9 | 50 | 18.444444 | 0.863309 | 0 | 0 | 0 | 0 | 0 | 0.054217 | 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 | 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 | 4 |
74a668c0c4996f7395710c9892ce1a9e30463cf7 | 171 | py | Python | entity/enemy/__init__.py | polowis/GodOfWar | 7e2c9a29ea9b6b41dea664cdeb5605727adf3859 | [
"MIT"
] | null | null | null | entity/enemy/__init__.py | polowis/GodOfWar | 7e2c9a29ea9b6b41dea664cdeb5605727adf3859 | [
"MIT"
] | null | null | null | entity/enemy/__init__.py | polowis/GodOfWar | 7e2c9a29ea9b6b41dea664cdeb5605727adf3859 | [
"MIT"
] | null | null | null | from .savager import Savager
from .dragon import Dragon
from .megaroche import Megaroche
from .goblin import Goblin
__all__ = ['Savager', 'Dragon', 'Megaroche', 'Goblin'] | 28.5 | 54 | 0.766082 | 21 | 171 | 6.047619 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128655 | 171 | 6 | 54 | 28.5 | 0.852349 | 0 | 0 | 0 | 0 | 0 | 0.162791 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 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 | 1 | 0 | 0 | 4 |
77698d297b9be91fbb6c85c94078c5c6f3ef7a7d | 184 | py | Python | geotrek/tourism/apps.py | claudep/Geotrek | 620799cc2667c3b203ef92de6ec35008111fb592 | [
"BSD-2-Clause"
] | 1 | 2019-12-11T11:04:05.000Z | 2019-12-11T11:04:05.000Z | geotrek/tourism/apps.py | numahell/Geotrek-admin | e279875b0b06ef60928c049d51533f76716c902a | [
"BSD-2-Clause"
] | null | null | null | geotrek/tourism/apps.py | numahell/Geotrek-admin | e279875b0b06ef60928c049d51533f76716c902a | [
"BSD-2-Clause"
] | null | null | null | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class TourismConfig(AppConfig):
name = 'geotrek.tourism'
verbose_name = _("Tourism")
| 23 | 54 | 0.766304 | 22 | 184 | 6.227273 | 0.727273 | 0.145985 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152174 | 184 | 7 | 55 | 26.285714 | 0.878205 | 0 | 0 | 0 | 0 | 0 | 0.119565 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 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 | 1 | 0 | 0 | 4 |
77ae5c2ec446659346fe695f061cab4ed0784c83 | 28 | py | Python | tests/__init__.py | jparsai/cvejob | 8f9462a1ecdf1d4de877ac5f44e772239ffcb379 | [
"Apache-2.0"
] | 8 | 2019-09-25T14:45:28.000Z | 2021-11-08T10:30:03.000Z | tests/__init__.py | jparsai/cvejob | 8f9462a1ecdf1d4de877ac5f44e772239ffcb379 | [
"Apache-2.0"
] | 113 | 2018-07-10T12:58:16.000Z | 2020-12-09T22:33:15.000Z | tests/__init__.py | jparsai/cvejob | 8f9462a1ecdf1d4de877ac5f44e772239ffcb379 | [
"Apache-2.0"
] | 12 | 2018-07-10T11:00:02.000Z | 2021-01-27T12:19:56.000Z | """Place for unit tests."""
| 14 | 27 | 0.607143 | 4 | 28 | 4.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 28 | 1 | 28 | 28 | 0.708333 | 0.75 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
77ae75c01bf6195a0763c8db5f2df89f63907ea3 | 163 | py | Python | problem0640.py | kmarcini/Project-Euler-Python | d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3 | [
"BSD-3-Clause"
] | null | null | null | problem0640.py | kmarcini/Project-Euler-Python | d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3 | [
"BSD-3-Clause"
] | null | null | null | problem0640.py | kmarcini/Project-Euler-Python | d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3 | [
"BSD-3-Clause"
] | null | null | null | ###########################
#
# #640 Shut the Box - Project Euler
# https://projecteuler.net/problem=640
#
# Code by Kevin Marciniak
#
###########################
| 18.111111 | 38 | 0.460123 | 15 | 163 | 5 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041958 | 0.122699 | 163 | 8 | 39 | 20.375 | 0.482517 | 0.570552 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
77b71923d90569e57bb8aa4e2cc845740057d03a | 345 | py | Python | src/commands/maths/eigens.py | nemkin/quantum | 60944144323bd5392ee660968960a30cfd4a5b50 | [
"MIT"
] | 1 | 2021-08-24T10:09:39.000Z | 2021-08-24T10:09:39.000Z | src/commands/maths/eigens.py | nemkin/quantum | 60944144323bd5392ee660968960a30cfd4a5b50 | [
"MIT"
] | 12 | 2021-11-30T23:36:10.000Z | 2022-01-14T19:51:54.000Z | src/commands/maths/eigens.py | nemkin/quantum | 60944144323bd5392ee660968960a30cfd4a5b50 | [
"MIT"
] | null | null | null | import numpy as np
import itertools
class Eigens:
def __init__(self, adj):
self.adj = adj
self.eigen_values, self.eigen_vectors = np.linalg.eig(adj)
def get_eigen_values(self):
return list(set(self.eigen_values))
def get_eigen_vectors_for(self, eigen_value):
return self.eigen_vectors[self.eigen_values == eigen_value]
| 23 | 63 | 0.744928 | 53 | 345 | 4.54717 | 0.415094 | 0.224066 | 0.186722 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15942 | 345 | 14 | 64 | 24.642857 | 0.831034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.2 | 0.2 | 0.8 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 4 |
77d6a28fa3c4934ef9ab0b43f11b0faf15c3efa7 | 79 | py | Python | gf/apps.py | streamdp/order_table | f001c0cb2871b1e0cf2b38e8e9b83a3cfe366e61 | [
"MIT"
] | 1 | 2021-06-23T00:58:38.000Z | 2021-06-23T00:58:38.000Z | gf/apps.py | streamdp/order_table | f001c0cb2871b1e0cf2b38e8e9b83a3cfe366e61 | [
"MIT"
] | null | null | null | gf/apps.py | streamdp/order_table | f001c0cb2871b1e0cf2b38e8e9b83a3cfe366e61 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class GfConfig(AppConfig):
name = 'gf'
| 13.166667 | 33 | 0.721519 | 10 | 79 | 5.7 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189873 | 79 | 5 | 34 | 15.8 | 0.890625 | 0 | 0 | 0 | 0 | 0 | 0.025316 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 4 |
77e36edaced7d6c48e862376aa9e8cf592e66631 | 140 | py | Python | config.py | KongtappV/movie-project-api | 80300594ce5a4e4d1097c26b2c9fa29d5ad8fce2 | [
"Unlicense"
] | 2 | 2022-01-03T12:31:21.000Z | 2022-01-06T03:59:47.000Z | config.py | KongtappV/movie-project-api | 80300594ce5a4e4d1097c26b2c9fa29d5ad8fce2 | [
"Unlicense"
] | null | null | null | config.py | KongtappV/movie-project-api | 80300594ce5a4e4d1097c26b2c9fa29d5ad8fce2 | [
"Unlicense"
] | 1 | 2021-12-03T08:33:04.000Z | 2021-12-03T08:33:04.000Z | OPENAPI_AUTOGEN_DIR = 'autogen'
DB_HOST = "iot.cpe.ku.ac.th"
DB_USER = "b6210545971"
DB_PASSWD = "narawish.s@ku.th"
DB_NAME = "b6210545971"
| 23.333333 | 31 | 0.735714 | 23 | 140 | 4.217391 | 0.695652 | 0.082474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16 | 0.107143 | 140 | 5 | 32 | 28 | 0.616 | 0 | 0 | 0 | 1 | 0 | 0.435714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
7ad32aa10e155c3baa0e2fd350c75d1adb672782 | 979 | py | Python | multi_job/models/process.py | JoelLefkowitz/dev | ba84211eef2cd4f62da9a086795979ee9c297ce2 | [
"MIT"
] | 1 | 2021-08-03T17:33:58.000Z | 2021-08-03T17:33:58.000Z | multi_job/models/process.py | JoelLefkowitz/dev | ba84211eef2cd4f62da9a086795979ee9c297ce2 | [
"MIT"
] | 1 | 2021-06-02T04:08:37.000Z | 2021-06-02T04:08:37.000Z | multi_job/models/process.py | JoelLefkowitz/dev | ba84211eef2cd4f62da9a086795979ee9c297ce2 | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod, abstractproperty
from dataclasses import dataclass
from subprocess import run
from typing import Callable
@dataclass
class Process(ABC):
path: str
alias: str
@abstractmethod
def trigger(self) -> str:
pass
@abstractproperty
def raw(self) -> str:
pass
def show(self, verbose: bool) -> str:
return self.raw if verbose else self.alias
@dataclass
class CommandProcess(Process):
call: str
def trigger(self) -> str:
output = run(self.call, cwd=self.path)
return str(output)
@property
def raw(self) -> str:
return f"{self.call} in {self.path}"
@dataclass
class FunctionProcess(Process):
function: Callable
context: dict
def trigger(self) -> str:
return self.function(self.path, self.context)
@property
def raw(self) -> str:
return f"{self.function} with path arg: {self.path} and context arg: {self.context}"
| 20.395833 | 92 | 0.651685 | 122 | 979 | 5.229508 | 0.336066 | 0.065831 | 0.065831 | 0.079937 | 0.100313 | 0.100313 | 0.100313 | 0.100313 | 0 | 0 | 0 | 0 | 0.248212 | 979 | 47 | 93 | 20.829787 | 0.866848 | 0 | 0 | 0.382353 | 0 | 0.029412 | 0.102145 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.205882 | false | 0.058824 | 0.117647 | 0.117647 | 0.705882 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 4 |
7af80382a9f540b72263b46c47ed6b0ff36b934d | 770 | py | Python | tasktiger/retry.py | timgates42/tasktiger | 5b54a127c538b019af3690e4e7f6c0c8a9904fe1 | [
"MIT"
] | 1,143 | 2015-10-01T19:44:10.000Z | 2022-03-26T17:32:14.000Z | tasktiger/retry.py | timgates42/tasktiger | 5b54a127c538b019af3690e4e7f6c0c8a9904fe1 | [
"MIT"
] | 126 | 2016-01-20T10:19:33.000Z | 2022-03-31T18:19:41.000Z | tasktiger/retry.py | timgates42/tasktiger | 5b54a127c538b019af3690e4e7f6c0c8a9904fe1 | [
"MIT"
] | 78 | 2015-10-04T06:51:59.000Z | 2022-03-26T17:32:16.000Z | # The retry logic is documented in the README.
from .exceptions import StopRetry
def _fixed(retry, delay, max_retries):
if retry > max_retries:
raise StopRetry()
return delay
def fixed(delay, max_retries):
return (_fixed, (delay, max_retries))
def _linear(retry, delay, increment, max_retries):
if retry > max_retries:
raise StopRetry()
return delay + increment * (retry - 1)
def linear(delay, increment, max_retries):
return (_linear, (delay, increment, max_retries))
def _exponential(retry, delay, factor, max_retries):
if retry > max_retries:
raise StopRetry()
return delay * factor ** (retry - 1)
def exponential(delay, factor, max_retries):
return (_exponential, (delay, factor, max_retries))
| 23.333333 | 55 | 0.692208 | 96 | 770 | 5.364583 | 0.25 | 0.23301 | 0.087379 | 0.099029 | 0.543689 | 0.302913 | 0.302913 | 0.302913 | 0.302913 | 0.302913 | 0 | 0.003279 | 0.207792 | 770 | 32 | 56 | 24.0625 | 0.840984 | 0.057143 | 0 | 0.315789 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0 | 0.052632 | 0.157895 | 0.684211 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
bb2750500ff762b8cdee0e0a4415d5efb2e427c6 | 108 | py | Python | Aplikacja_Webowa_Etap_3/test/api/app.py | ivanprokopets/Aplikacja_Webowa | 48b1b2e949fbfa2e47e801522648f3949f6a93cb | [
"MIT"
] | 1 | 2020-01-14T08:35:22.000Z | 2020-01-14T08:35:22.000Z | Aplikacja_Webowa_Etap_3/test/api/app.py | ivanprokopets/Web-application | 48b1b2e949fbfa2e47e801522648f3949f6a93cb | [
"MIT"
] | null | null | null | Aplikacja_Webowa_Etap_3/test/api/app.py | ivanprokopets/Web-application | 48b1b2e949fbfa2e47e801522648f3949f6a93cb | [
"MIT"
] | null | null | null | from flask import Flask
app = Flask(__name__)
@app.route("/api")
def main():
return "Welcome from api!" | 18 | 30 | 0.685185 | 16 | 108 | 4.375 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 108 | 6 | 30 | 18 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0.192661 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 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 | 1 | 1 | 0 | 0 | 4 |
bb51db0352159ad1df633e7261afe2f6afba8a8b | 375 | py | Python | spec/python/test_eos_exception_u4.py | DarkShadow44/kaitai_struct_tests | 4bb13cef82965cca66dda2eb2b77cd64e9f70a12 | [
"MIT"
] | 11 | 2018-04-01T03:58:15.000Z | 2021-08-14T09:04:55.000Z | spec/python/test_eos_exception_u4.py | DarkShadow44/kaitai_struct_tests | 4bb13cef82965cca66dda2eb2b77cd64e9f70a12 | [
"MIT"
] | 73 | 2016-07-20T10:27:15.000Z | 2020-12-17T18:56:46.000Z | spec/python/test_eos_exception_u4.py | DarkShadow44/kaitai_struct_tests | 4bb13cef82965cca66dda2eb2b77cd64e9f70a12 | [
"MIT"
] | 37 | 2016-08-15T08:25:56.000Z | 2021-08-28T14:48:46.000Z | # Autogenerated from KST: please remove this line if doing any edits by hand!
import unittest
import kaitaistruct
from eos_exception_u4 import EosExceptionU4
class TestEosExceptionU4(unittest.TestCase):
def test_eos_exception_u4(self):
with self.assertRaises(EOFError):
with EosExceptionU4.from_file('src/term_strz.bin') as r:
pass
| 28.846154 | 77 | 0.738667 | 48 | 375 | 5.625 | 0.770833 | 0.088889 | 0.103704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016722 | 0.202667 | 375 | 12 | 78 | 31.25 | 0.886288 | 0.2 | 0 | 0 | 1 | 0 | 0.057047 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.125 | false | 0.125 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
2473f4cc0b630825992cb01eea4a6908446455d0 | 67 | py | Python | alpyca_launch/src/alpyca/launch/parsing_exception.py | alpyca/alpyca | 207eae92ebcdd593b7953ecb6ad4816215ecb516 | [
"MIT"
] | 3 | 2019-01-13T17:12:34.000Z | 2019-02-07T18:09:07.000Z | alpyca_launch/src/alpyca/launch/parsing_exception.py | arturmiller/alpyca | 207eae92ebcdd593b7953ecb6ad4816215ecb516 | [
"MIT"
] | 4 | 2018-12-01T22:50:41.000Z | 2019-01-13T16:47:52.000Z | alpyca_launch/src/alpyca/launch/parsing_exception.py | alpyca/alpyca | 207eae92ebcdd593b7953ecb6ad4816215ecb516 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
class ParsingException(Exception):
pass
| 13.4 | 34 | 0.731343 | 8 | 67 | 6.125 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149254 | 67 | 4 | 35 | 16.75 | 0.859649 | 0.298507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
2488277ea2797d1eca2a59a94527786756a8be6e | 135 | py | Python | modules/__init__.py | ssun32/mteval | e116013bef0cc90a51aec629a23d4b1bf6a4e666 | [
"MIT"
] | 10 | 2020-06-04T20:30:43.000Z | 2022-03-19T08:51:30.000Z | modules/__init__.py | ssun32/mteval | e116013bef0cc90a51aec629a23d4b1bf6a4e666 | [
"MIT"
] | 1 | 2021-06-02T00:59:28.000Z | 2021-06-02T00:59:28.000Z | modules/__init__.py | ssun32/mteval | e116013bef0cc90a51aec629a23d4b1bf6a4e666 | [
"MIT"
] | 1 | 2020-04-28T21:16:00.000Z | 2020-04-28T21:16:00.000Z | from .doc_parser import DocParser
from .search import Search
from .trec_eval import TrecEval
from .relv_converter import RelvConverter
| 27 | 41 | 0.851852 | 19 | 135 | 5.894737 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118519 | 135 | 4 | 42 | 33.75 | 0.941176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
24d55402f1372e1a31f3b353d0d4a8e6f6938127 | 145 | py | Python | HttpTesting/tmp.py | xzdylyh/HttpTesting | 06f650fb060aceaf017dd5b17f5f3bda8614b6a0 | [
"CNRI-Python"
] | null | null | null | HttpTesting/tmp.py | xzdylyh/HttpTesting | 06f650fb060aceaf017dd5b17f5f3bda8614b6a0 | [
"CNRI-Python"
] | 2 | 2021-03-25T22:46:09.000Z | 2021-11-15T17:48:55.000Z | HttpTesting/tmp.py | xzdylyh/HttpTesting | 06f650fb060aceaf017dd5b17f5f3bda8614b6a0 | [
"CNRI-Python"
] | null | null | null | from library.scripts import get_yaml_field
path = r'D:\test_project\amtest\testcase\template.yaml'
content = get_yaml_field(path)
print(content) | 29 | 55 | 0.82069 | 23 | 145 | 4.956522 | 0.73913 | 0.122807 | 0.210526 | 0.280702 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075862 | 145 | 5 | 56 | 29 | 0.850746 | 0 | 0 | 0 | 0 | 0 | 0.308219 | 0.308219 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 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 | 4 |
24ec72799d6f0022382d5d90ba86da5762de8d98 | 366 | py | Python | Dataset/Leetcode/train/13/926.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/13/926.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/13/926.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution:
def XXX(self, s: str) -> int:
result=0
dict={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}
for i in range(len(s)):
result+=dict[s[i]]
if i>=1:
if dict[s[i]]>dict[s[i-1]]:
result+=(-dict[s[i-1]]-dict[s[i]]+(dict[s[i]]-dict[s[i-1]]))
return result
| 28.153846 | 80 | 0.420765 | 63 | 366 | 2.444444 | 0.492063 | 0.227273 | 0.272727 | 0.194805 | 0.207792 | 0.207792 | 0.168831 | 0 | 0 | 0 | 0 | 0.085366 | 0.327869 | 366 | 12 | 81 | 30.5 | 0.54065 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
702396e306491a086e90924c709915d82e2fd4a0 | 68 | py | Python | Scripts/Maperipy/English.py | cojalvo/Map | 50fcd7d33bfdaf63c014a53f57b898d146b80da0 | [
"MIT"
] | 2 | 2019-02-19T04:22:31.000Z | 2021-04-05T19:29:59.000Z | Scripts/Maperipy/English.py | cojalvo/Map | 50fcd7d33bfdaf63c014a53f57b898d146b80da0 | [
"MIT"
] | null | null | null | Scripts/Maperipy/English.py | cojalvo/Map | 50fcd7d33bfdaf63c014a53f57b898d146b80da0 | [
"MIT"
] | 2 | 2022-01-23T09:39:57.000Z | 2022-01-23T09:45:46.000Z | from maperipy import *
DataStore.store_data("Language", "English")
| 22.666667 | 43 | 0.764706 | 9 | 68 | 5.777778 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088235 | 68 | 2 | 44 | 34 | 0.822581 | 0 | 0 | 0 | 0 | 0 | 0.223881 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.5 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
70319daa8d071a46e619985117cd6af55dca8424 | 67 | py | Python | py_mob/__init__.py | statcompute/py_mob | 5f386e6a3e237296ca10b611e520ce858fe3cc60 | [
"MIT"
] | 15 | 2020-05-16T15:59:58.000Z | 2022-03-28T14:48:55.000Z | py_mob/__init__.py | statcompute/py_mob | 5f386e6a3e237296ca10b611e520ce858fe3cc60 | [
"MIT"
] | 3 | 2020-05-19T03:10:37.000Z | 2020-06-07T15:33:44.000Z | py_mob/__init__.py | statcompute/py_mob | 5f386e6a3e237296ca10b611e520ce858fe3cc60 | [
"MIT"
] | 7 | 2020-05-16T17:46:59.000Z | 2021-02-08T02:12:23.000Z | # py_mob/__init__.py
__version__ = "0.2.7"
from .py_mob import *
| 11.166667 | 21 | 0.686567 | 12 | 67 | 3 | 0.75 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053571 | 0.164179 | 67 | 5 | 22 | 13.4 | 0.589286 | 0.268657 | 0 | 0 | 0 | 0 | 0.106383 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
7057c5c877fc78b7ed5fa7fc1c33cab057141a61 | 97 | py | Python | dash_website/xwas/multivariate_results_tabs/__init__.py | SamuelDiai/Dash-Website | e064e432f14a86de1b54cf31ab311997c5643129 | [
"MIT"
] | null | null | null | dash_website/xwas/multivariate_results_tabs/__init__.py | SamuelDiai/Dash-Website | e064e432f14a86de1b54cf31ab311997c5643129 | [
"MIT"
] | null | null | null | dash_website/xwas/multivariate_results_tabs/__init__.py | SamuelDiai/Dash-Website | e064e432f14a86de1b54cf31ab311997c5643129 | [
"MIT"
] | null | null | null | DISPLAY_MODE = {"view_per_main_category": "X main category", "view_decreasing": "Decreasing R²"}
| 48.5 | 96 | 0.762887 | 13 | 97 | 5.307692 | 0.692308 | 0.347826 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011364 | 0.092784 | 97 | 1 | 97 | 97 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0.670103 | 0.226804 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
5614a3ab91f49a56516ee74fc3fb943026252c37 | 146 | py | Python | PythonScripts/01_Introduction/01_comments.py | matthijsjanssens/UE4-PythonScripting | 55b98492e861308605477302a7f1ef61fa4f77c1 | [
"MIT"
] | 1 | 2022-02-15T02:20:39.000Z | 2022-02-15T02:20:39.000Z | PythonScripts/01_Introduction/01_comments.py | denfrost/UE4-PythonScripting | 55b98492e861308605477302a7f1ef61fa4f77c1 | [
"MIT"
] | null | null | null | PythonScripts/01_Introduction/01_comments.py | denfrost/UE4-PythonScripting | 55b98492e861308605477302a7f1ef61fa4f77c1 | [
"MIT"
] | 1 | 2022-02-14T15:44:25.000Z | 2022-02-14T15:44:25.000Z | # I am a comment, python interpreter will ignore every line that starts with '#'
"""
I am a multiline comment and surrounded by 3 \" or 3 \'
"""
| 24.333333 | 80 | 0.684932 | 24 | 146 | 4.166667 | 0.791667 | 0.06 | 0.08 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017391 | 0.212329 | 146 | 5 | 81 | 29.2 | 0.852174 | 0.90411 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
562da6b364516d8c92673b5d9ae5228d0295897c | 472 | py | Python | flaml/tune/__init__.py | varun-suryan/FLAML | c79dae8f3902f44194e51ae7e62132e70910b1ce | [
"MIT"
] | 1 | 2021-02-25T14:30:50.000Z | 2021-02-25T14:30:50.000Z | flaml/tune/__init__.py | Jimmy-INL/FLAML | e41b42842af04c4d585e72313d580d211760961b | [
"MIT"
] | 1 | 2021-08-07T15:31:42.000Z | 2021-08-07T15:31:42.000Z | flaml/tune/__init__.py | Jimmy-INL/FLAML | e41b42842af04c4d585e72313d580d211760961b | [
"MIT"
] | 1 | 2021-06-13T22:25:57.000Z | 2021-06-13T22:25:57.000Z | try:
from ray.tune import (uniform, quniform, choice, randint, qrandint, randn,
qrandn, loguniform, qloguniform)
except ImportError:
from .sample import (uniform, quniform, choice, randint, qrandint, randn,
qrandn, loguniform, qloguniform)
from .tune import run, report
from .sample import polynomial_expansion_set
from .sample import PolynomialExpansionSet, Categorical, Float
from .trial import Trial
| 42.909091 | 79 | 0.690678 | 49 | 472 | 6.612245 | 0.530612 | 0.092593 | 0.148148 | 0.166667 | 0.45679 | 0.45679 | 0.45679 | 0.45679 | 0.45679 | 0.45679 | 0 | 0 | 0.243644 | 472 | 10 | 80 | 47.2 | 0.907563 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.7 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
568f8b52bf41be1fac2c54b3237278b3dabe8bfb | 204 | py | Python | backend/shop/serializers.py | Dambre/segmentium | f539834b39c4251e7d56106b6cebc1cc127930fa | [
"MIT"
] | null | null | null | backend/shop/serializers.py | Dambre/segmentium | f539834b39c4251e7d56106b6cebc1cc127930fa | [
"MIT"
] | null | null | null | backend/shop/serializers.py | Dambre/segmentium | f539834b39c4251e7d56106b6cebc1cc127930fa | [
"MIT"
] | null | null | null | from .modes import Order
from rest_framework import serializers
class OrderSerializer(serializers.ModelSerializer):
class Meta:
model = Order
fields = ('id', 'product', 'customer')
| 20.4 | 51 | 0.70098 | 21 | 204 | 6.761905 | 0.761905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.210784 | 204 | 9 | 52 | 22.666667 | 0.881988 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 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 | 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 | 4 |
3b08934922c6d7639aea03e99373339308453db0 | 118 | py | Python | escolaappweb_dashboard/apps.py | cassianomaia/EscolaApp-Web | d1e5a1d9f4ab6cc0cca69658fad8dc8dca6887f7 | [
"MIT"
] | null | null | null | escolaappweb_dashboard/apps.py | cassianomaia/EscolaApp-Web | d1e5a1d9f4ab6cc0cca69658fad8dc8dca6887f7 | [
"MIT"
] | 13 | 2018-11-09T12:15:33.000Z | 2018-12-07T10:35:14.000Z | escolaappweb_dashboard/apps.py | cassianomaia/EscolaApp-Web | d1e5a1d9f4ab6cc0cca69658fad8dc8dca6887f7 | [
"MIT"
] | 2 | 2018-12-02T19:29:45.000Z | 2018-12-04T11:15:31.000Z | from django.apps import AppConfig
class EscolaappwebDashboardConfig(AppConfig):
name = 'escolaappweb_dashboard'
| 19.666667 | 45 | 0.813559 | 11 | 118 | 8.636364 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127119 | 118 | 5 | 46 | 23.6 | 0.92233 | 0 | 0 | 0 | 0 | 0 | 0.186441 | 0.186441 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 4 |
3b15b653cffa131e6c4b72f4dc6f3c7785e62c9f | 398 | py | Python | manual_run.py | inesucrvenom/mathfun | 00ad69530c0e49ed4d3ed3687c50f2dff225a919 | [
"MIT"
] | null | null | null | manual_run.py | inesucrvenom/mathfun | 00ad69530c0e49ed4d3ed3687c50f2dff225a919 | [
"MIT"
] | null | null | null | manual_run.py | inesucrvenom/mathfun | 00ad69530c0e49ed4d3ed3687c50f2dff225a919 | [
"MIT"
] | null | null | null | from test.run_lambda import show_result
def run_all():
"""Create own lambda invocations"""
print(show_result('lambda_fibonacci_recursive', {'n': 20}))
print(show_result('lambda_fibonacci_iterative', {'n': 20}))
print(show_result('lambda_factorial_recursive', {'n': 20}))
print(show_result('lambda_factorial_iterative', {'n': 20}))
if __name__ == "__main__":
run_all()
| 24.875 | 63 | 0.693467 | 51 | 398 | 4.941176 | 0.431373 | 0.198413 | 0.238095 | 0.333333 | 0.583333 | 0.428571 | 0.428571 | 0 | 0 | 0 | 0 | 0.02346 | 0.143216 | 398 | 15 | 64 | 26.533333 | 0.715543 | 0.072864 | 0 | 0 | 0 | 0 | 0.319559 | 0.286501 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | true | 0 | 0.125 | 0 | 0.25 | 0.5 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
3b49195faf3c14629f04dc0440f33af8ee1d56d3 | 185 | py | Python | Code only/3- Control Flow/Even Odd using For loop Exercise.py | AhmedRaja1/Python-Beginner-s-Starter-Kit | 285cfbeb7207e6531954f21cae3a062f977ee5a0 | [
"MIT"
] | 1 | 2021-09-27T16:47:25.000Z | 2021-09-27T16:47:25.000Z | Code only/3- Control Flow/Even Odd using For loop Exercise.py | AhmedRaja1/Python-Beginner-s-Starter-Kit | 285cfbeb7207e6531954f21cae3a062f977ee5a0 | [
"MIT"
] | null | null | null | Code only/3- Control Flow/Even Odd using For loop Exercise.py | AhmedRaja1/Python-Beginner-s-Starter-Kit | 285cfbeb7207e6531954f21cae3a062f977ee5a0 | [
"MIT"
] | 1 | 2021-09-27T16:47:33.000Z | 2021-09-27T16:47:33.000Z | even_number_counter = 0
for number in range(1, 30):
if number % 2 == 0:
print(number)
even_number_counter += 1
print(f"We have {even_number_counter} Even Numbers")
| 23.125 | 52 | 0.659459 | 29 | 185 | 4 | 0.551724 | 0.258621 | 0.439655 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.049645 | 0.237838 | 185 | 7 | 53 | 26.428571 | 0.77305 | 0 | 0 | 0 | 0 | 0 | 0.227027 | 0.113514 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 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 | 4 |
3b9e446caeabadf5862f541e9f8073dbc6164ba6 | 141 | py | Python | test.py | wgr5600133/wordbook | e350d01d2862f0c99c365dfdadc0f0e9a70a6c63 | [
"MIT"
] | 4 | 2020-12-07T04:55:27.000Z | 2020-12-09T19:53:58.000Z | test.py | wgr5600133/wordbook | e350d01d2862f0c99c365dfdadc0f0e9a70a6c63 | [
"MIT"
] | null | null | null | test.py | wgr5600133/wordbook | e350d01d2862f0c99c365dfdadc0f0e9a70a6c63 | [
"MIT"
] | null | null | null | import pandas as pd
df = pd.read_csv("./resource/3000_back1.csv", index_col=0)
df['last_attempt_date'] = 0
df.to_csv('./resource/3000.csv') | 23.5 | 58 | 0.723404 | 26 | 141 | 3.692308 | 0.653846 | 0.229167 | 0.3125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.085938 | 0.092199 | 141 | 6 | 59 | 23.5 | 0.664063 | 0 | 0 | 0 | 0 | 0 | 0.429577 | 0.176056 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 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 | 4 |
8e9ea118baf0c76bfdb0a02f6aec58f6a7e48e4d | 106 | py | Python | django_photogallery/apps.py | Tasari/django-photogallery | 18e100f06167df31fce6c00806508a0f9f6b535f | [
"BSD-3-Clause"
] | null | null | null | django_photogallery/apps.py | Tasari/django-photogallery | 18e100f06167df31fce6c00806508a0f9f6b535f | [
"BSD-3-Clause"
] | null | null | null | django_photogallery/apps.py | Tasari/django-photogallery | 18e100f06167df31fce6c00806508a0f9f6b535f | [
"BSD-3-Clause"
] | null | null | null | from django.apps import AppConfig
class PhotogalleryConfig(AppConfig):
name = 'django_photogallery'
| 17.666667 | 36 | 0.792453 | 11 | 106 | 7.545455 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141509 | 106 | 5 | 37 | 21.2 | 0.912088 | 0 | 0 | 0 | 0 | 0 | 0.179245 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 4 |
8eb37c07115ae19f8a4556fffeb12517872016b1 | 220 | py | Python | oschub/views.py | WSoC-VITAP/oschub | 441049eb00b999eb086e629742dd8f0ae6cf0e31 | [
"Apache-2.0"
] | 7 | 2021-04-05T15:53:55.000Z | 2021-09-17T18:54:45.000Z | oschub/views.py | ackr-8/oschub | 659f557d8775ee00731819303fe64956c7acc0b6 | [
"Apache-2.0"
] | 22 | 2021-03-15T06:37:06.000Z | 2022-01-28T16:26:06.000Z | oschub/views.py | ackr-8/oschub | 659f557d8775ee00731819303fe64956c7acc0b6 | [
"Apache-2.0"
] | 5 | 2021-05-07T05:57:52.000Z | 2021-09-25T06:25:19.000Z | from django.http import HttpResponseRedirect
from SheetMe import *
from django.views import View
class UpdateSheet(View):
def get(self, request):
updateData()
return HttpResponseRedirect("/admin/")
| 22 | 46 | 0.727273 | 24 | 220 | 6.666667 | 0.708333 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190909 | 220 | 9 | 47 | 24.444444 | 0.898876 | 0 | 0 | 0 | 0 | 0 | 0.031818 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 0.857143 | 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 | 1 | 0 | 0 | 4 |
8ee5a70cbb943578ad8df5a0bbe75c0b995926b4 | 211 | py | Python | core/admin/data.py | ClairBerlin/managair | 44af9f73039ecdb7dd959dacda5470a103795ac3 | [
"BSD-3-Clause"
] | 4 | 2020-11-22T17:07:14.000Z | 2020-11-26T07:53:08.000Z | core/admin/data.py | ClairBerlin/managair | 44af9f73039ecdb7dd959dacda5470a103795ac3 | [
"BSD-3-Clause"
] | 18 | 2020-12-04T07:48:13.000Z | 2022-01-26T18:09:33.000Z | core/admin/data.py | ClairBerlin/managair | 44af9f73039ecdb7dd959dacda5470a103795ac3 | [
"BSD-3-Clause"
] | 1 | 2021-01-15T10:41:33.000Z | 2021-01-15T10:41:33.000Z | from django.contrib import admin
from core.models import Sample
@admin.register(Sample)
class SampleAdmin(admin.ModelAdmin):
list_display = ("timestamp_iso", "node", "co2_ppm")
list_filter = ["node"]
| 21.1 | 55 | 0.734597 | 27 | 211 | 5.592593 | 0.740741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005525 | 0.14218 | 211 | 9 | 56 | 23.444444 | 0.828729 | 0 | 0 | 0 | 0 | 0 | 0.132701 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.833333 | 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 | 1 | 0 | 0 | 4 |
8eeb3052ef09ee6ac544cce45561b46282e6a0df | 244 | py | Python | test_board.py | JLozensky/Othello_Board_Game | 2303dc3a3ff53f228259b59561f26a10c63ea334 | [
"MIT"
] | null | null | null | test_board.py | JLozensky/Othello_Board_Game | 2303dc3a3ff53f228259b59561f26a10c63ea334 | [
"MIT"
] | null | null | null | test_board.py | JLozensky/Othello_Board_Game | 2303dc3a3ff53f228259b59561f26a10c63ea334 | [
"MIT"
] | null | null | null | from board import Board
def test_getcenter():
b = Board(4)
assert(b.get_center(0, 0) == (63, 38))
assert(b.get_center(1, 1) == (138, 113))
assert(b.get_center(2, 7) == (213, 563))
assert(b.get_center(7, 3) == (588, 263))
| 22.181818 | 44 | 0.581967 | 42 | 244 | 3.261905 | 0.571429 | 0.20438 | 0.291971 | 0.467153 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.161458 | 0.213115 | 244 | 10 | 45 | 24.4 | 0.552083 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.285714 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
8ef5516af594d4b6a9eb04644cad3cd7fe86a9c5 | 137 | py | Python | cool/core/__init__.py | SmallCream/django-cool | 63b136da7ce39135c9f900e8161288f8fc8893a4 | [
"BSD-3-Clause"
] | 11 | 2020-05-19T09:52:35.000Z | 2022-02-25T10:39:56.000Z | cool/core/__init__.py | SmallCream/django-cool | 63b136da7ce39135c9f900e8161288f8fc8893a4 | [
"BSD-3-Clause"
] | null | null | null | cool/core/__init__.py | SmallCream/django-cool | 63b136da7ce39135c9f900e8161288f8fc8893a4 | [
"BSD-3-Clause"
] | 1 | 2020-12-24T08:14:58.000Z | 2020-12-24T08:14:58.000Z | # encoding: utf-8
from cool.core.cache import BaseCache
from cool.core.constants import Constants
__all__ = ['BaseCache', 'Constants']
| 19.571429 | 41 | 0.766423 | 18 | 137 | 5.611111 | 0.611111 | 0.158416 | 0.237624 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008333 | 0.124088 | 137 | 6 | 42 | 22.833333 | 0.833333 | 0.109489 | 0 | 0 | 0 | 0 | 0.15 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
d902d6b5f04d55105048baf03586c16729354c1d | 831 | py | Python | Joy_QA_Platform/frame/managers.py | bzc128/Joy_QA_Platform | d3325331cd832a22e91ad895ab793577609aabc4 | [
"Apache-2.0"
] | 123 | 2019-03-01T06:07:43.000Z | 2021-12-11T07:59:20.000Z | Joy_QA_Platform/frame/managers.py | bzc128/Joy_QA_Platform | d3325331cd832a22e91ad895ab793577609aabc4 | [
"Apache-2.0"
] | 8 | 2019-03-06T06:33:34.000Z | 2021-06-10T21:13:55.000Z | Joy_QA_Platform/frame/managers.py | bzc128/Joy_QA_Platform | d3325331cd832a22e91ad895ab793577609aabc4 | [
"Apache-2.0"
] | 54 | 2019-03-01T02:25:13.000Z | 2021-12-23T16:55:17.000Z | from django.db import models
#Django模块通过models.Manager进行数据库查询 需要了解
'''用户类型表操作'''
class UserTypeManager(models.Manager):
def insert_user_type(self, user_type):
self.create(user_type=user_type)
def insert_type_name(self, type_name):
self.create(type_name=type_name)
def insert_type_desc(self, type_desc):
self.create(type_desc=type_desc)
def get_objects(self, user_type_id): # 根据user_type得到一条数据
return self.get(user_type_id=user_type_id)
'''用户信息表操作'''
class UserInfoManager(models.Manager):
def insert_user(self, username, password, email, object):
self.create(username=username, password=password, email=email, user_type=object)
def query_user(self, username, password):
return self.filter(username__exact=username, password__exact=password).count()
| 29.678571 | 88 | 0.738869 | 110 | 831 | 5.309091 | 0.327273 | 0.109589 | 0.05137 | 0.075342 | 0.089041 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156438 | 831 | 27 | 89 | 30.777778 | 0.833096 | 0.064982 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0.266667 | 0.066667 | 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 | 1 | 0 | 1 | 1 | 0 | 0 | 4 |
d924cde5fd7137089c71b6e5a5d20217ede38c46 | 241 | py | Python | src/__init__.py | PaulloClara/magnet-link-finder | 7fbd65c4b615b3b7a0a3d84a5898227ea48b383b | [
"MIT"
] | null | null | null | src/__init__.py | PaulloClara/magnet-link-finder | 7fbd65c4b615b3b7a0a3d84a5898227ea48b383b | [
"MIT"
] | 1 | 2021-12-13T20:35:24.000Z | 2021-12-13T20:35:24.000Z | src/__init__.py | PaulloClara/magnet-link-finder | 7fbd65c4b615b3b7a0a3d84a5898227ea48b383b | [
"MIT"
] | null | null | null | WINDOW_WIDTH = 340
WINDOW_HEIGHT = 480
RESULT_FILE_PATH = 'src/temp/result.txt'
WEB_CRAWLER_PATH = 'src/app/web-crawler.py'
COPY_ICON_PATH = 'src/icon/copy.png'
FIND_ICON_PATH = 'src/icon/find.png'
WINDOW_ICON_PATH = 'src/icon/window.png'
| 24.1 | 43 | 0.767635 | 42 | 241 | 4.119048 | 0.452381 | 0.202312 | 0.190751 | 0.260116 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027523 | 0.095436 | 241 | 9 | 44 | 26.777778 | 0.766055 | 0 | 0 | 0 | 0 | 0 | 0.390041 | 0.091286 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 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 | 4 |
d95d02ccce62eb8a5ca6eef27bba3a0ae2fbdf83 | 143 | py | Python | installing_Django.py | radekwilk/Sharing-images-app-Django-project | 08773a156344216f9aa62c1bdf23ff18b4ee3725 | [
"MIT"
] | null | null | null | installing_Django.py | radekwilk/Sharing-images-app-Django-project | 08773a156344216f9aa62c1bdf23ff18b4ee3725 | [
"MIT"
] | null | null | null | installing_Django.py | radekwilk/Sharing-images-app-Django-project | 08773a156344216f9aa62c1bdf23ff18b4ee3725 | [
"MIT"
] | null | null | null | # 1. First, installing pipenv: pip install pipenv
# 2. Secondly, installing Django: pipenv install Django
# 3. Next, type: pipenv shell
# 4.
#
| 23.833333 | 55 | 0.72028 | 20 | 143 | 5.15 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033898 | 0.174825 | 143 | 5 | 56 | 28.6 | 0.838983 | 0.923077 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
d9681e0085e9b40194ab441e6bc48051d659ccce | 34 | py | Python | othelloai/__init__.py | jcarrete5/othello | 7195eb2dd8c25fa5b3f1e3738840c08997914c45 | [
"MIT"
] | null | null | null | othelloai/__init__.py | jcarrete5/othello | 7195eb2dd8c25fa5b3f1e3738840c08997914c45 | [
"MIT"
] | null | null | null | othelloai/__init__.py | jcarrete5/othello | 7195eb2dd8c25fa5b3f1e3738840c08997914c45 | [
"MIT"
] | null | null | null | """Othello AI and game engine."""
| 17 | 33 | 0.647059 | 5 | 34 | 4.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 34 | 1 | 34 | 34 | 0.758621 | 0.794118 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
d972fb570685f217e202b406565550c42514d844 | 245 | py | Python | malexport/parse/__init__.py | seanbreckenridge/malexport | ae30bef37a8cf44f8b0511bdfcd395e56e85d06b | [
"MIT"
] | null | null | null | malexport/parse/__init__.py | seanbreckenridge/malexport | ae30bef37a8cf44f8b0511bdfcd395e56e85d06b | [
"MIT"
] | 4 | 2021-09-19T15:18:37.000Z | 2022-02-10T06:10:38.000Z | malexport/parse/__init__.py | seanbreckenridge/malexport | ae30bef37a8cf44f8b0511bdfcd395e56e85d06b | [
"MIT"
] | null | null | null | from .xml import parse_xml
from .mal_list import parse_file as parse_list
from .forum import iter_forum_posts
from .history import iter_user_history
from .friends import iter_friends
from ..list_type import ListType
from .combine import combine
| 30.625 | 46 | 0.844898 | 40 | 245 | 4.925 | 0.425 | 0.152284 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122449 | 245 | 7 | 47 | 35 | 0.916279 | 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 | 1 | 0 | 0 | 4 |
d9754db5a7cce8812dd890bd8f76032271da734b | 241 | py | Python | chat/templatetags/chatextras.py | helmetwearer/dating-app | 8222de25ef3fed9f5ca5e826f6da72243a1b2a1d | [
"MIT"
] | null | null | null | chat/templatetags/chatextras.py | helmetwearer/dating-app | 8222de25ef3fed9f5ca5e826f6da72243a1b2a1d | [
"MIT"
] | null | null | null | chat/templatetags/chatextras.py | helmetwearer/dating-app | 8222de25ef3fed9f5ca5e826f6da72243a1b2a1d | [
"MIT"
] | null | null | null | # https://stackoverflow.com/questions/8000022/django-template-how-to-look-up-a-dictionary-value-with-a-variable
from django.template.defaulttags import register
@register.filter
def get_value(dictionary, key):
return dictionary.get(key) | 40.166667 | 111 | 0.809129 | 34 | 241 | 5.705882 | 0.735294 | 0.14433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031111 | 0.06639 | 241 | 6 | 112 | 40.166667 | 0.831111 | 0.452282 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 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 | 1 | 1 | 0 | 0 | 4 |
7953453e9cd7dc9fc203cac750bddd82b5cb145d | 82,725 | py | Python | Engine/Extras/Maya_AnimationRiggingTools/ArtToolsOSX/MayaTools/General/Scripts/ART_importMotion.py | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | 1 | 2022-01-29T18:36:12.000Z | 2022-01-29T18:36:12.000Z | Engine/Extras/Maya_AnimationRiggingTools/ArtToolsOSX/MayaTools/General/Scripts/ART_importMotion.py | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | 2 | 2015-06-21T17:38:11.000Z | 2015-06-22T20:54:42.000Z | Engine/Extras/Maya_AnimationRiggingTools/ArtToolsOSX/MayaTools/General/Scripts/ART_importMotion.py | PopCap/GameIdea | 201e1df50b2bc99afc079ce326aa0a44b178a391 | [
"BSD-2-Clause"
] | 1 | 2021-04-27T08:48:33.000Z | 2021-04-27T08:48:33.000Z | import maya.cmds as cmds
import maya.mel as mel
from functools import partial
import os, cPickle
import math
class ImportMotionUI():
def __init__(self):
#create class variables
self.widgets = {}
#find out which project we are in
references = cmds.ls(type = "reference")
for ref in references:
try:
self.project = cmds.referenceQuery(ref, filename = True).rpartition("Projects/")[2].partition("/")[0]
except:
pass
#get access to our maya tools
toolsPath = os.path.join(cmds.internalVar(usd = True), "mayaTools.txt")
if os.path.exists(toolsPath):
f = open(toolsPath, 'r')
self.mayaToolsDir = f.readline()
f.close()
#check to see if window exists, if so, delete
if cmds.window("importMotionUI", exists = True):
cmds.deleteUI("importMotionUI")
#build window
self.widgets["window"] = cmds.window("importMotionUI", w = 700, h = 400, title = "Import Motion", sizeable = False)
#create the main layout
self.widgets["topLevelLayout"] = cmds.columnLayout()
#create the rowColumnLayout (left side for the different ways one can import motion, the right side with that method's settings
self.widgets["rowColumnLayout"] = cmds.rowColumnLayout(w = 700, h = 400, nc = 2, cw = [(1, 150), (2, 550)], parent = self.widgets["topLevelLayout"])
#create the columnLayout for the left side
self.widgets["leftSideButtonColumn"] = cmds.columnLayout(w = 150, h = 400, parent = self.widgets["rowColumnLayout"], cat = ["both", 5], rs = 5)
#and create the frame layout for the right side
self.widgets["rightSideFrame"] = cmds.frameLayout(w = 550, h = 400, collapsable = False, borderStyle = "etchedIn", labelVisible = False, parent = self.widgets["rowColumnLayout"])
#create the buttons for the different methods of importing motion
self.widgets["importMotionMethods"] = cmds.iconTextRadioCollection()
self.widgets["importMotion_mocap"] = cmds.iconTextRadioButton(select = True, w = 140, h = 50, parent = self.widgets["leftSideButtonColumn"], image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMocap_off.bmp"), selectionImage = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMocap_on.bmp"))
self.widgets["importMotion_anims"] = cmds.iconTextRadioButton(select = False, w = 140, h = 50, parent = self.widgets["leftSideButtonColumn"], image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importAnim_off.bmp"), selectionImage = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importAnim_on.bmp"))
#create the elements for the right column
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#IMPORT MOCAP
self.widgets["importMocapForm"] = cmds.formLayout(w = 500, h = 400, parent = self.widgets["rightSideFrame"])
#text labels
fbxLabel = cmds.text(label = "FBX File:", font = "boldLabelFont")
importMethodLabel = cmds.text(label = "Import Method:", font = "boldLabelFont")
frameOffsetLabel = cmds.text(label = "Frame Offset:", font = "boldLabelFont")
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(fbxLabel, "top", 13), (fbxLabel, "left", 10)])
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(importMethodLabel, "top", 140), (importMethodLabel, "left", 10)])
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(frameOffsetLabel, "top", 210), (frameOffsetLabel, "left", 10)])
#fbxImport
self.widgets["fbxImportTextField"] = cmds.textField(w = 400, text = "", enable = True)
self.widgets["fbxImportBrowseButton"] = cmds.symbolButton(w = 30, h = 30, image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "browse.bmp"), c = self.fbxBrowse)
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["fbxImportTextField"], "top", 10), (self.widgets["fbxImportTextField"], "left", 70)])
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["fbxImportBrowseButton"], "top", 5), (self.widgets["fbxImportBrowseButton"], "left", 475)])
#character list
self.widgets["importMocap_characterList"] = cmds.optionMenu(w = 240, h = 50)
self.widgets["importMocap_characterThumb"] = cmds.image(w = 50, h = 50)
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["importMocap_characterList"], "top", 45), (self.widgets["importMocap_characterList"], "left", 10)])
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["importMocap_characterThumb"], "top", 45), (self.widgets["importMocap_characterThumb"], "left", 255)])
#import method
self.widgets["importMethodRadioCollection"] = cmds.radioCollection()
self.widgets["importMethod_FK"] = cmds.radioButton(label = "FK", select = True)
self.widgets["importMethod_IK"] = cmds.radioButton(label = "IK")
self.widgets["importMethod_Both"] = cmds.radioButton(label = "Both")
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["importMethod_FK"], "top", 165), (self.widgets["importMethod_FK"], "left", 10)])
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["importMethod_IK"], "top", 165), (self.widgets["importMethod_IK"], "left", 80)])
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["importMethod_Both"], "top", 165), (self.widgets["importMethod_Both"], "left", 150)])
#frame offset
self.widgets["frameOffsetField"] = cmds.intField(value=0, w = 100)
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["frameOffsetField"], "top", 235), (self.widgets["frameOffsetField"], "left", 10)])
#apply motion to parts
self.widgets["importMotionTo_Frame"] = cmds.frameLayout( w= 220, h = 350, label = "Apply To Which Parts:", bs = "etchedIn", collapsable = False)
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["importMotionTo_Frame"], "top", 40), (self.widgets["importMotionTo_Frame"], "right", 10)])
self.widgets["importMotionTo_Form"] = cmds.formLayout( w= 240, h = 280, parent = self.widgets["importMotionTo_Frame"])
self.widgets["importMotionTo_HeadButton"] = cmds.iconTextCheckBox(w = 55, h = 55, image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_head.bmp"), selectionImage = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_head_on.bmp"), value = True)
self.widgets["importMotionTo_SpineButton"] = cmds.iconTextCheckBox(w = 55, h = 100, image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_torso.bmp"), selectionImage = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_torso_on.bmp"), value = True)
self.widgets["importMotionTo_lArmButton"] = cmds.iconTextCheckBox(w = 30, h = 100, image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_arm.bmp"), selectionImage = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_arm_on.bmp"), value = True)
self.widgets["importMotionTo_rArmButton"] = cmds.iconTextCheckBox(w = 30, h = 100, image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_arm_r.bmp"), selectionImage = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_arm_r_on.bmp"), value = True)
self.widgets["importMotionTo_lLegButton"] = cmds.iconTextCheckBox(w = 30, h = 110, image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_leg.bmp"), selectionImage = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_leg_on.bmp"), value = True)
self.widgets["importMotionTo_rLegButton"] = cmds.iconTextCheckBox(w = 30, h = 110, image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_leg.bmp"), selectionImage = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_leg_on.bmp"), value = True)
cmds.formLayout(self.widgets["importMotionTo_Form"], edit = True, af = [(self.widgets["importMotionTo_HeadButton"], "top", 25), (self.widgets["importMotionTo_HeadButton"], "right", 100)])
cmds.formLayout(self.widgets["importMotionTo_Form"], edit = True, af = [(self.widgets["importMotionTo_SpineButton"], "top", 80), (self.widgets["importMotionTo_SpineButton"], "right", 100)])
cmds.formLayout(self.widgets["importMotionTo_Form"], edit = True, af = [(self.widgets["importMotionTo_lArmButton"], "top", 80), (self.widgets["importMotionTo_lArmButton"], "right", 70)])
cmds.formLayout(self.widgets["importMotionTo_Form"], edit = True, af = [(self.widgets["importMotionTo_rArmButton"], "top", 80), (self.widgets["importMotionTo_rArmButton"], "right", 155)])
cmds.formLayout(self.widgets["importMotionTo_Form"], edit = True, af = [(self.widgets["importMotionTo_lLegButton"], "top", 180), (self.widgets["importMotionTo_lLegButton"], "right", 98)])
cmds.formLayout(self.widgets["importMotionTo_Form"], edit = True, af = [(self.widgets["importMotionTo_rLegButton"], "top", 180), (self.widgets["importMotionTo_rLegButton"], "right", 125)])
#import button
self.widgets["importMocap_importButton"] = cmds.symbolButton(c = self.importMocap, w = 300, h = 50, image = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "importMotion_importButton.bmp"), parent = self.widgets["importMocapForm"])
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["importMocap_importButton"], "bottom", 10), (self.widgets["importMocap_importButton"], "left", 10)])
#heel solve checkbox
self.widgets["heelSolverCB"] = cmds.checkBox(label = "Solve Foot Roll", v = False, parent = self.widgets["importMocapForm"])
self.widgets["kneeSolverCB"] = cmds.checkBox(label = "Solve Knee Vectors", v = True, parent = self.widgets["importMocapForm"])
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["heelSolverCB"], "bottom", 110), (self.widgets["heelSolverCB"], "left", 10)])
cmds.formLayout(self.widgets["importMocapForm"], edit = True, af = [(self.widgets["kneeSolverCB"], "bottom", 110), (self.widgets["kneeSolverCB"], "left", 140)])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#IMPORT ANIMATION
self.widgets["importAnimationFormLayout"] = cmds.formLayout(w = 500, h = 400, parent = self.widgets["rightSideFrame"], visible = False)
#character list
self.widgets["importAnim_characterList"] = cmds.optionMenu(w = 200, h = 30)
self.widgets["importAnim_characterThumb"] = cmds.image(w = 50, h = 50)
cmds.formLayout(self.widgets["importAnimationFormLayout"], edit = True, af = [(self.widgets["importAnim_characterList"], "top", 30), (self.widgets["importAnim_characterList"], "left", 275)])
cmds.formLayout(self.widgets["importAnimationFormLayout"], edit = True, af = [(self.widgets["importAnim_characterThumb"], "top", 30), (self.widgets["importAnim_characterThumb"], "right", 10)])
#create the projects drop down
label = cmds.text(label = "Projects:", align = 'right')
self.widgets["importAnimProjectsList"] = cmds.optionMenu(w = 250,h = 30, parent = self.widgets["importAnimationFormLayout"], cc = self.getProjCategories)
cmds.formLayout(self.widgets["importAnimationFormLayout"], edit = True, af = [(label, "top", 10), (label, "left", 10)])
cmds.formLayout(self.widgets["importAnimationFormLayout"], edit = True, af = [(self.widgets["importAnimProjectsList"], "top", 30), (self.widgets["importAnimProjectsList"], "left", 10)])
#create the categories layout
self.widgets["categoriesList_topLayout"] = cmds.frameLayout(w = 250, h = 300, bs = "etchedIn", cll = False, cl = False, lv = False, parent = self.widgets["importAnimationFormLayout"])
cmds.formLayout(self.widgets["importAnimationFormLayout"], edit = True, af = [(self.widgets["categoriesList_topLayout"], "bottom", 10), (self.widgets["categoriesList_topLayout"], "left", 10)])
self.widgets["categoriesList_scrollLayout"] = cmds.scrollLayout(w = 240, h = 300, hst = 0, parent = self.widgets["categoriesList_topLayout"])
self.widgets["categoriesList_columnLayout"] = cmds.columnLayout(w = 220, parent = self.widgets["categoriesList_scrollLayout"])
#create the animation list layout
self.widgets["animList_topLayout"] = cmds.frameLayout(w = 260, h = 300, bs = "etchedIn", cll = False, cl = False, lv = False, parent = self.widgets["importAnimationFormLayout"], bgc = [.2, .2, .2])
cmds.formLayout(self.widgets["importAnimationFormLayout"], edit = True, af = [(self.widgets["animList_topLayout"], "bottom", 10), (self.widgets["animList_topLayout"], "right", 10)])
self.widgets["animList_scrollLayout"] = cmds.scrollLayout(w = 260, h = 300, hst = 0, parent = self.widgets["animList_topLayout"], bgc = [.2, .2, .2])
self.widgets["animList_columnLayout"] = cmds.columnLayout(w = 220, parent = self.widgets["animList_scrollLayout"], bgc = [.2, .2, .2])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#Edit radio button commands
cmds.iconTextRadioButton(self.widgets["importMotion_mocap"], edit = True, onc = partial(self.switchMode, "fbx"))
cmds.iconTextRadioButton(self.widgets["importMotion_anims"], edit = True, onc = partial(self.switchMode, "anim"))
#show the window
cmds.showWindow(self.widgets["window"])
#populate the dropdown with the characters
self.getCharacters()
self.changeActiveCharacter()
#populate the import animations project list
self.getProjects()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def getProjects(self, *args):
projectPath = os.path.join(self.mayaToolsDir, "General", "ART", "Projects")
projects = os.listdir(projectPath)
for proj in projects:
cmds.menuItem(label = proj, parent = self.widgets["importAnimProjectsList"])
#set to favorite if it exists
settingsLocation = os.path.join(self.mayaToolsDir, "General", "Scripts", "projectSettings.txt")
if os.path.exists(settingsLocation):
f = open(settingsLocation, 'r')
settings = cPickle.load(f)
favoriteProject = settings.get("FavoriteProject")
try:
cmds.optionMenu(self.widgets["importAnimProjectsList"], edit = True, v = favoriteProject)
except:
pass
self.getProjCategories()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def getProjCategories(self, *args):
#clear out all children first
children = cmds.columnLayout(self.widgets["categoriesList_columnLayout"], q = True, childArray = True)
if children != None:
for child in children:
cmds.deleteUI(child)
selectedProj = cmds.optionMenu(self.widgets["importAnimProjectsList"], q = True, v = True)
categoryPath = os.path.join(self.mayaToolsDir, "General", "ART", "Projects", selectedProj, "Animations")
if not os.path.exists(categoryPath):
os.makedirs(categoryPath)
categories = os.listdir(categoryPath)
self.widgets["animationCategories"] = cmds.iconTextRadioCollection()
for item in categories:
self.createCategoryEntry(item, selectedProj)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def createCategoryEntry(self, categoryName, project, *args):
cmds.iconTextRadioButton(onc = partial(self.getAnimations, categoryName, project), parent = self.widgets["categoriesList_columnLayout"], image = "menuIconFile.png", w = 220, h = 30, style = "iconAndTextHorizontal", label = categoryName, cl = self.widgets["animationCategories"], sl =True)
#get animations for seleted category
self.getAnimations(categoryName, project)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def getAnimations(self, categoryName, project, *args):
#clear out all animation files first
children = cmds.columnLayout(self.widgets["animList_columnLayout"], q = True, childArray = True)
if children != None:
for child in children:
cmds.deleteUI(child)
#get animations and populate UI
animFiles = os.listdir(os.path.join(self.mayaToolsDir, "General", "ART", "Projects", project, "Animations", categoryName))
for file in animFiles:
niceName = file.partition(".")[0]
button = cmds.iconTextButton( parent = self.widgets["animList_columnLayout"], image = "ghostOff.png", w = 220, h = 30, bgc = [.2, .2, .2], style = "iconAndTextHorizontal", label = niceName, ann = (project + ", " + categoryName))
#create the popup menu for the button
menu = cmds.popupMenu(b = 1, parent =button)
cmds.menuItem(label = "Import Options for " + file.partition(".")[0] + " animation:", parent = menu, enable = False)
cmds.menuItem(divider = True, parent = menu)
cmds.menuItem(label = "Import All Data", parent = menu, c = partial(self.importAnimation, file, project, categoryName))
cmds.menuItem(label = "Import Onto Selected Controls", parent = menu, c = partial(self.importAnimationOnSelection, file, project, categoryName))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def importAnimationOnSelection(self, animationName, project, categoryName, *args):
selected = cmds.ls(sl = True)
animPath = os.path.join(self.mayaToolsDir, "General", "ART", "Projects", project, "Animations", categoryName, animationName)
character = cmds.optionMenu(self.widgets["importAnim_characterList"], q = True, v = True)
f = open(animPath, 'r')
animData = cPickle.load(f)
f.close()
#create a progress window
progressWindow = cmds.progressWindow(title='Importing Animation', progress = 10, status='Importing...', isInterruptable=True )
progressIncrement = 100/len(animData)
#go through all of the animData ([layer, control, [curves and key pairings]])
for data in animData:
#cmds.progressWindow(edit = True, progress = progressIncrement, status='Importing...')
#sort out the incoming data
control = data[0]
keyInfo = data[1:]
layers = []
for info in keyInfo:
for i in info:
layer = i[0]
if layer != None:
layers.append(layer)
#if an object did have layers, we need to sort out the information
if layers != []:
#create needed layers
for layer in layers:
if layer != "BaseAnimation":
#see if our layer exists, if not create and select
try:
cmds.select(character + ":" + control)
if cmds.animLayer(layer, q = True, exists = True) == False:
cmds.animLayer(layer, addSelectedObjects = True)
else:
cmds.animLayer(layer, edit = True, addSelectedObjects = True)
except:
pass
#first setup base animation before other layers
animationLayersAll = cmds.ls(type = "animLayer")
for l in animationLayersAll:
cmds.animLayer(l, edit = True, selected = False)
cmds.animLayer("BaseAnimation", edit = True, selected = True)
for info in keyInfo:
for i in info:
layer = i[0]
if layer == None:
layer = "BaseAnimation"
attrs = i[1]
for attr in attrs:
attribute = attr[0]
if cmds.objExists(character + ":" + control + "." + attribute):
keys = attr[1]
for key in keys:
frame = key[0]
value = key[1]
#grab tangent info if there was any
try:
tangentInfo = key[2]
except:
tangentInfo = [None, None, None, None, None, None]
pass
if cmds.objExists(character + ":" + control):
if character + ":" + control in selected:
cmds.setKeyframe(character + ":" + control, animLayer = layer, at = attribute, t = frame, value = value, noResolve = True)
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), itt = tangentInfo[1])
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ott = tangentInfo[1])
if tangentInfo[2] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, ia = tangentInfo[2])
if tangentInfo[3] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, oa = tangentInfo[3])
if tangentInfo[4] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), iw = tangentInfo[4])
if tangentInfo[5] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ow = tangentInfo[5])
#refresh scene
cmds.select(character + ":" + control)
cmds.setToolTo('moveSuperContext')
cmds.select(clear = True)
else:
for info in keyInfo:
for i in info:
attrs = i[1]
for attr in attrs:
attribute = attr[0]
if cmds.objExists(character + ":" + control + "." + attribute):
keys = attr[1]
for key in keys:
frame = key[0]
value = key[1]
#grab tangent info if there was any
try:
tangentInfo = key[2]
except:
tangentInfo = [None, None, None, None, None, None]
pass
if cmds.objExists(character + ":" + control):
if character + ":" + control in selected:
if cmds.animLayer("BaseAnimation", q = True, exists = True):
cmds.setKeyframe(character + ":" + control, animLayer = "BaseAnimation", at = attribute, t = frame, value = value, noResolve = True)
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), itt = tangentInfo[1])
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ott = tangentInfo[1])
if tangentInfo[2] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, ia = tangentInfo[2])
if tangentInfo[3] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, oa = tangentInfo[3])
if tangentInfo[4] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), iw = tangentInfo[4])
if tangentInfo[5] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ow = tangentInfo[5])
else:
cmds.setKeyframe(character + ":" + control, at = attribute, t = frame, value = value)
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), itt = tangentInfo[1])
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ott = tangentInfo[1])
if tangentInfo[2] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, ia = tangentInfo[2])
if tangentInfo[3] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, oa = tangentInfo[3])
if tangentInfo[4] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), iw = tangentInfo[4])
if tangentInfo[5] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ow = tangentInfo[5])
cmds.progressWindow(progressWindow, endProgress=1)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def importAnimation(self, animationName, project, categoryName, *args):
animPath = os.path.join(self.mayaToolsDir, "General", "ART", "Projects", project, "Animations" , categoryName, animationName)
character = cmds.optionMenu(self.widgets["importAnim_characterList"], q = True, v = True)
f = open(animPath, 'r')
animData = cPickle.load(f)
f.close()
#create a progress window
progressWindow = cmds.progressWindow(title='Importing Animation', progress = 10, status='Importing...', isInterruptable=True )
progressIncrement = 100/len(animData)
#go through all of the animData ([layer, control, [curves and key pairings]])
for data in animData:
#sort out the incoming data
control = data[0]
keyInfo = data[1:]
layers = []
for info in keyInfo:
for i in info:
layer = i[0]
if layer != None:
layers.append(layer)
#if an object did have layers, we need to sort out the information
if layers != []:
#create needed layers
for layer in layers:
if layer != "BaseAnimation":
#see if our layer exists, if not create and select
try:
cmds.select(character + ":" + control)
if cmds.animLayer(layer, q = True, exists = True) == False:
cmds.animLayer(layer, addSelectedObjects = True)
else:
cmds.animLayer(layer, edit = True, addSelectedObjects = True)
except:
pass
#first setup base animation before other layers
animationLayersAll = cmds.ls(type = "animLayer")
for l in animationLayersAll:
cmds.animLayer(l, edit = True, selected = False)
cmds.animLayer("BaseAnimation", edit = True, selected = True)
for info in keyInfo:
#info is the array that includes all of the information for a control per layer. if info > 0, that means that control has animation on more than 1 layer.
for i in info:
#i is the array that has 2 pieces. the first element is the layer, the 2nd element is all of the keyframe data
layer = i[0]
if layer == None:
layer = "BaseAnimation"
attrs = i[1]
for attr in attrs:
#print layer, attr
attribute = attr[0]
if cmds.objExists(character + ":" + control + "." + attribute):
keys = attr[1]
for key in keys:
frame = key[0]
value = key[1]
#grab tangent info if there was any
try:
tangentInfo = key[2]
except:
tangentInfo = [None, None, None, None, None, None]
pass
if cmds.objExists(character + ":" + control):
cmds.setKeyframe(character + ":" + control, animLayer = layer, at = attribute, t = frame, value = value, noResolve = True)
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), itt = tangentInfo[1])
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ott = tangentInfo[1])
if tangentInfo[2] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, ia = tangentInfo[2])
if tangentInfo[3] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, oa = tangentInfo[3])
if tangentInfo[4] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), iw = tangentInfo[4])
if tangentInfo[5] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ow = tangentInfo[5])
#refresh scene
cmds.select(character + ":" + control)
cmds.setToolTo('moveSuperContext')
cmds.select(clear = True)
else:
for info in keyInfo:
for i in info:
attrs = i[1]
for attr in attrs:
attribute = attr[0]
if cmds.objExists(character + ":" + control + "." + attribute):
keys = attr[1]
for key in keys:
frame = key[0]
value = key[1]
#grab tangent info if there was any
try:
tangentInfo = key[2]
except:
tangentInfo = [None, None, None, None, None, None]
pass
if cmds.objExists(character + ":" + control):
if cmds.animLayer("BaseAnimation", q = True, exists = True):
cmds.setKeyframe(character + ":" + control, at = attribute, t = frame, value = value, animLayer = "BaseAnimation")
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), itt = tangentInfo[1])
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ott = tangentInfo[1])
if tangentInfo[2] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, ia = tangentInfo[2])
if tangentInfo[3] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, oa = tangentInfo[3])
if tangentInfo[4] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), iw = tangentInfo[4])
if tangentInfo[5] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ow = tangentInfo[5])
else:
cmds.setKeyframe(character + ":" + control, at = attribute, t = frame, value = value)
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), itt = tangentInfo[1])
if tangentInfo[1] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ott = tangentInfo[1])
if tangentInfo[2] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, ia = tangentInfo[2])
if tangentInfo[3] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), a = True, oa = tangentInfo[3])
if tangentInfo[4] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), iw = tangentInfo[4])
if tangentInfo[5] != None:
cmds.keyTangent(character + ":" + control + "." + attribute, t = (frame, frame), ow = tangentInfo[5])
cmds.progressWindow(progressWindow, endProgress=1)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def switchMode(self, mode, *args):
if mode == "fbx":
cmds.formLayout(self.widgets["importMocapForm"], edit = True, visible = True)
cmds.formLayout(self.widgets["importAnimationFormLayout"], edit = True, visible = False)
if mode == "anim":
cmds.formLayout(self.widgets["importMocapForm"], edit = True, visible = False)
cmds.formLayout(self.widgets["importAnimationFormLayout"], edit = True, visible = True)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def fbxBrowse(self, *args):
path = cmds.fileDialog2(fm = 1, fileFilter = "*.fbx", okc = "Select")[0]
#edit the text field with the above path passed in
cmds.textField(self.widgets["fbxImportTextField"], edit = True, text = path)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def ikHeelSolve(self, character, start, end, *args):
lValues = []
rValues = []
cmds.progressWindow(self.progWindow, edit=True, progress= 60, status= "Solving IK Foot Roll" )
for i in range(int(start), int(end + 1)):
cmds.currentTime(i)
if cmds.objExists("ball_l"):
lBallVal = cmds.getAttr("ball_l.rz")
lValues.append(lBallVal)
if cmds.objExists("ball_r"):
rBallVal = cmds.getAttr("ball_r.rz")
rValues.append(rBallVal)
cmds.progressWindow(self.progWindow, edit=True, progress= 80, status= "Solving IK Foot Roll" )
x = 0
for i in range(int(start), int(end + 1)):
cmds.currentTime(i)
if cmds.objExists("ball_l"):
if lValues[x] > 10:
cmds.setAttr(character + ":ik_foot_anim_l.rx", 0)
cmds.setAttr(character + ":ik_foot_anim_l.ry", 0)
cmds.setAttr(character + ":ik_foot_anim_l.rz", 0)
cmds.setKeyframe(character + ":ik_foot_anim_l")
cmds.setAttr(character + ":heel_ctrl_l.rz", lValues[x] * -1)
cmds.setKeyframe(character + ":heel_ctrl_l.rz")
footPos = cmds.xform("foot_l", q = True, ws = True, t = True)
ikFootPos = cmds.xform(character + ":ik_leg_foot_l", q = True, ws = True, t = True)
yDiff = footPos[1] - ikFootPos[1]
zDiff = footPos[2] - ikFootPos[2]
cmds.xform(character + ":ik_foot_anim_l", r = True, t = [0, yDiff, zDiff])
cmds.setKeyframe(character + ":ik_foot_anim_l")
else:
cmds.setAttr(character + ":heel_ctrl_l.rz", 0)
cmds.setKeyframe(character + ":heel_ctrl_l.rz")
if cmds.objExists("ball_r"):
if rValues[x] > 10:
cmds.setAttr(character + ":ik_foot_anim_r.rx", 0)
cmds.setAttr(character + ":ik_foot_anim_r.ry", 0)
cmds.setAttr(character + ":ik_foot_anim_r.rz", 0)
cmds.setKeyframe(character + ":ik_foot_anim_r")
cmds.setAttr(character + ":heel_ctrl_r.rz", rValues[x] * -1)
cmds.setKeyframe(character + ":heel_ctrl_r.rz")
footPos = cmds.xform("foot_r", q = True, ws = True, t = True)
ikFootPos = cmds.xform(character + ":ik_leg_foot_r", q = True, ws = True, t = True)
yDiff = footPos[1] - ikFootPos[1]
zDiff = footPos[2] - ikFootPos[2]
cmds.xform(character + ":ik_foot_anim_r", r = True, t = [0, yDiff, zDiff])
cmds.setKeyframe(character + ":ik_foot_anim_r")
else:
cmds.setAttr(character + ":heel_ctrl_r.rz", 0)
cmds.setKeyframe(character + ":heel_ctrl_r.rz")
#iterate x
x = x + 1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def ikKneeSolve(self, character, start, end, *args):
#Hide all the things
panels = cmds.getPanel(type = 'modelPanel')
for panel in panels:
editor = cmds.modelPanel(panel, q = True, modelEditor = True)
try:
cmds.modelEditor(editor, edit = True, interactive = False, displayTextures = False, textures = False, allObjects = False )
except:
pass
startPointR = cmds.xform(character + ":ik_leg_calf_r", q = True, ws = True, t = True)
endPointR = cmds.xform("calf_r", q = True, ws = True, t = True)
distR = cmds.distanceDimension( sp=(startPointR[0],startPointR[1],startPointR[2]), ep=(endPointR[0], endPointR[1], endPointR[2]) )
distRParent = cmds.listRelatives(distR, parent = True)[0]
locsR = cmds.listConnections(distR)
startLocR = locsR[0]
endLocR = locsR[1]
cmds.pointConstraint(character + ":ik_leg_calf_r", startLocR)
cmds.pointConstraint("calf_r", endLocR)
startPointL = cmds.xform(character + ":ik_leg_calf_l", q = True, ws = True, t = True)
endPointL = cmds.xform("calf_l", q = True, ws = True, t = True)
distL = cmds.distanceDimension( sp=(startPointL[0],startPointL[1],startPointL[2]), ep=(endPointL[0], endPointL[1], endPointL[2]) )
distLParent = cmds.listRelatives(distL, parent = True)[0]
locsL = cmds.listConnections(distL)
startLocL = locsL[0]
endLocL = locsL[1]
cmds.pointConstraint(character + ":ik_leg_calf_l", startLocL)
cmds.pointConstraint("calf_l", endLocL)
cmds.currentTime(int(start))
#get distance between rig knees and mocap knees
for i in range(int(start), int(end) + 1):
cmds.currentTime(i)
distanceR = cmds.getAttr(distR + ".distance")
distanceL = cmds.getAttr(distL + ".distance")
self.checkDistance(character, distL, distanceL, distanceL, "l")
self.checkDistance(character, distR, distanceR, distanceR, "r")
#clean up
cmds.delete([locsL[0], locsL[1], locsR[0], locsR[1], distL, distR, distRParent, distLParent])
#Show all the things
panels = cmds.getPanel(type = 'modelPanel')
for panel in panels:
editor = cmds.modelPanel(panel, q = True, modelEditor = True)
try:
cmds.modelEditor(editor, edit = True, interactive = True, displayTextures = True, textures = True, allObjects = True )
except:
pass
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def checkDistance(self, character, distanceNode, distanceAttr, originalValue, side):
if distanceAttr > 1:
currentAttr = cmds.getAttr(character + ":ik_foot_anim_" + side + ".knee_twist")
try:
cmds.setAttr(character + ":ik_foot_anim_" + side + ".knee_twist", currentAttr + 1)
cmds.setKeyframe(character + ":ik_foot_anim_" + side + ".knee_twist")
newDist = cmds.getAttr(distanceNode + ".distance")
if newDist < originalValue:
self.checkDistance(character, distanceNode, newDist, newDist, side)
cmds.progressWindow(self.progWindow, edit=True, progress= (cmds.progressWindow(q = True, progress = True) + 3), status= "Solving IK Pole Vectors" )
if newDist > originalValue:
cmds.setAttr(character + ":ik_foot_anim_" + side + ".knee_twist", currentAttr - 2)
cmds.setKeyframe(character + ":ik_foot_anim_" + side + ".knee_twist")
newDist = cmds.getAttr(distanceNode + ".distance")
self.checkDistance(character, distanceNode, newDist, newDist, side)
cmds.progressWindow(self.progWindow, edit=True, progress= (cmds.progressWindow(q = True, progress = True) + 3), status= "Solving IK Pole Vectors" )
except:
pass
#if adding 1 makes dist get smaller, continue adding 1 until the overall distance is less than 1
#if subtracting 1 makes dist get smaller, continue subtracting 1 until the overall distance is less than 1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def importMocap(self, *args):
#get the fbx file
filePath = cmds.textField(self.widgets["fbxImportTextField"], q = True, text = True)
if not os.path.exists(filePath):
cmds.warning("The given file path is not a valid path.")
return
else:
#get the active character
character = cmds.optionMenu(self.widgets["importMocap_characterList"], q = True, value = True)
#duplicate that character's root
if cmds.objExists("root"):
cmds.warning("There is already a skeleton in the scene with the name \"root\". Aborting")
return
newSkeleton = cmds.duplicate(character + ":root")
#find import method
selectedRadioButton = cmds.radioCollection(self.widgets["importMethodRadioCollection"], q = True, select = True)
importMethod = cmds.radioButton(selectedRadioButton, q = True, label = True)
#find parts that motion will be applied to
head = cmds.iconTextCheckBox(self.widgets["importMotionTo_HeadButton"], q = True, value = True)
body = cmds.iconTextCheckBox(self.widgets["importMotionTo_SpineButton"], q = True, value = True)
leftArm = cmds.iconTextCheckBox(self.widgets["importMotionTo_lArmButton"], q = True, value = True)
rightArm = cmds.iconTextCheckBox(self.widgets["importMotionTo_rArmButton"], q = True, value = True)
leftLeg = cmds.iconTextCheckBox(self.widgets["importMotionTo_lLegButton"], q = True, value = True)
rightLeg = cmds.iconTextCheckBox(self.widgets["importMotionTo_rLegButton"], q = True, value = True)
if importMethod == "FK":
extraControls = self.importMocap_FK(character, head, body, leftArm, rightArm, leftLeg, rightLeg)
if importMethod == "IK":
extraControls = self.importMocap_IK(character, head, body, leftArm, rightArm, leftLeg, rightLeg)
if importMethod == "Both":
extraControls = self.importMocap_FK(character, head, body, leftArm, rightArm, leftLeg, rightLeg)
self.importMocap_IK(character, head, body, leftArm, rightArm, leftLeg, rightLeg)
print extraControls
#fingers
self.importMocap_Fingers(character, leftArm, rightArm)
#ensure that the scene is in 30fps
cmds.currentUnit(time = 'ntsc')
cmds.playbackOptions(min = 0, max = 100, animationStartTime = 0, animationEndTime = 100)
cmds.currentTime(0)
#import the FBX file
string = "FBXImportMode -v \"exmerge\";"
mel.eval(string)
cmds.file(filePath, i = True, prompt = False, force = True)
animLayers = cmds.ls(type = "animLayer")
if animLayers != []:
for layer in animLayers:
cmds.animLayer(layer, edit = True, selected = False)
cmds.animLayer("BaseAnimation", edit = True, selected = True, preferred = True)
#snap timeline to length of imported animation
firstFrame = cmds.findKeyframe("pelvis", which = 'first')
lastFrame = cmds.findKeyframe("pelvis", which = 'last')
if lastFrame == firstFrame:
lastFrame = lastFrame + 1
cmds.playbackOptions(min = firstFrame, max = lastFrame, animationStartTime = firstFrame, animationEndTime = lastFrame)
#bake the animation down onto the controls
cmds.select(clear = True)
if importMethod == "FK":
if body == True:
cmds.select(character + ":body_anim", add = True)
cmds.select(character + ":spine_01_anim", add = True)
cmds.select(character + ":spine_02_anim", add = True)
if cmds.objExists(character + ":spine_03_anim"):
cmds.select(character + ":spine_03_anim", add = True)
if cmds.objExists(character + ":spine_04_anim"):
cmds.select(character + ":spine_04_anim", add = True)
if cmds.objExists(character + ":spine_05_anim"):
cmds.select(character + ":spine_05_anim", add = True)
if head == True:
cmds.select(character + ":head_fk_anim", add = True)
if cmds.objExists(character + ":neck_01_fk_anim"):
cmds.select(character + ":neck_01_fk_anim", add = True)
if cmds.objExists(character + ":neck_02_fk_anim"):
cmds.select(character + ":neck_02_fk_anim", add = True)
if cmds.objExists(character + ":neck_03_fk_anim"):
cmds.select(character + ":neck_03_fk_anim", add = True)
if leftArm == True:
cmds.select(character + ":clavicle_l_anim", add = True)
cmds.select(character + ":fk_arm_l_anim", add = True)
cmds.select(character + ":fk_elbow_l_anim", add = True)
cmds.select(character + ":fk_wrist_l_anim", add = True)
if rightArm == True:
cmds.select(character + ":clavicle_r_anim", add = True)
cmds.select(character + ":fk_arm_r_anim", add = True)
cmds.select(character + ":fk_elbow_r_anim", add = True)
cmds.select(character + ":fk_wrist_r_anim", add = True)
if leftLeg:
cmds.select(character + ":fk_thigh_l_anim", add = True)
cmds.select(character + ":fk_calf_l_anim", add = True)
cmds.select(character + ":fk_foot_l_anim", add = True)
if cmds.objExists("ball_l"):
cmds.select(character + ":fk_ball_l_anim", add = True)
if rightLeg:
cmds.select(character + ":fk_thigh_r_anim", add = True)
cmds.select(character + ":fk_calf_r_anim", add = True)
cmds.select(character + ":fk_foot_r_anim", add = True)
if cmds.objExists("ball_r"):
cmds.select(character + ":fk_ball_r_anim", add = True)
if importMethod == "IK":
if body == True:
cmds.select(character + ":body_anim", add = True)
cmds.select(character + ":chest_ik_anim", add = True)
cmds.select(character + ":mid_ik_anim", add = True)
if head == True:
cmds.select(character + ":head_fk_anim", add = True)
if cmds.objExists(character + ":neck_01_fk_anim"):
cmds.select(character + ":neck_01_fk_anim", add = True)
if cmds.objExists(character + ":neck_02_fk_anim"):
cmds.select(character + ":neck_02_fk_anim", add = True)
if cmds.objExists(character + ":neck_03_fk_anim"):
cmds.select(character + ":neck_03_fk_anim", add = True)
if leftArm == True:
cmds.select(character + ":ik_wrist_l_anim", add = True)
cmds.select(character + ":ik_elbow_l_anim", add = True)
if rightArm == True:
cmds.select(character + ":ik_wrist_r_anim", add = True)
cmds.select(character + ":ik_elbow_r_anim", add = True)
if leftLeg == True:
cmds.select(character + ":ik_foot_anim_l", add = True)
if rightLeg == True:
cmds.select(character + ":ik_foot_anim_r", add = True)
if importMethod == "Both":
if body == True:
cmds.select(character + ":body_anim", add = True)
cmds.select(character + ":chest_ik_anim", add = True)
cmds.select(character + ":mid_ik_anim", add = True)
cmds.select(character + ":body_anim", add = True)
cmds.select(character + ":spine_01_anim", add = True)
cmds.select(character + ":spine_02_anim", add = True)
if cmds.objExists(character + ":spine_03_anim"):
cmds.select(character + ":spine_03_anim", add = True)
if cmds.objExists(character + ":spine_04_anim"):
cmds.select(character + ":spine_04_anim", add = True)
if cmds.objExists(character + ":spine_05_anim"):
cmds.select(character + ":spine_05_anim", add = True)
if head == True:
cmds.select(character + ":head_fk_anim", add = True)
if cmds.objExists(character + ":neck_01_fk_anim"):
cmds.select(character + ":neck_01_fk_anim", add = True)
if cmds.objExists(character + ":neck_02_fk_anim"):
cmds.select(character + ":neck_02_fk_anim", add = True)
if cmds.objExists(character + ":neck_03_fk_anim"):
cmds.select(character + ":neck_03_fk_anim", add = True)
if leftArm == True:
cmds.select(character + ":ik_wrist_l_anim", add = True)
cmds.select(character + ":ik_elbow_l_anim", add = True)
cmds.select(character + ":clavicle_l_anim", add = True)
cmds.select(character + ":fk_arm_l_anim", add = True)
cmds.select(character + ":fk_elbow_l_anim", add = True)
cmds.select(character + ":fk_wrist_l_anim", add = True)
if rightArm == True:
cmds.select(character + ":ik_wrist_r_anim", add = True)
cmds.select(character + ":ik_elbow_r_anim", add = True)
cmds.select(character + ":clavicle_r_anim", add = True)
cmds.select(character + ":fk_arm_r_anim", add = True)
cmds.select(character + ":fk_elbow_r_anim", add = True)
cmds.select(character + ":fk_wrist_r_anim", add = True)
if leftLeg == True:
cmds.select(character + ":ik_foot_anim_l", add = True)
cmds.select(character + ":fk_thigh_l_anim", add = True)
cmds.select(character + ":fk_calf_l_anim", add = True)
cmds.select(character + ":fk_foot_l_anim", add = True)
if cmds.objExists("ball_l"):
cmds.select(character + ":fk_ball_l_anim", add = True)
if rightLeg == True:
cmds.select(character + ":ik_foot_anim_r", add = True)
cmds.select(character + ":fk_thigh_r_anim", add = True)
cmds.select(character + ":fk_calf_r_anim", add = True)
cmds.select(character + ":fk_foot_r_anim", add = True)
if cmds.objExists("ball_r"):
cmds.select(character + ":fk_ball_r_anim", add = True)
#select fingers:
for side in ["l", "r"]:
for finger in ["index", "middle", "ring", "pinky", "thumb"]:
if cmds.objExists(character + ":" + finger + "_finger_fk_ctrl_1_" + side):
cmds.select(character + ":" + finger + "_finger_fk_ctrl_1_" + side, add = True)
if cmds.objExists(character + ":" + finger + "_finger_fk_ctrl_2_" + side):
cmds.select(character + ":" + finger + "_finger_fk_ctrl_2_" + side, add = True)
if cmds.objExists(character + ":" + finger + "_finger_fk_ctrl_3_" + side):
cmds.select(character + ":" + finger + "_finger_fk_ctrl_3_" + side, add = True)
#select exttra controls
if len(extraControls) > 0:
for ctrl in extraControls:
cmds.select(ctrl, add = True)
#bake simulation
cmds.bakeResults(simulation = True, t = (firstFrame, lastFrame))
#fix ik knee solve
if importMethod == "IK" or importMethod == "Both":
if leftLeg == True or rightLeg == True:
self.progWindow = cmds.progressWindow(title = "Import Mocap", progress = 10, status = "Solving IK Pole Vectors")
val = cmds.checkBox(self.widgets["kneeSolverCB"], q = True, v = True)
if val == True:
self.ikKneeSolve(character, firstFrame, lastFrame)
val = cmds.checkBox(self.widgets["heelSolverCB"], q = True, v = True)
if val == True:
self.ikHeelSolve(character, firstFrame, lastFrame)
cmds.progressWindow(self.progWindow, endProgress=True)
#apply frame offset
offset = cmds.intField(self.widgets["frameOffsetField"], q = True, value = True)
cmds.select(clear = True)
for control in ["head_fk_anim", "neck_01_fk_anim", "neck_02_fk_anim", "neck_03_fk_anim", "spine_01_anim", "spine_02_anim", "spine_03_anim", "spine_04_anim", "spine_05_anim", "mid_ik_anim", "chest_ik_anim",
"body_anim", "hip_anim", "clavicle_l_anim", "clavicle_r_anim", "fk_arm_l_anim", "fk_arm_r_anim", "fk_elbow_l_anim", "fk_elbow_r_anim", "fk_wrist_l_anim", "fk_wrist_r_anim",
"ik_elbow_l_anim", "ik_elbow_r_anim", "ik_wrist_l_anim", "ik_wrist_r_anim", "fk_thigh_l_anim", "fk_thigh_r_anim", "fk_calf_l_anim", "fk_calf_r_anim", "fk_foot_l_anim", "fk_foot_r_anim",
"fk_ball_l_anim", "fk_ball_r_anim","ik_knee_anim_l", "ik_knee_anim_r", "ik_foot_anim_l", "ik_foot_anim_r", "index_finger_fk_ctrl_1_r", "index_finger_fk_ctrl_2_r", "index_finger_fk_ctrl_3_r",
"index_finger_fk_ctrl_1_l", "index_finger_fk_ctrl_2_l", "index_finger_fk_ctrl_3_l", "middle_finger_fk_ctrl_1_r", "middle_finger_fk_ctrl_2_r", "middle_finger_fk_ctrl_3_r",
"middle_finger_fk_ctrl_1_l", "middle_finger_fk_ctrl_2_l", "middle_finger_fk_ctrl_3_l", "ring_finger_fk_ctrl_1_r", "ring_finger_fk_ctrl_2_r", "ring_finger_fk_ctrl_3_r",
"ring_finger_fk_ctrl_1_l", "ring_finger_fk_ctrl_2_l", "ring_finger_fk_ctrl_3_l", "pinky_finger_fk_ctrl_1_r", "pinky_finger_fk_ctrl_2_r", "pinky_finger_fk_ctrl_3_r",
"pinky_finger_fk_ctrl_1_l", "pinky_finger_fk_ctrl_2_l", "pinky_finger_fk_ctrl_3_l", "thumb_finger_fk_ctrl_1_r", "thumb_finger_fk_ctrl_2_r", "thumb_finger_fk_ctrl_3_r", "thumb_finger_fk_ctrl_1_l", "thumb_finger_fk_ctrl_2_l", "thumb_finger_fk_ctrl_3_l"]:
if cmds.objExists(character + ":" + control):
cmds.select(character + ":" + control, add = True)
cmds.selectKey()
cmds.keyframe(edit = True, r = True, tc = offset)
firstFrame = cmds.findKeyframe("pelvis", which = 'first')
lastFrame = cmds.findKeyframe("pelvis", which = 'last')
cmds.playbackOptions(min = firstFrame, max = lastFrame, animationStartTime = firstFrame, animationEndTime = lastFrame)
#clean up
cmds.select(clear = True)
#delete the old skeleton
cmds.delete("root")
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def importMocap_IK(self, character, head, body, leftArm, rightArm, leftLeg, rightLeg):
if body == True:
#switch to IK mode
cmds.setAttr(character + ":Rig_Settings.spine_ik", 1)
cmds.setAttr(character + ":Rig_Settings.spine_fk", 0)
#constraints
cmds.parentConstraint("pelvis", character + ":body_anim")
if cmds.objExists(character + ":chest_ik_anim"):
#find highest spine joint
numSpineBones = cmds.getAttr(character + ":Skeleton_Settings.numSpineBones")
if numSpineBones == 5:
endSpine = "spine_05"
midSpine = ["spine_03"]
if numSpineBones == 4:
endSpine = "spine_04"
midSpine = ["spine_02", "spine_03"]
if numSpineBones == 3:
endSpine = "spine_03"
midSpine = ["spine_02"]
cmds.parentConstraint(endSpine, character + ":chest_ik_anim")
for each in midSpine:
cmds.parentConstraint(each, character + ":mid_ik_anim")
if head == True:
cmds.orientConstraint("neck_01", character + ":neck_01_fk_anim")
if cmds.objExists(character + ":neck_02_fk_anim"):
cmds.orientConstraint("neck_02", character + ":neck_02_fk_anim")
if cmds.objExists(character + ":neck_03_fk_anim"):
cmds.orientConstraint("neck_03", character + ":neck_03_fk_anim")
cmds.orientConstraint("head", character + ":head_fk_anim")
if leftArm == True:
#switch to IK mode
cmds.setAttr(character + ":Rig_Settings.lArmMode", 1)
#constraints
cmds.parentConstraint("hand_l", character + ":ik_wrist_l_anim", mo = True)
cmds.pointConstraint("lowerarm_l", character + ":ik_elbow_l_anim")
if rightArm == True:
#switch to IK mode
cmds.setAttr(character + ":Rig_Settings.rArmMode", 1)
#constraints
cmds.parentConstraint("hand_r", character + ":ik_wrist_r_anim", mo = True)
cmds.pointConstraint("lowerarm_r", character + ":ik_elbow_r_anim")
if leftLeg == True:
print "hooking up left leg"
#switch to IK mode
cmds.setAttr(character + ":Rig_Settings.lLegMode", 1)
#constraints
cmds.pointConstraint("foot_l", character + ":ik_foot_anim_l")
constraint = cmds.orientConstraint("foot_l", character + ":ik_foot_anim_l")[0]
cmds.setAttr(constraint + ".offsetY", 90)
if rightLeg == True:
print "hooking up right leg"
#switch to IK mode
cmds.setAttr(character + ":Rig_Settings.rLegMode", 1)
#constraints
cmds.pointConstraint("foot_r", character + ":ik_foot_anim_r", mo = True)
constraint = cmds.orientConstraint("foot_r", character + ":ik_foot_anim_r")[0]
cmds.setAttr(constraint + ".offsetX", 180)
cmds.setAttr(constraint + ".offsetY", 90)
coreJoints = ["root", "pelvis", "spine_01", "spine_02", "spine_03", "spine_04", "spine_05", "neck_01", "neck_02", "neck_03", "upperarm_l", "clavicle_l", "lowerarm_l", "hand_l", "upperarm_r", "clavicle_r", "lowerarm_r", "hand_r", "thigh_l", "calf_l", "foot_l", "ball_l", "thigh_r", "calf_r", "foot_r", "ball_r"]
cmds.select("root", hi = True)
allJoints = cmds.ls(sl = True)
extraControls = []
for joint in allJoints:
if joint not in coreJoints:
if cmds.objExists(character + ":" + joint + "_anim"):
try:
constraint = cmds.parentConstraint(joint, character + ":" + joint + "_anim")
extraControls.append(character + ":" + joint + "_anim")
except:
pass
return extraControls
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def importMocap_FK(self, character, head, body, leftArm, rightArm, leftLeg, rightLeg):
#setup constraints to FK controls
if body == True:
#switch to FK mode
cmds.setAttr(character + ":Rig_Settings.spine_ik", 0)
cmds.setAttr(character + ":Rig_Settings.spine_fk", 1)
#constraints
cmds.parentConstraint("pelvis", character + ":body_anim")
cmds.orientConstraint("spine_01", character + ":spine_01_anim")
cmds.orientConstraint("spine_02", character + ":spine_02_anim")
if cmds.objExists(character + ":spine_03_anim"):
cmds.orientConstraint("spine_03", character + ":spine_03_anim")
if cmds.objExists(character + ":spine_04_anim"):
cmds.orientConstraint("spine_04", character + ":spine_04_anim")
if cmds.objExists(character + ":spine_05_anim"):
cmds.orientConstraint("spine_05", character + ":spine_05_anim")
if head == True:
cmds.orientConstraint("neck_01", character + ":neck_01_fk_anim")
if cmds.objExists(character + ":neck_02_fk_anim"):
cmds.orientConstraint("neck_02", character + ":neck_02_fk_anim")
if cmds.objExists(character + ":neck_03_fk_anim"):
cmds.orientConstraint("neck_03", character + ":neck_03_fk_anim")
cmds.orientConstraint("head", character + ":head_fk_anim")
if leftArm == True:
#switch to FK mode
cmds.setAttr(character + ":Rig_Settings.lArmMode", 0)
cmds.pointConstraint("upperarm_l", character + ":clavicle_l_anim")
cmds.orientConstraint("upperarm_l", character + ":fk_arm_l_anim")
cmds.orientConstraint("lowerarm_l", character + ":fk_elbow_l_anim")
cmds.orientConstraint("hand_l", character + ":fk_wrist_l_anim")
if rightArm == True:
#switch to FK mode
cmds.setAttr(character + ":Rig_Settings.rArmMode", 0)
cmds.pointConstraint("upperarm_r", character + ":clavicle_r_anim")
cmds.orientConstraint("upperarm_r", character + ":fk_arm_r_anim")
cmds.orientConstraint("lowerarm_r", character + ":fk_elbow_r_anim")
cmds.orientConstraint("hand_r", character + ":fk_wrist_r_anim")
if leftLeg == True:
#switch to FK mode
cmds.setAttr(character + ":Rig_Settings.lLegMode", 0)
cmds.orientConstraint("thigh_l", character + ":fk_thigh_l_anim")
cmds.orientConstraint("calf_l", character + ":fk_calf_l_anim")
cmds.orientConstraint("foot_l", character + ":fk_foot_l_anim")
if cmds.objExists("ball_l"):
cmds.orientConstraint("ball_l", character + ":fk_ball_l_anim")
if rightLeg == True:
#switch to FK mode
cmds.setAttr(character + ":Rig_Settings.rLegMode", 0)
cmds.orientConstraint("thigh_r", character + ":fk_thigh_r_anim")
cmds.orientConstraint("calf_r", character + ":fk_calf_r_anim")
cmds.orientConstraint("foot_r", character + ":fk_foot_r_anim")
if cmds.objExists("ball_r"):
cmds.orientConstraint("ball_r", character + ":fk_ball_r_anim")
coreJoints = ["root", "pelvis", "spine_01", "spine_02", "spine_03", "spine_04", "spine_05", "neck_01", "neck_02", "neck_03", "upperarm_l", "clavicle_l", "lowerarm_l", "hand_l", "upperarm_r", "clavicle_r", "lowerarm_r", "hand_r", "thigh_l", "calf_l", "foot_l", "ball_l", "thigh_r", "calf_r", "foot_r", "ball_r"]
cmds.select("root", hi = True)
allJoints = cmds.ls(sl = True)
extraControls = []
for joint in allJoints:
if joint not in coreJoints:
if cmds.objExists(character + ":" + joint + "_anim"):
try:
constraint = cmds.parentConstraint(joint, character + ":" + joint + "_anim")
extraControls.append(character + ":" + joint + "_anim")
except:
pass
return extraControls
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def importMocap_Fingers(self, character, leftArm, rightArm):
if leftArm == True:
for finger in ["index", "middle", "ring", "pinky", "thumb"]:
#switch to FK mode
try:
cmds.setAttr(character + ":" + finger + "_finger_l_mode_anim.FK_IK", 0)
except:
pass
#setup constraints
if cmds.objExists(character + ":" + finger + "_finger_fk_ctrl_1_l"):
cmds.orientConstraint(finger + "_01_l", character + ":" + finger + "_finger_fk_ctrl_1_l")
if cmds.objExists(character + ":" + finger + "_finger_fk_ctrl_2_l"):
cmds.orientConstraint(finger + "_02_l", character + ":" + finger + "_finger_fk_ctrl_2_l")
if cmds.objExists(character + ":" + finger + "_finger_fk_ctrl_3_l"):
cmds.orientConstraint(finger + "_03_l", character + ":" + finger + "_finger_fk_ctrl_3_l")
if rightArm == True:
for finger in ["index", "middle", "ring", "pinky", "thumb"]:
#switch to FK mode
try:
cmds.setAttr(character + ":" + finger + "_finger_r_mode_anim.FK_IK", 0)
except:
pass
#setup constraints
if cmds.objExists(character + ":" + finger + "_finger_fk_ctrl_1_r"):
cmds.orientConstraint(finger + "_01_r", character + ":" + finger + "_finger_fk_ctrl_1_r")
if cmds.objExists(character + ":" + finger + "_finger_fk_ctrl_2_r"):
cmds.orientConstraint(finger + "_02_r", character + ":" + finger + "_finger_fk_ctrl_2_r")
if cmds.objExists(character + ":" + finger + "_finger_fk_ctrl_3_r"):
cmds.orientConstraint(finger + "_03_r", character + ":" + finger + "_finger_fk_ctrl_3_r")
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def getCharacters(self):
referenceNodes = []
references = cmds.ls(type = "reference")
for reference in references:
niceName = reference.rpartition("RN")[0]
suffix = reference.rpartition("RN")[2]
if suffix != "":
if cmds.objExists(niceName + suffix + ":" + "Skeleton_Settings"):
referenceNodes.append(niceName + suffix)
else:
if cmds.objExists(niceName + ":" + "Skeleton_Settings"):
referenceNodes.append(niceName)
for node in referenceNodes:
cmds.menuItem(label = node, parent = self.widgets["importMocap_characterList"])
cmds.menuItem(label = node, parent = self.widgets["importAnim_characterList"])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def changeActiveCharacter(self):
characterName = cmds.optionMenu(self.widgets["importMocap_characterList"], q = True, value = True)
thumbnailPath = os.path.join(self.mayaToolsDir, "General", "Icons", "ART", "Thumbnails", self.project)
thumbs = os.listdir(thumbnailPath)
for thumb in thumbs:
if thumb.find("_small") != -1:
if thumb.find(characterName) == 0:
cmds.image(self.widgets["importMocap_characterThumb"], edit = True, image = thumbnailPath + thumb, ann = characterName)
cmds.image(self.widgets["importAnim_characterThumb"], edit = True, image = thumbnailPath + thumb, ann = characterName)
| 82,725 | 82,725 | 0.473388 | 7,207 | 82,725 | 5.285417 | 0.086305 | 0.048225 | 0.040901 | 0.032001 | 0.679618 | 0.60115 | 0.585399 | 0.550011 | 0.510343 | 0.499659 | 0 | 0.015057 | 0.354536 | 82,725 | 1 | 82,725 | 82,725 | 0.698329 | 0.100115 | 0 | 0.568102 | 0 | 0 | 0.165175 | 0.05001 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.017462 | 0.137369 | null | null | 0.003492 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7971969dada14e580e45cb525f419bdeb7d73158 | 41 | py | Python | OpenCast/app/service/__init__.py | Tastyep/Pi-OpenCast | 1ed07130c26e6dd70184446af3c9143094d0c9a0 | [
"MIT"
] | 31 | 2019-10-05T14:23:10.000Z | 2022-02-27T19:38:55.000Z | OpenCast/app/service/__init__.py | Tastyep/RaspberryCast | 8ae8cf986b373b04c43d248ee72c77b1a29daa43 | [
"MIT"
] | 199 | 2020-08-30T16:33:03.000Z | 2022-03-28T04:10:06.000Z | OpenCast/app/service/__init__.py | Tastyep/RaspberryCast | 8ae8cf986b373b04c43d248ee72c77b1a29daa43 | [
"MIT"
] | 1 | 2019-10-05T16:00:49.000Z | 2019-10-05T16:00:49.000Z | """ Implementations command handlers """
| 20.5 | 40 | 0.731707 | 3 | 41 | 10 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121951 | 41 | 1 | 41 | 41 | 0.833333 | 0.780488 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
79b356b1867509b371634acb38cdbb0747ec9e48 | 273 | py | Python | jaraco/translate/__main__.py | jaraco/jaraco.translate | e218d89f670a9e29bd83a0f06d0f885c4d725d6f | [
"MIT"
] | null | null | null | jaraco/translate/__main__.py | jaraco/jaraco.translate | e218d89f670a9e29bd83a0f06d0f885c4d725d6f | [
"MIT"
] | null | null | null | jaraco/translate/__main__.py | jaraco/jaraco.translate | e218d89f670a9e29bd83a0f06d0f885c4d725d6f | [
"MIT"
] | 1 | 2016-04-27T00:12:23.000Z | 2016-04-27T00:12:23.000Z | import sys
import os
from . import google
def main():
lang = sys.argv[1]
text = ' '.join(sys.argv[2:])
google.translate.API_key = os.environ['GOOGLE_TRANSLATE_API_KEY']
print(google.translate(text, target_lang=lang))
__name__ == '__main__' and main()
| 17.0625 | 69 | 0.677656 | 39 | 273 | 4.410256 | 0.538462 | 0.261628 | 0.209302 | 0.244186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008929 | 0.179487 | 273 | 15 | 70 | 18.2 | 0.758929 | 0 | 0 | 0 | 0 | 0 | 0.120879 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.444444 | 0.111111 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
8db8512b043cb43c64133dc6a1e67b4f281289f8 | 3,878 | py | Python | pydeploy/tests/test_command_chain.py | yukinotenshi/pydeploy | e3ddf907b293c9da28503b3d72414a303c5dfbed | [
"MIT"
] | 2 | 2018-12-08T16:18:13.000Z | 2020-04-05T11:13:01.000Z | pydeploy/tests/test_command_chain.py | yukinotenshi/pydeploy | e3ddf907b293c9da28503b3d72414a303c5dfbed | [
"MIT"
] | 2 | 2021-06-01T23:08:24.000Z | 2021-11-27T06:13:41.000Z | pydeploy/tests/test_command_chain.py | yukinotenshi/pydeploy | e3ddf907b293c9da28503b3d72414a303c5dfbed | [
"MIT"
] | 1 | 2020-01-25T10:51:41.000Z | 2020-01-25T10:51:41.000Z | import os
import json
import unittest
from pydeploy.util import generate_random_string
from pydeploy.command_chain import CommandChain
class TestCommandChain(unittest.TestCase):
def setUp(self):
self.filename = generate_random_string()
self.first_out = generate_random_string()
self.second_out = generate_random_string()
def tearDown(self):
os.remove(self.filename)
CommandChain.instance = None
def test_empty(self):
data = {
'pre_script': [],
'post_script': [],
'remote': 'origin',
'branch': 'master'
}
with open(self.filename, 'w') as f:
json.dump(data, f)
chain = CommandChain.load_from_config(self.filename)
self.assertEqual(len(chain.commands), 1)
self.assertEqual(chain.commands[0].cmd, 'git pull origin master')
def test_prescript_only(self):
data = {
'pre_script': [
"echo " + self.first_out,
"echo " + self.second_out,
],
'post_script': [],
'remote': 'origin',
'branch': 'master'
}
with open(self.filename, 'w') as f:
json.dump(data, f)
chain = CommandChain.load_from_config(self.filename)
chain.commands[0].execute()
chain.commands[1].execute()
self.assertEqual(len(chain.commands), 3)
self.assertEqual(chain.commands[2].cmd, 'git pull origin master')
self.assertIn(self.first_out, chain.commands[0].out)
self.assertIn(self.second_out, chain.commands[1].out)
def test_postscript_only(self):
data = {
'post_script': [
"echo " + self.first_out,
"echo " + self.second_out,
],
'pre_script': [],
'remote': 'origin',
'branch': 'master'
}
with open(self.filename, 'w') as f:
json.dump(data, f)
chain = CommandChain.load_from_config(self.filename)
chain.commands[1].execute()
chain.commands[2].execute()
self.assertEqual(len(chain.commands), 3)
self.assertEqual(chain.commands[0].cmd, 'git pull origin master')
self.assertIn(self.first_out, chain.commands[1].out)
self.assertIn(self.second_out, chain.commands[2].out)
def test_all(self):
data = {
'post_script': [
"echo " + self.first_out,
"echo " + self.second_out,
],
'pre_script': [
"echo " + self.first_out,
"echo " + self.second_out,
],
'remote': 'origin',
'branch': 'master'
}
with open(self.filename, 'w') as f:
json.dump(data, f)
chain = CommandChain.load_from_config(self.filename)
chain.commands[0].execute()
chain.commands[1].execute()
chain.commands[3].execute()
chain.commands[4].execute()
self.assertEqual(len(chain.commands), 5)
self.assertEqual(chain.commands[2].cmd, 'git pull origin master')
self.assertIn(self.first_out, chain.commands[0].out)
self.assertIn(self.second_out, chain.commands[1].out)
self.assertIn(self.first_out, chain.commands[3].out)
self.assertIn(self.second_out, chain.commands[4].out)
def test_notifier_loaded(self):
data = {
'pre_script': [],
'post_script': [],
'remote': 'origin',
'branch': 'master',
'notifier': {
'type': 'discord',
'receiver': 'something'
}
}
with open(self.filename, 'w') as f:
json.dump(data, f)
chain = CommandChain.load_from_config(self.filename)
self.assertIsNotNone(chain.notifier)
| 31.528455 | 73 | 0.553636 | 420 | 3,878 | 4.980952 | 0.169048 | 0.14914 | 0.051625 | 0.057361 | 0.755736 | 0.74283 | 0.708413 | 0.698375 | 0.651052 | 0.651052 | 0 | 0.009053 | 0.3164 | 3,878 | 122 | 74 | 31.786885 | 0.780083 | 0 | 0 | 0.634615 | 1 | 0 | 0.101599 | 0 | 0 | 0 | 0 | 0 | 0.163462 | 1 | 0.067308 | false | 0 | 0.048077 | 0 | 0.125 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
8dbcef63697f90cd963b56ae7392f2f5cdfeec33 | 145 | py | Python | actions/get_policy.py | martezr/stackstorm-vault | 33c4a899871cb50df2fb899e1a2f715bcbbad67d | [
"Apache-2.0"
] | 3 | 2019-05-26T12:21:13.000Z | 2021-11-26T13:40:45.000Z | actions/get_policy.py | martezr/stackstorm-vault | 33c4a899871cb50df2fb899e1a2f715bcbbad67d | [
"Apache-2.0"
] | 12 | 2016-12-12T10:48:56.000Z | 2021-08-05T19:23:38.000Z | actions/get_policy.py | martezr/stackstorm-vault | 33c4a899871cb50df2fb899e1a2f715bcbbad67d | [
"Apache-2.0"
] | 11 | 2016-12-09T13:53:16.000Z | 2021-12-03T14:59:28.000Z | from lib import action
class VaultGetPolicyAction(action.VaultBaseAction):
def run(self, name):
return self.vault.get_policy(name)
| 20.714286 | 51 | 0.744828 | 18 | 145 | 5.944444 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172414 | 145 | 6 | 52 | 24.166667 | 0.891667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 4 |
8dc94644d29073b83fd6c00958d72e566dc74677 | 4,060 | py | Python | boto3_type_annotations_with_docs/boto3_type_annotations/transfer/paginator.py | cowboygneox/boto3_type_annotations | 450dce1de4e066b939de7eac2ec560ed1a7ddaa2 | [
"MIT"
] | 119 | 2018-12-01T18:20:57.000Z | 2022-02-02T10:31:29.000Z | boto3_type_annotations_with_docs/boto3_type_annotations/transfer/paginator.py | cowboygneox/boto3_type_annotations | 450dce1de4e066b939de7eac2ec560ed1a7ddaa2 | [
"MIT"
] | 15 | 2018-11-16T00:16:44.000Z | 2021-11-13T03:44:18.000Z | boto3_type_annotations_with_docs/boto3_type_annotations/transfer/paginator.py | cowboygneox/boto3_type_annotations | 450dce1de4e066b939de7eac2ec560ed1a7ddaa2 | [
"MIT"
] | 11 | 2019-05-06T05:26:51.000Z | 2021-09-28T15:27:59.000Z | from typing import Dict
from botocore.paginate import Paginator
class ListServers(Paginator):
def paginate(self, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that will paginate through responses from :py:meth:`Transfer.Client.list_servers`.
See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/transfer-2018-11-05/ListServers>`_
**Request Syntax**
::
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
**Response Syntax**
::
{
'Servers': [
{
'Arn': 'string',
'IdentityProviderType': 'SERVICE_MANAGED'|'API_GATEWAY',
'EndpointType': 'PUBLIC'|'VPC_ENDPOINT',
'LoggingRole': 'string',
'ServerId': 'string',
'State': 'OFFLINE'|'ONLINE'|'STARTING'|'STOPPING'|'START_FAILED'|'STOP_FAILED',
'UserCount': 123
},
]
}
**Response Structure**
- *(dict) --*
- **Servers** *(list) --*
An array of servers that were listed.
- *(dict) --*
Returns properties of the server that was specified.
- **Arn** *(string) --*
The unique Amazon Resource Name (ARN) for the server to be listed.
- **IdentityProviderType** *(string) --*
The authentication method used to validate a user for the server that was specified. listed. This can include Secure Shell (SSH), user name and password combinations, or your own custom authentication method. Valid values include ``SERVICE_MANAGED`` or ``API_GATEWAY`` .
- **EndpointType** *(string) --*
The type of VPC endpoint that your SFTP server is connected to. If your SFTP server is connected to a VPC endpoint, your server isn't accessible over the public internet.
- **LoggingRole** *(string) --*
The AWS Identity and Access Management entity that allows the server to turn on Amazon CloudWatch logging.
- **ServerId** *(string) --*
This value is the unique system assigned identifier for the SFTP servers that were listed.
- **State** *(string) --*
This property describes the condition of the SFTP server for the server that was described. A value of ``ONLINE`` > indicates that the server can accept jobs and transfer files. A ``State`` value of ``OFFLINE`` means that the server cannot perform file transfer operations.
The states of ``STARTING`` and ``STOPPING`` indicated that the server is in an intermediate state, either not fully able to respond, or not fully offline. The values of ``START_FAILED`` or ``STOP_FAILED`` can indicate an error condition.
- **UserCount** *(integer) --*
This property is a numeric value that indicates the number of users that are assigned to the SFTP server you specified with the ``ServerId`` .
:type PaginationConfig: dict
:param PaginationConfig:
A dictionary that provides parameters to control pagination.
- **MaxItems** *(integer) --*
The total number of items to return. If the total number of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination.
- **PageSize** *(integer) --*
The size of each page.
- **StartingToken** *(string) --*
A token to specify where to start paginating. This is the ``NextToken`` from a previous response.
:rtype: dict
:returns:
"""
pass
| 57.183099 | 291 | 0.573645 | 431 | 4,060 | 5.37587 | 0.438515 | 0.031075 | 0.016832 | 0.020716 | 0.072508 | 0.023306 | 0 | 0 | 0 | 0 | 0 | 0.006285 | 0.333744 | 4,060 | 70 | 292 | 58 | 0.850277 | 0.831281 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.4 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
8dd90087fd960f89ec410718ffbcfcd64567a4f1 | 22 | py | Python | Unit1/Part1/3-4-5.py | Devansu-Yadav/BasicsOfPython | 503ffb2f89da815d95e3eabf5b14de544729e705 | [
"MIT"
] | 1 | 2020-01-16T18:31:29.000Z | 2020-01-16T18:31:29.000Z | Unit1/Part1/3-4-5.py | golashboy/BasicsOfPython | b4a8db65ff9b513f836cf68e8dd4bcaebe5072bb | [
"MIT"
] | null | null | null | Unit1/Part1/3-4-5.py | golashboy/BasicsOfPython | b4a8db65ff9b513f836cf68e8dd4bcaebe5072bb | [
"MIT"
] | null | null | null | r=5
a=7
b=r+a
print(b) | 5.5 | 8 | 0.590909 | 9 | 22 | 1.444444 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105263 | 0.136364 | 22 | 4 | 8 | 5.5 | 0.578947 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 1 | 1 | 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 | 4 |
8de4e18b0ec253ee042da9091036e71233090962 | 264 | py | Python | UnityEngine/ParticleSystemCustomData/__init__.py | Grim-es/udon-pie-auto-completion | c2cd86554ed615cdbbb01e19fa40665eafdfaedc | [
"MIT"
] | null | null | null | UnityEngine/ParticleSystemCustomData/__init__.py | Grim-es/udon-pie-auto-completion | c2cd86554ed615cdbbb01e19fa40665eafdfaedc | [
"MIT"
] | null | null | null | UnityEngine/ParticleSystemCustomData/__init__.py | Grim-es/udon-pie-auto-completion | c2cd86554ed615cdbbb01e19fa40665eafdfaedc | [
"MIT"
] | null | null | null | from UdonPie import UnityEngine
from UdonPie.Undefined import *
class ParticleSystemCustomData:
def __new__(cls, arg1=None):
'''
:returns: ParticleSystemCustomData
:rtype: UnityEngine.ParticleSystemCustomData
'''
pass
| 22 | 52 | 0.67803 | 21 | 264 | 8.333333 | 0.714286 | 0.125714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005051 | 0.25 | 264 | 11 | 53 | 24 | 0.878788 | 0.299242 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
8df36557fa06fe5b86ce12231418d4a962798bf2 | 45 | py | Python | aioflow/__init__.py | luxrck/aioflow | d352c874b586a868c502993509016026d9b4944e | [
"MIT"
] | null | null | null | aioflow/__init__.py | luxrck/aioflow | d352c874b586a868c502993509016026d9b4944e | [
"MIT"
] | null | null | null | aioflow/__init__.py | luxrck/aioflow | d352c874b586a868c502993509016026d9b4944e | [
"MIT"
] | null | null | null | __version__ = "0.0.1"
from .worker import *
| 11.25 | 21 | 0.666667 | 7 | 45 | 3.714286 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081081 | 0.177778 | 45 | 3 | 22 | 15 | 0.621622 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
8df43342c203f0921c20fdbe348125ac285bf1f6 | 300 | py | Python | reto_decoradores.py | dirias/Curso-Profesional-de-Python | 956c52959e570bc00a7de37e81b47780c777a02e | [
"MIT"
] | null | null | null | reto_decoradores.py | dirias/Curso-Profesional-de-Python | 956c52959e570bc00a7de37e81b47780c777a02e | [
"MIT"
] | null | null | null | reto_decoradores.py | dirias/Curso-Profesional-de-Python | 956c52959e570bc00a7de37e81b47780c777a02e | [
"MIT"
] | null | null | null | def password_validator(func):
def wrapper(pw):
func(pw)
if len(pw) > 8:
print('The password is strong enough')
else:
print('The password is too week, please change it')
return wrapper
@password_validator
def login(pw):
pass
login('hola') | 20 | 63 | 0.593333 | 39 | 300 | 4.512821 | 0.615385 | 0.193182 | 0.181818 | 0.204545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004808 | 0.306667 | 300 | 15 | 64 | 20 | 0.841346 | 0 | 0 | 0 | 0 | 0 | 0.249169 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.416667 | 0 | 0 | 0.333333 | 0.166667 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
8df55e71ed954513404e75c6436f4a9a3db4f084 | 248 | py | Python | TradzQAI/API/cbpro/__init__.py | kkuette/AI_project | 1f46cb2536b24cb3716250f1e9705daa76af4f60 | [
"Apache-2.0"
] | 164 | 2017-11-24T13:07:04.000Z | 2022-03-10T04:54:46.000Z | TradzQAI/API/cbpro/__init__.py | kkuette/AI_project | 1f46cb2536b24cb3716250f1e9705daa76af4f60 | [
"Apache-2.0"
] | 21 | 2018-09-29T10:27:10.000Z | 2019-06-12T07:01:58.000Z | TradzQAI/API/cbpro/__init__.py | kkuette/AI_project | 1f46cb2536b24cb3716250f1e9705daa76af4f60 | [
"Apache-2.0"
] | 49 | 2018-05-09T17:28:52.000Z | 2022-02-27T04:50:45.000Z | from .authenticated_client import AuthenticatedClient
from .public_client import PublicClient
from .websocket_client import WebsocketClient
from .order_book import OrderBook
from .cbpro_auth import CBProAuth
from .cbpro_wrapper import cbprowrapper
| 35.428571 | 53 | 0.879032 | 30 | 248 | 7.066667 | 0.566667 | 0.169811 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 248 | 6 | 54 | 41.333333 | 0.946429 | 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 | 1 | 0 | 0 | 4 |
8df75bd75a436383788628f3fc4dc5828d8677dd | 33 | py | Python | .buildozer/android/platform/build-armeabi-v7a/build/venv/lib/python3.7/sre_compile.py | VPetras/mobile-test-app | 6708dade6873ae2fb1ecb13aa70662f95fb42dc6 | [
"MIT"
] | 12 | 2019-08-02T07:58:16.000Z | 2022-01-31T23:45:08.000Z | .buildozer/android/platform/build-armeabi-v7a/build/venv/lib/python3.7/sre_compile.py | VPetras/mobile-test-app | 6708dade6873ae2fb1ecb13aa70662f95fb42dc6 | [
"MIT"
] | 9 | 2021-03-19T02:17:08.000Z | 2022-03-12T00:01:38.000Z | .buildozer/android/platform/build-armeabi-v7a/build/venv/lib/python3.7/sre_compile.py | VPetras/mobile-test-app | 6708dade6873ae2fb1ecb13aa70662f95fb42dc6 | [
"MIT"
] | 11 | 2019-07-31T16:23:36.000Z | 2022-01-29T08:30:07.000Z | /usr/lib/python3.7/sre_compile.py | 33 | 33 | 0.818182 | 7 | 33 | 3.714286 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060606 | 0 | 33 | 1 | 33 | 33 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
5c14d1a226161d442eb8b3fd2527baa6840884a0 | 288 | py | Python | django_tally/user_def/models.py | CodeYellowBV/django-tally | a705821050da912fb8dabd56c41c040ea0a00a21 | [
"MIT"
] | null | null | null | django_tally/user_def/models.py | CodeYellowBV/django-tally | a705821050da912fb8dabd56c41c040ea0a00a21 | [
"MIT"
] | null | null | null | django_tally/user_def/models.py | CodeYellowBV/django-tally | a705821050da912fb8dabd56c41c040ea0a00a21 | [
"MIT"
] | null | null | null | from .group_tally import UserDefGroupTallyBase
from .tally import UserDefTallyBase
from .template import UserDefTemplateBase
class UserDefGroupTally(UserDefGroupTallyBase):
pass
class UserDefTally(UserDefTallyBase):
pass
class UserDefTemplate(UserDefTemplateBase):
pass
| 18 | 47 | 0.822917 | 25 | 288 | 9.44 | 0.52 | 0.09322 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135417 | 288 | 15 | 48 | 19.2 | 0.947791 | 0 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 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 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 4 |
5c1f8408f8dc520b46daaf84d640560497b72244 | 168 | py | Python | snippets/closure_functions/closure.py | peterbe/govspy | b1d0d3a3f9cfbbdc6e90ee4abec012f29a4d4b57 | [
"CNRI-Python"
] | 106 | 2015-02-16T09:09:37.000Z | 2022-03-16T14:34:29.000Z | snippets/closure_functions/closure.py | peterbe/govspy | b1d0d3a3f9cfbbdc6e90ee4abec012f29a4d4b57 | [
"CNRI-Python"
] | 13 | 2017-02-20T01:34:45.000Z | 2022-03-11T10:48:58.000Z | snippets/closure_functions/closure.py | peterbe/govspy | b1d0d3a3f9cfbbdc6e90ee4abec012f29a4d4b57 | [
"CNRI-Python"
] | 13 | 2016-02-25T01:24:24.000Z | 2020-11-10T01:27:56.000Z | def run():
def increment(amount):
return number + amount
number = 0
number = increment(1)
number = increment(2)
print(number) # 3
run()
| 14 | 30 | 0.571429 | 20 | 168 | 4.8 | 0.55 | 0.3125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034783 | 0.315476 | 168 | 11 | 31 | 15.272727 | 0.8 | 0.005952 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.125 | 0.375 | 0.125 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 4 |
5c3726e321b69074fb14be0268f1ae50576a8ced | 10,719 | py | Python | Algorithm.Python/stubs/QuantConnect/Indicators/____init___2.py | gaoxiaojun/Lean | 9dca43bccb720d0df91e4bfc1d363b71e3a36cb5 | [
"Apache-2.0"
] | 2 | 2020-12-08T11:27:20.000Z | 2021-04-06T13:21:15.000Z | Algorithm.Python/stubs/QuantConnect/Indicators/____init___2.py | gaoxiaojun/Lean | 9dca43bccb720d0df91e4bfc1d363b71e3a36cb5 | [
"Apache-2.0"
] | null | null | null | Algorithm.Python/stubs/QuantConnect/Indicators/____init___2.py | gaoxiaojun/Lean | 9dca43bccb720d0df91e4bfc1d363b71e3a36cb5 | [
"Apache-2.0"
] | 1 | 2020-12-08T11:27:21.000Z | 2020-12-08T11:27:21.000Z | from .____init___3 import *
import typing
import System.IO
import System.Collections.Generic
import System
import QuantConnect.Indicators
import QuantConnect.Data.Market
import QuantConnect.Data
import QuantConnect
import Python.Runtime
import datetime
class BollingerBands(QuantConnect.Indicators.Indicator, QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider, System.IComparable, QuantConnect.Indicators.IIndicator[IndicatorDataPoint], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IndicatorDataPoint]]):
"""
This indicator creates a moving average (middle band) with an upper band and lower band
fixed at k standard deviations above and below the moving average.
BollingerBands(period: int, k: Decimal, movingAverageType: MovingAverageType)
BollingerBands(name: str, period: int, k: Decimal, movingAverageType: MovingAverageType)
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, period: int, k: float, movingAverageType: QuantConnect.Indicators.MovingAverageType) -> QuantConnect.Indicators.BollingerBands:
pass
@typing.overload
def __init__(self, name: str, period: int, k: float, movingAverageType: QuantConnect.Indicators.MovingAverageType) -> QuantConnect.Indicators.BollingerBands:
pass
def __init__(self, *args) -> QuantConnect.Indicators.BollingerBands:
pass
BandWidth: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.IndicatorDataPoint]
IsReady: bool
LowerBand: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.IndicatorDataPoint]
MiddleBand: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.IndicatorDataPoint]
MovingAverageType: QuantConnect.Indicators.MovingAverageType
PercentB: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.IndicatorDataPoint]
Price: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.IndicatorDataPoint]
StandardDeviation: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.IndicatorDataPoint]
UpperBand: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.IndicatorDataPoint]
WarmUpPeriod: int
class ChandeMomentumOscillator(QuantConnect.Indicators.WindowIndicator[IndicatorDataPoint], QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider, System.IComparable, QuantConnect.Indicators.IIndicator[IndicatorDataPoint], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IndicatorDataPoint]]):
"""
This indicator computes the Chande Momentum Oscillator (CMO).
CMO calculation is mostly identical to RSI.
The only difference is in the last step of calculation:
RSI = gain / (gain+loss)
CMO = (gain-loss) / (gain+loss)
ChandeMomentumOscillator(period: int)
ChandeMomentumOscillator(name: str, period: int)
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, period: int) -> QuantConnect.Indicators.ChandeMomentumOscillator:
pass
@typing.overload
def __init__(self, name: str, period: int) -> QuantConnect.Indicators.ChandeMomentumOscillator:
pass
def __init__(self, *args) -> QuantConnect.Indicators.ChandeMomentumOscillator:
pass
IsReady: bool
WarmUpPeriod: int
class CommodityChannelIndex(QuantConnect.Indicators.BarIndicator, QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Represents the traditional commodity channel index (CCI)
CCI = (Typical Price - 20-period SMA of TP) / (.015 * Mean Deviation)
Typical Price (TP) = (High + Low + Close)/3
Constant = 0.015
There are four steps to calculating the Mean Deviation, first, subtract
the most recent 20-period average of the typical price from each period's
typical price. Second, take the absolute values of these numbers. Third,
sum the absolute values. Fourth, divide by the total number of periods (20).
CommodityChannelIndex(period: int, movingAverageType: MovingAverageType)
CommodityChannelIndex(name: str, period: int, movingAverageType: MovingAverageType)
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, period: int, movingAverageType: QuantConnect.Indicators.MovingAverageType) -> QuantConnect.Indicators.CommodityChannelIndex:
pass
@typing.overload
def __init__(self, name: str, period: int, movingAverageType: QuantConnect.Indicators.MovingAverageType) -> QuantConnect.Indicators.CommodityChannelIndex:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CommodityChannelIndex:
pass
IsReady: bool
MovingAverageType: QuantConnect.Indicators.MovingAverageType
TypicalPriceAverage: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.IndicatorDataPoint]
TypicalPriceMeanDeviation: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.IndicatorDataPoint]
WarmUpPeriod: int
class CompositeIndicator(QuantConnect.Indicators.IndicatorBase[IndicatorDataPoint], System.IComparable, QuantConnect.Indicators.IIndicator[IndicatorDataPoint], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IndicatorDataPoint]]):
"""
CompositeIndicator[T](name: str, left: IndicatorBase[T], right: IndicatorBase[T], composer: IndicatorComposer)
CompositeIndicator[T](left: IndicatorBase[T], right: IndicatorBase[T], composer: IndicatorComposer)
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str, left: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.T], right: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.T], composer: QuantConnect.Indicators.IndicatorComposer[QuantConnect.Indicators.T]) -> QuantConnect.Indicators.CompositeIndicator:
pass
@typing.overload
def __init__(self, left: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.T], right: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.T], composer: QuantConnect.Indicators.IndicatorComposer[QuantConnect.Indicators.T]) -> QuantConnect.Indicators.CompositeIndicator:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CompositeIndicator:
pass
IsReady: bool
Left: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.T]
Right: QuantConnect.Indicators.IndicatorBase[QuantConnect.Indicators.T]
IndicatorComposer: type
class ConstantIndicator(QuantConnect.Indicators.IndicatorBase[T], System.IComparable, QuantConnect.Indicators.IIndicator[T], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[T]]):
""" ConstantIndicator[T](name: str, value: Decimal) """
def Reset(self) -> None:
pass
def __init__(self, name: str, value: float) -> QuantConnect.Indicators.ConstantIndicator:
pass
IsReady: bool
class CoppockCurve(QuantConnect.Indicators.IndicatorBase[IndicatorDataPoint], QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider, System.IComparable, QuantConnect.Indicators.IIndicator[IndicatorDataPoint], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IndicatorDataPoint]]):
"""
A momentum indicator developed by Edwin “Sedge” Coppock in October 1965.
The goal of this indicator is to identify long-term buying opportunities in the S&P500 and Dow Industrials.
Source: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:coppock_curve
CoppockCurve()
CoppockCurve(shortRocPeriod: int, longRocPeriod: int, lwmaPeriod: int)
CoppockCurve(name: str, shortRocPeriod: int, longRocPeriod: int, lwmaPeriod: int)
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CoppockCurve:
pass
@typing.overload
def __init__(self, shortRocPeriod: int, longRocPeriod: int, lwmaPeriod: int) -> QuantConnect.Indicators.CoppockCurve:
pass
@typing.overload
def __init__(self, name: str, shortRocPeriod: int, longRocPeriod: int, lwmaPeriod: int) -> QuantConnect.Indicators.CoppockCurve:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CoppockCurve:
pass
IsReady: bool
WarmUpPeriod: int
class Delay(QuantConnect.Indicators.WindowIndicator[IndicatorDataPoint], QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider, System.IComparable, QuantConnect.Indicators.IIndicator[IndicatorDataPoint], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IndicatorDataPoint]]):
"""
An indicator that delays its input for a certain period
Delay(period: int)
Delay(name: str, period: int)
"""
@typing.overload
def __init__(self, period: int) -> QuantConnect.Indicators.Delay:
pass
@typing.overload
def __init__(self, name: str, period: int) -> QuantConnect.Indicators.Delay:
pass
def __init__(self, *args) -> QuantConnect.Indicators.Delay:
pass
IsReady: bool
WarmUpPeriod: int
class DetrendedPriceOscillator(QuantConnect.Indicators.IndicatorBase[IndicatorDataPoint], QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider, System.IComparable, QuantConnect.Indicators.IIndicator[IndicatorDataPoint], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IndicatorDataPoint]]):
"""
The Detrended Price Oscillator is an indicator designed to remove trend from price
and make it easier to identify cycles.
DPO does not extend to the last date because it is based on a displaced moving average.
Is estimated as Price {X/2 + 1} periods ago less the X-period simple moving average.
E.g.DPO(20) equals price 11 days ago less the 20-day SMA.
DetrendedPriceOscillator(name: str, period: int)
DetrendedPriceOscillator(period: int)
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str, period: int) -> QuantConnect.Indicators.DetrendedPriceOscillator:
pass
@typing.overload
def __init__(self, period: int) -> QuantConnect.Indicators.DetrendedPriceOscillator:
pass
def __init__(self, *args) -> QuantConnect.Indicators.DetrendedPriceOscillator:
pass
IsReady: bool
WarmUpPeriod: int
| 41.3861 | 312 | 0.745499 | 1,015 | 10,719 | 7.772414 | 0.211823 | 0.262137 | 0.03207 | 0.039929 | 0.671314 | 0.653568 | 0.527697 | 0.493345 | 0.457599 | 0.415262 | 0 | 0.003372 | 0.170072 | 10,719 | 258 | 313 | 41.546512 | 0.883431 | 0.258886 | 0 | 0.557377 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.245902 | false | 0.245902 | 0.090164 | 0 | 0.631148 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 4 |
5c48507b3df5ccfca6603885c9f607d9bde2cfaa | 40 | py | Python | Python/soma.py | alinemarchiori/NEPS_Exercises_Solved | 429402c6a86f64d54b80bf965f9ec3e95a5e5db8 | [
"MIT"
] | null | null | null | Python/soma.py | alinemarchiori/NEPS_Exercises_Solved | 429402c6a86f64d54b80bf965f9ec3e95a5e5db8 | [
"MIT"
] | null | null | null | Python/soma.py | alinemarchiori/NEPS_Exercises_Solved | 429402c6a86f64d54b80bf965f9ec3e95a5e5db8 | [
"MIT"
] | null | null | null | A=int(input())
B=int(input())
print(A+B) | 13.333333 | 14 | 0.625 | 9 | 40 | 2.777778 | 0.555556 | 0.64 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | 40 | 3 | 15 | 13.333333 | 0.657895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 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 | 4 |
308464fb4e3c68d0926c6e95c2953fd7018612b7 | 660 | py | Python | MovieSerieTorrent/info.py | JonathanPetit/Parser-Renamer-torrentfile | 3193b0544348e17c527f921e34283eb7ea66b01b | [
"MIT"
] | 7 | 2016-04-21T21:16:29.000Z | 2021-11-20T13:16:21.000Z | MovieSerieTorrent/info.py | JonathanPetit/Parser-Renamer-torrentfile | 3193b0544348e17c527f921e34283eb7ea66b01b | [
"MIT"
] | 5 | 2016-03-03T23:41:08.000Z | 2016-03-05T13:11:34.000Z | MovieSerieTorrent/info.py | JonathanPetit/Parser-Renamer-torrentfile | 3193b0544348e17c527f921e34283eb7ea66b01b | [
"MIT"
] | 3 | 2019-04-03T19:00:42.000Z | 2021-06-08T17:03:06.000Z | database = {
"season": "([Ss]?[0-9]{1,2})[Eex]",
"episode": "([Eex][0-9]{1,2})",
"year": "[\\[\\(]?((?:19[0-9]|20[012])[0-9])[\\]\\)]?",
"languages": "FRENCH|French|french|TRUEFRENCH|VOSTFR|VOST",
"sites": "[\\[\\s]{0,2}([Ww]{3}[.][A-Za-z0-9]+[.][a-z]{2,3})[\\]\\s]{0,2}",
"codec": "XViD|XVID|xvid|Xvid|XviD|x264|h\\.?264",
"quality": "((?:DVD|HD|B[Rr]|BD|WEB)[RrIiPp]{3}|[HP]DTV|H?D?CAM|[Bb]lu[Rr]ay|DVDSCR|WEB-DL)",
"resolution": "([0-9]{3,4}p)",
"audio": "(MP3|DD5\\.?1|Dual[\\- ]Audio|LiNE|DTS|AAC(?:\\.?2\\.0)?|AC3(?:\\.5\\.1)?)",
"sub": "FASTSUB|FANSUB",
"group": "[\\s]{2,}([A-Za-z0-9]+$)",
"extension": "[\\s]{0,1}(avi|mkv)$"
}
| 44 | 95 | 0.472727 | 112 | 660 | 2.785714 | 0.598214 | 0.032051 | 0.115385 | 0.025641 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.085667 | 0.080303 | 660 | 14 | 96 | 47.142857 | 0.428336 | 0 | 0 | 0 | 0 | 0.214286 | 0.79697 | 0.584848 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
30a92203765d75dab0c40cdaa3f9a18ae80fc884 | 91 | py | Python | test/main.py | kzulfazriawan/kommand | 59b6104d9bf1bc726f3eb30dd16ad8a970a307b0 | [
"MIT"
] | null | null | null | test/main.py | kzulfazriawan/kommand | 59b6104d9bf1bc726f3eb30dd16ad8a970a307b0 | [
"MIT"
] | 2 | 2020-07-20T07:54:00.000Z | 2020-07-29T11:07:12.000Z | test/main.py | kzulfazriawan/kommand | 59b6104d9bf1bc726f3eb30dd16ad8a970a307b0 | [
"MIT"
] | null | null | null | from kommand import control
if __name__ == '__main__':
control(json_file='kom.json')
| 15.166667 | 33 | 0.714286 | 12 | 91 | 4.666667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164835 | 91 | 5 | 34 | 18.2 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0.175824 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
30cb01053f05f815daecbe9ac16a329d90b154aa | 27 | py | Python | lib/python3.4/token.py | caiocsalvador/whats_the_craic | c49ef62f1acd7379f6fd90c2b93aa1fa00c8661d | [
"MIT"
] | 7 | 2017-04-26T12:28:22.000Z | 2021-02-09T18:59:50.000Z | django-ng/lib/python3.4/token.py | Arsalen/BusinessStrategies | 209e57340359af3ea063c064982198848dc36c5f | [
"MIT"
] | 13 | 2015-12-04T03:38:37.000Z | 2015-12-12T00:15:46.000Z | django-ng/lib/python3.4/token.py | Arsalen/BusinessStrategies | 209e57340359af3ea063c064982198848dc36c5f | [
"MIT"
] | 8 | 2017-06-01T08:42:16.000Z | 2020-07-23T12:30:19.000Z | /usr/lib/python3.4/token.py | 27 | 27 | 0.777778 | 6 | 27 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074074 | 0 | 27 | 1 | 27 | 27 | 0.703704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
30d951cc2af791015630ad1179494dd875aed358 | 171 | py | Python | tests/utils/code_formatter.py | omergertel/slash | 7dd5710a05822bbbaadc6c6517cefcbaa6397eab | [
"BSD-3-Clause"
] | 70 | 2015-12-05T12:33:10.000Z | 2022-03-03T04:56:58.000Z | tests/utils/code_formatter.py | omergertel/slash | 7dd5710a05822bbbaadc6c6517cefcbaa6397eab | [
"BSD-3-Clause"
] | 711 | 2015-10-06T11:01:48.000Z | 2022-02-09T12:40:47.000Z | tests/utils/code_formatter.py | omergertel/slash | 7dd5710a05822bbbaadc6c6517cefcbaa6397eab | [
"BSD-3-Clause"
] | 37 | 2015-10-13T11:00:51.000Z | 2022-02-08T07:28:11.000Z | from slash.utils.formatter import Formatter
class CodeFormatter(Formatter):
def __init__(self, stream):
super(CodeFormatter, self).__init__(stream, ' ' * 4)
| 24.428571 | 60 | 0.719298 | 19 | 171 | 6.052632 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007042 | 0.169591 | 171 | 6 | 61 | 28.5 | 0.802817 | 0 | 0 | 0 | 0 | 0 | 0.005848 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 4 |
a50e9b7c9badc684be5372271f25d21b0a8638a7 | 109 | py | Python | data/scraper/suicide_crisis_center/constants.py | gchatterjee/emergency-app | c63074fa99abdf2d5859bce613b774875a3d70c1 | [
"MIT"
] | null | null | null | data/scraper/suicide_crisis_center/constants.py | gchatterjee/emergency-app | c63074fa99abdf2d5859bce613b774875a3d70c1 | [
"MIT"
] | 29 | 2020-06-29T23:58:56.000Z | 2020-07-11T04:24:08.000Z | data/scraper/suicide_crisis_center/constants.py | gchatterjee/emergency-app | c63074fa99abdf2d5859bce613b774875a3d70c1 | [
"MIT"
] | null | null | null | '''constant for suicide crisis centers'''
URL = 'https://suicidepreventionlifeline.org/our-crisis-centers/'
| 27.25 | 65 | 0.761468 | 12 | 109 | 6.916667 | 0.833333 | 0.313253 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082569 | 109 | 3 | 66 | 36.333333 | 0.83 | 0.321101 | 0 | 0 | 0 | 0 | 0.838235 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
eb47be222da83a65e2ed0ca6b1b6b0cef2892992 | 122 | py | Python | sopel/modules/vote.py | Ameenekosan/Yumiko | 16624f0b3f5c94262104b85866ce2cf7fd96f0db | [
"EFL-2.0"
] | null | null | null | sopel/modules/vote.py | Ameenekosan/Yumiko | 16624f0b3f5c94262104b85866ce2cf7fd96f0db | [
"EFL-2.0"
] | null | null | null | sopel/modules/vote.py | Ameenekosan/Yumiko | 16624f0b3f5c94262104b85866ce2cf7fd96f0db | [
"EFL-2.0"
] | null | null | null | #old modules from smircbot re-written in Python2
# coding=utf8
from sopel.module import commands, rule, priority, example
| 30.5 | 58 | 0.803279 | 18 | 122 | 5.444444 | 0.944444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018868 | 0.131148 | 122 | 3 | 59 | 40.666667 | 0.90566 | 0.483607 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
eb597205b90760ef1df8523e2c3252a7ac670702 | 507 | py | Python | main.py | Kulothungan8297/Arithmetic-Formatter | 3ff8e010d84c729bc7637c90a0ae9f3c70559ca4 | [
"CC0-1.0"
] | null | null | null | main.py | Kulothungan8297/Arithmetic-Formatter | 3ff8e010d84c729bc7637c90a0ae9f3c70559ca4 | [
"CC0-1.0"
] | null | null | null | main.py | Kulothungan8297/Arithmetic-Formatter | 3ff8e010d84c729bc7637c90a0ae9f3c70559ca4 | [
"CC0-1.0"
] | null | null | null | from arithmetic_arranger import arithmetic_arranger
from unittest import main
#print(arithmetic_arranger(["3 + 855", "3801 - 2", "45 + 43", "123 + 49"]))
#actual = arithmetic_arranger(["32 - 698", "1 - 3801", "45 + 43", "123 + 49"], True)
#print(actual)
#expected = " 32 1 45 123\n- 698 - 3801 + 43 + 49\n----- ------ ---- -----\n -666 -3800 88 172"
#print(expected)
# Run unit tests automatically
main(module='test_module', exit=False)
| 36.214286 | 149 | 0.554241 | 63 | 507 | 4.380952 | 0.539683 | 0.26087 | 0.050725 | 0.065217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.182796 | 0.266272 | 507 | 13 | 150 | 39 | 0.55914 | 0.712032 | 0 | 0 | 0 | 0 | 0.086614 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
eb639adddd95714531644321b0a9c7515857593c | 196 | py | Python | pinto/pinto/core/routes.py | wwitzel3/pinto | 8114a733fb8ccaf9b030c64727f626c24ffe5788 | [
"MIT"
] | 3 | 2015-01-24T14:35:50.000Z | 2016-07-06T10:04:50.000Z | pinto/pinto/core/routes.py | wwitzel3/pinto | 8114a733fb8ccaf9b030c64727f626c24ffe5788 | [
"MIT"
] | null | null | null | pinto/pinto/core/routes.py | wwitzel3/pinto | 8114a733fb8ccaf9b030c64727f626c24ffe5788 | [
"MIT"
] | null | null | null | from pinto.security import RootACL
class Root(RootACL):
pass
def includeme(config):
config.add_route('about', '/about', factory=Root)
config.add_route('index', '/', factory=Root)
| 19.6 | 54 | 0.688776 | 25 | 196 | 5.32 | 0.64 | 0.135338 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163265 | 196 | 9 | 55 | 21.777778 | 0.810976 | 0 | 0 | 0 | 0 | 0 | 0.087179 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0.166667 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
eb7408e8d6bb7e11a0ee3de1ae43992980027ff8 | 1,341 | py | Python | src/handler.py | JD297/pushm | 353118c448b1054249a0b618a2806d66bcf8c03e | [
"BSD-2-Clause"
] | 3 | 2021-09-06T11:21:43.000Z | 2021-09-07T18:52:08.000Z | src/handler.py | JD297/pushm | 353118c448b1054249a0b618a2806d66bcf8c03e | [
"BSD-2-Clause"
] | 11 | 2021-09-10T20:18:14.000Z | 2021-09-29T11:39:43.000Z | src/handler.py | JD297/pushm | 353118c448b1054249a0b618a2806d66bcf8c03e | [
"BSD-2-Clause"
] | null | null | null | import json
import os
from aes import encrypt
from aes import decrypt
homedir = os.path.expanduser("~")
basedir = os.path.join(homedir, ".pushm")
def check_basedir():
return os.path.isdir(basedir)
def create_basedir():
os.mkdir(basedir, mode=0o700)
def check_session(session_file):
return os.path.isfile(session_file)
def create_session(session_file, password, data):
encrypt(session_file, password, data)
def get_json_session(session_file, password):
data = decrypt(session_file, password)
return json.loads(data)
def print_session(session_file, password):
sdata = get_json_session(session_file, password)
print(json.dumps(sdata, indent=4))
def handle_repo(name, password):
session_file = os.path.join(basedir, name + ".session")
if not check_basedir():
create_basedir()
if not check_session(session_file):
create_session(session_file, password, "{}")
else:
print_session(session_file, password)
def handle_select(name, password, key):
session_file = os.path.join(basedir, name + ".session")
sdata = get_json_session(session_file, password)
print(sdata[key])
def handle_insert(name, password, key, data):
session_file = os.path.join(basedir, name + ".session")
sdata = get_json_session(session_file, password)
sdata[key] = data
create_session(session_file, password, json.dumps(sdata, indent=4))
| 23.526316 | 68 | 0.759881 | 191 | 1,341 | 5.13089 | 0.219895 | 0.190816 | 0.202041 | 0.238776 | 0.496939 | 0.279592 | 0.245918 | 0.245918 | 0.157143 | 0.157143 | 0 | 0.005076 | 0.118568 | 1,341 | 56 | 69 | 23.946429 | 0.824027 | 0 | 0 | 0.162162 | 0 | 0 | 0.024609 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.243243 | false | 0.378378 | 0.108108 | 0.054054 | 0.432432 | 0.108108 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
eb8dc6eb0213a99616636f4dfc013746abbacf13 | 100 | py | Python | arbiter/backends/cape.py | polyswarm/arbiter-cuckoo | 695e2c021b3e86cd11717f02b7992345585b2486 | [
"MIT"
] | null | null | null | arbiter/backends/cape.py | polyswarm/arbiter-cuckoo | 695e2c021b3e86cd11717f02b7992345585b2486 | [
"MIT"
] | 3 | 2018-08-17T00:42:13.000Z | 2019-04-01T16:20:04.000Z | arbiter/backends/cape.py | polyswarm/arbiter-cuckoo | 695e2c021b3e86cd11717f02b7992345585b2486 | [
"MIT"
] | 2 | 2018-12-31T12:07:51.000Z | 2021-04-26T10:55:00.000Z | # Copyright (C) 2018 Hatching B.V.
# This file is licensed under the MIT License, see also LICENSE.
| 33.333333 | 64 | 0.74 | 17 | 100 | 4.352941 | 0.941176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04878 | 0.18 | 100 | 2 | 65 | 50 | 0.853659 | 0.95 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
eba242d57230c60efbb9cc47008b6344a1c912bf | 133 | py | Python | src/ebonite/ext/flask/uwsgi.py | koskotG/ebonite | 9f9ae016b70fb24865d5edc99142afb8ab4ddc59 | [
"Apache-2.0"
] | 270 | 2019-11-14T15:46:08.000Z | 2021-09-17T16:43:03.000Z | src/ebonite/ext/flask/build/app.py | leepand/ebonite | b01b662c43709d152940f488574d78ff25f89ecf | [
"Apache-2.0"
] | 14 | 2019-11-29T11:49:39.000Z | 2022-02-10T00:23:59.000Z | src/ebonite/ext/flask/build/app.py | leepand/ebonite | b01b662c43709d152940f488574d78ff25f89ecf | [
"Apache-2.0"
] | 18 | 2019-11-22T13:15:14.000Z | 2021-09-01T13:36:12.000Z | from ebonite import start_runtime
from ebonite.ext.flask import server
start_runtime()
app = server.current_app
__all__ = ['app']
| 14.777778 | 36 | 0.781955 | 19 | 133 | 5.105263 | 0.578947 | 0.226804 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135338 | 133 | 8 | 37 | 16.625 | 0.843478 | 0 | 0 | 0 | 0 | 0 | 0.022556 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
ebc0d5d6711efc8155f9a0c44a5f0e2f0096a699 | 22,829 | py | Python | tests/test_logs/test_logs.py | brady-gsa/moto | 48e727f50cae286ed84d3aacec3c347cd68c319e | [
"Apache-2.0"
] | null | null | null | tests/test_logs/test_logs.py | brady-gsa/moto | 48e727f50cae286ed84d3aacec3c347cd68c319e | [
"Apache-2.0"
] | null | null | null | tests/test_logs/test_logs.py | brady-gsa/moto | 48e727f50cae286ed84d3aacec3c347cd68c319e | [
"Apache-2.0"
] | 1 | 2021-09-10T14:00:17.000Z | 2021-09-10T14:00:17.000Z | import json
import boto3
import os
import sure # noqa
import six
from botocore.exceptions import ClientError
from moto import mock_logs, settings
from nose.tools import assert_raises
from nose import SkipTest
_logs_region = "us-east-1" if settings.TEST_SERVER_MODE else "us-west-2"
@mock_logs
def test_describe_metric_filters_happy():
conn = boto3.client("logs", "us-west-2")
response = put_metric_filter(conn)
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
response = conn.describe_metric_filters(filterNamePrefix="filter")
assert response["metricFilters"][0]["filterName"] == "filterName1"
@mock_logs
def test_describe_metric_filters_happy_metric_name():
conn = boto3.client("logs", "us-west-2")
response = put_metric_filter(conn)
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
response = conn.describe_metric_filters(
filterNamePrefix="filter",
metricName="metricName1",
metricNamespace="metricNamespace1",
)
assert response["metricFilters"][0]["filterName"] == "filterName1"
@mock_logs
def test_put_metric_filters_validation():
conn = boto3.client("logs", "us-west-2")
invalid_filter_name = "X" * 513
invalid_filter_pattern = "X" * 1025
invalid_metric_transformations = [
{
"defaultValue": 1,
"metricName": "metricName",
"metricNamespace": "metricNamespace",
"metricValue": "metricValue",
},
{
"defaultValue": 1,
"metricName": "metricName",
"metricNamespace": "metricNamespace",
"metricValue": "metricValue",
},
]
test_cases = [
build_put_case(
name="Invalid filter name",
expected=AssertionError,
filter_name=invalid_filter_name,
),
build_put_case(
name="Invalid filter pattern",
expected=AssertionError,
filter_pattern=invalid_filter_pattern,
),
build_put_case(
name="Invalid filter metric transformations",
expected=AssertionError,
metric_transformations=invalid_metric_transformations,
),
]
for test_case in test_cases:
inputs = test_case["input"]
conn.put_metric_filter.when.called_with(
filterName=inputs["filterName"],
filterPattern=inputs["filterPattern"],
logGroupName=inputs["logGroupName"],
metricTransformations=inputs["metricTransformations"],
).should.throw(test_case["expected"])
@mock_logs
def test_describe_metric_filters_validation():
conn = boto3.client("logs", "us-west-2")
length_over_512 = "X" * 513
length_over_255 = "X" * 256
test_cases = [
build_describe_case(
name="Invalid filter name prefix",
expected=AssertionError,
filter_name_prefix=length_over_512,
),
build_describe_case(
name="Invalid log group name",
expected=AssertionError,
log_group_name=length_over_512,
),
build_describe_case(
name="Invalid metric name",
expected=AssertionError,
metric_name=length_over_255,
),
build_describe_case(
name="Invalid metric namespace",
expected=AssertionError,
metric_namespace=length_over_255,
),
]
for test_case in test_cases:
conn.describe_metric_filter.when.called_with(test_case["input"]).should.throw(test_case["expected"])
@mock_logs
def test_describe_metric_filters_validation():
conn = boto3.client("logs", "us-west-2")
# conn.enable_key_rotation.when.called_with("not-a-key").should.throw(
# NotFoundException
# )
# assert response["ResponseMetadata"]["HTTPStatusCode"] != 200
response = conn.describe_metric_filters(
filterNamePrefix="filter",
metricName="metricName1",
metricNamespace="metricNamespace1",
)
# assert response["metricFilters"][0]["filterName"] == "filterName1"
@mock_logs
def test_describe_metric_filters_multiple_happy():
conn = boto3.client("logs", "us-west-2")
response = put_metric_filter(conn, 1)
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
response = put_metric_filter(conn, 2)
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
response = conn.describe_metric_filters(
filterNamePrefix="filter", logGroupName="logGroupName1"
)
assert response["metricFilters"][0]["filterName"] == "filterName1"
response = conn.describe_metric_filters(filterNamePrefix="filter")
assert response["metricFilters"][0]["filterName"] == "filterName1"
response = conn.describe_metric_filters(logGroupName="logGroupName1")
assert response["metricFilters"][0]["filterName"] == "filterName1"
@mock_logs
def test_delete_metric_filter():
conn = boto3.client("logs", "us-west-2")
response = put_metric_filter(conn, 1)
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
response = put_metric_filter(conn, 2)
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
response = conn.delete_metric_filter(
filterName="filterName", logGroupName="logGroupName1"
)
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
response = conn.describe_metric_filters(
filterNamePrefix="filter", logGroupName="logGroupName2"
)
assert response["metricFilters"][0]["filterName"] == "filterName2"
response = conn.describe_metric_filters(logGroupName="logGroupName2")
assert response["metricFilters"][0]["filterName"] == "filterName2"
def put_metric_filter(conn, count=1):
count = str(count)
return conn.put_metric_filter(
filterName="filterName" + count,
filterPattern="filterPattern" + count,
logGroupName="logGroupName" + count,
metricTransformations=[
{
"defaultValue": int(count),
"metricName": "metricName" + count,
"metricNamespace": "metricNamespace" + count,
"metricValue": "metricValue" + count,
},
],
)
def build_put_case(name, expected, filter_name="filterName", filter_pattern="filterPattern",
log_group_name="logGroupName", metric_transformations=None):
return {
"name": name,
"input":
build_put_input(filter_name, filter_pattern, log_group_name, metric_transformations),
"expected": expected
}
def build_put_input(filter_name, filter_pattern, log_group_name, metric_transformations):
if metric_transformations is None:
metric_transformations = [
{
"defaultValue": 1,
"metricName": "metricName",
"metricNamespace": "metricNamespace",
"metricValue": "metricValue",
},
]
return {
"filterName": filter_name,
"filterPattern": filter_pattern,
"logGroupName": log_group_name,
"metricTransformations": metric_transformations
}
def build_describe_input(filter_name_prefix, log_group_name, metric_name, metric_namespace):
return {
"filterNamePrefix": filter_name_prefix,
"logGroupName": log_group_name,
"metricName": metric_name,
"metricNamespace": metric_namespace
}
def build_describe_case(name, expected, filter_name_prefix="filterNamePrefix", log_group_name="logGroupName",
metric_name="metricName", metric_namespace="metricNamespace"):
return {
"name": name,
"input":
build_describe_input(filter_name_prefix, log_group_name, metric_name, metric_namespace),
"expected": expected
}
@mock_logs
def test_log_group_create():
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
response = conn.create_log_group(logGroupName=log_group_name)
response = conn.describe_log_groups(logGroupNamePrefix=log_group_name)
assert len(response["logGroups"]) == 1
# AWS defaults to Never Expire for log group retention
assert response["logGroups"][0].get("retentionInDays") == None
response = conn.delete_log_group(logGroupName=log_group_name)
@mock_logs
def test_exceptions():
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
log_stream_name = "dummp-stream"
conn.create_log_group(logGroupName=log_group_name)
with assert_raises(ClientError):
conn.create_log_group(logGroupName=log_group_name)
# descrine_log_groups is not implemented yet
conn.create_log_stream(logGroupName=log_group_name, logStreamName=log_stream_name)
with assert_raises(ClientError):
conn.create_log_stream(
logGroupName=log_group_name, logStreamName=log_stream_name
)
conn.put_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
logEvents=[{"timestamp": 0, "message": "line"}],
)
with assert_raises(ClientError):
conn.put_log_events(
logGroupName=log_group_name,
logStreamName="invalid-stream",
logEvents=[{"timestamp": 0, "message": "line"}],
)
@mock_logs
def test_put_logs():
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
log_stream_name = "stream"
conn.create_log_group(logGroupName=log_group_name)
conn.create_log_stream(logGroupName=log_group_name, logStreamName=log_stream_name)
messages = [
{"timestamp": 0, "message": "hello"},
{"timestamp": 0, "message": "world"},
]
putRes = conn.put_log_events(
logGroupName=log_group_name, logStreamName=log_stream_name, logEvents=messages
)
res = conn.get_log_events(
logGroupName=log_group_name, logStreamName=log_stream_name
)
events = res["events"]
nextSequenceToken = putRes["nextSequenceToken"]
assert isinstance(nextSequenceToken, six.string_types) == True
assert len(nextSequenceToken) == 56
events.should.have.length_of(2)
@mock_logs
def test_filter_logs_interleaved():
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
log_stream_name = "stream"
conn.create_log_group(logGroupName=log_group_name)
conn.create_log_stream(logGroupName=log_group_name, logStreamName=log_stream_name)
messages = [
{"timestamp": 0, "message": "hello"},
{"timestamp": 0, "message": "world"},
]
conn.put_log_events(
logGroupName=log_group_name, logStreamName=log_stream_name, logEvents=messages
)
res = conn.filter_log_events(
logGroupName=log_group_name, logStreamNames=[log_stream_name], interleaved=True
)
events = res["events"]
for original_message, resulting_event in zip(messages, events):
resulting_event["eventId"].should.equal(str(resulting_event["eventId"]))
resulting_event["timestamp"].should.equal(original_message["timestamp"])
resulting_event["message"].should.equal(original_message["message"])
@mock_logs
def test_filter_logs_raises_if_filter_pattern():
if os.environ.get("TEST_SERVER_MODE", "false").lower() == "true":
raise SkipTest("Does not work in server mode due to error in Workzeug")
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
log_stream_name = "stream"
conn.create_log_group(logGroupName=log_group_name)
conn.create_log_stream(logGroupName=log_group_name, logStreamName=log_stream_name)
messages = [
{"timestamp": 0, "message": "hello"},
{"timestamp": 0, "message": "world"},
]
conn.put_log_events(
logGroupName=log_group_name, logStreamName=log_stream_name, logEvents=messages
)
with assert_raises(NotImplementedError):
conn.filter_log_events(
logGroupName=log_group_name,
logStreamNames=[log_stream_name],
filterPattern='{$.message = "hello"}',
)
@mock_logs
def test_put_retention_policy():
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
response = conn.create_log_group(logGroupName=log_group_name)
response = conn.put_retention_policy(logGroupName=log_group_name, retentionInDays=7)
response = conn.describe_log_groups(logGroupNamePrefix=log_group_name)
assert len(response["logGroups"]) == 1
assert response["logGroups"][0].get("retentionInDays") == 7
response = conn.delete_log_group(logGroupName=log_group_name)
@mock_logs
def test_delete_retention_policy():
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
response = conn.create_log_group(logGroupName=log_group_name)
response = conn.put_retention_policy(logGroupName=log_group_name, retentionInDays=7)
response = conn.describe_log_groups(logGroupNamePrefix=log_group_name)
assert len(response["logGroups"]) == 1
assert response["logGroups"][0].get("retentionInDays") == 7
response = conn.delete_retention_policy(logGroupName=log_group_name)
response = conn.describe_log_groups(logGroupNamePrefix=log_group_name)
assert len(response["logGroups"]) == 1
assert response["logGroups"][0].get("retentionInDays") == None
response = conn.delete_log_group(logGroupName=log_group_name)
@mock_logs
def test_get_log_events():
client = boto3.client("logs", "us-west-2")
log_group_name = "test"
log_stream_name = "stream"
client.create_log_group(logGroupName=log_group_name)
client.create_log_stream(logGroupName=log_group_name, logStreamName=log_stream_name)
events = [{"timestamp": x, "message": str(x)} for x in range(20)]
client.put_log_events(
logGroupName=log_group_name, logStreamName=log_stream_name, logEvents=events
)
resp = client.get_log_events(
logGroupName=log_group_name, logStreamName=log_stream_name, limit=10
)
resp["events"].should.have.length_of(10)
for i in range(10):
resp["events"][i]["timestamp"].should.equal(i + 10)
resp["events"][i]["message"].should.equal(str(i + 10))
resp["nextForwardToken"].should.equal(
"f/00000000000000000000000000000000000000000000000000000019"
)
resp["nextBackwardToken"].should.equal(
"b/00000000000000000000000000000000000000000000000000000010"
)
resp = client.get_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
nextToken=resp["nextBackwardToken"],
limit=20,
)
resp["events"].should.have.length_of(10)
for i in range(10):
resp["events"][i]["timestamp"].should.equal(i)
resp["events"][i]["message"].should.equal(str(i))
resp["nextForwardToken"].should.equal(
"f/00000000000000000000000000000000000000000000000000000009"
)
resp["nextBackwardToken"].should.equal(
"b/00000000000000000000000000000000000000000000000000000000"
)
resp = client.get_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
nextToken=resp["nextBackwardToken"],
limit=10,
)
resp["events"].should.have.length_of(0)
resp["nextForwardToken"].should.equal(
"f/00000000000000000000000000000000000000000000000000000000"
)
resp["nextBackwardToken"].should.equal(
"b/00000000000000000000000000000000000000000000000000000000"
)
resp = client.get_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
nextToken=resp["nextForwardToken"],
limit=1,
)
resp["events"].should.have.length_of(1)
resp["events"][0]["timestamp"].should.equal(1)
resp["events"][0]["message"].should.equal(str(1))
resp["nextForwardToken"].should.equal(
"f/00000000000000000000000000000000000000000000000000000001"
)
resp["nextBackwardToken"].should.equal(
"b/00000000000000000000000000000000000000000000000000000001"
)
@mock_logs
def test_get_log_events_with_start_from_head():
client = boto3.client("logs", "us-west-2")
log_group_name = "test"
log_stream_name = "stream"
client.create_log_group(logGroupName=log_group_name)
client.create_log_stream(logGroupName=log_group_name, logStreamName=log_stream_name)
events = [{"timestamp": x, "message": str(x)} for x in range(20)]
client.put_log_events(
logGroupName=log_group_name, logStreamName=log_stream_name, logEvents=events
)
resp = client.get_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
limit=10,
startFromHead=True, # this parameter is only relevant without the usage of nextToken
)
resp["events"].should.have.length_of(10)
for i in range(10):
resp["events"][i]["timestamp"].should.equal(i)
resp["events"][i]["message"].should.equal(str(i))
resp["nextForwardToken"].should.equal(
"f/00000000000000000000000000000000000000000000000000000009"
)
resp["nextBackwardToken"].should.equal(
"b/00000000000000000000000000000000000000000000000000000000"
)
resp = client.get_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
nextToken=resp["nextForwardToken"],
limit=20,
)
resp["events"].should.have.length_of(10)
for i in range(10):
resp["events"][i]["timestamp"].should.equal(i + 10)
resp["events"][i]["message"].should.equal(str(i + 10))
resp["nextForwardToken"].should.equal(
"f/00000000000000000000000000000000000000000000000000000019"
)
resp["nextBackwardToken"].should.equal(
"b/00000000000000000000000000000000000000000000000000000010"
)
resp = client.get_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
nextToken=resp["nextForwardToken"],
limit=10,
)
resp["events"].should.have.length_of(0)
resp["nextForwardToken"].should.equal(
"f/00000000000000000000000000000000000000000000000000000019"
)
resp["nextBackwardToken"].should.equal(
"b/00000000000000000000000000000000000000000000000000000019"
)
resp = client.get_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
nextToken=resp["nextBackwardToken"],
limit=1,
)
resp["events"].should.have.length_of(1)
resp["events"][0]["timestamp"].should.equal(18)
resp["events"][0]["message"].should.equal(str(18))
resp["nextForwardToken"].should.equal(
"f/00000000000000000000000000000000000000000000000000000018"
)
resp["nextBackwardToken"].should.equal(
"b/00000000000000000000000000000000000000000000000000000018"
)
@mock_logs
def test_get_log_events_errors():
client = boto3.client("logs", "us-west-2")
log_group_name = "test"
log_stream_name = "stream"
client.create_log_group(logGroupName=log_group_name)
client.create_log_stream(logGroupName=log_group_name, logStreamName=log_stream_name)
with assert_raises(ClientError) as e:
client.get_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
nextToken="n/00000000000000000000000000000000000000000000000000000000",
)
ex = e.exception
ex.operation_name.should.equal("GetLogEvents")
ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.response["Error"]["Code"].should.equal("InvalidParameterException")
ex.response["Error"]["Message"].should.contain(
"The specified nextToken is invalid."
)
with assert_raises(ClientError) as e:
client.get_log_events(
logGroupName=log_group_name,
logStreamName=log_stream_name,
nextToken="not-existing-token",
)
ex = e.exception
ex.operation_name.should.equal("GetLogEvents")
ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.response["Error"]["Code"].should.equal("InvalidParameterException")
ex.response["Error"]["Message"].should.contain(
"The specified nextToken is invalid."
)
@mock_logs
def test_list_tags_log_group():
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
tags = {"tag_key_1": "tag_value_1", "tag_key_2": "tag_value_2"}
response = conn.create_log_group(logGroupName=log_group_name)
response = conn.list_tags_log_group(logGroupName=log_group_name)
assert response["tags"] == {}
response = conn.delete_log_group(logGroupName=log_group_name)
response = conn.create_log_group(logGroupName=log_group_name, tags=tags)
response = conn.list_tags_log_group(logGroupName=log_group_name)
assert response["tags"] == tags
response = conn.delete_log_group(logGroupName=log_group_name)
@mock_logs
def test_tag_log_group():
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
tags = {"tag_key_1": "tag_value_1"}
response = conn.create_log_group(logGroupName=log_group_name)
response = conn.tag_log_group(logGroupName=log_group_name, tags=tags)
response = conn.list_tags_log_group(logGroupName=log_group_name)
assert response["tags"] == tags
tags_with_added_value = {"tag_key_1": "tag_value_1", "tag_key_2": "tag_value_2"}
response = conn.tag_log_group(
logGroupName=log_group_name, tags={"tag_key_2": "tag_value_2"}
)
response = conn.list_tags_log_group(logGroupName=log_group_name)
assert response["tags"] == tags_with_added_value
tags_with_updated_value = {"tag_key_1": "tag_value_XX", "tag_key_2": "tag_value_2"}
response = conn.tag_log_group(
logGroupName=log_group_name, tags={"tag_key_1": "tag_value_XX"}
)
response = conn.list_tags_log_group(logGroupName=log_group_name)
assert response["tags"] == tags_with_updated_value
response = conn.delete_log_group(logGroupName=log_group_name)
@mock_logs
def test_untag_log_group():
conn = boto3.client("logs", "us-west-2")
log_group_name = "dummy"
response = conn.create_log_group(logGroupName=log_group_name)
tags = {"tag_key_1": "tag_value_1", "tag_key_2": "tag_value_2"}
response = conn.tag_log_group(logGroupName=log_group_name, tags=tags)
response = conn.list_tags_log_group(logGroupName=log_group_name)
assert response["tags"] == tags
tags_to_remove = ["tag_key_1"]
remaining_tags = {"tag_key_2": "tag_value_2"}
response = conn.untag_log_group(logGroupName=log_group_name, tags=tags_to_remove)
response = conn.list_tags_log_group(logGroupName=log_group_name)
assert response["tags"] == remaining_tags
response = conn.delete_log_group(logGroupName=log_group_name)
| 34.073134 | 109 | 0.688861 | 2,510 | 22,829 | 5.972908 | 0.086454 | 0.069904 | 0.073639 | 0.107257 | 0.792689 | 0.754602 | 0.734725 | 0.726054 | 0.693303 | 0.683364 | 0 | 0.06482 | 0.195147 | 22,829 | 669 | 110 | 34.124066 | 0.751116 | 0.016821 | 0 | 0.622222 | 0 | 0 | 0.199866 | 0.04805 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.046296 | false | 0 | 0.016667 | 0.005556 | 0.072222 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 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 | 4 |
6919d70efc698d86cfc8086f842cc52ab9801dce | 1,800 | py | Python | books/use_cases/repositories.py | OurBooks-Team-Yuml/Books | 58abbbcd761f4ec359c6ab62a36ee77da6348e43 | [
"MIT"
] | null | null | null | books/use_cases/repositories.py | OurBooks-Team-Yuml/Books | 58abbbcd761f4ec359c6ab62a36ee77da6348e43 | [
"MIT"
] | 45 | 2019-12-16T11:10:27.000Z | 2020-05-18T07:15:15.000Z | books/use_cases/repositories.py | OurBooks-Team-Yuml/Books | 58abbbcd761f4ec359c6ab62a36ee77da6348e43 | [
"MIT"
] | null | null | null | from typing import Iterator, Optional
from books.database import Author as AuthorDB, Book as BookDB
from books.entities import Author, Book, Category
class BaseAuthorRepository(object):
def get_authors(self) -> Iterator[Author]:
raise NotImplementedError
def get_author(self, id: int) -> Optional[Author]:
raise NotImplementedError
def create(self, data: dict) -> Author:
raise NotImplementedError
def update(self, id: int, data: dict) -> Author:
raise NotImplementedError
class BaseBookRepository(object):
def get_books(self) -> Iterator[Book]:
raise NotImplementedError
def get_book(self, id: int) -> Optional[Book]:
raise NotImplementedError
def create(self, data: dict) -> Book:
raise NotImplementedError
def update(self, id: int, data: dict) -> Book:
raise NotImplementedError
class BaseS3Repository(object):
def save_author_image(self, image: bytes, key: str) -> str:
raise NotImplementedError
def save_book_image(self, image: bytes, key: str) -> str:
raise NotImplementedError
class BaseCategoryRepository(object):
def get_categories(self) -> Iterator[Category]:
raise NotImplementedError
def get_by_name(self, name: str) -> Optional[Category]:
raise NotImplementedError
def get_by_id(self, id: int) -> Optional[Category]:
raise NotImplementedError
def add(self, data: dict) -> Category:
raise NotImplementedError
def update(self, id: int, data: dict) -> Category:
raise NotImplementedError
class BaseElasticRepository(object):
def add_book(self, book: Book) -> None:
raise NotImplementedError
def add_author(self, author: Author) -> None:
raise NotImplementedError
| 27.272727 | 63 | 0.691667 | 199 | 1,800 | 6.180905 | 0.21608 | 0.331707 | 0.263415 | 0.097561 | 0.480488 | 0.344715 | 0.279675 | 0.206504 | 0.206504 | 0 | 0 | 0.000713 | 0.220556 | 1,800 | 65 | 64 | 27.692308 | 0.87598 | 0 | 0 | 0.404762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.404762 | false | 0 | 0.071429 | 0 | 0.595238 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
694242ddc35cc56855fb9cef419c99c6d519e1ee | 5,162 | py | Python | src/examples/drawingNetworks.py | jamesn1197/YAFS | 2576b63e775574130f3a30e8799eb84c62313fc1 | [
"MIT"
] | 1 | 2021-03-04T21:51:43.000Z | 2021-03-04T21:51:43.000Z | src/examples/drawingNetworks.py | jamesn1197/YAFS | 2576b63e775574130f3a30e8799eb84c62313fc1 | [
"MIT"
] | null | null | null | src/examples/drawingNetworks.py | jamesn1197/YAFS | 2576b63e775574130f3a30e8799eb84c62313fc1 | [
"MIT"
] | 2 | 2020-10-16T07:53:40.000Z | 2022-01-25T07:00:58.000Z | """
This application create a graphml with some information from Dynamic* algorithms to draw the network in GEPHI.
"""
import networkx as nx
import itertools
import numpy as np
G = nx.read_graphml("Euclidean.graphml")
G = nx.convert_node_labels_to_integers(G, first_label=0, ordering='default', label_attribute=None)
centrality = nx.betweenness_centrality(G)
nx.set_node_attributes(G, name="centrality", values=centrality)
# This data is obtained by three Dynamic* algorithms
# Failures on Nodes
failures_exp=[{'id': 398, 'module': False, 'time': 500}, {'id': 343, 'module': False, 'time': 694}, {'id': 48, 'module': False, 'time': 1070}, {'id': 133, 'module': True, 'time': 1072}, {'id': 288, 'module': False, 'time': 1136}, {'id': 283, 'module': False, 'time': 1323}, {'id': 374, 'module': False, 'time': 1451}, {'id': 168, 'module': False, 'time': 1471}, {'id': 331, 'module': False, 'time': 1493}, {'id': 265, 'module': False, 'time': 1691}, {'id': 119, 'module': False, 'time': 1694}, {'id': 233, 'module': False, 'time': 1722}, {'id': 353, 'module': False, 'time': 1837}, {'id': 337, 'module': True, 'time': 1838}, {'id': 199, 'module': False, 'time': 1858}, {'id': 232, 'module': False, 'time': 2393}, {'id': 13, 'module': False, 'time': 2419}, {'id': 95, 'module': False, 'time': 2723}, {'id': 317, 'module': False, 'time': 2814}, {'id': 163, 'module': False, 'time': 2919}, {'id': 67, 'module': False, 'time': 3012}, {'id': 279, 'module': True, 'time': 3077}, {'id': 267, 'module': False, 'time': 3112}, {'id': 147, 'module': False, 'time': 3296}, {'id': 174, 'module': False, 'time': 3353}, {'id': 202, 'module': False, 'time': 3489}, {'id': 310, 'module': False, 'time': 3579}, {'id': 206, 'module': False, 'time': 3647}, {'id': 153, 'module': False, 'time': 3752}, {'id': 193, 'module': False, 'time': 3804}, {'id': 17, 'module': False, 'time': 3825}, {'id': 281, 'module': False, 'time': 3928}, {'id': 393, 'module': False, 'time': 4107}, {'id': 236, 'module': False, 'time': 4173}, {'id': 65, 'module': True, 'time': 4372}, {'id': 197, 'module': False, 'time': 4642}, {'id': 392, 'module': False, 'time': 4737}, {'id': 307, 'module': False, 'time': 4832}, {'id': 213, 'module': False, 'time': 4950}, {'id': 345, 'module': False, 'time': 5128}, {'id': 201, 'module': False, 'time': 5312}, {'id': 380, 'module': False, 'time': 5323}, {'id': 227, 'module': False, 'time': 5366}, {'id': 177, 'module': False, 'time': 5413}, {'id': 216, 'module': True, 'time': 5740}, {'id': 382, 'module': False, 'time': 5789}, {'id': 2, 'module': False, 'time': 5840}, {'id': 312, 'module': False, 'time': 6326}, {'id': 326, 'module': False, 'time': 6338}, {'id': 354, 'module': False, 'time': 6344}, {'id': 292, 'module': False, 'time': 6395}, {'id': 321, 'module': False, 'time': 6529}, {'id': 218, 'module': False, 'time': 6539}, {'id': 159, 'module': False, 'time': 6566}, {'id': 22, 'module': False, 'time': 6830}, {'id': 348, 'module': False, 'time': 6847}, {'id': 222, 'module': False, 'time': 6999}, {'id': 75, 'module': False, 'time': 7053}, {'id': 191, 'module': False, 'time': 7315}, {'id': 183, 'module': False, 'time': 7370}, {'id': 131, 'module': False, 'time': 7440}, {'id': 127, 'module': False, 'time': 7466}, {'id': 210, 'module': False, 'time': 7584}, {'id': 247, 'module': False, 'time': 7706}, {'id': 243, 'module': False, 'time': 7748}, {'id': 171, 'module': False, 'time': 8281}, {'id': 84, 'module': False, 'time': 8343}, {'id': 64, 'module': False, 'time': 8366}, {'id': 231, 'module': False, 'time': 8389}, {'id': 344, 'module': False, 'time': 8447}, {'id': 318, 'module': False, 'time': 8616}, {'id': 325, 'module': False, 'time': 8970}, {'id': 264, 'module': False, 'time': 9031}, {'id': 31, 'module': False, 'time': 9125}, {'id': 6, 'module': False, 'time': 9424}, {'id': 5, 'module': False, 'time': 9526}, {'id': 299, 'module': True, 'time': 9572}, {'id': 42, 'module': False, 'time': 9701}, {'id': 248, 'module': False, 'time': 9867}, {'id': 126, 'module': False, 'time': 9891}, {'id': 28, 'module': False, 'time': 9916}, {'id': 61, 'module': True, 'time': 9928}]
# Nodes with sensor app
src = [53, 339, 306, 102, 198, 180, 261, 316, 37, 11, 335, 173, 305, 0, 178, 289, 91, 379, 361, 12, 10, 217, 376, 152, 86, 169, 11, 88, 175, 198, 93, 92, 87, 184, 116, 8, 335, 223, 257, 74]
# Nodes with sensor app (Dynamic Workload)
finalSRC = [337, 110, 21, 230, 230, 110, 21, 238, 230, 70, 21, 21, 70, 110, 21, 21, 279, 230, 21, 21, 21, 21, 21, 110, 110, 230, 70, 110, 110, 230, 238, 238, 337, 238, 230, 279, 21, 21, 238, 230]
valuesOne = dict(itertools.izip(G.nodes(), np.zeros(len(G.nodes())).tolist()))
valuesSRC = dict(itertools.izip(G.nodes(), np.zeros(len(G.nodes())).tolist()))
valuesFIN = dict(itertools.izip(G.nodes(), np.zeros(len(G.nodes())).tolist()))
for item in failures_exp:
valuesOne[item["id"]]=1.0
for item in src:
valuesSRC[item]=1.0
for item in finalSRC:
valuesFIN[item]=1.0
nx.set_node_attributes(G, name='removed', values=valuesOne)
nx.set_node_attributes(G, name='src', values=valuesSRC)
nx.set_node_attributes(G, name='srcMove', values=valuesFIN)
nx.write_graphml(G, "Euclidean-removed.graphml")
| 112.217391 | 3,592 | 0.591631 | 756 | 5,162 | 4.01455 | 0.373016 | 0.271829 | 0.370675 | 0.025041 | 0.083361 | 0.076112 | 0.044481 | 0.044481 | 0.044481 | 0.044481 | 0 | 0.172058 | 0.137544 | 5,162 | 45 | 3,593 | 114.711111 | 0.509659 | 0.047075 | 0 | 0 | 0 | 0 | 0.216426 | 0.005095 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.130435 | 0 | 0.130435 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
15cea81dc2a96fe7dbb2f5566dbb8a367872dba5 | 382 | py | Python | protonfixes/gamefixes/221380.py | Sirmentio/protonfixes | 1ca6452ed1a9910ed0afc8c544ce90dfc699a678 | [
"BSD-2-Clause"
] | 1 | 2018-12-29T03:38:20.000Z | 2018-12-29T03:38:20.000Z | protonfixes/gamefixes/221380.py | Sirmentio/protonfixes | 1ca6452ed1a9910ed0afc8c544ce90dfc699a678 | [
"BSD-2-Clause"
] | null | null | null | protonfixes/gamefixes/221380.py | Sirmentio/protonfixes | 1ca6452ed1a9910ed0afc8c544ce90dfc699a678 | [
"BSD-2-Clause"
] | null | null | null | """ Game fix for Age of Empires 2 HD Edition
Source: https://github.com/JamesHealdUK/protonfixes/blob/master/fixes/221380.sh
"""
#pylint: disable=C0103
from protonfixes import util
def main():
""" Changes the proton argument from the launcher to the game
"""
# Replace launcher with game exe in proton arguments
util.replace_command('Launcher.exe', 'AoK HD.exe')
| 27.285714 | 79 | 0.725131 | 55 | 382 | 5.018182 | 0.745455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034591 | 0.167539 | 382 | 13 | 80 | 29.384615 | 0.833333 | 0.670157 | 0 | 0 | 0 | 0 | 0.198198 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | true | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
15d8948716bdd290628c5213949cb0d54521c1dc | 261 | py | Python | src/phonebook/mixins.py | lgandersen/bornhack-website | fbda2b4b53dc2cb266d1d7c13ba0aad59d9079df | [
"BSD-3-Clause"
] | 7 | 2017-04-14T15:28:29.000Z | 2021-09-10T09:45:38.000Z | src/phonebook/mixins.py | lgandersen/bornhack-website | fbda2b4b53dc2cb266d1d7c13ba0aad59d9079df | [
"BSD-3-Clause"
] | 799 | 2016-04-28T09:31:50.000Z | 2022-03-29T09:05:02.000Z | src/phonebook/mixins.py | lgandersen/bornhack-website | fbda2b4b53dc2cb266d1d7c13ba0aad59d9079df | [
"BSD-3-Clause"
] | 35 | 2016-04-28T09:23:53.000Z | 2021-05-02T12:36:01.000Z | from camps.mixins import CampViewMixin
# from .models import DectRegistration
class DectRegistrationViewMixin(CampViewMixin):
def get_object(self, *args, **kwargs):
return self.model.objects.get(camp=self.camp, number=self.kwargs["dect_number"])
| 29 | 88 | 0.766284 | 31 | 261 | 6.387097 | 0.677419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126437 | 261 | 8 | 89 | 32.625 | 0.868421 | 0.137931 | 0 | 0 | 0 | 0 | 0.049327 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
15d9d9c7f09e30c28102b0fef1677506d8bfd2ec | 179 | py | Python | src/hangman/error.py | opus49/hangman | 6831ab14938cafa78ec7112c4f23a452f85fd2a0 | [
"MIT"
] | null | null | null | src/hangman/error.py | opus49/hangman | 6831ab14938cafa78ec7112c4f23a452f85fd2a0 | [
"MIT"
] | null | null | null | src/hangman/error.py | opus49/hangman | 6831ab14938cafa78ec7112c4f23a452f85fd2a0 | [
"MIT"
] | 1 | 2020-04-10T12:49:30.000Z | 2020-04-10T12:49:30.000Z | """Custom exceptions for hangman"""
class Error(Exception):
"""Base class for Hangman exceptions"""
class GuessError(Error):
"""Exception raised for an invalid guess"""
| 22.375 | 47 | 0.703911 | 21 | 179 | 6 | 0.619048 | 0.15873 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162011 | 179 | 7 | 48 | 25.571429 | 0.84 | 0.564246 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
15fdb86def3f334aeaa377f1d50687d9e0f0c2dc | 233 | py | Python | python/grains/grains.py | ropable/exercism | 9dde2a7952badec03428b5f9dfb8499a7ce55458 | [
"MIT"
] | null | null | null | python/grains/grains.py | ropable/exercism | 9dde2a7952badec03428b5f9dfb8499a7ce55458 | [
"MIT"
] | null | null | null | python/grains/grains.py | ropable/exercism | 9dde2a7952badec03428b5f9dfb8499a7ce55458 | [
"MIT"
] | null | null | null | def square(number: int) -> int:
if number < 1 or number > 64:
raise ValueError("Input number is outside allowed range")
return 2 ** (number - 1)
def total() -> int:
return sum([square(i) for i in range(1, 65)])
| 25.888889 | 65 | 0.609442 | 36 | 233 | 3.944444 | 0.638889 | 0.098592 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045977 | 0.253219 | 233 | 8 | 66 | 29.125 | 0.770115 | 0 | 0 | 0 | 0 | 0 | 0.158798 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.166667 | 0.666667 | 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 | 1 | 1 | 0 | 0 | 4 |
c62fe78566062b07c7e01073887a9561cc1cb5c9 | 58,521 | py | Python | docker/opt/composer/create_music.py | jphacks/D_2105 | b7a5c972d1d4cc3322227cf2cbb8fd03fe2033f5 | [
"MIT"
] | 1 | 2021-10-29T23:18:39.000Z | 2021-10-29T23:18:39.000Z | docker/opt/composer/create_music.py | jphacks/D_2105 | b7a5c972d1d4cc3322227cf2cbb8fd03fe2033f5 | [
"MIT"
] | 4 | 2021-10-29T18:45:05.000Z | 2021-10-30T09:50:00.000Z | docker/opt/composer/create_music.py | jphacks/D_2105 | b7a5c972d1d4cc3322227cf2cbb8fd03fe2033f5 | [
"MIT"
] | 1 | 2021-11-01T11:11:12.000Z | 2021-11-01T11:11:12.000Z | # LICENSE
"""
# MuseScore_General.sf2
---
Current version: 0.2 13th May 2020
This is a scaled-down version of **MuseScore_General-HQ.sf2** that replaces some of the larger instruments to save memory and CPU on older PCs. This SoundFont is currently a work-in-progress. Detailed information on presets and sample sources used can be found in "MuseScore_General_Sample_Sources.csv". All instruments without attribution are still using samples from FluidR3Mono.
FluidR3 (original version) by Frank Wen Copyright (c) 2000-02
Mono conversion (FluidR3Mono) by Michael Cowgill Copyright (c) 2014-17
Adaptation for MuseScore_General.sf2 by S. Christian Collins Copyright (c) 2018-19
Temple Blocks instrument provided by Ethan Winer Copyright (c) 2002
Drumline Cymbals provided by Michael Schorsch Copyright (c) 2016
MuseScore_General.sf2 is shared under the MIT license as described in COPYING, as was FluidR3Mono and FluidR3 before it.
ftp://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General_License.md
"""
"""
pretty_midi
Copyright (c) 2014 Colin Raffel
Released under the MIT License (MIT)
https://github.com/craffel/pretty-midi/blob/main/LICENSE.txt
"""
"""
midi2audio
Copyright (c) 2016 Bohumír Zámečník
Released under the MIT License (MIT)
https://github.com/bzamecnik/midi2audio/blob/master/LICENSE
"""
"""
mido
Copyright (c) 2013-infinity Ole Martin Bjørndalen
Released under the MIT License (MIT)
https://mido.readthedocs.io/en/latest/license.html
"""
import os
import pretty_midi as pm
from midi2audio import FluidSynth
import mido
from mido import MidiFile, MidiTrack, MetaMessage
from composer.instruments import Instruments, DrumInstruments
from composer import get_tempo, add_sound_effect, create_backing
import settings
def append_notes(notes,input_notes_list,raise_key = 0,sift_start = 0,raise_velocity = 0):
"""
引数のnotesにnotes_listの中身を追加する
Parameters
----------
notes : pretty_midi.Instrument.notes
pretty_midi.Noteインスタンスを格納するリスト
input_notes_list : list[tuple(velocity, pitch, start, end)]
Noteインスタンス作成に使うパラメータ
"""
for i in input_notes_list:
velocity, code, start_time, end_time = i
velocity += raise_velocity
pitch = pm.note_name_to_number(code) + raise_key
start = start_time + sift_start
end = end_time + sift_start
note = pm.Note(velocity = velocity, pitch = pitch, start = start, end = end)
notes.append(note)
def create_default_main_melody(instruments_list, positive_param, emotion):
"""
パラメータがなかった場合の主旋律を作成
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
piano = pm.Instrument(Instruments.ACOSTIC_GRAND_PIANO)
default_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list,rhythm_denominator=3,emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = piano.notes, input_notes_list = default_melody_notes_list)
append_notes(notes = piano.notes, input_notes_list = accompaniment)
append_notes(notes = piano.notes, input_notes_list = bass)
instruments_list.append(piano)
def create_great_ocean_main_melody(instruments_list):
"""
パラメータが海で、かつ大海原に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
violin = pm.Instrument(Instruments.VIOLIN)
great_ocean_melody_notes_list = \
[
(90,'C4',2,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,18),(95,'E4',18,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
append_notes(notes = violin.notes, input_notes_list = great_ocean_melody_notes_list)
instruments_list.append(violin)
def create_summer_beach_melody(instruments_list):
"""
パラメータが海で、かつ、真夏のビーチに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
steel_drum = pm.Instrument(Instruments.STEEL_DRUMS)
summer_beach_melody_notes_list = \
[
(90,'C4',2,2.25),(90,'C4',2.25,2.5),(100,'D4',2.5,2.75),(100,'C4',3,3.25),(100,'F4',3.5,3.75),(100,'E4',4,4.25), #Happy Birthday to you
(90,'C4',6,6.25),(90,'C4',6.25,6.5),(100,'D4',6.5,6.75),(100,'C4',7,7.25),(100,'G4',7.5,7.75),(100,'F4',8,8.25), #Happy Birthday to you
(90,'C4',10,10.25),(90,'C4',10.25,10.5),(100,'C5',10.5,10.75),(100,'A4',11,11.25),(100,'F4',11.5,11.75),(100,'F4',11.75,12),(95,'E4',12,12.25),(95,'E4',12.25,12.5),(90,'D4',12.75,13), #Happy Birthday dear ??
(100,'A#4',14,14.25),(100,'A#4',14.25,14.5),(100,'A4',14.5,14.75),(100,'F4',15,15.25),(100,'G4',15.5,15.75),(100,'F4',16,16.25) #Happy Birthday to you
]
append_notes(notes = steel_drum.notes, input_notes_list = summer_beach_melody_notes_list)
instruments_list.append(steel_drum)
def create_moderate_beach_melody(instruments_list):
"""
パラメータが海で、かつ、閑散期の静かなビーチに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
vibraphone = pm.Instrument(Instruments.VIBRAPHONE)
moderate_beach_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,26) #Happy Birthday to you
]
append_notes(notes = vibraphone.notes, input_notes_list = moderate_beach_melody_notes_list)
instruments_list.append(vibraphone)
def create_aggressive_cherry_melody(instruments_list):
"""
パラメータが攻め気味の桜に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
electric_piano = pm.Instrument(Instruments.ELECTRIC_PIANO_2)
cherry_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
append_notes(notes = electric_piano.notes, input_notes_list = cherry_melody_notes_list)
instruments_list.append(electric_piano)
def create_graduate_cherry_melody(instruments_list):
flute = pm.Instrument(Instruments.FLUTE)
gradu_cherry_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',27,27.75),(100,'A#4',27.75,28),(100,'A4',28,29),(100,'F4',29,30),(100,'G4',31,32),(100,'F4',33,39) #Happy Birthday to you
]
append_notes(notes = flute.notes, input_notes_list = gradu_cherry_melody_notes_list)
instruments_list.append(flute)
def create_cat_melody(instruments_list, positive_param, emotion):
"""
パラメータが猫に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
orchestra_hit = pm.Instrument(Instruments.ORCHESTRA_HIT)
electric_guitar = pm.Instrument(Instruments.ELECTRIC_GUITAR_JAZZ)
electric_bass = pm.Instrument(Instruments.ELECTRIC_BASS_PICK)
cat_melody_notes_list = \
[
(90,'C4',2,2.25),(90,'C4',2.25,2.5),(100,'D4',2.5,2.75),(100,'C4',3,3.25),(100,'F4',3.5,3.75),(100,'E4',4,4.25), #Happy Birthday to you
(90,'C4',6,6.25),(90,'C4',6.25,6.5),(100,'D4',6.5,6.75),(100,'C4',7,7.25),(100,'G4',7.5,7.75),(100,'F4',8,8.25), #Happy Birthday to you
(90,'C4',10,10.25),(90,'C4',10.25,10.5),(100,'C5',10.5,10.75),(100,'A4',11,11.25),(100,'F4',11.5,11.75),(100,'F4',11.75,12),(95,'E4',12,12.25),(95,'E4',12.25,12.5),(90,'D4',12.75,13), #Happy Birthday dear ??
(100,'A#4',14,14.25),(100,'A#4',14.25,14.5),(100,'A4',14.5,14.75),(100,'F4',15,15.25),(100,'G4',15.5,15.75),(100,'F4',16,17) #Happy Birthday to you
]
key_note_list = [2,2.5,3,3.5,4,6,6.5,7,7.5,8,10,10.5,11,11.5,12,12.75,14,14.5,15,15.5,16]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=4, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = orchestra_hit.notes, input_notes_list = cat_melody_notes_list)
append_notes(notes = electric_guitar.notes, input_notes_list = accompaniment)
append_notes(notes = electric_bass.notes, input_notes_list = bass)
instruments_list.append(orchestra_hit)
instruments_list.append(electric_guitar)
instruments_list.append(electric_bass)
def create_dog_melody(instruments_list, positive_param, emotion):
"""
パラメータが犬に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
xylophone = pm.Instrument(Instruments.XYLOPHONE)
contrabass = pm.Instrument(Instruments.CONTRABASS)
dog_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,6.125),(100,'E4',6.125,6.25),(100,'E4',6.25,6.375),(100,'E4',6.375,6.5),(100,'E4',6.5,6.625),(100,'E4',6.625,6.75),(100,'E4',6.75,6.875),(100,'E4',6.875,7),(100,'E4',7,7.125),(100,'E4',7.125,7.25),(100,'E4',7.25,7.375),(100,'E4',7.375,7.5),(100,'E4',7.5,7.625),(100,'E4',7.625,7.75),(100,'E4',7.75,7.875),(100,'E4',7.875,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,12.125),(100,'F4',12.125,12.25),(100,'F4',12.25,12.375),(100,'F4',12.375,12.5),(100,'F4',12.5,12.625),(100,'F4',12.625,12.75),(100,'F4',12.75,12.875),(100,'F4',12.875,13),(100,'F4',13,13.125),(100,'F4',13.125,13.25),(100,'F4',13.25,13.375),(100,'F4',13.375,13.5),(100,'F4',13.5,13.625),(100,'F4',13.625,13.75),(100,'F4',13.75,13.875),(100,'F4',13.875,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,19.125),(100,'D4',19.125,19.25),(100,'D4',19.25,19.375),(100,'D4',19.375,19.5),(100,'D4',19.5,19.625),(100,'D4',19.625,19.75),(100,'D4',19.75,19.875),(100,'D4',19.875,20),(100,'D4',20,20.125),(100,'D4',20.125,20.25),(100,'D4',20.25,20.375),(100,'D4',20.375,20.5),(100,'D4',20.5,20.625),(100,'D4',20.625,20.75),(100,'D4',20.75,20.875),(100,'D4',20.875,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,25.125),(100,'F4',25.125,25.25),(100,'F4',25.25,25.375),(100,'F4',25.375,25.5),(100,'F4',25.5,25.625),(100,'F4',25.625,25.75),(100,'F4',25.75,25.875),(100,'F4',25.875,26),(100,'F4',26,26.125),(100,'F4',26.125,26.25),(100,'F4',26.25,26.375),(100,'F4',26.375,26.5),(100,'F4',26.5,26.625),(100,'F4',26.625,26.75),(100,'F4',26.75,26.875),(100,'F4',26.875,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = xylophone.notes, input_notes_list = dog_melody_notes_list, raise_key = 12)
append_notes(notes = xylophone.notes, input_notes_list = accompaniment, raise_key = 12)
append_notes(notes = contrabass.notes, input_notes_list = bass)
instruments_list.append(xylophone)
instruments_list.append(contrabass)
def create_train_melody(instruments_list):
"""
パラメータが電車に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
piano = pm.Instrument(Instruments.ACOSTIC_GRAND_PIANO)
train_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ?? 19->51で電車が通過
(100,'A#4',51,51.75),(100,'A#4',51.75,52),(100,'A4',52,53),(100,'F4',53,54),(100,'G4',54,55),(100,'F4',55,57) #Happy Birthday to you
]
append_notes(notes = piano.notes, input_notes_list = train_melody_notes_list)
instruments_list.append(piano)
def create_PC_melody(instruments_list, positive_param, emotion):
"""
パラメータがPCに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
synth_bass1 = pm.Instrument(Instruments.SYNTH_BASS_1)
synth_string = pm.Instrument(Instruments.SYNTH_STRINGS_2)
PC_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = synth_bass1.notes, input_notes_list = PC_melody_notes_list)
append_notes(notes = synth_string.notes, input_notes_list = accompaniment)
append_notes(notes = synth_bass1.notes, input_notes_list = bass)
instruments_list.append(synth_bass1)
instruments_list.append(synth_string)
def create_gourmet_melody(instruments_list):
"""
パラメータがグルメに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
piano = pm.Instrument(Instruments.ACOSTIC_GRAND_PIANO)
gourmet_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
append_notes(notes = piano.notes, input_notes_list = gourmet_melody_notes_list, raise_velocity = -10)
instruments_list.append(piano)
def create_sport_melody(instruments_list):
"""
パラメータがスポーツに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
trombone = pm.Instrument(Instruments.TROMBONE)
trumpet = pm.Instrument(Instruments.TRUMPET)
baseball_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
append_notes(notes = trombone.notes, input_notes_list = baseball_melody_notes_list, raise_key = -12)
append_notes(notes = trumpet.notes, input_notes_list = baseball_melody_notes_list)
instruments_list.append(trombone)
instruments_list.append(trumpet)
def create_soccer_melody(instruments_list, positive_param, emotion):
"""
パラメータがサッカーに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
brass_ensemble = pm.Instrument(Instruments.BRASS_SECTION)
trombone = pm.Instrument(Instruments.TROMBONE)
tuba = pm.Instrument(Instruments.TUBA)
soccer_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = brass_ensemble.notes, input_notes_list = soccer_melody_notes_list)
append_notes(notes = trombone.notes, input_notes_list = accompaniment)
append_notes(notes = tuba.notes, input_notes_list = bass)
instruments_list.append(brass_ensemble)
instruments_list.append(trombone)
instruments_list.append(tuba)
def create_baseball_melody(instruments_list, positive_param, emotion):
"""
パラメータが野球に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
trombone = pm.Instrument(Instruments.TROMBONE)
trumpet = pm.Instrument(Instruments.TRUMPET)
tuba = pm.Instrument(Instruments.TUBA)
baseball_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = trombone.notes, input_notes_list = baseball_melody_notes_list, raise_key = -12)
append_notes(notes = trumpet.notes, input_notes_list = baseball_melody_notes_list)
append_notes(notes = trumpet.notes, input_notes_list = accompaniment)
append_notes(notes = tuba.notes, input_notes_list = bass)
instruments_list.append(trombone)
instruments_list.append(trumpet)
instruments_list.append(tuba)
def create_table_tennis_melody(instruments_list):
"""
パラメータが卓球に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
piano = pm.Instrument(Instruments.ACOSTIC_GRAND_PIANO)
woodblock = pm.Instrument(Instruments.WOODBLOCK)
table_tennis_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ?? 19->27までスマッシュ
(100,'A#4',27,27.75),(100,'A#4',27.75,28),(100,'A4',28,29),(100,'F4',29,30),(100,'G4',30,31),(100,'F4',31,33) #Happy Birthday to you
]
backing_param1 = [(80,'c#4',i*2,i*2+1) for i in range(1,9)]
backing_param2 = [(80,'C4',i*2-1,i*2) for i in range(1,10)]
backing_param3 = [(80,'C#4',j*2,j*2+1) for j in range(14,16)]
backing_param4 = [(80,'C4',j*2-1,j*2) for j in range(14,17)]
append_notes(notes = piano.notes, input_notes_list = table_tennis_melody_notes_list)
append_notes(notes = woodblock.notes, input_notes_list = backing_param1)
append_notes(notes = woodblock.notes, input_notes_list = backing_param2)
append_notes(notes = woodblock.notes, input_notes_list = backing_param3)
append_notes(notes = woodblock.notes, input_notes_list = backing_param4)
instruments_list.append(piano)
instruments_list.append(woodblock)
def create_japanese_melody(instruments_list, positive_param, emotion):
"""
パラメータが和風に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
koto = pm.Instrument(Instruments.KOTO)
shamisen = pm.Instrument(Instruments.SHAMISEN)
japanese_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'G4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'A4',11,12),(100,'E4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'G4',17,17.75),(100,'G4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'D4',23,24),(100,'G4',24,25),(100,'E4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = shamisen.notes, input_notes_list = japanese_melody_notes_list, raise_velocity = 20)
append_notes(notes = koto.notes, input_notes_list = accompaniment, raise_velocity=-10)
instruments_list.append(koto)
instruments_list.append(shamisen)
def create_scandiavian_melody(instruments_list):
"""
パラメータが南国に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
fiddle = pm.Instrument(Instruments.FIDDLE)
scandinavian_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',6,7),(100,'E4',7,10), #Happy Birthday to you
(90,'C4',10,10.75),(90,'C4',10.75,11),(100,'D4',11,12),(100,'C4',12,13),(100,'G4',14,15),(100,'F4',15,18), #Happy Birthday to you
(90,'C4',18,18.75),(90,'C4',18.75,19),(100,'C5',19,20),(100,'A4',20,21),(100,'F4',22,22.75),(100,'F4',22.75,23),(95,'E4',23,23.75),(95,'E4',23.75,24),(90,'D4',24,26), #Happy Birthday dear ??
(100,'A#4',26,26.75),(100,'A#4',26.75,27),(100,'A4',27,28),(100,'F4',28,30),(100,'G4',30,31),(100,'F4',31,34) #Happy Birthday to you
]
append_notes(notes = fiddle.notes, input_notes_list = scandinavian_melody_notes_list)
instruments_list.append(fiddle)
def create_tropical_melody(instruments_list):
"""
パラメータが南国に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
xylophone = pm.Instrument(Instruments.XYLOPHONE)
tropical_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,26) #Happy Birthday to you
]
append_notes(notes = xylophone.notes, input_notes_list = tropical_melody_notes_list)
instruments_list.append(xylophone)
def create_school_melody(instruments_list, positive_param, emotion):
"""
パラメータが学校に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
electric_guitar = pm.Instrument(Instruments.ELECTRIC_GUITAR_JAZZ)
electric_bass = pm.Instrument(Instruments.ELECTRIC_BASS_FINGER)
shcool_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,7), #Happy Birthday to you
(90,'C4',10,10.75),(90,'C4',10.75,11),(100,'D4',11,12),(100,'C4',12,13),(100,'G4',13,14),(100,'F4',14,15), #Happy Birthday to you
(90,'C4',18,18.75),(90,'C4',18.75,19),(100,'C5',19,20),(100,'A4',20,21),(100,'F4',21,21.75),(100,'F4',21.75,22),(95,'E4',22,22.75),(90,'D4',22.75,23),(95,'E4',23,23.75),(90,'D4',23.75,26), #Happy Birthday dear ??
(100,'A#4',26,26.75),(100,'A#4',26.75,27),(100,'A4',27,28),(100,'F4',28,29),(100,'G4',29,30),(100,'F4',30,32) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,10,11,12,13,14,18,19,20,21,22,23.75,26,27,28,29,30]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=4, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = electric_guitar.notes, input_notes_list = shcool_melody_notes_list)
append_notes(notes = electric_guitar.notes, input_notes_list = accompaniment)
append_notes(notes = electric_bass.notes, input_notes_list = bass)
instruments_list.append(electric_guitar)
instruments_list.append(electric_bass)
def create_idol_melody(instruments_list):
"""
パラメータがアイドルで、かつ、真夏のビーチに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
synth_brass = pm.Instrument(Instruments.SYNTH_BRASS_1)
applause = pm.Instrument(Instruments.APPLAUSE)
idol_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
backing_param = [(60,'C4',i-0.75,i+0.15) for i in range(3,26)]
append_notes(notes = synth_brass.notes, input_notes_list = idol_melody_notes_list,raise_velocity = -20)
append_notes(notes = applause.notes, input_notes_list = backing_param)
instruments_list.append(synth_brass)
instruments_list.append(applause)
def create_outdoor_melody(instruments_list, positive_param, emotion):
"""
パラメータがアウトドアに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
flute = pm.Instrument(Instruments.FLUTE)
acostic_guitar = pm.Instrument(Instruments.ACOSTIC_GUITAR_NYLON)
contrabass = pm.Instrument(Instruments.CONTRABASS)
outdoor_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = flute.notes, input_notes_list = outdoor_melody_notes_list, raise_key = 12)
append_notes(notes = acostic_guitar.notes, input_notes_list = accompaniment)
append_notes(notes = contrabass.notes, input_notes_list = bass)
instruments_list.append(flute)
instruments_list.append(acostic_guitar)
instruments_list.append(contrabass)
def create_picture_melody(instruments_list, positive_param, emotion):
"""
パラメータが写真に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
violin = pm.Instrument(Instruments.VIOLIN)
contrabass = pm.Instrument(Instruments.CONTRABASS)
violin_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = violin.notes, input_notes_list = violin_melody_notes_list)
append_notes(notes = violin.notes, input_notes_list = accompaniment)
append_notes(notes = contrabass.notes, input_notes_list = bass)
instruments_list.append(violin)
instruments_list.append(contrabass)
def create_car_melody(instruments_list, positive_param, emotion):
"""
パラメータが車に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
electric_guitar = pm.Instrument(Instruments.ELECTRIC_GUITAR_JAZZ)
electric_bass = pm.Instrument(Instruments.ELECTRIC_BASS_PICK)
car_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,7), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,13), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,18),(95,'E4',18,19),(90,'D4',19,20), #Happy Birthday dear ??
(100,'A#4',20,20.75),(100,'A#4',20.75,21),(100,'A4',21,22),(100,'F4',22,23),(100,'G4',23,24),(100,'F4',24,26) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = electric_guitar.notes, input_notes_list = car_melody_notes_list)
append_notes(notes = electric_guitar.notes, input_notes_list = accompaniment)
append_notes(notes = electric_bass.notes, input_notes_list = bass)
instruments_list.append(electric_guitar)
instruments_list.append(electric_bass)
def create_bike_melody(instruments_list, positive_param, emotion):
"""
パラメータがバイクに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
synth_brass = pm.Instrument(Instruments.SYNTH_BRASS_2)
synth_brass1 = pm.Instrument(Instruments.SYNTH_BRASS_1)
synth_bass = pm.Instrument(Instruments.SYNTH_BASS_1)
bike_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,7), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,13), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,18),(95,'E4',18,19),(90,'D4',19,20), #Happy Birthday dear ??
(100,'A#4',20,20.75),(100,'A#4',20.75,21),(100,'A4',21,22),(100,'F4',22,23),(100,'G4',23,24),(100,'F4',24,26) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list,rhythm_denominator=3,emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = synth_brass.notes, input_notes_list = bike_melody_notes_list)
append_notes(notes = synth_bass1.notes, input_notes_list = accompaniment)
append_notes(notes = synth_bass.notes, input_notes_list = bass)
instruments_list.append(synth_brass)
instruments_list.append(synth_bass1)
instruments_list.append(synth_bass)
def create_drama_melody(instruments_list, positive_param, emotion):
"""
パラメータがドラマに該当した場合の主旋律を作成
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
glocken = pm.Instrument(Instruments.GLOCKENSPIEL)
piccolo = pm.Instrument(Instruments.PICCOLO)
xylophone = pm.Instrument(Instruments.XYLOPHONE)
contrabass = pm.Instrument(Instruments.CONTRABASS)
drama_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = glocken.notes, input_notes_list = drama_melody_notes_list)
append_notes(notes = piccolo.notes, input_notes_list = drama_melody_notes_list)
append_notes(notes = xylophone.notes, input_notes_list = accompaniment)
append_notes(notes = contrabass.notes, input_notes_list = bass)
instruments_list.append(glocken)
instruments_list.append(piccolo)
instruments_list.append(xylophone)
instruments_list.append(contrabass)
def create_rock_melody(instruments_list, positive_param, emotion):
"""
パラメータがロックに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
distortion_guitar = pm.Instrument(Instruments.DISTORTION_GUITAR)
electric_guitar = pm.Instrument(Instruments.ELECTRIC_GUITAR_JAZZ)
electric_bass = pm.Instrument(Instruments.ELECTRIC_BASS_FINGER)
rock_melody_notes_list = \
[
(90,'C4',2,2.25),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,7), #Happy Birthday to you
(90,'C4',8,8.25),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,13), #Happy Birthday to you
(90,'C4',14,14.25),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,20), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = distortion_guitar.notes, input_notes_list = rock_melody_notes_list)
append_notes(notes = electric_guitar.notes, input_notes_list = accompaniment)
append_notes(notes = electric_bass.notes, input_notes_list = bass)
instruments_list.append(distortion_guitar)
instruments_list.append(electric_guitar)
instruments_list.append(electric_bass)
def create_electronics_melody(instruments_list, positive_param, emotion):
"""
パラメータがエレクトロニクスに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
lead2_sawtooth = pm.Instrument(Instruments.LEAD2_SAWTOOTH)
electric_guitar = pm.Instrument(Instruments.ELECTRIC_GUITAR_JAZZ)
electric_bass = pm.Instrument(Instruments.ELECTRIC_BASS_FINGER)
electronics_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
key_note_list = [2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = lead2_sawtooth.notes, input_notes_list = electronics_melody_notes_list)
append_notes(notes = electric_guitar.notes, input_notes_list = accompaniment)
append_notes(notes = electric_bass.notes, input_notes_list = bass)
instruments_list.append(lead2_sawtooth)
instruments_list.append(electric_guitar)
instruments_list.append(electric_bass)
def create_jazz_melody(instruments_list):
"""
パラメータがジャズに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
piano = pm.Instrument(Instruments.ACOSTIC_GRAND_PIANO)
jazz_melody_notes_list = \
[
(90,'C4',2,2.25),(90,'C4',3,3.25),(100,'D4',4,6),(100,'C4',6,6.25),(100,'F4',7,7.75),(100,'E4',7.75,10), #Happy Birthday to you
(90,'C4',11,11.25),(100,'D4',12,14),(100,'C4',14,14.25),(100,'G4',15,15.75),(100,'F4',15.75,18), #Happy Birthday to you
(90,'C4',18,18.25),(90,'C4',19,19.25),(100,'C5',20,22),(100,'A4',22,23),(100,'F4',23,24),(95,'E4',24,25),(90,'D4',25,26), #Happy Birthday dear ??
(100,'A#4',26.5,27.5),(100,'A#4',27.5,27.75),(100,'A4',28,29),(100,'F4',29,30),(100,'G4',31,32),(100,'F4',32,32.5) #Happy Birthday to you
]
append_notes(notes = piano.notes, input_notes_list = jazz_melody_notes_list)
instruments_list.append(piano)
def create_ghost_melody(instruments_list, positive_param, emotion):
"""
パラメータが妖怪に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
goblins = pm.Instrument(Instruments.FX_GOBLINS)
wistle = pm.Instrument(Instruments.WHISTLE)
acosic_base = pm.Instrument(Instruments.ACOSIC_BASS)
ghost_melody_notes_list = \
[
(90,'C4',2,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,18),(95,'E4',18,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,28) #Happy Birthday to you
]
accompaniment, bass = create_backing.create_backing(key_note_list=key_note_list, rhythm_denominator=3, emotion_value=positive_param, emotion_dict=emotion)
append_notes(notes = goblins.notes, input_notes_list = ghost_melody_notes_list)
append_notes(notes = wistle.notes, input_notes_list = accompaniment)
append_notes(notes = acosic_base.notes, input_notes_list = bass)
instruments_list.append(goblins)
instruments_list.append(wistle)
instruments_list.append(acosic_base)
def create_sword_melody(instruments_list):
"""
パラメータが刀に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
shakuhachi = pm.Instrument(Instruments.SHAKUHACHI)
sword_melody_notes_list = \
[
(90,'C4',2,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,18),(95,'E4',18,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
append_notes(notes = shakuhachi.notes, input_notes_list = sword_melody_notes_list)
instruments_list.append(shakuhachi)
def create_gun_melody(instruments_list):
"""
パラメータが銃に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
music_box = pm.Instrument(Instruments.MUSIC_BOX)
gun_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'E4',5,5.2),(100,'F4',5.2,6),(100,'D4',6,6.2),(100,'E4',6.2,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'F4',11,11.2),(100,'G4',11.2,12),(100,'E4',12,12.2),(100,'F4',12.2,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,26) #Happy Birthday to you
]
append_notes(notes = music_box.notes, input_notes_list = gun_melody_notes_list)
instruments_list.append(music_box)
def create_history_melody(instruments_list, positive_param, emotion):
"""
パラメータが歴史に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
shanai = pm.Instrument(Instruments.SHANAI)
history_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,6.15),(100,'F4',6.15,6.3),(100,'E4',6.3,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,12.15),(100,'G4',12.15,12.3),(100,'F4',12.3,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,27) #Happy Birthday to you
]
append_notes(notes = shanai.notes, input_notes_list = history_melody_notes_list)
instruments_list.append(shanai)
def create_chunibyo_melody(instruments_list, positive_param, emotion):
"""
パラメータが厨二病に該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
trumpet = pm.Instrument(Instruments.TRUMPET)
chunibyo_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,5),(100,'F4',5,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,11),(100,'G4',11,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,28) #Happy Birthday to you
]
append_notes(notes = trumpet.notes, input_notes_list = chunibyo_melody_notes_list)
instruments_list.append(trumpet)
def create_fairy_melody(instruments_list, positive_param, emotion):
"""
パラメータがメルヘンに該当した場合の主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
bowed = pm.Instrument(Instruments.PAD5_BOWED)
fairy_melody_notes_list = \
[
(90,'C4',2,2.75),(90,'C4',2.75,3),(100,'D4',3,4),(100,'C4',4,4.8),(100,'C4',4.8,5),(100,'E4',5,5.2),(100,'F4',5.2,6),(100,'E4',6,8), #Happy Birthday to you
(90,'C4',8,8.75),(90,'C4',8.75,9),(100,'D4',9,10),(100,'C4',10,10.8),(100,'C4',10.8,11),(100,'E4',11,11.2),(100,'G4',11.2,12),(100,'F4',12,14), #Happy Birthday to you
(90,'C4',14,14.75),(90,'C4',14.75,14.81),(90,'F4',14.81,14.87),(90,'A4',14.87,15),(100,'C5',15,16),(100,'A4',16,17),(100,'F4',17,17.75),(100,'F4',17.75,18),(95,'E4',18,18.75),(95,'E4',18.75,19),(90,'D4',19,21), #Happy Birthday dear ??
(100,'A#4',21,21.75),(100,'A#4',21.75,22),(100,'A4',22,23),(100,'F4',23,24),(100,'G4',24,25),(100,'F4',25,28) #Happy Birthday to you
]
append_notes(notes = bowed.notes, input_notes_list = fairy_melody_notes_list)
instruments_list.append(bowed)
def create_child_melody(instruments_list, positive_param, emotion):
"""
パラメータが子供に該当した場合の主旋律を作成する(jazzと同じ)
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
piccolo = pm.Instrument(Instruments.PICCOLO)
xylophone = pm.Instrument(Instruments.XYLOPHONE)
child_melody_notes_list = \
[
(90,'C4',2,2.25),(90,'C4',2.25,2.5),(100,'D4',2.5,2.75),(100,'C4',3,3.25),(100,'F4',3.5,3.75),(100,'E4',4,4.25), #Happy Birthday to you
(90,'C4',6,6.25),(90,'C4',6.25,6.5),(100,'D4',6.5,6.75),(100,'C4',7,7.25),(100,'G4',7.5,7.75),(100,'F4',8,8.25), #Happy Birthday to you
(90,'C4',10,10.25),(90,'C4',10.25,10.5),(100,'C5',10.5,10.75),(100,'A4',11,11.25),(100,'F4',11.5,11.75),(100,'F4',11.75,12),(95,'E4',12,12.25),(95,'E4',12.25,12.5),(90,'D4',12.75,13), #Happy Birthday dear ??
(100,'A#4',14,14.25),(100,'A#4',14.25,14.5),(100,'A4',14.5,14.75),(100,'F4',15,15.25),(100,'G4',15.5,15.75),(100,'F4',16,17) #Happy Birthday to you
]
append_notes(notes = piccolo.notes, input_notes_list = child_melody_notes_list, raise_key = 24)
append_notes(notes = xylophone.notes, input_notes_list = child_melody_notes_list)
instruments_list.append(piccolo)
instruments_list.append(xylophone)
def create_mystery_melody(instruments_list):
"""
パラメータがミステリーに該当した場合の主旋律を作成する(jazzと同じ)
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
create_jazz_melody(instruments_list)
def create_shopping_melody(instruments_list, positive_param, emotion):
"""
パラメータがショッピングに該当した場合の主旋律を作成する(jazzと同じ)
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
"""
handbell = pm.Instrument(Instruments.PAD1_NEW_AGE)
shopping_melody_notes_list = \
[
(90,'C4',2,2.25),(90,'C4',2.25,2.5),(100,'D4',2.5,2.75),(100,'C4',3,3.25),(100,'F4',3.5,3.75),(100,'E4',4,4.25), #Happy Birthday to you
(90,'C4',6,6.25),(90,'C4',6.25,6.5),(100,'D4',6.5,6.75),(100,'C4',7,7.25),(100,'G4',7.5,7.75),(100,'F4',8,8.25), #Happy Birthday to you
(90,'C4',10,10.25),(90,'C4',10.25,10.5),(100,'C5',10.5,10.75),(100,'A4',11,11.25),(100,'F4',11.5,11.75),(100,'F4',11.75,12),(95,'E4',12,12.25),(95,'E4',12.25,12.5),(90,'D4',12.75,13), #Happy Birthday dear ??
(100,'A#4',14,14.25),(100,'A#4',14.25,14.5),(100,'A4',14.5,14.75),(100,'F4',15,15.25),(100,'G4',15.5,15.75),(100,'F4',16,18) #Happy Birthday to you
]
append_notes(notes = handbell.notes, input_notes_list = shopping_melody_notes_list)
instruments_list.append(handbell)
def create_main_melody(instruments_list, prime_value, positive_param, emotion):
"""
prime_valueに対応した主旋律を作成する
Parameters
----------
instruments_list : pretty_midi.Pretty_midi.instruments
pretty_midi.Instrumentインスタンスを格納するリスト
prime_value : str
言語分析の結果、一番使用頻度の高かったパラメータ
positive_param : float
Tweetから算出されたポジティブ度
"""
if prime_value == 'sea':
if positive_param < 0.33:
create_moderate_beach_melody(instruments_list)
elif positive_param < 0.66:
create_great_ocean_main_melody(instruments_list)
else:
create_summer_beach_melody(instruments_list)
elif prime_value == 'cherry':
if positive_param < 0.5:
create_graduate_cherry_melody(instruments_list)
else:
create_aggressive_cherry_melody(instruments_list)
elif prime_value == 'cat':
create_cat_melody(instruments_list, positive_param, emotion)
elif prime_value == 'dog':
create_dog_melody(instruments_list, positive_param, emotion)
elif prime_value == 'train':
create_train_melody(instruments_list)
elif prime_value == 'pc':
create_PC_melody(instruments_list, positive_param, emotion)
elif prime_value == 'gourmet':
create_gourmet_melody(instruments_list)
elif prime_value == 'sport':
create_sport_melody(instruments_list)
elif prime_value == 'soccer':
create_soccer_melody(instruments_list, positive_param, emotion)
elif prime_value == 'baseball':
create_baseball_melody(instruments_list, positive_param, emotion)
elif prime_value == 'tabletennis':
create_table_tennis_melody(instruments_list)
elif prime_value == 'japanese':
create_japanese_melody(instruments_list, positive_param, emotion)
elif prime_value == 'scandinavian':
create_scandiavian_melody(instruments_list)
elif prime_value == 'tropical':
create_tropical_melody(instruments_list)
elif prime_value == 'school':
create_school_melody(instruments_list, positive_param, emotion)
elif prime_value == 'idol':
create_idol_melody(instruments_list)
elif prime_value == 'outdoor':
create_outdoor_melody(instruments_list, positive_param, emotion)
elif prime_value == 'car':
create_car_melody(instruments_list, positive_param, emotion)
elif prime_value == 'bike':
create_bike_melody(instruments_list, positive_param, emotion)
elif prime_value == 'drama':
create_drama_melody(instruments_list, positive_param, emotion)
elif prime_value == 'picture':
create_picture_melody(instruments_list, positive_param, emotion)
elif prime_value == 'rock':
create_rock_melody(instruments_list, positive_param, emotion)
elif prime_value == 'electronic':
create_electronics_melody(instruments_list, positive_param, emotion)
elif prime_value == 'jazz':
create_jazz_melody(instruments_list)
elif prime_value == 'ghost':
create_ghost_melody(instruments_list, positive_param, emotion)
elif prime_value == 'sword':
create_sword_melody(instruments_list)
elif prime_value == 'gun':
create_gun_melody(instruments_list)
elif prime_value == 'history':
create_history_melody(instruments_list, positive_param, emotion)
elif prime_value == 'chuni':
create_chunibyo_melody(instruments_list, positive_param, emotion)
elif prime_value == 'fairy':
create_fairy_melody(instruments_list, positive_param, emotion)
elif prime_value == 'child':
create_child_melody(instruments_list, positive_param, emotion)
elif prime_value == 'mystery':
create_mystery_melody(instruments_list)
elif prime_value == 'shopping':
create_shopping_melody(instruments_list, positive_param, emotion)
else:
create_default_main_melody(instruments_list, positive_param, emotion)
def midi_to_wave(inputFileName,id):
WAV_PATH = f'movie/{id}/{settings.WAV_FILE_NAME}'
SOUND_FONT_PATH = 'composer/soundFont/MuseScore_General.sf3'
fs = FluidSynth(SOUND_FONT_PATH) #サウンドフォントを指定
fs.midi_to_audio(inputFileName,WAV_PATH) #midiをmp3に変換、保存
os.remove(inputFileName)
def create_music(related_value_list, positive_param,id, emotion):
"""
入力されたパラメータを基に曲を作成する
Parameters
----------
related_value_list : [str]
言語分析の結果を格納したリスト
"""
TENTATIVE_MIDI_PATH = f'movie/{id}/sample.mid'
MIDI_PATH = f'movie/{id}/sample2.mid'
NO_ITEM = 0
ONE_ITEMS = 1
TWO_ITEMS = 2
prime_value = 'none'
secondary_value = 'none'
third_value = 'none'
PM = pm.PrettyMIDI() #Pretty_MIDIオブジェクトの生成
if len(related_value_list) == NO_ITEM:
prime_value = 'none'
secondary_value = 'none'
third_value = 'none'
elif len(related_value_list) == ONE_ITEMS:
prime_value = related_value_list[0]
elif len(related_value_list) == TWO_ITEMS:
prime_value = related_value_list[0]
secondary_value = related_value_list[1]
else:
prime_value = related_value_list[0]
secondary_value = related_value_list[1]
third_value = related_value_list[2]
BPM = get_tempo.get_bpm(related_value_list, positive_param)
tempo = BPM * 2 #曲のテンポ
create_main_melody(PM.instruments,prime_value,positive_param,emotion)
add_sound_effect.by_midi(PM.instruments,positive_param,prime_value,secondary_value,third_value)
PM.write(TENTATIVE_MIDI_PATH)
mid = MidiFile(TENTATIVE_MIDI_PATH)
track = MidiTrack()
mid.tracks.append(track)
track.append(MetaMessage('set_tempo',tempo=mido.bpm2tempo(tempo)))
mid.save(MIDI_PATH)
os.remove(TENTATIVE_MIDI_PATH)
midi_to_wave(MIDI_PATH,id)
add_sound_effect.by_librosa(id,positive_param,prime_value,secondary_value,third_value) | 51.926353 | 549 | 0.655987 | 9,637 | 58,521 | 3.829511 | 0.04628 | 0.032109 | 0.043896 | 0.052676 | 0.803062 | 0.770681 | 0.726433 | 0.710663 | 0.645468 | 0.581141 | 0 | 0.181157 | 0.131252 | 58,521 | 1,127 | 550 | 51.926353 | 0.544748 | 0.170366 | 0 | 0.381737 | 0 | 0 | 0.052822 | 0.002527 | 0 | 0 | 0 | 0 | 0 | 1 | 0.061377 | false | 0 | 0.011976 | 0 | 0.073353 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 4 |
c63ec39d7086d24123f52266e064a19824a65e39 | 211 | py | Python | bnb/__init__.py | BramVer/BoostNoteBlogger | 360d7c1efcecbef25b4d720ffb648da8b60f5ba3 | [
"Beerware"
] | null | null | null | bnb/__init__.py | BramVer/BoostNoteBlogger | 360d7c1efcecbef25b4d720ffb648da8b60f5ba3 | [
"Beerware"
] | null | null | null | bnb/__init__.py | BramVer/BoostNoteBlogger | 360d7c1efcecbef25b4d720ffb648da8b60f5ba3 | [
"Beerware"
] | null | null | null | from bnb.config import *
from bnb.writer import *
from bnb.scanner import *
from bnb.blogger import *
from bnb.extractor import *
from bnb.converter import *
from bnb.exceptions import *
__version__ = "0.1.0"
| 19.181818 | 28 | 0.753555 | 32 | 211 | 4.84375 | 0.40625 | 0.316129 | 0.503226 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016854 | 0.156398 | 211 | 10 | 29 | 21.1 | 0.853933 | 0 | 0 | 0 | 0 | 0 | 0.023697 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.875 | 0 | 0.875 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.