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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eb92d2ae44991fc03f24fd6394cb7dcb73d9c217 | 365 | py | Python | tabint/import.py | KienVu2368/taproc | 47752c367eefb42bf52876c30e9e9e6085029465 | [
"MIT"
] | 3 | 2019-02-07T14:37:08.000Z | 2020-01-23T12:54:46.000Z | tabint/import.py | KienVu2368/taproc | 47752c367eefb42bf52876c30e9e9e6085029465 | [
"MIT"
] | 5 | 2020-07-25T09:33:19.000Z | 2020-07-25T09:39:15.000Z | tabint/import.py | KienVu2368/taproc | 47752c367eefb42bf52876c30e9e9e6085029465 | [
"MIT"
] | 2 | 2019-09-16T07:43:10.000Z | 2019-10-31T08:46:38.000Z | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/05_import.ipynb (unless otherwise specified).
__all__ = []
# Cell
import tabint
from .utils import *
from .dataset import *
from .feature import *
from .pre_processing import *
from .visual import *
from .learner import *
from .interpretation import *
from .inference import *
from .stat import *
from .eda import * | 22.8125 | 93 | 0.745205 | 49 | 365 | 5.428571 | 0.571429 | 0.338346 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006557 | 0.164384 | 365 | 16 | 94 | 22.8125 | 0.865574 | 0.263014 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.916667 | 0 | 0.916667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
eb946da37585e15cec66c756085aeca39aa6a6fa | 835 | py | Python | lesson8/SoccerPlayer.py | vinaymayar/python-game-workshop | e990f51815c2080a0d702c9d90dac8e8c2a35d45 | [
"MIT"
] | 1 | 2016-10-11T19:27:08.000Z | 2016-10-11T19:27:08.000Z | lesson8/SoccerPlayer.py | vinaymayar/python-game-workshop | e990f51815c2080a0d702c9d90dac8e8c2a35d45 | [
"MIT"
] | null | null | null | lesson8/SoccerPlayer.py | vinaymayar/python-game-workshop | e990f51815c2080a0d702c9d90dac8e8c2a35d45 | [
"MIT"
] | null | null | null | # Exercise 5
#
# We will define a new object, SoccerPlayer
# 1) Think about what data attributes define a soccer player in real life
# Examples include: name, age, position, goals scored
# Feel free to be creative!
# 2) Write the __init__ method for SoccerPlayer
# 3) Write the getters and setters for SoccerPlayer
# 4) Think about what actions and behaviors define a soccer player
# Examples include: scoring goal, playing soccer match
# Again, feel free to be creative!
# 5) Write at least two methods for SoccerPlayer
#
# Feel free to look at Car.py or Classes.py for help!
# Now, we will create a new instance of SoccerPlayer
# 1) Run SoccerPlayer.py
# 2) Create a new instance of SoccerPlayer in the Python shell
# 3) Test the methods of SoccerPlayer
class SoccerPlayer():
pass
| 36.304348 | 75 | 0.716168 | 126 | 835 | 4.714286 | 0.555556 | 0.035354 | 0.050505 | 0.063973 | 0.175084 | 0.107744 | 0 | 0 | 0 | 0 | 0 | 0.014019 | 0.231138 | 835 | 22 | 76 | 37.954545 | 0.911215 | 0.916168 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
eb9eb4540a3afa223765229540d8aa090829ec9f | 172 | py | Python | flask_service/my_app/tests/test_views.py | mwprog/atomist-flask-microservice | 65a18a0f149bf30af3cb5f9eb0818aa784901ade | [
"Apache-2.0"
] | null | null | null | flask_service/my_app/tests/test_views.py | mwprog/atomist-flask-microservice | 65a18a0f149bf30af3cb5f9eb0818aa784901ade | [
"Apache-2.0"
] | 6 | 2018-06-06T20:00:46.000Z | 2018-06-08T14:19:55.000Z | flask_service/my_app/tests/test_views.py | mwprog/atomist-flask-microservice | 65a18a0f149bf30af3cb5f9eb0818aa784901ade | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from flask import url_for
def test_my_app_index(client):
res = client.get(url_for('my_app_app.index'))
assert res.data == b'Hello World!'
| 21.5 | 49 | 0.674419 | 29 | 172 | 3.758621 | 0.724138 | 0.110092 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006993 | 0.168605 | 172 | 7 | 50 | 24.571429 | 0.755245 | 0.122093 | 0 | 0 | 0 | 0 | 0.187919 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ebd9896d77040dbb7f1c68d2f92d6dc0bb82146c | 473 | py | Python | nebbdyrclass.py | Caronthir/Nebbdyr | 1f71751e01c4f17e1ae91af17a07270cb630ef08 | [
"MIT"
] | 1 | 2018-04-30T10:53:02.000Z | 2018-04-30T10:53:02.000Z | nebbdyrclass.py | Caronthir/Nebbdyr | 1f71751e01c4f17e1ae91af17a07270cb630ef08 | [
"MIT"
] | null | null | null | nebbdyrclass.py | Caronthir/Nebbdyr | 1f71751e01c4f17e1ae91af17a07270cb630ef08 | [
"MIT"
] | null | null | null | from nebbdyrinstance import NebbdyrInstance
class NebbdyrClass:
def __init__(self, name, methods):
self.name = name
self.methods = methods
def find_method(self, instance, name):
if name in self.methods:
return self.methods[name]
def __str__(self):
return self.name
def call(self, interpreter, arguments):
instance = NebbdyrInstance(self)
return instance
def arity(self):
return 0
| 22.52381 | 43 | 0.638478 | 53 | 473 | 5.528302 | 0.415094 | 0.081911 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002967 | 0.287526 | 473 | 20 | 44 | 23.65 | 0.866469 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.066667 | 0.133333 | 0.733333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ebe2803b504134ed54ec909b7ab4923215ab6cd1 | 214 | py | Python | zucaml/global_vars.py | GustavoBMG/earthquake-prediction | a3278bb22385c78013269356990a60d60aba50f1 | [
"MIT"
] | 1 | 2021-11-09T20:16:31.000Z | 2021-11-09T20:16:31.000Z | zucaml/global_vars.py | GustavoBMG/earthquake-prediction | a3278bb22385c78013269356990a60d60aba50f1 | [
"MIT"
] | null | null | null | zucaml/global_vars.py | GustavoBMG/earthquake-prediction | a3278bb22385c78013269356990a60d60aba50f1 | [
"MIT"
] | null | null | null | from enum import Enum, IntEnum
problems = IntEnum('Problems', 'REGRESSION BINARY BINARY_AUTENC BINARY_CONV') #threshold, multiclass, multilabel zero-inflated
cv_strategies = IntEnum('CV_Strategies', 'KFOLD TIME') | 42.8 | 126 | 0.799065 | 26 | 214 | 6.423077 | 0.692308 | 0.179641 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102804 | 214 | 5 | 127 | 42.8 | 0.869792 | 0.219626 | 0 | 0 | 0 | 0 | 0.443114 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ebe427ca2529dfa3b43eb16ef093aacb90bb91f6 | 71 | py | Python | aula009.py | GuilhermeDallari/desafiomuundo1 | df4e06393970d2b686622d13d0ef433b761164fd | [
"MIT"
] | null | null | null | aula009.py | GuilhermeDallari/desafiomuundo1 | df4e06393970d2b686622d13d0ef433b761164fd | [
"MIT"
] | null | null | null | aula009.py | GuilhermeDallari/desafiomuundo1 | df4e06393970d2b686622d13d0ef433b761164fd | [
"MIT"
] | null | null | null | f = 'curso em video pythonnnnnnnnnn'
print(f.replace('curso', 'penas')) | 35.5 | 36 | 0.71831 | 10 | 71 | 5.1 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.098592 | 71 | 2 | 37 | 35.5 | 0.796875 | 0 | 0 | 0 | 0 | 0 | 0.555556 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
ccee7777587acfcb8dea0f8529cbb1dac1b9cadd | 212 | py | Python | env/lib/python3.6/site-packages/redcmd/subcommand.py | Nyash-Mauro/Instagram-clone | 39f3b660b3bdd59996fa88816712c906d0e3fba5 | [
"MIT"
] | 2 | 2020-04-03T22:15:44.000Z | 2022-02-26T05:22:55.000Z | env/lib/python3.6/site-packages/redcmd/subcommand.py | Nyash-Mauro/Instagram-clone | 39f3b660b3bdd59996fa88816712c906d0e3fba5 | [
"MIT"
] | 6 | 2020-07-06T13:57:54.000Z | 2022-03-12T00:39:23.000Z | my-project-env/lib/python3.6/site-packages/redcmd/subcommand.py | wizzicollo/animated-fiesta | 92a449b4b632ece5a5c73b5344cafe02d8872586 | [
"MIT"
] | null | null | null | __all__ = ['Subcommand']
# placeholder class for subcommand classes to derive from
class Subcommand(object):
pass
# placeholder class for internal subcommand classes
class InternalSubcommand(object):
pass
| 17.666667 | 57 | 0.787736 | 24 | 212 | 6.791667 | 0.541667 | 0.196319 | 0.233129 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150943 | 212 | 11 | 58 | 19.272727 | 0.905556 | 0.495283 | 0 | 0.4 | 0 | 0 | 0.096154 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.4 | 0 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
ccf63f15bdadfea0e8aa74651efef5f721a43d06 | 5,712 | py | Python | Python/Tetris/tetris.py | qiaw99/selflerning | c6d78b41770670057dc79f1146f638948b7a1e46 | [
"MIT"
] | 1 | 2019-09-23T08:05:45.000Z | 2019-09-23T08:05:45.000Z | Python/Tetris/tetris.py | qiaw99/selflerning | c6d78b41770670057dc79f1146f638948b7a1e46 | [
"MIT"
] | 1 | 2019-09-07T13:20:43.000Z | 2019-09-07T13:20:43.000Z | Python/Tetris/tetris.py | qiaw99/selflerning | c6d78b41770670057dc79f1146f638948b7a1e46 | [
"MIT"
] | null | null | null | import turtle
import time
import random
wn = turtle.Screen()
wn.title("TETRIS by @qiaw99")
wn.bgcolor("black")
wn.setup(width = 600, height = 800)
wn.tracer(0)
delay = 0.05
class Shape():
def __init__(self):
self.x = 5
self.y = 0
self.color = random.randint(1, 7)
# Block Shape
square = [[1,1],
[1,1]]
horizontal_line = [[1,1,1,1]]
vertical_line = [[1],
[1],
[1],
[1]]
left_l = [[1,0,0,0],
[1,1,1,1]]
right_l = [[0,0,0,1],
[1,1,1,1]]
left_s = [[1,1,0],
[0,1,1]]
right_s = [[0,1,1],
[1,1,0]]
t = [[0,1,0],
[1,1,1]]
shapes = [square, horizontal_line, vertical_line, left_l, right_l, left_s, right_s, t]
# Choose a random shape each time
self.shape = random.choice(shapes)
self.height = len(self.shape)
self.width = len(self.shape[0])
# print(self.height, self.width)
def move_left(self, grid):
if self.x > 0:
if grid[self.y][self.x - 1] == 0:
self.erase_shape(grid)
self.x -= 1
def move_right(self, grid):
if self.x < 12 - self.width:
if grid[self.y][self.x + self.width] == 0:
self.erase_shape(grid)
self.x += 1
def draw_shape(self, grid):
for y in range(self.height):
for x in range(self.width):
if(self.shape[y][x]==1):
grid[self.y + y][self.x + x] = self.color
def erase_shape(self, grid):
for y in range(self.height):
for x in range(self.width):
if(self.shape[y][x]==1):
grid[self.y + y][self.x + x] = 0
def can_move(self, grid):
result = True
for x in range(self.width):
# Check if bottom is a 1
if(self.shape[self.height-1][x] == 1):
if(grid[self.y + self.height][self.x + x] != 0):
result = False
return result
grid = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
]
# Create the drawing pen
pen = turtle.Turtle()
pen.penup()
pen.speed(0)
pen.shape("square")
pen.setundobuffer(None)
def draw_grid(pen, grid):
pen.clear()
top = 230
left = -110
colors = ["black", "lightblue", "blue", "orange", "yellow", "green", "purple", "red"]
for y in range(len(grid)):
for x in range(len(grid[0])):
screen_x = left + (x * 20)
screen_y = top - (y * 20)
color_number = grid[y][x]
color = colors[color_number]
pen.color(color)
pen.goto(screen_x, screen_y)
pen.stamp()
def check_grid(grid):
# Check if each row is full
y = 23
while y > 0:
is_full = True
for x in range(0, 12):
if grid[y][x] == 0:
is_full = False
y -= 1
break
if is_full:
global score
score += 10
draw_score(pen, score)
for copy_y in range(y, 0, -1):
for copy_x in range(0, 12):
grid[copy_y][copy_x] = grid[copy_y-1][copy_x]
def draw_score(pen, score):
pen.hideturtle()
pen.goto(-75, 350)
pen.write("Score: {}".format(score), move=False, align="left", font=("Arial", 24, "normal"))
pen.showturtle()
# Create the basic shape for the start of the game
shape = Shape()
# Put the shape in the grid
grid[shape.y][shape.x] = shape.color
# Draw the initial grid
# draw_grid(pen, grid)
wn.listen()
wn.onkeypress(lambda: shape.move_left(grid), "a")
wn.onkeypress(lambda: shape.move_right(grid), "d")
# Set the score to 0
score = 0
draw_score(pen, score)
# Main game loop
while True:
wn.update()
# Move the shape
# Open Row
# Check for the bottom
if shape.y == 23 - shape.height + 1:
shape = Shape()
check_grid(grid)
# Check for collision with next row
elif shape.can_move(grid):
# Erase the current shape
shape.erase_shape(grid)
# Move the shape by 1
shape.y +=1
# Draw the shape again
shape.draw_shape(grid)
else:
shape = Shape()
check_grid(grid)
# Draw the screen
draw_score(pen, score)
draw_grid(pen, grid)
time.sleep(delay)
wn.mainloop()
| 26.082192 | 96 | 0.445728 | 920 | 5,712 | 2.709783 | 0.147826 | 0.234256 | 0.34657 | 0.45728 | 0.315283 | 0.231849 | 0.210991 | 0.205375 | 0.205375 | 0.182912 | 0 | 0.116805 | 0.38848 | 5,712 | 218 | 97 | 26.201835 | 0.596908 | 0.080182 | 0 | 0.291391 | 0 | 0 | 0.018727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.059603 | false | 0 | 0.019868 | 0 | 0.092715 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6900302c9b66815f38f2108183aae6bcda2372a2 | 1,802 | py | Python | stock-filters/Buildings/flowers.py | Chris-Drury/caMelGDMC | b7498fedb57837b18bbf172e3f34bc285559e3dd | [
"0BSD"
] | null | null | null | stock-filters/Buildings/flowers.py | Chris-Drury/caMelGDMC | b7498fedb57837b18bbf172e3f34bc285559e3dd | [
"0BSD"
] | null | null | null | stock-filters/Buildings/flowers.py | Chris-Drury/caMelGDMC | b7498fedb57837b18bbf172e3f34bc285559e3dd | [
"0BSD"
] | null | null | null | from Buildings.material import AIR, GRASS, TRAPDOOR, WALL_SIGN, FLOWER
temp = "placeholder"
selections = FLOWER.values()
flowers_template = [
[
[AIR, GRASS, GRASS, GRASS, AIR, GRASS],
[AIR, AIR, GRASS, GRASS, GRASS, GRASS],
[GRASS, GRASS, GRASS, GRASS, GRASS, AIR],
[GRASS, GRASS, GRASS, GRASS, AIR, GRASS],
[GRASS, GRASS, GRASS, GRASS, GRASS, AIR],
[AIR, GRASS, AIR, GRASS, GRASS, GRASS],
],
[
[AIR, AIR, AIR, AIR, AIR, AIR],
[AIR, AIR, TRAPDOOR["S"], TRAPDOOR["S"], AIR, AIR],
[AIR, TRAPDOOR["E"], GRASS, GRASS, TRAPDOOR["W"], AIR],
[AIR, TRAPDOOR["E"], GRASS, GRASS, TRAPDOOR["W"], AIR],
[AIR, AIR, TRAPDOOR["N"], TRAPDOOR["N"], AIR, AIR],
[AIR, AIR, AIR, AIR, AIR, AIR],
],
[
[AIR, AIR, AIR, AIR, AIR, AIR],
[AIR, AIR, AIR, AIR, AIR, AIR],
[AIR, AIR, temp, temp, AIR, AIR],
[AIR, AIR, temp, temp, AIR, AIR],
[AIR, AIR, AIR, AIR, AIR, AIR],
[AIR, AIR, AIR, AIR, AIR, AIR],
]
]
def generate_flowers():
"""This function will generate a list of flower plots made from different types of flowers"""
flowers = []
for selection in selections:
new_flower = []
for floor in flowers_template:
new_floor = []
for row in floor:
new_row = []
for item in row:
if item == temp:
new_row.append(selection)
else:
new_row.append(item)
new_floor.append(new_row)
new_flower.append(new_floor)
new_blueprint = {
"height": -1,
"building": new_flower
}
flowers.append(new_blueprint)
return flowers
| 31.614035 | 97 | 0.513873 | 210 | 1,802 | 4.333333 | 0.22381 | 0.336264 | 0.415385 | 0.474725 | 0.431868 | 0.374725 | 0.374725 | 0.357143 | 0.303297 | 0.230769 | 0 | 0.000847 | 0.345172 | 1,802 | 56 | 98 | 32.178571 | 0.770339 | 0.04828 | 0 | 0.28 | 0 | 0 | 0.01931 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.02 | false | 0 | 0.02 | 0 | 0.06 | 0.04 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
69156ded65eebab45eed56505a7b61f41deabdc2 | 1,347 | py | Python | align/users/migrations/0002_auto_20200228_2126.py | CMPUT-404/Old-Repo-Cloud-Align | 1b692e60b94aeacd48c812be83273e4755df0406 | [
"Apache-2.0"
] | null | null | null | align/users/migrations/0002_auto_20200228_2126.py | CMPUT-404/Old-Repo-Cloud-Align | 1b692e60b94aeacd48c812be83273e4755df0406 | [
"Apache-2.0"
] | 44 | 2020-01-28T20:14:30.000Z | 2020-01-30T04:04:14.000Z | align/users/migrations/0002_auto_20200228_2126.py | CMPUT-404/Old-Repo-Cloud-Align | 1b692e60b94aeacd48c812be83273e4755df0406 | [
"Apache-2.0"
] | 2 | 2020-01-21T19:48:05.000Z | 2020-01-21T19:48:29.000Z | # Generated by Django 2.1.5 on 2020-02-28 21:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='user',
name='bio',
field=models.TextField(blank=True, max_length=500, null=True),
),
migrations.AlterField(
model_name='user',
name='displayName',
field=models.CharField(blank=True, default='<django.db.models.fields.CharField> <django.db.models.fields.CharField>', max_length=40, null=True),
),
migrations.AlterField(
model_name='user',
name='firstName',
field=models.CharField(blank=True, max_length=20, null=True),
),
migrations.AlterField(
model_name='user',
name='github',
field=models.URLField(blank=True, null=True),
),
migrations.AlterField(
model_name='user',
name='host',
field=models.URLField(blank=True, default='127.0.0.1:8000', null=True),
),
migrations.AlterField(
model_name='user',
name='lastName',
field=models.CharField(blank=True, max_length=20, null=True),
),
]
| 30.613636 | 156 | 0.564217 | 140 | 1,347 | 5.35 | 0.364286 | 0.160214 | 0.200267 | 0.23231 | 0.658211 | 0.46729 | 0.417891 | 0.417891 | 0.128171 | 0.128171 | 0 | 0.040512 | 0.303638 | 1,347 | 43 | 157 | 31.325581 | 0.757996 | 0.033408 | 0 | 0.540541 | 1 | 0.027027 | 0.128462 | 0.053846 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.027027 | 0 | 0.108108 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6934e4b35d9deb734ca4d0f2a8d148f065e4e3c0 | 12,634 | py | Python | multidim_image_augmentation/python/kernel_tests/apply_deformation_op_test.py | zhongzisha/multidim-image-augmentation | 4927015902fd20d395b5a1fe1b4caab2278e52ea | [
"Apache-2.0"
] | 122 | 2018-11-30T13:07:35.000Z | 2022-01-27T13:25:32.000Z | multidim_image_augmentation/python/kernel_tests/apply_deformation_op_test.py | zhongzisha/multidim-image-augmentation | 4927015902fd20d395b5a1fe1b4caab2278e52ea | [
"Apache-2.0"
] | 20 | 2018-12-26T04:30:32.000Z | 2021-02-04T13:52:32.000Z | multidim_image_augmentation/python/kernel_tests/apply_deformation_op_test.py | LaudateCorpus1/multidim-image-augmentation | 7a180ec02fba2aac98f89cfff6fa6b647484d7cc | [
"Apache-2.0"
] | 25 | 2018-11-30T13:08:32.000Z | 2022-02-04T17:55:20.000Z | # Lint as: python2, python3
# Copyright 2018 Google LLC
#
# 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
#
# https://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 __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import range
import tensorflow.compat.v1 as tf
from multidim_image_augmentation import augmentation_ops
class ApplyDeformation2DTest(tf.test.TestCase):
def test_IdentityTransform(self):
with self.session():
src = np.random.random([10, 7, 3]).astype(np.float32)
deformation = np.ndarray([10, 7, 2], dtype=np.float32)
for x0 in range(deformation.shape[0]):
for x1 in range(deformation.shape[1]):
deformation[x0, x1, 0] = x0
deformation[x0, x1, 1] = x1
result = augmentation_ops.apply_deformation2d(
src, deformation, [])
self.assertEqual(result.get_shape(), src.shape)
trg = result.eval()
self.assertAllEqual(trg, src)
def test_ExtrapolationMirror(self):
with self.session():
src = np.array([[[0], [1], [2], [3], [4]]]).astype(np.float32)
deform = np.array([[[0, -10], [0, -9], [0, -8], [0, -7], [0, -6],
[0, -5], [0, -4], [0, -3], [0, -2], [0, -1], [0, 0],
[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6],
[0, 7], [0, 8], [0, 9], [0, 10]]]).astype(np.float32)
trg = augmentation_ops.apply_deformation2d(
src, deform, []).eval()
self.assertAllEqual(
np.array([[[2], [1], [0], [1], [2], [3], [4], [3], [2], [1], [0],
[1], [2], [3], [4], [3], [2], [1], [0], [1], [2]]]), trg)
def test_ExtrapolationZero(self):
with self.session():
src = np.array([[[10], [11], [12], [13], [14]]]).astype(np.float32)
deform = np.array([[[0, -10], [0, -9], [0, -8], [0, -7], [0, -6],
[0, -5], [0, -4], [0, -3], [0, -2], [0, -1], [0, 0],
[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6],
[0, 7], [0, 8], [0, 9], [0, 10]]]).astype(np.float32)
# padding is not used but should not fail the test.
padding = np.array([42])
trg = augmentation_ops.apply_deformation2d(
src, deform, padding, extrapolation="zero_padding").eval()
self.assertAllEqual(
np.array([[[0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [10],
[11], [12], [13], [14], [0], [0], [0], [0], [0], [0]]]),
trg)
def test_ExtrapolationZeroMultichannel(self):
with self.session():
src = np.array([[[10, 9, 8, 7], [11, 10, 9, 8], [12, 11, 10, 9],
[13, 12, 11, 10], [14, 13, 12, 11]]]).astype(np.float32)
deform = np.array([[[0, -10], [0, -9], [0, -8], [0, -7], [0, -6],
[0, -5], [0, -4], [0, -3], [0, -2], [0, -1], [0, 0],
[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6],
[0, 7], [0, 8], [0, 9], [0, 10]]]).astype(np.float32)
trg = augmentation_ops.apply_deformation2d(
src, deform, [], extrapolation="zero_padding").eval()
self.assertAllEqual(
np.array([[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],
[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],
[0, 0, 0, 0], [0, 0, 0, 0], [10, 9, 8, 7], [11, 10, 9, 8],
[12, 11, 10, 9], [13, 12, 11, 10], [14, 13, 12, 11],
[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],
[0, 0, 0, 0], [0, 0, 0, 0]]]), trg)
def test_ExtrapolationConst(self):
with self.session():
src = np.array([[[10], [11], [12], [13], [14]]]).astype(np.float32)
deform = np.array([[[0, -10], [0, -9], [0, -8], [0, -7], [0, -6],
[0, -5], [0, -4], [0, -3], [0, -2], [0, -1], [0, 0],
[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6],
[0, 7], [0, 8], [0, 9], [0, 10]]]).astype(np.float32)
trg = augmentation_ops.apply_deformation2d(
src,
deform,
padding_constant=np.array([42]),
extrapolation="const_padding").eval()
self.assertAllEqual(
np.array([[[42], [42], [42], [42], [42], [42], [42], [42], [42],
[42], [10], [11], [12], [13], [14], [42], [42], [42],
[42], [42], [42]]]), trg)
def test_ExtrapolationConstMultichannel(self):
with self.session():
src = np.array([[[10, 9, 8, 7], [11, 10, 9, 8], [12, 11, 10, 9],
[13, 12, 11, 10], [14, 13, 12, 11]]]).astype(np.float32)
deform = np.array([[[0, -10], [0, -9], [0, -8], [0, -7], [0, -6],
[0, -5], [0, -4], [0, -3], [0, -2], [0, -1], [0, 0],
[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6],
[0, 7], [0, 8], [0, 9], [0, 10]]]).astype(np.float32)
trg = augmentation_ops.apply_deformation2d(
src,
deform,
extrapolation="const_padding",
padding_constant=np.array([1, 2, 3, 4])).eval()
self.assertAllEqual(
np.array([[[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4],
[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4],
[1, 2, 3, 4], [1, 2, 3, 4], [10, 9, 8, 7], [11, 10, 9, 8],
[12, 11, 10, 9], [13, 12, 11, 10], [14, 13, 12, 11],
[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4],
[1, 2, 3, 4], [1, 2, 3, 4]]]), trg)
class ApplyDeformation3DTest(tf.test.TestCase):
def test_IdentityTransform(self):
with self.session():
src = np.random.random([4, 10, 7, 3]).astype(np.float32)
deformation = np.ndarray([4, 10, 7, 3], dtype=np.float32)
for x0 in range(deformation.shape[0]):
for x1 in range(deformation.shape[1]):
for x2 in range(deformation.shape[2]):
deformation[x0, x1, x2, 0] = x0
deformation[x0, x1, x2, 1] = x1
deformation[x0, x1, x2, 2] = x2
result = augmentation_ops.apply_deformation3d(
src, deformation, [])
self.assertEqual(result.get_shape(), src.shape)
trg = result.eval()
self.assertAllEqual(trg, src)
def test_InterpolationNearest(self):
with self.session():
src = np.array([[[[0], [10], [20], [30]]]]).astype(np.float32)
deform = np.array([[[[0, 0, 0.5], [0, 0, 2.7]]]]).astype(np.float32)
trg = augmentation_ops.apply_deformation3d(
src, deform, [], interpolation="nearest").eval()
self.assertAllEqual(
np.array([[[[10], [30]]]]), trg)
def test_InterpolationMixedNearestLinear(self):
with self.session():
src = np.array([[[[0], [10], [20], [30]]],
[[[5], [15], [25], [35]]]]).astype(np.float32)
deform = np.array([[[[0, 0, 0.5], [0, 0, 2.7]],
[[0, 1, 1.5], [1, 0, 2.1]]]]).astype(np.float32)
trg = augmentation_ops.apply_deformation3d(
src,
deform, [],
interpolation="mixed_nearest_linear",
extrapolation="zero_padding").eval()
self.assertAllClose(np.array([[[[5], [27]], [[0], [26]]]]), trg)
def test_ExtrapolationMirror(self):
with self.session():
src = np.array([[[[0], [1], [2], [3], [4]]]]).astype(np.float32)
deform = np.array([[[[0, 0, -10], [0, 0, -9], [0, 0, -8], [0, 0, -7],
[0, 0, -6], [0, 0, -5], [0, 0, -4], [0, 0, -3],
[0, 0, -2], [0, 0, -1], [0, 0, 0], [0, 0, 1],
[0, 0, 2], [0, 0, 3], [0, 0, 4], [0, 0, 5],
[0, 0, 6], [0, 0, 7], [0, 0, 8], [0, 0, 9],
[0, 0, 10]]]]).astype(np.float32)
trg = augmentation_ops.apply_deformation3d(
src, deform, []).eval()
self.assertAllEqual(
np.array([[[[2], [1], [0], [1], [2], [3], [4], [3], [2], [1], [0],
[1], [2], [3], [4], [3], [2], [1], [0], [1], [2]]]]), trg)
def test_ExtrapolationZero(self):
with self.session():
src = np.array([[[[10], [11], [12], [13], [14]]]]).astype(np.float32)
deform = np.array([[[[0, 0, -10], [0, 0, -9], [0, 0, -8], [0, 0, -7],
[0, 0, -6], [0, 0, -5], [0, 0, -4], [0, 0, -3],
[0, 0, -2], [0, 0, -1], [0, 0, 0], [0, 0, 1],
[0, 0, 2], [0, 0, 3], [0, 0, 4], [0, 0, 5],
[0, 0, 6], [0, 0, 7], [0, 0, 8], [0, 0, 9],
[0, 0, 10]]]]).astype(np.float32)
# padding is not used but should not fail the test.
padding = np.array([42])
trg = augmentation_ops.apply_deformation3d(
src, deform, padding, extrapolation="zero_padding").eval()
self.assertAllEqual(
np.array([[[[0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [10],
[11], [12], [13], [14], [0], [0], [0], [0], [0], [0]]]]),
trg)
def test_ExtrapolationConst(self):
with self.session():
src = np.array([[[[10], [11], [12], [13], [14]]]]).astype(np.float32)
deform = np.array([[[[0, 0, -10], [0, 0, -9], [0, 0, -8], [0, 0, -7],
[0, 0, -6], [0, 0, -5], [0, 0, -4], [0, 0, -3],
[0, 0, -2], [0, 0, -1], [0, 0, 0], [0, 0, 1],
[0, 0, 2], [0, 0, 3], [0, 0, 4], [0, 0, 5],
[0, 0, 6], [0, 0, 7], [0, 0, 8], [0, 0, 9],
[0, 0, 10]]]]).astype(np.float32)
trg = augmentation_ops.apply_deformation3d(
src,
deform,
padding_constant=np.array([42]),
extrapolation="const_padding").eval()
self.assertAllEqual(
np.array([[[[42], [42], [42], [42], [42], [42], [42], [42], [42],
[42], [10], [11], [12], [13], [14], [42], [42], [42],
[42], [42], [42]]]]), trg)
def test_One_Hot_Encoding(self):
with self.session():
src = np.array([[[[4], [3], [1], [0], [2]]]]).astype(np.float32)
deform = np.array([[[[0, 0, -.5], [0, 0, 0], [0, 0, 0.3], [0, 0, 1],
[0, 0, 1.5], [0, 0, 2.5], [0, 0, 4],
[0, 0, 5]]]]).astype(np.float32)
trg_graph = augmentation_ops.apply_deformation3d(
src,
deform, [],
extrapolation="zero_padding",
conversion="indexed_to_one_hot",
output_num_channels=5)
trg = trg_graph.eval()
self.assertAllEqual([1, 1, 8, 5], trg_graph.shape)
self.assertAllEqual([1, 1, 8, 5], trg.shape)
expected = np.array([[[[0.5, 0, 0, 0, 0.5], [0, 0, 0, 0, 1],
[0, 0, 0, 0.3, 0.7], [0, 0, 0, 1, 0],
[0, 0.5, 0, 0.5, 0], [0.5, 0.5, 0, 0, 0],
[0, 0, 1, 0, 0], [1, 0, 0, 0, 0]]]]).astype(float)
for x2 in range(8):
for ch in range(5):
self.assertAlmostEqual(
expected[0, 0, x2, ch],
trg[0, 0, x2, ch],
msg="expected {}, but got {} at x2={}, ch={}".format(
expected[0, 0, x2, ch], trg[0, 0, x2, ch], x2, ch))
def test_outputSpatialShape(self):
with self.session():
src = np.random.random([4, 10, 7, 3]).astype(np.float32)
deformation = np.ndarray([4, 10, 7, 3], dtype=np.float32)
for x0 in range(deformation.shape[0]):
for x1 in range(deformation.shape[1]):
for x2 in range(deformation.shape[2]):
deformation[x0, x1, x2, 0] = x0
deformation[x0, x1, x2, 1] = x1
deformation[x0, x1, x2, 2] = x2
result = augmentation_ops.apply_deformation3d(
src, deformation, [],
output_spatial_shape=[-1, 6, 5])
self.assertEqual(result.get_shape(), [4, 6, 5, 3])
trg = result.eval()
self.assertAllEqual(trg, src[:, 2:-2, 1:-1, :])
if __name__ == "__main__":
tf.test.main()
| 45.121429 | 80 | 0.449818 | 1,794 | 12,634 | 3.114827 | 0.100334 | 0.076235 | 0.062813 | 0.066571 | 0.773801 | 0.740336 | 0.725841 | 0.698103 | 0.68665 | 0.679671 | 0 | 0.146404 | 0.320959 | 12,634 | 279 | 81 | 45.283154 | 0.504954 | 0.053348 | 0 | 0.640351 | 0 | 0 | 0.015993 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.061404 | false | 0 | 0.030702 | 0 | 0.100877 | 0.004386 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
693d11d6879a02372a283e4fec1c367a390e49b3 | 28 | py | Python | notebooks/_solutions/case4_air_quality_analysis47.py | rprops/Python_DS-WS | b2fc449a74be0c82863e5fcf1ddbe7d64976d530 | [
"BSD-3-Clause"
] | 183 | 2016-08-24T12:32:07.000Z | 2022-03-26T14:05:04.000Z | notebooks/_solutions/case4_air_quality_analysis47.py | rprops/Python_DS-WS | b2fc449a74be0c82863e5fcf1ddbe7d64976d530 | [
"BSD-3-Clause"
] | 1 | 2017-08-28T14:22:40.000Z | 2017-08-28T14:22:40.000Z | notebooks/_solutions/case4_air_quality_analysis47.py | rprops/Python_DS-WS | b2fc449a74be0c82863e5fcf1ddbe7d64976d530 | [
"BSD-3-Clause"
] | 204 | 2016-08-24T14:22:58.000Z | 2022-03-29T15:09:03.000Z | box = data_pivoted.boxplot() | 28 | 28 | 0.785714 | 4 | 28 | 5.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 28 | 1 | 28 | 28 | 0.807692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6964e028b79ca3f9cb5bbe6b93ef5b7f58ff504d | 80 | py | Python | Lib/test/import_star_from_java.py | clach04/bb_import_jython | 4529a0f578186a1c33c476300294ab42658eaf7c | [
"CNRI-Jython"
] | 332 | 2015-08-22T12:43:56.000Z | 2022-03-17T01:05:43.000Z | Lib/test/import_star_from_java.py | clach04/bb_import_jython | 4529a0f578186a1c33c476300294ab42658eaf7c | [
"CNRI-Jython"
] | 36 | 2015-05-30T08:39:19.000Z | 2022-03-04T20:42:33.000Z | Lib/test/import_star_from_java.py | clach04/bb_import_jython | 4529a0f578186a1c33c476300294ab42658eaf7c | [
"CNRI-Jython"
] | 74 | 2015-05-29T17:18:53.000Z | 2022-01-15T14:06:44.000Z | from java.util.regex import *
p = Pattern.compile("foo")
assert p.flags() == 0
| 16 | 29 | 0.675 | 13 | 80 | 4.153846 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014706 | 0.15 | 80 | 4 | 30 | 20 | 0.779412 | 0 | 0 | 0 | 0 | 0 | 0.0375 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
15c6f1cef071a4445d6aa95f8cc2332a9c0930f7 | 87 | py | Python | Practice/FCTRL2.py | anirudhkannanvp/CODECHEF | 6d108058c11207caa2e35e471ba88f84c0ea9774 | [
"MIT"
] | null | null | null | Practice/FCTRL2.py | anirudhkannanvp/CODECHEF | 6d108058c11207caa2e35e471ba88f84c0ea9774 | [
"MIT"
] | null | null | null | Practice/FCTRL2.py | anirudhkannanvp/CODECHEF | 6d108058c11207caa2e35e471ba88f84c0ea9774 | [
"MIT"
] | null | null | null | import math
t=int(input())
while(t):
t=t-1
print(math.factorial(int(input())))
| 14.5 | 39 | 0.62069 | 15 | 87 | 3.6 | 0.6 | 0.296296 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013699 | 0.16092 | 87 | 5 | 40 | 17.4 | 0.726027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
15f984a468e88651f01992f68de543e2d28e019e | 928 | py | Python | rllite/__init__.py | ZJU-RL/zjurl | 6aab83aaba7249bc43d112f21787c45b111d8aa4 | [
"MIT"
] | 3 | 2019-03-07T13:24:21.000Z | 2019-08-08T12:49:51.000Z | rllite/__init__.py | tyGavinZJU/rllite | 5c85eb11babb69a09604a04f0eb7bdc5a96f08f0 | [
"MIT"
] | null | null | null | rllite/__init__.py | tyGavinZJU/rllite | 5c85eb11babb69a09604a04f0eb7bdc5a96f08f0 | [
"MIT"
] | null | null | null | from rllite.Base.Base import Base
from rllite.A2C.A2C import A2C
#from rllite.A3C.A3C import A3C
from rllite.ACER.ACER import ACER
from rllite.CategoricalDQN.CategoricalDQN import CategoricalDQN
from rllite.DDPG.DDPG import DDPG
from rllite.DoubleDQN.DoubleDQN import DoubleDQN
from rllite.DQN.DQN import DQN
from rllite.DuelingDQN.DuelingDQN import DuelingDQN
from rllite.GAIL.GAIL import GAIL
from rllite.HER.HER import HER
from rllite.HierarchicalDQN.HierarchicalDQN import HierarchicalDQN
from rllite.NoisyDQN.NoisyDQN import NoisyDQN
#from rllite.PG.PG import PG
from rllite.PPO.PPO import PPO
from rllite.PrioritizedDQN.PrioritizedDQN import PrioritizedDQN
from rllite.QuantileRegressionDQN.QuantileRegressionDQN import QuantileRegressionDQN
from rllite.RainbowDQN.RainbowDQN import RainbowDQN
from rllite.SAC.SAC import SAC
#from rllite.SQL.SQL import SQL
from rllite.TD3.TD3 import TD3
#from rllite.TRPO.TRPO import TRPO | 42.181818 | 84 | 0.854526 | 132 | 928 | 6.007576 | 0.189394 | 0.277427 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010702 | 0.09375 | 928 | 22 | 85 | 42.181818 | 0.932224 | 0.12931 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
15fb85925640783d729104f9b01645e488352551 | 8,556 | py | Python | tests/unit/test_craps_game_point_on.py | sam0jones0/oo-design | 851ae1129dc8fbad1fa12f19c1329e97cfe9c64b | [
"MIT"
] | null | null | null | tests/unit/test_craps_game_point_on.py | sam0jones0/oo-design | 851ae1129dc8fbad1fa12f19c1329e97cfe9c64b | [
"MIT"
] | null | null | null | tests/unit/test_craps_game_point_on.py | sam0jones0/oo-design | 851ae1129dc8fbad1fa12f19c1329e97cfe9c64b | [
"MIT"
] | null | null | null | from fractions import Fraction
import pytest
import casino.main
import tests.conftest
class TestCrapsGamePointOn:
@pytest.fixture(autouse=True)
def _setup(self, monkeypatch, mock_craps_game, mock_table, mock_throw):
monkeypatch.setattr(casino.main, "CrapsGame", mock_craps_game)
monkeypatch.setattr(casino.main, "Table", mock_table)
monkeypatch.setattr(casino.main, "NaturalThrow", mock_throw)
monkeypatch.setattr(casino.main, "ElevenThrow", mock_throw)
monkeypatch.setattr(casino.main, "CrapsThrow", mock_throw)
monkeypatch.setattr(casino.main, "PointThrow", mock_throw)
self.table = casino.main.Table()
self.game = casino.main.CrapsGame("dice", self.table) # type: ignore
self.table.set_game(self.game)
self.state = casino.main.CrapsGamePointOn(point=6, game=self.game)
assert self.table == self.game.table
assert self.game == self.table.game
def test_is_valid(self, craps_bet):
buy_five_bet = craps_bet("Buy 5")
buy_six_bet = craps_bet("Buy 6")
lay_five_bet = craps_bet("Lay 5")
lay_six_bet = craps_bet("Lay 6")
pass_bet = craps_bet("Pass Line")
come_bet = craps_bet("Come Line")
prop_two_bet = craps_bet("Proposition 2")
field_bet = craps_bet("Field")
assert self.state.is_valid(buy_five_bet.outcome)
assert not self.state.is_valid(buy_six_bet.outcome)
assert self.state.is_valid(lay_five_bet.outcome)
assert not self.state.is_valid(lay_six_bet.outcome)
assert not self.state.is_valid(pass_bet.outcome)
assert self.state.is_valid(come_bet.outcome)
assert self.state.is_valid(prop_two_bet.outcome)
assert self.state.is_valid(field_bet.outcome)
def test_is_working(self, craps_bet):
pass_bet = craps_bet("Pass Line")
come_bet = craps_bet("Come Line")
prop_two_bet = craps_bet("Proposition 2")
assert self.state.is_working(pass_bet.outcome)
assert self.state.is_working(come_bet.outcome)
assert self.state.is_working(prop_two_bet.outcome)
def test_craps_throw(self, craps_bet):
dont_come_bet = craps_bet("Don't Come Line")
come_bet = craps_bet("Come Line")
come_odds_bet = craps_bet("Come Point 6 Odds")
pass_bet = craps_bet("Pass Line")
dont_pass_bet = craps_bet("Don't Pass Line")
self.table.place_bet(dont_come_bet)
self.table.place_bet(come_bet)
self.table.place_bet(come_odds_bet)
self.table.place_bet(pass_bet)
self.table.place_bet(dont_pass_bet)
craps_throw = casino.main.CrapsThrow(1, 2)
self.state = self.state.craps(craps_throw)
assert dont_come_bet.player.stake == 110
assert come_bet.player.stake == 90
assert come_odds_bet.player.stake == 90
assert pass_bet.player.stake == 90
assert dont_pass_bet.player.stake == 90
assert len(self.table.bets) == 3
assert isinstance(self.state, casino.main.CrapsGamePointOn)
def test_natural_throw(self, craps_bet):
dont_pass_bet = craps_bet("Don't Pass Line")
dont_pass_odds = craps_bet("Don't Pass Odds")
dont_come_point_bet = craps_bet("Don't Come Point 5")
dont_come_point_odds_bet = craps_bet("Don't Come Point 9 Odds")
pass_bet = craps_bet("Pass Line")
dont_come_line_bet = craps_bet("Don't Come Line")
come_point_bet = craps_bet("Come Point 4")
come_point_odds_bet = craps_bet("Come Point 10 Odds")
self.table.place_bet(dont_pass_bet)
self.table.place_bet(dont_pass_odds)
self.table.place_bet(dont_come_point_bet)
self.table.place_bet(dont_come_point_odds_bet)
self.table.place_bet(pass_bet)
self.table.place_bet(dont_come_line_bet)
self.table.place_bet(come_point_bet)
self.table.place_bet(come_point_odds_bet)
natural_throw = casino.main.NaturalThrow(3, 4)
self.state = self.state.natural(natural_throw)
assert dont_pass_bet.player.stake == 110
assert dont_pass_odds.player.stake == 110
assert dont_come_point_bet.player.stake == 110
assert dont_come_point_odds_bet.player.stake == 110
assert pass_bet.player.stake == 90
assert dont_come_line_bet.player.stake == 90
assert come_point_bet.player.stake == 90
assert come_point_odds_bet.player.stake == 90
assert isinstance(self.state, casino.main.CrapsGamePointOff)
assert len(self.table.bets) == 0
def test_eleven_throw(self, craps_bet):
dont_come_bet = craps_bet("Don't Come Line")
come_bet = craps_bet("Come Line")
come_odds_bet = craps_bet("Come Point 6 Odds")
pass_bet = craps_bet("Pass Line")
dont_pass_bet = craps_bet("Don't Pass Line")
self.table.place_bet(dont_come_bet)
self.table.place_bet(come_bet)
self.table.place_bet(come_odds_bet)
self.table.place_bet(pass_bet)
self.table.place_bet(dont_pass_bet)
eleven_throw = casino.main.ElevenThrow(6, 5)
self.state = self.state.eleven(eleven_throw)
assert dont_come_bet.player.stake == 90
assert come_bet.player.stake == 110
assert come_odds_bet.player.stake == 90
assert pass_bet.player.stake == 90
assert dont_pass_bet.player.stake == 90
assert len(self.table.bets) == 3
assert isinstance(self.state, casino.main.CrapsGamePointOn)
def test_point_throw_point_made(self, craps_bet):
pass_bet = craps_bet("Pass Line")
pass_odds_bet = craps_bet("Pass Odds")
dont_pass_bet = craps_bet("Don't Pass Line")
dont_pass_odds_bet = craps_bet("Don't Pass Odds")
self.table.place_bet(pass_bet)
self.table.place_bet(pass_odds_bet)
self.table.place_bet(dont_pass_bet)
self.table.place_bet(dont_pass_odds_bet)
assert len(self.table.bets) == 4
point_throw = casino.main.PointThrow(2, 4) # Point is 6.
self.state = self.state.point(point_throw)
assert pass_bet.player.stake == 110
assert pass_odds_bet.player.stake == 110
assert dont_pass_bet.player.stake == 90
assert dont_pass_odds_bet.player.stake == 90
assert len(self.table.bets) == 0
assert isinstance(self.state, casino.main.CrapsGamePointOff)
def test_point_throw_point_not_made(self, craps_bet):
pass_bet = craps_bet("Pass Line")
come_point_bet = craps_bet("Come Point 5")
come_point_odds_bet = craps_bet("Come Point 5 Odds")
dont_come_point_bet = craps_bet("Don't Come Point 5")
dont_come_point_odds_bet = craps_bet("Don't Come Point 5 Odds")
other_come_point_bet = craps_bet("Come Point 8")
self.table.place_bet(pass_bet)
self.table.place_bet(come_point_bet)
self.table.place_bet(come_point_odds_bet)
self.table.place_bet(dont_come_point_bet)
self.table.place_bet(dont_come_point_odds_bet)
self.table.place_bet(other_come_point_bet)
point_throw = casino.main.PointThrow(1, 4) # Point is 6.
self.state = self.state.point(point_throw)
assert pass_bet.player.stake == 90
assert come_point_bet.player.stake == 110
assert come_point_odds_bet.player.stake == 110
assert dont_come_point_bet.player.stake == 90
assert dont_come_point_odds_bet.player.stake == 90
assert other_come_point_bet.player.stake == 90
assert len(self.table.bets) == 2
assert isinstance(self.state, casino.main.CrapsGamePointOn)
def test_point_throw_come_line_move_to_throw(self, craps_bet):
pass_bet = craps_bet("Pass Line")
come_line_bet = craps_bet("Come Line")
dont_come_line_bet = craps_bet("Don't Come Line")
self.table.place_bet(pass_bet)
self.table.place_bet(come_line_bet)
self.table.place_bet(dont_come_line_bet)
point_throw = casino.main.PointThrow(4, 4)
self.state = self.state.point(point_throw)
assert come_line_bet.outcome.name == "Come Point 8"
assert dont_come_line_bet.outcome.name == "Don't Come Point 8"
assert len(self.table.bets) == 3
assert isinstance(self.state, casino.main.CrapsGamePointOn)
def test_point_outcome_odds(self):
assert self.state.point_outcome_odds() == Fraction(6, 5)
def test_str(self):
assert self.state.__str__() == "The Point Is 6"
| 41.736585 | 77 | 0.681276 | 1,258 | 8,556 | 4.328299 | 0.069157 | 0.073462 | 0.082828 | 0.096786 | 0.801653 | 0.74472 | 0.686869 | 0.58494 | 0.504132 | 0.467952 | 0 | 0.016637 | 0.220196 | 8,556 | 204 | 78 | 41.941176 | 0.79946 | 0.004208 | 0 | 0.441176 | 0 | 0 | 0.072687 | 0 | 0 | 0 | 0 | 0 | 0.341176 | 1 | 0.064706 | false | 0.247059 | 0.023529 | 0 | 0.094118 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
c611a92b889281bd3f4ba90869baf78ec9566717 | 2,081 | py | Python | Version 2/MazeDriver/Control/mazeControl.py | ICT2x01-p2-3/GroupProject-RoboCar | a993ec5829c3f7a5c9c5986e653124d9e4c774dc | [
"MIT"
] | null | null | null | Version 2/MazeDriver/Control/mazeControl.py | ICT2x01-p2-3/GroupProject-RoboCar | a993ec5829c3f7a5c9c5986e653124d9e4c774dc | [
"MIT"
] | 14 | 2021-10-13T03:54:44.000Z | 2021-12-05T13:06:08.000Z | Version 2/MazeDriver/Control/mazeControl.py | ICT2x01-p2-3/GroupProject-RoboCar | a993ec5829c3f7a5c9c5986e653124d9e4c774dc | [
"MIT"
] | null | null | null |
class maze_control():
def __init__(self, map, solution):
self.solution = solution
self.dmap = []
for x in map:
temp = []
for y in x:
temp.append(y)
self.dmap.append(temp)
def get_car(self):
if self.solution[0] != "":
for row in range(len(self.dmap)):
for cell in range(len(self.dmap[row])):
if self.dmap[row][cell] == "2":
return [row,cell]
return None
def move_car(self, row, cell):
success = None
error = None
if self.solution[0] == "Forward":
if self.dmap[row - 1][cell] != "1" or self.dmap[row - 1][cell] != "3":
self.dmap[row][cell] = "0"
self.dmap[row - 1][cell] = "2"
elif self.dmap[row - 1][cell] == "3":
success = 1
else:
error = 1
elif self.solution[0] == "Backward":
if self.dmap[row + 1][cell] != "1" or self.dmap[row + 1][cell] != "3":
self.dmap[row][cell] = "0"
self.dmap[row + 1][cell] = "2"
elif self.dmap[row + 1][cell] == "3":
success = 1
else:
error = 2
elif self.solution[0] == "Right":
if self.dmap[row][cell + 1] != "1" or self.dmap[row][cell + 1] != "3":
self.dmap[row][cell] = "0"
self.dmap[row][cell + 1] = "2"
elif self.dmap[row][cell + 1] == "3":
success = 1
else:
error = 3
elif self.solution[0] == "Left":
if self.dmap[row][cell - 1] != "1" or self.dmap[row][cell - 1] != "3":
self.dmap[row][cell] = "0"
self.dmap[row][cell - 1] = "2"
elif self.dmap[row][cell - 1] == "3":
success = 1
else:
error = 4
return [self.dmap,self.solution,success,error]
| 33.031746 | 83 | 0.409419 | 248 | 2,081 | 3.407258 | 0.157258 | 0.246154 | 0.286391 | 0.230769 | 0.578698 | 0.515976 | 0.515976 | 0.515976 | 0.515976 | 0.515976 | 0 | 0.042735 | 0.43777 | 2,081 | 62 | 84 | 33.564516 | 0.679487 | 0 | 0 | 0.230769 | 0 | 0 | 0.02231 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.057692 | false | 0 | 0 | 0 | 0.134615 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c630d9eee516357c63cab0f3f24f21abd5ac3f57 | 1,088 | py | Python | setup.py | brightway-lca/brightway2-parameters | d7d2dbb6874d9f39383dbceec5545de0b1fa2ddb | [
"BSD-3-Clause"
] | null | null | null | setup.py | brightway-lca/brightway2-parameters | d7d2dbb6874d9f39383dbceec5545de0b1fa2ddb | [
"BSD-3-Clause"
] | null | null | null | setup.py | brightway-lca/brightway2-parameters | d7d2dbb6874d9f39383dbceec5545de0b1fa2ddb | [
"BSD-3-Clause"
] | 1 | 2021-07-05T12:14:49.000Z | 2021-07-05T12:14:49.000Z | from setuptools import setup
setup(
name="bw2parameters",
version="0.7",
packages=["bw2parameters"],
author="Chris Mutel",
author_email="cmutel@gmail.com",
license=open("LICENSE").read(),
url="https://github.com/brightway-lca/brightway2-parameters",
install_requires=[
"asteval",
"astunparse",
"numpy",
"stats_arrays",
],
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
],
)
| 32 | 65 | 0.596507 | 105 | 1,088 | 6.114286 | 0.647619 | 0.17757 | 0.233645 | 0.161994 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019632 | 0.250919 | 1,088 | 33 | 66 | 32.969697 | 0.768098 | 0 | 0 | 0.0625 | 0 | 0 | 0.55239 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.03125 | 0 | 0.03125 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c631943d7170a0fde6c77ba8d3c6f3608a3ff19d | 228 | py | Python | cmake/functions/python_function.py | tahsmith/pycmake | acff91be83e9cff9ff9b65e5895340d14da075ea | [
"MIT"
] | null | null | null | cmake/functions/python_function.py | tahsmith/pycmake | acff91be83e9cff9ff9b65e5895340d14da075ea | [
"MIT"
] | null | null | null | cmake/functions/python_function.py | tahsmith/pycmake | acff91be83e9cff9ff9b65e5895340d14da075ea | [
"MIT"
] | null | null | null | from cmake.context import Context
__author__ = 'tahsmith'
class PythonFunction(object):
def __init__(self, func):
self.func = func
def __call__(self, context, argument_list):
self.func(*argument_list) | 20.727273 | 47 | 0.697368 | 27 | 228 | 5.37037 | 0.592593 | 0.165517 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.20614 | 228 | 11 | 48 | 20.727273 | 0.801105 | 0 | 0 | 0 | 0 | 0 | 0.034935 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d68f496091c5486847ac11256d1bf351629ed066 | 2,214 | py | Python | src/generative_playground/models/problem/rl/task.py | ZmeiGorynych/generative_playground | 5c336dfbd14235e4fd97b21778842a650e733275 | [
"MIT"
] | 9 | 2018-09-23T17:34:23.000Z | 2021-07-29T09:48:55.000Z | src/generative_playground/models/problem/rl/task.py | ZmeiGorynych/generative_playground | 5c336dfbd14235e4fd97b21778842a650e733275 | [
"MIT"
] | 2 | 2020-04-15T17:52:18.000Z | 2020-04-15T18:26:27.000Z | src/generative_playground/models/problem/rl/task.py | ZmeiGorynych/generative_playground | 5c336dfbd14235e4fd97b21778842a650e733275 | [
"MIT"
] | 6 | 2019-04-30T22:01:43.000Z | 2021-11-22T02:20:18.000Z | from generative_playground.models.problem.rl.environment import SequenceEnvironment
class BaseTask:
def __init__(self):
pass
def reset(self):
return self.env.reset()
def step(self, action):
next_state, reward, done, info = self.env.step(action)
# TODO: really the environment should be in control, say max_seq_len, etc?
# if done:
# next_state = self.env.reset()
return next_state, reward, done, info
def seed(self, random_seed):
return self.env.seed(random_seed)
class SequenceGenerationTask(BaseTask):
def __init__(self, name='seq_gen',
molecules=True,
grammar= False,
reward_fun = None,
batch_size = 1,
log_dir=None,
max_steps=None,
save_dataset=None):
super().__init__()
self.name = name
self.env = SequenceEnvironment(molecules,
grammar,
reward_fun=reward_fun,
batch_size=batch_size,
max_steps=max_steps,
save_dataset=save_dataset)
self.action_dim = self.env.action_dim
self.state_dim = self.env.state_dim
class SequenceGenerationTask(BaseTask):
def __init__(self, name='seq_gen',
molecules=True,
grammar=False,
reward_fun=None,
batch_size=1,
log_dir=None,
max_steps=None,
save_dataset=None):
super().__init__()
self.name = name
self.env = SequenceEnvironment(molecules,
grammar,
reward_fun=reward_fun,
batch_size=batch_size,
max_steps=max_steps,
save_dataset=save_dataset)
self.action_dim = self.env.action_dim
self.state_dim = self.env.state_dim
#self.env = self.set_monitor(self.env, log_dir) | 37.525424 | 83 | 0.504968 | 217 | 2,214 | 4.847926 | 0.281106 | 0.079848 | 0.047529 | 0.054183 | 0.678707 | 0.634981 | 0.634981 | 0.634981 | 0.634981 | 0.634981 | 0 | 0.001561 | 0.421409 | 2,214 | 59 | 84 | 37.525424 | 0.819672 | 0.072719 | 0 | 0.77551 | 0 | 0 | 0.006833 | 0 | 0 | 0 | 0 | 0.016949 | 0 | 1 | 0.122449 | false | 0.020408 | 0.020408 | 0.040816 | 0.265306 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d69a48d32313b599db12bff700626216d05f22f2 | 682 | py | Python | specklepy/utils/array.py | felixbosco/specklepy | 18f1d542f04cbe31fec8675791bf8350a09441c6 | [
"MIT"
] | null | null | null | specklepy/utils/array.py | felixbosco/specklepy | 18f1d542f04cbe31fec8675791bf8350a09441c6 | [
"MIT"
] | null | null | null | specklepy/utils/array.py | felixbosco/specklepy | 18f1d542f04cbe31fec8675791bf8350a09441c6 | [
"MIT"
] | 2 | 2020-12-07T14:21:13.000Z | 2021-02-26T13:52:52.000Z | import numpy as np
def frame_shape(array):
return array.shape[-2], array.shape[-1]
def frame_number(array):
"""Extract the number of frames in an array.
Arguments:
array (array-like):
Array to extract the frame number from.
Returns:
frame_number (int):
Number of frames in the array
"""
if array.ndim == 2:
number_frames = 1
elif array.ndim == 3:
number_frames = array.shape[0]
else:
raise ValueError(f"Data is {array.ndim}-dimensional but must be 2 or 3-dimensional!")
return number_frames
def peak_index(array):
return np.unravel_index(np.argmax(array), array.shape)
| 22 | 93 | 0.631965 | 96 | 682 | 4.40625 | 0.458333 | 0.094563 | 0.066194 | 0.07565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016064 | 0.269795 | 682 | 30 | 94 | 22.733333 | 0.833333 | 0.288856 | 0 | 0 | 0 | 0 | 0.142222 | 0.053333 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.076923 | 0.153846 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d6a50d640e6ee6c1281d5ed54aa046289991d8ad | 501 | py | Python | AlgorithmProblems/0249.Group-Shifted-Strings/249. Group Shifted Strings solution 2.py | lynnli92/leetcode-group-solution | b497eaf29fb820648366b44e27c918503936b167 | [
"MIT"
] | 4 | 2021-12-31T00:53:32.000Z | 2022-01-22T21:28:46.000Z | AlgorithmProblems/0249.Group-Shifted-Strings/249. Group Shifted Strings solution 2.py | lynnli92/leetcode-group-solution | b497eaf29fb820648366b44e27c918503936b167 | [
"MIT"
] | 1 | 2021-12-31T00:40:34.000Z | 2021-12-31T00:40:34.000Z | AlgorithmProblems/0249.Group-Shifted-Strings/249. Group Shifted Strings solution 2.py | lynnli92/leetcode-group-solution | b497eaf29fb820648366b44e27c918503936b167 | [
"MIT"
] | 5 | 2021-12-31T00:28:40.000Z | 2022-03-22T21:01:40.000Z | import collections
class Solution:
"""
@param strings: a string array
@return: return a list of string array
"""
def __init__(self):
self.ALF_LEN = 26
def groupStrings(self, strings):
# write your code here
hashT = collections.defaultdict(list)
for s in strings:
hashT[self.build_key(s)].append(s)
return hashT.values()
def build_key(self, s):
return tuple([(ord(c) - ord(s[0])) % self.ALF_LEN for c in s])
| 26.368421 | 70 | 0.592814 | 68 | 501 | 4.25 | 0.529412 | 0.076125 | 0.069204 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008499 | 0.295409 | 501 | 18 | 71 | 27.833333 | 0.810198 | 0.181637 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 0 | 1 | 0.272727 | false | 0 | 0.090909 | 0.090909 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d6b18ef1fdbf4592057f278edf609e743dffd056 | 68 | py | Python | example/05_candle_month.py | jha929/pyupbit | 8c55f5d6802ce4639c6142520b83e80b79de447b | [
"Apache-2.0"
] | 332 | 2018-07-23T14:18:16.000Z | 2022-03-31T06:37:26.000Z | example/05_candle_month.py | jha929/pyupbit | 8c55f5d6802ce4639c6142520b83e80b79de447b | [
"Apache-2.0"
] | 52 | 2019-01-25T04:06:10.000Z | 2022-03-27T14:56:52.000Z | example/05_candle_month.py | jha929/pyupbit | 8c55f5d6802ce4639c6142520b83e80b79de447b | [
"Apache-2.0"
] | 161 | 2018-07-16T11:04:33.000Z | 2022-03-28T12:35:46.000Z | import pyupbit
df = pyupbit.get_ohlcv("KRW-BTC", "month")
print(df) | 17 | 42 | 0.720588 | 11 | 68 | 4.363636 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102941 | 68 | 4 | 43 | 17 | 0.786885 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d6dd39bd1dc8d7c25ee5c71cc6ef482199bc8eca | 768 | py | Python | listener/normal/notifications/views.py | andymckay/arecibo | eb6787ea0a276047ef5add2df67a4dd051e5c961 | [
"Apache-2.0"
] | 6 | 2016-01-26T04:47:52.000Z | 2022-01-24T19:55:04.000Z | listener/normal/notifications/views.py | andymckay/arecibo | eb6787ea0a276047ef5add2df67a4dd051e5c961 | [
"Apache-2.0"
] | 6 | 2017-02-12T05:11:25.000Z | 2017-02-12T05:12:15.000Z | listener/normal/notifications/views.py | andymckay/arecibo | eb6787ea0a276047ef5add2df67a4dd051e5c961 | [
"Apache-2.0"
] | 2 | 2015-12-09T22:37:58.000Z | 2021-09-09T17:04:33.000Z | import sys
from datetime import datetime, timedelta
from django.contrib.auth.decorators import user_passes_test
from django.views.generic.simple import direct_to_template
from notifications.models import Notification
from notifications.email import send_error_email
from app.decorators import arecibo_login_required
from app.paginator import Paginator, get_page
from app.utils import log, render_plain
@arecibo_login_required
def notifications_list(request):
queryset = Notification.objects.all().order_by("-timestamp")
paginated = Paginator(queryset, 10)
page = get_page(request, paginated)
return direct_to_template(request, "notification_list.html", extra_context={
"page": page,
"nav": {"selected": "notifications"}
})
| 32 | 80 | 0.782552 | 96 | 768 | 6.0625 | 0.541667 | 0.036082 | 0.054983 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003021 | 0.138021 | 768 | 23 | 81 | 33.391304 | 0.876133 | 0 | 0 | 0 | 0 | 0 | 0.078125 | 0.028646 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0.055556 | 0.5 | 0 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
d6f5f8c26e64ece65e4d5ea54fe71d32aedeb9db | 456 | py | Python | votes/api/serializers.py | isidaruk/eurovision_project | 976743e66a2fed17c0513f17a9a7d35850e9cde5 | [
"MIT"
] | null | null | null | votes/api/serializers.py | isidaruk/eurovision_project | 976743e66a2fed17c0513f17a9a7d35850e9cde5 | [
"MIT"
] | 8 | 2020-02-12T00:23:27.000Z | 2022-03-08T21:10:13.000Z | votes/api/serializers.py | isidaruk/eurovision_project | 976743e66a2fed17c0513f17a9a7d35850e9cde5 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from participants.models import Participant
from voters.models import Voter
from votes.models import Vote
class VoteSerializer(serializers.ModelSerializer):
from_voter = serializers.PrimaryKeyRelatedField(queryset=Voter.objects.all())
to_participant = serializers.PrimaryKeyRelatedField(queryset=Participant.objects.all())
class Meta:
model = Vote
fields = '__all__'
depth = 1
| 28.5 | 91 | 0.767544 | 48 | 456 | 7.145833 | 0.520833 | 0.104956 | 0.239067 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002625 | 0.164474 | 456 | 15 | 92 | 30.4 | 0.897638 | 0 | 0 | 0 | 0 | 0 | 0.015351 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.363636 | 0 | 0.727273 | 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 | 1 | 0 | 1 | 0 | 0 | 3 |
ba4d0b07669edc9e8255f19b4c977b0463aec1e3 | 859 | py | Python | scripts/LODsTool/setupMenu.py | AsoboStudio/FlightSim-3dsMax-tools | a94564afdd648d202c2ebcc98f0d7ed6e61528f1 | [
"MIT"
] | 9 | 2020-04-28T14:05:15.000Z | 2022-03-23T05:56:45.000Z | scripts/LODsTool/setupMenu.py | AsoboStudio/FlightSim-3dsMax-tools | a94564afdd648d202c2ebcc98f0d7ed6e61528f1 | [
"MIT"
] | null | null | null | scripts/LODsTool/setupMenu.py | AsoboStudio/FlightSim-3dsMax-tools | a94564afdd648d202c2ebcc98f0d7ed6e61528f1 | [
"MIT"
] | 2 | 2021-06-30T02:30:53.000Z | 2021-07-23T19:48:56.000Z | import os
import sys
from pymxs import runtime as rt
from maxsdk import menu as sdkmenu
reload(sdkmenu)
toolFolder = os.path.dirname(__file__)
if toolFolder not in sys.path:
sys.path.append(toolFolder)
import LODsTool.lodtool as lodtool
reload(lodtool)
def installMenu():
sdkmenu.createMacroScript(_func=lodtool.run, category="FlightSim", name="FlightSimLODUtilities", button_text="LOD Utilities")
actionItem = rt.menuMan.createActionItem("FlightSimLODUtilities", "FlightSim")
FlightSimMenu = rt.menuman.findmenu("FlightSim")
maxMenuBar = rt.menuMan.getMainMenuBar()
if FlightSimMenu:
sdkmenu.safeAddItem(FlightSimMenu, actionItem)
sdkmenu.safeAddItem(maxMenuBar, rt.menuMan.createSubMenuItem("FlightSim", FlightSimMenu))
else:
print "Cannot find FlightSim menu"
rt.menuMan.updateMenuBar()
| 859 | 859 | 0.753201 | 93 | 859 | 6.892473 | 0.526882 | 0.070203 | 0.059282 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152503 | 859 | 1 | 859 | 859 | 0.880495 | 0 | 0 | 0 | 0 | 0 | 0.136205 | 0.048894 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.238095 | null | null | 0.047619 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ba5344885a29cb645981037cacc5cce020aad838 | 288 | py | Python | paypal_express_checkout/signals.py | theusefularts/django-paypal-express-checkout | 7163cce1de1ec17bba96efb374c4565d1ff8dd1e | [
"MIT"
] | 8 | 2017-04-25T22:52:48.000Z | 2022-02-09T01:39:51.000Z | paypal_express_checkout/signals.py | theusefularts/django-paypal-express-checkout | 7163cce1de1ec17bba96efb374c4565d1ff8dd1e | [
"MIT"
] | 4 | 2015-05-28T11:52:34.000Z | 2016-03-30T22:39:45.000Z | paypal_express_checkout/signals.py | bitmazk/django-paypal-express-checkout | 9bb3fc653268325440a605842ddc1c56cec036a7 | [
"MIT"
] | 9 | 2015-02-24T18:55:15.000Z | 2016-06-05T00:24:02.000Z | """Signals for the ``paypal_express_checkout`` app."""
from django.dispatch import Signal
# A signal that arrives, when an IPN is received with status 'Completed'
payment_completed = Signal(providing_args=['transaction'])
payment_status_updated = Signal(providing_args=['transaction'])
| 36 | 72 | 0.784722 | 37 | 288 | 5.918919 | 0.756757 | 0.136986 | 0.173516 | 0.273973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104167 | 288 | 7 | 73 | 41.142857 | 0.848837 | 0.416667 | 0 | 0 | 0 | 0 | 0.135802 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ba8cdd6a80d076147b8d00a9208f0045bcc899c6 | 57 | py | Python | __init__.py | Adless-i/Apkg.ADI | b31af7956aa823cb511d1e2c56c8d61a26bc9eb3 | [
"CC0-1.0"
] | null | null | null | __init__.py | Adless-i/Apkg.ADI | b31af7956aa823cb511d1e2c56c8d61a26bc9eb3 | [
"CC0-1.0"
] | null | null | null | __init__.py | Adless-i/Apkg.ADI | b31af7956aa823cb511d1e2c56c8d61a26bc9eb3 | [
"CC0-1.0"
] | null | null | null | /storage/emulated/0/root/Project/Appstore.ADI/downloader
| 28.5 | 56 | 0.842105 | 8 | 57 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017857 | 0.017544 | 57 | 1 | 57 | 57 | 0.839286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ba9e5f7be6637750ea0e4933c6fc5eb457ef31cf | 290 | py | Python | python/aghast/aghast_generated/InterpretedBuffer.py | HDembinski/aghast | f3d45a6960033f48fb8f6b7e906cb36b9d9d8e95 | [
"BSD-3-Clause"
] | 18 | 2019-04-15T14:39:35.000Z | 2021-12-21T15:01:02.000Z | python/aghast/aghast_generated/InterpretedBuffer.py | HDembinski/aghast | f3d45a6960033f48fb8f6b7e906cb36b9d9d8e95 | [
"BSD-3-Clause"
] | 27 | 2019-04-12T20:24:00.000Z | 2021-12-03T08:51:56.000Z | python/aghast/aghast_generated/InterpretedBuffer.py | diana-hep/stagg | ed97e9abc870e729d300622253aa7e9c870f77ec | [
"BSD-3-Clause"
] | 11 | 2019-04-15T14:41:00.000Z | 2021-11-16T13:28:10.000Z | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: aghast_generated
class InterpretedBuffer(object):
NONE = 0
InterpretedInlineBuffer = 1
InterpretedInlineInt64Buffer = 2
InterpretedInlineFloat64Buffer = 3
InterpretedExternalBuffer = 4
| 24.166667 | 68 | 0.775862 | 25 | 290 | 8.96 | 0.96 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037975 | 0.182759 | 290 | 11 | 69 | 26.363636 | 0.907173 | 0.324138 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 3 |
baa32a6c6283034e250c43ee160a91f7ebdcfa85 | 185 | py | Python | src/thirdParty/crBootstrap/crGlobalLevel.py | mhtvsSFrpHdE/chm-rebirth | f1803efe1326c7815c219717caa12cb6be95f6e4 | [
"MIT"
] | 2 | 2020-03-27T13:50:47.000Z | 2020-07-02T11:34:26.000Z | src/thirdParty/crBootstrap/crGlobalLevel.py | mhtvsSFrpHdE/chm-rebirth | f1803efe1326c7815c219717caa12cb6be95f6e4 | [
"MIT"
] | null | null | null | src/thirdParty/crBootstrap/crGlobalLevel.py | mhtvsSFrpHdE/chm-rebirth | f1803efe1326c7815c219717caa12cb6be95f6e4 | [
"MIT"
] | 2 | 2020-03-24T11:39:48.000Z | 2020-03-27T13:50:52.000Z | # https://docs.python.org/3/faq/programming.html#how-do-i-share-global-variables-across-modules
crLog = None
environment_config = None
magic_value_config = None
message_config = None
| 23.125 | 95 | 0.794595 | 28 | 185 | 5.107143 | 0.821429 | 0.20979 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005917 | 0.086486 | 185 | 7 | 96 | 26.428571 | 0.840237 | 0.497297 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
baa729159f25d430c553e8bd8bc98570410a29ae | 2,039 | py | Python | dgp/annotations/depth_annotation.py | visakii-work/dgp | 51eed60bba0679399b73392bdb0935a4e2306604 | [
"MIT"
] | 46 | 2020-05-13T04:21:11.000Z | 2022-03-14T02:05:28.000Z | dgp/annotations/depth_annotation.py | visakii-work/dgp | 51eed60bba0679399b73392bdb0935a4e2306604 | [
"MIT"
] | 20 | 2020-12-28T02:49:38.000Z | 2022-03-31T02:26:19.000Z | dgp/annotations/depth_annotation.py | visakii-work/dgp | 51eed60bba0679399b73392bdb0935a4e2306604 | [
"MIT"
] | 45 | 2020-05-11T21:44:10.000Z | 2022-03-28T06:55:28.000Z | # Copyright 2021 Toyota Research Institute. All rights reserved.
import os
import numpy as np
from dgp.annotations import Annotation
from dgp.utils.dataset_conversion import generate_uid_from_point_cloud
class DenseDepthAnnotation(Annotation):
"""Container for per-pixel depth annotation.
Parameters
----------
depth: np.ndarray
2D numpy float array that stores per-pixel depth.
"""
def __init__(self, depth):
assert isinstance(depth, np.ndarray)
assert depth.dtype in [np.float32, np.float64]
super().__init__(None)
self._depth = depth
@property
def depth(self):
return self._depth
@classmethod
def load(cls, annotation_file, ontology=None):
"""Loads annotation from file into a canonical format for consumption in __getitem__ function in BaseDataset.
Parameters
----------
annotation_file: str
Full path to NPZ file that stores 2D depth array.
ontology: None
Dummy ontology argument to meet the usage in `BaseDataset.load_annotation()`.
"""
assert ontology is None, "'ontology' must be 'None' for {}.".format(cls.__name__)
depth = np.load(annotation_file)['data']
return cls(depth)
@property
def hexdigest(self):
return generate_uid_from_point_cloud(self.depth)
def save(self, save_dir):
"""Serialize annotation object if possible, and saved to specified directory.
Annotations are saved in format <save_dir>/<sha>.<ext>
Paramaters
----------
save_dir: str
Path to directory to saved annotation
Returns
-------
pointcloud_path: str
Full path to the output NPZ file.
"""
pointcloud_path = os.path.join(save_dir, '{}.npz'.format(self.hexdigest))
np.savez_compressed(pointcloud_path, self.depth)
return pointcloud_path
def render(self):
"""TODO: Rendering function for per-pixel depth."""
| 29.985294 | 117 | 0.641981 | 241 | 2,039 | 5.26556 | 0.431535 | 0.035461 | 0.030733 | 0.031521 | 0.039401 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006658 | 0.263364 | 2,039 | 67 | 118 | 30.432836 | 0.838216 | 0.409514 | 0 | 0.076923 | 1 | 0 | 0.041992 | 0 | 0 | 0 | 0 | 0.014925 | 0.115385 | 1 | 0.230769 | false | 0 | 0.153846 | 0.076923 | 0.576923 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bad3e8e51199b5c7759ff6fc532e25ad830e9272 | 1,811 | py | Python | atlas/foundations_sdk/src/foundations/__init__.py | manesioz/atlas | 4afb63b48f65b0765300dc8034403aeca8489520 | [
"Apache-2.0"
] | 1 | 2021-11-01T12:47:44.000Z | 2021-11-01T12:47:44.000Z | atlas/foundations_sdk/src/foundations/__init__.py | manesioz/atlas | 4afb63b48f65b0765300dc8034403aeca8489520 | [
"Apache-2.0"
] | null | null | null | atlas/foundations_sdk/src/foundations/__init__.py | manesioz/atlas | 4afb63b48f65b0765300dc8034403aeca8489520 | [
"Apache-2.0"
] | null | null | null |
def _check_if_in_cli():
import traceback
import os
import os.path
in_run_py = False
in_unit_test = False
for line in traceback.format_stack():
if "runpy.py" in line:
in_run_py = True
elif "unittest" in line:
in_unit_test = True
if in_run_py and not in_unit_test:
os.environ["FOUNDATIONS_COMMAND_LINE"] = "True"
_check_if_in_cli()
from foundations.global_state import *
from foundations_contrib.bucket_pipeline_archive import BucketPipelineArchive
from foundations_contrib.bucket_pipeline_listing import BucketPipelineListing
from foundations_contrib.prefixed_bucket import PrefixedBucket
from foundations_internal.serializer import *
from foundations_internal.change_directory import ChangeDirectory
from foundations_contrib.bucket_job_deployment import BucketJobDeployment
from foundations_contrib.archiving.save_artifact import save_artifact
from foundations_contrib.deployment_wrapper import DeploymentWrapper
from foundations.projects import set_project_name, set_tag, get_metrics_for_all_jobs
from foundations_internal.versioning import __version__
from foundations.job_parameters import *
from foundations.job_metrics import *
import foundations_events.consumers
import foundations_events
from foundations_contrib.set_job_resources import set_job_resources
from foundations.submission import *
import foundations_core_cli
from foundations.artifacts import *
from foundations.local_run import set_up_default_environment_if_present
from foundations.set_tensorboard_logdir import set_tensorboard_logdir
def _append_module():
import sys
from foundations_internal.global_state import module_manager
module_manager.append_module(sys.modules[__name__])
_append_module()
set_up_default_environment_if_present()
| 32.339286 | 84 | 0.831033 | 233 | 1,811 | 6.055794 | 0.351931 | 0.201984 | 0.109142 | 0.059532 | 0.096386 | 0.045358 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12921 | 1,811 | 55 | 85 | 32.927273 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0.024323 | 0.013267 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04878 | false | 0 | 0.634146 | 0 | 0.682927 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
baeeba05208a43a76ae23b4442d4536be2e14e09 | 363 | py | Python | text/_elisp/key/base/character/japanese/upper/east/a.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | text/_elisp/key/base/character/japanese/upper/east/a.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | text/_elisp/key/base/character/japanese/upper/east/a.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | """
*A* |あ| |ア|
The _a_ Japanese gi.
"""
from dataclasses import dataclass
from strism._form.elisp.gi.base.character._strismic import MiddleEast2
from ...._gi import Gi
from ..._gi import JapaneseGi
__all__ = ["A"]
# [TODO] mechanism of extending
@dataclass
class A(
Gi,
JapaneseGi,
):
hiragana = "\u3042"
katakana = "\u30a2"
| 12.517241 | 70 | 0.641873 | 44 | 363 | 5.068182 | 0.636364 | 0.053812 | 0.107623 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02847 | 0.225895 | 363 | 28 | 71 | 12.964286 | 0.765125 | 0.187328 | 0 | 0 | 0 | 0 | 0.046595 | 0 | 0 | 0 | 0 | 0.035714 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
baff1688d59881aaad83cb769084cdbf5ecf0051 | 161 | py | Python | statey/ext/pulumi/constants.py | cfeenstra67/statey | 6d127ed48265e2e072fbb26486458a4b28a333ec | [
"MIT"
] | 4 | 2021-02-16T19:34:38.000Z | 2022-01-31T16:44:14.000Z | statey/ext/pulumi/constants.py | cfeenstra67/statey | 6d127ed48265e2e072fbb26486458a4b28a333ec | [
"MIT"
] | null | null | null | statey/ext/pulumi/constants.py | cfeenstra67/statey | 6d127ed48265e2e072fbb26486458a4b28a333ec | [
"MIT"
] | null | null | null | RESOLVER_STORE = {"pulumi.json": {"Any": {"type": "any"}, "Asset": {"type": "string"}}}
PULUMI_ID = "id"
PULUMI_NS = "pulumi"
PULUMI_HOME_ENV = "PULUMI_HOME"
| 20.125 | 87 | 0.627329 | 21 | 161 | 4.52381 | 0.571429 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 161 | 7 | 88 | 23 | 0.678571 | 0 | 0 | 0 | 0 | 0 | 0.341615 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
241300e014cfaa8c8d00bde302bf2cee03ecc02c | 92 | py | Python | Ene-Jun-2022/Ejemplos/APIs/sample.py | alanmenchaca/DAS_Sistemas | ebfe59cd7366440b9733610ab0514287b956a0ce | [
"MIT"
] | 1 | 2022-01-26T01:27:00.000Z | 2022-01-26T01:27:00.000Z | Ene-Jun-2022/Ejemplos/APIs/sample.py | alanmenchaca/DAS_Sistemas | ebfe59cd7366440b9733610ab0514287b956a0ce | [
"MIT"
] | null | null | null | Ene-Jun-2022/Ejemplos/APIs/sample.py | alanmenchaca/DAS_Sistemas | ebfe59cd7366440b9733610ab0514287b956a0ce | [
"MIT"
] | null | null | null | import requests
r = requests.get('https://pokeapi.co/api/v2/pokemon/ditto')
print(r.json()) | 23 | 59 | 0.728261 | 15 | 92 | 4.466667 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011628 | 0.065217 | 92 | 4 | 60 | 23 | 0.767442 | 0 | 0 | 0 | 0 | 0 | 0.419355 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2413a47f5de734e0503100b7ebca7313ef4200f3 | 787 | py | Python | tests/unit/raptiformica/cli/test_advertise.py | vdloo/raptiformica | e2807e5e913312034161efcbd74525a4b15b37e7 | [
"MIT"
] | 21 | 2016-09-04T11:27:31.000Z | 2019-10-30T08:23:14.000Z | tests/unit/raptiformica/cli/test_advertise.py | vdloo/raptiformica | e2807e5e913312034161efcbd74525a4b15b37e7 | [
"MIT"
] | 5 | 2017-09-17T15:59:37.000Z | 2018-02-03T14:53:32.000Z | tests/unit/raptiformica/cli/test_advertise.py | vdloo/raptiformica | e2807e5e913312034161efcbd74525a4b15b37e7 | [
"MIT"
] | 2 | 2017-11-21T18:14:51.000Z | 2017-11-22T01:20:45.000Z | from raptiformica.cli import advertise
from tests.testcase import TestCase
class TestAdvertise(TestCase):
def setUp(self):
self.parse_advertise_arguments = self.set_up_patch(
'raptiformica.cli.parse_advertise_arguments'
)
self.write_last_advertised = self.set_up_patch(
'raptiformica.cli.write_last_advertised'
)
def test_advertise_parses_advertise_arguments(self):
advertise()
self.parse_advertise_arguments.assert_called_once_with()
def test_advertise_writes_last_advertised(self):
advertise()
self.write_last_advertised.assert_called_once_with(
self.parse_advertise_arguments.return_value.host,
self.parse_advertise_arguments.return_value.port
)
| 30.269231 | 64 | 0.717916 | 88 | 787 | 6.011364 | 0.352273 | 0.204159 | 0.217391 | 0.204159 | 0.253308 | 0.253308 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217281 | 787 | 25 | 65 | 31.48 | 0.858766 | 0 | 0 | 0.105263 | 0 | 0 | 0.101652 | 0.101652 | 0 | 0 | 0 | 0 | 0.105263 | 1 | 0.157895 | false | 0 | 0.105263 | 0 | 0.315789 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
243540e2839e085b02b80abf7bd76e1b5cda8bbe | 343 | py | Python | VerificarStr.py | Wollacy/Python | afd6dadad290aee0698d4513cd9b168309df810c | [
"MIT"
] | null | null | null | VerificarStr.py | Wollacy/Python | afd6dadad290aee0698d4513cd9b168309df810c | [
"MIT"
] | null | null | null | VerificarStr.py | Wollacy/Python | afd6dadad290aee0698d4513cd9b168309df810c | [
"MIT"
] | null | null | null | ## Verifica Palavra no Nome
nome = str(input('Qual seu nome completo? ')).strip()
print('Seu nome tem Silva? {}'.format('SILVA' in nome.upper()))
## Concatenando Strings
print('-='*30)
print('CONCATENANDO STRINGS')
print('-='*30)
a = 'Wollacy'
b = 'Lilian'
c = 'Augusto'
print(a)
print(b)
print(c)
d = a + ' + ' + b + ' = ' + c
print(d) | 15.590909 | 63 | 0.603499 | 49 | 343 | 4.22449 | 0.530612 | 0.067633 | 0.231884 | 0.251208 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014134 | 0.174927 | 343 | 22 | 64 | 15.590909 | 0.717314 | 0.131195 | 0 | 0.153846 | 0 | 0 | 0.343537 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.615385 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
24360a646e0236467939f3394b4ce34d111feda6 | 14,233 | py | Python | bookwyrm/tests/views/landing/test_register.py | mouse-reeve/fedireads | e3471fcc3500747a1b1deaaca662021aae5b08d4 | [
"CC0-1.0"
] | 270 | 2020-01-27T06:06:07.000Z | 2020-06-21T00:28:18.000Z | bookwyrm/tests/views/landing/test_register.py | mouse-reeve/fedireads | e3471fcc3500747a1b1deaaca662021aae5b08d4 | [
"CC0-1.0"
] | 158 | 2020-02-10T20:36:54.000Z | 2020-06-26T17:12:54.000Z | bookwyrm/tests/views/landing/test_register.py | mouse-reeve/fedireads | e3471fcc3500747a1b1deaaca662021aae5b08d4 | [
"CC0-1.0"
] | 15 | 2020-02-13T21:53:33.000Z | 2020-06-17T16:52:46.000Z | """ test for app action functionality """
from unittest.mock import patch
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import PermissionDenied
from django.http.response import Http404
from django.template.response import TemplateResponse
from django.test import TestCase
from django.test.client import RequestFactory
from bookwyrm import models, views
from bookwyrm.settings import DOMAIN
from bookwyrm.tests.validate_html import validate_html
# pylint: disable=too-many-public-methods
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.lists_stream.populate_lists_task.delay")
class RegisterViews(TestCase):
"""login and password management"""
def setUp(self):
"""we need basic test data and mocks"""
self.factory = RequestFactory()
with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"), patch(
"bookwyrm.activitystreams.populate_stream_task.delay"
), patch("bookwyrm.lists_stream.populate_lists_task.delay"):
self.local_user = models.User.objects.create_user(
"mouse@your.domain.here",
"mouse@mouse.com",
"password",
local=True,
localname="mouse",
)
self.anonymous_user = AnonymousUser
self.anonymous_user.is_authenticated = False
self.settings = models.SiteSettings.objects.create(
id=1, require_confirm_email=False, allow_registration=True
)
def test_get_redirect(self, *_):
"""there's no dedicated registration page"""
view = views.Register.as_view()
request = self.factory.get("register/")
response = view(request)
self.assertEqual(response.status_code, 302)
def test_register(self, *_):
"""create a user"""
view = views.Register.as_view()
self.assertEqual(models.User.objects.count(), 1)
request = self.factory.post(
"register/",
{
"localname": "nutria-user.user_nutria",
"password": "mouseword",
"email": "aa@bb.cccc",
},
)
with patch("bookwyrm.views.landing.register.login"):
response = view(request)
self.assertEqual(models.User.objects.count(), 2)
self.assertEqual(response.status_code, 302)
nutria = models.User.objects.last()
self.assertEqual(nutria.username, f"nutria-user.user_nutria@{DOMAIN}")
self.assertEqual(nutria.localname, "nutria-user.user_nutria")
self.assertEqual(nutria.local, True)
@patch("bookwyrm.emailing.send_email.delay")
def test_register_email_confirm(self, *_):
"""create a user"""
self.settings.require_confirm_email = True
self.settings.save()
view = views.Register.as_view()
self.assertEqual(models.User.objects.count(), 1)
request = self.factory.post(
"register/",
{
"localname": "nutria",
"password": "mouseword",
"email": "aa@bb.cccc",
},
)
with patch("bookwyrm.views.landing.register.login"):
response = view(request)
self.assertEqual(response.status_code, 302)
nutria = models.User.objects.get(localname="nutria")
self.assertEqual(nutria.username, f"nutria@{DOMAIN}")
self.assertEqual(nutria.local, True)
self.assertFalse(nutria.is_active)
self.assertEqual(nutria.deactivation_reason, "pending")
self.assertIsNotNone(nutria.confirmation_code)
def test_register_trailing_space(self, *_):
"""django handles this so weirdly"""
view = views.Register.as_view()
request = self.factory.post(
"register/",
{"localname": "nutria ", "password": "mouseword", "email": "aa@bb.ccc"},
)
with patch("bookwyrm.views.landing.register.login"):
response = view(request)
self.assertEqual(models.User.objects.count(), 2)
self.assertEqual(response.status_code, 302)
nutria = models.User.objects.last()
self.assertEqual(nutria.username, f"nutria@{DOMAIN}")
self.assertEqual(nutria.localname, "nutria")
self.assertEqual(nutria.local, True)
def test_register_invalid_email(self, *_):
"""gotta have an email"""
view = views.Register.as_view()
self.assertEqual(models.User.objects.count(), 1)
request = self.factory.post(
"register/", {"localname": "nutria", "password": "mouseword", "email": "aa"}
)
response = view(request)
self.assertEqual(models.User.objects.count(), 1)
validate_html(response.render())
def test_register_error_and_invite(self, *_):
"""redirect to the invite page"""
view = views.Register.as_view()
self.settings.allow_registration = False
self.settings.save()
models.SiteInvite.objects.create(
code="testcode", user=self.local_user, use_limit=1
)
self.assertEqual(models.SiteInvite.objects.get().times_used, 0)
request = self.factory.post(
"register/",
{
"localname": "nutria",
"password": "mouseword",
"email": "",
"invite_code": "testcode",
},
)
with patch("bookwyrm.views.landing.register.login"):
response = view(request)
response = view(request)
validate_html(response.render())
def test_register_username_in_use(self, *_):
"""that username is taken"""
view = views.Register.as_view()
self.assertEqual(models.User.objects.count(), 1)
request = self.factory.post(
"register/",
{"localname": "mouse", "password": "mouseword", "email": "aa@bb.ccc"},
)
response = view(request)
self.assertEqual(models.User.objects.count(), 1)
validate_html(response.render())
def test_register_invalid_username(self, *_):
"""gotta have an email"""
view = views.Register.as_view()
self.assertEqual(models.User.objects.count(), 1)
request = self.factory.post(
"register/",
{"localname": "nut@ria", "password": "mouseword", "email": "aa@bb.ccc"},
)
response = view(request)
self.assertEqual(models.User.objects.count(), 1)
validate_html(response.render())
request = self.factory.post(
"register/",
{"localname": "nutr ia", "password": "mouseword", "email": "aa@bb.ccc"},
)
response = view(request)
self.assertEqual(models.User.objects.count(), 1)
validate_html(response.render())
request = self.factory.post(
"register/",
{"localname": "nut@ria", "password": "mouseword", "email": "aa@bb.ccc"},
)
response = view(request)
self.assertEqual(models.User.objects.count(), 1)
validate_html(response.render())
def test_register_closed_instance(self, *_):
"""you can't just register"""
view = views.Register.as_view()
self.settings.allow_registration = False
self.settings.save()
request = self.factory.post(
"register/",
{"localname": "nutria ", "password": "mouseword", "email": "aa@bb.ccc"},
)
with self.assertRaises(PermissionDenied):
view(request)
def test_register_blocked_domain(self, *_):
"""you can't register with a blocked domain"""
view = views.Register.as_view()
models.EmailBlocklist.objects.create(domain="gmail.com")
# one that fails
request = self.factory.post(
"register/",
{"localname": "nutria ", "password": "mouseword", "email": "aa@gmail.com"},
)
result = view(request)
self.assertEqual(result.status_code, 302)
self.assertFalse(models.User.objects.filter(email="aa@gmail.com").exists())
# one that succeeds
request = self.factory.post(
"register/",
{"localname": "nutria ", "password": "mouseword", "email": "aa@bleep.com"},
)
with patch("bookwyrm.views.landing.register.login"):
result = view(request)
self.assertEqual(result.status_code, 302)
self.assertTrue(models.User.objects.filter(email="aa@bleep.com").exists())
def test_register_invite(self, *_):
"""you can't just register"""
view = views.Register.as_view()
self.settings.allow_registration = False
self.settings.save()
models.SiteInvite.objects.create(
code="testcode", user=self.local_user, use_limit=1
)
self.assertEqual(models.SiteInvite.objects.get().times_used, 0)
request = self.factory.post(
"register/",
{
"localname": "nutria",
"password": "mouseword",
"email": "aa@bb.ccc",
"invite_code": "testcode",
},
)
with patch("bookwyrm.views.landing.register.login"):
response = view(request)
self.assertEqual(models.User.objects.count(), 2)
self.assertEqual(response.status_code, 302)
self.assertEqual(models.SiteInvite.objects.get().times_used, 1)
# invite already used to max capacity
request = self.factory.post(
"register/",
{
"localname": "nutria2",
"password": "mouseword",
"email": "aa@bb.ccc",
"invite_code": "testcode",
},
)
with self.assertRaises(PermissionDenied):
response = view(request)
self.assertEqual(models.User.objects.count(), 2)
# bad invite code
request = self.factory.post(
"register/",
{
"localname": "nutria3",
"password": "mouseword",
"email": "aa@bb.ccc",
"invite_code": "dkfkdjgdfkjgkdfj",
},
)
with self.assertRaises(Http404):
response = view(request)
self.assertEqual(models.User.objects.count(), 2)
def test_confirm_email_code_get(self, *_):
"""there are so many views, this just makes sure it LOADS"""
self.settings.require_confirm_email = True
self.settings.save()
self.local_user.is_active = False
self.local_user.deactivation_reason = "pending"
self.local_user.confirmation_code = "12345"
self.local_user.save(
broadcast=False,
update_fields=["is_active", "deactivation_reason", "confirmation_code"],
)
view = views.ConfirmEmailCode.as_view()
request = self.factory.get("")
request.user = self.anonymous_user
result = view(request, "12345")
self.assertEqual(result.url, "/login/confirmed")
self.assertEqual(result.status_code, 302)
self.local_user.refresh_from_db()
self.assertTrue(self.local_user.is_active)
self.assertIsNone(self.local_user.deactivation_reason)
request.user = self.local_user
result = view(request, "12345")
self.assertEqual(result.url, "/")
self.assertEqual(result.status_code, 302)
def test_confirm_email_code_get_invalid_code(self, *_):
"""there are so many views, this just makes sure it LOADS"""
self.settings.require_confirm_email = True
self.settings.save()
self.local_user.is_active = False
self.local_user.deactivation_reason = "pending"
self.local_user.confirmation_code = "12345"
self.local_user.save(
broadcast=False,
update_fields=["is_active", "deactivation_reason", "confirmation_code"],
)
view = views.ConfirmEmailCode.as_view()
request = self.factory.get("")
request.user = self.anonymous_user
result = view(request, "abcde")
self.assertIsInstance(result, TemplateResponse)
validate_html(result.render())
self.assertEqual(result.status_code, 200)
self.assertFalse(self.local_user.is_active)
self.assertEqual(self.local_user.deactivation_reason, "pending")
def test_confirm_email_get(self, *_):
"""there are so many views, this just makes sure it LOADS"""
self.settings.require_confirm_email = True
self.settings.save()
login = views.ConfirmEmail.as_view()
request = self.factory.get("")
request.user = self.anonymous_user
result = login(request)
self.assertIsInstance(result, TemplateResponse)
validate_html(result.render())
self.assertEqual(result.status_code, 200)
request.user = self.local_user
result = login(request)
self.assertEqual(result.url, "/")
self.assertEqual(result.status_code, 302)
def test_confirm_email_post(self, *_):
"""send the email"""
self.settings.require_confirm_email = True
self.settings.save()
view = views.ConfirmEmail.as_view()
models.SiteInvite.objects.create(
code="testcode", user=self.local_user, use_limit=1
)
request = self.factory.post("", {"code": "testcode"})
request.user = self.anonymous_user
result = view(request)
validate_html(result.render())
def test_resend_link_get(self, *_):
"""try again"""
request = self.factory.get("")
request.user = self.anonymous_user
result = views.ResendConfirmEmail.as_view()(request)
validate_html(result.render())
def test_resend_link_post(self, *_):
"""try again"""
request = self.factory.post("", {"email": "mouse@mouse.com"})
request.user = self.anonymous_user
with patch("bookwyrm.emailing.send_email.delay") as mock:
views.ResendConfirmEmail.as_view()(request)
self.assertEqual(mock.call_count, 1)
| 37.753316 | 88 | 0.607532 | 1,495 | 14,233 | 5.642809 | 0.137124 | 0.078236 | 0.046942 | 0.044334 | 0.768492 | 0.740517 | 0.68184 | 0.660028 | 0.637862 | 0.624822 | 0 | 0.008319 | 0.265229 | 14,233 | 376 | 89 | 37.853723 | 0.798336 | 0.049322 | 0 | 0.613636 | 0 | 0 | 0.143464 | 0.051695 | 0 | 0 | 0 | 0 | 0.181818 | 1 | 0.058442 | false | 0.051948 | 0.032468 | 0 | 0.094156 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
2449203ec7042f7123a228b27f377b7eff3f9a99 | 462 | py | Python | Algos/search.py | Suraj-Rajesh/code | 3d554c4d1d5cf4bd9d084b8034641c1f6c2a47c9 | [
"MIT"
] | null | null | null | Algos/search.py | Suraj-Rajesh/code | 3d554c4d1d5cf4bd9d084b8034641c1f6c2a47c9 | [
"MIT"
] | null | null | null | Algos/search.py | Suraj-Rajesh/code | 3d554c4d1d5cf4bd9d084b8034641c1f6c2a47c9 | [
"MIT"
] | null | null | null | def binary_search(array, element, begin, end):
if begin > end:
return -1
mid_index = (begin + end)/2
if element < array[mid_index]:
return binary_search(array, element, begin, mid_index - 1)
elif element > array[mid_index]:
return binary_search(array, element, mid_index + 1, end)
else:
return mid_index
if __name__ == '__main__':
lst = [2, 4, 5, 6, 7, 9]
print binary_search(lst, 9, 0, len(lst)-1)
| 27.176471 | 66 | 0.616883 | 68 | 462 | 3.926471 | 0.382353 | 0.179775 | 0.191011 | 0.269663 | 0.501873 | 0.374532 | 0.374532 | 0.374532 | 0.374532 | 0 | 0 | 0.038123 | 0.261905 | 462 | 16 | 67 | 28.875 | 0.744868 | 0 | 0 | 0 | 0 | 0 | 0.017316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.076923 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
79ec1f3f56205092e2a4cfa0b32a563586151a1d | 594 | py | Python | server/service/helper/dict_helper.py | EtienneTurc/IChooseYou | 9ea7767b793ba6ef389f7cc806a02db2e1434c70 | [
"MIT"
] | 4 | 2022-01-10T10:04:12.000Z | 2022-01-10T18:05:48.000Z | server/service/helper/dict_helper.py | EtienneTurc/IChooseYou | 9ea7767b793ba6ef389f7cc806a02db2e1434c70 | [
"MIT"
] | null | null | null | server/service/helper/dict_helper.py | EtienneTurc/IChooseYou | 9ea7767b793ba6ef389f7cc806a02db2e1434c70 | [
"MIT"
] | null | null | null | import numpy as np
def pick(dict, elements):
new_dict = {}
for el in elements:
new_dict[el] = dict.get(el)
return new_dict
def get_by_path(dict, path: str):
keys = path.split(".")
value = dict
for key in keys:
if value is None:
return None
value = value.get(key)
return value
def normalize(input_list: list[float]) -> list[float]:
return list(np.array(input_list) / np.sum(input_list))
def clean_none_values(dict: dict[str, any]) -> dict[str, any]:
return {key: dict[key] for key in dict if dict[key] is not None}
| 22 | 68 | 0.624579 | 94 | 594 | 3.840426 | 0.361702 | 0.058172 | 0.083102 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.255892 | 594 | 26 | 69 | 22.846154 | 0.816742 | 0 | 0 | 0 | 0 | 0 | 0.001684 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.055556 | 0.111111 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
79ed9fdffc87f71383397878bb7d216ee11a46f9 | 521 | py | Python | astor/__init__.py | theanalyst/astor | 826cb61433c811a3c7b41140253149afb6275f32 | [
"BSD-3-Clause"
] | null | null | null | astor/__init__.py | theanalyst/astor | 826cb61433c811a3c7b41140253149afb6275f32 | [
"BSD-3-Clause"
] | null | null | null | astor/__init__.py | theanalyst/astor | 826cb61433c811a3c7b41140253149afb6275f32 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Part of the astor library for Python AST manipulation.
License: 3-clause BSD
Copyright 2012 (c) Patrick Maupin
Copyright 2013 (c) Berker Peksag
"""
__version__ = '0.4'
from .codegen import to_source # NOQA
from .misc import iter_node, dump, all_symbols, get_anyop # NOQA
from .misc import get_boolop, get_binop, get_cmpop, get_unaryop # NOQA
from .misc import ExplicitNodeVisitor # NOQA
from .misc import parsefile, CodeToAst, codetoast # NOQA
from .treewalk import TreeWalk # NOQA
| 26.05 | 71 | 0.744722 | 75 | 521 | 5.013333 | 0.653333 | 0.106383 | 0.12766 | 0.191489 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02765 | 0.166987 | 521 | 19 | 72 | 27.421053 | 0.83871 | 0.380038 | 0 | 0 | 0 | 0 | 0.00974 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.857143 | 0 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
79f03228c0c50f20ecbfe884c608a0ec7cf8e10b | 114 | py | Python | cosycar/calendar_events.py | eragnms/cosy-car | 73290ee01cf79b75d42fdd4b0fdb9188af797113 | [
"MIT"
] | null | null | null | cosycar/calendar_events.py | eragnms/cosy-car | 73290ee01cf79b75d42fdd4b0fdb9188af797113 | [
"MIT"
] | null | null | null | cosycar/calendar_events.py | eragnms/cosy-car | 73290ee01cf79b75d42fdd4b0fdb9188af797113 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import logging
log = logging.getLogger(__name__)
class CalendarEvents():
pass
| 11.4 | 33 | 0.640351 | 12 | 114 | 5.75 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011236 | 0.219298 | 114 | 9 | 34 | 12.666667 | 0.764045 | 0.184211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.25 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
0341a5ec6b7c0df0f2688a24258c80a7827b06c4 | 130 | py | Python | project_name/todo_api/models.py | Saknowman/django-rest-vue-template | f97139b28aa148609561a1018ea2aef9bd3b4374 | [
"MIT"
] | null | null | null | project_name/todo_api/models.py | Saknowman/django-rest-vue-template | f97139b28aa148609561a1018ea2aef9bd3b4374 | [
"MIT"
] | 9 | 2019-11-02T00:37:12.000Z | 2022-02-10T13:49:16.000Z | project_name/todo_api/models.py | Saknowman/django-rest-vue-template | f97139b28aa148609561a1018ea2aef9bd3b4374 | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
class TodoTask(models.Model):
title = models.CharField(max_length=30)
| 18.571429 | 41 | 0.769231 | 19 | 130 | 5.210526 | 0.842105 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017857 | 0.138462 | 130 | 6 | 42 | 21.666667 | 0.866071 | 0.184615 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
cee821d52be2a70c889749b6f89c7fb3352eeeba | 102 | py | Python | chapter_05_mathematics/section_5_1_decimal/5_2_decimal_tuple.py | wuxiaofeng8764/P3SL_Example | 8ce1877af7372211b20836f799a8c44679577b7c | [
"MIT"
] | null | null | null | chapter_05_mathematics/section_5_1_decimal/5_2_decimal_tuple.py | wuxiaofeng8764/P3SL_Example | 8ce1877af7372211b20836f799a8c44679577b7c | [
"MIT"
] | null | null | null | chapter_05_mathematics/section_5_1_decimal/5_2_decimal_tuple.py | wuxiaofeng8764/P3SL_Example | 8ce1877af7372211b20836f799a8c44679577b7c | [
"MIT"
] | null | null | null | import decimal
# Tuple
t = (1, (1, 1), -2)
print('Input :', t)
print('Decimal:', decimal.Decimal(t))
| 14.571429 | 37 | 0.598039 | 16 | 102 | 3.8125 | 0.5 | 0.065574 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046512 | 0.156863 | 102 | 6 | 38 | 17 | 0.662791 | 0.04902 | 0 | 0 | 0 | 0 | 0.157895 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
301536f633baaa8f3b6e700632964eaf48180c60 | 1,085 | py | Python | calculator.py | 64u71bm/Python-Programs | 601d4a171593b84f7fada1870ddddd3999eb16a0 | [
"MIT"
] | 1 | 2018-12-07T15:19:33.000Z | 2018-12-07T15:19:33.000Z | calculator.py | 64u71bm/Python-Programs | 601d4a171593b84f7fada1870ddddd3999eb16a0 | [
"MIT"
] | null | null | null | calculator.py | 64u71bm/Python-Programs | 601d4a171593b84f7fada1870ddddd3999eb16a0 | [
"MIT"
] | null | null | null | n=input("enter the no. of times you want to perform a particular task ")
print " 1-Addition "
print " 2-Subtraction "
print " 3-Multiplication "
print " 4-Division "
print " 5-Exponentiation "
ch=input("enter your choice-> ")
if(ch==1):
for i in range(0,n):
a=input("enter the number")
b=input("enter the second number")
s=a+b
print a,"+",b,"=",s
if(ch==2):
for i in range(0,n):
a=input("enter the number")
b=input("enter the second number")
s=a-b
print a,"-",b,"=",s
if(ch==3):
for i in range(0,n):
a=input("enter the number")
b=input("enter the second number")
s=a*b
print a,"x",b,"=",s
if(ch==4):
for i in range(0,n):
a=input("enter the numerator")
b=input("enter the denominator")
s=a/b
print a,"/",b,"=",s
if(ch==5):
for i in range(0,n):
a=input("enter the number")
b=input("enter the power")
s=a**b
print a,"^",b,"=",s
else:
print "Thank You. Try Again" | 24.111111 | 73 | 0.513364 | 174 | 1,085 | 3.201149 | 0.264368 | 0.21544 | 0.256733 | 0.098743 | 0.567325 | 0.567325 | 0.567325 | 0.547576 | 0.547576 | 0.520646 | 0 | 0.020161 | 0.314286 | 1,085 | 45 | 74 | 24.111111 | 0.728495 | 0 | 0 | 0.307692 | 0 | 0 | 0.478887 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.282051 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
301b602bcc727868497a3197d018ff81ef24787a | 93 | py | Python | Chapter 1/1.8.6.py | Netmistro/Py-Practical-Problems | d4446ab6cda2def2fa94939f349ff27285243f25 | [
"MIT"
] | null | null | null | Chapter 1/1.8.6.py | Netmistro/Py-Practical-Problems | d4446ab6cda2def2fa94939f349ff27285243f25 | [
"MIT"
] | null | null | null | Chapter 1/1.8.6.py | Netmistro/Py-Practical-Problems | d4446ab6cda2def2fa94939f349ff27285243f25 | [
"MIT"
] | null | null | null | temp = eval(input('Enter a number: '))
print( temp, temp*2,temp*3, temp*4, temp*5 ,sep='---') | 46.5 | 54 | 0.612903 | 17 | 93 | 3.352941 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04878 | 0.11828 | 93 | 2 | 54 | 46.5 | 0.646341 | 0 | 0 | 0 | 0 | 0 | 0.202128 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
305906f14ceedf00b4a24e0e6604147a441d0777 | 2,175 | py | Python | sprl/util/experiencebuffer.py | miterion/self-paced-rl | 352c92e0b7b74c807af343211ebf833213626e87 | [
"MIT"
] | 1 | 2022-01-03T18:06:41.000Z | 2022-01-03T18:06:41.000Z | sprl/util/experiencebuffer.py | miterion/self-paced-rl | 352c92e0b7b74c807af343211ebf833213626e87 | [
"MIT"
] | null | null | null | sprl/util/experiencebuffer.py | miterion/self-paced-rl | 352c92e0b7b74c807af343211ebf833213626e87 | [
"MIT"
] | null | null | null | import numpy as np
class ExperienceBuffer:
def __init__(self, size, n_elements=1):
self.size = size
self.elements = tuple([[] for __ in range(0, n_elements)])
def insert(self, *args):
for i in range(0, len(args)):
self.elements[i].append(args[i])
if len(self.elements[i]) > self.size:
self.elements[i].pop(0)
def get(self):
return tuple([np.concatenate(self.elements[i], axis=0) for i in range(0, len(self.elements))])
class SVGD_ExperienceBuffer(ExperienceBuffer):
def insert(self, *args):
for i in range(0, len(args)):
self.elements[i].append(args[i])
np_el = np.concatenate(self.elements[i], axis=0)
while np_el.size > self.size:
if self.elements[i][0].size > np_el.size - self.size:
self.elements[i][0] = self.elements[i][0][:self.size]
else:
self.elements[i].pop(0)
np_el = np.concatenate(self.elements[i], axis=0)
def remove(self, n: int):
for element in self.elements:
del element[n]
def remove_multiple(self, ns: np.ndarray):
assert len(self.elements[0]) == ns.shape[0]
for i in range(0, len(self.elements)):
for j in range(0, ns.shape[0]):
self.elements[i][j] = self.elements[i][j][ns[j]]
class SVGD_ExperienceBuffer2(ExperienceBuffer):
def __init__(self, size, n_elements=1):
self.size = size
self.elements = list((None for _ in range(0, n_elements)))
def get(self):
return tuple(self.elements)
def insert(self, *args):
for i in range(0, len(args)):
if self.elements[i] is None:
self.elements[i] = args[i]
else:
self.elements[i] = np.concatenate((self.elements[i], args[i]), axis=0)
assert self.elements[0].shape[0] <= self.size
def keep_specific_indices(self, ns: np.ndarray):
for i in range(0, len(self.elements)):
self.elements[i] = self.elements[i][ns]
def get_specific(self, i: int):
return self.elements[i] | 32.954545 | 102 | 0.570115 | 307 | 2,175 | 3.957655 | 0.162866 | 0.28642 | 0.213992 | 0.054321 | 0.587654 | 0.427984 | 0.427984 | 0.374486 | 0.352263 | 0.24856 | 0 | 0.016785 | 0.287816 | 2,175 | 66 | 103 | 32.954545 | 0.767592 | 0 | 0 | 0.44898 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040816 | 1 | 0.22449 | false | 0 | 0.020408 | 0.061224 | 0.367347 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
30779fc008a8de76c36c2f237b49ec52adc1fbce | 918 | py | Python | src/fb_waba_manager/fb_waba_manager.py | chr0m1ng/fb-waba-manager | 03ca0e353843cb2583c359fa5653b413c3e886b8 | [
"MIT"
] | null | null | null | src/fb_waba_manager/fb_waba_manager.py | chr0m1ng/fb-waba-manager | 03ca0e353843cb2583c359fa5653b413c3e886b8 | [
"MIT"
] | null | null | null | src/fb_waba_manager/fb_waba_manager.py | chr0m1ng/fb-waba-manager | 03ca0e353843cb2583c359fa5653b413c3e886b8 | [
"MIT"
] | null | null | null | from .services.facebook.whatsapp.waba_service import WabaService
class FbWabaManager:
def __init__(self, access_token, business_id):
self.access_token = access_token
self.business_id = business_id
self.waba_service = WabaService(access_token)
def list_business_wabas(self, notify_requests=False):
return self.waba_service.list_wabas(self.business_id, notify_requests)
def list_waba_phone_numbers(self, waba_id, notify_requests=False):
return self.waba_service.list_phone_numbers(waba_id, notify_requests)
def list_business_phone_numbers(self, wabas=None, notify_requests=False):
return self.waba_service.list_business_phone_numbers(self.business_id, wabas, notify_requests)
def list_message_templates(self, waba_id, notify_requests=False):
return self.waba_service.list_message_templates(waba_id, notify_requests)
| 41.727273 | 103 | 0.764706 | 120 | 918 | 5.441667 | 0.233333 | 0.171516 | 0.114855 | 0.153139 | 0.444104 | 0.300153 | 0.300153 | 0.300153 | 0.165391 | 0.165391 | 0 | 0 | 0.164488 | 918 | 21 | 104 | 43.714286 | 0.851369 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.357143 | false | 0 | 0.071429 | 0.285714 | 0.785714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
0644c21ccefd472f660fa3b92297674b84a1ca9e | 203 | py | Python | labeller/__init__.py | swcho84/smart-labeller | 5bab230671213bf610ae5d3700ec4e905b4a9ae3 | [
"MIT"
] | 6 | 2019-10-18T09:03:46.000Z | 2021-03-10T09:19:54.000Z | labeller/__init__.py | swcho84/smart-labeller | 5bab230671213bf610ae5d3700ec4e905b4a9ae3 | [
"MIT"
] | 2 | 2019-10-18T14:26:06.000Z | 2020-12-16T17:57:25.000Z | labeller/__init__.py | swcho84/smart-labeller | 5bab230671213bf610ae5d3700ec4e905b4a9ae3 | [
"MIT"
] | 2 | 2020-05-20T19:45:25.000Z | 2021-08-06T04:30:34.000Z | from .app import (
AugmentHelper, ExportHelper,
LabelHelper, PartiallyLabelledDataset,
ImageViewer, TagHelper
)
from .base import (
ImageWindow, ask_directory,
ask_file, MessageBox
)
| 20.3 | 42 | 0.73399 | 18 | 203 | 8.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.197044 | 203 | 9 | 43 | 22.555556 | 0.90184 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.222222 | 0 | 0.222222 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0667c6934a17efde55ba0d8a6f64d5a460b2a18e | 313 | py | Python | flaskspawn/cookiecutters/small/{{cookiecutter.repo_name}}/tests/test_app.py | Skablam/flask-spawn | f68efc592952e3b68a11499e2be7d2161105d0b3 | [
"MIT"
] | 6 | 2015-07-05T09:52:27.000Z | 2017-11-05T02:34:32.000Z | flaskspawn/cookiecutters/small/{{cookiecutter.repo_name}}/tests/test_app.py | Skablam/flask-spawn | f68efc592952e3b68a11499e2be7d2161105d0b3 | [
"MIT"
] | 2 | 2015-07-06T12:20:12.000Z | 2016-05-29T23:11:56.000Z | flaskspawn/cookiecutters/small/{{cookiecutter.repo_name}}/tests/test_app.py | Skablam/flask-spawn | f68efc592952e3b68a11499e2be7d2161105d0b3 | [
"MIT"
] | 1 | 2017-02-18T21:32:38.000Z | 2017-02-18T21:32:38.000Z | from application.views import app
import unittest
import os
class TestRoutes(unittest.TestCase):
def setUp(self):
app.config.from_object(os.environ.get('SETTINGS'))
self.app = app.test_client()
def test_health(self):
self.assertEqual((self.app.get('/health')).status, '200 OK')
| 24.076923 | 68 | 0.686901 | 42 | 313 | 5.047619 | 0.595238 | 0.099057 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011673 | 0.178914 | 313 | 12 | 69 | 26.083333 | 0.81323 | 0 | 0 | 0 | 0 | 0 | 0.067093 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.222222 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
06682951517eb1b84b3e1552919dd84d34f61596 | 3,240 | py | Python | data_manipulation.py | icacedo/DL_practice | 9dce40d2dc72b4bada710417ce7139b9349633e1 | [
"MIT"
] | null | null | null | data_manipulation.py | icacedo/DL_practice | 9dce40d2dc72b4bada710417ce7139b9349633e1 | [
"MIT"
] | null | null | null | data_manipulation.py | icacedo/DL_practice | 9dce40d2dc72b4bada710417ce7139b9349633e1 | [
"MIT"
] | null | null | null | # numpy only supports CPU computation, unlike pytorch or tensorflow
# tensors are an n-dimensional array
# tensor class supports automatic differentiation
# tutorial can be done in MXNET, PYTORCH, or TENSORFLOW
# pytorch tutorial is done here
# import torch instead of pytorch
# tensor with one axis = vector, two = matrix; kth order tensor
import torch
'''
# create new tensor of evenly spaced values
x = torch.arange(12, dtype=torch.float32)
print(x)
print(x.shape)
print(x.numel())
X = x.reshape(3,4)
print(X)
# -1 means the tensor automatically infers this dimension
X = x.reshape(-1,4)
print(X)
# 2 here is another dimension
z = torch.zeros((2, 3, 4))
print(z)
o = torch.ones((2, 3, 4))
print(o)
# sample elements from a standard Gaussian (normal) distribution
r = torch.randn(3, 4)
print(r)
# specify exact values in a tensor
s = torch.tensor([[2,1,4,3],[1,2,3,4],[4,3,2,1]])
print(s)
'''
'''
# operations
# elementwise operations
# operators can be lifted to elementwise operators
# so long as tensors are identically shaped?
x = torch.tensor([1.0, 2, 4, 8])
y = torch.tensor([2, 2, 2, 2])
# can use +, -, *, /, **
print(x + y, x ** y)
# apply unary operator like exponentiation
# can specify the exponential with another tensor
print(torch.exp(x))
X = torch.arange(12, dtype=torch.float32).reshape((3,4))
Y = torch.tensor([[2.0,1,4,3],[1,2,3,4],[4,3,2,1]])
# concatenate
# dim 0 = row, dim 1 = column
XY = torch.cat((X, Y), dim=0), torch.cat((X, Y), dim=1)
print(XY)
# binary tensor
# true if the entry at the same position is the same
print(X == Y)
# sum all elements in a tensor
print(X.sum())
# boradcasting mechanism
# perform elementwise operations even when shapes differ
# need to copy elements so the tensors have the same shape
a = torch.arange(3).reshape((3, 1))
print(a)
b = torch.arange(2).reshape((1, 2))
print(b)
# broadcast entries in a and b to a 3x2 matriX (prev 3x1 and 1x2)
print(a + b)
# indexing and slicing
# -1 is the last element, 1:3 is the second and third
print(X[-1], X[1:3])
# write elements of a matrix by specifying indices
X[1, 2] = 9
print(X)
X[0:2, :] = 12
print(X)
# saving memory
# i don't really understand this section
# id gives exact location of referenced object in memory
before = id(Y)
print(before)
Y = Y + X
print(id(Y) == before)
# updates to objects should be done in place to prevent
# references from pointing to old memory location
# in-place operations
# zeros_like allocates a block of 0 entries
Z = torch.zeros_like(Y)
print('id(Z):', id(Z))
# assign result of operation to previously allocated array
# with slice notation
Z[:] = X + Y
print('id(Z):', id(Z))
# use X[:] = X + Y or X += Y to 'reduce memory overhead'
before = id(X)
X += Y
print(id(X) == before)
# conversion to other python objects
# can change a NumPy tensor to a torch tensor
# keeping the same memory location
# using in-place operations
A = X.numpy()
B = torch.from_numpy(A)
print(type(A), type(B))
# convert tensor to scalar
a = torch.tensor([3.5])
print(a, a.item(), float(a), int(a))
print(X < Y)
a = torch.arange(1, 6, dtype=torch.float32).reshape((5,1))
b = torch.arange(1, 3).reshape((1, 2))
print(a, b)
print(a + b)
'''
| 16.963351 | 67 | 0.676235 | 566 | 3,240 | 3.865724 | 0.340989 | 0.032907 | 0.012797 | 0.012797 | 0.061243 | 0.04936 | 0.038391 | 0.010055 | 0.010055 | 0.010055 | 0 | 0.03785 | 0.184568 | 3,240 | 190 | 68 | 17.052632 | 0.79031 | 0.100617 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
066b805318979169d213f4294adf74c31d6db4e1 | 460 | py | Python | notifications/migrations/0003_auto_20200503_0113.py | kerolloskromer/Voicee-Backend | 4ceb944b968044341b4f53000e851820f13e0613 | [
"MIT"
] | 1 | 2020-09-29T10:57:21.000Z | 2020-09-29T10:57:21.000Z | notifications/migrations/0003_auto_20200503_0113.py | kerolloskromer/Voicee-Backend | 4ceb944b968044341b4f53000e851820f13e0613 | [
"MIT"
] | 6 | 2021-02-08T20:51:33.000Z | 2021-06-10T20:11:37.000Z | notifications/migrations/0003_auto_20200503_0113.py | kerolloskromer/Voicee-Backend | 4ceb944b968044341b4f53000e851820f13e0613 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.5 on 2020-05-02 23:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('notifications', '0002_auto_20200503_0104'),
]
operations = [
migrations.RemoveField(
model_name='fcmdevicetoken',
name='app_version',
),
migrations.RemoveField(
model_name='fcmdevicetoken',
name='platform',
),
]
| 20.909091 | 53 | 0.586957 | 43 | 460 | 6.139535 | 0.744186 | 0.159091 | 0.19697 | 0.227273 | 0.363636 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0.097179 | 0.306522 | 460 | 21 | 54 | 21.904762 | 0.730408 | 0.097826 | 0 | 0.4 | 1 | 0 | 0.200969 | 0.05569 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.266667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
06852fb8026a576ccbd2d16db5a2ba3f1bd04c52 | 50 | py | Python | scale/trigger/__init__.py | kaydoh/scale | 1b6a3b879ffe83e10d3b9d9074835a4c3bf476ee | [
"Apache-2.0"
] | 121 | 2015-11-18T18:15:33.000Z | 2022-03-10T01:55:00.000Z | scale/trigger/__init__.py | kaydoh/scale | 1b6a3b879ffe83e10d3b9d9074835a4c3bf476ee | [
"Apache-2.0"
] | 1,415 | 2015-12-23T23:36:04.000Z | 2022-01-07T14:10:09.000Z | scale/trigger/__init__.py | kaydoh/scale | 1b6a3b879ffe83e10d3b9d9074835a4c3bf476ee | [
"Apache-2.0"
] | 66 | 2015-12-03T20:38:56.000Z | 2020-07-27T15:28:11.000Z | default_app_config = 'trigger.apps.TriggerConfig'
| 25 | 49 | 0.84 | 6 | 50 | 6.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06 | 50 | 1 | 50 | 50 | 0.851064 | 0 | 0 | 0 | 0 | 0 | 0.52 | 0.52 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
06ab871bf45cd0bb6c3aed3324cbd2b742054bbb | 176 | py | Python | tests/error/is_not_subscriptable02.py | ktok07b6/polyphony | 657c5c7440520db6b4985970bd50547407693ac4 | [
"MIT"
] | 83 | 2015-11-30T09:59:13.000Z | 2021-08-03T09:12:28.000Z | tests/error/is_not_subscriptable02.py | jesseclin/polyphony | 657c5c7440520db6b4985970bd50547407693ac4 | [
"MIT"
] | 4 | 2017-02-10T01:43:11.000Z | 2020-07-14T03:52:25.000Z | tests/error/is_not_subscriptable02.py | jesseclin/polyphony | 657c5c7440520db6b4985970bd50547407693ac4 | [
"MIT"
] | 11 | 2016-11-18T14:39:15.000Z | 2021-02-23T10:05:20.000Z | #'x' is not subscriptable
from polyphony import testbench
def is_not_subscriptable02():
x = 0
x[0] = 0
@testbench
def test():
is_not_subscriptable02()
test()
| 11 | 31 | 0.676136 | 24 | 176 | 4.791667 | 0.5 | 0.130435 | 0.347826 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051095 | 0.221591 | 176 | 15 | 32 | 11.733333 | 0.788321 | 0.136364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0 | 0.375 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
06ada3b3e768fdb9946a2d1847f26c859a3eda40 | 792 | py | Python | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/NV/texture_rectangle.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 210 | 2016-04-09T14:26:00.000Z | 2022-03-25T18:36:19.000Z | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/NV/texture_rectangle.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 72 | 2016-09-04T09:30:19.000Z | 2022-03-27T17:06:53.000Z | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/NV/texture_rectangle.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 64 | 2016-04-09T14:26:49.000Z | 2022-03-21T11:19:47.000Z | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'GL_NV_texture_rectangle'
def _f( function ):
return _p.createFunction( function,_p.PLATFORM.GL,'GL_NV_texture_rectangle',error_checker=_errors._error_checker)
GL_MAX_RECTANGLE_TEXTURE_SIZE_NV=_C('GL_MAX_RECTANGLE_TEXTURE_SIZE_NV',0x84F8)
GL_PROXY_TEXTURE_RECTANGLE_NV=_C('GL_PROXY_TEXTURE_RECTANGLE_NV',0x84F7)
GL_TEXTURE_BINDING_RECTANGLE_NV=_C('GL_TEXTURE_BINDING_RECTANGLE_NV',0x84F6)
GL_TEXTURE_RECTANGLE_NV=_C('GL_TEXTURE_RECTANGLE_NV',0x84F5)
| 41.684211 | 117 | 0.834596 | 125 | 792 | 4.824 | 0.4 | 0.159204 | 0.033168 | 0.074627 | 0.419569 | 0.089552 | 0 | 0 | 0 | 0 | 0 | 0.022039 | 0.083333 | 792 | 18 | 118 | 44 | 0.80854 | 0.126263 | 0 | 0 | 1 | 0 | 0.23538 | 0.23538 | 0 | 0 | 0.035088 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.461538 | 0.076923 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
ebfb587747de426e3ede280b34dcfd7b3b623fe4 | 447 | py | Python | behavex/__init__.py | Vocalo/behavex | 313f3406139f4d6d54299a06a7fdd00a283fe4fd | [
"MIT"
] | 39 | 2021-07-14T17:43:56.000Z | 2022-03-25T11:21:58.000Z | behavex/__init__.py | Vocalo/behavex | 313f3406139f4d6d54299a06a7fdd00a283fe4fd | [
"MIT"
] | 7 | 2021-10-01T08:17:19.000Z | 2022-03-18T20:24:18.000Z | behavex/__init__.py | Vocalo/behavex | 313f3406139f4d6d54299a06a7fdd00a283fe4fd | [
"MIT"
] | 5 | 2021-09-14T20:41:11.000Z | 2022-03-22T22:40:23.000Z | # -*- coding: utf-8 -*-
""" Create environment variables related to the framework path and config,
that are needed in framework modules.
"""
# __future__ import absolute_import added for compatibility
from __future__ import absolute_import
import os
# Set the framework path
os.environ['BEHAVEX_PATH'] = os.path.dirname(os.path.realpath(__file__))
# Set the features path
os.environ['FEATURES_PATH'] = os.path.join(os.getcwd(), 'features')
| 31.928571 | 74 | 0.753915 | 62 | 447 | 5.177419 | 0.564516 | 0.074766 | 0.099688 | 0.161994 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002584 | 0.134228 | 447 | 13 | 75 | 34.384615 | 0.826873 | 0.525727 | 0 | 0 | 0 | 0 | 0.167513 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
230fccf71f3761adabc1a52f2f37392f4cca7595 | 52 | py | Python | pycwr/interp/__init__.py | aliny2003/pycwr | 3186125bdd2f551b9c59639dca567a1c06b50e96 | [
"MIT"
] | 144 | 2019-11-27T14:36:41.000Z | 2022-02-23T08:21:17.000Z | pycwr/interp/__init__.py | zhaopingsun/pycwr | 7459371588e6d0d6d0737e249afa3921fe073151 | [
"MIT"
] | 32 | 2019-11-29T10:11:53.000Z | 2022-03-14T07:46:44.000Z | pycwr/interp/__init__.py | zhaopingsun/pycwr | 7459371588e6d0d6d0737e249afa3921fe073151 | [
"MIT"
] | 57 | 2019-11-27T12:51:44.000Z | 2022-01-29T14:50:05.000Z | from . import RadarInterp
__all__ = ["RadarInterp"] | 17.333333 | 25 | 0.75 | 5 | 52 | 7 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134615 | 52 | 3 | 26 | 17.333333 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0.207547 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
23278ea5a1bdf14f26b071f3af1d7650c61bc30a | 1,687 | py | Python | pgeng/__init__.py | Bouncehball/pgeng | 6f88991e16cfd744c8565b68b6348f313b4d75c0 | [
"MIT"
] | null | null | null | pgeng/__init__.py | Bouncehball/pgeng | 6f88991e16cfd744c8565b68b6348f313b4d75c0 | [
"MIT"
] | null | null | null | pgeng/__init__.py | Bouncehball/pgeng | 6f88991e16cfd744c8565b68b6348f313b4d75c0 | [
"MIT"
] | null | null | null | 'Useful functions and classes for PyGame'
#VARIABLES
__version__ = '1.5'
failed_imports = []
#VARIABLES
#COLLISION
try:
from .collision import *
except ImportError as e:
failed_imports.append(e.name)
#COLLISION
#VFX
try:
from .vfx import *
except ImportError as e:
failed_imports.append(e.name)
#VFX
#ANIMATIONS
try:
from .animations import *
except ImportError as e:
failed_imports.append(e.name)
#ANIMATIONS
#COLOUR
try:
from .colour import *
except ImportError as e:
failed_imports.append(e.name)
#COLOUR
#CORE
try:
from .core import *
except ImportError as e:
failed_imports.append(e.name)
#CORE
#ENTITY
try:
from .entity import Entity
except ImportError as e:
failed_imports.append(e.name)
#ENTITY
#FONT
try:
from .font import *
except ImportError as e:
failed_imports.append(e.name)
#FONT
#SCREEN
try:
from .screen import Screen
except ImportError as e:
failed_imports.append(e.name)
#SCREEN
#SOUNDS
try:
from .sounds import Sounds
except ImportError as e:
failed_imports.append(e.name)
#SOUNDS
#TILE
try:
from .tile import *
except ImportError as e:
failed_imports.append(e.name)
#TILE
#MESSAGES
print('''\nDo help(pgeng.<Function>) to get the documentation of the function (or possibly class)
Or do help(pgeng.<Package Content>) to get the documentation of the functions or classes in a file\n''')
print(f'Failed to import: {", ".join([failed_import.split(".")[-1] + " from " + ".".join(failed_import.split(".")[:-1]) if "pgeng" in failed_import else failed_import for failed_import in set(failed_imports)])}') if failed_imports else None
del failed_imports
#MESSAGES | 20.573171 | 241 | 0.714286 | 241 | 1,687 | 4.904564 | 0.248963 | 0.153976 | 0.160745 | 0.169205 | 0.489002 | 0.451777 | 0.407783 | 0.407783 | 0.407783 | 0.296108 | 0 | 0.002888 | 0.179016 | 1,687 | 82 | 242 | 20.573171 | 0.850542 | 0.112626 | 0 | 0.638298 | 0 | 0.042553 | 0.302163 | 0.083043 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.702128 | 0 | 0.702128 | 0.042553 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
232b5307202c2aaea0ef1311f24101a87d354e80 | 157 | py | Python | Portfolio_Django/home/urls.py | adityagirigoudar/adityagirigoudar.github.io | 3e8631a528d5ad01d80bb0d563267385c196af31 | [
"Apache-2.0"
] | null | null | null | Portfolio_Django/home/urls.py | adityagirigoudar/adityagirigoudar.github.io | 3e8631a528d5ad01d80bb0d563267385c196af31 | [
"Apache-2.0"
] | null | null | null | Portfolio_Django/home/urls.py | adityagirigoudar/adityagirigoudar.github.io | 3e8631a528d5ad01d80bb0d563267385c196af31 | [
"Apache-2.0"
] | null | null | null | from django.contrib import admin
from django.urls import path, include
from home import views
urlpatterns = [
path('/', views.home, name='home')
] | 22.428571 | 39 | 0.700637 | 21 | 157 | 5.238095 | 0.571429 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.191083 | 157 | 7 | 40 | 22.428571 | 0.866142 | 0 | 0 | 0 | 0 | 0 | 0.032895 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2333d99d81711c8bb6b2bfad4490c66b0fb4b7a5 | 2,249 | py | Python | gcpdiag/queries/cloudsql.py | GoogleCloudPlatform/gcpdiag | 1fb20974c80b54c145cb4281d8b254a0ad59667d | [
"Apache-2.0"
] | 63 | 2021-09-28T16:29:19.000Z | 2022-03-30T02:01:15.000Z | gcpdiag/queries/cloudsql.py | GoogleCloudPlatform/gcpdiag | 1fb20974c80b54c145cb4281d8b254a0ad59667d | [
"Apache-2.0"
] | 10 | 2021-10-06T11:59:44.000Z | 2022-03-24T16:41:38.000Z | gcpdiag/queries/cloudsql.py | GoogleCloudPlatform/gcpdiag | 1fb20974c80b54c145cb4281d8b254a0ad59667d | [
"Apache-2.0"
] | 20 | 2021-09-28T18:38:29.000Z | 2022-03-24T10:19:56.000Z | # Copyright 2021 Google LLC
#
# 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.
"""Queries related to CloudSQL."""
import ipaddress
from typing import Iterable
from boltons.iterutils import get_path
from gcpdiag import caching, config, models
from gcpdiag.queries import apis
class Instance(models.Resource):
""" Represents CloudSQL Instnace"""
_resource_data: dict
def __init__(self, project_id: str, resource_data: dict):
super().__init__(project_id)
self._resource_data = resource_data
@property
def name(self) -> str:
return self._resource_data['name']
@property
def status(self) -> str:
return self._resource_data['state']
@property
def version(self) -> str:
return self._resource_data['databaseVersion']
@property
def is_regional(self) -> bool:
return get_path(self._resource_data, ('settings', 'availabilityType'),
default='ZONAL') == 'REGIONAL'
@property
def ip_addresses(self) -> Iterable[ipaddress.IPv4Address]:
return [
ipaddress.ip_address(nic['ipAddress'])
for nic in self._resource_data.get('ipAddresses', [])
]
@property
def self_link(self) -> str:
return self._resource_data['selfLink']
@property
def full_path(self) -> str:
return self.self_link
def __str__(self) -> str:
return self.self_link
@caching.cached_api_call
def get_instances(context: models.Context) -> Iterable[Instance]:
if not apis.is_enabled(context.project_id, 'sqladmin'):
return []
api = apis.get_api('sqladmin', 'v1', context.project_id)
query = api.instances().list(project=context.project_id)
resp = query.execute(num_retries=config.API_RETRIES)
return [Instance(context.project_id, d) for d in resp.get('items', [])]
| 28.833333 | 74 | 0.719876 | 302 | 2,249 | 5.188742 | 0.437086 | 0.076579 | 0.071474 | 0.065093 | 0.105935 | 0.105935 | 0 | 0 | 0 | 0 | 0 | 0.005371 | 0.172076 | 2,249 | 77 | 75 | 29.207792 | 0.836198 | 0.269898 | 0 | 0.2 | 0 | 0 | 0.069221 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0.177778 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
23471b2f645e0643310cbb569aef8a2a716eed78 | 347 | py | Python | blog_api/views.py | maiconwa/crispy-eureka | 8b3c575516582b71b71686c4aec04ce4e18745a1 | [
"MIT"
] | null | null | null | blog_api/views.py | maiconwa/crispy-eureka | 8b3c575516582b71b71686c4aec04ce4e18745a1 | [
"MIT"
] | null | null | null | blog_api/views.py | maiconwa/crispy-eureka | 8b3c575516582b71b71686c4aec04ce4e18745a1 | [
"MIT"
] | null | null | null | from rest_framework import generics
from blog.models import Post
from .serializers import PostSerializer
class PostList(generics.ListCreateAPIView):
queryset = Post.postobjects.all()
serializer_class = PostSerializer
class PostDetail(generics.RetrieveAPIView):
queryset = Post.objects.all()
serializer_class = PostSerializer | 28.916667 | 43 | 0.792507 | 36 | 347 | 7.555556 | 0.555556 | 0.139706 | 0.132353 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144092 | 347 | 12 | 44 | 28.916667 | 0.915825 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 1 | 0 | 0 | 3 |
234e1f915822bbbc7845eed6f5fff5c0684c7dce | 775 | py | Python | REM/Tool/IDA 7.3/plugins/bochs/api_ntdll.py | dodieboy/Np_class | af9ec993eda3c1e2bf70257c8384696bb64a5e9d | [
"MIT"
] | null | null | null | REM/Tool/IDA 7.3/plugins/bochs/api_ntdll.py | dodieboy/Np_class | af9ec993eda3c1e2bf70257c8384696bb64a5e9d | [
"MIT"
] | null | null | null | REM/Tool/IDA 7.3/plugins/bochs/api_ntdll.py | dodieboy/Np_class | af9ec993eda3c1e2bf70257c8384696bb64a5e9d | [
"MIT"
] | 2 | 2021-03-30T00:46:58.000Z | 2021-12-12T23:41:12.000Z | #// The format of this file is descriped in api_kernel32.idc
#///func=RtlGetLastWin32Error entry=bochsys._BxWin32GetLastError@0
#///func=RtlSetLastWin32Error entry=bochsys._BxWin32SetLastError@4
#///func=NtSetLdtEntries purge=24
#///func=RtlAllocateHeap entry=nt_HeapAlloc
def nt_HeapAlloc():
# Redirect HeapAlloc -> VirtualAlloc
cpu.eax = BochsVirtAlloc(0, BochsGetParam(3), 1)
return 0
#///func=RtlEncodePointer entry=nt_EncodePointer purge=4
def nt_EncodePointer():
cpu.eax = BochsGetParam(1) ^ 0x11223344 # return the same parameter scrambled with a constant
return 0
#///func=RtlDecodePointer entry=nt_DecodePointer purge=4
def nt_DecodePointer():
cpu.eax = BochsGetParam(1) ^ 0x11223344; # return the same parameter scrambled with a constant
return 0
| 35.227273 | 96 | 0.779355 | 97 | 775 | 6.134021 | 0.484536 | 0.02521 | 0.036975 | 0.036975 | 0.272269 | 0.272269 | 0.272269 | 0.272269 | 0.272269 | 0.272269 | 0 | 0.061493 | 0.11871 | 775 | 21 | 97 | 36.904762 | 0.809663 | 0.660645 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0.079051 | 0 | 0 | 1 | 0.333333 | true | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2372a51a6d97d7571ab4bfdb8896bbf72f559696 | 260 | py | Python | mmtrack/models/mot/__init__.py | akiozihao/center_track | 3a06c91044e9f441963f6f602a6f223bad0eeaaa | [
"Apache-2.0"
] | null | null | null | mmtrack/models/mot/__init__.py | akiozihao/center_track | 3a06c91044e9f441963f6f602a6f223bad0eeaaa | [
"Apache-2.0"
] | null | null | null | mmtrack/models/mot/__init__.py | akiozihao/center_track | 3a06c91044e9f441963f6f602a6f223bad0eeaaa | [
"Apache-2.0"
] | 1 | 2021-07-15T00:26:35.000Z | 2021-07-15T00:26:35.000Z | from .base import BaseMultiObjectTracker
from .deep_sort import DeepSORT
from .trackers import * # noqa: F401,F403
from .tracktor import Tracktor
from .center_track import CenterTrack
__all__ = ['BaseMultiObjectTracker', 'Tracktor', 'DeepSORT','CenterTrack']
| 37.142857 | 74 | 0.8 | 29 | 260 | 6.965517 | 0.551724 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025974 | 0.111538 | 260 | 6 | 75 | 43.333333 | 0.848485 | 0.057692 | 0 | 0 | 0 | 0 | 0.201646 | 0.090535 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.833333 | 0 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2378daa5b529f2caf2f310c7e0adf6c1f1cc32b1 | 253 | py | Python | hw6/hasker/questions/admin.py | mcherdakov/otus-python-professional | 405101c6492c0e8343783d42be4a0070e5fa9e54 | [
"MIT"
] | null | null | null | hw6/hasker/questions/admin.py | mcherdakov/otus-python-professional | 405101c6492c0e8343783d42be4a0070e5fa9e54 | [
"MIT"
] | null | null | null | hw6/hasker/questions/admin.py | mcherdakov/otus-python-professional | 405101c6492c0e8343783d42be4a0070e5fa9e54 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Question, Answer, Tag, QuestionVote, AnswerVote
admin.site.register(Question)
admin.site.register(Answer)
admin.site.register(Tag)
admin.site.register(QuestionVote)
admin.site.register(AnswerVote)
| 23 | 67 | 0.818182 | 33 | 253 | 6.272727 | 0.393939 | 0.217391 | 0.410628 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.079051 | 253 | 10 | 68 | 25.3 | 0.888412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.285714 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
88ba5d27b9ad2eca77e5da8034707142b62f8d8b | 149 | py | Python | balancebot-project/setup.py | Prabhakarku/Self-Balancing-bot | 7cf55556fc8e1434ccfc6fc8654347f13929b86e | [
"MIT"
] | 10 | 2018-11-27T19:57:27.000Z | 2021-08-17T02:49:09.000Z | balancebot-project/setup.py | Prabhakarku/Self-Balancing-bot | 7cf55556fc8e1434ccfc6fc8654347f13929b86e | [
"MIT"
] | null | null | null | balancebot-project/setup.py | Prabhakarku/Self-Balancing-bot | 7cf55556fc8e1434ccfc6fc8654347f13929b86e | [
"MIT"
] | 3 | 2019-03-25T15:02:57.000Z | 2021-09-12T23:35:00.000Z | from setuptools import setup
setup(name='balance_bot',
version='0.0.1',
install_requires=['gym',
'pybullet']
)
| 18.625 | 35 | 0.550336 | 16 | 149 | 5 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0.315436 | 149 | 7 | 36 | 21.285714 | 0.754902 | 0 | 0 | 0 | 0 | 0 | 0.181208 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
88e774ce85e3ab89546f17ab37025aed988c3e97 | 80 | py | Python | read_my_file.py | rafaelgramoschi/warehouse.api.flask | 8d726f0fc6ce6ab4cc421c30493f03e6ae9dca52 | [
"MIT"
] | null | null | null | read_my_file.py | rafaelgramoschi/warehouse.api.flask | 8d726f0fc6ce6ab4cc421c30493f03e6ae9dca52 | [
"MIT"
] | null | null | null | read_my_file.py | rafaelgramoschi/warehouse.api.flask | 8d726f0fc6ce6ab4cc421c30493f03e6ae9dca52 | [
"MIT"
] | null | null | null | def read_first_line(file):
with open(file, "r") as f:
return f.readlines()[0] | 26.666667 | 27 | 0.6875 | 15 | 80 | 3.533333 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.1375 | 80 | 3 | 28 | 26.666667 | 0.753623 | 0 | 0 | 0 | 0 | 0 | 0.012346 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
88f5b63bfaf8cc73ae41af5d55345ce532793e3f | 13,830 | py | Python | homepage/templates/.cached_templates/terms.html.py | josht27/fomotrial | 40d18dd3fe4fc5e1093a6831447ec3f96f2c5a1a | [
"Apache-2.0"
] | null | null | null | homepage/templates/.cached_templates/terms.html.py | josht27/fomotrial | 40d18dd3fe4fc5e1093a6831447ec3f96f2c5a1a | [
"Apache-2.0"
] | null | null | null | homepage/templates/.cached_templates/terms.html.py | josht27/fomotrial | 40d18dd3fe4fc5e1093a6831447ec3f96f2c5a1a | [
"Apache-2.0"
] | null | null | null | # -*- coding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
STOP_RENDERING = runtime.STOP_RENDERING
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1520526928.275338
_enable_loop = True
_template_filename = 'C:/Users/mayaroney/desktop/fomo/homepage/templates/terms.html'
_template_uri = 'terms.html'
_source_encoding = 'utf-8'
import django_mako_plus
import django_mako_plus
_exports = ['top_center', 'content_center']
def _mako_get_namespace(context, name):
try:
return context.namespaces[(__name__, name)]
except KeyError:
_mako_generate_namespaces(context)
return context.namespaces[(__name__, name)]
def _mako_generate_namespaces(context):
pass
def _mako_inherit(template, context):
_mako_generate_namespaces(context)
return runtime._inherit_from(context, 'app_base.html', _template_uri)
def render_body(context,**pageargs):
__M_caller = context.caller_stack._push_frame()
try:
__M_locals = __M_dict_builtin(pageargs=pageargs)
def top_center():
return render_top_center(context._locals(__M_locals))
def content_center():
return render_content_center(context._locals(__M_locals))
__M_writer = context.writer()
__M_writer('\r\n\r\n')
if 'parent' not in context._data or not hasattr(context._data['parent'], 'top_center'):
context['self'].top_center(**pageargs)
__M_writer('\r\n\r\n')
if 'parent' not in context._data or not hasattr(context._data['parent'], 'content_center'):
context['self'].content_center(**pageargs)
__M_writer('\r\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_top_center(context,**pageargs):
__M_caller = context.caller_stack._push_frame()
try:
def top_center():
return render_top_center(context)
__M_writer = context.writer()
__M_writer('\r\n<h1>Terms & Conditions</h1>\r\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_content_center(context,**pageargs):
__M_caller = context.caller_stack._push_frame()
try:
def content_center():
return render_content_center(context)
__M_writer = context.writer()
__M_writer("\r\n\r\n\r\n\r\n\r\n<p>\r\n These terms and conditions govern your use of this website; by using this website, you accept these terms and conditions in full. If you disagree with these terms and conditions or any part of these terms and conditions, you must not use this website.\r\n\r\n[You must be at least [18] years of age to use this website. By using this website [and by agreeing to these terms and conditions] you warrant and represent that you are at least [18] years of age.]\r\n\r\n[This website uses cookies. By using this website and agreeing to these terms and conditions, you consent to our [NAME]'s use of cookies in accordance with the terms of [NAME]'s [privacy policy / cookies policy].]\r\n</p>\r\n\r\n<h3>License to use website</h3>\r\n<p>\r\nUnless otherwise stated, [NAME] and/or its licensors own the intellectual property rights in the website and material on the website. Subject to the license below, all these intellectual property rights are reserved.\r\n<br/>\r\nYou may view, download for caching purposes only, and print pages [or [OTHER CONTENT]] from the website for your own personal use, subject to the restrictions set out below and elsewhere in these terms and conditions.\r\n<br/>\r\nYou must not:\r\n<ul>\r\n <li>republish material from this website (including republication on another website);</li>\r\n <li>sell, rent or sub-license material from the website;</li>\r\n <li>show any material from the website in public;</li>\r\n <li>reproduce, duplicate, copy or otherwise exploit material on this website for a commercial purpose;]</li>\r\n <li>[edit or otherwise modify any material on the website; or]</li>\r\n <li>[redistribute material from this website [except for content specifically and expressly made available for redistribution].]</li>\r\n</ul>\r\n<br/>\r\n[Where content is specifically made available for redistribution, it may only be redistributed [within your organisation].]\r\n</p>\r\n\r\n<h3>Acceptable use</h3>\r\n\r\n<p>\r\n You must not use this website in any way that causes, or may cause, damage to the website or impairment of the availability or accessibility of the website; or in any way which is unlawful, illegal, fraudulent or harmful, or in connection with any unlawful, illegal, fraudulent or harmful purpose or activity.\r\n<br/>\r\n You must not use this website to copy, store, host, transmit, send, use, publish or distribute any material which consists of (or is linked to) any spyware, computer virus, Trojan horse, worm, keystroke logger, rootkit or other malicious computer software.\r\n<br/>\r\n You must not conduct any systematic or automated data collection activities (including without limitation scraping, data mining, data extraction and data harvesting) on or in relation to this website without [NAME'S] express written consent.\r\n<br/>\r\n [You must not use this website to transmit or send unsolicited commercial communications.]\r\n<br/>\r\n [You must not use this website for any purposes related to marketing without [NAME'S] express written consent.]\r\n</p>\r\n\r\n<h3>Restricted access</h3>\r\n<p>\r\n[Access to certain areas of this website is restricted.] [NAME] reserves the right to restrict access to [other] areas of this website, or indeed this entire website, at [NAME'S] discretion.\r\n<br/>\r\nIf [NAME] provides you with a user ID and password to enable you to access restricted areas of this website or other content or services, you must ensure that the user ID and password are kept confidential.\r\n<br/>\r\n[[NAME] may disable your user ID and password in [NAME'S] sole discretion without notice or explanation.]\r\n</p><br/>\r\n\r\n<h3>User content</h3>\r\n<p>\r\nIn these terms and conditions, “your user content” means material (including without limitation text, images, audio material, video material and audio-visual material) that you submit to this website, for whatever purpose.\r\n<br/>\r\nYou grant to [NAME] a worldwide, irrevocable, non-exclusive, royalty-free license to use, reproduce, adapt, publish, translate and distribute your user content in any existing or future media. You also grant to [NAME] the right to sub-license these rights, and the right to bring an action for infringement of these rights.\r\n<br/>\r\nYour user content must not be illegal or unlawful, must not infringe any third party's legal rights, and must not be capable of giving rise to legal action whether against you or [NAME] or a third party (in each case under any applicable law).\r\n<br/>\r\nYou must not submit any user content to the website that is or has ever been the subject of any threatened or actual legal proceedings or other similar complaint.\r\n<br/>\r\n[NAME] reserves the right to edit or remove any material submitted to this website, or stored on [NAME'S] servers, or hosted or published upon this website.\r\n<br/>\r\n[Notwithstanding [NAME'S] rights under these terms and conditions in relation to user content, [NAME] does not undertake to monitor the submission of such content to, or the publication of such content on, this website.]\r\n</p><br/>\r\n\r\n<h3>No warranties</h3>\r\n<p>\r\nThis website is provided “as is” without any representations or warranties, express or implied. [NAME] makes no representations or warranties in relation to this website or the information and materials provided on this website.\r\n<br/>\r\nWithout prejudice to the generality of the foregoing paragraph, [NAME] does not warrant that:\r\n<br/>\r\n\uf06c\tthis website will be constantly available, or available at all; or\r\n\uf06c\tthe information on this website is complete, true, accurate or non-misleading.\r\n<br/>\r\nNothing on this website constitutes, or is meant to constitute, advice of any kind. [If you require advice in relation to any [legal, financial or medical] matter you should consult an appropriate professional.]\r\n</p><br/>\r\n\r\n<h3>Limitations of liability</h3>\r\n\r\n[NAME] will not be liable to you (whether under the law of contact, the law of torts or otherwise) in relation to the contents of, or use of, or otherwise in connection with, this website:\r\n\r\n\uf06c\t[to the extent that the website is provided free-of-charge, for any direct loss;]\r\n\uf06c\tfor any indirect, special or consequential loss; or\r\n\uf06c\tfor any business losses, loss of revenue, income, profits or anticipated savings, loss of contracts or business relationships, loss of reputation or goodwill, or loss or corruption of information or data.\r\n\r\nThese limitations of liability apply even if [NAME] has been expressly advised of the potential loss.\r\n\r\nExceptions\r\n\r\nNothing in this website disclaimer will exclude or limit any warranty implied by law that it would be unlawful to exclude or limit; and nothing in this website disclaimer will exclude or limit [NAME'S] liability in respect of any:\r\n\r\n\uf06c\tdeath or personal injury caused by [NAME'S] negligence;\r\n\uf06c\tfraud or fraudulent misrepresentation on the part of [NAME]; or\r\n\uf06c\tmatter which it would be illegal or unlawful for [NAME] to exclude or limit, or to attempt or purport to exclude or limit, its liability.\r\n\r\nReasonableness\r\n\r\nBy using this website, you agree that the exclusions and limitations of liability set out in this website disclaimer are reasonable.\r\n\r\nIf you do not think they are reasonable, you must not use this website.\r\n\r\nOther parties\r\n\r\n[You accept that, as a limited liability entity, [NAME] has an interest in limiting the personal liability of its officers and employees. You agree that you will not bring any claim personally against [NAME'S] officers or employees in respect of any losses you suffer in connection with the website.]\r\n\r\n[Without prejudice to the foregoing paragraph,] you agree that the limitations of warranties and liability set out in this website disclaimer will protect [NAME'S] officers, employees, agents, subsidiaries, successors, assigns and sub-contractors as well as [NAME].\r\n\r\nUnenforceable provisions\r\n\r\nIf any provision of this website disclaimer is, or is found to be, unenforceable under applicable law, that will not affect the enforceability of the other provisions of this website disclaimer.\r\n\r\nIndemnity\r\n\r\nYou hereby indemnify [NAME] and undertake to keep [NAME] indemnified against any losses, damages, costs, liabilities and expenses (including without limitation legal expenses and any amounts paid by [NAME] to a third party in settlement of a claim or dispute on the advice of [NAME'S] legal advisers) incurred or suffered by [NAME] arising out of any breach by you of any provision of these terms and conditions[, or arising out of any claim that you have breached any provision of these terms and conditions].\r\n\r\nBreaches of these terms and conditions\r\n\r\nWithout prejudice to [NAME'S] other rights under these terms and conditions, if you breach these terms and conditions in any way, [NAME] may take such action as [NAME] deems appropriate to deal with the breach, including suspending your access to the website, prohibiting you from accessing the website, blocking computers using your IP address from accessing the website, contacting your internet service provider to request that they block your access to the website and/or bringing court proceedings against you.\r\n\r\nVariation\r\n\r\n[NAME] may revise these terms and conditions from time-to-time. Revised terms and conditions will apply to the use of this website from the date of the publication of the revised terms and conditions on this website. Please check this page regularly to ensure you are familiar with the current version.\r\n\r\nAssignment\r\n\r\n[NAME] may transfer, sub-contract or otherwise deal with [NAME'S] rights and/or obligations under these terms and conditions without notifying you or obtaining your consent.\r\n\r\nYou may not transfer, sub-contract or otherwise deal with your rights and/or obligations under these terms and conditions.\r\n\r\nSeverability\r\n\r\nIf a provision of these terms and conditions is determined by any court or other competent authority to be unlawful and/or unenforceable, the other provisions will continue in effect. If any unlawful and/or unenforceable provision would be lawful or enforceable if part of it were deleted, that part will be deemed to be deleted, and the rest of the provision will continue in effect.\r\n\r\nEntire agreement\r\n\r\nThese terms and conditions [, together with [DOCUMENTS],] constitute the entire agreement between you and [NAME] in relation to your use of this website, and supersede all previous agreements in respect of your use of this website.\r\n\r\nLaw and jurisdiction\r\n\r\nThese terms and conditions will be governed by and construed in accordance with [GOVERNING LAW], and any disputes relating to these terms and conditions will be subject to the [non-]exclusive jurisdiction of the courts of [JURISDICTION].\r\n\r\nCredit: This document was created using a Contractology template available at http://www.contractology.com.\r\n\r\n")
return ''
finally:
context.caller_stack._pop_frame()
"""
__M_BEGIN_METADATA
{"filename": "C:/Users/mayaroney/desktop/fomo/homepage/templates/terms.html", "uri": "terms.html", "source_encoding": "utf-8", "line_map": {"29": 0, "38": 1, "43": 5, "48": 155, "54": 3, "60": 3, "66": 7, "72": 7, "78": 72}}
__M_END_METADATA
"""
| 166.626506 | 11,129 | 0.759798 | 2,310 | 13,830 | 4.480952 | 0.241558 | 0.023379 | 0.013332 | 0.008888 | 0.284224 | 0.207613 | 0.174186 | 0.132644 | 0.091779 | 0.069752 | 0 | 0.007261 | 0.153579 | 13,830 | 82 | 11,130 | 168.658537 | 0.876986 | 0.001446 | 0 | 0.484375 | 0 | 0.015625 | 0.836854 | 0.115583 | 0 | 0 | 0 | 0 | 0 | 1 | 0.15625 | false | 0.03125 | 0.046875 | 0.0625 | 0.359375 | 0.015625 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
88fefe1cf4126fae21d534d7103853bda64b9abb | 222 | py | Python | tests/test_utility.py | nthienan/sonarqube-exporter | 9416944ceb18a16462b17c5bf257f34c4dee5d0c | [
"MIT"
] | 1 | 2022-01-02T03:26:54.000Z | 2022-01-02T03:26:54.000Z | tests/test_utility.py | nthienan/sonarqube-exporter | 9416944ceb18a16462b17c5bf257f34c4dee5d0c | [
"MIT"
] | 2 | 2022-01-02T03:36:23.000Z | 2022-01-02T05:01:01.000Z | tests/test_utility.py | nthienan/sonarqube-exporter | 9416944ceb18a16462b17c5bf257f34c4dee5d0c | [
"MIT"
] | null | null | null | import unittest
class SampleTest(unittest.TestCase):
def test_1(self):
self.assertEqual(2, 1 + 1)
@unittest.skip("demonstare skipped test case")
def test_2(self):
self.assertEqual(1, 2 - 1)
| 18.5 | 50 | 0.648649 | 30 | 222 | 4.733333 | 0.5 | 0.098592 | 0.267606 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047059 | 0.234234 | 222 | 11 | 51 | 20.181818 | 0.788235 | 0 | 0 | 0 | 0 | 0 | 0.126126 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 1 | 0.285714 | false | 0 | 0.142857 | 0 | 0.571429 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
001061109d990aa6a43e23ab1714894a79f46abc | 129 | py | Python | week_07/caesar.py | DaviNakamuraCardoso/cs50 | 2081abb6fa1131184b07a68ed3b07d538c3ba3dd | [
"MIT"
] | 2 | 2020-08-05T23:27:24.000Z | 2020-08-12T01:52:29.000Z | week_07/caesar.py | DaviNakamuraCardoso/cs50 | 2081abb6fa1131184b07a68ed3b07d538c3ba3dd | [
"MIT"
] | null | null | null | week_07/caesar.py | DaviNakamuraCardoso/cs50 | 2081abb6fa1131184b07a68ed3b07d538c3ba3dd | [
"MIT"
] | 1 | 2020-08-07T04:50:09.000Z | 2020-08-07T04:50:09.000Z | def main():
message = input('Message: ')
alphabet = 'abcdefghijklkmnopqrstuvwxyz'
letters = alphabet.split(sep='')
| 18.428571 | 44 | 0.651163 | 11 | 129 | 7.636364 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.20155 | 129 | 6 | 45 | 21.5 | 0.815534 | 0 | 0 | 0 | 0 | 0 | 0.283465 | 0.212598 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0014102ad92f83a6946a8d449b8493c17fc41431 | 1,507 | py | Python | dynamicserialize/dstypes/com/raytheon/uf/common/serialization/SerializableExceptionWrapper.py | srcarter3/python-awips | d981062662968cf3fb105e8e23d955950ae2497e | [
"BSD-3-Clause"
] | 33 | 2016-03-17T01:21:18.000Z | 2022-02-08T10:41:06.000Z | dynamicserialize/dstypes/com/raytheon/uf/common/serialization/SerializableExceptionWrapper.py | srcarter3/python-awips | d981062662968cf3fb105e8e23d955950ae2497e | [
"BSD-3-Clause"
] | 15 | 2016-04-19T16:34:08.000Z | 2020-09-09T19:57:54.000Z | dynamicserialize/dstypes/com/raytheon/uf/common/serialization/SerializableExceptionWrapper.py | Unidata/python-awips | 8459aa756816e5a45d2e5bea534d23d5b1dd1690 | [
"BSD-3-Clause"
] | 20 | 2016-03-12T01:46:58.000Z | 2022-02-08T06:53:22.000Z | #
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 2015-02-27 4174 nabowle Output full stacktrace.
# 2018-10-05 mjames@ucar Fix returned retVal encoding.
#
class SerializableExceptionWrapper(object):
def __init__(self):
self.stackTrace = None
self.message = None
self.exceptionClass = None
self.wrapper = None
def __str__(self):
return self.__repr__()
def __repr__(self):
if not self.message:
self.message = ''
retVal = "" + str(self.exceptionClass) + " exception thrown: " + str(self.message) + "\n"
for element in self.stackTrace:
retVal += "\tat " + str(element) + "\n"
if self.wrapper:
retVal += "Caused by: " + self.wrapper.__repr__()
return str(retVal)
def getStackTrace(self):
return self.stackTrace
def setStackTrace(self, stackTrace):
self.stackTrace = stackTrace
def getMessage(self):
return self.message
def setMessage(self, message):
self.message = message
def getExceptionClass(self):
return self.exceptionClass
def setExceptionClass(self, exceptionClass):
self.exceptionClass = exceptionClass
def getWrapper(self):
return self.wrapper
def setWrapper(self, wrapper):
self.wrapper = wrapper
| 26.910714 | 97 | 0.565362 | 140 | 1,507 | 5.942857 | 0.392857 | 0.092548 | 0.084135 | 0.052885 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019175 | 0.307896 | 1,507 | 55 | 98 | 27.4 | 0.778523 | 0.199071 | 0 | 0 | 0 | 0 | 0.032691 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.151515 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
001b438832e6b8e9b42af6984e1fdf454af1c786 | 10,837 | py | Python | Digest/Plot/SingleVm_plot.py | goncalonuno/EdgeMig | 02f8cf575a96b27e29a1b8a227be0717dfe59871 | [
"MIT"
] | null | null | null | Digest/Plot/SingleVm_plot.py | goncalonuno/EdgeMig | 02f8cf575a96b27e29a1b8a227be0717dfe59871 | [
"MIT"
] | null | null | null | Digest/Plot/SingleVm_plot.py | goncalonuno/EdgeMig | 02f8cf575a96b27e29a1b8a227be0717dfe59871 | [
"MIT"
] | 1 | 2021-06-15T05:20:10.000Z | 2021-06-15T05:20:10.000Z | import pandas as pd
import math
import matplotlib.pyplot as plt
import seaborn as sn
import matplotlib.patches as mpatches
from LoopVm_plot import *
from natsort import index_natsorted, order_by_index
#sn.set_context("paper", font_scale = 2)
#single VM Only - (NO Comparisons)
def latency_equilibrium(df, title):
fig, ax = plt.subplots()
ax.set_title("Migration Mechanism - Deviation relative to Latency Equilibrium " + title)
ax.scatter(df['INDEX'], df['delta_lat_real_end'], label = 'Latency delta as migration completed')
ax.plot(df['INDEX'], df['delta_lat_real_end'])
ax.scatter(df['INDEX'], df['delta_lat_init'], label = 'Latency delta as migration started')
ax.plot(df['INDEX'], df['delta_lat_init'])
#ax.scatter(df['INDEX'], df['lat_source_init'], label = 'Latency to the source as migration started')
#ax.plot(df['INDEX'], df['lat_source_init'])
#ax.scatter(df['INDEX'], df['lat_target_init'], label = 'Latency to the target as migration started')
#ax.plot(df['INDEX'], df['lat_target_init'])
#ax.scatter(df['INDEX'], df['lat_source_end'], label = 'Latency to the source as migration completed')
#ax.plot(df['INDEX'], df['lat_source_end'])
#ax.scatter(df['INDEX'], df['lat_target_end'], label = 'Latency to the target as migration completed')
#ax.plot(df['INDEX'], df['lat_target_end'])
#ax.axhline(0,color= 'black')
#i=0
#for id_lte, idtrip in zip(df['id_edge_origin'],df['TripID']):
# ax.annotate("S_ID_LTE: "+str(id_lte) + "\nTripID: " + str(idtrip), (df['INDEX'].values[i], df['lat_source_init'].values[i]))
# ax.annotate("S_ID_LTE: "+str(id_lte) + "\nTripID: " + str(idtrip), (df['INDEX'].values[i], df['lat_source_end'].values[i]))
# i = i + 1
#i=0
#for id_lte, idtrip in zip(df['id_edge_target'],df['TripID']):
# ax.annotate("T_ID_LTE: "+str(id_lte) + "\nTripID: " + str(idtrip), (df['INDEX'].values[i], df['lat_target_init'].values[i]))
# ax.annotate("T_ID_LTE: "+str(id_lte) + "\nTripID: " + str(idtrip), (df['INDEX'].values[i], df['lat_target_end'].values[i]))
# i = i + 1
#i=0
#for id_lte_o, id_lte_d in zip(df['id_edge_origin'],df['id_edge_target']):
# ax.annotate(""+str(id_lte_o) + "->" + str(id_lte_d), (df['INDEX'].values[i], df['delta_lat_init'].values[i]))
# ax.annotate(""+str(id_lte_o) + "->" + str(id_lte_d), (df['INDEX'].values[i], df['delta_lat_real_end'].values[i]))
# i = i + 1
ax.set_xlabel('Migrations Performed')
ax.set_ylabel('Delta Latency in ms')
ax.legend()
return 1
#single VM Only - (NO Comparisons)
def distance_equilibrium(df, title):
fig, ax = plt.subplots()
ax.set_title("Migration Mechanism - Deviation relative to Distance Equilibrium " + title)
ax.scatter(df['INDEX'], df['delta_dist_real_end'], label = 'Distance to equilibrium as migration completed')
ax.plot(df['INDEX'], df['delta_dist_real_end'])
ax.scatter(df['INDEX'], df['delta_dist_init'], label = 'Distance to equilibrium as migration started')
ax.plot(df['INDEX'], df['delta_dist_init'])
ax.scatter(df['INDEX'], df['dist_source_init'], label = 'Distance to the source as migration started')
ax.plot(df['INDEX'], df['dist_source_init'])
ax.scatter(df['INDEX'], df['dist_target_init'], label = 'Distance to the target as migration started')
ax.plot(df['INDEX'], df['dist_target_init'])
ax.scatter(df['INDEX'], df['dist_source_end'], label = 'Distance to the source as migration finished')
ax.plot(df['INDEX'], df['dist_source_end'])
ax.scatter(df['INDEX'], df['dist_target_end'], label = 'Distance to the target as migration finished')
ax.plot(df['INDEX'], df['dist_target_end'])
ax.axhline(0,color= 'black')
i=0
for id_lte, idtrip in zip(df['id_edge_origin'],df['TripID']):
ax.annotate("S_ID_LTE: "+str(id_lte) + "\nTripID: " + str(idtrip), (df['INDEX'].values[i], df['dist_source_init'].values[i]))
ax.annotate("S_ID_LTE: "+str(id_lte) + "\nTripID: " + str(idtrip), (df['INDEX'].values[i], df['dist_source_end'].values[i]))
i = i + 1
i=0
for id_lte, idtrip in zip(df['id_edge_target'],df['TripID']):
ax.annotate("T_ID_LTE: "+str(id_lte) + "\nTripID: " + str(idtrip), (df['INDEX'].values[i], df['dist_target_init'].values[i]))
ax.annotate("T_ID_LTE: "+str(id_lte) + "\nTripID: " + str(idtrip), (df['INDEX'].values[i], df['dist_target_end'].values[i]))
i = i + 1
i=0
for id_lte_o, id_lte_d in zip(df['id_edge_origin'],df['id_edge_target']):
ax.annotate(""+str(id_lte_o) + "->" + str(id_lte_d), (df['INDEX'].values[i], df['delta_dist_init'].values[i]))
ax.annotate(""+str(id_lte_o) + "->" + str(id_lte_d), (df['INDEX'].values[i], df['delta_dist_real_end'].values[i]))
i = i + 1
ax.set_xlabel('Migrations Performed')
ax.set_ylabel('Delta Distance in m')
ax.legend()
return 1
#single VM Only - Single Plot + Compare Plot (OLD WAY)
def client_latency(df, new_fig, fig, ax, label):
if (new_fig == 1):
fig, ax = plt.subplots()
ax.set_title("Client Latency Evolution by Trip ")
ax.plot(df.index, df['Latency'], label = 'Latency to the station ' + label)
df = df.drop_duplicates(subset=['TripID'])
for i in range(len(df.index)):
latency = df.at[df.index[i], 'Latency']
tripid = df.at[df.index[i], 'TripID']
ax.annotate("TripID: " + str(tripid), (df.index[i], latency))
ax.scatter(df.index[i], latency, color='blue')
ax.set_xlabel('Path coordinates')
ax.set_ylabel('Latency in milliseconds')
ax.legend()
return fig, ax
#single VM Only - Single Plot + Compare Plot (OLD WAY)
def client_distance(df, new_fig, fig, ax, label):
if (new_fig == 1):
fig, ax = plt.subplots()
ax.set_title("Evolution of Client Distance to Origin by Trip ")
ax.plot(df.index, df['Distance'], label = 'Distance to the station ' + label)
df = df.drop_duplicates(subset=['TripID'])
for i in range(len(df.index)):
distance = df.at[df.index[i], 'Distance']
tripid = df.at[df.index[i], 'TripID']
ax.annotate("TripID: " + str(tripid), (df.index[i], distance))
ax.scatter(df.index[i], distance, color='blue')
ax.set_xlabel('Path coordinates')
ax.set_ylabel('Distance in meters')
ax.legend()
return fig, ax
####
#single VM - Single Plot + Compare Plot
def prep_n_mig(plot_dict, df_lst_files):
df_aux_list = list()
for Class, df in zip(plot_dict['Classes'], df_lst_files):
dfaux = Vm_groupby(df, ['TripID'], {'Mig_ID':'count'})
dfaux.rename(columns={'TripID':'TripID', 'Mig_ID':'Number of Migrations'},inplace=True)
dfaux.insert(0, 'Class', Class)
df_aux_list.append(dfaux)
dfconcat = pd.concat(df_aux_list)
return dfconcat
def n_mig(df):
fig, ax = plt.subplots()
ax.set_title("Number of Migrations by Trip ")
sn.barplot(x='TripID', y='Number of Migrations', hue='Class', palette=['C0','C1','C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'], data=df, ax=ax)
ax.set_xlabel('Trips')
ax.set_ylabel('Number of migrations')
ax.legend()
return 1
####
####
#single VM - Single Plot + Compare Plot
def prep_migtime(plot_dict, df_lst_files):
df_aux_list = list()
for Class, df in zip(plot_dict['Classes'], df_lst_files):
dfaux = Vm_groupby(df, ['TripID'], {'Mt_real':'sum', 'triptime': 'first'})
dfaux.insert(0, 'Class', Class)
df_aux_list.append(dfaux)
dfconcat = pd.concat(df_aux_list)
return dfconcat
def migtime(df):
fig, ax = plt.subplots()
ax.set_title("Time Spent Migrating vs Trip Time ")
ax.scatter(df['TripID'], df['triptime'], label = 'Total Trip Time', color='black')
sn.barplot(x='TripID', y='Mt_real', hue='Class', palette=['C0','C1','C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'], data=df, ax=ax)
ax.set_xlabel('Trips')
ax.set_ylabel('Time in Seconds')
ax.legend()
return 1
####
####
#single VM - Single Plot + Compare Plot
def prep_downtime(plot_dict, df_lst_files):
df_aux_list = list()
for Class, df in zip(plot_dict['Classes'], df_lst_files):
dfaux = Vm_groupby(df, ['TripID'], {'DT_real':'sum'})
dfaux.insert(0, 'Class', Class)
df_aux_list.append(dfaux)
dfconcat = pd.concat(df_aux_list)
return dfconcat
def downtime(df):
fig, ax = plt.subplots()
ax.set_title("Downtime by Trip")
sn.barplot(x='TripID', y='DT_real', hue='Class', palette=['C0','C1','C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'], data=df, ax=ax)
ax.set_xlabel('Trips')
ax.set_ylabel('Time in milliseconds')
ax.legend()
return 1
####
####
#single VM - Single Plot + Compare Plot
def prep_mte_vs_mtr(plot_dict, df_lst_files):
df_aux_list = list()
i = 0
for Class, df in zip(plot_dict['Classes'], df_lst_files):
dfaux = df[df['TripID'].values == df['TripID'].values[0]]
dfaux = Vm_groupby(dfaux, ['TripID'], {'Mt_est':'first', 'Mt_real':'first'})
dfaux.insert(0, 'Class', 'Estimate Migration Time') # + Class
df_aux_list.append(dfaux)
i = i + 1
if(i==1): break # Remove if migration estimate method is to be compared!!!!!!
dfconcat = pd.concat(df_aux_list)
return dfconcat
def mte_vs_mtr(df):
fig, ax = plt.subplots(1,2)
fig.suptitle("Migration Time Estimate vs Real Migration Time")
sn.barplot(x='TripID', y='Mt_real', data=df, ax=ax[0])
sn.barplot(x='TripID', y='Mt_est', hue='Class', palette=['C1','C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'], data=df, ax=ax[1])
leg1 = mpatches.Patch(color='#1f77b4', label='Real Migration Time')
ax[0].legend(handles=[leg1])
ax[0].set_ylim([0, 60])
ax[1].legend()
ax[1].set_ylim([0, 60])
for i in range(2):
ax[i].set_xlabel('Single Machine')
ax[i].set_ylabel('Time in Seconds')
ax[i].set_xticks([])
return 1
####
####
#single VM - Single Plot + Compare Plot
def prep_transferred_data(plot_dict, df_lst_files):
df_aux_list = list()
for Class, df in zip(plot_dict['Classes'], df_lst_files):
dfaux = Vm_groupby(df, ['TripID'], {'transferred_dataGB':'sum'})
dfaux.insert(0, 'Class', Class)
df_aux_list.append(dfaux)
dfconcat = pd.concat(df_aux_list)
return dfconcat
def transferred_data(df):
fig, ax = plt.subplots()
ax.set_title("Transferred Data by Trip")
sn.barplot(x='TripID', y='transferred_dataGB', hue='Class', palette=['C0','C1','C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'], data=df, ax=ax)
ax.set_xlabel('Trips')
ax.set_ylabel('Data in GB')
ax.legend()
return 1 | 32.839394 | 149 | 0.622497 | 1,654 | 10,837 | 3.908706 | 0.11185 | 0.051972 | 0.036195 | 0.034648 | 0.810054 | 0.784841 | 0.752823 | 0.663264 | 0.599536 | 0.538438 | 0 | 0.011751 | 0.191197 | 10,837 | 330 | 150 | 32.839394 | 0.725841 | 0.189351 | 0 | 0.443182 | 0 | 0 | 0.256599 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.079545 | false | 0 | 0.039773 | 0 | 0.198864 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
001fb809956312ba7d229af458724e3df814324f | 2,552 | py | Python | tools/nntool/utils/node_id.py | danieldennett/gap_sdk | 5667c899025a3a152dbf91e5c18e5b3e422d4ea6 | [
"Apache-2.0"
] | 1 | 2020-01-29T15:39:31.000Z | 2020-01-29T15:39:31.000Z | tools/nntool/utils/node_id.py | danieldennett/gap_sdk | 5667c899025a3a152dbf91e5c18e5b3e422d4ea6 | [
"Apache-2.0"
] | null | null | null | tools/nntool/utils/node_id.py | danieldennett/gap_sdk | 5667c899025a3a152dbf91e5c18e5b3e422d4ea6 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 GreenWaves Technologies, SAS
# 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 utils.json_serializable import JsonSerializable
class NodeId(JsonSerializable):
def __init__(self, node, fnode=None):
if isinstance(node, list):
self._id = [None if not elem else elem for elem in node]
else:
self._id = [node.name, "" if fnode is None else fnode.name]
@property
def id(self):
return self._id
@property
def node_name(self):
return self._id[0]
@property
def fnode_name(self):
return self._id[1]
def get_node(self, G):
node = G.node(self._id[0])
if self._id[1]:
node = node.get_contained_node(self._id[1])
return node
def _encapsulate(self):
return "{}###{}".format(self._id[0], self._id[1] or "")
@classmethod
def _dencapsulate(cls, val):
return cls(val.split('###'))
def __hash__(self):
return str(self).__hash__()
def __eq__(self, value):
return str(self) == str(value)
def __str__(self):
if self._id[1]:
return "_".join(self._id)
return self._id[0]
from utils.node_id import NodeId
def convert_node_id_to_str(nodeid):
if isinstance(nodeid, NodeId):
return 'NodeId_' + nodeid._encapsulate()
return nodeid
def convert_str_to_node_id(val):
if isinstance(val, str) and val.startswith('NodeId_'):
return NodeId._dencapsulate(val[7:])
return val
def convert_keys_to_str(info):
if isinstance(info, list):
return [convert_keys_to_str(elem) for elem in info]
if isinstance(info, dict):
return {convert_node_id_to_str(k): convert_keys_to_str(v) for k, v in info.items()}
return info
def convert_str_to_keys(info):
if isinstance(info, list):
return [convert_keys_to_str(elem) for elem in info]
if isinstance(info, dict):
return {convert_str_to_node_id(k):
convert_str_to_keys(v) for k, v in info.items()}
return info | 30.023529 | 91 | 0.660658 | 369 | 2,552 | 4.349594 | 0.303523 | 0.048598 | 0.021807 | 0.039875 | 0.21433 | 0.153271 | 0.153271 | 0.153271 | 0.153271 | 0.119626 | 0 | 0.009245 | 0.237069 | 2,552 | 85 | 92 | 30.023529 | 0.8151 | 0.221395 | 0 | 0.267857 | 0 | 0 | 0.012645 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.035714 | 0.125 | 0.660714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
0023ad596793b3e21bf4b43869f2757923d87e3e | 108 | py | Python | msc/sampling_experiments.py | JakobHavtorn/es-rl | 30d81ad908a30e78d03c83d37454dbe8e05d1452 | [
"MIT"
] | 1 | 2021-09-03T17:54:14.000Z | 2021-09-03T17:54:14.000Z | msc/sampling_experiments.py | JakobHavtorn/es-rl | 30d81ad908a30e78d03c83d37454dbe8e05d1452 | [
"MIT"
] | null | null | null | msc/sampling_experiments.py | JakobHavtorn/es-rl | 30d81ad908a30e78d03c83d37454dbe8e05d1452 | [
"MIT"
] | null | null | null | import numpy as numpy
import torch
import IPython
cov = np.random.randint(0,5,(4,4))
IPython.embed()
| 8.307692 | 34 | 0.703704 | 18 | 108 | 4.222222 | 0.722222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044944 | 0.175926 | 108 | 12 | 35 | 9 | 0.808989 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0045d5558fcf7ff25feee8a171bcee9477cb49a4 | 436 | py | Python | test/generate/autotest/28_2F_ADD_A_Rn.py | Aimini/hm-51 | 2d46323388a0679b2f99d1a33f5a0d55a5f838e6 | [
"MIT"
] | null | null | null | test/generate/autotest/28_2F_ADD_A_Rn.py | Aimini/hm-51 | 2d46323388a0679b2f99d1a33f5a0d55a5f838e6 | [
"MIT"
] | 20 | 2020-01-13T04:19:37.000Z | 2020-02-12T14:25:44.000Z | test/generate/autotest/28_2F_ADD_A_Rn.py | Aimini/hm-51 | 2d46323388a0679b2f99d1a33f5a0d55a5f838e6 | [
"MIT"
] | null | null | null | #########################################################
# 2020-01-23 16:03:11
# AI
# ins: ADDC A, Rn
#########################################################
from .common import INS_OPERATION
from .common.INS_XXX_A_Rn import XXX_A_RN
class ADD_A_Rn(XXX_A_RN):
def __init__(self):
super().__init__("ADD")
def op_func(self, B):
INS_OPERATION.op_a_addc_xx(self.ram, B, False)
p = ADD_A_Rn().gen(0, 128, 1)
| 21.8 | 57 | 0.488532 | 62 | 436 | 3.032258 | 0.532258 | 0.095745 | 0.095745 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051351 | 0.151376 | 436 | 19 | 58 | 22.947368 | 0.456757 | 0.087156 | 0 | 0 | 0 | 0 | 0.010714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
0048537a21a5abf9b5c53767ae52c0821953ad1a | 748 | py | Python | python/misc/frames_per_second.py | christopher-burke/warmups | 140c96ada87ec5e9faa4622504ddee18840dce4a | [
"MIT"
] | null | null | null | python/misc/frames_per_second.py | christopher-burke/warmups | 140c96ada87ec5e9faa4622504ddee18840dce4a | [
"MIT"
] | 2 | 2022-03-10T03:49:14.000Z | 2022-03-14T00:49:54.000Z | python/misc/frames_per_second.py | christopher-burke/warmups | 140c96ada87ec5e9faa4622504ddee18840dce4a | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""Frames per second.
Create a function that returns the number of frames shown in a
given number of minutes for a certain FPS.
Source:
https://edabit.com/challenge/Yj2Rew5XQYpu7Nosq
"""
def frames(minutes: int, fps: int) -> int:
"""Find the number of frames shown."""
seconds = minutes * 60
return seconds * fps
def main():
"""Run sample functions. Do not import."""
assert frames(1, 1) == 60
assert frames(10, 1) == 600
assert frames(10, 25) == 15000
assert frames(500, 60) == 1800000
assert frames(0, 60) == 0
assert frames(99, 1) == 5940
assert frames(419, 70) == 1759800
assert frames(52, 33) == 102960
print('Passed.')
if __name__ == "__main__":
main() | 24.129032 | 62 | 0.637701 | 106 | 748 | 4.424528 | 0.584906 | 0.204691 | 0.046908 | 0.072495 | 0.093817 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121107 | 0.227273 | 748 | 31 | 63 | 24.129032 | 0.690311 | 0.364973 | 0 | 0 | 0 | 0 | 0.03268 | 0 | 0 | 0 | 0 | 0 | 0.533333 | 1 | 0.133333 | false | 0.066667 | 0 | 0 | 0.2 | 0.066667 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
004d21e67c73aa0ec2a365e9ae480223c9f53fe0 | 1,963 | py | Python | trim_reads.py | brendane/miscellaneous_bioinfo_scripts | 91ca3282823495299e4c68aa79bdc1c0225a6d7b | [
"MIT"
] | null | null | null | trim_reads.py | brendane/miscellaneous_bioinfo_scripts | 91ca3282823495299e4c68aa79bdc1c0225a6d7b | [
"MIT"
] | 1 | 2020-09-17T11:14:13.000Z | 2020-09-17T11:14:13.000Z | trim_reads.py | brendane/miscellaneous_bioinfo_scripts | 91ca3282823495299e4c68aa79bdc1c0225a6d7b | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
"""
Trim fastq file reads to a common length.
trim_reads.py <input file> <length>
"""
#==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================#
import gzip
import sys
from Bio import SeqIO
#==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================#
n = int(sys.argv[2])
if sys.argv[1].endswith('.gz'):
ofun = gzip.open
else:
ofun = open
with ofun(sys.argv[1], 'rb') as handle:
for rec in SeqIO.parse(handle, 'fastq'):
SeqIO.write(rec[:n], sys.stdout, 'fastq')
| 72.703704 | 780 | 0.128375 | 65 | 1,963 | 3.861538 | 0.630769 | 0.083665 | 0.063745 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002132 | 0.04432 | 1,963 | 26 | 781 | 75.5 | 0.131663 | 0.843607 | 0 | 0 | 0 | 0 | 0.052265 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.272727 | 0 | 0.272727 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
004dc52b3180178c26fd9cf0ec525ba61b272f84 | 174 | py | Python | HellProject/urls.py | SwyftG/HellProject | 7c845ff2dc1bfe7e3eb32663b618d310c025a3c7 | [
"MIT"
] | null | null | null | HellProject/urls.py | SwyftG/HellProject | 7c845ff2dc1bfe7e3eb32663b618d310c025a3c7 | [
"MIT"
] | null | null | null | HellProject/urls.py | SwyftG/HellProject | 7c845ff2dc1bfe7e3eb32663b618d310c025a3c7 | [
"MIT"
] | null | null | null | # encoding: utf-8
__author__ = 'lianggao'
__date__ = '2019/5/29 10:44 AM'
def javpop_url(time):
yield 'http://javpop.com/' + time[:4] + '/' + time[4:6] + '/' + time[-2:] | 29 | 77 | 0.586207 | 27 | 174 | 3.444444 | 0.814815 | 0.107527 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110345 | 0.166667 | 174 | 6 | 77 | 29 | 0.531034 | 0.086207 | 0 | 0 | 0 | 0 | 0.291139 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
004dd15d2275d10071eb16b3e5b1bedf8af824a3 | 28 | py | Python | pup/__init__.py | astronouth7303/pup-tools | 1546331989676e481aa67b4cf0c5712a01e62609 | [
"MIT"
] | null | null | null | pup/__init__.py | astronouth7303/pup-tools | 1546331989676e481aa67b4cf0c5712a01e62609 | [
"MIT"
] | null | null | null | pup/__init__.py | astronouth7303/pup-tools | 1546331989676e481aa67b4cf0c5712a01e62609 | [
"MIT"
] | null | null | null | __all__ = ["xpath", "http"]
| 14 | 27 | 0.571429 | 3 | 28 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 28 | 1 | 28 | 28 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0.321429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0050153811091997b220a88262f317b00c310507 | 357 | py | Python | data_access_log/utils.py | Microdisseny/django-data-access-log | b12fe865b97a164675220bdd822a3f5bfdbb1c83 | [
"MIT"
] | null | null | null | data_access_log/utils.py | Microdisseny/django-data-access-log | b12fe865b97a164675220bdd822a3f5bfdbb1c83 | [
"MIT"
] | 2 | 2018-10-03T12:12:54.000Z | 2018-10-05T05:47:43.000Z | data_access_log/utils.py | Microdisseny/django-data-access-log | b12fe865b97a164675220bdd822a3f5bfdbb1c83 | [
"MIT"
] | null | null | null | def type_name(cls):
"""Get the name of a class."""
if not cls:
return '(none)'
return '{}.{}'.format(cls.__module__, cls.__name__)
def viewset_model(serializer):
"""Get the model of a serializer."""
if hasattr(serializer, 'serializer_class'):
return serializer.serializer_class.Meta.model
else:
return None
| 25.5 | 55 | 0.635854 | 45 | 357 | 4.777778 | 0.466667 | 0.055814 | 0.232558 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.229692 | 357 | 13 | 56 | 27.461538 | 0.781818 | 0.154062 | 0 | 0 | 0 | 0 | 0.092784 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
cc5a9ed955072b718e0fe46ba9c49429f654067d | 123 | py | Python | whitebearbake/database/__init__.py | deemarc/whitebearbake | 95b8d74f36caf5ae29b5c0202d143d3142cc86cf | [
"MIT"
] | null | null | null | whitebearbake/database/__init__.py | deemarc/whitebearbake | 95b8d74f36caf5ae29b5c0202d143d3142cc86cf | [
"MIT"
] | null | null | null | whitebearbake/database/__init__.py | deemarc/whitebearbake | 95b8d74f36caf5ae29b5c0202d143d3142cc86cf | [
"MIT"
] | null | null | null | from flask_sqlalchemy import SQLAlchemy
# from flask_marshmallow import Marshmallow
db = SQLAlchemy()
# ma = Marshmallow() | 24.6 | 43 | 0.804878 | 14 | 123 | 6.928571 | 0.5 | 0.185567 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130081 | 123 | 5 | 44 | 24.6 | 0.906542 | 0.487805 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
cc66b42a5fc4690f3f7b1feb68a0864dd1d88933 | 262 | py | Python | automancy/elementals/organisms/html5_video_player/html5_video_viewport.py | IAmTheBlurr/Automancy | 0c52916cd01dda6bd34ef8d048c37e478dfabbb5 | [
"MIT"
] | null | null | null | automancy/elementals/organisms/html5_video_player/html5_video_viewport.py | IAmTheBlurr/Automancy | 0c52916cd01dda6bd34ef8d048c37e478dfabbb5 | [
"MIT"
] | null | null | null | automancy/elementals/organisms/html5_video_player/html5_video_viewport.py | IAmTheBlurr/Automancy | 0c52916cd01dda6bd34ef8d048c37e478dfabbb5 | [
"MIT"
] | null | null | null | from automancy.core import Elemental
class VideoViewport(Elemental):
""" The container object for the video feed itself """
def __init__(self, locator: str, human_name: str, system_name: str):
super().__init__(locator, human_name, system_name)
| 32.75 | 72 | 0.729008 | 34 | 262 | 5.264706 | 0.676471 | 0.100559 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.171756 | 262 | 7 | 73 | 37.428571 | 0.824885 | 0.175573 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
cc6c79cfc032344b998fe0946b24e2b291bd1f1a | 136 | py | Python | ginga/version.py | astrofrog/ginga | 8a8180b98f0ba69f863d13c4ad690213076def6f | [
"BSD-3-Clause"
] | null | null | null | ginga/version.py | astrofrog/ginga | 8a8180b98f0ba69f863d13c4ad690213076def6f | [
"BSD-3-Clause"
] | null | null | null | ginga/version.py | astrofrog/ginga | 8a8180b98f0ba69f863d13c4ad690213076def6f | [
"BSD-3-Clause"
] | null | null | null | # this file was automatically generated
major = 1
minor = 4
release = '20130410193624'
version = '%d.%d-%s' % (major, minor, release)
| 17 | 46 | 0.683824 | 18 | 136 | 5.166667 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 0.176471 | 136 | 7 | 47 | 19.428571 | 0.6875 | 0.272059 | 0 | 0 | 1 | 0 | 0.229167 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
cc7512b6b91e1602e731be02525fd19bed501fb9 | 762 | py | Python | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/GLX/SGIX/dmbuffer.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/GLX/SGIX/dmbuffer.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/GLX/SGIX/dmbuffer.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GLX import _types as _cs
# End users want this...
from OpenGL.raw.GLX._types import *
from OpenGL.raw.GLX import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'GLX_SGIX_dmbuffer'
def _f( function ):
return _p.createFunction( function,_p.PLATFORM.GLX,'GLX_SGIX_dmbuffer',error_checker=_errors._error_checker)
GLX_DIGITAL_MEDIA_PBUFFER_SGIX=_C('GLX_DIGITAL_MEDIA_PBUFFER_SGIX',0x8024)
@_f
@_p.types(_cs.Bool,ctypes.POINTER(_cs.Display),_cs.GLXPbufferSGIX,ctypes.POINTER(_cs.DMparams),_cs.DMbuffer)
def glXAssociateDMPbufferSGIX(dpy,pbuffer,params,dmbuffer):pass
| 42.333333 | 113 | 0.795276 | 111 | 762 | 5.135135 | 0.486486 | 0.087719 | 0.068421 | 0.084211 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007364 | 0.108924 | 762 | 17 | 114 | 44.823529 | 0.832106 | 0.131234 | 0 | 0 | 1 | 0 | 0.100313 | 0.047022 | 0 | 0 | 0.009404 | 0 | 0 | 1 | 0.153846 | false | 0.076923 | 0.461538 | 0.076923 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
cc7f6f98aa8f00916ac95c4ae3b39548b2514bd3 | 346 | py | Python | banal/__init__.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | 1 | 2022-01-25T22:52:58.000Z | 2022-01-25T22:52:58.000Z | banal/__init__.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | banal/__init__.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | from banal.lists import is_sequence, ensure_list, unique_list
from banal.dicts import is_mapping, clean_dict
from banal.filesystem import decode_path
from banal.cache import hash_data
from banal.bools import as_bool
__all__ = [is_sequence, ensure_list, unique_list, as_bool,
is_mapping, clean_dict,
decode_path, hash_data]
| 34.6 | 61 | 0.786127 | 53 | 346 | 4.754717 | 0.433962 | 0.178571 | 0.126984 | 0.15873 | 0.238095 | 0.238095 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16185 | 346 | 9 | 62 | 38.444444 | 0.868966 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.625 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
cc809b7548658fa2ecbde52efb24b06e87fb62d7 | 123 | py | Python | ksksite/danmakuwall/urls.py | Ki-Seki/ki-seki.site | efef59ee52a0b69501385c06ef6e4265f39d1738 | [
"MIT"
] | null | null | null | ksksite/danmakuwall/urls.py | Ki-Seki/ki-seki.site | efef59ee52a0b69501385c06ef6e4265f39d1738 | [
"MIT"
] | null | null | null | ksksite/danmakuwall/urls.py | Ki-Seki/ki-seki.site | efef59ee52a0b69501385c06ef6e4265f39d1738 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('', views.danmakuwall, name='danmakuwall'),
]
| 13.666667 | 52 | 0.691057 | 14 | 123 | 6.071429 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178862 | 123 | 8 | 53 | 15.375 | 0.841584 | 0 | 0 | 0 | 0 | 0 | 0.089431 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ccbe25f96cd1644b17752ba0c3692386bdb28abd | 438 | py | Python | Curso Python/Mundo 1/Modulo2/Desafios/Desafios 1/des004.py | catabimbas/Curso-Python | 72549952db77fa9b0ea3746b83f94592e3fdeb30 | [
"MIT"
] | null | null | null | Curso Python/Mundo 1/Modulo2/Desafios/Desafios 1/des004.py | catabimbas/Curso-Python | 72549952db77fa9b0ea3746b83f94592e3fdeb30 | [
"MIT"
] | null | null | null | Curso Python/Mundo 1/Modulo2/Desafios/Desafios 1/des004.py | catabimbas/Curso-Python | 72549952db77fa9b0ea3746b83f94592e3fdeb30 | [
"MIT"
] | null | null | null | name = input('Digite algo: ')
print('O tipo desse valor: {}'.format(type(name)))
print('Só tem espaço? {}'.format(name.isspace()))
print('É um número? {}'.format(name.isalnum()))
print('É alfabético? {}'.format(name.isalpha()))
print('É alfanumérico? {}'.format(name.isalnum()))
print('Está em maiúsculas? {}'.format(name.isupper))
print('Está minúsculas? {}'.format(name.islower()))
print('Está capitalizada? {}'.format(name.istitle()))
| 43.8 | 53 | 0.678082 | 57 | 438 | 5.210526 | 0.526316 | 0.23569 | 0.114478 | 0.148148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.077626 | 438 | 9 | 54 | 48.666667 | 0.735149 | 0 | 0 | 0 | 0 | 0 | 0.372146 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.888889 | 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 | 1 | 0 | 3 |
ccc74fad15af827defff22ffb150fed27c4a1187 | 595 | py | Python | airslate/entities/documents.py | airslate-oss/python-airslate | 0f7fe6321b1c2e6875a02dfecb5ffa07a361bb1d | [
"Apache-2.0"
] | 3 | 2021-02-07T20:04:26.000Z | 2021-09-22T08:32:26.000Z | airslate/entities/documents.py | airslate-oss/python-airslate | 0f7fe6321b1c2e6875a02dfecb5ffa07a361bb1d | [
"Apache-2.0"
] | 15 | 2021-01-21T15:38:37.000Z | 2021-02-16T07:52:20.000Z | airslate/entities/documents.py | airslate-oss/python-airslate | 0f7fe6321b1c2e6875a02dfecb5ffa07a361bb1d | [
"Apache-2.0"
] | null | null | null | # This file is part of the airslate.
#
# Copyright (c) 2021 airSlate, Inc.
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
"""Provides documents related classes and functionality."""
from .base import BaseEntity
from .fields import Field
class Document(BaseEntity):
"""Represents Document entity."""
@property
def type(self):
return 'documents'
@property
def fields(self) -> [Field]:
"""Get list of :class:`Field` instances."""
return self.has_many(Field, 'fields')
| 23.8 | 62 | 0.685714 | 74 | 595 | 5.5 | 0.662162 | 0.054054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008493 | 0.208403 | 595 | 24 | 63 | 24.791667 | 0.855626 | 0.521008 | 0 | 0.222222 | 0 | 0 | 0.056818 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0.111111 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ccca7b33d767243693d7d837e27dd208a5b41aa9 | 227 | py | Python | setup.py | joshpoll/lynx | ff7142db3b631abe9eaba58203145c9b3e83a211 | [
"MIT"
] | 1 | 2020-09-05T04:56:01.000Z | 2020-09-05T04:56:01.000Z | setup.py | joshpoll/lynx | ff7142db3b631abe9eaba58203145c9b3e83a211 | [
"MIT"
] | null | null | null | setup.py | joshpoll/lynx | ff7142db3b631abe9eaba58203145c9b3e83a211 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(
name='obsidian',
version='0.0.0',
description='Constraint-based visual design',
packages=['obsidian'],
install_requires=['pysmt', 'drawSvg', 'notebook', 'ipywidgets'],
)
| 22.7 | 68 | 0.669604 | 24 | 227 | 6.291667 | 0.833333 | 0.02649 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015789 | 0.162996 | 227 | 9 | 69 | 25.222222 | 0.778947 | 0 | 0 | 0 | 0 | 0 | 0.356828 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.125 | 0 | 0.125 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ccd31203487eddbd6f8e160ef07faa31b4431ebf | 453 | py | Python | day2.py | CornCobs/aoc19 | 2af35d69467278ebb9a61235b32c9f836bb00da4 | [
"BSD-3-Clause"
] | null | null | null | day2.py | CornCobs/aoc19 | 2af35d69467278ebb9a61235b32c9f836bb00da4 | [
"BSD-3-Clause"
] | null | null | null | day2.py | CornCobs/aoc19 | 2af35d69467278ebb9a61235b32c9f836bb00da4 | [
"BSD-3-Clause"
] | null | null | null | with open(r"C:\Users\joash\Desktop\CS\haskell\AOC19\aoc\day2.txt", "r") as f:
program = [ int(i) for i in f.read().split(",") ]
pos = 0
while program[pos] != 99:
print("currently on pos:", pos, "opcode is: ", program[pos])
if program[pos] == 1:
program[program[pos+3]] = program[program[pos+1]] + program[program[pos+2]]
else:
program[program[pos+3]] = program[program[pos+1]] * program[program[pos+2]]
pos += 4
print(program[0]) | 34.846154 | 79 | 0.629139 | 74 | 453 | 3.851351 | 0.5 | 0.315789 | 0.357895 | 0.189474 | 0.417544 | 0.417544 | 0.378947 | 0.378947 | 0.378947 | 0.378947 | 0 | 0.039267 | 0.156733 | 453 | 13 | 80 | 34.846154 | 0.706806 | 0 | 0 | 0 | 0 | 0 | 0.180617 | 0.114537 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.181818 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
aea5a014a9d8f09822b842021f8ea3d539ff09e8 | 969 | py | Python | lottery/branch/desc.py | chapter09/open_lth | 53403fdb3fb82b833e336cf36b0292bfed61820a | [
"MIT"
] | null | null | null | lottery/branch/desc.py | chapter09/open_lth | 53403fdb3fb82b833e336cf36b0292bfed61820a | [
"MIT"
] | null | null | null | lottery/branch/desc.py | chapter09/open_lth | 53403fdb3fb82b833e336cf36b0292bfed61820a | [
"MIT"
] | null | null | null | # 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.
import argparse
from dataclasses import dataclass
from ...foundations import desc
from ...lottery.desc import LotteryDesc
def make_BranchDesc(BranchHparams: type, name: str):
@dataclass
class BranchDesc(desc.Desc):
lottery_desc: LotteryDesc
branch_hparams: BranchHparams
@staticmethod
def name_prefix(): return 'lottery_branch_' + name
@staticmethod
def add_args(parser: argparse.ArgumentParser, defaults: LotteryDesc = None):
LotteryDesc.add_args(parser, defaults)
BranchHparams.add_args(parser)
@classmethod
def create_from_args(cls, args: argparse.Namespace):
return BranchDesc(LotteryDesc.create_from_args(args), BranchHparams.create_from_args(args))
return BranchDesc
| 30.28125 | 103 | 0.716202 | 112 | 969 | 6.0625 | 0.491071 | 0.030928 | 0.057437 | 0.053019 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.213622 | 969 | 31 | 104 | 31.258065 | 0.891076 | 0.173375 | 0 | 0.105263 | 0 | 0 | 0.018821 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0 | 0.210526 | 0.105263 | 0.684211 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
aec376ffa508a19a703760021341b94ed85985e5 | 2,505 | py | Python | partI/machine/FA.py | lustres/Under-Computeration | c3afc0124a6c4f9d71586b0840855b192838b163 | [
"BSD-3-Clause"
] | 1 | 2020-10-27T11:42:04.000Z | 2020-10-27T11:42:04.000Z | partI/machine/FA.py | lustres/Under-Computeration | c3afc0124a6c4f9d71586b0840855b192838b163 | [
"BSD-3-Clause"
] | null | null | null | partI/machine/FA.py | lustres/Under-Computeration | c3afc0124a6c4f9d71586b0840855b192838b163 | [
"BSD-3-Clause"
] | null | null | null | class FARule(object):
def __init__(self, state, char, next):
super(FARule, self).__init__()
self.state = state
self.char = char
self.next = next
def is_applied(self, state, char):
return self.state == state and self.char == char
def follow(self, config):
return FAConfig(self.next)
def __repr__(self):
return f'#< {self.state} --[{self.char}]--> {self.next}) >'
class FAConfig(object):
def __init__(self, state):
super(FAConfig, self).__init__()
self.state = state
def stuck(self):
return FAConfig(None)
def is_stuck(self):
return self.state is None
def __eq__(self, other):
return self.__hash__() == other.__hash__()
def __hash__(self):
return hash((self.state))
def __repr__(self):
return f'<config state:{self.state}>'
class FA(object):
def __init__(self, _current_config, accept_states, rulebook):
super(FA, self).__init__()
self.accept_states = accept_states
self.rulebook = rulebook
self._current_config = self.__state_with_free_move(_current_config)
def __state_with_free_move(self, current):
return self.rulebook.follow_free_moves(current)
@property
def current_config(self):
return self._current_config
@current_config.setter
def current_config(self, value):
self._current_config = self.__state_with_free_move(value)
def is_accepted(self):
if isinstance(self.current_config, set):
return len(({config.state for config in self.current_config} & self.accept_states)) != 0
else:
return self.current_config.state in self.accept_states
def __read_char(self, char):
self.current_config = self.rulebook.next_config(self.current_config, char)
return self
def read_string(self, string):
for c in string:
self.__read_char(c)
return self
def __repr__(self):
return f'current state: {self.current_config}'
class FADesign(object):
def __init__(self, start_config, accept_states, rulebook):
super(FADesign, self).__init__()
self.start_config = start_config
self.accept_states = accept_states
self.rulebook = rulebook
def __to_fa(self):
return FA(self.start_config, self.accept_states, self.rulebook)
def is_accepted(self, string):
return self.__to_fa().read_string(string).is_accepted()
| 28.465909 | 100 | 0.650699 | 315 | 2,505 | 4.765079 | 0.161905 | 0.121253 | 0.113258 | 0.045303 | 0.275816 | 0.11459 | 0.11459 | 0.11459 | 0 | 0 | 0 | 0.000528 | 0.243912 | 2,505 | 87 | 101 | 28.793103 | 0.791975 | 0 | 0 | 0.171875 | 0 | 0 | 0.044711 | 0.008383 | 0 | 0 | 0 | 0 | 0 | 1 | 0.328125 | false | 0 | 0 | 0.203125 | 0.65625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
aed24b045929bbf42ad25955df4b26dc882e6178 | 31 | py | Python | PyQt5/Part-3/ext/__init__.py | haha517/mywriter | 8ddd5ce3b2f31491480dee9beb7367c8d6182282 | [
"MIT"
] | 177 | 2015-01-09T18:53:51.000Z | 2022-03-31T03:26:21.000Z | PyQt5/Part-3/ext/__init__.py | haha517/mywriter | 8ddd5ce3b2f31491480dee9beb7367c8d6182282 | [
"MIT"
] | 7 | 2015-08-19T06:30:07.000Z | 2020-05-09T12:00:53.000Z | PyQt5/Part-3/ext/__init__.py | haha517/mywriter | 8ddd5ce3b2f31491480dee9beb7367c8d6182282 | [
"MIT"
] | 123 | 2015-01-07T18:23:40.000Z | 2022-03-26T02:40:55.000Z | __all__ = ["find","wordcount"]
| 15.5 | 30 | 0.645161 | 3 | 31 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 31 | 1 | 31 | 31 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0.419355 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
aedad67ce747a8cc9c9de8ce95f624b1d179d3b1 | 2,555 | py | Python | myapp/models.py | YA-androidapp/Django-MyRoutes | 7727f1dc8e71bb5e0c2df878f1f9a65330c0b322 | [
"Apache-2.0"
] | null | null | null | myapp/models.py | YA-androidapp/Django-MyRoutes | 7727f1dc8e71bb5e0c2df878f1f9a65330c0b322 | [
"Apache-2.0"
] | null | null | null | myapp/models.py | YA-androidapp/Django-MyRoutes | 7727f1dc8e71bb5e0c2df878f1f9a65330c0b322 | [
"Apache-2.0"
] | null | null | null | from django.db import models
from django.urls import reverse
from django.contrib.auth.models import AbstractUser
from django.core.validators import FileExtensionValidator
import hashlib
import os
from datetime import datetime
def custom_upload_to(instance, filename):
current_time = datetime.now()
pre_hash_name = os.path.basename(filename)
extension = str(filename).split('.')[-1]
hs_filename = '{}.{}'.format(hashlib.md5(pre_hash_name.encode()).hexdigest(), extension)
saved_path = 'upload/files/'
return '{}{}'.format(saved_path, hs_filename)
class Route(models.Model):
# Relationships
created_by = models.ForeignKey("myapp.AppUser", on_delete=models.CASCADE, related_name='routes')
# Fields
name = models.TextField(max_length=100)
file = models.FileField(
upload_to=custom_upload_to,
validators=[FileExtensionValidator(['kml', ])],
)
last_updated = models.DateTimeField(auto_now=True, editable=False)
created = models.DateTimeField(auto_now_add=True, editable=False)
class Meta:
pass
def __str__(self):
return str(self.name)
def get_absolute_url(self):
return reverse("myapp_Route_detail", args=(self.pk,))
def get_update_url(self):
return reverse("myapp_Route_update", args=(self.pk,))
class AppUser(AbstractUser):
# Fields
last_updated = models.DateTimeField(auto_now=True, editable=False)
created = models.DateTimeField(auto_now_add=True, editable=False)
class Meta:
pass
def __str__(self):
return str(self.pk)
def get_absolute_url(self):
return reverse("myapp_AppUser_detail", args=(self.pk,))
def get_update_url(self):
return reverse("myapp_AppUser_update", args=(self.pk,))
class Image(models.Model):
# Relationships
created_by = models.ForeignKey("myapp.AppUser", on_delete=models.CASCADE, related_name='images')
route = models.ForeignKey("myapp.route", on_delete=models.CASCADE, related_name='images')
# Fields
title = models.CharField(max_length=100)
created = models.DateTimeField(auto_now_add=True, editable=False)
last_updated = models.DateTimeField(auto_now=True, editable=False)
image = models.ImageField(upload_to=custom_upload_to)
class Meta:
pass
def __str__(self):
return str(self.pk)
def get_absolute_url(self):
return reverse("myapp_Image_detail", args=(self.pk,))
def get_update_url(self):
return reverse("myapp_Image_update", args=(self.pk,))
| 28.707865 | 100 | 0.705284 | 321 | 2,555 | 5.380062 | 0.271028 | 0.052113 | 0.079907 | 0.09033 | 0.613202 | 0.563405 | 0.543717 | 0.51824 | 0.495657 | 0.4337 | 0 | 0.003808 | 0.177691 | 2,555 | 88 | 101 | 29.034091 | 0.818182 | 0.018787 | 0 | 0.403509 | 0 | 0 | 0.077169 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.175439 | false | 0.052632 | 0.122807 | 0.157895 | 0.807018 | 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 | 1 | 1 | 0 | 0 | 3 |
aee35f1851658469404cfdbe6d9aad2a44ef24f8 | 388 | py | Python | backend/schemas.py | tomowl/scout | bdb0a6dfd3847d3cf493a2e85fa4231c54cd0d78 | [
"Apache-2.0"
] | 1 | 2022-02-10T02:09:53.000Z | 2022-02-10T02:09:53.000Z | backend/schemas.py | tomowl/scout | bdb0a6dfd3847d3cf493a2e85fa4231c54cd0d78 | [
"Apache-2.0"
] | null | null | null | backend/schemas.py | tomowl/scout | bdb0a6dfd3847d3cf493a2e85fa4231c54cd0d78 | [
"Apache-2.0"
] | null | null | null | from os import environ
from pydantic import BaseModel
from typing import Optional
class Transaction(BaseModel):
'''
Transaction data necessary to operate.
'''
token_1: str
token_2: str
swap: str
amount: float
wallet: Optional[str] = environ.get('WALLET')
private_key: Optional[str] = environ.get('PRIVATE_KEY')
dry_run: Optional[bool] = True | 22.823529 | 59 | 0.68299 | 49 | 388 | 5.306122 | 0.591837 | 0.084615 | 0.138462 | 0.161538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006645 | 0.224227 | 388 | 17 | 60 | 22.823529 | 0.857143 | 0.097938 | 0 | 0 | 0 | 0 | 0.05136 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.272727 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
aeea44aff50e0d29bf6c408681e46de6d46f0924 | 361 | py | Python | app/emails.py | nlohmann/lqfb_viewer | c89b08818cc69aa17eaf69a9268fcc94492fcaea | [
"Unlicense",
"MIT"
] | null | null | null | app/emails.py | nlohmann/lqfb_viewer | c89b08818cc69aa17eaf69a9268fcc94492fcaea | [
"Unlicense",
"MIT"
] | 1 | 2019-01-12T12:09:04.000Z | 2019-01-12T13:20:17.000Z | app/emails.py | nlohmann/lqfb_viewer | c89b08818cc69aa17eaf69a9268fcc94492fcaea | [
"Unlicense",
"MIT"
] | null | null | null | from flask.ext.mail import Message
from app import mail
from flask import flash
from decorators import async
@async
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender = sender, recipients = recipients)
msg.body = text_body
msg.html = html_body
try:
mail.send(msg)
except:
pass
| 22.5625 | 68 | 0.706371 | 50 | 361 | 5 | 0.46 | 0.072 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221607 | 361 | 15 | 69 | 24.066667 | 0.88968 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.076923 | 0.307692 | 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 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
4e0367bf260ea70e4609b0500eb186130b7be27d | 3,171 | py | Python | src/dynamic_graph/script_shortcuts.py | Rascof/dynamic-graph-python | 348f8d9291fe1314c86f1db88833d2531af8bf11 | [
"BSD-2-Clause"
] | null | null | null | src/dynamic_graph/script_shortcuts.py | Rascof/dynamic-graph-python | 348f8d9291fe1314c86f1db88833d2531af8bf11 | [
"BSD-2-Clause"
] | null | null | null | src/dynamic_graph/script_shortcuts.py | Rascof/dynamic-graph-python | 348f8d9291fe1314c86f1db88833d2531af8bf11 | [
"BSD-2-Clause"
] | null | null | null | # Defines the following shortcuts:
# signal.name -> return the shortname
# signal -> display nicely the content of the signal
# signal(3) -> recompute the signal at time 3, and display nicely
# signal +1 -> increment the signal time of 1, recompute, and display.
# signal.deps -> display the graph dependancy up to the default value (3)
# signal.deps(6) -> same, but with depth = 6.
# entity -> same as print(entity)
# change the prompt to be '%'
from __future__ import print_function
# Changing prompt
import sys
from .entity import Entity
from .matlab import matlab
from .signal_base import SignalBase
# Enables shortcut "name"
def sig_short_name(self):
return self.getName().split(':')[-1]
setattr(SignalBase, 'name', property(sig_short_name))
# Enables shortcuts "m"
# This code implements a pseudo function 'm' in the class signal_base,
# with no args, or optional args. Three calls can be made:
# - sig.m : print the current value.
# - sig.m(time): recompute at given <time>, and display the current value
# - sig.m +time: recompute at <time> after current time, and display.
class PrettySignalPrint:
sig = None
def __init__(self, sig):
self.sig = sig
def __str__(self):
return self.sig.name + " = " + str(matlab(self.sig.value))
def __repr__(self):
return str(self)
def __call__(self, iter):
self.sig.recompute(iter)
return self
def __add__(self, iter):
self.sig.recompute(self.sig.time + iter)
return self
def sigMatPrint(sig):
return PrettySignalPrint(sig)
setattr(SignalBase, 'm', property(PrettySignalPrint))
# print('Pretty matlab print set')
# Enable the same as 'm', but directly on the signal object.
def sigRepr(self):
return self.name + ' = ' + str(matlab(self.value))
def sigCall(sig, iter):
sig.recompute(iter)
print(sigRepr(sig))
def sigTimeIncr(sig, iter):
sig.recompute(sig.time + iter)
print(sigRepr(sig))
setattr(SignalBase, '__repr__', sigRepr)
setattr(SignalBase, '__call__', sigCall)
setattr(SignalBase, '__add__', sigTimeIncr)
# Enables shortcut "deps"
# Implements the peudo function 'deps', that can be called without arg,
# or specifying a specific depth to be printed.
class SignalDepPrint:
defaultDepth = 2
sig = None
def __init__(self, sig):
self.sig = sig
def __repr__(self):
return self.sig.displayDependencies(self.defaultDepth)
def __call__(self, depth):
self.defaultDepth = depth
return self
setattr(SignalBase, 'deps', property(SignalDepPrint))
setattr(Entity, 'sigs', property(Entity.displaySignals))
setattr(Entity, '__repr__', Entity.__str__)
sys.ps1 = '% '
# Enable function that can be call without()def optionalparentheses(f):
def optionalparentheses(f):
class decoclass:
def __init__(self, f):
self.functor = f
def __repr__(self):
res = self.functor()
if isinstance(res, str):
return res
else:
return ''
def __call__(self, *arg):
return self.functor(*arg)
return decoclass(f)
| 24.773438 | 76 | 0.666351 | 407 | 3,171 | 5.007371 | 0.285012 | 0.034347 | 0.027478 | 0.017664 | 0.090285 | 0.066732 | 0.066732 | 0.066732 | 0.033366 | 0.033366 | 0 | 0.004077 | 0.226427 | 3,171 | 127 | 77 | 24.968504 | 0.826743 | 0.351939 | 0 | 0.222222 | 0 | 0 | 0.026096 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.269841 | false | 0 | 0.079365 | 0.111111 | 0.650794 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
4e17fc487a489a795debf498a789f96b0aaef3f3 | 159 | py | Python | qord/internal/__init__.py | nerdguyahmad/qord | 9a486d2d3060f2c17036da0910e27b27615fa3a6 | [
"MIT"
] | 11 | 2022-02-08T13:57:55.000Z | 2022-03-11T13:42:22.000Z | qord/internal/__init__.py | nerdguyahmad/qord | 9a486d2d3060f2c17036da0910e27b27615fa3a6 | [
"MIT"
] | 8 | 2022-02-09T12:43:03.000Z | 2022-03-25T16:41:17.000Z | qord/internal/__init__.py | nerdguyahmad/qord | 9a486d2d3060f2c17036da0910e27b27615fa3a6 | [
"MIT"
] | 1 | 2022-03-06T13:25:08.000Z | 2022-03-06T13:25:08.000Z | """Non-public internal utilities used across the library.
The classes and functions under this module are not meant to be touched by users.
"""
__all__ = ()
| 22.714286 | 81 | 0.748428 | 24 | 159 | 4.791667 | 0.958333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176101 | 159 | 6 | 82 | 26.5 | 0.877863 | 0.861635 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9d70141fc4ff469b70fe397f6d9608b707c0fc4e | 374 | py | Python | ibolc/branch/models.py | jschaf/ibolcdb | e890fcf6bdc6219b3464899a99ac0464f6d329fc | [
"BSD-3-Clause"
] | null | null | null | ibolc/branch/models.py | jschaf/ibolcdb | e890fcf6bdc6219b3464899a99ac0464f6d329fc | [
"BSD-3-Clause"
] | null | null | null | ibolc/branch/models.py | jschaf/ibolcdb | e890fcf6bdc6219b3464899a99ac0464f6d329fc | [
"BSD-3-Clause"
] | null | null | null | from ibolc.database import (
Column,
db,
Model
)
class Branch(Model):
__tablename__ = 'branch'
id = Column(db.Integer, primary_key=True)
name = Column(db.String, nullable=False)
full_name = Column(db.String, nullable=False)
code = Column(db.String)
def __repr__(self):
return "<Branch({})>".format(self.name)
# TODO: add rank
| 19.684211 | 49 | 0.641711 | 47 | 374 | 4.893617 | 0.617021 | 0.173913 | 0.182609 | 0.156522 | 0.269565 | 0.269565 | 0 | 0 | 0 | 0 | 0 | 0 | 0.224599 | 374 | 18 | 50 | 20.777778 | 0.793103 | 0.037433 | 0 | 0 | 0 | 0 | 0.050279 | 0 | 0 | 0 | 0 | 0.055556 | 0 | 1 | 0.076923 | false | 0 | 0.076923 | 0.076923 | 0.692308 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
9d830839b1b5e8a8de4a840828dbf08de0367d1a | 408 | py | Python | integration/app_test.py | lsh110600/devops-eng-training | 310796c1dbe9cb8fdc3337208d556184b5b96d74 | [
"MIT"
] | null | null | null | integration/app_test.py | lsh110600/devops-eng-training | 310796c1dbe9cb8fdc3337208d556184b5b96d74 | [
"MIT"
] | null | null | null | integration/app_test.py | lsh110600/devops-eng-training | 310796c1dbe9cb8fdc3337208d556184b5b96d74 | [
"MIT"
] | null | null | null | # TODO(everyone): 웹서버의 healthz가 response code 200 확인
import pytest
import requests
import os
import sys
sys.path.append(
os.path.dirname(os.path.dirname(__file__))
)
from app import create_app
@pytest.fixture
def api():
app = create_app()
return app.test_client()
def test_health_check():
response = requests.get(url="http://localhost:8080/healthz")
assert response.status_code == 200 | 20.4 | 64 | 0.735294 | 59 | 408 | 4.915254 | 0.610169 | 0.048276 | 0.089655 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028986 | 0.154412 | 408 | 20 | 65 | 20.4 | 0.811594 | 0.122549 | 0 | 0 | 0 | 0 | 0.081232 | 0 | 0 | 0 | 0 | 0.05 | 0.066667 | 1 | 0.133333 | false | 0 | 0.333333 | 0 | 0.533333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
9dc7d727ff313505f120c90ddd73242550c253fa | 167 | py | Python | print-list-import-module.py | bdclauser/python-notes | b9e0f5006776e20c36fecec5d617a1a7bbc26748 | [
"MIT"
] | null | null | null | print-list-import-module.py | bdclauser/python-notes | b9e0f5006776e20c36fecec5d617a1a7bbc26748 | [
"MIT"
] | null | null | null | print-list-import-module.py | bdclauser/python-notes | b9e0f5006776e20c36fecec5d617a1a7bbc26748 | [
"MIT"
] | null | null | null | # prints list of imported module
import math # Imports the math module
everything = dir(math) # Sets everything in math to a list
print(everything) # prints list.
| 27.833333 | 59 | 0.748503 | 25 | 167 | 5 | 0.64 | 0.16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.191617 | 167 | 5 | 60 | 33.4 | 0.925926 | 0.60479 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.