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
05f5c4200cb6e9a7f74bc3a20114687cb596c358
277
py
Python
language_features/loops/for_continue.py
PrasadHonrao/python-samples
faa48aa3eaf2d67b8cef0114e1f6ef08e2c1300a
[ "MIT" ]
3
2018-08-20T13:00:01.000Z
2021-09-18T04:19:46.000Z
language_features/loops/for_continue.py
PrasadHonrao/python-samples
faa48aa3eaf2d67b8cef0114e1f6ef08e2c1300a
[ "MIT" ]
1
2021-06-25T20:25:02.000Z
2021-08-19T22:44:31.000Z
language_features/loops/for_continue.py
PrasadHonrao/python-samples
faa48aa3eaf2d67b8cef0114e1f6ef08e2c1300a
[ "MIT" ]
1
2021-09-18T23:51:20.000Z
2021-09-18T23:51:20.000Z
programming_languages = ["Python", "Scala", "Haskell", "F#", "C#", "JavaScript"] for lang in programming_languages: if (lang == "Haskell"): continue print("Found Haskell !!!", end='\n') # this statement will never be executed print(lang, end=' ')
39.571429
85
0.602888
31
277
5.322581
0.741935
0.242424
0
0
0
0
0
0
0
0
0
0
0.220217
277
7
86
39.571429
0.763889
0.133574
0
0
0
0
0.253219
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
05fc40877c0f99b6531ab92da8b5b8418ae240a6
341
py
Python
cacheback/tasks.py
kevin-brown/django-cacheback
f34b1942a90f13e9eaa7833c82df8190a32816d9
[ "MIT" ]
160
2015-01-02T05:55:29.000Z
2022-03-28T19:33:40.000Z
cacheback/tasks.py
kevin-brown/django-cacheback
f34b1942a90f13e9eaa7833c82df8190a32816d9
[ "MIT" ]
57
2015-01-08T03:32:55.000Z
2022-01-25T07:59:33.000Z
cacheback/tasks.py
kevin-brown/django-cacheback
f34b1942a90f13e9eaa7833c82df8190a32816d9
[ "MIT" ]
66
2015-01-13T14:41:59.000Z
2022-03-31T16:24:45.000Z
from celery import shared_task from django.conf import settings @shared_task(ignore_result=getattr(settings, 'CACHEBACK_TASK_IGNORE_RESULT', False)) def refresh_cache(klass_str, obj_args, obj_kwargs, call_args, call_kwargs): from .base import Job Job.perform_async_refresh(klass_str, obj_args, obj_kwargs, call_args, call_kwargs)
34.1
86
0.815249
52
341
4.980769
0.5
0.07722
0.123552
0.11583
0.324324
0.324324
0.324324
0.324324
0.324324
0.324324
0
0
0.108504
341
9
87
37.888889
0.851974
0
0
0
0
0
0.082111
0.082111
0
0
0
0
0
1
0.166667
false
0
0.5
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
0
0
0
2
af02a1d8b4580c6edee5866051174448c3182111
1,086
py
Python
backend/models.py
Virace/pdblog
d9a3e1df45e5e8b68c8c066e30b5ffb7d9f63e6c
[ "Apache-2.0" ]
null
null
null
backend/models.py
Virace/pdblog
d9a3e1df45e5e8b68c8c066e30b5ffb7d9f63e6c
[ "Apache-2.0" ]
null
null
null
backend/models.py
Virace/pdblog
d9a3e1df45e5e8b68c8c066e30b5ffb7d9f63e6c
[ "Apache-2.0" ]
null
null
null
from django.db import models # Create your models here. class Users(models.Model): status_list = ( ('0', '正常'), ('1', '封禁'), ('9', '删除') ) login = models.CharField(verbose_name='用户名', max_length=15, unique=True, null=False) passw = models.CharField(verbose_name='密码', max_length=30, null=False) nickname = models.CharField(verbose_name='昵称', max_length=15, unique=True) email = models.EmailField(verbose_name='邮箱', unique=True) url = models.URLField(verbose_name='网址', null=True) registered = models.DateTimeField(verbose_name='注册时间', auto_now_add=True) status = models.IntegerField(verbose_name='账户状态', choices=status_list, default=0) class UserToken(models.Model): user = models.OneToOneField(to=Users) token = models.CharField(verbose_name='密码', max_length=30, null=True) class Usermeta(models.Model): uid = models.OneToOneField(verbose_name='用户', to=UserToken) key = models.CharField(verbose_name='key', unique=True, max_length=20) value = models.CharField(verbose_name='value', max_length=20)
35.032258
88
0.699816
145
1,086
5.096552
0.434483
0.163735
0.17862
0.211096
0.173207
0.116373
0.116373
0.116373
0.116373
0
0
0.01741
0.153775
1,086
30
89
36.2
0.786725
0.022099
0
0
0
0
0.037771
0
0
0
0
0
0
1
0
false
0.047619
0.047619
0
0.809524
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
0
1
0
0
2
af0358ec5f3e948ae2556d56b80e029312055c69
464
py
Python
src/admin/database/demo.py
aimanow/sft
dce87ffe395ae4bd08b47f28e07594e1889da819
[ "Apache-2.0" ]
280
2016-07-19T09:59:02.000Z
2022-03-05T19:02:48.000Z
database/demo.py
YAR-SEN/GodMode2
d8a79b45c6d8b94f3d2af3113428a87d148d20d0
[ "WTFPL" ]
3
2016-07-20T05:36:49.000Z
2018-12-10T16:16:19.000Z
database/demo.py
YAR-SEN/GodMode2
d8a79b45c6d8b94f3d2af3113428a87d148d20d0
[ "WTFPL" ]
20
2016-07-20T10:51:34.000Z
2022-01-12T23:15:22.000Z
import sqlalchemy as sa from sqlalchemy.orm import relationship from godmode.database import database demo_database = database("sqlite:///database/demo.sqlite", connect_args={"check_same_thread": False}) class User(demo_database.TableBase): __table__ = sa.Table('users', demo_database.metadata, autoload=True) class Post(demo_database.TableBase): __table__ = sa.Table('posts', demo_database.metadata, autoload=True) user = relationship('User')
25.777778
101
0.769397
58
464
5.87931
0.465517
0.175953
0.123167
0.152493
0.381232
0.193548
0
0
0
0
0
0
0.116379
464
17
102
27.294118
0.831707
0
0
0
0
0
0.131466
0.064655
0
0
0
0
0
1
0
false
0
0.333333
0
0.888889
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
af07e4dd31a4914cbd33a4acf8cebab169c6aa64
155
py
Python
Pattern/45_pattern.py
manish1822510059/Python-1000-program
d03c1920fe63a7e32ac5bd9a13e2766d7a25756c
[ "Apache-2.0" ]
1
2021-03-06T03:33:42.000Z
2021-03-06T03:33:42.000Z
Pattern/45_pattern.py
manish1822510059/Python-1000-programs
d03c1920fe63a7e32ac5bd9a13e2766d7a25756c
[ "Apache-2.0" ]
null
null
null
Pattern/45_pattern.py
manish1822510059/Python-1000-programs
d03c1920fe63a7e32ac5bd9a13e2766d7a25756c
[ "Apache-2.0" ]
null
null
null
inc = 1 num = 1 for x in range (5,0,-1): for y in range(x,0,-1): print(" ",end="") print(str(num)*inc) num += 2 inc += 2
19.375
28
0.425806
28
155
2.357143
0.5
0.121212
0
0
0
0
0
0
0
0
0
0.092784
0.374194
155
8
29
19.375
0.587629
0
0
0
0
0
0.006711
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
af211838f27e90551ce31e75a4e8a30fd35abf54
668
py
Python
minibot/bs_repr.py
cornell-cup/cs-reminibot
411d1ed4b4f67f07f3608cb6ddb7f0b8d7a22b24
[ "Apache-2.0" ]
5
2020-09-05T18:57:33.000Z
2022-03-15T00:14:57.000Z
minibot/bs_repr.py
cornell-cup/cs-reminibot
411d1ed4b4f67f07f3608cb6ddb7f0b8d7a22b24
[ "Apache-2.0" ]
33
2019-11-07T22:42:13.000Z
2022-02-05T17:54:50.000Z
minibot/bs_repr.py
cornell-cup/cs-reminibot
411d1ed4b4f67f07f3608cb6ddb7f0b8d7a22b24
[ "Apache-2.0" ]
10
2019-09-28T16:44:10.000Z
2022-03-12T20:23:50.000Z
from collections import deque from socket import socket import time class BS_Repr: """ Represents a basestation that the Minibot is communicating with """ TIMEOUT_LIMIT = 5 def __init__(self, conn_sock: socket): self.last_status_time = time.time() self.conn_sock = conn_sock def update_status_time(self): self.last_status_time = time.time() def is_connected(self) -> bool: """ Checks whether the Basestation has sent a heartbeat message recently """ time_diff = time.time() - self.last_status_time # print(f"Time diff {time_diff}") return time_diff < BS_Repr.TIMEOUT_LIMIT
27.833333
81
0.672156
89
668
4.786517
0.47191
0.093897
0.098592
0.126761
0.122066
0.122066
0
0
0
0
0
0.001988
0.247006
668
23
82
29.043478
0.84493
0.270958
0
0.153846
0
0
0
0
0
0
0
0
0
1
0.230769
false
0
0.230769
0
0.692308
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
0
1
0
0
2
af287649caf833c7e12356bc40221f779ead86ac
4,036
py
Python
server-python3/wspty/PromptTerminal.py
Aaron-Ming/websocket_terminal
42c24391d51c275eabf1f879fb312b9a3614f51e
[ "MIT" ]
40
2016-11-20T09:48:27.000Z
2021-04-02T00:29:14.000Z
server-python3/wspty/PromptTerminal.py
Aaron-Ming/websocket_terminal
42c24391d51c275eabf1f879fb312b9a3614f51e
[ "MIT" ]
6
2018-01-07T03:43:22.000Z
2022-03-21T08:43:33.000Z
server-python3/wspty/PromptTerminal.py
glensc/websocket_terminal
42c24391d51c275eabf1f879fb312b9a3614f51e
[ "MIT" ]
20
2016-12-02T06:00:27.000Z
2021-08-15T11:40:34.000Z
import subprocess import sys import eventlet.queue import eventlet.tpool import eventlet.green.subprocess from eventlet import green from eventlet.greenpool import GreenPool from .BaseTerminal import BaseTerminal import logging logger = logging.getLogger(__name__) class SubprocessTerminal(BaseTerminal): def __init__(self, cmd): self.process = make_simple_process(cmd) self.queue = eventlet.queue.Queue() self.greenpool = self._start_consume() def _start_consume(self): greenpool = GreenPool(5) greenpool.spawn_n(self._consume_stream, self.process.stdout) greenpool.spawn_n(self._consume_stream, self.process.stderr) return greenpool def _consume_stream(self, stream): while True: data = stream.read() if not data: break self._send_to_slave(data) def recv(self, count=None): return self.master_to_slave(self.queue.get()) def _send_to_slave(self, data): self.queue.put(data) def send(self, data): data = self.slave_to_master(data) self.process.stdin.write(data) def slave_to_master(self, x): return x def master_to_slave(self, x): return x def close(self): self.process.kill() class LinuxTerminal(SubprocessTerminal): def __init__(self, cmd=None): if cmd is None: cmd = ['bash'] import shlex cmd = " ".join(map(shlex.quote, cmd)) cmd = ['script', '-qfc', cmd, '/dev/null'] super().__init__(cmd) class WindowsTerminal(SubprocessTerminal): def __init__(self, cmd=None): if cmd is None: cmd = ['cmd'] super().__init__(cmd) def slave_to_master(self, data): data = data.replace(b'\r', b'\r\n') self._send_to_slave(data) return data def master_to_slave(self, x): return x.replace(b'\n', b'\r\n') class NonBlockingSimplePipe: def __init__(self, stream): logger.debug("NonBlockingSimplePipe.__init__ type(stream) == {}".format(type(stream))) logger.debug("NonBlockingSimplePipe.__init__ type(stream).__name__ == {!r}".format(type(stream).__name__)) self.needs_thread = not is_greenpipe(stream) self.stream = stream def read(self): if self.needs_thread: return eventlet.tpool.execute(self._read) return self._read() def write(self, data): if self.needs_thread: return eventlet.tpool.execute(self._write, data) return self._write(data) def _read(self): return self.stream.read(2048) def _write(self, data): self.stream.write(data) self.stream.flush() class NonBlockingSimpleProcess: def __init__(self, cmd): self.proc = make_subprocess(cmd) self.stdin = NonBlockingSimplePipe(self.proc.stdin) self.stdout = NonBlockingSimplePipe(self.proc.stdout) self.stderr = NonBlockingSimplePipe(self.proc.stderr) def kill(self): self.proc.kill() def is_greenpipe(obj): # GreenFileIO is not exposed and GreenPipe is not a class, so checking by name return type(obj).__name__ == "GreenFileIO" def os_terminal(): return OS_TERMINALS[sys.platform]() def make_subprocess(obj): def green_popen(cmd): p = subprocess.PIPE return green.subprocess.Popen(cmd, stdin=p, stdout=p, stderr=p, bufsize=0) if isinstance(obj, str): return green_popen([obj]) if isinstance(obj, list): return green_popen(obj) if isinstance(obj, subprocess.Popen): return obj if isinstance(obj, green.subprocess.Popen): return obj raise Exception("Invalid argument to make_subprocess: {}".format(type(obj))) def make_simple_process(obj): if isinstance(obj, NonBlockingSimpleProcess): return obj proc = make_subprocess(obj) return NonBlockingSimpleProcess(proc) OS_TERMINALS = { 'linux': LinuxTerminal, 'win32': WindowsTerminal }
26.728477
114
0.652131
491
4,036
5.136456
0.217923
0.023791
0.021808
0.022205
0.250991
0.201427
0.201427
0.133228
0.076923
0.039651
0
0.002606
0.239346
4,036
150
115
26.906667
0.818893
0.018831
0
0.171171
0
0
0.052552
0.020465
0
0
0
0
0
1
0.225225
false
0
0.09009
0.063063
0.540541
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
0
1
0
0
2
af3c9ab2a4ffc5e73dde198e33c3f4ccce4a8ccb
1,388
py
Python
turnstile.py
RahulRaj97/design-pattern-fellowship
4fa40b5d7295874da431f75e0bae148befc4d2ae
[ "MIT" ]
null
null
null
turnstile.py
RahulRaj97/design-pattern-fellowship
4fa40b5d7295874da431f75e0bae148befc4d2ae
[ "MIT" ]
null
null
null
turnstile.py
RahulRaj97/design-pattern-fellowship
4fa40b5d7295874da431f75e0bae148befc4d2ae
[ "MIT" ]
null
null
null
""" State is a behavioral design pattern that lets an object alter its behavior when its internal state changes. It appears as if the object changed its class. """ import time from abc import abstractmethod class TurnstileStates(): """ The base State class """ @abstractmethod def enter(self): pass @abstractmethod def pay(self): pass class ClosedTurnstile(TurnstileStates): def __init__(self, g): self.gate = g def enter(self) : print("You must pay $1.00") def pay(self) : self.gate.transition_to(ProcessPayment(self.gate)) print("Processing Payment") class ProcessPayment(TurnstileStates): def __init__(self,g): self.gate=g def enter(self) : print("Procesing Payment") def pay(self) : print("Procesing Payment") class OpenTurnstile(TurnstileStates): def __init__(self,g): self.gate=g def enter(self) : print("Client Entered") self.gate.transition_to(ClosedTurnstile(self.gate)) print("Gate Closed") def pay(self) : print("Already Paid") class Turnstile(): def __init__(self): self.state = ClosedTurnstile(self) def transition_to(self, state): self.state = state def enter(self): self.state.enter() def pay(self): self.state.pay()
19.828571
109
0.622478
164
1,388
5.152439
0.347561
0.066272
0.071006
0.092308
0.188166
0.188166
0.188166
0.188166
0.188166
0.188166
0
0.002976
0.273775
1,388
69
110
20.115942
0.835317
0.127522
0
0.52381
0
0
0.090067
0
0
0
0
0
0
1
0.357143
false
0.047619
0.047619
0
0.52381
0.166667
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
0
1
0
0
2
af42dfca82d6a6bc811b31bec4684f795be6aa0c
8,290
py
Python
cloudcafe/identity/v2_0/extensions/osksadm/client.py
rcbops-qa/cloudcafe
d937f85496aadafbb94a330b9adb8ea18bee79ba
[ "Apache-2.0" ]
null
null
null
cloudcafe/identity/v2_0/extensions/osksadm/client.py
rcbops-qa/cloudcafe
d937f85496aadafbb94a330b9adb8ea18bee79ba
[ "Apache-2.0" ]
null
null
null
cloudcafe/identity/v2_0/extensions/osksadm/client.py
rcbops-qa/cloudcafe
d937f85496aadafbb94a330b9adb8ea18bee79ba
[ "Apache-2.0" ]
1
2020-04-13T17:44:28.000Z
2020-04-13T17:44:28.000Z
""" Copyright 2013 Rackspace Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from cloudcafe.identity.common.client import BaseIdentityAPIClient from cloudcafe.identity.v2_0.extensions.osksadm.models import requests from cloudcafe.identity.v2_0.models import responses from cloudcafe.identity.v2_0.extensions.osksadm.models.responses import ( Service, ServiceList) class OSKSADM_Client(BaseIdentityAPIClient): def get_users(self, requestslib_kwargs=None): url = "{0}/users".format(self.url) return self.get( url, response_entity_type=responses.UserList, requestslib_kwargs=requestslib_kwargs) def create_user( self, enabled=None, email=None, name=None, password=None, tenant_id=None, requestslib_kwargs=None): url = "{0}/users".format(self.url) model = requests.CreateUser( enabled=enabled, email=email, name=name, password=password, tenant_id=tenant_id) return self.post( url, response_entity_type=responses.UserAlt, request_entity=model, requestslib_kwargs=requestslib_kwargs) def update_user( self, url_user_id, enabled=None, email=None, name=None, user_id=None, tenant_id=None, requestslib_kwargs=None): url = "{0}/users/{1}".format(self.url, url_user_id) model = requests.UpdateUser( enabled=enabled, email=email, name=name, id_=user_id, tenant_id=tenant_id) return self.put( url, response_entity_type=responses.UserAlt, request_entity=model, requestslib_kwargs=requestslib_kwargs) def delete_user(self, user_id, requestslib_kwargs=None): url = "{0}/users/{1}".format(self.url, user_id) return self.delete(url, requestslib_kwargs=requestslib_kwargs) def get_user_global_roles(self, user_id, requestslib_kwargs=None): url = "{0}/users/{1}/roles".format(self.url, user_id) return self.get( url, response_entity_type=responses.RoleList, requestslib_kwargs=requestslib_kwargs) def add_global_role_to_user( self, user_id, role_id, requestslib_kwargs=None): url = "{0}/users/{1}/roles/{2}".format(self.url, user_id, role_id) return self.put(url, requestslib_kwargs=requestslib_kwargs) def delete_global_role_from_user( self, user_id, role_id, requestslib_kwargs=None): url = "{0}/users/{1}/roles/{2}".format(self.url, user_id, role_id) return self.delete(url, requestslib_kwargs=requestslib_kwargs) def create_tenant( self, name=None, description=None, enabled=None, requestslib_kwargs=None): url = "{0}/tenants".format(self.url) model = requests.CreateTenant( name=name, description=description, enabled=enabled) return self.post( url, response_entity_type=responses.Tenant, request_entity=model, requestslib_kwargs=requestslib_kwargs) def update_tenant( self, url_tenant_id, name=None, description=None, enabled=None, tenant_id=None, requestslib_kwargs=None): url = "{0}/tenants/{1}".format(self.url, url_tenant_id) model = requests.UpdateTenant( name=name, description=description, enabled=enabled, id_=tenant_id) return self.put( url, response_entity_type=responses.Tenant, request_entity=model, requestslib_kwargs=requestslib_kwargs) def delete_tenant(self, tenant_id, requestslib_kwargs=None): url = "{0}/tenants/{1}".format(self.url, tenant_id) return self.delete(url, requestslib_kwargs=requestslib_kwargs) def get_users_for_tenant( self, tenant_id, marker=None, limit=None, requestslib_kwargs=None): params = {} if marker: params["marker"] = marker if limit: params["limit"] = limit url = "{0}/tenants/{1}/users".format(self.url, tenant_id) return self.get( url, response_entity_type=responses.UserList, params=params, requestslib_kwargs=requestslib_kwargs) def add_role_to_user_for_tenant( self, tenant_id, user_id, role_id, requestslib_kwargs=None): url = "{0}/tenants/{1}/users/{2}/roles/OS-KSADM/{3}".format( self.url, tenant_id, user_id, role_id) return self.put(url, requestslib_kwargs=requestslib_kwargs) def delete_role_from_user_for_tenant( self, tenant_id, user_id, role_id, requestslib_kwargs=None): url = "{0}/tenants/{1}/users/{2}/roles/OS-KSADM/{3}".format( self.url, tenant_id, user_id, role_id) return self.delete(url, requestslib_kwargs=requestslib_kwargs) def get_role_by_name(self, name, requestslib_kwargs=None): url = "{0}/OS-KSADM/roles".format(self.url) params = {"name": name} return self.get( url, params=params, response_entity_type=responses.Role, requestslib_kwargs=requestslib_kwargs) def create_role( self, role_id=None, name=None, description=None, requestslib_kwargs=None): url = "{0}/OS-KSADM/roles".format(self.url) model = requests.CreateRole( id_=role_id, name=name, description=description) return self.post( url, response_entity_type=responses.Role, request_entity=model, requestslib_kwargs=requestslib_kwargs) def get_roles(self, requestslib_kwargs=None): url = "{0}/OS-KSADM/roles".format(self.url) return self.get( url, response_entity_type=responses.RoleList, requestslib_kwargs=requestslib_kwargs) def get_role_by_id(self, role_id, requestslib_kwargs=None): url = "{0}/OS-KSADM/roles/{1}".format(self.url, role_id) return self.get( url, response_entity_type=responses.Role, requestslib_kwargs=requestslib_kwargs) def delete_role( self, role_id, requestslib_kwargs=None): url = "{0}/OS-KSADM/roles/{1}".format(self.url, role_id) return self.delete(url, requestslib_kwargs=requestslib_kwargs) def get_services(self, marker=None, limit=None, requestslib_kwargs=None): params = {} if marker: params["marker"] = marker if limit: params["limit"] = limit url = "{0}/OS-KSADM/services".format(self.url) return self.get( url, response_entity_type=ServiceList, requestslib_kwargs=requestslib_kwargs) def create_service( self, service_id=None, name=None, type_=None, description=None, requestslib_kwargs=None): url = "{0}/OS-KSADM/services".format(self.url) model = requests.CreateService( id_=service_id, name=name, type_=type_, description=description) return self.post( url, request_entity=model, response_entity_type=Service, requestslib_kwargs=requestslib_kwargs) def get_service_by_name(self, name=None, requestslib_kwargs=None): url = "{0}/OS-KSADM/services".format(self.url) params = {"name": name} return self.get( url, params=params, response_entity_type=Service, requestslib_kwargs=requestslib_kwargs) def get_service_by_id(self, service_id, requestslib_kwargs=None): url = "{0}/OS-KSADM/services/{1}".format(self.url, service_id) return self.get( url, response_entity_type=Service, requestslib_kwargs=requestslib_kwargs) def delete_service(self, service_id, requestslib_kwargs=None): url = "{0}/OS-KSADM/services/{1}".format(self.url, service_id) return self.delete(url, requestslib_kwargs=requestslib_kwargs)
42.731959
79
0.670084
1,037
8,290
5.141755
0.124397
0.219993
0.090585
0.146662
0.796137
0.771943
0.675731
0.657727
0.609152
0.560015
0
0.00887
0.224849
8,290
193
80
42.953368
0.820884
0.066224
0
0.562914
0
0
0.064658
0.040347
0
0
0
0
0
1
0.152318
false
0.013245
0.02649
0
0.337748
0
0
0
0
null
1
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
0
0
0
0
0
0
0
0
0
0
2
af503485e3bcb9e015c81e6a4dc54582b4d0ae9c
146
py
Python
license/apps.py
KieranSweeden/fol.io
a6f231e3f9fb96841387b04d72131470c5fc3239
[ "OLDAP-2.5", "OLDAP-2.4", "OLDAP-2.3" ]
2
2021-06-15T16:46:50.000Z
2021-07-01T04:36:17.000Z
license/apps.py
KieranSweeden/fol.io
a6f231e3f9fb96841387b04d72131470c5fc3239
[ "OLDAP-2.5", "OLDAP-2.4", "OLDAP-2.3" ]
1
2021-07-07T07:01:22.000Z
2021-07-07T07:01:22.000Z
license/apps.py
KieranSweeden/fol.io
a6f231e3f9fb96841387b04d72131470c5fc3239
[ "OLDAP-2.5", "OLDAP-2.4", "OLDAP-2.3" ]
2
2022-01-17T02:45:58.000Z
2022-01-26T23:16:09.000Z
from django.apps import AppConfig class LicenseConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'license'
20.857143
56
0.760274
17
146
6.411765
0.882353
0
0
0
0
0
0
0
0
0
0
0
0.150685
146
6
57
24.333333
0.879032
0
0
0
0
0
0.246575
0.19863
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
af7bd58497bf1affcffbccc30d92bf647657f2bf
1,895
py
Python
spark_auto_mapper_fhir/value_sets/encounter_location_status.py
imranq2/SparkAutoMapper.FHIR
dd23b218fb0097d1edc2f3e688e8d6d4d7278bd2
[ "Apache-2.0" ]
1
2020-10-31T23:25:07.000Z
2020-10-31T23:25:07.000Z
spark_auto_mapper_fhir/value_sets/encounter_location_status.py
icanbwell/SparkAutoMapper.FHIR
98f368e781b46523142c7cb513c670d659a93c9b
[ "Apache-2.0" ]
null
null
null
spark_auto_mapper_fhir/value_sets/encounter_location_status.py
icanbwell/SparkAutoMapper.FHIR
98f368e781b46523142c7cb513c670d659a93c9b
[ "Apache-2.0" ]
null
null
null
from __future__ import annotations from spark_auto_mapper_fhir.fhir_types.uri import FhirUri from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType # This file is auto-generated by generate_classes so do not edit manually # noinspection PyPep8Naming class EncounterLocationStatusCode(GenericTypeCode): """ EncounterLocationStatus From: http://hl7.org/fhir/encounter-location-status in valuesets.xml The status of the location. """ def __init__(self, value: AutoMapperTextInputType): super().__init__(value=value) """ http://hl7.org/fhir/encounter-location-status """ codeset: FhirUri = "http://hl7.org/fhir/encounter-location-status" class EncounterLocationStatusCodeValues: """ The patient is planned to be moved to this location at some point in the future. From: http://hl7.org/fhir/encounter-location-status in valuesets.xml """ Planned = EncounterLocationStatusCode("planned") """ The patient is currently at this location, or was between the period specified. A system may update these records when the patient leaves the location to either reserved, or completed. From: http://hl7.org/fhir/encounter-location-status in valuesets.xml """ Active = EncounterLocationStatusCode("active") """ This location is held empty for this patient. From: http://hl7.org/fhir/encounter-location-status in valuesets.xml """ Reserved = EncounterLocationStatusCode("reserved") """ The patient was at this location during the period specified. Not to be used when the patient is currently at the location. From: http://hl7.org/fhir/encounter-location-status in valuesets.xml """ Completed = EncounterLocationStatusCode("completed")
33.839286
84
0.73562
229
1,895
5.973799
0.366812
0.035819
0.05117
0.071637
0.322368
0.255117
0.255117
0.201023
0.201023
0.201023
0
0.005151
0.180475
1,895
55
85
34.454545
0.875724
0.196834
0
0
0
0
0.097656
0
0
0
0
0
0
1
0.076923
false
0
0.307692
0
0.923077
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
af7d1a6a67abf71b68102358cc9c069a202e77d7
381
py
Python
web/api/routers.py
samuelfirst/nemoobot
b74ad66d4f2052eaba14e4b79e20c3da274b5909
[ "MIT" ]
1
2021-01-30T09:19:37.000Z
2021-01-30T09:19:37.000Z
web/api/routers.py
samuelfirst/nemoobot
b74ad66d4f2052eaba14e4b79e20c3da274b5909
[ "MIT" ]
2
2020-12-21T20:57:19.000Z
2021-01-26T08:08:09.000Z
web/api/routers.py
samuelfirst/nemoobot
b74ad66d4f2052eaba14e4b79e20c3da274b5909
[ "MIT" ]
1
2020-12-22T07:42:42.000Z
2020-12-22T07:42:42.000Z
from rest_framework import routers from api import views as api_views router = routers.DefaultRouter() router.register(r'users', api_views.UserViewSet) router.register(r'tokens', api_views.TokenViewSet) router.register(r'settings', api_views.SettingViewSet) router.register(r'custom_commands', api_views.CustomCommandsViewSet) router.register(r'notices', api_views.NoticeViewSet)
38.1
68
0.834646
51
381
6.078431
0.45098
0.154839
0.241935
0
0
0
0
0
0
0
0
0
0.062992
381
9
69
42.333333
0.868347
0
0
0
0
0
0.107612
0
0
0
0
0
0
1
0
false
0
0.25
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
0
0
0
0
0
0
0
0
2
af7d2747338ac6bec7dac968f19b7c31a3092ac3
1,627
py
Python
apps/productos/migrations/0005_auto_20180407_1223.py
franciscosf/PalerpWebSite
3a92a6e3019ac02d0661259e6e3af8fca5e39dc9
[ "MIT" ]
null
null
null
apps/productos/migrations/0005_auto_20180407_1223.py
franciscosf/PalerpWebSite
3a92a6e3019ac02d0661259e6e3af8fca5e39dc9
[ "MIT" ]
null
null
null
apps/productos/migrations/0005_auto_20180407_1223.py
franciscosf/PalerpWebSite
3a92a6e3019ac02d0661259e6e3af8fca5e39dc9
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2018-04-07 17:23 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('productos', '0004_auto_20180407_1210'), ] operations = [ migrations.AddField( model_name='compra', name='codigo_autorizacion', field=models.CharField(max_length=11, null=True), ), migrations.AddField( model_name='compra', name='email', field=models.CharField(max_length=150, null=True), ), migrations.AddField( model_name='compra', name='froma_pago', field=models.CharField(max_length=21, null=True), ), migrations.AddField( model_name='compra', name='medio_pago', field=models.CharField(max_length=21, null=True), ), migrations.AddField( model_name='compra', name='nombre_tarjeta_habiente', field=models.CharField(max_length=201, null=True), ), migrations.AddField( model_name='compra', name='numero_pedido', field=models.IntegerField(null=True), ), migrations.AddField( model_name='compra', name='numero_tarjeta', field=models.CharField(max_length=24, null=True), ), migrations.AlterField( model_name='compra', name='fecha', field=models.DateTimeField(null=True), ), ]
29.053571
62
0.559926
158
1,627
5.582278
0.392405
0.081633
0.136054
0.172336
0.572562
0.441043
0.399093
0.399093
0.297052
0.181406
0
0.041742
0.32268
1,627
55
63
29.581818
0.758621
0.04118
0
0.520833
1
0
0.114965
0.029544
0
0
0
0
0
1
0
false
0
0.041667
0
0.104167
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
af82310e151d9ec8b5f2d9af76f12bf5661b6026
297
py
Python
Services/SaveEmbeddingService.py
miguel-kjh/ReID-in-Sport-competitions
c7abd47e6ce659aa73e76f797215941a11416981
[ "MIT" ]
5
2021-06-30T07:41:42.000Z
2022-01-20T17:57:36.000Z
Services/SaveEmbeddingService.py
miguel-kjh/ReID-in-Sport-competitions
c7abd47e6ce659aa73e76f797215941a11416981
[ "MIT" ]
null
null
null
Services/SaveEmbeddingService.py
miguel-kjh/ReID-in-Sport-competitions
c7abd47e6ce659aa73e76f797215941a11416981
[ "MIT" ]
null
null
null
from abc import abstractmethod class SaveEmbeddingService: @abstractmethod def saveBodyInformation(self, filename: str, embediddingCollection: dict) -> None: pass @abstractmethod def loadInformation(self, filename: str): pass
21.214286
55
0.62963
23
297
8.130435
0.695652
0.181818
0.160428
0
0
0
0
0
0
0
0
0
0.313131
297
13
56
22.846154
0.916667
0
0
0.4
0
0
0
0
0
0
0
0
0
1
0.2
false
0.2
0.1
0
0.4
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
0
0
0
0
0
2
af888a1803a4835d344a58ca68071f9ed710c3cf
547
py
Python
soup/migrations/0005_auto_20180712_1226.py
aaron-meinema/cooksite
2c987e6933a44bfa985d15c77a71860782ba751e
[ "BSD-3-Clause" ]
null
null
null
soup/migrations/0005_auto_20180712_1226.py
aaron-meinema/cooksite
2c987e6933a44bfa985d15c77a71860782ba751e
[ "BSD-3-Clause" ]
null
null
null
soup/migrations/0005_auto_20180712_1226.py
aaron-meinema/cooksite
2c987e6933a44bfa985d15c77a71860782ba751e
[ "BSD-3-Clause" ]
null
null
null
# Generated by Django 2.1b1 on 2018-07-12 12:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('soup', '0004_auto_20180712_1217'), ] operations = [ migrations.AlterField( model_name='content', name='type', field=models.CharField(max_length=50), ), migrations.AlterField( model_name='contentline', name='content_line', field=models.CharField(max_length=256), ), ]
22.791667
51
0.581353
55
547
5.636364
0.672727
0.129032
0.16129
0.187097
0.187097
0
0
0
0
0
0
0.094987
0.30713
547
23
52
23.782609
0.722955
0.082267
0
0.235294
1
0
0.122
0.046
0
0
0
0
0
1
0
false
0
0.058824
0
0.235294
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
af9b6690fa1bee847307735c2b73b8bd55aa01fd
376
py
Python
src/data/load_dataset/twitter_predict.py
42-AI/DemocracyWatcher
14028eb210259e07347f4ee05546255be69356cc
[ "MIT" ]
3
2022-03-05T14:09:38.000Z
2022-03-07T21:08:39.000Z
src/data/load_dataset/twitter_predict.py
42-AI/DemocracyWatcher
14028eb210259e07347f4ee05546255be69356cc
[ "MIT" ]
56
2022-03-05T14:54:37.000Z
2022-03-29T21:52:02.000Z
src/data/load_dataset/twitter_predict.py
42-AI/SentimentalBB
14028eb210259e07347f4ee05546255be69356cc
[ "MIT" ]
null
null
null
import pandas as pd import numpy as np from unidecode import unidecode import os from src import config def get_tweets_csv(csv_path: str) -> np.array: df = pd.read_csv(csv_path) X = df['text'].apply(lambda row: unidecode(row)).to_numpy() return X def get_tweets_df(df) -> np.array: X = df['text'].apply(lambda row: unidecode(row)).to_numpy() return X
20.888889
63
0.696809
64
376
3.953125
0.421875
0.118577
0.094862
0.094862
0.371542
0.371542
0.371542
0.371542
0.371542
0.371542
0
0
0.183511
376
17
64
22.117647
0.824104
0
0
0.333333
0
0
0.021277
0
0
0
0
0
0
1
0.166667
false
0
0.416667
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
afb8f8d7032d23d92bbc198cc9aa27285b17959d
191
py
Python
honeybot/plugins/downloaded/comic/info.py
hailenwashere/honeybot
95a6cd54283db1dcd4b33b9d281a7f6e1056ec09
[ "MIT" ]
60
2019-06-04T13:57:38.000Z
2021-10-19T10:17:56.000Z
honeybot/plugins/downloaded/comic/info.py
hailenwashere/honeybot
95a6cd54283db1dcd4b33b9d281a7f6e1056ec09
[ "MIT" ]
70
2019-06-04T13:59:53.000Z
2021-10-05T10:14:16.000Z
honeybot/plugins/downloaded/comic/info.py
hailenwashere/honeybot
95a6cd54283db1dcd4b33b9d281a7f6e1056ec09
[ "MIT" ]
95
2019-06-04T15:13:42.000Z
2021-08-09T17:15:35.000Z
NAME = 'comic.py' ORIGINAL_AUTHORS = [ 'Miguel Boekhold' ] ABOUT = ''' Returns a random comic from xkcd ''' COMMANDS = ''' >>> .comic returns a url of a random comic ''' WEBSITE = ''
11.235294
32
0.617801
24
191
4.875
0.708333
0.136752
0.205128
0
0
0
0
0
0
0
0
0
0.225131
191
16
33
11.9375
0.790541
0
0
0.166667
0
0
0.531579
0
0
0
0
0
0
1
0
false
0
0
0
0
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
0
0
0
0
0
0
0
2
afc624142b7319f64089353bbcad4e8376cdec6c
283
py
Python
ScalableLSH/Deploy/client.py
USCDataScience/cmu-fg-bg-similarity
d8fc9a53937551f7a052bc2c6f442bcc29ea2615
[ "Apache-2.0" ]
8
2020-04-13T21:40:26.000Z
2022-01-22T11:32:31.000Z
ScalableLSH/Deploy/client.py
USCDataScience/cmu-fg-bg-similarity
d8fc9a53937551f7a052bc2c6f442bcc29ea2615
[ "Apache-2.0" ]
null
null
null
ScalableLSH/Deploy/client.py
USCDataScience/cmu-fg-bg-similarity
d8fc9a53937551f7a052bc2c6f442bcc29ea2615
[ "Apache-2.0" ]
null
null
null
import zmq context = zmq.Context() socket = context.socket(zmq.REQ) socket.connect("tcp://localhost:5555") socket.send(b"http://10.3.2.61/~ubuntu/projects/001_backpage/dataset/corpus/ImagesNevada/Nevada_2012_10_10_1349862492000_4_0.jpg" + "\0") message = socket.recv() print message
35.375
137
0.777385
44
283
4.840909
0.727273
0.093897
0
0
0
0
0
0
0
0
0
0.139098
0.060071
283
7
138
40.428571
0.661654
0
0
0
0
0.142857
0.480565
0
0
0
0
0
0
0
null
null
0
0.142857
null
null
0.142857
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
1
0
0
0
0
0
0
0
0
2
bb61e8e1807ed497f73f967386d10e1d15cedd1d
857
py
Python
userlib/analysislib/paco_analysis/kepco_trace.py
specialforcea/labscript_suite
a4ad5255207cced671990fff94647b1625aa0049
[ "BSD-2-Clause" ]
null
null
null
userlib/analysislib/paco_analysis/kepco_trace.py
specialforcea/labscript_suite
a4ad5255207cced671990fff94647b1625aa0049
[ "BSD-2-Clause" ]
null
null
null
userlib/analysislib/paco_analysis/kepco_trace.py
specialforcea/labscript_suite
a4ad5255207cced671990fff94647b1625aa0049
[ "BSD-2-Clause" ]
null
null
null
from __future__ import division from lyse import * from pylab import * from analysislib.common.fit_gaussian_2d import fit_2d from analysislib.common.traces import * from analysislib.spinor.aliases import * from time import time from scipy.ndimage import * from mpl_toolkits.axes_grid1 import make_axes_locatable import os import pandas as pd import numpy as np import numexpr as ne import matplotlib.gridspec as gridspec from analysislib import fit_table # Parameters pixel_size = 5.6e-6/4 # Divided by Magnification Factor # Time stamp print '\nRunning %s' % os.path.basename(__file__) t = time() def print_time(s): print 't = %6.3f : %s' % ((time()-t), s) # Run dataframe run = Run(path) x_trace, y_trace = run.get_trace('trace_fluxgate') plot(x_trace, y_trace, 'r') xlabel('t (s)') ylabel('output (V)') title('fluxgate_trace') tight_layout()
23.162162
56
0.757293
135
857
4.614815
0.525926
0.080257
0.067416
0.038523
0
0
0
0
0
0
0
0.012228
0.14119
857
37
57
23.162162
0.834239
0.07818
0
0
0
0
0.089172
0
0
0
0
0
0
0
null
null
0
0.555556
null
null
0.111111
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
2
bb86f8d5b85e4257863e4e1ca13ac1f757f41a08
600
py
Python
quite/gui/widgets/__init__.py
Wingsgo/PyQtGraphEmbedded
e1992606c7beacde6b24ea5c858ba26a800accdd
[ "MIT" ]
null
null
null
quite/gui/widgets/__init__.py
Wingsgo/PyQtGraphEmbedded
e1992606c7beacde6b24ea5c858ba26a800accdd
[ "MIT" ]
null
null
null
quite/gui/widgets/__init__.py
Wingsgo/PyQtGraphEmbedded
e1992606c7beacde6b24ea5c858ba26a800accdd
[ "MIT" ]
null
null
null
from .widget import Widget from .dialog import Dialog from .main_window import MainWindow from .group_box import GroupBox from .dock_widget import DockWidget from .label import Label from .line_edit import LineEdit from .date_edit import DateEdit from .combo_box import ComboBox from .list_widget import ListWidget from .spin_box import SpinBox from .double_spin_box import DoubleSpinBox from .input_dialog import InputDialog from .action import Action from .shortcut import Shortcut from .push_button import PushButton from .table_widget import TableWidget from .plot_widget import PlotWidget
24
42
0.84
86
600
5.697674
0.430233
0.122449
0.053061
0
0
0
0
0
0
0
0
0
0.13
600
24
43
25
0.938697
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
bb94aace1e75eec15ebd05cb7335f95aec142ae3
156
py
Python
AnalysisServer/visomics/vtk/celeryconfig.py
Kitware/Visomics
5a12f132d826c32dececbd2707e920f4d5525da3
[ "Apache-2.0" ]
3
2015-05-03T05:14:50.000Z
2017-03-29T14:54:49.000Z
AnalysisServer/visomics/vtk/celeryconfig.py
Kitware/Visomics
5a12f132d826c32dececbd2707e920f4d5525da3
[ "Apache-2.0" ]
null
null
null
AnalysisServer/visomics/vtk/celeryconfig.py
Kitware/Visomics
5a12f132d826c32dececbd2707e920f4d5525da3
[ "Apache-2.0" ]
1
2017-03-29T15:04:16.000Z
2017-03-29T15:04:16.000Z
BROKER_URL = "mongodb://arbor/celery" CELERY_RESULT_BACKEND = "mongodb" CELERY_MONGODB_BACKEND_SETTINGS = { "host": "arbor", "database": "celery" }
22.285714
37
0.705128
17
156
6.117647
0.588235
0
0
0
0
0
0
0
0
0
0
0
0.141026
156
6
38
26
0.776119
0
0
0
0
0
0.333333
0.141026
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
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
bb96474ea735e41dc6f943767bcd55a7a5ec7f8f
1,692
py
Python
CS-1520-Web-Applications/Project 4/models.py
solomonheisey/University_Projects
b95cc87ad9ef8aaad3b12b3fb8564f580adf189b
[ "MIT" ]
1
2021-09-26T19:27:42.000Z
2021-09-26T19:27:42.000Z
CS-1520-Web-Applications/Project 4/models.py
solomonheisey/University_Projects
b95cc87ad9ef8aaad3b12b3fb8564f580adf189b
[ "MIT" ]
null
null
null
CS-1520-Web-Applications/Project 4/models.py
solomonheisey/University_Projects
b95cc87ad9ef8aaad3b12b3fb8564f580adf189b
[ "MIT" ]
null
null
null
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class User(db.Model): user_id = db.Column(db.Integer, unique=True, primary_key=True) username = db.Column(db.String(80), unique=True, nullable=False) password = db.Column(db.String(64), nullable=False) purchases = db.relationship('Purchase', backref='user', lazy=True) categories = db.relationship('Category', backref='user', lazy=True) def __init__(self, username, password): self.username = username self.password = password class Category(db.Model): category_id = db.Column(db.Integer, unique=True, primary_key=True) category_name = db.Column(db.String(80), nullable=False) limit = db.Column(db.Float, nullable=False) purchases = db.relationship('Purchase', backref='category', lazy=True) user_id = db.Column(db.Integer, db.ForeignKey('user.user_id')) def __init__(self, category_name, limit, user_id): self.category_name = category_name self.limit = limit self.user_id = user_id class Purchase(db.Model): purchase_id = db.Column(db.Integer, unique=True, primary_key=True) amount = db.Column(db.Float, nullable=False) description = db.Column(db.String(80)) date = db.Column(db.DateTime, nullable=False) category_id = db.Column(db.Integer, db.ForeignKey('category.category_id'), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.user_id'), nullable=False) def __init__(self, amount, description, date, category_id, user_id): self.amount = amount self.description = description self.date = date self.category_id = category_id self.user_id = user_id
37.6
94
0.697991
228
1,692
5.013158
0.175439
0.090989
0.113736
0.062992
0.43832
0.36308
0.307962
0.191601
0.191601
0.191601
0
0.005735
0.175532
1,692
44
95
38.454545
0.81362
0
0
0.058824
0
0
0.049645
0
0
0
0
0
0
1
0.088235
false
0.088235
0.029412
0
0.676471
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
0
0
1
0
0
2
bb967c74251fcdb3fe23b5a069fbddcc0ca3facd
4,355
py
Python
A03vankirkj.py
spring-2019-csc-226/a03-master
7be446b28d5aebfc4c4635cc418db0c0c0fadbca
[ "MIT" ]
null
null
null
A03vankirkj.py
spring-2019-csc-226/a03-master
7be446b28d5aebfc4c4635cc418db0c0c0fadbca
[ "MIT" ]
4
2019-02-07T06:26:00.000Z
2019-02-19T00:08:43.000Z
A03vankirkj.py
spring-2019-csc-226/a03-master
7be446b28d5aebfc4c4635cc418db0c0c0fadbca
[ "MIT" ]
1
2019-02-07T02:23:37.000Z
2019-02-07T02:23:37.000Z
################################################################################ # Author:Justin Vankirk # Username:vankirkj # # Assignment:A03 # https://docs.google.com/document/d/1upvTP9Z7BehzY-HqRqI9Uh2F3cD19rZi_MtArv0Tn_M/edit?usp=sharing ################################################################################# # Acknowledgements: Azah and I made the stars # # ################################################################################# import turtle def makesquare(): #makes the square outline square = turtle.Turtle() square.penup() square.setpos(-241, 241) square.pendown() square.pensize(20) square.color("white") for i in range(4): square.forward(500) square.right(90) """ Docstring for function_1 """ # ... def boustraphedon(): fanciness = turtle.Turtle() #stars!!! fanciness.pensize(20) fanciness.penup() fanciness.setpos(-221, 221) fanciness.pendown() fanciness.speed(100) for i in range(5): ###This is the algorythm for our stars.### for i in range(11): fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.left(90) fanciness.forward(20) fanciness.left(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(180) fanciness.forward(60) fanciness.left(180) for i in range(11): fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.left(90) fanciness.forward(20) fanciness.left(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(180) fanciness.backward(20) fanciness.left(180) for i in range(11): #if we continued this last loop, it would be impossible to keep the snake inside the box. fanciness.forward(20) #We subtracted this last line of code in order to fix it. fanciness.right(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.left(90) fanciness.forward(20) fanciness.left(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(180) fanciness.forward(60) fanciness.left(180) for i in range(11): fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.left(90) fanciness.forward(20) fanciness.left(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(90) fanciness.forward(20) fanciness.right(180) fanciness.left(180) """ Create the background """ # ... def makeskyscraper(): skyscraper = turtle.Turtle() #makes the skyscrapers base skyscraper.color(115,115,200) skyscraper.width(10) skyscraper.penup() skyscraper.setpos(-100,-245) skyscraper.pendown() skyscraper.begin_fill() skyscraper.forward(100) skyscraper.left(90) skyscraper.forward(400) skyscraper.left(90) skyscraper.forward(100) skyscraper.left(90) skyscraper.forward(400) skyscraper.end_fill() def door(): door = turtle.Turtle() #skyscraper door door.penup() door.setpos(-75, -245) door.pendown() door.begin_fill() for i in range(2): door.forward(30) door.left(90) door.forward(50) door.left(90) door.end_fill() door.hideturtle() def main(): """ This actually runs the code. """ # ... makesquare() # Function call to function_1 boustraphedon() # Function call to function_2 makeskyscraper() door() window = turtle.Screen() window.bgcolor("yellow") window.colormode(255) main() window.exitonclick()
25.467836
131
0.568772
465
4,355
5.307527
0.258065
0.194489
0.204214
0.295381
0.495138
0.492707
0.492707
0.492707
0.480956
0.480956
0
0.073516
0.269116
4,355
171
132
25.467836
0.701854
0.125373
0
0.6
0
0
0.003187
0
0
0
0
0
0
1
0.04
false
0
0.008
0
0.048
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
0
0
0
2
bba012c730f2c271cad587086805b8ecd429093d
279
py
Python
zoo_checks/migrations/0033_merge_20200216_2228.py
falkben/zoo-checks
b1d6cf980088664b1feded4a1e08a82c6f358c33
[ "Apache-2.0" ]
null
null
null
zoo_checks/migrations/0033_merge_20200216_2228.py
falkben/zoo-checks
b1d6cf980088664b1feded4a1e08a82c6f358c33
[ "Apache-2.0" ]
3
2019-06-01T14:56:19.000Z
2019-06-03T13:53:27.000Z
zoo_checks/migrations/0033_merge_20200216_2228.py
falkben/zoo-checks
b1d6cf980088664b1feded4a1e08a82c6f358c33
[ "Apache-2.0" ]
null
null
null
# Generated by Django 2.2.9 on 2020-02-17 03:28 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('zoo_checks', '0032_auto_20200203_0000'), ('zoo_checks', '0030_auto_20200207_2126'), ] operations = [ ]
18.6
50
0.655914
35
279
5
0.8
0.102857
0
0
0
0
0
0
0
0
0
0.217593
0.225806
279
14
51
19.928571
0.592593
0.16129
0
0
1
0
0.284483
0.198276
0
0
0
0
0
1
0
false
0
0.125
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
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
2
bba3bcdc84ec759af64f4f1942e13a67470a56b6
1,475
py
Python
portais_tech/portais_tech/items.py
naanadr/portais-noticias-tech
6d3f8164ce4ac590b2a21cd1b9eb44951a2cc7e3
[ "MIT" ]
2
2020-02-22T05:25:32.000Z
2020-02-23T23:47:46.000Z
portais_tech/portais_tech/items.py
naanadr/portais-noticias-tech
6d3f8164ce4ac590b2a21cd1b9eb44951a2cc7e3
[ "MIT" ]
null
null
null
portais_tech/portais_tech/items.py
naanadr/portais-noticias-tech
6d3f8164ce4ac590b2a21cd1b9eb44951a2cc7e3
[ "MIT" ]
null
null
null
import scrapy from scrapy.loader.processors import MapCompose, TakeFirst def get_autor(value): editado_msg = ',' if editado_msg in value: value = value.split(editado_msg)[0] return value def get_revisor(value): editado_msg = ' por ' if editado_msg in value: value = value.split(editado_msg)[1] return value def qtd_comentarios(value): if 'comentários' in value: value = value.split(' ')[0] return int(value) class PortaisTechItem(scrapy.Item): spider = scrapy.Field( input_processor=TakeFirst(), output_processor=TakeFirst(), ) url = scrapy.Field( input_processor=TakeFirst(), output_processor=TakeFirst(), ) titulo = scrapy.Field( input_processor=TakeFirst(), output_processor=TakeFirst(), ) qtd_comentarios = scrapy.Field( input_processor=MapCompose(qtd_comentarios), output_processor=TakeFirst(), ) autor = scrapy.Field( input_processor=MapCompose(get_autor), output_processor=TakeFirst(), ) revisor = scrapy.Field( input_processor=MapCompose(get_revisor), output_processor=TakeFirst(), ) data_publicacao = scrapy.Field( input_processor=TakeFirst(), output_processor=TakeFirst(), ) referencias = scrapy.Field() conteudo_relacionado = scrapy.Field( input_processor=MapCompose(get_revisor), ) tags = scrapy.Field()
23.790323
58
0.652203
153
1,475
6.084967
0.267974
0.212675
0.137487
0.214823
0.542428
0.481203
0.440387
0.343716
0.094522
0.094522
0
0.002698
0.246102
1,475
61
59
24.180328
0.834532
0
0
0.34
0
0
0.012203
0
0
0
0
0
0
1
0.06
false
0
0.04
0
0.38
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
bba41467d75ce74f68e5c4f722cce19e2307e934
1,047
py
Python
phi/tf/flow.py
eliasdjo/PhiFlow
dc88dca696d25a5ea5793aa48fae390469f0d829
[ "MIT" ]
null
null
null
phi/tf/flow.py
eliasdjo/PhiFlow
dc88dca696d25a5ea5793aa48fae390469f0d829
[ "MIT" ]
null
null
null
phi/tf/flow.py
eliasdjo/PhiFlow
dc88dca696d25a5ea5793aa48fae390469f0d829
[ "MIT" ]
null
null
null
# pylint: disable-msg = wildcard-import, unused-wildcard-import, unused-import """ Standard import for TensorFlow mode. Extends the import `from phi.flow import *` by TensorFlow-related functions and modules. The following TensorFlow modules are included: `tensorflow` / `tf`, `keras`, `layers`. Importing this module registers the TensorFlow backend as the default backend unless called within a backend context. New tensors created via `phi.math` functions will be backed by TensorFlow tensors. See `phi.flow`, `phi.torch.flow`, `phi.jax.flow`. """ from phi.flow import * from . import TENSORFLOW from .nets import parameter_count, dense_net, u_net, save_state, load_state, update_weights, adam import tensorflow from tensorflow import keras from tensorflow.keras import layers from ..math.backend import PHI_LOGGER as _LOGGER tf = tensorflow if not backend.context_backend(): backend.set_global_default_backend(TENSORFLOW) else: _LOGGER.warn(f"Importing '{__name__}' within a backend context will not set the default backend.")
34.9
117
0.782235
148
1,047
5.418919
0.472973
0.026185
0.049875
0.042394
0
0
0
0
0
0
0
0
0.133715
1,047
29
118
36.103448
0.884234
0.520535
0
0
0
0
0.163968
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
bbac2fab32aea03bab604d536c47b51151cc2aff
322
py
Python
aio.api.github/aio/api/github/utils.py
Nordix/pytooling
b48e70e9098c283d0f17db8016d2f32a2b103a57
[ "Apache-2.0" ]
1
2021-12-09T19:24:48.000Z
2021-12-09T19:24:48.000Z
aio.api.github/aio/api/github/utils.py
Nordix/pytooling
b48e70e9098c283d0f17db8016d2f32a2b103a57
[ "Apache-2.0" ]
392
2021-08-24T15:55:32.000Z
2022-03-28T14:26:22.000Z
aio.api.github/aio/api/github/utils.py
Nordix/pytooling
b48e70e9098c283d0f17db8016d2f32a2b103a57
[ "Apache-2.0" ]
3
2021-10-06T13:43:11.000Z
2021-11-29T13:48:56.000Z
from datetime import datetime # these only deal with utc but are good enough for working with the # github api def dt_from_js_isoformat(iso: str) -> datetime: return datetime.fromisoformat(iso.replace("Z", "+00:00")) def dt_to_js_isoformat(dt: datetime) -> str: return dt.isoformat().replace("+00:00", "Z")
21.466667
67
0.714286
50
322
4.48
0.58
0.044643
0
0
0
0
0
0
0
0
0
0.02963
0.161491
322
14
68
23
0.8
0.236025
0
0
0
0
0.057851
0
0
0
0
0
0
1
0.4
false
0
0.2
0.4
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
bbb7e11e28b9d116064e13a1a85c12306a593ab3
944
py
Python
rpiRobot/src/vision/infrastructure/openCvCameraCalibrationFactory.py
olgam4/design3
6e05d123a24deae7dda646df535844a158ef5cc0
[ "WTFPL" ]
null
null
null
rpiRobot/src/vision/infrastructure/openCvCameraCalibrationFactory.py
olgam4/design3
6e05d123a24deae7dda646df535844a158ef5cc0
[ "WTFPL" ]
null
null
null
rpiRobot/src/vision/infrastructure/openCvCameraCalibrationFactory.py
olgam4/design3
6e05d123a24deae7dda646df535844a158ef5cc0
[ "WTFPL" ]
null
null
null
from os import path import numpy as np from vision.domain.iCameraCalibration import ICameraCalibration from vision.domain.iCameraCalibrationFactory import ICameraCalibrationFactory from vision.infrastructure.fallbackCameraCalibration import FallBackCameraCalibration from vision.infrastructure.openCvCameraCalibration import OpenCvCameraCalibration class OpenCvCameraCalibrationFactory(ICameraCalibrationFactory): def load_calibration_from_file(self, calibration_file_path: path, image_width: int, image_height: int) -> ICameraCalibration: if calibration_file_path is None: return FallBackCameraCalibration() arrays = np.load(calibration_file_path) camera_matrix = arrays['camera_matrix'] distortion_coefficients = arrays['distortion_coefficients'] return OpenCvCameraCalibration(camera_matrix, distortion_coefficients, image_width, image_height)
42.909091
105
0.791314
86
944
8.465116
0.395349
0.054945
0.078297
0.093407
0
0
0
0
0
0
0
0
0.162076
944
21
106
44.952381
0.920354
0
0
0
0
0
0.038136
0.024364
0
0
0
0
0
1
0.066667
false
0
0.4
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
bbbb0192d6eca0fc8ff5dffd0716d00687768996
236
py
Python
custom/icds_reports/migrations/0032_create_datasource_views.py
rochakchauhan/commcare-hq
aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236
[ "BSD-3-Clause" ]
1
2020-07-14T13:00:23.000Z
2020-07-14T13:00:23.000Z
custom/icds_reports/migrations/0032_create_datasource_views.py
rochakchauhan/commcare-hq
aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236
[ "BSD-3-Clause" ]
1
2021-06-02T04:45:16.000Z
2021-06-02T04:45:16.000Z
custom/icds_reports/migrations/0032_create_datasource_views.py
rochakchauhan/commcare-hq
aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236
[ "BSD-3-Clause" ]
null
null
null
# Generated by Django 1.11.9 on 2018-01-17 20:33 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('icds_reports', '0031_agg_child_health_definitions'), ] operations = []
18.153846
62
0.690678
30
236
5.266667
0.9
0
0
0
0
0
0
0
0
0
0
0.106383
0.20339
236
12
63
19.666667
0.734043
0.194915
0
0
1
0
0.239362
0.175532
0
0
0
0
0
1
0
false
0
0.166667
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
bbbdc89756b388bfe27f53df9eee4b4e8d1f4eb6
502
py
Python
NotebookIndex/notebook_index/views_catalog.py
ahriknow/ahriknow
817b5670c964e01ffe19ed182ce0a7b42e17ce09
[ "MIT" ]
null
null
null
NotebookIndex/notebook_index/views_catalog.py
ahriknow/ahriknow
817b5670c964e01ffe19ed182ce0a7b42e17ce09
[ "MIT" ]
3
2021-03-19T01:28:43.000Z
2021-04-08T19:57:19.000Z
NotebookIndex/notebook_index/views_catalog.py
ahriknow/ahriknow
817b5670c964e01ffe19ed182ce0a7b42e17ce09
[ "MIT" ]
null
null
null
from rest_framework.response import Response from rest_framework.views import APIView from NotebookIndex.notebook_index.serializer import ManyCatalog from NotebookManage.notebook.models import Book, Catalog class CatalogView(APIView): def get(self, request, id=None): catalog = Catalog.objects.filter(book=Book.objects.filter(pk=id).first()) data = ManyCatalog(instance=catalog, many=True).data return Response({'code': 200, 'msg': 'Query was successful!', 'data': data})
41.833333
84
0.752988
63
502
5.952381
0.619048
0.042667
0.090667
0
0
0
0
0
0
0
0
0.006928
0.13745
502
11
85
45.636364
0.859122
0
0
0
0
0
0.063745
0
0
0
0
0
0
1
0.111111
false
0
0.444444
0
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
0
0
0
1
0
1
0
0
2
bbbf17a3996e84b02e39f13c5f1c38c29bc3dbf7
69
py
Python
code5.py
adarshjudoka212/pythonprogramme
1b3865ddc6060deebd74529ce294b152d5c8f25d
[ "MIT" ]
null
null
null
code5.py
adarshjudoka212/pythonprogramme
1b3865ddc6060deebd74529ce294b152d5c8f25d
[ "MIT" ]
null
null
null
code5.py
adarshjudoka212/pythonprogramme
1b3865ddc6060deebd74529ce294b152d5c8f25d
[ "MIT" ]
null
null
null
def fun(): a=89 str="adar" return[a,str]; print(fun())
9.857143
19
0.492754
11
69
3.090909
0.727273
0
0
0
0
0
0
0
0
0
0
0.040816
0.289855
69
6
20
11.5
0.653061
0
0
0
0
0
0.058824
0
0
0
0
0
0
1
0.2
false
0
0
0
0.2
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
bbc18009172fe74ebffc98185da2c2c7d1d02c99
223
py
Python
idk.py
vishalkotha22/codingprojects
afe262dbd43779a798e29b41bf272c25cf40e9a5
[ "CC0-1.0" ]
null
null
null
idk.py
vishalkotha22/codingprojects
afe262dbd43779a798e29b41bf272c25cf40e9a5
[ "CC0-1.0" ]
null
null
null
idk.py
vishalkotha22/codingprojects
afe262dbd43779a798e29b41bf272c25cf40e9a5
[ "CC0-1.0" ]
null
null
null
from sklearn.tree import DecisionTreeClassifier from sklearn import EstimatorObject dtree = DecisionTreeClassifier() dtree.fit(df(['Age', 'Distance']), df['Attended']) model = EstimatorObject() cart_plot(dtree)
22.3
51
0.748879
23
223
7.217391
0.652174
0.13253
0
0
0
0
0
0
0
0
0
0
0.134529
223
10
52
22.3
0.860104
0
0
0
0
0
0.088372
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
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
2
bbd792287fa96d060acafa0bf57cd96849e6b87e
226
py
Python
JavPy/functions/magnet.py
generaljun/JavPy
e2b5488631c0979c643a2f86ba4cd8bb1709e2f8
[ "Apache-2.0" ]
1
2020-07-30T08:48:17.000Z
2020-07-30T08:48:17.000Z
JavPy/functions/magnet.py
liqiang0330/JavPy
e2b5488631c0979c643a2f86ba4cd8bb1709e2f8
[ "Apache-2.0" ]
null
null
null
JavPy/functions/magnet.py
liqiang0330/JavPy
e2b5488631c0979c643a2f86ba4cd8bb1709e2f8
[ "Apache-2.0" ]
2
2020-07-30T06:30:23.000Z
2020-07-30T08:48:19.000Z
from JavPy.functions.sources import Sources class Magnet: @staticmethod def get_magnet(code): return Sources.Magnet[0].search_magnet(code) if __name__ == '__main__': print(Magnet.get_magnet("ABP-123"))
18.833333
52
0.707965
29
226
5.137931
0.689655
0.120805
0
0
0
0
0
0
0
0
0
0.021505
0.176991
226
11
53
20.545455
0.77957
0
0
0
0
0
0.066372
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0.142857
0.571429
0.142857
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
2
bbf01995eb69cea6c6ed666e3fa906757fea63d6
268
py
Python
xd.py
Felipe17Programmer/Proyectos_Python
14f52e31c188928e00128df01c78977d5a6265f8
[ "Apache-2.0" ]
null
null
null
xd.py
Felipe17Programmer/Proyectos_Python
14f52e31c188928e00128df01c78977d5a6265f8
[ "Apache-2.0" ]
null
null
null
xd.py
Felipe17Programmer/Proyectos_Python
14f52e31c188928e00128df01c78977d5a6265f8
[ "Apache-2.0" ]
null
null
null
def insertar(lista,elemento): for i in range(len(lista)): if elemento < len(lista): lista.insert(i-1,elemento) if elemento > len(lista): lista.insert(i-1,elemento) print lista listax=[2,3,4,5,7,8,9] insertar(listax,50)
24.363636
38
0.597015
41
268
3.902439
0.536585
0.15
0.1625
0.225
0.4875
0.4875
0.4875
0.4875
0.4875
0
0
0.055276
0.257463
268
10
39
26.8
0.748744
0
0
0.222222
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0.111111
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
0
0
2
bbf13d9662a378fc31095e8da03cbd5cf4af3556
780
py
Python
imports.py
MarcusTL12/PyCalc
b846f90eddb75acbb126ac2f8e1d2a4c52e77a2f
[ "Apache-2.0" ]
null
null
null
imports.py
MarcusTL12/PyCalc
b846f90eddb75acbb126ac2f8e1d2a4c52e77a2f
[ "Apache-2.0" ]
null
null
null
imports.py
MarcusTL12/PyCalc
b846f90eddb75acbb126ac2f8e1d2a4c52e77a2f
[ "Apache-2.0" ]
null
null
null
import sys sys.path.append('./PyScr/') import numpy as np import matplotlib.pyplot as plt import cmath import math import copy import pfprint import primefac from scipy.special import comb as choose _ = None def ppprint(arg): global _ pfprint.pfprint(arg) _ = arg def frac(): pfprint.frac = not pfprint.frac return _ def denom_lim(n): pfprint.denom_lim = n def num_dec(n): pfprint.num_dec = n def pltclr(): plt.cla() plt.clf() plt.close() def fact(n): return math.factorial(n) def primesS(n): return primefac.primes_to_string(primefac.primes(n)) def primes(n): return primefac.primes(n) sys.displayhook = ppprint pi = np.pi e = np.exp(1) sqrt = np.sqrt predef_globals = len(globals()) + 1 def loc(): return dict(list(globals().items())[predef_globals:])
15
54
0.719231
125
780
4.392
0.456
0.029144
0.032787
0.076503
0
0
0
0
0
0
0
0.00303
0.153846
780
51
55
15.294118
0.828788
0
0
0
0
0
0.010256
0
0
0
0
0
0
1
0.230769
false
0
0.230769
0.102564
0.589744
0.179487
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
bbf38dbff6c0d07f5bba50b7978d774fa6484af7
222
py
Python
python/python_work2/liebiao2.py
lucycore/python
c1c49e52392615851c0efec886d0e947b609681c
[ "Apache-2.0" ]
null
null
null
python/python_work2/liebiao2.py
lucycore/python
c1c49e52392615851c0efec886d0e947b609681c
[ "Apache-2.0" ]
null
null
null
python/python_work2/liebiao2.py
lucycore/python
c1c49e52392615851c0efec886d0e947b609681c
[ "Apache-2.0" ]
null
null
null
names = ["duanzijie","zhaokeer","lijiaxi","zhuzi","wangwenbo","gongyijun"] print(names) print(names[0]) print(names[1]) print(names[2]) print(names[3]) print(names[4]) print(names[5]) hi = "hi" + " " + name[1] print(hi)
17.076923
74
0.648649
33
222
4.363636
0.484848
0.486111
0
0
0
0
0
0
0
0
0
0.034826
0.094595
222
13
75
17.076923
0.681592
0
0
0
0
0
0.225225
0
0.1
0
0
0
0
1
0
false
0
0
0
0
0.8
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
a526bbe3ed8747ce16ae5d5867a5d7fc89df59e7
4,411
py
Python
tests/designMethods/test_en_13001_input.py
tum-fml/marsDemonstrator
49f45d883eea27b678f10ec6e385e4c0d2e3b409
[ "CC0-1.0" ]
1
2021-05-12T20:06:03.000Z
2021-05-12T20:06:03.000Z
tests/designMethods/test_en_13001_input.py
tum-fml/marsDemonstrator
49f45d883eea27b678f10ec6e385e4c0d2e3b409
[ "CC0-1.0" ]
null
null
null
tests/designMethods/test_en_13001_input.py
tum-fml/marsDemonstrator
49f45d883eea27b678f10ec6e385e4c0d2e3b409
[ "CC0-1.0" ]
null
null
null
import unittest import pathlib import numpy as np from marsDemonstrator.designMethods.en_13001_3_3 import MARSInput # pylint: disable=import-error class En_test(unittest.TestCase): def setUp(self) -> None: self.config = "m1" self.direction = 1 parent_path = pathlib.Path(__file__).parent.parent.absolute() input_file = parent_path / "testdata" / "test_material_input.xlsx" self.my_input = MARSInput() self.my_input.load_material_input_check(input_file, "rail_materials", "wheel_materials") self.my_input.load_geometry_input_check(input_file, "rail_geometries", "wheel_geometries") self.my_input.read_input_df(input_file) self.my_input.load_parameter_input("EN-13001-3-3") self.my_input.set_materials_and_geometry() self.my_input.parameters.compute_contact_and_f_1() self.my_input.parameters.compute_f_f3() # load results self.expected_results_geometry = self.my_input.input_df.loc["Results Geometry", :].copy() self.expected_results_geometry.index = self.expected_results_geometry.iloc[:, 0] self.expected_results_geometry = self.expected_results_geometry.drop(self.expected_results_geometry.columns[0], axis=1) self.expected_results_geometry = self.expected_results_geometry.transpose() self.expected_results_geometry.index = range(len(self.expected_results_geometry)) self.expected_results_materials = self.my_input.input_df.loc["Results Material", :].copy() self.expected_results_materials.index = self.expected_results_materials.iloc[:, 0] self.expected_results_materials = self.expected_results_materials.drop(self.expected_results_materials.columns[0], axis=1) self.expected_results_materials = self.expected_results_materials.transpose() self.expected_results_materials.index = range(len(self.expected_results_materials)) def test_material_parameters(self) -> None: np.testing.assert_almost_equal(list(self.expected_results_materials["res_E_r"]), list(self.my_input.parameters.materials["rail"]["E"])) np.testing.assert_almost_equal(list(self.expected_results_materials["res_f_y_r"]), list(self.my_input.parameters.materials["rail"]["f_y"])) np.testing.assert_almost_equal(list(self.expected_results_materials["res_HB_r"]), list(self.my_input.parameters.materials["rail"]["HB"])) np.testing.assert_almost_equal(list(self.expected_results_materials["res_z_r"]), list(self.my_input.parameters.materials["rail"]["z"])) np.testing.assert_almost_equal(list(self.expected_results_materials["res_v_r"]), list(self.my_input.parameters.materials["rail"]["v"])) np.testing.assert_almost_equal(list(self.expected_results_materials["res_E_w"]), list(self.my_input.parameters.materials["wheel"]["E"])) np.testing.assert_almost_equal(list(self.expected_results_materials["res_f_y_w"]), list(self.my_input.parameters.materials["wheel"]["f_y"])) np.testing.assert_almost_equal(list(self.expected_results_materials["res_HB_w"]), list(self.my_input.parameters.materials["wheel"]["HB"])) np.testing.assert_almost_equal(list(self.expected_results_materials["res_z_w"]), list(self.my_input.parameters.materials["wheel"]["z"])) np.testing.assert_almost_equal(list(self.expected_results_materials["res_v_w"]), list(self.my_input.parameters.materials["wheel"]["v"])) def test_computed_geometry(self) -> None: # np.testing.assert_almost_equal(list(self.my_input.parameters.data["E_m_test"]), list(self.my_input.parameters.data["E_m"])) np.testing.assert_almost_equal(list(self.expected_results_geometry["res_b_min"]), list(self.my_input.parameters.gen_params["b_min"])) self.assertEqual(list(self.expected_results_geometry["res_contact"]), list(self.my_input.parameters.gen_params["contact"])) np.testing.assert_almost_equal(list(self.expected_results_geometry["res_f_1"]), list(self.my_input.parameters.gen_params["f_1"])) np.testing.assert_almost_equal(list(self.expected_results_geometry["res_r_k"]), list(self.my_input.parameters.gen_params["r_k"])) np.testing.assert_almost_equal(list(self.expected_results_geometry["res_f_f3"]), list(self.my_input.parameters.gen_params["f_f3"])) if __name__ == "__main_": unittest.main()
72.311475
149
0.745409
606
4,411
5.056106
0.150165
0.137076
0.217037
0.182768
0.732376
0.644909
0.619125
0.54406
0.302872
0.286554
0
0.007231
0.122195
4,411
60
150
73.516667
0.784091
0.037406
0
0
0
0
0.082736
0.005739
0
0
0
0
0.319149
1
0.06383
false
0
0.085106
0
0.170213
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
0
0
0
2
a52b918f09c0f902f3048f04f7dc503f0ed7c971
215
py
Python
hermes/regulars.py
SOBotics/Hermes
af2d8befe4e332019a04c8ceee3f8ebe975f9f8e
[ "MIT" ]
null
null
null
hermes/regulars.py
SOBotics/Hermes
af2d8befe4e332019a04c8ceee3f8ebe975f9f8e
[ "MIT" ]
5
2018-09-18T10:03:41.000Z
2019-06-03T17:12:30.000Z
hermes/regulars.py
SOBotics/SoundFlow
af2d8befe4e332019a04c8ceee3f8ebe975f9f8e
[ "MIT" ]
null
null
null
""" User defined here are allowed to use privileged bot commands """ regulars = [ 965146, #Shree 4946380, #Mithrandir 5067311, #Andras Deak 397817, #Stephen Kennedy 6707985, #geisterfurz007 ]
17.916667
60
0.674419
23
215
6.304348
1
0
0
0
0
0
0
0
0
0
0
0.219512
0.237209
215
11
61
19.545455
0.664634
0.539535
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
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
2
a539b9bbbd63b6a5db6c6b7404fcbce1d7230f25
18,860
py
Python
rps3env/tests/rps3_game_test.py
islamelnabarawy/rps3env
e7728a5c310fa82a9fa9b65a628cb77e4efbc425
[ "Apache-2.0" ]
null
null
null
rps3env/tests/rps3_game_test.py
islamelnabarawy/rps3env
e7728a5c310fa82a9fa9b65a628cb77e4efbc425
[ "Apache-2.0" ]
null
null
null
rps3env/tests/rps3_game_test.py
islamelnabarawy/rps3env
e7728a5c310fa82a9fa9b65a628cb77e4efbc425
[ "Apache-2.0" ]
null
null
null
""" Copyright 2019 Islam Elnabarawy Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import logging import random import sys import unittest import gym from gym import Space, spaces import rps3env.config from rps3env.envs import RPS3GameEnv, RPS3GameMinMaxEnv from rps3env.tests.utils import captured_output __author__ = 'Islam Elnabarawy' logger = logging.getLogger(__name__) logger.setLevel(rps3env.config.ENV_LOG_LEVEL) logger.addHandler(logging.StreamHandler(sys.stdout)) EMPTY_BOARD = """ .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Turns: 0 Player Counts: [0, 0, 0] Player Reveals: [0, 0, 0] Opponent Captures: [0, 0, 0] Opponent Counts: [0, 0, 0, 0] Probabilities: [0.0, 0.0, 0.0]""" INIT_BOARD = """ OP OR .. OS OP .. OR OS .. OS OP .. .. .. OR PS .. PR PP .. PP PR .. PS PS .. PR PP PP PR .. PS PP .. PR PS .. PS PP .. .. .. PR OU .. OU OU .. OU OU .. OU OU .. OU OU Turns: 0 Player Counts: [3, 3, 3] Player Reveals: [0, 0, 0] Opponent Captures: [0, 0, 0] Opponent Counts: [0, 0, 0, 9] Probabilities: [0.3333333333333333, 0.3333333333333333, 0.3333333333333333]""" OBS_BEFORE_BOARD_INIT = { 'occupied': [False] * 28, 'player_owned': [False] * 28, 'piece_type': [-1] * 28, 'player_captures': [0, 0, 0], 'opponent_captures': [0, 0, 0], } OBS_AFTER_BOARD_INIT = { 'occupied': [True] * 18 + [False] * 10, 'player_owned': [True] * 9 + [False] * 19, 'piece_type': [1, 2, 3] * 3 + [0] * 9 + [-1] * 10, 'player_captures': [0, 0, 0], 'opponent_captures': [0, 0, 0], } OBS_AFTER_LEGAL_MOVE = { 'occupied': [False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, True, True, True, False, False, False, False, False, False, True, False, False], 'player_owned': [False, True, True, True, True, True, True, True, True, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False], 'piece_type': [-1, 2, 3, 1, 2, 3, 1, 2, 3, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, -1, -1, -1, -1, -1, -1, 0, -1, -1], 'player_captures': [0, 0, 0], 'opponent_captures': [0, 0, 0], } OBS_AFTER_CHALLENGE_WIN = { 'occupied': [True, True, True, True, True, True, True, True, False, True, True, True, True, True, True, True, False, True, False, False, False, False, False, False, False, False, True, False], 'player_owned': [True, True, True, True, True, True, True, True, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 'piece_type': [1, 2, 3, 1, 2, 3, 1, 2, -1, 3, 0, 0, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1], 'player_captures': [0, 0, 0], 'opponent_captures': [0, 1, 0], } OBS_AFTER_CHALLENGE_TIE = { 'occupied': [True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, True, True, False, False, False, False, False, False, False, True, False, False], 'player_owned': [True, True, True, True, True, True, True, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 'piece_type': [1, 2, 3, 1, 2, 3, 1, 2, 3, 0, 0, 0, 0, 0, 0, -1, 0, 1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1], 'player_captures': [0, 0, 0], 'opponent_captures': [0, 0, 0], } OBS_AFTER_CHALLENGE_LOSS = { 'occupied': [True, True, True, True, True, True, True, True, False, True, True, True, True, True, True, True, True, True, False, False, False, False, False, False, False, False, False, False], 'player_owned': [True, True, True, True, True, True, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 'piece_type': [1, 2, 3, 1, 2, 3, 1, 2, -1, 1, 0, 0, 0, 0, 0, 0, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 'player_captures': [0, 0, 1], 'opponent_captures': [0, 0, 0], } OBS_AFTER_FULL_GAME = { 'occupied': [True, True, True, True, True, True, False, True, False, False, False, False, False, True, False, False, True, False, True, False, False, False, False, True, True, True, True, True], 'player_owned': [True, True, True, True, True, True, False, True, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, True], 'piece_type': [1, 2, 3, 1, 2, 3, -1, 2, -1, -1, -1, -1, -1, 3, -1, -1, 0, -1, 0, -1, -1, -1, -1, 3, 0, 0, 1, 1], 'player_captures': [0, 0, 0], 'opponent_captures': [0, 3, 0], } OBS_AFTER_TAKE_ALL_PIECES = { 'occupied': [False, False, True, False, True, True, True, True, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, True, False, False, False], 'piece_type': [-1, -1, 3, -1, 2, 3, 1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1], 'player_owned': [False, False, True, False, True, True, True, True, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, True, False, False, False], 'player_captures': [1, 0, 1], 'opponent_captures': [3, 3, 3], } OBS_AFTER_LOSE_ALL_PIECES = { 'occupied': [True, False, False, False, False, False, False, True, False, False, False, True, False, True, False, False, True, True, False, False, False, False, False, True, False, False, False, False], 'piece_type': [1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, 0, -1, 0, -1, -1, 0, 1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1], 'player_owned': [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 'player_captures': [3, 3, 3], 'opponent_captures': [0, 2, 0], } AVAILABLE_ACTIONS_AFTER_INIT = [ (0, 17), (0, 18), (1, 18), (2, 19), (3, 19), (4, 20), (5, 20), (6, 21), (7, 21), (8, 9), (8, 22) ] class RPS3GameEnvTest(unittest.TestCase): def setUp(self): self.env = gym.make('RPS3Game-v0') # type: RPS3GameEnv def tearDown(self): self.env.close() def init_board(self): self.env.reset() obs, reward, done, info = self.env.step([1, 2, 3] * 3) return obs, reward, done, info def step_assert(self, obs_actual, reward_actual, done_actual, info_actual, obs_expected, reward_expected=None, done_expected=False, info_expected=None): if reward_expected is None: reward_expected = [0, 0] self.assertEqual(obs_expected, obs_actual) self.assertEqual(reward_expected, reward_actual) self.assertEqual(done_expected, done_actual) if info_expected is not None: for k in info_expected.keys(): self.assertEqual(info_expected[k], info_actual[k]) def test_initializable(self): self.assertIsNotNone(self.env, msg='gym.make() returned None.') def test_action_space_pre_reset(self): self.assertRaises(ValueError, lambda: self.env.action_space) def test_action_space_pre_init(self): self.env.reset() self.assertIsInstance(self.env.action_space, Space) self.assertEqual(9, self.env.action_space.shape[0]) self.assertEqual(3, max(self.env.action_space.nvec)) self.assertEqual(3, min(self.env.action_space.nvec)) def test_action_space_post_init(self): self.init_board() self.assertIsInstance(self.env.action_space, Space) self.assertEqual(2, self.env.action_space.shape[0]) self.assertEqual(27, max(self.env.action_space.nvec)) self.assertEqual(27, min(self.env.action_space.nvec)) def test_observation_space(self): self.assertIsInstance(self.env.observation_space, spaces.Dict) obs_sp = self.env.observation_space.spaces self.assertEqual(5, len(obs_sp)) self.assertEqual(28, obs_sp['occupied'].n) self.assertEqual(28, obs_sp['player_owned'].n) piece_type = obs_sp['piece_type'] self.assertEqual(28, piece_type.shape[0]) self.assertEqual(3, max(piece_type.nvec)) self.assertEqual(3, min(piece_type.nvec)) player_captures = obs_sp['player_captures'] self.assertEqual(3, player_captures.shape[0]) self.assertEqual(3, max(player_captures.nvec)) self.assertEqual(3, min(player_captures.nvec)) opponent_captures = obs_sp['opponent_captures'] self.assertEqual(3, opponent_captures.shape[0]) self.assertEqual(3, max(opponent_captures.nvec)) self.assertEqual(3, min(opponent_captures.nvec)) def test_reward_range(self): self.assertEqual(-100, self.env.reward_range[0]) self.assertEqual(100, self.env.reward_range[1]) def test_step_before_reset(self): self.assertRaises(ValueError, lambda: self.env.step([1, 2, 3] * 3)) def test_reset(self): actual = self.env.reset() expected = OBS_BEFORE_BOARD_INIT self.assertEqual(expected, actual) def test_render_empty_board(self): self.env.reset() actual = self.env.render(mode='ansi') self.assertEqual(EMPTY_BOARD, actual) def test_output_empty_board(self): self.env.reset() with captured_output() as (out, err): self.env.render(mode='console') self.assertEqual(EMPTY_BOARD, out.getvalue().rstrip()) def test_set_board(self): self.env.seed() obs, reward, done, info = self.init_board() self.step_assert(obs, reward, done, info, OBS_AFTER_BOARD_INIT) def test_render_set_board(self): self.env.seed(0) self.init_board() actual = self.env.render(mode='ansi') self.assertEqual(INIT_BOARD, actual) def test_render_human(self): self.env.seed(0) self.init_board() self.env.render(mode='human') done = False while not done: self.env.render(mode='human') action = random.choice(self.env.available_actions) obs, reward, done, info = self.env.step(action) self.env.render(mode='human') def test_render_rgb_array(self): self.env.seed(0) self.init_board() self.env.render(mode='rgb_array') done = False while not done: self.env.render(mode='rgb_array') action = random.choice(self.env.available_actions) obs, reward, done, info = self.env.step(action) self.env.render(mode='rgb_array') def test_render_invalid_mode(self): self.init_board() self.assertRaises(gym.error.UnsupportedMode, lambda: self.env.render('invalid')) def test_pre_init_available_actions(self): self.assertRaises(ValueError, lambda: self.env.available_actions) def test_init_available_actions(self): self.env.reset() available_actions = self.env.available_actions random.seed(0) self.assertIsInstance(random.choice(available_actions), list) self.assertEqual(362880, len(available_actions)) def test_game_available_actions(self): self.init_board() available_actions = self.env.available_actions self.assertEqual(AVAILABLE_ACTIONS_AFTER_INIT, available_actions) def test_post_game_available_actions(self): self.init_board() done = False while not done: _, _, done, _ = self.env.step(random.choice(self.env.available_actions)) self.assertRaises(ValueError, lambda: self.env.available_actions) def test_malformed_move(self): self.env.seed(0) self.init_board() self.assertRaises(AssertionError, lambda: self.env.step(())) self.assertRaises(AssertionError, lambda: self.env.step((0,))) def test_illegal_moves(self): self.env.seed(0) self.init_board() self.assertRaises(AssertionError, lambda: self.env.step((0, 1))) self.assertRaises(AssertionError, lambda: self.env.step((0, 19))) self.assertRaises(AssertionError, lambda: self.env.step((0, 27))) def test_legal_move(self): self.env.seed(0) self.init_board() obs, reward, done, info = self.env.step((0, 18)) self.step_assert(obs, reward, done, info, OBS_AFTER_LEGAL_MOVE, info_expected={'round': 1}) def test_challenge_tie(self): self.env.seed(0) self.init_board() obs, reward, done, info = self.env.step((0, 17)) self.step_assert(obs, reward, done, info, OBS_AFTER_CHALLENGE_TIE, info_expected={'round': 1}) def test_challenge_win(self): self.env.seed(0) self.init_board() obs, reward, done, info = self.env.step((8, 9)) self.step_assert(obs, reward, done, info, OBS_AFTER_CHALLENGE_WIN, reward_expected=[1, 0], info_expected={'round': 1}) def test_challenge_loss(self): self.env.seed(2) self.init_board() obs, reward, done, info = self.env.step((8, 9)) self.step_assert(obs, reward, done, info, OBS_AFTER_CHALLENGE_LOSS, reward_expected=[-1, 0], info_expected={'round': 1}) def test_full_game(self): self.env.seed(0) self.init_board() moves = [(8, 9), (9, 22), (22, 23), (23, 11), (11, 23), (23, 11), (11, 12), (12, 13), (6, 21)] for move in moves: self.env.step(move) obs, reward, done, info = self.env.step((21, 27)) self.step_assert(obs, reward, done, info, OBS_AFTER_FULL_GAME, reward_expected=[100, 0], done_expected=True, info_expected={'round': 10}) def test_full_game_take_all_pieces(self): self.env.seed(0) self.env.reset() self.env.step([2, 1, 3, 1, 2, 3, 1, 2, 3]) moves = [(0, 17), (1, 18), (18, 26), (26, 16), (16, 26), (26, 25), (17, 16), (16, 15), (25, 14), (8, 22), (22, 23), (23, 11), (11, 23), (23, 24), (24, 13), (13, 24), (3, 19), (19, 18), (18, 26), (26, 17), (15, 25)] for move in moves: self.env.step(move) obs, reward, done, info = self.env.step((25, 24)) self.step_assert(obs, reward, done, info, OBS_AFTER_TAKE_ALL_PIECES, reward_expected=[101, 0], done_expected=True, info_expected={'round': len(moves) + 1}) def test_full_game_lose_all_pieces(self): self.env.seed(0) self.env.reset() self.env.step([3, 2, 1, 3, 2, 1, 3, 2, 1]) moves = [(0, 17), (8, 9), (3, 19), (19, 27), (27, 25), (7, 21), (21, 27), (1, 18), (18, 27), (4, 20), (20, 21), (2, 19), (19, 27), (6, 7), (5, 6), (7, 8), (8, 22), (6, 7), (7, 8), (8, 9), (22, 27), (9, 22), (22, 23), (27, 26)] for move in moves: self.env.step(move) obs, reward, done, info = self.env.step((26, 17)) self.step_assert(obs, reward, done, info, OBS_AFTER_LOSE_ALL_PIECES, reward_expected=[-101, 0], done_expected=True, info_expected={'round': len(moves) + 1}) class RPS3GameMinMaxEnvTest(unittest.TestCase): def setUp(self): self.env = gym.make('RPS3Game-v1') # type: RPS3GameMinMaxEnv def tearDown(self): self.env.close() def test_random_play_level_1_1(self): self.play_randomly(0, 1, 27) def test_random_play_level_1_2(self): self.play_randomly(3, 1, 38) def test_random_play_level_2_1(self): self.play_randomly(0, 2, 40) def test_random_play_level_2_2(self): self.play_randomly(2, 2, 45) def test_random_play_level_3_1(self): self.play_randomly(0, 3, 61) def test_random_play_level_3_2(self): self.play_randomly(3, 3, 43) def test_history_table_printing(self): self.play_randomly(0, 1, 27) with captured_output() as (out, err): self.env._opponent.print_history_table() as_str = self.env._opponent.get_history_table() as_out = out.getvalue().rstrip() self.assertEqual(as_out, as_str) def play_randomly(self, seed, depth_limit, final_round): self.env.settings['depth_limit'] = depth_limit self.env.reset() self.env.seed(seed) done = False reward, info = None, None total_reward = 0 while not done: logger.debug(self.env.render(mode='ansi')) action = random.choice(self.env.available_actions) logger.debug('Taking action: %s', action) obs, reward, done, info = self.env.step(action) logger.debug('Got reward: %s', reward) logger.debug('Info: %s', info) total_reward += sum(reward) logger.debug(self.env.render(mode='ansi')) logger.debug('Game over. Total reward: %d', total_reward) self.assertEqual([0, -100], reward) self.assertTrue(done) self.assertEqual(final_round, info['round'])
40.21322
120
0.575716
2,547
18,860
4.117786
0.102474
0.187834
0.238844
0.272693
0.65799
0.610698
0.552727
0.482647
0.407513
0.368802
0
0.056982
0.273277
18,860
468
121
40.299145
0.70823
0.03176
0
0.355263
0
0
0.132203
0
0
0
0
0
0.152632
1
0.110526
false
0
0.023684
0
0.142105
0.005263
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a53cd473e804512f54a6592d92dab7e1afdf1042
8,468
py
Python
fsm.py
shihyuuuuuuu/chatbot
24bfab040adfb410448bb04aa16f47c7e32ec394
[ "MIT" ]
null
null
null
fsm.py
shihyuuuuuuu/chatbot
24bfab040adfb410448bb04aa16f47c7e32ec394
[ "MIT" ]
null
null
null
fsm.py
shihyuuuuuuu/chatbot
24bfab040adfb410448bb04aa16f47c7e32ec394
[ "MIT" ]
null
null
null
from transitions.extensions import GraphMachine import pymongo from pymongo import MongoClient from pprint import pprint client = MongoClient() db = client.chatbot schedule = db.schedule class TocMachine(GraphMachine): def __init__(self, **machine_configs): self.machine = GraphMachine( model = self, **machine_configs ) def bye_to_user(self, update): text = update.message.text if text.lower() == 'bye': update.message.reply_text("ㄅㄅ") return 1 def is_going_to_chat1(self, update): text = update.message.text if text.lower() == 'show fsm': return 1 def is_going_to_chat2(self, update): text = update.message.text if text.lower() == '簡單介紹一下你自己': return 1 def is_going_to_state1(self, update): text = update.message.text return text.lower() == '嗨' or text.lower() == '返回' def is_going_to_state2(self, update): text = update.message.text if text.lower() == '查賽程': return 1 def is_going_to_state3(self, update): text = update.message.text if text.lower() == '裕隆': return 1 def is_going_to_state4(self, update): text = update.message.text if text.lower() == '台啤': return 1 def is_going_to_state5(self, update): text = update.message.text if text.lower() == '璞園': return 1 def is_going_to_state6(self, update): text = update.message.text if text.lower() == '達欣': return 1 def is_going_to_state7(self, update): text = update.message.text if text.lower() == '富邦': return 1 def is_going_to_state8(self, update): text = update.message.text if text.lower() == '台銀': return 1 def is_going_to_state9(self, update): text = update.message.text if text.lower() == '金酒': return 1 def is_going_to_state10(self, update): text = update.message.text if text.lower() == '查戰績': return 1 def on_enter_chat1(self, update): update.message.reply_photo(open("state_diagram.png","rb")) self.go_back(update) def on_exit_chat1(self, update): print('Leaving chat1') def on_enter_chat2(self, update): update.message.reply_audio(open("output.ogg","rb")) self.go_back(update) def on_exit_chat2(self, update): print('Leaving chat2') def on_enter_state1(self, update): update.message.reply_text("你好!我可以為你做什麼呢?") def on_exit_state1(self, update): print('Leaving state1') def on_enter_state2(self, update): update.message.reply_text("你想要看那一隊的比賽?") def on_exit_state2(self, update): print('Leaving state2') def on_enter_state3(self, update): update.message.reply_text("這是裕隆隊接下來的比賽:") for document in schedule.find({"$or": [{"Team1":"裕隆"}, {"Team2":"裕隆"}]}): document = str(document) date = document.find("Date") time = document.find("Time") team1 = document.find("Team1") team2 = document.find("Team2") place = document.find("Place") #print(document[date+8:date+13], document[time+6, time+11]) update.message.reply_text(document[date+8:date+14] + " " + document[time+8:time+13] + " " + document[team1+9:team1+11] + ":" + document[team2+9:team2+11] + " " + document[place+9:place+11]) self.go_back(update) def on_exit_state3(self, update): print('Leaving state3') def on_enter_state4(self, update): update.message.reply_text("這是台啤隊接下來的比賽:") for document in schedule.find({"$or": [{"Team1":"台啤"}, {"Team2":"台啤"}]}): document = str(document) date = document.find("Date") time = document.find("Time") team1 = document.find("Team1") team2 = document.find("Team2") place = document.find("Place") update.message.reply_text(document[date+8:date+14] + " " + document[time+8:time+13] + " " + document[team1+9:team1+11] + ":" + document[team2+9:team2+11] + " " + document[place+9:place+11]) self.go_back(update) def on_exit_state4(self, update): print('Leaving state4') def on_enter_state5(self, update): update.message.reply_text("這是璞園隊接下來的比賽:") for document in schedule.find({"$or": [{"Team1":"璞園"}, {"Team2":"璞園"}]}): document = str(document) date = document.find("Date") time = document.find("Time") team1 = document.find("Team1") team2 = document.find("Team2") place = document.find("Place") #print(document[date+8:date+13], document[time+6, time+11]) update.message.reply_text(document[date+8:date+14] + " " + document[time+8:time+13] + " " + document[team1+9:team1+11] + ":" + document[team2+9:team2+11] + " " + document[place+9:place+11]) self.go_back(update) def on_exit_state5(self, update): print('Leaving state5') def on_enter_state6(self, update): update.message.reply_text("這是達欣隊接下來的比賽:") for document in schedule.find({"$or": [{"Team1":"達欣"}, {"Team2":"達欣"}]}): document = str(document) date = document.find("Date") time = document.find("Time") team1 = document.find("Team1") team2 = document.find("Team2") place = document.find("Place") update.message.reply_text(document[date+8:date+14] + " " + document[time+8:time+13] + " " + document[team1+9:team1+11] + ":" + document[team2+9:team2+11] + " " + document[place+9:place+11]) self.go_back(update) def on_exit_state6(self, update): print('Leaving state6') def on_enter_state7(self, update): update.message.reply_text("這是富邦隊接下來的比賽:") for document in schedule.find({"$or": [{"Team1":"富邦"}, {"Team2":"富邦"}]}): document = str(document) date = document.find("Date") time = document.find("Time") team1 = document.find("Team1") team2 = document.find("Team2") place = document.find("Place") #print(document[date+8:date+13], document[time+6, time+11]) update.message.reply_text(document[date+8:date+14] + " " + document[time+8:time+13] + " " + document[team1+9:team1+11] + ":" + document[team2+9:team2+11] + " " + document[place+9:place+11]) self.go_back(update) def on_exit_state7(self, update): print('Leaving state7') def on_enter_state8(self, update): update.message.reply_text("這是台銀隊接下來的比賽:") for document in schedule.find({"$or": [{"Team1":"台銀"}, {"Team2":"台銀"}]}): document = str(document) date = document.find("Date") time = document.find("Time") team1 = document.find("Team1") team2 = document.find("Team2") place = document.find("Place") update.message.reply_text(document[date+8:date+14] + " " + document[time+8:time+13] + " " + document[team1+9:team1+11] + ":" + document[team2+9:team2+11] + " " + document[place+9:place+11]) self.go_back(update) def on_exit_state8(self, update): print('Leaving state8') def on_enter_state9(self, update): update.message.reply_text("這是金酒隊接下來的比賽:") for document in schedule.find({"$or": [{"Team1":"金酒"}, {"Team2":"金酒"}]}): document = str(document) date = document.find("Date") time = document.find("Time") team1 = document.find("Team1") team2 = document.find("Team2") place = document.find("Place") #print(document[date+8:date+13], document[time+6, time+11]) update.message.reply_text(document[date+8:date+14] + " " + document[time+8:time+13] + " " + document[team1+9:team1+11] + ":" + document[team2+9:team2+11] + " " + document[place+9:place+11]) self.go_back(update) def on_exit_state9(self, update): print('Leaving state9') def on_enter_state10(self, update): update.message.reply_text("1 台灣銀行\n2 桃園璞園建築\n3 富邦勇士\n4 台北達欣工程\n5 金門酒廠\n6 裕隆納智捷\n7 台灣啤酒") self.go_back(update) def on_exit_state10(self, update): print('Leaving state10')
38.666667
201
0.583491
1,045
8,468
4.610526
0.111005
0.076795
0.07472
0.082192
0.727688
0.716065
0.599834
0.548153
0.536945
0.432337
0
0.043235
0.262518
8,468
218
202
38.844037
0.728263
0.027397
0
0.469274
0
0
0.087221
0
0
0
0
0
0
1
0.212291
false
0
0.022346
0
0.312849
0.072626
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
0
0
1
0
0
0
0
0
0
0
2
a5446309dc1e4dc4814d0f6638875e9d03515b64
443
py
Python
api/serializers.py
peterwade153/social-meta
67633f8aac7f63ee8678e59e18091b2cd6619fec
[ "MIT" ]
null
null
null
api/serializers.py
peterwade153/social-meta
67633f8aac7f63ee8678e59e18091b2cd6619fec
[ "MIT" ]
null
null
null
api/serializers.py
peterwade153/social-meta
67633f8aac7f63ee8678e59e18091b2cd6619fec
[ "MIT" ]
null
null
null
from rest_framework import serializers from api.models import Post, Like class PostSerializer(serializers.ModelSerializer): class Meta: model = Post read_only_fields = ['id', 'user', 'is_active'] fields = ['text'] + read_only_fields class LikeSerializer(serializers.ModelSerializer): class Meta: model = Like read_only_fields = ['id', 'user'] fields = ['post'] + read_only_fields
22.15
54
0.6614
49
443
5.77551
0.469388
0.113074
0.19788
0.24735
0.424028
0
0
0
0
0
0
0
0.23702
443
19
55
23.315789
0.837278
0
0
0.166667
0
0
0.065463
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.5
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a5594c0fc5b313819654b388377b510a2036915f
115
py
Python
Stones on the Table.py
NehaAgarwal2598/Codeforces
859196a734cb24834736adf9517b351647da6e73
[ "MIT" ]
null
null
null
Stones on the Table.py
NehaAgarwal2598/Codeforces
859196a734cb24834736adf9517b351647da6e73
[ "MIT" ]
null
null
null
Stones on the Table.py
NehaAgarwal2598/Codeforces
859196a734cb24834736adf9517b351647da6e73
[ "MIT" ]
null
null
null
n = int(input()) s = input() c=0 for i in range(n-1): if s[i]==s[i+1]: c +=1 print(c)
10.454545
21
0.391304
23
115
1.956522
0.565217
0.088889
0
0
0
0
0
0
0
0
0
0.057143
0.391304
115
10
22
11.5
0.585714
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.142857
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a56df4a560c4a746353d76fcd7919d82fa2b9f05
538
py
Python
22-django/aprendiendoDjango/miapp/models.py
richi2050/Master-en-python
d8ba136f03d8f794cded235c4e7b4b3dadba4dc4
[ "MIT" ]
null
null
null
22-django/aprendiendoDjango/miapp/models.py
richi2050/Master-en-python
d8ba136f03d8f794cded235c4e7b4b3dadba4dc4
[ "MIT" ]
null
null
null
22-django/aprendiendoDjango/miapp/models.py
richi2050/Master-en-python
d8ba136f03d8f794cded235c4e7b4b3dadba4dc4
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class Article(models.Model): title = models.CharField(max_length=100) image = models.ImageField(default='null') content = models.TextField() public = models.BooleanField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Category(models.Model): name = models.CharField(max_length=100) description = models.CharField(max_length=250) created_at = models.DateTimeField(auto_now_add=True)
33.625
56
0.750929
69
538
5.695652
0.521739
0.114504
0.137405
0.183206
0.422392
0.21374
0.21374
0.21374
0
0
0
0.019565
0.144981
538
16
57
33.625
0.834783
0.04461
0
0.166667
0
0
0.007797
0
0
0
0
0
0
1
0
false
0
0.083333
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
a57321ad776cf3a73f1dc9dba83d7dbbe8365249
884
py
Python
vispy/io/datasets.py
izaid/vispy
402cf95bfef88d70c9c45bb27c532ed72944e14a
[ "BSD-3-Clause" ]
null
null
null
vispy/io/datasets.py
izaid/vispy
402cf95bfef88d70c9c45bb27c532ed72944e14a
[ "BSD-3-Clause" ]
null
null
null
vispy/io/datasets.py
izaid/vispy
402cf95bfef88d70c9c45bb27c532ed72944e14a
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # Copyright (c) 2014, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import numpy as np from os import path as op from ..util import load_data_file # This is the package data dir, not the dir for config, etc. DATA_DIR = op.join(op.dirname(__file__), '_data') def load_iris(): """Load the iris dataset Returns ------- iris : NpzFile data['data'] : a (150, 4) NumPy array with the iris' features data['group'] : a (150,) NumPy array with the iris' group """ return np.load(load_data_file('iris/iris.npz', force_download='2014-09-04')) def load_crate(): """Load an image of a crate Returns ------- crate : array 256x256x3 crate image. """ return np.load(load_data_file('orig/crate.npz'))['crate']
24.555556
73
0.613122
127
884
4.149606
0.511811
0.045541
0.068311
0.064516
0.170778
0.091082
0
0
0
0
0
0.040971
0.254525
884
35
74
25.257143
0.758725
0.522624
0
0
0
0
0.129834
0
0
0
0
0
0
1
0.222222
false
0
0.333333
0
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
1
0
0
0
0
2
a5953a795730e0e06aede826773d8532f804edb9
836
py
Python
src/restfuls/apps/v1/route.py
Qinnnnnn/Watero_DataCenter
fc56dc13fa9a71817de9243b494dc01ab1d193bd
[ "MIT" ]
null
null
null
src/restfuls/apps/v1/route.py
Qinnnnnn/Watero_DataCenter
fc56dc13fa9a71817de9243b494dc01ab1d193bd
[ "MIT" ]
null
null
null
src/restfuls/apps/v1/route.py
Qinnnnnn/Watero_DataCenter
fc56dc13fa9a71817de9243b494dc01ab1d193bd
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding:utf-8 -*- """ File : route.py Author : Zerui Qin CreateDate : 2019-04-01 09:50:07 Note : 注册URL """ from src.restfuls.apps.v1.apis.auth import AgentAuth from src.restfuls.apps.v1.apis.heartbeat import AgentHeartbeat from src.restfuls.apps.v1.apis.push import AgentPush from src.restfuls.apps.v1.apis.register import AgentRegister from src.restfuls.apps.v1.apis.resource import AgentResource def register_url(api): """ 注册URL :param api: :return: """ api.add_resource(AgentRegister, '/register', endpoint='register') api.add_resource(AgentAuth, '/auth', endpoint='auth') api.add_resource(AgentPush, '/push', endpoint='push') api.add_resource(AgentHeartbeat, '/heartbeat/', endpoint='heartbeat') api.add_resource(AgentResource, '/resource', endpoint='resource')
30.962963
73
0.723684
110
836
5.445455
0.418182
0.058431
0.125209
0.158598
0.208681
0.208681
0
0
0
0
0
0.027473
0.129187
836
26
74
32.153846
0.79533
0.179426
0
0
0
0
0.110092
0
0
0
0
0
0
1
0.090909
false
0
0.454545
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
a5b221fa1c656d7576d2672d422de1386f23210f
1,836
py
Python
nn_modules/gzip-js/test/zipTest.py
PotWallet/PotWallet-Chain
b5728de3ff44b4f9611a01e036410e91c7fec15e
[ "MIT", "Unlicense" ]
305
2015-01-06T12:37:29.000Z
2022-03-25T18:03:52.000Z
node_modules/grunt/node_modules/gzip-js/test/zipTest.py
arhea/grunt-travis
58afde3919d79e78fdfb66aeda42d6bcb44d4e97
[ "MIT" ]
18
2015-02-09T11:04:23.000Z
2020-12-08T21:27:04.000Z
node_modules/grunt/node_modules/gzip-js/test/zipTest.py
arhea/grunt-travis
58afde3919d79e78fdfb66aeda42d6bcb44d4e97
[ "MIT" ]
68
2015-05-09T05:07:42.000Z
2022-02-10T23:22:13.000Z
import os from helpers import run_cmd from colorama import Fore defaultTestDir = 'test-files' defaultOutDir = 'test-outs' """ Run a single test @param tFile- required; the full path to the file to run @param level- optional (default: all); the compression level [1-9] @return True if all tests passed; False if at least one test failed """ def runTest(tFile, level=None, outDir=defaultOutDir): passed = True if level == None: for x in range(1, 10): if runTest(tFile, x, outDir) == False: passed = False return passed out1 = os.path.join(outDir, '%(file)s.%(level)d.gz' % {'file': os.path.basename(tFile), 'level' : level}) out2 = os.path.join(outDir, '%(file)s.%(level)d.out.gz' % {'file': os.path.basename(tFile), 'level' : level}) run_cmd('gzip -c -%(level)d %(file)s > %(outfile)s' % {'level' : level, 'file' : tFile, 'outfile' : out1}) run_cmd('../bin/gzip.js --level %(level)d --file %(file)s --output %(output)s' % {'level' : level, 'file' : tFile, 'output' : out2}) result = run_cmd('diff %(file1)s %(file2)s' % {'file1' : out1, 'file2' : out2}) if result['returncode'] == 0: status = Fore.GREEN + 'PASSED' + Fore.RESET else: passed = False status = Fore.RED + 'FAILED' + Fore.RESET print 'Level %(level)d: %(status)s' % {'level' : level, 'status' : status} return passed """ Runs all tests on the given level. This iterates throuth the testDir directory defined above. @param level- The level to run on [1-9] (default: None, runs on all levels all) @return True if all levels passed, False if at least one failed """ def runAll(level=None, testDir=defaultTestDir): passed = True for tFile in os.listdir(testDir): fullPath = os.path.join(testDir, tFile) print Fore.YELLOW + tFile + Fore.RESET if runTest(fullPath, level) == False: passed = False print '' return passed
30.098361
133
0.667756
276
1,836
4.427536
0.326087
0.057283
0.02455
0.02455
0.171849
0.139116
0.101473
0.101473
0
0
0
0.011858
0.173203
1,836
60
134
30.6
0.793149
0
0
0.242424
0
0.030303
0.231218
0.033552
0
0
0
0
0
0
null
null
0.272727
0.090909
null
null
0.090909
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
0
0
0
0
0
2
3c0153768e4b883adf2eab5ec0d78056452ee636
17,293
py
Python
pysnmp/CRESCENDO-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/CRESCENDO-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/CRESCENDO-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module CRESCENDO-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CRESCENDO-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:12:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ValueSizeConstraint") MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("RFC1212", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") DisplayString, = mibBuilder.importSymbols("RFC1213", "DisplayString") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") enterprises, Unsigned32, iso, MibIdentifier, Integer32, NotificationType, Counter32, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Bits, ObjectIdentity, IpAddress, ModuleIdentity, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "enterprises", "Unsigned32", "iso", "MibIdentifier", "Integer32", "NotificationType", "Counter32", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Bits", "ObjectIdentity", "IpAddress", "ModuleIdentity", "Gauge32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") crescendo = MibIdentifier((1, 3, 6, 1, 4, 1, 203)) crescendoProducts = MibIdentifier((1, 3, 6, 1, 4, 1, 203, 1)) concentrator = MibIdentifier((1, 3, 6, 1, 4, 1, 203, 1, 1)) conc = MibIdentifier((1, 3, 6, 1, 4, 1, 203, 1, 1, 1)) chassis = MibIdentifier((1, 3, 6, 1, 4, 1, 203, 1, 1, 2)) module = MibIdentifier((1, 3, 6, 1, 4, 1, 203, 1, 1, 3)) port = MibIdentifier((1, 3, 6, 1, 4, 1, 203, 1, 1, 4)) concMgmtType = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("snmp", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: concMgmtType.setStatus('mandatory') concIpAddr = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: concIpAddr.setStatus('mandatory') concNetMask = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: concNetMask.setStatus('mandatory') concBroadcast = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 4), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: concBroadcast.setStatus('mandatory') concTrapReceiverTable = MibTable((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 5), ) if mibBuilder.loadTexts: concTrapReceiverTable.setStatus('mandatory') concTrapReceiverEntry = MibTableRow((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 5, 1), ).setIndexNames((0, "CRESCENDO-MIB", "concTrapReceiverAddr")) if mibBuilder.loadTexts: concTrapReceiverEntry.setStatus('mandatory') concTrapReceiverType = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("invalid", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: concTrapReceiverType.setStatus('mandatory') concTrapReceiverAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 5, 1, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: concTrapReceiverAddr.setStatus('mandatory') concTrapReceiverComm = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 5, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite") if mibBuilder.loadTexts: concTrapReceiverComm.setStatus('mandatory') concCommunityTable = MibTable((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 6), ) if mibBuilder.loadTexts: concCommunityTable.setStatus('mandatory') concCommunityEntry = MibTableRow((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 6, 1), ).setIndexNames((0, "CRESCENDO-MIB", "concCommunityAccess")) if mibBuilder.loadTexts: concCommunityEntry.setStatus('mandatory') concCommunityAccess = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 6, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("readOnly", 2), ("readWrite", 3), ("readWriteAll", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: concCommunityAccess.setStatus('mandatory') concCommunityString = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 6, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite") if mibBuilder.loadTexts: concCommunityString.setStatus('mandatory') concAttachType = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("dualAttach", 2), ("singleAttach", 3), ("nullAttach", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: concAttachType.setStatus('mandatory') concTraffic = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly") if mibBuilder.loadTexts: concTraffic.setStatus('mandatory') concReset = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: concReset.setStatus('mandatory') concBaudRate = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 1, 10), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: concBaudRate.setStatus('mandatory') chassisType = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("cxxxx", 2), ("c1000", 3), ("c1001", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisType.setStatus('mandatory') chassisBkplType = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("fddi", 2), ("fddiEthernet", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisBkplType.setStatus('mandatory') chassisPs1Type = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("other", 1), ("none", 2), ("w50", 3), ("w200", 4), ("w600", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisPs1Type.setStatus('mandatory') chassisPs1Status = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("ok", 2), ("minorFault", 3), ("majorFault", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisPs1Status.setStatus('mandatory') chassisPs1TestResult = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisPs1TestResult.setStatus('mandatory') chassisPs2Type = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("other", 1), ("none", 2), ("w50", 3), ("w200", 4), ("w600", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisPs2Type.setStatus('mandatory') chassisPs2Status = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("ok", 2), ("minorFault", 3), ("majorFault", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisPs2Status.setStatus('mandatory') chassisPs2TestResult = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisPs2TestResult.setStatus('mandatory') chassisFanStatus = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("ok", 2), ("minorFault", 3), ("majorFault", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisFanStatus.setStatus('mandatory') chassisFanTestResult = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisFanTestResult.setStatus('mandatory') chassisMinorAlarm = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisMinorAlarm.setStatus('mandatory') chassisMajorAlarm = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisMajorAlarm.setStatus('mandatory') chassisTempAlarm = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisTempAlarm.setStatus('mandatory') chassisNumSlots = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 14), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisNumSlots.setStatus('mandatory') chassisSlotConfig = MibScalar((1, 3, 6, 1, 4, 1, 203, 1, 1, 2, 15), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisSlotConfig.setStatus('mandatory') moduleTable = MibTable((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1), ) if mibBuilder.loadTexts: moduleTable.setStatus('mandatory') moduleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1), ).setIndexNames((0, "CRESCENDO-MIB", "moduleIndex")) if mibBuilder.loadTexts: moduleEntry.setStatus('mandatory') moduleIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleIndex.setStatus('mandatory') moduleType = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("empty", 2), ("c1000", 3), ("c1001", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleType.setStatus('mandatory') moduleSerialNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleSerialNumber.setStatus('mandatory') moduleHwHiVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleHwHiVersion.setStatus('mandatory') moduleHwLoVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleHwLoVersion.setStatus('mandatory') moduleFwHiVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleFwHiVersion.setStatus('mandatory') moduleFwLoVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleFwLoVersion.setStatus('mandatory') moduleSwHiVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleSwHiVersion.setStatus('mandatory') moduleSwLoVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleSwLoVersion.setStatus('mandatory') moduleStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("ok", 2), ("minorFault", 3), ("majorFault", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleStatus.setStatus('mandatory') moduleTestResult = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleTestResult.setStatus('mandatory') moduleReset = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: moduleReset.setStatus('mandatory') moduleName = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 13), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite") if mibBuilder.loadTexts: moduleName.setStatus('mandatory') moduleNumPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 14), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleNumPorts.setStatus('mandatory') modulePortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 3, 1, 1, 15), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readonly") if mibBuilder.loadTexts: modulePortStatus.setStatus('mandatory') portTable = MibTable((1, 3, 6, 1, 4, 1, 203, 1, 1, 4, 1), ) if mibBuilder.loadTexts: portTable.setStatus('mandatory') portEntry = MibTableRow((1, 3, 6, 1, 4, 1, 203, 1, 1, 4, 1, 1), ).setIndexNames((0, "CRESCENDO-MIB", "portModuleIndex"), (0, "CRESCENDO-MIB", "portIndex")) if mibBuilder.loadTexts: portEntry.setStatus('mandatory') portModuleIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 4, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: portModuleIndex.setStatus('mandatory') portIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 4, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: portIndex.setStatus('mandatory') portFddiIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 4, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: portFddiIndex.setStatus('mandatory') portName = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 4, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite") if mibBuilder.loadTexts: portName.setStatus('mandatory') portType = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 4, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("cddi", 2), ("fiber", 3), ("multiMedia", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: portType.setStatus('mandatory') portStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 203, 1, 1, 4, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("ok", 2), ("minorFault", 3), ("majorFault", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: portStatus.setStatus('mandatory') mibBuilder.exportSymbols("CRESCENDO-MIB", moduleNumPorts=moduleNumPorts, chassisMinorAlarm=chassisMinorAlarm, concTrapReceiverType=concTrapReceiverType, crescendoProducts=crescendoProducts, chassisType=chassisType, chassisPs1TestResult=chassisPs1TestResult, chassisMajorAlarm=chassisMajorAlarm, chassisSlotConfig=chassisSlotConfig, modulePortStatus=modulePortStatus, chassisPs1Status=chassisPs1Status, moduleHwHiVersion=moduleHwHiVersion, concCommunityEntry=concCommunityEntry, chassisFanTestResult=chassisFanTestResult, chassisPs2TestResult=chassisPs2TestResult, chassisFanStatus=chassisFanStatus, concIpAddr=concIpAddr, chassisPs2Status=chassisPs2Status, moduleReset=moduleReset, chassisPs2Type=chassisPs2Type, concTrapReceiverComm=concTrapReceiverComm, concNetMask=concNetMask, moduleStatus=moduleStatus, chassisPs1Type=chassisPs1Type, chassisNumSlots=chassisNumSlots, concBroadcast=concBroadcast, concTrapReceiverTable=concTrapReceiverTable, concMgmtType=concMgmtType, moduleHwLoVersion=moduleHwLoVersion, moduleSwLoVersion=moduleSwLoVersion, moduleTestResult=moduleTestResult, moduleIndex=moduleIndex, moduleType=moduleType, crescendo=crescendo, module=module, concTrapReceiverEntry=concTrapReceiverEntry, concCommunityString=concCommunityString, moduleTable=moduleTable, portType=portType, concBaudRate=concBaudRate, chassisTempAlarm=chassisTempAlarm, portEntry=portEntry, moduleFwLoVersion=moduleFwLoVersion, moduleSwHiVersion=moduleSwHiVersion, moduleSerialNumber=moduleSerialNumber, concAttachType=concAttachType, portIndex=portIndex, moduleFwHiVersion=moduleFwHiVersion, moduleName=moduleName, chassis=chassis, portName=portName, port=port, concCommunityAccess=concCommunityAccess, concentrator=concentrator, portStatus=portStatus, concTrapReceiverAddr=concTrapReceiverAddr, conc=conc, concCommunityTable=concCommunityTable, concTraffic=concTraffic, moduleEntry=moduleEntry, portTable=portTable, portFddiIndex=portFddiIndex, chassisBkplType=chassisBkplType, concReset=concReset, portModuleIndex=portModuleIndex)
125.311594
2,021
0.74215
2,055
17,293
6.245255
0.09635
0.01683
0.01683
0.019947
0.540829
0.503584
0.443198
0.419199
0.409225
0.386162
0
0.079608
0.085468
17,293
137
2,022
126.226277
0.7319
0.018505
0
0
0
0
0.116541
0.002594
0
0
0
0
0
1
0
false
0
0.061538
0
0.061538
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3c1950bfb4c58d17df258a837440092dea72e319
317
py
Python
tests/conftest.py
textanalytics2020/laserembeddings
77747b79815b706479425ca48166c89a40eed143
[ "BSD-3-Clause" ]
177
2019-07-23T20:48:23.000Z
2022-03-28T02:59:16.000Z
tests/conftest.py
textanalytics2020/laserembeddings
77747b79815b706479425ca48166c89a40eed143
[ "BSD-3-Clause" ]
21
2019-10-01T10:53:31.000Z
2021-12-12T10:31:43.000Z
tests/conftest.py
textanalytics2020/laserembeddings
77747b79815b706479425ca48166c89a40eed143
[ "BSD-3-Clause" ]
20
2019-08-31T09:56:57.000Z
2021-11-23T10:43:30.000Z
import os import pytest @pytest.fixture def test_data(): import numpy as np test_data_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data', 'laserembeddings-test-data.npz') return np.load(test_data_file) if os.path.isfile(test_data_file) else None
24.384615
78
0.665615
46
317
4.347826
0.5
0.2
0.18
0
0
0
0
0
0
0
0
0
0.227129
317
12
79
26.416667
0.816327
0
0
0
0
0
0.104101
0.091483
0
0
0
0
0
1
0.125
false
0
0.375
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3c36824ad9ebdd39f48bbb269eb0a6b11166df47
819
py
Python
venv/lib/python3.7/site-packages/pystan/__init__.py
vchiapaikeo/prophet
e8c250ca7bfffc280baa7dabc80a2c2d1f72c6a7
[ "MIT" ]
null
null
null
venv/lib/python3.7/site-packages/pystan/__init__.py
vchiapaikeo/prophet
e8c250ca7bfffc280baa7dabc80a2c2d1f72c6a7
[ "MIT" ]
null
null
null
venv/lib/python3.7/site-packages/pystan/__init__.py
vchiapaikeo/prophet
e8c250ca7bfffc280baa7dabc80a2c2d1f72c6a7
[ "MIT" ]
null
null
null
#----------------------------------------------------------------------------- # Copyright (c) 2013-2015 PyStan developers # # This file is licensed under Version 3.0 of the GNU General Public # License. See LICENSE for a text of the license. #----------------------------------------------------------------------------- import logging from pystan.api import stanc, stan from pystan.misc import read_rdump, stan_rdump, stansummary from pystan.diagnostics import check_hmc_diagnostics from pystan.model import StanModel from pystan.lookup import lookup logger = logging.getLogger('pystan') logger.addHandler(logging.NullHandler()) if len(logger.handlers) == 1: logging.basicConfig(level=logging.INFO) # following PEP 386 # See also https://docs.openstack.org/pbr/latest/user/semver.html __version__ = '2.19.1.1'
35.608696
78
0.634921
99
819
5.171717
0.666667
0.097656
0
0
0
0
0
0
0
0
0
0.02585
0.102564
819
22
79
37.227273
0.670748
0.478632
0
0
0
0
0.033413
0
0
0
0
0
0
1
0
false
0
0.545455
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3c397d147b06582185868eee113671c46ccc2bfb
548
py
Python
ampa/cole/migrations/0024_entitat_instance.py
jordiprats/django-ampa
b8e9d6076c32caa8bdc11094362ddccb12d95f8c
[ "Apache-2.0" ]
null
null
null
ampa/cole/migrations/0024_entitat_instance.py
jordiprats/django-ampa
b8e9d6076c32caa8bdc11094362ddccb12d95f8c
[ "Apache-2.0" ]
null
null
null
ampa/cole/migrations/0024_entitat_instance.py
jordiprats/django-ampa
b8e9d6076c32caa8bdc11094362ddccb12d95f8c
[ "Apache-2.0" ]
null
null
null
# Generated by Django 3.1.5 on 2021-03-06 17:29 from django.db import migrations, models def forward(apps, schema_editor): Entitat = apps.get_model("cole", "Entitat") try: entitat_instance = Entitat.objects.all()[0] if entitat_instance: return except: pass entitat_instance = Entitat() entitat_instance.save() class Migration(migrations.Migration): dependencies = [ ('cole', '0023_entitat_codi_registre'), ] operations = [ migrations.RunPython(forward) ]
21.92
51
0.640511
62
548
5.516129
0.709677
0.175439
0.128655
0
0
0
0
0
0
0
0
0.0489
0.25365
548
24
52
22.833333
0.787286
0.082117
0
0
1
0
0.081836
0.051896
0
0
0
0
0
1
0.055556
false
0.055556
0.055556
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
3c3f4cd4f6d1b2e174e3741225ac00366eb8de7d
92
py
Python
src/wizcoin/__init__.py
emacollins/wizcoin
39c5df6623675e83bae2eb435878d58e23cf0b8e
[ "MIT" ]
null
null
null
src/wizcoin/__init__.py
emacollins/wizcoin
39c5df6623675e83bae2eb435878d58e23cf0b8e
[ "MIT" ]
null
null
null
src/wizcoin/__init__.py
emacollins/wizcoin
39c5df6623675e83bae2eb435878d58e23cf0b8e
[ "MIT" ]
null
null
null
"""WizCoin By Al Sweigart test@gmail.com A basic Python project.""" __version__ = '0.1.0'
13.142857
29
0.695652
15
92
4
0.933333
0
0
0
0
0
0
0
0
0
0
0.038462
0.152174
92
6
30
15.333333
0.730769
0.673913
0
0
0
0
0.208333
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3c44389404392b3a903490973640379a4ebb22bd
102
py
Python
output/models/saxon_data/xml_versions/xv001_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
1
2021-08-14T17:59:21.000Z
2021-08-14T17:59:21.000Z
output/models/saxon_data/xml_versions/xv001_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
4
2020-02-12T21:30:44.000Z
2020-04-15T20:06:46.000Z
output/models/saxon_data/xml_versions/xv001_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
null
null
null
from output.models.saxon_data.xml_versions.xv001_xsd.xv001 import DKstra __all__ = [ "DKstra", ]
17
72
0.754902
14
102
5
0.857143
0
0
0
0
0
0
0
0
0
0
0.068182
0.137255
102
5
73
20.4
0.727273
0
0
0
0
0
0.058824
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3c4c728fbade613a2239f30b7eb299a38bc1425a
8,362
py
Python
nova/virt/xenapi/image/utils.py
bopopescu/nova-token
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
[ "Apache-2.0" ]
null
null
null
nova/virt/xenapi/image/utils.py
bopopescu/nova-token
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
[ "Apache-2.0" ]
null
null
null
nova/virt/xenapi/image/utils.py
bopopescu/nova-token
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
[ "Apache-2.0" ]
2
2017-07-20T17:31:34.000Z
2020-07-24T02:42:19.000Z
begin_unit comment|'# Copyright 2013 OpenStack Foundation' nl|'\n' comment|'# All Rights Reserved.' nl|'\n' comment|'#' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' comment|'# a copy of the License at' nl|'\n' comment|'#' nl|'\n' comment|'# http://www.apache.org/licenses/LICENSE-2.0' nl|'\n' comment|'#' nl|'\n' comment|'# Unless required by applicable law or agreed to in writing, software' nl|'\n' comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT' nl|'\n' comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the' nl|'\n' comment|'# License for the specific language governing permissions and limitations' nl|'\n' comment|'# under the License.' nl|'\n' nl|'\n' name|'import' name|'shutil' newline|'\n' name|'import' name|'tarfile' newline|'\n' nl|'\n' name|'from' name|'nova' name|'import' name|'image' newline|'\n' nl|'\n' DECL|variable|IMAGE_API name|'IMAGE_API' op|'=' name|'image' op|'.' name|'API' op|'(' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|class|GlanceImage name|'class' name|'GlanceImage' op|'(' name|'object' op|')' op|':' newline|'\n' DECL|member|__init__ indent|' ' name|'def' name|'__init__' op|'(' name|'self' op|',' name|'context' op|',' name|'image_href_or_id' op|')' op|':' newline|'\n' indent|' ' name|'self' op|'.' name|'_context' op|'=' name|'context' newline|'\n' name|'self' op|'.' name|'_image_id' op|'=' name|'image_href_or_id' newline|'\n' name|'self' op|'.' name|'_cached_meta' op|'=' name|'None' newline|'\n' nl|'\n' dedent|'' op|'@' name|'property' newline|'\n' DECL|member|meta name|'def' name|'meta' op|'(' name|'self' op|')' op|':' newline|'\n' indent|' ' name|'if' name|'self' op|'.' name|'_cached_meta' name|'is' name|'None' op|':' newline|'\n' indent|' ' name|'self' op|'.' name|'_cached_meta' op|'=' name|'IMAGE_API' op|'.' name|'get' op|'(' name|'self' op|'.' name|'_context' op|',' name|'self' op|'.' name|'_image_id' op|')' newline|'\n' dedent|'' name|'return' name|'self' op|'.' name|'_cached_meta' newline|'\n' nl|'\n' DECL|member|download_to dedent|'' name|'def' name|'download_to' op|'(' name|'self' op|',' name|'fileobj' op|')' op|':' newline|'\n' indent|' ' name|'return' name|'IMAGE_API' op|'.' name|'download' op|'(' name|'self' op|'.' name|'_context' op|',' name|'self' op|'.' name|'_image_id' op|',' name|'fileobj' op|')' newline|'\n' nl|'\n' DECL|member|is_raw_tgz dedent|'' name|'def' name|'is_raw_tgz' op|'(' name|'self' op|')' op|':' newline|'\n' indent|' ' name|'return' op|'[' string|"'raw'" op|',' string|"'tgz'" op|']' op|'==' op|'[' nl|'\n' name|'self' op|'.' name|'meta' op|'.' name|'get' op|'(' name|'key' op|')' name|'for' name|'key' name|'in' op|'(' string|"'disk_format'" op|',' string|"'container_format'" op|')' op|']' newline|'\n' nl|'\n' DECL|member|data dedent|'' name|'def' name|'data' op|'(' name|'self' op|')' op|':' newline|'\n' indent|' ' name|'return' name|'IMAGE_API' op|'.' name|'download' op|'(' name|'self' op|'.' name|'_context' op|',' name|'self' op|'.' name|'_image_id' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|class|RawImage dedent|'' dedent|'' name|'class' name|'RawImage' op|'(' name|'object' op|')' op|':' newline|'\n' DECL|member|__init__ indent|' ' name|'def' name|'__init__' op|'(' name|'self' op|',' name|'glance_image' op|')' op|':' newline|'\n' indent|' ' name|'self' op|'.' name|'glance_image' op|'=' name|'glance_image' newline|'\n' nl|'\n' DECL|member|get_size dedent|'' name|'def' name|'get_size' op|'(' name|'self' op|')' op|':' newline|'\n' indent|' ' name|'return' name|'int' op|'(' name|'self' op|'.' name|'glance_image' op|'.' name|'meta' op|'[' string|"'size'" op|']' op|')' newline|'\n' nl|'\n' DECL|member|stream_to dedent|'' name|'def' name|'stream_to' op|'(' name|'self' op|',' name|'fileobj' op|')' op|':' newline|'\n' indent|' ' name|'return' name|'self' op|'.' name|'glance_image' op|'.' name|'download_to' op|'(' name|'fileobj' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|class|IterableToFileAdapter dedent|'' dedent|'' name|'class' name|'IterableToFileAdapter' op|'(' name|'object' op|')' op|':' newline|'\n' indent|' ' string|'"""A degenerate file-like so that an iterable could be read like a file.\n\n As Glance client returns an iterable, but tarfile requires a file like,\n this is the adapter between the two. This allows tarfile to access the\n glance stream.\n """' newline|'\n' nl|'\n' DECL|member|__init__ name|'def' name|'__init__' op|'(' name|'self' op|',' name|'iterable' op|')' op|':' newline|'\n' indent|' ' name|'self' op|'.' name|'iterator' op|'=' name|'iterable' op|'.' name|'__iter__' op|'(' op|')' newline|'\n' name|'self' op|'.' name|'remaining_data' op|'=' string|"''" newline|'\n' nl|'\n' DECL|member|read dedent|'' name|'def' name|'read' op|'(' name|'self' op|',' name|'size' op|')' op|':' newline|'\n' indent|' ' name|'chunk' op|'=' name|'self' op|'.' name|'remaining_data' newline|'\n' name|'try' op|':' newline|'\n' indent|' ' name|'while' name|'not' name|'chunk' op|':' newline|'\n' indent|' ' name|'chunk' op|'=' name|'next' op|'(' name|'self' op|'.' name|'iterator' op|')' newline|'\n' dedent|'' dedent|'' name|'except' name|'StopIteration' op|':' newline|'\n' indent|' ' name|'return' string|"''" newline|'\n' dedent|'' name|'return_value' op|'=' name|'chunk' op|'[' number|'0' op|':' name|'size' op|']' newline|'\n' name|'self' op|'.' name|'remaining_data' op|'=' name|'chunk' op|'[' name|'size' op|':' op|']' newline|'\n' name|'return' name|'return_value' newline|'\n' nl|'\n' nl|'\n' DECL|class|RawTGZImage dedent|'' dedent|'' name|'class' name|'RawTGZImage' op|'(' name|'object' op|')' op|':' newline|'\n' DECL|member|__init__ indent|' ' name|'def' name|'__init__' op|'(' name|'self' op|',' name|'glance_image' op|')' op|':' newline|'\n' indent|' ' name|'self' op|'.' name|'glance_image' op|'=' name|'glance_image' newline|'\n' name|'self' op|'.' name|'_tar_info' op|'=' name|'None' newline|'\n' name|'self' op|'.' name|'_tar_file' op|'=' name|'None' newline|'\n' nl|'\n' DECL|member|_as_file dedent|'' name|'def' name|'_as_file' op|'(' name|'self' op|')' op|':' newline|'\n' indent|' ' name|'return' name|'IterableToFileAdapter' op|'(' name|'self' op|'.' name|'glance_image' op|'.' name|'data' op|'(' op|')' op|')' newline|'\n' nl|'\n' DECL|member|_as_tarfile dedent|'' name|'def' name|'_as_tarfile' op|'(' name|'self' op|')' op|':' newline|'\n' indent|' ' name|'return' name|'tarfile' op|'.' name|'open' op|'(' name|'mode' op|'=' string|"'r|gz'" op|',' name|'fileobj' op|'=' name|'self' op|'.' name|'_as_file' op|'(' op|')' op|')' newline|'\n' nl|'\n' DECL|member|get_size dedent|'' name|'def' name|'get_size' op|'(' name|'self' op|')' op|':' newline|'\n' indent|' ' name|'if' name|'self' op|'.' name|'_tar_file' name|'is' name|'None' op|':' newline|'\n' indent|' ' name|'self' op|'.' name|'_tar_file' op|'=' name|'self' op|'.' name|'_as_tarfile' op|'(' op|')' newline|'\n' name|'self' op|'.' name|'_tar_info' op|'=' name|'self' op|'.' name|'_tar_file' op|'.' name|'next' op|'(' op|')' newline|'\n' dedent|'' name|'return' name|'self' op|'.' name|'_tar_info' op|'.' name|'size' newline|'\n' nl|'\n' DECL|member|stream_to dedent|'' name|'def' name|'stream_to' op|'(' name|'self' op|',' name|'target_file' op|')' op|':' newline|'\n' indent|' ' name|'if' name|'self' op|'.' name|'_tar_file' name|'is' name|'None' op|':' newline|'\n' indent|' ' name|'self' op|'.' name|'_tar_file' op|'=' name|'self' op|'.' name|'_as_tarfile' op|'(' op|')' newline|'\n' name|'self' op|'.' name|'_tar_info' op|'=' name|'self' op|'.' name|'_tar_file' op|'.' name|'next' op|'(' op|')' newline|'\n' dedent|'' name|'source_file' op|'=' name|'self' op|'.' name|'_tar_file' op|'.' name|'extractfile' op|'(' name|'self' op|'.' name|'_tar_info' op|')' newline|'\n' name|'shutil' op|'.' name|'copyfileobj' op|'(' name|'source_file' op|',' name|'target_file' op|')' newline|'\n' name|'self' op|'.' name|'_tar_file' op|'.' name|'close' op|'(' op|')' newline|'\n' dedent|'' dedent|'' endmarker|'' end_unit
12.924266
265
0.602009
1,245
8,362
3.926104
0.127711
0.153437
0.11252
0.13748
0.671849
0.593494
0.529255
0.498977
0.441489
0.38257
0
0.001227
0.122818
8,362
646
266
12.944272
0.665167
0
0
0.908669
0
0.001548
0.36618
0.005023
0
0
0
0
0
0
null
null
0
0.004644
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
3c50ba24127886bcf7c71449e0a441caef745c79
2,016
py
Python
cli/utils.py
Remmeauth/remme-core-cli
94cc09fe9d2e718b45273dde68d6c672c4773f6a
[ "MIT" ]
null
null
null
cli/utils.py
Remmeauth/remme-core-cli
94cc09fe9d2e718b45273dde68d6c672c4773f6a
[ "MIT" ]
94
2019-03-27T09:34:28.000Z
2019-08-27T05:32:33.000Z
cli/utils.py
Remmeauth/remme-core-cli
94cc09fe9d2e718b45273dde68d6c672c4773f6a
[ "MIT" ]
6
2019-06-06T15:16:38.000Z
2020-02-24T12:55:55.000Z
""" Provide utils for command line interface. """ import json import click from cli.config import ConfigFile def dict_to_pretty_json(data): r""" Convert dictionary to json with indents (human readable string). From the following code: { "address": [ "The following address `1120076ecf036e857f42129b5830` is invalid." ] } It creates: "{\n \"address\": [\n \"The following address `1120076ecf036e857f42129b5830` is invalid.\" ]\n}\n" Notes: - `r` symbol at the start of the documentation is presented because of PEP257. References: - https://www.python.org/dev/peps/pep-0257/#id15 - https://stackoverflow.com/a/33734332/9632462 """ return json.dumps(data, indent=4, sort_keys=True) def print_result(result): """ Print successful result to the terminal. """ return click.echo(dict_to_pretty_json({'result': result})) def print_errors(errors): """ Print error messages to the terminal. Arguments: errors (string or dict): dictionary with error messages. References: - https://click.palletsprojects.com/en/7.x/utils/#ansi-colors """ click.secho(dict_to_pretty_json({'errors': errors}), blink=True, bold=True, fg='red') def default_node_url(): """ Get default node URL. """ config_parameters = ConfigFile().parse() if config_parameters.node_url is None: return 'localhost' return config_parameters.node_url async def return_async_value(value): """ Asynchronous function return value impostor. Using for mock particular asynchronous function with specified return value. Example of usage in code: mock_account_get_balance = mock.patch('cli.account.service.Account.get_balance') mock_account_get_balance.return_value = return_async_value(13500) References: - https://github.com/pytest-dev/pytest-mock/issues/60 """ return value
24.888889
119
0.659722
243
2,016
5.345679
0.485597
0.021555
0.027714
0.036952
0.08622
0.08622
0
0
0
0
0
0.049838
0.233631
2,016
80
120
25.2
0.790939
0.418651
0
0
0
0
0.038647
0
0
0
0
0
0
1
0.235294
false
0
0.176471
0
0.705882
0.117647
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
0
1
0
0
2
3c5c5cae33924c7df042e7f2e12672f2ff06b57a
2,085
py
Python
tests/test_file_walker.py
vardan10/codewatch
d906edaa0f7aa51cc1ee159356f801512d138000
[ "Apache-2.0" ]
null
null
null
tests/test_file_walker.py
vardan10/codewatch
d906edaa0f7aa51cc1ee159356f801512d138000
[ "Apache-2.0" ]
null
null
null
tests/test_file_walker.py
vardan10/codewatch
d906edaa0f7aa51cc1ee159356f801512d138000
[ "Apache-2.0" ]
null
null
null
from codewatch.file_walker import FileWalker MOCK_PATHS = [ ('.', ['dir1', 'dir2'], ['file1', 'file2', 'file3']), ('./dir1', [], ['dir1_file1', 'dir1_file2']), ('./dir2', ['dir2_subdir'], ['dir2_file1']), ('./dir2/dir2_subdir', [], ['subdir_file1']), ] MOCK_START_PATH = '/home/mock' def _expected_files_from_dir(dir_index): path = MOCK_PATHS[dir_index][0] files = MOCK_PATHS[dir_index][2] return [path + '/' + file for file in files] def create_mock_os_walk(mock_path): def _os_walk(path): assert path == mock_path return MOCK_PATHS return _os_walk def _walk(directory_filter, file_filter): class MockLoader(object): def __init__(self, filters): self.filters = filters loader = MockLoader(filters=[directory_filter, file_filter]) walk_fn = create_mock_os_walk(MOCK_START_PATH) walker = FileWalker(loader, MOCK_START_PATH, walk_fn=walk_fn) return [f for f in walker.walk()] def test_it_can_walk_all_files(): def directory_filter(_path): return True def file_filter(_path): return True expected_files_walked = ( _expected_files_from_dir(0) + _expected_files_from_dir(1) + _expected_files_from_dir(2) + _expected_files_from_dir(3) ) assert _walk(directory_filter, file_filter) == expected_files_walked def test_it_filters_on_directories(): def directory_filter(path): return 'dir2' not in path def file_filter(_path): return True expected_files_walked = ( _expected_files_from_dir(0) + _expected_files_from_dir(1) ) assert _walk(directory_filter, file_filter) == expected_files_walked def test_it_filters_on_files(): def directory_filter(_path): return True def file_filter(path): return 'subdir' not in path expected_files_walked = ( _expected_files_from_dir(0) + _expected_files_from_dir(1) + _expected_files_from_dir(2) ) assert _walk(directory_filter, file_filter) == expected_files_walked
26.0625
72
0.672422
271
2,085
4.701107
0.195572
0.163265
0.133438
0.156986
0.526688
0.450549
0.450549
0.450549
0.450549
0.408163
0
0.017813
0.219185
2,085
79
73
26.392405
0.764742
0
0
0.327586
0
0
0.061391
0
0
0
0
0
0.068966
1
0.241379
false
0
0.017241
0.103448
0.448276
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
0
0
0
2
3c677a9df343c0d5a10437578fcffa7f4fb98250
208
py
Python
CS Practical/A16.py
adityaruplaha/adityaruplaha-school-projects
b19d06f356fafdbe4189bade59d4a4d1ffec567f
[ "MIT" ]
null
null
null
CS Practical/A16.py
adityaruplaha/adityaruplaha-school-projects
b19d06f356fafdbe4189bade59d4a4d1ffec567f
[ "MIT" ]
null
null
null
CS Practical/A16.py
adityaruplaha/adityaruplaha-school-projects
b19d06f356fafdbe4189bade59d4a4d1ffec567f
[ "MIT" ]
null
null
null
# Swap assign variables print("Enter 3 no.s:") a = float(input("a: ")) b = float(input("b: ")) c = float(input("c: ")) a, b = a+b, b+c print("Variables are: ") print("a:", a) print("b:", b) print("c:", c)
14.857143
24
0.543269
38
208
2.973684
0.368421
0.265487
0
0
0
0
0
0
0
0
0
0.005814
0.173077
208
13
25
16
0.651163
0.100962
0
0
0
0
0.232432
0
0
0
0
0
0
1
0
false
0
0
0
0
0.555556
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
3c7a408d59d93ef0b1725084817a4cd7ce5274e2
82
py
Python
tests/python/setitem.py
jacereda/py2nim
56fc2699d31241c60bed726f59efea4bf46be238
[ "MIT" ]
10
2020-03-10T12:01:01.000Z
2021-05-23T19:47:06.000Z
tests/python/setitem.py
jacereda/py2nim
56fc2699d31241c60bed726f59efea4bf46be238
[ "MIT" ]
null
null
null
tests/python/setitem.py
jacereda/py2nim
56fc2699d31241c60bed726f59efea4bf46be238
[ "MIT" ]
1
2020-07-17T11:20:56.000Z
2020-07-17T11:20:56.000Z
class A: def __setitem__(self, e, f): print(e + f) a = A() a[2] = 8
10.25
32
0.463415
15
82
2.266667
0.666667
0.117647
0
0
0
0
0
0
0
0
0
0.037736
0.353659
82
7
33
11.714286
0.603774
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3c8070d20cf1a6dacdae8491d5c310a382aa84fd
389
py
Python
setup.py
hoffa/ccz
17488aab3f5fb24a98e422b8510508a1bdf7bba3
[ "Unlicense" ]
null
null
null
setup.py
hoffa/ccz
17488aab3f5fb24a98e422b8510508a1bdf7bba3
[ "Unlicense" ]
3
2021-05-30T09:33:51.000Z
2021-05-30T22:13:37.000Z
setup.py
hoffa/cx
17488aab3f5fb24a98e422b8510508a1bdf7bba3
[ "Unlicense" ]
null
null
null
from setuptools import setup, find_packages with open("README.md") as f: long_description = f.read() setup( name="ccz", version="0.3.2", install_requires=["ccxt"], packages=find_packages(), long_description=long_description, long_description_content_type="text/markdown", entry_points={"console_scripts": ["ccz=ccz:main"]}, python_requires=">=3.6", )
24.3125
55
0.688946
50
389
5.12
0.7
0.234375
0.148438
0.234375
0
0
0
0
0
0
0
0.015244
0.156812
389
15
56
25.933333
0.765244
0
0
0
0
0
0.169666
0
0
0
0
0
0
1
0
false
0
0.076923
0
0.076923
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3c96876235514f4a42563f2a2ed427426ff74d32
462
py
Python
tests/test_version.py
aziascreations/mooss-serialize
e8eda61721a014c3fe5c5ddc4e11cc6925358099
[ "Unlicense" ]
null
null
null
tests/test_version.py
aziascreations/mooss-serialize
e8eda61721a014c3fe5c5ddc4e11cc6925358099
[ "Unlicense" ]
null
null
null
tests/test_version.py
aziascreations/mooss-serialize
e8eda61721a014c3fe5c5ddc4e11cc6925358099
[ "Unlicense" ]
null
null
null
# Imports import semver import unittest import mooss.serialize.__version__ as __version__ # Tests class TestVersion(unittest.TestCase): def test_version(self): """ Testing if the version follows the 'Semantic Versioning' format. """ # Assertion is done through the absence of any 'ValueError' exception. semver.VersionInfo.parse(__version__.VERSION) # Main if __name__ == '__main__': unittest.main()
21
78
0.683983
50
462
5.9
0.7
0
0
0
0
0
0
0
0
0
0
0
0.233766
462
21
79
22
0.833333
0.331169
0
0
0
0
0.028369
0
0
0
0
0
0
1
0.125
false
0
0.375
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3c968d11f02a0c76c01083accb901817c8ee198c
1,845
py
Python
python-buildkite-api/buildkite.py
tahoemph/python-buildkite-api
aa20a716a737a8589ba910fd80a8b5935a85aa4a
[ "MIT" ]
null
null
null
python-buildkite-api/buildkite.py
tahoemph/python-buildkite-api
aa20a716a737a8589ba910fd80a8b5935a85aa4a
[ "MIT" ]
null
null
null
python-buildkite-api/buildkite.py
tahoemph/python-buildkite-api
aa20a716a737a8589ba910fd80a8b5935a85aa4a
[ "MIT" ]
3
2016-05-27T03:37:28.000Z
2019-08-23T20:47:28.000Z
from buildkite_auth import BuildkiteAuth from buildkite_base import BuildkiteBase from buildkite_builds import BuildkiteBuilds from buildkite_organizations import BuildkiteOrganizations from buildkite_pipelines import BuildkitePipelines class Buildkite(BuildkiteBase): def __init__(self): self.api_objects = { 'auth': BuildkiteAuth(), 'organizations': BuildkiteOrganizations(), 'pipelines': BuildkitePipelines(), 'builds': BuildkiteBuilds() } for k in self.api_objects: self.api_objects[k].set_parent(self) def build_request(self, url_pieces): url = self.url_parts() parameters = [] for index, piece in enumerate(url_pieces): protocol_object = self.api_objects.get(piece) # If the last component isn't an object then treat it like # a slug. if not protocol_object and index == len(url_pieces) - 1: url_parts = [piece] parameter_parts = [] else: url_parts = protocol_object.url_parts() parameter_parts = protocol_object.url_parameters() for part in url_parts: url = '/'.join((url, part)) parameters.extend(parameter_parts) if parameters: url = url + '?' + ''.join(parameters) return url def url_parts(self): return "https://api.buildkite.com/v2" def url_parameters(self): return [] # TODO: generate these from the api_objects map. def auth(self): return self.api_objects['auth'] def organization(self): return self.api_objects['organizations'] def pipelines(self): return self.api_objects['pipelines'] def builds(self): return self.api_objects['builds']
32.946429
70
0.619512
198
1,845
5.580808
0.338384
0.081448
0.101357
0.061538
0.086878
0
0
0
0
0
0
0.001531
0.292141
1,845
55
71
33.545455
0.844564
0.060163
0
0
0
0
0.054335
0
0
0
0
0.018182
0
1
0.181818
false
0
0.113636
0.136364
0.477273
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
1
0
0
0
2
b1b59d8a7d29ef53dd847c35698cabe0f808da1a
1,057
py
Python
napari_etdb/etdb.py
alisterburt/napari-etdb
731180630bf0b115340850cc421dacf2e5d63fc6
[ "BSD-3-Clause" ]
1
2021-09-07T05:13:33.000Z
2021-09-07T05:13:33.000Z
napari_etdb/etdb.py
alisterburt/napari-etdb
731180630bf0b115340850cc421dacf2e5d63fc6
[ "BSD-3-Clause" ]
1
2021-09-07T05:33:24.000Z
2021-09-07T18:20:39.000Z
napari_etdb/etdb.py
alisterburt/napari-etdb
731180630bf0b115340850cc421dacf2e5d63fc6
[ "BSD-3-Clause" ]
null
null
null
""" Placeholder file for an actual interface to the ETDB """ from pydantic import BaseModel from napari.utils.events import SelectableEventedList from datetime import date, datetime from typing import Optional from .etdb_entries.placeholders import starfish, spheres class Entry(BaseModel): date: Optional[date] = None microscopist: Optional[str] = None species: Optional[str] = None strain: Optional[str] = None acquisition_settings: Optional[str] = None microscope: Optional[str] = None acquisition_software: Optional[str] = None processing_software: Optional[str] = None notes: Optional[str] = None open_index_protocol_id: Optional[str] = None preview_image_url: Optional[str] = None tomogram_url: Optional[str] = None def __hash__(self): """Implemented as object in SelectableEventedList must be hashable """ return id(self) starfish = Entry.parse_obj(starfish) spheres = Entry.parse_obj(spheres) def get_entries(): return SelectableEventedList([starfish, spheres])
28.567568
74
0.731315
126
1,057
6
0.47619
0.160053
0.218254
0.068783
0
0
0
0
0
0
0
0
0.183538
1,057
37
75
28.567568
0.876014
0.118259
0
0
0
0
0
0
0
0
0
0
0
1
0.083333
false
0
0.208333
0.041667
0.916667
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
0
0
0
0
1
0
0
2
b1b62056f3f057fc80177f705ac081cf53aa44d7
563
py
Python
sensorApi/api/migrations/0004_auto_20200504_2224.py
Pawel095/SensorArray
1726b1d35c86fa6b2f44c45263e2785b166a5e75
[ "MIT" ]
null
null
null
sensorApi/api/migrations/0004_auto_20200504_2224.py
Pawel095/SensorArray
1726b1d35c86fa6b2f44c45263e2785b166a5e75
[ "MIT" ]
null
null
null
sensorApi/api/migrations/0004_auto_20200504_2224.py
Pawel095/SensorArray
1726b1d35c86fa6b2f44c45263e2785b166a5e75
[ "MIT" ]
null
null
null
# Generated by Django 3.0.5 on 2020-05-04 20:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("api", "0003_auto_20200504_2154"), ] operations = [ migrations.AddField( model_name="loggeddata", name="humidity", field=models.FloatField(default=0), ), migrations.AddField( model_name="loggeddata", name="temperature", field=models.FloatField(default=0), ), ]
23.458333
48
0.550622
53
563
5.754717
0.660377
0.118033
0.15082
0.177049
0.459016
0.268852
0
0
0
0
0
0.08871
0.339254
563
23
49
24.478261
0.731183
0.079929
0
0.470588
1
0
0.131846
0.046653
0
0
0
0
0
1
0
false
0
0.058824
0
0.235294
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
b1b9fcd0360c0892e2cc3c7642fda8653e07f7cf
293
py
Python
codql/codeql/config.py
Heersin/codeql_packer
5d1258ce2419a67161ac3b844219ebdbe5310e59
[ "MIT" ]
null
null
null
codql/codeql/config.py
Heersin/codeql_packer
5d1258ce2419a67161ac3b844219ebdbe5310e59
[ "MIT" ]
null
null
null
codql/codeql/config.py
Heersin/codeql_packer
5d1258ce2419a67161ac3b844219ebdbe5310e59
[ "MIT" ]
null
null
null
cpp_config = [ 'query-lib/official/cpp/codeql-suites/cpp-security-and-quality.qls', 'query-lib/official/cpp/codeql-suites/cpp-security-extended.qls', ] js_config = [] # exported lang_configs = { 'cpp' : cpp_config, 'javascript' : js_config } need_compile = ['cpp', 'java']
18.3125
72
0.675768
38
293
5.052632
0.526316
0.09375
0.166667
0.197917
0.4375
0.4375
0.4375
0.4375
0
0
0
0
0.153584
293
16
73
18.3125
0.774194
0.027304
0
0
0
0.1
0.517606
0.447183
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
b1c082dddb99169a9d7ba76d70b86474d7d218f0
4,526
py
Python
src/quoridor/QuoridorGame.py
oramleo/alphaquoridor
b9d99cfff8205d64ef0365bb864278aa238cf4be
[ "MIT" ]
1
2021-12-11T04:14:30.000Z
2021-12-11T04:14:30.000Z
src/quoridor/QuoridorGame.py
oramleo/alphaquoridor
b9d99cfff8205d64ef0365bb864278aa238cf4be
[ "MIT" ]
null
null
null
src/quoridor/QuoridorGame.py
oramleo/alphaquoridor
b9d99cfff8205d64ef0365bb864278aa238cf4be
[ "MIT" ]
null
null
null
import sys import os import numpy as np sys.path.append(os.path.join(os.path.dirname(__file__), 'pathfind/build')) from alphazero_general.Game import Game from .QuoridorLogic import QuoridorBoard class QuoridorGame(Game): def __init__(self, n): super().__init__() self.n = n self.action_size = 12 + 2 * (self.n - 1) ** 2 self.board_len = 2 * self.n - 1 def __str__(self): return 'quoridor_n' + str(self.n) + '_v3' def getInitBoard(self): """ Returns: startBoard: a representation of the board (ideally this is the form that will be the input to your neural network) """ return QuoridorBoard(self.n) def getActionSize(self): """ Returns: actionSize: number of all possible actions """ # 4 pawn moves, 8 jumps, 64 vertical walls, 64 horizontal walls return self.action_size def getBoardSize(self): return (self.n, self.n, 2), (self.n - 1, self.n - 1, 2), 17 def getNextState(self, board, player, action): """ Input: board: current board player: current player (1 or -1) action: action taken by current player Returns: nextBoard: board after applying action nextPlayer: player who plays in the next turn (should be -player) """ next_board = QuoridorBoard(self.n, board=board) next_board.executeAction(player, action) return next_board, -player def getValidActions(self, board, player): """ Input: board: current board player: current player Returns: validMoves: a binary vector of length self.getActionSize(), 1 for moves that are valid from the current board and player, 0 for invalid moves """ return board.getValidActions(player) def getGameEnded(self, board, player): """ Input: board: current board player: current player (1 or -1) Returns: r: 0 if game has not ended. 1 if player won, -1 if player lost, small non-zero value for draw. """ return board.getGameEnded(player) def getCanonicalForm(self, board, player): """ Input: board: current board player: current player (1 or -1) Returns: canonicalBoard: returns canonical form of board. The canonical form should be independent of player. For e.g. in chess, the canonical form can be chosen to be from the pov of white. When the player is white, we can return board as is. When the player is black, we can invert the colors and return the board. """ next_board = QuoridorBoard(self.n, board=board) return next_board.makeCanonical(player) def getSymmetries(self, board, pi): """ Input: board: current board pi: policy vector of size self.getActionSize() Returns: symmForms: a list of [(board,pi)] where each tuple is a symmetrical form of the board and the corresponding pi vector. This is used when training the neural network from examples. """ pawn_moves = 12 vwa_size = pawn_moves + (self.n - 1) ** 2 vw_actions = list(np.flipud(np.array(pi[pawn_moves:vwa_size]).reshape(self.n - 1, self.n - 1)).flatten()) hw_actions = list(np.flipud(np.array(pi[vwa_size:]).reshape(self.n - 1, self.n - 1)).flatten()) pi2 = pi[:12] + vw_actions + hw_actions pi2[2], pi2[3] = pi2[3], pi2[2] pi2[6], pi2[7] = pi2[7], pi2[6] pi2[8], pi2[10] = pi2[10], pi2[8] pi2[9], pi2[11] = pi2[9], pi2[11] return [(board.getBoard(), pi), (board.getBoardFlippedHorizontally(), pi2)] def stringRepresentation(self, board): """ Input: board: current board Returns: boardString: a quick conversion of board to a string format. Required by MCTS for hashing. """ return board.getBoardHashable() def display(self, board, name=None, save_folder=None, save=True): board.plot(name=name, save_folder=save_folder, save=save)
33.525926
113
0.563853
551
4,526
4.558984
0.321234
0.033838
0.021497
0.052548
0.176354
0.176354
0.171576
0.119825
0.119825
0.119825
0
0.026581
0.34335
4,526
134
114
33.776119
0.818641
0.415599
0
0.043478
0
0
0.012576
0
0
0
0
0
0
1
0.26087
false
0
0.108696
0.043478
0.608696
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
0
1
0
0
2
b1c560d3dcb0fd5f35d6800083b8fa0821849fd9
2,821
py
Python
game/consumers.py
Greenns/channels-obstruction
d91db6920815b02ac06320cc15e901725ea0f67f
[ "MIT" ]
103
2017-02-16T10:18:15.000Z
2022-01-10T23:38:16.000Z
game/consumers.py
fihuer/channels-obstruction
3fa502c9a887cade1a51986c4afd5baf05de51c2
[ "MIT" ]
11
2020-02-12T03:15:17.000Z
2022-02-26T18:56:46.000Z
game/consumers.py
fihuer/channels-obstruction
3fa502c9a887cade1a51986c4afd5baf05de51c2
[ "MIT" ]
49
2017-05-19T06:18:51.000Z
2022-02-15T16:53:19.000Z
import re import logging from channels import Group from channels.sessions import channel_session from .models import Game, GameSquare from channels.auth import http_session_user, channel_session_user, channel_session_user_from_http log = logging.getLogger(__name__) from django.utils.decorators import method_decorator from channels.generic.websockets import JsonWebsocketConsumer class LobbyConsumer(JsonWebsocketConsumer): # Set to True to automatically port users from HTTP cookies # (you don't need channel_session_user, this implies it) http_user = True def connection_groups(self, **kwargs): """ Called to return the list of groups to automatically add/remove this connection to/from. """ print("adding to connection group lobby") return ["lobby"] def connect(self, message, **kwargs): """ Perform things on connection start """ pass def receive(self, content, **kwargs): """ Called when a message is received with either text or bytes filled out. """ channel_session_user = True action = content['action'] if action == 'create_game': # create a new game using the part of the channel name Game.create_new(self.message.user) def disconnect(self, message, **kwargs): """ Perform things on connection close """ pass class GameConsumer(JsonWebsocketConsumer): # Set to True to automatically port users from HTTP cookies # (you don't need channel_session_user, this implies it) http_user = True def connection_groups(self, **kwargs): """ Called to return the list of groups to automatically add/remove this connection to/from. """ return ["game-{0}".format(kwargs['game_id'])] def connect(self, message, **kwargs): """ Perform things on connection start """ pass def receive(self, content, **kwargs): """ Called when a message is received with either text or bytes filled out. """ channel_session_user = True action = content['action'] print("MESSAGE ON OBSTRUCTION - {0}".format(action)) if action == 'claim_square': # get the square object square = GameSquare.get_by_id(content['square_id']) square.claim('Selected', self.message.user) if action == 'chat_text_entered': # chat text game = Game.get_by_id(content['game_id']) game.add_log(content['text'], self.message.user) game.send_game_update() def disconnect(self, message, **kwargs): """ Perform things on connection close """ pass
28.21
97
0.627083
329
2,821
5.25228
0.303951
0.056713
0.0625
0.055556
0.578125
0.550926
0.550926
0.550926
0.550926
0.550926
0
0.000992
0.285005
2,821
99
98
28.494949
0.855726
0.274016
0
0.428571
0
0
0.087864
0
0
0
0
0
0
1
0.190476
false
0.095238
0.190476
0
0.52381
0.047619
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
0
0
1
0
0
2
b1c76af39c924ec2be78cdbd17ab142924fda18a
700
py
Python
py-contract/producer-contract.py
victoriest/photio
f7873fe96e1f9794a34ca179554234eb91054717
[ "Apache-2.0" ]
null
null
null
py-contract/producer-contract.py
victoriest/photio
f7873fe96e1f9794a34ca179554234eb91054717
[ "Apache-2.0" ]
null
null
null
py-contract/producer-contract.py
victoriest/photio
f7873fe96e1f9794a34ca179554234eb91054717
[ "Apache-2.0" ]
null
null
null
from flask import Flask, Response, make_response import json import config app = Flask(__name__) @app.route("/health") def health(): result = {'status': 'UP'} return Response(json.dumps(result), mimetype='application/json') @app.route("/v1/api/invitation/invite") def invite(token, scheduleId, targetUserId): pass @app.route("/v1/api/invitation/accept") def accept(token, invitationId): pass @app.route("/v1/api/invitation/reject") def reject(token, invitationId): pass @app.route("/v1/api/invitation/evaluate") def evaluate(token, targetUserId, socre, message): pass if __name__ == "__main__": app.run(host=config.HOST, port=config.PORT, debug=config.DEBUG)
19.444444
68
0.711429
91
700
5.32967
0.428571
0.082474
0.082474
0.107216
0.284536
0.237113
0.181443
0.181443
0
0
0
0.006601
0.134286
700
35
69
20
0.793729
0
0
0.181818
0
0
0.201429
0.145714
0
0
0
0
0
1
0.227273
false
0.181818
0.136364
0
0.409091
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
0
0
0
2
b1cd5e5a11bad9534977afd70d011f48bd5af433
519
py
Python
Roomba Code/main.py
dotcomstar/Incredibots2019
506f470f320668b712a180845b6ab98726424fb9
[ "MIT" ]
null
null
null
Roomba Code/main.py
dotcomstar/Incredibots2019
506f470f320668b712a180845b6ab98726424fb9
[ "MIT" ]
null
null
null
Roomba Code/main.py
dotcomstar/Incredibots2019
506f470f320668b712a180845b6ab98726424fb9
[ "MIT" ]
null
null
null
#!/usr/bin/python import os import sys from wallaby import * import constants as c import actions as a import movement as m import gyro as g import sensors as s import utils as u def main(): print "Starting main()\n" u.setup() u.calibrate() # You only need to include this command if you want the tophats to sense better at the cost of speed. a.get_gas_valve() print "Finished main\n" u.shutdown(86) if __name__== "__main__": sys.stdout = os.fdopen(sys.stdout.fileno(),"w",0) main();
22.565217
120
0.691715
88
519
3.965909
0.647727
0.028653
0.034384
0
0
0
0
0
0
0
0
0.007299
0.208092
519
22
121
23.590909
0.841849
0.223507
0
0
0
0
0.102244
0
0
0
0
0
0
0
null
null
0
0.473684
null
null
0.105263
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
0
1
0
0
0
0
2
b1dfea9d6d33f6396ab7c7791e2bcf1a30ea7661
951
py
Python
lib/coginvasion/gags/Inventory.py
theclashingfritz/Cog-Invasion-Online-Dump
2561abbacb3e2e288e06f3f04b935b5ed589c8f8
[ "Apache-2.0" ]
1
2020-03-12T16:44:10.000Z
2020-03-12T16:44:10.000Z
lib/coginvasion/gags/Inventory.py
theclashingfritz/Cog-Invasion-Online-Dump
2561abbacb3e2e288e06f3f04b935b5ed589c8f8
[ "Apache-2.0" ]
null
null
null
lib/coginvasion/gags/Inventory.py
theclashingfritz/Cog-Invasion-Online-Dump
2561abbacb3e2e288e06f3f04b935b5ed589c8f8
[ "Apache-2.0" ]
null
null
null
# uncompyle6 version 3.2.4 # Python bytecode 2.7 (62211) # Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] # Embedded file name: lib.coginvasion.gags.Inventory from direct.directNotify.DirectNotifyGlobal import directNotify from direct.showbase.DirectObject import DirectObject class Inventory(DirectObject): notify = directNotify.newCategory('Inventory') def __init__(self): DirectObject.__init__(self) self.gags = None return def setGags(self, gagArray, ammo): self.gags = {} for gag in gagArray: self.gags[gag] = ammo self.gags = gagArray self.gagAmmo = ammo def getGags(self): return self.gags def getGagAmmo(self): return self.gagAmmo def getAmmoOfGag(self, index): return self.getGagAmmo()[index] def cleanup(self): del self.gags del self.gagAmmo
27.171429
104
0.661409
118
951
5.262712
0.5
0.077295
0.038647
0
0
0
0
0
0
0
0
0.061111
0.242902
951
35
105
27.171429
0.801389
0.216614
0
0
0
0
0.012146
0
0
0
0
0
0
1
0.26087
false
0
0.086957
0.130435
0.608696
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
0
0
0
2
b1e5bd03375177a23f54dcd70374f81f872f644f
53
py
Python
spotdl/__init__.py
brayo-pip/Spotdl
261faae2b23d00e3b0705be9120ebac91a70d2db
[ "MIT" ]
null
null
null
spotdl/__init__.py
brayo-pip/Spotdl
261faae2b23d00e3b0705be9120ebac91a70d2db
[ "MIT" ]
null
null
null
spotdl/__init__.py
brayo-pip/Spotdl
261faae2b23d00e3b0705be9120ebac91a70d2db
[ "MIT" ]
null
null
null
__all__ = ["search", "download","lyrics", "patches"]
26.5
52
0.641509
5
53
6
1
0
0
0
0
0
0
0
0
0
0
0
0.09434
53
1
53
53
0.625
0
0
0
0
0
0.509434
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
b1e84d7aabd4cbde434caa12989290c341d58a83
126
py
Python
album_service.py
stesfu/musick
0379dc221d91bda9d453410ba20524700a0239be
[ "MIT" ]
null
null
null
album_service.py
stesfu/musick
0379dc221d91bda9d453410ba20524700a0239be
[ "MIT" ]
null
null
null
album_service.py
stesfu/musick
0379dc221d91bda9d453410ba20524700a0239be
[ "MIT" ]
null
null
null
album_info = { 'Arrival - ABBA': { 'image': 'arrival.jpg', 'spotify_link_a': '1M4anG49aEs4YimBdj96Oy', }, }
18
49
0.571429
11
126
6.272727
0.909091
0
0
0
0
0
0
0
0
0
0
0.073684
0.246032
126
6
50
21
0.652632
0
0
0
0
0
0.52381
0.174603
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
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
b1f553e31a1cf320b0ae926d018507be5ee2be00
622
py
Python
src/pyrobot/azure_kinect/camera.py
gujralsanyam22/pyrobot
a0448714857b684d8b280f710e9304988524d2e0
[ "MIT" ]
2,150
2019-06-12T20:55:41.000Z
2022-03-21T07:14:51.000Z
src/pyrobot/azure_kinect/camera.py
gujralsanyam22/pyrobot
a0448714857b684d8b280f710e9304988524d2e0
[ "MIT" ]
124
2019-06-22T17:12:27.000Z
2022-02-26T11:43:13.000Z
src/pyrobot/azure_kinect/camera.py
gujralsanyam22/pyrobot
a0448714857b684d8b280f710e9304988524d2e0
[ "MIT" ]
329
2019-06-13T03:03:54.000Z
2022-03-30T07:04:55.000Z
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from pyrobot.kinect2.camera import Kinect2Camera class AzureKinectCamera(Kinect2Camera): """ This is camera class that interfaces with the KinectV2 camera """ def __init__(self, configs): """ Constructor of the KinectV2Camera class. :param configs: Camera specific configuration object :type configs: YACS CfgNode """ super(AzureKinectCamera, self).__init__(configs=configs)
25.916667
65
0.700965
73
622
5.863014
0.671233
0.046729
0
0
0
0
0
0
0
0
0
0.01046
0.231511
622
23
66
27.043478
0.884937
0.57074
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
2
b1f6fed75bf0324561a438c671e1d089b3001bf6
210
py
Python
cride/users/app.py
chulth/CRide
3dd0aaf12d50ac7786d87413962b9a21e45c0cc7
[ "MIT" ]
null
null
null
cride/users/app.py
chulth/CRide
3dd0aaf12d50ac7786d87413962b9a21e45c0cc7
[ "MIT" ]
null
null
null
cride/users/app.py
chulth/CRide
3dd0aaf12d50ac7786d87413962b9a21e45c0cc7
[ "MIT" ]
null
null
null
'''users app.''' # Django #from django.app import AppConfig from django.apps import AppConfig class UsersAppConfig(AppConfig): '''users app config.''' name = 'cride.users' verbose_name = 'Users'
17.5
33
0.685714
25
210
5.72
0.52
0.111888
0
0
0
0
0
0
0
0
0
0
0.180952
210
11
34
19.090909
0.831395
0.32381
0
0
0
0
0.123077
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
2
5900d1d102fca4f9321bafdf2652c76ad5621680
1,262
py
Python
models/windows_device_ad_account.py
MIchaelMainer/msgraph-v10-models-python
adad66363ebe151be2332f3ef74a664584385748
[ "MIT" ]
1
2021-03-07T07:02:22.000Z
2021-03-07T07:02:22.000Z
models/windows_device_ad_account.py
MIchaelMainer/msgraph-v10-models-python
adad66363ebe151be2332f3ef74a664584385748
[ "MIT" ]
null
null
null
models/windows_device_ad_account.py
MIchaelMainer/msgraph-v10-models-python
adad66363ebe151be2332f3ef74a664584385748
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- ''' # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # # This file was generated and any changes will be overwritten. ''' from __future__ import unicode_literals from ..one_drive_object_base import OneDriveObjectBase class WindowsDeviceADAccount(OneDriveObjectBase): def __init__(self, prop_dict={}): self._prop_dict = prop_dict @property def domain_name(self): """Gets and sets the domainName Returns: str: The domainName """ if "domainName" in self._prop_dict: return self._prop_dict["domainName"] else: return None @domain_name.setter def domain_name(self, val): self._prop_dict["domainName"] = val @property def user_name(self): """Gets and sets the userName Returns: str: The userName """ if "userName" in self._prop_dict: return self._prop_dict["userName"] else: return None @user_name.setter def user_name(self, val): self._prop_dict["userName"] = val
24.745098
151
0.603011
141
1,262
5.156028
0.453901
0.099037
0.13205
0.046768
0.211829
0.211829
0.088033
0.088033
0
0
0
0.001152
0.312203
1,262
50
152
25.24
0.836406
0.301902
0
0.26087
0
0
0.06932
0
0
0
0
0
0
1
0.217391
false
0
0.086957
0
0.521739
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
0
1
0
0
2
591561bcd00ba95a3076d2995292ef8796f702d5
358
py
Python
src/02/count.py
Octau/distributed-system
cec5fc1451f0297cdad95dab7c9ff19b0656be62
[ "CC0-1.0" ]
null
null
null
src/02/count.py
Octau/distributed-system
cec5fc1451f0297cdad95dab7c9ff19b0656be62
[ "CC0-1.0" ]
null
null
null
src/02/count.py
Octau/distributed-system
cec5fc1451f0297cdad95dab7c9ff19b0656be62
[ "CC0-1.0" ]
null
null
null
import sys n_huruf=0; n_angka=0; lines_number = 0 for line in sys.stdin: for chara in line: if(chara.isdigit()): n_angka+=1 elif(chara.isalpha()): n_huruf+=1 lines_number = lines_number + 1 sys.stdout.write('Jumlah huruf :'+str(n_huruf)) sys.stdout.write('\n') sys.stdout.write('Jumlah angka :'+str(n_angka))
22.375
47
0.628492
57
358
3.789474
0.385965
0.083333
0.194444
0.185185
0
0
0
0
0
0
0
0.021583
0.223464
358
15
48
23.866667
0.755396
0
0
0
0
0
0.083799
0
0
0
0
0
0
1
0
false
0
0.071429
0
0.071429
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
0
0
0
2
591fc557a74e28b578bc53d5fbc4c14dcf236ed7
180
py
Python
utils/ids/difficulty_id.py
rkwong43/Toh
702f689aa2c37a9f6f463e24405b6c418fd0607f
[ "CC-BY-4.0" ]
3
2020-01-28T16:02:26.000Z
2020-01-29T21:47:14.000Z
utils/ids/difficulty_id.py
rkwong43/Tears-Under-Heaven
702f689aa2c37a9f6f463e24405b6c418fd0607f
[ "CC-BY-4.0" ]
null
null
null
utils/ids/difficulty_id.py
rkwong43/Tears-Under-Heaven
702f689aa2c37a9f6f463e24405b6c418fd0607f
[ "CC-BY-4.0" ]
null
null
null
from enum import Enum, auto """Represents the IDs of difficulty levels. """ class DifficultyID(Enum): # Difficulties EASY = auto() NORMAL = auto() HARD = auto()
15
43
0.638889
21
180
5.47619
0.761905
0
0
0
0
0
0
0
0
0
0
0
0.244444
180
11
44
16.363636
0.845588
0.066667
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.2
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
5921edb8819a04fbbfb0f75b48d321362354828f
1,188
py
Python
LeetCode/Python/first_missing_positive.py
wh-acmer/minixalpha-acm
cb684ad70eaa61d42a445364cb3ee195b9e9302e
[ "MIT" ]
null
null
null
LeetCode/Python/first_missing_positive.py
wh-acmer/minixalpha-acm
cb684ad70eaa61d42a445364cb3ee195b9e9302e
[ "MIT" ]
null
null
null
LeetCode/Python/first_missing_positive.py
wh-acmer/minixalpha-acm
cb684ad70eaa61d42a445364cb3ee195b9e9302e
[ "MIT" ]
null
null
null
#!/usr/bin/env python #coding: utf-8 class Solution: # @param A, a list of integers # @return an integer def firstMissingPositive(self, A): if not A: return 1 la = len(A) i = 0 while i < la: if i + 1 == A[i]: i += 1 continue if A[i] <= 0: i += 1 continue j = A[i] while j > 0 and j <= la and j != A[j-1] and j != i: t = A[j-1] A[j-1] = j j = t if j > 0 and j <= la and j != A[j-1]: A[j-1] = j i += 1 i = 1 while i <= la: if A[i-1] != i: return i i += 1 return A[la-1] + 1 if __name__ == '__main__': s = Solution() assert 3 == s.firstMissingPositive([1,2,0]) assert 2 == s.firstMissingPositive([3,4,-1,1]) assert 2 == s.firstMissingPositive([1,1]) assert 3 == s.firstMissingPositive([1,1,2,2]) assert 2 == s.firstMissingPositive([1,1,3,3]) assert 1 == s.firstMissingPositive([]) assert 1 == s.firstMissingPositive([2]) assert 3 == s.firstMissingPositive([2,1])
26.4
63
0.446128
170
1,188
3.070588
0.229412
0.321839
0.028736
0.16092
0.304598
0.193487
0.078544
0.057471
0.057471
0.057471
0
0.068376
0.409091
1,188
44
64
27
0.675214
0.068182
0
0.176471
0
0
0.007253
0
0
0
0
0
0.235294
1
0.029412
false
0
0
0
0.088235
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5941351462b05953e2bb10d7a3b6451404874428
1,430
py
Python
class2/exercise2.py
SamerLabban/Network_Automation_Course
ca68e83a7699fded251aa6ec2f021e8a7e53ffed
[ "Apache-2.0" ]
1
2017-04-30T17:43:51.000Z
2017-04-30T17:43:51.000Z
class2/exercise2.py
SamerLabban/Network_Automation_Course
ca68e83a7699fded251aa6ec2f021e8a7e53ffed
[ "Apache-2.0" ]
null
null
null
class2/exercise2.py
SamerLabban/Network_Automation_Course
ca68e83a7699fded251aa6ec2f021e8a7e53ffed
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python import telnetlib #Need the following to be able to use time.sleep import time #I need the following to be able to use try and except import socket import sys TELNET_PORT = 23 TELNET_TIMEOUT = 6 #Create Telnet Connection def telnet_connect(ip_addr): try: return telnetlib.Telnet(ip_addr, TELNET_PORT, TELNET_TIMEOUT) except socket.timeout: sys.exit("Connection time-out") #Login to the router rtr1 def login(remote_conn, username, password): output = remote_conn.read_until("sername", TELNET_TIMEOUT) remote_conn.write(username + '\n') output += remote_conn.read_until("ssword:", TELNET_TIMEOUT) remote_conn.write(password + '\n') return output #Send command and return output def send_command(remote_conn, cmd): #strip any trailing newlines cmd = cmd.rstrip() remote_conn.write(cmd + '\n') time.sleep(1) return remote_conn.read_very_eager() def main(): #pynet-rtr1 (Cisco 881) ip_addr = '184.105.247.70' username = 'pyclass' password = '88newclass' #Create telnet connection to the router remote_conn = telnet_connect(ip_addr) #Login output = login(remote_conn, username, password) time.sleep(1) output = remote_conn.read_very_eager() #Disable paging remote_conn.write("terminal length 0" + '\n') #Send command and return output output = send_command(remote_conn, 'show ip int brief') print output remote_conn.close() if __name__ == "__main__": main()
23.064516
63
0.746154
213
1,430
4.812207
0.384977
0.136585
0.062439
0.058537
0.316098
0.056585
0.056585
0.056585
0
0
0
0.019721
0.148951
1,430
61
64
23.442623
0.822514
0.233566
0
0.055556
0
0
0.105166
0
0
0
0
0
0
0
null
null
0.111111
0.111111
null
null
0.027778
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
0
0
0
0
0
2
594ef4c2e9b789a9cbcdb0044560f2ad24c9c6cc
107
py
Python
past/001/a/answer.py
TakuyaNoguchi/atcoder
d079402e6fe9c9aaf3a6fc9272331ee71fc497da
[ "MIT" ]
null
null
null
past/001/a/answer.py
TakuyaNoguchi/atcoder
d079402e6fe9c9aaf3a6fc9272331ee71fc497da
[ "MIT" ]
null
null
null
past/001/a/answer.py
TakuyaNoguchi/atcoder
d079402e6fe9c9aaf3a6fc9272331ee71fc497da
[ "MIT" ]
null
null
null
import re S = input().rstrip() if re.match('^[0-9]+$', S): print(int(S) * 2) else: print('error')
13.375
27
0.523364
18
107
3.111111
0.777778
0
0
0
0
0
0
0
0
0
0
0.035294
0.205607
107
8
28
13.375
0.623529
0
0
0
0
0
0.12037
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3cad61659053568395803614f7ad60a640dd6a42
960
py
Python
cosmic_ray/operators/break_continue.py
rob-smallshire/cosmic-ray
4fd751b38eee30568f8366e09452d7aa60be4e26
[ "MIT" ]
null
null
null
cosmic_ray/operators/break_continue.py
rob-smallshire/cosmic-ray
4fd751b38eee30568f8366e09452d7aa60be4e26
[ "MIT" ]
null
null
null
cosmic_ray/operators/break_continue.py
rob-smallshire/cosmic-ray
4fd751b38eee30568f8366e09452d7aa60be4e26
[ "MIT" ]
null
null
null
"""Implementation of the replace-break-with-continue and replace-continue-with-break operators. """ import ast from .operator import Operator class ReplaceBreakWithContinue(Operator): "Operator which replaces 'break' with 'continue'." def visit_Break(self, node): # pylint: disable=invalid-name "Visit a 'break' node." return self.visit_mutation_site(node) def mutate(self, node, _): """Replace a Break node with a Continue node.""" assert isinstance(node, ast.Break) return ast.Continue() class ReplaceContinueWithBreak(Operator): "Operator which replaces 'continue' with 'break'." def visit_Continue(self, node): # pylint: disable=invalid-name "Visit a 'continue' node." return self.visit_mutation_site(node) def mutate(self, node, _): """Replace a Continue node with a Break node.""" assert isinstance(node, ast.Continue) return ast.Break()
28.235294
67
0.679167
115
960
5.6
0.286957
0.049689
0.046584
0.090062
0.388199
0.304348
0.304348
0.304348
0.186335
0.186335
0
0
0.2125
960
33
68
29.090909
0.851852
0.397917
0
0.222222
0
0
0.2
0
0
0
0
0
0.111111
1
0.222222
false
0
0.111111
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
3cb1923af301402eb24b54bd236d10f07ebab9fd
1,803
py
Python
tests/transfer_from_rdbms_to_json_test.py
moshebeeri/datap
9ff99bb435728cd69f2589e3ee858a06768ea85e
[ "Apache-2.0" ]
null
null
null
tests/transfer_from_rdbms_to_json_test.py
moshebeeri/datap
9ff99bb435728cd69f2589e3ee858a06768ea85e
[ "Apache-2.0" ]
null
null
null
tests/transfer_from_rdbms_to_json_test.py
moshebeeri/datap
9ff99bb435728cd69f2589e3ee858a06768ea85e
[ "Apache-2.0" ]
null
null
null
from controller import Control import mongomock from elasticmock import elasticmock from datetime import datetime from freezegun import freeze_time from datetime import datetime import elasticsearch from unittest import TestCase from service import * from projects.job import Job import random from rdbms import AlchemyEngineFactory from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, DateTime from sqlalchemy.orm import sessionmaker Base = declarative_base() class TestData(Base): __tablename__ = 'TestData' id = Column(Integer, primary_key=True) number = Column(Integer) timestamp = Column(DateTime, default=datetime.utcnow) def __repr__(self): return "<User(number='%d', timestamp='%s')>" % (self.number, str(self.timestamp)) class TestSQLiteToMongo(TestCase): engineFactory: AlchemyEngineFactory = None sqlite_engine = None @classmethod def setUpClass(cls): super(TestSQLiteToMongo, cls).setUpClass() cls.engineFactory = AlchemyEngineFactory() cls.sqlite_engine = cls.engineFactory.sqlite_in_memory() def sqlite_populate_many(self, session): objects = [] for i in range(100): test_data = TestData(number=i + 100) session.add(test_data) session.commit() @mongomock.patch(servers=(('example.com', 27017),)) def test_transfer_elastic_to_mongo(self): control = Control({'retryable': False}) sqlite = SQLiteDB() # elastic = Elasticsearch(index='my_data') # self.elastic_populate_many(elastic) mongodb = MongoDB(connection = 'example.com') control = control.add_source(sqlite).add_destination(mongodb) assert control != None docs = control.run(Job(from_time=datetime(2020, 11, 11), to_time= datetime(2020, 11, 12))) assert len(docs) == 500
31.631579
94
0.747088
216
1,803
6.092593
0.444444
0.031915
0.027356
0.039514
0
0
0
0
0
0
0
0.019646
0.153078
1,803
56
95
32.196429
0.842174
0.042152
0
0.043478
0
0
0.042948
0
0
0
0
0
0.043478
1
0.086957
false
0
0.326087
0.021739
0.608696
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3cc7eeed94683ad8a5d6e2313f924c29fd0e96fe
371
py
Python
mliyweb/api/v2/instances.py
FINRAOS/MLiy
a6fd56ad8a0de97d9862569d02e5d0f65c181acf
[ "Apache-2.0" ]
13
2018-06-19T18:28:38.000Z
2021-12-02T13:08:52.000Z
mliyweb/api/v2/instances.py
FINRAOS/MLiy
a6fd56ad8a0de97d9862569d02e5d0f65c181acf
[ "Apache-2.0" ]
14
2018-08-09T14:49:08.000Z
2022-02-10T10:54:55.000Z
mliyweb/api/v2/instances.py
FINRAOS/MLiy
a6fd56ad8a0de97d9862569d02e5d0f65c181acf
[ "Apache-2.0" ]
2
2018-07-11T14:13:23.000Z
2019-02-08T14:17:26.000Z
from rest_framework import viewsets from rest_framework.permissions import AllowAny from mliyweb.api.v2.serializers import InstanceSerializer from mliyweb.models import Instance class InstanceViewSet(viewsets.ModelViewSet): queryset = Instance.objects.all().exclude(state__iexact='terminated') serializer_class = InstanceSerializer permission_classes = [AllowAny]
28.538462
70
0.843666
41
371
7.487805
0.658537
0.052117
0.110749
0
0
0
0
0
0
0
0
0.002967
0.091644
371
12
71
30.916667
0.908012
0
0
0
0
0
0.027027
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3ce159415d39a9d3be61532d952f625095ce234f
1,717
py
Python
ntcore/tcpsockets/tcp_stream.py
amorygalili/pynetworktables
59b5d1328274e78393202fe2a7e09845f5ff63a5
[ "BSD-3-Clause" ]
56
2015-01-05T00:59:55.000Z
2022-03-30T22:40:09.000Z
ntcore/tcpsockets/tcp_stream.py
amorygalili/pynetworktables
59b5d1328274e78393202fe2a7e09845f5ff63a5
[ "BSD-3-Clause" ]
71
2015-01-17T23:17:03.000Z
2021-12-28T18:44:44.000Z
ntcore/tcpsockets/tcp_stream.py
amorygalili/pynetworktables
59b5d1328274e78393202fe2a7e09845f5ff63a5
[ "BSD-3-Clause" ]
36
2015-01-26T15:00:04.000Z
2022-03-02T23:02:22.000Z
# novalidate import select import socket import threading class StreamEOF(IOError): pass class TCPStream(object): def __init__(self, sd, peer_ip, peer_port, sock_type): self.m_sd = sd self.m_peerIP = peer_ip self.m_peerPort = peer_port self.m_rdsock = sd.makefile("rb") self.m_wrsock = sd.makefile("wb") self.close_lock = threading.Lock() # Python-specific for debugging self.sock_type = sock_type def read(self, size): # TODO: ntcore does a select to wait for read to be available. Necessary? data = self.m_rdsock.read(size) if size > 0 and len(data) != size: raise StreamEOF("end of file") return data def readline(self): return self.m_rdsock.readline() def readStruct(self, s): sz = s.size data = self.m_rdsock.read(sz) if len(data) != sz: raise StreamEOF("end of file") return s.unpack(data) def send(self, contents): self.m_wrsock.write(contents) self.m_wrsock.flush() def close(self): with self.close_lock: if self.m_sd: try: self.m_sd.shutdown(socket.SHUT_RDWR) except OSError: pass self.m_sd.close() # self.m_sd = None def getPeerIP(self): return self.m_peerIP def getPeerPort(self): return self.m_peerPort def setNoDelay(self): self.m_sd.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) def _waitForReadEvent(self, timeout): r, _, _ = select.select((self.m_sd,), (), (), timeout) return len(r) > 0
23.520548
81
0.576587
221
1,717
4.312217
0.375566
0.094439
0.051417
0.047219
0.100735
0.06086
0
0
0
0
0
0.002582
0.323238
1,717
72
82
23.847222
0.817556
0.075131
0
0.085106
0
0
0.016425
0
0
0
0
0.013889
0
1
0.212766
false
0.042553
0.06383
0.06383
0.446809
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
0
0
0
2
3ce2b3933382b31b28c9fcfc52c41f5de36e94a4
2,820
py
Python
REST/CDH/modify_yarn_config.py
doronve/myrep
77fe6299f29453daae24990e974eddeb2ea2b17e
[ "Apache-2.0" ]
null
null
null
REST/CDH/modify_yarn_config.py
doronve/myrep
77fe6299f29453daae24990e974eddeb2ea2b17e
[ "Apache-2.0" ]
null
null
null
REST/CDH/modify_yarn_config.py
doronve/myrep
77fe6299f29453daae24990e974eddeb2ea2b17e
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/python import urllib2 import sys, getopt import base64 from urlparse import urlparse import json from pprint import pprint import cdhRest yarn_json = ' { "items" : [ { "name" : "yarn_nodemanager_resource_cpu_vcores", "value" : "8" }, { "name" : "yarn_nodemanager_resource_memory_mb", "value" : "8192" } ] }' content_header = {'Content-type':'application/json', 'Accept':'application/vnd.error+json,application/json', 'Accept-Version':'1.0'} yarnJsonObj = json.loads(yarn_json) def main(argv): chost = '' username = '' password = '' try: opts, args = getopt.getopt(argv,"h:u:p:",["chost=","user=","pass="]) except getopt.GetoptError: print 'test.py -h <chost> -u <username> -p <password>' sys.exit(2) for opt, arg in opts: if opt in ("-h", "--chost"): chost = arg elif opt in ("-u", "--user"): username = arg elif opt in ("-p", "--pass"): password = arg if __debug__: print 'host is:', chost if __debug__: print 'username is:', username if __debug__: print 'password is:', password base64string = base64.encodestring( '%s:%s' % (username, password))[:-1] authheader = 'Basic %s' % base64string apiver = cdhRest.getversion(chost, authheader) baseurl = "http://" + chost + ":7180/api/" + apiver + "/clusters" clusterslist = cdhRest.get_cluster_names(baseurl, authheader) for cluster in clusterslist: baseurl1 = baseurl + "/" + cluster + "/services" service = cdhRest.get_service_name_by_type(baseurl1, "YARN", authheader) baseurl1 = baseurl1 + "/" + service + "/roleConfigGroups" confgroups = cdhRest.get_conf_groups(baseurl1, "NODEMANAGER", authheader) for confgroup in confgroups: baseurl2 = baseurl1 + "/" + confgroup + "/config?view=full" req = urllib2.Request(baseurl2) req.add_header("Authorization", authheader) handle = urllib2.urlopen(req) thepage = handle.read() data = json.loads(thepage) #if __debug__: pprint(data) # example taken from here http://stackoverflow.com/questions/21243834/doing-put-using-python-urllib2 baseURL = baseurl1 + "/" + confgroup + "/config" if __debug__: print "baseURL = ", baseURL request = urllib2.Request(url=baseURL, data=json.dumps(yarnJsonObj), headers=content_header) if __debug__: print "request = ", request request.add_header("Authorization", authheader) if __debug__: print "request = ", request request.get_method = lambda: 'PUT' #if I remove this line then the POST works fine. if __debug__: print "request = ", request response = urllib2.urlopen(request) if __debug__: print response.read() if __name__ == "__main__": main(sys.argv[1:])
37.6
169
0.639716
321
2,820
5.411215
0.404984
0.036269
0.055268
0.032815
0.052965
0.037997
0
0
0
0
0
0.020455
0.219858
2,820
74
170
38.108108
0.769091
0.066667
0
0.05
0
0.016667
0.212709
0.045662
0
0
0
0
0
0
null
null
0.116667
0.116667
null
null
0.166667
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
0
0
0
0
0
2
3ce434b3d58945581d792a2f6395262bc7598409
4,400
py
Python
scenarios/DLP_SH_v2/run_cases.py
grossmann-group/or-gym
8ebad3bdc84cc7787592d7bf347fdd39eb24d982
[ "MIT" ]
6
2020-12-03T21:08:39.000Z
2021-12-26T08:40:33.000Z
scenarios/DLP_SH_v2/run_cases.py
grossmann-group/or-gym
8ebad3bdc84cc7787592d7bf347fdd39eb24d982
[ "MIT" ]
9
2020-09-21T19:03:54.000Z
2022-03-07T09:05:56.000Z
scenarios/DLP_SH_v2/run_cases.py
grossmann-group/or-gym
8ebad3bdc84cc7787592d7bf347fdd39eb24d982
[ "MIT" ]
1
2022-03-12T13:40:50.000Z
2022-03-12T13:40:50.000Z
import or_gym import pickle from pyomo.opt import SolverFactory from or_gym.algos.supply_network.math_prog import * from or_gym.algos.supply_network.stoch_prog import * #imputs path = "./scenarios/" ver = "v2" model = "DLP" mode = "SH" window = 30 solver = "glpk" #create file names filename = path+"in"+ver+".pkl" D = pickle.load(open(filename,'rb')) filesave = path+model+"_"+mode+"_"+ver+"/" #solve shrinking horizon model for i in range(100): #create environmnet with user specified demand user_D = {(1,0): D[:,i]} #assign scenario to retail/market link sample_path = {(1,0): True} #note that the specified demand is sampled from the prob distribution env = or_gym.make("InvManagement-"+ver, env_config={'user_D': user_D, 'sample_path': sample_path}) #loop through each period in the simulation, optimizing along the way for t in range(env.num_periods): #create model m=net_im_lp_model(env,window_size=window,use_expectation=True) #select solver s=SolverFactory(solver) #solve model res=s.solve(m, tee=False) #check result is optimal if res['Solver'][0]['Termination condition'][:] != 'optimal': print("ERROR: NOT OPTIMAL") break #extract reorder quantities Ropt=m.R.get_values() #pass action for the current timestep only (i.e. t=0) action={e[1:]:Ropt[e] for e in Ropt.keys() if e[0]==0} outcome=env.step(action) #print profit for the total simulation run print("Case " + str(i) + " - " + str(env.P.sum().sum())) #pickle environment pickle.dump(env, open(filesave+"run"+str(i)+".pkl","wb")) # Cumulative Profits: # Case 0 - 767.472 # Case 1 - 902.6880000000001 # Case 2 - 804.315 # Case 3 - 854.0160000000001 # Case 4 - 859.086 # Case 5 - 824.8399999999999 # Case 6 - 857.886 # Case 7 - 841.5989999999999 # Case 8 - 782.482 # Case 9 - 842.7719999999999 # Case 10 - 861.606 # Case 11 - 793.9260000000002 # Case 12 - 853.2360000000001 # Case 13 - 847.98 # Case 14 - 852.0160000000001 # Case 15 - 785.8220000000001 # Case 16 - 814.9360000000001 # Case 17 - 798.935 # Case 18 - 827.2859999999998 # Case 19 - 794.171 # Case 20 - 885.75 # Case 21 - 873.152 # Case 22 - 845.5509999999999 # Case 23 - 870.4390000000001 # Case 24 - 838.8389999999999 # Case 25 - 823.0610000000001 # Case 26 - 768.0480000000002 # Case 27 - 860.135 # Case 28 - 832.598 # Case 29 - 761.7920000000001 # Case 30 - 732.9990000000003 # Case 31 - 849.8599999999999 # Case 32 - 834.1680000000001 # Case 33 - 785.5120000000002 # Case 34 - 851.472 # Case 35 - 761.8120000000001 # Case 36 - 840.9250000000002 # Case 37 - 830.76 # Case 38 - 842.8509999999999 # Case 39 - 844.1100000000001 # Case 40 - 835.0889999999999 # Case 41 - 776.4780000000001 # Case 42 - 820.421 # Case 43 - 728.0729999999999 # Case 44 - 786.454 # Case 45 - 759.7570000000001 # Case 46 - 855.989 # Case 47 - 842.3520000000001 # Case 48 - 869.825 # Case 49 - 847.2250000000001 # Case 50 - 832.74 # Case 51 - 848.6969999999999 # Case 52 - 911.2819999999999 # Case 53 - 833.306 # Case 54 - 838.1010000000001 # Case 55 - 781.2520000000002 # Case 56 - 801.8880000000001 # Case 57 - 793.367 # Case 58 - 845.1510000000003 # Case 59 - 803.0619999999999 # Case 60 - 857.7310000000002 # Case 61 - 862.876 # Case 62 - 815.54 # Case 63 - 840.1860000000001 # Case 64 - 750.0720000000001 # Case 65 - 797.1399999999999 # Case 66 - 812.703 # Case 67 - 844.8230000000001 # Case 68 - 880.039 # Case 69 - 815.5909999999999 # Case 70 - 817.6570000000002 # Case 71 - 748.762 # Case 72 - 827.7429999999999 # Case 73 - 859.8779999999999 # Case 74 - 838.6980000000001 # Case 75 - 850.6070000000002 # Case 76 - 866.692 # Case 77 - 811.1239999999998 # Case 78 - 794.3320000000001 # Case 79 - 789.0690000000002 # Case 80 - 805.9580000000001 # Case 81 - 818.9090000000001 # Case 82 - 835.829 # Case 83 - 800.0029999999999 # Case 84 - 816.521 # Case 85 - 874.163 # Case 86 - 846.1049999999998 # Case 87 - 862.8380000000002 # Case 88 - 777.5250000000001 # Case 89 - 819.4320000000002 # Case 90 - 831.5439999999999 # Case 91 - 833.7629999999999 # Case 92 - 850.8490000000002 # Case 93 - 854.415 # Case 94 - 798.4720000000002 # Case 95 - 823.6989999999998 # Case 96 - 866.8779999999999 # Case 97 - 796.9650000000001 # Case 98 - 752.9560000000001 # Case 99 - 871.815
29.530201
101
0.674091
647
4,400
4.547141
0.61051
0.006798
0.006118
0.009517
0.018355
0.018355
0
0
0
0
0
0.42024
0.205
4,400
149
102
29.530201
0.420812
0.668409
0
0
0
0
0.099702
0
0
0
0
0
0
1
0
false
0
0.16129
0
0.16129
0.064516
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
0
0
0
0
0
0
0
0
2
3ce6866c70e654a59b3bff53a3c4d3db0f346e1f
804
py
Python
tests/schema_comparer/not_matches/test_schema_comparer_struct_to_struct.py
icanbwell/SparkDataFrameComparer
f6364ada42d83a77cd6fcc34993dfc655f6324fc
[ "Apache-2.0" ]
1
2020-10-31T23:25:02.000Z
2020-10-31T23:25:02.000Z
tests/schema_comparer/not_matches/test_schema_comparer_struct_to_struct.py
imranq2/SparkDataFrameComparer
46de202f26713d91d747faee6b0dcf54a872739d
[ "Apache-2.0" ]
null
null
null
tests/schema_comparer/not_matches/test_schema_comparer_struct_to_struct.py
imranq2/SparkDataFrameComparer
46de202f26713d91d747faee6b0dcf54a872739d
[ "Apache-2.0" ]
null
null
null
from pyspark.sql.types import ( StructType, StructField, StringType, IntegerType, FloatType, ) from spark_data_frame_comparer.schema_comparer import SchemaComparer def test_schema_comparer_struct_to_struct() -> None: print("") source_schema: StructType = StructType( [ StructField("name", StructType([StructField("given", FloatType())])), StructField("age", IntegerType()), ] ) desired_schema: StructType = StructType( [ StructField("name", StructType([StructField("given", StringType())])), StructField("age", IntegerType()), ] ) SchemaComparer.compare_schema( parent_column_name=None, source_schema=source_schema, desired_schema=desired_schema, )
25.935484
82
0.635572
69
804
7.144928
0.434783
0.212982
0.105477
0.150101
0.271805
0.271805
0.271805
0.271805
0
0
0
0
0.252488
804
30
83
26.8
0.8203
0
0
0.074074
0
0
0.029851
0
0
0
0
0
0
1
0.037037
true
0
0.074074
0
0.111111
0.037037
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
3cec10af265e59a9e78c3e2145439e2d6aa5c28c
393
py
Python
DataStructures-Algorithms/Udacity-Python-DSA/02-Stacks-and-Queues/implement-queue-class.py
shoaibur/SWE
1e114a2750f2df5d6c50b48c8e439224894d65da
[ "MIT" ]
1
2020-11-14T18:28:13.000Z
2020-11-14T18:28:13.000Z
DataStructures-Algorithms/Udacity-Python-DSA/02-Stacks-and-Queues/implement-queue-class.py
shoaibur/SWE
1e114a2750f2df5d6c50b48c8e439224894d65da
[ "MIT" ]
null
null
null
DataStructures-Algorithms/Udacity-Python-DSA/02-Stacks-and-Queues/implement-queue-class.py
shoaibur/SWE
1e114a2750f2df5d6c50b48c8e439224894d65da
[ "MIT" ]
null
null
null
class Queue(object): def __init__(self): self.q = [] def push(self, value): self.q.insert(0, value) def pop(self): return self.q.pop() def is_empty(self): return self.q == [] def size(self): return len(self.q) # Example q = Queue() q.push(1) q.push(2) q.push(3) print(q.q) # [3, 2, 1] q.pop() print(q.q) # [3, 2]
16.375
31
0.503817
63
393
3.063492
0.349206
0.129534
0.082902
0.15544
0.093264
0
0
0
0
0
0
0.033457
0.315522
393
23
32
17.086957
0.684015
0.061069
0
0.111111
0
0
0
0
0
0
0
0
0
1
0.277778
false
0
0
0.166667
0.5
0.111111
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
3cf243c8128823ad0a1f5e9690d2a0b22b044352
1,802
py
Python
invenio_resourcesync/exporter/ext.py
mhaya/invenio-resourcesync
c76188ea713118e01fe6af3b66ae957c4d9ab60d
[ "MIT" ]
null
null
null
invenio_resourcesync/exporter/ext.py
mhaya/invenio-resourcesync
c76188ea713118e01fe6af3b66ae957c4d9ab60d
[ "MIT" ]
null
null
null
invenio_resourcesync/exporter/ext.py
mhaya/invenio-resourcesync
c76188ea713118e01fe6af3b66ae957c4d9ab60d
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # # This file is part of Zenodo. # Copyright (C) 2018 CERN. # # Zenodo is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Zenodo is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Zenodo; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307, USA. # # In applying this license, CERN does not # waive the privileges and immunities granted to it by virtue of its status # as an Intergovernmental Organization or submit itself to any jurisdiction. """Exporter extension.""" from __future__ import absolute_import, print_function from flask import current_app from . import config class InvenioExporter(object): """Exporter extension.""" def __init__(self, app=None): """Extension initialization.""" if app: self.init_app(app) @staticmethod def init_config(app): """Initialize configuration.""" for k in dir(config): if k.startswith('EXPORTER_'): app.config.setdefault(k, getattr(config, k)) def init_app(self, app): """Flask application initialization.""" self.init_config(app) app.extensions['invenio-exporter'] = self def job(self, job_id): """Get export job definition.""" return current_app.config['EXPORTER_JOBS'].get(job_id, None)
31.614035
76
0.695893
249
1,802
4.955823
0.546185
0.029173
0.031605
0.046191
0.066451
0.045381
0
0
0
0
0
0.014114
0.213652
1,802
56
77
32.178571
0.85674
0.596004
0
0
0
0
0.056296
0
0
0
0
0
0
1
0.235294
false
0
0.176471
0
0.529412
0.058824
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
0
1
0
0
2
a70c0be1149a0cfa6d7601960be0d176269b5d10
101
py
Python
01-introduction-functional-paradigm/functional_programming.py
saidulislam/Functional-Programming-in-Python
27ae205f9cf0fa38e16e29089cf72981f8a51a78
[ "Apache-2.0" ]
null
null
null
01-introduction-functional-paradigm/functional_programming.py
saidulislam/Functional-Programming-in-Python
27ae205f9cf0fa38e16e29089cf72981f8a51a78
[ "Apache-2.0" ]
null
null
null
01-introduction-functional-paradigm/functional_programming.py
saidulislam/Functional-Programming-in-Python
27ae205f9cf0fa38e16e29089cf72981f8a51a78
[ "Apache-2.0" ]
null
null
null
import functools my_list = [1,2,3,4] sum = functools.reduce(lambda x,y: x+y, my_list) print(sum)
20.2
49
0.683168
20
101
3.35
0.7
0.179104
0
0
0
0
0
0
0
0
0
0.047059
0.158416
101
5
50
20.2
0.741176
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
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
2
a71c7ecac5633d8136f7ec1764bea45c0cd0795c
9,921
py
Python
src/applications/danews/add_metadata.py
centre-for-humanities-computing/danish-foundation-models
1cc0950fab55650fd92f56b4bad0b13a5be73061
[ "MIT" ]
8
2021-12-10T08:37:55.000Z
2022-02-08T14:42:01.000Z
src/applications/danews/add_metadata.py
centre-for-humanities-computing/danish-foundation-models
1cc0950fab55650fd92f56b4bad0b13a5be73061
[ "MIT" ]
47
2021-12-12T14:41:31.000Z
2022-03-31T08:57:56.000Z
src/applications/danews/add_metadata.py
centre-for-humanities-computing/danish-foundation-models
1cc0950fab55650fd92f56b4bad0b13a5be73061
[ "MIT" ]
null
null
null
""" Add description to dataset and generate an outline to a datasheet describing the dataset. Dependent on: src/applications/danews/dedupe.py Authors: Kenneth Enevoldsen """ from datasets import load_from_disk from pathlib import Path import spacy def word_count(batch): nlp = spacy.blank("da") batch["n_tokens"] = [len(doc) for doc in nlp.pipe(batch["text"])] return batch print("Loading dataset") path = Path("/work/hope-infomedia_cleaned/infomedia_2000-2021") news = load_from_disk(path) print("Add n_tokens column") news = news.map(word_count, batched=True, batch_size=1024 * 2 * 2, num_proc=16) # Add description print("Creating metadata") dates = news["PublishDate"] start_date = min(dates).strftime("%d/%m/%Y") end_date = max(dates).strftime("%d/%m/%Y") print("\tCounting unique sources") sources = news["Source"] n_sources = len(set(sources)) print("\tExtracting duplicate counts") n_tokens_ = news["n_tokens"] n_tokens = sum(n_tokens_) is_duplicate_ = news["is_duplicate"] n_clean_tokens = sum( n_tok for n_tok, is_dup in zip(n_tokens_, is_duplicate_) if is_dup is False ) n_non_duplicates = sum([1 for is_dup in is_duplicate_ if is_dup is False]) n_duplicates = sum([1 for is_dup in is_duplicate_ if is_dup is True]) n_docs = len(news) print("\tExtracting number of low-quality text") passed_quality_filter = news["passed_quality_filter"] n_low_quality = sum(1 for is_good in passed_quality_filter if is_good is False) news.info.description = f""" DaNews consist of articles collected from the [Infomedia](https://infomedia.dk) and consists of {n_docs} articles across {n_sources} news sources. DaNews include articles from the period {start_date} to {end_date}. DaNews have been filters out quality using a series of heuristic filters and removing repitious texts. Following the filtering DaNews is deduplicated to remove exact and near-duplicates. For more on data cleaning see post processing. DaNews includes a total of {n_tokens} tokens of which {n_clean_tokens} ({n_clean_tokens/n_tokens:.2f}%) are left after filtering. ## Datasheet: ### Motivation: **For what purpose was the dataset created? Who created the dataset? Who funded the creation of the dataset? ** The dataset was created for pre-training Danish language models by a team of researchers at Center for Humanities Computing Aarhus (CHCAA) using a codebase jointly developed with partners from industry (e.g. KMD, Ekstra Bladet) and other research institutions (e.g. Briston University). For more on collaborators on this project see the [GitHub repository](https://github.com/centre-for-humanities-computing/danish-foundation-models ). **Any other comments?** No. ## Composition **What do the instances that comprise the dataset represent (e.g., documents, photos, people, countries)?** All instances of the dataset are Danish articles depending on the source these are derived from tabloid media or mainstream news. **How many instances are there in total (of each type, if appropriate)?** The dataset consist of {n_docs} documents where {n_docs-n_duplicates} ({n_duplicates/n_docs:.2f}%) are left after filtering. **Does the dataset contain all possible instances or is it a sample (not necessarily random) of instances from a larger set?** Prior to filtering this dataset contains all instances of new articles from the given period across the sources. **If the dataset is a sample from a larger set, what was the sampling strategy?** The dataset is not a sample, however it is filtered as described in post processing. **Who was involved in the data collection process?** A team of researchers at Center for Humanities Computing Aarhus (CHCAA) recieved this dataset in a collaboration with Infomedia. **Over what timeframe was the data collected?** The dataset include articles from the period {start_date} to {end_date}. **Were any ethical review processes conducted?** No. ## Preprocessing/cleaning/labeling **Was any preprocessing/Cleaning/Labeling of the data done (e.g., discretization or bucketing, tokenization, part-of-speech tagging, SIFT feature extraction, removal of instances, processing of missing values)?** We filter documents that are not in Danish. We remove low-quality text and deduplicate documents based on their document-level n-gram similarity. The full pre-processing details are given in the post processing section. **Is the software used to preprocess/clean/label the instances available?** Yes, the script are avaiable [here](https://github.com/centre-for-humanities-computing/danish-foundation-models/tree/main/src/application/danews). Which used version 0.0.1 of the [dfm package](https://github.com/centre-for-humanities-computing/danish-foundation-models). ## Uses **Has the dataset been used for any tasks already?** Yes, the dataset has been used to pre-train Danish language models. Parts of the dataset have also been used in: - Baglini, R. B., Nielbo, K. L., Hæstrup, F., Enevoldsen, K., Vahlstrup, P. B., & Roepstorff, A. (2021, June 2). When no news is bad news: Detection of negative events from news media content. https://2021.dhbenelux.org/ - Nielbo, K. L., Baglini, R. B., Vahlstrup, P. B., Enevoldsen, K. C., Bechmann, A., & Roepstorff, A. (2021, January). News information decoupling: An information signature of catastrophes in legacy news media. https://eadh2020-2021.org/ **Is there a repository that links to any or all papers or systems that use the dataset?** No. **What (other) tasks could the dataset be used for?** The scale of the dataset makes it suitable for NLP tasks such as language modelling. Similarly, the structure of the articles make it a suitable dataset for training text summerization models. **Is there anything about the composition of the dataset or the way it was collected and preprocessed/cleaned/labeled that might impact future uses?** This dataset is static and thus does not evolve over time with the language, thus will become increasingly outdated over time. **Are there tasks for which the dataset should not be used?** This dataset contains Danish articles and thus should not be used for Danish language task. As the writers of the content is predominantly journalists, it reflect a certain social group which is unlikely to reflect Danish language as a whole. ## Distribution **Will the dataset be distributed to third parties outside of the entity (e.g., company, institution, organization) on behalf of which the dataset was created?** No. """ news.info.license = "Not publicly available." news.info.post_processed = f""" # Post processing DaNews have been filtered for quality using a series of heuristic filters and removing repitious texts. Following the filtering DaNews is deduplicated to remove exact and near-duplicates. A total of {n_low_quality} ({n_low_quality/n_docs:.2f}%) were considered low quality and a total of {n_duplicates} ({n_duplicates/(n_non_duplicates+n_duplicates):.2f}%) documents were considered duplicates. ## Quality Filter: For the quality filtering DaNews applies a filter akin to [2] which filters text which does not: - Contain at least 2 Danish stopwords. For the stopword list we use the one used in SpaCy v.3.1.4. - Have mean word length between 3-10. - Have a token length between 50-100 000. - Have a less than 5 000 000 characters. - Have a less than 60% words containing an alphabetic character. - Have a symbol to word ratio lower than 10% for hashtags an ellipsis. - Have less than 90% of lines starting with a bullet point. - have less than 30% of lines ending with an ellipsis. - Have low high degree of repitiuous text: - Less than 20% duplicate lines. - Less than 20% duplicate paragraphs. - Where the top 2-4 grams constitute less than 20%, 18%, 16%, respectively, of the text. - Where the duplicate 5-10 grams constitute less than 25%, 24%, 23%, 22%, 21%, 20% of the text, respectively. ## Deduplication The deduplication removed all documents with a 13-gram similarity higher than 80% following the MinHash algorithm [1] using 128 permutation. The MinHash algorithm is a probabilistic data structure for approximating the Jaccard similarity between two sets. References: - [1] Broder, Andrei Z. "On the resemblance and containment of documents." Proceedings. Compression and Complexity of SEQUENCES 1997 (Cat. No. 97TB100171). IEEE, 1997. - [2] Rae, J. W., Borgeaud, S., Cai, T., Millican, K., Hoffmann, J., Song, F., Aslanides, J., Henderson, S., Ring, R., Young, S., Rutherford, E., Hennigan, T., Menick, J., Cassirer, A., Powell, R., Driessche, G. van den, Hendricks, L. A., Rauh, M., Huang, P.-S., … Irving, G. (2021). Scaling Language Models: Methods, Analysis & Insights from Training Gopher. https://arxiv.org/abs/2112.11446v2 """ news.info.version = "1.0.0" news.info.citation = """If you wish to cite this work please see our GitHub page for an up to date citation: https://github.com/centre-for-humanities-computing/danish-foundation-models""" news.info.homepage = ( "https://github.com/centre-for-humanities-computing/danish-foundation-models" ) # write markdown file print("\tWriting markdown file") md = f""" # DaNews *Version*: {news.info.version} *Homepage*: {news.info.homepage} *license*: {news.info.license} {news.info.description} {news.info.post_processed} ### Citation {news.info.citation} """ print("Saving description markdown") with open("danish-foundation-models/docs/danews.md", "w") as f: f.write(md) # write dataset with added metadata print("Saving dataset") save_path = Path("/work/hope-infomedia_cleaned/infomedia_2000-2021.arrow") news.save_to_disk(save_path) # write meta file news_sub = news.remove_columns( [ c for c in news.features.keys() if c not in {"n_tokens", "is_duplicate", "passed_quality_filter", "Source"} ] ) news_sub.to_csv("news_meta.csv")
35.55914
117
0.753452
1,536
9,921
4.803385
0.342448
0.029818
0.020873
0.013554
0.154242
0.137436
0.137436
0.137436
0.133098
0.119816
0
0.018563
0.152908
9,921
278
118
35.68705
0.858996
0.026409
0
0.04712
1
0.062827
0.849606
0.05255
0
0
0
0
0
1
0.005236
false
0.015707
0.015707
0
0.026178
0.04712
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a7308795495e8f8ade2f72037b391b0808e98305
533
py
Python
tests.py
sorengoyal/combat-evolved
c760bf8aedd7eeb29afeacb02b052f91f388cc0c
[ "CC-BY-3.0" ]
null
null
null
tests.py
sorengoyal/combat-evolved
c760bf8aedd7eeb29afeacb02b052f91f388cc0c
[ "CC-BY-3.0" ]
2
2017-06-10T18:38:02.000Z
2017-06-24T02:39:32.000Z
tests.py
sorengoyal/combat-evolved
c760bf8aedd7eeb29afeacb02b052f91f388cc0c
[ "CC-BY-3.0" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 1 20:45:09 2017 @author: sogoyal """ from app.tests.TestServerMethods import TestServerMethods from app.tests.TestGeospatial import TestGeospatial import unittest API_KEY = '3d42933f4c284a3b8dd2c5200e97da00' suite = unittest.TestSuite() loader = unittest.TestLoader() suite.addTests(loader.loadTestsFromTestCase(TestServerMethods)) #suite.addTests(loader.loadTestsFromTestCase(TestGeospatial)) runner = unittest.TextTestRunner(verbosity=3) runner.run(suite)
25.380952
63
0.797373
59
533
7.186441
0.661017
0.033019
0.056604
0.188679
0
0
0
0
0
0
0
0.072165
0.090056
533
20
64
26.65
0.802062
0.294559
0
0
0
0
0.087432
0.087432
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
0
1
0
0
0
0
2
597ea57970ac878f088034814530597b72f4cc24
1,144
py
Python
satoshi.py
malorento/satoshi
adbc6b08455d7c06684fc6588d86822a5cfab44a
[ "MIT" ]
null
null
null
satoshi.py
malorento/satoshi
adbc6b08455d7c06684fc6588d86822a5cfab44a
[ "MIT" ]
null
null
null
satoshi.py
malorento/satoshi
adbc6b08455d7c06684fc6588d86822a5cfab44a
[ "MIT" ]
null
null
null
from Core import core from Core import decor print(decor.banner) while True: print(decor.menu) choose = int(input(decor.yellow + "Enter number >> ")) if choose == 1: file = input(decor.yellow + "Enter filename with extension (file.txt) >> ") password = input(decor.yellow + "Enter password for file (remember it) >> ") try: core.encrypt(file, password) break except: print(decor.red + "[!] Error [!]") continue elif choose == 2: ext = input(decor.yellow + "Enter file extension (txt | py | data | ini | etc) >> ") file = input(decor.yellow + "Enter filename with extension (file.txt.aes) >> ") password = input(decor.yellow + "Enter file password >> ") try: core.decrypt(ext, file, password) break except ValueError: print(decor.red + "[!] Wrong password [!]" + decor.reset) continue elif choose == 3: break else: print(decor.red + "[!] Inknown command [!]" + decor.reset) continue
29.333333
93
0.533217
121
1,144
5.041322
0.404959
0.098361
0.157377
0.206557
0.316393
0.17377
0.17377
0.17377
0.17377
0.17377
0
0.003995
0.343531
1,144
38
94
30.105263
0.808256
0
0
0.266667
0
0
0.256781
0
0
0
0
0
0
1
0
false
0.166667
0.066667
0
0.066667
0.166667
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
1
0
0
0
0
0
2
5983197b11ab4b941ff446cf4950d269e0a51cab
4,144
py
Python
examples/pytorch/models/GPyTorchModels.py
UTokyo-ICEPP/multiml_htautau
5f926c2291a55f57419aa0130d07e2a793fc7353
[ "Apache-2.0" ]
null
null
null
examples/pytorch/models/GPyTorchModels.py
UTokyo-ICEPP/multiml_htautau
5f926c2291a55f57419aa0130d07e2a793fc7353
[ "Apache-2.0" ]
null
null
null
examples/pytorch/models/GPyTorchModels.py
UTokyo-ICEPP/multiml_htautau
5f926c2291a55f57419aa0130d07e2a793fc7353
[ "Apache-2.0" ]
null
null
null
import torch import gpytorch from gpytorch.distributions import MultitaskMultivariateNormal class MultitaskGPModel(gpytorch.models.ApproximateGP): def __init__(self, inducing_points_num, input_dim, num_latents, num_tasks=8): # Let's use a different set of inducing points for each latent function # num_latents x inducing_points(in each dim) x input_dim inducing_points = torch.rand(num_latents, inducing_points_num, input_dim) # We have to mark the CholeskyVariationalDistribution as batch # so that we learn a variational distribution for each task variational_distribution = gpytorch.variational.CholeskyVariationalDistribution( inducing_points.size(-2), batch_shape=torch.Size([num_latents]) ) # We have to wrap the VariationalStrategy in a LMCVariationalStrategy # so that the output will be a MultitaskMultivariateNormal rather than a batch output variational_strategy = gpytorch.variational.LMCVariationalStrategy( gpytorch.variational.VariationalStrategy( self, inducing_points, variational_distribution, learn_inducing_locations=True ), num_tasks=num_tasks, num_latents=num_latents, latent_dim=-1 ) super().__init__(variational_strategy) # The mean and covariance modules should be marked as batch # so we learn a different set of hyperparameters self.mean_module = gpytorch.means.ConstantMean(batch_shape=torch.Size([num_latents])) # self.covar_module = gpytorch.kernels.RBFKernel(batch_shape=torch.Size([num_latents])) self.covar_module = gpytorch.kernels.ScaleKernel( gpytorch.kernels.RBFKernel(batch_shape=torch.Size([num_latents])), batch_shape=torch.Size([num_latents]) ) def forward(self, x): # The forward function should be written as if we were dealing with each output # dimension in batch mean_x = self.mean_module(x) covar_x = self.covar_module(x) return gpytorch.distributions.MultivariateNormal(mean_x, covar_x) class IndependentMultitaskGPModel(gpytorch.models.ApproximateGP): def __init__(self, inducing_points_num, input_dim, num_tasks=8): # Let's use a different set of inducing points for each task inducing_points = torch.rand(num_tasks, inducing_points_num, input_dim) # We have to mark the CholeskyVariationalDistribution as batch # so that we learn a variational distribution for each task variational_distribution = gpytorch.variational.CholeskyVariationalDistribution( inducing_points.size(-2), batch_shape=torch.Size([num_tasks]) ) variational_strategy = gpytorch.variational.IndependentMultitaskVariationalStrategy( gpytorch.variational.VariationalStrategy( self, inducing_points, variational_distribution, learn_inducing_locations=True ), num_tasks=num_tasks, ) super().__init__(variational_strategy) # The mean and covariance modules should be marked as batch # so we learn a different set of hyperparameters self.mean_module = gpytorch.means.ConstantMean(batch_shape=torch.Size([num_tasks])) self.covar_module = gpytorch.kernels.ScaleKernel( gpytorch.kernels.RBFKernel(batch_shape=torch.Size([num_tasks])), batch_shape=torch.Size([num_tasks]) ) def forward(self, x): # The forward function should be written as if we were dealing with each output # dimension in batch mean_x = self.mean_module(x) covar_x = self.covar_module(x) return gpytorch.distributions.MultivariateNormal(mean_x, covar_x) def tensor_to_array(input_data): """ torch.tensor -> np.array Parameters ---------- input_data : torch.Tensor torch.Tensor data Returns ------- output_data : np.ndarray input_data converted to array type """ output_data = input_data.to('cpu').detach().numpy().copy() return output_data
42.721649
95
0.6986
483
4,144
5.776398
0.213251
0.065233
0.048387
0.06129
0.745161
0.726523
0.698566
0.698566
0.698566
0.692832
0
0.001563
0.228041
4,144
96
96
43.166667
0.870585
0.298986
0
0.423077
0
0
0.001055
0
0
0
0
0
0
1
0.096154
false
0
0.057692
0
0.25
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
598f1ae016dd603cb191e858a8a535adcf57198d
406
py
Python
detection/pixel_link/pylib/test/test_util_tf.py
HLIG/HUAWEI_OCR2019
1070d6291072e0223c2624f686766d0f3065e9c6
[ "MIT" ]
54
2019-04-17T07:55:44.000Z
2021-06-02T06:00:04.000Z
detection/pixel_link/pylib/test/test_util_tf.py
HLIG/HUAWEI_OCR2019
1070d6291072e0223c2624f686766d0f3065e9c6
[ "MIT" ]
5
2019-04-24T03:22:50.000Z
2021-08-18T13:12:38.000Z
detection/pixel_link/pylib/test/test_util_tf.py
HLIG/HUAWEI_OCR2019
1070d6291072e0223c2624f686766d0f3065e9c6
[ "MIT" ]
28
2019-04-17T11:30:58.000Z
2021-12-09T13:37:02.000Z
import util def test_is_gpu_available(): # for i in range(4): if(util.tf.is_gpu_available()): print "GPU is available, %s CUDA installed"%('with' if util.tf.is_gpu_available(True) else 'without'); def test_get_available_gpus(): devices = util.tf.get_available_gpus(); for d in devices: print d if util.mod.is_main(__name__): test_is_gpu_available() test_get_available_gpus()
27.066667
104
0.714286
66
406
4.045455
0.439394
0.074906
0.209738
0.134831
0.164794
0.164794
0
0
0
0
0
0.00295
0.165025
406
14
105
29
0.784661
0.044335
0
0
0
0
0.119171
0
0
0
0
0
0
0
null
null
0
0.090909
null
null
0.181818
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
1
0
0
0
0
0
0
0
0
2
599c23bc10129153960f647702884f5e351cae70
272
py
Python
setup.py
WTFox/BenefitPoint
cd307af97ab7b4e8fc492b4e0824afcf32b65cf0
[ "MIT" ]
2
2015-04-21T20:47:08.000Z
2015-06-24T18:40:22.000Z
setup.py
WTFox/BenefitPoint
cd307af97ab7b4e8fc492b4e0824afcf32b65cf0
[ "MIT" ]
null
null
null
setup.py
WTFox/BenefitPoint
cd307af97ab7b4e8fc492b4e0824afcf32b65cf0
[ "MIT" ]
null
null
null
from distutils.core import setup setup( name='benefitpoint', version='0.1', packages=['benefitpoint'], url='', license='', author='anthonyfox', author_email='anthonyfox1988@gmail.com', description='A python wrapper for BenefitPoint API' )
20.923077
55
0.665441
29
272
6.206897
0.862069
0
0
0
0
0
0
0
0
0
0
0.027273
0.191176
272
12
56
22.666667
0.790909
0
0
0
0
0
0.360294
0.088235
0
0
0
0
0
1
0
true
0
0.090909
0
0.090909
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
599d11a06e5edd515cb1953e1b7729347d30c29a
323
py
Python
code/events/fix_response_hand_gstroop_code.py
spinoza-rec/PIOP1
74f8c746de27cd5f12a3f61aa545903ead9f9d2a
[ "CC0-1.0" ]
1
2020-08-23T20:21:35.000Z
2020-08-23T20:21:35.000Z
code/events/fix_response_hand_gstroop_code.py
NILAB-UvA/PIOP1
74f8c746de27cd5f12a3f61aa545903ead9f9d2a
[ "CC0-1.0" ]
null
null
null
code/events/fix_response_hand_gstroop_code.py
NILAB-UvA/PIOP1
74f8c746de27cd5f12a3f61aa545903ead9f9d2a
[ "CC0-1.0" ]
null
null
null
import pandas as pd from glob import glob tsvs = sorted(glob('../../sub*/func/*task-gstroop*.tsv')) for tsv in tsvs: df = pd.read_csv(tsv, sep='\t') df.loc[df['response_hand'] == 1, 'response_hand'] = 'left' df.loc[df['response_hand'] == 2, 'response_hand'] = 'right' df.to_csv(tsv, sep='\t', index=False)
32.3
63
0.625387
53
323
3.698113
0.566038
0.244898
0.091837
0.102041
0.193878
0
0
0
0
0
0
0.007353
0.157895
323
9
64
35.888889
0.713235
0
0
0
0
0
0.306502
0.105263
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
59aaed1703bcb17421325e37709f1cb55aa98c5c
216
py
Python
decorator/generate_domain.py
MailG/code_py
c21a27c871c5c42625aadf45d51a0ba325095739
[ "MIT" ]
null
null
null
decorator/generate_domain.py
MailG/code_py
c21a27c871c5c42625aadf45d51a0ba325095739
[ "MIT" ]
null
null
null
decorator/generate_domain.py
MailG/code_py
c21a27c871c5c42625aadf45d51a0ba325095739
[ "MIT" ]
null
null
null
import unittest def gen_domain_list(domain): if len(domain) == 0: return None common_index = 0 common_index = domain.find('.') print domain, common_index def main(): gen_domain_list("www.bc.ade.da.com")
15.428571
37
0.708333
34
216
4.294118
0.617647
0.226027
0.178082
0
0
0
0
0
0
0
0
0.01105
0.162037
216
13
38
16.615385
0.79558
0
0
0
0
0
0.083721
0
0
0
0
0
0
0
null
null
0
0.111111
null
null
0.111111
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
1
0
0
0
0
0
0
0
0
2
59b2e8192eace452eac95853186123a89babe369
6,603
py
Python
tests/expectdata/statements/load_capiq_cat_annual.py
nickderobertis/py-finstmt
7903bce83b31e4425ac680020bf7d3536ed1ed11
[ "MIT" ]
3
2021-11-30T21:03:25.000Z
2022-01-04T10:18:54.000Z
tests/expectdata/statements/load_capiq_cat_annual.py
nickderobertis/py-finstmt
7903bce83b31e4425ac680020bf7d3536ed1ed11
[ "MIT" ]
23
2020-03-24T18:14:22.000Z
2022-03-12T00:19:51.000Z
tests/expectdata/statements/load_capiq_cat_annual.py
whoopnip/py-finstmt
7903bce83b31e4425ac680020bf7d3536ed1ed11
[ "MIT" ]
3
2021-05-15T11:13:08.000Z
2021-11-30T21:03:28.000Z
import pandas as pd LOAD_CAPIQ_CAT_A_INDEX_str = ["2014-12-31 00:00:00", "2015-12-31 00:00:00", "2016-12-31 00:00:00", "2017-12-31 00:00:00", "2018-12-31 00:00:00"] LOAD_CAPIQ_CAT_A_INDEX = [pd.to_datetime(val) for val in LOAD_CAPIQ_CAT_A_INDEX_str] LOAD_CAPIQ_CAT_A_INDEX_DATA_DICT = dict( revenue=pd.Series( [55184.0, 47011.0, 38537.0, 45462.0, 54722.0], index=LOAD_CAPIQ_CAT_A_INDEX ), cogs=pd.Series( [40718.0, 33546.0, 28044.0, 31260.0, 36997.0], index=LOAD_CAPIQ_CAT_A_INDEX ), gross_profit=pd.Series( [14466.0, 13465.0, 10493.0, 14202.0, 17725.0], index=LOAD_CAPIQ_CAT_A_INDEX ), rd_exp=pd.Series( [2380.0, 2119.0, 1853.0, 1842.0, 1850.0], index=LOAD_CAPIQ_CAT_A_INDEX ), sga=pd.Series( [5894.0, 4363.0, 4476.0, 4425.0, 4806.0], index=LOAD_CAPIQ_CAT_A_INDEX ), dep_exp=pd.Series( [0.0, 0.0, 0.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), other_op_exp=pd.Series( [44.0, 27.0, 78.0, 19.0, 89.0], index=LOAD_CAPIQ_CAT_A_INDEX ), op_exp=pd.Series( [8318.0, 6509.0, 6407.0, 6286.0, 6745.0], index=LOAD_CAPIQ_CAT_A_INDEX ), ebit=pd.Series( [3766.0, 4659.0, 1884.0, 5576.0, 8336.0], index=LOAD_CAPIQ_CAT_A_INDEX ), int_exp=pd.Series( [484.0, 507.0, 503.0, 531.0, 404.0], index=LOAD_CAPIQ_CAT_A_INDEX ), gain_on_sale_invest=pd.Series( [36.0, 176.0, 47.0, 187.0, -29.0], index=LOAD_CAPIQ_CAT_A_INDEX ), gain_on_sale_asset=pd.Series( [0.0, 0.0, 0.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), impairment=pd.Series( [0.0, 0.0, 595.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), ebt=pd.Series( [3160.0, 3439.0, 133.0, 4098.0, 7846.0], index=LOAD_CAPIQ_CAT_A_INDEX ), tax_exp=pd.Series( [692.0, 916.0, 192.0, 3339.0, 1698.0], index=LOAD_CAPIQ_CAT_A_INDEX ), net_income=pd.Series( [2452.0, 2512.0, -67.0, 754.0, 6147.0], index=LOAD_CAPIQ_CAT_A_INDEX ), cash=pd.Series( [6317.0, 5340.0, 5257.0, 7381.0, 6968.0], index=LOAD_CAPIQ_CAT_A_INDEX ), st_invest=pd.Series( [0.0, 0.0, 0.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), cash_and_st_invest=pd.Series( [6317.0, 5340.0, 5257.0, 7381.0, 6968.0], index=LOAD_CAPIQ_CAT_A_INDEX ), receivables=pd.Series( [7699.0, 6677.0, 5919.0, 7376.0, 8714.0], index=LOAD_CAPIQ_CAT_A_INDEX ), inventory=pd.Series( [12205.0, 9700.0, 8614.0, 10018.0, 11529.0], index=LOAD_CAPIQ_CAT_A_INDEX ), def_tax_st=pd.Series( [1644.0, 0.0, 0.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), other_current_assets=pd.Series( [27.0, 14.0, 23.0, 48.0, 19.0], index=LOAD_CAPIQ_CAT_A_INDEX ), total_current_assets=pd.Series( [38867.0, 33508.0, 31967.0, 36244.0, 38603.0], index=LOAD_CAPIQ_CAT_A_INDEX ), gross_ppe=pd.Series( [31572.0, 31977.0, 31940.0, 31538.0, 29781.0], index=LOAD_CAPIQ_CAT_A_INDEX ), dep=pd.Series( [14995.0, 15887.0, 16618.0, 17383.0, 16207.0], index=LOAD_CAPIQ_CAT_A_INDEX ), net_ppe=pd.Series( [16577.0, 16090.0, 15322.0, 14155.0, 13574.0], index=LOAD_CAPIQ_CAT_A_INDEX ), goodwill=pd.Series( [6677.0, 6598.0, 6003.0, 6183.0, 6217.0], index=LOAD_CAPIQ_CAT_A_INDEX ), lt_invest=pd.Series( [257.0, 246.0, 249.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), def_tax_lt=pd.Series( [1267.0, 2367.0, 2683.0, 1569.0, 1363.0], index=LOAD_CAPIQ_CAT_A_INDEX ), other_lt_assets=pd.Series( [528.0, 1874.0, 1529.0, 950.0, 962.0], index=LOAD_CAPIQ_CAT_A_INDEX ), total_non_current_assets=pd.Series( [25306.0, 27175.0, 25786.0, 22857.0, 22116.0], index=LOAD_CAPIQ_CAT_A_INDEX ), total_assets=pd.Series( [84681.0, 78342.0, 74704.0, 76962.0, 78509.0], index=LOAD_CAPIQ_CAT_A_INDEX ), payables=pd.Series( [6515.0, 5023.0, 4614.0, 6487.0, 7051.0], index=LOAD_CAPIQ_CAT_A_INDEX ), st_debt=pd.Series( [9.0, 9.0, 209.0, 1.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), current_lt_debt=pd.Series( [510.0, 517.0, 507.0, 6.0, 10.0], index=LOAD_CAPIQ_CAT_A_INDEX ), tax_liab_st=pd.Series( [414.0, 0.0, 0.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), other_current_liab=pd.Series( [4004.0, 2955.0, 3377.0, 3424.0, 3735.0], index=LOAD_CAPIQ_CAT_A_INDEX ), total_current_liab=pd.Series( [27877.0, 26242.0, 26132.0, 26931.0, 28218.0], index=LOAD_CAPIQ_CAT_A_INDEX ), lt_debt=pd.Series( [9408.0, 8883.0, 8368.0, 7492.0, 7549.0], index=LOAD_CAPIQ_CAT_A_INDEX ), total_debt=pd.Series( [39293.0, 38017.0, 36784.0, 34880.0, 36593.0], index=LOAD_CAPIQ_CAT_A_INDEX ), deferred_rev=pd.Series( [0.0, 0.0, 0.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), tax_liab_lt=pd.Series( [414.0, 0.0, 0.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), deposit_liab=pd.Series( [0.0, 0.0, 0.0, 0.0, 0.0], index=LOAD_CAPIQ_CAT_A_INDEX ), other_lt_liab=pd.Series( [2817.0, 3203.0, 3184.0, 3657.0, 3319.0], index=LOAD_CAPIQ_CAT_A_INDEX ), total_non_current_liab=pd.Series( [12639.0, 12086.0, 11552.0, 11149.0, 10868.0], index=LOAD_CAPIQ_CAT_A_INDEX ), total_liab=pd.Series( [67855.0, 63457.0, 61491.0, 63196.0, 64429.0], index=LOAD_CAPIQ_CAT_A_INDEX ), common_stock=pd.Series( [5016.0, 5238.0, 5277.0, 5593.0, 5827.0], index=LOAD_CAPIQ_CAT_A_INDEX ), other_income=pd.Series( [-6431.0, -2035.0, -2039.0, -1192.0, -1684.0], index=LOAD_CAPIQ_CAT_A_INDEX ), retained_earnings=pd.Series( [33887.0, 29246.0, 27377.0, 26301.0, 30427.0], index=LOAD_CAPIQ_CAT_A_INDEX ), minority_interest=pd.Series( [80.0, 76.0, 76.0, 69.0, 41.0], index=LOAD_CAPIQ_CAT_A_INDEX ), total_equity=pd.Series( [16826.0, 14885.0, 13213.0, 13766.0, 14080.0], index=LOAD_CAPIQ_CAT_A_INDEX ), total_liab_and_equity=pd.Series( [84681.0, 78342.0, 74704.0, 76962.0, 78509.0], index=LOAD_CAPIQ_CAT_A_INDEX ), )
30.150685
144
0.5864
1,138
6,603
3.140598
0.245167
0.045887
0.058758
0.064913
0.535255
0.511192
0.496083
0.415501
0.297706
0.22188
0
0.260094
0.261093
6,603
218
145
30.288991
0.472433
0
0
0.539171
0
0
0.014387
0
0
0
0
0
0
1
0
false
0
0.004608
0
0.004608
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
0
0
0
0
0
0
0
0
2
59c49f6515b3e511d038e69f8c8d925051497af1
282
py
Python
modules/dbnd/src/dbnd/_vendor/croniter/tests/base.py
ipattarapong/dbnd
7bd65621c46c73e078eb628f994127ad4c7dbd1a
[ "Apache-2.0" ]
224
2020-01-02T10:46:37.000Z
2022-03-02T13:54:08.000Z
modules/dbnd/src/dbnd/_vendor/croniter/tests/base.py
ipattarapong/dbnd
7bd65621c46c73e078eb628f994127ad4c7dbd1a
[ "Apache-2.0" ]
16
2020-03-11T09:37:58.000Z
2022-01-26T10:22:08.000Z
modules/dbnd/src/dbnd/_vendor/croniter/tests/base.py
ipattarapong/dbnd
7bd65621c46c73e078eb628f994127ad4c7dbd1a
[ "Apache-2.0" ]
24
2020-03-24T13:53:50.000Z
2022-03-22T11:55:18.000Z
try: import unittest2 as unittest except ImportError: import unittest class TestCase(unittest.TestCase): ''' We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. ''' # vim:set ft=python:
20.142857
66
0.695035
41
282
4.780488
0.804878
0
0
0
0
0
0
0
0
0
0
0.004651
0.237589
282
13
67
21.692308
0.906977
0.496454
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.6
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
59cc6a480edbd2cd4d420d7b304beec43816da98
292
py
Python
ABC_A/ABC159_A.py
ryosuke0825/atcoder_python
185cdbe7db44ecca1aaf357858d16d31ce515ddb
[ "MIT" ]
null
null
null
ABC_A/ABC159_A.py
ryosuke0825/atcoder_python
185cdbe7db44ecca1aaf357858d16d31ce515ddb
[ "MIT" ]
null
null
null
ABC_A/ABC159_A.py
ryosuke0825/atcoder_python
185cdbe7db44ecca1aaf357858d16d31ce515ddb
[ "MIT" ]
null
null
null
import math n, m = map(int, input().split()) ans_n = 0 if n <= 1: ans_n = 0 else: ans_n = math.factorial(n)//(math.factorial(n-2)*math.factorial(2)) ans_m = 0 if m <= 1: ans_m = 0 else: ans_m = math.factorial(m)//(math.factorial(m-2)*math.factorial(2)) print(ans_n+ans_m)
16.222222
70
0.613014
57
292
3
0.280702
0.45614
0.05848
0.175439
0
0
0
0
0
0
0
0.042373
0.191781
292
17
71
17.176471
0.682203
0
0
0.461538
0
0
0
0
0
0
0
0
0
1
0
false
0
0.076923
0
0.076923
0.076923
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
59cde84d62c301e6d47391eb096662b7e78686f9
1,270
py
Python
cloudbaseinit/conf/base.py
andia10240/cloudbase-init
3c290194c139990f2a0e5747aa2f6c9554d26659
[ "Apache-2.0" ]
160
2015-01-09T14:45:59.000Z
2022-03-15T09:15:12.000Z
cloudbaseinit/conf/base.py
andia10240/cloudbase-init
3c290194c139990f2a0e5747aa2f6c9554d26659
[ "Apache-2.0" ]
95
2015-01-25T15:22:05.000Z
2022-03-16T10:40:27.000Z
cloudbaseinit/conf/base.py
andia10240/cloudbase-init
3c290194c139990f2a0e5747aa2f6c9554d26659
[ "Apache-2.0" ]
86
2015-01-19T17:19:35.000Z
2022-03-24T09:21:55.000Z
# Copyright 2016 Cloudbase Solutions Srl # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc import six @six.add_metaclass(abc.ABCMeta) class Options(object): """Contact class for all the collections of config options.""" def __init__(self, config, group="DEFAULT"): self._config = config self._group_name = group @property def group_name(self): """The group name for the current options.""" return self._group_name @abc.abstractmethod def register(self): """Register the current options to the global ConfigOpts object.""" pass @abc.abstractmethod def list(self): """Return a list which contains all the available options.""" pass
29.534884
78
0.687402
171
1,270
5.040936
0.555556
0.069606
0.030162
0.037123
0
0
0
0
0
0
0
0.008222
0.233858
1,270
42
79
30.238095
0.877698
0.633071
0
0.25
0
0
0.016166
0
0
0
0
0
0
1
0.25
false
0.125
0.125
0
0.5
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
0
0
0
2