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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
950ed1be89562c32d8d6bb451ac6c3a2273fd2f9 | 137 | py | Python | Basic Programming/Ladderophilia.py | Rounak259/HackerEarth | fb6f950f0b68f1c4ffab0a0c17b2e693700c4cb0 | [
"MIT"
] | null | null | null | Basic Programming/Ladderophilia.py | Rounak259/HackerEarth | fb6f950f0b68f1c4ffab0a0c17b2e693700c4cb0 | [
"MIT"
] | null | null | null | Basic Programming/Ladderophilia.py | Rounak259/HackerEarth | fb6f950f0b68f1c4ffab0a0c17b2e693700c4cb0 | [
"MIT"
] | null | null | null | for i in range(0, (int(input())*2)+1):
if i%2==0:
print("* *")
print("* *")
else:
print("*****") | 22.833333 | 39 | 0.335766 | 17 | 137 | 2.705882 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.059524 | 0.386861 | 137 | 6 | 40 | 22.833333 | 0.488095 | 0 | 0 | 0.333333 | 0 | 0 | 0.112782 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
952140f4477d16050646918fcc1442a5ecfca997 | 276 | py | Python | dash_website/correlation_between/__init__.py | SamuelDiai/Dash-Website | e064e432f14a86de1b54cf31ab311997c5643129 | [
"MIT"
] | null | null | null | dash_website/correlation_between/__init__.py | SamuelDiai/Dash-Website | e064e432f14a86de1b54cf31ab311997c5643129 | [
"MIT"
] | null | null | null | dash_website/correlation_between/__init__.py | SamuelDiai/Dash-Website | e064e432f14a86de1b54cf31ab311997c5643129 | [
"MIT"
] | null | null | null | SAMPLE_DEFINITION = {
"all_samples_per_participant": "Participant and time of examination",
"average_per_participant": "Participant (average across samples)",
"all_samples_when_possible_otherwise_average": "Participant and time when possible otherwise average",
}
| 46 | 106 | 0.789855 | 31 | 276 | 6.677419 | 0.483871 | 0.096618 | 0.241546 | 0.270531 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126812 | 276 | 5 | 107 | 55.2 | 0.858921 | 0 | 0 | 0 | 0 | 0 | 0.782609 | 0.336957 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
20f6c4369a199462fda8b5629410d16162ee8e78 | 199 | py | Python | quantity/digger/interaction/ipython_config.py | wyjcpu/quantity | a53126a430f12b5bac81a52b2fe749cc497faf36 | [
"MIT"
] | null | null | null | quantity/digger/interaction/ipython_config.py | wyjcpu/quantity | a53126a430f12b5bac81a52b2fe749cc497faf36 | [
"MIT"
] | null | null | null | quantity/digger/interaction/ipython_config.py | wyjcpu/quantity | a53126a430f12b5bac81a52b2fe749cc497faf36 | [
"MIT"
] | 1 | 2021-05-11T09:33:59.000Z | 2021-05-11T09:33:59.000Z | # -*- coding: utf-8 -*-
c = get_config()
#c.InteractiveShellApp.exec_files = [
#'shell.py'
#]
c.InteractiveShellApp.exec_lines = [
'from quantdigger.interaction.shell import shell as qd'
]
| 22.111111 | 60 | 0.673367 | 24 | 199 | 5.458333 | 0.75 | 0.305344 | 0.366412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006024 | 0.165829 | 199 | 8 | 61 | 24.875 | 0.783133 | 0.341709 | 0 | 0 | 0 | 0 | 0.420635 | 0.230159 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1f14e03330a53764edff09f482f1db59a16f76e3 | 226 | py | Python | thonny/plugins/cpython_backend/__init__.py | kr-g/thonny | 8aec29b6920482ba131bb03aab36ae2765e17d0d | [
"MIT"
] | null | null | null | thonny/plugins/cpython_backend/__init__.py | kr-g/thonny | 8aec29b6920482ba131bb03aab36ae2765e17d0d | [
"MIT"
] | null | null | null | thonny/plugins/cpython_backend/__init__.py | kr-g/thonny | 8aec29b6920482ba131bb03aab36ae2765e17d0d | [
"MIT"
] | null | null | null | """
cpython_backend and cpython_frontend are separated, because the cpython_ssh needs to copy the former
to the remote host so that it wouldn't depend on frontend part.
"""
from .cp_back import MainCPythonBackend, get_backend
| 37.666667 | 100 | 0.809735 | 36 | 226 | 4.944444 | 0.805556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141593 | 226 | 5 | 101 | 45.2 | 0.917526 | 0.725664 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
1f183367469743a08c06413b08fede73f89ee8ae | 107 | py | Python | helloworld.py | albertliangcode/DiceRoll | c70be41b26e71863eeb9d2d540abcf0f37091fcf | [
"MIT"
] | null | null | null | helloworld.py | albertliangcode/DiceRoll | c70be41b26e71863eeb9d2d540abcf0f37091fcf | [
"MIT"
] | 1 | 2015-03-27T04:53:14.000Z | 2015-03-27T15:58:56.000Z | helloworld.py | albertliangcode/DiceRoll | c70be41b26e71863eeb9d2d540abcf0f37091fcf | [
"MIT"
] | null | null | null | """
Hello World
3/26/15
Albert Liang
First test of Python on my Linux Machine
"""
print "Hello World!"
| 8.916667 | 40 | 0.691589 | 18 | 107 | 4.111111 | 0.888889 | 0.27027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0.205607 | 107 | 11 | 41 | 9.727273 | 0.811765 | 0 | 0 | 0 | 0 | 0 | 0.521739 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
1f2aa4a855594459baa55da2c8bb25525e381ef6 | 12,821 | py | Python | micropsi_core/world/minecraft/structs.py | joschabach/micropsi2 | 74a2642d20da9da1d64acc5e4c11aeabee192a27 | [
"MIT"
] | 119 | 2015-01-23T11:24:58.000Z | 2022-03-13T08:00:50.000Z | micropsi_core/world/minecraft/structs.py | Chediak/micropsi2 | 74a2642d20da9da1d64acc5e4c11aeabee192a27 | [
"MIT"
] | 9 | 2015-02-18T20:44:58.000Z | 2021-09-17T14:38:05.000Z | micropsi_core/world/minecraft/structs.py | Chediak/micropsi2 | 74a2642d20da9da1d64acc5e4c11aeabee192a27 | [
"MIT"
] | 34 | 2015-04-01T20:48:49.000Z | 2022-03-13T08:02:00.000Z | block_names = {
"-1": "Emptiness",
"0": "Air",
"1": "Stone",
"2": "Grass",
"3": "Dirt",
"4": "Cobblestone",
"5": "Oak_Wood_Planks",
"6": "Sapling",
"7": "Bedrock",
"8": "Water",
"9": "Water",
"10": "Lava",
"11": "Lava",
"12": "Sand",
"13": "Gravel",
"14": "Gold_Ore",
"15": "Iron_Ore",
"16": "Coal_Ore",
"17": "Wood",
"18": "Leaves",
"19": "Sponge",
"20": "Glass",
"21": "Lapis_Lazuli_Ore",
"22": "Lapis_Lazuli_(Block)",
"23": "Dispenser",
"24": "Sandstone",
"25": "Note_Block",
"26": "Bed",
"27": "Powered_Rail_Off",
"28": "Detector_Rail",
"29": "Sticky_Piston",
"30": "WebBlock",
"31": "Tall_Grass",
"32": "Dead_Bush",
"33": "Piston",
"34": "Block_34",
"35": "White_Wool",
"37": "Dandelion",
"38": "Poppy",
"39": "Brown_Mushroom",
"40": "Red_Mushroom",
"41": "Gold_(Block)",
"42": "Iron_(Block)",
"43": "Double_Stone_Slab",
"44": "Stone_Slab",
"45": "Brick_(Block)",
"46": "TNT",
"47": "Bookshelf",
"48": "Moss_Stone",
"49": "Obsidian",
"50": "Torch",
"51": "Fire",
"52": "Monster_Spawner",
"53": "Wooden_Stairs",
"54": "Chest",
"55": "Redstone_(Wire,Inventory)",
"56": "Diamond_Ore",
"57": "Diamond_(Block)",
"58": "Crafting_Table",
"59": "Crops",
"60": "Farmland",
"61": "Furnace",
"62": "Furnace_(Active)",
"63": "Sign",
"64": "Wooden_Door",
"65": "Ladders",
"66": "Rails",
"67": "Cobblestone_Stairs",
"68": "Wall_Sign",
"69": "Lever",
"70": "Stone_Pressure_Plate",
"71": "Iron_Door",
"72": "Wooden_Pressure_Plate",
"73": "Redstone_Ore",
"74": "Redstone_Ore",
"75": "Redstone_(Torch,_Inactive)",
"76": "Redstone_(Torch,_Active)",
"77": "Stone_Button",
"78": "Snow",
"79": "Ice",
"80": "Snow_(Block)",
"81": "Cactus",
"82": "Clay_Block",
"83": "Sugar_Canes",
"84": "Jukebox",
"85": "Fence",
"86": "Pumpkin",
"87": "Netherrack",
"88": "Soul_Sand",
"89": "Glowstone_(Block)",
"90": "Portal",
"91": "Jack_o'Lantern",
"92": "Cake",
"93": "Redstone_(Repeater,_Inactive)",
"94": "Redstone_(Repeater,_Active)",
"95": "White_Stained_Glass",
"96": "Trapdoor",
"97": "Stone",
"98": "Stone_Brick",
"99": "BrownMushroomCap",
"100": "RedMushroomCap",
"101": "Iron_Bars",
"102": "Glass_Pane",
"103": "Melon_(Block)",
"104": "Seed_Stem",
"105": "Seed_Stem",
"106": "Vine",
"107": "Fence_Gate_(Closed)",
"108": "Brick_Stairs",
"109": "Stone_Brick_Stairs",
"110": "Mycelium",
"111": "Lily_Pad",
"112": "Nether_Brick",
"113": "Nether_Brick_Fence",
"114": "Nether_Brick_Stairs",
"115": "Nether_Wart",
"116": "Enchantment_Table",
"117": "Brewing_Stand",
"118": "Cauldron",
"119": "End_Portal",
"120": "End_Portal_Frame",
"121": "End_Stone",
"122": "Dragon_Egg",
"123": "Redstone_Lamp",
"124": "Redstone_Lamp_(Active)",
"125": "Oak_Wood_Planks",
"126": "Oak-Wood_Slab",
"127": "Cocoa_Plant",
"128": "Sandstone_Stairs",
"129": "Emerald_Ore",
"130": "Ender_Chest",
"131": "Tripwire_Hook",
"132": "Tripwire",
"133": "Block_of_Emerald",
"134": "Spruce_Wood_Stairs",
"135": "Birch_Wood_Stairs",
"136": "Jungle_Wood_Stairs",
"137": "Command_Block",
"138": "Beacon_Block",
"139": "Cobblestone_Wall",
"140": "Flower_Pot",
"141": "Carrot_(Block)",
"142": "Potatoes_(Block)",
"143": "Wooden_Button",
"144": "Skeleton_Skull",
"145": "Anvil",
"146": "Trapped_Chest",
"147": "Weighted_Pressure_Plate_(Light)",
"148": "Weighted_Pressure_Plate_(Heavy)",
"149": "Redstone_Comparator_(inactive)",
"150": "Redstone_Comparator_(active)",
"151": "Daylight_Sensor",
"152": "Block_of_Redstone",
"153": "Nether_Quartz_Ore",
"154": "Hopper",
"155": "Block_of_Quartz",
"156": "Quartz_Stairs",
"157": "Activator_Rail",
"158": "Dropper",
"159": "White_Stained_Clay",
"160": "White_Stained_Glass_Pane",
"161": "Leaves",
"162": "Acacia_Wood",
"163": "Acacia_Wood_Stairs",
"164": "Dark_Oak_Wood_Stairs",
"165": "Slime_Block",
"166": "Barrier",
"167": "Iron_Trapdoor",
"168": "Prismarine",
"169": "Sea_Lantern",
"170": "Hay_Block",
"171": "White_Carpet",
"172": "Hardened_Clay",
"173": "Block_of_Coal",
"174": "Packed_Ice",
"175": "Sunflower",
"176": "Free-standing_Banner_(Small)",
"177": "Wall-mounted_Banner_(Small)",
"178": "Inverted_Daylight_Sensor",
"179": "Red_Sandstone",
"180": "Red_Sandstone_Stairs",
"181": "Red_Sandstone",
"182": "Red_Sandstone_Slab",
"183": "Spruce_Fence_Gate_(Closed)",
"184": "Birch_Fence_Gate_(Closed)",
"185": "Jungle_Fence_Gate_(Closed)",
"186": "Dark_Oak_Fence_Gate_(Closed)",
"187": "Acacia_Fence_Gate_(Closed)",
"188": "Spruce_Fence",
"189": "Birch_Fence",
"190": "Jungle_Fence",
"191": "Dark_Oak_Fence",
"192": "Acacia_Fence",
"193": "Spruce_Door",
"194": "Birch_Door",
"195": "Jungle_Door",
"196": "Acacia_Door",
"197": "Dark_Oak_Door",
}
block_colors = {
"-1": (250, 250, 250), # "Emptiness",
"0": (250, 250, 250), # (250, 250, 250), # "Air",
"1": (62, 62, 62), # "Stone",
"2": (90, 140, 80), # (), # "Grass",
"3": (150, 105, 75), # "Dirt",
"4": (106, 106, 106), # "Cobblestone",
"5": (145, 120, 75), # "Oak_Wood_Planks",
"6": (75, 205, 37), # "Sapling",
"7": (39, 39, 39), # "Bedrock",
"8": (74, 90, 206), # "Water",
"9": (74, 90, 206), # "Water",
"10": (194, 70, 11), # "Lava",
"11": (194, 70, 11), # "Lava",
"12": (206, 197, 152), # "Sand",
"13": (108, 108, 108), # "Gravel",
"14": (121, 121, 121), # "Gold_Ore",
"15": (118, 118, 118), # "Iron_Ore",
"16": (75, 75, 75), # "Coal_Ore",
"17": (60, 47, 29), # "Wood",
"18": (53, 132, 19), # "Leaves",
"19": (190, 191, 80), # "Sponge",
"20": (151, 179, 183), # "Glass",
"21": (65, 92, 146), # "Lapis_Lazuli_Ore",
"22": (31, 64, 141), # "Lapis_Lazuli_(Block)",
"23": (97, 97, 97), # "Dispenser",
"24": (212, 205, 158), # "Sandstone",
"25": (), # "Note_Block",
"26": (129, 19, 19), # "Bed",
"27": (), # "Powered_Rail_Off",
"28": (), # "Detector_Rail",
"29": (), # "Sticky_Piston",
"30": (), # "WebBlock",
"31": (59, 90, 51), # "Tall_Grass",
"32": (148, 100, 40), # "Dead_Bush",
"33": (), # "Piston",
"34": (), # "Block_34",
"35": (225, 225, 225), # "White_Wool",
"37": (234, 242, 6), # "Dandelion",
"38": (), # "Poppy",
"39": (114, 86, 67), # "Brown_Mushroom",
"40": (), # "Red_Mushroom",
"41": (), # "Gold_(Block)",
"42": (212, 212, 212), # "Iron_(Block)",
"43": (149, 149, 149), # "Double_Stone_Slab",
"44": (150, 150, 150), # "Stone_Slab",
"45": (), # "Brick_(Block)",
"46": (), # "TNT",
"47": (65, 53, 32), # "Bookshelf",
"48": (), # "Moss_Stone",
"49": (), # "Obsidian",
"50": (239, 167, 3), # "Torch",
"51": (190, 90, 4), # "Fire",
"52": (), # "Monster_Spawner",
"53": (142, 115, 71), # "Wooden_Stairs",
"54": (155, 105, 32), # "Chest",
"55": (), # "Redstone_(Wire,Inventory)",
"56": (), # "Diamond_Ore",
"57": (), # "Diamond_(Block)",
"58": (60, 49, 29), # "Crafting_Table",
"59": (138, 119, 18), # "Crops",
"60": (68, 47, 32), # "Farmland",
"61": (39, 39, 39), # "Furnace",
"62": (), # "Furnace_(Active)",
"63": (), # "Sign",
"64": (91, 72, 35), # "Wooden_Door",
"65": (145, 114, 67), # "Ladders",
"66": (), # "Rails",
"67": (90, 90, 90), # "Cobblestone_Stairs",
"68": (104, 85, 51), # "Wall_Sign",
"69": (), # "Lever",
"70": (), # "Stone_Pressure_Plate",
"71": (), # "Iron_Door",
"72": (), # "Wooden_Pressure_Plate",
"73": (), # "Redstone_Ore",
"74": (), # "Redstone_Ore",
"75": (), # "Redstone_(Torch,_Inactive)",
"76": (), # "Redstone_(Torch,_Active)",
"77": (), # "Stone_Button",
"78": (219, 235, 235), # "Snow",
"79": (125, 154, 204), # "Ice",
"80": (), # "Snow_(Block)",
"81": (10, 80, 20), # "Cactus",
"82": (), # "Clay_Block",
"83": (137, 187, 88), # "Sugar_Canes",
"84": (), # "Jukebox",
"85": (66, 53, 32), # "Fence",
"86": (), # "Pumpkin",
"87": (), # "Netherrack",
"88": (), # "Soul_Sand",
"89": (192, 148, 78), # "Glowstone_(Block)",
"90": (), # "Portal",
"91": (), # "Jack_o'Lantern",
"92": (), # "Cake",
"93": (), # "Redstone_(Repeater,_Inactive)",
"94": (), # "Redstone_(Repeater,_Active)",
"95": (), # "White_Stained_Glass",
"96": (), # "Trapdoor",
"97": (), # "Stone",
"98": (78, 78, 78), # "Stone_Brick",
"99": (), # "BrownMushroomCap",
"100": (), # "RedMushroomCap",
"101": (74, 74, 74), # "Iron_Bars",
"102": (201, 228, 233), # "Glass_Pane",
"103": (), # "Melon_(Block)",
"104": (), # "Seed_Stem",
"105": (), # "Seed_Stem",
"106": (44, 111, 15), # "Vine",
"107": (51, 43, 27), # "Fence_Gate_(Closed)",
"108": (), # "Brick_Stairs",
"109": (82, 82, 82), # "Stone_Brick_Stairs",
"110": (), # "Mycelium",
"111": (), # "Lily_Pad",
"112": (), # "Nether_Brick",
"113": (), # "Nether_Brick_Fence",
"114": (), # "Nether_Brick_Stairs",
"115": (), # "Nether_Wart",
"116": (82, 210, 188), # "Enchantment_Table",
"117": (), # "Brewing_Stand",
"118": (), # "Cauldron",
"119": (), # "End_Portal",
"120": (), # "End_Portal_Frame",
"121": (), # "End_Stone",
"122": (), # "Dragon_Egg",
"123": (), # "Redstone_Lamp",
"124": (), # "Redstone_Lamp_(Active)",
"125": (), # "Oak_Wood_Planks",
"126": (), # "Oak-Wood_Slab",
"127": (), # "Cocoa_Plant",
"128": (199, 193, 142), # "Sandstone_Stairs",
"129": (), # "Emerald_Ore",
"130": (), # "Ender_Chest",
"131": (), # "Tripwire_Hook",
"132": (), # "Tripwire",
"133": (), # "Block_of_Emerald",
"134": (), # "Spruce_Wood_Stairs",
"135": (), # "Birch_Wood_Stairs",
"136": (), # "Jungle_Wood_Stairs",
"137": (), # "Command_Block",
"138": (), # "Beacon_Block",
"139": (), # "Cobblestone_Wall",
"140": (84, 45, 35), # "Flower_Pot",
"141": (), # "Carrot_(Block)",
"142": (3, 224, 26), # "Potatoes_(Block)",
"143": (), # "Wooden_Button",
"144": (), # "Skeleton_Skull",
"145": (26, 26, 26), # "Anvil",
"146": (), # "Trapped_Chest",
"147": (), # "Weighted_Pressure_Plate_(Light)",
"148": (), # "Weighted_Pressure_Plate_(Heavy)",
"149": (), # "Redstone_Comparator_(inactive)",
"150": (), # "Redstone_Comparator_(active)",
"151": (), # "Daylight_Sensor",
"152": (), # "Block_of_Redstone",
"153": (), # "Nether_Quartz_Ore",
"154": (), # "Hopper",
"155": (), # "Block_of_Quartz",
"156": (), # "Quartz_Stairs",
"157": (), # "Activator_Rail",
"158": (), # "Dropper",
"159": (), # "White_Stained_Clay",
"160": (), # "White_Stained_Glass_Pane",
"161": (72, 145, 41), # "Leaves",
"162": (), # "Acacia_Wood",
"163": (164, 87, 47), # "Acacia_Wood_Stairs",
"164": (), # "Dark_Oak_Wood_Stairs",
"165": (), # "Slime_Block",
"166": (), # "Barrier",
"167": (), # "Iron_Trapdoor",
"168": (), # "Prismarine",
"169": (), # "Sea_Lantern",
"170": (), # "Hay_Block",
"171": (), # "White_Carpet",
"172": (), # "Hardened_Clay",
"173": (), # "Block_of_Coal",
"174": (), # "Packed_Ice",
"175": (), # "Sunflower",
"176": (), # "Free-standing_Banner_(Small)",
"177": (), # "Wall-mounted_Banner_(Small)",
"178": (), # "Inverted_Daylight_Sensor",
"179": (), # "Red_Sandstone",
"180": (), # "Red_Sandstone_Stairs",
"181": (), # "Red_Sandstone",
"182": (), # "Red_Sandstone_Slab",
"183": (), # "Spruce_Fence_Gate_(Closed)",
"184": (), # "Birch_Fence_Gate_(Closed)",
"185": (), # "Jungle_Fence_Gate_(Closed)",
"186": (), # "Dark_Oak_Fence_Gate_(Closed)",
"187": (), # "Acacia_Fence_Gate_(Closed)",
"188": (), # "Spruce_Fence",
"189": (), # "Birch_Fence",
"190": (), # "Jungle_Fence",
"191": (), # "Dark_Oak_Fence",
"192": (), # "Acacia_Fence",
"193": (), # "Spruce_Door",
"194": (), # "Birch_Door",
"195": (), # "Jungle_Door",
"196": (), # "Acacia_Door",
"197": (), # "Dark_Oak_Door",
}
| 31.893035 | 55 | 0.487169 | 1,396 | 12,821 | 4.196275 | 0.277221 | 0.018436 | 0.030727 | 0.006145 | 0.77535 | 0.730625 | 0.721748 | 0.673267 | 0.65449 | 0.612154 | 0 | 0.151649 | 0.243429 | 12,821 | 401 | 56 | 31.972569 | 0.452268 | 0.254348 | 0 | 0 | 0 | 0 | 0.364676 | 0.056416 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1f2e11dad0fd97404f4db48881a5d882d529f71f | 483 | py | Python | CH_12_performance/T_04_profiler_calibration.py | mastering-python/code_2 | 441af8b67402c8216c482cca7c002e1d7f0f1baa | [
"MIT"
] | null | null | null | CH_12_performance/T_04_profiler_calibration.py | mastering-python/code_2 | 441af8b67402c8216c482cca7c002e1d7f0f1baa | [
"MIT"
] | null | null | null | CH_12_performance/T_04_profiler_calibration.py | mastering-python/code_2 | 441af8b67402c8216c482cca7c002e1d7f0f1baa | [
"MIT"
] | null | null | null | import profile
if __name__ == '__main__':
profiler = profile.Profile()
for i in range(10):
print(profiler.calibrate(100000))
##############################################################################
import profile
# The number here is bias calculated earlier
profile.Profile.bias = 9.809351906482531e-07
##############################################################################
import profile
profiler = profile.Profile(bias=9.809351906482531e-07)
| 21.954545 | 78 | 0.492754 | 41 | 483 | 5.609756 | 0.585366 | 0.169565 | 0.191304 | 0.165217 | 0.321739 | 0.321739 | 0 | 0 | 0 | 0 | 0 | 0.103774 | 0.122153 | 483 | 21 | 79 | 23 | 0.438679 | 0.086957 | 0 | 0.333333 | 0 | 0 | 0.028269 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.111111 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
1f4d26f585b15bf5891fea5747a34af9e44fc045 | 25 | py | Python | tests/tag_handlers/__init__.py | an-otter-world/marshpy | 42aed8e5f316358792356c7e550f844a08bf206e | [
"WTFPL"
] | 1 | 2020-01-02T22:16:21.000Z | 2020-01-02T22:16:21.000Z | tests/tag_handlers/__init__.py | an-otter-world/pofy | 738fff7b2d56f7a979d0623dbda69c2bb29770b0 | [
"WTFPL"
] | 55 | 2020-01-02T00:17:58.000Z | 2021-02-07T23:26:26.000Z | tests/tag_handlers/__init__.py | gdaow/marshpy | 97b92f929b672a7d14578d0e3bafd52c0a920dd8 | [
"WTFPL"
] | null | null | null | """Tag handler tests."""
| 12.5 | 24 | 0.6 | 3 | 25 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 25 | 1 | 25 | 25 | 0.681818 | 0.72 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1f6d15854e425566e351de08563eae6b23af95df | 31 | py | Python | autokey/CapsCtrl/caps_5.py | TeX2e/dotfiles | 4e39b59623067fcb09ceaa7f4892ff7a2b285374 | [
"WTFPL"
] | 1 | 2017-04-17T16:24:23.000Z | 2017-04-17T16:24:23.000Z | autokey/CapsCtrl/caps_5.py | TeX2e/dotfiles | 4e39b59623067fcb09ceaa7f4892ff7a2b285374 | [
"WTFPL"
] | null | null | null | autokey/CapsCtrl/caps_5.py | TeX2e/dotfiles | 4e39b59623067fcb09ceaa7f4892ff7a2b285374 | [
"WTFPL"
] | 1 | 2021-02-23T07:51:32.000Z | 2021-02-23T07:51:32.000Z | keyboard.send_keys("<ctrl>+5")
| 15.5 | 30 | 0.709677 | 5 | 31 | 4.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033333 | 0.032258 | 31 | 1 | 31 | 31 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0.258065 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1f7f88dc300da6a04ad8ddccc63aab72cbf33b0b | 31 | py | Python | test/__init__.py | rxn4chemistry/biocatalysis-model | 4f61873bf2574af96e8fab7800eca15bd980a420 | [
"MIT"
] | 20 | 2022-02-19T09:14:41.000Z | 2022-03-16T07:58:14.000Z | test/__init__.py | rxn4chemistry/biocatalysis-model | 4f61873bf2574af96e8fab7800eca15bd980a420 | [
"MIT"
] | null | null | null | test/__init__.py | rxn4chemistry/biocatalysis-model | 4f61873bf2574af96e8fab7800eca15bd980a420 | [
"MIT"
] | 6 | 2022-02-20T15:48:56.000Z | 2022-02-24T04:51:20.000Z | """Initialize test modules."""
| 15.5 | 30 | 0.677419 | 3 | 31 | 7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 31 | 1 | 31 | 31 | 0.75 | 0.774194 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2f07bbd814e96edb9a9e10f2088a846b936f2120 | 208 | py | Python | acfc/helpers.py | grtcdr/acfc | 3c928b8acc711c8543407a6d9d020b232824f945 | [
"MIT"
] | 2 | 2021-11-12T13:57:06.000Z | 2022-01-17T16:29:24.000Z | acfc/helpers.py | grtcdr/acfc | 3c928b8acc711c8543407a6d9d020b232824f945 | [
"MIT"
] | 2 | 2022-01-17T16:48:39.000Z | 2022-01-19T03:49:29.000Z | acfc/helpers.py | grtcdr/acfc | 3c928b8acc711c8543407a6d9d020b232824f945 | [
"MIT"
] | null | null | null | def unpound(input: str) -> str:
"""
Removes '0x' or '#' prefix from a given string
:param input: A hexadecimal value.
:return: str
"""
return input.replace('#', '').replace('0x', '')
| 23.111111 | 51 | 0.5625 | 25 | 208 | 4.68 | 0.68 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012821 | 0.25 | 208 | 8 | 52 | 26 | 0.737179 | 0.456731 | 0 | 0 | 0 | 0 | 0.033708 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
2f835a38f1dd6dc673537556862d6e1f77f0d35e | 848 | py | Python | torchimage/misc/outer.py | miaotianyi/torchimage | 8b209c7da087bc18fd78dc0013c671e21a338f38 | [
"MIT"
] | 10 | 2021-04-22T08:15:49.000Z | 2022-03-19T01:28:06.000Z | torchimage/misc/outer.py | miaotianyi/torchimage | 8b209c7da087bc18fd78dc0013c671e21a338f38 | [
"MIT"
] | null | null | null | torchimage/misc/outer.py | miaotianyi/torchimage | 8b209c7da087bc18fd78dc0013c671e21a338f38 | [
"MIT"
] | null | null | null | import torch
def outer(u, v):
"""
Compute the outer product of two tensors.
For two tensors **u** of shape :math:`(k_1, k_2, ..., k_m)` and **v** of shape :math:`(l_1, l_2, ..., l_n)`,
their outer product :math:`\mathbf{w} = \mathbf{u} \otimes \mathbf{v}` is defined such that
:math:`\mathbf{w}[i_1, i_2, ..., i_m, j_1, j_2, ..., j_n] =
\mathbf{u}[i_1, i_2, ..., i_m] \mathbf{v}[j_1, j_2, ..., j_n]`.
**w** will have :math:`m+n` dimensions and the shape of :math:`(k_1, k_2, ..., k_m, l_1, l_2, ..., l_n)`
Parameters
----------
u, v : torch.Tensor or np.ndarray
Input tensor with arbitrary shape.
Returns
-------
w : torch.Tensor
Outer product of u and v.
``w.shape`` is the same as ``u.shape + v.shape``.
"""
return u.reshape(u.shape + (1, ) * v.ndim) * v
| 30.285714 | 112 | 0.537736 | 149 | 848 | 2.899329 | 0.328859 | 0.083333 | 0.064815 | 0.032407 | 0.12963 | 0.12963 | 0.046296 | 0 | 0 | 0 | 0 | 0.026646 | 0.247642 | 848 | 27 | 113 | 31.407407 | 0.65047 | 0.810142 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 1 | 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 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
85d4bead6fbb991de43ace890e4f2fc06c3a81d6 | 466 | py | Python | app/gui/const.py | vasilypht/Cryptographic-methods | 7a44a46f01d5973d338170cb05272582d34bc1be | [
"MIT"
] | null | null | null | app/gui/const.py | vasilypht/Cryptographic-methods | 7a44a46f01d5973d338170cb05272582d34bc1be | [
"MIT"
] | null | null | null | app/gui/const.py | vasilypht/Cryptographic-methods | 7a44a46f01d5973d338170cb05272582d34bc1be | [
"MIT"
] | null | null | null | from typing import Final
# files
MAX_CHARS_READ: Final = 1024
MAX_BYTES_READ: Final = 64 * 64
# Support file extensions
CAESAR_SUPPORT_EXT: Final = "Text files (*.txt)"
FREQ_ANALYSIS_SUPPORT_EXT: Final = "Text files (*.txt)"
XOR_SUPPORT_EXT: Final = "All files (*.*)"
DES_SUPPORT_EXT: Final = "All files (*.*)"
IC_SUPPORT_EXT: Final = "Text files (*.txt)"
AUTOCORRELATION_SUPPORT_EXT: Final = "Text files (*.txt)"
KASISKI_SUPPORT_EXT: Final = "Text files (*.txt)"
| 31.066667 | 57 | 0.723176 | 67 | 466 | 4.746269 | 0.38806 | 0.220126 | 0.330189 | 0.298742 | 0.569182 | 0.424528 | 0 | 0 | 0 | 0 | 0 | 0.019901 | 0.137339 | 466 | 14 | 58 | 33.285714 | 0.771144 | 0.062232 | 0 | 0 | 0 | 0 | 0.276498 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.1 | 0 | 0.1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
85d91447152256285528db53aaf511e11d7c6f74 | 33 | py | Python | tests/__init__.py | adamwojt/yee-cli | fda415e82669f5de82a56bcaefda06edb2b242f8 | [
"MIT"
] | 2 | 2021-02-17T12:23:52.000Z | 2021-10-03T01:43:05.000Z | tests/__init__.py | adamwojt/yee-cli | fda415e82669f5de82a56bcaefda06edb2b242f8 | [
"MIT"
] | null | null | null | tests/__init__.py | adamwojt/yee-cli | fda415e82669f5de82a56bcaefda06edb2b242f8 | [
"MIT"
] | null | null | null | """Unit test package for yee."""
| 16.5 | 32 | 0.636364 | 5 | 33 | 4.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151515 | 33 | 1 | 33 | 33 | 0.75 | 0.787879 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
85fb227d9c437dc0922e99ec260c371baa2f2a64 | 218 | py | Python | src/ui_pkg/uitemplate/views.py | mschwager/py-httptemplate | 49d901771d28dfaab12dd75fd313f1a3e8de1e1c | [
"Apache-2.0"
] | 2 | 2019-07-10T10:57:58.000Z | 2022-01-28T16:12:04.000Z | src/ui_pkg/uitemplate/views.py | mschwager/py-httptemplate | 49d901771d28dfaab12dd75fd313f1a3e8de1e1c | [
"Apache-2.0"
] | null | null | null | src/ui_pkg/uitemplate/views.py | mschwager/py-httptemplate | 49d901771d28dfaab12dd75fd313f1a3e8de1e1c | [
"Apache-2.0"
] | 1 | 2020-09-02T16:37:40.000Z | 2020-09-02T16:37:40.000Z | import aiohttp_jinja2
@aiohttp_jinja2.template('index.html')
async def index(request):
return {'content_header': 'Content Header'}
@aiohttp_jinja2.template('about.html')
async def about(request):
return {}
| 18.166667 | 47 | 0.738532 | 27 | 218 | 5.814815 | 0.481481 | 0.248408 | 0.267516 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015789 | 0.12844 | 218 | 11 | 48 | 19.818182 | 0.810526 | 0 | 0 | 0 | 0 | 0 | 0.220183 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.142857 | 0 | 0.428571 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c84127da28afece910bcea3750ee773dae0881e1 | 211 | py | Python | backend/server/apps/accounts/models.py | robkreisel/bible-notes | d042e412176a764df76739ac7d924950697de06c | [
"MIT"
] | null | null | null | backend/server/apps/accounts/models.py | robkreisel/bible-notes | d042e412176a764df76739ac7d924950697de06c | [
"MIT"
] | null | null | null | backend/server/apps/accounts/models.py | robkreisel/bible-notes | d042e412176a764df76739ac7d924950697de06c | [
"MIT"
] | null | null | null | from cuser.models import AbstractCUser
class User(AbstractCUser):
pass
User._meta.get_field('email')._unique = True
User._meta.get_field('email').blank = False
User._meta.get_field('email').null = False
| 19.181818 | 44 | 0.753555 | 30 | 211 | 5.066667 | 0.566667 | 0.157895 | 0.217105 | 0.315789 | 0.414474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113744 | 211 | 10 | 45 | 21.1 | 0.812834 | 0 | 0 | 0 | 0 | 0 | 0.07109 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.166667 | 0.166667 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
c85468fbc194575d2362f54972edf3ed8b533df0 | 1,540 | py | Python | tests/test_requests.py | Kitingu/restplus | f9f5d36f376b08bed4305020259f2be7d689705a | [
"MIT"
] | null | null | null | tests/test_requests.py | Kitingu/restplus | f9f5d36f376b08bed4305020259f2be7d689705a | [
"MIT"
] | 5 | 2019-10-21T17:05:46.000Z | 2021-06-01T22:35:47.000Z | tests/test_requests.py | Kitingu/restplus | f9f5d36f376b08bed4305020259f2be7d689705a | [
"MIT"
] | 1 | 2018-09-04T14:17:43.000Z | 2018-09-04T14:17:43.000Z | import json
from tests.Base_test import BaseTest
class Request(BaseTest):
def test_get_requests(self):
response = self.client().get('api/v1/requests',headers=self.user_header)
self.assertEqual(response.status_code, 200)
def test_create_request(self):
resp = self.client().post('/api/v1/rides', data=json.dumps(self.test_ride),
content_type='application/json',headers=self.user_header)
self.assertEqual(resp.status_code, 201)
resp = self.client().post('/api/v1/rides/1/requests', data=json.dumps(self.test_request),
content_type='application/json',headers=self.user_header)
self.assertEqual(resp.status_code, 201)
def test_request_non_existing(self):
resp = self.client().post('/api/v1/rides/888/requests', data=json.dumps(self.test_request),
content_type='application/json',headers=self.user_header)
self.assertEqual(resp.status_code, 404)
def test_request_more_than_available_seats(self):
resp = self.client().post('/api/v1/rides', data=json.dumps(self.test_ride),
content_type='application/json',headers=self.user_header)
self.assertEqual(resp.status_code, 201)
resp = self.client().post('/api/v1/rides/1/requests', data=json.dumps(self.request_many),
content_type='application/json',headers=self.user_header)
self.assertEqual(resp.status_code, 400)
| 49.677419 | 99 | 0.649351 | 193 | 1,540 | 5 | 0.238342 | 0.062176 | 0.093264 | 0.13057 | 0.752332 | 0.752332 | 0.715026 | 0.715026 | 0.681865 | 0.681865 | 0 | 0.024247 | 0.223377 | 1,540 | 30 | 100 | 51.333333 | 0.782609 | 0 | 0 | 0.416667 | 0 | 0 | 0.126623 | 0.048052 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.166667 | false | 0 | 0.083333 | 0 | 0.291667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c099b828b9d70b42c879fcee11cd0e18c510fb23 | 2,840 | py | Python | myapp/tests/test_cli.py | NCAR/benchmarking-web | 30336c1cec4fb66435679ad989427e9c4ab2a080 | [
"Apache-2.0"
] | null | null | null | myapp/tests/test_cli.py | NCAR/benchmarking-web | 30336c1cec4fb66435679ad989427e9c4ab2a080 | [
"Apache-2.0"
] | null | null | null | myapp/tests/test_cli.py | NCAR/benchmarking-web | 30336c1cec4fb66435679ad989427e9c4ab2a080 | [
"Apache-2.0"
] | null | null | null | from ..cli import DEFAULT_CONFIG, NAME, cli
def test_cli_defaults():
ctx = cli.make_context(cli.name, args=[], auto_envvar_prefix=NAME)
assert ctx.params == DEFAULT_CONFIG
def test_cli_host():
params = DEFAULT_CONFIG.copy()
params['host'] = 'http://localhost'
ctx = cli.make_context(cli.name, args=['--host', params['host']], auto_envvar_prefix=NAME)
assert ctx.params == params
def test_cli_port():
params = DEFAULT_CONFIG.copy()
params['port'] = 4567
ctx = cli.make_context(cli.name, args=['--port', str(params['port'])], auto_envvar_prefix=NAME)
assert ctx.params == params
def test_cli_logging():
params = DEFAULT_CONFIG.copy()
params['logging'] = 'WARNING'
ctx = cli.make_context(
cli.name, args=['--logging', str(params['logging'])], auto_envvar_prefix=NAME
)
assert ctx.params == params
def test_cli_mongouri():
params = DEFAULT_CONFIG.copy()
params['mongouri'] = 'mongodb://test.mongodb.com'
ctx = cli.make_context(
cli.name, args=['--mongouri', params['mongouri']], auto_envvar_prefix=NAME
)
assert ctx.params == params
def test_cli_mongodb():
params = DEFAULT_CONFIG.copy()
params['mongodb'] = 'test'
ctx = cli.make_context(cli.name, args=['--mongodb', params['mongodb']], auto_envvar_prefix=NAME)
assert ctx.params == params
def test_cli_env(cli_env):
params = DEFAULT_CONFIG.copy()
params['host'] = 'http://127.0.0.1'
params['port'] = 6789
ctx = cli.make_context(cli.name, args=[], auto_envvar_prefix=NAME)
assert ctx.params == params
def test_cli_env_overridden(cli_env):
params = DEFAULT_CONFIG.copy()
params['host'] = 'http://127.0.0.1'
params['port'] = 9999
ctx = cli.make_context(cli.name, args=['--port', str(params['port'])], auto_envvar_prefix=NAME)
assert ctx.params == params
def test_cli_configfile(cli_configfile):
params = DEFAULT_CONFIG.copy()
params['host'] = 'http://0.0.0.0'
params['port'] = 9999
ctx = cli.make_context(cli.name, args=['--config', cli_configfile], auto_envvar_prefix=NAME)
assert ctx.params == params
def test_cli_configfile_overridden(cli_configfile):
params = DEFAULT_CONFIG.copy()
params['host'] = 'http://0.0.0.0'
params['port'] = 8888
ctx = cli.make_context(
cli.name,
args=['--config', cli_configfile, '--port', str(params['port'])],
auto_envvar_prefix=NAME,
)
assert ctx.params == params
def test_cli_env_configfile_overridden(cli_env, cli_configfile):
params = DEFAULT_CONFIG.copy()
params['host'] = 'http://127.0.0.1'
params['port'] = 8888
ctx = cli.make_context(
cli.name,
args=['--config', cli_configfile, '--port', str(params['port'])],
auto_envvar_prefix=NAME,
)
assert ctx.params == params
| 30.212766 | 100 | 0.655634 | 380 | 2,840 | 4.689474 | 0.102632 | 0.087542 | 0.061728 | 0.104938 | 0.829405 | 0.76431 | 0.76431 | 0.680696 | 0.680696 | 0.673401 | 0 | 0.021496 | 0.180986 | 2,840 | 93 | 101 | 30.537634 | 0.744626 | 0 | 0 | 0.605634 | 0 | 0 | 0.113732 | 0.009155 | 0 | 0 | 0 | 0 | 0.15493 | 1 | 0.15493 | false | 0 | 0.014085 | 0 | 0.169014 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 4 |
c0ad2f5c84973b4a8fd87aa2c106362e0517cf37 | 289 | py | Python | flfm/tests/__init__.py | m-flak/flfm | e73943dc014e9af87a5c170d17dee15e1c6609bd | [
"Apache-2.0"
] | 5 | 2019-10-24T05:40:26.000Z | 2021-01-06T01:41:08.000Z | flfm/tests/__init__.py | m-flak/flfm | e73943dc014e9af87a5c170d17dee15e1c6609bd | [
"Apache-2.0"
] | null | null | null | flfm/tests/__init__.py | m-flak/flfm | e73943dc014e9af87a5c170d17dee15e1c6609bd | [
"Apache-2.0"
] | null | null | null | from .test_accounts import AccountsTesting
from .test_media import MediaTest
from .test_rules import RulesTest, VirtualRulesTest
from .test_sockets import SocketsWorkingTest
from .test_uploads import UploadsTest
from .test_video import VideoFormatTests
from .test_viewer import ViewerTest
| 36.125 | 51 | 0.871972 | 36 | 289 | 6.805556 | 0.5 | 0.228571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.100346 | 289 | 7 | 52 | 41.285714 | 0.942308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
c0ca73def91bc51785e693e810a0fd717b562fc8 | 134 | py | Python | api/web/__init__.py | michael-pryor/GeoTweetSearch | cb6d0a7732a0584022f3720e3f696fb709dd45b5 | [
"Apache-2.0"
] | 1 | 2016-04-08T08:40:34.000Z | 2016-04-08T08:40:34.000Z | api/web/__init__.py | watfordxp/GeoTweetSearch | cb6d0a7732a0584022f3720e3f696fb709dd45b5 | [
"Apache-2.0"
] | null | null | null | api/web/__init__.py | watfordxp/GeoTweetSearch | cb6d0a7732a0584022f3720e3f696fb709dd45b5 | [
"Apache-2.0"
] | 2 | 2015-08-28T17:08:26.000Z | 2016-12-30T21:59:46.000Z | __author__ = 'Michael Pryor'
from config import TEMPLATE_PATH, STATIC_PATH
import bottle
bottle.TEMPLATE_PATH.insert(0,TEMPLATE_PATH) | 26.8 | 45 | 0.843284 | 19 | 134 | 5.526316 | 0.631579 | 0.342857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008197 | 0.089552 | 134 | 5 | 46 | 26.8 | 0.852459 | 0 | 0 | 0 | 0 | 0 | 0.096296 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
2386d1ec413b77ccea9ecf7c48d7317b56a0f72d | 20 | py | Python | src/myutils/__init__.py | lord483/Project-Euler-Solutions | ba9e9451460d631774dfa75d61cedc1918a462c2 | [
"MIT"
] | null | null | null | src/myutils/__init__.py | lord483/Project-Euler-Solutions | ba9e9451460d631774dfa75d61cedc1918a462c2 | [
"MIT"
] | null | null | null | src/myutils/__init__.py | lord483/Project-Euler-Solutions | ba9e9451460d631774dfa75d61cedc1918a462c2 | [
"MIT"
] | null | null | null | __all__ = ["prime"]
| 10 | 19 | 0.6 | 2 | 20 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 20 | 1 | 20 | 20 | 0.470588 | 0 | 0 | 0 | 0 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
23b08f979d3d0e090f24b2f1aa8be11dc9c65c8c | 870 | py | Python | aiotdlib/api/functions/get_storage_statistics_fast.py | jraylan/aiotdlib | 4528fcfca7c5c69b54a878ce6ce60e934a2dcc73 | [
"MIT"
] | 37 | 2021-05-04T10:41:41.000Z | 2022-03-30T13:48:05.000Z | aiotdlib/api/functions/get_storage_statistics_fast.py | jraylan/aiotdlib | 4528fcfca7c5c69b54a878ce6ce60e934a2dcc73 | [
"MIT"
] | 13 | 2021-07-17T19:54:51.000Z | 2022-02-26T06:50:00.000Z | aiotdlib/api/functions/get_storage_statistics_fast.py | jraylan/aiotdlib | 4528fcfca7c5c69b54a878ce6ce60e934a2dcc73 | [
"MIT"
] | 7 | 2021-09-22T21:27:11.000Z | 2022-02-20T02:33:19.000Z | # =============================================================================== #
# #
# This file has been generated automatically!! Do not change this manually! #
# #
# =============================================================================== #
from __future__ import annotations
from pydantic import Field
from ..base_object import BaseObject
class GetStorageStatisticsFast(BaseObject):
"""
Quickly returns approximate storage usage statistics. Can be called before authorization
"""
ID: str = Field("getStorageStatisticsFast", alias="@type")
@staticmethod
def read(q: dict) -> GetStorageStatisticsFast:
return GetStorageStatisticsFast.construct(**q)
| 36.25 | 92 | 0.450575 | 54 | 870 | 7.166667 | 0.796296 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.312644 | 870 | 23 | 93 | 37.826087 | 0.647157 | 0.566667 | 0 | 0 | 1 | 0 | 0.083815 | 0.069364 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0.125 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 4 |
23cf45c49ac016f91ad8ec9fb1ecbac2f8b5fe45 | 69 | py | Python | env/lib/python3.8/site-packages/shortuuid/__main__.py | rajancolab/blogsite | 0721a3ab9b61bfca6fd84d5fae60b0574bfb0287 | [
"MIT"
] | 1,044 | 2016-10-20T23:43:13.000Z | 2022-03-30T07:45:03.000Z | env/lib/python3.8/site-packages/shortuuid/__main__.py | rajancolab/blogsite | 0721a3ab9b61bfca6fd84d5fae60b0574bfb0287 | [
"MIT"
] | 44 | 2017-01-24T10:24:45.000Z | 2022-03-17T13:59:51.000Z | env/lib/python3.8/site-packages/shortuuid/__main__.py | rajancolab/blogsite | 0721a3ab9b61bfca6fd84d5fae60b0574bfb0287 | [
"MIT"
] | 62 | 2016-10-29T21:22:26.000Z | 2022-03-24T23:04:02.000Z | from .main import uuid
if __name__ == "__main__":
print(uuid())
| 13.8 | 26 | 0.652174 | 9 | 69 | 4.111111 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202899 | 69 | 4 | 27 | 17.25 | 0.672727 | 0 | 0 | 0 | 0 | 0 | 0.115942 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
9b06bf9596d37dbb509c1d799141c58a57e83a70 | 6,089 | py | Python | tests/test_arraymanipulation.py | LukichevaPolina/dpnp | 5f5a679905d237ac7be1cc9ad1075877a9f77e39 | [
"BSD-2-Clause"
] | 37 | 2020-09-08T00:38:52.000Z | 2022-03-18T01:44:10.000Z | tests/test_arraymanipulation.py | LukichevaPolina/dpnp | 5f5a679905d237ac7be1cc9ad1075877a9f77e39 | [
"BSD-2-Clause"
] | 432 | 2020-09-07T09:48:41.000Z | 2022-03-25T17:50:55.000Z | tests/test_arraymanipulation.py | LukichevaPolina/dpnp | 5f5a679905d237ac7be1cc9ad1075877a9f77e39 | [
"BSD-2-Clause"
] | 17 | 2020-09-07T10:00:34.000Z | 2022-03-25T13:53:43.000Z | import pytest
import dpnp
import numpy
@pytest.mark.parametrize("dtype",
[numpy.float64, numpy.float32, numpy.int64, numpy.int32],
ids=["float64", "float32", "int64", "int32"])
@pytest.mark.parametrize("data",
[[1, 2, 3], [1., 2., 3.]],
ids=["[1, 2, 3]", "[1., 2., 3.]"])
def test_asfarray(dtype, data):
expected = numpy.asfarray(data, dtype)
result = dpnp.asfarray(data, dtype)
numpy.testing.assert_array_equal(result, expected)
@pytest.mark.parametrize("dtype",
[numpy.float64, numpy.float32, numpy.int64, numpy.int32],
ids=["float64", "float32", "int64", "int32"])
@pytest.mark.parametrize("data",
[[1, 2, 3], [1., 2., 3.]],
ids=["[1, 2, 3]", "[1., 2., 3.]"])
def test_asfarray2(dtype, data):
expected = numpy.asfarray(numpy.array(data), dtype)
result = dpnp.asfarray(dpnp.array(data), dtype)
numpy.testing.assert_array_equal(result, expected)
class TestConcatenate:
def test_returns_copy(self):
a = dpnp.array(numpy.eye(3))
b = dpnp.concatenate([a])
b[0, 0] = 2
assert b[0, 0] != a[0, 0]
def test_large_concatenate_axis_None(self):
x = dpnp.arange(1, 100)
r = dpnp.concatenate(x, None)
numpy.testing.assert_array_equal(x, r)
r = dpnp.concatenate(x, 100)
numpy.testing.assert_array_equal(x, r)
def test_concatenate(self):
# Test concatenate function
# One sequence returns unmodified (but as array)
r4 = list(range(4))
numpy.testing.assert_array_equal(dpnp.concatenate((r4,)), r4)
# Any sequence
numpy.testing.assert_array_equal(dpnp.concatenate((tuple(r4),)), r4)
numpy.testing.assert_array_equal(dpnp.concatenate((dpnp.array(r4),)), r4)
# 1D default concatenation
r3 = list(range(3))
numpy.testing.assert_array_equal(dpnp.concatenate((r4, r3)), r4 + r3)
# Mixed sequence types
numpy.testing.assert_array_equal(dpnp.concatenate((tuple(r4), r3)), r4 + r3)
numpy.testing.assert_array_equal(dpnp.concatenate((dpnp.array(r4), r3)), r4 + r3)
# Explicit axis specification
numpy.testing.assert_array_equal(dpnp.concatenate((r4, r3), 0), r4 + r3)
# Including negative
numpy.testing.assert_array_equal(dpnp.concatenate((r4, r3), -1), r4 + r3)
# 2D
a23 = dpnp.array([[10, 11, 12], [13, 14, 15]])
a13 = dpnp.array([[0, 1, 2]])
res = dpnp.array([[10, 11, 12], [13, 14, 15], [0, 1, 2]])
numpy.testing.assert_array_equal(dpnp.concatenate((a23, a13)), res)
numpy.testing.assert_array_equal(dpnp.concatenate((a23, a13), 0), res)
numpy.testing.assert_array_equal(dpnp.concatenate((a23.T, a13.T), 1), res.T)
numpy.testing.assert_array_equal(dpnp.concatenate((a23.T, a13.T), -1), res.T)
# Arrays much match shape
numpy.testing.assert_raises(ValueError, dpnp.concatenate, (a23.T, a13.T), 0)
# 3D
res = dpnp.reshape(dpnp.arange(2 * 3 * 7), (2, 3, 7))
a0 = res[..., :4]
a1 = res[..., 4:6]
a2 = res[..., 6:]
numpy.testing.assert_array_equal(dpnp.concatenate((a0, a1, a2), 2), res)
numpy.testing.assert_array_equal(dpnp.concatenate((a0, a1, a2), -1), res)
numpy.testing.assert_array_equal(dpnp.concatenate((a0.T, a1.T, a2.T), 0), res.T)
out = dpnp.copy(res)
rout = dpnp.concatenate((a0, a1, a2), 2, out=out)
numpy.testing.assert_(out is rout)
numpy.testing.assert_equal(res, rout)
class TestHstack:
def test_non_iterable(self):
numpy.testing.assert_raises(TypeError, dpnp.hstack, 1)
def test_empty_input(self):
numpy.testing.assert_raises(ValueError, dpnp.hstack, ())
def test_0D_array(self):
b = dpnp.array(2)
a = dpnp.array(1)
res = dpnp.hstack([a, b])
desired = dpnp.array([1, 2])
numpy.testing.assert_array_equal(res, desired)
def test_1D_array(self):
a = dpnp.array([1])
b = dpnp.array([2])
res = dpnp.hstack([a, b])
desired = dpnp.array([1, 2])
numpy.testing.assert_array_equal(res, desired)
def test_2D_array(self):
a = dpnp.array([[1], [2]])
b = dpnp.array([[1], [2]])
res = dpnp.hstack([a, b])
desired = dpnp.array([[1, 1], [2, 2]])
numpy.testing.assert_array_equal(res, desired)
def test_generator(self):
with numpy.testing.assert_warns(FutureWarning):
dpnp.hstack((numpy.arange(3) for _ in range(2)))
with numpy.testing.assert_warns(FutureWarning):
dpnp.hstack(map(lambda x: x, numpy.ones((3, 2))))
class TestVstack:
def test_non_iterable(self):
numpy.testing.assert_raises(TypeError, dpnp.vstack, 1)
def test_empty_input(self):
numpy.testing.assert_raises(ValueError, dpnp.vstack, ())
def test_0D_array(self):
a = dpnp.array(1)
b = dpnp.array(2)
res = dpnp.vstack([a, b])
desired = dpnp.array([[1], [2]])
numpy.testing.assert_array_equal(res, desired)
def test_1D_array(self):
a = dpnp.array([1])
b = dpnp.array([2])
res = dpnp.vstack([a, b])
desired = dpnp.array([[1], [2]])
numpy.testing.assert_array_equal(res, desired)
def test_2D_array(self):
a = dpnp.array([[1], [2]])
b = dpnp.array([[1], [2]])
res = dpnp.vstack([a, b])
desired = dpnp.array([[1], [2], [1], [2]])
numpy.testing.assert_array_equal(res, desired)
def test_2D_array2(self):
a = dpnp.array([1, 2])
b = dpnp.array([1, 2])
res = dpnp.vstack([a, b])
desired = dpnp.array([[1, 2], [1, 2]])
numpy.testing.assert_array_equal(res, desired)
def test_generator(self):
with numpy.testing.assert_warns(FutureWarning):
dpnp.vstack((numpy.arange(3) for _ in range(2)))
| 37.355828 | 89 | 0.584825 | 821 | 6,089 | 4.219245 | 0.137637 | 0.124711 | 0.187067 | 0.172633 | 0.772229 | 0.731524 | 0.70843 | 0.677252 | 0.63597 | 0.492206 | 0 | 0.055054 | 0.254229 | 6,089 | 162 | 90 | 37.58642 | 0.707774 | 0.03416 | 0 | 0.488 | 0 | 0 | 0.018399 | 0 | 0 | 0 | 0 | 0 | 0.296 | 1 | 0.144 | false | 0 | 0.024 | 0 | 0.192 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
9b0ea14b57e7c53933113e5941964e56f4b03457 | 31 | py | Python | esphome/components/max9611/__init__.py | OttoWinter/esphomeyaml | 6a85259e4d6d1b0a0f819688b8e555efcb99ecb0 | [
"MIT"
] | 249 | 2018-04-07T12:04:11.000Z | 2019-01-25T01:11:34.000Z | esphome/components/max9611/__init__.py | OttoWinter/esphomeyaml | 6a85259e4d6d1b0a0f819688b8e555efcb99ecb0 | [
"MIT"
] | 243 | 2018-04-11T16:37:11.000Z | 2019-01-25T16:50:37.000Z | esphome/components/max9611/__init__.py | OttoWinter/esphomeyaml | 6a85259e4d6d1b0a0f819688b8e555efcb99ecb0 | [
"MIT"
] | 40 | 2018-04-10T05:50:14.000Z | 2019-01-25T15:20:36.000Z | CODEOWNERS = ["@mckaymatthew"]
| 15.5 | 30 | 0.709677 | 2 | 31 | 11 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 31 | 1 | 31 | 31 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0.419355 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
f1b28b2ba8f68cfe35004a512037b823bc56fac9 | 31 | py | Python | lggr/migrations/__init__.py | 10sr/webtools | 8dd7fecf5d3df9094f32d044f11e983ab3095287 | [
"Apache-2.0"
] | null | null | null | lggr/migrations/__init__.py | 10sr/webtools | 8dd7fecf5d3df9094f32d044f11e983ab3095287 | [
"Apache-2.0"
] | 111 | 2019-05-15T05:20:49.000Z | 2021-10-16T14:43:34.000Z | lggr/migrations/__init__.py | 10sr/webtools | 8dd7fecf5d3df9094f32d044f11e983ab3095287 | [
"Apache-2.0"
] | null | null | null | """loggr migration scripts."""
| 15.5 | 30 | 0.677419 | 3 | 31 | 7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 31 | 1 | 31 | 31 | 0.75 | 0.774194 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
f1c627c336236736291663c1df74db7c5eec1982 | 37 | py | Python | ex1.py | orende/intro-till-python | d2fccc7aaeabf88d6b040b7e199326a748dee0fa | [
"MIT"
] | null | null | null | ex1.py | orende/intro-till-python | d2fccc7aaeabf88d6b040b7e199326a748dee0fa | [
"MIT"
] | null | null | null | ex1.py | orende/intro-till-python | d2fccc7aaeabf88d6b040b7e199326a748dee0fa | [
"MIT"
] | null | null | null | var1 = 1
var2 = "hej"
print var1+var2 | 12.333333 | 15 | 0.675676 | 7 | 37 | 3.571429 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 0.189189 | 37 | 3 | 15 | 12.333333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0.078947 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.333333 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
f1dbe1f1244f3c42e16df5e89f4e5bd5c00e4d25 | 92 | py | Python | Codewars/8kyu/subtract-the-sum/Python/test.py | RevansChen/online-judge | ad1b07fee7bd3c49418becccda904e17505f3018 | [
"MIT"
] | 7 | 2017-09-20T16:40:39.000Z | 2021-08-31T18:15:08.000Z | Codewars/8kyu/subtract-the-sum/Python/test.py | RevansChen/online-judge | ad1b07fee7bd3c49418becccda904e17505f3018 | [
"MIT"
] | null | null | null | Codewars/8kyu/subtract-the-sum/Python/test.py | RevansChen/online-judge | ad1b07fee7bd3c49418becccda904e17505f3018 | [
"MIT"
] | null | null | null | # Python - 3.6.0
Test.describe('Basic Test')
Test.assert_equals(subtract_sum(10), 'apple')
| 18.4 | 45 | 0.717391 | 15 | 92 | 4.266667 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060241 | 0.097826 | 92 | 4 | 46 | 23 | 0.710843 | 0.152174 | 0 | 0 | 0 | 0 | 0.197368 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
f1e58154770dab54b624c22675c394228c4b0aac | 125 | py | Python | python/python/rotate/rotate.py | iggy18/data-structures-and-algorithms | 700ef727ca7656724120a1873af4bd4bce5962f4 | [
"MIT"
] | null | null | null | python/python/rotate/rotate.py | iggy18/data-structures-and-algorithms | 700ef727ca7656724120a1873af4bd4bce5962f4 | [
"MIT"
] | null | null | null | python/python/rotate/rotate.py | iggy18/data-structures-and-algorithms | 700ef727ca7656724120a1873af4bd4bce5962f4 | [
"MIT"
] | null | null | null | """
problem domain:
rotate a 3x3 matrix 90 degrees.
"""
def rotate(matrix):
return [list(a) for a in zip(*matrix)]
| 9.615385 | 42 | 0.632 | 19 | 125 | 4.157895 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041237 | 0.224 | 125 | 12 | 43 | 10.416667 | 0.773196 | 0.376 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
f1f8152c1251f220f961ff4c02ee393129aaab90 | 10,004 | py | Python | amoebaelib/replace_nodes_in_tree.py | laelbarlow/amoebae | 3c6607bcb64a60baee2f19f0a25e14b325e9725d | [
"Apache-2.0"
] | 8 | 2020-07-16T21:36:38.000Z | 2021-11-28T08:32:05.000Z | amoebaelib/replace_nodes_in_tree.py | laelbarlow/amoebae | 3c6607bcb64a60baee2f19f0a25e14b325e9725d | [
"Apache-2.0"
] | null | null | null | amoebaelib/replace_nodes_in_tree.py | laelbarlow/amoebae | 3c6607bcb64a60baee2f19f0a25e14b325e9725d | [
"Apache-2.0"
] | 1 | 2020-07-31T21:21:15.000Z | 2020-07-31T21:21:15.000Z | #!/usr/bin/env python3
# Copyright 2018 Lael D. Barlow
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Contains functions for replacing nodes of interest in a given ete3 TreeNode
object with alternative nodes.
***This module is not in use yet.
"""
import sys
import os
#from math import factorial
from ete3 import Tree
from search_alignment_space import get_corresponding_node
#from itertools import product
# Unfinished function:
def replace_nodes_of_interest_in_tree(t, nodes, replacement_nodes):
"""Takes a TreeNode object, a list of nodes (TreeNode objects) of interest,
and a list of replacement nodes, and makes the appropriate node
replacements.
"""
t2 = t.copy()
print(t2)
for n, replacement_n in zip(nodes, replacement_nodes):
t2n = get_corresponding_node(n, t2)
# Replace t2n with replacement_n
pass # ...........
return t2
#def get_polytomy_for_treenode(treenode):
# """Take an ETE3 TreeNode object and return a TreeNode object with all the
# same leaf nodes, but just as a polytomy.
# """
# # Initiate a new TreeNode object.
# new_treenode = Tree()
#
# # Add each terminal (leaf) node from the original TreeNode object as a
# # child to the new TreeNode object.
# for leaf in treenode.get_leaves():
# new_treenode.add_child(leaf)
#
# # Return polytomy.
# return new_treenode
#
#
#def determine_if_polytomy(subtree):
# """Determine if the given subtree (represented as a set, which may contain
# sets) is a polytomy or not.
# """
# is_polytomy = False
# # Basically, input sets cannot contain more than two elements. Otherwise,
# # they represent a polytomy.
# if len(subtree) > 2:
# is_polytomy = True
#
# # Return True if it's a polytomy.
# return is_polytomy
#
#
#def get_partitions_of_set(s):
# """Recursively partition elements in an input set.
# """
# # Add a new singleton subset.
# if len(s) == 1:
# yield frozenset(s)
# return
# # Extract one element from the set
# elem, *_ = s
# rest = frozenset(s - {elem})
# for partition in get_partitions_of_set(rest):
# for subset in partition:
# # Insert the element in the subset
# try:
# augmented_subset = frozenset(subset | frozenset({elem}))
# except TypeError:
# # subset is actually an atomic element
# augmented_subset = frozenset({subset} | frozenset({elem}))
# yield frozenset({augmented_subset}) | (partition - {subset})
# # Case with the element in its own extra subset
# yield frozenset({elem}) | partition
#
#
#def get_newick_tree_string_from_set(s):
# if type(s) not in (set, frozenset):
# return str(s)
# return "(" + ",".join(sorted(map(get_newick_tree_string_from_set, s))) + ")"
#
#
#def trees(leaves, polytomies=False):
# """Generate all alternative trees (in newick format) for a given list of
# leaf names, by recursively partitioning the input set of leaf names in
# every possible way. By default polytomies are excluded, but can be included
# by setting the polytomies option to True.
# """
# if type(leaves) not in (set, frozenset):
# # It actually is a single leaf
# yield leaves
# # Don't try to yield any more trees
# return
# # Otherwise, we will have to consider all the possible
# # partitions of the set of leaves, and for each partition,
# # construct the possible trees for each part
# for partition in get_partitions_of_set(leaves):
# # We need to skip the case where the partition
# # has only one subset (the initial set itself),
# # otherwise we will try to build an infinite
# # succession of nodes with just one subtree
# if len(partition) == 1:
# part, *_ = partition
# # Just to be sure the assumption is correct
# assert part == leaves
# continue
# # We recursively apply the trees function to each part and obtain the
# # possible trees by making the product of the sets of possible
# # subtrees.
# for subtree in product(*map(trees, partition)):
# # Only return trees that are polytomies if the option is used.
# yield_subtree = False
# if polytomies:
# yield_subtree = True
# else:
# # Determine whether the subtree is a polytomy.
# is_polytomy = determine_if_polytomy(subtree)
# if not is_polytomy:
# yield_subtree = True
# # Now yield the subtree if appropriate.
# if yield_subtree:
# yield frozenset(subtree)
# else:
# # Ignore topologies that are not interesting.
# continue
#
#
#def get_total_num_topos_for_n_taxa(n):
# """Given a number of taxa (integer greater than 2), return an integer
# representing the theoretical total number of possible topologies (without
# polytomies) for relationships between those taxa.
# """
# assert isinstance(n, int), """Input must be an int."""
# assert n > 2, """Input number must be greater than 2."""
# return factorial(2*n - 5) / (factorial(n - 3) * 2**(n - 3))
#
#
#def get_leaf_names_to_represent_n_taxa(n):
# """Take n integer and return a list of the same number of unique strings
# that can be easily replaced with other taxon names or subtrees.
# """
# longest_leaf_list = [x*10 for x in ["A", "B", "C", "D", "E", "F", "G"]]
# leaves = longest_leaf_list[:n]
# return leaves
#
#
#def get_all_unique_unrooted_bifurcating_topologies_for_n_taxa(n):
# """Given an integer from 3 to 7, generate all unique unrooted bifurcating
# tree topologies for that given number of taxa.
# """
# # Check that input is an integer between 3 and 7.
# assert isinstance(n, int), """Input must be an int."""
# assert 2 < n < 8, """Input number must be greater than 2 and less than 8."""
#
# # Generate a set of leaf names to represent n taxa.
# leaves = get_leaf_names_to_represent_n_taxa(n)
#
# # Call recursive function (trees) to generate all unique bifurcating rooted
# # trees for n taxa (rooted on a particular leaf).
# all_trees = frozenset(
# {frozenset({tree, leaves[0]}) for tree in trees(set(leaves[1:]))})
#
# ## Print resulting set of trees.
# #print('\nTree topologies for ' + str(n) + ' taxa:')
# #for tree in all_trees:
# # print(get_newick_tree_string_from_set(tree) + ";")
#
# # Check that the length of the resulting set of topologies is the same as
# # predicted by the formula.
# assert len(all_trees) == get_total_num_topos_for_n_taxa(n), """Different
# number of tree topologies produced than expected."""
#
# # Return the set of all alternative tree topologies as a list.
# return list(all_trees)
#
#
#def get_all_alt_topologies(subtrees):
# """Take a list of ete3 TreeNode objects and return a list of TreeNode
# objects representing all possible backbone topologies for relationships
# between the input clades.
# """
# # Find all alternative topologies for tree with the same number of taxa as
# # the number of input subtrees (with taxa represented by arbitrary
# # strings).
# all_tree_sets =\
# get_all_unique_unrooted_bifurcating_topologies_for_n_taxa(len(subtrees))
#
# # Get all sets as newick tree strings.
# all_rooted_newick_trees = [get_newick_tree_string_from_set(x) + ';' for x in all_tree_sets]
#
# ## Print rooted trees.
# #print('First three rooted trees:')
# #for i in all_rooted_newick_trees[:3]:
# # print(i)
# #print('')
#
# # (Re)generate the list of leaf names in the backbone trees.
# leaf_names_in_all_trees = get_leaf_names_to_represent_n_taxa(len(subtrees))
#
# # Unroot all the trees.
# all_tree_obj = [Tree(x) for x in all_rooted_newick_trees]
# for t in all_tree_obj:
# t.unroot()
# all_unrooted_newick_trees = [t.write(format=9) for t in all_tree_obj]
#
# ## Print unrooted trees.
# #print('First three unrooted trees:')
# #for i in all_unrooted_newick_trees[:3]:
# # print(i)
# #print('')
#
# # Get list of input subtrees as newick trees (without trailing semicolons).
# subtree_newick_strings = [subtree.write(format=9) for subtree in subtrees]
#
# ## Print subtrees.
# #print('First three subtrees:')
# #for i in subtree_newick_strings[:3]:
# # print(i[:-1])
# #print('')
#
# # Get list of alternative topologies by replacing strings in unrooted trees
# # with strings representing the input subtrees.
# all_unrooted_trees_with_subtrees = all_unrooted_newick_trees
# for place_holder_name, subtree_string in\
# zip(leaf_names_in_all_trees, subtree_newick_strings):
# #print('Replacing %s with %s in all alternative topologies.' %\
# # (place_holder_name, subtree_string[:-1]))
# all_unrooted_trees_with_subtrees =\
# [t.replace(place_holder_name, subtree_string[:-1]) for t in\
# all_unrooted_trees_with_subtrees]
#
# ## Print trees with subtrees.
# #print('\nFirst three unrooted trees with subtrees:')
# #for i in all_unrooted_trees_with_subtrees[:3]:
# # print(i)
# #print('')
#
# # Return list of alternative topologies as newick strings.
# return all_unrooted_trees_with_subtrees
| 37.893939 | 96 | 0.658237 | 1,370 | 10,004 | 4.662044 | 0.219708 | 0.009394 | 0.018632 | 0.023485 | 0.176765 | 0.133553 | 0.077345 | 0.045405 | 0.028495 | 0.013152 | 0 | 0.006746 | 0.244302 | 10,004 | 263 | 97 | 38.038023 | 0.838095 | 0.907437 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0.090909 | 0.363636 | 0 | 0.545455 | 0.090909 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
f1fa5a6357e67bc284f861fffc538583e08a4f7d | 5,944 | py | Python | tests/test_shortable.py | rgomezjnr/shortable | 4ace06b484bd24a356300a9d15a02a902c853c63 | [
"MIT"
] | null | null | null | tests/test_shortable.py | rgomezjnr/shortable | 4ace06b484bd24a356300a9d15a02a902c853c63 | [
"MIT"
] | null | null | null | tests/test_shortable.py | rgomezjnr/shortable | 4ace06b484bd24a356300a9d15a02a902c853c63 | [
"MIT"
] | 1 | 2021-11-01T23:20:45.000Z | 2021-11-01T23:20:45.000Z | #!/usr/bin/env python
import unittest
import logging
from shortable import shortable
#class TestValidReadOldShortStatus(unittest.TestCase):
# def setUp(self):
# self.shortable = shortable.Shortable()
# self.file_name = 'valid_shortable.json'
#
# def test_valid_read_old_short_status(self):
# self.shortable.read_old_short_status('valid_shortable.json')
# self.assertIs(self.old_short_status, dict)
# self.assertGreaterEqual(len(self.shortable.read_old_short_status), 1)
#
# def tearDown(self):
# self.shortable
# self.file_name
#class TestInvalidReadOldShortStatus(unittest.TestCase):
# def setUp(self):
# self.shortable = shortable.Shortable()
# self.file_name
#
# def test_invalid_read_old_short_status(self):
# self.shortable.read_old_short_status('invalid_old_short_status_not_dict.json')
# self.shortable.read_old_short_status('invalid_shortable_less_than_1_asset.json')
# self.shortable.read_old_short_status('invalid_shortable_empty.json')
# self.assertRaises(shortable database is not type dict)
# self.assertRaises(shortable database length less than 1)
#
# def tearDown(self):
# self.shortable
# self.file_name
class TestNonShortableToShortable(unittest.TestCase):
def setUp(self):
self.shortable = shortable.Shortable()
self.shortable.old_short_status = {'AMZN': False, 'MSFT': False, 'TSLA': False}
self.shortable.new_short_status = {'AMZN': True, 'MSFT': True, 'TSLA': True}
self.expected_report = 'AMZN now shortable\nMSFT now shortable\nTSLA now shortable\n'
def test_non_shortable_to_shortable(self):
self.shortable.check_short_status_changes()
self.assertEqual(self.shortable.old_short_status, self.shortable.new_short_status)
self.assertEqual(self.shortable.report, self.expected_report)
def tearDown(self):
del self.shortable
del self.expected_report
class TestShortableToNonShortable(unittest.TestCase):
def setUp(self):
self.shortable = shortable.Shortable()
self.shortable.old_short_status = {'AMZN': True, 'MSFT': True, 'TSLA': True}
self.shortable.new_short_status = {'AMZN': False, 'MSFT': False, 'TSLA': False}
self.expected_report = 'AMZN now non-shortable\nMSFT now non-shortable\nTSLA now non-shortable\n'
def test_shortable_to_non_shortable(self):
self.shortable.check_short_status_changes()
self.assertEqual(self.shortable.old_short_status, self.shortable.new_short_status)
self.assertEqual(self.shortable.report, self.expected_report)
def tearDown(self):
del self.shortable
del self.expected_report
class TestNoneToShortable(unittest.TestCase):
def setUp(self):
self.shortable = shortable.Shortable()
self.shortable.old_short_status = {'AMZN': None, 'MSFT': None, 'TSLA': None}
self.shortable.new_short_status = {'AMZN': True, 'MSFT': True, 'TSLA': True}
self.expected_report = 'AMZN now shortable, previous status unknown\nMSFT now shortable, previous status unknown\nTSLA now shortable, previous status unknown\n'
def test_none_to_shortable(self):
self.shortable.check_short_status_changes()
self.assertEqual(self.shortable.old_short_status, self.shortable.new_short_status)
self.assertEqual(self.shortable.report, self.expected_report)
for asset in self.shortable.old_short_status:
self.assertIsNotNone(asset)
def tearDown(self):
del self.shortable
class TestNoneToNonShortable(unittest.TestCase):
def setUp(self):
self.shortable = shortable.Shortable()
self.shortable.old_short_status = {'AMZN': None, 'MSFT': None, 'TSLA': None}
self.shortable.new_short_status = {'AMZN': False, 'MSFT': False, 'TSLA': False}
self.expected_report = 'AMZN now non-shortable, previous status unknown\nMSFT now non-shortable, previous status unknown\nTSLA now non-shortable, previous status unknown\n'
def test_none_to_non_shortable(self):
self.shortable.check_short_status_changes()
self.assertEqual(self.shortable.old_short_status, self.shortable.new_short_status)
self.assertEqual(self.shortable.report, self.expected_report)
for asset in self.shortable.old_short_status:
self.assertIsNotNone(asset)
def tearDown(self):
del self.shortable
class TestNoShortableStatusChange(unittest.TestCase):
def setUp(self):
self.shortable = shortable.Shortable()
self.shortable.old_short_status = {'AMZN': True, 'MSFT': True, 'TSLA': True}
self.shortable.new_short_status = {'AMZN': True, 'MSFT': True, 'TSLA': True}
self.expected_log = ['INFO:root:No change to shortable status of AMZN',
'INFO:root:No change to shortable status of MSFT',
'INFO:root:No change to shortable status of TSLA']
def test_no_shortable_status_change(self):
with self.assertLogs('root', level='INFO') as cm:
self.shortable.check_short_status_changes()
logging.getLogger('root').info('No change to shortable status of AMZN')
logging.getLogger('root').info('No change to shortable status of MSFT')
logging.getLogger('root').info('No change to shortable status of TSLA')
self.assertEqual(cm.output, self.expected_log)
def tearDown(self):
del self.shortable
del self.expected_log
#class TestNoExistingShortListDatabase(unittest.TestCase):
#class TestInvalidAsset(unittest.TestCase):
#class TestInvalidAssetStatus(unittest.TestCase):
#class TestSingleAssetinDatabase(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
| 44.358209 | 181 | 0.691958 | 701 | 5,944 | 5.667618 | 0.128388 | 0.15706 | 0.070476 | 0.058142 | 0.764661 | 0.764661 | 0.71256 | 0.704757 | 0.678329 | 0.614145 | 0 | 0.000635 | 0.205754 | 5,944 | 133 | 182 | 44.691729 | 0.840924 | 0.223587 | 0 | 0.623377 | 0 | 0.025974 | 0.182962 | 0 | 0 | 0 | 0 | 0 | 0.155844 | 1 | 0.194805 | false | 0 | 0.038961 | 0 | 0.298701 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7b0089203106fc7f6ec0de1fac8e681e8623b289 | 150 | py | Python | radikopodcast/radikoxml/__init__.py | road-master/radiko-podcast | 40ad83cf8116d675da072ce891420c4d84503141 | [
"MIT"
] | null | null | null | radikopodcast/radikoxml/__init__.py | road-master/radiko-podcast | 40ad83cf8116d675da072ce891420c4d84503141 | [
"MIT"
] | 2 | 2021-11-09T14:34:17.000Z | 2021-11-09T14:34:30.000Z | radikopodcast/radikoxml/__init__.py | road-master/radiko-podcast | 40ad83cf8116d675da072ce891420c4d84503141 | [
"MIT"
] | null | null | null | """Package about radiko XML.
see:
- [radikoのxml番組表とタグの意味 - 別館 子子子子子子(ねこのここねこ)はてブロ部](
https://riocampos-tech.hatenablog.com/entry/20170415/p1)
"""
| 18.75 | 58 | 0.726667 | 18 | 150 | 6.055556 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.067164 | 0.106667 | 150 | 7 | 59 | 21.428571 | 0.746269 | 0.946667 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7b3488d3588681e8511f709931303a438b450840 | 2,019 | py | Python | twitchbot/pubsub/subscription_model.py | cvangheem/Twitchbot | 48bb065951e88e4d2e9ef8d0c1a3afb0150a5eb5 | [
"MIT"
] | null | null | null | twitchbot/pubsub/subscription_model.py | cvangheem/Twitchbot | 48bb065951e88e4d2e9ef8d0c1a3afb0150a5eb5 | [
"MIT"
] | null | null | null | twitchbot/pubsub/subscription_model.py | cvangheem/Twitchbot | 48bb065951e88e4d2e9ef8d0c1a3afb0150a5eb5 | [
"MIT"
] | null | null | null | from typing import TYPE_CHECKING
from ..cached_property import cached_property
if TYPE_CHECKING:
from .models import PubSubData
__all__ = [
'PubSubSubscription'
]
class PubSubSubscription:
def __init__(self, raw: 'PubSubData'):
self.data = raw
@property
def topic(self) -> str:
return self.data.topic
@property
def benefit_end_month(self) -> int:
return self.data.message_dict.get('benefit_end_month', -1)
@property
def channel_id(self) -> str:
return self.data.message_dict.get('channel_id', '')
@property
def channel_name(self) -> str:
return self.data.message_dict.get('channel_name', '')
@property
def context(self) -> str:
return self.data.message_dict.get('context', '')
@property
def cumulative_months(self) -> int:
return self.data.message_dict.get('cumulative_months', 0)
@property
def display_name(self) -> str:
return self.data.message_dict.get('display_name', '')
@property
def is_gift(self) -> bool:
return self.data.message_dict.get('is_gift', False)
@property
def months(self) -> int:
return self.data.message_dict.get('months', 0)
@property
def multi_month_duration(self) -> int:
return self.data.message_dict.get('multi_month_duration', 0)
@property
def streak_months(self) -> int:
return self.data.message_dict.get('streak_months', 0)
@cached_property
def sub_message_dict(self) -> dict:
return self.data.message_dict.get('sub_message', {}) or {}
@property
def sub_plan(self) -> str:
return self.data.message_dict.get('sub_plan', '')
@property
def sub_plan_name(self) -> str:
return self.data.message_dict.get('sub_plan_name', '')
@property
def user_id(self) -> str:
return self.data.message_dict.get('user_id', '')
@property
def user_name(self) -> str:
return self.data.message_dict.get('user_name', '')
| 25.556962 | 68 | 0.647845 | 260 | 2,019 | 4.796154 | 0.184615 | 0.109062 | 0.179631 | 0.252606 | 0.488372 | 0.471532 | 0.449078 | 0.424218 | 0.340016 | 0.067362 | 0 | 0.003193 | 0.224369 | 2,019 | 78 | 69 | 25.884615 | 0.793103 | 0 | 0 | 0.258621 | 0 | 0 | 0.097573 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.293103 | false | 0 | 0.051724 | 0.275862 | 0.637931 | 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 | 1 | 1 | 0 | 0 | 4 |
9e372552faeb7cc7d56e8c0bd874ecc1759b51a8 | 175 | py | Python | 0x04-python-more_data_structures/0-square_matrix_simple.py | C-distin/alx-higher_level_programming | ee018135b24ac07d40f2309a4febf21b8a25aee4 | [
"MIT"
] | null | null | null | 0x04-python-more_data_structures/0-square_matrix_simple.py | C-distin/alx-higher_level_programming | ee018135b24ac07d40f2309a4febf21b8a25aee4 | [
"MIT"
] | null | null | null | 0x04-python-more_data_structures/0-square_matrix_simple.py | C-distin/alx-higher_level_programming | ee018135b24ac07d40f2309a4febf21b8a25aee4 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
def square_matrix_simple(matrix=[]):
new_matrix = []
for i in matrix:
new_matrix.append(list(map(lambda x: x**2, i)))
return new_matrix
| 25 | 55 | 0.645714 | 27 | 175 | 4 | 0.666667 | 0.25 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014388 | 0.205714 | 175 | 6 | 56 | 29.166667 | 0.76259 | 0.097143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
9e5cff5d2df2279468d43b58b4d8385e529468fb | 156 | py | Python | Results/process_results.py | zarquin/TUIDrawTests | 65339cdbce8540d1195ce02329ceda4b7dc14aef | [
"Apache-2.0"
] | null | null | null | Results/process_results.py | zarquin/TUIDrawTests | 65339cdbce8540d1195ce02329ceda4b7dc14aef | [
"Apache-2.0"
] | 1 | 2021-10-16T04:24:59.000Z | 2021-10-16T04:24:59.000Z | Results/process_results.py | zarquin/TUIDrawTests | 65339cdbce8540d1195ce02329ceda4b7dc14aef | [
"Apache-2.0"
] | null | null | null | #run the tests
# then print the results.
"""
TUIDrawTests
Benchmarking for Terminal Drawing
zarquin@ucc.asn.au
(c) 2020
See LICENSE for licence details
""" | 17.333333 | 34 | 0.762821 | 23 | 156 | 5.173913 | 0.913043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030075 | 0.147436 | 156 | 9 | 35 | 17.333333 | 0.864662 | 0.929487 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
9e8fe134a70efefaaa1dc3b91bd49de207f542e0 | 105 | py | Python | python/unittest/mock/medium/01_patch_on_import/work.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | python/unittest/mock/medium/01_patch_on_import/work.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | python/unittest/mock/medium/01_patch_on_import/work.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | import os
def work_on():
path = os.getcwd()
print(f"Working on {path}")
return path
| 13.125 | 32 | 0.561905 | 15 | 105 | 3.866667 | 0.733333 | 0.206897 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.314286 | 105 | 7 | 33 | 15 | 0.805556 | 0 | 0 | 0 | 0 | 0 | 0.173469 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0.2 | 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 | 1 | 0 | 0 | 4 |
9ea6f788b789f5e542be5c636af353f8d7190833 | 160 | py | Python | python/tree/trie.py | gyan42/interview-preparation-qns | e648f75fe9480604f4089596df1ae21a814f7415 | [
"Apache-2.0"
] | null | null | null | python/tree/trie.py | gyan42/interview-preparation-qns | e648f75fe9480604f4089596df1ae21a814f7415 | [
"Apache-2.0"
] | null | null | null | python/tree/trie.py | gyan42/interview-preparation-qns | e648f75fe9480604f4089596df1ae21a814f7415 | [
"Apache-2.0"
] | null | null | null | # https://www.geeksforgeeks.org/trie-insert-and-search/
# https://leetcode.com/problems/word-search-ii/discuss/1134922/Python-Trie-(98.99)-explanation-comments
| 53.333333 | 103 | 0.7875 | 23 | 160 | 5.478261 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070513 | 0.025 | 160 | 2 | 104 | 80 | 0.737179 | 0.96875 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
9eadd03728c97f46ba54801036c7a49967fa78e5 | 22,262 | py | Python | Extends.py | JakubKosakowski/APO_Softwart | 4294a5efd2cdca4cc28c4a8745b14c1f2a2bc2e0 | [
"MIT"
] | null | null | null | Extends.py | JakubKosakowski/APO_Softwart | 4294a5efd2cdca4cc28c4a8745b14c1f2a2bc2e0 | [
"MIT"
] | null | null | null | Extends.py | JakubKosakowski/APO_Softwart | 4294a5efd2cdca4cc28c4a8745b14c1f2a2bc2e0 | [
"MIT"
] | null | null | null | from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
class UiExtends(QWidget):
submitted = pyqtSignal(str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("Threshold extend")
self.setFixedWidth(200)
self.setFixedHeight(200)
self.min_text = QLabel()
self.min_text.move(10, 20)
self.min_text.setText("Insert min value")
self.max_text = QLabel()
self.max_text.move(30, 20)
self.max_text.setText("Insert max value")
self.min_value = QLineEdit()
self.min_value.resize(80, 5)
self.min_value.move(15, 20)
self.min_value.insert("0")
self.max_value = QLineEdit()
self.max_value.resize(80, 5)
self.max_value.move(40, 20)
self.max_value.insert("0")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.min_text, 0, 0)
self.vbox.addWidget(self.min_value, 1, 0)
self.vbox.addWidget(self.max_text, 2, 0)
self.vbox.addWidget(self.max_value, 3, 0)
self.vbox.addWidget(self.btn, 4, 0)
self.vbox.setRowStretch(5, 1)
def send_values(self):
self.submitted.emit(
self.min_value.text(),
self.max_value.text()
)
self.close()
class Binarization(QWidget):
submitted = pyqtSignal(str)
def __init__(self):
super().__init__()
self.setWindowTitle("Binarization extend")
self.setFixedWidth(200)
self.setFixedHeight(200)
self.threshold_text = QLabel()
self.threshold_text.move(10, 20)
self.threshold_text.setText("Insert binarization threshold:")
self.threshold_value = QLineEdit()
self.threshold_value.resize(80, 5)
self.threshold_value.move(15, 20)
self.threshold_value.insert("0")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.threshold_text, 0, 0)
self.vbox.addWidget(self.threshold_value, 1, 0)
self.vbox.addWidget(self.btn, 2, 0)
self.vbox.setRowStretch(3, 1)
def send_values(self):
self.submitted.emit(
self.threshold_value.text()
)
self.close()
class Posterization(QWidget):
submitted = pyqtSignal(str)
def __init__(self):
super().__init__()
self.setWindowTitle("Binarization extend")
self.setFixedWidth(200)
self.setFixedHeight(200)
self.posterization_text = QLabel()
self.posterization_text.move(10, 20)
self.posterization_text.setText("Insert posterization levels:")
self.posterization_value = QLineEdit()
self.posterization_value.resize(80, 5)
self.posterization_value.move(15, 20)
self.posterization_value.insert("1")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.posterization_text, 0, 0)
self.vbox.addWidget(self.posterization_value, 1, 0)
self.vbox.addWidget(self.btn, 2, 0)
self.vbox.setRowStretch(3, 1)
def send_values(self):
self.submitted.emit(
self.posterization_value.text()
)
self.close()
class Kernel(QWidget):
submitted = pyqtSignal(str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("Kernel size")
self.kernel_text = QLabel()
self.kernel_text.move(10, 20)
self.kernel_text.setText("Insert kernel value:")
self.kernel_value = QLineEdit()
self.kernel_value.resize(80, 5)
self.kernel_value.move(15, 20)
self.kernel_value.insert("1")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.list = QListWidget()
self.list.setGeometry(50, 70, 150, 60)
self.border_type = "Isolated"
self.list.addItem("Isolated")
self.list.addItem("Reflect")
self.list.addItem("Replicate")
self.list.itemClicked.connect(self.clicked)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.kernel_text, 0, 0)
self.vbox.addWidget(self.kernel_value, 1, 0)
self.vbox.addWidget(self.list, 0, 1)
self.vbox.addWidget(self.btn, 2, 0)
self.vbox.setRowStretch(3, 1)
def send_values(self):
self.submitted.emit(
self.kernel_value.text(),
self.border_type
)
self.close()
def clicked(self, item):
self.border_type = item.text()
class Gaussian(QWidget):
submitted = pyqtSignal(str, str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("Gaussian values")
self.kernel_text = QLabel()
self.kernel_text.move(10, 20)
self.kernel_text.setText("Insert kernel size")
self.stdev_text = QLabel()
self.stdev_text.move(30, 20)
self.stdev_text.setText("Insert standard deviation")
self.kernel_value = QLineEdit()
self.kernel_value.resize(80, 5)
self.kernel_value.move(15, 20)
self.kernel_value.insert("0")
self.stdev_value = QLineEdit()
self.stdev_value.resize(80, 5)
self.stdev_value.move(40, 20)
self.stdev_value.insert("0")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.list = QListWidget()
self.list.setGeometry(50, 70, 150, 60)
self.border_type = "Isolated"
self.list.addItem("Isolated")
self.list.addItem("Reflect")
self.list.addItem("Replicate")
self.list.itemClicked.connect(self.clicked)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.kernel_text, 0, 0)
self.vbox.addWidget(self.kernel_value, 1, 0)
self.vbox.addWidget(self.stdev_text, 2, 0)
self.vbox.addWidget(self.stdev_value, 3, 0)
self.vbox.addWidget(self.btn, 4, 0)
self.vbox.addWidget(self.list, 0, 1)
self.vbox.setRowStretch(5, 1)
def send_values(self):
self.submitted.emit(
self.kernel_value.text(),
self.stdev_value.text(),
self.border_type
)
self.close()
def clicked(self, item):
self.border_type = item.text()
class Sobel(QWidget):
submitted = pyqtSignal(str)
def __init__(self):
super().__init__()
self.setWindowTitle("Sobel kernel")
self.setFixedWidth(200)
self.setFixedHeight(200)
self.kernel_text = QLabel()
self.kernel_text.move(10, 20)
self.kernel_text.setText("Insert Sobel kernel size:")
self.kernel_value = QLineEdit()
self.kernel_value.resize(80, 5)
self.kernel_value.move(15, 20)
self.kernel_value.insert("1")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.kernel_text, 0, 0)
self.vbox.addWidget(self.kernel_value, 1, 0)
self.vbox.addWidget(self.btn, 2, 0)
self.vbox.setRowStretch(3, 1)
def send_values(self):
self.submitted.emit(
self.kernel_value.text()
)
self.close()
class Mask(QWidget):
submitted = pyqtSignal(str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("Sharp mask")
self.mask_text = QLabel()
self.mask_text.setText("Select sharp mask: ")
self.border_text = QLabel()
self.border_text.setText("Select border type: ")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.list = QListWidget()
self.list.setGeometry(50, 70, 150, 60)
self.mask_type = "[[ 0,-1, 0]\n[-1, 5,-1]\n[ 0,-1, 0]]"
self.list.addItem("[[ 0,-1, 0]\n[-1, 5,-1]\n[ 0,-1, 0]]")
self.list.addItem("[[-1,-1,-1]\n[-1, 9,-1]\n[-1,-1,-1]]")
self.list.addItem("[[ 1,-2, 1]\n[-2, 5,-2]\n[ 1,-2, 1]]")
self.list.itemClicked.connect(self.clicked)
self.border = QListWidget()
self.border.setGeometry(50, 70, 150, 60)
self.border_type = "Isolated"
self.border.addItem("Isolated")
self.border.addItem("Reflect")
self.border.addItem("Replicate")
self.border.itemClicked.connect(self.clicked_border)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.mask_text, 0, 0)
self.vbox.addWidget(self.list, 0, 1)
self.vbox.addWidget(self.border_text, 0, 2)
self.vbox.addWidget(self.border, 0, 3)
self.vbox.addWidget(self.btn, 0, 4)
self.vbox.setRowStretch(5, 1)
def send_values(self):
self.submitted.emit(
self.mask_type,
self.border_type
)
self.close()
def clicked(self, item):
self.mask_type = item.text()
def clicked_border(self, item):
self.border_type = item.text()
class Prewitt(QWidget):
submitted = pyqtSignal(str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("Prewitt values")
self.prewitt_text = QLabel()
self.prewitt_text.setText("Select Prewitt mask: ")
self.border_text = QLabel()
self.border_text.setText("Select border type: ")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.list = QListWidget()
self.list.setGeometry(50, 70, 150, 60)
self.prewitt_type = "[[ -1, 0, 1]\n[-1, 0, 1]\tE\n[ -1, 0, 1]]"
self.list.addItem("[[ -1, 0, 1]\n[-1, 0, 1]\tE\n[ -1, 0, 1]]")
self.list.addItem("[[ -1, -1, 0]\n[-1, 0, 1]\tSE\n[ 0, 1, 1]]")
self.list.addItem("[[ -1, -1, -1]\n[0, 0, 0]\tS\n[ 1, 1, 1]]")
self.list.addItem("[[ 0, -1, -1]\n[1, 0, -1]\tSW\n[ 1, 1, 0]]")
self.list.addItem("[[ 1, 0, -1]\n[1, 0, -1]\tW\n[ 1, 0, -1]]")
self.list.addItem("[[ 1, 1, 0]\n[1, 0, -1]\tNW\n[ 0, -1, -1]]")
self.list.addItem("[[ 1, 1, 1]\n[0, 0, 0]\tN\n[ -1, -1, -1]]")
self.list.addItem("[[ 0, 1, 1]\n[-1, 0, 1]\tNE\n[ -1, -1, 0]]")
self.list.itemClicked.connect(self.clicked)
self.border = QListWidget()
self.border.setGeometry(50, 70, 150, 60)
self.border_type = "Isolated"
self.border.addItem("Isolated")
self.border.addItem("Reflect")
self.border.addItem("Replicate")
self.border.itemClicked.connect(self.clicked_border)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.prewitt_text, 0, 0)
self.vbox.addWidget(self.list, 0, 1)
self.vbox.addWidget(self.border_text, 0, 2)
self.vbox.addWidget(self.border, 0, 3)
self.vbox.addWidget(self.btn, 0, 4)
self.vbox.setRowStretch(5, 1)
def send_values(self):
self.submitted.emit(
self.prewitt_type,
self.border_type
)
self.close()
def clicked(self, item):
self.prewitt_type = item.text()
def clicked_border(self, item):
self.border_type = item.text()
class User(QWidget):
submitted = pyqtSignal(str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("User mask")
self.mask_text = QLabel()
self.mask_text.setText("Write user mask: ")
self.border_text = QLabel()
self.border_text.setText("Select border type: ")
self.mask_value = QPlainTextEdit(self)
self.mask_value.setFixedHeight(150)
self.mask_value.insertPlainText("0 0 0\n0 0 0\n0 0 0")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.border = QListWidget()
self.border.setGeometry(50, 70, 150, 60)
self.border_type = "Isolated"
self.border.addItem("Isolated")
self.border.addItem("Reflect")
self.border.addItem("Replicate")
self.border.itemClicked.connect(self.clicked_border)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.mask_text, 0, 0)
self.vbox.addWidget(self.mask_value, 0, 1)
self.vbox.addWidget(self.border_text, 0, 2)
self.vbox.addWidget(self.border, 0, 3)
self.vbox.addWidget(self.btn, 0, 4)
self.vbox.setRowStretch(5, 1)
def send_values(self):
self.submitted.emit(
self.mask_value.toPlainText(),
self.border_type
)
self.close()
def clicked_border(self, item):
self.border_type = item.text()
class Median(QWidget):
submitted = pyqtSignal(str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("User mask")
self.mask_text = QLabel()
self.mask_text.setText("Select median blur mask: ")
self.border_text = QLabel()
self.border_text.setText("Select border type: ")
self.mask_list = QListWidget()
self.mask_list.setGeometry(50, 70, 150, 60)
self.mask_value = "3x3"
self.mask_list.addItem("3x3")
self.mask_list.addItem("5x5")
self.mask_list.addItem("7x7")
self.mask_list.itemClicked.connect(self.clicked_mask)
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.border = QListWidget()
self.border.setGeometry(50, 70, 150, 60)
self.border_type = "Isolated"
self.border.addItem("Isolated")
self.border.addItem("Reflect")
self.border.addItem("Replicate")
self.border.itemClicked.connect(self.clicked_border)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.mask_text, 0, 0)
self.vbox.addWidget(self.mask_list, 0, 1)
self.vbox.addWidget(self.border_text, 0, 2)
self.vbox.addWidget(self.border, 0, 3)
self.vbox.addWidget(self.btn, 0, 4)
self.vbox.setRowStretch(5, 1)
def send_values(self):
self.submitted.emit(
self.mask_value,
self.border_type
)
self.close()
def clicked_border(self, item):
self.border_type = item.text()
def clicked_mask(self, item):
self.mask_value = item.text()
class Blending(QWidget):
submitted = pyqtSignal(str, str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("Blending values")
self.setFixedWidth(200)
self.setFixedHeight(200)
self.alpha_text = QLabel()
self.alpha_text.move(10, 20)
self.alpha_text.setText("Insert alpha values:")
self.alpha_value = QLineEdit()
self.alpha_value.resize(80, 5)
self.alpha_value.insert("0.1")
self.beta_text = QLabel()
self.beta_text.move(10, 20)
self.beta_text.setText("Insert beta values:")
self.beta_value = QLineEdit()
self.beta_value.resize(80, 5)
self.beta_value.insert("0.1")
self.gamma_text = QLabel()
self.gamma_text.move(10, 20)
self.gamma_text.setText("Insert gamma values:")
self.gamma_value = QLineEdit()
self.gamma_value.resize(80, 5)
self.gamma_value.insert("0")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.alpha_text, 0, 0)
self.vbox.addWidget(self.alpha_value, 1, 0)
self.vbox.addWidget(self.beta_text, 2, 0)
self.vbox.addWidget(self.beta_value, 3, 0)
self.vbox.addWidget(self.gamma_text, 4, 0)
self.vbox.addWidget(self.gamma_value, 5, 0)
self.vbox.addWidget(self.btn, 6, 0)
self.vbox.setRowStretch(7, 1)
def send_values(self):
self.submitted.emit(
self.alpha_value.text(),
self.beta_value.text(),
self.gamma_value.text()
)
self.close()
class Logic(QWidget):
submitted = pyqtSignal(str)
def __init__(self):
super().__init__()
self.setWindowTitle("Blending values")
self.setFixedWidth(200)
self.setFixedHeight(200)
self.operation_text = QLabel()
self.operation_text.move(10, 20)
self.operation_text.setText("Select operation type:")
self.operation = QListWidget()
self.operation.setGeometry(50, 70, 150, 60)
self.operation_type = "NOT"
self.operation.addItem("NOT")
self.operation.addItem("AND")
self.operation.addItem("OR")
self.operation.addItem("XOR")
self.operation.itemClicked.connect(self.clicked_operation)
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.operation_text, 0, 0)
self.vbox.addWidget(self.operation, 1, 0)
self.vbox.addWidget(self.btn, 2, 0)
self.vbox.setRowStretch(3, 1)
def send_values(self):
self.submitted.emit(
self.operation_type
)
self.close()
def clicked_operation(self, item):
self.operation_type = item.text()
class Morphology(QWidget):
submitted = pyqtSignal(str, str, str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("Blending values")
self.setFixedWidth(400)
self.setFixedHeight(400)
self.operation_text = QLabel()
self.operation_text.move(10, 20)
self.operation_text.setText("Select operation type:")
self.iteration_text = QLabel()
self.iteration_text.move(10, 20)
self.iteration_text.setText("Write amount of iterations(Only ERODE and DILATE):")
self.iteration_value = QLineEdit()
self.iteration_value.resize(80, 5)
self.iteration_value.insert("1")
self.element_text = QLabel()
self.element_text.move(10, 20)
self.element_text.setText("Select structure element:")
self.border_text = QLabel()
self.border_text.move(10, 20)
self.border_text.setText("Select border type:")
self.operation = QListWidget()
self.operation.setGeometry(50, 70, 150, 60)
self.operation_type = "OPEN"
self.operation.addItem("ERODE")
self.operation.addItem("DILATE")
self.operation.addItem("OPEN")
self.operation.addItem("CLOSE")
self.operation.itemClicked.connect(self.clicked_operation)
self.element = QListWidget()
self.element.setGeometry(50, 70, 150, 60)
self.element_type = "DIAMOND(4x4)"
self.element.addItem("DIAMOND(4x4)")
self.element.addItem("SQUARE(8x8)")
self.element.itemClicked.connect(self.clicked_element)
self.border = QListWidget()
self.border.setGeometry(50, 70, 150, 60)
self.border_type = "Isolated"
self.border.addItem("Isolated")
self.border.addItem("Reflect")
self.border.addItem("Replicate")
self.border.itemClicked.connect(self.clicked_border)
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.operation_text, 0, 0)
self.vbox.addWidget(self.operation, 1, 0)
self.vbox.addWidget(self.element_text, 2, 0)
self.vbox.addWidget(self.element, 3, 0)
self.vbox.addWidget(self.border_text, 4, 0)
self.vbox.addWidget(self.border, 5, 0)
self.vbox.addWidget(self.iteration_text, 6, 0)
self.vbox.addWidget(self.iteration_value, 7, 0)
self.vbox.addWidget(self.btn, 8, 0)
self.vbox.setRowStretch(9, 1)
def send_values(self):
self.submitted.emit(
self.operation_type,
self.element_type,
self.border_type,
self.iteration_value.text()
)
self.close()
def clicked_operation(self, item):
self.operation_type = item.text()
def clicked_element(self, item):
self.element_type = item.text()
def clicked_border(self, item):
self.border_type = item.text()
class Two_Stages(QWidget):
submitted = pyqtSignal(str, str, str)
def __init__(self):
super().__init__()
self.setWindowTitle("Two stages filter")
self.first_mask_text = QLabel()
self.first_mask_text.setText("Write user mask: ")
self.second_mask_text = QLabel()
self.second_mask_text.setText("Write user mask: ")
self.first_mask_value = QPlainTextEdit(self)
self.first_mask_value.setFixedHeight(150)
self.first_mask_value.insertPlainText("0 0 0\n0 0 0\n0 0 0")
self.second_mask_value = QPlainTextEdit(self)
self.second_mask_value.setFixedHeight(150)
self.second_mask_value.insertPlainText("0 0 0\n0 0 0\n0 0 0")
self.border_text = QLabel()
self.border_text.setText("Select border type: ")
self.btn = QPushButton("OK")
self.btn.clicked.connect(self.send_values)
self.border = QListWidget()
self.border.setGeometry(50, 70, 150, 60)
self.border_type = "Isolated"
self.border.addItem("Isolated")
self.border.addItem("Reflect")
self.border.addItem("Replicate")
self.border.itemClicked.connect(self.clicked_border)
self.vbox = QGridLayout(self)
self.vbox.addWidget(self.first_mask_text, 0, 0)
self.vbox.addWidget(self.first_mask_value, 0, 1)
self.vbox.addWidget(self.second_mask_text, 0, 2)
self.vbox.addWidget(self.second_mask_value, 0, 3)
self.vbox.addWidget(self.border_text, 0, 4)
self.vbox.addWidget(self.border, 0, 5)
self.vbox.addWidget(self.btn, 1, 0)
self.vbox.setRowStretch(7, 1)
def clicked_border(self, item):
self.border_type = item.text()
def send_values(self):
self.submitted.emit(
self.first_mask_value.toPlainText(),
self.second_mask_value.toPlainText(),
self.border_type
)
self.close() | 31.622159 | 89 | 0.612883 | 2,803 | 22,262 | 4.722797 | 0.050303 | 0.059223 | 0.089893 | 0.111044 | 0.829884 | 0.755401 | 0.731304 | 0.683638 | 0.654706 | 0.65176 | 0 | 0.039256 | 0.25393 | 22,262 | 704 | 90 | 31.622159 | 0.757782 | 0 | 0 | 0.596745 | 0 | 0.023508 | 0.078426 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.075949 | false | 0 | 0.005425 | 0 | 0.132007 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 4 |
7b43501888596d277f96cf7110fde6bd67a06c69 | 861 | py | Python | xoa_driver/internals/core/commands/__init__.py | xenadevel/xena-open-automation-python-api | b17e512aa14eee7c51677004b4c91712005edcd0 | [
"Apache-2.0"
] | 1 | 2022-03-18T17:17:59.000Z | 2022-03-18T17:17:59.000Z | xoa_driver/internals/core/commands/__init__.py | xenadevel/xena-open-automation-python-api | b17e512aa14eee7c51677004b4c91712005edcd0 | [
"Apache-2.0"
] | null | null | null | xoa_driver/internals/core/commands/__init__.py | xenadevel/xena-open-automation-python-api | b17e512aa14eee7c51677004b4c91712005edcd0 | [
"Apache-2.0"
] | null | null | null | """
Definition of BXMP commands.
All commands in this module are only a stateles declaration of there structures which
define how they will be converted to binary protocol.
"""
# importing commands subsets
from .c_commands import *
from .m_commands import *
from .m4_commands import *
from .m4e_commands import *
from .p_commands import *
from .p4_commands import *
from .p4e_commands import *
from .p4g_commands import *
from .pc_commands import *
from .pd_commands import *
from .pe_commands import *
from .pec_commands import *
from .ped_commands import *
from .pef_commands import *
from .pf_commands import *
from .pl_commands import *
from .pm_commands import *
from .pp_commands import *
from .pr_commands import *
from .ps_commands import *
from .pt_commands import *
from .px_commands import *
from .xp_commands import *
from .xpd_commands import *
| 26.090909 | 86 | 0.780488 | 126 | 861 | 5.142857 | 0.420635 | 0.518519 | 0.638889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006859 | 0.15331 | 861 | 32 | 87 | 26.90625 | 0.88203 | 0.229965 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
7b75af5096c0741a1e86d20de0450bd0618f9ef1 | 94 | py | Python | ha_config/custom_components/lan_smartthings/cover.py | bogusfocused/ha_lan_smartthings | 81ae2f1305e75fa418afc454095167610724ab37 | [
"MIT"
] | 2 | 2021-12-22T02:16:48.000Z | 2022-01-26T07:02:03.000Z | ha_config/custom_components/lan_smartthings/cover.py | bogusfocused/ha_lan_smartthings | 81ae2f1305e75fa418afc454095167610724ab37 | [
"MIT"
] | null | null | null | ha_config/custom_components/lan_smartthings/cover.py | bogusfocused/ha_lan_smartthings | 81ae2f1305e75fa418afc454095167610724ab37 | [
"MIT"
] | null | null | null | """Support for covers through the SmartThings cloud API."""
from .smartthings.cover import *
| 31.333333 | 59 | 0.755319 | 12 | 94 | 5.916667 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138298 | 94 | 2 | 60 | 47 | 0.876543 | 0.56383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
7b76ba88bc9508c88ba84f86b29833e28b627699 | 112 | py | Python | __init__.py | 64-B1T/faser_utils | e72fd5753d55bf8bdf5af18c72e9306119f941a3 | [
"MIT"
] | null | null | null | __init__.py | 64-B1T/faser_utils | e72fd5753d55bf8bdf5af18c72e9306119f941a3 | [
"MIT"
] | null | null | null | __init__.py | 64-B1T/faser_utils | e72fd5753d55bf8bdf5af18c72e9306119f941a3 | [
"MIT"
] | null | null | null | import sys
import os
sys.path.append(os.path.dirname(__file__))
import disp as disp
import FaserLog as FaserLog
| 18.666667 | 42 | 0.8125 | 19 | 112 | 4.578947 | 0.526316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116071 | 112 | 5 | 43 | 22.4 | 0.878788 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.8 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
7b9106d357bf4a76416a7f87ff5a98281418f64a | 141 | py | Python | fltk/synthpriv/synthetic/models/Private_PGM/__init__.py | tudelft-eemcs-dml/fltk-testbed-gr-1 | bbe01d5d82a447ad8b6d9e3f350f831922a8b8b7 | [
"BSD-2-Clause"
] | null | null | null | fltk/synthpriv/synthetic/models/Private_PGM/__init__.py | tudelft-eemcs-dml/fltk-testbed-gr-1 | bbe01d5d82a447ad8b6d9e3f350f831922a8b8b7 | [
"BSD-2-Clause"
] | null | null | null | fltk/synthpriv/synthetic/models/Private_PGM/__init__.py | tudelft-eemcs-dml/fltk-testbed-gr-1 | bbe01d5d82a447ad8b6d9e3f350f831922a8b8b7 | [
"BSD-2-Clause"
] | null | null | null | # This source code is licensed under the license found in the
# LICENSE file in the {root}/models/Private_PGM/ directory of this source tree. | 70.5 | 79 | 0.787234 | 24 | 141 | 4.583333 | 0.75 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156028 | 141 | 2 | 79 | 70.5 | 0.92437 | 0.971631 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7b9d94fb3c79f9fc9d45485c278708db23befcd7 | 49 | py | Python | python/testData/inspections/PyArgumentListInspection/constructorQualifiedByModule.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2018-12-29T09:53:39.000Z | 2018-12-29T09:53:42.000Z | python/testData/inspections/PyArgumentListInspection/constructorQualifiedByModule.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/inspections/PyArgumentListInspection/constructorQualifiedByModule.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | import datetime
x = datetime.tmxxx(1981, 2, 25)
| 12.25 | 31 | 0.714286 | 8 | 49 | 4.375 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170732 | 0.163265 | 49 | 3 | 32 | 16.333333 | 0.682927 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
7ba3d709ee1321c2277eb0baf40f38292d4ec06f | 488 | py | Python | bilibili_spider/database.py | AllenTom/BilibiliSpider | def4ad24e2d62509dbaf018a1aa9f0e45a564b12 | [
"MIT"
] | 5 | 2018-03-15T08:04:59.000Z | 2021-11-22T00:27:42.000Z | bilibili_spider/database.py | AllenTom/BilibiliSpider | def4ad24e2d62509dbaf018a1aa9f0e45a564b12 | [
"MIT"
] | null | null | null | bilibili_spider/database.py | AllenTom/BilibiliSpider | def4ad24e2d62509dbaf018a1aa9f0e45a564b12 | [
"MIT"
] | 1 | 2018-10-12T22:39:31.000Z | 2018-10-12T22:39:31.000Z | import pymongo
from scrapy.conf import settings
if settings.get("MONGO_USERNAME") == "" and settings.get("MONGO_PASSWORD") == "":
connection = pymongo.MongoClient(
f'mongodb://{settings.get("MONGO_HOST")}:{settings.get("MONGO_PORT")}')
else:
connection = pymongo.MongoClient(
f'mongodb://{settings.get("MONGO_USERNAME")}:{settings.get("MONGO_PASSWORD")}@{settings.get("MONGO_HOST")}:{settings.get("MONGO_PORT")}')
db = connection[settings.get("MONGO_DATABASE")]
| 40.666667 | 145 | 0.702869 | 58 | 488 | 5.758621 | 0.362069 | 0.296407 | 0.431138 | 0.143713 | 0.502994 | 0.502994 | 0.502994 | 0.502994 | 0 | 0 | 0 | 0 | 0.106557 | 488 | 11 | 146 | 44.363636 | 0.766055 | 0 | 0 | 0.222222 | 0 | 0.111111 | 0.495902 | 0.409836 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.222222 | 0.222222 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
7bac9462bba8b03826bef9145a8501e331485479 | 1,015 | py | Python | ch01/test1.py | gangigammo/deep-learning-2 | 6bce355261d8ad5135c104fca32946aa13dc0ba4 | [
"MIT"
] | null | null | null | ch01/test1.py | gangigammo/deep-learning-2 | 6bce355261d8ad5135c104fca32946aa13dc0ba4 | [
"MIT"
] | null | null | null | ch01/test1.py | gangigammo/deep-learning-2 | 6bce355261d8ad5135c104fca32946aa13dc0ba4 | [
"MIT"
] | null | null | null | import numpy as np
# class MatMul:
# def __init__(self,W):
# self.params = [W]
# self.grads = [np.zeros_like(W)]
# self.x = None
#
# def forward(self,x):
# W = self.params
# out = np.dot(x,W)
# self.x = x
# return x
#
# def backward(self,dout):
# W = self.params
# dx = np.dot(dout,W.T)
# dW = np.dot(self.x.T, dout)
# self.grads[0][...] = dW
# return dx
#
# class Affine:
# def __init__(self,W,b):
# self.params = [W,b]
# self.grads = [np.zeros_like(W),np.zeros_like(b)]
# self.x = None
#
# def forward(self,x):
# W,b = self.params
# out = np.dot(x,W) + b
# self.x = x
# return out
#
# def backward(self,dout):
# W,b = self.params
# dx = np.dot(dout,W.T)
# dW = np.dot(self.x.T, dout)
# db = np.sum(dout, axis=0)
#
# self.grads[0][...] = dW
# self.grads[1][...] = db
# return dx
| 22.555556 | 58 | 0.452217 | 145 | 1,015 | 3.089655 | 0.22069 | 0.089286 | 0.066964 | 0.080357 | 0.5625 | 0.473214 | 0.379464 | 0.290179 | 0.178571 | 0.178571 | 0 | 0.00624 | 0.368473 | 1,015 | 44 | 59 | 23.068182 | 0.692668 | 0.898522 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
7bc21ed89a5e06b25ffd14cd65cd55d1da57c999 | 239 | py | Python | mdf_connect_server/processor/__init__.py | materials-data-facility/connect | 9ec5b61750bf6fa579bf3ec122f31880d3c049b8 | [
"Apache-2.0"
] | 1 | 2019-09-13T18:35:56.000Z | 2019-09-13T18:35:56.000Z | mdf_connect_server/processor/__init__.py | materials-data-facility/connect_server | 9ec5b61750bf6fa579bf3ec122f31880d3c049b8 | [
"Apache-2.0"
] | 15 | 2018-11-01T18:08:11.000Z | 2021-12-06T17:55:03.000Z | mdf_connect_server/processor/__init__.py | materials-data-facility/connect | 9ec5b61750bf6fa579bf3ec122f31880d3c049b8 | [
"Apache-2.0"
] | 1 | 2020-11-30T17:02:41.000Z | 2020-11-30T17:02:41.000Z | # flake8: noqa
# NOTE: flake8 complains about these imports going unused; this is fine
from .extractors import run_extractors
from .validator import Validator
from .start_extractors import start_extractors
from .processor import processor
| 34.142857 | 71 | 0.832636 | 32 | 239 | 6.125 | 0.59375 | 0.163265 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009615 | 0.129707 | 239 | 6 | 72 | 39.833333 | 0.932692 | 0.343096 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
c8c7a8cf14dee008db911fa475fe863c3233d5ab | 85 | py | Python | analisitesto/testo/apps.py | jaski1994/analisi_testo | 9d7b7c25dacb171308676e30fc8631c51c06b09c | [
"Apache-2.0"
] | null | null | null | analisitesto/testo/apps.py | jaski1994/analisi_testo | 9d7b7c25dacb171308676e30fc8631c51c06b09c | [
"Apache-2.0"
] | null | null | null | analisitesto/testo/apps.py | jaski1994/analisi_testo | 9d7b7c25dacb171308676e30fc8631c51c06b09c | [
"Apache-2.0"
] | null | null | null | from django.apps import AppConfig
class TestoConfig(AppConfig):
name = 'testo'
| 14.166667 | 33 | 0.741176 | 10 | 85 | 6.3 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 85 | 5 | 34 | 17 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
c8ce1ecf9ce7834db835e692cea13ffdee106a78 | 297 | py | Python | msg.py | vijay8451/quicksystem | 515823ff88991daab1ec36958b252ce448c1ec76 | [
"MIT"
] | 3 | 2019-06-25T09:04:19.000Z | 2019-10-01T13:02:29.000Z | msg.py | vijay8451/quicksystem | 515823ff88991daab1ec36958b252ce448c1ec76 | [
"MIT"
] | 2 | 2021-03-31T19:00:02.000Z | 2021-12-13T19:58:31.000Z | msg.py | vijay8451/quicksystem | 515823ff88991daab1ec36958b252ce448c1ec76 | [
"MIT"
] | null | null | null | import click
def echo_success(msg):
click.echo(click.style(msg, fg='green'))
def echo_error(msg):
click.echo(click.style(msg, fg='red', reverse=True))
def echo_skip(msg):
click.echo(click.style(msg, fg='cyan'))
def echo_normal(msg):
click.echo(click.style(msg, fg='blue'))
| 16.5 | 56 | 0.673401 | 48 | 297 | 4.083333 | 0.354167 | 0.142857 | 0.244898 | 0.346939 | 0.55102 | 0.55102 | 0.55102 | 0 | 0 | 0 | 0 | 0 | 0.144781 | 297 | 17 | 57 | 17.470588 | 0.771654 | 0 | 0 | 0 | 0 | 0 | 0.053872 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.444444 | false | 0 | 0.111111 | 0 | 0.555556 | 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 | 1 | 0 | 0 | 4 |
c8ee2ac839107054f2cfdaff66f7c6d699f225d3 | 520 | py | Python | src/jt/javabridge/_platform/__init__.py | karpierz/jtypes.javabridge | ee519456d4048e55a0696c28bdf3c727667b5b50 | [
"BSD-3-Clause"
] | null | null | null | src/jt/javabridge/_platform/__init__.py | karpierz/jtypes.javabridge | ee519456d4048e55a0696c28bdf3c727667b5b50 | [
"BSD-3-Clause"
] | null | null | null | src/jt/javabridge/_platform/__init__.py | karpierz/jtypes.javabridge | ee519456d4048e55a0696c28bdf3c727667b5b50 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2014-2018, Adam Karpierz
# Licensed under the BSD license
# http://opensource.org/licenses/BSD-3-Clause
from ...jvm.lib import platform
if platform.is_windows:
from ._windows import JVMFinder
elif platform.is_linux:
from ._linux import JVMFinder
elif platform.is_osx:
from ._osx import JVMFinder
elif platform.is_android:
from ._android import JVMFinder
elif platform.is_posix:
from ._linux import JVMFinder
else:
raise ImportError("unsupported platform")
del platform
| 24.761905 | 45 | 0.753846 | 70 | 520 | 5.457143 | 0.514286 | 0.13089 | 0.198953 | 0.282723 | 0.303665 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020882 | 0.171154 | 520 | 20 | 46 | 26 | 0.865429 | 0.217308 | 0 | 0.142857 | 0 | 0 | 0.049628 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
cda4a534aa5047c73ecd4c9a84083bef054b81fc | 149 | py | Python | app/display_modules/macrobes/constants.py | MetaGenScope/metagenscope-server | 609cd57c626c857c8efde8237a1f22f4d1e6065d | [
"MIT"
] | null | null | null | app/display_modules/macrobes/constants.py | MetaGenScope/metagenscope-server | 609cd57c626c857c8efde8237a1f22f4d1e6065d | [
"MIT"
] | null | null | null | app/display_modules/macrobes/constants.py | MetaGenScope/metagenscope-server | 609cd57c626c857c8efde8237a1f22f4d1e6065d | [
"MIT"
] | null | null | null | # pylint:disable=unused-import
"""Constants for macrobe display module."""
from app.analysis_results.constants import MACROBES_NAME as MODULE_NAME
| 24.833333 | 71 | 0.812081 | 20 | 149 | 5.9 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.100671 | 149 | 5 | 72 | 29.8 | 0.880597 | 0.449664 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
cdb111d0a7e3eb4fe23bd948bec6b627818826f5 | 71 | py | Python | python/tHome/acurite/test/run.py | ZigmundRat/T-Home | 5dc8689f52d87dac890051e540b338b009293ced | [
"BSD-2-Clause"
] | 18 | 2016-04-17T19:39:28.000Z | 2020-11-19T06:55:20.000Z | python/tHome/acurite/test/run.py | ZigmundRat/T-Home | 5dc8689f52d87dac890051e540b338b009293ced | [
"BSD-2-Clause"
] | 6 | 2016-10-31T13:53:45.000Z | 2019-03-20T20:47:03.000Z | python/tHome/acurite/test/run.py | ZigmundRat/T-Home | 5dc8689f52d87dac890051e540b338b009293ced | [
"BSD-2-Clause"
] | 12 | 2016-10-31T12:29:08.000Z | 2021-12-28T12:18:28.000Z | #!/usr/bin/env python
from tHome import acurite
acurite.run()
| 10.142857 | 25 | 0.661972 | 10 | 71 | 4.7 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.225352 | 71 | 6 | 26 | 11.833333 | 0.854545 | 0.28169 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
cdb8cbe6debb1fa410439b2fc38468b591332a4b | 30 | py | Python | app_conf/__init__.py | henrique221/LMS_Teste | 2b2da822817ab7fcf5c7b0b271b333637b3eead1 | [
"MIT"
] | null | null | null | app_conf/__init__.py | henrique221/LMS_Teste | 2b2da822817ab7fcf5c7b0b271b333637b3eead1 | [
"MIT"
] | null | null | null | app_conf/__init__.py | henrique221/LMS_Teste | 2b2da822817ab7fcf5c7b0b271b333637b3eead1 | [
"MIT"
] | null | null | null | """
Package for app_conf.
"""
| 7.5 | 21 | 0.6 | 4 | 30 | 4.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 30 | 3 | 22 | 10 | 0.68 | 0.7 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
cdebd7d3ac31fbd8e164d4055d7268d7746bb833 | 86 | py | Python | client/frameprocessor.py | AmmarRabie/vdrive | 7e1cfc77a54b1a75cad1ab17c3c670aea81760bf | [
"MIT"
] | null | null | null | client/frameprocessor.py | AmmarRabie/vdrive | 7e1cfc77a54b1a75cad1ab17c3c670aea81760bf | [
"MIT"
] | 4 | 2019-04-19T04:39:16.000Z | 2019-04-19T06:38:18.000Z | client/frameprocessor.py | AmmarRabie/vdrive | 7e1cfc77a54b1a75cad1ab17c3c670aea81760bf | [
"MIT"
] | 1 | 2019-11-08T06:26:20.000Z | 2019-11-08T06:26:20.000Z | '''
This file for making a function into certain frames
To be included in phase2
'''
| 14.333333 | 51 | 0.732558 | 14 | 86 | 4.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.197674 | 86 | 5 | 52 | 17.2 | 0.898551 | 0.883721 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
a800f7515a19ccc551e819538f82bfbb08f8d30d | 110 | py | Python | tests/test_extract.py | xbr/sphinxcontrib-xbr | 844444c0a0d9877a477bbbfd41d253f1c7bda3eb | [
"BSD-2-Clause"
] | null | null | null | tests/test_extract.py | xbr/sphinxcontrib-xbr | 844444c0a0d9877a477bbbfd41d253f1c7bda3eb | [
"BSD-2-Clause"
] | 1 | 2018-04-22T17:25:58.000Z | 2018-04-22T17:25:58.000Z | tests/test_extract.py | xbr/sphinxcontrib-xbr | 844444c0a0d9877a477bbbfd41d253f1c7bda3eb | [
"BSD-2-Clause"
] | 2 | 2018-05-07T07:34:52.000Z | 2021-03-24T05:37:22.000Z | from __future__ import absolute_import
class TestClass(object):
def test_one(self):
assert True
| 15.714286 | 38 | 0.727273 | 14 | 110 | 5.285714 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218182 | 110 | 6 | 39 | 18.333333 | 0.860465 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
a817644e01ae084b08f15644da0c9818bc4ac28b | 3,971 | py | Python | src/Xhs_Finance.py | VcSpace/News-M | 5bd4805a0c3ae29651657ed10d9f4fb14df82840 | [
"MIT"
] | 12 | 2021-01-18T09:13:45.000Z | 2022-01-07T12:41:24.000Z | src/Xhs_Finance.py | VcSpace/News-M | 5bd4805a0c3ae29651657ed10d9f4fb14df82840 | [
"MIT"
] | 1 | 2021-09-15T10:53:53.000Z | 2021-09-15T10:53:53.000Z | src/Xhs_Finance.py | VcSpace/News-M | 5bd4805a0c3ae29651657ed10d9f4fb14df82840 | [
"MIT"
] | 3 | 2021-04-11T01:20:31.000Z | 2022-01-07T07:09:32.000Z | import requests
from bs4 import BeautifulSoup
from openpyxl import load_workbook
headers = {
'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36',
}
class XinHuaNet(object):
def __init__(self):
pass
def request(self):
self.url = 'http://www.xinhuanet.com/fortunepro/'
self.data = requests.get(self.url, headers=headers)
self.data.encoding = "utf-8"
self.soup = BeautifulSoup(self.data.text, "lxml")
def getTopNew(self):
wb = load_workbook(self.xlsxname)
sheet = wb.create_sheet("Xhs")
t_row = 1
t_col = 1
sheet.cell(row=t_row, column=t_col, value="财经TOP10")
t_row = t_row + 1
sheet.cell(row=t_row, column=t_col, value="新闻标题")
sheet.cell(row=t_row, column=t_col + 1, value="新闻链接")
sheet.cell(row=t_row, column=t_col + 2, value="新闻简介")
sheet.cell(row=t_row, column=t_col + 3, value="新闻时间")
t_row = t_row + 1
datalist = self.soup.find_all(class_='cjtop')
for newlist in datalist:
news = newlist.find_all('a')
for m_new in news:
m_href = m_new['href']
m_title = m_new.get_text()
sheet.cell(row=t_row, column=t_col, value=m_title)
sheet.cell(row=t_row, column=t_col + 1, value=m_href)
t_row = t_row + 1
try:
wb.save(self.xlsxname)
except Exception:
print("Xhs Save Error = 1")
def getnews(self):
wb = load_workbook(self.xlsxname)
sheet = wb.get_sheet_by_name("Xhs")
t_row = sheet.max_row + 2
t_col = 1
sheet.cell(row=t_row, column=t_col, value="财经新闻")
t_row = t_row + 1
sheet.cell(row=t_row, column=t_col, value="新闻标题")
sheet.cell(row=t_row, column=t_col + 1, value="新闻链接")
sheet.cell(row=t_row, column=t_col + 2, value="新闻简介")
sheet.cell(row=t_row, column=t_col + 3, value="新闻时间")
t_row = t_row + 1
datalist = self.soup.find_all(class_='xpage-content-list')
for data in datalist:
news = data.find_all('a')
for m_new in news:
m_href = m_new['href']
m_title = m_new.get_text()
if m_title == "":
continue
sheet.cell(row=t_row, column=t_col, value=m_title)
sheet.cell(row=t_row, column=t_col + 1, value=m_href)
t_row = t_row + 1
try:
wb.save(self.xlsxname)
except Exception:
print("Xhs Save Error = 2")
def get_research_report(self):
wb = load_workbook(self.xlsxname)
sheet = wb.get_sheet_by_name("Xhs")
t_row = sheet.max_row + 2
t_col = 1
sheet.cell(row=t_row, column=t_col, value="行业研报")
t_row = t_row + 1
sheet.cell(row=t_row, column=t_col, value="新闻标题")
sheet.cell(row=t_row, column=t_col + 1, value="新闻链接")
sheet.cell(row=t_row, column=t_col + 2, value="新闻简介")
sheet.cell(row=t_row, column=t_col + 3, value="新闻时间")
t_row = t_row + 1
datalist = self.soup.find_all(class_='rtlist')
for data in datalist:
news = data.find_all('a')
for m_new in news:
m_href = m_new['href']
m_title = m_new.get_text()
if len(m_title) <= 4:
continue
sheet.cell(row=t_row, column=t_col, value=m_title)
sheet.cell(row=t_row, column=t_col + 1, value=m_href)
t_row = t_row + 1
try:
wb.save(self.xlsxname)
except Exception:
print("Xhs Save Error = 3")
def main(self, file_name):
self.xlsxname = file_name
Xhs.request()
Xhs.getTopNew()
Xhs.getnews()
Xhs.get_research_report()
Xhs = XinHuaNet()
| 33.940171 | 125 | 0.556787 | 579 | 3,971 | 3.602763 | 0.184801 | 0.080537 | 0.100671 | 0.130872 | 0.71093 | 0.71093 | 0.71093 | 0.71093 | 0.693193 | 0.693193 | 0 | 0.023351 | 0.320574 | 3,971 | 116 | 126 | 34.232759 | 0.749815 | 0 | 0 | 0.61 | 0 | 0.01 | 0.083102 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.06 | false | 0.01 | 0.03 | 0 | 0.1 | 0.03 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
a825509011cdb5143f49586546b0568cc7c33e6e | 59 | py | Python | api/app/schemas/__init__.py | bcgov/wps | 71df0de72de9cd656dc9ebf8461ffe47cfb155f6 | [
"Apache-2.0"
] | 19 | 2020-01-31T21:51:31.000Z | 2022-01-07T14:40:03.000Z | api/app/schemas/__init__.py | bcgov/wps | 71df0de72de9cd656dc9ebf8461ffe47cfb155f6 | [
"Apache-2.0"
] | 1,680 | 2020-01-24T23:25:08.000Z | 2022-03-31T23:50:27.000Z | api/app/schemas/__init__.py | bcgov/wps | 71df0de72de9cd656dc9ebf8461ffe47cfb155f6 | [
"Apache-2.0"
] | 6 | 2020-04-28T22:41:08.000Z | 2021-05-05T18:16:06.000Z | """ This module contains pydantic schemas for the API.
"""
| 19.666667 | 54 | 0.711864 | 8 | 59 | 5.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.169492 | 59 | 2 | 55 | 29.5 | 0.857143 | 0.847458 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
a8334ae7c53631c1e3a671a99a28c9039354e605 | 124 | py | Python | libapp/sitemap/models/__init__.py | octopi-labs/bazzinga | fcdd8e925cbaa31cacbec10dd1d599e72b84c588 | [
"MIT"
] | null | null | null | libapp/sitemap/models/__init__.py | octopi-labs/bazzinga | fcdd8e925cbaa31cacbec10dd1d599e72b84c588 | [
"MIT"
] | 3 | 2021-03-20T00:43:11.000Z | 2022-01-06T22:33:23.000Z | libapp/sitemap/models/__init__.py | octopi-labs/bazzinga | fcdd8e925cbaa31cacbec10dd1d599e72b84c588 | [
"MIT"
] | null | null | null | from libapp.sitemap.models.space import Space, UrlAlias, Workspace, Node, SpaceCity, SpaceCategory, FileManaged, FileUsage
| 41.333333 | 122 | 0.822581 | 14 | 124 | 7.285714 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 124 | 2 | 123 | 62 | 0.910714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
b55458accfb139434142f32a327657ca7bb04406 | 10,484 | py | Python | dhost/github/tests/test_github_api.py | dhost-project/dhost | ca6a4a76a737174b24165e20edeb1d1019a9424b | [
"MIT"
] | null | null | null | dhost/github/tests/test_github_api.py | dhost-project/dhost | ca6a4a76a737174b24165e20edeb1d1019a9424b | [
"MIT"
] | 67 | 2021-07-06T11:50:25.000Z | 2021-10-14T13:45:51.000Z | dhost/github/tests/test_github_api.py | dhost-project/dhost | ca6a4a76a737174b24165e20edeb1d1019a9424b | [
"MIT"
] | null | null | null | import json
import os
from unittest import TestCase, mock
from django.conf import settings
from dhost.github.github_api import GithubAPI, GithubAPIError
TMP_PATH = settings.TEST_DIR
class GithubAPITestCase(TestCase):
def setUp(self):
self.g = GithubAPI(token="github_token")
def test_get_token(self):
self.assertEqual(self.g.get_token(), "github_token")
def test__get_authorization_header(self):
authorization_header = self.g._get_authorization_header()
self.assertEqual(
authorization_header, {"Authorization": "token github_token"}
)
def test_get_headers(self):
headers = self.g.get_headers()
self.assertIsNotNone(headers["Accept"])
self.assertIsNotNone(headers["Authorization"])
def test_get_headers_with_additionnal_headers(self):
headers = self.g.get_headers({"Add": "additionnal_headers"})
self.assertIsNotNone(headers["Add"])
def test__prepare_request(self):
url, headers = self.g._prepare_request(url="/test_url")
self.assertIsNotNone(headers["Accept"])
self.assertIsNotNone(headers["Authorization"])
self.assertEqual(url, "https://api.github.com/test_url")
@mock.patch("requests.get")
def test_get(self, mock_get):
mock_get.return_value = mock.Mock(status_code=200, json=lambda: {})
self.g.get("/test")
mock_get.assert_called_once_with(
"https://api.github.com/test",
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": "token github_token",
},
)
@mock.patch("requests.get")
def test_get_404_status(self, mock_get):
mock_get.return_value = mock.Mock(
status_code=404, json=lambda: {"message": "Not Found"}
)
with self.assertRaises(GithubAPIError) as context:
self.g.get("/test")
self.assertEqual(
"https://api.github.com/test (404) Not Found",
str(context.exception),
)
@mock.patch("requests.get")
def test_get_404_status_json_decode_error(self, mock_get):
# test in case json return a JSONDecodeError exception, this can occur
# if the content is empty for example
mock_get.return_value = mock.Mock(
status_code=404, json=lambda: json.loads(""), content="test content"
)
with self.assertRaises(GithubAPIError) as context:
self.g.get("/test")
self.assertEqual(
"https://api.github.com/test (404) test content",
str(context.exception),
)
@mock.patch("requests.post")
def test_post(self, mock_post):
mock_post.return_value = mock.Mock(status_code=201, json=lambda: {})
self.g.post("/test", data={"test_data": "test"})
mock_post.assert_called_once_with(
"https://api.github.com/test",
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": "token github_token",
},
data={"test_data": "test"},
)
@mock.patch("requests.post")
def test_post_404_status(self, mock_post):
mock_post.return_value = mock.MagicMock(
status_code=404, json=lambda: {"message": "Not Found"}
)
with self.assertRaises(GithubAPIError) as context:
self.g.post("/test", data={"test_data": "test"})
self.assertEqual(
"https://api.github.com/test (404) Not Found",
str(context.exception),
)
@mock.patch("requests.patch")
def test_patch(self, mock_patch):
mock_patch.return_value = mock.Mock(status_code=200, json=lambda: {})
self.g.patch("/test", data={"test_data": "test"})
mock_patch.assert_called_once_with(
"https://api.github.com/test",
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": "token github_token",
},
data={"test_data": "test"},
)
@mock.patch("requests.patch")
def test_patch_404_status(self, mock_patch):
mock_patch.return_value = mock.MagicMock(
status_code=404, json=lambda: {"message": "Not Found"}
)
with self.assertRaises(GithubAPIError) as context:
self.g.patch("/test", data={"test_data": "test"})
self.assertEqual(
"https://api.github.com/test (404) Not Found",
str(context.exception),
)
@mock.patch("requests.get")
def test_head(self, mock_get):
mock_get.return_value = mock.Mock(
status_code=200, headers={"test_head": "test"}
)
self.g.head("/test")
mock_get.assert_called_once_with(
"https://api.github.com/test",
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": "token github_token",
},
)
@mock.patch("requests.delete")
def test_delete(self, mock_delete):
mock_delete.return_value = mock.Mock(status_code=204, json=lambda: {})
self.g.delete("/test")
mock_delete.assert_called_once_with(
"https://api.github.com/test",
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": "token github_token",
},
)
@mock.patch("requests.delete")
def test_delete_404_status(self, mock_delete):
mock_delete.return_value = mock.Mock(
status_code=404, json=lambda: {"message": "Not Found"}
)
with self.assertRaises(GithubAPIError) as context:
self.g.delete("/test")
self.assertEqual(
"https://api.github.com/test (404) Not Found",
str(context.exception),
)
@mock.patch(
"dhost.github.github_api.GithubAPI.head",
mock.MagicMock(return_value={"X-OAuth-Scopes": "oauth_test_scope"}),
)
def test_get_scopes(self):
oauth_scopes = self.g.get_scopes("octocat")
self.assertEqual(oauth_scopes, "oauth_test_scope")
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_get_user(self, mock):
self.g.get_user(username="octocat")
mock.assert_called_once_with("/users/octocat")
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_list_repos(self, mock):
self.g.list_repos()
mock.assert_called_once_with("/user/repos")
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_get_repo(self, mock):
self.g.get_repo(owner="octocat", repo="Hello-World")
mock.assert_called_once_with("/repos/octocat/Hello-World")
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_list_branches(self, mock):
self.g.list_branches(owner="octocat", repo="Hello-World")
mock.assert_called_once_with("/repos/octocat/Hello-World/branches")
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_download_repo(self, mock_get):
mock_get.return_value = mock.Mock(content=b"data_test")
self.g.download_repo(
owner="octocat",
repo="Hello-World",
ref="master",
path=os.path.join(TMP_PATH, "repos"),
)
self.assertTrue(os.path.exists(TMP_PATH + "/repos/Hello-World.tar"))
mock_get.assert_called_once_with(
"/repos/octocat/Hello-World/tarball/master", allow_redirects=True
)
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_download_repo_with_archive_name(self, mock_get):
mock_get.return_value = mock.Mock(content=b"data_test")
self.g.download_repo(
owner="octocat",
repo="Hello-World",
ref="master",
path=os.path.join(TMP_PATH, "repos"),
archive_name="foo_bar",
)
self.assertTrue(os.path.exists(TMP_PATH + "/repos/foo_bar.tar"))
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_list_hooks(self, mock):
self.g.list_hooks(owner="octocat", repo="Hello-World")
mock.assert_called_once_with("/repos/octocat/Hello-World/hooks")
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_get_hook(self, mock):
self.g.get_hook(owner="octocat", repo="Hello-World", hook_id=1)
mock.assert_called_once_with("/repos/octocat/Hello-World/hooks/1")
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_get_hook_config(self, mock):
self.g.get_hook_config(owner="octocat", repo="Hello-World", hook_id=1)
mock.assert_called_once_with(
"/repos/octocat/Hello-World/hooks/1/config"
)
@mock.patch("dhost.github.github_api.GithubAPI.post")
def test_create_hook(self, mock):
self.g.create_hook(
owner="octocat", repo="Hello-World", webhook_url="webhook_test_url"
)
mock.assert_called_once_with(
"/repos/octocat/Hello-World/hooks",
data={
"name": "web",
"config": {
"url": "webhook_test_url",
"insecure_ssl": False,
},
},
)
@mock.patch("dhost.github.github_api.GithubAPI.patch")
def test_update_hook(self, mock):
self.g.update_hook(
owner="octocat", repo="Hello-World", hook_id=1, data="test_data"
)
mock.assert_called_once_with(
"/repos/octocat/Hello-World/hooks/1", "test_data"
)
@mock.patch("dhost.github.github_api.GithubAPI.patch")
def test_update_hook_config(self, mock):
self.g.update_hook_config(
owner="octocat", repo="Hello-World", hook_id=1, data="test_data"
)
mock.assert_called_once_with(
"/repos/octocat/Hello-World/hooks/1/config", "test_data"
)
@mock.patch("dhost.github.github_api.GithubAPI.delete")
def test_delete_hook(self, mock):
self.g.delete_hook(owner="octocat", repo="Hello-World", hook_id=1)
mock.assert_called_once_with("/repos/octocat/Hello-World/hooks/1")
@mock.patch("dhost.github.github_api.GithubAPI.get")
def test_ping_hook(self, mock):
self.g.ping_hook(owner="octocat", repo="Hello-World", hook_id=1)
mock.assert_called_once_with(
"/repos/octocat/Hello-World/hooks/1/pings", code=204
)
| 37.177305 | 80 | 0.616082 | 1,278 | 10,484 | 4.838028 | 0.104069 | 0.025069 | 0.046579 | 0.058224 | 0.804302 | 0.763383 | 0.723435 | 0.683972 | 0.615721 | 0.600841 | 0 | 0.010123 | 0.246185 | 10,484 | 281 | 81 | 37.309609 | 0.772238 | 0.00992 | 0 | 0.442623 | 0 | 0 | 0.253734 | 0.108509 | 0 | 0 | 0 | 0 | 0.159836 | 1 | 0.127049 | false | 0 | 0.020492 | 0 | 0.151639 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 4 |
b554eb57e39d52fb4fa1f6e0bb47b918b5d736a2 | 106 | py | Python | src/onedrivesdk_fork/version.py | erkib/onedrive-sdk-python | 9d24c4a4117c72418cbe785df36213d928f318c5 | [
"MIT"
] | 20 | 2020-06-04T01:23:08.000Z | 2022-01-18T05:41:17.000Z | src/onedrivesdk_fork/version.py | erkib/onedrive-sdk-python | 9d24c4a4117c72418cbe785df36213d928f318c5 | [
"MIT"
] | 1 | 2020-03-27T09:41:27.000Z | 2020-03-27T09:41:27.000Z | src/onedrivesdk_fork/version.py | erkib/onedrive-sdk-python | 9d24c4a4117c72418cbe785df36213d928f318c5 | [
"MIT"
] | 3 | 2020-03-27T09:14:46.000Z | 2021-07-28T17:35:43.000Z | from __future__ import with_statement
from codecs import open
from os import path
__version__ = "1.1.14"
| 17.666667 | 37 | 0.801887 | 17 | 106 | 4.470588 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044444 | 0.150943 | 106 | 5 | 38 | 21.2 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.056604 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
b55781783a111694b1461327be4ff24d0c08ff61 | 163 | py | Python | polybius/graphics/basics/__init__.py | TStalnaker44/python_jeopardy | 7044d9512d51c04e22a6d2cbfa9e9a82a384de85 | [
"MIT"
] | null | null | null | polybius/graphics/basics/__init__.py | TStalnaker44/python_jeopardy | 7044d9512d51c04e22a6d2cbfa9e9a82a384de85 | [
"MIT"
] | null | null | null | polybius/graphics/basics/__init__.py | TStalnaker44/python_jeopardy | 7044d9512d51c04e22a6d2cbfa9e9a82a384de85 | [
"MIT"
] | null | null | null | from .banner import Banner
from .mask import Mask
from .drawable import Drawable
from .animated import Animated
__all__ = ["Banner","Mask","Drawable","Animated"]
| 23.285714 | 49 | 0.766871 | 21 | 163 | 5.761905 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122699 | 163 | 6 | 50 | 27.166667 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0.159509 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
b55f2146760bf602e3eefa7af6a06e2c7034fa3b | 724 | py | Python | tests/planning/test_CBiRRT.py | MisoRobotics/prpy | afbc8e9c3a8e4f4dc31261782962e12eb4b0ca10 | [
"BSD-3-Clause"
] | 53 | 2015-02-07T04:58:23.000Z | 2022-03-07T15:49:07.000Z | tests/planning/test_CBiRRT.py | MisoRobotics/prpy | afbc8e9c3a8e4f4dc31261782962e12eb4b0ca10 | [
"BSD-3-Clause"
] | 283 | 2015-01-01T17:16:37.000Z | 2018-05-09T23:51:48.000Z | tests/planning/test_CBiRRT.py | MisoRobotics/prpy | afbc8e9c3a8e4f4dc31261782962e12eb4b0ca10 | [
"BSD-3-Clause"
] | 28 | 2015-02-20T01:37:38.000Z | 2021-03-12T07:05:23.000Z | #!/usr/bin/env python
from methods import (
PlanToConfigurationTest,
PlanToConfigurationStraightLineTest,
PlanToConfigurationCompleteTest,
PlanToEndEffectorPoseTest,
PlanToEndEffectorOffsetTest,
)
from planning_helpers import BasePlannerTest
from prpy.planning.cbirrt import CBiRRTPlanner
from unittest import TestCase
class CBiRRTPlannerTest(BasePlannerTest,
PlanToConfigurationTest,
PlanToConfigurationStraightLineTest,
PlanToConfigurationCompleteTest,
PlanToEndEffectorPoseTest,
PlanToEndEffectorOffsetTest,
TestCase):
planner_factory = CBiRRTPlanner
| 32.909091 | 60 | 0.683702 | 39 | 724 | 12.641026 | 0.615385 | 0.235294 | 0.361055 | 0.462475 | 0.572008 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.283149 | 724 | 21 | 61 | 34.47619 | 0.949904 | 0.027624 | 0 | 0.555556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.333333 | 0 | 0 | 0 | 1 | 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 | 4 |
b5836421c7f9b795f05e53cf3fc2dd73f9efadb3 | 23,094 | py | Python | ion_functions/data/test/test_generic_functions.py | steinermg/ion-functions | cea532ad9af51e86768572c8deb48547d99567c5 | [
"Apache-2.0"
] | 10 | 2015-04-03T15:32:21.000Z | 2018-11-21T11:57:26.000Z | ion_functions/data/test/test_generic_functions.py | steinermg/ion-functions | cea532ad9af51e86768572c8deb48547d99567c5 | [
"Apache-2.0"
] | 8 | 2015-01-07T15:19:22.000Z | 2015-12-08T18:14:04.000Z | ion_functions/data/test/test_generic_functions.py | steinermg/ion-functions | cea532ad9af51e86768572c8deb48547d99567c5 | [
"Apache-2.0"
] | 17 | 2015-01-14T16:23:00.000Z | 2021-07-19T08:26:52.000Z | #!/usr/bin/env python
"""
@package ion_functions.test.generic_functions
@file ion_functions/test/generic_functions.py
@author Christopher Wingard, Stuart Pearce, Russell Desiderio
@brief Unit tests for generic_functions module
"""
from nose.plugins.attrib import attr
from ion_functions.test.base_test import BaseUnitTestCase
import numpy as np
from ion_functions.data import generic_functions as gfunc
from ion_functions.data.generic_functions import SYSTEM_FILLVALUE
# for test_replace_fill_with_nan
INST_FILLVALUE = -32768
ZERO_FILLVALUE = 0
@attr('UNIT', group='func')
class TestGenericFunctionsUnit(BaseUnitTestCase):
def test_replace_fill_with_nan_with_vectortime_variables(self):
"""
Description:
Tests replace_fill_with_nan for variables that are time-vectorized
with more than one time point. Functionally this means that the lead
dimension of these test variables will have a shape greater than 1.
Cases (instances of the system fill value are always processed):
no instrument fill value
one instrument fill value of 0
two instrument fill values
Implemented by:
2013-06-11: Russell Desiderio. Initial code.
"""
# constants for convenience in filling in test variables
sfill = SYSTEM_FILLVALUE
zfill = ZERO_FILLVALUE
ifill = INST_FILLVALUE
# set up 6 integer arrays to be tested, v1-v6.
# this will also designate their ordering on input and output
v1_good_1D = np.array([1, 2, 3, 4, 5])
v2_good_2D = np.tile(v1_good_1D, (3, 1))
v3_good_3D = np.tile(v2_good_2D, (3, 1, 1))
v4_fill_1D = np.array([11, ifill, 13, zfill, sfill])
v5_fill_2D = np.vstack((v4_fill_1D, v1_good_1D, v4_fill_1D))
v6_fill_3D = np.copy(v3_good_3D)
v6_fill_3D[0, 0, 0] = zfill
v6_fill_3D[1, 1, 1] = sfill
v6_fill_3D[2, 2, 2:5] = ifill # last 3 elements in row '2'
# and a float array which should pass through unchanged
v7_float_array = v3_good_3D.astype(float)
v7_float_array[0, 1, 2] = np.nan
#SET INPUTS
v1, v2, v3 = np.copy(v1_good_1D), np.copy(v2_good_2D), np.copy(v3_good_3D)
v4, v5, v6 = np.copy(v4_fill_1D), np.copy(v5_fill_2D), np.copy(v6_fill_3D)
v7 = np.copy(v7_float_array)
### CASE 1: no instrument fill values, only system fill values
# set expected outputs
x1 = v1_good_1D.astype(float)
x2 = v2_good_2D.astype(float)
x3 = v3_good_3D.astype(float)
x4 = np.array([11.0, float(ifill), 13.0, float(zfill), np.nan])
x5 = np.vstack((x4, x1, x4))
x6 = v6_fill_3D.astype(float)
x6[1, 1, 1] = np.nan
x7 = np.copy(v7_float_array)
# (1a): instrument_fillvalue = None
(c1, c2, c3, c4, c5, c6, c7) = gfunc.replace_fill_with_nan(
None, v1, v2, v3, v4, v5, v6, v7)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
# (1b) instrument_fillvalue = empty list
(c1, c2, c3, c4, c5, c6, c7) = gfunc.replace_fill_with_nan(
[], v1, v2, v3, v4, v5, v6, v7)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
# (1c) instrument_fillvalue: empty ndarray
(c1, c2, c3, c4, c5, c6, c7) = gfunc.replace_fill_with_nan(
np.array([]), v1, v2, v3, v4, v5, v6, v7)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
### CASE (2): one instrument fill value = 0
# reset expected outputs; x1-x3 and x7 are unchanged
x4[3] = np.nan # x4 is now reset
x5 = np.vstack((x4, x1, x4))
x6[0, 0, 0] = np.nan # x6 is now reset
# (2a) instrument_fillvalue is a scalar
(c1, c2, c3, c4, c5, c6, c7) = gfunc.replace_fill_with_nan(
zfill, v1, v2, v3, v4, v5, v6, v7)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
# (2b) instrument_fillvalue is a one-element list
(c1, c2, c3, c4, c5, c6, c7) = gfunc.replace_fill_with_nan(
[zfill], v1, v2, v3, v4, v5, v6, v7)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
# (2c) instrument_fillvalue is a shape (1,) ndarray
(c1, c2, c3, c4, c5, c6, c7) = gfunc.replace_fill_with_nan(
np.array([zfill]), v1, v2, v3, v4, v5, v6, v7)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
### CASE (3): two instrument fill values
# reset expected outputs; x1-x3 and x7 are unchanged
x4[1] = np.nan # x4 is now reset
x5 = np.vstack((x4, x1, x4))
x6[2, 2, 2:5] = np.nan # x6 is now reset
# (3a) instrument_fillvalues are contained in a list
(c1, c2, c3, c4, c5, c6, c7) = gfunc.replace_fill_with_nan(
[ifill, zfill], v1, v2, v3, v4, v5, v6, v7)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
# (3b) instrument_fillvalues are contained in an ndarray
(c1, c2, c3, c4, c5, c6, c7) = gfunc.replace_fill_with_nan(
np.array([ifill, zfill]), v1, v2, v3, v4, v5, v6, v7)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
def test_replace_fill_with_nan_with_scalartime_variables(self):
"""
Description:
Tests replace_fill_with_nan for variables that are time-vectorized
with one time point. Functionally this means that the lead dimension
of these test variables will have shape 1.
Cases (instances of the system fill value are always processed):
no instrument fill value
one instrument fill value of 0
two instrument fill values
Implemented by:
2013-06-12: Russell Desiderio. Initial code.
"""
# constants for convenience in filling in test variables
sfill = SYSTEM_FILLVALUE
zfill = ZERO_FILLVALUE
ifill = INST_FILLVALUE
# set up 8 integer arrays to be tested, v1-v8.
# this will also designate their ordering on input and output
v1 = np.array([500])
v2 = np.array([ifill])
v3 = np.array([zfill])
v4 = np.array([sfill])
v5 = np.array([[1, 2, 3, 4, 5]])
v6 = np.array([[11, ifill, 13, zfill, sfill]])
v7 = np.tile(v5, (3, 1))[np.newaxis, :]
v8 = np.vstack((v6, v5, v6))[np.newaxis, :]
### CASE 1: no instrument fill values, only system fill values
# set expected outputs
x1, x2, x3 = v1.astype(float), v2.astype(float), v3.astype(float)
x4 = np.array([np.nan])
x5 = v5.astype(float)
x6 = np.array([[11.0, float(ifill), 13.0, float(zfill), np.nan]])
x7 = v7.astype(float)
x8 = np.copy(v8.astype(float))
x8[0, 0, 4] = np.nan
x8[0, 2, 4] = np.nan
# (1a) instrument_fillvalue = None
(c1, c2, c3, c4, c5, c6, c7, c8) = gfunc.replace_fill_with_nan(
None, v1, v2, v3, v4, v5, v6, v7, v8)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
np.testing.assert_array_almost_equal(c8, x8, decimal=8)
# (1b) instrument_fillvalue: empty list
(c1, c2, c3, c4, c5, c6, c7, c8) = gfunc.replace_fill_with_nan(
[], v1, v2, v3, v4, v5, v6, v7, v8)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
np.testing.assert_array_almost_equal(c8, x8, decimal=8)
# (1c) instrument_fillvalue: empty ndarray
(c1, c2, c3, c4, c5, c6, c7, c8) = gfunc.replace_fill_with_nan(
np.array([]), v1, v2, v3, v4, v5, v6, v7, v8)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
np.testing.assert_array_almost_equal(c8, x8, decimal=8)
### CASE (2): one instrument fill value = 0
# reset expected outputs; x1, x2, x4, x5 and x7 are unchanged
x3 = np.array([np.nan])
x6[0, 3] = np.nan # x6 is now reset
x8[0, 0, 3] = np.nan
x8[0, 2, 3] = np.nan # x8 is now reset
# (2a) instrument_fillvalue is a scalar
(c1, c2, c3, c4, c5, c6, c7, c8) = gfunc.replace_fill_with_nan(
zfill, v1, v2, v3, v4, v5, v6, v7, v8)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
np.testing.assert_array_almost_equal(c8, x8, decimal=8)
# (2b) instrument_fillvalue is a one element list
(c1, c2, c3, c4, c5, c6, c7, c8) = gfunc.replace_fill_with_nan(
[zfill], v1, v2, v3, v4, v5, v6, v7, v8)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
np.testing.assert_array_almost_equal(c8, x8, decimal=8)
# (2c) instrument_fillvalue is a one element ndarray
(c1, c2, c3, c4, c5, c6, c7, c8) = gfunc.replace_fill_with_nan(
np.array([zfill]), v1, v2, v3, v4, v5, v6, v7, v8)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
np.testing.assert_array_almost_equal(c8, x8, decimal=8)
### CASE (3): two instrument fill values
# reset expected outputs; x1,x3-x5 and x7 are unchanged
x2 = np.array([np.nan])
x6[0, 1] = np.nan # x6 is now reset
x8[0, 0, 1] = np.nan
x8[0, 2, 1] = np.nan # x8 is now reset
# (3a) instrument_fillvalues are contained in a list
(c1, c2, c3, c4, c5, c6, c7, c8) = gfunc.replace_fill_with_nan(
[ifill, zfill], v1, v2, v3, v4, v5, v6, v7, v8)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
np.testing.assert_array_almost_equal(c8, x8, decimal=8)
# (3b) instrument_fillvalues are contained in an ndarray
(c1, c2, c3, c4, c5, c6, c7, c8) = gfunc.replace_fill_with_nan(
np.array([ifill, zfill]), v1, v2, v3, v4, v5, v6, v7, v8)
np.testing.assert_array_almost_equal(c1, x1, decimal=8)
np.testing.assert_array_almost_equal(c2, x2, decimal=8)
np.testing.assert_array_almost_equal(c3, x3, decimal=8)
np.testing.assert_array_almost_equal(c4, x4, decimal=8)
np.testing.assert_array_almost_equal(c5, x5, decimal=8)
np.testing.assert_array_almost_equal(c6, x6, decimal=8)
np.testing.assert_array_almost_equal(c7, x7, decimal=8)
np.testing.assert_array_almost_equal(c8, x8, decimal=8)
def test_replace_fill_with_nan_with_one_data_argument(self):
"""
Description:
Tests replace_fill_with_nan when called with only one data argument.
Coding replace_fill_with_nan for this was initially not straightforward
due to the core python\numpy "interface".
Cases (instances of the system fill value are always processed):
no instrument fill value
one instrument fill value of 0
two instrument fill values
Implemented by:
2013-06-23: Russell Desiderio. Initial code.
"""
# constants for convenience in filling in test variables
sfill = SYSTEM_FILLVALUE
zfill = ZERO_FILLVALUE
ifill = INST_FILLVALUE
# set up a list of 8 input integer arrays to be tested one at a time
v4 = np.array([[1, 2, 3, 4, 5]])
v5 = np.array([[11, ifill, 13, zfill, sfill]])
v = [np.array([500]),
np.array([ifill]),
np.array([zfill]),
np.array([sfill]),
v4,
v5,
np.tile(v4, (3, 1))[np.newaxis, :],
np.vstack((v5, v4, v5))[np.newaxis, :]
]
### CASE(1): no instrument fill values
# expected values
x = [np.array([500.0]),
np.array([ifill]).astype('float'),
np.array([zfill]).astype('float'),
np.array([np.nan]),
np.array([[1.0, 2.0, 3.0, 4.0, 5.0]]),
np.array([[11, ifill, 13, zfill, np.nan]]).astype('float'),
v[6].astype(float),
np.copy(v[7].astype(float))
]
x[7][0, 0, 4] = np.nan
x[7][0, 2, 4] = np.nan
for ii in range(len(v)):
c = gfunc.replace_fill_with_nan(None, v[ii])
np.testing.assert_array_almost_equal(c, x[ii], decimal=8)
### CASE (2): one instrument fill value = 0
# reset expected outputs; x[0], x[1], x[3], x[4] and x[6] are unchanged
x[2] = np.array([np.nan])
x[5][0, 3] = np.nan # x[5] is now reset
x[7][0, 0, 3] = np.nan
x[7][0, 2, 3] = np.nan # x[7] is now reset
for ii in range(len(v)):
c = gfunc.replace_fill_with_nan(zfill, v[ii])
np.testing.assert_array_almost_equal(c, x[ii], decimal=8)
### CASE (3): two instrument fill values
# reset expected outputs; only list elements 5 and 7 will change
x[1] = np.array([np.nan])
x[5][0, 1] = np.nan # x[5] is now reset
x[7][0, 0, 1] = np.nan
x[7][0, 2, 1] = np.nan # x[7] is now reset
for ii in range(len(v)):
c = gfunc.replace_fill_with_nan([ifill, zfill], v[ii])
np.testing.assert_array_almost_equal(c, x[ii], decimal=8)
def test_magnetic_declination(self):
"""
Test magnetic_declination function.
Some values based on those defined in the WMM document,
WMM2010testvalues.pdf which accompanies the software. Others
were created and checked using online calculators.
Implemented by Stuart Pearce, April 2013
"""
lat = np.array([45.0, 45.0, 80.0, 0.0, -80.0, 80.0, 0.0, -80.0])
lon = np.array([-128.0, -128.0, 0.0, 120.0,
240.0, 0.0, 120.0, 240.0])
z = np.array([0.0, 1000.0, 0.0, 0.0,
0.0, 100000.0, 100000.0, 100000.0])
timestamp = np.array([3575053740.7382507, # 2013-04-15 22:29:00
3575053740.7382507, # UTC
3471292800.0, # 2010-01-01 UTC
3471292800.0,
3471292800.0,
3471292800.0,
3471292800.0,
3471292800.0])
decln = np.array([16.46093044096720, 16.46376239313584, -6.13, 0.97,
70.21, -6.57, 0.94, 69.62])
out = gfunc.magnetic_declination(lat, lon, timestamp, z, -1)
self.assertTrue(np.allclose(out, decln, rtol=0, atol=1e-2))
def test_magnetic_correction(self):
"""
Test magentic_correction function.
Input values based on those defined in DPS; output values calculated to
more significant figures using matlab code specified in the DPS.
OOI (2012). Data Product Specification for Velocity Profile and Echo
Intensity. Document Control Number 1341-00750.
https://alfresco.oceanobservatories.org/ (See: Company Home >> OOI
>> Controlled >> 1000 System Level >>
1341-00750_Data_Product_SPEC_VELPROF_OOI.pdf)
Implemented by Christopher Wingard, April 2013
Modified by Russell Desiderio, April 07, 2014. Changed the rtol values
from 1e4 to 1e-4 to get a fair test. Changed the output values by
adding more significant figures.
"""
# apply the magnetic declination correction.
uu_cor, vv_cor = gfunc.magnetic_correction(16.9604, np.array([0.4413]),
np.array([0.1719]))
# test the transform
self.assertTrue(np.allclose(uu_cor, 0.472251, rtol=1e-4, atol=0))
self.assertTrue(np.allclose(vv_cor, 0.035692, rtol=1e-4, atol=0))
def test_ntp_to_unix_time(self):
"""
Test ntp_to_unix_time function.
Timestamp Values gathered from various internet sources
including the NTP FAQ and HOWTO.
Implemented by Stuart Pearce, April 2013
"""
ntp_timestamps = np.array([3176736750.7358608,
3359763506.2082224,
3575049755.4380851])
output = gfunc.ntp_to_unix_time(ntp_timestamps)
check_values = np.array([967747950.735861,
1150774706.2082224,
1366060955.438085])
self.assertTrue(np.allclose(output, check_values,
rtol=0, atol=1e-6))
def test_extract_parameters(self):
"""
Test extract_parameter function.
Array values created by author.
Implemented by Christopher Wingard, April 2013
"""
in_array = np.array([34, 67, 12, 15, 89, 100, 54, 36])
self.assertTrue(np.equal(34, gfunc.extract_parameter(in_array, 0)))
self.assertTrue(np.equal(67, gfunc.extract_parameter(in_array, 1)))
self.assertTrue(np.equal(12, gfunc.extract_parameter(in_array, 2)))
self.assertTrue(np.equal(15, gfunc.extract_parameter(in_array, 3)))
self.assertTrue(np.equal(89, gfunc.extract_parameter(in_array, 4)))
self.assertTrue(np.equal(100, gfunc.extract_parameter(in_array, 5)))
self.assertTrue(np.equal(54, gfunc.extract_parameter(in_array, 6)))
self.assertTrue(np.equal(36, gfunc.extract_parameter(in_array, 7)))
| 45.550296 | 83 | 0.622196 | 3,412 | 23,094 | 4.03136 | 0.105217 | 0.08048 | 0.134133 | 0.178844 | 0.758997 | 0.711741 | 0.684188 | 0.660923 | 0.653653 | 0.646383 | 0 | 0.087742 | 0.264181 | 23,094 | 506 | 84 | 45.640316 | 0.721709 | 0.227981 | 0 | 0.517915 | 0 | 0 | 0.00133 | 0 | 0 | 0 | 0 | 0 | 0.439739 | 1 | 0.022801 | false | 0 | 0.016287 | 0 | 0.042345 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
b5a858ce335467cabfdcdbf500db2a1e694580b8 | 93 | py | Python | dzTraficoBackend/dzTrafico/apps.py | DZAymen/dz-Trafico | 74ff9caf9e3845d8af977c46b04a2d3421a0661b | [
"MIT"
] | null | null | null | dzTraficoBackend/dzTrafico/apps.py | DZAymen/dz-Trafico | 74ff9caf9e3845d8af977c46b04a2d3421a0661b | [
"MIT"
] | null | null | null | dzTraficoBackend/dzTrafico/apps.py | DZAymen/dz-Trafico | 74ff9caf9e3845d8af977c46b04a2d3421a0661b | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class DztraficoConfig(AppConfig):
name = 'dzTrafico'
| 15.5 | 33 | 0.763441 | 10 | 93 | 7.1 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16129 | 93 | 5 | 34 | 18.6 | 0.910256 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
b5aa8ff6e5cf1625b08671d9811631b6ff938b6f | 186 | py | Python | pvfit/__init__.py | markcampanelli/pvfit | e526f3757279a3f8c41295aab94c1575ee9485fc | [
"MIT"
] | 4 | 2019-09-17T15:19:17.000Z | 2021-11-24T03:21:03.000Z | pvfit/__init__.py | markcampanelli/pvfit | e526f3757279a3f8c41295aab94c1575ee9485fc | [
"MIT"
] | 3 | 2019-09-08T01:47:29.000Z | 2020-09-13T16:12:45.000Z | pvfit/__init__.py | markcampanelli/pvfit | e526f3757279a3f8c41295aab94c1575ee9485fc | [
"MIT"
] | 2 | 2019-10-01T07:40:16.000Z | 2019-10-25T09:27:45.000Z | from pkg_resources import get_distribution
# This relies on setuptools_scm magic in setup.py, and raises when package is not installed.
__version__ = get_distribution(__name__).version
| 37.2 | 92 | 0.833333 | 27 | 186 | 5.296296 | 0.888889 | 0.20979 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123656 | 186 | 4 | 93 | 46.5 | 0.877301 | 0.483871 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
a916c7d5e2d045dfd06cbdfb01f11e8ae362c556 | 119 | py | Python | python/testData/codeInsight/controlflow/fortrycontinue.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/codeInsight/controlflow/fortrycontinue.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/codeInsight/controlflow/fortrycontinue.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | tests = "foo"
for t in tests:
try:
for t in []:
print t
except Exception:
continue
| 14.875 | 21 | 0.478992 | 15 | 119 | 3.8 | 0.666667 | 0.140351 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.445378 | 119 | 7 | 22 | 17 | 0.863636 | 0 | 0 | 0 | 0 | 0 | 0.02521 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.142857 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
a91a3c7b2444899be466ae0ea64db15bfe889258 | 210 | py | Python | xl/strval.py | tizz98/xl | 4534a1792f878964fedd87432c438ab6364ece49 | [
"MIT"
] | 1 | 2018-03-30T17:36:41.000Z | 2018-03-30T17:36:41.000Z | xl/strval.py | tizz98/xl | 4534a1792f878964fedd87432c438ab6364ece49 | [
"MIT"
] | null | null | null | xl/strval.py | tizz98/xl | 4534a1792f878964fedd87432c438ab6364ece49 | [
"MIT"
] | null | null | null | from value import Value
class StrVal(Value):
ADD = "&"
def __init__(self, value):
super(StrVal, self).__init__(value)
self.value = '"%s"' % self.value # needs to be in double quotes
| 21 | 72 | 0.614286 | 28 | 210 | 4.321429 | 0.607143 | 0.223141 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.257143 | 210 | 9 | 73 | 23.333333 | 0.775641 | 0.133333 | 0 | 0 | 0 | 0 | 0.027778 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 4 |
a926863ff550dda4cb2a92e546966952a22533dd | 272 | py | Python | src/pyfme/environment/__init__.py | jdebecdelievre/PyFME | 45a46c9dccfaf4961dc9a7320ff43a24e28eb4e4 | [
"MIT"
] | 1 | 2021-01-24T19:34:46.000Z | 2021-01-24T19:34:46.000Z | src/pyfme/environment/__init__.py | jdebecdelievre/PyFME | 45a46c9dccfaf4961dc9a7320ff43a24e28eb4e4 | [
"MIT"
] | null | null | null | src/pyfme/environment/__init__.py | jdebecdelievre/PyFME | 45a46c9dccfaf4961dc9a7320ff43a24e28eb4e4 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Python Flight Mechanics Engine (PyFME).
Copyright (c) AeroPython Development Team.
Distributed under the terms of the MIT License.
Environment
-----------
"""
from .environment import Environment
from .environment import Conditions | 22.666667 | 48 | 0.698529 | 30 | 272 | 6.333333 | 0.8 | 0.157895 | 0.273684 | 0.336842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004444 | 0.172794 | 272 | 12 | 49 | 22.666667 | 0.84 | 0.654412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
a939447e406c6de2fd579f7be65cfe8d1e5c8cab | 189 | py | Python | 8kyu/basic_subclasses_adam_and_eve.py | nhsz/codewars | 82703959e910254d6feff4162f78c6dbd7a1c3ed | [
"MIT"
] | 1 | 2018-12-02T23:04:38.000Z | 2018-12-02T23:04:38.000Z | 8kyu/basic_subclasses_adam_and_eve.py | nhsz/codewars | 82703959e910254d6feff4162f78c6dbd7a1c3ed | [
"MIT"
] | null | null | null | 8kyu/basic_subclasses_adam_and_eve.py | nhsz/codewars | 82703959e910254d6feff4162f78c6dbd7a1c3ed | [
"MIT"
] | null | null | null | # http://www.codewars.com/kata/547274e24481cfc469000416/
def god():
return [Man(), Woman()]
class Human(object):
pass
class Man(Human):
pass
class Woman(Human):
pass
| 11.117647 | 56 | 0.645503 | 23 | 189 | 5.304348 | 0.652174 | 0.147541 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 0.206349 | 189 | 16 | 57 | 11.8125 | 0.68 | 0.285714 | 0 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | true | 0.375 | 0 | 0.125 | 0.625 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 4 |
a939e6b341321f5caad9c63ba45aba001c5b3bb3 | 1,299 | py | Python | tests/test_finance.py | kinegratii/borax | 3595f554b788c31d0f07be4099db68c854db65f7 | [
"MIT"
] | 51 | 2018-04-18T13:52:15.000Z | 2022-03-23T13:46:02.000Z | tests/test_finance.py | kinegratii/borax | 3595f554b788c31d0f07be4099db68c854db65f7 | [
"MIT"
] | 26 | 2019-05-26T02:22:34.000Z | 2022-03-14T07:50:32.000Z | tests/test_finance.py | kinegratii/borax | 3595f554b788c31d0f07be4099db68c854db65f7 | [
"MIT"
] | 7 | 2018-09-30T08:17:29.000Z | 2020-12-16T01:49:24.000Z | # coding=utf8
import decimal
import unittest
from borax.numbers import FinanceNumbers
decimal.getcontext().prec = 2
class CapitalNumber(unittest.TestCase):
def test_amount_capital(self):
self.assertEqual('壹亿元整', FinanceNumbers.to_capital_str(100000000))
self.assertEqual('肆佰伍拾柒万捌仟肆佰肆拾贰元贰角叁分', FinanceNumbers.to_capital_str(4578442.23))
self.assertEqual('贰佰叁拾肆元整', FinanceNumbers.to_capital_str(234))
self.assertEqual('捌拾元零角贰分', FinanceNumbers.to_capital_str(80.02))
def test_decimal(self):
self.assertEqual('肆元伍角零分', FinanceNumbers.to_capital_str(decimal.Decimal(4.50)))
self.assertEqual('壹拾万柒仟元伍角叁分', FinanceNumbers.to_capital_str(decimal.Decimal('107000.53')))
self.assertEqual('壹拾万柒仟元伍角叁分', FinanceNumbers.to_capital_str('107000.53'))
def test_valid_range(self):
with self.assertRaises(ValueError):
FinanceNumbers.to_capital_str(332342342341234)
with self.assertRaises(ValueError):
FinanceNumbers.to_capital_str(1000000000000)
self.assertIsNotNone(FinanceNumbers.to_capital_str(999999999999))
self.assertIsNotNone(FinanceNumbers.to_capital_str(999999999999.99))
with self.assertRaises(ValueError):
FinanceNumbers.to_capital_str('1000000000000')
| 40.59375 | 99 | 0.744419 | 140 | 1,299 | 6.7 | 0.35 | 0.204691 | 0.294243 | 0.332623 | 0.49467 | 0.49467 | 0.4371 | 0.206823 | 0.147122 | 0 | 0 | 0.102541 | 0.151655 | 1,299 | 31 | 100 | 41.903226 | 0.748639 | 0.008468 | 0 | 0.130435 | 0 | 0 | 0.072317 | 0 | 0 | 0 | 0 | 0 | 0.521739 | 1 | 0.130435 | false | 0 | 0.130435 | 0 | 0.304348 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
a94a516331d09c09ea21dd450c16f1ba6a056dab | 261 | py | Python | cradmin_legacy/crsettings.py | appressoas/cradmin_legacy | b9d024299333dd04c87c1031bd5be5778aa7f1f1 | [
"BSD-3-Clause"
] | 11 | 2015-07-05T16:57:58.000Z | 2020-11-24T16:58:19.000Z | django_cradmin/crsettings.py | appressoas/django_cradmin | 0f8715afdfe1ad32e46033f442e622aecf6a4dec | [
"BSD-3-Clause"
] | 91 | 2015-01-08T22:38:13.000Z | 2022-02-10T10:25:27.000Z | django_cradmin/crsettings.py | appressoas/django_cradmin | 0f8715afdfe1ad32e46033f442e622aecf6a4dec | [
"BSD-3-Clause"
] | 3 | 2016-12-07T12:19:24.000Z | 2018-10-03T14:04:18.000Z | from django.conf import settings
def get_setting(setting, fallbackvalue=None):
"""
Get a Django setting falling back to the given ``fallbackvalue``
if ``settings.<setting>`` is not set.
"""
return getattr(settings, setting, fallbackvalue)
| 26.1 | 68 | 0.701149 | 32 | 261 | 5.6875 | 0.6875 | 0.21978 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.191571 | 261 | 9 | 69 | 29 | 0.862559 | 0.390805 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
8d362abf1009d2753f1d7848657df979ad295556 | 92 | py | Python | Python/Topics/Itertools module/Choosing a name/main.py | drtierney/hyperskill-problems | b74da993f0ac7bcff1cbd5d89a3a1b06b05f33e0 | [
"MIT"
] | 5 | 2020-08-29T15:15:31.000Z | 2022-03-01T18:22:34.000Z | Python/Topics/Itertools module/Choosing a name/main.py | drtierney/hyperskill-problems | b74da993f0ac7bcff1cbd5d89a3a1b06b05f33e0 | [
"MIT"
] | null | null | null | Python/Topics/Itertools module/Choosing a name/main.py | drtierney/hyperskill-problems | b74da993f0ac7bcff1cbd5d89a3a1b06b05f33e0 | [
"MIT"
] | 1 | 2020-12-02T11:13:14.000Z | 2020-12-02T11:13:14.000Z | import itertools
for n, m in itertools.product(first_names, middle_names):
print(n, m)
| 18.4 | 57 | 0.73913 | 15 | 92 | 4.4 | 0.733333 | 0.060606 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163043 | 92 | 4 | 58 | 23 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
8d9b686435559a19d9f76e8e2ba9d918db405eed | 146 | py | Python | dvc/dependency/https.py | farizrahman4u/dvc | a56c8bbab662c3792ae12aa7db6c40a42a23de50 | [
"Apache-2.0"
] | 1 | 2020-08-12T22:51:45.000Z | 2020-08-12T22:51:45.000Z | dvc/dependency/https.py | farizrahman4u/dvc | a56c8bbab662c3792ae12aa7db6c40a42a23de50 | [
"Apache-2.0"
] | null | null | null | dvc/dependency/https.py | farizrahman4u/dvc | a56c8bbab662c3792ae12aa7db6c40a42a23de50 | [
"Apache-2.0"
] | 1 | 2020-11-28T11:47:48.000Z | 2020-11-28T11:47:48.000Z | from ..tree.https import HTTPSRemoteTree
from .http import HTTPDependency
class HTTPSDependency(HTTPDependency):
TREE_CLS = HTTPSRemoteTree
| 20.857143 | 40 | 0.815068 | 15 | 146 | 7.866667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130137 | 146 | 6 | 41 | 24.333333 | 0.929134 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
a5f168cc7ffc66a5ddae8a72d42fd592ed4462c7 | 187 | py | Python | setup.py | AFM-SPM/curves | e28c3f845b5b79a75d138b3b8e57665a6dc4d224 | [
"MIT"
] | 2 | 2022-02-08T14:25:27.000Z | 2022-02-10T14:33:47.000Z | setup.py | AFM-SPM/curves | e28c3f845b5b79a75d138b3b8e57665a6dc4d224 | [
"MIT"
] | 1 | 2022-02-11T08:56:18.000Z | 2022-02-17T18:10:14.000Z | setup.py | AFM-SPM/curves | e28c3f845b5b79a75d138b3b8e57665a6dc4d224 | [
"MIT"
] | 1 | 2022-01-28T15:20:12.000Z | 2022-01-28T15:20:12.000Z | from setuptools import setup, find_packages
setup(
name='Curves',
version='0.1.0',
packages=find_packages(),
install_requires=['numpy',
'pandas',]
) | 20.777778 | 43 | 0.593583 | 20 | 187 | 5.4 | 0.75 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021898 | 0.26738 | 187 | 9 | 44 | 20.777778 | 0.766423 | 0 | 0 | 0 | 0 | 0 | 0.117021 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.125 | 0 | 0.125 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
5711368ca4c64e2b920c34d89d4bebe868a45eaf | 124 | py | Python | releases/egg/eggDemo.py | tgolsson/appJar | 5e2f8bff44e927e7c2bae17fccddc6dbf79952f0 | [
"Apache-2.0"
] | 666 | 2016-11-14T18:17:40.000Z | 2022-03-29T03:53:22.000Z | releases/egg/eggDemo.py | tgolsson/appJar | 5e2f8bff44e927e7c2bae17fccddc6dbf79952f0 | [
"Apache-2.0"
] | 598 | 2016-10-20T21:04:09.000Z | 2022-03-15T22:44:49.000Z | releases/egg/eggDemo.py | tgolsson/appJar | 5e2f8bff44e927e7c2bae17fccddc6dbf79952f0 | [
"Apache-2.0"
] | 95 | 2017-01-19T12:23:58.000Z | 2022-03-06T18:16:21.000Z | import sys
sys.path.append("appJar-0.93-py3.6.egg")
from appJar import gui
with gui() as app:
app.label('hello world')
| 17.714286 | 40 | 0.701613 | 23 | 124 | 3.782609 | 0.782609 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04717 | 0.145161 | 124 | 6 | 41 | 20.666667 | 0.773585 | 0 | 0 | 0 | 0 | 0 | 0.258065 | 0.169355 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
939b1eb2a0c8ff5bbf2dd1254c8152bbceb0bb74 | 57 | py | Python | example_snippets/multimenus_snippets/NewSnippets/SymPy/Solvers/Solve for two variables.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | null | null | null | example_snippets/multimenus_snippets/NewSnippets/SymPy/Solvers/Solve for two variables.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | null | null | null | example_snippets/multimenus_snippets/NewSnippets/SymPy/Solvers/Solve for two variables.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | 1 | 2021-02-04T04:51:48.000Z | 2021-02-04T04:51:48.000Z | eqns = Eq(x + y, 4), Eq(x*y, 3)
soln = solve(eqns, [x,y]) | 28.5 | 31 | 0.508772 | 14 | 57 | 2.071429 | 0.571429 | 0.206897 | 0.275862 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043478 | 0.192982 | 57 | 2 | 32 | 28.5 | 0.586957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
93a18a8770adf186f06f9af80a5118ba5a62b835 | 464 | py | Python | neuralNet/interactor.py | matthewReff/spirecomm | 95c8a7e8b5dcabd1c2c04cdd046b2190c5d3f087 | [
"MIT"
] | null | null | null | neuralNet/interactor.py | matthewReff/spirecomm | 95c8a7e8b5dcabd1c2c04cdd046b2190c5d3f087 | [
"MIT"
] | null | null | null | neuralNet/interactor.py | matthewReff/spirecomm | 95c8a7e8b5dcabd1c2c04cdd046b2190c5d3f087 | [
"MIT"
] | null | null | null | import logging
from spirecomm.spire.game import Game
from spirecomm.communication.action import *
from neuralNet.dataConverter import *
class NeuralNetInteractor:
def __init__(self):
pass
def __run_combat_in_NN(self, nnCombatIpnut: str) -> str:
return ""
def run_combat(self, gameState: Game) -> Action:
readableState = game_state_to_NN_input(gameState)
nnOutput = self.__run_combat_in_NN(readableState)
return NN_output_to_action(nnOutput)
| 20.173913 | 57 | 0.784483 | 60 | 464 | 5.7 | 0.5 | 0.078947 | 0.070175 | 0.076023 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137931 | 464 | 22 | 58 | 21.090909 | 0.855 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0.076923 | 0.307692 | 0.076923 | 0.769231 | 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 | 1 | 0 | 1 | 0 | 0 | 4 |
93a5c3b5df106dba9d08e5bc13d74880f0ffee55 | 234 | py | Python | OOP/Polymorphism/exercise/main.py | musen-rse/examples_python | 75f2afb94c9ee2e1f1333638d186c2c3c3a96436 | [
"MIT"
] | 1 | 2022-01-23T14:02:47.000Z | 2022-01-23T14:02:47.000Z | OOP/Polymorphism/exercise/main.py | musen-rse/examples_python | 75f2afb94c9ee2e1f1333638d186c2c3c3a96436 | [
"MIT"
] | 1 | 2021-09-12T07:00:30.000Z | 2021-09-12T07:00:30.000Z | OOP/Polymorphism/exercise/main.py | musen-rse/examples_python | 75f2afb94c9ee2e1f1333638d186c2c3c3a96436 | [
"MIT"
] | 1 | 2022-01-23T14:02:29.000Z | 2022-01-23T14:02:29.000Z | from ants_impl import WorkerAnt, SoldierAnt, NurseAnt
from core.ant_queen import AntQueen
if __name__ == '__main__':
ants = [WorkerAnt(), SoldierAnt(), NurseAnt()]
ant_queen = AntQueen(ants)
ant_queen.do_morning_routine() | 33.428571 | 53 | 0.74359 | 29 | 234 | 5.517241 | 0.586207 | 0.15 | 0.3375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149573 | 234 | 7 | 54 | 33.428571 | 0.80402 | 0 | 0 | 0 | 0 | 0 | 0.034043 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
93e15bd0499fe20df4b22b6cf7e8a04bbc13785d | 286 | py | Python | src/dask_awkward/__init__.py | martindurant/dask-awkward | 67866442f3e9c0c70108322f1c960c4eb6bacb25 | [
"BSD-3-Clause"
] | null | null | null | src/dask_awkward/__init__.py | martindurant/dask-awkward | 67866442f3e9c0c70108322f1c960c4eb6bacb25 | [
"BSD-3-Clause"
] | null | null | null | src/dask_awkward/__init__.py | martindurant/dask-awkward | 67866442f3e9c0c70108322f1c960c4eb6bacb25 | [
"BSD-3-Clause"
] | null | null | null | from ._version import version # noqa
from .core import _type as type # noqa
from .core import fields, map_partitions # noqa
from .io import from_json, from_parquet # noqa
from .routines import count, count_nonzero, flatten, max, min, num, sum # noqa
__version__ = version # noqa
| 35.75 | 79 | 0.748252 | 42 | 286 | 4.857143 | 0.5 | 0.156863 | 0.117647 | 0.176471 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 286 | 7 | 80 | 40.857143 | 0.871795 | 0.101399 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.833333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
93e6d53a51a0416f830515472f8fbd43658a2170 | 1,051 | py | Python | frontpage/models.py | tuvokki/pico | 932afb64c689b396d30b7fa6f1bcf1df8958f7ec | [
"MIT"
] | null | null | null | frontpage/models.py | tuvokki/pico | 932afb64c689b396d30b7fa6f1bcf1df8958f7ec | [
"MIT"
] | null | null | null | frontpage/models.py | tuvokki/pico | 932afb64c689b396d30b7fa6f1bcf1df8958f7ec | [
"MIT"
] | null | null | null | import datetime
from django.db import models
from django.utils import timezone
class Hero(models.Model):
image = models.ImageField(upload_to='hero_images/')
head = models.CharField(max_length=200)
sub = models.CharField(max_length=200)
link = models.URLField(max_length=200)
linktext = models.CharField(max_length=200)
slot = models.CharField(max_length=1000)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.head
class IconCard(models.Model):
icon = models.CharField(max_length=200)
headline = models.CharField(max_length=200)
body = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
slot = models.CharField(max_length=2000)
def __str__(self):
return self.headline
class InfoCard(models.Model):
headline = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
slot = models.CharField(max_length=2000)
def __str__(self):
return self.headline
| 29.194444 | 55 | 0.716461 | 133 | 1,051 | 5.451128 | 0.308271 | 0.136552 | 0.248276 | 0.331034 | 0.675862 | 0.46069 | 0.347586 | 0.347586 | 0.347586 | 0.347586 | 0 | 0.04186 | 0.181732 | 1,051 | 35 | 56 | 30.028571 | 0.801163 | 0 | 0 | 0.444444 | 0 | 0 | 0.05138 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0.111111 | 1 | 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 | 1 | 1 | 0 | 0 | 4 |
9e0bcd69252aec44fb42f54e29009d0e9a1d8512 | 1,020 | py | Python | {{cookiecutter.repo_name}}/tests/test_{{cookiecutter.package_name}}.py | fengzileee/cookiecutter-py | 904a021f74b0a2185c2d8b9ec4ef742f48db0e90 | [
"BSD-2-Clause"
] | null | null | null | {{cookiecutter.repo_name}}/tests/test_{{cookiecutter.package_name}}.py | fengzileee/cookiecutter-py | 904a021f74b0a2185c2d8b9ec4ef742f48db0e90 | [
"BSD-2-Clause"
] | null | null | null | {{cookiecutter.repo_name}}/tests/test_{{cookiecutter.package_name}}.py | fengzileee/cookiecutter-py | 904a021f74b0a2185c2d8b9ec4ef742f48db0e90 | [
"BSD-2-Clause"
] | null | null | null | {%- if cookiecutter.command_line_interface == "typer" %}
from typer.testing import CliRunner
from {{ cookiecutter.package_name }}.cli import app
{%- elif cookiecutter.command_line_interface == "click" %}
from click.testing import CliRunner
{% endif %}
{%- if cookiecutter.command_line_interface not in ["no", "typer"] %}
from {{ cookiecutter.package_name }}.cli import main
{%- endif %}
def test_main():
{%- if cookiecutter.command_line_interface == "typer" %}
runner = CliRunner()
result = runner.invoke(app, ["Joe", "-a", 10])
assert "Hello, I'm Joe. I'm 10 years old." in result.output
assert result.exit_code == 0
{%- elif cookiecutter.command_line_interface == "click" %}
runner = CliRunner()
result = runner.invoke(main, [])
assert result.output == "()\n"
assert result.exit_code == 0
{%- elif cookiecutter.command_line_interface == "argparse" %}
main([])
{%- elif cookiecutter.command_line_interface == "plain" %}
assert main([]) == 0
{%- else %}
pass
{%- endif %}
| 31.875 | 68 | 0.668627 | 123 | 1,020 | 5.390244 | 0.357724 | 0.200603 | 0.242836 | 0.337858 | 0.6727 | 0.467572 | 0.171946 | 0.171946 | 0.171946 | 0.171946 | 0 | 0.008235 | 0.166667 | 1,020 | 31 | 69 | 32.903226 | 0.771765 | 0 | 0 | 0.37037 | 0 | 0 | 0.080392 | 0 | 0 | 0 | 0 | 0 | 0.185185 | 0 | null | null | 0.037037 | 0.148148 | null | null | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
9e1ba949ee7c0f50bd3ef31ed445685d3b85863d | 118 | py | Python | iris_sdk/models/maps/tier_list.py | NumberAI/python-bandwidth-iris | 0e05f79d68b244812afb97e00fd65b3f46d00aa3 | [
"MIT"
] | 2 | 2020-04-13T13:47:59.000Z | 2022-02-23T20:32:41.000Z | iris_sdk/models/maps/tier_list.py | bandwidthcom/python-bandwidth-iris | dbcb30569631395041b92917252d913166f7d3c9 | [
"MIT"
] | 5 | 2020-09-18T20:59:24.000Z | 2021-08-25T16:51:42.000Z | iris_sdk/models/maps/tier_list.py | bandwidthcom/python-bandwidth-iris | dbcb30569631395041b92917252d913166f7d3c9 | [
"MIT"
] | 5 | 2018-12-12T14:39:50.000Z | 2020-11-17T21:42:29.000Z | #!/usr/bin/env python
from iris_sdk.models.maps.base_map import BaseMap
class TierListMap(BaseMap):
tier = None | 16.857143 | 49 | 0.754237 | 18 | 118 | 4.833333 | 0.944444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144068 | 118 | 7 | 50 | 16.857143 | 0.861386 | 0.169492 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
f50ee41e1da0fad52b672e649f509a2ceb9c1545 | 147 | py | Python | formset_bootstrap/apps.py | mbourqui/django-dynamic-formset | b6242d813bc0d9d49c01016f318cef94ba58f934 | [
"BSD-3-Clause"
] | 1 | 2019-07-30T10:54:37.000Z | 2019-07-30T10:54:37.000Z | formset_bootstrap/apps.py | mbourqui/django-dynamic-formset | b6242d813bc0d9d49c01016f318cef94ba58f934 | [
"BSD-3-Clause"
] | 6 | 2018-04-05T15:31:24.000Z | 2022-03-03T13:08:28.000Z | formset_bootstrap/apps.py | mbourqui/django-dynamic-formset | b6242d813bc0d9d49c01016f318cef94ba58f934 | [
"BSD-3-Clause"
] | 3 | 2019-04-16T15:39:25.000Z | 2021-02-03T14:15:41.000Z | from django.apps import AppConfig
class FormsetBootstrapConfig(AppConfig):
name = 'formset_bootstrap'
verbose_name = "Formset Bootstrap"
| 21 | 40 | 0.77551 | 15 | 147 | 7.466667 | 0.733333 | 0.196429 | 0.357143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156463 | 147 | 6 | 41 | 24.5 | 0.903226 | 0 | 0 | 0 | 0 | 0 | 0.231293 | 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 | 1 | 0 | 0 | 4 |
f52a66656d32b2329582373eac3986281b7ebeac | 242 | py | Python | project/admin.py | feddykip/Projects-rating | d2266a9dd62b1136108ad9045cd1f751877b6594 | [
"MIT"
] | null | null | null | project/admin.py | feddykip/Projects-rating | d2266a9dd62b1136108ad9045cd1f751877b6594 | [
"MIT"
] | null | null | null | project/admin.py | feddykip/Projects-rating | d2266a9dd62b1136108ad9045cd1f751877b6594 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import UserProfile,Projects,Category,Rating
# Register your models here.
admin.site.register(UserProfile)
admin.site.register(Projects)
admin.site.register(Category)
admin.site.register(Rating)
| 24.2 | 56 | 0.826446 | 32 | 242 | 6.25 | 0.4375 | 0.18 | 0.34 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078512 | 242 | 9 | 57 | 26.888889 | 0.896861 | 0.107438 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
f53779819e8aefea949b447019350bfcca1d0ba3 | 30 | py | Python | src/pytorch_metric_learning/__init__.py | wconnell/pytorch-metric-learning | 1affee7c77bb5d6d4ee559bad62b910a21b39d48 | [
"MIT"
] | 1 | 2021-01-27T03:36:19.000Z | 2021-01-27T03:36:19.000Z | src/pytorch_metric_learning/__init__.py | nashory/pytorch-metric-learning | 1affee7c77bb5d6d4ee559bad62b910a21b39d48 | [
"MIT"
] | null | null | null | src/pytorch_metric_learning/__init__.py | nashory/pytorch-metric-learning | 1affee7c77bb5d6d4ee559bad62b910a21b39d48 | [
"MIT"
] | null | null | null | __version__ = "0.9.91.dev1"
| 7.5 | 27 | 0.633333 | 5 | 30 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0.166667 | 30 | 3 | 28 | 10 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0.392857 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
f53ea5f8167ff9808ed283c6e86277730e1ffac6 | 355 | py | Python | python/processing/resize.py | rwightman/pytorch-nips2017-adversarial | 1727494ea3bfcbc3b4754b35096e816e1269ff38 | [
"Apache-2.0"
] | 17 | 2018-02-05T15:09:01.000Z | 2022-03-15T06:27:07.000Z | processing/resize.py | alekseynp/stylegan2-pytorch | 8696ece63ca19a969a8e571964d897a4ca4398a5 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 1 | 2019-03-03T05:30:38.000Z | 2019-03-08T04:44:39.000Z | processing/resize.py | alekseynp/stylegan2-pytorch | 8696ece63ca19a969a8e571964d897a4ca4398a5 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 2 | 2019-07-26T07:17:09.000Z | 2019-10-16T03:44:02.000Z | import torch.nn as nn
class Resize(nn.Module):
def __init__(self, input_size):
super(Resize, self).__init__()
self.input_size = input_size
self.resize_layer = nn.Upsample(size=(self.input_size, self.input_size), mode='bilinear').cuda()
def forward(self, x):
resized = self.resize_layer(x)
return resized
| 27.307692 | 104 | 0.659155 | 49 | 355 | 4.469388 | 0.44898 | 0.205479 | 0.237443 | 0.155251 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.219718 | 355 | 12 | 105 | 29.583333 | 0.790614 | 0 | 0 | 0 | 0 | 0 | 0.022535 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
f55378a0e1ecda930e2dfe3e45b613f9b869a756 | 277 | py | Python | 09_numpy_cpp-custom-matrix/test.py | oldboldpilot/pybind11_examples | dcc5aa26f151013298541d28976d17579af3fe27 | [
"MIT"
] | 430 | 2017-05-31T05:02:52.000Z | 2022-03-31T09:17:20.000Z | 09_numpy_cpp-custom-matrix/test.py | oldboldpilot/pybind11_examples | dcc5aa26f151013298541d28976d17579af3fe27 | [
"MIT"
] | 6 | 2018-01-31T00:46:54.000Z | 2021-08-30T07:05:25.000Z | 09_numpy_cpp-custom-matrix/test.py | oldboldpilot/pybind11_examples | dcc5aa26f151013298541d28976d17579af3fe27 | [
"MIT"
] | 69 | 2017-09-06T03:22:12.000Z | 2022-03-31T09:17:21.000Z |
import numpy as np
import example
A = np.arange(5)
B = np.arange(5)
print(example.mul(A,B))
A = np.arange(25).reshape(5,5)
B = np.arange(25).reshape(5,5)
print(example.mul(A,B))
A = np.arange(125).reshape(5,5,5)
B = np.arange(125).reshape(5,5,5)
print(example.mul(A,B))
| 14.578947 | 33 | 0.66065 | 59 | 277 | 3.101695 | 0.237288 | 0.262295 | 0.196721 | 0.163934 | 0.743169 | 0.73224 | 0.579235 | 0.295082 | 0.295082 | 0 | 0 | 0.090535 | 0.122744 | 277 | 18 | 34 | 15.388889 | 0.662551 | 0 | 0 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.181818 | 0 | 0.181818 | 0.272727 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
f5583606875c6fc4bedf2e5806e37fe364cbe824 | 73 | py | Python | cactus/__init__.py | krallin/Cactus | cba9b096df3cb8e819b37cf9466a58eec581c381 | [
"BSD-3-Clause"
] | 2 | 2016-07-07T17:43:33.000Z | 2017-09-11T00:33:19.000Z | cactus/__init__.py | krallin/Cactus | cba9b096df3cb8e819b37cf9466a58eec581c381 | [
"BSD-3-Clause"
] | null | null | null | cactus/__init__.py | krallin/Cactus | cba9b096df3cb8e819b37cf9466a58eec581c381 | [
"BSD-3-Clause"
] | null | null | null | import socket
from cactus.site import Site
socket.setdefaulttimeout(5) | 12.166667 | 28 | 0.821918 | 10 | 73 | 6 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015625 | 0.123288 | 73 | 6 | 29 | 12.166667 | 0.921875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
f56d147332f5a282599c674635977c041e0d800e | 20 | py | Python | .idea/VirtualEnvironment/Lib/site-packages/tests/outcomes/imports/test_import_absolute_error_circular_3/main2.py | Vladpetr/NewsPortal | cd4127fbc09d9c8f5e65c8ae699856c6d380a320 | [
"Apache-2.0"
] | null | null | null | .idea/VirtualEnvironment/Lib/site-packages/tests/outcomes/imports/test_import_absolute_error_circular_3/main2.py | Vladpetr/NewsPortal | cd4127fbc09d9c8f5e65c8ae699856c6d380a320 | [
"Apache-2.0"
] | 5 | 2021-04-08T22:02:15.000Z | 2022-02-10T14:53:45.000Z | .idea/VirtualEnvironment/Lib/site-packages/tests/outcomes/imports/test_import_absolute_error_circular_3/main2.py | Vladpetr/NewsPortal | cd4127fbc09d9c8f5e65c8ae699856c6d380a320 | [
"Apache-2.0"
] | null | null | null | import main
x = 106
| 6.666667 | 11 | 0.7 | 4 | 20 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0.25 | 20 | 2 | 12 | 10 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
f57b920ec8a2132b7a747eb7ce3d844e6db94cda | 67 | py | Python | cobl/website/models.py | Bibiko/CoBL-public | 5092a0d01b7a13565c7da6bf2f6c52d648a2debe | [
"BSD-2-Clause"
] | 3 | 2017-05-30T04:40:43.000Z | 2019-04-25T14:54:54.000Z | cobl/website/models.py | Bibiko/CoBL-public | 5092a0d01b7a13565c7da6bf2f6c52d648a2debe | [
"BSD-2-Clause"
] | null | null | null | cobl/website/models.py | Bibiko/CoBL-public | 5092a0d01b7a13565c7da6bf2f6c52d648a2debe | [
"BSD-2-Clause"
] | 3 | 2018-07-02T13:42:12.000Z | 2019-05-17T13:11:13.000Z | # empty file to signal to django to treat this directory as an app
| 33.5 | 66 | 0.776119 | 13 | 67 | 4 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208955 | 67 | 1 | 67 | 67 | 0.981132 | 0.955224 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
f584c64f34175c1938a3512aed463ae82803409e | 359 | py | Python | app1/app/utils/custom_exc/__init__.py | hzjsea/fastapi-admin | 6a72e83ad967d5a33a1c9d1e861685d68bef06b1 | [
"Apache-2.0"
] | null | null | null | app1/app/utils/custom_exc/__init__.py | hzjsea/fastapi-admin | 6a72e83ad967d5a33a1c9d1e861685d68bef06b1 | [
"Apache-2.0"
] | null | null | null | app1/app/utils/custom_exc/__init__.py | hzjsea/fastapi-admin | 6a72e83ad967d5a33a1c9d1e861685d68bef06b1 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# encoding: utf-8
"""
@author: hzjsea
@file: __init__.py.py
@time: 2021/11/19 10:53 上午
"""
class PostParamsError(Exception):
def __init__(self, err_desc: str = "POST请求参数错误"):
self.err_desc = err_desc
class TokenAuthError(Exception):
def __init__(self, err_desc: str = "token认证失败"):
self.err_desc = err_desc
| 18.894737 | 53 | 0.674095 | 50 | 359 | 4.48 | 0.6 | 0.1875 | 0.196429 | 0.178571 | 0.428571 | 0.267857 | 0.267857 | 0 | 0 | 0 | 0 | 0.047782 | 0.183844 | 359 | 18 | 54 | 19.944444 | 0.716724 | 0.284123 | 0 | 0.333333 | 0 | 0 | 0.076613 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 4 |
19221219e851f2b948288ffb629a7b5e3596a73d | 82 | py | Python | starparser/__init__.py | sami-chaaban/StarParser | a55d6c5236edabb360ae555c9a7980ddce347d86 | [
"MIT"
] | 3 | 2020-11-07T07:32:49.000Z | 2021-06-16T17:03:42.000Z | starparser/__init__.py | sami-chaaban/StarParser | a55d6c5236edabb360ae555c9a7980ddce347d86 | [
"MIT"
] | null | null | null | starparser/__init__.py | sami-chaaban/StarParser | a55d6c5236edabb360ae555c9a7980ddce347d86 | [
"MIT"
] | null | null | null | import os
__version__ = '1.34'
_ROOT = os.path.abspath(os.path.dirname(__file__)) | 20.5 | 50 | 0.743902 | 13 | 82 | 4 | 0.769231 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040541 | 0.097561 | 82 | 4 | 50 | 20.5 | 0.662162 | 0 | 0 | 0 | 0 | 0 | 0.048193 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
192838412fd9400a47e04f68cb5c750623e148c3 | 231 | py | Python | api/app.py | Pupsen-Vupsen/trik-testsys-api | 75f7812500a7e601d9753d88630df593f9034edf | [
"Apache-2.0"
] | null | null | null | api/app.py | Pupsen-Vupsen/trik-testsys-api | 75f7812500a7e601d9753d88630df593f9034edf | [
"Apache-2.0"
] | null | null | null | api/app.py | Pupsen-Vupsen/trik-testsys-api | 75f7812500a7e601d9753d88630df593f9034edf | [
"Apache-2.0"
] | null | null | null | import logging
from api.config import PATH_TO_LOG
from api.loader import app
import controller
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG, filename=PATH_TO_LOG)
app.run(host="0.0.0.0", debug=True)
| 23.1 | 66 | 0.761905 | 37 | 231 | 4.432432 | 0.594595 | 0.036585 | 0.109756 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019901 | 0.12987 | 231 | 9 | 67 | 25.666667 | 0.79602 | 0 | 0 | 0 | 0 | 0 | 0.064935 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.571429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
192a1a382a19cbfb8f7e16b0fee46ea642ee86de | 73 | py | Python | python_3.8/random_examples/hello_function.py | elLui/python_tools_and_practice_v3.8 | 13b3134dd4126547b5eea200a55c43127d9bd80e | [
"MIT"
] | 1 | 2020-12-15T00:13:35.000Z | 2020-12-15T00:13:35.000Z | python_3.8/random_examples/hello_function.py | elLui/python_tools_and_practice_v3.8 | 13b3134dd4126547b5eea200a55c43127d9bd80e | [
"MIT"
] | null | null | null | python_3.8/random_examples/hello_function.py | elLui/python_tools_and_practice_v3.8 | 13b3134dd4126547b5eea200a55c43127d9bd80e | [
"MIT"
] | null | null | null | def hello(name):
print('hello ' + name)
hello('alice')
hello('bob')
| 12.166667 | 26 | 0.60274 | 10 | 73 | 4.4 | 0.6 | 0.409091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178082 | 73 | 5 | 27 | 14.6 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0.191781 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1938831701d9cf294b6e67fedb9730ef2ca5b540 | 1,611 | py | Python | codewars/7kyu/dinamuh/RotateForAMax/test_bench.py | dinamuh/Training_one | d18e8fb12608ce1753162c20252ca928c4df97ab | [
"MIT"
] | null | null | null | codewars/7kyu/dinamuh/RotateForAMax/test_bench.py | dinamuh/Training_one | d18e8fb12608ce1753162c20252ca928c4df97ab | [
"MIT"
] | 2 | 2019-01-22T10:53:42.000Z | 2019-01-31T08:02:48.000Z | codewars/7kyu/dinamuh/RotateForAMax/test_bench.py | dinamuh/Training_one | d18e8fb12608ce1753162c20252ca928c4df97ab | [
"MIT"
] | 13 | 2019-01-22T10:37:42.000Z | 2019-01-25T13:30:43.000Z | from main import max_rot
from main import max_rot2
def test(benchmark):
assert benchmark(max_rot, 38458215) == 85821534
def test2(benchmark):
assert benchmark(max_rot2, 38458215) == 85821534
'''''''''
---------------------------------------------------------------------------------- benchmark: 2 tests ----------------------------------------------------------------------------------
Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test2 4.5110 (1.0) 34.7910 (1.56) 4.8358 (1.0) 1.0444 (1.16) 4.6520 (1.0) 0.1200 (1.26) 2858;7356 206.7905 (1.0) 101041 1
test 5.5870 (1.24) 22.3630 (1.0) 5.8356 (1.21) 0.9007 (1.0) 5.6850 (1.22) 0.0950 (1.0) 1047;3482 171.3632 (0.83) 48620 1
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Legend:
Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
OPS: Operations Per Second, computed as 1 / Mean
============================================================================ 2 passed in 2.52 seconds =======
'''''
| 61.961538 | 184 | 0.331471 | 145 | 1,611 | 3.655172 | 0.558621 | 0.026415 | 0.05283 | 0.064151 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149123 | 0.221601 | 1,611 | 25 | 185 | 64.44 | 0.273525 | 0 | 0 | 0.111111 | 0 | 0.222222 | 0.866667 | 0.378816 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.111111 | false | 0.055556 | 0.111111 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
194c8b57be0c726cc0ef322e5d7695006a676a68 | 1,599 | py | Python | crawlib/__init__.py | MacHu-GWU/crawlib-project | b2963b7f6a36ee7f1ef95a6bf9d8cb746d9da991 | [
"MIT"
] | 1 | 2020-06-19T09:45:20.000Z | 2020-06-19T09:45:20.000Z | crawlib/__init__.py | MacHu-GWU/crawlib-project | b2963b7f6a36ee7f1ef95a6bf9d8cb746d9da991 | [
"MIT"
] | 1 | 2019-12-27T18:41:21.000Z | 2019-12-27T18:41:21.000Z | crawlib/__init__.py | MacHu-GWU/crawlib-project | b2963b7f6a36ee7f1ef95a6bf9d8cb746d9da991 | [
"MIT"
] | 1 | 2018-08-22T01:27:32.000Z | 2018-08-22T01:27:32.000Z | # -*- coding: utf-8 -*-
"""
tool set for crawler project.
"""
from ._version import __version__
__short_description__ = "tool set for crawler project."
__license__ = "MIT"
__author__ = "Sanhe Hu"
__author_email__ = "husanhe@gmail.com"
__github_username__ = "MacHu-GWU"
try:
import scrapy
_has_scrapy = True
except ImportError: # pragma: no cover
_has_scrapy = False
try:
from .status import Status, StatusDetail
except ImportError: # pragma: no cover
pass
try:
from .middleware.url_builder import BaseUrlBuilder
except ImportError: # pragma: no cover
pass
try:
from .decorator import resolve_arg
except ImportError: # pragma: no cover
pass
try:
from .decode import decoder
except ImportError: # pragma: no cover
pass
try:
from .entity import (
RelationshipConfig, Relationship, ParseResult,
)
except ImportError: # pragma: no cover
pass
try:
from .entity import (
MongodbEntity, MongodbEntitySingleStatus,
)
except ImportError: # pragma: no cover
pass
try:
from .entity import (
SqlEntity, SqlEntitySingleStatus, Base as SqlDeclarativeBase
)
except ImportError: # pragma: no cover
pass
try:
from .time_util import epoch, utc_now, x_seconds_before_now, x_seconds_after_now
except ImportError: # pragma: no cover
pass
try:
from .cache import create_cache, create_cache_here
from .cached_request import CachedRequest
except ImportError: # pragma: no cover
pass
try:
from . import (
exc,
)
except ImportError: # pragma: no cover
pass | 20.240506 | 84 | 0.700438 | 187 | 1,599 | 5.743316 | 0.40107 | 0.174115 | 0.235568 | 0.256052 | 0.481378 | 0.408752 | 0.377095 | 0.377095 | 0.148045 | 0.148045 | 0 | 0.00081 | 0.227642 | 1,599 | 79 | 85 | 20.240506 | 0.868826 | 0.149468 | 0 | 0.583333 | 0 | 0 | 0.04918 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0.4 | 0 | 0.4 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 4 |
194fb8a814c7ec44697fbc788f8b0820a12a7ecb | 445 | py | Python | template/agent/agents_template.py | eric8607242/OSNASLib | 43908ab454fb78f835f8a015935205179b9acec4 | [
"MIT"
] | 3 | 2021-06-14T11:00:21.000Z | 2021-10-18T02:59:54.000Z | template/agent/agents_template.py | eric8607242/OneShot_NAS_example | 2e758a9e5d9e03eecb9c4cc0e2e6a8ec38cf7052 | [
"MIT"
] | 1 | 2021-12-04T07:42:25.000Z | 2021-12-04T15:14:12.000Z | template/agent/agents_template.py | eric8607242/OneShot_NAS_example | 2e758a9e5d9e03eecb9c4cc0e2e6a8ec38cf7052 | [
"MIT"
] | null | null | null | from .training_agent import {{customize_class}}TrainingAgent
from ..base_search_agent import MetaSearchAgent
from ..base_evaluate_agent import MetaEvaluateAgent
class {{customize_class}}SearchAgent(MetaSearchAgent):
agent_state = "search"
training_agent = {{customize_class}}TrainingAgent()
class {{customize_class}}EvaluateAgent(MetaEvaluateAgent):
agent_state = "evaluate"
training_agent = {{customize_class}}TrainingAgent()
| 37.083333 | 60 | 0.8 | 45 | 445 | 7.6 | 0.333333 | 0.204678 | 0.236842 | 0.157895 | 0.233918 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103371 | 445 | 11 | 61 | 40.454545 | 0.857143 | 0 | 0 | 0.222222 | 0 | 0 | 0.031461 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
19709bf495861b3000c3dcb10b922d8b81a8878c | 9,894 | py | Python | third_party/python-peachpy/peachpy/x86_64/nacl.py | gautamkmr/caffe2 | cde7f21d1e34ec714bc08dbfab945a1ad30e92ff | [
"MIT"
] | 40 | 2021-06-01T07:37:59.000Z | 2022-03-25T01:42:09.000Z | third_party/python-peachpy/peachpy/x86_64/nacl.py | gautamkmr/caffe2 | cde7f21d1e34ec714bc08dbfab945a1ad30e92ff | [
"MIT"
] | 14 | 2021-06-01T11:52:46.000Z | 2022-03-25T02:13:08.000Z | third_party/python-peachpy/peachpy/x86_64/nacl.py | gautamkmr/caffe2 | cde7f21d1e34ec714bc08dbfab945a1ad30e92ff | [
"MIT"
] | 7 | 2021-07-20T19:34:26.000Z | 2022-03-13T21:07:36.000Z | # This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import inspect
import peachpy.stream
from peachpy.x86_64.instructions import Instruction
from peachpy.x86_64.operand import check_operand, format_operand_type, is_r32, is_imm32
# Permitted pseudo-instructions:
#
# - [rep] cmps %nacl:(%rsi),%nacl:(%rdi),%rZP (sandboxed cmps)
# mov %esi,%esi
# lea (%rZP,%rsi,1),%rsi
# mov %edi,%edi
# lea (%rZP,%rdi,1),%rdi
# [rep] cmps (%rsi),(%rdi)
#
# - [rep] movs %nacl:(%rsi),%nacl:(%rdi),%rZP (sandboxed movs)
# mov %esi,%esi
# lea (%rZP,%rsi,1),%rsi
# mov %edi,%edi
# lea (%rZP,%rdi,1),%rdi
# [rep] movs (%rsi),(%rdi)
#
# - naclasp ...,%rZP (sandboxed stack increment)
# add ...,%esp
# add %rZP,%rsp
#
# - naclcall %eXX,%rZP (sandboxed indirect call)
# and $-32, %eXX
# add %rZP, %rXX
# call *%rXX
# Note: the assembler ensures all calls (including naclcall) will end at the bundle boundary.
#
# - nacljmp %eXX,%rZP (sandboxed indirect jump)
# and $-32,%eXX
# add %rZP,%rXX
# jmp *%rXX
#
# - naclrestbp ...,%rZP (sandboxed %ebp/rbp restore)
# mov ...,%ebp
# add %rZP,%rbp
#
# - naclrestsp ...,%rZP (sandboxed %esp/rsp restore)
# mov ...,%esp
# add %rZP,%rsp
#
# - naclrestsp_noflags ...,%rZP (sandboxed %esp/rsp restore)
# mov ...,%esp
# lea (%rsp,%rZP,1),%rsp
#
# - naclspadj $N,%rZP (sandboxed %esp/rsp restore from %rbp; incudes $N offset)
# lea N(%rbp),%esp
# add %rZP,%rsp
#
# - naclssp ...,%rZP (sandboxed stack decrement)
# SUB(esp, ...)
# ADD(rZP, rsp)
#
# - [rep] scas %nacl:(%rdi),%?ax,%rZP (sandboxed stos)
# mov %edi,%edi
# lea (%rZP,%rdi,1),%rdi
# [rep] scas (%rdi),%?ax
# [rep] stos %?ax,%nacl:(%rdi),%rZP
#
# - (sandboxed stos) mov %edi,%edi
# LEA(rdi, [rZP + rdi*1])
# REP.STOS([rdi], al/ax/eax/rax)
class NACLJMP(Instruction):
"""Sandboxed Indirect Jump"""
def __init__(self, *args, **kwargs):
"""Supported forms:
* NACLJMP(r32)
"""
origin = kwargs.get("origin")
prototype = kwargs.get("prototype")
if origin is None and prototype is None and peachpy.x86_64.options.get_debug_level() > 0:
origin = inspect.stack()
super(NACLJMP, self).__init__("NACLJMP", origin=origin, prototype=prototype)
self.operands = tuple(map(check_operand, args))
if len(self.operands) != 1:
raise SyntaxError("Instruction \"NACLJMP\" requires 1 operand")
self.in_regs = (True,)
self.out_regs = (False,)
self.out_operands = (True,)
self._gas_name = "nacljmp"
if not is_r32(self.operands[0]):
raise SyntaxError("Invalid operand types: NACLJMP " + ", ".join(map(format_operand_type, self.operands)))
if peachpy.stream.active_stream is not None:
peachpy.stream.active_stream.add_instruction(self)
def _lower(self):
from peachpy.stream import InstructionStream
from peachpy.x86_64.generic import AND, ADD, JMP
from peachpy.x86_64.registers import r15
with InstructionStream() as stream:
AND(self.operands[0], -32)
ADD(self.operands[0].as_qword, r15)
JMP(self.operands[0].as_qword)
return stream.instructions
def encode(self):
import operator
return bytearray().join(map(operator.methodcaller("encode"), self._lower()))
class NACLASP(Instruction):
"""Sandboxed RSP Increment (Addition)"""
def __init__(self, *args, **kwargs):
"""Supported forms:
* NACLASP(r32)
* NACLASP(imm32)
"""
origin = kwargs.get("origin")
prototype = kwargs.get("prototype")
if origin is None and prototype is None and peachpy.x86_64.options.get_debug_level() > 0:
origin = inspect.stack()
super(NACLASP, self).__init__("NACLASP", origin=origin, prototype=prototype)
self.operands = tuple(map(check_operand, args))
if len(self.operands) != 1:
raise SyntaxError("Instruction \"NACLASP\" requires 1 operand")
self.in_regs = (True,)
self.out_regs = (False,)
self.out_operands = (True,)
self._gas_name = "naclasp"
if not is_r32(self.operands[0]) and not is_imm32(self.operands[0]):
raise SyntaxError("Invalid operand types: NACLASP" + ", ".join(map(format_operand_type, self.operands)))
if peachpy.stream.active_stream is not None:
peachpy.stream.active_stream.add_instruction(self)
def _lower(self):
from peachpy.stream import InstructionStream
from peachpy.x86_64.generic import ADD
from peachpy.x86_64.registers import esp, rsp, r15
with InstructionStream() as stream:
ADD(esp, self.operands[0])
ADD(rsp, r15)
return stream.instructions
def encode(self):
import operator
return bytearray().join(map(operator.methodcaller("encode"), self._lower()))
class NACLSSP(Instruction):
"""Sandboxed RSP Decrement (Subtraction)"""
def __init__(self, *args, **kwargs):
"""Supported forms:
* NACLSSP(r32)
* NACLSSP(imm32)
"""
origin = kwargs.get("origin")
prototype = kwargs.get("prototype")
if origin is None and prototype is None and peachpy.x86_64.options.get_debug_level() > 0:
origin = inspect.stack()
super(NACLSSP, self).__init__("NACLSSP", origin=origin, prototype=prototype)
self.operands = tuple(map(check_operand, args))
if len(self.operands) != 1:
raise SyntaxError("Instruction \"NACLSSP\" requires 1 operand")
self.in_regs = (True,)
self.out_regs = (False,)
self.out_operands = (True,)
self._gas_name = "naclssp"
if not is_r32(self.operands[0]) and not is_imm32(self.operands[0]):
raise SyntaxError("Invalid operand types: NACLSSP" + ", ".join(map(format_operand_type, self.operands)))
if peachpy.stream.active_stream is not None:
peachpy.stream.active_stream.add_instruction(self)
def _lower(self):
from peachpy.stream import InstructionStream
from peachpy.x86_64.generic import SUB, ADD
from peachpy.x86_64.registers import esp, rsp, r15
with InstructionStream() as stream:
SUB(esp, self.operands[0])
ADD(rsp, r15)
return stream.instructions
def encode(self):
import operator
return bytearray().join(map(operator.methodcaller("encode"), self._lower()))
class NACLRESTSP(Instruction):
"""Sandboxed RSP Restore"""
def __init__(self, *args, **kwargs):
"""Supported forms:
* NACLRESTSP(r32)
"""
origin = kwargs.get("origin")
prototype = kwargs.get("prototype")
if origin is None and prototype is None and peachpy.x86_64.options.get_debug_level() > 0:
origin = inspect.stack()
super(NACLRESTSP, self).__init__("NACLRESTSP", origin=origin, prototype=prototype)
self.operands = tuple(map(check_operand, args))
if len(self.operands) != 1:
raise SyntaxError("Instruction \"NACLRESTSP\" requires 1 operand")
self.in_regs = (True,)
self.out_regs = (False,)
self.out_operands = (True,)
self._gas_name = "naclrestsp"
if is_r32(self.operands[0]):
pass
else:
raise SyntaxError("Invalid operand types: NACLRESTSP " + ", ".join(map(format_operand_type, self.operands)))
if peachpy.stream.active_stream is not None:
peachpy.stream.active_stream.add_instruction(self)
def _lower(self):
from peachpy.stream import InstructionStream
from peachpy.x86_64.generic import MOV, ADD
from peachpy.x86_64.registers import esp, rsp, r15
with InstructionStream() as stream:
MOV(esp, self.operands[0])
ADD(rsp, r15)
return stream.instructions
def encode(self):
import operator
return bytearray().join(map(operator.methodcaller("encode"), self._lower()))
class NACLRESTBP(Instruction):
"""Sandboxed RBP Restore"""
def __init__(self, *args, **kwargs):
"""Supported forms:
* NACLRESTBP(r32)
"""
origin = kwargs.get("origin")
prototype = kwargs.get("prototype")
if origin is None and prototype is None and peachpy.x86_64.options.get_debug_level() > 0:
origin = inspect.stack()
super(NACLRESTBP, self).__init__("NACLRESTBP", origin=origin, prototype=prototype)
self.operands = tuple(map(check_operand, args))
if len(self.operands) != 1:
raise SyntaxError("Instruction \"NACLRESTBP\" requires 1 operand")
self.in_regs = (True,)
self.out_regs = (False,)
self.out_operands = (True,)
self._gas_name = "naclrestbp"
if is_r32(self.operands[0]):
pass
else:
raise SyntaxError("Invalid operand types: NACLRESTBP " + ", ".join(map(format_operand_type, self.operands)))
if peachpy.stream.active_stream is not None:
peachpy.stream.active_stream.add_instruction(self)
def _lower(self):
from peachpy.stream import InstructionStream
from peachpy.x86_64.generic import MOV, ADD
from peachpy.x86_64.registers import ebp, rbp, r15
with InstructionStream() as stream:
MOV(ebp, self.operands[0])
ADD(rbp, r15)
return stream.instructions
def encode(self):
import operator
return bytearray().join(map(operator.methodcaller("encode"), self._lower()))
| 36.109489 | 120 | 0.613705 | 1,183 | 9,894 | 5.008453 | 0.12426 | 0.058734 | 0.03443 | 0.032405 | 0.766414 | 0.750042 | 0.723882 | 0.686582 | 0.664304 | 0.660084 | 0 | 0.021999 | 0.255711 | 9,894 | 273 | 121 | 36.241758 | 0.782591 | 0.207297 | 0 | 0.720779 | 0 | 0 | 0.067877 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.097403 | false | 0.012987 | 0.155844 | 0 | 0.350649 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 4 |
1975b5a42eb1109583b74a3b7ce1dbaafdd526e9 | 415 | py | Python | scripts/test_DepthFunctions.py | krejov100/DepthCodec | fced6980bbdb85e28fba19ee722b6955b4bed4dc | [
"Apache-2.0"
] | 2 | 2019-12-09T22:07:33.000Z | 2022-03-06T10:41:16.000Z | scripts/test_DepthFunctions.py | krejov100/DepthCodec | fced6980bbdb85e28fba19ee722b6955b4bed4dc | [
"Apache-2.0"
] | 25 | 2018-08-13T22:28:43.000Z | 2018-09-18T16:30:20.000Z | scripts/test_DepthFunctions.py | krejov100/DepthCodec | fced6980bbdb85e28fba19ee722b6955b4bed4dc | [
"Apache-2.0"
] | null | null | null | import unittest
from DepthFunctions import F0, F1, F2, F3, function_from_id
# TODO Comment
class TestDepthFunctions(unittest.TestCase):
def test_function_from_id(self):
self.assertIsInstance(function_from_id(0), F0)
self.assertIsInstance(function_from_id(1), F1)
self.assertIsInstance(function_from_id(2), F2)
self.assertIsInstance(function_from_id(3), F3)
if __name__ == '__main__':
unittest.main() | 29.642857 | 59 | 0.785542 | 57 | 415 | 5.350877 | 0.45614 | 0.236066 | 0.27541 | 0.419672 | 0.445902 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032432 | 0.108434 | 415 | 14 | 60 | 29.642857 | 0.791892 | 0.028916 | 0 | 0 | 0 | 0 | 0.019901 | 0 | 0 | 0 | 0 | 0.071429 | 0.4 | 1 | 0.1 | false | 0 | 0.2 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2703a8eb863cb98e035328f5cfd560515e93d2e8 | 703 | py | Python | main/forms.py | TheCyberAlchemist/GIPM | 1b755aea2adb60119a9354e873de887ec7414505 | [
"MIT"
] | null | null | null | main/forms.py | TheCyberAlchemist/GIPM | 1b755aea2adb60119a9354e873de887ec7414505 | [
"MIT"
] | null | null | null | main/forms.py | TheCyberAlchemist/GIPM | 1b755aea2adb60119a9354e873de887ec7414505 | [
"MIT"
] | null | null | null | from django.forms import ModelForm
from .models import *
class add_indent(ModelForm):
class Meta:
model = indent
fields = '__all__'
exclude = ('PO','WO','item_description')
class add_PO(ModelForm):
class Meta:
model = purchase_order
fields = '__all__'
class update_PO(ModelForm):
class Meta:
model = purchase_order
fields = ['po_date',"is_complete"]
class add_WO(ModelForm):
class Meta:
model = work_order
fields = '__all__'
class add_vendor(ModelForm):
class Meta:
model = vendor_details
fields = '__all__'
class add_grn(ModelForm):
class Meta:
model = grn
fields = '__all__'
class add_assembly(ModelForm):
class Meta:
model = assembly
fields = '__all__'
| 18.5 | 42 | 0.711238 | 90 | 703 | 5.133333 | 0.322222 | 0.212121 | 0.272727 | 0.348485 | 0.190476 | 0.190476 | 0.190476 | 0.190476 | 0 | 0 | 0 | 0 | 0.182077 | 703 | 38 | 43 | 18.5 | 0.803478 | 0 | 0 | 0.483871 | 0 | 0 | 0.113636 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.064516 | 0 | 0.516129 | 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 | 1 | 0 | 0 | 4 |
27277471d64c35aaf81ff4ccd6bd601b43918b85 | 64 | py | Python | xt/util/__init__.py | ZZHsunsky/xingtian | 0484e2c968d9e6b2e5f43a3b86c0213a095ba309 | [
"MIT"
] | 1 | 2020-08-15T15:42:30.000Z | 2020-08-15T15:42:30.000Z | xt/util/__init__.py | ZZHsunsky/xingtian | 0484e2c968d9e6b2e5f43a3b86c0213a095ba309 | [
"MIT"
] | 3 | 2021-03-31T20:15:40.000Z | 2022-02-09T23:50:46.000Z | built-in/TensorFlow/Research/reinforcement-learning/ModelZoo_QMIX_TensorFlow/xt/util/__init__.py | Huawei-Ascend/modelzoo | df51ed9c1d6dbde1deef63f2a037a369f8554406 | [
"Apache-2.0"
] | null | null | null | """
util model is a set of tools to provide basic functions
"""
| 16 | 55 | 0.703125 | 11 | 64 | 4.090909 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.203125 | 64 | 3 | 56 | 21.333333 | 0.882353 | 0.859375 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.