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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7fb6655e444707235655b6b04ce814593df93517 | 153 | py | Python | dev.py | wabscale/flasq | ea5cba81c3259441f64e96a7c63d2234728100a3 | [
"MIT"
] | 1 | 2022-02-25T02:12:10.000Z | 2022-02-25T02:12:10.000Z | dev.py | wabscale/flasq | ea5cba81c3259441f64e96a7c63d2234728100a3 | [
"MIT"
] | null | null | null | dev.py | wabscale/flasq | ea5cba81c3259441f64e96a7c63d2234728100a3 | [
"MIT"
] | null | null | null | from web import app
from glob import glob
app.run(
debug=True,
host='0.0.0.0',
port=5000,
extra_files=glob('./web/templates/**.html')
)
| 15.3 | 47 | 0.627451 | 25 | 153 | 3.8 | 0.64 | 0.063158 | 0.063158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065574 | 0.202614 | 153 | 9 | 48 | 17 | 0.713115 | 0 | 0 | 0 | 0 | 0 | 0.196078 | 0.150327 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7fbdd22fcfc2573215684df2e76cac9a67962312 | 154 | py | Python | String/P151 - reverseWordsInString.py | HarshOza36/LeetCode_Problems | 6d7035e0d681213ac602b9e0382dbfa87f8d4745 | [
"MIT"
] | null | null | null | String/P151 - reverseWordsInString.py | HarshOza36/LeetCode_Problems | 6d7035e0d681213ac602b9e0382dbfa87f8d4745 | [
"MIT"
] | null | null | null | String/P151 - reverseWordsInString.py | HarshOza36/LeetCode_Problems | 6d7035e0d681213ac602b9e0382dbfa87f8d4745 | [
"MIT"
] | null | null | null | class Solution:
def reverseWords(self, s: str) -> str:
s = s.split(" ")
s = [i for i in s if i != ""]
return " ".join(s[::-1]) | 30.8 | 42 | 0.454545 | 23 | 154 | 3.043478 | 0.652174 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009901 | 0.344156 | 154 | 5 | 43 | 30.8 | 0.683168 | 0 | 0 | 0 | 0 | 0 | 0.012903 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
f6852dfc604081fcd05261f22cc95fbff38847fc | 2,317 | py | Python | qrogue/game/logic/collectibles/collectible.py | 7Magic7Mike7/Qrogue | 70bd5671a77981c1d4b633246321ba44f13c21ff | [
"MIT"
] | 4 | 2021-12-14T19:13:43.000Z | 2022-02-16T13:25:38.000Z | qrogue/game/logic/collectibles/collectible.py | 7Magic7Mike7/Qrogue | 70bd5671a77981c1d4b633246321ba44f13c21ff | [
"MIT"
] | null | null | null | qrogue/game/logic/collectibles/collectible.py | 7Magic7Mike7/Qrogue | 70bd5671a77981c1d4b633246321ba44f13c21ff | [
"MIT"
] | 1 | 2022-01-04T18:35:51.000Z | 2022-01-04T18:35:51.000Z | import math
from abc import ABC, abstractmethod
from enum import Enum
from typing import Iterator
class CollectibleType(Enum):
Consumable = 1
Gate = 2
ActiveItem = 3
PassiveItem = 4
Pickup = 5
Qubit = 6
Multi = 0 # wraps multiple collectibles
def type_str(c_type: CollectibleType) -> str:
if c_type is CollectibleType.Gate:
return " Gate"
else:
return ""
class Collectible(ABC):
def __init__(self, c_type: CollectibleType):
self.__type = c_type
@property
def type(self):
return self.__type
@abstractmethod
def name(self) -> str:
pass
@abstractmethod
def description(self) -> str:
pass
@abstractmethod
def default_price(self) -> int:
pass
@abstractmethod
def to_string(self) -> str:
pass
class MultiCollectible(Collectible):
PRICE_MULT = 0.9
def __init__(self, content: [Collectible]):
super(MultiCollectible, self).__init__(CollectibleType.Multi)
self.__content = content
def name(self) -> str:
return "Collectible Pack"
def description(self) -> str:
desc = "Contains multiple Collectibles:"
for collectible in self.__content:
desc += "\n - " + collectible.name()
return desc
def default_price(self) -> int:
price = 0
for collectible in self.__content:
price += collectible.default_price()
return math.ceil(price * MultiCollectible.PRICE_MULT)
def to_string(self) -> str:
text = "Multi ["
for collectible in self.__content:
text += collectible.to_string() + ", "
return text + "]"
def iterator(self) -> Iterator[Collectible]:
return iter(self.__content)
class ShopItem:
def __init__(self, collectible: Collectible, price: int = -1):
self.__collectible = collectible
if price < 0:
price = collectible.default_price()
self.__price = price
@property
def collectible(self) -> Collectible:
return self.__collectible
@property
def price(self) -> int:
return self.__price
def to_string(self) -> str:
return f"{self.collectible}, {self.price}$"
def __str__(self):
return self.to_string()
| 22.715686 | 69 | 0.616314 | 252 | 2,317 | 5.436508 | 0.25 | 0.035766 | 0.024088 | 0.032847 | 0.169343 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007282 | 0.288735 | 2,317 | 101 | 70 | 22.940594 | 0.824029 | 0.011653 | 0 | 0.306667 | 0 | 0 | 0.044143 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0.066667 | 0.053333 | 0.093333 | 0.613333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
f689cb30eecdf29de4c6be77cd697849835314bd | 180 | py | Python | cvp/setup.py | hashnfv/hashnfv-dovetail | 73f332fc513f184513be483db6a108bd3c7b7d9b | [
"Apache-2.0"
] | 1 | 2017-11-03T01:06:51.000Z | 2017-11-03T01:06:51.000Z | cvp/setup.py | hashnfv/hashnfv-dovetail | 73f332fc513f184513be483db6a108bd3c7b7d9b | [
"Apache-2.0"
] | null | null | null | cvp/setup.py | hashnfv/hashnfv-dovetail | 73f332fc513f184513be483db6a108bd3c7b7d9b | [
"Apache-2.0"
] | 2 | 2017-09-05T13:38:20.000Z | 2017-10-12T21:56:11.000Z | import setuptools
__author__ = 'serena'
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr==2.0.0'],
pbr=True)
| 12.857143 | 34 | 0.683333 | 21 | 180 | 5.619048 | 0.761905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020979 | 0.205556 | 180 | 13 | 35 | 13.846154 | 0.804196 | 0.022222 | 0 | 0 | 0 | 0 | 0.091954 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.111111 | 0.333333 | 0 | 0.333333 | 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 | 0 | 0 | 0 | 3 |
f6a98ab922bb283e3d03fe3c75cc8eb473f34455 | 95 | py | Python | models/dbconfig.py | FusionX9000/Reddit-Saves-Manager | 6109f3b40a992f99ba95346b1e39a2df07e1bcb7 | [
"MIT"
] | null | null | null | models/dbconfig.py | FusionX9000/Reddit-Saves-Manager | 6109f3b40a992f99ba95346b1e39a2df07e1bcb7 | [
"MIT"
] | 1 | 2021-06-02T01:12:35.000Z | 2021-06-02T01:12:35.000Z | models/dbconfig.py | FusionX9000/Reddit-Saves-Manager | 6109f3b40a992f99ba95346b1e39a2df07e1bcb7 | [
"MIT"
] | null | null | null | database = "database"
user = "postgres"
password = "password"
host = "localhost"
port = "5432"
| 15.833333 | 21 | 0.684211 | 10 | 95 | 6.5 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | 0.157895 | 95 | 5 | 22 | 19 | 0.7625 | 0 | 0 | 0 | 0 | 0 | 0.389474 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f6a9f53335a90945beeac0881642656ecefd349b | 318 | py | Python | Programs/HowToUse.py | aposum23/laborathory14 | 03e251e267b5783b12ea9b2f4ba2da41194f349e | [
"MIT"
] | null | null | null | Programs/HowToUse.py | aposum23/laborathory14 | 03e251e267b5783b12ea9b2f4ba2da41194f349e | [
"MIT"
] | null | null | null | Programs/HowToUse.py | aposum23/laborathory14 | 03e251e267b5783b12ea9b2f4ba2da41194f349e | [
"MIT"
] | null | null | null | def mul(a, b):
return a * b
mul(3, 4)
#12
def mul5(a):
return mul(5,a)
mul5(2)
#10
def mul(a):
def helper(b):
return a * b
return helper
mul(5)(2)
#10
def fun1(a):
x = a * 3
def fun2(b):
nonlocal x
return b + x
return fun2
test_fun = fun1(4)
test_fun(7)
#19
| 9.9375 | 20 | 0.512579 | 60 | 318 | 2.683333 | 0.35 | 0.037267 | 0.086957 | 0.111801 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110577 | 0.345912 | 318 | 31 | 21 | 10.258065 | 0.663462 | 0.025157 | 0 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0 | 0 | 0.157895 | 0.631579 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f6ab9a9d8d75aed7d16ae4d945c1c5fe7a289970 | 152 | py | Python | py_tdlib/constructors/set_bot_updates_status.py | Mr-TelegramBot/python-tdlib | 2e2d21a742ebcd439971a32357f2d0abd0ce61eb | [
"MIT"
] | 24 | 2018-10-05T13:04:30.000Z | 2020-05-12T08:45:34.000Z | py_tdlib/constructors/set_bot_updates_status.py | MrMahdi313/python-tdlib | 2e2d21a742ebcd439971a32357f2d0abd0ce61eb | [
"MIT"
] | 3 | 2019-06-26T07:20:20.000Z | 2021-05-24T13:06:56.000Z | py_tdlib/constructors/set_bot_updates_status.py | MrMahdi313/python-tdlib | 2e2d21a742ebcd439971a32357f2d0abd0ce61eb | [
"MIT"
] | 5 | 2018-10-05T14:29:28.000Z | 2020-08-11T15:04:10.000Z | from ..factory import Method
class setBotUpdatesStatus(Method):
pending_update_count = None # type: "int32"
error_message = None # type: "string"
| 21.714286 | 45 | 0.743421 | 18 | 152 | 6.111111 | 0.833333 | 0.145455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015625 | 0.157895 | 152 | 6 | 46 | 25.333333 | 0.84375 | 0.184211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
f6b7fa5f60e2de9db3a6e09ccdc529c81f6a56da | 203 | py | Python | cah/__init__.py | pordino/aikaterna-cogs | 07108bc808b571395e511586492f719c6582e72e | [
"Apache-2.0"
] | 98 | 2017-09-12T01:52:17.000Z | 2022-03-17T16:43:01.000Z | cah/__init__.py | pordino/aikaterna-cogs | 07108bc808b571395e511586492f719c6582e72e | [
"Apache-2.0"
] | 147 | 2016-12-01T04:39:05.000Z | 2022-02-13T02:20:14.000Z | cah/__init__.py | pordino/aikaterna-cogs | 07108bc808b571395e511586492f719c6582e72e | [
"Apache-2.0"
] | 160 | 2016-12-01T20:19:44.000Z | 2022-03-30T10:32:41.000Z | from .cah import CardsAgainstHumanity
__red_end_user_data_statement__ = "This cog does not persistently store data or metadata about users."
def setup(bot):
bot.add_cog(CardsAgainstHumanity(bot))
| 25.375 | 102 | 0.802956 | 28 | 203 | 5.5 | 0.821429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133005 | 203 | 7 | 103 | 29 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0.325123 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f6c1d658392020e0d6f57aed9f80cf163700273d | 197 | py | Python | aa.py | ani37/Hello-world | db3998f9ce110b145c48eda401c607acc726cd2c | [
"MIT"
] | null | null | null | aa.py | ani37/Hello-world | db3998f9ce110b145c48eda401c607acc726cd2c | [
"MIT"
] | null | null | null | aa.py | ani37/Hello-world | db3998f9ce110b145c48eda401c607acc726cd2c | [
"MIT"
] | 1 | 2018-10-27T10:14:24.000Z | 2018-10-27T10:14:24.000Z | MAX = 100000
MOD = pwo(10, 9) + 7
dp = [1 for in xrange(MAX)]
for i in xrange(7, MAX):
dp[i] = (dp[i - 1] + dp[i - 7]) % MOD
n = input()
for i in xrange(n):
k = input()
print dp[k]
| 16.416667 | 39 | 0.502538 | 40 | 197 | 2.475 | 0.425 | 0.242424 | 0.121212 | 0.242424 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101449 | 0.299492 | 197 | 11 | 40 | 17.909091 | 0.615942 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.111111 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f6d7d9fa5e972fea2d582789bda3bf36878133b2 | 3,673 | py | Python | test/priors/test_half_cauchy_prior.py | noamsgl/gpytorch | c3e3109c756ace47d82ff8b1f52b2d77748ff09c | [
"MIT"
] | 188 | 2017-06-09T20:42:18.000Z | 2018-02-15T11:17:09.000Z | test/priors/test_half_cauchy_prior.py | noamsgl/gpytorch | c3e3109c756ace47d82ff8b1f52b2d77748ff09c | [
"MIT"
] | 49 | 2017-07-18T02:55:17.000Z | 2018-02-15T21:23:42.000Z | test/priors/test_half_cauchy_prior.py | noamsgl/gpytorch | c3e3109c756ace47d82ff8b1f52b2d77748ff09c | [
"MIT"
] | 24 | 2017-07-12T17:29:52.000Z | 2018-02-15T19:25:07.000Z | #!/usr/bin/env python3
import unittest
import torch
from torch.distributions import HalfCauchy
from gpytorch.priors import HalfCauchyPrior
from gpytorch.test.utils import least_used_cuda_device
class TestHalfCauchyPrior(unittest.TestCase):
def test_half_cauchy_prior_to_gpu(self):
if torch.cuda.is_available():
prior = HalfCauchy(1.0).cuda()
self.assertEqual(prior.concentration.device.type, "cuda")
self.assertEqual(prior.rate.device.type, "cuda")
def test_half_cauchy_prior_validate_args(self):
with self.assertRaises(ValueError):
HalfCauchyPrior(-1, validate_args=True)
with self.assertRaises(ValueError):
HalfCauchyPrior(-1, validate_args=True)
def test_half_cauchy_prior_log_prob(self, cuda=False):
device = torch.device("cuda") if cuda else torch.device("cpu")
prior = HalfCauchyPrior(0.1)
dist = HalfCauchy(0.1)
t = torch.tensor(1.0, device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
t = torch.tensor([1.5, 0.5], device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
t = torch.tensor([[1.0, 0.5], [3.0, 0.25]], device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
def test_half_cauchy_prior_log_prob_cuda(self):
if torch.cuda.is_available():
with least_used_cuda_device():
return self.test_gamma_prior_log_prob(cuda=True)
def test_half_cauchy_prior_log_prob_log_transform(self, cuda=False):
device = torch.device("cuda") if cuda else torch.device("cpu")
prior = HalfCauchyPrior(0.1, transform=torch.exp)
dist = HalfCauchy(0.1)
t = torch.tensor(0.0, device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t.exp())))
t = torch.tensor([-1, 0.5], device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t.exp())))
t = torch.tensor([[-1, 0.5], [0.1, -2.0]], device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t.exp())))
def test_half_cauchy_prior_log_prob_log_transform_cuda(self):
if torch.cuda.is_available():
with least_used_cuda_device():
return self.test_half_cauchy_prior_log_prob_log_transform(cuda=True)
def test_half_cauchy_prior_batch_log_prob(self, cuda=False):
device = torch.device("cuda") if cuda else torch.device("cpu")
prior = HalfCauchyPrior(0.1)
dist = HalfCauchy(0.1)
t = torch.ones(2, device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
t = torch.ones(2, 2, device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
scale = torch.tensor([0.1, 1.0], device=device)
prior = HalfCauchyPrior(scale)
dist = HalfCauchy(scale)
t = torch.ones(2, device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
t = torch.ones(2, 2, device=device)
self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
with self.assertRaises(ValueError):
prior.log_prob(torch.ones(3, device=device))
with self.assertRaises(ValueError):
prior.log_prob(torch.ones(2, 3, device=device))
def test_half_cauchy_prior_batch_log_prob_cuda(self):
if torch.cuda.is_available():
with least_used_cuda_device():
return self.test_half_cauchy_prior_batch_log_prob(cuda=True)
if __name__ == "__main__":
unittest.main()
| 41.738636 | 84 | 0.665941 | 521 | 3,673 | 4.476008 | 0.128599 | 0.093053 | 0.068611 | 0.081475 | 0.783019 | 0.763293 | 0.752144 | 0.7247 | 0.683533 | 0.541595 | 0 | 0.019501 | 0.204193 | 3,673 | 87 | 85 | 42.218391 | 0.77831 | 0.005717 | 0 | 0.507246 | 0 | 0 | 0.010134 | 0 | 0 | 0 | 0 | 0 | 0.231884 | 1 | 0.115942 | false | 0 | 0.072464 | 0 | 0.246377 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f6e2d912d61b57a1bc1a9fc88cfe7298ffc1b85b | 480 | py | Python | covid19sweden/__init__.py | martinbenes1996/covid19sweden | 100993e41c302ffd96fa39857dd8ddd21267f1ed | [
"MIT"
] | 1 | 2020-06-06T21:02:10.000Z | 2020-06-06T21:02:10.000Z | covid19sweden/__init__.py | martinbenes1996/covid19sweden | 100993e41c302ffd96fa39857dd8ddd21267f1ed | [
"MIT"
] | 1 | 2020-06-25T00:18:21.000Z | 2020-06-26T02:34:19.000Z | covid19sweden/__init__.py | martinbenes1996/covid19sweden | 100993e41c302ffd96fa39857dd8ddd21267f1ed | [
"MIT"
] | 1 | 2020-06-06T21:04:22.000Z | 2020-06-06T21:04:22.000Z | # -*- coding: utf-8 -*-
"""Webscraper for Swedish data.
Reference: https://www.scb.se/hitta-statistik/statistik-efter-amne/befolkning/befolkningens-sammansattning/befolkningsstatistik/pong/tabell-och-diagram/preliminar-statistik-over-doda/
Todo:
* caching
"""
import pkg_resources
from .main import *
from . import fohm
from .scb import *
from .backup import *
try:
__version__ = pkg_resources.get_distribution("covid19sweden").version
except:
__version__ = None | 24 | 183 | 0.75625 | 57 | 480 | 6.175439 | 0.754386 | 0.068182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007109 | 0.120833 | 480 | 20 | 184 | 24 | 0.827014 | 0.535417 | 0 | 0 | 0 | 0 | 0.059908 | 0 | 0 | 0 | 0 | 0.05 | 0 | 1 | 0 | false | 0 | 0.555556 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f6ecd0aafed1e62eb63756a09afea3562d8bef9e | 99 | py | Python | api/newsCategory/apps.py | jhonatantft/ckl | 8a0d533922fa091ac5f2dbe50caee3920ec2b90d | [
"MIT"
] | null | null | null | api/newsCategory/apps.py | jhonatantft/ckl | 8a0d533922fa091ac5f2dbe50caee3920ec2b90d | [
"MIT"
] | 2 | 2021-05-08T21:26:43.000Z | 2022-02-19T00:26:17.000Z | api/newsCategory/apps.py | jhonatantft/ckl | 8a0d533922fa091ac5f2dbe50caee3920ec2b90d | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class NewscategoryConfig(AppConfig):
name = 'newsCategory'
| 16.5 | 36 | 0.777778 | 10 | 99 | 7.7 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151515 | 99 | 5 | 37 | 19.8 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 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 | 0 | 0 | 0 | 3 |
10182dc2e471f5a0f909b79006a7d28c08916403 | 509 | py | Python | querybook/server/datasources_socketio/connect.py | shivammmmm/querybook | 71263eb7db79e56235ea752f2cf3339ca9b3a092 | [
"Apache-2.0"
] | 1,144 | 2021-03-30T05:06:16.000Z | 2022-03-31T10:40:31.000Z | querybook/server/datasources_socketio/connect.py | shivammmmm/querybook | 71263eb7db79e56235ea752f2cf3339ca9b3a092 | [
"Apache-2.0"
] | 593 | 2021-07-01T10:34:25.000Z | 2022-03-31T23:24:40.000Z | querybook/server/datasources_socketio/connect.py | shivammmmm/querybook | 71263eb7db79e56235ea752f2cf3339ca9b3a092 | [
"Apache-2.0"
] | 113 | 2021-03-30T00:07:20.000Z | 2022-03-31T07:18:43.000Z | from flask_login import current_user
from flask_socketio import ConnectionRefusedError
from app.flask_app import socketio
from const.data_doc import DATA_DOC_NAMESPACE
from const.query_execution import QUERY_EXECUTION_NAMESPACE
def connect():
if not current_user.is_authenticated:
raise ConnectionRefusedError("User is not logged in, please refresh the page.")
socketio.on("connect", namespace=DATA_DOC_NAMESPACE)(connect)
socketio.on("connect", namespace=QUERY_EXECUTION_NAMESPACE)(connect)
| 31.8125 | 87 | 0.827112 | 68 | 509 | 5.955882 | 0.426471 | 0.051852 | 0.079012 | 0.128395 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.11002 | 509 | 15 | 88 | 33.933333 | 0.89404 | 0 | 0 | 0 | 0 | 0 | 0.119843 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | true | 0 | 0.5 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
1220d274182a0990223702c61d3c21c277645d4a | 452 | py | Python | uim/model/helpers/__init__.py | Wacom-Developer/universal-ink-library | 689ed90e09e912b8fc9ac249984df43a7b59aa59 | [
"Apache-2.0"
] | 5 | 2021-09-06T11:45:37.000Z | 2022-03-24T15:56:06.000Z | uim/model/helpers/__init__.py | Wacom-Developer/universal-ink-library | 689ed90e09e912b8fc9ac249984df43a7b59aa59 | [
"Apache-2.0"
] | null | null | null | uim/model/helpers/__init__.py | Wacom-Developer/universal-ink-library | 689ed90e09e912b8fc9ac249984df43a7b59aa59 | [
"Apache-2.0"
] | 2 | 2021-09-03T09:08:45.000Z | 2021-12-15T14:03:16.000Z | # -*- coding: utf-8 -*-
"""
Helpers
=======
The helpers are simple functions to support with:
- Catmull-Rom splines
- Extracting text and named entities from Ink Model
- Iterate over the Ink Tree
"""
__all__ = ['spline', 'text_extractor', 'treeiterator', 'policy']
from uim.model.helpers import spline
from uim.model.helpers import text_extractor
from uim.model.helpers import treeiterator
from uim.model.helpers import policy
| 25.111111 | 64 | 0.710177 | 59 | 452 | 5.338983 | 0.542373 | 0.088889 | 0.152381 | 0.24127 | 0.31746 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002703 | 0.181416 | 452 | 17 | 65 | 26.588235 | 0.848649 | 0.431416 | 0 | 0 | 0 | 0 | 0.164502 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
122e92d89d689afb07f2870e5616b184ec228c74 | 74 | py | Python | Chapter2_Python/fStrings.py | dependencyInversion/UdemyML | 9e1a0a01688a82c61ef006a592a58c12fb186552 | [
"MIT"
] | null | null | null | Chapter2_Python/fStrings.py | dependencyInversion/UdemyML | 9e1a0a01688a82c61ef006a592a58c12fb186552 | [
"MIT"
] | null | null | null | Chapter2_Python/fStrings.py | dependencyInversion/UdemyML | 9e1a0a01688a82c61ef006a592a58c12fb186552 | [
"MIT"
] | null | null | null | my_name = "Jan"
my_age = 23
print(f"Age: { my_age }, Name: { my_name }")
| 14.8 | 44 | 0.594595 | 14 | 74 | 2.857143 | 0.5 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033898 | 0.202703 | 74 | 4 | 45 | 18.5 | 0.644068 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
124d0147a05244a749391c0acf979893ea8c65d5 | 6,372 | py | Python | nexpose_rest/nexpose_policy.py | Patralos/nexpose-rest | c03431a408afd1528b0ca5a00859467574953ea0 | [
"MIT"
] | null | null | null | nexpose_rest/nexpose_policy.py | Patralos/nexpose-rest | c03431a408afd1528b0ca5a00859467574953ea0 | [
"MIT"
] | null | null | null | nexpose_rest/nexpose_policy.py | Patralos/nexpose-rest | c03431a408afd1528b0ca5a00859467574953ea0 | [
"MIT"
] | null | null | null | from nexpose_rest.nexpose import _GET
def getPolicies(config, filter=None, scannedOnly=None):
getParameters=[]
if filter is not None:
getParameters.append('filter=' + filter)
if scannedOnly is not None:
getParameters.append('scannedOnly=' + scannedOnly)
code, data = _GET('/api/3/policies', config, getParameters=getParameters)
return data
def getPolicyRuleControls(config, policyId, ruleId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/rules/' + str(ruleId) + '/controls', config, getParameters=getParameters)
return data
def getAssetPolicyRulesSummary(config, assetId, policyId):
getParameters=[]
code, data = _GET('/api/3/assets/' + str(assetId) + '/policies/' + str(policyId) + '/rules', config, getParameters=getParameters)
return data
def getPolicyGroup(config, policyId, groupId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/groups/' + str(groupId) + '', config, getParameters=getParameters)
return data
def getPolicyRule(config, policyId, ruleId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/rules/' + str(ruleId) + '', config, getParameters=getParameters)
return data
def getPolicyRuleAssetResultProof(config, policyId, ruleId, assetId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/rules/' + str(ruleId) + '/assets/' + str(assetId) + '/proof', config, getParameters=getParameters)
return data
def getDisabledPolicyRules(config, policyId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/rules/disabled', config, getParameters=getParameters)
return data
def getPolicyChildren(config, id):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(id) + '/children', config, getParameters=getParameters)
return data
def getPolicyGroups(config, policyId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/groups', config, getParameters=getParameters)
return data
def getPolicyAssetResults(config, policyId, applicableOnly=None):
getParameters=[]
if applicableOnly is not None:
getParameters.append('applicableOnly=' + applicableOnly)
code, data = _GET('/api/3/policies/' + str(policyId) + '/assets', config, getParameters=getParameters)
return data
def getAssetPolicyChildren(config, assetId, policyId):
getParameters=[]
code, data = _GET('/api/3/assets/' + str(assetId) + '/policies/' + str(policyId) + '/children', config, getParameters=getParameters)
return data
def getPolicyRuleRationale(config, policyId, ruleId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/rules/' + str(ruleId) + '/rationale', config, getParameters=getParameters)
return data
def getPolicyGroupRulesWithAssetAssessment(config, assetId, policyId, groupId):
getParameters=[]
code, data = _GET('/api/3/assets/' + str(assetId) + '/policies/' + str(policyId) + '/groups/' + str(groupId) + '/rules', config, getParameters=getParameters)
return data
def getPolicyRuleAssetResults(config, policyId, ruleId, applicableOnly=None):
getParameters=[]
if applicableOnly is not None:
getParameters.append('applicableOnly=' + applicableOnly)
code, data = _GET('/api/3/policies/' + str(policyId) + '/rules/' + str(ruleId) + '/assets', config, getParameters=getParameters)
return data
def getAssetPolicyGroupChildren(config, assetId, policyId, groupId):
getParameters=[]
code, data = _GET('/api/3/assets/' + str(assetId) + '/policies/' + str(policyId) + '/groups/' + str(groupId) + '/children', config, getParameters=getParameters)
return data
def getPoliciesForAsset(config, assetId, applicableOnly=None):
getParameters=[]
if applicableOnly is not None:
getParameters.append('applicableOnly=' + applicableOnly)
code, data = _GET('/api/3/assets/' + str(assetId) + '/policies', config, getParameters=getParameters)
return data
def getPolicyRuleRemediation(config, policyId, ruleId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/rules/' + str(ruleId) + '/remediation', config, getParameters=getParameters)
return data
def getPolicyRules(config, policyId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/rules', config, getParameters=getParameters)
return data
def getPolicySummary(config):
getParameters=[]
code, data = _GET('/api/3/policy/summary', config, getParameters=getParameters)
return data
def getPolicyGroupAssetResult(config, policyId, groupId, assetId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/groups/' + str(groupId) + '/assets/' + str(assetId) + '', config, getParameters=getParameters)
return data
def getPolicyAssetResult(config, policyId, assetId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/assets/' + str(assetId) + '', config, getParameters=getParameters)
return data
def getPolicyGroupAssetResults(config, policyId, groupId, applicableOnly=None):
getParameters=[]
if applicableOnly is not None:
getParameters.append('applicableOnly=' + applicableOnly)
code, data = _GET('/api/3/policies/' + str(policyId) + '/groups/' + str(groupId) + '/assets', config, getParameters=getParameters)
return data
def getDescendantPolicyRules(config, policyId, groupId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/groups/' + str(groupId) + '/rules', config, getParameters=getParameters)
return data
def getPolicyRuleAssetResult(config, policyId, ruleId, assetId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/rules/' + str(ruleId) + '/assets/' + str(assetId) + '', config, getParameters=getParameters)
return data
def getPolicyGroupChildren(config, policyId, groupId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '/groups/' + str(groupId) + '/children', config, getParameters=getParameters)
return data
def getPolicy(config, policyId):
getParameters=[]
code, data = _GET('/api/3/policies/' + str(policyId) + '', config, getParameters=getParameters)
return data
| 37.482353 | 164 | 0.694131 | 642 | 6,372 | 6.845794 | 0.101246 | 0.116724 | 0.065074 | 0.082821 | 0.806143 | 0.783845 | 0.681911 | 0.604778 | 0.595904 | 0.552446 | 0 | 0.004849 | 0.158506 | 6,372 | 169 | 165 | 37.704142 | 0.814808 | 0 | 0 | 0.512821 | 0 | 0 | 0.127903 | 0.003296 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.017094 | 0.008547 | 0 | 0.452991 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
12630eab0d2633dd229a8455f46121e72a20a96c | 437 | py | Python | skypy/galaxies/__init__.py | itrharrison/skypy-itrharrison | cea1f02d1b2cd3b689266d7ae9bca1a4cfe986a2 | [
"BSD-3-Clause"
] | 88 | 2020-04-06T15:48:17.000Z | 2022-02-16T12:01:54.000Z | skypy/galaxies/__init__.py | itrharrison/skypy-itrharrison | cea1f02d1b2cd3b689266d7ae9bca1a4cfe986a2 | [
"BSD-3-Clause"
] | 332 | 2020-04-04T07:30:08.000Z | 2022-03-30T14:49:08.000Z | skypy/galaxies/__init__.py | itrharrison/skypy-itrharrison | cea1f02d1b2cd3b689266d7ae9bca1a4cfe986a2 | [
"BSD-3-Clause"
] | 41 | 2020-04-03T13:50:43.000Z | 2022-03-24T16:10:03.000Z | """
This module contains methods that model the intrinsic properties of galaxy
populations.
"""
__all__ = [
'schechter_lf',
]
from . import luminosity # noqa F401,F403
from . import morphology # noqa F401,F403
from . import redshift # noqa F401,F403
from . import spectrum # noqa F401,F403
from . import stellar_mass # noqa F401,F403
from ._schechter import schechter_lf # noqa
from ._schechter import schechter_smf # noqa
| 24.277778 | 74 | 0.743707 | 58 | 437 | 5.431034 | 0.465517 | 0.15873 | 0.190476 | 0.253968 | 0.279365 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084034 | 0.183066 | 437 | 17 | 75 | 25.705882 | 0.798319 | 0.395881 | 0 | 0 | 0 | 0 | 0.048 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.7 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
126f3570c8ca400c14dbf8aadb5953428e90972f | 86 | py | Python | droidlet/dialog/robot/dialogue_objects/__init__.py | CowherdChris/droidlet | 8d965c1ebc38eceb6f8083c52b1146c1bc17d5e1 | [
"MIT"
] | null | null | null | droidlet/dialog/robot/dialogue_objects/__init__.py | CowherdChris/droidlet | 8d965c1ebc38eceb6f8083c52b1146c1bc17d5e1 | [
"MIT"
] | null | null | null | droidlet/dialog/robot/dialogue_objects/__init__.py | CowherdChris/droidlet | 8d965c1ebc38eceb6f8083c52b1146c1bc17d5e1 | [
"MIT"
] | null | null | null | from .loco_dialogue_object import LocoBotCapabilities
__all__ = [LocoBotCapabilities] | 28.666667 | 53 | 0.872093 | 8 | 86 | 8.625 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081395 | 86 | 3 | 54 | 28.666667 | 0.873418 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
12732154001636677778fe83629d7b02a01b585b | 148 | py | Python | psana/psana/momentum/Energy.py | JBlaschke/lcls2 | 30523ef069e823535475d68fa283c6387bcf817b | [
"BSD-3-Clause-LBNL"
] | 16 | 2017-11-09T17:10:56.000Z | 2022-03-09T23:03:10.000Z | psana/psana/momentum/Energy.py | JBlaschke/lcls2 | 30523ef069e823535475d68fa283c6387bcf817b | [
"BSD-3-Clause-LBNL"
] | 6 | 2017-12-12T19:30:05.000Z | 2020-07-09T00:28:33.000Z | psana/psana/momentum/Energy.py | JBlaschke/lcls2 | 30523ef069e823535475d68fa283c6387bcf817b | [
"BSD-3-Clause-LBNL"
] | 25 | 2017-09-18T20:02:43.000Z | 2022-03-27T22:27:42.000Z | import numpy as np
def CalcEnergy(m_amu,Px_au,Py_au,Pz_au):
amu2au = 1836.15
return 27.2*(Px_au**2 + Py_au**2 + Pz_au**2)/(2*amu2au*m_amu)
| 24.666667 | 65 | 0.668919 | 33 | 148 | 2.757576 | 0.545455 | 0.098901 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.120968 | 0.162162 | 148 | 5 | 66 | 29.6 | 0.612903 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
12732acde8058d66a7523c9ed83348d21998d829 | 357 | py | Python | timer.py | davidbarkhuizen/simagora | 43d44dc058adcde4738574cb1132abaa02e6516e | [
"MIT"
] | 1 | 2017-04-30T23:31:43.000Z | 2017-04-30T23:31:43.000Z | timer.py | davidbarkhuizen/simagora | 43d44dc058adcde4738574cb1132abaa02e6516e | [
"MIT"
] | null | null | null | timer.py | davidbarkhuizen/simagora | 43d44dc058adcde4738574cb1132abaa02e6516e | [
"MIT"
] | null | null | null | from time import clock
import logging
#~ class Timer(object):
#~
#~ def start(self,s):
#~ self.s = s
#~ self.started = clock()
#~
#~ def stop(self):
#~ self.stopped = clock()
#~ t = self.stopped - self.started
#~ self.log(t)
#~
#~ def log(self, t):
#~ line = self.s + ',' + str(t)
#~ logging.info(line)
| 19.833333 | 38 | 0.504202 | 45 | 357 | 4 | 0.444444 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.296919 | 357 | 17 | 39 | 21 | 0.717131 | 0.70028 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
89c4524ab54cd0dacd5f166c3bbe02a8a3454498 | 5,966 | py | Python | google/ads/google_ads/v3/proto/services/shopping_performance_view_service_pb2.py | andy0937/google-ads-python | cb5da7f4a75076828d1fc3524b08cc167670435a | [
"Apache-2.0"
] | null | null | null | google/ads/google_ads/v3/proto/services/shopping_performance_view_service_pb2.py | andy0937/google-ads-python | cb5da7f4a75076828d1fc3524b08cc167670435a | [
"Apache-2.0"
] | null | null | null | google/ads/google_ads/v3/proto/services/shopping_performance_view_service_pb2.py | andy0937/google-ads-python | cb5da7f4a75076828d1fc3524b08cc167670435a | [
"Apache-2.0"
] | 1 | 2020-03-13T00:14:31.000Z | 2020-03-13T00:14:31.000Z | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v3/proto/services/shopping_performance_view_service.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.ads.google_ads.v3.proto.resources import shopping_performance_view_pb2 as google_dot_ads_dot_googleads__v3_dot_proto_dot_resources_dot_shopping__performance__view__pb2
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
from google.api import client_pb2 as google_dot_api_dot_client__pb2
from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='google/ads/googleads_v3/proto/services/shopping_performance_view_service.proto',
package='google.ads.googleads.v3.services',
syntax='proto3',
serialized_options=_b('\n$com.google.ads.googleads.v3.servicesB#ShoppingPerformanceViewServiceProtoP\001ZHgoogle.golang.org/genproto/googleapis/ads/googleads/v3/services;services\242\002\003GAA\252\002 Google.Ads.GoogleAds.V3.Services\312\002 Google\\Ads\\GoogleAds\\V3\\Services\352\002$Google::Ads::GoogleAds::V3::Services'),
serialized_pb=_b('\nNgoogle/ads/googleads_v3/proto/services/shopping_performance_view_service.proto\x12 google.ads.googleads.v3.services\x1aGgoogle/ads/googleads_v3/proto/resources/shopping_performance_view.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\"?\n!GetShoppingPerformanceViewRequest\x12\x1a\n\rresource_name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x32\xae\x02\n\x1eShoppingPerformanceViewService\x12\xee\x01\n\x1aGetShoppingPerformanceView\x12\x43.google.ads.googleads.v3.services.GetShoppingPerformanceViewRequest\x1a:.google.ads.googleads.v3.resources.ShoppingPerformanceView\"O\x82\xd3\xe4\x93\x02\x39\x12\x37/v3/{resource_name=customers/*/shoppingPerformanceView}\xda\x41\rresource_name\x1a\x1b\xca\x41\x18googleads.googleapis.comB\x8a\x02\n$com.google.ads.googleads.v3.servicesB#ShoppingPerformanceViewServiceProtoP\x01ZHgoogle.golang.org/genproto/googleapis/ads/googleads/v3/services;services\xa2\x02\x03GAA\xaa\x02 Google.Ads.GoogleAds.V3.Services\xca\x02 Google\\Ads\\GoogleAds\\V3\\Services\xea\x02$Google::Ads::GoogleAds::V3::Servicesb\x06proto3')
,
dependencies=[google_dot_ads_dot_googleads__v3_dot_proto_dot_resources_dot_shopping__performance__view__pb2.DESCRIPTOR,google_dot_api_dot_annotations__pb2.DESCRIPTOR,google_dot_api_dot_client__pb2.DESCRIPTOR,google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,])
_GETSHOPPINGPERFORMANCEVIEWREQUEST = _descriptor.Descriptor(
name='GetShoppingPerformanceViewRequest',
full_name='google.ads.googleads.v3.services.GetShoppingPerformanceViewRequest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='resource_name', full_name='google.ads.googleads.v3.services.GetShoppingPerformanceViewRequest.resource_name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=_b('\340A\002'), file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=277,
serialized_end=340,
)
DESCRIPTOR.message_types_by_name['GetShoppingPerformanceViewRequest'] = _GETSHOPPINGPERFORMANCEVIEWREQUEST
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
GetShoppingPerformanceViewRequest = _reflection.GeneratedProtocolMessageType('GetShoppingPerformanceViewRequest', (_message.Message,), dict(
DESCRIPTOR = _GETSHOPPINGPERFORMANCEVIEWREQUEST,
__module__ = 'google.ads.googleads_v3.proto.services.shopping_performance_view_service_pb2'
,
__doc__ = """Request message for
[ShoppingPerformanceViewService.GetShoppingPerformanceView][google.ads.googleads.v3.services.ShoppingPerformanceViewService.GetShoppingPerformanceView].
Attributes:
resource_name:
Required. The resource name of the Shopping performance view
to fetch.
""",
# @@protoc_insertion_point(class_scope:google.ads.googleads.v3.services.GetShoppingPerformanceViewRequest)
))
_sym_db.RegisterMessage(GetShoppingPerformanceViewRequest)
DESCRIPTOR._options = None
_GETSHOPPINGPERFORMANCEVIEWREQUEST.fields_by_name['resource_name']._options = None
_SHOPPINGPERFORMANCEVIEWSERVICE = _descriptor.ServiceDescriptor(
name='ShoppingPerformanceViewService',
full_name='google.ads.googleads.v3.services.ShoppingPerformanceViewService',
file=DESCRIPTOR,
index=0,
serialized_options=_b('\312A\030googleads.googleapis.com'),
serialized_start=343,
serialized_end=645,
methods=[
_descriptor.MethodDescriptor(
name='GetShoppingPerformanceView',
full_name='google.ads.googleads.v3.services.ShoppingPerformanceViewService.GetShoppingPerformanceView',
index=0,
containing_service=None,
input_type=_GETSHOPPINGPERFORMANCEVIEWREQUEST,
output_type=google_dot_ads_dot_googleads__v3_dot_proto_dot_resources_dot_shopping__performance__view__pb2._SHOPPINGPERFORMANCEVIEW,
serialized_options=_b('\202\323\344\223\0029\0227/v3/{resource_name=customers/*/shoppingPerformanceView}\332A\rresource_name'),
),
])
_sym_db.RegisterServiceDescriptor(_SHOPPINGPERFORMANCEVIEWSERVICE)
DESCRIPTOR.services_by_name['ShoppingPerformanceViewService'] = _SHOPPINGPERFORMANCEVIEWSERVICE
# @@protoc_insertion_point(module_scope)
| 53.267857 | 1,127 | 0.826852 | 702 | 5,966 | 6.702279 | 0.274929 | 0.065462 | 0.074389 | 0.089267 | 0.397237 | 0.346015 | 0.255048 | 0.231668 | 0.127524 | 0.103294 | 0 | 0.039308 | 0.070399 | 5,966 | 111 | 1,128 | 53.747748 | 0.809052 | 0.057492 | 0 | 0.116279 | 1 | 0.034884 | 0.458868 | 0.419516 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.104651 | 0 | 0.104651 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
89de59b92801ba07cf84ab98bf1071d2e2892971 | 311 | py | Python | Lists/In_Lists.py | obareau/python_travaux_pratiques | 2205f4c253e96e409b56f5c23d6e23387ab46524 | [
"MIT"
] | 1 | 2021-11-01T12:45:50.000Z | 2021-11-01T12:45:50.000Z | Lists/In_Lists.py | obareau/python_travaux_pratiques | 2205f4c253e96e409b56f5c23d6e23387ab46524 | [
"MIT"
] | null | null | null | Lists/In_Lists.py | obareau/python_travaux_pratiques | 2205f4c253e96e409b56f5c23d6e23387ab46524 | [
"MIT"
] | null | null | null | # Check if the value is in the list?
words = ['apple', 'banana', 'peach', '42']
if 'apple' in words:
print('found apple')
if 'a' in words:
print('found a')
else:
print('NOT found a')
if 42 in words:
print('found 42')
else:
print('NOT found 42')
# found apple
# NOT found a
# NOT found 42 | 16.368421 | 42 | 0.604502 | 52 | 311 | 3.615385 | 0.326923 | 0.170213 | 0.191489 | 0.271277 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042373 | 0.241158 | 311 | 19 | 43 | 16.368421 | 0.754237 | 0.228296 | 0 | 0.181818 | 0 | 0 | 0.309322 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.454545 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
89dfe3895be78648508f25f822750a4e38dd966a | 46,445 | py | Python | src/genesis_api_wrapper/catalogue.py | j-suchard/destatis-genesis-api | b0bbec0283ba41707d543b11e556ab0997e5f792 | [
"BSD-3-Clause"
] | null | null | null | src/genesis_api_wrapper/catalogue.py | j-suchard/destatis-genesis-api | b0bbec0283ba41707d543b11e556ab0997e5f792 | [
"BSD-3-Clause"
] | null | null | null | src/genesis_api_wrapper/catalogue.py | j-suchard/destatis-genesis-api | b0bbec0283ba41707d543b11e556ab0997e5f792 | [
"BSD-3-Clause"
] | null | null | null | import datetime
import typing
from . import enums, tools
class CatalogueAPIWrapper:
"""Methods for listing objects"""
def __init__(
self, username: str, password: str, language: enums.Language = enums.Language.GERMAN
):
"""Create a new Wrapper containing functions for listing different object types
:param username: The username which will be used for authenticating at the database. Due
to constraints of the database the username needs to be exactly 10 characters long and
may not contain any whitespaces
:type username: str
:param password: The password which will be used for authenticating at the database. Due
to constraints of the database the password needs to be at least 10 characters long,
may not exceed 20 characters and may not contain any whitespaces
:type password: str
:param language: The language in which the responses are returned by the database.
:py:enum:mem:`~genesis_api_wrapper.enums.Language.GERMAN` has the most compatibility
with the database
since most of the tables are on German. Therefore, this parameter defaults to
:py:enum:mem:`~genesis_api_wrapper.enums.Language.GERMAN`
:type language: enums.Language
:raise ValueError: The username or the password did not match the constraints stated in
their description.
"""
if " " in username:
raise ValueError("The username may not contain any whitespaces")
if len(username) != 10:
raise ValueError("The username may only be 10 characters long")
if " " in password:
raise ValueError("The password may not contain any whitespaces")
if len(password) < 10:
raise ValueError(
f"The password may not be shorter than 10 characters. Current "
f"length: {len(password)}"
)
if len(password) > 20:
raise ValueError(
f"The password may not be longer that 20 characters. Current "
f"length: {len(password)}"
)
self._username = username
self._password = password
self._language = language
self._service_url = "/catalogue"
self._base_parameter = {
"username": self._username,
"password": self._password,
"language": self._language.value,
}
async def cubes(
self,
object_name: str,
storage_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100,
) -> dict:
"""
**PREMIUM ACCESS REQUIRED**
List the datacubes matching the ``object_name``
:param object_name: The identifier code of the data cubes. The usage of an asterisk
(``*``) is permitted as wildcard
:type object_name: str
:param storage_location: The storage location of the object, defaults to
:py:enum:mem:`~genesis_api_wrapper.enums.ObjectStorage.ALL`
:type storage_location: enums.ObjectStorage, optional
:param result_count: The maximal amount of results which are returned by the database,
defaults to 100
:type result_count: int, optional
:return: The response from the database parsed into a dict. If the ``Content-Type``
header indicated a non-JSON response the response is stored in a temporary file and
the file path will be returned
:rtype: dict, os.PathLike
:raises exceptions.GENESISPermissionError: The supplied account does not have the
permissions to access data cubes.
:raises ValueError: One of the parameters does not contain a valid value. Please check
the message of the exception for further information
"""
if " " in object_name:
raise ValueError("The object_name parameter may not contain whitespaces")
if len(object_name) == 0:
raise ValueError("The object_name parameter may not be empty")
if len(object_name) > 10:
raise ValueError("The object_name parameter may not exceed 10 characters")
if type(storage_location) is not enums.ObjectStorage:
raise ValueError(
f"The storage_location parameter only accepts "
f"{repr(enums.ObjectStorage)} values"
)
if result_count < 1:
raise ValueError("The result_count parameter value may not be below 0")
if result_count > 2500:
raise ValueError("The result_count parameter value may not exceed 2500")
query_parameters = self._base_parameter | {
"selection": object_name,
"area": storage_location.value,
"pagelength": result_count,
}
query_path = self._service_url + "/cubes"
return await tools.get_database_response(query_path, query_parameters)
async def cubes2statistic(
self,
object_name: str,
cube_code: typing.Optional[str] = None,
storage_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100,
) -> dict:
"""
**PREMIUM ACCESS REQUIRED**
List the datacubes matching the ``object_name``
:param object_name: The identifier code of the statistic
:type object_name: str
:param cube_code: The identifier code of the cube. The usage of an asterisk
(``*``) is permitted as wildcard. This value acts as filter, only showing the data
cubes matching this code
:type cube_code: str, optional
:param storage_location: The storage location of the object, defaults to
:py:enum:mem:`~genesis_api_wrapper.enums.ObjectStorage.ALL`
:type storage_location: enums.ObjectStorage
:param result_count: The maximal amount of results which are returned by the database,
defaults to 100
:type result_count: int
:return: The response from the database parsed into a dict. If the ``Content-Type``
header indicated a non-JSON response the response is stored in a temporary file and
the file path will be returned
:rtype: dict, os.PathLike
:raises exceptions.GENESISPermissionError: The supplied account does not have the
permissions to access data cubes.
:raises ValueError: One of the parameters does not contain a valid value. Please check
the message of the exception for further information
"""
if " " in object_name:
raise ValueError("The object_name parameter may not contain whitespaces")
if "*" in object_name:
raise ValueError(
"The object_name parameter may not contain asterisks. Wildcards are "
"not permitted"
)
if len(object_name) == 0:
raise ValueError("The object_name parameter may not be empty")
if len(object_name) > 6:
raise ValueError("The object_name parameter may not exceed 6 characters")
if cube_code is not None and " " in cube_code:
raise ValueError("The cube_code parameter may not contain whitespaces")
if cube_code is not None and len(cube_code) == 0:
raise ValueError("The cube_code parameter may not be empty")
if cube_code is not None and len(cube_code) > 10:
raise ValueError("The cube_code parameter may not exceed 10 characters")
if type(storage_location) is not enums.ObjectStorage:
raise ValueError(
f"The storage_location parameter only accepts "
f"{repr(enums.ObjectStorage)} values"
)
if result_count < 1:
raise ValueError("The result_count parameter value may not be below 0")
if result_count > 2500:
raise ValueError("The result_count parameter value may not exceed 2500")
query_parameters = self._base_parameter | {
"name": object_name,
"selection": "" if cube_code is None else cube_code,
"area": storage_location.value,
"pagelength": result_count,
}
query_path = self._service_url + "/cubes2statistic"
return await tools.get_database_response(query_path, query_parameters)
async def cubes2variable(
self,
object_name: str,
cube_code: str,
storage_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100,
) -> dict:
"""
**PREMIUM ACCESS REQUIRED**
List the datacubes matching the ``object_name``
:param object_name: The identifier code of the variable
:type object_name: str
:param cube_code: The identifier code of the cube. The usage of an asterisk
(``*``) is permitted as wildcard. This value acts as filter, only showing the
data cubes matching this code
:type cube_code: str, optional
:param storage_location: The storage location of the object, defaults to
:py:enum:mem:`~genesis_api_wrapper.enums.ObjectStorage.ALL`
:type storage_location: enums.ObjectStorage
:param result_count: The maximal amount of results which are returned by the
database,
defaults to 100
:type result_count: int
:return: The response from the database parsed into a dict. If the ``Content-Type``
header indicated a non-JSON response the response is stored in a temporary
file and
the file path will be returned
:rtype: dict, os.PathLike
:raises exceptions.GENESISPermissionError: The supplied account does not have the
permissions to access data cubes.
:raises ValueError: One of the parameters does not contain a valid value. Please check
the message of the exception for further information
"""
if " " in object_name:
raise ValueError("The object_name parameter may not contain whitespaces")
if "*" in object_name:
raise ValueError(
"The object_name parameter may not contain asterisks. Wildcards are "
"not permitted"
)
if len(object_name) == 0:
raise ValueError("The object_name parameter may not be empty")
if len(object_name) > 6:
raise ValueError("The object_name parameter may not exceed 6 characters")
if cube_code is not None and " " in cube_code:
raise ValueError("The cube_code parameter may not contain whitespaces")
if cube_code is not None and len(cube_code) == 0:
raise ValueError("The cube_code parameter may not be empty")
if cube_code is not None and len(cube_code) > 10:
raise ValueError("The cube_code parameter may not exceed 10 characters")
if type(storage_location) is not enums.ObjectStorage:
raise ValueError(
f"The storage_location parameter only accepts "
f"{repr(enums.ObjectStorage)} values"
)
if result_count < 1:
raise ValueError("The result_count parameter value may not be below 0")
if result_count > 2500:
raise ValueError("The result_count parameter value may not exceed 2500")
query_parameters = self._base_parameter | {
"name": object_name,
"selection": "" if cube_code is None else cube_code,
"area": storage_location.value,
"pagelength": result_count,
}
query_path = self._service_url + "/cubes2variable"
return await tools.get_database_response(query_path, query_parameters)
async def jobs(
self,
object_name: str,
search_by: enums.JobCriteria,
sort_by: enums.JobCriteria,
job_type: enums.JobType = enums.JobType.ALL,
result_count: int = 100,
) -> dict:
"""
Get a list of the jobs that match the parameters
:param object_name: The identifier code of the job. The usage of an asterisk
(``*``) is permitted as wildcard. This value acts as filter, only showing the
jobs matching this code
:type object_name: str
:param search_by: Criteria which shall be applied to the object_name
:type search_by: enums.JobCriteria
:param sort_by: Criteria by which the output shall be sorted
:type sort_by: enums.JobCriteria
:param job_type: The type of jobs which shall be returned, defaults to
:py:enum:mem:`~genesis_api_wrapper.enums.JobType.ALL`
:type job_type: enums.JobType
:param result_count: The maximal amount of results which are returned by the
database, defaults to 100
:type result_count: int
:rtype: dict, os.PathLike
:raises exceptions.GENESISPermissionError: The supplied account does not have the
permissions to this resource.
:raises ValueError: One of the parameters does not contain a valid value. Please check
the message of the exception for further information
"""
if " " in object_name:
raise ValueError("The object_name parameter may not contain whitespaces")
if "*" in object_name:
raise ValueError(
"The object_name parameter may not contain asterisks. Wildcards are "
"not permitted"
)
if len(object_name) == 0:
raise ValueError("The object_name parameter may not be empty")
if len(object_name) > 50:
raise ValueError("The object_name parameter may not exceed 50 characters")
if type(search_by) is not enums.JobCriteria:
raise ValueError(
f"The search_by parameter only accepts values from the following enumeration: "
f"{repr(enums.JobCriteria)}"
)
if type(sort_by) is not enums.JobCriteria:
raise ValueError(
f"The sort_by parameter only accepts values from the following enumeration: "
f"{repr(enums.JobCriteria)}"
)
if type(job_type) is not enums.JobType:
raise ValueError(
f"The job_type parameter only accepts values from the following enumeration: "
f"{repr(enums.JobType)}"
)
if result_count < 1:
raise ValueError("The result_count parameter value may not be below 0")
if result_count > 2500:
raise ValueError("The result_count parameter value may not exceed 2500")
query_parameter = self._base_parameter | {
'selection': object_name,
'searchcriterion': search_by.value,
'sortcriterion': sort_by.value,
'type': job_type.value,
'pagelength': result_count
}
query_path = self._service_url + '/jobs'
return await tools.get_database_response(query_path, query_parameter)
async def modified_data(
self,
object_filter: str,
object_type: enums.ObjectType = enums.ObjectType.ALL,
updated_after: datetime.date = datetime.date.today() - datetime.timedelta(days=-7),
result_count: int = 100
) -> dict:
"""
**Due to an error in the database the parameter** ``result_count`` **is ignored by the
database**
Get a list of modified objects which were modified or uploaded after ``updated_after``.
The following objects are returned by this query:
- Tables
- Statistics
- Statistic updates
:param object_filter: The identifier code of the object. The usage of an asterisk
(``*``) is permitted as wildcard. This value acts as filter, only showing the
jobs matching this code
:type object_filter: str
:param object_type: The type of object that shall be listed
Allowed types (enums):
- :py:enum:mem:`~genesis_api_wrapper.enums.ObjectType.ALL`
- :py:enum:mem:`~genesis_api_wrapper.enums.ObjectType.TABLES`
- :py:enum:mem:`~genesis_api_wrapper.enums.ObjectType.STATISTICS`
- :py:enum:mem:`~genesis_api_wrapper.enums.ObjectType.STATISTIC_UPDATE`
:type object_type: enums.ObjectType
:param updated_after: The date after which the object needs to be modified or uploaded to
be returned by the database, defaults to 7 days before today
:type updated_after: datetime.date
:param result_count: The number of results that will be returned
:type result_count: int
"""
if " " in object_filter:
raise ValueError("The object_filter parameter may not contain whitespaces")
if len(object_filter) == 0:
raise ValueError("The object_filter parameter may not be empty")
if len(object_filter) > 50:
raise ValueError("The object_filter parameter may not exceed 50 characters")
if type(object_type) is not enums.ObjectType:
raise ValueError(
f"The object_type parameter only accepts values from the following enumeration: "
f"{repr(enums.ObjectType)}"
)
if object_type not in [enums.ObjectType.ALL, enums.ObjectType.TABLES,
enums.ObjectType.STATISTICS, enums.ObjectType.STATISTICS_UPDATE]:
raise ValueError(
f"The supplied object_type ({object_type}) is not allowed at this resource"
)
if updated_after > datetime.date.today():
raise ValueError(
f'The updated_after parameter is in the future'
)
# ==== Build the query data ====
query_path = self._service_url + '/modifieddata'
query_parameters = self._base_parameter | {
'selection': object_filter,
'type': object_type.value,
'date': tools.convert_date_to_string(updated_after),
'pagelength': result_count
}
# ==== Return the query data ====
return await tools.get_database_response(query_path, query_parameters)
async def quality_signs(self) -> dict:
"""
Get the list of quality signs from the database
:return: The Response containing the quality signs present in the database
:rtype: dict
"""
query_path = self._service_url + '/qualitysigns'
query_parameters = self._base_parameter
return await tools.get_database_response(query_path, query_parameters)
async def results(
self,
object_name: str,
storage_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100
) -> dict:
"""
Get a list of result tables matching the ``object_name``
:param object_name: The identifier code of the result tables. The usage of an asterisk
(``*``) is permitted as wildcard
:type object_name: str
:param storage_location: The storage location of the object, defaults to
:py:enum:mem:`~genesis_api_wrapper.enums.ObjectStorage.ALL`
:type storage_location: enums.ObjectStorage, optional
:param result_count: The maximal amount of results which are returned by the database,
defaults to 100
:type result_count: int, optional
:return: The response from the database parsed into a dict. If the ``Content-Type``
header indicated a non-JSON response the response is stored in a temporary file and
the file path will be returned
:rtype: dict, os.PathLike
:raises exceptions.GENESISPermissionError: The supplied account does not have the
permissions to access data cubes.
:raises ValueError: One of the parameters does not contain a valid value. Please check
the message of the exception for further information
"""
if " " in object_name:
raise ValueError("The object_name parameter may not contain whitespaces")
if len(object_name) == 0:
raise ValueError("The object_name parameter may not be empty")
if len(object_name) > 10:
raise ValueError("The object_name parameter may not exceed 10 characters")
if type(storage_location) is not enums.ObjectStorage:
raise ValueError(
f"The storage_location parameter only accepts "
f"{repr(enums.ObjectStorage)} values"
)
if result_count < 1:
raise ValueError("The result_count parameter value may not be below 0")
if result_count > 2500:
raise ValueError("The result_count parameter value may not exceed 2500")
# ==== Build the query path and parameters ====
query_path = self._service_url + '/results'
query_parameters = self._base_parameter | {
'selection': object_name,
'area': storage_location.value,
'pagelength': result_count
}
# ==== Get the response ====
return await tools.get_database_response(query_path, query_parameters)
async def statistics(
self,
object_name: str,
storage_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
search_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
sort_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
result_count: int = 100
) -> dict:
"""
Get a list of statistics matching the supplied code
:param object_name: The identifier code of the data cubes. The usage of an asterisk
(``*``) is permitted as wildcard
:type object_name: str
:param storage_location: The storage location of the object, defaults to
:py:enum:mem:`~genesis_api_wrapper.enums.ObjectStorage.ALL`
:type storage_location: enums.ObjectStorage, optional
:param search_by: Criteria which shall be applied to the ``object_name``, defaults to
:py:enum:mem:`~genesis_api_wrapper.enums.GenericCriteria.CODE`
:type search_by: enums.GenericCriteria, optional
:param sort_by: Criteria by which the result shall be sorted, defaults to
:py:enum:mem:`~genesis_api_wrapper.enums.GenericCriteria.CODE`
:type sort_by: enums.GenericCriteria, optional
:param result_count: The number of results that the response shall contain at it's maximum
:type result_count: int
:return: The response from the database parsed into a dict. If the ``Content-Type``
header indicated a non-JSON response the response is stored in a temporary file and
the file path will be returned
:rtype: dict, os.PathLike
:raises exceptions.GENESISPermissionError: The supplied account does not have the
permissions to access data cubes.
:raises ValueError: One of the parameters does not contain a valid value. Please check
the message of the exception for further information
"""
if " " in object_name:
raise ValueError("The object_name parameter may not contain whitespaces")
if len(object_name) == 0:
raise ValueError("The object_name parameter may not be empty")
if len(object_name) > 15:
raise ValueError("The object_name parameter may not exceed 15 characters")
if type(storage_location) is not enums.ObjectStorage:
raise ValueError(
f"The storage_location parameter only accepts "
f"{repr(enums.ObjectStorage)} values"
)
if type(search_by) is not enums.GenericCriteria:
raise ValueError(
f"The search_by parameter only accepts "
f"{repr(enums.GenericCriteria)} values"
)
if type(sort_by) is not enums.GenericCriteria:
raise ValueError(
f"The sort_by parameter only accepts "
f"{repr(enums.GenericCriteria)} values"
)
if result_count < 1:
raise ValueError("The result_count parameter value may not be below 0")
if result_count > 2500:
raise ValueError("The result_count parameter value may not exceed 2500")
# ==== Build query path and parameters ====
query_path = self._service_url + '/statistics'
query_parameters = self._base_parameter | {
'selection': object_name,
'searchcriterion': search_by.value,
'sortcriterion': sort_by.value,
'pagelength': result_count
}
return await tools.get_database_response(query_path, query_parameters)
async def statistics2variable(
self,
variable_name: str,
statistic_selector: str = None,
search_by: enums.StatisticCriteria = enums.StatisticCriteria.CODE,
sort_by: enums.StatisticCriteria = enums.StatisticCriteria.CODE,
object_area: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100,
):
"""Get a list of statistics which are referenced by the selected variable
:param variable_name: The name of the variable [required]
:type variable_name: str
:param statistic_selector: Filter for the statistics by the code of them, [optional,
stars allowed to wildcard, max. length 15]
:type statistic_selector: str
:param search_by: The field on which the code shall be applied, [optional, defaults
to `GENESISenums.StatisticCriteria.CODE`]
:type search_by: enums.StatisticCriteria
:param sort_by: The field by which the results are to be sorted, [optional, defaults
to `GENESISenums.StatisticCriteria.CODE`]
:type sort_by: enums.StatisticCriteria
:param object_area: The area in which the object is stored
:type object_area: enums.ObjectStorage
:param result_count: The number of results which are returned by the request
:type result_count: int
:return: The response returned by the server
"""
if variable_name is None:
raise ValueError("The variable name needs to be set to run a successful query")
if not 1 <= len(variable_name.strip()) <= 15:
raise ValueError("The variable names length needs to be between 1 and 15 signs")
if statistic_selector and not (1 <= len(statistic_selector.strip()) <= 15):
raise ValueError("The selectors length may not exceed 15 characters")
# Create the parameters object
_param = self._base_parameter | {
"name": variable_name,
"selection": "" if statistic_selector is None else statistic_selector,
"searchcriterion": search_by.value,
"sortcriterion": sort_by.value,
"pagelength": result_count,
"area": object_area.value,
}
_url = self._service_url + "/statistics2variable"
return await tools.get_database_response(_url, _param)
async def tables(
self,
table_selector: str,
object_area: enums.ObjectStorage = enums.ObjectStorage.ALL,
sort_by: enums.TableCriteria = enums.TableCriteria.CODE,
result_count: int = 100,
) -> dict:
"""Get a list of tables matching the selector from the selected object area
:param table_selector: The code of the table [required, stars (*) allowed for wildcards]
:param object_area: The area in which the table is stored [defaults to ALL]
:param sort_by: The criteria by which the results shall be sorted [defaults to CODE]
:param result_count: The number of results that shall be returned
:return: A list of tables matching the request
"""
if table_selector and not (1 <= len(table_selector.strip()) <= 15):
raise ValueError(
"The table selector needs to be at least 1 character and max 15 " "characters"
)
_param = self._base_parameter | {
"selection": table_selector,
"area": object_area.value,
"searchcriterion": "Code",
"sortcriterion": sort_by.value,
"pagelength": result_count,
}
_url = self._service_url + "/tables"
return await tools.get_database_response(_url, _param)
async def tables2statistics(
self,
statistics_name: str,
table_selector: str = None,
object_area: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100,
) -> dict:
"""Get a list of tables matching the table selector which are assigned to the
:param statistics_name: Name of the statistic [required, 1-15 characters]
:param table_selector: Filter for the tables code [optional, wildcards allowed]
:param object_area: The location of the statistic/tables
:param result_count: The number of tables in the response
:return:
"""
if statistics_name is None:
raise ValueError("The name of the statistic is required to get the tables")
if not 1 <= len(statistics_name.strip()) <= 15:
raise ValueError("The length of the statistics name needs to be between 1 and 15")
if table_selector and not (1 <= len(table_selector.strip()) <= 15):
raise ValueError(
"The table selector needs to be at least 1 character and max 15 " "characters"
)
_param = self._base_parameter | {
"name": statistics_name,
"selection": table_selector,
"area": object_area.value,
"pagelength": result_count,
}
_url = self._service_url + "/tables2statistic"
return await tools.get_database_response(_url, _param)
async def tables2variable(
self,
variable_name: str,
table_selector: str = None,
object_area: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100,
) -> dict:
"""Get a list of tables matching the table selector which are assigned to the
:param variable_name: Name of the statistic [required, 1-15 characters]
:param table_selector: Filter for the tables code [optional, wildcards allowed]
:param object_area: The location of the statistic/tables
:param result_count: The number of tables in the response
:return:
"""
if variable_name is None:
raise ValueError("The name of the statistic is required to get the tables")
if not 1 <= len(variable_name) <= 15:
raise ValueError("The length of the statistics name needs to be between 1 and 15")
if table_selector and not (1 <= len(table_selector.strip()) <= 15):
raise ValueError(
"The table selector needs to be at least 1 character and max 15 " "characters"
)
_param = self._base_parameter | {
"name": variable_name,
"selection": table_selector,
"area": object_area.value,
"pagelength": result_count,
}
_url = self._service_url + "/tables2variable"
return await tools.get_database_response(_url, _param)
async def terms(self, term_selector: str, result_count: int = 100):
"""Get a list of terms according to the selector
:param term_selector: The selector for the terms [required, wildcards allowed]
:param result_count: The number of terms which shall be returned
:return: The parsed response from the server
"""
if term_selector is None:
raise ValueError("The selector for the terms is a required parameter")
if not 1 <= len(term_selector.strip()) <= 15:
raise ValueError("The length of the selector needs to be between 1 and 15")
_param = self._base_parameter | {"selection": term_selector, "pagelength": result_count}
_url = self._service_url + "/terms"
return await tools.get_database_response(_url, _param)
async def timeseries(
self,
timeseries_selector: str,
object_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100,
) -> dict:
"""Get a list of timeseries according to the selector and the location of the object
:param timeseries_selector: The selector for the timeseries [required, wildcards
allowed]
:param object_location: The area in which the object is stored [default:
``enums.ObjectStorage.ALL``]
:param result_count: The number of results that shall be returned
:return: The list of found timeseries
"""
if timeseries_selector is None:
raise ValueError("The selector is required for a successful database request")
if not 1 <= len(timeseries_selector.strip()) <= 15:
raise ValueError(
"The length of the selector needs to be between 1 and 15 " "characters"
)
_param = self._base_parameter | {
"selection": timeseries_selector,
"area": object_location.value,
"pagelength": result_count,
}
_url = self._service_url + "/timeseries"
return await tools.get_database_response(_url, _param)
async def timeseries2statistic(
self,
statistic_name: str,
timeseries_selector: typing.Optional[str] = None,
object_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100,
):
"""Get a list of timeseries which are related to the selected statistic
:param statistic_name: Code of the statistic [required, length: 1-15 characters]
:param timeseries_selector: Filter for the timeseries by their code [optional,
wildcards allowed]
:param object_location: The storage location of the object
:param result_count: The number of results that shall be returned
:return: A response containing the list of timeseries which match the supplied
parameters
"""
if statistic_name is None:
raise ValueError("The name of the statistic is a required parameter")
if timeseries_selector and not (1 <= len(timeseries_selector.strip()) <= 15):
raise ValueError(
"If a timeseries_selector is supplied its length may not exceed " "15 characters"
)
# Build the query parameters
param = self._base_parameter | {
"name": statistic_name,
"selection": "" if timeseries_selector is None else timeseries_selector,
"area": object_location.value,
"pagelength": result_count,
}
url = self._service_url + "/timeseries2statistic"
return await tools.get_database_response(url, param)
async def timeseries2variable(
self,
variable_name: str,
timeseries_selector: typing.Optional[str] = None,
object_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
result_count: int = 100,
) -> dict:
"""Get a list of timeseries which are related to the specified variable
:param variable_name: The code of the variable [required]
:param timeseries_selector: A filter for the returned timeseries [optional, wildcards
allowed]
:param object_location: The storage location in which the search shall be executed [
optional, defaults to ``enums.ObjectStorage.ALL``]
:param result_count: The number of results that shall be returned
:return: A parsed response containing the list of timeseries, if any were found
"""
if variable_name is None:
raise ValueError("The variable_name is a required parameter")
if not (1 <= len(variable_name.strip()) <= 15):
raise ValueError("The length of the variable name may not exceed 15 characters")
if timeseries_selector and not (1 <= len(timeseries_selector.strip()) <= 15):
raise ValueError(
"If a timeseries_selector is supplied its length may not exceed " "15 characters"
)
# Build the query parameters
_query_parameter = self._base_parameter | {
"name": variable_name,
"selection": "" if timeseries_selector is None else timeseries_selector,
"area": object_location.value,
"pagelength": result_count,
}
_url = self._service_url + "/timeseries2variable"
return await tools.get_database_response(_url, _query_parameter)
async def values(
self,
value_filter: str,
object_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
search_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
sort_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
result_count: int = 100,
) -> dict:
"""Get a list of values specified by the filter
:param value_filter: The filter for the value identifications [optional, wildcards
allowed]
:param object_location: The storage location which shall be used during the search [
optional, defaults to ``GenericCriteria.CODE``]
:param search_by: The criteria which is used in combination to the value_filter [
optional, defaults to ``GenericCriteria.CODE``]
:param sort_by: The criteria by which the results are sorted [optional, defaults to
``GenericCriteria.CODE``]
:param result_count: The number of results returned
:return: A parsed response containing the list of values
"""
# Check the received variables
if value_filter is None:
raise ValueError("The value_filter is a required parameter")
if not 1 <= len(value_filter.strip()) <= 15:
raise ValueError(
"The length of the value_filter needs to be at least 1 character "
"and may not exceed 15 characters"
)
if not 1 <= result_count <= 2500:
raise ValueError(
"The number of results returned needs to be greater than 1, "
"but may not exceed 2500"
)
# Build the query parameters
params = self._base_parameter | {
"selection": value_filter,
"area": object_location.value,
"searchcriterion": search_by.value,
"sortcriterion": sort_by.value,
"pagelength": result_count,
}
_url = self._service_url + "/values"
return await tools.get_database_response(_url, params)
async def values2variable(
self,
variable_name: str,
value_filter: typing.Optional[str] = None,
object_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
search_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
sort_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
result_count: int = 100,
) -> dict:
"""Get a list of characteristic values for the supplied variable
:param variable_name: The code of the variable
:param value_filter: A filter for the returned values [optional, wildcards allowed]
:param object_location: The storage location of the variable
:param search_by: Criteria which is applied to the ``value_filter``
:param sort_by: Criteria which is used to sort the results
:param result_count: The number of characteristic values which may be returned
:return: A parsed response from the server containing the list of characteristic values
"""
# Check if the variable name is set correctly
if not variable_name or len(variable_name.strip()) == 0:
raise ValueError("The variable_name is a required parameter and may not be empty")
if not (1 <= len(variable_name.strip()) <= 15):
raise ValueError(
"The length of the variable_name may not exceed 15 characters "
"and may not be below 1 character"
)
if "*" in variable_name:
raise ValueError("The variable_name may not contain any wildcards (*)")
# Check the value filter
if value_filter and not (1 <= len(value_filter.strip()) <= 15):
raise ValueError(
"The length of the value_filter may not exceed 15 characters and "
"may not be below 1"
)
# Check the number of results returned
if not 1 <= result_count <= 2500:
raise ValueError(
"The number of results returned needs to be greater than 1, "
"but may not exceed 2500"
)
# Create the query parameter
_param = self._base_parameter | {
"name": variable_name,
"selection": value_filter,
"area": object_location.value,
"searchcriterion": search_by.value,
"sortcriterion": sort_by.value,
"pagelength": result_count,
}
# Build the url for the call
_url = self._service_url + "/values2variable"
# Make the call and await the response
return await tools.get_database_response(_url, _param)
async def variables(
self,
variable_filter: str,
object_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
search_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
sort_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
variable_type: enums.VariableType = enums.VariableType.ALL,
result_count: int = 100,
) -> dict:
"""Get a list of variables matching the filter and object location
:param variable_filter: Identification Code of the variable [required, wildcards
allowed]
:param object_location: The storage location of the object [optional]
:param search_by: Criteria which is applied to the variable filter [optional]
:param sort_by: Criteria by which the result is sorted [optional]
:param variable_type: The type of variable [optional]
:param result_count: The number of results that may be returned [optional]
:return: A parsed response from the server containing the variables
"""
# Check if the filter is supplied correctly
if not variable_filter or len(variable_filter.strip()) == 0:
raise ValueError("The variable_filter is a required parameter any may not be empty")
if not (1 <= len(variable_filter.strip()) <= 6):
raise ValueError("The variable_filter may only contain up to 6 characters")
# Check if the result count is set properly
if not (1 <= result_count <= 2500):
raise ValueError("The number of possible results needs to be between 1 and 2500")
# Build the query parameters
_param = self._base_parameter | {
"selection": variable_filter,
"area": object_location.value,
"searchcriterion": search_by.value,
"sortcriterion": sort_by.value,
"type": variable_type.value,
"pagelength": result_count,
}
# Build the url
_url = self._service_url + "/variables"
# Return the parsed result
return await tools.get_database_response(_url, _param)
async def variables2statistic(
self,
statistic_name: str,
variable_filter: typing.Optional[str] = None,
object_location: enums.ObjectStorage = enums.ObjectStorage.ALL,
search_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
sort_by: enums.GenericCriteria = enums.GenericCriteria.CODE,
variable_type: enums.VariableType = enums.VariableType.ALL,
result_count: int = 100,
) -> dict:
"""Get a list of variables related to the supplied statistic
:param statistic_name: The identification of the statistic [required]
:param variable_filter: Filter for the returned variables [optional, wildcards allowed]
:param object_location: Storage location which is used for the search [optional]
:param search_by: Criteria which is applied to the variable_filter [optional]
:param sort_by: Criteria specifying how the results are to be sorted [optional]
:param variable_type: The type of variables that shall be returned [optional]
:param result_count: Max. amount of results returned by the server [optional]
:return: A parsed response containing a list of variables
"""
# Check if the statistic_name is set correctly
if not statistic_name or len(statistic_name.strip()) == 0:
raise ValueError("The statistic_name is a required parameter")
if not (1 <= len(statistic_name.strip()) <= 15):
raise ValueError("The length of statistic_name may not exceed 15 characters")
if "*" in statistic_name:
raise ValueError("The statistic_name may not contain wildcards (*)")
# Check if the variable_filter is set correctly if set
if variable_filter and not (1 <= len(variable_filter.strip()) <= 6):
raise ValueError(
"The variable_filter may not exceed the length of 6 characters, "
"if it is supplied"
)
# Build the query parameters
_param = self._base_parameter | {
"name": statistic_name,
"selection": variable_filter,
"area": object_location.value,
"searchcriterion": search_by.value,
"sortcriterion": sort_by.value,
"type": variable_type.value,
"pagelength": result_count,
}
# Build the query path
_path = self._service_url + "/variables2statistic"
return await tools.get_database_response(_path, _param)
| 48.53187 | 98 | 0.636279 | 5,545 | 46,445 | 5.199279 | 0.054644 | 0.049428 | 0.048699 | 0.019979 | 0.789213 | 0.754873 | 0.725945 | 0.693548 | 0.654527 | 0.604579 | 0 | 0.010737 | 0.294111 | 46,445 | 956 | 99 | 48.582636 | 0.868629 | 0.040844 | 0 | 0.603774 | 0 | 0 | 0.240723 | 0.01111 | 0 | 0 | 0 | 0 | 0 | 1 | 0.001715 | false | 0.018868 | 0.005146 | 0 | 0.042882 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
89e28e497194558b332c7d2514764dab8aee4b55 | 813 | py | Python | src/openweather/OpenWeatherParser.py | ralfe/wpi | ee077fb9fd1b2e8759e6195b3c36f24848eea6f5 | [
"MIT"
] | null | null | null | src/openweather/OpenWeatherParser.py | ralfe/wpi | ee077fb9fd1b2e8759e6195b3c36f24848eea6f5 | [
"MIT"
] | null | null | null | src/openweather/OpenWeatherParser.py | ralfe/wpi | ee077fb9fd1b2e8759e6195b3c36f24848eea6f5 | [
"MIT"
] | null | null | null | __author__ = 'renderle'
class OpenWeatherParser:
def __init__(self, data):
self.data = data
def getValueFor(self, idx):
return self.data['list'][idx]
def getTemperature(self):
earlymorningValue = self.getValueFor(0)['main']['temp_max']
morningValue = self.getValueFor(1)['main']['temp_max']
mixedTemp = (earlymorningValue + 2*morningValue)/3
return mixedTemp;
def getCloudFactor(self):
earlymorningValue = self.getValueFor(0)['clouds']['all']
morningValue = self.getValueFor(1)['clouds']['all']
mixedCloudFactor = (earlymorningValue + 3*morningValue)/4
return mixedCloudFactor
def getOverallWeatherCondition(self):
morningValue = self.getValueFor(1)['weather'][0]['id']
return morningValue
| 30.111111 | 67 | 0.654367 | 78 | 813 | 6.692308 | 0.397436 | 0.143678 | 0.155172 | 0.16092 | 0.141762 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015699 | 0.216482 | 813 | 26 | 68 | 31.269231 | 0.803768 | 0 | 0 | 0 | 0 | 0 | 0.077586 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0 | 0.052632 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d612e925c123019a0812dc8cafaa3b8e961aa72d | 863 | py | Python | venv/lib/python3.6/site-packages/taggit_templatetags2/views.py | corwin-cole/lunas-picture-box | af0870bea27b01abdd64260bc4e0d40423580fb2 | [
"MIT"
] | 38 | 2015-01-06T16:38:47.000Z | 2022-03-28T12:55:25.000Z | venv/lib/python3.6/site-packages/taggit_templatetags2/views.py | corwin-cole/lunas-picture-box | af0870bea27b01abdd64260bc4e0d40423580fb2 | [
"MIT"
] | 12 | 2020-06-06T01:22:26.000Z | 2022-03-12T00:13:42.000Z | venv/lib/python3.6/site-packages/taggit_templatetags2/views.py | corwin-cole/lunas-picture-box | af0870bea27b01abdd64260bc4e0d40423580fb2 | [
"MIT"
] | 16 | 2015-02-21T22:31:41.000Z | 2022-03-28T12:55:28.000Z | from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView
from .settings import TAGGED_ITEM_MODEL, TAG_MODEL
class TagCanvasListView(ListView):
template_name = 'taggit_templatetags2/tagcanvas_list.html'
model = TAGGED_ITEM_MODEL
def get_tag_id(self):
return int(self.kwargs['tag_id'])
def get_tag_object(self):
return TAG_MODEL.objects.get(id=self.get_tag_id())
def get_queryset(self):
"""
Returns only the objects assigned to single tag.
"""
return self.model._default_manager.filter(
tag_id=self.get_tag_id())
def get_context_data(self, **kwargs):
context = super(TagCanvasListView, self).get_context_data(**kwargs)
context['tag'] = self.get_tag_object()
return context
| 26.96875 | 75 | 0.699884 | 113 | 863 | 5.079646 | 0.424779 | 0.052265 | 0.041812 | 0.057491 | 0.069686 | 0.069686 | 0.069686 | 0 | 0 | 0 | 0 | 0.001464 | 0.208575 | 863 | 31 | 76 | 27.83871 | 0.838946 | 0.05562 | 0 | 0 | 0 | 0 | 0.062025 | 0.050633 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0.111111 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d65aaf4c15566afc36462d10778530ebc31a672f | 1,544 | py | Python | alipay/aop/api/response/AlipayOpenAppQrcodeCreateResponse.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/response/AlipayOpenAppQrcodeCreateResponse.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/response/AlipayOpenAppQrcodeCreateResponse.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenAppQrcodeCreateResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenAppQrcodeCreateResponse, self).__init__()
self._qr_code_url = None
self._qr_code_url_circle_blue = None
self._qr_code_url_circle_white = None
@property
def qr_code_url(self):
return self._qr_code_url
@qr_code_url.setter
def qr_code_url(self, value):
self._qr_code_url = value
@property
def qr_code_url_circle_blue(self):
return self._qr_code_url_circle_blue
@qr_code_url_circle_blue.setter
def qr_code_url_circle_blue(self, value):
self._qr_code_url_circle_blue = value
@property
def qr_code_url_circle_white(self):
return self._qr_code_url_circle_white
@qr_code_url_circle_white.setter
def qr_code_url_circle_white(self, value):
self._qr_code_url_circle_white = value
def parse_response_content(self, response_content):
response = super(AlipayOpenAppQrcodeCreateResponse, self).parse_response_content(response_content)
if 'qr_code_url' in response:
self.qr_code_url = response['qr_code_url']
if 'qr_code_url_circle_blue' in response:
self.qr_code_url_circle_blue = response['qr_code_url_circle_blue']
if 'qr_code_url_circle_white' in response:
self.qr_code_url_circle_white = response['qr_code_url_circle_white']
| 33.565217 | 106 | 0.729275 | 214 | 1,544 | 4.733645 | 0.168224 | 0.159921 | 0.239882 | 0.266535 | 0.616979 | 0.444225 | 0.284304 | 0 | 0 | 0 | 0 | 0.000807 | 0.197539 | 1,544 | 45 | 107 | 34.311111 | 0.816788 | 0.027202 | 0 | 0.088235 | 0 | 0 | 0.077333 | 0.062667 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.058824 | 0.088235 | 0.411765 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c3dafcd023eb4196e2c03de73e78ae172fc56c0a | 105 | py | Python | fastapi version/src/fastapp/__init__.py | abhiWriteCode/TextSummarization | e2ed2dddc6afaa5a5106cfda19a3bd8d520f63a4 | [
"MIT"
] | null | null | null | fastapi version/src/fastapp/__init__.py | abhiWriteCode/TextSummarization | e2ed2dddc6afaa5a5106cfda19a3bd8d520f63a4 | [
"MIT"
] | null | null | null | fastapi version/src/fastapp/__init__.py | abhiWriteCode/TextSummarization | e2ed2dddc6afaa5a5106cfda19a3bd8d520f63a4 | [
"MIT"
] | null | null | null | from fastapi import FastAPI
from . import api
app = FastAPI(debug=True)
app.include_router(api.router) | 15 | 30 | 0.780952 | 16 | 105 | 5.0625 | 0.5625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 105 | 7 | 30 | 15 | 0.89011 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7f02e9703a47b60d920bf5b4d7b9b607bc976036 | 96 | py | Python | struct2seq/__init__.py | amorehead/neurips19-graph-protein-design | 92ecd0b667069c3207afa668865eb23eea4631d4 | [
"MIT"
] | null | null | null | struct2seq/__init__.py | amorehead/neurips19-graph-protein-design | 92ecd0b667069c3207afa668865eb23eea4631d4 | [
"MIT"
] | null | null | null | struct2seq/__init__.py | amorehead/neurips19-graph-protein-design | 92ecd0b667069c3207afa668865eb23eea4631d4 | [
"MIT"
] | null | null | null | __all__ = ['data', 'noam_opt', 'protein_features', 'self_attention', 'struct2seq', 'seq_model']
| 48 | 95 | 0.708333 | 11 | 96 | 5.454545 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011364 | 0.083333 | 96 | 1 | 96 | 96 | 0.670455 | 0 | 0 | 0 | 0 | 0 | 0.635417 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7f1013721896a66800cbfdbbd69ac5bfb01f2332 | 47 | py | Python | pytype/__version__.py | jjedele/pytype | 3c5d920d26ac583bdfd68080e7db454ecb1dc900 | [
"Apache-2.0"
] | null | null | null | pytype/__version__.py | jjedele/pytype | 3c5d920d26ac583bdfd68080e7db454ecb1dc900 | [
"Apache-2.0"
] | null | null | null | pytype/__version__.py | jjedele/pytype | 3c5d920d26ac583bdfd68080e7db454ecb1dc900 | [
"Apache-2.0"
] | null | null | null | # pylint: skip-file
__version__ = '2018.12.21'
| 15.666667 | 26 | 0.702128 | 7 | 47 | 4.142857 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195122 | 0.12766 | 47 | 2 | 27 | 23.5 | 0.512195 | 0.361702 | 0 | 0 | 0 | 0 | 0.357143 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7f102b5952e499b7df63927d1e17dfc99e397355 | 291 | py | Python | keybindings/autokey/data/Mac/refresh.py | guoyiteng/linux-for-macos-user | 705baec9ddffb9ab73172cdc2b272ab123b1e402 | [
"MIT"
] | 1 | 2019-10-24T19:52:23.000Z | 2019-10-24T19:52:23.000Z | keybindings/autokey/data/Mac/refresh.py | guoyiteng/linux-for-macos-user | 705baec9ddffb9ab73172cdc2b272ab123b1e402 | [
"MIT"
] | null | null | null | keybindings/autokey/data/Mac/refresh.py | guoyiteng/linux-for-macos-user | 705baec9ddffb9ab73172cdc2b272ab123b1e402 | [
"MIT"
] | null | null | null | store.set_global_value('hotkey', '<meta>+r')
if re.match('.*(Hyper)', window.get_active_class()):
logging.debug('terminal refresh buffer')
engine.set_return_value('<ctrl>+<shift>+r')
else:
logging.debug('normal')
engine.set_return_value('<ctrl>+r')
engine.run_script('combo') | 36.375 | 52 | 0.697595 | 41 | 291 | 4.731707 | 0.707317 | 0.123711 | 0.154639 | 0.206186 | 0.247423 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09622 | 291 | 8 | 53 | 36.375 | 0.737643 | 0 | 0 | 0 | 0 | 0 | 0.277397 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7f191b51e43f5f96fe4666dba8c6b32532e8c659 | 581 | py | Python | neighbour/forms.py | Nobella-Nyarari-Ejiofor/Neighbourood | cacd9d64c944fa195a4bcb554425c9d0210b87b8 | [
"PostgreSQL",
"Unlicense"
] | null | null | null | neighbour/forms.py | Nobella-Nyarari-Ejiofor/Neighbourood | cacd9d64c944fa195a4bcb554425c9d0210b87b8 | [
"PostgreSQL",
"Unlicense"
] | null | null | null | neighbour/forms.py | Nobella-Nyarari-Ejiofor/Neighbourood | cacd9d64c944fa195a4bcb554425c9d0210b87b8 | [
"PostgreSQL",
"Unlicense"
] | null | null | null | from django.contrib.auth.models import User
from django import forms
import neighbour
from .models import Business, Profile , Neighbourhood , Posts
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
exclude = ['user']
class NeighbourhoodForm(forms.ModelForm):
class Meta:
model = Neighbourhood
exclude = ['occupants_count']
class PostForm(forms.ModelForm):
class Meta:
model = Posts
exclude= ['profile','neighbourhood']
class BusinessForm(forms.ModelForm):
class Meta:
model = Business
exclude =['profile', 'neighbourhood'] | 23.24 | 61 | 0.726334 | 63 | 581 | 6.68254 | 0.380952 | 0.133017 | 0.180523 | 0.218527 | 0.266033 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175559 | 581 | 25 | 62 | 23.24 | 0.878914 | 0 | 0 | 0.3 | 0 | 0 | 0.101375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6156a185a0ec9e2713a8896fbea860c9a2788539 | 2,069 | py | Python | test/teos/unit/test_extended_appointment.py | ritikramuka/python-teos | daa9d8dc89d5ddc3f29f2b7b2dda05bf0c79c82d | [
"MIT"
] | 86 | 2020-03-20T23:58:40.000Z | 2022-02-27T11:25:11.000Z | test/teos/unit/test_extended_appointment.py | sr-gi/python-teos | f8f214125a2f7c82fed278dc21ee5d517e7de72a | [
"MIT"
] | 160 | 2020-03-23T16:31:51.000Z | 2022-03-05T13:22:21.000Z | test/teos/unit/test_extended_appointment.py | sr-gi/python-teos | f8f214125a2f7c82fed278dc21ee5d517e7de72a | [
"MIT"
] | 17 | 2020-03-21T10:28:37.000Z | 2022-02-23T12:22:00.000Z | import pytest
from teos.extended_appointment import ExtendedAppointment
@pytest.fixture
def ext_appointment_data(generate_dummy_appointment):
return generate_dummy_appointment().to_dict()
# Parent methods are not tested.
def test_init_ext_appointment(ext_appointment_data):
# The appointment has no checks whatsoever, since the inspector is the one taking care or that, and the only one
# creating appointments.
ext_appointment = ExtendedAppointment(
ext_appointment_data["locator"],
ext_appointment_data["encrypted_blob"],
ext_appointment_data["to_self_delay"],
ext_appointment_data["user_id"],
ext_appointment_data["user_signature"],
ext_appointment_data["start_block"],
)
assert (
ext_appointment_data["locator"] == ext_appointment.locator
and ext_appointment_data["to_self_delay"] == ext_appointment.to_self_delay
and ext_appointment_data["encrypted_blob"] == ext_appointment.encrypted_blob
and ext_appointment_data["user_id"] == ext_appointment.user_id
and ext_appointment_data["user_signature"] == ext_appointment.user_signature
and ext_appointment_data["start_block"] == ext_appointment.start_block
)
def test_get_summary(ext_appointment_data):
assert ExtendedAppointment.from_dict(ext_appointment_data).get_summary() == {
"locator": ext_appointment_data["locator"],
"user_id": ext_appointment_data["user_id"],
}
def test_from_dict(ext_appointment_data):
# The appointment should be build if we don't miss any field
ext_appointment = ExtendedAppointment.from_dict(ext_appointment_data)
assert isinstance(ext_appointment, ExtendedAppointment)
# Otherwise it should fail
for key in ext_appointment_data.keys():
prev_val = ext_appointment_data[key]
ext_appointment_data[key] = None
with pytest.raises(ValueError, match="Wrong appointment data"):
ExtendedAppointment.from_dict(ext_appointment_data)
ext_appointment_data[key] = prev_val
| 36.946429 | 116 | 0.744804 | 253 | 2,069 | 5.703557 | 0.312253 | 0.33957 | 0.31185 | 0.07623 | 0.449757 | 0.365211 | 0.2079 | 0.059598 | 0 | 0 | 0 | 0 | 0.17593 | 2,069 | 55 | 117 | 37.618182 | 0.846334 | 0.119865 | 0 | 0 | 1 | 0 | 0.100275 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.111111 | false | 0 | 0.055556 | 0.027778 | 0.194444 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
61ba3d50811169b0b9f01a141d232b991d2868ad | 457 | py | Python | arranging.py | mallimuondu/Algorithims | 9e2ff15ab87c56a38aba18d0e31999e12c9a317e | [
"MIT"
] | null | null | null | arranging.py | mallimuondu/Algorithims | 9e2ff15ab87c56a38aba18d0e31999e12c9a317e | [
"MIT"
] | null | null | null | arranging.py | mallimuondu/Algorithims | 9e2ff15ab87c56a38aba18d0e31999e12c9a317e | [
"MIT"
] | null | null | null | input1 = int(input("Enter the first number: "))
input2 = int(input("Enter the second number: "))
input3 = int(input("Enter the third number: "))
input4 = int(input("Enter the fourth number: "))
input5 = int(input("Enter the fifth number: "))
tuple_num = []
tuple_num.append(input1)
tuple_num.append(input2)
tuple_num.append(input3)
tuple_num.append(input4)
tuple_num.append(input5)
print(tuple_num)
tuple_num.sort()
for a in tuple_num:
print(a * a) | 30.466667 | 49 | 0.722101 | 71 | 457 | 4.521127 | 0.323944 | 0.224299 | 0.202492 | 0.249221 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025189 | 0.131291 | 457 | 15 | 50 | 30.466667 | 0.783375 | 0 | 0 | 0 | 0 | 0 | 0.277293 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.133333 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f60c351db3d540f17c4848153f58c4bf3898b80c | 241 | py | Python | infrastructure-dashboard/nccid-redirect/lambda/lambda-handler.py | uk-gov-mirror/NHSX.covid-chest-imaging-database | 77799a97193d09e9267182d18fbb79d604bbb038 | [
"MIT"
] | 56 | 2020-04-08T12:40:28.000Z | 2021-10-02T22:57:16.000Z | infrastructure-dashboard/nccid-redirect/lambda/lambda-handler.py | uk-gov-mirror/NHSX.covid-chest-imaging-database | 77799a97193d09e9267182d18fbb79d604bbb038 | [
"MIT"
] | 111 | 2020-04-02T13:23:06.000Z | 2022-03-30T13:23:28.000Z | infrastructure-dashboard/nccid-redirect/lambda/lambda-handler.py | uk-gov-mirror/NHSX.covid-chest-imaging-database | 77799a97193d09e9267182d18fbb79d604bbb038 | [
"MIT"
] | 10 | 2020-05-05T14:07:11.000Z | 2022-01-11T15:47:27.000Z | def handler(event, context):
return {
"statusCode": 302,
"headers": {
"Location": "https://www.nhsx.nhs.uk/covid-19-response/data-and-covid-19/national-covid-19-chest-imaging-database-nccid/"
},
}
| 30.125 | 133 | 0.589212 | 28 | 241 | 5.071429 | 0.857143 | 0.147887 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048913 | 0.236515 | 241 | 7 | 134 | 34.428571 | 0.722826 | 0 | 0 | 0 | 0 | 0.142857 | 0.547718 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0.142857 | 0.285714 | 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 | 0 | 0 | 0 | 3 |
f620b14338e61be682d35b0543506d9c7f9a1c6d | 905 | py | Python | manim/utils/unit.py | PhotonSpheres/manim | 7399c24b33095e29633fd75460d13eae5703cba9 | [
"MIT"
] | 9,497 | 2020-05-19T04:05:51.000Z | 2022-03-31T19:00:02.000Z | manim/utils/unit.py | PhotonSpheres/manim | 7399c24b33095e29633fd75460d13eae5703cba9 | [
"MIT"
] | 2,052 | 2020-05-19T03:35:26.000Z | 2022-03-31T16:18:06.000Z | manim/utils/unit.py | PhotonSpheres/manim | 7399c24b33095e29633fd75460d13eae5703cba9 | [
"MIT"
] | 1,016 | 2020-05-20T01:16:11.000Z | 2022-03-30T16:47:14.000Z | """Implement the Unit class."""
import numpy as np
from .. import config, constants
__all__ = ["Pixels", "Degrees", "Munits", "Percent"]
class _PixelUnits:
def __mul__(self, val):
return val * config.frame_width / config.pixel_width
def __rmul__(self, val):
return val * config.frame_width / config.pixel_width
class Percent:
def __init__(self, axis):
if np.array_equal(axis, constants.X_AXIS):
self.length = config.frame_width
if np.array_equal(axis, constants.Y_AXIS):
self.length = config.frame_height
if np.array_equal(axis, constants.Z_AXIS):
raise NotImplementedError("length of Z axis is undefined")
def __mul__(self, val):
return val / 100 * self.length
def __rmul__(self, val):
return val / 100 * self.length
Pixels = _PixelUnits()
Degrees = constants.PI / 180
Munits = 1
| 24.459459 | 70 | 0.653039 | 117 | 905 | 4.726496 | 0.384615 | 0.050633 | 0.094033 | 0.115732 | 0.562387 | 0.471971 | 0.278481 | 0.173599 | 0.173599 | 0.173599 | 0 | 0.014577 | 0.241989 | 905 | 36 | 71 | 25.138889 | 0.791545 | 0.027624 | 0 | 0.347826 | 0 | 0 | 0.062929 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0.086957 | 0.173913 | 0.565217 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f64a19aff3d9a4d44aac824d38c6aaef4eeb9f77 | 99 | py | Python | lesson-08/test_m.py | rafaelmartinsbuck/ai-for-trading | 51234e408c94ccdeee9b06301a2f63bd170243e3 | [
"MIT"
] | 1 | 2020-05-15T09:41:14.000Z | 2020-05-15T09:41:14.000Z | lesson-08/test_m.py | rafaelmartinsbuck/ai-for-trading | 51234e408c94ccdeee9b06301a2f63bd170243e3 | [
"MIT"
] | null | null | null | lesson-08/test_m.py | rafaelmartinsbuck/ai-for-trading | 51234e408c94ccdeee9b06301a2f63bd170243e3 | [
"MIT"
] | null | null | null | import pandas as pd
import numpy as np
df = pd.DataFrame({"A":[1,2,3,4], "B":[5,6,7,8]})
print(df) | 19.8 | 49 | 0.616162 | 23 | 99 | 2.652174 | 0.826087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.093023 | 0.131313 | 99 | 5 | 50 | 19.8 | 0.616279 | 0 | 0 | 0 | 0 | 0 | 0.02 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f6686b5276ad867dc68aa933b114b3472854d95c | 99 | py | Python | change_funname.py | poojadhoble32/python-projects | 4c094dd0072d4213344e26476e4e99a4a12246e7 | [
"bzip2-1.0.6"
] | null | null | null | change_funname.py | poojadhoble32/python-projects | 4c094dd0072d4213344e26476e4e99a4a12246e7 | [
"bzip2-1.0.6"
] | null | null | null | change_funname.py | poojadhoble32/python-projects | 4c094dd0072d4213344e26476e4e99a4a12246e7 | [
"bzip2-1.0.6"
] | null | null | null | def old(name,age):
print(f"my name is {name} and age is {age}")
old as new
new("pooja",23)
| 19.8 | 49 | 0.606061 | 20 | 99 | 3 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025974 | 0.222222 | 99 | 4 | 50 | 24.75 | 0.753247 | 0 | 0 | 0 | 0 | 0 | 0.410526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9c8515789c228e61ad777a8d32e3b11f40b6960c | 808 | py | Python | integration-test/630-bus-routes-z12.py | slachiewicz/vector-datasource | fb37603ba264be05839992f40eba1b5ae8a9c290 | [
"MIT"
] | null | null | null | integration-test/630-bus-routes-z12.py | slachiewicz/vector-datasource | fb37603ba264be05839992f40eba1b5ae8a9c290 | [
"MIT"
] | 2 | 2021-03-26T00:41:17.000Z | 2021-12-13T20:49:38.000Z | integration-test/630-bus-routes-z12.py | slachiewicz/vector-datasource | fb37603ba264be05839992f40eba1b5ae8a9c290 | [
"MIT"
] | null | null | null | # block between mission & 6th and howard & 5th in SF.
# appears to have lots of buses.
# https://www.openstreetmap.org/way/88572932 -- Mission St
# https://www.openstreetmap.org/relation/3406710 -- 14X to Daly City
# https://www.openstreetmap.org/relation/3406709 -- 14X to Downtown
# https://www.openstreetmap.org/relation/3406708 -- 14R to Mission
# https://www.openstreetmap.org/relation/3000713 -- 14R to Downtown
# ... and many more bus route relations
z, x, y = (16, 10484, 25329)
# test that at least one is present in tiles up to z12
while z >= 12:
assert_has_feature(
z, x, y, 'roads',
{ 'is_bus_route': True })
z, x, y = (z-1, x/2, y/2)
# but that none are present in the parent tile at z11
assert_no_matching_feature(
z, x, y, 'roads',
{ 'is_bus_route': True })
| 35.130435 | 68 | 0.67698 | 130 | 808 | 4.138462 | 0.546154 | 0.074349 | 0.195167 | 0.223048 | 0.345725 | 0.107807 | 0.107807 | 0.107807 | 0.107807 | 0 | 0 | 0.10229 | 0.189356 | 808 | 22 | 69 | 36.727273 | 0.719084 | 0.675743 | 0 | 0.444444 | 0 | 0 | 0.135458 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9cb339f88a19712fdd5c854216d9d0e7bc780ed9 | 22 | py | Python | networking_infoblox/neutron/cmd/eventlet/__init__.py | rav28/networking-infoblox | fce27ca1c2bafb9b0a90aa22388bbc2dbec68294 | [
"Apache-2.0"
] | null | null | null | networking_infoblox/neutron/cmd/eventlet/__init__.py | rav28/networking-infoblox | fce27ca1c2bafb9b0a90aa22388bbc2dbec68294 | [
"Apache-2.0"
] | 1 | 2021-11-20T19:39:58.000Z | 2021-11-20T19:39:58.000Z | networking_infoblox/neutron/cmd/eventlet/__init__.py | rav28/networking-infoblox | fce27ca1c2bafb9b0a90aa22388bbc2dbec68294 | [
"Apache-2.0"
] | 1 | 2021-11-20T19:37:55.000Z | 2021-11-20T19:37:55.000Z | __author__ = 'hhwang'
| 11 | 21 | 0.727273 | 2 | 22 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 22 | 1 | 22 | 22 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9cb3f5cf51b8b20433b3b320d11d55ba5d9140d5 | 243 | py | Python | debauto/utils.py | flaviomilan/python-debauto-br | c776c9094b0fc380797360231d9d1574813b2852 | [
"MIT"
] | 5 | 2019-05-02T01:05:28.000Z | 2021-12-30T05:30:02.000Z | debauto/utils.py | flaviomilan/python-debauto-br | c776c9094b0fc380797360231d9d1574813b2852 | [
"MIT"
] | null | null | null | debauto/utils.py | flaviomilan/python-debauto-br | c776c9094b0fc380797360231d9d1574813b2852 | [
"MIT"
] | 2 | 2021-01-01T22:28:32.000Z | 2021-01-01T22:33:04.000Z | # -*- encoding: utf-8 -*-
import datetime
def formata_data(data):
data = datetime.datetime.strptime(data, '%d/%m/%Y').date()
return data.strftime("%Y%m%d")
def formata_valor(valor):
return str("%.2f" % valor).replace(".", "")
| 18.692308 | 62 | 0.613169 | 33 | 243 | 4.454545 | 0.575758 | 0.136054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009804 | 0.160494 | 243 | 12 | 63 | 20.25 | 0.710784 | 0.09465 | 0 | 0 | 0 | 0 | 0.087156 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0.166667 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
9ccc9caa284546838f6e690c84b3287d39799b8f | 7,645 | py | Python | RecoMuon/MuonIsolationProducers/test/isoTest_cfg.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 852 | 2015-01-11T21:03:51.000Z | 2022-03-25T21:14:00.000Z | RecoMuon/MuonIsolationProducers/test/isoTest_cfg.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 30,371 | 2015-01-02T00:14:40.000Z | 2022-03-31T23:26:05.000Z | RecoMuon/MuonIsolationProducers/test/isoTest_cfg.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 3,240 | 2015-01-02T05:53:18.000Z | 2022-03-31T17:24:21.000Z | # The following comments couldn't be translated into the new config version:
#
# keep only muon-related info here
#
import FWCore.ParameterSet.Config as cms
process = cms.Process("MISO")
process.load("Configuration.EventContent.EventContent_cff")
# service = MessageLogger {
# untracked vstring destinations = { "cout" }
# untracked vstring debugModules = { "muIsoDepositTk",
# "muIsoDepositCalByAssociatorHits",
# "muIsoDepositCalByAssociatorTowers",
# "muIsoDepositCal" }
# untracked vstring categories = { "RecoMuon" , "MuonIsolation" }
#
# untracked PSet cout = {
# untracked string threshold = "DEBUG"
# untracked int32 lineLength = 132
# untracked bool noLineBreaks = true
# untracked PSet DEBUG = {untracked int32 limit = 0 }
# untracked PSet RecoMuon = { untracked int32 limit = 10000000}
# untracked PSet MuonIsolation = { untracked int32 limit = 10000000}
# }
# }
process.load("FWCore.MessageLogger.MessageLogger_cfi")
#process.load("RecoLocalMuon.Configuration.RecoLocalMuon_cff")
#process.load("RecoMuon.Configuration.RecoMuon_cff")
process.load("Configuration.StandardSequences.Services_cff")
process.load("Configuration.StandardSequences.Geometry_cff")
process.load("Configuration.StandardSequences.MagneticField_38T_cff")
process.load("Configuration.StandardSequences.FakeConditions_cff")
#process.load("Configuration.StandardSequences.RawToDigi_cff")
process.load("Configuration.StandardSequences.Reconstruction_cff")
#has everything(?) one needs
# pick muIsolation sequence for "standard" iso reco for tracker and global muons
process.load("RecoMuon.MuonIsolationProducers.muIsolation_cff")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(2000)
)
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring('/store/mc/2007/12/7/RelVal-RelValBJets_Pt_50_120-1197045102/0002/0A21A5F4-02A5-DC11-89F5-000423DD2F34.root')
)
process.source = cms.Source ("PoolSource",
fileNames = cms.untracked.vstring (
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/10438122-2A5F-DD11-A77F-000423D985E4.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/12F34420-2A5F-DD11-AB6E-000423D6CA6E.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/244E7C0B-315F-DD11-ACFC-001617E30F58.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/2ADD8A12-315F-DD11-8AB8-000423D6C8E6.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/34A291FB-305F-DD11-833E-001617C3B6CC.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/383E09CA-2C5F-DD11-9A28-000423D6BA18.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/40F0F8A4-2A5F-DD11-BC72-001617C3B64C.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/4AD39C8C-2A5F-DD11-B935-001617C3B710.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/4C0D4911-315F-DD11-A20D-001617DBD332.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/4C32E425-2A5F-DD11-B819-000423D6C8EE.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/50881CBB-2A5F-DD11-92C6-001617C3B6E8.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/52B83F75-2A5F-DD11-AD56-001617C3B6CC.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/544DC99A-2A5F-DD11-9160-001617C3B6E2.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/62F7698D-2A5F-DD11-907A-001617C3B6DC.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/7C8A2791-2A5F-DD11-814D-001617DBCF6A.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/7EDA5005-315F-DD11-8019-001617C3B706.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/8A91E518-2A5F-DD11-B49A-000423D6B42C.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/8CC497AE-2A5F-DD11-AE43-000423DD2F34.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/9A469FA8-2A5F-DD11-9909-001617C3B6FE.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/9A5BE3A4-2A5F-DD11-A61B-001617DF785A.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/9AC2141C-2A5F-DD11-ADF5-000423D6A6F4.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/9CCFA319-2A5F-DD11-B0AA-000423D94700.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/A0F6C41D-2A5F-DD11-8685-000423D6BA18.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/B0159DAC-2A5F-DD11-98A8-001617E30D00.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/B05C32FC-305F-DD11-A957-001617C3B70E.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/C6ADD999-2A5F-DD11-AF9F-0016177CA7A0.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/C8AEE585-2A5F-DD11-BB37-001617C3B77C.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/CC5178C4-2A5F-DD11-BCE6-001617E30F4C.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/CE9FE020-2A5F-DD11-9846-000423D6CA72.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/D24BFA7E-2A5F-DD11-8F79-001617C3B70E.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/D62761FA-305F-DD11-A108-0016177CA778.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/DA0DDFB6-2A5F-DD11-987A-001617DBD5B2.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/E64386FE-305F-DD11-BA68-0019DB29C614.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/E6BC0D37-2A5F-DD11-9ACB-000423D6B444.root',
'/store/relval/CMSSW_2_1_0_pre11/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/STARTUP_V4_v2/0000/F251D794-2A5F-DD11-BA5D-00161757BF42.root'
),
secondaryFileNames = cms.untracked.vstring (
)
)
process.RECO = cms.OutputModule("PoolOutputModule",
process.FEVTSIMEventContent,
fileName = cms.untracked.string('file:isoTest.root')
)
process.p1 = cms.Path(process.muIsolation)
process.outpath = cms.EndPath(process.RECO)
process.RECO.outputCommands.append('drop *_*_*_*')
process.RECO.outputCommands.extend(process.RecoMuonRECO.outputCommands)
| 71.448598 | 147 | 0.780379 | 1,093 | 7,645 | 5.249771 | 0.220494 | 0.067097 | 0.097595 | 0.103695 | 0.56152 | 0.515511 | 0.515511 | 0.515511 | 0.515511 | 0.515511 | 0 | 0.170106 | 0.087247 | 7,645 | 106 | 148 | 72.122642 | 0.652193 | 0.145062 | 0 | 0.030769 | 0 | 0.553846 | 0.809619 | 0.799017 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.015385 | 0 | 0.015385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9cce74ca65c4a70248a44251c279dedff70a0c3a | 220 | py | Python | app/egg/__init__.py | MultyXu/Islandr | 5f965638d0cda68e76f63b0625b2411029e90c2d | [
"MIT"
] | 2 | 2019-06-05T01:36:53.000Z | 2019-06-05T01:37:12.000Z | app/egg/__init__.py | dingding0606/Islandr | dd2277a8a7ceb002af3b28045133797fa9ffed9d | [
"MIT"
] | null | null | null | app/egg/__init__.py | dingding0606/Islandr | dd2277a8a7ceb002af3b28045133797fa9ffed9d | [
"MIT"
] | 1 | 2019-08-28T20:49:22.000Z | 2019-08-28T20:49:22.000Z | '''
@Description: Easter Egg
@Author: Tianyi Lu
@Date: 2019-08-10 10:30:29
@LastEditors: Tianyi Lu
@LastEditTime: 2019-08-10 10:36:24
'''
from flask import Blueprint
egg = Blueprint('egg', __name__)
from . import views | 18.333333 | 34 | 0.722727 | 34 | 220 | 4.558824 | 0.647059 | 0.103226 | 0.103226 | 0.129032 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147368 | 0.136364 | 220 | 12 | 35 | 18.333333 | 0.668421 | 0.586364 | 0 | 0 | 0 | 0 | 0.035714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0.666667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 3 |
9cd8b09c53d8ecf1b2984937b2ed05ef619c8318 | 23,127 | py | Python | gitea_api/models/timeline_comment.py | r7l/python-gitea-api | 31d3dba27ea7e551e2048a1230c4ab4d73365006 | [
"MIT"
] | 1 | 2022-02-09T23:43:26.000Z | 2022-02-09T23:43:26.000Z | gitea_api/models/timeline_comment.py | r7l/python-gitea-api | 31d3dba27ea7e551e2048a1230c4ab4d73365006 | [
"MIT"
] | null | null | null | gitea_api/models/timeline_comment.py | r7l/python-gitea-api | 31d3dba27ea7e551e2048a1230c4ab4d73365006 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.16.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class TimelineComment(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'assignee': 'User',
'assignee_team': 'Team',
'body': 'str',
'created_at': 'datetime',
'dependent_issue': 'Issue',
'html_url': 'str',
'id': 'int',
'issue_url': 'str',
'label': 'Label',
'milestone': 'Milestone',
'new_ref': 'str',
'new_title': 'str',
'old_milestone': 'Milestone',
'old_project_id': 'int',
'old_ref': 'str',
'old_title': 'str',
'project_id': 'int',
'pull_request_url': 'str',
'ref_action': 'str',
'ref_comment': 'Comment',
'ref_commit_sha': 'str',
'ref_issue': 'Issue',
'removed_assignee': 'bool',
'resolve_doer': 'User',
'review_id': 'int',
'tracked_time': 'TrackedTime',
'type': 'str',
'updated_at': 'datetime',
'user': 'User'
}
attribute_map = {
'assignee': 'assignee',
'assignee_team': 'assignee_team',
'body': 'body',
'created_at': 'created_at',
'dependent_issue': 'dependent_issue',
'html_url': 'html_url',
'id': 'id',
'issue_url': 'issue_url',
'label': 'label',
'milestone': 'milestone',
'new_ref': 'new_ref',
'new_title': 'new_title',
'old_milestone': 'old_milestone',
'old_project_id': 'old_project_id',
'old_ref': 'old_ref',
'old_title': 'old_title',
'project_id': 'project_id',
'pull_request_url': 'pull_request_url',
'ref_action': 'ref_action',
'ref_comment': 'ref_comment',
'ref_commit_sha': 'ref_commit_sha',
'ref_issue': 'ref_issue',
'removed_assignee': 'removed_assignee',
'resolve_doer': 'resolve_doer',
'review_id': 'review_id',
'tracked_time': 'tracked_time',
'type': 'type',
'updated_at': 'updated_at',
'user': 'user'
}
def __init__(self, assignee=None, assignee_team=None, body=None, created_at=None, dependent_issue=None, html_url=None, id=None, issue_url=None, label=None, milestone=None, new_ref=None, new_title=None, old_milestone=None, old_project_id=None, old_ref=None, old_title=None, project_id=None, pull_request_url=None, ref_action=None, ref_comment=None, ref_commit_sha=None, ref_issue=None, removed_assignee=None, resolve_doer=None, review_id=None, tracked_time=None, type=None, updated_at=None, user=None): # noqa: E501
"""TimelineComment - a model defined in Swagger""" # noqa: E501
self._assignee = None
self._assignee_team = None
self._body = None
self._created_at = None
self._dependent_issue = None
self._html_url = None
self._id = None
self._issue_url = None
self._label = None
self._milestone = None
self._new_ref = None
self._new_title = None
self._old_milestone = None
self._old_project_id = None
self._old_ref = None
self._old_title = None
self._project_id = None
self._pull_request_url = None
self._ref_action = None
self._ref_comment = None
self._ref_commit_sha = None
self._ref_issue = None
self._removed_assignee = None
self._resolve_doer = None
self._review_id = None
self._tracked_time = None
self._type = None
self._updated_at = None
self._user = None
self.discriminator = None
if assignee is not None:
self.assignee = assignee
if assignee_team is not None:
self.assignee_team = assignee_team
if body is not None:
self.body = body
if created_at is not None:
self.created_at = created_at
if dependent_issue is not None:
self.dependent_issue = dependent_issue
if html_url is not None:
self.html_url = html_url
if id is not None:
self.id = id
if issue_url is not None:
self.issue_url = issue_url
if label is not None:
self.label = label
if milestone is not None:
self.milestone = milestone
if new_ref is not None:
self.new_ref = new_ref
if new_title is not None:
self.new_title = new_title
if old_milestone is not None:
self.old_milestone = old_milestone
if old_project_id is not None:
self.old_project_id = old_project_id
if old_ref is not None:
self.old_ref = old_ref
if old_title is not None:
self.old_title = old_title
if project_id is not None:
self.project_id = project_id
if pull_request_url is not None:
self.pull_request_url = pull_request_url
if ref_action is not None:
self.ref_action = ref_action
if ref_comment is not None:
self.ref_comment = ref_comment
if ref_commit_sha is not None:
self.ref_commit_sha = ref_commit_sha
if ref_issue is not None:
self.ref_issue = ref_issue
if removed_assignee is not None:
self.removed_assignee = removed_assignee
if resolve_doer is not None:
self.resolve_doer = resolve_doer
if review_id is not None:
self.review_id = review_id
if tracked_time is not None:
self.tracked_time = tracked_time
if type is not None:
self.type = type
if updated_at is not None:
self.updated_at = updated_at
if user is not None:
self.user = user
@property
def assignee(self):
"""Gets the assignee of this TimelineComment. # noqa: E501
:return: The assignee of this TimelineComment. # noqa: E501
:rtype: User
"""
return self._assignee
@assignee.setter
def assignee(self, assignee):
"""Sets the assignee of this TimelineComment.
:param assignee: The assignee of this TimelineComment. # noqa: E501
:type: User
"""
self._assignee = assignee
@property
def assignee_team(self):
"""Gets the assignee_team of this TimelineComment. # noqa: E501
:return: The assignee_team of this TimelineComment. # noqa: E501
:rtype: Team
"""
return self._assignee_team
@assignee_team.setter
def assignee_team(self, assignee_team):
"""Sets the assignee_team of this TimelineComment.
:param assignee_team: The assignee_team of this TimelineComment. # noqa: E501
:type: Team
"""
self._assignee_team = assignee_team
@property
def body(self):
"""Gets the body of this TimelineComment. # noqa: E501
:return: The body of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._body
@body.setter
def body(self, body):
"""Sets the body of this TimelineComment.
:param body: The body of this TimelineComment. # noqa: E501
:type: str
"""
self._body = body
@property
def created_at(self):
"""Gets the created_at of this TimelineComment. # noqa: E501
:return: The created_at of this TimelineComment. # noqa: E501
:rtype: datetime
"""
return self._created_at
@created_at.setter
def created_at(self, created_at):
"""Sets the created_at of this TimelineComment.
:param created_at: The created_at of this TimelineComment. # noqa: E501
:type: datetime
"""
self._created_at = created_at
@property
def dependent_issue(self):
"""Gets the dependent_issue of this TimelineComment. # noqa: E501
:return: The dependent_issue of this TimelineComment. # noqa: E501
:rtype: Issue
"""
return self._dependent_issue
@dependent_issue.setter
def dependent_issue(self, dependent_issue):
"""Sets the dependent_issue of this TimelineComment.
:param dependent_issue: The dependent_issue of this TimelineComment. # noqa: E501
:type: Issue
"""
self._dependent_issue = dependent_issue
@property
def html_url(self):
"""Gets the html_url of this TimelineComment. # noqa: E501
:return: The html_url of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._html_url
@html_url.setter
def html_url(self, html_url):
"""Sets the html_url of this TimelineComment.
:param html_url: The html_url of this TimelineComment. # noqa: E501
:type: str
"""
self._html_url = html_url
@property
def id(self):
"""Gets the id of this TimelineComment. # noqa: E501
:return: The id of this TimelineComment. # noqa: E501
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""Sets the id of this TimelineComment.
:param id: The id of this TimelineComment. # noqa: E501
:type: int
"""
self._id = id
@property
def issue_url(self):
"""Gets the issue_url of this TimelineComment. # noqa: E501
:return: The issue_url of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._issue_url
@issue_url.setter
def issue_url(self, issue_url):
"""Sets the issue_url of this TimelineComment.
:param issue_url: The issue_url of this TimelineComment. # noqa: E501
:type: str
"""
self._issue_url = issue_url
@property
def label(self):
"""Gets the label of this TimelineComment. # noqa: E501
:return: The label of this TimelineComment. # noqa: E501
:rtype: Label
"""
return self._label
@label.setter
def label(self, label):
"""Sets the label of this TimelineComment.
:param label: The label of this TimelineComment. # noqa: E501
:type: Label
"""
self._label = label
@property
def milestone(self):
"""Gets the milestone of this TimelineComment. # noqa: E501
:return: The milestone of this TimelineComment. # noqa: E501
:rtype: Milestone
"""
return self._milestone
@milestone.setter
def milestone(self, milestone):
"""Sets the milestone of this TimelineComment.
:param milestone: The milestone of this TimelineComment. # noqa: E501
:type: Milestone
"""
self._milestone = milestone
@property
def new_ref(self):
"""Gets the new_ref of this TimelineComment. # noqa: E501
:return: The new_ref of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._new_ref
@new_ref.setter
def new_ref(self, new_ref):
"""Sets the new_ref of this TimelineComment.
:param new_ref: The new_ref of this TimelineComment. # noqa: E501
:type: str
"""
self._new_ref = new_ref
@property
def new_title(self):
"""Gets the new_title of this TimelineComment. # noqa: E501
:return: The new_title of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._new_title
@new_title.setter
def new_title(self, new_title):
"""Sets the new_title of this TimelineComment.
:param new_title: The new_title of this TimelineComment. # noqa: E501
:type: str
"""
self._new_title = new_title
@property
def old_milestone(self):
"""Gets the old_milestone of this TimelineComment. # noqa: E501
:return: The old_milestone of this TimelineComment. # noqa: E501
:rtype: Milestone
"""
return self._old_milestone
@old_milestone.setter
def old_milestone(self, old_milestone):
"""Sets the old_milestone of this TimelineComment.
:param old_milestone: The old_milestone of this TimelineComment. # noqa: E501
:type: Milestone
"""
self._old_milestone = old_milestone
@property
def old_project_id(self):
"""Gets the old_project_id of this TimelineComment. # noqa: E501
:return: The old_project_id of this TimelineComment. # noqa: E501
:rtype: int
"""
return self._old_project_id
@old_project_id.setter
def old_project_id(self, old_project_id):
"""Sets the old_project_id of this TimelineComment.
:param old_project_id: The old_project_id of this TimelineComment. # noqa: E501
:type: int
"""
self._old_project_id = old_project_id
@property
def old_ref(self):
"""Gets the old_ref of this TimelineComment. # noqa: E501
:return: The old_ref of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._old_ref
@old_ref.setter
def old_ref(self, old_ref):
"""Sets the old_ref of this TimelineComment.
:param old_ref: The old_ref of this TimelineComment. # noqa: E501
:type: str
"""
self._old_ref = old_ref
@property
def old_title(self):
"""Gets the old_title of this TimelineComment. # noqa: E501
:return: The old_title of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._old_title
@old_title.setter
def old_title(self, old_title):
"""Sets the old_title of this TimelineComment.
:param old_title: The old_title of this TimelineComment. # noqa: E501
:type: str
"""
self._old_title = old_title
@property
def project_id(self):
"""Gets the project_id of this TimelineComment. # noqa: E501
:return: The project_id of this TimelineComment. # noqa: E501
:rtype: int
"""
return self._project_id
@project_id.setter
def project_id(self, project_id):
"""Sets the project_id of this TimelineComment.
:param project_id: The project_id of this TimelineComment. # noqa: E501
:type: int
"""
self._project_id = project_id
@property
def pull_request_url(self):
"""Gets the pull_request_url of this TimelineComment. # noqa: E501
:return: The pull_request_url of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._pull_request_url
@pull_request_url.setter
def pull_request_url(self, pull_request_url):
"""Sets the pull_request_url of this TimelineComment.
:param pull_request_url: The pull_request_url of this TimelineComment. # noqa: E501
:type: str
"""
self._pull_request_url = pull_request_url
@property
def ref_action(self):
"""Gets the ref_action of this TimelineComment. # noqa: E501
:return: The ref_action of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._ref_action
@ref_action.setter
def ref_action(self, ref_action):
"""Sets the ref_action of this TimelineComment.
:param ref_action: The ref_action of this TimelineComment. # noqa: E501
:type: str
"""
self._ref_action = ref_action
@property
def ref_comment(self):
"""Gets the ref_comment of this TimelineComment. # noqa: E501
:return: The ref_comment of this TimelineComment. # noqa: E501
:rtype: Comment
"""
return self._ref_comment
@ref_comment.setter
def ref_comment(self, ref_comment):
"""Sets the ref_comment of this TimelineComment.
:param ref_comment: The ref_comment of this TimelineComment. # noqa: E501
:type: Comment
"""
self._ref_comment = ref_comment
@property
def ref_commit_sha(self):
"""Gets the ref_commit_sha of this TimelineComment. # noqa: E501
commit SHA where issue/PR was referenced # noqa: E501
:return: The ref_commit_sha of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._ref_commit_sha
@ref_commit_sha.setter
def ref_commit_sha(self, ref_commit_sha):
"""Sets the ref_commit_sha of this TimelineComment.
commit SHA where issue/PR was referenced # noqa: E501
:param ref_commit_sha: The ref_commit_sha of this TimelineComment. # noqa: E501
:type: str
"""
self._ref_commit_sha = ref_commit_sha
@property
def ref_issue(self):
"""Gets the ref_issue of this TimelineComment. # noqa: E501
:return: The ref_issue of this TimelineComment. # noqa: E501
:rtype: Issue
"""
return self._ref_issue
@ref_issue.setter
def ref_issue(self, ref_issue):
"""Sets the ref_issue of this TimelineComment.
:param ref_issue: The ref_issue of this TimelineComment. # noqa: E501
:type: Issue
"""
self._ref_issue = ref_issue
@property
def removed_assignee(self):
"""Gets the removed_assignee of this TimelineComment. # noqa: E501
whether the assignees were removed or added # noqa: E501
:return: The removed_assignee of this TimelineComment. # noqa: E501
:rtype: bool
"""
return self._removed_assignee
@removed_assignee.setter
def removed_assignee(self, removed_assignee):
"""Sets the removed_assignee of this TimelineComment.
whether the assignees were removed or added # noqa: E501
:param removed_assignee: The removed_assignee of this TimelineComment. # noqa: E501
:type: bool
"""
self._removed_assignee = removed_assignee
@property
def resolve_doer(self):
"""Gets the resolve_doer of this TimelineComment. # noqa: E501
:return: The resolve_doer of this TimelineComment. # noqa: E501
:rtype: User
"""
return self._resolve_doer
@resolve_doer.setter
def resolve_doer(self, resolve_doer):
"""Sets the resolve_doer of this TimelineComment.
:param resolve_doer: The resolve_doer of this TimelineComment. # noqa: E501
:type: User
"""
self._resolve_doer = resolve_doer
@property
def review_id(self):
"""Gets the review_id of this TimelineComment. # noqa: E501
:return: The review_id of this TimelineComment. # noqa: E501
:rtype: int
"""
return self._review_id
@review_id.setter
def review_id(self, review_id):
"""Sets the review_id of this TimelineComment.
:param review_id: The review_id of this TimelineComment. # noqa: E501
:type: int
"""
self._review_id = review_id
@property
def tracked_time(self):
"""Gets the tracked_time of this TimelineComment. # noqa: E501
:return: The tracked_time of this TimelineComment. # noqa: E501
:rtype: TrackedTime
"""
return self._tracked_time
@tracked_time.setter
def tracked_time(self, tracked_time):
"""Sets the tracked_time of this TimelineComment.
:param tracked_time: The tracked_time of this TimelineComment. # noqa: E501
:type: TrackedTime
"""
self._tracked_time = tracked_time
@property
def type(self):
"""Gets the type of this TimelineComment. # noqa: E501
:return: The type of this TimelineComment. # noqa: E501
:rtype: str
"""
return self._type
@type.setter
def type(self, type):
"""Sets the type of this TimelineComment.
:param type: The type of this TimelineComment. # noqa: E501
:type: str
"""
self._type = type
@property
def updated_at(self):
"""Gets the updated_at of this TimelineComment. # noqa: E501
:return: The updated_at of this TimelineComment. # noqa: E501
:rtype: datetime
"""
return self._updated_at
@updated_at.setter
def updated_at(self, updated_at):
"""Sets the updated_at of this TimelineComment.
:param updated_at: The updated_at of this TimelineComment. # noqa: E501
:type: datetime
"""
self._updated_at = updated_at
@property
def user(self):
"""Gets the user of this TimelineComment. # noqa: E501
:return: The user of this TimelineComment. # noqa: E501
:rtype: User
"""
return self._user
@user.setter
def user(self, user):
"""Sets the user of this TimelineComment.
:param user: The user of this TimelineComment. # noqa: E501
:type: User
"""
self._user = user
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(TimelineComment, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, TimelineComment):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
| 27.434164 | 519 | 0.598564 | 2,784 | 23,127 | 4.747126 | 0.054598 | 0.052663 | 0.184322 | 0.164573 | 0.607446 | 0.456946 | 0.391419 | 0.339664 | 0.200061 | 0.090042 | 0 | 0.018438 | 0.312881 | 23,127 | 842 | 520 | 27.466746 | 0.813228 | 0.370217 | 0 | 0.085635 | 1 | 0 | 0.079499 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176796 | false | 0 | 0.008287 | 0 | 0.290055 | 0.005525 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9ced7b3c51ed7b3bb5bdd6b331b57b879e9a8dab | 834 | py | Python | backend/secure_backend/models.py | CS-twop/Secure-django-reacthook | 3d7b3e65c7e1f1e015dcd3ddf2838acdab7cab17 | [
"MIT"
] | null | null | null | backend/secure_backend/models.py | CS-twop/Secure-django-reacthook | 3d7b3e65c7e1f1e015dcd3ddf2838acdab7cab17 | [
"MIT"
] | null | null | null | backend/secure_backend/models.py | CS-twop/Secure-django-reacthook | 3d7b3e65c7e1f1e015dcd3ddf2838acdab7cab17 | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import User
class Post(models.Model):
user = models.ForeignKey(User, related_name='posts', on_delete=models.CASCADE)
content = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return str(self.user) + ' : ' + self.content
class Comment(models.Model):
post_id = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='comments')
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='comments')
content = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return str(self.user) + ' >> ' + self.content | 36.26087 | 88 | 0.721823 | 108 | 834 | 5.342593 | 0.324074 | 0.055459 | 0.145581 | 0.17331 | 0.627383 | 0.627383 | 0.627383 | 0.488735 | 0.488735 | 0.488735 | 0 | 0 | 0.160671 | 834 | 23 | 89 | 36.26087 | 0.824286 | 0 | 0 | 0.470588 | 0 | 0 | 0.033533 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.117647 | false | 0 | 0.117647 | 0.117647 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
14069f69e286ba7e7815086e118f09ac462708fd | 823 | py | Python | sionna/channel/tr38901/__init__.py | NVlabs/sionna | 488e6c3ff6ff2b3313d0ca0f94e4247b8dd6ff35 | [
"Apache-2.0"
] | 163 | 2022-03-22T19:47:47.000Z | 2022-03-31T23:56:45.000Z | sionna/channel/tr38901/__init__.py | Maryammhsnv/sionna | 527d0f7866b379afffad34a6bef7ed3bf6f33ad2 | [
"Apache-2.0"
] | 2 | 2022-03-24T12:43:07.000Z | 2022-03-29T07:17:16.000Z | sionna/channel/tr38901/__init__.py | Maryammhsnv/sionna | 527d0f7866b379afffad34a6bef7ed3bf6f33ad2 | [
"Apache-2.0"
] | 19 | 2022-03-23T02:31:22.000Z | 2022-03-30T06:35:12.000Z | #
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""
Channel sub-package of the Sionna library implementing 3GPP TR39.801 models.
"""
# pylint: disable=line-too-long
from .antenna import AntennaElement, AntennaPanel, PanelArray, Antenna, AntennaArray
from .lsp import LSP, LSPGenerator
from .rays import Rays, RaysGenerator
from .system_level_scenario import SystemLevelScenario
from .rma_scenario import RMaScenario
from .umi_scenario import UMiScenario
from .uma_scenario import UMaScenario
from .channel_coefficients import Topology, ChannelCoefficientsGenerator
from .system_level_channel import SystemLevelChannel
from .rma import RMa
from .uma import UMa
from .umi import UMi
from .tdl import TDL
from .cdl import CDL
| 32.92 | 103 | 0.818955 | 106 | 823 | 6.283019 | 0.575472 | 0.084084 | 0.045045 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022039 | 0.117861 | 823 | 24 | 104 | 34.291667 | 0.895317 | 0.297691 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
143fbec953156df9d4526de475d51f26bf5b991c | 54 | py | Python | chap4/4-9.py | StewedChickenwithStats/Answers-to-Python-Crash-Course | 9ffbe02abba5d111f702d920db7932303daf59d4 | [
"MIT"
] | 1 | 2022-02-21T07:05:48.000Z | 2022-02-21T07:05:48.000Z | chap4/4-9.py | StewedChickenwithStats/Answers-to-Python-Crash-Course | 9ffbe02abba5d111f702d920db7932303daf59d4 | [
"MIT"
] | null | null | null | chap4/4-9.py | StewedChickenwithStats/Answers-to-Python-Crash-Course | 9ffbe02abba5d111f702d920db7932303daf59d4 | [
"MIT"
] | null | null | null | cubes=[value**3 for value in range(1,11)]
print(cubes) | 27 | 41 | 0.722222 | 11 | 54 | 3.545455 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081633 | 0.092593 | 54 | 2 | 42 | 27 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
144698a559c916923c258db6ccf04e14398014a5 | 1,293 | py | Python | pupil/profiler.py | nigamapurv/Minkowski_planview | 1c887bf0c54b9bdd632b9249cac71b275be8b2c2 | [
"MIT"
] | 1 | 2019-12-12T07:16:05.000Z | 2019-12-12T07:16:05.000Z | pupil/profiler.py | nigamapurv/Minkowski_planview | 1c887bf0c54b9bdd632b9249cac71b275be8b2c2 | [
"MIT"
] | null | null | null | pupil/profiler.py | nigamapurv/Minkowski_planview | 1c887bf0c54b9bdd632b9249cac71b275be8b2c2 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cProfile
import io
import pstats
cache = {}
PROFILE_SWITCH = True
class Profiler:
def __init__(self):
self.profiler = cProfile.Profile()
def profile(self, func, *args, **kwargs):
self.profiler.enable()
result = func(*args, **kwargs)
self.profiler.disable()
with io.StringIO() as string_stream:
profiler_stats = pstats.Stats(self.profiler, stream = string_stream).sort_stats("cumulative")
profiler_stats.print_stats()
print(string_stream.getvalue())
return result
class PassThroughProfiler:
def __init__(self):
pass
def profile(self, func, *args, **kwargs):
return func(*args, **kwargs)
def get_profiler():
if "profiler" not in cache:
if PROFILE_SWITCH:
cache["profiler"] = Profiler()
else:
cache["profiler"] = PassThroughProfiler()
return cache["profiler"]
def profile(func, *args, **kwargs):
profiler = get_profiler()
return profiler.profile(func, *args, **kwargs)
def profileable(func):
def _profile(*args, **kwargs):
return profile(func, *args, **kwargs)
return _profile | 23.509091 | 105 | 0.648879 | 142 | 1,293 | 5.661972 | 0.302817 | 0.099502 | 0.121891 | 0.078358 | 0.116915 | 0.069652 | 0 | 0 | 0 | 0 | 0 | 0 | 0.241299 | 1,293 | 55 | 106 | 23.509091 | 0.819572 | 0 | 0 | 0.102564 | 0 | 0 | 0.032458 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.205128 | false | 0.076923 | 0.153846 | 0.051282 | 0.564103 | 0.076923 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
144aea4f0502bed2772fcf751e46d1dcc9492dd4 | 203 | py | Python | Chapter 03/Chap03_Example3.10.py | bpbpublications/Programming-Techniques-using-Python | 49b785f37e95a3aad1d36cef51e219ac56e5e9f0 | [
"MIT"
] | null | null | null | Chapter 03/Chap03_Example3.10.py | bpbpublications/Programming-Techniques-using-Python | 49b785f37e95a3aad1d36cef51e219ac56e5e9f0 | [
"MIT"
] | null | null | null | Chapter 03/Chap03_Example3.10.py | bpbpublications/Programming-Techniques-using-Python | 49b785f37e95a3aad1d36cef51e219ac56e5e9f0 | [
"MIT"
] | null | null | null | for num in range(1,6):
#code inside for loop
if num == 4:
continue
#code inside for loop
print(num)
#code outside for loop
print("continue statement executed on num = 4")
| 22.555556 | 48 | 0.615764 | 31 | 203 | 4.032258 | 0.548387 | 0.168 | 0.208 | 0.272 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028169 | 0.300493 | 203 | 8 | 49 | 25.375 | 0.852113 | 0.300493 | 0 | 0 | 0 | 0 | 0.290076 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
14590358be50b254390f5fc7eebb4b6ad228a02e | 148 | py | Python | Week3/Hospitalisations_ClassificationCase/import.py | PenelopeCorsica/AppliedML2021 | 1b48fe56553d7e4486e2542cf5d26b5aa6f5b473 | [
"BSD-3-Clause"
] | 13 | 2021-04-20T13:13:51.000Z | 2022-03-28T18:08:07.000Z | Week3/Hospitalisations_ClassificationCase/import.py | PenelopeCorsica/AppliedML2021 | 1b48fe56553d7e4486e2542cf5d26b5aa6f5b473 | [
"BSD-3-Clause"
] | null | null | null | Week3/Hospitalisations_ClassificationCase/import.py | PenelopeCorsica/AppliedML2021 | 1b48fe56553d7e4486e2542cf5d26b5aa6f5b473 | [
"BSD-3-Clause"
] | 8 | 2021-04-16T11:03:42.000Z | 2021-09-29T02:25:15.000Z | import pandas as pd
X_train = pd.read_csv("X_train.csv")
df_y = pd.read_csv("y_train.csv")
y_train = df_y["y"]
X_test = pd.read_csv("X_test.csv")
| 18.5 | 36 | 0.702703 | 33 | 148 | 2.818182 | 0.333333 | 0.193548 | 0.290323 | 0.215054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121622 | 148 | 7 | 37 | 21.142857 | 0.715385 | 0 | 0 | 0 | 0 | 0 | 0.222973 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
145f50f90a8086649d041c871071f93bec34f696 | 334 | py | Python | app/app.py | raevilman/aws_lambda_python_skeleton | aebd3a4f80bc1149662c8a0b1af5df40d28eff01 | [
"MIT"
] | 3 | 2020-10-19T11:31:10.000Z | 2021-02-19T12:14:26.000Z | app/app.py | raevilman/aws_lambda_python_skeleton | aebd3a4f80bc1149662c8a0b1af5df40d28eff01 | [
"MIT"
] | null | null | null | app/app.py | raevilman/aws_lambda_python_skeleton | aebd3a4f80bc1149662c8a0b1af5df40d28eff01 | [
"MIT"
] | 1 | 2021-01-21T10:29:10.000Z | 2021-01-21T10:29:10.000Z | import json
from app.event import Event
from app.responder import send_ok_response
from app.utils import get_logger
# Setup logging
logger = get_logger("app")
def run(event: Event):
logger.info(event.http_path())
logger.info(event.http_method())
return send_ok_response(json.dumps({
'message': 'Hello'
}))
| 19.647059 | 42 | 0.715569 | 48 | 334 | 4.8125 | 0.5 | 0.090909 | 0.121212 | 0.164502 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173653 | 334 | 16 | 43 | 20.875 | 0.836957 | 0.038922 | 0 | 0 | 0 | 0 | 0.047022 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.363636 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
147a0334d820a059fbd8f4598327b2b7c87e1f19 | 3,720 | py | Python | obywatele/migrations/0020_auto_20201225_1624.py | soma115/wikikracja | 7715ca1daa4ca09888e1c7389ed5f8a2df29898b | [
"MIT"
] | 7 | 2016-02-21T17:25:54.000Z | 2021-10-09T19:36:10.000Z | obywatele/migrations/0020_auto_20201225_1624.py | soma115/wikikracja | 7715ca1daa4ca09888e1c7389ed5f8a2df29898b | [
"MIT"
] | 19 | 2020-02-11T23:55:01.000Z | 2022-03-31T18:11:56.000Z | obywatele/migrations/0020_auto_20201225_1624.py | soma115/wikikracja | 7715ca1daa4ca09888e1c7389ed5f8a2df29898b | [
"MIT"
] | 3 | 2016-01-20T22:34:58.000Z | 2020-09-16T07:45:42.000Z | # Generated by Django 3.1 on 2020-12-25 15:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('obywatele', '0019_auto_20201225_1621'),
]
operations = [
migrations.AlterField(
model_name='uzytkownik',
name='business',
field=models.CharField(blank=True, help_text='If you are running a business', max_length=200, null=True, verbose_name='Business'),
),
migrations.AlterField(
model_name='uzytkownik',
name='city',
field=models.CharField(blank=True, help_text='Where you are spending most of your time', max_length=100, null=True, verbose_name='City'),
),
migrations.AlterField(
model_name='uzytkownik',
name='fb',
field=models.CharField(blank=True, help_text='Link to Facebook profile', max_length=500, null=True, verbose_name='Facebook'),
),
migrations.AlterField(
model_name='uzytkownik',
name='for_sale',
field=models.CharField(blank=True, help_text='Stuff you have for sale', max_length=500, null=True, verbose_name='For sale'),
),
migrations.AlterField(
model_name='uzytkownik',
name='hobby',
field=models.CharField(blank=True, help_text='Hobbies you have', max_length=200, null=True, verbose_name='Hobby'),
),
migrations.AlterField(
model_name='uzytkownik',
name='i_need',
field=models.CharField(blank=True, help_text='What do you need', max_length=500, null=True, verbose_name='I need'),
),
migrations.AlterField(
model_name='uzytkownik',
name='job',
field=models.CharField(blank=True, help_text='Your profession', max_length=500, null=True, verbose_name='Job'),
),
migrations.AlterField(
model_name='uzytkownik',
name='knowledge',
field=models.CharField(blank=True, help_text='Knowledge you have', max_length=500, null=True, verbose_name='Knowledge'),
),
migrations.AlterField(
model_name='uzytkownik',
name='other',
field=models.CharField(blank=True, help_text='Other things about worth mentioning', max_length=500, null=True, verbose_name='Other'),
),
migrations.AlterField(
model_name='uzytkownik',
name='responsibilities',
field=models.CharField(blank=True, help_text='Tasks performed in our group', max_length=2000, null=True, verbose_name='Responsibilities'),
),
migrations.AlterField(
model_name='uzytkownik',
name='skills',
field=models.CharField(blank=True, help_text='What practical skills do you have', max_length=500, null=True, verbose_name='Skills'),
),
migrations.AlterField(
model_name='uzytkownik',
name='to_borrow',
field=models.CharField(blank=True, help_text='Stuff you can borrow to others', max_length=500, null=True, verbose_name='To borrow'),
),
migrations.AlterField(
model_name='uzytkownik',
name='to_give_away',
field=models.CharField(blank=True, help_text='Things you are willing to give away for free', max_length=2000, null=True, verbose_name='To give away'),
),
migrations.AlterField(
model_name='uzytkownik',
name='want_to_learn',
field=models.CharField(blank=True, help_text='Things you would like to learn', max_length=500, null=True, verbose_name='I want to learn'),
),
]
| 44.285714 | 162 | 0.618548 | 423 | 3,720 | 5.283688 | 0.231678 | 0.12528 | 0.1566 | 0.181655 | 0.711857 | 0.710067 | 0.479195 | 0.180761 | 0.115436 | 0 | 0 | 0.026948 | 0.261828 | 3,720 | 83 | 163 | 44.819277 | 0.786963 | 0.011559 | 0 | 0.545455 | 1 | 0 | 0.21034 | 0.006259 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.012987 | 0 | 0.051948 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
147c28455f56f5983cd813f99265bdd8b89586bb | 270 | py | Python | app/cli/__init__.py | Hacker-1202/Selfium | 7e798c23c9f24aacab6f6a485d6355f1045bc65c | [
"MIT"
] | 14 | 2021-11-05T11:27:25.000Z | 2022-02-28T02:04:32.000Z | app/cli/__init__.py | CssHammer/Selfium | 7e798c23c9f24aacab6f6a485d6355f1045bc65c | [
"MIT"
] | 2 | 2021-05-17T23:55:34.000Z | 2021-07-09T17:24:44.000Z | app/cli/__init__.py | CssHammer/Selfium | 7e798c23c9f24aacab6f6a485d6355f1045bc65c | [
"MIT"
] | 5 | 2022-01-02T13:33:17.000Z | 2022-02-26T13:09:50.000Z |
"""
Selfium CLI Tools
~~~~~~~~~~~~~~~~~~~
All cli functions used in Selfium project;
:copyright: (c) 2021 - Caillou and ZeusHay;
:license: MIT, see LICENSE for more details.
"""
from .logo import *
from .clear import *
from .welcome import *
from .tokenError import *
| 19.285714 | 44 | 0.67037 | 35 | 270 | 5.171429 | 0.742857 | 0.165746 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017778 | 0.166667 | 270 | 13 | 45 | 20.769231 | 0.786667 | 0.625926 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
148e62acadab2abb7a544e4448e8d3e81c73ab98 | 585 | py | Python | pathod/__init__.py | illera88/mitmproxy | 4f464001841e5119bf57ef620a3257892ded2ded | [
"MIT"
] | 6 | 2020-11-25T07:33:05.000Z | 2022-01-25T07:25:54.000Z | pathod/__init__.py | illera88/mitmproxy | 4f464001841e5119bf57ef620a3257892ded2ded | [
"MIT"
] | null | null | null | pathod/__init__.py | illera88/mitmproxy | 4f464001841e5119bf57ef620a3257892ded2ded | [
"MIT"
] | 4 | 2021-03-14T16:14:27.000Z | 2021-09-25T03:01:15.000Z | import os
import sys
import warnings
warnings.warn(
"pathod and pathoc modules are deprecated, see https://github.com/mitmproxy/mitmproxy/issues/4273",
DeprecationWarning,
stacklevel=2
)
def print_tool_deprecation_message():
print("####", file=sys.stderr)
print(f"### {os.path.basename(sys.argv[0])} is deprecated and will not be part of future mitmproxy releases!", file=sys.stderr)
print("### See https://github.com/mitmproxy/mitmproxy/issues/4273 for more information.", file=sys.stderr)
print("####", file=sys.stderr)
print("", file=sys.stderr)
| 30.789474 | 131 | 0.707692 | 79 | 585 | 5.202532 | 0.556962 | 0.085158 | 0.158151 | 0.175182 | 0.394161 | 0.3382 | 0.3382 | 0.218978 | 0 | 0 | 0 | 0.01992 | 0.14188 | 585 | 18 | 132 | 32.5 | 0.798805 | 0 | 0 | 0.142857 | 0 | 0.142857 | 0.48547 | 0.052991 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | true | 0 | 0.214286 | 0 | 0.285714 | 0.428571 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
14938eb4c17ff96d22edd6168c88c690385d934d | 2,207 | py | Python | tests/test_tc100.py | radoering/flake8-type-checking | 02c2af870e8098d0c5bd623591c5b184c0614213 | [
"BSD-3-Clause"
] | 19 | 2021-04-21T14:12:24.000Z | 2022-03-13T07:42:26.000Z | tests/test_tc100.py | radoering/flake8-type-checking | 02c2af870e8098d0c5bd623591c5b184c0614213 | [
"BSD-3-Clause"
] | 29 | 2021-04-21T14:31:12.000Z | 2022-03-26T08:57:54.000Z | tests/test_tc100.py | sondrelg/flake8-typing-only-imports | d27ffece2cdd5b57a529c8d9f45ba2173c29066f | [
"BSD-3-Clause"
] | 2 | 2021-04-08T08:04:44.000Z | 2021-04-14T11:00:18.000Z | """
This file tests the TC100 error:
>> Missing 'from __future__ import annotations' import
The idea is that we should raise one of these errors if a file contains any type-checking imports and one is missing.
One thing to note: futures imports should always be at the top of a file, so we only need to check one line.
"""
import pytest
from flake8_type_checking.codes import TC100
from tests import _get_error, mod
examples = [
# No errors
('', set()),
('if TYPE_CHECKING:\n\tx = 2', set()),
# Unused import
('if TYPE_CHECKING:\n\tfrom typing import Dict', {'1:0 ' + TC100}),
('if TYPE_CHECKING:\n\tfrom typing import Dict, Any', {'1:0 ' + TC100}),
(f'if TYPE_CHECKING:\n\timport {mod}', {'1:0 ' + TC100}),
(f'if TYPE_CHECKING:\n\tfrom {mod} import constants', {'1:0 ' + TC100}),
# Used imports
('if TYPE_CHECKING:\n\tfrom typing import Dict\nx = Dict', set()),
('if TYPE_CHECKING:\n\tfrom typing import Dict, Any\nx, y = Dict, Any', set()),
(f'if TYPE_CHECKING:\n\timport {mod}\nx = {mod}.constants.TC001', set()),
(f'if TYPE_CHECKING:\n\tfrom {mod} import constants\nprint(constants)', set()),
# Import used for AnnAssign
('if TYPE_CHECKING:\n\tfrom typing import Dict\nx: Dict[str, int]', {'1:0 ' + TC100}),
('if TYPE_CHECKING:\n\tfrom typing import Dict\nx: Dict[str, int] = {}', {'1:0 ' + TC100}),
# Import used for arg
('if TYPE_CHECKING:\n\tfrom typing import Dict\ndef example(x: Dict[str, int]):\n\tpass', {'1:0 ' + TC100}),
('if TYPE_CHECKING:\n\tfrom typing import Dict\ndef example(x: Dict[str, int] = {}):\n\tpass', {'1:0 ' + TC100}),
# Import used for returns
('if TYPE_CHECKING:\n\tfrom typing import Dict\ndef example() -> Dict[str, int]:\n\tpass', {'1:0 ' + TC100}),
# Probably not much point in adding many more test cases, as the logic for TC100
# is not dependent on the type of annotation assignments; it's purely concerned with
# whether an ast.Import or ast.ImportFrom exists within a type checking block
]
@pytest.mark.parametrize('example, expected', examples)
def test_TC100_errors(example, expected):
assert _get_error(example, error_code_filter='TC100') == expected
| 46.957447 | 117 | 0.670594 | 343 | 2,207 | 4.233236 | 0.329446 | 0.140496 | 0.134986 | 0.144628 | 0.469697 | 0.455234 | 0.433196 | 0.408402 | 0.347107 | 0.264463 | 0 | 0.035971 | 0.181242 | 2,207 | 46 | 118 | 47.978261 | 0.767571 | 0.30222 | 0 | 0 | 0 | 0.130435 | 0.588583 | 0.221785 | 0 | 0 | 0 | 0 | 0.043478 | 1 | 0.043478 | false | 0.130435 | 0.695652 | 0 | 0.73913 | 0.043478 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
149847bd740c757e149d66da0c573d0fe5e56850 | 91 | py | Python | tests/basic/lambda4.py | Slater-Victoroff/pyjaco | 89c4e3c46399c5023b0e160005d855a01241c58a | [
"MIT"
] | 38 | 2015-01-01T18:08:59.000Z | 2022-02-18T08:57:27.000Z | tests/basic/lambda4.py | dusty-phillips/pyjaco | 066895ae38d1828498e529c1875cb88df6cbc54d | [
"MIT"
] | 1 | 2020-07-15T13:30:32.000Z | 2020-07-15T13:30:32.000Z | tests/basic/lambda4.py | Slater-Victoroff/pyjaco | 89c4e3c46399c5023b0e160005d855a01241c58a | [
"MIT"
] | 12 | 2016-03-07T09:30:49.000Z | 2021-09-05T20:38:47.000Z |
la = []
for x in range(5):
la.append(lambda x: (lambda q: q + x)(x))
print la[3](1)
| 11.375 | 45 | 0.527473 | 19 | 91 | 2.526316 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044118 | 0.252747 | 91 | 7 | 46 | 13 | 0.661765 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
14a905270cca517cd153387fad1257a23aa0b010 | 275 | py | Python | futbol-news/backend/app/app/models/search_term.py | davidespicolomina/proyecto-personal | 807445546d493f9c092720e18e5fefa3281da4c9 | [
"Apache-2.0"
] | null | null | null | futbol-news/backend/app/app/models/search_term.py | davidespicolomina/proyecto-personal | 807445546d493f9c092720e18e5fefa3281da4c9 | [
"Apache-2.0"
] | null | null | null | futbol-news/backend/app/app/models/search_term.py | davidespicolomina/proyecto-personal | 807445546d493f9c092720e18e5fefa3281da4c9 | [
"Apache-2.0"
] | null | null | null | from sqlalchemy import Column, Integer, String
from app.db.base_class import Base
class SearchTerm(Base):
id = Column(Integer, primary_key=True, index=True)
term = Column(String, nullable=False, comment="Término de búsqueda para filtros", unique=True, index=True)
| 30.555556 | 110 | 0.76 | 39 | 275 | 5.307692 | 0.666667 | 0.125604 | 0.125604 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141818 | 275 | 8 | 111 | 34.375 | 0.877119 | 0 | 0 | 0 | 0 | 0 | 0.116364 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
1ae3b0d4623fb39afa8ccdec2cd3e21e3a3da924 | 109 | py | Python | paul_analysis/Python/util/hdf5lib_param.py | lzkelley/arepo-mbh-sims_analysis | f14519552cedd39a040b53e6d7cc538b5b8f38a3 | [
"MIT"
] | null | null | null | paul_analysis/Python/util/hdf5lib_param.py | lzkelley/arepo-mbh-sims_analysis | f14519552cedd39a040b53e6d7cc538b5b8f38a3 | [
"MIT"
] | null | null | null | paul_analysis/Python/util/hdf5lib_param.py | lzkelley/arepo-mbh-sims_analysis | f14519552cedd39a040b53e6d7cc538b5b8f38a3 | [
"MIT"
] | null | null | null | #tables or h5py
libname="h5py" #tables"
#libname="tables"
def setlib(name):
global libname
libname = name
| 13.625 | 23 | 0.724771 | 15 | 109 | 5.266667 | 0.533333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021505 | 0.146789 | 109 | 7 | 24 | 15.571429 | 0.827957 | 0.33945 | 0 | 0 | 0 | 0 | 0.057971 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1afff1ccdcfcf884da6805c728defb7d5049e9b8 | 424 | py | Python | jtr/load/embeddings/__init__.py | mitchelljeff/SUMMAD4.3 | 33bb3a74cff16a7aa699660a08d98ddcd662cad5 | [
"MIT"
] | 1 | 2017-09-15T14:06:07.000Z | 2017-09-15T14:06:07.000Z | jtr/load/embeddings/__init__.py | mitchelljeff/SUMMAD4.3 | 33bb3a74cff16a7aa699660a08d98ddcd662cad5 | [
"MIT"
] | null | null | null | jtr/load/embeddings/__init__.py | mitchelljeff/SUMMAD4.3 | 33bb3a74cff16a7aa699660a08d98ddcd662cad5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from jtr.load.embeddings.embeddings import Embeddings, load_embeddings
from jtr.load.embeddings.word_to_vec import load_word2vec, get_word2vec_vocabulary
from jtr.load.embeddings.glove import load_glove
from jtr.load.embeddings.vocabulary import Vocabulary
__all__ = [
'Embeddings',
'load_embeddings'
'load_word2vec',
'get_word2vec_vocabulary',
'load_glove',
'Vocabulary'
]
| 26.5 | 82 | 0.761792 | 52 | 424 | 5.903846 | 0.307692 | 0.273616 | 0.143322 | 0.273616 | 0.214984 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013699 | 0.139151 | 424 | 15 | 83 | 28.266667 | 0.827397 | 0.049528 | 0 | 0 | 0 | 0 | 0.201995 | 0.057357 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2102482614cbfec0280843f4652b4c092440bef6 | 80 | py | Python | todo/apps.py | arthtyagi/gettit | 26047f85a7cf0a5f380cde4e18f9bcc88bb27db6 | [
"MIT"
] | 6 | 2020-05-30T18:10:08.000Z | 2021-11-30T14:39:41.000Z | todo/apps.py | arthtyagi/gettit | 26047f85a7cf0a5f380cde4e18f9bcc88bb27db6 | [
"MIT"
] | 18 | 2020-06-21T12:04:47.000Z | 2022-01-13T02:57:16.000Z | todo/apps.py | arthtyagi/gettit | 26047f85a7cf0a5f380cde4e18f9bcc88bb27db6 | [
"MIT"
] | 1 | 2020-08-30T01:42:54.000Z | 2020-08-30T01:42:54.000Z | from django.apps import AppConfig
class TodoConfig(AppConfig):
name = 'todo'
| 13.333333 | 33 | 0.7625 | 10 | 80 | 6.1 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 80 | 5 | 34 | 16 | 0.897059 | 0 | 0 | 0 | 0 | 0 | 0.05 | 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 | 0 | 0 | 0 | 3 |
210ef2ae872b4a00dd69a05f6c0a2cbd5afb971f | 269 | py | Python | srv/tools/import_lemuria.py | Nekohime/lemuria | 0e6ca20522547026e4b20bb8cd8caa23633c171c | [
"MIT"
] | 13 | 2021-02-12T23:44:06.000Z | 2022-03-05T16:59:08.000Z | srv/tools/import_lemuria.py | Nekohime/lemuria | 0e6ca20522547026e4b20bb8cd8caa23633c171c | [
"MIT"
] | 3 | 2021-03-16T18:28:54.000Z | 2022-03-25T17:58:42.000Z | srv/tools/import_lemuria.py | Nekohime/lemuria | 0e6ca20522547026e4b20bb8cd8caa23633c171c | [
"MIT"
] | 5 | 2021-03-04T17:56:54.000Z | 2022-01-24T19:31:22.000Z | #!/usr/bin/env python3
# encoding: utf-8
"""Easily create ../app.db and import ../lemuria.json"""
import asyncio
from db_tools import init_db
from db_tools import import_world
asyncio.run(init_db())
asyncio.run(import_world('../atlemuria.txt', '../proplemuria.txt'))
| 24.454545 | 67 | 0.736059 | 41 | 269 | 4.682927 | 0.585366 | 0.0625 | 0.114583 | 0.177083 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00823 | 0.096654 | 269 | 10 | 68 | 26.9 | 0.781893 | 0.327138 | 0 | 0 | 0 | 0 | 0.195402 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.8 | 0 | 0.8 | 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 | 0 | 0 | 0 | 3 |
213cacab60c7aca13a5911f8efdb7500b4cda703 | 468 | py | Python | mine/chess_knight.py | NigrumAquila/py_checkio | df437c2c3ad325d84714665000e3299a70e91f32 | [
"MIT"
] | null | null | null | mine/chess_knight.py | NigrumAquila/py_checkio | df437c2c3ad325d84714665000e3299a70e91f32 | [
"MIT"
] | null | null | null | mine/chess_knight.py | NigrumAquila/py_checkio | df437c2c3ad325d84714665000e3299a70e91f32 | [
"MIT"
] | null | null | null | def chess_knight(start, moves):
def knight_can_move(from_pos, to_pos):
return set(map(lambda x: abs(ord(x[0]) - ord(x[1])), zip(from_pos, to_pos))) == {1, 2}
def knight_moves(pos):
return {f + r for f in 'abcdefgh' for r in '12345678' if knight_can_move(pos, f + r)}
# till task become consistent, hardcode
res = knight_moves(start)
if moves == 2:
res.update(*map(knight_moves, res))
return sorted(res) | 39 | 94 | 0.611111 | 75 | 468 | 3.653333 | 0.48 | 0.120438 | 0.094891 | 0.087591 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037143 | 0.252137 | 468 | 12 | 95 | 39 | 0.745714 | 0.07906 | 0 | 0 | 0 | 0 | 0.037209 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.222222 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
213fe410dc708c64e9b46a2d208e12a8faedbe74 | 147 | py | Python | GoogleColab/InteligenciaAnalitica/Ex5/downloadbase.py | AlexandroLuis/ComputerScience | 273c3f6797737d98ffdf00ae870ceafa3aba59d1 | [
"MIT"
] | 2 | 2021-02-06T21:48:24.000Z | 2022-03-21T00:16:17.000Z | GoogleColab/InteligenciaAnalitica/Ex5/downloadbase.py | AlexandroLuis/ComputerScience | 273c3f6797737d98ffdf00ae870ceafa3aba59d1 | [
"MIT"
] | null | null | null | GoogleColab/InteligenciaAnalitica/Ex5/downloadbase.py | AlexandroLuis/ComputerScience | 273c3f6797737d98ffdf00ae870ceafa3aba59d1 | [
"MIT"
] | 1 | 2022-02-10T20:59:23.000Z | 2022-02-10T20:59:23.000Z | # https://www.kaggle.com/datatattle/covid-19-nlp-text-classification
!gdown --id 1Hd0ytKZrR3s22FheUJt4EZOpZ4eWyTrN
!unzip tweets_corona_virus.zip
| 29.4 | 68 | 0.829932 | 18 | 147 | 6.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064748 | 0.054422 | 147 | 4 | 69 | 36.75 | 0.798561 | 0.44898 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
215aad09216d33e48ee72eef419bf4b1dbea80ce | 1,383 | py | Python | Ch10/test/singly_circular_list_dictionary_test.py | Ryuichi-Sasaki/CLRS | 3ae6f2c9554d2dffff0ea8f6f6e162fcdcf8f7e9 | [
"MIT"
] | null | null | null | Ch10/test/singly_circular_list_dictionary_test.py | Ryuichi-Sasaki/CLRS | 3ae6f2c9554d2dffff0ea8f6f6e162fcdcf8f7e9 | [
"MIT"
] | null | null | null | Ch10/test/singly_circular_list_dictionary_test.py | Ryuichi-Sasaki/CLRS | 3ae6f2c9554d2dffff0ea8f6f6e162fcdcf8f7e9 | [
"MIT"
] | null | null | null | import unittest
import sys
sys.path.append("../src/")
from singly_circular_list_dictionary import SinglyLinkedDictionary
from singly_circular_list_dictionary import Item
class TestSinglyLinkedDictionary(unittest.TestCase):
def test_insert_search(self):
d = SinglyLinkedDictionary()
self.assertEqual(None, d.search(0))
x = Item(0)
d.insert(x)
self.assertEqual(x, d.search(0))
y = Item(1)
d.insert(y)
self.assertEqual(x, d.search(0))
self.assertEqual(y, d.search(1))
self.assertEqual(None, d.search(2))
def test_delete_search(self):
d = SinglyLinkedDictionary()
w = Item(0)
d.insert(w)
d.delete(w)
self.assertEqual(None, d.search(0))
x = Item(1)
y = Item(2)
z = Item(3)
d.insert(x)
d.insert(y)
d.insert(z)
d.delete(y)
self.assertEqual(x, d.search(1))
self.assertEqual(None, d.search(2))
self.assertEqual(z, d.search(3))
d.delete(x)
self.assertEqual(None, d.search(1))
self.assertEqual(None, d.search(2))
self.assertEqual(z, d.search(3))
d.delete(z)
self.assertEqual(None, d.search(1))
self.assertEqual(None, d.search(2))
self.assertEqual(None, d.search(3))
if __name__ == "__main__":
unittest.main() | 26.09434 | 66 | 0.595083 | 183 | 1,383 | 4.398907 | 0.196721 | 0.279503 | 0.212422 | 0.223602 | 0.586335 | 0.572671 | 0.396273 | 0.396273 | 0.31677 | 0.273292 | 0 | 0.020792 | 0.269704 | 1,383 | 53 | 67 | 26.09434 | 0.776238 | 0 | 0 | 0.418605 | 0 | 0 | 0.010838 | 0 | 0 | 0 | 0 | 0 | 0.348837 | 1 | 0.046512 | false | 0 | 0.093023 | 0 | 0.162791 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dcd99c7731f5c8f42cf05cb204ee8f7516acc652 | 413 | py | Python | Diena_1_4_thonny/d2_u2_d11.py | edzya/Python_RTU_08_20 | d2921d998c611c18328dd523daf976a27ce858c1 | [
"MIT"
] | 8 | 2020-08-31T16:10:54.000Z | 2021-11-24T06:37:37.000Z | Diena_1_4_thonny/d2_u2_d11.py | edzya/Python_RTU_08_20 | d2921d998c611c18328dd523daf976a27ce858c1 | [
"MIT"
] | 8 | 2021-06-08T22:30:29.000Z | 2022-03-12T00:48:55.000Z | Diena_1_4_thonny/d2_u2_d11.py | edzya/Python_RTU_08_20 | d2921d998c611c18328dd523daf976a27ce858c1 | [
"MIT"
] | 12 | 2020-09-28T17:06:52.000Z | 2022-02-17T12:12:46.000Z | try:
width=float(input("Ieraksti savas istabas platumu (metros): "))
height=float(input("Ieraksti savas istabas augstumu (metros): "))
length=float(input("Ieraksti savas istabas garumu (metros): "))
capacity=round(width*height*length, 2)
print(f"Tavas istabas tilpums ir {capacity} m\u00b3.")
except ValueError:
print("Ievadiet vērtību ciparos! Komata vietā jālieto punkts.")
print("*"*30) | 45.888889 | 69 | 0.714286 | 52 | 413 | 5.673077 | 0.634615 | 0.101695 | 0.183051 | 0.233898 | 0.305085 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016997 | 0.145278 | 413 | 9 | 70 | 45.888889 | 0.818697 | 0 | 0 | 0 | 0 | 0 | 0.536232 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dceac604206c3804e988356a36e1c21687d75def | 50 | py | Python | api_module/___init__.py | miscdec/tk-auto-study | 2c5c716ab652dfc04796c335d2fb2bc01c494ccd | [
"MIT"
] | null | null | null | api_module/___init__.py | miscdec/tk-auto-study | 2c5c716ab652dfc04796c335d2fb2bc01c494ccd | [
"MIT"
] | null | null | null | api_module/___init__.py | miscdec/tk-auto-study | 2c5c716ab652dfc04796c335d2fb2bc01c494ccd | [
"MIT"
] | null | null | null | from . import main_api
__all__=[
"main_api"
] | 10 | 22 | 0.66 | 7 | 50 | 3.857143 | 0.714286 | 0.518519 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.22 | 50 | 5 | 23 | 10 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0.156863 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dcf7946f10ce6e7e4b323d54039dd26ab7fa02da | 271 | py | Python | problem_49/test_prime_permutations.py | plilja/project-euler | 646d1989cf15e903ef7e3c6e487284847d522ec9 | [
"Apache-2.0"
] | null | null | null | problem_49/test_prime_permutations.py | plilja/project-euler | 646d1989cf15e903ef7e3c6e487284847d522ec9 | [
"Apache-2.0"
] | null | null | null | problem_49/test_prime_permutations.py | plilja/project-euler | 646d1989cf15e903ef7e3c6e487284847d522ec9 | [
"Apache-2.0"
] | null | null | null | import unittest
from prime_permutations import *
class PrimePermutationsTest(unittest.TestCase):
def test_prime_permutations(self):
self.assertEqual(sorted(prime_permutations()), sorted([2969, 6299, 9629]))
if __name__ == '__main__':
unittest.main()
| 20.846154 | 82 | 0.741697 | 29 | 271 | 6.517241 | 0.655172 | 0.269841 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051948 | 0.147601 | 271 | 12 | 83 | 22.583333 | 0.766234 | 0 | 0 | 0 | 0 | 0 | 0.02952 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
dcf7baef1e6706bbb04fa4359be5af5f09500ebe | 1,495 | py | Python | lecture10/inventory_hitting_time.py | BenGravell/optimal-control-course | ae8ab619b5c138f79d466d9c6dfc7af46b2a23b6 | [
"MIT"
] | null | null | null | lecture10/inventory_hitting_time.py | BenGravell/optimal-control-course | ae8ab619b5c138f79d466d9c6dfc7af46b2a23b6 | [
"MIT"
] | null | null | null | lecture10/inventory_hitting_time.py | BenGravell/optimal-control-course | ae8ab619b5c138f79d466d9c6dfc7af46b2a23b6 | [
"MIT"
] | null | null | null | import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
capacity = 6
prob_demand_mass = np.array([0.7, 0.2, 0.1])
prob_demand_supp = np.array([0, 1, 2])
T = 50
P = np.array([[0, 0, 0, 0, prob_demand_mass[0], prob_demand_mass[1], prob_demand_mass[2]],
[0, 0, 0, 0, prob_demand_mass[0], prob_demand_mass[1], prob_demand_mass[2]],
[prob_demand_mass[0], prob_demand_mass[1], prob_demand_mass[2], 0, 0, 0, 0],
[0, prob_demand_mass[0], prob_demand_mass[1], prob_demand_mass[2], 0, 0, 0],
[0, 0, prob_demand_mass[0], prob_demand_mass[1], prob_demand_mass[2], 0, 0],
[0, 0, 0, prob_demand_mass[0], prob_demand_mass[1], prob_demand_mass[2], 0],
[0, 0, 0, 0, prob_demand_mass[0], prob_demand_mass[1], prob_demand_mass[2]]])
init_state = 6 # This should not be an element of the target_states
target_states = [0, 1]
Q = np.copy(P)
for target_state in target_states:
Q[target_state] = np.zeros(capacity+1)
Q[target_state, target_state] = 1
t_hist = np.arange(T)
hit_prob_hist = np.zeros(T)
for t in t_hist:
if t > 0:
Q1 = la.matrix_power(Q, t)
Q2 = la.matrix_power(Q, t-1)
Qdiff = Q1 - Q2
hit_prob_hist[t] = np.sum([Qdiff[init_state, target_state] for target_state in target_states])
plt.close('all')
plt.style.use('../conlab.mplstyle')
plt.step(t_hist, hit_prob_hist)
plt.xlabel('Time')
plt.ylabel('Hitting probability')
plt.tight_layout()
plt.show()
| 36.463415 | 102 | 0.656856 | 271 | 1,495 | 3.365314 | 0.239852 | 0.252193 | 0.337719 | 0.213816 | 0.470395 | 0.4375 | 0.376096 | 0.376096 | 0.376096 | 0.376096 | 0 | 0.059652 | 0.192642 | 1,495 | 40 | 103 | 37.375 | 0.69594 | 0.033445 | 0 | 0 | 0 | 0 | 0.030492 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.085714 | 0 | 0.085714 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0d05520e82655910896021870c67e33da2f6dc74 | 569 | py | Python | tests/api/schemas/test_product_schema.py | igor822/product-categorization | e9c64834bf60cd9d51ab9b696b1b3ea49e702c9d | [
"MIT"
] | 19 | 2018-11-13T15:12:12.000Z | 2022-01-31T20:43:26.000Z | tests/api/schemas/test_product_schema.py | igor822/product-categorization | e9c64834bf60cd9d51ab9b696b1b3ea49e702c9d | [
"MIT"
] | null | null | null | tests/api/schemas/test_product_schema.py | igor822/product-categorization | e9c64834bf60cd9d51ab9b696b1b3ea49e702c9d | [
"MIT"
] | 8 | 2019-03-07T03:32:43.000Z | 2020-11-13T01:51:03.000Z | import unittest
import pytest
from src.api.schemas.product_schema import ProductSchema
class ProductSchemaTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_validate_valid_product(self):
product = {"name": "Produt name", "description": "Some description"}
assert ProductSchema().load(product)
def test_validate_invalid_product(self):
product = {"name": "Produt name"}
validation = ProductSchema().load(product)
assert len(validation.errors['description']) == 1
| 27.095238 | 76 | 0.683656 | 61 | 569 | 6.262295 | 0.52459 | 0.041885 | 0.057592 | 0.115183 | 0.167539 | 0.167539 | 0 | 0 | 0 | 0 | 0 | 0.002222 | 0.209139 | 569 | 20 | 77 | 28.45 | 0.846667 | 0 | 0 | 0.133333 | 0 | 0 | 0.119508 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 1 | 0.266667 | false | 0.133333 | 0.2 | 0 | 0.533333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
0d1b7c2182554a8a0f1a06812e62cc4dae4383a2 | 122 | py | Python | py_tdlib/constructors/location.py | Mr-TelegramBot/python-tdlib | 2e2d21a742ebcd439971a32357f2d0abd0ce61eb | [
"MIT"
] | 24 | 2018-10-05T13:04:30.000Z | 2020-05-12T08:45:34.000Z | py_tdlib/constructors/location.py | MrMahdi313/python-tdlib | 2e2d21a742ebcd439971a32357f2d0abd0ce61eb | [
"MIT"
] | 3 | 2019-06-26T07:20:20.000Z | 2021-05-24T13:06:56.000Z | py_tdlib/constructors/location.py | MrMahdi313/python-tdlib | 2e2d21a742ebcd439971a32357f2d0abd0ce61eb | [
"MIT"
] | 5 | 2018-10-05T14:29:28.000Z | 2020-08-11T15:04:10.000Z | from ..factory import Type
class location(Type):
latitude = None # type: "double"
longitude = None # type: "double"
| 17.428571 | 35 | 0.680328 | 15 | 122 | 5.533333 | 0.666667 | 0.192771 | 0.337349 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196721 | 122 | 6 | 36 | 20.333333 | 0.846939 | 0.237705 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
0d22a9dd7d5f467850b8900e066974665ef38818 | 2,394 | py | Python | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/NV/draw_vulkan_image.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/NV/draw_vulkan_image.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/NV/draw_vulkan_image.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | '''OpenGL extension NV.draw_vulkan_image
This module customises the behaviour of the
OpenGL.raw.GL.NV.draw_vulkan_image to provide a more
Python-friendly API
Overview (from the spec)
This extension provides a new function, DrawVkImageNV(), allowing
applications to draw a screen-aligned rectangle displaying some or all of
the contents of a two-dimensional Vulkan VkImage. Callers specify a
Vulkan VkImage handle, an optional OpenGL sampler object, window
coordinates of the rectangle to draw, and texture coordinates corresponding
to the corners of the rectangle. For each fragment produced by the
rectangle, DrawVkImageNV interpolates the texture coordinates, performs
a texture lookup, and uses the texture result as the fragment color.
No shaders are used by DrawVkImageNV; the results of the texture lookup
are used in lieu of a fragment shader output. The fragments generated are
processed by all per-fragment operations. In particular,
DrawVkImageNV() fully supports blending and multisampling.
In order to synchronize between Vulkan and OpenGL there are three other
functions provided; WaitVkSemaphoreNV(), SignalVkSemaphoreNV() and
SignalVkFenceNV(). These allow OpenGL to wait for Vulkan to complete work
and also Vulkan to wait for OpenGL to complete work. Together OpenGL
and Vulkan can synchronize on the server without application
interation.
Finally the function GetVkProcAddrNV() is provided to allow the OpenGL
context to query the Vulkan entry points directly and avoid having to
load them through the typical Vulkan loader.
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/NV/draw_vulkan_image.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GL import _types, _glgets
from OpenGL.raw.GL.NV.draw_vulkan_image import *
from OpenGL.raw.GL.NV.draw_vulkan_image import _EXTENSION_NAME
def glInitDrawVulkanImageNV():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME )
# INPUT glGetVkProcAddrNV.name size not checked against 'name'
glGetVkProcAddrNV=wrapper.wrapper(glGetVkProcAddrNV).setInputArraySize(
'name', None
)
### END AUTOGENERATED SECTION | 45.169811 | 77 | 0.789474 | 327 | 2,394 | 5.730887 | 0.495413 | 0.032017 | 0.032017 | 0.045358 | 0.055496 | 0.055496 | 0.055496 | 0.040555 | 0.040555 | 0 | 0 | 0 | 0.166249 | 2,394 | 53 | 78 | 45.169811 | 0.938878 | 0.847118 | 0 | 0 | 0 | 0 | 0.008421 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.583333 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0d2fbfa96bb0ce534111ac7e21349a1c716d99fa | 637 | py | Python | PyOpenWorm/quantity.py | nheffelman/pyopdata | 5cc3042b004f167dbf18acc119474ea48b47810d | [
"MIT"
] | null | null | null | PyOpenWorm/quantity.py | nheffelman/pyopdata | 5cc3042b004f167dbf18acc119474ea48b47810d | [
"MIT"
] | null | null | null | PyOpenWorm/quantity.py | nheffelman/pyopdata | 5cc3042b004f167dbf18acc119474ea48b47810d | [
"MIT"
] | null | null | null | import pint as Q
class Quantity:
""" Enables the use of measurement units in our statements
"""
ur = Q.UnitRegistry()
@classmethod
def parse(self, s):
q = self.ur.Quantity(s)
my_q = Quantity(0,"mL")
my_q._quant = q
return my_q
def __init__(self, value, unit):
self._quant = self.ur.Quantity(value,unit)
@property
def unit(self):
return str(self._quant.units)
@property
def value(self):
return self._quant.magnitude
def serialize(self):
return (str(self.value) + self.unit)
#alias call to string
__str__ = serialize
| 21.233333 | 62 | 0.601256 | 84 | 637 | 4.380952 | 0.452381 | 0.024457 | 0.076087 | 0.092391 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002222 | 0.293564 | 637 | 29 | 63 | 21.965517 | 0.815556 | 0.125589 | 0 | 0.1 | 0 | 0 | 0.003636 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.05 | 0.15 | 0.65 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
0d426d8765e77fea1c98581ceb39c83d5c0fb5f4 | 215 | py | Python | parts/edag_diodes.py | baryluk/edag | 675107e2078bcecb30768a5e96c7431104352024 | [
"BSL-1.0"
] | null | null | null | parts/edag_diodes.py | baryluk/edag | 675107e2078bcecb30768a5e96c7431104352024 | [
"BSL-1.0"
] | null | null | null | parts/edag_diodes.py | baryluk/edag | 675107e2078bcecb30768a5e96c7431104352024 | [
"BSL-1.0"
] | null | null | null | #!/usr/bin/env python3
# Diodes
"1N4148"
"1N5817G"
"BAT43" # Zener
"1N457"
# bc junction of many transistors can also be used as dioded, i.e. 2SC1815, 2SA9012, etc. with very small leakage current (~1pA at -4V).
| 21.5 | 136 | 0.702326 | 34 | 215 | 4.441176 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162921 | 0.172093 | 215 | 9 | 137 | 23.888889 | 0.685393 | 0.818605 | 0 | 0 | 0 | 0 | 0.547619 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0d51ae17ec18a17c3026a04979a7cfd4797e2e95 | 1,680 | py | Python | infoblox_netmri/api/remote/models/wireless_hot_standby_grid_remote.py | IngmarVG-IB/infoblox-netmri | b0c725fd64aee1890d83917d911b89236207e564 | [
"Apache-2.0"
] | null | null | null | infoblox_netmri/api/remote/models/wireless_hot_standby_grid_remote.py | IngmarVG-IB/infoblox-netmri | b0c725fd64aee1890d83917d911b89236207e564 | [
"Apache-2.0"
] | null | null | null | infoblox_netmri/api/remote/models/wireless_hot_standby_grid_remote.py | IngmarVG-IB/infoblox-netmri | b0c725fd64aee1890d83917d911b89236207e564 | [
"Apache-2.0"
] | null | null | null | from ..remote import RemoteModel
from infoblox_netmri.utils.utils import check_api_availability
class WirelessHotStandbyGridRemote(RemoteModel):
"""
| ``id:`` none
| ``attribute type:`` string
| ``WlsHotSbTimestamp:`` none
| ``attribute type:`` string
| ``MonitoredIPDotted:`` none
| ``attribute type:`` string
| ``MonitoredIPNumeric:`` none
| ``attribute type:`` string
| ``MonitoredDevice:`` none
| ``attribute type:`` string
| ``MonitoredDeviceID:`` none
| ``attribute type:`` string
| ``MonitoredDeviceType:`` none
| ``attribute type:`` string
| ``WlsHotSbMAC:`` none
| ``attribute type:`` string
| ``WlsHotSbInd:`` none
| ``attribute type:`` string
| ``WlsHotSbStatus:`` none
| ``attribute type:`` string
| ``WlsHotSbState:`` none
| ``attribute type:`` string
| ``WlsHotSbPollingFeq:`` none
| ``attribute type:`` string
| ``WlsHotSbPollingTimeout:`` none
| ``attribute type:`` string
"""
properties = ("id",
"WlsHotSbTimestamp",
"MonitoredIPDotted",
"MonitoredIPNumeric",
"MonitoredDevice",
"MonitoredDeviceID",
"MonitoredDeviceType",
"WlsHotSbMAC",
"WlsHotSbInd",
"WlsHotSbStatus",
"WlsHotSbState",
"WlsHotSbPollingFeq",
"WlsHotSbPollingTimeout",
)
| 21.265823 | 62 | 0.491071 | 95 | 1,680 | 8.652632 | 0.315789 | 0.205596 | 0.268856 | 0.363747 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.383333 | 1,680 | 79 | 63 | 21.265823 | 0.793436 | 0.4625 | 0 | 0 | 0 | 0 | 0.267956 | 0.030387 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.117647 | 0 | 0.235294 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b49746c535ff505d70174da7005a75abdaab6aa0 | 1,707 | py | Python | src/test_uint8.py | disconnect3d/PicoBlade-asm | f4c1c5966f71ac9b11118dc0df1a6dd93699b4a2 | [
"MIT"
] | 4 | 2018-07-26T21:16:06.000Z | 2021-07-02T17:07:01.000Z | src/test_uint8.py | disconnect3d/PicoBlade-asm | f4c1c5966f71ac9b11118dc0df1a6dd93699b4a2 | [
"MIT"
] | 1 | 2016-11-09T22:47:05.000Z | 2017-01-19T23:34:50.000Z | src/test_uint8.py | disconnect3d/PicoBlade-asm | f4c1c5966f71ac9b11118dc0df1a6dd93699b4a2 | [
"MIT"
] | null | null | null | from src.uint8 import uint8
def test_constructor1():
assert int(uint8(20)) == 20
def test_constructor2():
assert uint8(256) == uint8(0)
assert uint8(260) == uint8(4)
assert uint8(-1) == uint8(255)
assert uint8(-5) == uint8(251)
assert uint8(-5) != uint8(252)
def test_add_other():
assert (uint8(50), 0) == uint8(20) + uint8(30)
assert (uint8(5), 1) == uint8(250) + uint8(11)
def test_add_int():
assert (uint8(50), 0) == uint8(20) + 30
assert (uint8(5), 1) == uint8(250) + 11
assert (uint8(251), 1) == uint8(1) + -6
def test_sub_other():
assert (uint8(246), 1) == uint8(20) - uint8(30)
assert (uint8(239), 0) == uint8(250) - uint8(11)
def test_sub_int():
assert (uint8(246), 1) == uint8(20) - 30
assert (uint8(239), 0) == uint8(250) - 11
assert (uint8(7), 0) == uint8(1) - -6
def test_and_other():
assert uint8(24) == uint8(31) & uint8(24)
assert uint8(0) == uint8(17) & uint8(12)
val = uint8(31)
val &= uint8(24)
assert val == uint8(24)
def test_and_int():
assert uint8(24) == uint8(31) & 24
assert uint8(0) == uint8(17) & 12
val = uint8(31)
val &= 24
assert val == uint8(24)
def test_eq_int():
assert uint8(42) == 42
assert uint8(256) == 0
assert uint8(-1) == 255
def test_mod():
assert uint8(32) % 2 == 0
assert uint8(5) % uint8(2) == 1
def test_lshift():
assert (uint8(0), 1) == uint8(128) << 1
assert (uint8(128), 1) == uint8(192) << 1
assert (uint8(64), 0) == uint8(32) << 1
def test_getitem():
assert uint8(16)[4] == 1
assert uint8(16)[5] == 0
for i in range(8):
assert uint8(255)[i] == 1
assert uint8(0)[i] == 0
| 22.168831 | 52 | 0.565319 | 266 | 1,707 | 3.556391 | 0.199248 | 0.360465 | 0.063425 | 0.053911 | 0.460888 | 0.32981 | 0.154334 | 0 | 0 | 0 | 0 | 0.197205 | 0.24546 | 1,707 | 76 | 53 | 22.460526 | 0.537267 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.653846 | 1 | 0.230769 | false | 0 | 0.019231 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b4c089a9dff52456f55324f47ec3da262a9da232 | 8,392 | py | Python | lentil/fourier.py | andykee/lentil | 28b3e449336ec4a405144b302d7c0d92d308f052 | [
"BSD-3-Clause"
] | 6 | 2020-07-30T19:33:22.000Z | 2022-01-19T19:17:13.000Z | lentil/fourier.py | andykee/lentil | 28b3e449336ec4a405144b302d7c0d92d308f052 | [
"BSD-3-Clause"
] | 42 | 2020-06-19T06:02:10.000Z | 2022-03-05T00:06:46.000Z | lentil/fourier.py | andykee/lentil | 28b3e449336ec4a405144b302d7c0d92d308f052 | [
"BSD-3-Clause"
] | 2 | 2021-08-05T18:27:08.000Z | 2022-01-18T19:42:40.000Z | import functools
import numpy as np
def dft2(f, alpha, npix=None, shift=(0, 0), offset=(0, 0), unitary=True, out=None):
"""Compute the 2-dimensional discrete Fourier Transform.
This function allows independent control over input shape, output shape,
and output sampling by implementing the matrix triple product algorithm
described in [1].
Parameters
----------
f : array_like
2D array to Fourier Transform
alpha : float or array_like
Output plane sampling interval (frequency). If :attr:`alpha` is an
array, ``alpha[1]`` represents row-wise sampling and ``alpha[2]``
represents column-wise sampling. If :attr:`alpha` is a scalar,
``alpha[1] = alpha[2] = alpha`` gives uniform sampling across the rows
and columns of the output plane.
npix : int or array_like, optional
Size of the output array :attr:`F`. If :attr:`npix` is an array,
``F.shape = (npix[1], npix[2])``. If :attr:`npi`` is a scalar,
``F.shape = (npix, npix)``. Default is ``f.shape``.
shift : array_like, optional
Number of pixels in (r,c) to shift the DC pixel in the output plane
with the origin centrally located in the plane. Default is ``(0,0)``.
offset : array_like, optional
Number of pixels in (r,c) that the input plane is shifted relative to
the origin. Default is ``(0,0)``.
unitary : bool, optional
Normalization flag. If ``True``, a normalization is performed on the
output such that the DFT operation is unitary and energy is conserved
through the Fourier transform operation (Parseval's theorem). In this
way, the energy in in a limited-area DFT is a fraction of the total
energy corresponding to the limited area. Default is ``True``.
out : ndarray or None
A location into which the result is stored. If provided, it must have
shape = npix and dtype = np.complex. If not provided or None, a
freshly-allocated array is returned.
Returns
-------
F : complex ndarray
Notes
-----
* Setting ``alpha = 1/f.shape`` and ``npix = f.shape`` is equivalent to
::
F = np.fft.ifftshift(np.fft.fft2(np.fft.fftshift(f)))
* ``dft2()`` is designed to place the DC pixel in the same location as a
well formed call to any standard FFT for both even and odd sized input
arrays. The DC pixel is located at ``np.floor(npix/2) + 1``, which is
consistent with calls to Numpy's FFT method where the input and output
are correctly shifted:
``np.fft.ifftshift(np.fft.fft2(np.fft.fftshift(f)))``.
* If the y-axis shift behavior is not what you are expecting, you most
likely have your plotting axes flipped (matplotlib's default behavior is
to place [0,0] in the upper left corner of the axes). This may be resolved
by either flipping the sign of the y component of ``shift`` or by passing
``origin = 'lower'`` to ``imshow()``.
References
----------
[1] Soummer, et. al. Fast computation of Lyot-style coronagraph propagation (2007)
"""
alpha_row, alpha_col = _sanitize_alpha(alpha)
f = np.asarray(f)
m, n = f.shape
if npix is None:
npix = [m, n]
M, N = _sanitize_npix(npix)
shift_row, shift_col = _sanitize_shift(shift)
offset_row, offset_col = _sanitize_npix(offset)
if out is not None:
if not np.can_cast(complex, out.dtype):
raise TypeError(f"Cannot cast complex output to dtype('{out.dtype}')")
E1, E2 = _dft2_matrices(m, n, M, N, alpha_row, alpha_col, shift_row, shift_col,
offset_row, offset_col)
F = np.dot(E1.dot(f), E2, out=out)
# now calculate the answer, without reallocating memory
if unitary:
np.multiply(F, np.sqrt(np.abs(alpha_row * alpha_col)), out=F)
return F
@functools.lru_cache(maxsize=32)
def _dft2_matrices(m, n, M, N, alphar, alphac, shiftr, shiftc, offsetr, offsetc):
R, S, U, V = _dft2_coords(m, n, M, N)
E1 = np.exp(-2.0 * 1j * np.pi * alphar * np.outer(R-shiftr+offsetr, U-shiftr)).T
E2 = np.exp(-2.0 * 1j * np.pi * alphac * np.outer(S-shiftc+offsetc, V-shiftc))
return E1, E2
@functools.lru_cache(maxsize=32)
def _dft2_coords(m, n, M, N):
# R and S are (r,c) coordinates in the (m x n) input plane f
# V and U are (r,c) coordinates in the (M x N) output plane F
R = np.arange(m) - np.floor(m/2.0)
S = np.arange(n) - np.floor(n/2.0)
U = np.arange(M) - np.floor(M/2.0)
V = np.arange(N) - np.floor(N/2.0)
return R, S, U, V
def idft2(F, alpha, npix=None, shift=(0,0), unitary=True, out=None):
"""Compute the 2-dimensional inverse discrete Fourier Transform.
This function allows independent control over input shape, output shape,
and output sampling by implementing the matrix triple product algorithm
described in [1].
Parameters
----------
F : array_like
2D array to Fourier Transform
alpha : float or array_like
Input plane sampling interval (frequency). If :attr:`alpha` is an array,
``alpha[1]`` represents row-wise sampling and ``alpha[2]`` represents
column-wise sampling. If :attr:`alpha` is a scalar,
``alpha[1] = alpha[2] = alpha`` represents uniform sampling across the
rows and columns of the input plane.
npix : int or array_like, optional
Size of the output array :attr:`F`. If :attr:`npix` is an array,
``F.shape = (npix[1], npix[2])``. If :attr:`npix` is a scalar,
``F.shape = (npix, npix)``. Default is ``F.shape``
shift : array_like, optional
Number of pixels in (x,y) to shift the DC pixel in the output plane with
the origin centrally located in the plane. Default is `[0,0]`.
unitary : bool, optional
Normalization flag. If ``True``, a normalization is performed on the
output such that the DFT operation is unitary and energy is conserved
through the Fourier transform operation (Parseval's theorem). In this
way, the energy in in a limited-area DFT is a fraction of the total
energy corresponding to the limited area. Default is ``True``.
Returns
-------
f : complex ndarray
Notes
-----
* Setting ``alpha = 1/F.shape`` and ``npix = F.shape`` is equivalent to
::
F = np.fft.ifftshift(np.fft.ifft2(np.fft.fftshift(F)))
* ``idft2()`` is designed to place the DC pixel in the same location as a
well formed call to any standard FFT for both even and odd sized input
arrays. The DC pixel is located at ``np.floor(npix/2) + 1``, which is
consistent with calls to Numpy's IFFT method where the input and output
are correctly shifted:
``np.fft.ifftshift(np.fft.ifft2(np.fft.fftshift(f)))``.
* If the y-axis shift behavior is not what you are expecting, you most
likely have your plotting axes flipped (matplotlib's default behavior is
to place [0,0] in the upper left corner of the axes). This may be resolved
by either flipping the sign of the y component of ``shift`` or by passing
``origin = 'lower'`` to ``imshow()``.
References
----------
[1] Soummer, et. al. Fast computation of Lyot-style coronagraph propagation (2007)
[2] `Expressing the inverse DFT in terms of the DFT <https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Expressing_the_inverse_DFT_in_terms_of_the_DFT>`_.
"""
F = np.asarray(F)
N = F.size
# will allocate memory for F if out == None
F = dft2(np.conj(F), alpha, npix, shift, unitary=unitary, out=out)
np.conj(F, out=F)
return np.divide(F, N, out=F)
def _sanitize_alpha(x):
"""Return consistent representation of alpha as ar, ac"""
x = np.asarray(x)
if x.size == 1:
ar, ac = float(x), float(x)
else:
ar, ac = float(x[0]), float(x[1])
return ar, ac
def _sanitize_npix(x):
"""Return consistent representation of npix as M, N"""
x = np.asarray(x)
if x.size == 1:
M, N = int(x), int(x)
else:
M, N = int(x[0]), int(x[1])
return M, N
def _sanitize_shift(x):
"""Return consistent representation of shift as sr, sc"""
if isinstance(x, np.ndarray):
sr, sc = float(x[0]), float(x[1])
else:
sr, sc = x
return sr, sc
| 38.319635 | 164 | 0.636916 | 1,309 | 8,392 | 4.038197 | 0.197097 | 0.005675 | 0.011351 | 0.003784 | 0.756527 | 0.737798 | 0.722664 | 0.697692 | 0.676126 | 0.629398 | 0 | 0.015528 | 0.247974 | 8,392 | 218 | 165 | 38.495413 | 0.822057 | 0.68601 | 0 | 0.152542 | 0 | 0 | 0.022957 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.118644 | false | 0 | 0.033898 | 0 | 0.271186 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b4c33445657935893d39d91a0309206fd2cd458e | 391 | py | Python | tellurium/notebooks/__init__.py | kirichoi/tellurium | 77cf6e794600587741ebe209644a78051e0db1d5 | [
"Apache-2.0"
] | 73 | 2016-06-13T12:44:28.000Z | 2021-12-31T14:44:39.000Z | tellurium/notebooks/__init__.py | kirichoi/tellurium | 77cf6e794600587741ebe209644a78051e0db1d5 | [
"Apache-2.0"
] | 461 | 2015-03-26T00:05:16.000Z | 2022-03-16T17:24:35.000Z | tellurium/notebooks/__init__.py | kirichoi/tellurium | 77cf6e794600587741ebe209644a78051e0db1d5 | [
"Apache-2.0"
] | 30 | 2016-01-18T16:50:54.000Z | 2021-07-06T09:29:53.000Z | """
notebook imports
"""
from __future__ import absolute_import
import warnings
import ipywidgets
import IPython
from .notebooktools import *
from .ontologysearch import OntologySearch
from .parameterslider import ParameterSlider
from .speciessearch import SearchBySpeciesForm
# except ImportError:
# warnings.warn("Notebook tools are not imported, due to missing dependencies.")
| 17.772727 | 83 | 0.808184 | 41 | 391 | 7.585366 | 0.609756 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138107 | 391 | 21 | 84 | 18.619048 | 0.922849 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
b4c97a273a81770eaaca18c88e6e3fb3e5d16e27 | 1,307 | py | Python | cupy/linalg/norm.py | umitanuki/chainer | 225c56b233e684ff4855451d2af4c2fb66915f21 | [
"MIT"
] | null | null | null | cupy/linalg/norm.py | umitanuki/chainer | 225c56b233e684ff4855451d2af4c2fb66915f21 | [
"MIT"
] | null | null | null | cupy/linalg/norm.py | umitanuki/chainer | 225c56b233e684ff4855451d2af4c2fb66915f21 | [
"MIT"
] | 1 | 2018-11-18T00:36:51.000Z | 2018-11-18T00:36:51.000Z | def norm(x, ord=None, axis=None):
# TODO(beam2d): Implement it
raise NotImplementedError
def cond(x, p=None):
# TODO(beam2d): Implement it
raise NotImplementedError
def det(a):
# TODO(beam2d): Implement it
raise NotImplementedError
def matrix_rank(M, tol=None):
# TODO(beam2d): Implement it
raise NotImplementedError
def slogdet(a):
# TODO(beam2d): Implement it
raise NotImplementedError
def trace(a, offset=0, axis1=0, axis2=1, dtype=None, out=None):
"""Returns the sum along the diagonals of an array.
It computes the sum along the diagonals at ``axis1`` and ``axis2``.
Args:
a (cupy.ndarray): Array to take trace.
offset (int): Index of diagonals. Zero indicates the main diagonal, a
positive value an upper diagonal, and a negative value a lower
diagonal.
axis1 (int): The first axis along which the trace is taken.
axis2 (int): The second axis along which the trace is taken.
dtype: Data type specifier of the output.
out (cupy.ndarray): Output array.
Returns:
cupy.ndarray: The trace of ``a`` along axes ``(axis1, axis2)``.
.. seealso:: :func:`numpy.trace`
"""
d = a.diagonal(offset, axis1, axis2)
return d.sum(-1, dtype, out, False)
| 26.673469 | 77 | 0.646519 | 180 | 1,307 | 4.688889 | 0.4 | 0.059242 | 0.112559 | 0.124408 | 0.424171 | 0.369668 | 0.369668 | 0.300948 | 0 | 0 | 0 | 0.019348 | 0.248661 | 1,307 | 48 | 78 | 27.229167 | 0.840122 | 0.605203 | 0 | 0.384615 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020833 | 0 | 1 | 0.461538 | false | 0 | 0 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b4ea18107650e6d8144929adf5242acb860cb78c | 198 | py | Python | src/setup.py | Mr-Salme/CipheyCore | f9ce42973d141a6cfd506ec7a423443293d29201 | [
"MIT"
] | null | null | null | src/setup.py | Mr-Salme/CipheyCore | f9ce42973d141a6cfd506ec7a423443293d29201 | [
"MIT"
] | null | null | null | src/setup.py | Mr-Salme/CipheyCore | f9ce42973d141a6cfd506ec7a423443293d29201 | [
"MIT"
] | null | null | null | from setuptools import setup, Extension
# Compile parts of `freq.cpp` into a shared library so we can call it from Python
setup(
#...
ext_modules=[Extension('gof_test', ['freq.cpp'],),],
)
| 24.75 | 81 | 0.686869 | 29 | 198 | 4.62069 | 0.827586 | 0.104478 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176768 | 198 | 7 | 82 | 28.285714 | 0.822086 | 0.414141 | 0 | 0 | 0 | 0 | 0.141593 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
370a15691cec20cb2cd5ab37aca120000fa1eaf8 | 40,610 | py | Python | v2.5.7/toontown/episodes/MoneybinTakeover.py | TTOFFLINE-LEAK/ttoffline | bb0e91704a755d34983e94288d50288e46b68380 | [
"MIT"
] | 4 | 2019-07-01T15:46:43.000Z | 2021-07-23T16:26:48.000Z | v2.5.7/toontown/episodes/MoneybinTakeover.py | TTOFFLINE-LEAK/ttoffline | bb0e91704a755d34983e94288d50288e46b68380 | [
"MIT"
] | 1 | 2019-06-29T03:40:05.000Z | 2021-06-13T01:15:16.000Z | v2.5.7/toontown/episodes/MoneybinTakeover.py | TTOFFLINE-LEAK/ttoffline | bb0e91704a755d34983e94288d50288e46b68380 | [
"MIT"
] | 4 | 2019-07-28T21:18:46.000Z | 2021-02-25T06:37:25.000Z | from toontown.avatar import ToontownAvatarUtils
from toontown.avatar.CogExtras import *
PROPS = [
(
5, 'modules', 'suit_walls', (0.0, 342.4, 0.0), (-10.5, 0.0, 0.0), (54.6, 54.6, 54.6), 'wall_suit_build5', None,
None),
(
5, 'modules', 'suit_walls', (53.686, 332.45, 0.0), (-16.5, 0.0, 0.0), (54.6, 54.6, 54.6), 'wall_suit_build5', None,
None),
(
5, 'modules', 'suit_walls', (106.037, 316.943, 0.0), (-24.0, 0.0, 0.0), (54.6, 54.6, 54.6), 'wall_suit_build5',
None, None),
(
5, 'modules', 'suit_walls', (155.917, 294.735, 0.0), (-36.0, 0.0, 0.0), (54.6, 54.6, 54.6), 'wall_suit_build5',
None, None),
(
4, 'modules', 'suit_landmark_corp', (196.307, 269.394, 0.0), (-49.5, 0.0, 0.0), (2.7, 2.7, 2.7), None, None, None),
(
5, 'modules', 'suit_walls', (247.652, 209.276, 0.0), (-54.0, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build4',
None, None),
(
5, 'modules', 'suit_walls', (280.215, 164.456, 0.0), (-70.5, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build4',
None, None),
(
5, 'modules', 'suit_walls', (298.708, 112.234, 0.0), (-81.0, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build4',
None, None),
(
5, 'modules', 'suit_walls', (307.374, 57.516, 0.0), (-88.5, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build4',
None,
None),
(
5, 'modules', 'suit_walls', (308.824, 2.135, 0.0), (-96.0, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build3', None,
None),
(
5, 'modules', 'suit_walls', (303.034, -52.961, 0.0), (-102.0, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build3',
None, None),
(
5, 'modules', 'suit_walls', (291.515, -107.15, 0.0), (-115.5, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build3',
None, None),
(
5, 'modules', 'suit_walls', (267.665, -157.153, 0.0), (-129.0, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build3',
None, None),
(
5, 'modules', 'suit_walls', (232.801, -200.207, 0.0), (-142.5, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build3',
None, None),
(
5, 'modules', 'suit_walls', (-78.657, -284.069, 0.0), (165.5, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build1',
None, None),
(
5, 'modules', 'suit_walls', (-132.292, -270.198, 0.0), (149.0, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build1',
None, None),
(
5, 'modules', 'suit_walls', (-179.779, -241.665, 0.0), (134.0, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build1',
None, None),
(
5, 'modules', 'suit_walls', (-218.263, -201.813, 0.0), (123.5, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build2',
None, None),
(
5, 'modules', 'suit_walls', (-248.84, -155.616, 0.0), (114.5, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build2',
None, None),
(
5, 'modules', 'suit_walls', (-271.814, -105.204, 0.0), (96.5, 0.0, 0.0), (55.4, 55.4, 55.4), 'wall_suit_build2',
None, None),
(
4, 'modules', 'suit_landmark_legal', (-278.086, -50.161, 0.0), (87.5, 0.0, 0.0), (2.7, 2.7, 2.7), None, None,
None),
(
5, 'modules', 'suit_walls', (-274.513, 31.661, 0.0), (81.5, 0.0, 0.0), (54.5, 54.5, 54.5), 'wall_suit_build4',
None,
None),
(
5, 'modules', 'suit_walls', (-266.458, 85.563, 0.0), (66.5, 0.0, 0.0), (54.5, 54.5, 54.5), 'wall_suit_build4',
None,
None),
(
5, 'modules', 'suit_walls', (-244.726, 135.543, 0.0), (54.5, 0.0, 0.0), (54.5, 54.5, 54.5), 'wall_suit_build4',
None, None),
(
5, 'modules', 'suit_walls', (-213.078, 179.912, 0.0), (65.0, 0.0, 0.0), (54.5, 54.5, 54.5), 'wall_suit_build4',
None, None),
(
5, 'modules', 'suit_walls', (-190.045, 229.306, 0.0), (68.0, 0.0, 0.0), (54.5, 54.5, 54.5), 'wall_suit_build5',
None, None),
(
5, 'modules', 'suit_walls', (-169.629, 279.838, 0.0), (54.5, 0.0, 0.0), (54.5, 54.5, 54.5), 'wall_suit_build5',
None, None),
(
5, 'modules', 'suit_walls', (-137.98, 324.207, 0.0), (12.5, 0.0, 0.0), (54.5, 54.5, 54.5), 'wall_suit_build5',
None,
None),
(
4, 'modules', 'suit_landmark_sales', (-86.515, 338.143, 0.0), (5.0, 0.0, 0.0), (2.8, 2.8, 2.8), None, None, None),
(
6, 'cogHQ', 'WaterTowerSimple', (110.0, -140.0, 0.0), (0.0, 0.0, 0.0), (1.0, 1.0, 1.0), None, None, None),
(
6, 'cogHQ', 'WaterTowerSimple', (83.4, -175.2, 0.0), (0.0, 0.0, 0.0), (0.8, 0.8, 0.8), None, None, None),
(
6, 'cogHQ', 'WaterTowerSimple', (51.0, 131.8, 0.15), (54.0, 0.0, 0.0), (2.0, 2.0, 2.0), None, None, None),
(
6, 'cogHQ', 'WaterTowerSimple', (86.812, 209.566, 0.15), (-25.5, 0.0, 0.0), (1.4, 1.4, 1.4), None, None, None),
(
6, 'cogHQ', 'WaterTowerSimple', (125.888, 94.562, 0.15), (13.5, 0.0, 0.0), (1.4, 1.4, 1.4), None, None, None),
(
6, 'cogHQ', 'WaterTowerSimple', (167.643, -205.228, 0.15), (293.0, 0.0, 0.0), (1.1, 1.1, 1.1), None, None, None),
(
6, 'cogHQ', 'SmokeStack_simple', (-67.683, 76.087, 0.15), (293.0, 0.0, 0.0), (1.1, 1.1, 1.1), None, None, None),
(
6, 'cogHQ', 'SmokeStack_simple', (-76.301, 48.529, 0.15), (293.0, 0.0, 0.0), (1.025, 1.025, 1.025), None, None,
None),
(
6, 'cogHQ', 'SmokeStack_simple', (-90.453, 37.979, 0.15), (293.0, 0.0, 0.0), (0.875, 0.875, 0.875), None, None,
None),
(
6, 'cogHQ', 'SmokeStack_simple', (-96.849, 7.107, 0.15), (293.0, 0.0, 0.0), (0.775, 0.775, 0.775), None, None,
None),
(
9, 'cogHQ', 'woodCrateB', (91.145, -154.239, 0.3), (403.5, 0.0, 0.0), (2.575, 2.575, 2.575), None, None, None),
(
9, 'cogHQ', 'metal_crateB', (241.218, 62.596, 0.3), (325.5, 0.0, 0.0), (3.975, 3.975, 3.975), None, None, None),
(
9, 'cogHQ', 'FactoryGearB', (215.457, -170.329, 3.15), (339.0, 0.0, 0.0), (12.975, 12.975, 12.975), None, None,
None),
(
9, 'cogHQ', 'woodCrateB', (223.817, 70.637, 0.15), (348.0, 0.0, 0.0), (2.875, 2.875, 2.875), None, None, None),
(
10, 'cashbotHQ', 'CBWoodCrate', (148.604, -193.93, 0.25), (336.0, 0.0, 0.0), (2.875, 2.875, 2.875), None, None,
None),
(
10, 'cashbotHQ', 'CBMetalCrate', (187.686, -190.44, 0.25), (364.5, 0.0, 0.0), (2.875, 2.875, 2.875), None, None,
None),
(
10, 'cashbotHQ', 'CBMetalCrate', (159.86, -175.457, 0.25), (360.0, 0.0, 0.0), (2.425, 2.425, 2.425), None, None,
None),
(
10, 'cashbotHQ', 'DoubleGoldStack', (130.958, 188.263, 0.25), (378.0, 0.0, 0.0), (2.425, 2.425, 2.425), None, None,
None),
(
10, 'cashbotHQ', 'DoubleCoinStack', (16.991, 243.846, 0.25), (367.5, 0.0, 0.0), (2.425, 2.425, 2.425), None, None,
None),
(
10, 'cashbotHQ', 'MoneyStackPallet', (94.762, 80.424, 0.25), (378.0, 0.0, 0.0), (2.425, 2.425, 2.425), None, None,
None),
(
10, 'cashbotHQ', 'CashBotSafe', (152.787, 77.659, 0.25), (369.0, 0.0, 0.0), (1.0, 1.0, 1.0), None, None, None),
(
10, 'cashbotHQ', 'CashBotSafe', (167.633, 76.774, 0.25), (352.5, 0.0, 0.0), (1.0, 1.0, 1.0), None, None, None),
(
10, 'cashbotHQ', 'MoneyStackPallet', (232.506, -16.91, 0.25), (334.5, 0.0, 0.0), (2.4, 2.4, 2.4), None, None,
None),
(
10, 'cashbotHQ', 'shelf_A1', (262.684, 171.426, 0.25), (312.0, 0.0, 0.0), (2.4, 2.4, 2.4), None, None, None),
(
10, 'cashbotHQ', 'shelf_A1MoneyBags', (280.169, 125.461, 0.25), (289.5, 0.0, 0.0), (2.4, 2.4, 2.4), None, None,
None),
(
10, 'cashbotHQ', 'VaultDoorCover', (168.327, 284.185, 0.25), (328.5, 0.0, 0.0), (2.4, 2.4, 2.4), None, None, None),
(
10, 'cashbotHQ', 'shelf_A1Gold', (130.324, 297.732, 0.25), (337.5, 0.0, 0.0), (2.4, 2.4, 2.4), None, None, None),
(
10, 'cashbotHQ', 'shelf_A1Gold', (94.847, 312.427, 0.25), (340.5, 0.0, 0.0), (2.4, 2.4, 2.4), None, None, None),
(
10, 'cashbotHQ', 'shelf_A1Gold', (56.096, 316.298, 0.25), (345.0, 0.0, 0.0), (2.4, 2.4, 2.4), None, None, None),
(
6, 'cogHQ', 'WaterTowerSimple', (-43.383, -149.335, 0.0), (28.5, 0.0, 0.0), (1.0, 1.0, 1.0), None, None, None),
(
6, 'cogHQ', 'WaterTowerSimple', (-84.082, -125.941, 0.0), (-12.0, 0.0, 0.0), (1.2, 1.2, 1.2), None, None, None),
(
9, 'cogHQ', 'woodCrateB', (-106.023, -12.046, 0.0), (3.0, 0.0, 0.0), (2.5, 2.5, 2.5), None, None, None),
(
9, 'cogHQ', 'CogDoorHandShake', (-233.571, 146.487, 0.0), (58.5, 0.0, 0.0), (2.5, 2.5, 2.5), None, None, None),
(
10, 'cashbotHQ', 'CBWoodCrate', (-112.604, -121.894, 0.15), (31.5, 0.0, 0.0), (2.5, 2.5, 2.5), None, None, None),
(
10, 'cashbotHQ', 'crates_C1', (-152.706, 242.107, 0.15), (52.5, 0.0, 0.0), (2.5, 2.5, 2.5), None, None, None),
(
10, 'cashbotHQ', 'GoldBarStack', (-170.256, 215.103, 0.15), (48.0, 0.0, 0.0), (2.5, 2.5, 2.5), None, None, None),
(
10, 'cashbotHQ', 'MoneyStackPallet', (-186.041, 186.343, 0.15), (48.0, 0.0, 0.0), (2.5, 2.5, 2.5), None, None,
None),
(
10, 'cashbotHQ', 'shelf_A1Gold', (-249.959, 76.956, 0.15), (67.5, 0.0, 0.0), (2.5, 2.5, 2.5), None, None, None),
(
11, 'lawbotHQ', 'LB_paper_stacks', (-159.375, 13.489, 0.15), (45.0, 0.0, 0.0), (1.875, 1.875, 1.875), None, None,
None),
(
9, 'cogHQ', 'old_sky', (0.0, 0.0, 378.952), (15.5, 0.0, 0.0), (1.475, 1.475, 1.475), None, None, None)]
class MoneybinTakeover:
def __init__(self):
base.camLens.setFov(60)
self.modelList = []
self.moneyBinTheme = None
self.moneyBinTakeOver = None
self.moneybin = None
self.cogbin = None
self.cogArea = None
self.cogSky = None
return
def generate(self):
def addModels(PROPS, parent, children=False, strong=None):
for prop in PROPS:
if children:
if prop[6]:
if prop[0] == 'custom':
model = loader.loadModel('custom/models/%s/%s.egg' % (prop[1], prop[2])).find('**/%s' % prop[6])
else:
model = loader.loadModel('phase_%s/models/%s/%s' % (prop[0], prop[1], prop[2])).find('**/%s' % prop[6])
elif prop[0] == 'custom':
model = loader.loadModel('custom/models/%s/%s.egg' % (prop[1], prop[2]))
else:
model = loader.loadModel('phase_%s/models/%s/%s' % (prop[0], prop[1], prop[2]))
else:
if prop[0] == 'custom':
model = loader.loadModel('custom/models/%s/%s.egg' % (prop[1], prop[2]))
else:
model = loader.loadModel('phase_%s/models/%s/%s' % (prop[0], prop[1], prop[2]))
model.reparentTo(parent)
model.setPos(prop[3])
model.setHpr(prop[4])
model.setScale(prop[5])
self.modelList.append(model)
if prop[7]:
model.setColorScale(prop[7])
if prop[8]:
texture = loader.loadTexture(prop[8])
model.setTexture(texture, 1)
if strong:
model.flattenStrong()
self.moneyBinTheme = loader.loadMusic('phase_14.5/audio/bgm/SB_hub.ogg')
self.moneyBinTakeOver = loader.loadMusic('phase_14.5/audio/sfx/SB_Takeover.ogg')
self.cogArea = render.attachNewNode('cogArea')
self.cogArea.setZ(150)
self.cogArea.hide()
self.cogArea.setColorScale(1, 0.912, 0.863, 1)
self.cogSky = loader.loadModel('phase_9/models/cogHQ/old_sky')
self.cogSky.reparentTo(render)
self.cogSky.setPosHprScale(0, 0, 378.952, 15.5, 0, 0, 1.475, 1.475, 1.475)
self.cogSky.hide()
self.modelList.append(self.cogSky)
self.modelList.append(self.cogArea)
addModels(PROPS, self.cogArea, children=True)
self.setUpStreet()
loader.loadDNAFile(base.cr.playGame.hood.dnaStore, 'phase_8/dna/storage_ODG.jazz')
loader.loadDNAFile(base.cr.playGame.hood.dnaStore, 'phase_4/dna/storage.jazz')
loader.loadDNAFile(base.cr.playGame.hood.dnaStore, 'phase_4/dna/storage_TT_sz.jazz')
self.moneybin = loader.loadDNAFile(base.cr.playGame.hood.dnaStore, 'phase_14/dna/tt_dg_moneybin_area.jazz')
self.moneybin = NodePath(self.moneybin)
self.moneybin.setH(90)
self.moneybin.reparentTo(render)
self.modelList.append(self.moneybin)
self.sky = loader.loadModel('phase_3.5/models/props/TT_sky')
self.sky.setScale(2.42)
self.sky.reparentTo(render)
self.cogbin = loader.loadModel('phase_14/models/modules/cogbin')
self.cogbin.reparentTo(render)
self.cogbin.setPosHprScale(0.0, 2.16, 150, 0.0, 0.0, 0.0, 1.38, 1.38, 1.38)
self.cogbin.hide()
self.modelList.append(self.cogbin)
groundTexture = loader.loadTexture('phase_9/maps/ground7.jpg')
sidewalkTexture = loader.loadTexture('phase_9/maps/CementFloorx4Warm.jpg')
self.robberbaron = ToontownAvatarUtils.createDistributedCog('rb', 0.0, -48.43, 16.999, 0.0, 0.0, 0.0, level=12)
streetTrack = Parallel()
for street in ['street_80x40_sidewalk', 'street_80x40_curb', 'street_80x40_street', 'street_25x40_street',
'street_25x40_sidewalk', 'street_25x40_curb']:
for node in render.findAllMatches('**/%s' % street):
streetTrack.append(Func(node.setTexture, groundTexture, 1))
streetTrack.append(Func(node.setTexture, sidewalkTexture, 1))
streetTrack.append(Func(node.setTexture, sidewalkTexture, 1))
moneybinTrack = Parallel(self.moneybin.find('**/moneybin1').colorScaleInterval(4.2, (0,
0,
0,
1)), self.moneybin.find('**/moneybin1').colorScaleInterval(4.2, (0,
0,
0,
1)), Sequence(Wait(1.75), Parallel(Sequence(Parallel(self.moneybin.find('**/moneybin1').scaleInterval(3.75, (1,
1,
0.001)), self.moneybin.find('**/flowers').scaleInterval(3.75, (1,
1,
0.001)), self.moneybin.find('**/trees').scaleInterval(3.75, (1,
1,
0.001)), self.moneybin.find('**/tag_arena_wall').scaleInterval(3.75, (1,
1,
0.001)), self.moneybin.find('**/out_arena_trees_1').scaleInterval(3.75, (1,
1,
0.001)), self.moneybin.find('**/out_arena_trees_2').scaleInterval(3.75, (1,
1,
0.001))), Func(self.moneybin.find('**/moneybin1').removeNode), Func(self.moneybin.find('**/flowers').removeNode), Func(self.moneybin.find('**/trees').removeNode), Func(self.moneybin.find('**/tag_arena_wall').removeNode), Func(self.moneybin.find('**/out_arena_trees_1').removeNode), Func(self.moneybin.find('**/out_arena_trees_2').removeNode)))))
cogBinTrack = Parallel(Func(self.cogbin.show), Func(self.cogArea.show), Func(self.sky.removeNode), Func(self.cogSky.show), Func(self.songRateChange, self.moneyBinTheme), Sequence(Parallel(self.cogbin.posInterval(5.0, (0.0,
2.16,
16.3)), self.cogArea.posInterval(5.0, (0.0,
2.16,
0.0))), Parallel(Sequence(LerpScaleInterval(self.cogbin, 0.45, (1.38,
1.38,
1.1), blendType='easeInOut'), LerpScaleInterval(self.cogbin, 0.6, (1.38,
1.38,
1.6), blendType='easeInOut'), LerpScaleInterval(self.cogbin, 0.7, (1.38,
1.38,
1.28), blendType='easeInOut'), LerpScaleInterval(self.cogbin, 0.75, (1.38,
1.38,
1.38), blendType='easeInOut')), Sequence(LerpScaleInterval(self.cogArea, 0.45, (1.0,
1.0,
0.7), blendType='easeInOut'), LerpScaleInterval(self.cogArea, 0.6, (1.0,
1.0,
1.3), blendType='easeInOut'), LerpScaleInterval(self.cogArea, 0.7, (1.0,
1.0,
0.9), blendType='easeInOut'), LerpScaleInterval(self.cogArea, 0.75, (1.0,
1.0,
1.0), blendType='easeInOut')))))
self.cameraTrack = Sequence(Func(self.robberbaron.setPosHpr, 0.0, -48.43, 16.999, 0.0, 0.0, 0.0), Func(base.camera.setPosHpr, -90.37, -95.11, 20.3, -154, 0.0, 0.0), Parallel(Sequence(Wait(1.0), self.robberbaron.beginSupaFlyMove(VBase3(0.0, -48.43, 16.999), 1, 'flyIn', walkAfterLanding=False)), LerpPosHprInterval(base.camera, 8.0, (-34.39,
-28.71,
25.038), (-130,
-0.6,
0.0), blendType='easeInOut')), Func(base.camera.setPosHpr, 27.945, -83.46, 17.402, 34.5, 8.24, 4.5), Func(self.robberbaron.loop, 'walk'), self.robberbaron.posHprInterval(2.5, (0.0,
-27.43,
21.398), (0.0,
0.0,
0.0)), self.robberbaron.posHprInterval(1.5, (0.0,
-9,
21.398), (0.0,
0.0,
0.0)), Func(base.camera.setPosHpr, 2.4331, -238.5, 20.352, -1.7, 11.8, 9.0), Func(self.robberbaron.delete), Wait(5.0), Func(base.localAvatar.brickLay, 'cog'), Func(self.moneybin.find('**/ground').setTexture, groundTexture, 1), Func(self.moneybin.find('**/moneybin_hill').setTexture, groundTexture, 1), Func(self.moneybin.find('**/ground').setColor, 1, 1, 1, 1), Func(self.moneybin.find('**/moneybin_hill').setColor, 1, 1, 1, 1), Func(self.moneyBinTheme.stop), Func(self.moneyBinTakeOver.play), Func(base.camera.setPosHpr, 131.27, -382.0, 78.261, 19.1, -5.1, 0.0), streetTrack)
self.buildingTrack = Sequence(Wait(12.0), Parallel(moneybinTrack, cogBinTrack, Sequence(Wait(8.0), Func(base.transitions.fadeOut, 2.0), Wait(2.0), Func(self.cleanupScene))))
self.animation = Parallel(Func(self.moneyBinTheme.play), self.cameraTrack, self.buildingTrack)
self.animation.start()
return
def songRateChange(self, song):
rateTrack = Sequence()
playRate = 1.0
for rate in xrange(0, 101):
rateTrack.append(Func(song.setPlayRate, playRate))
rateTrack.append(Wait(0.05))
playRate -= 0.01
rateTrack.append(Func(song.stop))
rateTrack.start()
def setUpStreet(self):
for dept in ['sales', 'money', 'corp', 'legal']:
for spot in render.findAllMatches('**/suit_landmark_new_%s_door_origin' % dept):
elevator = loader.loadModel('phase_4/models/modules/elevator')
elevator.reparentTo(spot)
randomFloor = random.randint(3, 5)
hideList = 5
for light in range(1, 6):
elevator.find('**/floor_light_%s' % light).setColor(0.5, 0.5, 0.5, 1)
if hideList != randomFloor:
elevator.find('**/floor_light_%s' % hideList).hide()
hideList = hideList - 1
sign = loader.loadModel('phase_5/models/modules/suit_sign')
sign.reparentTo(spot)
sign.setPos(0, -0.1, 12.5)
sign.setScale(5)
for spot in render.findAllMatches('**/suit_landmark_money2_door_origin'):
elevator = loader.loadModel('phase_4/models/modules/elevator')
elevator.reparentTo(spot)
randomFloor = random.randint(2, 5)
hideList = 5
for light in range(1, 6):
elevator.find('**/floor_light_%s' % light).setColor(0.5, 0.5, 0.5, 1)
if hideList != randomFloor:
elevator.find('**/floor_light_%s' % hideList).hide()
hideList = hideList - 1
sign = loader.loadModel('phase_5/models/modules/suit_sign')
sign.reparentTo(spot)
sign.setPos(0, -0.1, 11.5)
sign.setScale(5)
def cleanupScene(self):
for model in self.modelList:
model.removeNode()
del model | 106.868421 | 1,168 | 0.264664 | 3,063 | 40,610 | 3.450212 | 0.169442 | 0.064156 | 0.059614 | 0.049205 | 0.577687 | 0.541067 | 0.478142 | 0.428842 | 0.393547 | 0.385125 | 0 | 0.182109 | 0.630313 | 40,610 | 380 | 1,169 | 106.868421 | 0.521814 | 0 | 0 | 0.286104 | 0 | 0 | 0.073945 | 0.017261 | 0 | 0 | 0 | 0 | 0 | 1 | 0.016349 | false | 0 | 0.00545 | 0 | 0.029973 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 3 |
37175535dd73bb85ce801f6d71053f502d010455 | 459 | py | Python | sesame/utils.py | GamePad64/django-sesame | 9d6144110b2cd74cca4e58273926b111eadb3f03 | [
"BSD-3-Clause"
] | null | null | null | sesame/utils.py | GamePad64/django-sesame | 9d6144110b2cd74cca4e58273926b111eadb3f03 | [
"BSD-3-Clause"
] | null | null | null | sesame/utils.py | GamePad64/django-sesame | 9d6144110b2cd74cca4e58273926b111eadb3f03 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import unicode_literals
from .backends import UrlAuthBackendMixin
from .compatibility import urlencode
from .middleware import TOKEN_NAME
def get_parameters(user):
"""
Return GET parameters to log in `user`.
"""
return {TOKEN_NAME: UrlAuthBackendMixin().create_token(user)}
def get_query_string(user):
"""
Return a complete query string to log in `user`.
"""
return '?' + urlencode(get_parameters(user))
| 20.863636 | 65 | 0.718954 | 55 | 459 | 5.781818 | 0.454545 | 0.125786 | 0.106918 | 0.069182 | 0.106918 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.187364 | 459 | 21 | 66 | 21.857143 | 0.852547 | 0.191721 | 0 | 0 | 0 | 0 | 0.002959 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.5 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
37218dc001152be9a5cbbcb8a62c2a58d5ca62fb | 287 | py | Python | yard/skills/66-python/cookbook/yvhai/demo/input/xml.py | paser4se/bbxyard | d09bc6efb75618b2cef047bad9c8b835043446cb | [
"Apache-2.0"
] | 1 | 2016-03-29T02:01:58.000Z | 2016-03-29T02:01:58.000Z | yard/skills/66-python/cookbook/yvhai/demo/input/xml.py | paser4se/bbxyard | d09bc6efb75618b2cef047bad9c8b835043446cb | [
"Apache-2.0"
] | 18 | 2019-02-13T09:15:25.000Z | 2021-12-09T21:32:13.000Z | yard/skills/66-python/cookbook/yvhai/demo/input/xml.py | paser4se/bbxyard | d09bc6efb75618b2cef047bad9c8b835043446cb | [
"Apache-2.0"
] | 2 | 2020-07-05T01:01:30.000Z | 2020-07-08T22:33:06.000Z | #!/usr/bin/env python3
# xml 资源
xml_w3_book = """
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
"""
| 13.045455 | 43 | 0.620209 | 43 | 287 | 4.093023 | 0.604651 | 0.102273 | 0.147727 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068826 | 0.139373 | 287 | 21 | 44 | 13.666667 | 0.643725 | 0.097561 | 1 | 0.307692 | 0 | 0 | 0.902724 | 0.089494 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2e92110a4acf5b4d90f4de3ae5d754fd4d0bda47 | 292 | py | Python | integration/tests_ok/user_agent.py | jleverenz/hurl | b81ca8ab7e0e409ec0c074fd8e118721ff4d3fb3 | [
"Apache-2.0"
] | null | null | null | integration/tests_ok/user_agent.py | jleverenz/hurl | b81ca8ab7e0e409ec0c074fd8e118721ff4d3fb3 | [
"Apache-2.0"
] | null | null | null | integration/tests_ok/user_agent.py | jleverenz/hurl | b81ca8ab7e0e409ec0c074fd8e118721ff4d3fb3 | [
"Apache-2.0"
] | null | null | null | from app import app
from flask import request
@app.route("/user-agent/a")
def useragent_a():
assert "Mozilla/5.0 A" == request.headers["User-Agent"]
return ""
@app.route("/user-agent/b")
def useragent_b():
assert "Mozilla/5.0 B" == request.headers["User-Agent"]
return ""
| 19.466667 | 59 | 0.657534 | 44 | 292 | 4.318182 | 0.409091 | 0.189474 | 0.126316 | 0.178947 | 0.305263 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016393 | 0.164384 | 292 | 14 | 60 | 20.857143 | 0.762295 | 0 | 0 | 0.2 | 0 | 0 | 0.246575 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | true | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2ea7b1e2f8c9260e23fc9fd591de1116fc926068 | 332 | py | Python | gsheetsdb/types.py | tim-werner/gsheets-db-api | 12f2a4fbe1bd5aa36781226759326ce782b08a91 | [
"MIT"
] | 176 | 2018-09-11T12:29:00.000Z | 2022-03-26T19:33:31.000Z | gsheetsdb/types.py | tim-werner/gsheets-db-api | 12f2a4fbe1bd5aa36781226759326ce782b08a91 | [
"MIT"
] | 16 | 2018-09-14T18:11:09.000Z | 2022-03-08T20:17:56.000Z | gsheetsdb/types.py | tim-werner/gsheets-db-api | 12f2a4fbe1bd5aa36781226759326ce782b08a91 | [
"MIT"
] | 14 | 2019-01-10T16:40:25.000Z | 2021-07-27T01:22:58.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from enum import Enum
class Type(Enum):
STRING = 'string'
NUMBER = 'number'
BOOLEAN = 'boolean'
DATE = 'date'
DATETIME = 'datetime'
TIMEOFDAY = 'timeofday'
| 20.75 | 39 | 0.73494 | 38 | 332 | 5.921053 | 0.473684 | 0.177778 | 0.284444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201807 | 332 | 15 | 40 | 22.133333 | 0.849057 | 0 | 0 | 0 | 0 | 0 | 0.120482 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.416667 | 0 | 1 | 0.083333 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2ecf02de134bbfb63253edf9f0df0a07e83ef05f | 239 | py | Python | src/check_ids.py | lubianat/complex_bot | e0ddabcc0487c52b14fb94950c5a812f0bdb2283 | [
"MIT"
] | 1 | 2021-10-06T00:21:10.000Z | 2021-10-06T00:21:10.000Z | src/check_ids.py | lubianat/complex_bot | e0ddabcc0487c52b14fb94950c5a812f0bdb2283 | [
"MIT"
] | 14 | 2021-01-15T21:51:38.000Z | 2021-11-10T10:08:22.000Z | src/check_ids.py | lubianat/complex_bot | e0ddabcc0487c52b14fb94950c5a812f0bdb2283 | [
"MIT"
] | 1 | 2021-01-18T10:32:56.000Z | 2021-01-18T10:32:56.000Z | import pandas as pd
from wikidataintegrator import wdi_login
import utils
from login import WDPASS, WDUSER
import argparse
import sys
parser = argparse.ArgumentParser()
df = utils.get_complex_portal_species_ids()
print(df.to_markdown()) | 21.727273 | 43 | 0.824268 | 34 | 239 | 5.617647 | 0.705882 | 0.115183 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117155 | 239 | 11 | 44 | 21.727273 | 0.905213 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.111111 | 0.666667 | 0 | 0.666667 | 0.111111 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
2ef007f96300135913374e66f242b4d7ad638d34 | 937 | py | Python | env/Lib/site-packages/OpenGL/GL/ARB/shader_clock.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 210 | 2016-04-09T14:26:00.000Z | 2022-03-25T18:36:19.000Z | env/Lib/site-packages/OpenGL/GL/ARB/shader_clock.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 72 | 2016-09-04T09:30:19.000Z | 2022-03-27T17:06:53.000Z | env/Lib/site-packages/OpenGL/GL/ARB/shader_clock.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 64 | 2016-04-09T14:26:49.000Z | 2022-03-21T11:19:47.000Z | '''OpenGL extension ARB.shader_clock
This module customises the behaviour of the
OpenGL.raw.GL.ARB.shader_clock to provide a more
Python-friendly API
Overview (from the spec)
This extension exposes a 64-bit monotonically incrementing shader
counter which may be used to derive local timing information within
a single shader invocation.
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/ARB/shader_clock.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GL import _types, _glgets
from OpenGL.raw.GL.ARB.shader_clock import *
from OpenGL.raw.GL.ARB.shader_clock import _EXTENSION_NAME
def glInitShaderClockARB():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME )
### END AUTOGENERATED SECTION | 32.310345 | 71 | 0.803629 | 132 | 937 | 5.621212 | 0.537879 | 0.080863 | 0.09434 | 0.056604 | 0.128032 | 0.128032 | 0.09434 | 0.09434 | 0 | 0 | 0 | 0.002469 | 0.135539 | 937 | 29 | 72 | 32.310345 | 0.91358 | 0.61793 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | true | 0 | 0.777778 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2ef1c30c2a21d30607beca0e47199956e827e7ca | 234 | py | Python | tuiuiu/tuiuiuadmin/tests/api/utils.py | caputomarcos/tuiuiu.io | d8fb57cf95487e7fe1454b2130ef18acc916da46 | [
"BSD-3-Clause"
] | 3 | 2019-08-08T09:09:35.000Z | 2020-12-15T18:04:17.000Z | tuiuiu/tuiuiuadmin/tests/api/utils.py | caputomarcos/tuiuiu.io | d8fb57cf95487e7fe1454b2130ef18acc916da46 | [
"BSD-3-Clause"
] | null | null | null | tuiuiu/tuiuiuadmin/tests/api/utils.py | caputomarcos/tuiuiu.io | d8fb57cf95487e7fe1454b2130ef18acc916da46 | [
"BSD-3-Clause"
] | 1 | 2017-09-09T20:10:40.000Z | 2017-09-09T20:10:40.000Z | from __future__ import absolute_import, unicode_literals
from django.test import TestCase
from tuiuiu.tests.utils import TuiuiuTestUtils
class AdminAPITestCase(TestCase, TuiuiuTestUtils):
def setUp(self):
self.login()
| 21.272727 | 56 | 0.790598 | 27 | 234 | 6.62963 | 0.703704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149573 | 234 | 10 | 57 | 23.4 | 0.899497 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.5 | 0 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2ef92842a29485830b7dc96257442537b474a8cf | 1,243 | py | Python | app/backend/queries/mysql.py | sesam-community/autoconnect | 1f0a4630ca77cc3cf5786de0bb4686b05bd0f0bb | [
"Apache-2.0"
] | null | null | null | app/backend/queries/mysql.py | sesam-community/autoconnect | 1f0a4630ca77cc3cf5786de0bb4686b05bd0f0bb | [
"Apache-2.0"
] | null | null | null | app/backend/queries/mysql.py | sesam-community/autoconnect | 1f0a4630ca77cc3cf5786de0bb4686b05bd0f0bb | [
"Apache-2.0"
] | 1 | 2021-02-18T15:15:01.000Z | 2021-02-18T15:15:01.000Z | def table_pkey(table):
query = f"""SELECT KU.table_name as TABLENAME,column_name as PRIMARYKEYCOLUMN FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KU ON TC.CONSTRAINT_TYPE = 'PRIMARY KEY' AND TC.CONSTRAINT_NAME = KU.CONSTRAINT_NAME
AND KU.table_name='{table}' ORDER BY KU.TABLE_NAME,KU.ORDINAL_POSITION LIMIT 1;"""
return query
def get_fkey_relations(db_name, table):
query = f"""SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = '{db_name}'
AND REFERENCED_TABLE_NAME = '{table}';"""
return query
def get_index_info(db_name):
query = f"""SELECT DISTINCT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA = '{db_name}';"""
return query
def get_table_columns_for_indexing(table):
query = f"select column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '{table}';"
return query
def get_table_ref_idx(index_table, table, index_column, column):
sql = f"SELECT * FROM {index_table}, {table} WHERE {index_table}.{index_column} = {table}.{column} LIMIT 500;"
return sql | 47.807692 | 143 | 0.745776 | 177 | 1,243 | 4.932203 | 0.282486 | 0.082474 | 0.054983 | 0.077892 | 0.260023 | 0.071019 | 0.071019 | 0 | 0 | 0 | 0 | 0.003839 | 0.161706 | 1,243 | 26 | 144 | 47.807692 | 0.833973 | 0 | 0 | 0.210526 | 0 | 0.105263 | 0.691318 | 0.284566 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0 | 0 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2c0300ca0658c1688971286bba3169afb2699074 | 1,911 | py | Python | controllers/task_handler.py | MuhammadWaleedUsman/PythonTornadoDockerTraefikMySql | 29d7a72c30a96f4eaf9174fdf29fd06fb48e7974 | [
"Apache-2.0"
] | null | null | null | controllers/task_handler.py | MuhammadWaleedUsman/PythonTornadoDockerTraefikMySql | 29d7a72c30a96f4eaf9174fdf29fd06fb48e7974 | [
"Apache-2.0"
] | null | null | null | controllers/task_handler.py | MuhammadWaleedUsman/PythonTornadoDockerTraefikMySql | 29d7a72c30a96f4eaf9174fdf29fd06fb48e7974 | [
"Apache-2.0"
] | null | null | null | from .db_handler import cursor
from tornado import concurrent
import tornado.web
executor = concurrent.futures.ThreadPoolExecutor(8)
def start_task(arg):
print("The Task has started") # Async task
return True
def stop_task(arg):
print("The Task has stopped") # Async task
return True
class HandlerStart(tornado.web.RequestHandler):
def post(self, username):
cursor.execute("SELECT * FROM users")
users = cursor.fetchall()
user_names = []
if users:
keys = ("id", "name", "email")
list_of_users = [dict(zip(keys, values)) for values in users]
for user in list_of_users:
user_names.append(user['name'])
if username in set(user_names):
flag = True
else:
flag = False
else:
flag = False
if flag:
executor.submit(start_task, username)
response = "started"
else:
response = "User Doesn't exist"
self.write('request accepted |' + str(username) + ' | ' + str(response))
class HandlerStop(tornado.web.RequestHandler):
def post(self, username):
cursor.execute("SELECT * FROM users")
users = cursor.fetchall()
user_names = []
if users:
keys = ("id", "name", "email")
list_of_users = [dict(zip(keys, values)) for values in users]
for user in list_of_users:
user_names.append(user['name'])
if username in set(user_names):
flag = True
else:
flag = False
else:
flag = False
if flag:
executor.submit(stop_task, username)
response = "stopped"
else:
response = "User Doesn't exist"
self.write('request accepted |' + str(username) + ' | ' + str(response))
| 29.4 | 80 | 0.55259 | 211 | 1,911 | 4.914692 | 0.303318 | 0.052073 | 0.04243 | 0.02893 | 0.734812 | 0.734812 | 0.692382 | 0.692382 | 0.692382 | 0.692382 | 0 | 0.000798 | 0.344322 | 1,911 | 64 | 81 | 29.859375 | 0.826816 | 0.010989 | 0 | 0.740741 | 0 | 0 | 0.105988 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.074074 | false | 0 | 0.055556 | 0 | 0.203704 | 0.037037 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2c0432e1308cc8fe3207fb79660271c04e458a71 | 666 | py | Python | Python/WordBreak.py | Jspsun/LEETCodePractice | 9dba8c0441201a188b93e4d39a0a9b7602857a5f | [
"MIT"
] | 3 | 2017-10-14T19:49:28.000Z | 2019-01-12T21:51:11.000Z | Python/WordBreak.py | Jspsun/LEETCodePractice | 9dba8c0441201a188b93e4d39a0a9b7602857a5f | [
"MIT"
] | null | null | null | Python/WordBreak.py | Jspsun/LEETCodePractice | 9dba8c0441201a188b93e4d39a0a9b7602857a5f | [
"MIT"
] | 5 | 2017-02-06T19:10:23.000Z | 2020-12-19T01:58:10.000Z | class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: bool
"""
dp = [False for i in xrange(len(s)+1)]
dp[0] = True
for i in range(1, len(s)+1):
for w in wordDict:
if len(w)<= i and dp[i-len(w)]:
if s[i-len(w):i]==w:
dp[i] = True
break
return dp[-1]
print Solution().wordBreak("leetcode", ["leet","code"])==True
print Solution().wordBreak("leetcode", ["wowwwww","caode"])==False
print Solution().wordBreak("aaaaaaa", ["aaaa","aa"])==False | 31.714286 | 66 | 0.478979 | 85 | 666 | 3.752941 | 0.447059 | 0.037618 | 0.206897 | 0.188088 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011468 | 0.345345 | 666 | 21 | 67 | 31.714286 | 0.720183 | 0 | 0 | 0 | 0 | 0 | 0.085069 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.214286 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
25cbeb75700cfc7ba35658909719975df140adca | 6,215 | py | Python | tests/test_algorithms/test_sutherland_hodgman.py | Huite/numba_celltree | f6562153fb09468c64c6594b5ed4c48ce827997a | [
"MIT"
] | 2 | 2021-08-30T08:44:45.000Z | 2021-08-30T11:55:25.000Z | tests/test_algorithms/test_sutherland_hodgman.py | Deltares/numba_celltree | 898c54a18731e56407d03636f7f18e67d84a1f00 | [
"MIT"
] | null | null | null | tests/test_algorithms/test_sutherland_hodgman.py | Deltares/numba_celltree | 898c54a18731e56407d03636f7f18e67d84a1f00 | [
"MIT"
] | null | null | null | """"
Test data generated with:
```python
import numpy as np
import shapely.geometry as sg
def ccw(a):
# Ensure triangles are counter-clockwise
for i in range(len(a)):
t = a[i]
normal = (t[1][0] - t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0])
if normal < 0:
a[i] = t[::-1]
def area_of_intersection(a, b):
ntriangles = a.shape[0]
out = np.empty(ntriangles, dtype=np.float64)
for i in range(ntriangles):
aa = sg.Polygon(a[i])
bb = sg.Polygon(b[i])
out[i] = aa.intersection(bb).area
return out
a = np.random.rand(10, 3, 2)
b = np.random.rand(10, 3, 2)
ccw(a)
ccw(b)
expected = area_of_intersection(a, b)
```
"""
import numpy as np
from numba_celltree.algorithms.sutherland_hodgman import (
area_of_intersection,
box_area_of_intersection,
intersection,
polygon_polygon_clip_area,
)
from numba_celltree.constants import FloatDType, Point, Vector
A = np.array(
[
[[0.98599114, 0.16203056], [0.64839124, 0.6552714], [0.44528724, 0.88567472]],
[[0.96182162, 0.3642742], [0.03478739, 0.54268026], [0.57582971, 0.41541277]],
[[0.32556365, 0.03800701], [0.74000686, 0.04684465], [0.89527188, 0.55061165]],
[[0.2988294, 0.96608896], [0.01212383, 0.00144037], [0.75113002, 0.54797261]],
[[0.06522962, 0.43735202], [0.791499, 0.5229509], [0.40651803, 0.94317979]],
[[0.06544202, 0.16735701], [0.67916353, 0.95843272], [0.33545733, 0.86368003]],
[[0.43129575, 0.27998206], [0.49468229, 0.75438255], [0.01542992, 0.80696797]],
[[0.29449023, 0.32433138], [0.46157048, 0.22492393], [0.82442969, 0.75853821]],
[[0.66113797, 0.88485505], [0.70164374, 0.24393423], [0.89565423, 0.89407158]],
[[0.92226655, 0.82771688], [0.42243438, 0.17562404], [0.82885357, 0.17541439]],
],
)
B = np.array(
[
[[0.8141854, 0.06821897], [0.37086004, 0.49067617], [0.79810508, 0.07873283]],
[[0.74948185, 0.8942076], [0.59654411, 0.87755533], [0.3023107, 0.68256513]],
[[0.46670989, 0.31716127], [0.68408985, 0.75792215], [0.41437824, 0.79509823]],
[[0.60715923, 0.67648133], [0.40045464, 0.79676831], [0.06332723, 0.69679141]],
[[0.24057248, 0.16433727], [0.58871277, 0.05499277], [0.59144784, 0.24476056]],
[[0.23183198, 0.41619006], [0.66566902, 0.30110111], [0.60418791, 0.60702136]],
[[0.09393344, 0.87976118], [0.994083, 0.00532686], [0.95176396, 0.79836557]],
[[0.89063751, 0.5880825], [0.03881315, 0.82436939], [0.61391092, 0.45027842]],
[[0.63168954, 0.75135847], [0.8726944, 0.06387274], [0.89585471, 0.92837592]],
[[0.94379596, 0.64164962], [0.95787609, 0.65627618], [0.6212529, 0.89153053]],
]
)
EXPECTED = np.array(
[
0.0,
0.0,
0.0,
0.0262324,
0.0,
0.00038042,
0.03629781,
0.01677156,
0.05417924,
0.00108787,
]
)
def test_intersection():
# Intersection
a = Point(0.0, 0.0)
V = Vector(1.0, 1.0)
r = Point(1.0, 0.0)
s = Point(0.0, 1.0)
U = Vector(s.x - r.x, s.y - r.y)
N = Vector(-U.y, U.x)
succes, p = intersection(a, V, r, N)
assert succes
assert np.allclose(p, [0.5, 0.5])
# Parallel lines, no intersection
s = Point(2.0, 1.0)
U = Vector(s.x - r.x, s.y - r.y)
N = Vector(-U.y, U.x)
succes, p = intersection(a, V, r, N)
assert not succes
def test_clip_area():
for a, b, expected in zip(A, B, EXPECTED):
actual = polygon_polygon_clip_area(a, b)
assert np.allclose(actual, expected)
def test_clip_area_no_overlap():
a = np.array(
[
[0.0, 0.0],
[1.0, 0.0],
[1.0, 1.0],
]
)
b = a.copy()
b += 2.0
actual = polygon_polygon_clip_area(a, b)
assert np.allclose(actual, 0)
def test_clip_area_repeated_vertex():
a = np.array(
[
[0.0, 0.0],
[1.0, 0.0],
[1.0, 0.0],
[1.0, 1.0],
]
)
# No overlap
b = a.copy()
b += 2.0
actual = polygon_polygon_clip_area(a, b)
assert np.allclose(actual, 0)
b = np.array(
[
[0.0, 0.0],
[1.0, 0.0],
[0.0, 1.0],
[0.0, 1.0],
]
)
actual = polygon_polygon_clip_area(a, b)
def test_clip_area_epsilon():
EPS = np.finfo(FloatDType).eps
a = np.array(
[
[-1.0, -1.0],
[1.0, -1.0],
[1.0, 1.0],
]
)
b = np.array(
[
[-1.0 - EPS, -1.0 - EPS],
[1.0 + EPS, -1.0 - EPS],
[1.0 + EPS, 1.0 + EPS],
]
)
actual = polygon_polygon_clip_area(a, b)
assert np.allclose(actual, 2.0)
EPS = -EPS
b = np.array(
[
[-1.0 - EPS, -1.0 - EPS],
[1.0 + EPS, -1.0 - EPS],
[1.0 + EPS, 1.0 + EPS],
]
)
actual = polygon_polygon_clip_area(a, b)
assert np.allclose(actual, 2.0)
def test_area_of_intersection():
vertices_a = A.reshape(-1, 2)
vertices_b = B.reshape(-1, 2)
faces_a = np.arange(len(vertices_a)).reshape(-1, 3)
faces_b = np.arange(len(vertices_b)).reshape(-1, 3)
indices_a = np.arange(len(faces_a))
indices_b = np.arange(len(faces_a))
actual = area_of_intersection(
vertices_a, vertices_b, faces_a, faces_b, indices_a, indices_b
)
assert np.allclose(actual, EXPECTED)
def test_box_area_of_intersection():
box_coords = np.array(
[
[0.0, 1.0, 0.0, 1.0],
[1.0, 2.0, 1.0, 2.0],
]
)
vertices = np.array(
[
[0.0, 0.0],
[2.0, 0.0],
[2.0, 2.0],
[-2.0, 0.0],
[-2.0, 2.0],
]
)
faces = np.array(
[
[0, 1, 2],
[0, 3, 4],
]
)
indices_bbox = np.array([0, 0, 1, 1])
indices_face = np.array([0, 1, 0, 1])
actual = box_area_of_intersection(
box_coords,
vertices,
faces,
indices_bbox,
indices_face,
)
assert np.allclose(actual, [0.5, 0.0, 0.5, 0.0])
| 26.559829 | 90 | 0.524698 | 925 | 6,215 | 3.437838 | 0.241081 | 0.032075 | 0.026415 | 0.013836 | 0.303459 | 0.245597 | 0.20912 | 0.20912 | 0.183019 | 0.177673 | 0 | 0.303913 | 0.292679 | 6,215 | 233 | 91 | 26.67382 | 0.419472 | 0.122928 | 0 | 0.281609 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057471 | 1 | 0.04023 | false | 0 | 0.017241 | 0 | 0.057471 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
25cd4e9ba282e597a4fa5b69cbe92a7a0be65817 | 155 | py | Python | interpreter/application.py | Jesssullivan/MerlinAI-Interpreters | e2e053f357a74d642b160b42a1276fa44c45614b | [
"Unlicense"
] | 3 | 2019-02-23T03:19:32.000Z | 2020-02-12T13:54:02.000Z | interpreter/application.py | Jesssullivan/MerlinAI-Interpreters | e2e053f357a74d642b160b42a1276fa44c45614b | [
"Unlicense"
] | null | null | null | interpreter/application.py | Jesssullivan/MerlinAI-Interpreters | e2e053f357a74d642b160b42a1276fa44c45614b | [
"Unlicense"
] | null | null | null |
from app.main import create_app
from waitress import serve
if __name__ == "__main__":
app = create_app()
serve(app, host='0.0.0.0', port='5000')
| 19.375 | 43 | 0.677419 | 25 | 155 | 3.8 | 0.52 | 0.063158 | 0.063158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.062992 | 0.180645 | 155 | 7 | 44 | 22.142857 | 0.685039 | 0 | 0 | 0 | 0 | 0 | 0.123377 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
25da3c1cb459bcee6395b9dfd94dc5a75175e53c | 3,183 | py | Python | fixtures/db.py | maxteplyakov/learn_python_test_automation | de40804d58ada5f4165ca6a0070bfb4cfca038d9 | [
"MIT"
] | null | null | null | fixtures/db.py | maxteplyakov/learn_python_test_automation | de40804d58ada5f4165ca6a0070bfb4cfca038d9 | [
"MIT"
] | null | null | null | fixtures/db.py | maxteplyakov/learn_python_test_automation | de40804d58ada5f4165ca6a0070bfb4cfca038d9 | [
"MIT"
] | null | null | null | import mysql.connector
from models.group import Group
from models.contact import Contact
class DbFixture():
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connection = mysql.connector.connect(
host=host, database=name, user=user, password=password,
autocommit=True
)
def get_group_list(self):
list = []
cursor = self.connection.cursor()
try:
cursor.execute(
"SELECT group_id, group_name, group_header, group_footer "
"FROM group_list"
)
for row in cursor:
(id, name, header, footer) = row
list.append(
Group(id=str(id), name=name, header=header, footer=footer)
)
finally:
cursor.close()
return list
def get_group_by_id(self, id):
group = None
cursor = self.connection.cursor()
try:
cursor.execute(
"SELECT group_id, group_name, group_header, group_footer "
"FROM group_list "
f"WHERE group_id={id}"
)
# group = Group(id=str(id), name=name, header=header, footer=footer)
for row in cursor:
(id, name, header, footer) = row
group = Group(
id=str(id), name=name, header=header, footer=footer
)
finally:
cursor.close()
return group
def get_contact_list(self):
list = []
cursor = self.connection.cursor()
try:
cursor.execute(
"SELECT id, firstname, lastname, address, email "
"FROM addressbook "
"WHERE deprecated='0000-00-00 00:00:00'"
)
for row in cursor:
(id, firstname, lastname, address, email) = row
list.append(
Contact(
id=str(id),
first_name=firstname,
last_name=lastname,
address=address,
email1=email
)
)
finally:
cursor.close()
return list
def get_contact_by_id(self, id):
contact = None
cursor = self.connection.cursor()
try:
cursor.execute(
"SELECT id, firstname, lastname, address, email "
"FROM addressbook "
"WHERE deprecated='0000-00-00 00:00:00' AND id=%s" % id
)
for row in cursor:
(id, firstname, lastname, address, email) = row
contact = Contact(
id=str(id),
first_name=firstname,
last_name=lastname,
address=address,
email1=email
)
finally:
cursor.close()
return contact
def destroy(self):
self.connection.close()
| 30.902913 | 80 | 0.473767 | 301 | 3,183 | 4.913621 | 0.186047 | 0.021636 | 0.024341 | 0.070318 | 0.707235 | 0.707235 | 0.707235 | 0.693712 | 0.693712 | 0.640974 | 0 | 0.016854 | 0.440779 | 3,183 | 102 | 81 | 31.205882 | 0.814045 | 0.020735 | 0 | 0.565217 | 0 | 0 | 0.120706 | 0.014125 | 0 | 0 | 0 | 0 | 0 | 1 | 0.065217 | false | 0.032609 | 0.032609 | 0 | 0.152174 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
25ef3cf038f4dc0c0967a72f05b874c0bdc8e6a9 | 858 | py | Python | viberbot/api/viber_requests/viber_seen_request.py | AaganMaskey/viber-bot-python | 99224b6c777ee3ac9d26a4b1ccd6ae0193291edb | [
"Apache-2.0"
] | 1 | 2019-12-27T17:02:38.000Z | 2019-12-27T17:02:38.000Z | viberbot/api/viber_requests/viber_seen_request.py | AaganMaskey/viber-bot-python | 99224b6c777ee3ac9d26a4b1ccd6ae0193291edb | [
"Apache-2.0"
] | 1 | 2021-06-25T15:17:45.000Z | 2021-06-25T15:17:45.000Z | viberbot/api/viber_requests/viber_seen_request.py | Micuk/viber-bot-python | c090e40a2270f3fec5b5cd34f83334a5797d2bdd | [
"Apache-2.0"
] | null | null | null | from future.utils import python_2_unicode_compatible
from ..event_type import EventType
from viberbot.api.viber_requests.viber_request import ViberRequest
class ViberSeenRequest(ViberRequest):
def __init__(self):
super(ViberSeenRequest, self).__init__(EventType.SEEN)
self._message_token = None
self._user_id = None
def from_dict(self, request_dict):
super(ViberSeenRequest, self).from_dict(request_dict)
self._message_token = request_dict['message_token']
self._user_id = request_dict['user_id']
return self
@property
def meesage_token(self):
return self._message_token
@property
def user_id(self):
return self._user_id
@python_2_unicode_compatible
def __str__(self):
return u"ViberSeenRequest [{0}, message_token={1}, user_id={2}]" \
.format(super(ViberSeenRequest, self).__str__(), self._message_token, self._user_id)
| 28.6 | 87 | 0.785548 | 117 | 858 | 5.307692 | 0.324786 | 0.067633 | 0.10306 | 0.077295 | 0.070853 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00657 | 0.113054 | 858 | 29 | 88 | 29.586207 | 0.809461 | 0 | 0 | 0.086957 | 0 | 0 | 0.086247 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0.130435 | 0.130435 | 0.565217 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d30ac629c524ea866310dba919699e150da5f2f1 | 7,143 | py | Python | server/permatrix.py | osaizar/sand | b98c954090af69410589360a68e68cd10d52f782 | [
"Apache-2.0"
] | null | null | null | server/permatrix.py | osaizar/sand | b98c954090af69410589360a68e68cd10d52f782 | [
"Apache-2.0"
] | null | null | null | server/permatrix.py | osaizar/sand | b98c954090af69410589360a68e68cd10d52f782 | [
"Apache-2.0"
] | null | null | null | import random
import numpy as np
MATRIX = [(7, 6, 2, 1, 0, 3, 5, 4),
(6, 5, 0, 1, 3, 2, 4, 7),
(1, 0, 3, 7, 5, 4, 6, 2),
(7, 5, 2, 6, 1, 3, 0, 4),
(0, 4, 2, 3, 7, 1, 6, 5),
(7, 1, 0, 2, 3, 5, 6, 4),
(3, 4, 2, 6, 0, 7, 5, 1),
(6, 1, 5, 2, 7, 4, 0, 3),
(3, 1, 4, 5, 0, 7, 2, 6),
(3, 2, 6, 5, 0, 4, 1, 7),
(3, 0, 6, 1, 7, 5, 4, 2),
(0, 6, 1, 7, 4, 2, 5, 3),
(3, 5, 2, 0, 7, 4, 6, 1),
(5, 4, 0, 3, 1, 7, 2, 6),
(4, 1, 6, 3, 2, 7, 0, 5),
(3, 7, 5, 1, 2, 0, 6, 4),
(4, 5, 2, 7, 6, 0, 3, 1),
(7, 2, 4, 6, 0, 3, 1, 5),
(3, 7, 5, 6, 1, 0, 4, 2),
(0, 5, 4, 3, 7, 2, 1, 6),
(4, 0, 2, 3, 1, 6, 5, 7),
(1, 7, 6, 3, 4, 0, 2, 5),
(5, 7, 3, 2, 6, 1, 4, 0),
(1, 3, 0, 5, 2, 7, 4, 6),
(7, 4, 3, 5, 1, 6, 0, 2),
(5, 1, 3, 0, 4, 2, 6, 7),
(7, 0, 2, 3, 1, 5, 6, 4),
(4, 0, 7, 6, 1, 5, 3, 2),
(5, 3, 6, 1, 4, 7, 2, 0),
(2, 4, 5, 1, 7, 0, 6, 3),
(1, 2, 4, 3, 6, 5, 0, 7),
(4, 7, 6, 5, 0, 2, 3, 1),
(4, 5, 3, 0, 6, 2, 7, 1),
(5, 7, 6, 3, 2, 1, 0, 4),
(5, 6, 7, 0, 4, 2, 1, 3),
(0, 7, 2, 6, 5, 4, 3, 1),
(6, 0, 5, 1, 3, 4, 2, 7),
(7, 1, 5, 2, 3, 4, 6, 0),
(2, 5, 4, 7, 0, 1, 3, 6),
(4, 5, 0, 6, 1, 2, 3, 7),
(3, 2, 0, 6, 7, 4, 5, 1),
(2, 6, 3, 1, 5, 0, 4, 7),
(7, 4, 2, 1, 6, 3, 5, 0),
(5, 3, 2, 6, 1, 0, 4, 7),
(6, 5, 4, 0, 3, 7, 2, 1),
(6, 2, 7, 3, 5, 1, 4, 0),
(3, 4, 2, 7, 6, 0, 1, 5),
(1, 6, 0, 3, 7, 2, 4, 5),
(2, 7, 4, 1, 5, 3, 0, 6),
(3, 1, 0, 5, 4, 2, 6, 7),
(6, 1, 2, 7, 5, 4, 0, 3),
(7, 5, 6, 2, 0, 4, 1, 3),
(5, 3, 2, 7, 0, 4, 6, 1),
(2, 6, 5, 0, 1, 3, 7, 4),
(2, 4, 5, 3, 0, 1, 7, 6),
(4, 0, 2, 1, 6, 3, 7, 5),
(5, 0, 6, 2, 3, 4, 7, 1),
(0, 2, 6, 7, 3, 5, 1, 4),
(3, 4, 0, 7, 2, 1, 6, 5),
(1, 2, 4, 3, 5, 7, 6, 0),
(5, 2, 4, 7, 1, 3, 0, 6),
(7, 5, 1, 3, 6, 0, 4, 2),
(4, 6, 1, 3, 5, 2, 7, 0),
(0, 5, 3, 1, 4, 2, 6, 7),
(2, 3, 1, 4, 5, 6, 7, 0),
(6, 1, 0, 7, 2, 5, 4, 3),
(3, 6, 1, 7, 0, 4, 5, 2),
(4, 7, 2, 3, 1, 0, 5, 6),
(1, 2, 3, 4, 6, 5, 7, 0),
(5, 4, 3, 1, 2, 0, 7, 6),
(6, 0, 4, 7, 5, 2, 3, 1),
(2, 6, 5, 4, 0, 1, 3, 7),
(1, 3, 4, 5, 0, 2, 6, 7),
(0, 5, 6, 7, 2, 1, 4, 3),
(2, 1, 6, 0, 3, 7, 4, 5),
(6, 7, 5, 3, 2, 0, 1, 4),
(0, 7, 2, 5, 6, 1, 4, 3),
(1, 6, 0, 5, 7, 2, 4, 3),
(5, 1, 6, 4, 2, 7, 0, 3),
(6, 3, 1, 0, 2, 4, 7, 5),
(3, 1, 7, 4, 5, 0, 6, 2),
(4, 6, 7, 5, 1, 2, 3, 0),
(7, 1, 2, 6, 3, 4, 0, 5),
(3, 6, 7, 2, 1, 4, 0, 5),
(7, 6, 0, 5, 1, 4, 2, 3),
(2, 5, 3, 1, 7, 4, 6, 0),
(7, 5, 2, 6, 3, 1, 4, 0),
(0, 3, 5, 2, 6, 7, 1, 4),
(1, 6, 5, 2, 3, 7, 0, 4),
(4, 0, 1, 3, 6, 7, 2, 5),
(6, 4, 3, 5, 0, 7, 1, 2),
(1, 0, 3, 7, 2, 5, 4, 6),
(2, 5, 0, 1, 3, 7, 6, 4),
(3, 2, 1, 5, 7, 4, 6, 0),
(1, 3, 6, 7, 0, 4, 2, 5),
(5, 0, 4, 3, 2, 1, 7, 6),
(6, 0, 3, 7, 4, 5, 1, 2),
(5, 1, 0, 3, 4, 2, 7, 6),
(6, 4, 0, 2, 5, 3, 1, 7),
(7, 2, 4, 5, 0, 1, 6, 3),
(0, 1, 3, 4, 2, 6, 7, 5),
(3, 6, 5, 7, 0, 2, 1, 4),
(2, 1, 4, 6, 5, 7, 0, 3),
(6, 4, 7, 0, 5, 3, 2, 1),
(6, 3, 7, 4, 1, 2, 0, 5),
(3, 4, 5, 6, 2, 7, 0, 1),
(5, 3, 1, 6, 4, 0, 7, 2),
(1, 4, 0, 3, 2, 5, 6, 7),
(3, 1, 7, 6, 4, 5, 0, 2),
(3, 4, 0, 5, 7, 6, 2, 1),
(3, 4, 0, 6, 7, 2, 1, 5),
(7, 2, 1, 3, 0, 5, 6, 4),
(2, 1, 5, 7, 0, 3, 4, 6),
(6, 3, 7, 5, 0, 1, 4, 2),
(0, 1, 2, 6, 4, 5, 7, 3),
(4, 7, 5, 6, 2, 1, 0, 3),
(3, 4, 6, 7, 1, 2, 5, 0),
(6, 0, 7, 2, 3, 4, 1, 5),
(5, 4, 6, 3, 1, 2, 0, 7),
(7, 1, 2, 4, 0, 6, 3, 5),
(7, 4, 5, 1, 3, 0, 2, 6),
(6, 2, 4, 5, 0, 7, 3, 1),
(5, 6, 3, 2, 1, 7, 4, 0),
(0, 1, 4, 7, 2, 5, 6, 3),
(7, 6, 2, 5, 3, 4, 0, 1),
(6, 5, 4, 7, 2, 1, 3, 0),
(6, 2, 1, 3, 4, 0, 7, 5),
(5, 0, 7, 3, 1, 4, 2, 6),
(5, 6, 2, 0, 7, 4, 1, 3),
(5, 7, 3, 0, 6, 2, 1, 4),
(3, 1, 7, 4, 5, 0, 2, 6),
(4, 0, 7, 6, 3, 5, 1, 2),
(5, 4, 0, 3, 2, 7, 1, 6),
(5, 3, 2, 1, 6, 0, 4, 7),
(3, 1, 7, 6, 4, 2, 5, 0),
(0, 3, 5, 1, 7, 6, 2, 4),
(6, 4, 1, 7, 2, 5, 0, 3),
(7, 2, 6, 4, 5, 3, 0, 1),
(5, 1, 3, 4, 2, 6, 7, 0),
(6, 1, 7, 0, 5, 3, 2, 4),
(4, 6, 0, 1, 2, 3, 5, 7),
(3, 4, 0, 2, 7, 1, 6, 5),
(5, 1, 2, 0, 4, 3, 7, 6),
(5, 1, 3, 0, 4, 7, 2, 6),
(3, 7, 1, 2, 5, 0, 6, 4),
(6, 5, 2, 1, 3, 4, 0, 7),
(3, 4, 7, 6, 5, 0, 2, 1),
(5, 1, 3, 7, 4, 2, 6, 0),
(6, 4, 0, 7, 3, 2, 5, 1),
(0, 2, 4, 3, 6, 7, 1, 5),
(5, 0, 7, 6, 4, 1, 3, 2),
(4, 6, 7, 2, 3, 5, 1, 0),
(1, 0, 5, 3, 6, 7, 4, 2),
(1, 4, 7, 6, 0, 3, 5, 2),
(7, 3, 4, 6, 5, 1, 2, 0),
(1, 3, 0, 6, 7, 4, 2, 5),
(5, 4, 6, 1, 2, 0, 7, 3),
(5, 3, 1, 0, 4, 2, 6, 7),
(7, 1, 4, 0, 3, 2, 5, 6),
(1, 2, 3, 7, 5, 6, 0, 4),
(7, 6, 3, 4, 5, 0, 1, 2),
(7, 0, 5, 6, 1, 4, 2, 3),
(0, 3, 7, 1, 6, 4, 2, 5),
(6, 0, 3, 1, 5, 2, 4, 7),
(7, 1, 4, 6, 3, 2, 0, 5),
(4, 5, 2, 7, 6, 0, 1, 3),
(3, 4, 0, 5, 7, 2, 6, 1),
(4, 3, 7, 6, 2, 5, 0, 1),
(4, 2, 1, 3, 7, 6, 5, 0),
(6, 0, 2, 5, 7, 3, 4, 1),
(4, 1, 5, 6, 7, 0, 3, 2),
(5, 6, 0, 2, 4, 3, 1, 7),
(0, 1, 2, 4, 5, 3, 7, 6),
(7, 0, 5, 1, 4, 6, 3, 2),
(5, 6, 7, 4, 0, 1, 3, 2),
(4, 6, 1, 5, 7, 3, 0, 2),
(1, 2, 7, 4, 0, 3, 5, 6),
(5, 6, 3, 0, 1, 2, 4, 7),
(3, 4, 6, 2, 7, 5, 0, 1),
(3, 4, 0, 6, 5, 2, 1, 7),
(6, 5, 0, 7, 1, 3, 4, 2),
(3, 0, 4, 6, 7, 2, 5, 1),
(1, 0, 2, 3, 4, 5, 6, 7),
(6, 7, 1, 0, 4, 3, 2, 5),
(1, 5, 3, 6, 4, 0, 2, 7),
(1, 0, 2, 3, 7, 4, 6, 5),
(7, 3, 2, 6, 5, 1, 4, 0),
(7, 5, 0, 6, 1, 2, 3, 4),
(0, 5, 3, 7, 2, 6, 4, 1),
(5, 7, 3, 4, 0, 2, 1, 6),
(1, 0, 4, 5, 2, 7, 3, 6),
(4, 5, 1, 3, 6, 0, 2, 7),
(6, 3, 7, 0, 4, 2, 5, 1),
(2, 4, 3, 6, 5, 1, 0, 7),
(4, 0, 7, 3, 5, 1, 6, 2),
(7, 3, 6, 4, 1, 2, 5, 0),
(7, 6, 5, 3, 1, 0, 4, 2),
(5, 4, 0, 6, 7, 2, 3, 1),
(7, 4, 0, 3, 1, 5, 6, 2),
(5, 6, 3, 0, 7, 2, 4, 1),
(0, 2, 7, 5, 6, 4, 3, 1),
(1, 6, 4, 2, 5, 3, 7, 0),
(6, 2, 3, 7, 0, 4, 5, 1),
(4, 7, 5, 2, 1, 6, 3, 0),
(4, 3, 0, 5, 1, 6, 7, 2),
(1, 6, 0, 7, 4, 3, 2, 5),
(0, 2, 6, 5, 4, 3, 1, 7),
(2, 5, 6, 7, 1, 0, 4, 3),
(2, 3, 6, 4, 1, 5, 0, 7),
(4, 7, 3, 6, 0, 1, 5, 2),
(5, 2, 6, 3, 7, 4, 1, 0),
(0, 3, 6, 5, 1, 7, 2, 4),
(0, 7, 6, 1, 4, 5, 3, 2),
(4, 3, 2, 1, 6, 7, 0, 5),
(7, 1, 6, 3, 0, 5, 4, 2),
(2, 6, 3, 7, 4, 0, 5, 1),
(7, 1, 2, 5, 3, 0, 4, 6),
(2, 5, 6, 7, 4, 1, 3, 0),
(6, 0, 1, 2, 4, 5, 7, 3),
(5, 3, 1, 2, 0, 7, 4, 6),
(7, 5, 2, 3, 6, 0, 4, 1),
(1, 7, 4, 3, 5, 6, 0, 2),
(5, 0, 4, 2, 6, 3, 7, 1),
(0, 5, 3, 7, 2, 4, 6, 1),
(1, 4, 0, 7, 3, 5, 2, 6),
(6, 1, 7, 3, 4, 0, 2, 5),
(6, 0, 5, 2, 3, 4, 1, 7),
(0, 3, 1, 4, 2, 6, 7, 5),
(3, 4, 1, 5, 7, 0, 2, 6),
(3, 7, 2, 4, 5, 6, 0, 1),
(1, 2, 3, 4, 5, 7, 6, 0),
(2, 4, 3, 7, 1, 0, 6, 5),
(3, 7, 4, 2, 0, 5, 6, 1),
(3, 1, 0, 6, 7, 2, 5, 4),
(5, 7, 0, 6, 3, 4, 2, 1),
(5, 1, 3, 0, 7, 2, 4, 6),
(3, 2, 6, 7, 5, 4, 0, 1),
(7, 2, 6, 3, 5, 0, 4, 1),
(4, 3, 6, 5, 1, 0, 7, 2),
(2, 4, 6, 1, 3, 5, 0, 7),
(2, 0, 5, 3, 6, 4, 1, 7),
(0, 3, 1, 2, 6, 4, 7, 5),
(6, 2, 5, 3, 0, 4, 1, 7),
(3, 7, 0, 4, 6, 1, 5, 2),
(2, 7, 3, 6, 0, 5, 1, 4),
(1, 4, 3, 5, 6, 2, 7, 0),
(7, 2, 6, 0, 4, 1, 5, 3),
(4, 2, 7, 5, 0, 6, 3, 1),
(1, 2, 7, 0, 3, 4, 5, 6),
(2, 4, 7, 6, 5, 1, 0, 3),
(5, 7, 0, 2, 6, 3, 4, 1),
(2, 5, 6, 4, 3, 1, 7, 0),
(1, 6, 4, 0, 7, 3, 5, 2),
(1, 4, 5, 7, 6, 3, 2, 0),
(6, 0, 1, 2, 7, 4, 3, 5),
(2, 4, 7, 1, 0, 5, 3, 6)]
def generate_permatrix():
global MATRIX
l = list(range(8))
perm_set = set()
while len(perm_set) < 256:
random.shuffle(l)
perm_set.add(tuple(l))
MATRIX = list(perm_set)
for i in MATRIX:
print(str(i) + ",")
def generate_server_permatrix():
global MATRIX
for i in range(len(MATRIX)):
elem = np.zeros((8,8), dtype=np.uint8)
for j in range(8):
elem[j, MATRIX[i].index(j)] = 1
MATRIX[i] = elem
generate_server_permatrix()
| 25.329787 | 40 | 0.332773 | 2,129 | 7,143 | 1.112259 | 0.019728 | 0.04223 | 0.017736 | 0.011824 | 0.455236 | 0.128801 | 0.017736 | 0 | 0 | 0 | 0 | 0.410661 | 0.298754 | 7,143 | 281 | 41 | 25.419929 | 0.062088 | 0 | 0 | 0.007246 | 0 | 0 | 0.00014 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.007246 | false | 0 | 0.007246 | 0 | 0.014493 | 0.003623 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d318c848b55117fd7c66c4af724183f8868ea105 | 436 | py | Python | src/data_science/data_science/tools/time.py | viclule/api_models_deployment_framework | 7595cf0b4f3e277925b968014102d7561547bcd4 | [
"MIT"
] | null | null | null | src/data_science/data_science/tools/time.py | viclule/api_models_deployment_framework | 7595cf0b4f3e277925b968014102d7561547bcd4 | [
"MIT"
] | null | null | null | src/data_science/data_science/tools/time.py | viclule/api_models_deployment_framework | 7595cf0b4f3e277925b968014102d7561547bcd4 | [
"MIT"
] | null | null | null | from datetime import datetime, timezone
def get_timestamp_isoformat():
"""
Generate a timestampt in iso format.
"""
dt = datetime.utcnow().replace(microsecond=0).isoformat("T") + "Z"
return dt
def get_timestamp_unix():
"""
Generate a timestampt in unix format.
########.###
"""
dt = datetime.utcnow().replace()
timestamp = dt.replace(tzinfo=timezone.utc).timestamp()
return timestamp
| 21.8 | 70 | 0.637615 | 49 | 436 | 5.591837 | 0.510204 | 0.043796 | 0.109489 | 0.153285 | 0.211679 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002915 | 0.213303 | 436 | 19 | 71 | 22.947368 | 0.795918 | 0.199541 | 0 | 0 | 1 | 0 | 0.006369 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d31a96e194e159ff9f667fe1d5373f70080f5da4 | 1,127 | py | Python | datatracer/foreign_key/base.py | HDI-Project/DataTracer | 4bb0906f1716bbcfeb0881cade5d6d47bca90764 | [
"MIT"
] | 15 | 2020-05-27T11:55:05.000Z | 2022-02-08T11:07:54.000Z | datatracer/foreign_key/base.py | HDI-Project/DataTracer | 4bb0906f1716bbcfeb0881cade5d6d47bca90764 | [
"MIT"
] | 21 | 2020-06-02T11:56:13.000Z | 2021-07-29T21:50:27.000Z | datatracer/foreign_key/base.py | HDI-Project/DataTracer | 4bb0906f1716bbcfeb0881cade5d6d47bca90764 | [
"MIT"
] | 3 | 2021-01-19T17:10:58.000Z | 2021-08-13T20:47:33.000Z | """Foreign Key Solving base class."""
class ForeignKeySolver():
def fit(self, list_of_databases):
"""Fit this solver.
Args:
list_of_databases (list):
List of tuples containing ``MetaData`` instnces and table dictinaries,
which contain table names as input and ``pandas.DataFrames`` as values.
"""
pass
def solve(self, tables, primary_keys=None):
"""Solve the foreign key detection problem.
The output is a list of foreign key specifications, in order from the most likely
to the least likely.
Args:
tables (dict):
Dict containing table names as input and ``pandas.DataFrames``
as values.
primary_keys (dict):
(Optional). Dictionary of table primary keys, as returned by the Primary
Key Solvers. This parameter is optional and not all the subclasses need it.
Returns:
dict:
List of foreign key specifications, sorted by likelyhood.
"""
raise NotImplementedError()
| 32.2 | 91 | 0.593611 | 127 | 1,127 | 5.220472 | 0.527559 | 0.045249 | 0.045249 | 0.051282 | 0.223228 | 0.13273 | 0.13273 | 0.13273 | 0.13273 | 0 | 0 | 0 | 0.338953 | 1,127 | 34 | 92 | 33.147059 | 0.889933 | 0.69299 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0.2 | 0 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
d37dcd3460178c5f2fd87503fdb31b744dd39932 | 779 | py | Python | theme_clean/__manifest__.py | YnievesDotNetTeam/addons | 2dd619ed7897a61bedef720d73509cb693a7f6cf | [
"MIT"
] | null | null | null | theme_clean/__manifest__.py | YnievesDotNetTeam/addons | 2dd619ed7897a61bedef720d73509cb693a7f6cf | [
"MIT"
] | null | null | null | theme_clean/__manifest__.py | YnievesDotNetTeam/addons | 2dd619ed7897a61bedef720d73509cb693a7f6cf | [
"MIT"
] | null | null | null | {
'name': 'Clean Theme',
'description': 'Clean Theme',
'category': 'Theme/Services',
'summary': 'Corporate, Business, Tech, Services',
'sequence': 120,
'version': '2.0',
'author': 'Odoo S.A.',
'depends': ['theme_common', 'website_animate'],
'data': [
'views/assets.xml',
'views/image_content.xml',
'views/snippets/s_cover.xml',
'views/snippets/s_carousel.xml',
'views/snippets/s_text_image.xml',
'views/snippets/s_three_columns.xml',
'views/snippets/s_call_to_action.xml',
],
'images': [
'static/description/Clean_description.jpg',
'static/description/clean_screenshot.jpg',
],
'license': 'LGPL-3',
'live_test_url': 'https://theme-clean.odoo.com',
}
| 28.851852 | 53 | 0.594352 | 87 | 779 | 5.137931 | 0.574713 | 0.107383 | 0.178971 | 0.190157 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009901 | 0.22208 | 779 | 26 | 54 | 29.961538 | 0.727723 | 0 | 0 | 0.08 | 0 | 0 | 0.648267 | 0.32991 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d3921bbf727327b6abcb686de351663bb6fe7b42 | 181 | py | Python | Reinforcement_Learning/gym-environments/setup.py | SpencerPao/ComputerVision | 807ce1a1bb651a7a2248f074ab3caab95ea56a96 | [
"MIT"
] | 1 | 2021-11-22T21:52:35.000Z | 2021-11-22T21:52:35.000Z | Reinforcement_Learning/gym-environments/setup.py | SpencerPao/ComputerVision | 807ce1a1bb651a7a2248f074ab3caab95ea56a96 | [
"MIT"
] | 2 | 2021-11-23T02:02:56.000Z | 2021-12-19T01:04:38.000Z | Reinforcement_Learning/gym-environments/setup.py | SpencerPao/ComputerVision | 807ce1a1bb651a7a2248f074ab3caab95ea56a96 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(name='gym_dinorun',
version='0.1',
install_requires=['gym', 'selenium', 'numpy', 'pillow', 'pyvirtualdisplay', 'matplotlib']
)
| 25.857143 | 95 | 0.651934 | 19 | 181 | 6.105263 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013423 | 0.176796 | 181 | 6 | 96 | 30.166667 | 0.765101 | 0 | 0 | 0 | 0 | 0 | 0.342541 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d3963f0cda7e231690d35ea142f4ffd430047c44 | 144 | py | Python | admin-portal/queues/apps.py | oakbani/ksdp-portal | 8f44b3cb0081a7f31b9c8121883dd51945a05520 | [
"MIT"
] | null | null | null | admin-portal/queues/apps.py | oakbani/ksdp-portal | 8f44b3cb0081a7f31b9c8121883dd51945a05520 | [
"MIT"
] | null | null | null | admin-portal/queues/apps.py | oakbani/ksdp-portal | 8f44b3cb0081a7f31b9c8121883dd51945a05520 | [
"MIT"
] | 1 | 2021-09-19T10:58:17.000Z | 2021-09-19T10:58:17.000Z | from django.apps import AppConfig
class QueuesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "queues"
| 20.571429 | 56 | 0.756944 | 17 | 144 | 6.294118 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152778 | 144 | 6 | 57 | 24 | 0.877049 | 0 | 0 | 0 | 0 | 0 | 0.243056 | 0.201389 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d3aa7a46e2eb468c36ac6cd5574de318dee4cff0 | 283 | py | Python | kubernetes_typed/client/models/v1_empty_dir_volume_source.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 22 | 2020-12-10T13:06:02.000Z | 2022-02-13T21:58:15.000Z | kubernetes_typed/client/models/v1_empty_dir_volume_source.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 4 | 2021-03-08T07:06:12.000Z | 2022-03-29T23:41:45.000Z | kubernetes_typed/client/models/v1_empty_dir_volume_source.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 2 | 2021-09-05T19:18:28.000Z | 2022-03-14T02:56:17.000Z | # Code generated by `typeddictgen`. DO NOT EDIT.
"""V1EmptyDirVolumeSourceDict generated type."""
from typing import TypedDict
V1EmptyDirVolumeSourceDict = TypedDict(
"V1EmptyDirVolumeSourceDict",
{
"medium": str,
"sizeLimit": str,
},
total=False,
)
| 21.769231 | 48 | 0.678445 | 23 | 283 | 8.347826 | 0.782609 | 0.364583 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013453 | 0.212014 | 283 | 12 | 49 | 23.583333 | 0.847534 | 0.318021 | 0 | 0 | 1 | 0 | 0.219251 | 0.139037 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.111111 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.