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
068b1f15c66f69ca8359ed327b55c6c6ff17f023
622
py
Python
webapp/users/admin.py
Sollimann/momentum_web
f1fb50def9cc8cb59d2303a4b1dba580e32abbd4
[ "Apache-2.0" ]
null
null
null
webapp/users/admin.py
Sollimann/momentum_web
f1fb50def9cc8cb59d2303a4b1dba580e32abbd4
[ "Apache-2.0" ]
null
null
null
webapp/users/admin.py
Sollimann/momentum_web
f1fb50def9cc8cb59d2303a4b1dba580e32abbd4
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from .models import User, Startup, Investor, Person, Industry, Sector, Status, Job, Type, Pub_or_priv, Field, Status_interest # Register your models here. admin.site.register(Job) admin.site.register(Type) admin.site.register(User, UserAdmin) admin.site.register(Startup) admin.site.register(Investor) admin.site.register(Person) admin.site.register(Industry) admin.site.register(Sector) admin.site.register(Status) admin.site.register(Pub_or_priv) admin.site.register(Field) admin.site.register(Status_interest)
27.043478
126
0.78135
86
622
5.581395
0.302326
0.225
0.425
0.095833
0
0
0
0
0
0
0
0
0.110932
622
22
127
28.272727
0.867993
0.041801
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.2
0
0.2
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
ebf5c15155770eb9ea5b52687c468532e0fca43a
304
py
Python
metarecord/admin/_common.py
kerkkoheiskanen/helerm
bdaf801a940d42325a1076b42bb0edef831fbac9
[ "MIT" ]
null
null
null
metarecord/admin/_common.py
kerkkoheiskanen/helerm
bdaf801a940d42325a1076b42bb0edef831fbac9
[ "MIT" ]
null
null
null
metarecord/admin/_common.py
kerkkoheiskanen/helerm
bdaf801a940d42325a1076b42bb0edef831fbac9
[ "MIT" ]
null
null
null
from django.contrib import admin from metarecord.forms import UTF8HStoreField class StructuralElementAdmin(admin.ModelAdmin): def get_form(self, request, obj=None, **kwargs): kwargs['field_classes'] = {'attributes': UTF8HStoreField} return super().get_form(request, obj, **kwargs)
30.4
65
0.736842
34
304
6.5
0.705882
0.063348
0
0
0
0
0
0
0
0
0
0.007752
0.151316
304
9
66
33.777778
0.848837
0
0
0
0
0
0.075658
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.833333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
ebf5dc6136a12e72129121bc1b222eb95eb94df8
393
py
Python
metagrad/dataset.py
nlp-greyfoss/metagrad
0f32f177ced1478f0c75ad37bace9a9fc4044ba3
[ "MIT" ]
7
2022-01-27T05:38:02.000Z
2022-03-30T01:48:00.000Z
metagrad/dataset.py
nlp-greyfoss/metagrad
0f32f177ced1478f0c75ad37bace9a9fc4044ba3
[ "MIT" ]
null
null
null
metagrad/dataset.py
nlp-greyfoss/metagrad
0f32f177ced1478f0c75ad37bace9a9fc4044ba3
[ "MIT" ]
2
2022-02-22T07:47:02.000Z
2022-03-22T08:31:59.000Z
from metagrad.tensor import Tensor class Dataset: def __getitem__(self, index): return NotImplementedError class TensorDataset(Dataset): def __init__(self, *tensors: Tensor) -> None: self.tensors = tensors def __getitem__(self, index): return tuple(tensor[index] for tensor in self.tensors) def __len__(self): return len(self.tensors[0])
20.684211
62
0.679389
46
393
5.456522
0.456522
0.175299
0.111554
0.151394
0.199203
0
0
0
0
0
0
0.0033
0.229008
393
18
63
21.833333
0.825083
0
0
0.181818
0
0
0
0
0
0
0
0
0
1
0.363636
false
0
0.090909
0.272727
0.909091
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
23103d4b9a02c082342855650c49eac36f3a18fd
1,833
py
Python
.venv/Lib/site-packages/networkx/algorithms/community/tests/test_modularity_max.py
VeikkaHimmi/Graph-based-Chess
17ac9b3a04ddf8001a06062fd958b9c95b8dd0ef
[ "MIT" ]
1
2021-08-29T15:23:24.000Z
2021-08-29T15:23:24.000Z
.venv/Lib/site-packages/networkx/algorithms/community/tests/test_modularity_max.py
VeikkaHimmi/Graph-based-Chess
17ac9b3a04ddf8001a06062fd958b9c95b8dd0ef
[ "MIT" ]
25
2021-04-17T09:26:47.000Z
2022-01-02T20:06:55.000Z
.venv/Lib/site-packages/networkx/algorithms/community/tests/test_modularity_max.py
VeikkaHimmi/Graph-based-Chess
17ac9b3a04ddf8001a06062fd958b9c95b8dd0ef
[ "MIT" ]
1
2021-07-13T21:21:14.000Z
2021-07-13T21:21:14.000Z
import pytest import networkx as nx from networkx.algorithms.community import ( greedy_modularity_communities, modularity, naive_greedy_modularity_communities, ) @pytest.mark.parametrize( "func", (greedy_modularity_communities, naive_greedy_modularity_communities) ) def test_modularity_communities(func): G = nx.karate_club_graph() john_a = frozenset( [8, 14, 15, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33] ) mr_hi = frozenset([0, 4, 5, 6, 10, 11, 16, 19]) overlap = frozenset([1, 2, 3, 7, 9, 12, 13, 17, 21]) expected = {john_a, overlap, mr_hi} assert set(func(G)) == expected def test_modularity_communities_weighted(): G = nx.balanced_tree(2, 3) for (a, b) in G.edges: if ((a == 1) or (a == 2)) and (b != 0): G[a][b]["weight"] = 10.0 else: G[a][b]["weight"] = 1.0 expected = [{0, 1, 3, 4, 7, 8, 9, 10}, {2, 5, 6, 11, 12, 13, 14}] assert greedy_modularity_communities(G, weight="weight") == expected def test_resolution_parameter_impact(): G = nx.barbell_graph(5, 3) gamma = 1 expected = [frozenset(range(5)), frozenset(range(8, 13)), frozenset(range(5, 8))] assert greedy_modularity_communities(G, resolution=gamma) == expected assert naive_greedy_modularity_communities(G, resolution=gamma) == expected gamma = 2.5 expected = [{0, 1, 2, 3}, {9, 10, 11, 12}, {5, 6, 7}, {4}, {8}] assert greedy_modularity_communities(G, resolution=gamma) == expected assert naive_greedy_modularity_communities(G, resolution=gamma) == expected gamma = 0.3 expected = [frozenset(range(8)), frozenset(range(8, 13))] assert greedy_modularity_communities(G, resolution=gamma) == expected assert naive_greedy_modularity_communities(G, resolution=gamma) == expected
32.157895
85
0.651391
260
1,833
4.426923
0.315385
0.237185
0.258036
0.170287
0.35013
0.320591
0.320591
0.320591
0.320591
0.320591
0
0.082877
0.203492
1,833
56
86
32.732143
0.705479
0
0
0.142857
0
0
0.012002
0
0
0
0
0
0.190476
1
0.071429
false
0
0.071429
0
0.142857
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
232e477bf5769f97e0803fd86d3d4ff95a4a4ba3
253
py
Python
pyppeteer_stealth/navigator_languages.py
minhle2994/pyppeteer_stealth
ec3fc18f19a913608dc758ca3dbc53b78108e597
[ "MIT" ]
1
2021-03-19T06:47:45.000Z
2021-03-19T06:47:45.000Z
pyppeteer_stealth/navigator_languages.py
minhle2994/pyppeteer_stealth
ec3fc18f19a913608dc758ca3dbc53b78108e597
[ "MIT" ]
null
null
null
pyppeteer_stealth/navigator_languages.py
minhle2994/pyppeteer_stealth
ec3fc18f19a913608dc758ca3dbc53b78108e597
[ "MIT" ]
1
2021-03-16T18:29:59.000Z
2021-03-16T18:29:59.000Z
from pyppeteer.page import Page async def navigator_languages(page: Page) -> None: await page.evaluateOnNewDocument( """ () => { Object.defineProperty(navigator, 'languages', { get: () => ['en-US', 'en'] }) } """ )
18.071429
51
0.565217
23
253
6.173913
0.695652
0.253521
0
0
0
0
0
0
0
0
0
0
0.26087
253
13
52
19.461538
0.759358
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
235042c6b4d7d263aa03ae573a14b8d948cca641
5,250
py
Python
control/RobotMessages.py
oholsen/hagedag
4e2881fa1f636228e5cbe76e61fb4b224f0b1e4a
[ "Apache-2.0" ]
null
null
null
control/RobotMessages.py
oholsen/hagedag
4e2881fa1f636228e5cbe76e61fb4b224f0b1e4a
[ "Apache-2.0" ]
null
null
null
control/RobotMessages.py
oholsen/hagedag
4e2881fa1f636228e5cbe76e61fb4b224f0b1e4a
[ "Apache-2.0" ]
null
null
null
from typing import Optional import math from abc import ABC import RobotModel def to_float(s: str) -> Optional[float]: try: return float(s) except ValueError: return None def to_int(s: str) -> Optional[int]: try: return int(s) except ValueError: return None class FromRobot(ABC): pass class Time(FromRobot): def __init__(self, segments): self.time = to_float(segments[1]) def __str__(self): return f"Time({self.time})" class Ticks(FromRobot): def __init__(self, segments): self.right = to_float(segments[1]) * RobotModel.DIST_PER_TICK self.left = to_float(segments[2]) * RobotModel.DIST_PER_TICK class Speed(FromRobot): def __init__(self, segments): self.left = to_float(segments[1]) * RobotModel.DIST_PER_TICK self.right = to_float(segments[2]) * RobotModel.DIST_PER_TICK self.left_set_lp = to_float(segments[3]) * RobotModel.DIST_PER_TICK self.right_set_lp = to_float(segments[4]) * RobotModel.DIST_PER_TICK def speed(self): return (self.left + self.right) / 2 def omega(self): return (self.right - self.left) / RobotModel.WHEEL_BASE def __str__(self): return f"Speed({self.left}, {self.right})" class Power(FromRobot): def __init__(self, segments): self.left = to_float(segments[1]) self.right = to_float(segments[2]) def max(self) -> float: return max(abs(self.left), abs(self.right)) class Battery(FromRobot): def __init__(self, segments): self.voltage = float(segments[1]) def __str__(self): return f"Battery({self.voltage})" class ControlAck(FromRobot): """Ack as response from starting processing of control line""" pass class HeartbeatAck(ControlAck): def __init__(self, segments): pass def __str__(self): return "Heartbeat()" class StopAck(ControlAck): def __init__(self, segments): pass def __str__(self): return "Stop()" class ResetAck(ControlAck): def __init__(self, segments): pass def __str__(self): return "Reset()" class Status(FromRobot): STATUS_MAX_POWER = 1 def __init__(self, segments): self.status = int(segments[1]) def max_power(self) -> bool: return self.status & self.STATUS_MAX_POWER != 0 def __str__(self): return f"Status({self.status})" class Ack(FromRobot): # Ack <time> <command as interpreted by robot> def __init__(self, time: float, command: FromRobot): self.time = time self.command = command def __str__(self): return f"Ack({self.time},{self.command})" class MoveAck(FromRobot): def __init__(self, segments): self.speed = to_float(segments[1]) * RobotModel.DIST_PER_TICK self.omega = to_float(segments[2]) * RobotModel.DIST_PER_TICK / (RobotModel.WHEEL_BASE / 2) self.timeout = to_float(segments[3]) def __str__(self): return f"Move({self.speed},{self.omega},{self.timeout})" class Timeout(FromRobot): # Timeout <time> <command as interpreted by robot> def __init__(self, time: float, command: FromRobot): self.time = time self.command = command def __str__(self): return f"Timeout({self.time},{self.command})" _acks = { "m": MoveAck, ".": StopAck, "!": ResetAck, } def control(segments) -> Optional[ControlAck]: assert segments[0] == "Control" segments = segments[1:] ack = _acks.get(segments[0]) if ack is not None: return ack(segments) return None def ack(clz, segments) -> FromRobot: time = float(segments[1]) segments = segments[2:] cmd = _acks.get(segments[0]) if cmd is not None: cmd = cmd(segments) return clz(time, cmd) return None class Ignore(FromRobot): def __init__(self, segments): self.segments = segments def __str__(self): return f"Ignore({self.segments})" _sentences = { "Time": Time, "Ticks": Ticks, "Speed": Speed, "Power": Power, "Battery": Battery, "Status": Status, "Control": control, "Ack": lambda segments: ack(Ack, segments), "Timeout": lambda segments: ack(Timeout, segments), } def process(line): line = line.strip() segments = line.split() cmd = segments[0] sentence = _sentences.get(cmd, Ignore) if sentence: return sentence(segments) class RobotCommand(ABC): pass class MoveCommand(RobotCommand): def __init__(self, speed: float, omega: float, timeout: float): self.speed = speed # m/s self.omega = omega # rad/s self.timeout = timeout def __str__(self): t = self.speed / RobotModel.DIST_PER_TICK r = self.omega * (RobotModel.WHEEL_BASE / 2) / RobotModel.DIST_PER_TICK return f"m {t:.2f} {r:.2f} {self.timeout:.3f}" class StopCommand(RobotCommand): def __str__(self): return "." class ResetCommand(StopCommand): def __str__(self): return "!" class CutCommand(RobotCommand): def __init__(self, speed: float): self.speed = speed def __str__(self): return f"CUT {self.speed:.2f}"
22.340426
99
0.630476
654
5,250
4.799694
0.151376
0.050972
0.052565
0.07136
0.434533
0.336731
0.241797
0.241797
0.186684
0.152596
0
0.007562
0.244381
5,250
234
100
22.435897
0.783716
0.030667
0
0.305732
0
0
0.072638
0.035236
0
0
0
0
0.006369
1
0.248408
false
0.038217
0.025478
0.11465
0.585987
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
2358429a00876fd3b1f543278688bfd4461e8adc
143
py
Python
wsgi.py
dankolbman/stoic-auth
b76a2c7c2afeae691d195354297bca56e0bb2b5a
[ "MIT" ]
null
null
null
wsgi.py
dankolbman/stoic-auth
b76a2c7c2afeae691d195354297bca56e0bb2b5a
[ "MIT" ]
9
2017-05-02T02:41:16.000Z
2017-06-26T11:44:37.000Z
wsgi.py
dankolbman/stoic-users
b76a2c7c2afeae691d195354297bca56e0bb2b5a
[ "MIT" ]
null
null
null
import os from users import create_app app = create_app(os.getenv('FLASK_CONFIG') or 'development') if __name__ == "__main__": app.run()
17.875
60
0.72028
21
143
4.380952
0.714286
0.195652
0
0
0
0
0
0
0
0
0
0
0.153846
143
7
61
20.428571
0.760331
0
0
0
0
0
0.216783
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
23584b3b62fae5ca9662a57dfad682d88bbac0e6
16,527
py
Python
pypinksign/pypinkseed.py
bandoche/PyPinkSign
ed1609a9bfdffbfff94cebbacae0984b90c03cad
[ "MIT" ]
77
2015-06-03T15:43:13.000Z
2022-03-13T06:27:31.000Z
pypinksign/pypinkseed.py
bandoche/PyPinkSign
ed1609a9bfdffbfff94cebbacae0984b90c03cad
[ "MIT" ]
19
2015-06-04T08:47:29.000Z
2022-01-18T00:15:03.000Z
pypinksign/pypinkseed.py
bandoche/PyPinkSign
ed1609a9bfdffbfff94cebbacae0984b90c03cad
[ "MIT" ]
26
2015-06-09T04:03:21.000Z
2021-11-10T13:39:41.000Z
# coding=utf-8 import logging import struct SS0 = [ 0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124, 0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360, 0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0x08c8c0c8, 0x17071314, 0x2585a1a4, 0x0f8f838c, 0x03030300, 0x3b4b7378, 0x3b8bb3b8, 0x13031310, 0x12c2d2d0, 0x2ecee2ec, 0x30407070, 0x0c8c808c, 0x3f0f333c, 0x2888a0a8, 0x32023230, 0x1dcdd1dc, 0x36c6f2f4, 0x34447074, 0x2ccce0ec, 0x15859194, 0x0b0b0308, 0x17475354, 0x1c4c505c, 0x1b4b5358, 0x3d8db1bc, 0x01010100, 0x24042024, 0x1c0c101c, 0x33437370, 0x18889098, 0x10001010, 0x0cccc0cc, 0x32c2f2f0, 0x19c9d1d8, 0x2c0c202c, 0x27c7e3e4, 0x32427270, 0x03838380, 0x1b8b9398, 0x11c1d1d0, 0x06868284, 0x09c9c1c8, 0x20406060, 0x10405050, 0x2383a3a0, 0x2bcbe3e8, 0x0d0d010c, 0x3686b2b4, 0x1e8e929c, 0x0f4f434c, 0x3787b3b4, 0x1a4a5258, 0x06c6c2c4, 0x38487078, 0x2686a2a4, 0x12021210, 0x2f8fa3ac, 0x15c5d1d4, 0x21416160, 0x03c3c3c0, 0x3484b0b4, 0x01414140, 0x12425250, 0x3d4d717c, 0x0d8d818c, 0x08080008, 0x1f0f131c, 0x19899198, 0x00000000, 0x19091118, 0x04040004, 0x13435350, 0x37c7f3f4, 0x21c1e1e0, 0x3dcdf1fc, 0x36467274, 0x2f0f232c, 0x27072324, 0x3080b0b0, 0x0b8b8388, 0x0e0e020c, 0x2b8ba3a8, 0x2282a2a0, 0x2e4e626c, 0x13839390, 0x0d4d414c, 0x29496168, 0x3c4c707c, 0x09090108, 0x0a0a0208, 0x3f8fb3bc, 0x2fcfe3ec, 0x33c3f3f0, 0x05c5c1c4, 0x07878384, 0x14041014, 0x3ecef2fc, 0x24446064, 0x1eced2dc, 0x2e0e222c, 0x0b4b4348, 0x1a0a1218, 0x06060204, 0x21012120, 0x2b4b6368, 0x26466264, 0x02020200, 0x35c5f1f4, 0x12829290, 0x0a8a8288, 0x0c0c000c, 0x3383b3b0, 0x3e4e727c, 0x10c0d0d0, 0x3a4a7278, 0x07474344, 0x16869294, 0x25c5e1e4, 0x26062224, 0x00808080, 0x2d8da1ac, 0x1fcfd3dc, 0x2181a1a0, 0x30003030, 0x37073334, 0x2e8ea2ac, 0x36063234, 0x15051114, 0x22022220, 0x38083038, 0x34c4f0f4, 0x2787a3a4, 0x05454144, 0x0c4c404c, 0x01818180, 0x29c9e1e8, 0x04848084, 0x17879394, 0x35053134, 0x0bcbc3c8, 0x0ecec2cc, 0x3c0c303c, 0x31417170, 0x11011110, 0x07c7c3c4, 0x09898188, 0x35457174, 0x3bcbf3f8, 0x1acad2d8, 0x38c8f0f8, 0x14849094, 0x19495158, 0x02828280, 0x04c4c0c4, 0x3fcff3fc, 0x09494148, 0x39093138, 0x27476364, 0x00c0c0c0, 0x0fcfc3cc, 0x17c7d3d4, 0x3888b0b8, 0x0f0f030c, 0x0e8e828c, 0x02424240, 0x23032320, 0x11819190, 0x2c4c606c, 0x1bcbd3d8, 0x2484a0a4, 0x34043034, 0x31c1f1f0, 0x08484048, 0x02c2c2c0, 0x2f4f636c, 0x3d0d313c, 0x2d0d212c, 0x00404040, 0x3e8eb2bc, 0x3e0e323c, 0x3c8cb0bc, 0x01c1c1c0, 0x2a8aa2a8, 0x3a8ab2b8, 0x0e4e424c, 0x15455154, 0x3b0b3338, 0x1cccd0dc, 0x28486068, 0x3f4f737c, 0x1c8c909c, 0x18c8d0d8, 0x0a4a4248, 0x16465254, 0x37477374, 0x2080a0a0, 0x2dcde1ec, 0x06464244, 0x3585b1b4, 0x2b0b2328, 0x25456164, 0x3acaf2f8, 0x23c3e3e0, 0x3989b1b8, 0x3181b1b0, 0x1f8f939c, 0x1e4e525c, 0x39c9f1f8, 0x26c6e2e4, 0x3282b2b0, 0x31013130, 0x2acae2e8, 0x2d4d616c, 0x1f4f535c, 0x24c4e0e4, 0x30c0f0f0, 0x0dcdc1cc, 0x08888088, 0x16061214, 0x3a0a3238, 0x18485058, 0x14c4d0d4, 0x22426260, 0x29092128, 0x07070304, 0x33033330, 0x28c8e0e8, 0x1b0b1318, 0x05050104, 0x39497178, 0x10809090, 0x2a4a6268, 0x2a0a2228, 0x1a8a9298 ] SS1 = [ 0x38380830, 0xe828c8e0, 0x2c2d0d21, 0xa42686a2, 0xcc0fcfc3, 0xdc1eced2, 0xb03383b3, 0xb83888b0, 0xac2f8fa3, 0x60204060, 0x54154551, 0xc407c7c3, 0x44044440, 0x6c2f4f63, 0x682b4b63, 0x581b4b53, 0xc003c3c3, 0x60224262, 0x30330333, 0xb43585b1, 0x28290921, 0xa02080a0, 0xe022c2e2, 0xa42787a3, 0xd013c3d3, 0x90118191, 0x10110111, 0x04060602, 0x1c1c0c10, 0xbc3c8cb0, 0x34360632, 0x480b4b43, 0xec2fcfe3, 0x88088880, 0x6c2c4c60, 0xa82888a0, 0x14170713, 0xc404c4c0, 0x14160612, 0xf434c4f0, 0xc002c2c2, 0x44054541, 0xe021c1e1, 0xd416c6d2, 0x3c3f0f33, 0x3c3d0d31, 0x8c0e8e82, 0x98188890, 0x28280820, 0x4c0e4e42, 0xf436c6f2, 0x3c3e0e32, 0xa42585a1, 0xf839c9f1, 0x0c0d0d01, 0xdc1fcfd3, 0xd818c8d0, 0x282b0b23, 0x64264662, 0x783a4a72, 0x24270723, 0x2c2f0f23, 0xf031c1f1, 0x70324272, 0x40024242, 0xd414c4d0, 0x40014141, 0xc000c0c0, 0x70334373, 0x64274763, 0xac2c8ca0, 0x880b8b83, 0xf437c7f3, 0xac2d8da1, 0x80008080, 0x1c1f0f13, 0xc80acac2, 0x2c2c0c20, 0xa82a8aa2, 0x34340430, 0xd012c2d2, 0x080b0b03, 0xec2ecee2, 0xe829c9e1, 0x5c1d4d51, 0x94148490, 0x18180810, 0xf838c8f0, 0x54174753, 0xac2e8ea2, 0x08080800, 0xc405c5c1, 0x10130313, 0xcc0dcdc1, 0x84068682, 0xb83989b1, 0xfc3fcff3, 0x7c3d4d71, 0xc001c1c1, 0x30310131, 0xf435c5f1, 0x880a8a82, 0x682a4a62, 0xb03181b1, 0xd011c1d1, 0x20200020, 0xd417c7d3, 0x00020202, 0x20220222, 0x04040400, 0x68284860, 0x70314171, 0x04070703, 0xd81bcbd3, 0x9c1d8d91, 0x98198991, 0x60214161, 0xbc3e8eb2, 0xe426c6e2, 0x58194951, 0xdc1dcdd1, 0x50114151, 0x90108090, 0xdc1cccd0, 0x981a8a92, 0xa02383a3, 0xa82b8ba3, 0xd010c0d0, 0x80018181, 0x0c0f0f03, 0x44074743, 0x181a0a12, 0xe023c3e3, 0xec2ccce0, 0x8c0d8d81, 0xbc3f8fb3, 0x94168692, 0x783b4b73, 0x5c1c4c50, 0xa02282a2, 0xa02181a1, 0x60234363, 0x20230323, 0x4c0d4d41, 0xc808c8c0, 0x9c1e8e92, 0x9c1c8c90, 0x383a0a32, 0x0c0c0c00, 0x2c2e0e22, 0xb83a8ab2, 0x6c2e4e62, 0x9c1f8f93, 0x581a4a52, 0xf032c2f2, 0x90128292, 0xf033c3f3, 0x48094941, 0x78384870, 0xcc0cccc0, 0x14150511, 0xf83bcbf3, 0x70304070, 0x74354571, 0x7c3f4f73, 0x34350531, 0x10100010, 0x00030303, 0x64244460, 0x6c2d4d61, 0xc406c6c2, 0x74344470, 0xd415c5d1, 0xb43484b0, 0xe82acae2, 0x08090901, 0x74364672, 0x18190911, 0xfc3ecef2, 0x40004040, 0x10120212, 0xe020c0e0, 0xbc3d8db1, 0x04050501, 0xf83acaf2, 0x00010101, 0xf030c0f0, 0x282a0a22, 0x5c1e4e52, 0xa82989a1, 0x54164652, 0x40034343, 0x84058581, 0x14140410, 0x88098981, 0x981b8b93, 0xb03080b0, 0xe425c5e1, 0x48084840, 0x78394971, 0x94178793, 0xfc3cccf0, 0x1c1e0e12, 0x80028282, 0x20210121, 0x8c0c8c80, 0x181b0b13, 0x5c1f4f53, 0x74374773, 0x54144450, 0xb03282b2, 0x1c1d0d11, 0x24250521, 0x4c0f4f43, 0x00000000, 0x44064642, 0xec2dcde1, 0x58184850, 0x50124252, 0xe82bcbe3, 0x7c3e4e72, 0xd81acad2, 0xc809c9c1, 0xfc3dcdf1, 0x30300030, 0x94158591, 0x64254561, 0x3c3c0c30, 0xb43686b2, 0xe424c4e0, 0xb83b8bb3, 0x7c3c4c70, 0x0c0e0e02, 0x50104050, 0x38390931, 0x24260622, 0x30320232, 0x84048480, 0x68294961, 0x90138393, 0x34370733, 0xe427c7e3, 0x24240420, 0xa42484a0, 0xc80bcbc3, 0x50134353, 0x080a0a02, 0x84078783, 0xd819c9d1, 0x4c0c4c40, 0x80038383, 0x8c0f8f83, 0xcc0ecec2, 0x383b0b33, 0x480a4a42, 0xb43787b3 ] SS2 = [ 0xa1a82989, 0x81840585, 0xd2d416c6, 0xd3d013c3, 0x50541444, 0x111c1d0d, 0xa0ac2c8c, 0x21242505, 0x515c1d4d, 0x43400343, 0x10181808, 0x121c1e0e, 0x51501141, 0xf0fc3ccc, 0xc2c80aca, 0x63602343, 0x20282808, 0x40440444, 0x20202000, 0x919c1d8d, 0xe0e020c0, 0xe2e022c2, 0xc0c808c8, 0x13141707, 0xa1a42585, 0x838c0f8f, 0x03000303, 0x73783b4b, 0xb3b83b8b, 0x13101303, 0xd2d012c2, 0xe2ec2ece, 0x70703040, 0x808c0c8c, 0x333c3f0f, 0xa0a82888, 0x32303202, 0xd1dc1dcd, 0xf2f436c6, 0x70743444, 0xe0ec2ccc, 0x91941585, 0x03080b0b, 0x53541747, 0x505c1c4c, 0x53581b4b, 0xb1bc3d8d, 0x01000101, 0x20242404, 0x101c1c0c, 0x73703343, 0x90981888, 0x10101000, 0xc0cc0ccc, 0xf2f032c2, 0xd1d819c9, 0x202c2c0c, 0xe3e427c7, 0x72703242, 0x83800383, 0x93981b8b, 0xd1d011c1, 0x82840686, 0xc1c809c9, 0x60602040, 0x50501040, 0xa3a02383, 0xe3e82bcb, 0x010c0d0d, 0xb2b43686, 0x929c1e8e, 0x434c0f4f, 0xb3b43787, 0x52581a4a, 0xc2c406c6, 0x70783848, 0xa2a42686, 0x12101202, 0xa3ac2f8f, 0xd1d415c5, 0x61602141, 0xc3c003c3, 0xb0b43484, 0x41400141, 0x52501242, 0x717c3d4d, 0x818c0d8d, 0x00080808, 0x131c1f0f, 0x91981989, 0x00000000, 0x11181909, 0x00040404, 0x53501343, 0xf3f437c7, 0xe1e021c1, 0xf1fc3dcd, 0x72743646, 0x232c2f0f, 0x23242707, 0xb0b03080, 0x83880b8b, 0x020c0e0e, 0xa3a82b8b, 0xa2a02282, 0x626c2e4e, 0x93901383, 0x414c0d4d, 0x61682949, 0x707c3c4c, 0x01080909, 0x02080a0a, 0xb3bc3f8f, 0xe3ec2fcf, 0xf3f033c3, 0xc1c405c5, 0x83840787, 0x10141404, 0xf2fc3ece, 0x60642444, 0xd2dc1ece, 0x222c2e0e, 0x43480b4b, 0x12181a0a, 0x02040606, 0x21202101, 0x63682b4b, 0x62642646, 0x02000202, 0xf1f435c5, 0x92901282, 0x82880a8a, 0x000c0c0c, 0xb3b03383, 0x727c3e4e, 0xd0d010c0, 0x72783a4a, 0x43440747, 0x92941686, 0xe1e425c5, 0x22242606, 0x80800080, 0xa1ac2d8d, 0xd3dc1fcf, 0xa1a02181, 0x30303000, 0x33343707, 0xa2ac2e8e, 0x32343606, 0x11141505, 0x22202202, 0x30383808, 0xf0f434c4, 0xa3a42787, 0x41440545, 0x404c0c4c, 0x81800181, 0xe1e829c9, 0x80840484, 0x93941787, 0x31343505, 0xc3c80bcb, 0xc2cc0ece, 0x303c3c0c, 0x71703141, 0x11101101, 0xc3c407c7, 0x81880989, 0x71743545, 0xf3f83bcb, 0xd2d81aca, 0xf0f838c8, 0x90941484, 0x51581949, 0x82800282, 0xc0c404c4, 0xf3fc3fcf, 0x41480949, 0x31383909, 0x63642747, 0xc0c000c0, 0xc3cc0fcf, 0xd3d417c7, 0xb0b83888, 0x030c0f0f, 0x828c0e8e, 0x42400242, 0x23202303, 0x91901181, 0x606c2c4c, 0xd3d81bcb, 0xa0a42484, 0x30343404, 0xf1f031c1, 0x40480848, 0xc2c002c2, 0x636c2f4f, 0x313c3d0d, 0x212c2d0d, 0x40400040, 0xb2bc3e8e, 0x323c3e0e, 0xb0bc3c8c, 0xc1c001c1, 0xa2a82a8a, 0xb2b83a8a, 0x424c0e4e, 0x51541545, 0x33383b0b, 0xd0dc1ccc, 0x60682848, 0x737c3f4f, 0x909c1c8c, 0xd0d818c8, 0x42480a4a, 0x52541646, 0x73743747, 0xa0a02080, 0xe1ec2dcd, 0x42440646, 0xb1b43585, 0x23282b0b, 0x61642545, 0xf2f83aca, 0xe3e023c3, 0xb1b83989, 0xb1b03181, 0x939c1f8f, 0x525c1e4e, 0xf1f839c9, 0xe2e426c6, 0xb2b03282, 0x31303101, 0xe2e82aca, 0x616c2d4d, 0x535c1f4f, 0xe0e424c4, 0xf0f030c0, 0xc1cc0dcd, 0x80880888, 0x12141606, 0x32383a0a, 0x50581848, 0xd0d414c4, 0x62602242, 0x21282909, 0x03040707, 0x33303303, 0xe0e828c8, 0x13181b0b, 0x01040505, 0x71783949, 0x90901080, 0x62682a4a, 0x22282a0a, 0x92981a8a ] SS3 = [ 0x08303838, 0xc8e0e828, 0x0d212c2d, 0x86a2a426, 0xcfc3cc0f, 0xced2dc1e, 0x83b3b033, 0x88b0b838, 0x8fa3ac2f, 0x40606020, 0x45515415, 0xc7c3c407, 0x44404404, 0x4f636c2f, 0x4b63682b, 0x4b53581b, 0xc3c3c003, 0x42626022, 0x03333033, 0x85b1b435, 0x09212829, 0x80a0a020, 0xc2e2e022, 0x87a3a427, 0xc3d3d013, 0x81919011, 0x01111011, 0x06020406, 0x0c101c1c, 0x8cb0bc3c, 0x06323436, 0x4b43480b, 0xcfe3ec2f, 0x88808808, 0x4c606c2c, 0x88a0a828, 0x07131417, 0xc4c0c404, 0x06121416, 0xc4f0f434, 0xc2c2c002, 0x45414405, 0xc1e1e021, 0xc6d2d416, 0x0f333c3f, 0x0d313c3d, 0x8e828c0e, 0x88909818, 0x08202828, 0x4e424c0e, 0xc6f2f436, 0x0e323c3e, 0x85a1a425, 0xc9f1f839, 0x0d010c0d, 0xcfd3dc1f, 0xc8d0d818, 0x0b23282b, 0x46626426, 0x4a72783a, 0x07232427, 0x0f232c2f, 0xc1f1f031, 0x42727032, 0x42424002, 0xc4d0d414, 0x41414001, 0xc0c0c000, 0x43737033, 0x47636427, 0x8ca0ac2c, 0x8b83880b, 0xc7f3f437, 0x8da1ac2d, 0x80808000, 0x0f131c1f, 0xcac2c80a, 0x0c202c2c, 0x8aa2a82a, 0x04303434, 0xc2d2d012, 0x0b03080b, 0xcee2ec2e, 0xc9e1e829, 0x4d515c1d, 0x84909414, 0x08101818, 0xc8f0f838, 0x47535417, 0x8ea2ac2e, 0x08000808, 0xc5c1c405, 0x03131013, 0xcdc1cc0d, 0x86828406, 0x89b1b839, 0xcff3fc3f, 0x4d717c3d, 0xc1c1c001, 0x01313031, 0xc5f1f435, 0x8a82880a, 0x4a62682a, 0x81b1b031, 0xc1d1d011, 0x00202020, 0xc7d3d417, 0x02020002, 0x02222022, 0x04000404, 0x48606828, 0x41717031, 0x07030407, 0xcbd3d81b, 0x8d919c1d, 0x89919819, 0x41616021, 0x8eb2bc3e, 0xc6e2e426, 0x49515819, 0xcdd1dc1d, 0x41515011, 0x80909010, 0xccd0dc1c, 0x8a92981a, 0x83a3a023, 0x8ba3a82b, 0xc0d0d010, 0x81818001, 0x0f030c0f, 0x47434407, 0x0a12181a, 0xc3e3e023, 0xcce0ec2c, 0x8d818c0d, 0x8fb3bc3f, 0x86929416, 0x4b73783b, 0x4c505c1c, 0x82a2a022, 0x81a1a021, 0x43636023, 0x03232023, 0x4d414c0d, 0xc8c0c808, 0x8e929c1e, 0x8c909c1c, 0x0a32383a, 0x0c000c0c, 0x0e222c2e, 0x8ab2b83a, 0x4e626c2e, 0x8f939c1f, 0x4a52581a, 0xc2f2f032, 0x82929012, 0xc3f3f033, 0x49414809, 0x48707838, 0xccc0cc0c, 0x05111415, 0xcbf3f83b, 0x40707030, 0x45717435, 0x4f737c3f, 0x05313435, 0x00101010, 0x03030003, 0x44606424, 0x4d616c2d, 0xc6c2c406, 0x44707434, 0xc5d1d415, 0x84b0b434, 0xcae2e82a, 0x09010809, 0x46727436, 0x09111819, 0xcef2fc3e, 0x40404000, 0x02121012, 0xc0e0e020, 0x8db1bc3d, 0x05010405, 0xcaf2f83a, 0x01010001, 0xc0f0f030, 0x0a22282a, 0x4e525c1e, 0x89a1a829, 0x46525416, 0x43434003, 0x85818405, 0x04101414, 0x89818809, 0x8b93981b, 0x80b0b030, 0xc5e1e425, 0x48404808, 0x49717839, 0x87939417, 0xccf0fc3c, 0x0e121c1e, 0x82828002, 0x01212021, 0x8c808c0c, 0x0b13181b, 0x4f535c1f, 0x47737437, 0x44505414, 0x82b2b032, 0x0d111c1d, 0x05212425, 0x4f434c0f, 0x00000000, 0x46424406, 0xcde1ec2d, 0x48505818, 0x42525012, 0xcbe3e82b, 0x4e727c3e, 0xcad2d81a, 0xc9c1c809, 0xcdf1fc3d, 0x00303030, 0x85919415, 0x45616425, 0x0c303c3c, 0x86b2b436, 0xc4e0e424, 0x8bb3b83b, 0x4c707c3c, 0x0e020c0e, 0x40505010, 0x09313839, 0x06222426, 0x02323032, 0x84808404, 0x49616829, 0x83939013, 0x07333437, 0xc7e3e427, 0x04202424, 0x84a0a424, 0xcbc3c80b, 0x43535013, 0x0a02080a, 0x87838407, 0xc9d1d819, 0x4c404c0c, 0x83838003, 0x8f838c0f, 0xcec2cc0e, 0x0b33383b, 0x4a42480a, 0x87b3b437 ] KC = [ 0x9e3779b9, 0x3c6ef373, 0x78dde6e6, 0xf1bbcdcc, 0xe3779b99, 0xc6ef3733, 0x8dde6e67, 0x1bbcdccf, 0x3779b99e, 0x6ef3733c, 0xdde6e678, 0xbbcdccf1, 0x779b99e3, 0xef3733c6, 0xde6e678d, 0xbcdccf1b ] BLOCK_SIZE = 16 def long_to_bytes(dest: bytearray, dest_off: int, value: int) -> None: dest[dest_off:dest_off + 8] = struct.pack('>Q', value) def g(x: int) -> int: g_val = SS0[x & 0xff] ^ SS1[(x >> 8) & 0xff] ^ SS2[(x >> 16) & 0xff] ^ SS3[(x >> 24) & 0xff] return g_val % 0xffffffff def F(ki0: int, ki1: int, r: int) -> int: r0 = (r >> 32) % (2 ** 32) r1 = r % (2 ** 32) rd1 = phase_calc2(r0, ki0, r1, ki1) rd0 = rd1 + phase_calc1(r0, ki0, r1, ki1) return ((rd0 << 32) | (rd1 & 0xffffffff)) & 0xffffffffffffffff def phase_calc1(r0: int, ki0: int, r1: int, ki1: int) -> int: return g(g((r0 ^ ki0) ^ (r1 ^ ki1)) + (r0 ^ ki0)) % 0xffffffff def phase_calc2(r0: int, ki0: int, r1: int, ki1: int) -> int: return g(phase_calc1(r0, ki0, r1, ki1) + g((r0 ^ ki0) ^ (r1 ^ ki1))) % 0xffffffff def process_block(enc: bool, raw_key: bytes, in_data: bytes) -> bytearray: if raw_key is None: raise ValueError('raw_key required') w_key = set_key(raw_key) if len(in_data) != BLOCK_SIZE: raise ValueError('wrong size') out = bytearray(BLOCK_SIZE) left = bytes_to_long(in_data, 0) right = bytes_to_long(in_data, 8) logging.debug(f'left = ({len(hex(left)) - 2}){hex(left)}, right = ({len(hex(right)) - 2}){hex(right)}') logging.debug( f'round(i) = -1, left = ({len(hex(left)) - 2}){hex(left)}, right = ({len(hex(right)) - 2}){hex(right)}') if enc: loop = range(16) # 0 -> 15 for encryption else: loop = range(15, -1, -1) # 15 -> 0 for decryption for i in loop: nl = right k1 = struct.unpack('>I', w_key[4 * (2 * i):4 * (2 * i) + 4])[0] k2 = struct.unpack('>I', w_key[4 * (2 * i + 1):4 * (2 * i + 1) + 4])[0] rk = F(k1, k2, right) right = left ^ rk left = nl long_to_bytes(out, 0, right) long_to_bytes(out, 8, left) return out def extract_w0(val: int) -> int: return val >> 32 def extract_w1(val: int) -> int: return val % (2 ** 32) def bytes_to_long(src: bytes, offset: int) -> int: return struct.unpack('>Q', src[offset:offset + 8])[0] def rotate_right8(x: int) -> int: return ((x >> 8) ^ (x << 56)) % (2 ** 64) def rotate_left8(x: int) -> int: return ((x << 8) ^ (x >> 56)) % (2 ** 64) def set_key(raw_key: bytes) -> bytearray: logging.debug(f'raw_key = {raw_key.hex()}') key: bytearray = bytearray(16 * 8) l_lower = bytes_to_long(raw_key, 0) l_upper = bytes_to_long(raw_key, 8) key0 = extract_w0(l_lower) key1 = extract_w1(l_lower) key2 = extract_w0(l_upper) key3 = extract_w1(l_upper) for i in range(16): t0 = key0 + key2 - KC[i] t1 = key1 - key3 + KC[i] ch1 = struct.pack('>I', g(t0)) key[4 * (2 * i):4 * (2 * i) + 4] = ch1 ch2 = struct.pack('>I', g(t1)) key[4 * (2 * i + 1):4 * (2 * i + 1) + 4] = ch2 logging.debug(f'key0-4 {key0:#010x}, {key1:#010x}, {key2:#010x}, {key3:#010x} set key rount {i:02d} =' f' {ch1.hex()} - {ch2.hex()} lower = {l_lower:#018x} upper = {l_upper:#018x}') if i % 2 == 0: l_lower = rotate_right8(l_lower) key0 = extract_w0(l_lower) key1 = extract_w1(l_lower) else: l_upper = rotate_left8(l_upper) key2 = extract_w0(l_upper) key3 = extract_w1(l_upper) return key
60.98524
112
0.744479
1,598
16,527
7.650814
0.717772
0.004417
0.001963
0.00409
0.048749
0.038443
0.035171
0.035171
0.031245
0.031245
0
0.53434
0.154232
16,527
270
113
61.211111
0.340321
0.003509
0
0.044843
0
0.017937
0.024719
0
0
0
0.636137
0
0
1
0.053812
false
0
0.008969
0.03139
0.112108
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
3
235acfb9d2e5f86bf0aed67d957e07a02a87cd2a
133
py
Python
src/speechless/utils/logging.py
Exepp/SpeechLess
6e7424e979f39132650db0d7426c1e9449dc43b8
[ "MIT" ]
1
2022-03-17T14:51:41.000Z
2022-03-17T14:51:41.000Z
src/speechless/utils/logging.py
Exepp/SpeechLess
6e7424e979f39132650db0d7426c1e9449dc43b8
[ "MIT" ]
14
2021-06-23T02:27:22.000Z
2021-11-27T15:43:39.000Z
src/speechless/utils/logging.py
Exepp/SpeechLess
6e7424e979f39132650db0d7426c1e9449dc43b8
[ "MIT" ]
null
null
null
import logging NULL_LOGGER = logging.getLogger('null') NULL_LOGGER.handlers = [logging.NullHandler()] NULL_LOGGER.propagate = False
22.166667
46
0.796992
16
133
6.4375
0.5625
0.291262
0
0
0
0
0
0
0
0
0
0
0.090226
133
5
47
26.6
0.85124
0
0
0
0
0
0.030075
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
236b9e74ff38d84a0ea66dcf8bb0aaacdade30d4
365
py
Python
chatbot/ichatbot.py
squahtx/hal9000
80e13911d0cf240c786f016993cd18bb063e687f
[ "MIT" ]
null
null
null
chatbot/ichatbot.py
squahtx/hal9000
80e13911d0cf240c786f016993cd18bb063e687f
[ "MIT" ]
null
null
null
chatbot/ichatbot.py
squahtx/hal9000
80e13911d0cf240c786f016993cd18bb063e687f
[ "MIT" ]
null
null
null
from base import abstract class IChatBot(object): # Events @property def messageReceived(self): pass # Chat Bot @property @abstract def running(self): pass @property @abstract def commandSystem(self): pass @abstract def run(self): pass # Plugins @abstract def addPlugin(self, plugin): pass @abstract def removePlugin(self, plugin): pass
14.038462
37
0.717808
45
365
5.822222
0.488889
0.209924
0.145038
0
0
0
0
0
0
0
0
0
0.189041
365
25
38
14.6
0.885135
0.063014
0
0.5
0
0
0
0
0
0
0
0
0
1
0.375
false
0.375
0.0625
0
0.5
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
237caaf4c69035d44b933a9f29b4bd854279e400
6,613
py
Python
marvin.py
vrillusions/marvin-jabberbot
d4ba25184269a1569d503b9c66076aedd1d43a47
[ "MIT" ]
1
2017-09-13T14:24:30.000Z
2017-09-13T14:24:30.000Z
marvin.py
vrillusions/marvin-jabberbot
d4ba25184269a1569d503b9c66076aedd1d43a47
[ "MIT" ]
null
null
null
marvin.py
vrillusions/marvin-jabberbot
d4ba25184269a1569d503b9c66076aedd1d43a47
[ "MIT" ]
null
null
null
#!/usr/bin/env python # vim:ts=4:sw=4:expandtab:ft=python:fileencoding=utf-8 """Marvin jabber bot. A jabber bot made to play with jabber, python, etc and hopefully still be useful. @todo: use a decorator for admin commands """ #__version__ = "$Rev$" import sys sys.path.append('lib') import datetime import hashlib import os import string from random import choice from ConfigParser import ConfigParser from jabberbot import JabberBot import botcommands class MarvinJabberBot(JabberBot): """Incredible... It's even worse than I thought it would be. Source code: http://github.com/vrillusions/marvin-jabberbot""" def __init__(self, jid, password, res=None, adminjid=None): """The init function.""" if hasattr(JabberBot, '__init__'): JabberBot.__init__(self, jid, password, res) self.adminjid = adminjid def _if_admin(self, jid, command): if jid == self.adminjid: result = eval(command) return result else: return 'Not authorized' def connectCallback(self): """Called after successful connection but before processing""" # would have like to add the RegisterHandlers here but it doesn't appear to work pass def subscribe_handler(self, conn, pres): """Handles requests from users to subscribe to bot""" # for some reason this HAS to be set before the initial connection. Place the # following in the connect() function of main file # conn.RegisterHandler('presence', self.subscribe_handler, 'subscribe') jid = pres.getFrom().getStripped() self.conn.Roster.Authorize(jid) self.conn.Roster.Subscribe(jid) def unsubscribed_handler(self, conn, pres): """Handles notifications that the user has unsubscribed (removed) the bot""" # place follwoing in connect() function of main file # conn.RegisterHandler('presence', self.unsubscribed_handler, 'unsubscribed') jid = pres.getFrom().getStripped() self.conn.Roster.delItem(jid) def bot_privacy(self, mess, args): """A simplistic privacy polic (summary: nothing is logged)""" privacytext = open('etc/privacy.txt', 'r').read() return privacytext def bot_serverinfo(self, mess, args): """HIDDEN Displays information about the server.""" #version = open('/proc/version').read().strip() #loadavg = open('/proc/loadavg').read().strip() #return '%s\n\n%s' % ( version, loadavg, ) jid = mess.getFrom().getStripped() return self._if_admin(jid, 'botcommands.getServerInfo()') def bot_url(self, mess, args): """Returns a shorten form of url.""" # only process the first "word" if args == '': return "Syntax: url http://google.com" argList = [] argList = args.split() return botcommands.getShortUrl(argList[0]) def bot_length(self, mess, args): """Returns how long the specified message is.""" return len(args) def bot_md5(self, mess, args): """Returns MD5 hash in hexadecimal format.""" return hashlib.md5(args).hexdigest() def bot_lookupmd5(self, mess, args): """Attempts to lookup the value of an MD5 hash.""" return botcommands.lookupMd5(args) def bot_sha1(self, mess, args): """Returns SHA1 hash in hexadecimal format.""" return hashlib.sha1(args).hexdigest() def bot_reload(self, mess, args): """HIDDEN Reloads the bot.""" jid = mess.getFrom().getStripped() result = self._if_admin(jid, 'self.quit()') return result def bot_time(self, mess, args): """Displays current server time.""" return str(datetime.datetime.now()) + " EST/EDT" def bot_rot13(self, mess, args): """Returns passed arguments rot13'ed.""" return args.encode('rot13') def bot_whoami(self, mess, args): """Tells you your username.""" return mess.getFrom() def bot_fortune(self, mess, args): """Get a random quote.""" # taken from snakebot jabber bot fortune = os.popen('/usr/games/fortune').read() return fortune def bot_spell(self, mess, args): """Checks the spelling of a word""" return botcommands.spellCheck(args) def bot_random(self, mess, args): """Returns a random 32 character string useful for passwords""" chars = string.letters + string.digits randomOutput = '' for i in range(32): randomOutput = randomOutput + choice(chars) return randomOutput def bot_password(self, mess, args): """Similar to random command but tries to produce a pronounceable password""" vowels = 'aeiou' consonants = 'bcdfghjklmnpqrstvwxyz' numbers = string.digits randomPassword = ( choice(consonants) + choice(vowels) + choice(consonants) + choice(vowels) + choice(consonants) + choice(vowels) + choice(consonants) + choice(numbers) ) return randomPassword def bot_ascii2hex(self, mess, args): """Takes an ascii string and converts it to hexadecimal.""" return args.encode('hex') def bot_hex2ascii(self, mess, args): """Takes a hex string and converts it to ascii.""" return args.decode('hex') def bot_dbg(self, mess, args): """HIDDEN used for debugging""" jid = mess.getFrom().getStripped() self._if_admin(jid, '"True"') jid = mess.getFrom().getStripped() jidobj = mess.getFrom() #jid = 'vrillusions@gmail.com' subscribe = self.conn.Roster.getSubscription( jid) ask = self.conn.Roster.getAsk(jid) # show = self.conn.Roster.getShow(jidobj) group = self.conn.Roster.getGroups(jid) result = 'sub:%s ask:%s group:%s' % (subscribe, ask, group) #result = self.conn.Roster.getRawItem(jid) #result = self.conn.Roster.getItems() return result if __name__ == '__main__': config = ConfigParser() config.read('etc/config.ini') username = config.get('jabberbot', 'username') password = config.get('jabberbot', 'password') adminjid = config.get('jabberbot', 'adminjid') bot = MarvinJabberBot(jid=username,password=password,adminjid=adminjid) bot.serve_forever(bot.connectCallback()) # error handling is handled in serve_forever, don't think it is needed # here. At least it's not as important
35.175532
88
0.628157
784
6,613
5.227041
0.355867
0.026354
0.052709
0.027818
0.133236
0.0898
0.07223
0.053197
0.053197
0.025866
0
0.005062
0.253138
6,613
187
89
35.363636
0.824661
0.321488
0
0.089109
0
0
0.062731
0.01107
0
0
0
0.005348
0
1
0.227723
false
0.079208
0.089109
0
0.534653
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
88d833a3a567a1ecb02279a6f3d70a364d4f59be
302
py
Python
text/_cascade/formatting/viewport.py
jedhsu/text
8525b602d304ac571a629104c48703443244545c
[ "Apache-2.0" ]
null
null
null
text/_cascade/formatting/viewport.py
jedhsu/text
8525b602d304ac571a629104c48703443244545c
[ "Apache-2.0" ]
null
null
null
text/_cascade/formatting/viewport.py
jedhsu/text
8525b602d304ac571a629104c48703443244545c
[ "Apache-2.0" ]
null
null
null
from ..base import AtRule """ Viewport Area of the canvas document intends to use. """ class Viewport(AtRule): viewport_fit: property user_zoom: property orientation: property min_zoom: property height_at_viewport: type width_at_viewport: type zoom_at_viewport: type
14.380952
43
0.718543
39
302
5.333333
0.615385
0.144231
0.201923
0
0
0
0
0
0
0
0
0
0.218543
302
20
44
15.1
0.881356
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.111111
0
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
3
88e93c8b9ae0b34ff3ef98341a3972f64310c062
295
py
Python
examples/idioms/programs/173.2427-format-a-number-with-grouped-thousands.py
laowantong/paroxython
4626798a60eeaa765dbfab9e63e04030c9fcb1d0
[ "MIT" ]
31
2020-05-02T13:34:26.000Z
2021-06-06T17:25:52.000Z
examples/idioms/programs/173.2427-format-a-number-with-grouped-thousands.py
laowantong/paroxython
4626798a60eeaa765dbfab9e63e04030c9fcb1d0
[ "MIT" ]
108
2019-11-18T19:41:52.000Z
2022-03-18T13:58:17.000Z
examples/idioms/programs/173.2427-format-a-number-with-grouped-thousands.py
laowantong/paroxython
4626798a60eeaa765dbfab9e63e04030c9fcb1d0
[ "MIT" ]
4
2020-05-19T08:57:44.000Z
2020-09-21T08:53:46.000Z
"""Format a number with grouped thousands. Number will be formatted with a comma separator between every group of thousands. Source: cup """ # Implementation author: cup # Created on 2018-09-17T20:09:08.888749Z # Last modified on 2018-09-17T20:09:08.888749Z # Version 1 print("f'{1000:,}'")
21.071429
81
0.738983
46
295
4.73913
0.717391
0.055046
0.073395
0.119266
0.220183
0.220183
0.220183
0
0
0
0
0.178571
0.145763
295
13
82
22.692308
0.686508
0.871186
0
0
0
0
0.392857
0
0
0
0
0
0
1
0
true
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
3
88f4a2ea947ca50e16daec3ac4b2f5c0374005b8
199
py
Python
problem0231.py
kmarcini/Project-Euler-Python
d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3
[ "BSD-3-Clause" ]
null
null
null
problem0231.py
kmarcini/Project-Euler-Python
d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3
[ "BSD-3-Clause" ]
null
null
null
problem0231.py
kmarcini/Project-Euler-Python
d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3
[ "BSD-3-Clause" ]
null
null
null
########################### # # #231 The prime factorisation of binomial coefficients - Project Euler # https://projecteuler.net/problem=231 # # Code by Kevin Marciniak # ###########################
22.111111
71
0.542714
18
199
6
0.944444
0
0
0
0
0
0
0
0
0
0
0.034091
0.115578
199
8
72
24.875
0.579545
0.648241
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
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
88fd3f533d36eb7a8fc1a622764e12dbb3d01962
100
py
Python
problem01.py
goznauk/ProjectEuler.py
f7118bc0ced3da79a7d9b67af120ad510498798d
[ "MIT" ]
null
null
null
problem01.py
goznauk/ProjectEuler.py
f7118bc0ced3da79a7d9b67af120ad510498798d
[ "MIT" ]
null
null
null
problem01.py
goznauk/ProjectEuler.py
f7118bc0ced3da79a7d9b67af120ad510498798d
[ "MIT" ]
null
null
null
i = 1 sum = 0 for i in range(1000) : if i%3==0 : sum += i elif i%5==0 : sum += i print sum
8.333333
22
0.49
23
100
2.130435
0.565217
0.163265
0.204082
0
0
0
0
0
0
0
0
0.151515
0.34
100
11
23
9.090909
0.590909
0
0
0.25
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0.125
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
cc3769928efe814d68a7fb624a6a3e412219f568
1,816
py
Python
src/excision_mail/user.py
Excision-Mail/excision-cli
de747b87f0064a55c85ccb027dba82734b2f76f0
[ "0BSD" ]
1
2022-02-27T12:56:17.000Z
2022-02-27T12:56:17.000Z
src/excision_mail/user.py
Excision-Mail/excision-cli
de747b87f0064a55c85ccb027dba82734b2f76f0
[ "0BSD" ]
null
null
null
src/excision_mail/user.py
Excision-Mail/excision-cli
de747b87f0064a55c85ccb027dba82734b2f76f0
[ "0BSD" ]
null
null
null
import typing from .UserManager import UserManager, UStat from .utils import get_newpass def user_add(user: str, **kwargs): um = UserManager(**kwargs) newpass = get_newpass() um.user_add(user, newpass) def user_delete(user: str, **kwargs): um = UserManager(**kwargs) um.user_delete(user) def user_disable(user: str, **kwargs): um = UserManager(**kwargs) um.user_disable(user) def user_enable(user: str, **kwargs): um = UserManager(**kwargs) um.user_enable(user) def alias_add(alias: str, **kwargs): um = UserManager(**kwargs) um.alias_add(alias) def alias_allow(user: str, alias: str, **kwargs): um = UserManager(**kwargs) um.alias_allow(user, alias) def alias_delete(alias: str, **kwargs): um = UserManager(**kwargs) um.alias_delete(alias) def alias_deny(user: str, alias: str, **kwargs): um = UserManager(**kwargs) um.alias_deny(user, alias) def alias_disable(alias: str, **kwargs): um = UserManager(**kwargs) um.alias_disable(alias) def alias_enable(alias: str, **kwargs): um = UserManager(**kwargs) um.alias_enable(alias) def change_passwd(user: str, **kwargs): um = UserManager(**kwargs) newpass = get_newpass() um.change_passwd(user, newpass) def account_info(account: str, **kwargs): um = UserManager(**kwargs) astatus = um.check_status(account) if astatus == UStat.USER: print(f'{account} is a user') elif astatus == UStat.ALIAS: print(f'{account} is an alias') elif astatus == UStat.LIST: print(f'{account} is a mailing list') elif astatus == UStat.EXTERNAL: print(f'{account} is an external user') elif astatus == UStat.ABSENT: print(f'{account} is not present') else: print(f'{account} status unknown')
22.7
49
0.655286
241
1,816
4.825726
0.174274
0.144454
0.1135
0.226999
0.484953
0.404127
0.404127
0.404127
0.16853
0.16853
0
0
0.204295
1,816
79
50
22.987342
0.804844
0
0
0.264151
0
0
0.079295
0
0
0
0
0
0
1
0.226415
false
0.113208
0.056604
0
0.283019
0.113208
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
cc82120a61f0f0a695f2d31129a87b66aa9d1ac2
206
py
Python
balebot/models/constants/errors.py
ehsanbarkhordar/reminder_bot
c72e664c71658dd2ec30bb610ffc836b53f000b9
[ "MIT" ]
24
2018-07-08T12:17:55.000Z
2022-03-05T22:00:28.000Z
balebot/models/constants/errors.py
ehsanbarkhordar/reminder_bot
c72e664c71658dd2ec30bb610ffc836b53f000b9
[ "MIT" ]
21
2018-08-30T03:18:25.000Z
2022-03-11T23:36:16.000Z
balebot/models/constants/errors.py
ehsanbarkhordar/reminder_bot
c72e664c71658dd2ec30bb610ffc836b53f000b9
[ "MIT" ]
12
2018-07-07T08:29:12.000Z
2022-03-05T22:00:05.000Z
class Error: none_or_invalid_attribute = "main attributes should have value." unacceptable_json = "json input has unacceptable format." unacceptable_object_type = "object has unacceptable type"
41.2
68
0.776699
25
206
6.16
0.72
0.194805
0
0
0
0
0
0
0
0
0
0
0.165049
206
4
69
51.5
0.895349
0
0
0
0
0
0.470874
0
0
0
0
0
0
1
0
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
0
0
0
0
0
1
0
0
3
ccc0e578dddcec14d126f92746d3992338f73482
439
py
Python
python/testbed/constant.py
LuaDist/lcms
f6473758511db915ff1762c4aa0115f5de414b3c
[ "MIT" ]
7
2017-06-03T09:01:24.000Z
2021-12-03T00:06:41.000Z
python/testbed/constant.py
LuaDist/lcms
f6473758511db915ff1762c4aa0115f5de414b3c
[ "MIT" ]
null
null
null
python/testbed/constant.py
LuaDist/lcms
f6473758511db915ff1762c4aa0115f5de414b3c
[ "MIT" ]
7
2015-06-05T06:04:40.000Z
2022-01-14T10:33:15.000Z
# # Sample: Constants # from lcms import * print "D50=", cmsD50_XYZ() print "D50=", cmsD50_xyY() Lab = cmsCIELab(70, -3, 45) print print Lab LCh = cmsCIELCh(0, 0, 0) cmsLab2LCh(LCh, Lab) print LCh Lab2 = cmsCIELab(70, 3, 45) print print Lab, Lab2 print "dE (Lab) =", cmsDeltaE(Lab, Lab2) print "dE (CIE94)=", cmsCIE94DeltaE(Lab, Lab2) print "dE (BFD) = ", cmsBFDdeltaE(Lab, Lab2) print "dE (CMC) = ", cmsCMCdeltaE(Lab, Lab2)
14.16129
46
0.651481
64
439
4.4375
0.4375
0.123239
0.169014
0.197183
0.190141
0.190141
0.190141
0
0
0
0
0.089136
0.182232
439
30
47
14.633333
0.70195
0.038724
0
0.125
0
0
0.13012
0
0
0
0
0
0
0
null
null
0
0.0625
null
null
0.6875
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
3
aea092b47560bce9d3b91ec63b9c8ac8a00dc301
211
py
Python
python/test.py
mohit2530/LawnSprinklerSystem
dbcc13ea97cf9216898518f4b4eeacb2a2e039df
[ "MIT" ]
1
2020-06-07T03:56:32.000Z
2020-06-07T03:56:32.000Z
python/test.py
mohit2530/LawnSprinklerSystem
dbcc13ea97cf9216898518f4b4eeacb2a2e039df
[ "MIT" ]
null
null
null
python/test.py
mohit2530/LawnSprinklerSystem
dbcc13ea97cf9216898518f4b4eeacb2a2e039df
[ "MIT" ]
null
null
null
import RPi.GPIO as GPIO import time channel = 21 GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(channel, GPIO.OUT) GPIO.output(channel, GPIO.HIGH) #time.sleep(5) #GPIO.output(channel, GPIO.LOW)
13.1875
31
0.748815
34
211
4.647059
0.529412
0.208861
0.21519
0.265823
0
0
0
0
0
0
0
0.016043
0.113744
211
15
32
14.066667
0.828877
0.203791
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
aea702dcc09f29b5e785fc8134dedead52170f90
145
py
Python
leimpy/__init__.py
mberz/leimpy
80783bd73685c29680ca0d173d7e247e08fde8b0
[ "MIT" ]
null
null
null
leimpy/__init__.py
mberz/leimpy
80783bd73685c29680ca0d173d7e247e08fde8b0
[ "MIT" ]
null
null
null
leimpy/__init__.py
mberz/leimpy
80783bd73685c29680ca0d173d7e247e08fde8b0
[ "MIT" ]
null
null
null
"""Top-level package for leimpy.""" __author__ = """Marco Berzborn""" __email__ = 'marco.berzborn@akustik.rwth-aachen.de' __version__ = '0.0.0'
24.166667
51
0.703448
19
145
4.736842
0.789474
0.288889
0
0
0
0
0
0
0
0
0
0.023077
0.103448
145
5
52
29
0.669231
0.2
0
0
0
0
0.509091
0.336364
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
aea9cacfd1d4f1a413d1bb430f1a08ee6761f9be
1,485
py
Python
src/Node.py
LukasTinnes/VenturePainter
cb1f24fda2a43d402a9c5a401d713af0c950270b
[ "Unlicense" ]
1
2020-05-29T21:09:33.000Z
2020-05-29T21:09:33.000Z
src/Node.py
LukasTinnes/VenturePainter
cb1f24fda2a43d402a9c5a401d713af0c950270b
[ "Unlicense" ]
3
2020-06-14T11:33:54.000Z
2022-01-13T03:31:06.000Z
src/Node.py
LukasTinnes/VenturePainter
cb1f24fda2a43d402a9c5a401d713af0c950270b
[ "Unlicense" ]
null
null
null
class Node: """ A node in a graph """ def __init__(self, identifier): """ :param identifier: Identifier is hash of given Shape Object """ self.identifier = identifier self.outgoing_pointers = [] self.incoming_pointers = [] def get_identifier(self): return self.identifier def point_to(self, identifier): """ Points to Node with the given identifier. :param identifier: :return: """ self.incoming_pointers.append(identifier) def pointed_at(self, identifier): self.outgoing_pointers.append(identifier) def has_edges(self): return len(self.incoming_pointers) > 0 or len(self.outgoing_pointers) > 0 def has_mutual_edge(self): for in_edge in self.incoming_pointers: if in_edge in self.outgoing_pointers: return True return False def search_for(self, identifier): return self.__search_for(identifier, []) def __search_for(self, identifier, exclude): if self.identifier == identifier: return self else: for node in self.incoming_pointers: if not hash(node) in exclude: exclude.append(hash(node)) ret = node.__search_for(identifier, exclude) if ret is not None: return ret def __hash__(self): return self.identifier
28.018868
81
0.584512
163
1,485
5.110429
0.282209
0.151261
0.120048
0.072029
0.120048
0
0
0
0
0
0
0.002028
0.336027
1,485
52
82
28.557692
0.842799
0.09899
0
0.0625
0
0
0
0
0
0
0
0
0
1
0.28125
false
0
0
0.125
0.5625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
aec4a874cf00905f1f3609980c64b8fe4ce94a76
245
bzl
Python
tools/rules/cu.bzl
vuanvin/pytorch
9267fd8d7395074001ad7cf2a8f28082dbff6b0b
[ "Intel" ]
5
2018-04-24T13:41:12.000Z
2019-07-09T07:32:09.000Z
tools/rules/cu.bzl
vuanvin/pytorch
9267fd8d7395074001ad7cf2a8f28082dbff6b0b
[ "Intel" ]
14
2021-10-14T06:58:50.000Z
2021-12-17T11:51:07.000Z
tools/rules/cu.bzl
vuanvin/pytorch
9267fd8d7395074001ad7cf2a8f28082dbff6b0b
[ "Intel" ]
7
2020-08-31T22:49:59.000Z
2020-09-15T14:29:07.000Z
load("@rules_cuda//cuda:defs.bzl", "cuda_library") NVCC_COPTS = ["--expt-relaxed-constexpr", "--expt-extended-lambda"] def cu_library(name, srcs, copts = [], **kwargs): cuda_library(name, srcs = srcs, copts = NVCC_COPTS + copts, **kwargs)
35
73
0.681633
33
245
4.878788
0.545455
0.136646
0.186335
0
0
0
0
0
0
0
0
0
0.118367
245
6
74
40.833333
0.74537
0
0
0
0
0
0.342857
0.293878
0
0
0
0
0
1
0.25
false
0
0
0
0.25
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
1
0
0
0
0
0
0
0
3
aeeee5a10a98fab576ba078c87f67c66ea7ad43c
58
py
Python
autocert/__init__.py
peng22/auto-cert-edited
074c54d5a75b1440f2e1eee666877748886163ca
[ "MIT" ]
9
2016-12-12T13:56:43.000Z
2021-03-06T20:33:52.000Z
autocert/__init__.py
peng22/auto-cert-edited
074c54d5a75b1440f2e1eee666877748886163ca
[ "MIT" ]
null
null
null
autocert/__init__.py
peng22/auto-cert-edited
074c54d5a75b1440f2e1eee666877748886163ca
[ "MIT" ]
3
2017-09-21T10:18:34.000Z
2020-05-28T10:48:24.000Z
default_app_config = 'autocert.apps.DjangoAutocertConfig'
29
57
0.862069
6
58
8
1
0
0
0
0
0
0
0
0
0
0
0
0.051724
58
1
58
58
0.872727
0
0
0
0
0
0.586207
0.586207
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
4e029ee2752c82978beb3774ace29901f230219c
887
py
Python
moe/tests/bandit/__init__.py
dstoeckel/MOE
5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c
[ "Apache-2.0" ]
966
2015-01-10T05:27:30.000Z
2022-03-26T21:04:36.000Z
moe/tests/bandit/__init__.py
dstoeckel/MOE
5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c
[ "Apache-2.0" ]
46
2015-01-16T22:33:08.000Z
2019-09-04T16:33:27.000Z
moe/tests/bandit/__init__.py
dstoeckel/MOE
5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c
[ "Apache-2.0" ]
143
2015-01-07T03:57:19.000Z
2022-02-28T01:10:45.000Z
# -*- coding: utf-8 -*- r"""Testing code for the (Python) bandit library. Testing is done via the Testify package: https://github.com/Yelp/Testify This package includes: * Test cases/test setup files * Tests for bandit/epsilon: :mod:`moe.tests.bandit.epsilon` * Tests for bandit/ucb: :mod:`moe.tests.bandit.ucb` * Tests for bandit/bla: :mod:`moe.tests.bandit.bla` This package includes: * Test cases/test setup files * Tests for classes and utils in :mod:`moe.bandit` **Files in this package** * :mod:`moe.tests.bandit.bandit_interface_test`: tests for :mod:`moe.bandit.interfaces.bandit_interface.BanditInterface` * :mod:`moe.tests.bandit.bandit_test_case`: base test case for bandit tests with a simple integration test case * :mod:`moe.tests.bandit.linkers_test`: tests for :mod:`moe.bandit.linkers` * :mod:`moe.tests.bandit.utils_test`: tests for :mod:`moe.bandit.utils` """
32.851852
120
0.742954
138
887
4.724638
0.333333
0.101227
0.118098
0.182515
0.334356
0.263804
0.153374
0.153374
0.153374
0.153374
0
0.001272
0.113867
887
26
121
34.115385
0.828244
0.987599
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
4e15f5b181e450626546e852845a4cbf81b6ec86
1,537
py
Python
libs/helpers.py
ggarri/mgit
50f412de8256250b9219bf68dccdfdba49f41883
[ "BSD-2-Clause" ]
null
null
null
libs/helpers.py
ggarri/mgit
50f412de8256250b9219bf68dccdfdba49f41883
[ "BSD-2-Clause" ]
13
2018-02-16T10:30:23.000Z
2021-03-25T21:45:21.000Z
libs/helpers.py
ggarri/mgit
50f412de8256250b9219bf68dccdfdba49f41883
[ "BSD-2-Clause" ]
null
null
null
import multiprocessing import traceback from multiprocessing.pool import Pool class Color(): _RED = "\033[1;31m" _BLUE = "\033[1;34m" _YELLOW = "\033[1;93m" _CYAN = "\033[1;36xm" _GREEN = "\033[0;32m" _RESET = "\033[0;0m" _BOLD = "\033[;1m" _REVERSE = "\033[;7m" @staticmethod def red(str): return Color.build(str, Color._RED) @staticmethod def green(str): return Color.build(str, Color._GREEN) @staticmethod def yellow(str): return Color.build(str, Color._YELLOW) @staticmethod def build(str, COLOR): return "%s%s%s" % (COLOR, str, Color._RESET) # Shortcut to multiprocessing's logger def error(msg, *args): return multiprocessing.get_logger().error(msg, *args) class LogExceptions(object): def __init__(self, callable): self.__callable = callable def __call__(self, *args, **kwargs): try: result = self.__callable(*args, **kwargs) except Exception as e: # Here we add some debugging help. If multiprocessing's # debugging is on, it will arrange to log the traceback error(traceback.format_exc()) # Re-raise the original exception so the Pool worker can # clean up raise # It was fine, give a normal answer return result class LoggingPool(Pool): def apply_async(self, func, args=(), kwds={}, callback=None): return Pool.apply_async(self, LogExceptions(func), args, kwds, callback)
26.964912
80
0.618738
192
1,537
4.807292
0.463542
0.043337
0.056338
0.061755
0.087757
0.087757
0
0
0
0
0
0.038087
0.265452
1,537
56
81
27.446429
0.779451
0.15745
0
0.102564
0
0
0.063665
0
0
0
0
0
0
1
0.205128
false
0
0.076923
0.153846
0.74359
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
4e3d5adf85688a5226e5acb33eb485f8354d99ba
68
py
Python
sphinx_paramlinks/__init__.py
sqlalchemyorg/sphinx-paramlinks
f68e675866b4f549a880e4a3e44da7f854fc6d7f
[ "MIT" ]
7
2019-04-18T21:26:10.000Z
2021-09-29T07:40:27.000Z
sphinx_paramlinks/__init__.py
sqlalchemyorg/sphinx-paramlinks
f68e675866b4f549a880e4a3e44da7f854fc6d7f
[ "MIT" ]
13
2019-03-04T14:45:23.000Z
2022-01-18T20:25:05.000Z
sphinx_paramlinks/__init__.py
sqlalchemyorg/sphinx-paramlinks
f68e675866b4f549a880e4a3e44da7f854fc6d7f
[ "MIT" ]
4
2019-03-02T16:22:28.000Z
2021-02-01T10:18:20.000Z
__version__ = "0.5.1" from .sphinx_paramlinks import setup # noqa
17
44
0.735294
10
68
4.5
1
0
0
0
0
0
0
0
0
0
0
0.052632
0.161765
68
3
45
22.666667
0.736842
0.058824
0
0
0
0
0.080645
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
9d8eec371082cc9063dffe5ca06657f41ba3c1ad
446
py
Python
powerline/matchers/vim.py
Tuxdude/powerline
28c1d93b4e460bbc61be852f0ccf6c5416be4faf
[ "MIT" ]
null
null
null
powerline/matchers/vim.py
Tuxdude/powerline
28c1d93b4e460bbc61be852f0ccf6c5416be4faf
[ "MIT" ]
null
null
null
powerline/matchers/vim.py
Tuxdude/powerline
28c1d93b4e460bbc61be852f0ccf6c5416be4faf
[ "MIT" ]
null
null
null
# vim:fileencoding=utf-8:noet from __future__ import absolute_import import os from powerline.bindings.vim import getbufvar def help(matcher_info): return str(getbufvar(matcher_info['bufnr'], '&buftype')) == 'help' def cmdwin(matcher_info): name = matcher_info['buffer'].name return name and os.path.basename(name) == '[Command Line]' def quickfix(matcher_info): return str(getbufvar(matcher_info['bufnr'], '&buftype')) == 'quickfix'
22.3
71
0.744395
60
446
5.35
0.5
0.205607
0.105919
0.124611
0.323988
0.323988
0.323988
0.323988
0.323988
0
0
0.002525
0.112108
446
19
72
23.473684
0.808081
0.060538
0
0
0
0
0.139089
0
0
0
0
0
0
1
0.3
false
0
0.3
0.2
0.9
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
3
9d9095023de48d4bc06f225573477bc60f8a82f6
5,648
py
Python
cal_tools/model.py
JasonCozens/CalTools
595e338faec3275481d5c0d39f95fd2783b58913
[ "BSD-2-Clause" ]
null
null
null
cal_tools/model.py
JasonCozens/CalTools
595e338faec3275481d5c0d39f95fd2783b58913
[ "BSD-2-Clause" ]
null
null
null
cal_tools/model.py
JasonCozens/CalTools
595e338faec3275481d5c0d39f95fd2783b58913
[ "BSD-2-Clause" ]
null
null
null
"""Model: A python model of RFC 5545. ===================================== """ __author__ = 'Jason' import datetime from icalendar import Calendar from icalendar import Event ARG_TYPE_INCORRECT = 'Argument should be of type {0}' REQ_PROP_MISSING = 'Required property {0} is missing' class CalendarModel(): """RFC 5545 - Section 3.4. (page 50).:: Code:: icalstream = 1*icalobject icalobject = "BEGIN" ":" "VCALENDAR" CRLF icalbody "END" ":" "VCALENDAR" CRLF icalbody = calprops component calprops = *( prodid version calscale? method? x-prop* iana-prop* ) component = 1*( eventc / todoc / journalc / freebusyc / timezonec / iana-comp / x-comp ) iana-comp = "BEGIN" ":" iana-token CRLF 1*contentline "END" ":" iana-token CRLF x-comp = "BEGIN" ":" x-name CRLF 1*contentline "END" ":" x-name CRLF """ def __init__(self, calendar): """ :param calendar: :return: None """ if not isinstance(calendar, Calendar): raise AssertionError(ARG_TYPE_INCORRECT.format(Calendar)) if not 'PRODID' in calendar.keys(): raise AssertionError(REQ_PROP_MISSING.format('PRODID')) if not 'VERSION' in calendar.keys(): raise AssertionError(REQ_PROP_MISSING.format('VERSION')) class EventModel(): def __init__(self, event): assert isinstance(event, Event),\ 'event is not of type {0}'.format(Event) self._uid = None self._time_stamp = None self._end = None self._duration = None self._from_event(event) def _from_event(self, event): assert 'uid' in event.keys(), REQ_PROP_MISSING.format('uid') @property def uid(self): """ :return: """ assert self._uid is not None @property def time_stamp(self): """dtstamp :return: """ assert type(self._time_stamp) is datetime.datetime @property def start(self): """start :return: datetime """ pass @property def event_class(self): """ :return: """ pass @property def created(self): """ :return: """ pass @property def description(self): """ :return: """ pass @property def geo(self): """ :return: """ pass @property def last_mod(self): """ :return: """ pass @property def location(self): """ :return: """ pass @property def organizer(self): """ :return: """ pass @property def priority(self): """ :return: """ pass @property def seq(self): """ :return: """ pass @property def status(self): """ :return: """ pass @property def summary(self): """ :return: """ pass @property def transp(self): """ :return: """ pass @property def url(self): """ :return: """ pass @property def recur_id(self): """ :return: """ pass @property def recurrence_rule(self): """rrule :return: <TODO> """ pass @property def end(self): """dtend :return: <TODO> """ assert self._end is None or self._duration is None @property def duration(self): """duration :return: <TODO> """ assert self._end is None or self._duration is None @property def attach(self): """rrule :return: <TODO> """ return [] @property def attendee(self): """rrule :return: <TODO> """ return [] @property def categories(self): """rrule :return: <TODO> """ return [] @property def comment(self): """rrule :return: <TODO> """ return [] @property def contact(self): """rrule :return: <TODO> """ return [] @property def exclude_dates(self): """rrule :return: <TODO> """ return [] @property def rs_status(self): """rrule :return: <TODO> """ return [] @property def related(self): """rrule :return: <TODO> """ return [] @property def resources(self): """rrule :return: <TODO> """ return [] @property def r_date(self): """rrule :return: <TODO> """ return [] @property def x_prop(self): """rrule :return: <TODO> """ return [] @property def iana_prop(self): """rrule :return: <TODO> """ return []
16.660767
69
0.424929
465
5,648
5.053763
0.249462
0.149787
0.102128
0.131064
0.42766
0.278723
0.264681
0.09617
0.09617
0.051064
0
0.006153
0.453258
5,648
339
70
16.660767
0.754858
0.277975
0
0.512397
0
0
0.038691
0
0
0
0
0.047198
0.07438
1
0.289256
false
0.132231
0.024793
0
0.429752
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
1
0
0
0
0
0
3
9dbf6549817cbb8a91095d7ff0194305d6aaaedc
224
py
Python
tests/test_model.py
Markovvn1/swipio-file-storage
1eeb031f8afcbbf4056e35bda9ef7799c232724b
[ "Apache-2.0" ]
29
2021-09-25T15:47:45.000Z
2022-03-16T11:50:46.000Z
tests/test_model.py
Markovvn1/swipio-file-storage
1eeb031f8afcbbf4056e35bda9ef7799c232724b
[ "Apache-2.0" ]
null
null
null
tests/test_model.py
Markovvn1/swipio-file-storage
1eeb031f8afcbbf4056e35bda9ef7799c232724b
[ "Apache-2.0" ]
null
null
null
from file_storage.model import Model def test_user(model: Model): model.create_user('test01', 'kjhni3j') assert model.get_user_id('test01', 'kjhni3j') == 1 assert model.get_user_id('test01', 'kjhni3u') is None
28
57
0.714286
33
224
4.636364
0.545455
0.130719
0.183007
0.235294
0.339869
0.339869
0
0
0
0
0
0.052356
0.147321
224
7
58
32
0.748691
0
0
0
0
0
0.174107
0
0
0
0
0
0.4
1
0.2
false
0
0.2
0
0.4
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
9de34d9d02eaee4a8df729e621c7664b95353d4e
1,641
py
Python
scripts/tflite_model_tools/tflite/HardSwishOptions.py
LaudateCorpus1/edgeai-tidl-tools
d98789769a711e5a3700dfdc20d877073bd87da7
[ "CNRI-Python" ]
15
2021-09-05T03:43:54.000Z
2022-03-29T14:17:29.000Z
scripts/tflite_model_tools/tflite/HardSwishOptions.py
LaudateCorpus1/edgeai-tidl-tools
d98789769a711e5a3700dfdc20d877073bd87da7
[ "CNRI-Python" ]
21
2021-09-01T06:58:31.000Z
2022-03-31T06:33:15.000Z
scripts/tflite_model_tools/tflite/HardSwishOptions.py
LaudateCorpus1/edgeai-tidl-tools
d98789769a711e5a3700dfdc20d877073bd87da7
[ "CNRI-Python" ]
6
2021-09-22T06:44:19.000Z
2022-02-07T06:28:35.000Z
# automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class HardSwishOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAsHardSwishOptions(cls, buf, offset): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) x = HardSwishOptions() x.Init(buf, n + offset) return x @classmethod def HardSwishOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) # HardSwishOptions def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) def HardSwishOptionsStart(builder): builder.StartObject(0) def HardSwishOptionsEnd(builder): return builder.EndObject() class HardSwishOptionsT(object): # HardSwishOptionsT def __init__(self): pass @classmethod def InitFromBuf(cls, buf, pos): hardSwishOptions = HardSwishOptions() hardSwishOptions.Init(buf, pos) return cls.InitFromObj(hardSwishOptions) @classmethod def InitFromObj(cls, hardSwishOptions): x = HardSwishOptionsT() x._UnPack(hardSwishOptions) return x # HardSwishOptionsT def _UnPack(self, hardSwishOptions): if hardSwishOptions is None: return # HardSwishOptionsT def Pack(self, builder): HardSwishOptionsStart(builder) hardSwishOptions = HardSwishOptionsEnd(builder) return hardSwishOptions
27.813559
114
0.701402
158
1,641
7.177215
0.405063
0.049383
0.021164
0
0
0
0
0
0
0
0
0.006216
0.215722
1,641
58
115
28.293103
0.874903
0.094455
0
0.157895
1
0
0.013523
0
0
0
0
0
0
1
0.263158
false
0.026316
0.078947
0.052632
0.578947
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
9df120bc9804daf1d86484050a366b8a48b201ef
23
py
Python
MetaScreener/external_sw/mgltools/MGLToolsPckgs/Support/version.py
bio-hpc/metascreener
6900497629f601c4b6c0c37da26de58ffa221988
[ "Apache-2.0" ]
8
2021-12-14T21:30:01.000Z
2022-02-14T11:30:03.000Z
MetaScreener/external_sw/mgltools/MGLToolsPckgs/Support/version.py
bio-hpc/metascreener
6900497629f601c4b6c0c37da26de58ffa221988
[ "Apache-2.0" ]
null
null
null
MetaScreener/external_sw/mgltools/MGLToolsPckgs/Support/version.py
bio-hpc/metascreener
6900497629f601c4b6c0c37da26de58ffa221988
[ "Apache-2.0" ]
null
null
null
__version__ = 'latest'
11.5
22
0.73913
2
23
6.5
1
0
0
0
0
0
0
0
0
0
0
0
0.130435
23
1
23
23
0.65
0
0
0
0
0
0.26087
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d192d36a7c59bab97ec409aa7728d0bc8b73b447
745
py
Python
test/ackermann/test_local_ackermann_recursive.py
inesucrvenom/mathfun
00ad69530c0e49ed4d3ed3687c50f2dff225a919
[ "MIT" ]
null
null
null
test/ackermann/test_local_ackermann_recursive.py
inesucrvenom/mathfun
00ad69530c0e49ed4d3ed3687c50f2dff225a919
[ "MIT" ]
null
null
null
test/ackermann/test_local_ackermann_recursive.py
inesucrvenom/mathfun
00ad69530c0e49ed4d3ed3687c50f2dff225a919
[ "MIT" ]
null
null
null
import unittest from src.lambda_ackermann_recursive import ackermann import test.ackermann.basetests_ackermann as BT def call_function(a: int, b: int) -> int: return ackermann(a, b) class Test_ValidInput(unittest.TestCase, BT.ValidInput): def base_function(self, a, b): return call_function(a, b) class Test_ExceptionHandling(unittest.TestCase, BT.ExceptionHandling): def base_function(self, a, b): return call_function(a, b) class Test_RunningTime(unittest.TestCase): def test_time(self): self.assertNotIsInstance(call_function(3, 4), Exception) def test_recursion_error(self): with self.assertRaises(Exception): call_function(4, 3) if __name__ == "__main__": unittest.main()
24.032258
70
0.731544
98
745
5.316327
0.377551
0.115163
0.074856
0.06334
0.191939
0.191939
0.191939
0.191939
0.191939
0.191939
0
0.006462
0.169128
745
31
71
24.032258
0.835218
0
0
0.222222
0
0
0.010724
0
0
0
0
0
0.111111
1
0.277778
false
0
0.166667
0.166667
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
d1947d0b30da14be76b47d655c34c7362ffcb907
764
py
Python
opps/articles/search_indexes.py
jeanmask/opps
031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87
[ "MIT" ]
159
2015-01-03T16:36:35.000Z
2022-03-29T20:50:13.000Z
opps/articles/search_indexes.py
jeanmask/opps
031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87
[ "MIT" ]
81
2015-01-02T21:26:16.000Z
2021-05-29T12:24:52.000Z
opps/articles/search_indexes.py
jeanmask/opps
031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87
[ "MIT" ]
75
2015-01-23T13:41:03.000Z
2021-09-24T03:45:23.000Z
# -*- coding: utf-8 -*- from datetime import datetime from django.conf import settings from haystack.indexes import Indexable from opps.containers.search_indexes import ContainerIndex from .models import Post, Album, Link migration_date = getattr(settings, 'MIGRATION_DATE', None) if migration_date: m_date = datetime.strptime(migration_date, "%Y-%m-%d").date() Post.is_legacy = lambda self: m_date >= self.date_insert.date() else: Post.is_legacy = lambda self: False class PostIndex(ContainerIndex, Indexable): def get_model(self): return Post class AlbumIndex(ContainerIndex, Indexable): def get_model(self): return Album class LinkIndex(ContainerIndex, Indexable): def get_model(self): return Link
20.648649
67
0.727749
98
764
5.540816
0.44898
0.095764
0.143646
0.160221
0.324125
0.243094
0.243094
0
0
0
0
0.00159
0.176702
764
36
68
21.222222
0.861685
0.027487
0
0.15
0
0
0.02969
0
0
0
0
0
0
1
0.15
false
0
0.25
0.15
0.7
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
3
d1bf5602426fbfd5e2db0c13f44a79d66ea7155c
299
py
Python
hackerrank/Algorithms/Fair Rations/test.py
ATrain951/01.python-com_Qproject
c164dd093954d006538020bdf2e59e716b24d67c
[ "MIT" ]
4
2020-07-24T01:59:50.000Z
2021-07-24T15:14:08.000Z
hackerrank/Algorithms/Fair Rations/test.py
ATrain951/01.python-com_Qproject
c164dd093954d006538020bdf2e59e716b24d67c
[ "MIT" ]
null
null
null
hackerrank/Algorithms/Fair Rations/test.py
ATrain951/01.python-com_Qproject
c164dd093954d006538020bdf2e59e716b24d67c
[ "MIT" ]
null
null
null
import unittest import solution class TestQ(unittest.TestCase): def test_case_0(self): self.assertEqual(solution.fairRations([2, 3, 4, 5, 6]), 4) def test_case_1(self): self.assertEqual(solution.fairRations([1, 2]), 'NO') if __name__ == '__main__': unittest.main()
18.6875
66
0.662207
40
299
4.65
0.575
0.075269
0.11828
0.290323
0.408602
0
0
0
0
0
0
0.041494
0.19398
299
15
67
19.933333
0.73029
0
0
0
0
0
0.033445
0
0
0
0
0
0.222222
1
0.222222
false
0
0.222222
0
0.555556
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
d1c493bae01750d219a4f02a0d2ddf3e9e06f54b
758
py
Python
examples.py
CITGuru/cssjson
b51d3384642e0ec8625ff4e790a523cb848a25e7
[ "MIT" ]
4
2019-04-04T01:26:04.000Z
2021-11-22T23:35:07.000Z
examples.py
CITGuru/cssjson
b51d3384642e0ec8625ff4e790a523cb848a25e7
[ "MIT" ]
null
null
null
examples.py
CITGuru/cssjson
b51d3384642e0ec8625ff4e790a523cb848a25e7
[ "MIT" ]
null
null
null
from cssjson import toJSON, toCSS css = toJSON("example.css", path=True) # print(css) # json = toCSS({'rules': {u'.morris-hover.morris-default-style .morris-hover-row-label': {'attr': {u'font-weight': u'bold', u'margin': u'0.25em 0'}}, u'.morris-hover.morris-default-style': {'attr': {u'border-radius': u'10px', u'font-size': u'12px', u'color': u'#666', u'padding': u'6px', u'background': u'rgba(255, 255, 255, 0.8)', u'font-family': u'sans-serif', u'border': u'solid 2px rgba(230, 230, 230, 0.8)', u'text-align': u'center'}}, u'.morris-hover': {'attr': {u'position': u'absolute', u'z-index': u'1000'}}, u'.morris-hover.morris-default-style .morris-hover-point': {'attr': {u'white-space': u'nowrap', u'margin': u'0.1em 0'}}}}) json = toCSS(css) print(json)
94.75
640
0.649077
133
758
3.699248
0.43609
0.134146
0.097561
0.109756
0.227642
0.227642
0.166667
0.166667
0
0
0
0.06087
0.08971
758
7
641
108.285714
0.652174
0.854881
0
0
0
0
0.103774
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.25
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d1c8dafbcabaaad009617c7bbf6e5775e7e7e702
1,199
py
Python
flaskd3/domains/repositoryif/data_source_repository.py
hohihohi/flask_ddd_sample
34bd1af4614577be0a6b410250f2d58d2c6f3b93
[ "MIT" ]
null
null
null
flaskd3/domains/repositoryif/data_source_repository.py
hohihohi/flask_ddd_sample
34bd1af4614577be0a6b410250f2d58d2c6f3b93
[ "MIT" ]
null
null
null
flaskd3/domains/repositoryif/data_source_repository.py
hohihohi/flask_ddd_sample
34bd1af4614577be0a6b410250f2d58d2c6f3b93
[ "MIT" ]
null
null
null
from abc import ABCMeta, abstractmethod # NOTE: domain service concern with domain and business logic, so call them and has responsibility. class DataSourceRepositoryIF(metaclass=ABCMeta): # find data source by id from database. This method should return data source object or None @abstractmethod def find_by_id(self, id): pass # find data source by name from database. This method should return data source object or None @abstractmethod def find_by_name(self, name): pass # find data sources by user id from database. This method should return data sources object or None @abstractmethod def find_by_user_id(self, user_id): pass # save data source to database. This method should return saved data source object or error @abstractmethod def save(self, data_source): pass # delete data source from database. This method should return deleted data source object or error @abstractmethod def delete(self, data_source): pass # update data source to database. This method should return updated data source object or error @abstractmethod def update(self, data_source): pass
34.257143
103
0.723937
165
1,199
5.193939
0.290909
0.151692
0.126021
0.168028
0.551925
0.551925
0.512252
0.331389
0.184364
0.184364
0
0
0.233528
1,199
34
104
35.264706
0.932535
0.549625
0
0.6
0
0
0
0
0
0
0
0
0
1
0.3
false
0.3
0.05
0
0.4
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
d1da50bbe125aec03fdc0a745255737e832493a4
1,332
py
Python
musictools.py
kenmurrell/AraAraBot
5d2845967ba6ab2fe946dcc9d70253e85899aee6
[ "MIT" ]
null
null
null
musictools.py
kenmurrell/AraAraBot
5d2845967ba6ab2fe946dcc9d70253e85899aee6
[ "MIT" ]
null
null
null
musictools.py
kenmurrell/AraAraBot
5d2845967ba6ab2fe946dcc9d70253e85899aee6
[ "MIT" ]
null
null
null
import os from datetime import timedelta from typing import Any class Track(object): def __init__(self, id: str, title: str, url: str, duration: Any, filename: str): self.id = id self.title = title self.url = url self.duration = int(duration) self.filename = filename def details(self): return "({duration})({id})[{title}](url={url})".format( duration=timedelta(seconds=self.duration), id=self.id, title=self.title, url=self.url).encode("utf-8") def prettify(self): return "({duration})[{title}]".format( duration=timedelta(seconds=self.duration), title=self.title).encode("utf-8") def is_available(self): return os.path.isfile(self.filename) class Skip(object): def __init__(self, limit=1): self.limit = limit self.register = set() def add(self, user) -> bool: if user in self.register: return False else: self.register.add(user) return True def clear(self): self.register.clear() def ready(self) -> bool: return len(self.register) >= self.limit def status(self): return "{votes} votes, {limit} needed".format(votes=len(self.register), limit=self.limit)
25.615385
97
0.583333
162
1,332
4.740741
0.314815
0.09375
0.033854
0.044271
0.109375
0.109375
0
0
0
0
0
0.003148
0.284535
1,332
51
98
26.117647
0.802728
0
0
0.052632
0
0
0.073574
0.044294
0
0
0
0
0
1
0.236842
false
0
0.078947
0.131579
0.552632
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
d1f0f3eeb92af56dee61c16766f1a1722f0deeae
298
py
Python
src/badgr/datasets/dataset.py
KaiW-53/badgr
6184302f156a7bc624af57b2521b1e89ffd6523d
[ "MIT" ]
110
2020-02-14T05:25:08.000Z
2022-03-15T07:40:52.000Z
src/badgr/datasets/dataset.py
KaiW-53/badgr
6184302f156a7bc624af57b2521b1e89ffd6523d
[ "MIT" ]
15
2020-03-12T12:49:54.000Z
2022-03-12T00:14:51.000Z
src/badgr/datasets/dataset.py
KaiW-53/badgr
6184302f156a7bc624af57b2521b1e89ffd6523d
[ "MIT" ]
38
2020-02-21T02:32:40.000Z
2022-02-28T17:54:56.000Z
class Dataset(object): def __init__(self, env_spec): self._env_spec = env_spec def get_batch(self, batch_size, horizon): raise NotImplementedError def get_batch_iterator(self, batch_size, horizon, randomize_order=False, is_tf=True): raise NotImplementedError
27.090909
89
0.718121
38
298
5.236842
0.552632
0.105528
0.110553
0.201005
0
0
0
0
0
0
0
0
0.204698
298
10
90
29.8
0.839662
0
0
0.285714
0
0
0
0
0
0
0
0
0
1
0.428571
false
0
0
0
0.571429
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
d1fa1f600828ea34160aee8b2f390239887cb5dc
87
py
Python
hu_wiwi_grades/__init__.py
NDelventhal/hu_wiwi_grades
b66290a604697d615da07c1b75d9f97df9b97bd1
[ "MIT" ]
1
2020-10-28T17:15:20.000Z
2020-10-28T17:15:20.000Z
hu_wiwi_grades/__init__.py
NDelventhal/hu_wiwi_grades
b66290a604697d615da07c1b75d9f97df9b97bd1
[ "MIT" ]
null
null
null
hu_wiwi_grades/__init__.py
NDelventhal/hu_wiwi_grades
b66290a604697d615da07c1b75d9f97df9b97bd1
[ "MIT" ]
null
null
null
from .hu_wiwi_grades import * __version__ = '0.1.0' __author__ = 'Niall Delventhal'
21.75
31
0.724138
12
87
4.416667
0.916667
0
0
0
0
0
0
0
0
0
0
0.041096
0.16092
87
4
31
21.75
0.684932
0
0
0
0
0
0.247059
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ae1519ed5482310be0681e16e354248ad461cfae
65
py
Python
settings.py
SecurityCompass/LabServer
757ce46146b39d1fbaf2f5400ff782a56b6de180
[ "BSD-4-Clause" ]
15
2015-03-28T12:40:08.000Z
2020-08-27T09:01:00.000Z
settings.py
SecurityCompass/LabServer
757ce46146b39d1fbaf2f5400ff782a56b6de180
[ "BSD-4-Clause" ]
2
2016-08-10T05:00:12.000Z
2017-05-08T11:23:03.000Z
settings.py
SecurityCompass/LabServer
757ce46146b39d1fbaf2f5400ff782a56b6de180
[ "BSD-4-Clause" ]
20
2015-01-10T21:32:28.000Z
2022-02-27T14:28:40.000Z
import datetime SESSION_LIFETIME = datetime.timedelta(minutes=5)
21.666667
48
0.846154
8
65
6.75
0.875
0
0
0
0
0
0
0
0
0
0
0.016667
0.076923
65
2
49
32.5
0.883333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ae22b92b0c597ef83fc3894e6c96f13a5fe6ee0f
251
py
Python
news_search/utils/big2gbk.py
luzy99/news-spider
397b355e56a3a39b98bc8710e523bab9e6bedc8d
[ "MIT" ]
6
2020-12-21T07:35:06.000Z
2022-01-03T09:07:36.000Z
news_search/utils/big2gbk.py
luzy99/news-spider
397b355e56a3a39b98bc8710e523bab9e6bedc8d
[ "MIT" ]
2
2020-12-21T07:35:02.000Z
2022-02-26T14:25:23.000Z
news_search/utils/big2gbk.py
luzy99/news-spider
397b355e56a3a39b98bc8710e523bab9e6bedc8d
[ "MIT" ]
1
2022-01-03T09:07:37.000Z
2022-01-03T09:07:37.000Z
from ..utils.langconv import Converter def Traditional2Simplified(sentence): ''' 将sentence中的繁体字转为简体字 :param sentence: 待转换的句子 :return: 将句子中繁体字转换为简体字之后的句子 ''' sentence = Converter('zh-hans').convert(sentence) return sentence
25.1
53
0.713147
22
251
8.136364
0.727273
0
0
0
0
0
0
0
0
0
0
0.004902
0.187251
251
10
54
25.1
0.872549
0.282869
0
0
0
0
0.044586
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
ae24b71bafc9ef4a33f8e7a98d61884afa5b6ec1
12,600
py
Python
Parser/language.py
JellevanCappelle/OrganisedAssembly
171a7bb23b4681f6b489a4e30c438f3a5c599953
[ "MIT" ]
null
null
null
Parser/language.py
JellevanCappelle/OrganisedAssembly
171a7bb23b4681f6b489a4e30c438f3a5c599953
[ "MIT" ]
null
null
null
Parser/language.py
JellevanCappelle/OrganisedAssembly
171a7bb23b4681f6b489a4e30c438f3a5c599953
[ "MIT" ]
null
null
null
from arpeggio import Optional, ZeroOrMore, OneOrMore, Sequence, Not, EOF from arpeggio import RegExMatch as regex from arpeggio import ParserPython from arpeggio import NonTerminal from arpeggio.export import PTDOTExporter import sys import json # load instructions and other keywords with open("keywords/keywords.txt", "r") as db: keywords = db.read().split('\n') with open("keywords/instructions.txt", "r") as db: instructionKeyword = db.read().split('\n') instructionKeyword = [i for i in instructionKeyword if not i == "callf" and not i.startswith("rep")] with open("keywords/sse instructions.txt", "r") as sse: sseInstructionKeyword = list(sse) # register types GPRs = [] for l in "abcd": GPRs += [l + 'l', l + 'h', l + 'x', f"e{l}x", f"r{l}x"] for r in ["di", "si", "sp", "bp"]: GPRs += [r, 'e' + r, 'r' + r] for i in range(8, 16): GPRs.append(f"r{i}") GPRs.append(f"r{i}d") GPRs.append(f"r{i}w") SRs = [l + 's' for l in "cdefg"] CRs = ["cr" + str(i) for i in range(8)] SSERs = ["xmm" + str(i) for i in range(16)] conditionSuffixes = ["e", "z", "l", "g", "a", "b", "le", "ge", "be", "ae", "c", "s", "p", "o"] ifKeywords = [] forKeywords = [] whileKeywords = [] for suf in conditionSuffixes: ifKeywords += ["if" + suf, "ifn" + suf] forKeywords += ["for" + suf, "forn" + suf] whileKeywords += ["while" + suf, "whilen" + suf] instructionKeyword += ["set" + suf, "setn" + suf] sizeKeywords = ["byte", "word", "dword", "qword"] stringSizeKeywords = [kwd + 's' for kwd in sizeKeywords] miscKeywords = ["constant", "string", "cstring", "function", "method", "using", "namespace", "ref", "enum", "struct", "sizeof", "alias", "binary", "ref", "value", "params"] nonIdentifiers = instructionKeyword + ifKeywords + forKeywords + whileKeywords + sizeKeywords + stringSizeKeywords + miscKeywords # define language rules ARRAY_TYPE = "Array" # registers def gpRegister(): return GPRs def segRegister(): return SRs def controlRegister(): return CRs def register(): return [gpRegister, segRegister, controlRegister] def sseRegister(): return SSERs # numbers def decimal(): return regex('[0-9]+d?') def hexadecimal(): return [regex('0x[0-9a-fA-F]+'), regex('[0-9][0-9a-fA-F]*h')] def binary(): return [regex('0b[01]+'), regex('[01]+b')] def singleQuotedString(): return regex(r"'([^'\\]|\\.)*'") def doubleQuotedString(): return regex(r'"([^"\\]|\\.)*"') def number(): return [hexadecimal, binary, decimal, singleQuotedString] # identifier def name(): return Not(nonIdentifiers), regex('[a-zA-Z_][a-zA-Z0-9_]*') def namePath(): return name, ZeroOrMore('.', name) def templateParam(): return sizeOrType() # anything that is a sizeOrType can also be a template parameter, but more options might be added later def templateParamList(): return '<', templateParam, ZeroOrMore(',', templateParam), '>' def templateDeclParamList(): return '<', name, ZeroOrMore(',', name), '>' # TODO: allow syntax for specifying parameter types def templateName(): return name, Optional(templateDeclParamList) def identifier(): return name, Optional(templateParamList) def identifierPath(): return identifier, ZeroOrMore('.', identifier) # expression # TODO: differentiate between expressions that can or can't contain registers (i.e. effective addresses or immediates) def sizeof(): return "sizeof", '<', templateParam, '>' def exprValue(): return [number, register, sizeof, identifierPath] def binaryOperator(): return ['+', '-', '*', '/', '^', '&', '|', '<<', '>>'] def unaryOperator(): return ['-', '~'] def exprTerm(): return Optional(unaryOperator), [('(', expr, ')'), exprValue] def expr(): return exprTerm, ZeroOrMore(binaryOperator, exprTerm) # operands def baseOrOffset(): return [gpRegister, expr] def offsetMultiplier(): return baseOrOffset, Optional('*', expr) # TODO: redo this (and expressions in general) properly, taking precedence rules into account def baseOffsetMultiplier(): return baseOrOffset, Optional(['+', '-'], offsetMultiplier) def address(): return baseOffsetMultiplier # TODO: fix baseOffsetMultiplier def segAddress(): return Optional(segRegister, ':'), address def sizeSpecifier(): return sizeKeywords def memReference(): return Optional(sizeSpecifier), '[', segAddress, ']' def immediate(): return Optional(sizeSpecifier), expr # can also be an aliased register! def operand(): return [register, memReference, aliasDecl, immediate] def operandList(): return operand, ZeroOrMore(',', operand) # sse instructions def sseMemReference(): return '[', segAddress, ']' def sseOperand(): return [sseRegister, sseMemReference] def sseOpcode(): return sseInstructionKeyword def sseInstruction(): return sseOpcode, sseOperand, ZeroOrMore(',', sseOperand) # statements def opcode(): return instructionKeyword def repPrefix(): return ["rep", "repe", "repne", "repnz", "repz"] def lockPrefix(): return "lock" def instruction(): return Optional(lockPrefix), Optional(repPrefix), opcode, Optional(operandList) def label(): return name, ':' def comment(): return regex('#.*') def statement(): return Optional(label), Optional([instruction, sseInstruction, controlFlow, abiReturn, abiCall, methodCall, declaration]), Optional(comment) def emptyStatement(): return Optional(comment) # variables and constants def refType(): return "ref", '<', sizeOrType, '>' def valueType(): return "value", '<', sizeOrType, '>' def sizeOrType(): return [sizeSpecifier, identifierPath, refType, valueType] def exprList(): return expr, ZeroOrMore(',', expr) def varAssignment(): return '=', expr def variableDecl(): return sizeOrType, '[', name, ']', Optional(varAssignment) def dataStringType(): return stringSizeKeywords def dataStringDecl(): return dataStringType, '[', name, ']', '=', exprList def textStringDecl(): return "string", '[', name, ']', '=', doubleQuotedString def cStringDecl(): return "cstring", '[', name, ']', '=', singleQuotedString def fileDecl(): return "binary", '[', name, ']', ':', doubleQuotedString def constantDecl(): return "constant", name, '=', expr def arrayDecl(): return "byte", '<', expr, '>', '[', name, ']' def aliasDecl(): return "alias", name, '=', gpRegister def declaration(): return [variableDecl, dataStringDecl, textStringDecl, cStringDecl, constantDecl, arrayDecl, aliasDecl, fileDecl] # enums def enumAssignment(): return name, '=', expr def enumStatement(): return Optional(enumAssignment), Optional(comment) def enumBody(): return '{', enumStatement, ZeroOrMore('\n', enumStatement), '}' def enum(): return "enum", name, Optional(emptySpace), enumBody, Optional(comment) # ABI calls def memArgument(): return Optional(sizeOrType), '[', segAddress, ']' def immArgument(): return Optional(sizeSpecifier), expr def refArgument(): return "ref", [('[', segAddress, ']'), singleQuotedString, doubleQuotedString] def argument(): return [gpRegister, memArgument, refArgument, immArgument] def returnTarget(): return [gpRegister, memArgument, aliasDecl, name] # only aliased registers should be allowed for 'name' def returnTargetList(): return returnTarget, ZeroOrMore(',', returnTarget) def argumentList(): return argument, ZeroOrMore(',', argument) def abiAssignment(): return returnTargetList, '=' def abiCall(): return Optional(abiAssignment), identifierPath, '(', Optional(argumentList), ')' # TODO: allow registers and memory operands to serve as function pointers def abiReturn(): return "return", Optional(argumentList) # functions def paramsKeyword(): return "params" parameterType = [sizeOrType, (paramsKeyword, ARRAY_TYPE, '<', sizeOrType, '>')] def parameter(): return parameterType, '[', name, ']' def parameterList(): return parameter, ZeroOrMore(',', parameter) def functionDeclaration(): return "function", templateName, '(', Optional(parameterList), ')' def emptySpace(): return OneOrMore(emptyStatement, '\n') def localCode(): return statement, ZeroOrMore('\n', statement) def localBody(): return '{', localCode, '}' def function(): return functionDeclaration, Optional(emptySpace), localBody, Optional(comment) # structs def structVariableDecl(): return sizeOrType, '[', name, ']' def structField(): return [structVariableDecl, arrayDecl] def staticKeyword(): return "static" def structMethodDecl(): return Optional(staticKeyword), "method", templateName, '(', Optional(parameterList), ')' def structMethod(): return structMethodDecl, Optional(emptySpace), localBody, Optional(comment) def structStatement(): return Optional([constantDecl, structField, structMethod]), Optional(comment) def structBody(): return '{', structStatement, ZeroOrMore('\n', structStatement), '}' def struct(): return "struct", templateName, Optional(emptySpace), structBody, Optional(comment) def regPointerCast(): return '(', gpRegister, "as", identifierPath, ')' def memPointerCast(): return '[', segAddress, "as", identifierPath, ']' def directPointer(): return '[', identifierPath, ']' def structReference(): return [directPointer, regPointerCast, memPointerCast] def methodCall(): return Optional(abiAssignment), structReference, '.', identifierPath, '(', Optional(argumentList), ')' # control flow def oneliner(): return [instruction, controlFlow, abiReturn, abiCall] def initialiser(): return [instruction, abiCall, declaration] def condition(): return [instruction, abiCall] def repeatable(): return [instruction, controlFlow, abiCall] def ifKeyword(): return ifKeywords def ifBody(): return [localBody, oneliner] def ifStatement(): return ifKeyword, '(', Optional(condition), ')', Optional(emptySpace), ifBody, Optional(comment), Optional('\n', elseStatement) def elseStatement(): return "else", Optional(emptySpace), ifBody, Optional(comment) def whileKeyword(): return whileKeywords def loopBody(): return [localBody, repeatable] def whileLoop(): return whileKeyword, '(', Optional(condition), ')', Optional(emptySpace), loopBody, Optional(comment) def doWhileLoop(): return "do", Optional(emptySpace), loopBody, Optional(emptySpace), whileKeyword, '(', Optional(condition), ')', Optional(comment) def forKeyword(): return forKeywords def forLoop(): return forKeyword, '(', Optional(initialiser), ';', Optional(condition), ';', Optional(repeatable), ')', Optional(emptySpace), loopBody, Optional(comment) def doForLoop(): return "do", Optional(emptySpace), loopBody, Optional(emptySpace), forKeyword, '(', Optional(initialiser), ';', Optional(condition), ';', Optional(repeatable), ')', Optional(comment) def breakStatement(): return "break" def continueStatement(): return "continue" def controlFlow(): return [breakStatement, continueStatement, ifStatement, whileLoop, doWhileLoop, forLoop, doForLoop] # namespaces def globalStatement(): return [namespace, enum, struct, function, statement, ''] def globalCode(): return globalStatement, ZeroOrMore('\n', globalStatement) def namespaceDeclaration(): return 'namespace', namePath def namespaceBody(): return '{', globalCode, '}' def namespace(): return namespaceDeclaration, Optional(emptySpace), namespaceBody, Optional(comment) # file structure def using(): return "using", namePath, Optional(comment), '\n' def usingList(): return using, ZeroOrMore(Optional(emptySpace), using) def program(): return Optional(emptySpace), Optional(usingList), globalCode, EOF parser = ParserPython(program, ws = "\t\r ", autokwd = True, reduce_tree = False, memoization = True) with open(input()) as file: code = file.read() try: result = parser.parse(code) except Exception as e: print(e, file=sys.stderr) sys.exit() def semiSerialise(nonTerminal): rule = nonTerminal.rule_name children = [] for i in range(len(nonTerminal)): child = nonTerminal[i] if isinstance(child, NonTerminal): child = semiSerialise(child) else: if child.rule_name != "": child = (child.rule_name, [str(child)], parser.pos_to_linecol(child.position)) else: child = str(child) children.append(child) position = parser.pos_to_linecol(nonTerminal.position) return (rule, children, position) def escape(string): chars = '\\"\t\n' replacements = '\\"tn' for i, c in enumerate(chars): string = string.replace(c, f"\\{replacements[i]}") return f'"{string}"' def serialise(tree): if isinstance(tree, tuple): rule = tree[0] children = list(map(serialise, tree[1])) line, column = tree[2] position = f"{line},{column}" return f'{{"{rule}":[{",".join(children + [position])}]}}' else: return escape(tree) tree = semiSerialise(result) tree_json = serialise(tree) print(tree_json)
48.461538
199
0.705317
1,342
12,600
6.611773
0.266766
0.025245
0.020286
0.004959
0.064465
0.040347
0.02795
0.016229
0
0
0
0.002282
0.130635
12,600
259
200
48.648649
0.807741
0.063254
0
0.014634
0
0
0.068869
0.008322
0
0
0
0.003861
0
1
0.614634
false
0
0.034146
0.6
0.668293
0.009756
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ae31be8e856a95060490f13ddb843abee281c1b1
149
py
Python
music/index/urls.py
xeroCBW/music
ba73151b35dbc898cfb56f1576aa7695f2d61fe9
[ "MIT" ]
null
null
null
music/index/urls.py
xeroCBW/music
ba73151b35dbc898cfb56f1576aa7695f2d61fe9
[ "MIT" ]
null
null
null
music/index/urls.py
xeroCBW/music
ba73151b35dbc898cfb56f1576aa7695f2d61fe9
[ "MIT" ]
null
null
null
from django.urls import path from django.conf.urls import url,include from . import views urlpatterns = [ path('',views.indexView,name='index'), ]
16.555556
40
0.744966
21
149
5.285714
0.619048
0.18018
0
0
0
0
0
0
0
0
0
0
0.127517
149
9
41
16.555556
0.853846
0
0
0
0
0
0.033333
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ae4dcbc52db941dc67aff0c2860e366a5c3e5bf2
5,187
py
Python
test/env.py
personnelink/shellish
f130599aabe1ed44323b2374c9e6c3b789f06517
[ "MIT" ]
4
2015-10-06T23:50:20.000Z
2021-06-11T19:20:43.000Z
test/env.py
personnelink/shellish
f130599aabe1ed44323b2374c9e6c3b789f06517
[ "MIT" ]
null
null
null
test/env.py
personnelink/shellish
f130599aabe1ed44323b2374c9e6c3b789f06517
[ "MIT" ]
null
null
null
import shellish import unittest import os class EnvTests(unittest.TestCase): def setUp(self): self.env_save = env = os.environ os.environ = env.copy() def tearDown(self): os.environ = self.env_save def setenv(self, key, value): os.environ[key] = value def test_simple_env_noset(self): c = shellish.Command(name='c') c.add_argument('--foo', env='FOO') c.run = lambda args: args self.assertEqual(c(argv='--foo bar').foo, 'bar') self.assertEqual(c(argv='').foo, None) def test_dup_env(self): c = shellish.Command(name='c') c.add_argument('--foo', env='FOO') self.assertRaises(ValueError, c.add_argument, '--bar', env='FOO') def test_simple_env_set(self): c = shellish.Command(name='c') c.add_argument('--foo', env='SHELLISH_TEST_FOO') c.run = lambda args: args self.setenv('SHELLISH_TEST_FOO', 'from_env') self.assertEqual(c(argv='--foo from_args').foo, 'from_args') self.assertEqual(c(argv='').foo, 'from_env') def test_override_default(self): c = shellish.Command(name='c') c.add_argument('--foo', default='foodef', env='SHELLISH_TEST_FOO') c.run = lambda args: args self.assertEqual(c(argv='').foo, 'foodef') self.setenv('SHELLISH_TEST_FOO', 'from_env') self.assertEqual(c(argv='').foo, 'from_env') self.assertEqual(c(argv='--foo from_arg').foo, 'from_arg') def test_autoenv(self): c = shellish.Command(name="test_autoenv") c.add_argument('--foo', autoenv=True) c.run = lambda args: args # just return args ns self.assertEqual(c(argv='').foo, None) self.assertEqual(c(argv='--foo bar').foo, 'bar') self.setenv('TEST_AUTOENV_FOO', 'from_env') self.assertEqual(c(argv='').foo, 'from_env') self.assertEqual(c(argv='--foo from_arg').foo, 'from_arg') def test_autoenv_nested_commands(self): head = shellish.Command(name="head") tail = shellish.Command(name="tail") tail.add_argument('--foo', autoenv=True) head.add_subcommand(tail) tail.run = lambda args: args # just return args ns self.assertEqual(head(argv='tail').foo, None) self.assertEqual(head(argv='tail --foo bar').foo, 'bar') self.setenv('HEAD_TAIL_FOO', 'from_env') self.assertEqual(head(argv='tail').foo, 'from_env') self.assertEqual(head(argv='tail --foo from_arg').foo, 'from_arg') def test_autoenv_double_nested_commands(self): head = shellish.Command(name="head") mid = shellish.Command(name="mid") tail = shellish.Command(name="tail") tail.add_argument('--foo', autoenv=True) mid.add_subcommand(tail) head.add_subcommand(mid) tail.run = lambda args: args # just return args ns self.assertEqual(head(argv='mid tail').foo, None) self.assertEqual(head(argv='mid tail --foo bar').foo, 'bar') self.setenv('HEAD_MID_TAIL_FOO', 'from_env') self.assertEqual(head(argv='mid tail').foo, 'from_env') self.assertEqual(head(argv='mid tail --foo from_arg').foo, 'from_arg') def test_autoenv_double_nested_commands_alt_order(self): head = shellish.Command(name="head") mid = shellish.Command(name="mid") head.add_subcommand(mid) tail = shellish.Command(name="tail") mid.add_subcommand(tail) tail.add_argument('--foo', autoenv=True) tail.run = lambda args: args # just return args ns self.assertEqual(head(argv='mid tail').foo, None) self.assertEqual(head(argv='mid tail --foo bar').foo, 'bar') self.setenv('HEAD_MID_TAIL_FOO', 'from_env') self.assertEqual(head(argv='mid tail').foo, 'from_env') self.assertEqual(head(argv='mid tail --foo from_arg').foo, 'from_arg') def test_autoenv_odd_names(self): names = { "test-autoenv": "TEST_AUTOENV", "test ": "TEST", "test ": "TEST", " test ": "TEST", " test": "TEST", " test": "TEST", " test-test": "TEST_TEST", " test test": "TEST_TEST", " t!@#$est-test": "TEST_TEST", "1test": "_1TEST", " 1test": "_1TEST", " 1test ": "_1TEST", } for i, (name, env_prefix) in enumerate(names.items()): with self.subTest(name): c = shellish.Command(name=name) action = c.add_argument('--foo', autoenv=True) self.assertEqual(action.env, '%s_FOO' % env_prefix) def test_nonstd_parser(self): c = shellish.Command(name="test_autoenv") g = c.argparser.add_mutually_exclusive_group() c.add_argument('--foo', parser=g, env='SHELLISH_TEST_FOO') c.run = lambda args: args self.assertEqual(c(argv='').foo, None) self.assertEqual(c(argv='--foo bar').foo, 'bar') self.setenv('SHELLISH_TEST_FOO', 'from_env') self.assertEqual(c(argv='').foo, 'from_env') self.assertEqual(c(argv='--foo from_arg').foo, 'from_arg')
40.523438
78
0.598226
674
5,187
4.437685
0.117211
0.140421
0.068205
0.100301
0.774992
0.752257
0.715814
0.65998
0.634905
0.630558
0
0.001525
0.241373
5,187
127
79
40.84252
0.758577
0.01523
0
0.580357
0
0
0.177151
0
0
0
0
0
0.258929
1
0.116071
false
0
0.026786
0
0.151786
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ae521337f687430076fe39a23aa7b0ef18f830e4
830
py
Python
job/migrations/0004_auto_20210302_0817.py
zakiladj/django-job-board
1ca5297d5bb1cfbc3e58ad0db540e2c03e453622
[ "MIT" ]
null
null
null
job/migrations/0004_auto_20210302_0817.py
zakiladj/django-job-board
1ca5297d5bb1cfbc3e58ad0db540e2c03e453622
[ "MIT" ]
null
null
null
job/migrations/0004_auto_20210302_0817.py
zakiladj/django-job-board
1ca5297d5bb1cfbc3e58ad0db540e2c03e453622
[ "MIT" ]
null
null
null
# Generated by Django 3.1.7 on 2021-03-02 08:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('job', '0003_job_discription'), ] operations = [ migrations.AddField( model_name='job', name='experience', field=models.IntegerField(default=1), ), migrations.AddField( model_name='job', name='published_at', field=models.DateTimeField(auto_now=True), ), migrations.AddField( model_name='job', name='salary', field=models.IntegerField(default=0), ), migrations.AddField( model_name='job', name='vacancy', field=models.IntegerField(default=1), ), ]
24.411765
54
0.542169
78
830
5.666667
0.512821
0.162896
0.208145
0.244344
0.447964
0.307692
0
0
0
0
0
0.040146
0.339759
830
33
55
25.151515
0.766423
0.054217
0
0.518519
1
0
0.0894
0
0
0
0
0
0
1
0
false
0
0.037037
0
0.148148
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ae81f849daed5b3ef1310ac1cc11d34560a76831
83
py
Python
code/extract.py
kobigurk/hadeshash
4f820638fd4d104ce970f42665ea8389428941a9
[ "MIT" ]
null
null
null
code/extract.py
kobigurk/hadeshash
4f820638fd4d104ce970f42665ea8389428941a9
[ "MIT" ]
null
null
null
code/extract.py
kobigurk/hadeshash
4f820638fd4d104ce970f42665ea8389428941a9
[ "MIT" ]
null
null
null
import sys array = eval(sys.argv[1]) index = int(sys.argv[2]) print(array[index])
13.833333
25
0.686747
15
83
3.8
0.666667
0.245614
0
0
0
0
0
0
0
0
0
0.027397
0.120482
83
5
26
16.6
0.753425
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.25
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
0
0
0
0
0
0
0
0
3
ae93ce46e7d617099f65e817e3f5f9921c3d198e
569
py
Python
tests/test_json_field.py
mixcloud/django-extensions
32d69b214cd4d2e8861f0e1dac8a9e2fc8112c92
[ "MIT" ]
1
2015-08-10T16:03:34.000Z
2015-08-10T16:03:34.000Z
tests/test_json_field.py
mixcloud/django-extensions
32d69b214cd4d2e8861f0e1dac8a9e2fc8112c92
[ "MIT" ]
null
null
null
tests/test_json_field.py
mixcloud/django-extensions
32d69b214cd4d2e8861f0e1dac8a9e2fc8112c92
[ "MIT" ]
1
2019-11-02T03:07:07.000Z
2019-11-02T03:07:07.000Z
from django.test import TestCase from .testapp.models import JSONFieldTestModel class JsonFieldTest(TestCase): def test_char_field_create(self): j = JSONFieldTestModel.objects.create(a=6, j_field=dict(foo='bar')) self.assertEqual(j.a, 6) def test_default(self): j = JSONFieldTestModel.objects.create(a=1) self.assertEqual(j.j_field, {}) def test_empty_list(self): j = JSONFieldTestModel.objects.create(a=6, j_field=[]) self.assertTrue(isinstance(j.j_field, list)) self.assertEqual(j.j_field, [])
29.947368
75
0.68717
75
569
5.066667
0.386667
0.078947
0.181579
0.236842
0.444737
0.328947
0.231579
0.231579
0.231579
0
0
0.008677
0.189807
569
18
76
31.611111
0.815618
0
0
0
0
0
0.005272
0
0
0
0
0
0.307692
1
0.230769
false
0
0.153846
0
0.461538
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
ae99fbdd88f77bd0e3bd6efbe884f2bbca0dc040
286
py
Python
tests/features/swrl_parser.py
mpetyx/pyrif
2f7ba863030d7337bb39ad502d1e09e26ac950d2
[ "MIT" ]
null
null
null
tests/features/swrl_parser.py
mpetyx/pyrif
2f7ba863030d7337bb39ad502d1e09e26ac950d2
[ "MIT" ]
null
null
null
tests/features/swrl_parser.py
mpetyx/pyrif
2f7ba863030d7337bb39ad502d1e09e26ac950d2
[ "MIT" ]
null
null
null
from lettuce import step, world @step("the empty xml swrl document") def step_impl(step): """ :type step lettuce.core.Step """ pass @step("I retrieve (\d+)") def step_impl(step, expected): """ :type step lettuce.core.Step """ assert int(expected) == 1
17.875
36
0.611888
39
286
4.435897
0.564103
0.080925
0.127168
0.17341
0.265896
0
0
0
0
0
0
0.004566
0.234266
286
16
37
17.875
0.785388
0.199301
0
0
0
0
0.21608
0
0
0
0
0
0.142857
1
0.285714
false
0.142857
0.142857
0
0.428571
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
ae9bd0aecf76dd350dbfdaab98699a2fd3a080de
1,050
py
Python
ezdisteach/formats/_odpcourse.py
call-learning/ez-disteach
7636dfdbfb709769824266800ebba18be764ecc3
[ "MIT" ]
null
null
null
ezdisteach/formats/_odpcourse.py
call-learning/ez-disteach
7636dfdbfb709769824266800ebba18be764ecc3
[ "MIT" ]
null
null
null
ezdisteach/formats/_odpcourse.py
call-learning/ez-disteach
7636dfdbfb709769824266800ebba18be764ecc3
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ EZDisTeach ODP Course format support """ from io import BufferedWriter import zipfile import tempfile from odfdo import Document title = 'odpcourse' extensions = ('odp',) def export_stream(model, **kwargs): pass def import_stream(model, in_stream, **kwargs): from ezdisteach.lib.odf.odftomodel import build_model # Here we receive a stream and th odf lib uses only files # So we need to convert the stream to a temporary file with tempfile.NamedTemporaryFile() as f: f.write(in_stream.read()) document = Document(f) build_model(document, model) def import_meta(model, in_stream, **kwargs): """Build the model a stream.""" import_stream(model, in_stream, type="meta") pass def export_meta(model, **kwargs): """Build the model a stream.""" export_stream(model, type="meta") pass def detect(stream): """Returns True if given stream is valid IMS Content Package.""" try: return True except (TypeError): return False
22.826087
68
0.674286
141
1,050
4.93617
0.489362
0.063218
0.056034
0.054598
0.146552
0.074713
0
0
0
0
0
0.00122
0.219048
1,050
45
69
23.333333
0.847561
0.266667
0
0.12
0
0
0.026846
0
0
0
0
0
0
1
0.2
false
0.12
0.32
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
3
8833f27d96c22c3458969f7920839174a4ffbb04
8,680
py
Python
recommend/eusolver/scripts/job_list_icfp_one_shot.py
jiry17/IntSy
36333489b77ff2fbe84e6440be1f6b84eb61f29e
[ "MIT" ]
7
2020-03-01T12:07:44.000Z
2021-10-20T02:34:59.000Z
recommend/esolver/scripts/job_list_icfp_one_shot.py
jiry17/PolyGen
b384e478ec91299d6a14f4681ff3e0850911822b
[ "MIT" ]
1
2020-05-25T22:08:35.000Z
2020-05-25T22:08:35.000Z
recommend/eusolver/scripts/job_list_icfp_one_shot.py
jiry17/IntSy
36333489b77ff2fbe84e6440be1f6b84eb61f29e
[ "MIT" ]
1
2021-12-01T08:18:21.000Z
2021-12-01T08:18:21.000Z
# job_list_one_shot.py --- # # Filename: job_list_one_shot.py # Author: Abhishek Udupa # Created: Tue Jan 26 15:13:19 2016 (-0500) # # # Copyright (c) 2015, Abhishek Udupa, University of Pennsylvania # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by The University of Pennsylvania # 4. Neither the name of the University of Pennsylvania nor the # names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ''AS IS'' AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # Code: [ (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_103_10.sl'], 'icfp_103_10-one-shot', 'icfp_103_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_113_1000.sl'], 'icfp_113_1000-one-shot', 'icfp_113_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_125_10.sl'], 'icfp_125_10-one-shot', 'icfp_125_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_14_1000.sl'], 'icfp_14_1000-one-shot', 'icfp_14_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_147_1000.sl'], 'icfp_147_1000-one-shot', 'icfp_147_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_28_10.sl'], 'icfp_28_10-one-shot', 'icfp_28_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_39_100.sl'], 'icfp_39_100-one-shot', 'icfp_39_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_51_10.sl'], 'icfp_51_10-one-shot', 'icfp_51_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_68_1000.sl'], 'icfp_68_1000-one-shot', 'icfp_68_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_72_10.sl'], 'icfp_72_10-one-shot', 'icfp_72_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_82_10.sl'], 'icfp_82_10-one-shot', 'icfp_82_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_94_1000.sl'], 'icfp_94_1000-one-shot', 'icfp_94_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_96_10.sl'], 'icfp_96_10-one-shot', 'icfp_96_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_104_10.sl'], 'icfp_104_10-one-shot', 'icfp_104_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_114_100.sl'], 'icfp_114_100-one-shot', 'icfp_114_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_134_1000.sl'], 'icfp_134_1000-one-shot', 'icfp_134_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_143_1000.sl'], 'icfp_143_1000-one-shot', 'icfp_143_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_150_10.sl'], 'icfp_150_10-one-shot', 'icfp_150_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_30_10.sl'], 'icfp_30_10-one-shot', 'icfp_30_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_45_1000.sl'], 'icfp_45_1000-one-shot', 'icfp_45_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_54_1000.sl'], 'icfp_54_1000-one-shot', 'icfp_54_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_69_10.sl'], 'icfp_69_10-one-shot', 'icfp_69_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_73_10.sl'], 'icfp_73_10-one-shot', 'icfp_73_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_87_10.sl'], 'icfp_87_10-one-shot', 'icfp_87_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_94_100.sl'], 'icfp_94_100-one-shot', 'icfp_94_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_99_100.sl'], 'icfp_99_100-one-shot', 'icfp_99_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_105_1000.sl'], 'icfp_105_1000-one-shot', 'icfp_105_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_118_100.sl'], 'icfp_118_100-one-shot', 'icfp_118_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_135_100.sl'], 'icfp_135_100-one-shot', 'icfp_135_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_144_1000.sl'], 'icfp_144_1000-one-shot', 'icfp_144_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_21_1000.sl'], 'icfp_21_1000-one-shot', 'icfp_21_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_32_10.sl'], 'icfp_32_10-one-shot', 'icfp_32_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_45_10.sl'], 'icfp_45_10-one-shot', 'icfp_45_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_56_1000.sl'], 'icfp_56_1000-one-shot', 'icfp_56_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_7_1000.sl'], 'icfp_7_1000-one-shot', 'icfp_7_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_81_1000.sl'], 'icfp_81_1000-one-shot', 'icfp_81_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_9_1000.sl'], 'icfp_9_1000-one-shot', 'icfp_9_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_95_100.sl'], 'icfp_95_100-one-shot', 'icfp_95_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_105_100.sl'], 'icfp_105_100-one-shot', 'icfp_105_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_118_10.sl'], 'icfp_118_10-one-shot', 'icfp_118_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_139_10.sl'], 'icfp_139_10-one-shot', 'icfp_139_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_144_100.sl'], 'icfp_144_100-one-shot', 'icfp_144_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_25_1000.sl'], 'icfp_25_1000-one-shot', 'icfp_25_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_38_10.sl'], 'icfp_38_10-one-shot', 'icfp_38_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_5_1000.sl'], 'icfp_5_1000-one-shot', 'icfp_5_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_64_10.sl'], 'icfp_64_10-one-shot', 'icfp_64_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_7_10.sl'], 'icfp_7_10-one-shot', 'icfp_7_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_82_100.sl'], 'icfp_82_100-one-shot', 'icfp_82_100-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_93_1000.sl'], 'icfp_93_1000-one-shot', 'icfp_93_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_96_1000.sl'], 'icfp_96_1000-one-shot', 'icfp_96_1000-one-shot') ] # # job_list_one_shot.py ends here
91.368421
139
0.679147
1,332
8,680
4.193694
0.153153
0.129073
0.143215
0.179019
0.715002
0.494271
0.494271
0.494271
0.486753
0.486753
0
0.136334
0.101728
8,680
94
140
92.340426
0.580095
0.213825
0
0
0
0
0.728037
0.383107
0
0
0
0
0
1
0
true
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
8837ad39acde490761f8eb38f1f73c2261c8bb92
704
py
Python
telnet.py
melihteke/istihza
473fc094229f985882dd4eb19190bdcaaf540fdd
[ "MIT" ]
null
null
null
telnet.py
melihteke/istihza
473fc094229f985882dd4eb19190bdcaaf540fdd
[ "MIT" ]
null
null
null
telnet.py
melihteke/istihza
473fc094229f985882dd4eb19190bdcaaf540fdd
[ "MIT" ]
null
null
null
import getpass import telnetlib HOST = "192.168.178.55" user = input("Enter your telnet username: ") password = getpass.getpass() tn = telnetlib.Telnet(HOST) tn.read_until(b"Username: ") tn.write(user.encode('ascii') + b"\n") if password: tn.read_until(b"Password: ") tn.write(password.encode('ascii') + b"\n") tn.write(b"enable\n") tn.write(b"cisco\n") tn.write(b"conf t\n") tn.write(b"int loop 20\n") tn.write(b"ip address 20.1.1.1 255.255.255.255\n") tn.write(b"int loop 21\n") tn.write(b"ip address 21.2.2.2 255.255.255.255\n") tn.write(b"router ospf 4\n") tn.write(b"network 0.0.0.0 255.255.255.255 area 0\n") tn.write(b"end\n") tn.write(b"exit\n") print(tn.read_all().decode('ascii'))
24.275862
53
0.680398
144
704
3.305556
0.333333
0.191176
0.184874
0.207983
0.212185
0.212185
0.088235
0.088235
0
0
0
0.106349
0.105114
704
28
54
25.142857
0.649206
0
0
0
0
0
0.383523
0
0
0
0
0
0
1
0
false
0.217391
0.086957
0
0.086957
0.043478
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
0
0
0
0
0
3
885172e6c8a759ae8c92f4d1bbabea08200991e9
160
py
Python
system_test/utils/timeutils.py
OpenPOWER-BigData/HDP--kafka
87d4fc2721658a342854bb1ce3c366bcb3ac1219
[ "Apache-2.0" ]
null
null
null
system_test/utils/timeutils.py
OpenPOWER-BigData/HDP--kafka
87d4fc2721658a342854bb1ce3c366bcb3ac1219
[ "Apache-2.0" ]
null
null
null
system_test/utils/timeutils.py
OpenPOWER-BigData/HDP--kafka
87d4fc2721658a342854bb1ce3c366bcb3ac1219
[ "Apache-2.0" ]
null
null
null
import logging import time logger = logging.getLogger("namedLogger") def sleep(secs): logger.info("Sleeping for %d seconds.", secs) time.sleep(secs)
16
49
0.7125
21
160
5.428571
0.666667
0.157895
0
0
0
0
0
0
0
0
0
0
0.1625
160
9
50
17.777778
0.850746
0
0
0
0
0
0.21875
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
88537af77eb257c05e51b7eaaf9e88b1deb7291c
151
py
Python
Dataset/Leetcode/test/136/516.py
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/test/136/516.py
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/test/136/516.py
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
class Solution: def singleNumber(self, nums: List[int]) -> int: a = itertools.accumulate(nums,lambda t,x:t^x) return list(a)[-1]
25.166667
53
0.609272
22
151
4.181818
0.727273
0.043478
0
0
0
0
0
0
0
0
0
0.008696
0.238411
151
5
54
30.2
0.791304
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
885de76375c8d740af85d3a0512ce4681e4bc81a
176
py
Python
minigest/docfisc/admin/fattura_riepilogo_iva.py
ctrlmaniac/minigest
2bfceb57e41c872e4112e24d0e6991164846888b
[ "MIT" ]
null
null
null
minigest/docfisc/admin/fattura_riepilogo_iva.py
ctrlmaniac/minigest
2bfceb57e41c872e4112e24d0e6991164846888b
[ "MIT" ]
1
2021-09-22T19:10:20.000Z
2021-09-22T19:10:20.000Z
minigest/docfisc/admin/fattura_riepilogo_iva.py
ctrlmaniac/minigest
2bfceb57e41c872e4112e24d0e6991164846888b
[ "MIT" ]
null
null
null
from django.contrib import admin from ..models import FatturaRiepilogoIVA class FatturaRiepilogoIVAAdmin(admin.StackedInline): model = FatturaRiepilogoIVA extra = 0
19.555556
52
0.795455
17
176
8.235294
0.764706
0
0
0
0
0
0
0
0
0
0
0.006711
0.153409
176
8
53
22
0.932886
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
886702c11459b011afe2118a0a32eb0ae0729bf4
425
py
Python
bioimageit_framework/framework/__init__.py
bioimageit/bioimageit_framework
718e259d1490a8afc18794abae5a17eb41ada88f
[ "BSD-4-Clause" ]
null
null
null
bioimageit_framework/framework/__init__.py
bioimageit/bioimageit_framework
718e259d1490a8afc18794abae5a17eb41ada88f
[ "BSD-4-Clause" ]
null
null
null
bioimageit_framework/framework/__init__.py
bioimageit/bioimageit_framework
718e259d1490a8afc18794abae5a17eb41ada88f
[ "BSD-4-Clause" ]
null
null
null
from .exceptions import CommandArgsError from .framework import (BiAction, BiContainer, BiActuator, BiComponent, BiConnectome) from .observer import (BiGuiObserver) __all__ = ['CommandArgsError', 'BiObject', 'BiAction', 'BiContainer', 'BiActuator', 'BiComponent', 'BiConnectome', 'BiGuiObserver']
30.357143
61
0.550588
25
425
9.2
0.56
0.165217
0.252174
0.347826
0.452174
0
0
0
0
0
0
0
0.362353
425
13
62
32.692308
0.848708
0
0
0
0
0
0.209412
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
8874947f5d54bdcebbc0269d0a29814f3e85156c
651
py
Python
app/forms.py
alexmacniven/mega-flask-blog
6138a5b339d2c505707d16b124e3b9d69dbe23bd
[ "MIT" ]
null
null
null
app/forms.py
alexmacniven/mega-flask-blog
6138a5b339d2c505707d16b124e3b9d69dbe23bd
[ "MIT" ]
null
null
null
app/forms.py
alexmacniven/mega-flask-blog
6138a5b339d2c505707d16b124e3b9d69dbe23bd
[ "MIT" ]
null
null
null
# WTF uses a class to represent a traditional form. # The class LoginForm describes the fields of our form. Note; we're # paying no attention to the appearance of the form just yet. from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField, SubmitField # DataRequired ensures that a user has inputted data into the field. from wtforms.validators import DataRequired class LoginForm(FlaskForm): username = StringField("Username", validators=[DataRequired()]) password = PasswordField("Password", validators=[DataRequired()]) remember_me = BooleanField("Remember Me") submit = SubmitField("Sign In")
43.4
73
0.77573
82
651
6.134146
0.597561
0.055666
0
0
0
0
0
0
0
0
0
0
0.149002
651
14
74
46.5
0.907942
0.371736
0
0
0
0
0.084158
0
0
0
0
0
0
1
0
false
0.25
0.375
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
3
887badb10aad64fce501f3d46c434e85e2dd88d2
1,906
py
Python
torchaddons/distributions/_categorical.py
jakkes/torchaddons
3a93b4c3ad026e208a3836c61159d9fd54694dd2
[ "MIT" ]
null
null
null
torchaddons/distributions/_categorical.py
jakkes/torchaddons
3a93b4c3ad026e208a3836c61159d9fd54694dd2
[ "MIT" ]
null
null
null
torchaddons/distributions/_categorical.py
jakkes/torchaddons
3a93b4c3ad026e208a3836c61159d9fd54694dd2
[ "MIT" ]
null
null
null
from typing import Tuple import torch import torchaddons from torchaddons import distributions class Categorical(distributions.Base): """Categorical distribution.""" def __init__(self, probabilities: torch.Tensor) -> None: """Creates a categorical distribution. Args: probabilities (torch.Tensor): Probabilities (or relative probability) along the last dimension. Must be non-negative. """ super().__init__() if (probabilities < 0).any(): raise ValueError("Probabilities must be non-negative.") self._probs = probabilities / probabilities.sum(-1, True) @property def is_continuous(self) -> bool: return False @property def is_discrete(self) -> bool: return True @property def shape(self) -> Tuple[int, ...]: return self._probs.shape[:-1] def clone(self) -> "distributions.Categorical": return Categorical(self._probs.clone()) @property def probabilities(self) -> torch.Tensor: """Probabilities of the categories.""" return self._probs def sample(self, *shape: Tuple[int, ...]) -> torch.Tensor: return torchaddons.random.choice(self._probs.expand(shape + self._probs.shape)) def _include_discrete_mask(self, mask: distributions.constraints.CategoricalMask): if mask.mask.shape != self._probs.shape: raise ValueError("Discrete mask does not match the shape of the distribution.") self._probs[~mask.mask] = 0.0 self._probs /= self._probs.sum(-1, keepdim=True) def include_constraint(self, constraint: distributions.constraints.Base) -> bool: if isinstance(constraint, distributions.constraints.CategoricalMask): self._include_discrete_mask(constraint) return True return super().include_constraint(constraint)
32.305085
91
0.657922
203
1,906
6.039409
0.330049
0.073409
0.034258
0.027732
0
0
0
0
0
0
0
0.00411
0.233998
1,906
58
92
32.862069
0.835616
0.121196
0
0.166667
0
0
0.073186
0.015375
0
0
0
0
0
1
0.25
false
0
0.111111
0.138889
0.611111
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
889d41e73a80584b6a4009c626596eae5e82d357
280
py
Python
granule_ingester/granule_ingester/writers/DataStore.py
kevinmarlis/incubator-sdap-ingester
7ee17fdf16201c499f7bd35cf398844f2c70f046
[ "Apache-2.0" ]
null
null
null
granule_ingester/granule_ingester/writers/DataStore.py
kevinmarlis/incubator-sdap-ingester
7ee17fdf16201c499f7bd35cf398844f2c70f046
[ "Apache-2.0" ]
1
2021-05-03T22:13:11.000Z
2021-05-03T22:13:11.000Z
granule_ingester/granule_ingester/writers/DataStore.py
kevinmarlis/incubator-sdap-ingester
7ee17fdf16201c499f7bd35cf398844f2c70f046
[ "Apache-2.0" ]
null
null
null
from abc import ABC, abstractmethod from nexusproto import DataTile_pb2 as nexusproto from granule_ingester.healthcheck import HealthCheck class DataStore(HealthCheck, ABC): @abstractmethod def save_data(self, nexus_tile: nexusproto.NexusTile) -> None: pass
20
66
0.775
33
280
6.454545
0.666667
0.159624
0
0
0
0
0
0
0
0
0
0.00431
0.171429
280
13
67
21.538462
0.913793
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0.142857
0.428571
0
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
3
ee2d0ac8671e29603bfe74c0df09ec905ea9badc
813
py
Python
test/test_get_info_edit_page.py
smagdenko/addressbook
da7bcbfe7d5f565b4eb857dcdddd2a9699e5e5e6
[ "Apache-2.0" ]
null
null
null
test/test_get_info_edit_page.py
smagdenko/addressbook
da7bcbfe7d5f565b4eb857dcdddd2a9699e5e5e6
[ "Apache-2.0" ]
null
null
null
test/test_get_info_edit_page.py
smagdenko/addressbook
da7bcbfe7d5f565b4eb857dcdddd2a9699e5e5e6
[ "Apache-2.0" ]
null
null
null
def test_contacts_on_home_page(app): contact_from_home_page = app.contact.get_contacts_list()[1] contact_from_edit_page = app.contact.get_info_from_edit_page(1) assert contact_from_edit_page.email_1 == contact_from_home_page.email_1 assert contact_from_edit_page.email_2 == contact_from_home_page.email_2 assert contact_from_edit_page.email_3 == contact_from_home_page.email_3 def test_phones_on_home_page(app): phones_from_home_page = app.contact.get_contacts_list()[1] phones_from_edit_page = app.contact.get_info_from_edit_page(1) assert phones_from_edit_page.work_phone == phones_from_home_page.work_phone assert phones_from_edit_page.home_phone == phones_from_home_page.home_phone assert phones_from_edit_page.mobile_phone == phones_from_home_page.mobile_phone
40.65
83
0.826568
136
813
4.352941
0.161765
0.135135
0.202703
0.128378
0.800676
0.532095
0.383446
0.290541
0.290541
0.162162
0
0.013774
0.107011
813
19
84
42.789474
0.801653
0
0
0
0
0
0
0
0
0
0
0
0.5
1
0.166667
false
0
0
0
0.166667
0
0
0
0
null
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
ee308495ab434d96e4af75e940fcb798d38f0b54
500
py
Python
tests/integration/test_scheme.py
firefly-cpp/simframe
63475e1cf41fcd6baa9c27fb1451c47a87d77ac7
[ "BSD-3-Clause" ]
null
null
null
tests/integration/test_scheme.py
firefly-cpp/simframe
63475e1cf41fcd6baa9c27fb1451c47a87d77ac7
[ "BSD-3-Clause" ]
null
null
null
tests/integration/test_scheme.py
firefly-cpp/simframe
63475e1cf41fcd6baa9c27fb1451c47a87d77ac7
[ "BSD-3-Clause" ]
null
null
null
# Tests for Scheme class import pytest from simframe.integration import Scheme def test_scheme_repr_str(): def f(): pass s = Scheme(f) assert isinstance(repr(s), str) assert isinstance(str(s), str) def test_scheme_attributes(): def f(): pass with pytest.raises(TypeError): s = Scheme(f, controller=None) with pytest.raises(TypeError): s = Scheme(None) s = Scheme(f) with pytest.raises(TypeError): s.description = None
19.230769
39
0.634
65
500
4.8
0.384615
0.089744
0.076923
0.240385
0.288462
0.205128
0
0
0
0
0
0
0.262
500
25
40
20
0.845528
0.044
0
0.5
0
0
0
0
0
0
0
0
0.111111
1
0.222222
false
0.111111
0.111111
0
0.333333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
ee54764370757a59f58a929c613972fb103f8ce4
2,542
py
Python
ancilla/ancilla/foundation/node/api/api.py
frenzylabs/ancilla
3469272f17e1a5092d033cdc099f86f3052e744f
[ "Apache-2.0" ]
7
2020-03-31T19:52:59.000Z
2021-05-21T08:38:47.000Z
ancilla/ancilla/foundation/node/api/api.py
frenzylabs/ancilla
3469272f17e1a5092d033cdc099f86f3052e744f
[ "Apache-2.0" ]
15
2020-04-01T13:52:07.000Z
2020-04-01T13:52:11.000Z
ancilla/ancilla/foundation/node/api/api.py
frenzylabs/ancilla
3469272f17e1a5092d033cdc099f86f3052e744f
[ "Apache-2.0" ]
null
null
null
''' api.py ancilla Created by Kevin Musselman (kevin@frenzylabs.com) on 01/08/20 Copyright 2019 FrenzyLabs, LLC. ''' import time import json from ...data.models import Service, ServiceAttachment from ..response import AncillaError class Api(object): def __init__(self, service): self.service = service self.setup() def setup(self, prefix = ""): self.service.route(f'{prefix}/settings', 'GET', self.settings) self.service.route(f'{prefix}/actions', 'GET', self.actions) self.service.route(f'{prefix}/routes', 'GET', self.routes) self.service.route(f'{prefix}/events', 'GET', self.events) self.service.route(f'{prefix}/attachments/<attachment_id>', 'DELETE', self.delete_attachment) self.service.route(f'{prefix}/attachments', 'POST', self.add_attachment) self.service.route(f'{prefix}/attachments', 'GET', self.attachments) def settings(self, *args): return {"settings": self.service.settings.to_json()} def routes(self, *args): return {"routes": [f"{r}" for r in self.service.routes]} def actions(self, *args): return {"actions": self.service.list_actions()} def events(self, *args): # print(f"THE EVENT DICT = {self.service.event_class.event_dict()}", flush=True) return {"events": self.service.event_class.list_events()} def delete_attachment(self, request, attachment_id, *args, **kwargs): # attachment = self.service.model.service_attachments.where(ServiceAttachment.attachment_id == service_id).first() attachment = self.service.model.service_attachments.where(ServiceAttachment.id == attachment_id).first() if attachment: attachment.delete_instance() return {"sucess": "Removed Attachment"} raise AncillaError(404, {"error": "No Attachment Found"}) def add_attachment(self, request, *args): service_id = request.params.get("service_id") res = self.service.model.service_attachments.where(ServiceAttachment.attachment_id == service_id).first() if res: return {"attachment": res.json} attachment = Service.get_by_id(service_id) sa = ServiceAttachment(parent=self.service.model, attachment=attachment) sa.save() return {"attachment": sa.json} def attachments(self, *args): return {"attachments": [a.json for a in self.service.model.service_attachments]} def update_attachment(self, request, attachment_id, *args): pass
35.305556
120
0.667191
303
2,542
5.488449
0.267327
0.125676
0.067348
0.071557
0.337943
0.262177
0.197234
0.144318
0.098617
0.098617
0
0.006341
0.193548
2,542
72
121
35.305556
0.804878
0.118804
0
0
0
0
0.12702
0.016158
0
0
0
0
0
1
0.232558
false
0.023256
0.093023
0.116279
0.534884
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ee59c3299ce85a9172d9cdc7e2f6bf9c32d1c981
184
py
Python
Python Programs/exception.py
Chibi-Shem/Hacktoberfest2020-Expert
324843464aec039e130e85a16e74b76d310f1497
[ "MIT" ]
77
2020-10-01T10:06:59.000Z
2021-11-08T08:57:18.000Z
Python Programs/exception.py
Chibi-Shem/Hacktoberfest2020-Expert
324843464aec039e130e85a16e74b76d310f1497
[ "MIT" ]
46
2020-09-27T04:55:36.000Z
2021-05-14T18:49:06.000Z
Python Programs/exception.py
Chibi-Shem/Hacktoberfest2020-Expert
324843464aec039e130e85a16e74b76d310f1497
[ "MIT" ]
327
2020-09-26T17:06:03.000Z
2021-10-09T06:04:39.000Z
while True: try: num=int(input("Input your number: ")) print("Your number is {}".format(num)) break except: print("Please insert number!")
26.285714
47
0.532609
21
184
4.666667
0.714286
0.204082
0
0
0
0
0
0
0
0
0
0
0.331522
184
7
48
26.285714
0.796748
0
0
0
0
0
0.318436
0
0
0
0
0
0
1
0
false
0
0
0
0
0.285714
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ee6744152186b56a2413dd80ca53002e96845e99
757
py
Python
access_niu/components/__init__.py
accessai/access-niu
221c37a628374d6303f269080619e748d86ca8e1
[ "Apache-2.0" ]
15
2019-04-21T06:21:05.000Z
2019-07-15T09:31:59.000Z
access_niu/components/__init__.py
accessai/access-niu
221c37a628374d6303f269080619e748d86ca8e1
[ "Apache-2.0" ]
18
2019-04-25T09:36:57.000Z
2022-02-10T00:11:00.000Z
access_niu/components/__init__.py
accessai/access-niu
221c37a628374d6303f269080619e748d86ca8e1
[ "Apache-2.0" ]
9
2019-05-03T16:04:54.000Z
2019-07-15T07:58:03.000Z
import abc from abc import ABCMeta class Component(object): __metaclass__ = ABCMeta def __init__(self, **kwargs): self._is_active = ( kwargs.get("active") if kwargs.get("active") is not None else True ) @abc.abstractmethod def name(self): raise NotImplementedError() def prepare(self, **kwargs): pass def build(self, **kwargs): pass @abc.abstractmethod def run(self, **kwargs): return NotImplementedError() def clean(self, **kwargs): pass def persist(self, **kwargs): pass @property def is_active(self): return self._is_active @is_active.setter def is_active(self, value): self._is_active = value
18.463415
78
0.599736
86
757
5.081395
0.395349
0.1373
0.128146
0.077803
0
0
0
0
0
0
0
0
0.297226
757
40
79
18.925
0.821429
0
0
0.214286
0
0
0.015852
0
0
0
0
0
0
1
0.321429
false
0.142857
0.071429
0.071429
0.535714
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
ee74d8312381b3dc6baa9e157f39a64cd21f9fab
128
py
Python
v2/backend/admin/__init__.py
jonfairbanks/rtsp-nvr
c770c77e74a062c63fb5e2419bc00a17543da332
[ "MIT" ]
558
2017-10-04T14:33:18.000Z
2022-03-24T21:25:08.000Z
v2/backend/admin/__init__.py
jonfairbanks/rtsp-nvr
c770c77e74a062c63fb5e2419bc00a17543da332
[ "MIT" ]
22
2018-04-29T04:25:49.000Z
2021-08-02T17:26:02.000Z
v2/backend/admin/__init__.py
jonfairbanks/rtsp-nvr
c770c77e74a062c63fb5e2419bc00a17543da332
[ "MIT" ]
127
2017-11-14T19:47:27.000Z
2022-03-24T21:25:12.000Z
from backend.magic import Bundle from .macro import macro from .model_admin import ModelAdmin admin_bundle = Bundle(__name__)
18.285714
35
0.820313
18
128
5.5
0.555556
0
0
0
0
0
0
0
0
0
0
0
0.132813
128
6
36
21.333333
0.891892
0
0
0
0
0
0
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
0
0
0
3
c98c216decafb4265625c2c1a358c0317db04961
63
py
Python
Aula Python/Aula 09 ex1.py
ayresmajor/Curso-python
006229cec38ea365bf43b19e3ce93fbd32e1dca6
[ "MIT" ]
null
null
null
Aula Python/Aula 09 ex1.py
ayresmajor/Curso-python
006229cec38ea365bf43b19e3ce93fbd32e1dca6
[ "MIT" ]
null
null
null
Aula Python/Aula 09 ex1.py
ayresmajor/Curso-python
006229cec38ea365bf43b19e3ce93fbd32e1dca6
[ "MIT" ]
null
null
null
frase = 'Curso em Vídeo Python' print('-'.join(frase.split()))
21
31
0.666667
9
63
4.666667
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.111111
63
2
32
31.5
0.75
0
0
0
0
0
0.349206
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
c99b68c40cc672d90fac6ad9450f20fefbd146ff
215
py
Python
run.py
marciks/flask-basic-skeleton
b53677598007295b602f52421b6defaabd30fc33
[ "MIT" ]
null
null
null
run.py
marciks/flask-basic-skeleton
b53677598007295b602f52421b6defaabd30fc33
[ "MIT" ]
null
null
null
run.py
marciks/flask-basic-skeleton
b53677598007295b602f52421b6defaabd30fc33
[ "MIT" ]
null
null
null
# WSGI Server for Development # Use this during development vs. apache. Can view via [url]:8001 # Run using virtualenv. 'env/bin/python run.py' from app import app app.run(host='127.0.0.1', port=5000, debug=True)
26.875
65
0.730233
38
215
4.131579
0.842105
0
0
0
0
0
0
0
0
0
0
0.076087
0.144186
215
7
66
30.714286
0.777174
0.637209
0
0
0
0
0.123288
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
c9b01a37b22b339d5207a9b783c9d7c5dc9c1b40
390
py
Python
challenge-64/test_solver.py
mauricioklein/algorithm-exercises
1be95762d000102795059255a0a0d2d21d4b67fc
[ "MIT" ]
3
2019-12-03T11:40:36.000Z
2020-06-28T19:39:51.000Z
challenge-64/test_solver.py
mauricioklein/algorithm-exercises
1be95762d000102795059255a0a0d2d21d4b67fc
[ "MIT" ]
null
null
null
challenge-64/test_solver.py
mauricioklein/algorithm-exercises
1be95762d000102795059255a0a0d2d21d4b67fc
[ "MIT" ]
null
null
null
import unittest from solver import look_and_say class TestSolver(unittest.TestCase): def test_look_and_say(self): self.assertEqual(look_and_say(1), "1") self.assertEqual(look_and_say(2), "11") self.assertEqual(look_and_say(3), "21") self.assertEqual(look_and_say(4), "1211") self.assertEqual(look_and_say(5), "111221") if __name__ == "__main__": unittest.main()
27.857143
47
0.723077
58
390
4.465517
0.448276
0.189189
0.27027
0.42471
0.482625
0
0
0
0
0
0
0.059347
0.135897
390
13
48
30
0.709199
0
0
0
0
0
0.058974
0
0
0
0
0
0.454545
1
0.090909
false
0
0.181818
0
0.363636
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
c9cab525bd1fddfcb5bc7b9b2eb43f87ff68a0ca
128
py
Python
terrascript/data/external.py
amlodzianowski/python-terrascript
1111affe6cd30d9b8b7bc74ae4e27590f7d4dc49
[ "BSD-2-Clause" ]
null
null
null
terrascript/data/external.py
amlodzianowski/python-terrascript
1111affe6cd30d9b8b7bc74ae4e27590f7d4dc49
[ "BSD-2-Clause" ]
null
null
null
terrascript/data/external.py
amlodzianowski/python-terrascript
1111affe6cd30d9b8b7bc74ae4e27590f7d4dc49
[ "BSD-2-Clause" ]
null
null
null
# terrascript/data/external.py import terrascript class external(terrascript.Data): pass __all__ = [ "external", ]
9.846154
33
0.695313
13
128
6.538462
0.615385
0.352941
0
0
0
0
0
0
0
0
0
0
0.195313
128
12
34
10.666667
0.825243
0.21875
0
0
0
0
0.081633
0
0
0
0
0
0
1
0
false
0.166667
0.166667
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
c9f54bccef7846790fbd097eea3dead5e698e582
2,215
py
Python
src/abaqus/Amplitude/DecayAmplitude.py
Haiiliin/PyAbaqus
f20db6ebea19b73059fe875a53be370253381078
[ "MIT" ]
7
2022-01-21T09:15:45.000Z
2022-02-15T09:31:58.000Z
src/abaqus/Amplitude/DecayAmplitude.py
Haiiliin/PyAbaqus
f20db6ebea19b73059fe875a53be370253381078
[ "MIT" ]
null
null
null
src/abaqus/Amplitude/DecayAmplitude.py
Haiiliin/PyAbaqus
f20db6ebea19b73059fe875a53be370253381078
[ "MIT" ]
null
null
null
from abaqusConstants import * from .Amplitude import Amplitude class DecayAmplitude(Amplitude): """The DecayAmplitude object defines an amplitude curve using an exponential decay. The DecayAmplitude object is derived from the Amplitude object. Notes ----- This object can be accessed by: .. code-block:: python import amplitude mdb.models[name].amplitudes[name] import odbAmplitude session.odbs[name].amplitudes[name] The corresponding analysis keywords are: - AMPLITUDE """ def __init__(self, name: str, initial: float, maximum: float, start: float, decayTime: float, timeSpan: SymbolicConstant = STEP): """This method creates a DecayAmplitude object. Notes ----- This function can be accessed by: .. code-block:: python mdb.models[name].DecayAmplitude session.odbs[name].DecayAmplitude Parameters ---------- name A String specifying the repository key. initial A Float specifying the constant A0A0. maximum A Float specifying the coefficient AA. start A Float specifying the starting time t0t0. Possible values are non-negative numbers. decayTime A Float specifying the decay time tdtd. Possible values are non-negative numbers. timeSpan A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP and TOTAL. The default value is STEP. Returns ------- A DecayAmplitude object. Raises ------ InvalidNameError RangeError """ super().__init__() pass def setValues(self, timeSpan: SymbolicConstant = STEP): """This method modifies the DecayAmplitude object. Parameters ---------- timeSpan A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP and TOTAL. The default value is STEP. Raises ------ RangeError """ pass
27.345679
99
0.590519
218
2,215
5.963303
0.385321
0.07
0.049231
0.058462
0.327692
0.269231
0.215385
0.169231
0.169231
0.169231
0
0.002738
0.340406
2,215
80
100
27.6875
0.887064
0.646501
0
0.222222
0
0
0
0
0
0
0
0
0
1
0.222222
false
0.222222
0.222222
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
a010ea36bc7820586b4a12c1e501c237d8f89dc1
1,016
py
Python
stamper/views.py
uploadcare/stump
8070ff42f01972fa86b4a2eaba580dad65482ef2
[ "MIT" ]
null
null
null
stamper/views.py
uploadcare/stump
8070ff42f01972fa86b4a2eaba580dad65482ef2
[ "MIT" ]
null
null
null
stamper/views.py
uploadcare/stump
8070ff42f01972fa86b4a2eaba580dad65482ef2
[ "MIT" ]
null
null
null
from django.shortcuts import render from django.http import HttpResponseRedirect from django.http import HttpResponse from django.views.generic import View from django.utils import timezone from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST from .models import WebhookLog import copy import json import datetime @csrf_exempt @require_POST def webhook(request): try: jsondata = request.body data = json.loads(jsondata) meta = copy.copy(request.META) for k, v in meta.items(): if not isinstance(v, basestring): del meta[k] WebhookLog.objects.create(date_generated=timezone.now(), body=jsondata, request_meta=json.dumps(meta), is_image=data['data']['is_image']) return HttpResponse(status=200) except Exception, e: print(e.message) else: pass finally: pass
28.222222
64
0.67815
125
1,016
5.448
0.488
0.117474
0.061674
0.088106
0.138032
0.138032
0.138032
0.138032
0
0
0
0.003916
0.246063
1,016
35
65
29.028571
0.885117
0
0
0.121212
0
0
0.011811
0
0
0
0
0
0
0
null
null
0.060606
0.363636
null
null
0.030303
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
1
0
0
0
0
3
4e41bd6840c600f96f506c02b19f482db530fabd
113
py
Python
storyscript/compiler/semantics/__init__.py
marqov/storyscript
4b99ff904305109cfb4310cb504127e2649ba44a
[ "MIT" ]
1
2019-05-06T14:04:40.000Z
2019-05-06T14:04:40.000Z
storyscript/compiler/semantics/__init__.py
marqov/storyscript
4b99ff904305109cfb4310cb504127e2649ba44a
[ "MIT" ]
null
null
null
storyscript/compiler/semantics/__init__.py
marqov/storyscript
4b99ff904305109cfb4310cb504127e2649ba44a
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from storyscript.compiler.semantics.Semantics import Semantics __all__ = ['Semantics']
18.833333
62
0.725664
12
113
6.5
0.75
0
0
0
0
0
0
0
0
0
0
0.010101
0.123894
113
5
63
22.6
0.777778
0.185841
0
0
0
0
0.1
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
4e46efae2c1395e883c864f7de109a9c519ce923
361
py
Python
app.py
MHolmblad13/LoLCalcDash
5bd128b668e471e27c212e7ec98d2e901f5cf629
[ "MIT" ]
null
null
null
app.py
MHolmblad13/LoLCalcDash
5bd128b668e471e27c212e7ec98d2e901f5cf629
[ "MIT" ]
null
null
null
app.py
MHolmblad13/LoLCalcDash
5bd128b668e471e27c212e7ec98d2e901f5cf629
[ "MIT" ]
null
null
null
import dash import dash_bootstrap_components as dbc external_stylesheets = [dbc.themes.CERULEAN,'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.1/css/all.min.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets,#) suppress_callback_exceptions=True) server = app.server suppress_callback_exceptions=True
36.1
122
0.772853
47
361
5.659574
0.659574
0.214286
0.195489
0.225564
0
0
0
0
0
0
0
0.012658
0.124654
361
10
123
36.1
0.829114
0.00277
0
0
0
0.142857
0.210826
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
4e520f009051d990e05052ba8bfd9ecd76f3ce5b
574
py
Python
oceanAcouPy/__init__.py
IvanaEscobar/oceanAcouPy
9ea11792dfe1cc0ba7004d23521fd222b4e949eb
[ "MIT" ]
null
null
null
oceanAcouPy/__init__.py
IvanaEscobar/oceanAcouPy
9ea11792dfe1cc0ba7004d23521fd222b4e949eb
[ "MIT" ]
null
null
null
oceanAcouPy/__init__.py
IvanaEscobar/oceanAcouPy
9ea11792dfe1cc0ba7004d23521fd222b4e949eb
[ "MIT" ]
null
null
null
from oceanAcouPy import attenuation from oceanAcouPy import beamform from oceanAcouPy import bottomLoss from oceanAcouPy import moi from oceanAcouPy import reflCoeff from oceanAcouPy import soundSpeed from oceanAcouPy import normalModes from oceanAcouPy import detectThreshold from oceanAcouPy import seafloor from oceanAcouPy import bubble __all__ = [ 'attenuation', 'beamform', 'bottomloss', 'moi', 'reflCoeff', 'soundSpeed', 'normalModes', 'detectThreshold', 'seafloor', 'bubble' ]
23.916667
39
0.695122
51
574
7.745098
0.27451
0.379747
0.531646
0
0
0
0
0
0
0
0
0
0.249129
574
23
40
24.956522
0.916473
0
0
0
0
0
0.158537
0
0
0
0
0
0
1
0
false
0
0.454545
0
0.454545
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
4e59986b53f605464a07f1bbecb62b406bd5491b
3,082
py
Python
tests/filters_test.py
ivan-californias/swcli
2a7df6bbe3396f44458971a93bfa108f9ca34ddf
[ "MIT" ]
null
null
null
tests/filters_test.py
ivan-californias/swcli
2a7df6bbe3396f44458971a93bfa108f9ca34ddf
[ "MIT" ]
null
null
null
tests/filters_test.py
ivan-californias/swcli
2a7df6bbe3396f44458971a93bfa108f9ca34ddf
[ "MIT" ]
null
null
null
import unittest from filters import Filters from tests.data import data class TestFilters(unittest.TestCase): def setUp(self): self.filters = Filters(None) def test_filter_data_equal(self): filtered = self.filters.filter_data(data, 'name', '=', 'John Doe') self.assertEqual(len(filtered), 1) self.assertEqual(filtered[0]['name'], 'John Doe') def test_filter_data_not_equal(self): filtered = self.filters.filter_data(data, 'name', '!=', 'John Doe') self.assertEqual(len(filtered), 2) self.assertEqual(filtered[0]['name'], 'Marie Freeman') self.assertEqual(filtered[1]['name'], 'Lisa Smith') def test_filter_data_is_contained(self): filtered = self.filters.filter_data(data, 'favourite_foods.name', '~>', 'Lemon Pie, Chocolate Cake') self.assertEqual(len(filtered), 2) self.assertEqual(filtered[0]['name'], 'John Doe') self.assertEqual(filtered[1]['name'], 'Lisa Smith') def test_filter_data_contains(self): filtered = self.filters.filter_data(data, 'address.city', '<~', 'Garden') self.assertEqual(len(filtered), 2) self.assertEqual(filtered[0]['name'], 'Marie Freeman') self.assertEqual(filtered[1]['name'], 'Lisa Smith') def test_filter_data_greater_than(self): filtered = self.filters.filter_data(data, 'age', '>', '40') self.assertEqual(len(filtered), 1) self.assertEqual(filtered[0]['name'], 'John Doe') def test_filter_data_greater_than_or_equal_to(self): filtered = self.filters.filter_data(data, 'age', '>=', '35') self.assertEqual(len(filtered), 2) self.assertEqual(filtered[0]['name'], 'John Doe') self.assertEqual(filtered[1]['name'], 'Lisa Smith') def test_filter_data_less_than(self): filtered = self.filters.filter_data(data, 'age', '<', '34') self.assertEqual(len(filtered), 1) self.assertEqual(filtered[0]['name'], 'Marie Freeman') def test_filter_data_less_than_or_equal_to(self): filtered = self.filters.filter_data(data, 'age', '<=', '35') self.assertEqual(len(filtered), 2) self.assertEqual(filtered[0]['name'], 'Marie Freeman') self.assertEqual(filtered[1]['name'], 'Lisa Smith') def test_filter_data_invalid_operator(self): with self.assertRaises(Exception) as err: filtered = self.filters.filter_data(data, 'age', '*+', '35') self.assertEqual(str(err.exception), 'Unknown operator \'*+\'') def test_filter_data_not_a_list(self): filtered = self.filters.filter_data('not a list', 'age', '>=', '35') self.assertEqual(filtered, 'not a list') def test_filter_data_field_not_found(self): filtered = self.filters.filter_data(data, 'old', '=', '35') self.assertEqual(len(filtered), 0) def test_filter_data_invalid_number(self): filtered = self.filters.filter_data(data, 'age', '>', 'five') self.assertEqual(len(filtered), 0) if __name__ == '__main__': unittest.main()
35.837209
108
0.64828
383
3,082
5.020888
0.180157
0.195008
0.167447
0.106084
0.791992
0.728029
0.690588
0.626625
0.605824
0.560062
0
0.014877
0.193056
3,082
85
109
36.258824
0.758343
0
0
0.396552
0
0
0.123297
0
0
0
0
0
0.448276
1
0.224138
false
0
0.051724
0
0.293103
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
1
0
0
0
0
0
0
0
3
4e5c938b8291a028c03c153d39ede00ebb72405b
87
py
Python
SpeechSite/apps/Speech/apps.py
take2make/SpeechRecognitionSite
d43d6ad7021c0b22d304a7d7ee9a6e21992eeedc
[ "MIT" ]
null
null
null
SpeechSite/apps/Speech/apps.py
take2make/SpeechRecognitionSite
d43d6ad7021c0b22d304a7d7ee9a6e21992eeedc
[ "MIT" ]
null
null
null
SpeechSite/apps/Speech/apps.py
take2make/SpeechRecognitionSite
d43d6ad7021c0b22d304a7d7ee9a6e21992eeedc
[ "MIT" ]
null
null
null
from django.apps import AppConfig class SpeechConfig(AppConfig): name = 'Speech'
14.5
33
0.747126
10
87
6.5
0.9
0
0
0
0
0
0
0
0
0
0
0
0.172414
87
5
34
17.4
0.902778
0
0
0
0
0
0.068966
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
4e61faeb55542a969e118a1d9a108e31dce3c9aa
275
py
Python
backend/groups/admin.py
donicrazy/ChatApp
ab129a9c0706bbb972cbce43283ba6e06d144635
[ "MIT" ]
null
null
null
backend/groups/admin.py
donicrazy/ChatApp
ab129a9c0706bbb972cbce43283ba6e06d144635
[ "MIT" ]
7
2021-03-19T04:47:13.000Z
2022-01-13T02:02:46.000Z
backend/groups/admin.py
donicrazy/ChatApp
ab129a9c0706bbb972cbce43283ba6e06d144635
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import ( ChatGroup, GroupMembership, GroupMessage, GroupMessageInfo, ) admin.site.register(ChatGroup) admin.site.register(GroupMembership) admin.site.register(GroupMessage) admin.site.register(GroupMessageInfo)
19.642857
37
0.785455
28
275
7.714286
0.428571
0.166667
0.314815
0
0
0
0
0
0
0
0
0
0.127273
275
13
38
21.153846
0.9
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.181818
0
0.181818
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
4e7805e56ba88e9c912b30b8ebf98c4d4ef9ea0a
153
py
Python
niimpy/test_read_sql.py
AaltoRSE/niimpy
e0b6ea5c69e93676730af0b05f23322489fc1781
[ "MIT" ]
null
null
null
niimpy/test_read_sql.py
AaltoRSE/niimpy
e0b6ea5c69e93676730af0b05f23322489fc1781
[ "MIT" ]
null
null
null
niimpy/test_read_sql.py
AaltoRSE/niimpy
e0b6ea5c69e93676730af0b05f23322489fc1781
[ "MIT" ]
null
null
null
import niimpy from . import read from . import sampledata def test_read_sql(): data = niimpy.read_sql(sampledata.DATA, table='AwareScreen')
21.857143
64
0.718954
20
153
5.35
0.55
0.186916
0
0
0
0
0
0
0
0
0
0
0.189542
153
7
65
21.857143
0.862903
0
0
0
0
0
0.071429
0
0
0
0
0
0
1
0.2
false
0
0.6
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
0
0
0
3
4eb1fce0d88ffc6ec03c8bfa6eb6b095eb4881ea
879
py
Python
test/test_test.py
otaithleigh/opswrapper
b3273a3e76d4b07f990fb6949f3a51d0ce6670f0
[ "MIT" ]
3
2020-04-07T06:43:42.000Z
2021-12-13T16:45:03.000Z
test/test_test.py
otaithleigh/opswrapper
b3273a3e76d4b07f990fb6949f3a51d0ce6670f0
[ "MIT" ]
null
null
null
test/test_test.py
otaithleigh/opswrapper
b3273a3e76d4b07f990fb6949f3a51d0ce6670f0
[ "MIT" ]
null
null
null
from pytest import raises from opswrapper import test def test_standard(): generated = test.NormUnbalance(1e-8, 50).tcl_code() expected = 'test NormUnbalance 1e-08 50 0 2' assert generated == expected def test_with_flags(): generated = test.NormUnbalance(1e-8, 50, 2, 2).tcl_code() expected = 'test NormUnbalance 1e-08 50 2 2' assert generated == expected def test_with_str_field(): generated = test.NormDispIncr('$tol', 50, 2, 2).tcl_code() expected = 'test NormDispIncr $tol 50 2 2' assert generated == expected def test_alternate_format(): generated = test.NormUnbalance(1e-8, 50, 2, 2).tcl_code({float: '.2e'}) expected = 'test NormUnbalance 1.00e-08 50 2 2' assert generated == expected def test_bad_print_flag(): the_test = test.EnergyIncr(1e-4, 50, 8) with raises(ValueError): the_test.tcl_code()
25.852941
75
0.687144
127
879
4.614173
0.307087
0.174061
0.040956
0.163823
0.645051
0.645051
0.53413
0.428328
0.259386
0.136519
0
0.074965
0.195677
879
33
76
26.636364
0.75389
0
0
0.181818
1
0
0.150171
0
0
0
0
0
0.181818
1
0.227273
false
0
0.090909
0
0.318182
0.045455
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
4ebddabe964222bc8c27e88b37dd7090307eb4e9
1,821
py
Python
python/pyspark_hbase/sql/context.py
CrazyZero1/astro
99cc67d3c279b86ad771e582eafdb79ded6d8d04
[ "Apache-2.0" ]
365
2015-07-23T01:34:46.000Z
2022-03-09T23:40:58.000Z
python/pyspark_hbase/sql/context.py
CrazyZero1/astro
99cc67d3c279b86ad771e582eafdb79ded6d8d04
[ "Apache-2.0" ]
30
2015-07-30T09:29:51.000Z
2016-05-15T18:08:12.000Z
python/pyspark_hbase/sql/context.py
CrazyZero1/astro
99cc67d3c279b86ad771e582eafdb79ded6d8d04
[ "Apache-2.0" ]
196
2015-07-16T07:01:27.000Z
2022-02-27T10:16:21.000Z
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You 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. # from pyspark.sql import SQLContext from py4j.java_gateway import java_import def register(sc): java_import(sc._gateway.jvm, "org.apache.spark.sql.hbase.HBaseSQLContext") __all__ = ["HBaseSQLContext"] class HBaseSQLContext(SQLContext): """A variant of Spark SQL that integrates with data stored in HBase. """ def __init__(self, sparkContext): """Create a new HbaseContext. @param sparkContext: The SparkContext to wrap. """ SQLContext.__init__(self, sparkContext) self._scala_HBaseSQLContext = self._get_hbase_ctx() @property def _ssql_ctx(self): if self._scala_HBaseSQLContext is None: print ("loading hbase context ..") self._scala_HBaseSQLContext = self._get_hbase_ctx() if self._scala_SQLContext is None: self._scala_SQLContext = self._scala_HBaseSQLContext return self._scala_HBaseSQLContext def _get_hbase_ctx(self): return self._jvm.HBaseSQLContext(self._jsc.sc()) #TODO: add tests if for main
35.705882
78
0.732015
244
1,821
5.286885
0.483607
0.048837
0.093023
0.024806
0.060465
0.060465
0.060465
0
0
0
0
0.003406
0.19385
1,821
50
79
36.42
0.875341
0.507963
0
0.105263
0
0
0.094186
0.048837
0
0
0
0.02
0
1
0.210526
false
0
0.157895
0.052632
0.526316
0.052632
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
0
1
0
0
3
4ec13034e7bc4530b6ca7e00a16724b31a54d68f
2,328
py
Python
leetcode/google/tagged/medium/missing_ranges_test.py
alvinctk/google-tech-dev-guide
9d7759bea1f44673c2de4f25a94b27368928a59f
[ "Apache-2.0" ]
26
2019-06-07T05:29:47.000Z
2022-03-19T15:32:27.000Z
leetcode/google/tagged/medium/missing_ranges_test.py
alvinctk/google-tech-dev-guide
9d7759bea1f44673c2de4f25a94b27368928a59f
[ "Apache-2.0" ]
null
null
null
leetcode/google/tagged/medium/missing_ranges_test.py
alvinctk/google-tech-dev-guide
9d7759bea1f44673c2de4f25a94b27368928a59f
[ "Apache-2.0" ]
6
2019-10-10T06:39:28.000Z
2020-05-12T19:50:55.000Z
import unittest import missing_ranges as program class TestCase(unittest.TestCase): def setUp(self): self.missing_range = program.Solution().findMissingRanges self.t = self.assertMissingRange def assertMissingRange(self, ranges, lower, upper, answer): self.assertEqual(self.missing_range(ranges, lower, upper), answer) class TestProgram(TestCase): def test_example(self): self.t([0,1,3,50,75], 0, 99, ["2","4->49","51->74","76->99"]) def test_empty(self): self.t([], 4, -1, []) self.t([], 1, 1, ["1"]) self.t([], -1, -1, ["-1"]) self.t([], 0, 100, ["0->100"]) self.t([], -1, 100, ["-1->100"]) self.t([], -100, 100, ["-100->100"]) self.t([], -100, 0, ["-100->0"]) def test_repeat(self): self.t([1, 1, 1], 0, 100, ["0", "2->100"]) self.t([1, 1, 1, 1, 1, 1, 1, 1, 1], 0, 100, ["0", "2->100"]) def test_single(self): self.t([1, 3, 5, 7, 8, 9, 10], 0, 11, ["0", "2", "4", "6", "11"]) def test_missing_negative_range(self): self.t([-990,-800,-701,-60, -5], -999, -1, ["-999->-991", "-989->-801", "-799->-702", "-700->-61", "-59->-6", "-4->-1"]) self.t([-990,-800,-701,-60, -5], -991, -1, ["-991", "-989->-801", "-799->-702", "-700->-61", "-59->-6", "-4->-1"]) self.t([-990,-800,-701,-60, -5], -991, -4, ["-991", "-989->-801", "-799->-702", "-700->-61", "-59->-6", "-4"]) def test_missing_start(self): self.t([-1,1,3,50,100], -6, 100, ["-6->-2","0","2","4->49","51->99"]) self.t([-1,1,3,50,100], -2, 100, ["-2","0","2","4->49","51->99"]) self.t([1,3,50,100], 0, 100, ["0","2","4->49","51->99"]) self.t([50,100], 0, 100, ["0->49", "51->99"]) def test_missing_start_and_end(self): self.t([-6,1,3,50,100, 101], -6, 102, ["-5->0","2","4->49","51->99", "102"]) self.t([-6,0,3,50,100, 101], -6, 102, ["-5->-1","1->2","4->49","51->99", "102"]) self.t([-4,0,3,50,100, 101], -99, 102, ["-99->-5", "-3->-1","1->2","4->49","51->99", "102"]) self.t([-4,0,3,50,100, 101], -99, 999, ["-99->-5", "-3->-1","1->2","4->49","51->99", "102->999"]) def test_missing_end(self): self.t([0,1,3,50,100, 101], 0, 300, ["2","4->49","51->99", "102->300"]) if __name__ == "__main__": unittest.main()
42.327273
128
0.468643
397
2,328
2.68262
0.173804
0.112676
0.028169
0.050704
0.432864
0.39061
0.379343
0.292019
0.215023
0.215023
0
0.253476
0.196735
2,328
54
129
43.111111
0.316043
0
0
0
0
0
0.174828
0
0
0
0
0
0.071429
1
0.238095
false
0
0.047619
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
4ecb1827aee95ccc9210d2c90d07026b56eaa3c1
2,336
py
Python
src/pymysql/connection.py
rrickgauer/pymysql
d935df4e6f5e5f6a5ba63f2a18f1cd4adc29f964
[ "Apache-2.0" ]
null
null
null
src/pymysql/connection.py
rrickgauer/pymysql
d935df4e6f5e5f6a5ba63f2a18f1cd4adc29f964
[ "Apache-2.0" ]
null
null
null
src/pymysql/connection.py
rrickgauer/pymysql
d935df4e6f5e5f6a5ba63f2a18f1cd4adc29f964
[ "Apache-2.0" ]
null
null
null
import mysql.connector from mysql.connector.cursor import MySQLCursor, MySQLCursorPrepared, MySQLCursorDict from . import credentials as db_credentials class ConnectionBase: """A MySQL database connection""" #---------------------------------------------------------- # Constructor #---------------------------------------------------------- def __init__(self): self.connection = mysql.connector.MySQLConnection() #---------------------------------------------------------- # Connect to the database #---------------------------------------------------------- def connect(self): self.connection = mysql.connector.connect( user = db_credentials.USER, host = db_credentials.HOST, database = db_credentials.DATABASE, password = db_credentials.PASSWORD ) #---------------------------------------------------------- # Close the database connection #---------------------------------------------------------- def close(self): self.connection.close() #---------------------------------------------------------- # Commit the current transaction #---------------------------------------------------------- def commit(self): self.connection.commit() #---------------------------------------------------------- # Get a cursor from the database connection. # # Args: # a_dbCursorType (DbCursorTypes): Cursor type # # Returns: # MySQLCursor: The connected mysql cursor. #---------------------------------------------------------- def getCursor(self) -> MySQLCursor: return self.connection.cursor() class ConnectionPrepared(ConnectionBase): #---------------------------------------------------------- # Return a prepared cursor #---------------------------------------------------------- def getCursor(self) -> MySQLCursorPrepared: return self.connection.cursor(prepared=True) class ConnectionDict(ConnectionBase): #---------------------------------------------------------- # Return a dictionary cursor #---------------------------------------------------------- def getCursor(self) -> MySQLCursorDict: return self.connection.cursor(dictionary=True)
33.855072
84
0.411815
141
2,336
6.751773
0.319149
0.102941
0.07563
0.069328
0.067227
0
0
0
0
0
0
0
0.186644
2,336
68
85
34.352941
0.501053
0.488014
0
0
0
0
0
0
0
0
0
0
0
1
0.28
false
0.04
0.12
0.12
0.64
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
4ed214adf5736ce907af1cb579910377466f0202
683
py
Python
tests/optional-neg/test.py
lean-delivery/tf-readme-validator
85f537be2299ff30b94a22b1a91c9b53dbd18675
[ "Apache-2.0" ]
null
null
null
tests/optional-neg/test.py
lean-delivery/tf-readme-validator
85f537be2299ff30b94a22b1a91c9b53dbd18675
[ "Apache-2.0" ]
null
null
null
tests/optional-neg/test.py
lean-delivery/tf-readme-validator
85f537be2299ff30b94a22b1a91c9b53dbd18675
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python import unittest import sys sys.path.append('../../bin') target = __import__('tf_readme_validator') main = target.main readme = target.cfg['readme'] class Test1(unittest.TestCase): def test(self): result = main() self.assertEqual(result, 1) self.assertEqual('ok' in readme['Conditional creation'], False) self.assertEqual('ok' in readme['Code included in this module'], False) self.assertEqual('ok' in readme['Known issues / Limitations'], False) self.assertEqual('ok' in readme['Tests'], False) self.assertEqual('ok' in readme['Examples'], False) if __name__ == '__main__': unittest.main()
26.269231
79
0.660322
84
683
5.202381
0.47619
0.20595
0.194508
0.217391
0.331808
0.2746
0
0
0
0
0
0.00361
0.188873
683
25
80
27.32
0.785199
0.029283
0
0
0
0
0.20997
0
0
0
0
0
0.352941
1
0.058824
false
0
0.176471
0
0.294118
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
4eda889281d9dc493072cdef52d2e90ec2a2c06d
1,075
py
Python
test/TestApp.py
quadrupleflame/Untitled
022a80af4b0cde3144ac66f929ce31d95c08dd26
[ "MIT" ]
null
null
null
test/TestApp.py
quadrupleflame/Untitled
022a80af4b0cde3144ac66f929ce31d95c08dd26
[ "MIT" ]
12
2018-11-20T03:36:38.000Z
2018-11-20T13:14:34.000Z
test/TestApp.py
quadrupleflame/Untitled
022a80af4b0cde3144ac66f929ce31d95c08dd26
[ "MIT" ]
null
null
null
import unittest import os, sys from flask import Flask from app import auth, api, db, home, create_app import threading import pytest import requests global flask @pytest.fixture() def server(): flask = create_app() flask.run(host="localhost", port=5000) class TestApp(unittest.TestCase): def setUp(self, *args): return def tearDown(self): pass def test_init(self): # self.assertEqual(type(flask), Flask) self.assertEqual('foo'.upper(), 'FOO') def test_db(self): # database = db.init_app(flask) # self.assertEqual(type(database), type(None)) self.assertTrue('FOO'.isupper()) self.assertFalse('Foo'.isupper()) def test_api(self): s = 'hello world' self.assertEqual(s.split(), ['hello', 'world']) # check that s.split fails when the separator is not a string with self.assertRaises(TypeError): s.split(2) def test_auth(self): pass def test_home(self): pass if __name__ == '__main__': unittest.main()
21.078431
69
0.624186
136
1,075
4.816176
0.477941
0.053435
0.033588
0.045802
0
0
0
0
0
0
0
0.006227
0.253023
1,075
50
70
21.5
0.809465
0.15907
0
0.090909
0
0
0.055617
0
0
0
0
0
0.151515
1
0.242424
false
0.090909
0.212121
0.030303
0.515152
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
14cfbb3b76c8d94e3ba1ed71447c7a8727442fdc
90
py
Python
watson-framework-archive/imcrypt/controllers/__init__.py
sigmundv/encrypt-image
b37bc93b56be1cc7934c44705df3ba52906fe18e
[ "BSD-2-Clause" ]
null
null
null
watson-framework-archive/imcrypt/controllers/__init__.py
sigmundv/encrypt-image
b37bc93b56be1cc7934c44705df3ba52906fe18e
[ "BSD-2-Clause" ]
null
null
null
watson-framework-archive/imcrypt/controllers/__init__.py
sigmundv/encrypt-image
b37bc93b56be1cc7934c44705df3ba52906fe18e
[ "BSD-2-Clause" ]
null
null
null
# -*- coding: utf-8 -*- from imcrypt.controllers.index import Index __all__ = ['Index']
15
43
0.666667
11
90
5.090909
0.818182
0
0
0
0
0
0
0
0
0
0
0.013158
0.155556
90
5
44
18
0.723684
0.233333
0
0
0
0
0.074627
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
14f0afbfdf6b53b9209c175efd2c5d896b9641e4
114
py
Python
socket-service/codenames.py
TheSmartMonkey/codename
a39946c8c705d50548f655838e4d32525c211e30
[ "MIT" ]
1
2021-01-09T17:45:40.000Z
2021-01-09T17:45:40.000Z
socket-service/codenames.py
TheSmartMonkey/codename
a39946c8c705d50548f655838e4d32525c211e30
[ "MIT" ]
null
null
null
socket-service/codenames.py
TheSmartMonkey/codename
a39946c8c705d50548f655838e4d32525c211e30
[ "MIT" ]
null
null
null
import json import sys import os import requests class Codenames(object): def __init__(self): pass
10.363636
24
0.701754
15
114
5.066667
0.8
0
0
0
0
0
0
0
0
0
0
0
0.245614
114
10
25
11.4
0.883721
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0.142857
0.571429
0
0.857143
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
3
0903711d93b32a588dfc14efa2cf6125e04231a3
332
py
Python
omsignal/utils/transform/__init__.py
eeishaan/ift6759-block1
59a7ff61c02b7ae5148a05b41e3aff3542e3c746
[ "Apache-2.0" ]
null
null
null
omsignal/utils/transform/__init__.py
eeishaan/ift6759-block1
59a7ff61c02b7ae5148a05b41e3aff3542e3c746
[ "Apache-2.0" ]
null
null
null
omsignal/utils/transform/__init__.py
eeishaan/ift6759-block1
59a7ff61c02b7ae5148a05b41e3aff3542e3c746
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 from abc import ABC, abstractmethod class OmTransform(ABC): ''' Abstract base class for custom transformers ''' @abstractmethod def __call__(self, x): pass def state(self): ''' This method should return the state of the transformer ''' pass
17.473684
62
0.599398
37
332
5.27027
0.756757
0
0
0
0
0
0
0
0
0
0
0.004386
0.313253
332
18
63
18.444444
0.850877
0.361446
0
0.285714
0
0
0
0
0
0
0
0
0
1
0.285714
false
0.285714
0.142857
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
09138ac9dc59df7b41a01f3d4fae1c6df94e099d
1,533
py
Python
mason/clients/engines/scheduler.py
kyprifog/mason
bf45672124ef841bc16216c293034f4ccc506621
[ "Apache-2.0" ]
4
2021-04-12T17:49:34.000Z
2022-01-23T19:54:29.000Z
mason/clients/engines/scheduler.py
kyprifog/mason
bf45672124ef841bc16216c293034f4ccc506621
[ "Apache-2.0" ]
24
2021-04-30T18:40:25.000Z
2021-05-12T20:52:06.000Z
mason/clients/engines/scheduler.py
kyprifog/mason
bf45672124ef841bc16216c293034f4ccc506621
[ "Apache-2.0" ]
3
2021-04-12T19:40:43.000Z
2021-09-07T21:56:36.000Z
from typing import Tuple, Optional, Union from abc import abstractmethod from mason.clients.base import Client from mason.engines.scheduler.models.dags.client_dag import ClientDag from mason.engines.scheduler.models.schedule import Schedule, InvalidSchedule from mason.clients.response import Response from mason.util.environment import MasonEnvironment class SchedulerClient: @abstractmethod def __init__(self, client: Client): self.client = client @abstractmethod def register_dag(self, schedule_name: str, valid_dag: 'ValidDag', schedule: Optional[Schedule], response: Response) -> Tuple[str, Response, Optional[ClientDag]]: # type: ignore raise NotImplementedError("Client method not implemented") @abstractmethod def trigger_schedule(self, schedule_name: str, response: Response, env: MasonEnvironment) -> Response: raise NotImplementedError("Client method not implemented") @abstractmethod def delete_schedule(self, schedule_name: str, response: Response) -> Response: raise NotImplementedError("Client method not implemented") @abstractmethod def validate_schedule(self, schedule: Optional[str]) -> Union[Optional[Schedule], InvalidSchedule]: raise NotImplementedError("Client method not implemented") # TODO: Remove @abstractmethod def trigger_schedule_for_table(self, table_name: str, database_name: str, response: Response) -> Response: raise NotImplementedError("Client method not implemented")
39.307692
180
0.754077
165
1,533
6.89697
0.30303
0.089631
0.13181
0.158172
0.435852
0.381371
0.337434
0.282074
0.223199
0.142355
0
0
0.165036
1,533
38
181
40.342105
0.889063
0.016308
0
0.423077
0
0
0.101729
0
0
0
0
0.026316
0
1
0.230769
false
0
0.269231
0
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
0
1
0
0
3
092b5d67993ea744cb37a1b4efef2988f212b838
459
py
Python
sql4json/sql4json.py
bheni/sql4json
ea4ffdcb4bc0f957da4bc92c76f5e52406964bfc
[ "Apache-2.0" ]
7
2015-05-01T05:50:49.000Z
2022-03-20T03:45:18.000Z
sql4json/sql4json.py
bheni/sql4json
ea4ffdcb4bc0f957da4bc92c76f5e52406964bfc
[ "Apache-2.0" ]
1
2016-05-04T21:37:43.000Z
2016-05-04T21:37:43.000Z
sql4json/sql4json.py
bheni/sql4json
ea4ffdcb4bc0f957da4bc92c76f5e52406964bfc
[ "Apache-2.0" ]
null
null
null
import json from data_query_engine import DataQueryEngine class Sql4Json(object): def __init__(self, json_str, sql_str): self.data = json.loads(json_str, encoding="latin1") self.query_engine = DataQueryEngine(self.data, sql_str) def get_results(self): return self.query_engine.get_results() def __str__(self): return json.dumps(self.query_engine.get_results(), sort_keys=True, indent=4, separators=(',', ': '))
30.6
108
0.703704
61
459
4.95082
0.459016
0.145695
0.149007
0.119205
0.165563
0
0
0
0
0
0
0.007937
0.176471
459
15
108
30.6
0.791005
0
0
0
0
0
0.019565
0
0
0
0
0
0
1
0.3
false
0
0.2
0.2
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
09470992adb89f4cbc8258e18007c510bacc770f
132
py
Python
ifelse.py
chidanandpujar/Python_scripts
0ee70e07ef4ab4d8c04955466ea9b305bdac0a53
[ "Unlicense" ]
null
null
null
ifelse.py
chidanandpujar/Python_scripts
0ee70e07ef4ab4d8c04955466ea9b305bdac0a53
[ "Unlicense" ]
null
null
null
ifelse.py
chidanandpujar/Python_scripts
0ee70e07ef4ab4d8c04955466ea9b305bdac0a53
[ "Unlicense" ]
null
null
null
num=int(input("Enter number:")) if (num > 0): print(num,"is a positive number") else: print(num,"is not a positive number")
22
41
0.643939
22
132
3.863636
0.590909
0.188235
0.235294
0
0
0
0
0
0
0
0
0.009259
0.181818
132
5
42
26.4
0.777778
0
0
0
0
0
0.431818
0
0
0
0
0
0
1
0
false
0
0
0
0
0.4
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0959ea8d0dbdd1283bb93211fa2e7664e0b0e148
228
py
Python
poplerGUI/ui_logic_sitechange.py
bibsian/lter
5e5ac08b62e031ddabad490cc59db4a945ea20f6
[ "MIT" ]
5
2016-05-02T22:56:01.000Z
2016-08-18T23:03:05.000Z
poplerGUI/ui_logic_sitechange.py
bibsian/lter
5e5ac08b62e031ddabad490cc59db4a945ea20f6
[ "MIT" ]
11
2016-08-03T20:39:42.000Z
2016-10-18T22:03:38.000Z
poplerGUI/ui_logic_sitechange.py
bibsian/database-development
5e5ac08b62e031ddabad490cc59db4a945ea20f6
[ "MIT" ]
null
null
null
from PyQt4 import QtGui from Views import ui_dialog_sitechange as uichange class TablePreview(QtGui.QDialog, uichange.Ui_Dialog): def __init__(self, parent=None): super().__init__(parent) self.setupUi(self)
28.5
54
0.745614
30
228
5.3
0.666667
0.100629
0
0
0
0
0
0
0
0
0
0.005291
0.171053
228
7
55
32.571429
0.835979
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
095e57c13b382eb52a527ce55a298ed55f3494ba
218
py
Python
models/__init__.py
kun-woo-park/Mobile_Stereo_Net_RealSense
993e21f35bf4d8b8e060849301d42784f77e53d3
[ "Apache-2.0" ]
76
2021-08-24T01:39:17.000Z
2022-03-17T02:23:46.000Z
models/__init__.py
kun-woo-park/Mobile_Stereo_Net_RealSense
993e21f35bf4d8b8e060849301d42784f77e53d3
[ "Apache-2.0" ]
13
2021-09-05T18:30:26.000Z
2022-02-24T15:13:59.000Z
models/__init__.py
kun-woo-park/Mobile_Stereo_Net_RealSense
993e21f35bf4d8b8e060849301d42784f77e53d3
[ "Apache-2.0" ]
21
2021-08-23T09:24:27.000Z
2022-03-29T04:10:32.000Z
# Copyright (c) 2021. All rights reserved. from models.MSNet2D import MSNet2D from models.MSNet3D import MSNet3D from models.submodule import model_loss __models__ = { "MSNet2D": MSNet2D, "MSNet3D": MSNet3D }
21.8
42
0.752294
27
218
5.888889
0.518519
0.188679
0
0
0
0
0
0
0
0
0
0.065934
0.165138
218
9
43
24.222222
0.807692
0.183486
0
0
0
0
0.079545
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.428571
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
1194cf3137c7a5f30049a3a185f9e902ef6ede18
1,316
py
Python
PositionalList.py
xliiauo/leetcode
e6c477802379168e084d076066f3b9e559dc553d
[ "MIT" ]
1
2016-05-08T15:51:05.000Z
2016-05-08T15:51:05.000Z
PositionalList.py
xliiauo/leetcode
e6c477802379168e084d076066f3b9e559dc553d
[ "MIT" ]
null
null
null
PositionalList.py
xliiauo/leetcode
e6c477802379168e084d076066f3b9e559dc553d
[ "MIT" ]
null
null
null
class _DoubleLinkedBase: class _Node: __slots__ = '_element', '_prev', '_next' def __init__(self, element, prev, next): self._element = element self._prev = prev self._next = next def __init__(self): self._header = self._Node(None, None, None) self._tailer = self._Node(None, None, None) self._header._next = self._tailer self._tailer._prev = self._header self._size = 0 def insert_between(self, e, prev, next): node = self._Node(e, prev, next) prev._next = node next._prev = node self._size += 1 return node def delete(self, node): node._prev._next = node._next node._next._prev = node._prev self._size -= 1 return node._element class PositionalList(_DoubleLinkedBase): class Position: def __init__(self, container, node): self._container = container self._node = node def element(self): return self._node._element def __eq__(self, other): return type(other) is type(self) and other._node is self._node def __ne__(self, other): return not (self == other) def _make_position(self, p): return self.Position(self, p)
28
74
0.580547
154
1,316
4.538961
0.214286
0.080114
0.04721
0.042918
0.180258
0.06867
0
0
0
0
0
0.003359
0.321429
1,316
47
75
28
0.779395
0
0
0
0
0
0.013667
0
0
0
0
0
0
1
0.243243
false
0
0
0.108108
0.513514
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
1196151bf092a455c2914325f794ac24175cfc91
472
py
Python
tests/test_base_repository.py
mamerisawesome/coeusfactory
73530e118a9354b8b91f8d4a59f7f025008f366d
[ "MIT" ]
1
2020-02-19T03:03:32.000Z
2020-02-19T03:03:32.000Z
tests/test_base_repository.py
mamerisawesome/coeusfactory
73530e118a9354b8b91f8d4a59f7f025008f366d
[ "MIT" ]
null
null
null
tests/test_base_repository.py
mamerisawesome/coeusfactory
73530e118a9354b8b91f8d4a59f7f025008f366d
[ "MIT" ]
null
null
null
def test_base_repository(): from coeusfactory.repositories.BaseRepository import BaseRepository br = BaseRepository(model="test", name=__name__) # return fails if no interface is created assert not br.get_all() assert not br.get_by_id(0) assert not br.get({}) assert not br.add({}) assert not br.delete_by_id(0) assert not br.delete({}) assert not br.update_by_id(0, {}) assert not br.update({}, {}) assert not br.count()
29.5
71
0.677966
69
472
4.449275
0.434783
0.263844
0.322476
0.136808
0.156352
0.156352
0
0
0
0
0
0.008
0.205508
472
15
72
31.466667
0.810667
0.082627
0
0
0
0
0.009281
0
0
0
0
0
0.75
1
0.083333
false
0
0.083333
0
0.166667
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
1
0
0
0
0
0
0
0
0
0
3
11968a9ceff4c99e46aff148aafd52e3ca44c30a
386
py
Python
Module 03/DjangoDesignPatternsandBestPracticesSecondEdition_Code/src/sightings/admin.py
74gigi8/Learning-Path-Learn-Web-Development-with-Python
aa7e7e46f21b631484ff800788482f1f21c13220
[ "MIT" ]
41
2018-06-22T03:41:10.000Z
2022-03-21T19:59:53.000Z
Module 03/DjangoDesignPatternsandBestPracticesSecondEdition_Code/src/sightings/admin.py
74gigi8/Learning-Path-Learn-Web-Development-with-Python
aa7e7e46f21b631484ff800788482f1f21c13220
[ "MIT" ]
6
2018-05-27T08:34:25.000Z
2021-06-10T20:24:25.000Z
src/sightings/admin.py
fkallin/Superbook
a5874d3fbe04085cc4e62051c44a178a61dc289a
[ "MIT" ]
26
2018-10-06T08:39:24.000Z
2021-12-05T23:32:20.000Z
from django.contrib import admin from . import models class SightingAdmin(admin.ModelAdmin): list_display = ('superhero', 'power', 'location', 'sighted_on') date_hierarchy = 'sighted_on' search_fields = ['superhero'] ordering = ['superhero'] admin.site.register(models.Origin) admin.site.register(models.Location) admin.site.register(models.Sighting, SightingAdmin)
25.733333
67
0.746114
44
386
6.431818
0.568182
0.095406
0.180212
0.243816
0
0
0
0
0
0
0
0
0.126943
386
14
68
27.571429
0.839763
0
0
0
0
0
0.15544
0
0
0
0
0
0
1
0
false
0
0.2
0
0.7
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
11b1f4bbb9793ac47a00dbdc9f133afdfc71dc0f
1,695
py
Python
tests/metrics/test_metric.py
ad12/meddlr
dda5a4ad7855de3a34331c60599e3253f980e989
[ "Apache-2.0" ]
23
2021-11-05T02:00:01.000Z
2022-03-21T15:35:38.000Z
tests/metrics/test_metric.py
ad12/meddlr
dda5a4ad7855de3a34331c60599e3253f980e989
[ "Apache-2.0" ]
29
2021-11-04T22:18:26.000Z
2022-03-24T01:04:53.000Z
tests/metrics/test_metric.py
ad12/meddlr
dda5a4ad7855de3a34331c60599e3253f980e989
[ "Apache-2.0" ]
1
2022-01-25T22:34:51.000Z
2022-01-25T22:34:51.000Z
import unittest import torch from meddlr.metrics import Metric def metric_func(preds, targets, alpha, beta=0.1): return (alpha / beta) * (targets - preds).mean(dim=tuple(range(2, len(preds) + 1))) class MockMetric(Metric): def func(self, preds, targets, alpha, beta=0.1): # Return a BxC tensor return metric_func(preds, targets, alpha, beta) class TestMetric(unittest.TestCase): def test_compute(self): preds = torch.randn((3, 4, 30, 20)) targets = torch.randn((3, 4, 30, 20)) alpha = 0.1 beta = 0.1 expected_out = metric_func(preds, targets, alpha, beta=0.1) metric = MockMetric() metric(preds, targets, alpha, beta) out = metric.compute() assert out.shape == (3, 4) assert torch.all(out == expected_out) metric = MockMetric() metric(preds, targets, alpha, beta=beta) out = metric.compute() assert out.shape == (3, 4) assert torch.all(out == expected_out) metric = MockMetric() metric(preds, targets, alpha, beta=beta) metric(preds, targets, alpha, beta=beta) metric(preds, targets, alpha, beta=beta) out = metric.compute() assert len(metric.ids) == 9 assert out.shape == (9, 4) def test_to_pandas(self): preds = torch.randn((3, 4, 30, 20)) targets = torch.randn((3, 4, 30, 20)) alpha = 0.1 beta = 0.1 metric = MockMetric() metric(preds, targets, alpha, beta=beta) metric(preds, targets, alpha, beta=beta) metric(preds, targets, alpha, beta=beta) df = metric.to_pandas() assert len(df) == 9
28.25
87
0.587021
221
1,695
4.457014
0.21267
0.118782
0.207107
0.255838
0.714721
0.714721
0.683249
0.647716
0.586802
0.586802
0
0.039506
0.283186
1,695
59
88
28.728814
0.771193
0.011209
0
0.604651
0
0
0
0
0
0
0
0
0.162791
1
0.093023
false
0
0.069767
0.046512
0.255814
0
0
0
0
null
0
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
3
11b55878b79f83db5dc75f278ef2c4c69313d9b9
179
py
Python
Ex027.py
CaioBaima/cursoemvideo-python
e24460e5ec7ddc5721b7e0a2b4b750a045bce07e
[ "MIT" ]
null
null
null
Ex027.py
CaioBaima/cursoemvideo-python
e24460e5ec7ddc5721b7e0a2b4b750a045bce07e
[ "MIT" ]
null
null
null
Ex027.py
CaioBaima/cursoemvideo-python
e24460e5ec7ddc5721b7e0a2b4b750a045bce07e
[ "MIT" ]
null
null
null
nome = str(input('Digite o seu nome completo:\n')) lista = nome.split() print('Seu primeiro nome é:\n {}'.format(lista[0])) print('Seu último nome é:\n {}'.format(lista[-1]))
35.8
52
0.642458
30
179
3.833333
0.566667
0.13913
0.104348
0.208696
0.295652
0
0
0
0
0
0
0.012903
0.134078
179
4
53
44.75
0.729032
0
0
0
0
0
0.44
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
11d6174a1fcc9236b70ae5036be8db360dc6fdce
273
py
Python
Pacote Dawload/Projeto progamas Python/ex1041 Coordenadas de um ponto.py
wagnersistemalima/Exercicios-Python-URI-Online-Judge-Problems---Contests
d839a344b899c08f4199ff1ae22dd6ee931df6a2
[ "MIT" ]
1
2020-12-11T23:22:20.000Z
2020-12-11T23:22:20.000Z
Pacote Dawload/Projeto progamas Python/ex1041 Coordenadas de um ponto.py
wagnersistemalima/Exercicios-Python-URI-Online-Judge-Problems---Contests
d839a344b899c08f4199ff1ae22dd6ee931df6a2
[ "MIT" ]
null
null
null
Pacote Dawload/Projeto progamas Python/ex1041 Coordenadas de um ponto.py
wagnersistemalima/Exercicios-Python-URI-Online-Judge-Problems---Contests
d839a344b899c08f4199ff1ae22dd6ee931df6a2
[ "MIT" ]
null
null
null
#Ex 1041 Coordenadas de um ponto 10/04/2020 x, y = map(float, input().split()) if x > 0 and y > 0: print('Q1') elif x < 0 and y > 0: print('Q2') if x > 0 and y < 0: print('Q4') elif x < 0 and y < 0: print('Q3') elif x == 0 and y == 0: print('Origem')
18.2
43
0.527473
55
273
2.618182
0.454545
0.069444
0.173611
0.208333
0.527778
0.527778
0.527778
0
0
0
0
0.134021
0.289377
273
14
44
19.5
0.608247
0.153846
0
0
0
0
0.061404
0
0
0
0
0
0
1
0
true
0
0
0
0
0.454545
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
3
11e2395c17af20cb94e18740a7a77f674974f264
501
py
Python
riotwrapper/const/val_const.py
Victoraq/Riot-API-Wrapper
7c5367314e60fbea333933bf0d6660f003dd2efc
[ "MIT" ]
null
null
null
riotwrapper/const/val_const.py
Victoraq/Riot-API-Wrapper
7c5367314e60fbea333933bf0d6660f003dd2efc
[ "MIT" ]
null
null
null
riotwrapper/const/val_const.py
Victoraq/Riot-API-Wrapper
7c5367314e60fbea333933bf0d6660f003dd2efc
[ "MIT" ]
null
null
null
# flake8: noqa # fmt: off """List of Valorant API available regions and endpoints.""" REGION_URL = { "BR": "https://br.api.riotgames.com", "EUN": "https://eun.api.riotgames.com", "AP": "https://ap.api.riotgames.com", "KR": "https://kr.api.riotgames.com", "LATAM": "https://latam.api.riotgames.com", "NA": "https://na.api.riotgames.com", } API_PATH = { "platform_data": "{region_url}/val/status/v1/platform-data", "contents": "{region_url}/val/status/v1/contents", }
26.368421
64
0.626747
68
501
4.544118
0.441176
0.23301
0.291262
0.116505
0.12945
0
0
0
0
0
0
0.007009
0.145709
501
19
65
26.368421
0.714953
0.151697
0
0
0
0
0.677804
0.178998
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
11f5dd718f0f2a03bc426b20a6b5ead465e2ec9e
4,974
py
Python
lunar_python/LunarTime.py
6tail/lunar-python
96e17121371009a524728d11c93d5a97119e27d5
[ "MIT" ]
61
2020-07-16T00:53:24.000Z
2022-03-28T14:21:34.000Z
lunar_python/LunarTime.py
6tail/lunar-python
96e17121371009a524728d11c93d5a97119e27d5
[ "MIT" ]
4
2020-09-23T08:03:40.000Z
2022-02-21T06:09:08.000Z
lunar_python/LunarTime.py
6tail/lunar-python
96e17121371009a524728d11c93d5a97119e27d5
[ "MIT" ]
25
2020-05-25T00:26:25.000Z
2022-03-29T03:13:54.000Z
# -*- coding: utf-8 -*- from . import NineStar from .util import LunarUtil class LunarTime: """ 时辰 """ def __init__(self, lunar_year, lunar_month, lunar_day, hour, minute, second): from . import Lunar self.__lunar = Lunar.fromYmdHms(lunar_year, lunar_month, lunar_day, hour, minute, second) self.__zhiIndex = LunarUtil.getTimeZhiIndex("%02d:%02d" % (hour, minute)) self.__ganIndex = (self.__lunar.getDayGanIndexExact() % 5 * 2 + self.__zhiIndex) % 10 @staticmethod def fromYmdHms(lunar_year, lunar_month, lunar_day, hour, minute, second): return LunarTime(lunar_year, lunar_month, lunar_day, hour, minute, second) def getGan(self): return LunarUtil.GAN[self.__ganIndex + 1] def getZhi(self): return LunarUtil.ZHI[self.__zhiIndex + 1] def getGanZhi(self): return self.getGan() + self.getZhi() def getShengXiao(self): return LunarUtil.SHENGXIAO[self.__zhiIndex + 1] def getPositionXi(self): return LunarUtil.POSITION_XI[self.__ganIndex + 1] def getPositionXiDesc(self): return LunarUtil.POSITION_DESC[self.getPositionXi()] def getPositionYangGui(self): return LunarUtil.POSITION_YANG_GUI[self.__ganIndex + 1] def getPositionYangGuiDesc(self): return LunarUtil.POSITION_DESC[self.getPositionYangGui()] def getPositionYinGui(self): return LunarUtil.POSITION_YIN_GUI[self.__ganIndex + 1] def getPositionYinGuiDesc(self): return LunarUtil.POSITION_DESC[self.getPositionYinGui()] def getPositionFu(self): return LunarUtil.POSITION_FU[self.__ganIndex + 1] def getPositionFuDesc(self): return LunarUtil.POSITION_DESC[self.getPositionFu()] def getPositionCai(self): return LunarUtil.POSITION_CAI[self.__ganIndex + 1] def getPositionCaiDesc(self): return LunarUtil.POSITION_DESC[self.getPositionCai()] def getChong(self): return LunarUtil.CHONG[self.__zhiIndex + 1] def getChongGan(self): return LunarUtil.CHONG_GAN[self.__ganIndex + 1] def getChongGanTie(self): return LunarUtil.CHONG_GAN_TIE[self.getGan()] def getChongShengXiao(self): chong = self.getChong() for i in range(0, len(LunarUtil.ZHI)): if LunarUtil.ZHI[i] == chong: return LunarUtil.SHENGXIAO[i] return "" def getChongDesc(self): return "(" + self.getChongGan() + self.getChong() + ")" + self.getChongShengXiao() def getSha(self): return LunarUtil.SHA[self.getZhi()] def getNaYin(self): return LunarUtil.NAYIN[self.getGanZhi()] def getTianShen(self): offset = LunarUtil.ZHI_TIAN_SHEN_OFFSET[self.__lunar.getDayZhiExact()] return LunarUtil.TIAN_SHEN[(self.__zhiIndex + offset) % 12 + 1] def getTianShenType(self): return LunarUtil.TIAN_SHEN_TYPE[self.getTianShen()] def getTianShenLuck(self): return LunarUtil.TIAN_SHEN_TYPE_LUCK[self.getTianShenType()] def getYi(self): """ 获取时宜 :return: 宜 """ return LunarUtil.getTimeYi(self.__lunar.getDayInGanZhiExact(), self.getGanZhi()) def getJi(self): """ 获取时忌 :return: 忌 """ return LunarUtil.getTimeJi(self.__lunar.getDayInGanZhiExact(), self.getGanZhi()) def getNineStar(self): solar_ymd = self.__lunar.getSolar().toYmd() jie_qi = self.__lunar.getJieQiTable() asc = False if jie_qi["冬至"] <= solar_ymd < jie_qi["夏至"]: asc = True start = 7 if asc else 3 day_zhi = self.__lunar.getDayZhi() if day_zhi in "子午卯酉": start = 1 if asc else 9 elif day_zhi in "辰戌丑未": start = 4 if asc else 6 index = start + self.__zhiIndex - 1 if asc else start - self.__zhiIndex - 1 if index > 8: index -= 9 if index < 0: index += 9 return NineStar.fromIndex(index) def getGanIndex(self): return self.__ganIndex def getZhiIndex(self): return self.__zhiIndex def __str__(self): return self.toString() def toString(self): return self.getGanZhi() def getXun(self): """ 获取时辰所在旬 :return: 旬 """ return LunarUtil.getXun(self.getGanZhi()) def getXunKong(self): """ 获取值时空亡 :return: 空亡(旬空) """ return LunarUtil.getXunKong(self.getGanZhi()) def getMinHm(self): hour = self.__lunar.getHour() if hour < 1: return "00:00" elif hour > 22: return "23:00" return "%02d:00", hour - 1 if hour % 2 == 0 else hour def getMaxHm(self): hour = self.__lunar.getHour() if hour < 1: return "00:59" elif hour > 22: return "23:59" return "%02d:59", hour + 1 if hour % 2 != 0 else hour
28.751445
97
0.616405
556
4,974
5.320144
0.25
0.087897
0.128465
0.091278
0.283976
0.215348
0.105477
0.105477
0.091278
0.062204
0
0.019668
0.274226
4,974
172
98
28.918605
0.799723
0.019904
0
0.053571
0
0
0.012038
0
0
0
0
0
0
1
0.330357
false
0
0.026786
0.241071
0.732143
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
11f6d2b3f9b1dfcf184b73c14314bb67a30f9916
117
py
Python
web_scraping/ec2files/ec2file94.py
nikibhatt/Groa
fc2d4ae87cb825e6d54a0831c72be16541eebe61
[ "MIT" ]
1
2020-04-08T20:11:48.000Z
2020-04-08T20:11:48.000Z
web_scraping/ec2files/ec2file94.py
cmgospod/Groa
31b3624bfe61e772b55f8175b4e95d63c9e67966
[ "MIT" ]
null
null
null
web_scraping/ec2files/ec2file94.py
cmgospod/Groa
31b3624bfe61e772b55f8175b4e95d63c9e67966
[ "MIT" ]
1
2020-09-12T07:07:41.000Z
2020-09-12T07:07:41.000Z
from scraper import * s = Scraper(start=167508, end=169289, max_iter=30, scraper_instance=94) s.scrape_letterboxd()
39
72
0.777778
18
117
4.888889
0.833333
0
0
0
0
0
0
0
0
0
0
0.152381
0.102564
117
3
73
39
0.685714
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3