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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9df8326320ebeefc167dcda9f2bb32fd04c4f06d | 104 | py | Python | src/main/cclyzer/config/__init__.py | plast-lab/cclyzer | 470b614ff26a348d5d9bde1cabe52cf668ec48b9 | [
"MIT"
] | 63 | 2016-02-06T21:06:40.000Z | 2021-11-16T19:58:27.000Z | src/main/cclyzer/config/__init__.py | plast-lab/cclyzer | 470b614ff26a348d5d9bde1cabe52cf668ec48b9 | [
"MIT"
] | 7 | 2016-03-03T16:18:16.000Z | 2019-07-26T17:08:07.000Z | src/main/cclyzer/config/__init__.py | plast-lab/cclyzer | 470b614ff26a348d5d9bde1cabe52cf668ec48b9 | [
"MIT"
] | 14 | 2016-02-21T17:12:36.000Z | 2021-09-26T02:48:41.000Z | from custom_analysis import CustomAnalysis
from yaml_impl import YamlConfiguration as UserConfiguration
| 34.666667 | 60 | 0.903846 | 12 | 104 | 7.666667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096154 | 104 | 2 | 61 | 52 | 0.978723 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
d17a1f27b1adae63d017e6fd0aa2a33f22fb53f2 | 123 | py | Python | iris_sdk/models/maps/warnings.py | NumberAI/python-bandwidth-iris | 0e05f79d68b244812afb97e00fd65b3f46d00aa3 | [
"MIT"
] | 2 | 2020-04-13T13:47:59.000Z | 2022-02-23T20:32:41.000Z | iris_sdk/models/maps/warnings.py | bandwidthcom/python-bandwidth-iris | dbcb30569631395041b92917252d913166f7d3c9 | [
"MIT"
] | 5 | 2020-09-18T20:59:24.000Z | 2021-08-25T16:51:42.000Z | iris_sdk/models/maps/warnings.py | bandwidthcom/python-bandwidth-iris | dbcb30569631395041b92917252d913166f7d3c9 | [
"MIT"
] | 5 | 2018-12-12T14:39:50.000Z | 2020-11-17T21:42:29.000Z | #!/usr/bin/env python
from iris_sdk.models.maps.base_map import BaseMap
class WarningsMap(BaseMap):
warning = None
| 17.571429 | 49 | 0.747967 | 18 | 123 | 5 | 0.944444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154472 | 123 | 6 | 50 | 20.5 | 0.865385 | 0.162602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
d1884fd270ec3ca17700fbcb4baec1be039603b4 | 3,002 | py | Python | Level2/Ex_2.py | zac11/Python_Excerices | 775739e2639be1f82cc3690c854b9ea0ece05042 | [
"Apache-2.0"
] | 2 | 2019-03-09T20:31:06.000Z | 2020-06-19T12:15:13.000Z | Level2/Ex_2.py | zac11/Python_Excerices | 775739e2639be1f82cc3690c854b9ea0ece05042 | [
"Apache-2.0"
] | null | null | null | Level2/Ex_2.py | zac11/Python_Excerices | 775739e2639be1f82cc3690c854b9ea0ece05042 | [
"Apache-2.0"
] | 1 | 2018-08-11T18:36:49.000Z | 2018-08-11T18:36:49.000Z | """
Question:
Write a program which takes 2 digits, X,Y as input and generates a 2-dimensional array. The element value in the i-th row and j-th column of the array should be i*j.
Note: i=0,1.., X-1; j=0,1,¡Y-1.
Example
Suppose the following inputs are given to the program:
3,5
Then, the output of the program should be:
[[0, 0, 0, 0, 0], [0, 1, 2, 3, 4], [0, 2, 4, 6, 8]]
"""
str_input = input()
dimensions = [int(x) for x in str_input.split(',')]
rowNum = dimensions[0]
columnNum = dimensions[1]
multilist = [[0 for col in range(columnNum)] for row in range(rowNum)]
"""
This creates a 4X6 dimensional array of 0's
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
"""
print(multilist)
for row in range(rowNum):
for col in range(columnNum):
multilist[row][col]= row*col
print(multilist)
"""
------------------Row 1----------------------
for row in range(0):
for col in range(6):
multilist[0][0]= 1*0 = 0
for row in range(0):
for col in range(6):
multilist[0][1]= 0*1 = 0
for row in range(0):
for col in range(6):
multilist[0][2]= 0*2 = 0
for row in range(0):
for col in range(6):
multilist[0][3]= 0*3 = 0
for row in range(0):
for col in range(6):
multilist[0][4]= 0*4 = 0
for row in range(0):
for col in range(6):
multilist[0][5]= 0*5 = 0
for row in range(0):
for col in range(6):
multilist[0][6]= 0*6 = 0
------------------Row 2-------------------------
for row in range(1):
for col in range(6):
multilist[1][0]= 1*0 = 0
for row in range(1):
for col in range(6):
multilist[1][1]= 1*1 = 1
for row in range(1):
for col in range(6):
multilist[1][2]= 1*2 = 2
for row in range(1):
for col in range(6):
multilist[1][3]= 1*3 = 3
for row in range(1):
for col in range(6):
multilist[1][4]= 1*4 = 4
for row in range(1):
for col in range(6):
multilist[1][5]= 1*5 = 5
for row in range(1):
for col in range(6):
multilist[1][6]= 1*6 = 6
------------------Row 3---------------------------
for row in range(2):
for col in range(6):
multilist[2][0]= 2*0 = 0
for row in range(2):
for col in range(6):
multilist[2][1]= 2*1 = 2
for row in range(2):
for col in range(6):
multilist[2][2]= 2*2 = 4
for row in range(2):
for col in range(6):
multilist[2][3]= 2*3 = 6
for row in range(2):
for col in range(6):
multilist[2][4]= 2*4 = 8
for row in range(2):
for col in range(6):
multilist[2][5]= 2*5 = 10
for row in range(2):
for col in range(6):
multilist[2][6]= 2*6 = 12
------------------Row 4---------------------------------
for row in range(3):
for col in range(6):
multilist[3][0]= 3*0 = 0
for row in range(3):
for col in range(6):
multilist[3][1]= 3*1 = 3
for row in range(3):
for col in range(6):
multilist[3][2]= 3*2 = 6
for row in range(3):
for col in range(6):
multilist[3][3]= 3*3 = 9
for row in range(3):
for col in range(6):
multilist[3][4]= 3*4 = 12
for row in range(3):
for col in range(6):
multilist[3][5]= 3*5 = 15
""" | 16.315217 | 165 | 0.562958 | 606 | 3,002 | 2.788779 | 0.107261 | 0.240237 | 0.137278 | 0.223077 | 0.691716 | 0.636095 | 0.630178 | 0.630178 | 0.626036 | 0.626036 | 0 | 0.107969 | 0.222518 | 3,002 | 184 | 166 | 16.315217 | 0.615253 | 0.123251 | 0 | 0.2 | 1 | 0 | 0.003003 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 4 |
0612f09da6dbf3ef8e21762c3440799b8fa0a270 | 166 | py | Python | deliver/functions_will/eval_spline.py | mariecpereira/Extracao-de-Caracteristicas-Corpo-Caloso | f094c706db815f91cf61d1d501c2a9030b9b54d3 | [
"MIT"
] | null | null | null | deliver/functions_will/eval_spline.py | mariecpereira/Extracao-de-Caracteristicas-Corpo-Caloso | f094c706db815f91cf61d1d501c2a9030b9b54d3 | [
"MIT"
] | null | null | null | deliver/functions_will/eval_spline.py | mariecpereira/Extracao-de-Caracteristicas-Corpo-Caloso | f094c706db815f91cf61d1d501c2a9030b9b54d3 | [
"MIT"
] | null | null | null | # -*- encoding: utf-8 -*-
import numpy as np
import scipy.interpolate as spline
def eval_spline(tck, t):
y, x = spline.splev(t,tck)
return np.vstack((y,x))
| 18.444444 | 34 | 0.650602 | 28 | 166 | 3.821429 | 0.678571 | 0.037383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007463 | 0.192771 | 166 | 8 | 35 | 20.75 | 0.791045 | 0.138554 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
ae081196588084056c347dc252815961c1cf3a7e | 197 | py | Python | week02/week02_02.py | w1g/introduction_to_python | 8798f891fd99090c88aa06eb6dd6e29e6a86e928 | [
"MIT"
] | null | null | null | week02/week02_02.py | w1g/introduction_to_python | 8798f891fd99090c88aa06eb6dd6e29e6a86e928 | [
"MIT"
] | null | null | null | week02/week02_02.py | w1g/introduction_to_python | 8798f891fd99090c88aa06eb6dd6e29e6a86e928 | [
"MIT"
] | null | null | null | import json
import functools
def to_json(func):
@functools.wraps(func)
def inner(*argv, **kwargv):
result = func(*argv, **kwargv)
return json.dumps(result)
return inner | 21.888889 | 38 | 0.64467 | 25 | 197 | 5.04 | 0.52 | 0.15873 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.233503 | 197 | 9 | 39 | 21.888889 | 0.834437 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
ae56b162d08ee77c5cc01859d9ddffc8428c2257 | 93 | py | Python | paseto_auth/exceptions.py | moiseshiraldo/django-rest-paseto-auth | 13295f8bdbec486decbff9692c11ad38dbe90090 | [
"MIT"
] | 7 | 2018-07-05T02:32:53.000Z | 2020-11-23T22:45:55.000Z | paseto_auth/exceptions.py | moiseshiraldo/django-rest-paseto-auth | 13295f8bdbec486decbff9692c11ad38dbe90090 | [
"MIT"
] | 2 | 2018-04-23T18:24:40.000Z | 2018-04-23T18:35:07.000Z | paseto_auth/exceptions.py | moiseshiraldo/django-rest-paseto-auth | 13295f8bdbec486decbff9692c11ad38dbe90090 | [
"MIT"
] | null | null | null |
class TokenError(Exception):
"""
Base exception for token errors.
"""
pass
| 11.625 | 36 | 0.591398 | 9 | 93 | 6.111111 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.301075 | 93 | 7 | 37 | 13.285714 | 0.846154 | 0.344086 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
ae6e483b504c179d9b95badd3f34b4aa161dbfce | 961 | py | Python | askalexa/response/package.py | scottenglert/AskAlexa | aac9d8aa4d6d5d2e9dcd079e0ac516b06c8a94ba | [
"MIT"
] | 2 | 2018-05-25T11:18:18.000Z | 2019-08-09T19:23:54.000Z | askalexa/response/package.py | scottenglert/AskAlexa | aac9d8aa4d6d5d2e9dcd079e0ac516b06c8a94ba | [
"MIT"
] | null | null | null | askalexa/response/package.py | scottenglert/AskAlexa | aac9d8aa4d6d5d2e9dcd079e0ac516b06c8a94ba | [
"MIT"
] | null | null | null | from askalexa.response.data import JsonResponseData, response_property
class ResponsePackage(JsonResponseData):
'''
This is the complete response package that is sent back to Alexa with the
given response and session attributes.
'''
def __init__(self, response, session_attributes):
self._version = '1.0'
self._response = response
self._session_attributes = session_attributes
@response_property('version')
def version(self):
return self._version
@response_property('sessionAttributes')
def session_attributes(self):
return self._session_attributes
@session_attributes.setter
def session_attributes(self, attributes):
self._session_attributes = attributes
@response_property('response')
def response(self):
return self._response
@response.setter
def response(self, response):
self._response = response | 30.03125 | 78 | 0.688866 | 98 | 961 | 6.510204 | 0.336735 | 0.239812 | 0.098746 | 0.087774 | 0.119122 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002732 | 0.238293 | 961 | 32 | 79 | 30.03125 | 0.868852 | 0.116545 | 0 | 0.095238 | 0 | 0 | 0.043805 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.047619 | 0.142857 | 0.52381 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
ae746eb3b2d59aa6933af18c77e168446a664136 | 273 | py | Python | pymlconf/__init__.py | pylover/pymlconf | 4111ed84b23201957ee789b58e6818f330eeb28b | [
"MIT"
] | 36 | 2015-02-09T14:20:32.000Z | 2020-12-18T03:01:29.000Z | pymlconf/__init__.py | pylover/pymlconf | 4111ed84b23201957ee789b58e6818f330eeb28b | [
"MIT"
] | 23 | 2015-06-05T07:30:18.000Z | 2020-05-26T17:45:46.000Z | pymlconf/__init__.py | pylover/pymlconf | 4111ed84b23201957ee789b58e6818f330eeb28b | [
"MIT"
] | 5 | 2016-02-19T14:22:28.000Z | 2018-08-06T14:04:44.000Z | """pymlconf package."""
from .models import Mergable, MergableList, MergableDict, Root, \
ConfigurationNamespace, DeferredRoot
from .errors import ConfigurationError, ConfigurationAlreadyInitializedError, \
ConfigurationNotInitializedError
__version__ = '3.0.1'
| 27.3 | 79 | 0.794872 | 21 | 273 | 10.142857 | 0.904762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0125 | 0.120879 | 273 | 9 | 80 | 30.333333 | 0.875 | 0.062271 | 0 | 0 | 0 | 0 | 0.02 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
ae953647fa33bb9ce7e7ef91abfda8f2c598668c | 230 | py | Python | projects/serializers.py | sahin88/Django_RestFramework_ReactJS_PortfolioApp_Frontend | 5dd2bb70af93bd115d637cf56e0aeadb7ffc991b | [
"Unlicense"
] | null | null | null | projects/serializers.py | sahin88/Django_RestFramework_ReactJS_PortfolioApp_Frontend | 5dd2bb70af93bd115d637cf56e0aeadb7ffc991b | [
"Unlicense"
] | null | null | null | projects/serializers.py | sahin88/Django_RestFramework_ReactJS_PortfolioApp_Frontend | 5dd2bb70af93bd115d637cf56e0aeadb7ffc991b | [
"Unlicense"
] | null | null | null | from rest_framework import serializers
from .models import Projects
class ProjectsSerializers(serializers.ModelSerializer):
class Meta:
model = Projects
fields = ('name', 'description', 'url_field', 'image')
| 25.555556 | 62 | 0.721739 | 23 | 230 | 7.130435 | 0.782609 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186957 | 230 | 8 | 63 | 28.75 | 0.877005 | 0 | 0 | 0 | 0 | 0 | 0.126087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
8815a65eb79ea5f19d0cc1bb2129230de1d5b22f | 221 | py | Python | python_app/tenhou-bot/mahjong/ai/base.py | 0xsuu/Project-Mahjong | e82edc67651ff93c8ec158b590cd728f28504be9 | [
"Apache-2.0"
] | 9 | 2018-06-08T00:09:08.000Z | 2021-11-17T11:05:11.000Z | python_app/tenhou-bot/mahjong/ai/base.py | 0xsuu/Project-Mahjong | e82edc67651ff93c8ec158b590cd728f28504be9 | [
"Apache-2.0"
] | 1 | 2020-04-25T12:43:26.000Z | 2020-04-25T12:43:26.000Z | python_app/tenhou-bot/mahjong/ai/base.py | 0xsuu/Project-Mahjong | e82edc67651ff93c8ec158b590cd728f28504be9 | [
"Apache-2.0"
] | 2 | 2019-05-30T07:18:45.000Z | 2019-11-05T09:15:13.000Z | # -*- coding: utf-8 -*-
class BaseAI(object):
player = None
table = None
def __init__(self, table, player):
self.player = player
self.table = table
def discard_tile(self):
pass
| 15.785714 | 38 | 0.565611 | 26 | 221 | 4.615385 | 0.576923 | 0.15 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006623 | 0.316742 | 221 | 13 | 39 | 17 | 0.788079 | 0.095023 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.125 | 0 | 0 | 0.625 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 4 |
882612f02c6fdbe21f13b2bef82aa48693a0a992 | 461 | py | Python | demo/file/os_path_demo.py | firstprojectfor/FPF_python | 2321aff0d5b56f787befec55917d731c8c776558 | [
"MIT"
] | 1 | 2019-05-04T01:32:06.000Z | 2019-05-04T01:32:06.000Z | demo/file/os_path_demo.py | firstprojectfor/FPF_python | 2321aff0d5b56f787befec55917d731c8c776558 | [
"MIT"
] | null | null | null | demo/file/os_path_demo.py | firstprojectfor/FPF_python | 2321aff0d5b56f787befec55917d731c8c776558 | [
"MIT"
] | null | null | null | import os
import time
file1 = "d://test.pdf"
file2 = "d://tmp//"
print(os.path.isabs(file1))
print(os.path.isdir(file2))
print("split ---")
print(os.path.split(file1))
print(os.path.splitext(file1))
print(os.path.split(file2))
print(os.path.splitext(file2))
print(os.path.basename(file1))
print(os.path.dirname(file1))
print(os.path.abspath(file1))
print(time.ctime(os.path.getctime(file1)))
print(os.path.getsize(file1))
print(os.path.getsize(file2))
| 17.074074 | 42 | 0.718004 | 75 | 461 | 4.413333 | 0.28 | 0.217523 | 0.365559 | 0.338369 | 0.138973 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03271 | 0.071584 | 461 | 26 | 43 | 17.730769 | 0.740654 | 0 | 0 | 0 | 0 | 0 | 0.065359 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.117647 | 0 | 0.117647 | 0.764706 | 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 | 1 | 0 | 4 |
88416086d7d639bb7305bcf357ce7663abb2c9e4 | 28 | py | Python | keygen/gliffy-keygen/utils.py | dmikhaylenko/environment | 5ecdbbe520b1ff4f6b1ec3a2e2d922d65d594622 | [
"MIT"
] | null | null | null | keygen/gliffy-keygen/utils.py | dmikhaylenko/environment | 5ecdbbe520b1ff4f6b1ec3a2e2d922d65d594622 | [
"MIT"
] | null | null | null | keygen/gliffy-keygen/utils.py | dmikhaylenko/environment | 5ecdbbe520b1ff4f6b1ec3a2e2d922d65d594622 | [
"MIT"
] | null | null | null | ../atlassian-keygen/utils.py | 28 | 28 | 0.785714 | 4 | 28 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 28 | 1 | 28 | 28 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
8844193801a6c6e3c1bd2210776e244b8c0ba7e1 | 53 | py | Python | douzero/dmc/__init__.py | hsywhu/DouZero | a246f3ba88a041fc08463ffe64fec2cfa1ec7707 | [
"Apache-2.0"
] | 2,552 | 2021-06-11T08:17:47.000Z | 2022-03-30T12:05:56.000Z | douzero/dmc/__init__.py | Vincentzyx/DouZero | 3f06cb8a0203e1b78a238e6c79ed785f46465725 | [
"Apache-2.0"
] | 37 | 2021-06-16T14:17:30.000Z | 2022-01-26T07:15:27.000Z | douzero/dmc/__init__.py | Vincentzyx/DouZero | 3f06cb8a0203e1b78a238e6c79ed785f46465725 | [
"Apache-2.0"
] | 343 | 2021-06-15T04:39:13.000Z | 2022-03-29T11:19:32.000Z | from .dmc import train
from .arguments import parser
| 17.666667 | 29 | 0.811321 | 8 | 53 | 5.375 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150943 | 53 | 2 | 30 | 26.5 | 0.955556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
8853b9facdacf1bee4734f5669b3330abef604b4 | 22 | py | Python | lang/Python/read-entire-file-1.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | 5 | 2021-01-29T20:08:05.000Z | 2022-03-22T06:16:05.000Z | lang/Python/read-entire-file-1.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | lang/Python/read-entire-file-1.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | 1 | 2021-04-13T04:19:31.000Z | 2021-04-13T04:19:31.000Z | open(filename).read()
| 11 | 21 | 0.727273 | 3 | 22 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 22 | 1 | 22 | 22 | 0.761905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
888a70d65c6daaabf3b8235128df1155c615d89d | 93 | py | Python | kioskoapp/apps.py | Knd9/kioskoproy | 46683501287a9d7d6de5ddacdb87c00861b9eb56 | [
"MIT"
] | null | null | null | kioskoapp/apps.py | Knd9/kioskoproy | 46683501287a9d7d6de5ddacdb87c00861b9eb56 | [
"MIT"
] | 5 | 2021-04-08T18:41:15.000Z | 2021-09-22T17:59:11.000Z | kioskoapp/apps.py | Knd9/kioskoproy | 46683501287a9d7d6de5ddacdb87c00861b9eb56 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class KioskoappConfig(AppConfig):
name = 'kioskoapp'
| 15.5 | 33 | 0.763441 | 10 | 93 | 7.1 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16129 | 93 | 5 | 34 | 18.6 | 0.910256 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
ee17b7ab2030c081df24352e6296b7aa8e60ae9b | 63 | py | Python | Android/parser/ui/lang/langtest.py | Bravest-Ptt/Useful-Shell | 75016ff44f218afce6b885af7b23fb801a7ef2d4 | [
"Apache-2.0"
] | 1 | 2020-05-31T08:46:45.000Z | 2020-05-31T08:46:45.000Z | Android/parser/ui/lang/langtest.py | Bravest-Ptt/Useful-Shell | 75016ff44f218afce6b885af7b23fb801a7ef2d4 | [
"Apache-2.0"
] | null | null | null | Android/parser/ui/lang/langtest.py | Bravest-Ptt/Useful-Shell | 75016ff44f218afce6b885af7b23fb801a7ef2d4 | [
"Apache-2.0"
] | null | null | null | import lang
if __name__ == "__main__":
print lang.app_name | 15.75 | 26 | 0.714286 | 9 | 63 | 4 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 63 | 4 | 27 | 15.75 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
ee268da90192b81de8fa746848ae88f3121b2bfb | 26 | py | Python | pypingcli/__init__.py | tameeshB/pyPingCLI | 070edab79b24c257a8512b2a1410d12583f96d69 | [
"MIT"
] | 1 | 2019-10-28T00:39:32.000Z | 2019-10-28T00:39:32.000Z | pypingcli/__init__.py | tameeshB/pyPingCLI | 070edab79b24c257a8512b2a1410d12583f96d69 | [
"MIT"
] | 7 | 2018-10-01T01:13:59.000Z | 2018-10-03T16:44:34.000Z | pypingcli/__init__.py | tameeshB/pyPingCLI | 070edab79b24c257a8512b2a1410d12583f96d69 | [
"MIT"
] | 6 | 2018-10-01T10:09:16.000Z | 2020-09-16T06:59:16.000Z | __version__ = '0.02.dev0'
| 13 | 25 | 0.692308 | 4 | 26 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 0.115385 | 26 | 1 | 26 | 26 | 0.434783 | 0 | 0 | 0 | 0 | 0 | 0.346154 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ee7881cecae01f4cc1c53911b1ea7ebf14c50b82 | 174 | py | Python | examples/helpers/post/like.py | javad94/instauto | 8d4d068863176b0a1df13e5be3d5e32388036921 | [
"MIT"
] | 79 | 2020-08-24T23:32:57.000Z | 2022-02-20T19:03:17.000Z | examples/helpers/post/like.py | klaytonpaiva/instauto | 7f8c26b22f84d3d966625c7fa656e91cc623bb2e | [
"MIT"
] | 146 | 2020-07-25T16:27:48.000Z | 2021-10-02T09:03:50.000Z | examples/helpers/post/like.py | klaytonpaiva/instauto | 7f8c26b22f84d3d966625c7fa656e91cc623bb2e | [
"MIT"
] | 41 | 2020-09-07T14:19:04.000Z | 2022-02-07T23:08:10.000Z | from instauto.api.client import ApiClient
from instauto.helpers.post import like_post
client = ApiClient.initiate_from_file('.instauto.save')
like_post(client, "media_id")
| 24.857143 | 55 | 0.816092 | 25 | 174 | 5.48 | 0.56 | 0.175182 | 0.20438 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.086207 | 174 | 6 | 56 | 29 | 0.861635 | 0 | 0 | 0 | 0 | 0 | 0.127168 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
ee798baefc405ca3520b6ba9c8712f4e403b2fcf | 184 | py | Python | api/app/admin/logout.py | dheepak-aot/queue-management-1 | a96e3ab4b8e4e14e2d70e940de6d9551f6f093be | [
"Apache-2.0"
] | 30 | 2018-09-19T03:30:51.000Z | 2022-03-07T02:57:05.000Z | api/app/admin/logout.py | dheepak-aot/queue-management-1 | a96e3ab4b8e4e14e2d70e940de6d9551f6f093be | [
"Apache-2.0"
] | 159 | 2018-09-17T23:45:58.000Z | 2022-03-30T17:35:05.000Z | api/app/admin/logout.py | dheepak-aot/queue-management-1 | a96e3ab4b8e4e14e2d70e940de6d9551f6f093be | [
"Apache-2.0"
] | 52 | 2018-05-18T18:30:06.000Z | 2021-08-25T12:00:29.000Z | from flask_admin.menu import MenuLink
from flask_login import current_user
class LogoutMenuLink(MenuLink):
def is_accessible(self):
return current_user.is_authenticated
| 20.444444 | 44 | 0.798913 | 24 | 184 | 5.875 | 0.708333 | 0.12766 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157609 | 184 | 8 | 45 | 23 | 0.909677 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0.2 | 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 | 1 | 0 | 0 | 0 | 4 |
c987ee1de55111f6f877bdd7d1f0dfc0e30d8b3c | 19,184 | py | Python | backend/meertime/test_graphql.py | gravitationalwavedc/meertime_dataportal | de06814d5b456c12ebd77d76eb38801458c97d26 | [
"MIT"
] | 1 | 2020-10-26T02:48:06.000Z | 2020-10-26T02:48:06.000Z | backend/meertime/test_graphql.py | gravitationalwavedc/meertime_dataportal | de06814d5b456c12ebd77d76eb38801458c97d26 | [
"MIT"
] | null | null | null | backend/meertime/test_graphql.py | gravitationalwavedc/meertime_dataportal | de06814d5b456c12ebd77d76eb38801458c97d26 | [
"MIT"
] | null | null | null | import pytest
import json
from dataportal.models import Observations, Pulsars, Utcs
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from datetime import datetime
from ingest.ingest_methods import handle_image_parsing
# Auxiliary functions
jwt_mutation = """
mutation TokenAuth($username: String!, $password: String!) {
tokenAuth(input:{username: $username, password: $password}) {
token
payload
refreshExpiresIn
}
}
"""
def __create_viewer(client, django_user_model):
username = "viewer"
password = "reweiv"
viewer = django_user_model.objects.create_user(username=username, password=password)
return viewer
jwt_vars_viewer = """
{
"username": "viewer",
"password": "reweiv"
}
"""
def __create_creator(client, django_user_model):
username = "creator"
password = "rotaerc"
creator = django_user_model.objects.create_user(username=username, password=password)
content_type = ContentType.objects.get_for_model(Observations)
permission = Permission.objects.get(content_type=content_type, codename="add_observations")
creator.user_permissions.add(permission)
return creator
jwt_vars_creator = """
{
"username": "creator",
"password": "rotaerc"
}
"""
def __create_psr_utc_obs():
psr = Pulsars.objects.create(jname="J1234-5678")
utc_str = "2000-01-01-12:59:12"
utc_dt = datetime.strptime(f"{utc_str} +0000", "%Y-%m-%d-%H:%M:%S %z")
utc = Utcs.objects.create(utc_ts=utc_dt)
Observations.objects.create(pulsar=psr, utc=utc, beam=1)
return psr, utc
def __obtain_jwt_token(client, mutation, vars):
# obtain the token
payload = {"query": mutation, "variables": vars}
response = client.post("/graphql/", payload)
data = json.loads(response.content)["data"]
jwt_token = data["tokenAuth"]["token"]
return jwt_token
# Test querying
# pulsars query
query_psr = """
query {
pulsars {
jname
}
}
"""
def test_graphql_pulsars_query_no_token(client, django_user_model):
psr, _ = __create_psr_utc_obs()
expected = b'{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":3,"column":9}],"path":["pulsars"]}],"data":{"pulsars":null}}'
response = client.post("/graphql/", {"query": query_psr})
assert response.content == expected
assert response.status_code == 200
def test_graphql_pulsars_query_with_token(client, django_user_model):
user = __create_viewer(client, django_user_model)
psr, _ = __create_psr_utc_obs()
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_viewer)
# try mutation with the token
payload = {"query": query_psr}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
expected = b'{"data":{"pulsars":[{"jname":"J1234-5678"}]}}'
assert response.content == expected
assert response.status_code == 200
# utcs query
query_utcs = """
query {
utcs {
utcTs
}
}
"""
def test_graphql_utcs_query_no_token(client, django_user_model):
_, utc = __create_psr_utc_obs()
expected = b'{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":3,"column":9}],"path":["utcs"]}],"data":{"utcs":null}}'
response = client.post("/graphql/", {"query": query_utcs})
assert response.status_code == 200
assert response.content == expected
def test_graphql_utcs_query_with_token(client, django_user_model):
user = __create_viewer(client, django_user_model)
psr, _ = __create_psr_utc_obs()
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_viewer)
# try mutation with the token
payload = {"query": query_utcs}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
expected = b'{"data":{"utcs":[{"utcTs":"2000-01-01T12:59:12+00:00"}]}}'
assert response.content == expected
assert response.status_code == 200
# observations query:
query_obs = """
query {
observations {
pulsar {
jname
}
utc {
utcTs
}
}
}
"""
def test_graphql_observations_query_no_token(client, django_user_model):
psr, utc = __create_psr_utc_obs()
expected = b'{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":3,"column":9}],"path":["observations"]}],"data":{"observations":null}}'
response = client.post("/graphql/", {"query": query_obs})
assert response.status_code == 200
assert response.content == expected
def test_graphql_observations_query_with_token(client, django_user_model):
user = __create_viewer(client, django_user_model)
psr, _ = __create_psr_utc_obs()
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_viewer)
# try mutation with the token
payload = {"query": query_obs}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
expected = (
b'{"data":{"observations":[{"pulsar":{"jname":"J1234-5678"},"utc":{"utcTs":"2000-01-01T12:59:12+00:00"}}]}}'
)
assert response.content == expected
assert response.status_code == 200
# Test mutations
# Auxiliary strings for testing mutations
# mutations shared between tests below
createObservation_mutation = """
mutation (
$jname: String!, $utc: String!, $beam: Int!, $RA: String, $DEC: String, $DM: Float, $snr: Float, $length: Float, $nchan: Int, $nbin: Int,
$nsubint: Int, $nant: Int, $nant_eff: Int, $proposal: String, $bw: Float, $freq: Float,
$profile: String, $phaseVsTime: String, $phaseVsFreq: String, $bandpass: String, $snrVsTime: String, $update: Boolean,
$schedule: String, $phaseup: String
) {
createObservation(
jname: $jname, utc: $utc, beam: $beam, RA: $RA, DEC: $DEC, DM: $DM, snr: $snr, length: $length, nchan: $nchan, nbin: $nbin,
nsubint: $nsubint, nant: $nant, nantEff: $nant_eff, proposal: $proposal, bw: $bw, frequency: $freq,
profile: $profile, phaseVsTime: $phaseVsTime, phaseVsFrequency: $phaseVsFreq, bandpass: $bandpass, snrVsTime: $snrVsTime, update: $update,
schedule: $schedule, phaseup: $phaseup
) {
observations {
pulsar {
jname
}
}
}
}
"""
image_bytes = handle_image_parsing("ingest/example.png")
createObservation_mutation_variables = """
{
"jname": "J1234-5678",
"utc": "2020-08-12-01:02:03",
"beam": 3,
"RA": "12:34:01.132",
"DEC": "-56:78:01.132",
"DM": 5.3514,
"snr": 15.231,
"length": 201.2,
"nchan": 856,
"nant": 57,
"nbin": 1024,
"nsubint": 12,
"nant_eff": 57,
"proposal": "SCI-20180516-MB-02",
"bw": 856,
"freq": 1235.0123,
"profile": "",
"phaseVsTime": "",
"phaseVsFreq": "%s",
"bandpass": "",
"snrVsTime": "",
"schedule": "2020-01",
"phaseup": "2020-02",
"update": false
}
""" % (
image_bytes,
)
jwt_mutation = """
mutation TokenAuth($username: String!, $password: String!) {
tokenAuth(input:{username: $username, password: $password}) {
token
payload
refreshExpiresIn
}
}
"""
def test_graphql_mutation_createObservation_without_token(client, django_user_model):
payload = {"query": createObservation_mutation, "variables": createObservation_mutation_variables}
response = client.post("/graphql/", payload)
error_list = json.loads(response.content)["errors"]
expected = b'{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":8,"column":9}],"path":["createObservation"]}],"data":{"createObservation":null}}'
assert response.status_code == 200
assert len(error_list) > 0
assert isinstance(error_list[0], dict)
assert "message" in error_list[0].keys()
assert error_list[0]["message"] == "You do not have permission to perform this action"
assert response.content == expected
@pytest.mark.django_db
def test_graphql_mutation_createObservation_with_token_without_permission(client, django_user_model):
user = __create_viewer(client, django_user_model)
assert not user.has_perm("dataportal.add_observations")
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_viewer)
# try mutation with the token
payload = {"query": createObservation_mutation, "variables": createObservation_mutation_variables}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
error_list = json.loads(response.content)["errors"]
expected = b'{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":8,"column":9}],"path":["createObservation"]}],"data":{"createObservation":null}}'
assert response.status_code == 200
assert len(error_list) > 0
assert isinstance(error_list[0], dict)
assert "message" in error_list[0].keys()
assert error_list[0]["message"] == "You do not have permission to perform this action"
assert response.content == expected
@pytest.mark.django_db
def test_graphql_mutation_createObservation_with_token_with_permission(client, django_user_model):
user = __create_creator(client, django_user_model)
assert user.has_perm("dataportal.add_observations")
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_creator)
# try mutation with the token
payload = {"query": createObservation_mutation, "variables": createObservation_mutation_variables}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
assert response.status_code == 200
assert response.content == b'{"data":{"createObservation":{"observations":{"pulsar":{"jname":"J1234-5678"}}}}}'
createSearchmode_mutation = """
mutation (
$jname: String!, $utc: String!, $beam: Int!, $DM: Float, $RA: String, $DEC: String, $nbit: Int, $nchan: Int,
$npol: Int, $tsamp: Float, $nant: Int, $nant_eff: Int, $proposal: String, $length: Float, $bw: Float, $freq: Float,
$schedule: String, $phaseup: String
) {
createSearchmode(
jname: $jname, utc: $utc, beam: $beam, RA: $RA, DEC: $DEC, DM: $DM, nbit: $nbit, nchan: $nchan,
npol: $npol, tsamp: $tsamp, nant: $nant, nantEff: $nant_eff, proposal: $proposal, length: $length, bw: $bw, frequency: $freq,
schedule: $schedule, phaseup: $phaseup
) {
searchmode {
pulsar {
jname
}
}
}
}
"""
createSearchmode_mutation_variables = """
{
"jname": "J1234-5678",
"utc": "2020-08-12-01:02:03",
"beam": 3,
"RA": "12:34:12.345",
"DEC": "-56:77:56.789",
"DM": 5.3514,
"nbit": 8,
"nchan": 856,
"npol": 2,
"tsamp": 0.000064,
"nant": 57,
"nant_eff": 54,
"proposal": "SCI-20180516-MB-02",
"length": 201.2,
"bw": 856,
"freq": 1235.0123,
"schedule": "2020-01",
"phaseup": "2020-03"
}
"""
def test_graphql_mutation_createSearchmode_without_token(client, django_user_model):
payload = {"query": createSearchmode_mutation, "variables": createSearchmode_mutation_variables}
response = client.post("/graphql/", payload)
error_list = json.loads(response.content)["errors"]
expected = b'{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":7,"column":9}],"path":["createSearchmode"]}],"data":{"createSearchmode":null}}'
assert response.status_code == 200
assert len(error_list) > 0
assert isinstance(error_list[0], dict)
assert "message" in error_list[0].keys()
assert error_list[0]["message"] == "You do not have permission to perform this action"
assert response.content == expected
@pytest.mark.django_db
def test_graphql_mutation_createSearchmode_with_token_without_permission(client, django_user_model):
user = __create_viewer(client, django_user_model)
assert not user.has_perm("dataportal.add_observations")
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_viewer)
# try mutation with the token
payload = {"query": createSearchmode_mutation, "variables": createSearchmode_mutation_variables}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
error_list = json.loads(response.content)["errors"]
expected = b'{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":7,"column":9}],"path":["createSearchmode"]}],"data":{"createSearchmode":null}}'
assert response.status_code == 200
assert len(error_list) > 0
assert isinstance(error_list[0], dict)
assert "message" in error_list[0].keys()
assert error_list[0]["message"] == "You do not have permission to perform this action"
assert response.content == expected
@pytest.mark.django_db
def test_graphql_mutation_createSearchmode_with_token_with_permission(client, django_user_model):
user = __create_creator(client, django_user_model)
assert user.has_perm("dataportal.add_observations")
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_creator)
# try mutation with the token
payload = {"query": createSearchmode_mutation, "variables": createSearchmode_mutation_variables}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
assert response.status_code == 200
assert response.content == b'{"data":{"createSearchmode":{"searchmode":{"pulsar":{"jname":"J1234-5678"}}}}}'
createFluxcal_mutation = """
mutation (
$jname: String!, $utc: String!, $beam: Int!, $snr: Float, $length: Float, $nbin: Int, $nchan: Int,
$nant: Int, $nant_eff: Int, $proposal: String, $bw: Float, $freq: Float,
$schedule: String, $phaseup: String
) {
createFluxcal(
jname: $jname, utc: $utc, beam: $beam, snr: $snr, nbin: $nbin, nchan: $nchan, length: $length,
nant: $nant, nantEff: $nant_eff, proposal: $proposal, bw: $bw, frequency: $freq,
schedule: $schedule, phaseup: $phaseup
) {
fluxcal {
pulsar {
jname
}
}
}
}
"""
createFluxcal_mutation_variables = """
{
"jname": "J1234-5678",
"utc": "2020-08-12-01:02:03",
"beam": 3,
"snr": 15.231,
"length": 201.2,
"nchan": 856,
"nbin": 1024,
"nant": 57,
"nant_eff": 54,
"proposal": "SCI-20180516-MB-02",
"bw": 856,
"freq": 1235.0123,
"schedule": "2020-01",
"phaseup": "2020-02"
}
"""
def test_graphql_mutation_createFluxcal_without_token(client, django_user_model):
payload = {"query": createFluxcal_mutation, "variables": createFluxcal_mutation_variables}
response = client.post("/graphql/", payload)
error_list = json.loads(response.content)["errors"]
expected = b'{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":7,"column":9}],"path":["createFluxcal"]}],"data":{"createFluxcal":null}}'
assert response.status_code == 200
assert len(error_list) > 0
assert isinstance(error_list[0], dict)
assert "message" in error_list[0].keys()
assert error_list[0]["message"] == "You do not have permission to perform this action"
assert response.content == expected
@pytest.mark.django_db
def test_graphql_mutation_createFluxcal_with_token_without_permission(client, django_user_model):
user = __create_viewer(client, django_user_model)
assert not user.has_perm("dataportal.add_observations")
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_viewer)
# try mutation with the token
payload = {"query": createFluxcal_mutation, "variables": createFluxcal_mutation_variables}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
error_list = json.loads(response.content)["errors"]
expected = b'{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":7,"column":9}],"path":["createFluxcal"]}],"data":{"createFluxcal":null}}'
assert response.status_code == 200
assert len(error_list) > 0
assert isinstance(error_list[0], dict)
assert "message" in error_list[0].keys()
assert error_list[0]["message"] == "You do not have permission to perform this action"
assert response.content == expected
@pytest.mark.django_db
def test_graphql_mutation_createFluxcal_with_token_with_permission(client, django_user_model):
user = __create_creator(client, django_user_model)
assert user.has_perm("dataportal.add_observations")
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_creator)
# try mutation with the token
payload = {"query": createFluxcal_mutation, "variables": createFluxcal_mutation_variables}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
assert response.status_code == 200
assert response.content == b'{"data":{"createFluxcal":{"fluxcal":{"pulsar":{"jname":"J1234-5678"}}}}}'
createEphemeris_mutation = """
mutation (
$jname: String!, $updated_at: String!, $ephemeris: String!, $comment: String!) {
createEphemeris(
jname: $jname, updatedAt: $updated_at, ephemeris: $ephemeris, comment: $comment) {
ephemeris {
pulsar {
jname
}
}
}
}
"""
createEphemeris_mutation_variables = """
{
"jname": "J1234-5678",
"comment": "",
"updated_at": "2020-08-12-01:02:03",
"ephemeris": "fake"
}
"""
@pytest.mark.django_db
def test_graphql_mutation_createEphemeris_with_token_with_permission(client, django_user_model):
user = __create_creator(client, django_user_model)
assert user.has_perm("dataportal.add_observations")
jwt_token = __obtain_jwt_token(client, jwt_mutation, jwt_vars_creator)
# try mutation with the token
payload = {"query": createEphemeris_mutation, "variables": createEphemeris_mutation_variables}
header = {"HTTP_AUTHORIZATION": f"JWT {jwt_token}"}
response = client.post("/graphql/", payload, **header)
print(response.status_code)
print(response.content)
assert response.status_code == 200
assert response.content == b'{"data":{"createEphemeris":{"ephemeris":{"pulsar":{"jname":"J1234-5678"}}}}}'
| 37.838264 | 193 | 0.65294 | 2,210 | 19,184 | 5.444344 | 0.097738 | 0.021941 | 0.0374 | 0.04887 | 0.772274 | 0.742852 | 0.731715 | 0.713514 | 0.655834 | 0.644531 | 0 | 0.032597 | 0.202043 | 19,184 | 506 | 194 | 37.913043 | 0.753397 | 0.024343 | 0 | 0.566586 | 0 | 0.065375 | 0.469915 | 0.109376 | 0 | 0 | 0 | 0 | 0.152542 | 1 | 0.048426 | false | 0.031477 | 0.016949 | 0 | 0.075061 | 0.004843 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c99073b77f7ed98e3e2ecd4213c68afe004f92b9 | 246 | py | Python | app/views/auth/logout.py | olivierpons/evalr | 7c76474ad41769804965a11550501321d7b1889b | [
"MIT"
] | null | null | null | app/views/auth/logout.py | olivierpons/evalr | 7c76474ad41769804965a11550501321d7b1889b | [
"MIT"
] | null | null | null | app/views/auth/logout.py | olivierpons/evalr | 7c76474ad41769804965a11550501321d7b1889b | [
"MIT"
] | null | null | null | from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import LogoutView
from django.urls import reverse_lazy
class AuthLogoutView(LoginRequiredMixin, LogoutView):
next_page = reverse_lazy('app_new_index')
| 30.75 | 57 | 0.837398 | 31 | 246 | 6.483871 | 0.612903 | 0.149254 | 0.169154 | 0.208955 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097561 | 246 | 7 | 58 | 35.142857 | 0.905405 | 0 | 0 | 0 | 0 | 0 | 0.052846 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
c990ba455a2c491429ca138412237be5df3300b9 | 357 | py | Python | extranet/models/__init__.py | montel-ig/codeshop | 487e35a6ed7a21374263d304c4f347bb67d5a2d6 | [
"Unlicense"
] | 3 | 2020-04-28T04:51:42.000Z | 2021-11-29T12:55:56.000Z | extranet/models/__init__.py | montel-ig/codeshop | 487e35a6ed7a21374263d304c4f347bb67d5a2d6 | [
"Unlicense"
] | null | null | null | extranet/models/__init__.py | montel-ig/codeshop | 487e35a6ed7a21374263d304c4f347bb67d5a2d6 | [
"Unlicense"
] | null | null | null | from _coder import Coder, HourTag, Hours, Month
from _issues import Organization, Repository, Issue
from _needs import Need, Project
from _reports import (CoderReport, CoderWeekly, CoderMonthly, ProjectReport,
ProjectWeekly, ProjectMonthly, TeamReport,
TeamWeeklyMeeting)
from _timer import Timer, AlreadyStarted
| 44.625 | 76 | 0.736695 | 34 | 357 | 7.588235 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218487 | 357 | 7 | 77 | 51 | 0.924731 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.714286 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
c994bfdef6006d85265509755ccf312eb62daa83 | 48 | py | Python | test/integration/MemberFunctionDeclareStart/public two parameters.py | HighSchoolHacking/GLS-Draft | 9e418b6290e7c8e3f2da87668784bdba1cde5a76 | [
"MIT"
] | 30 | 2019-10-29T12:47:50.000Z | 2022-02-12T06:41:39.000Z | test/integration/MemberFunctionDeclareStart/public two parameters.py | HighSchoolHacking/GLS-Draft | 9e418b6290e7c8e3f2da87668784bdba1cde5a76 | [
"MIT"
] | 247 | 2017-09-21T17:11:18.000Z | 2019-10-08T12:59:07.000Z | test/integration/MemberFunctionDeclareStart/public two parameters.py | HighSchoolHacking/GLS-Draft | 9e418b6290e7c8e3f2da87668784bdba1cde5a76 | [
"MIT"
] | 17 | 2017-10-01T16:53:20.000Z | 2018-11-28T07:20:35.000Z | #
class Abc:
def def_ghi(self, jkl, mno):
#
| 9.6 | 32 | 0.583333 | 8 | 48 | 3.375 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 48 | 4 | 33 | 12 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c99c3f15d26a934e79e745d9e58d7ba80ee8ce99 | 35 | py | Python | tests_py3/polytestmix/test1.py | elfsternberg/py-polymorphic-loader | 39e93c354f1ae03b05364cdf29ce339fa92fd0fd | [
"MIT"
] | null | null | null | tests_py3/polytestmix/test1.py | elfsternberg/py-polymorphic-loader | 39e93c354f1ae03b05364cdf29ce339fa92fd0fd | [
"MIT"
] | null | null | null | tests_py3/polytestmix/test1.py | elfsternberg/py-polymorphic-loader | 39e93c354f1ae03b05364cdf29ce339fa92fd0fd | [
"MIT"
] | null | null | null | result = "Success for 1: Test One"
| 17.5 | 34 | 0.685714 | 6 | 35 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035714 | 0.2 | 35 | 1 | 35 | 35 | 0.821429 | 0 | 0 | 0 | 0 | 0 | 0.657143 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c9c83879f2974e7f6e9c2263c091eba2b96c729e | 309 | py | Python | telecom/calls/managers.py | paulohos06/app-work-at-olist | 0371dc83f0d50394587d03c62ed9508852ece7e5 | [
"MIT"
] | null | null | null | telecom/calls/managers.py | paulohos06/app-work-at-olist | 0371dc83f0d50394587d03c62ed9508852ece7e5 | [
"MIT"
] | 8 | 2020-06-06T00:01:33.000Z | 2022-02-10T10:29:15.000Z | telecom/calls/managers.py | paulohos06/app-work-at-olist | 0371dc83f0d50394587d03c62ed9508852ece7e5 | [
"MIT"
] | null | null | null | from django.db import models
class StartManager(models.Manager):
def get_queryset(self):
return super(StartManager, self).get_queryset().filter(type="start")
class EndManager(models.Manager):
def get_queryset(self):
return super(EndManager, self).get_queryset().filter(type="end")
| 25.75 | 76 | 0.724919 | 39 | 309 | 5.641026 | 0.487179 | 0.2 | 0.145455 | 0.172727 | 0.609091 | 0.381818 | 0.381818 | 0.381818 | 0 | 0 | 0 | 0 | 0.148867 | 309 | 11 | 77 | 28.090909 | 0.836502 | 0 | 0 | 0.285714 | 0 | 0 | 0.02589 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.285714 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
c9dc7beb513d430d56fd0a18caa678754dd9b0b7 | 161 | py | Python | src/alternation_scan/combine.py | nt409/HRHR | 62ab397650f4e2a1b1d0e6ef289b4e73790c777e | [
"MIT"
] | null | null | null | src/alternation_scan/combine.py | nt409/HRHR | 62ab397650f4e2a1b1d0e6ef289b4e73790c777e | [
"MIT"
] | null | null | null | src/alternation_scan/combine.py | nt409/HRHR | 62ab397650f4e2a1b1d0e6ef289b4e73790c777e | [
"MIT"
] | null | null | null | from alternation_scan.utils import combine_alt_scan_csvs
if __name__ == "__main__":
n_doses = 51
n_its = 100
combine_alt_scan_csvs(n_doses, n_its)
| 20.125 | 56 | 0.745342 | 26 | 161 | 3.884615 | 0.615385 | 0.19802 | 0.277228 | 0.356436 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038168 | 0.186335 | 161 | 7 | 57 | 23 | 0.732824 | 0 | 0 | 0 | 0 | 0 | 0.049689 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
a001abbbb4b53316bfccd93251f225e6a940eb65 | 67 | py | Python | bin/Robots/__init__.py | chuanbenli/mathrobot | 4564de93c9154a05383211aca7f133ca873650a4 | [
"MIT"
] | 1 | 2021-09-24T22:47:41.000Z | 2021-09-24T22:47:41.000Z | bin/Robots/__init__.py | chuanbenli/mathrobot | 4564de93c9154a05383211aca7f133ca873650a4 | [
"MIT"
] | null | null | null | bin/Robots/__init__.py | chuanbenli/mathrobot | 4564de93c9154a05383211aca7f133ca873650a4 | [
"MIT"
] | 1 | 2020-06-23T16:26:42.000Z | 2020-06-23T16:26:42.000Z | class wupin:
def __init__ (self, name, operator, ):
self.name = | 22.333333 | 39 | 0.671642 | 9 | 67 | 4.555556 | 0.777778 | 0.390244 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19403 | 67 | 3 | 40 | 22.333333 | 0.759259 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
a00c80731798096d979676fc394ebcc0b25b34c4 | 60 | py | Python | bigserene_sdk/reports/__init__.py | BigSerene/bigserene-sdk | aa98178a2845f21820581fe5cae277b6c28c0a3e | [
"MIT"
] | null | null | null | bigserene_sdk/reports/__init__.py | BigSerene/bigserene-sdk | aa98178a2845f21820581fe5cae277b6c28c0a3e | [
"MIT"
] | 2 | 2020-05-20T23:09:38.000Z | 2020-05-25T16:57:11.000Z | bigserene_sdk/reports/__init__.py | BigSerene/bigserene-sdk | aa98178a2845f21820581fe5cae277b6c28c0a3e | [
"MIT"
] | null | null | null | from .report import Report
from .client import ReportClient
| 20 | 32 | 0.833333 | 8 | 60 | 6.25 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 60 | 2 | 33 | 30 | 0.961538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
4e7ecde0be6eec4a295d7feb454e8186cd81ba04 | 190 | py | Python | things/serializers.py | ravewillow6383/permissions | 5c0f7dcce58ebe9663b11869c452fb31e5cb3505 | [
"MIT"
] | null | null | null | things/serializers.py | ravewillow6383/permissions | 5c0f7dcce58ebe9663b11869c452fb31e5cb3505 | [
"MIT"
] | 7 | 2020-06-05T22:41:55.000Z | 2022-02-10T12:40:00.000Z | things/serializers.py | ravewillow6383/permissions | 5c0f7dcce58ebe9663b11869c452fb31e5cb3505 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from . import models
class ThingSerializer(serializers.ModelSerializer):
class Meta:
fields = ('id', 'name')
model = models.Thing | 23.75 | 51 | 0.705263 | 20 | 190 | 6.65 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.210526 | 190 | 8 | 52 | 23.75 | 0.886667 | 0 | 0 | 0 | 0 | 0 | 0.031414 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
4e977c998677c3bb03ae11dcb66f377e8cb74cbf | 133 | py | Python | paradigm_panes/__init__.py | UAlbertaALTLab/paradigm-panes | 3503d8d4c84600525ece4a04e6d6e014a08cb050 | [
"Apache-2.0"
] | null | null | null | paradigm_panes/__init__.py | UAlbertaALTLab/paradigm-panes | 3503d8d4c84600525ece4a04e6d6e014a08cb050 | [
"Apache-2.0"
] | null | null | null | paradigm_panes/__init__.py | UAlbertaALTLab/paradigm-panes | 3503d8d4c84600525ece4a04e6d6e014a08cb050 | [
"Apache-2.0"
] | null | null | null | __version__ = '0.3.1'
from pathlib import Path
from . import settings
from .panes import *
from .pane_generator import PaneGenerator | 22.166667 | 41 | 0.789474 | 19 | 133 | 5.263158 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026316 | 0.142857 | 133 | 6 | 41 | 22.166667 | 0.850877 | 0 | 0 | 0 | 0 | 0 | 0.037313 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
4ebb5c3e5398567ec38461f23db04e8deb374b86 | 183 | py | Python | xee/__init__.py | quentin7b/xee-python-sdk | 3dc3de9291f971400858adb0daa62036c4a0833b | [
"Apache-2.0"
] | 4 | 2016-09-02T14:39:02.000Z | 2018-11-20T19:44:58.000Z | xee/__init__.py | quentin7b/xee-python-sdk | 3dc3de9291f971400858adb0daa62036c4a0833b | [
"Apache-2.0"
] | 24 | 2016-09-02T14:39:12.000Z | 2020-05-11T14:55:25.000Z | xee/__init__.py | quentin7b/xee-python-sdk | 3dc3de9291f971400858adb0daa62036c4a0833b | [
"Apache-2.0"
] | 2 | 2016-09-03T16:56:23.000Z | 2020-04-27T20:55:52.000Z | #!/usr/bin/env python
# coding: utf8
"""
This package contains Xee python SDK.
This SDK maps the request you can send to Xee APIs (see dev.xee.com).
"""
from .sdk import Xee
| 20.333333 | 73 | 0.677596 | 31 | 183 | 4 | 0.774194 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006944 | 0.213115 | 183 | 8 | 74 | 22.875 | 0.854167 | 0.770492 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
14dddffa5e28a5df5a4405cf9f10ad5c405fef44 | 1,082 | py | Python | tests/UnitTests/Morphology/invalid_affix_pair_specification_test.py | ZenaNugraha/PySastrawi | 6382bc19d9dbb2873fa81e7a5c49439a8db5cb20 | [
"MIT"
] | 282 | 2016-02-20T22:14:25.000Z | 2022-03-24T17:17:17.000Z | tests/UnitTests/Morphology/invalid_affix_pair_specification_test.py | ZenaNugraha/PySastrawi | 6382bc19d9dbb2873fa81e7a5c49439a8db5cb20 | [
"MIT"
] | 20 | 2016-10-23T07:33:41.000Z | 2022-02-07T07:23:58.000Z | tests/UnitTests/Morphology/invalid_affix_pair_specification_test.py | ZenaNugraha/PySastrawi | 6382bc19d9dbb2873fa81e7a5c49439a8db5cb20 | [
"MIT"
] | 129 | 2016-02-27T14:40:23.000Z | 2022-03-07T15:45:18.000Z | import unittest
from Sastrawi.Morphology.InvalidAffixPairSpecification import InvalidAffixPairSpecification
class Test_InvalidAffixPairSpecificationTest(unittest.TestCase):
def setUp(self):
self.specification = InvalidAffixPairSpecification()
return super(Test_InvalidAffixPairSpecificationTest, self).setUp()
def test_containsInvalidAffixPair(self):
self.assertFalse(self.specification.is_satisfied_by('memberikan'))
self.assertFalse(self.specification.is_satisfied_by('ketahui'))
self.assertTrue(self.specification.is_satisfied_by('berjatuhi'))
self.assertTrue(self.specification.is_satisfied_by('dipukulan'))
self.assertTrue(self.specification.is_satisfied_by('ketiduri'))
self.assertTrue(self.specification.is_satisfied_by('ketidurkan'))
self.assertTrue(self.specification.is_satisfied_by('menduaan'))
self.assertTrue(self.specification.is_satisfied_by('terduaan'))
self.assertTrue(self.specification.is_satisfied_by('perkataan'))
if __name__ == '__main__':
unittest.main()
| 47.043478 | 91 | 0.771719 | 106 | 1,082 | 7.603774 | 0.320755 | 0.210918 | 0.212159 | 0.312655 | 0.493797 | 0.493797 | 0.493797 | 0 | 0 | 0 | 0 | 0 | 0.125693 | 1,082 | 22 | 92 | 49.181818 | 0.852008 | 0 | 0 | 0 | 0 | 0 | 0.079482 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0.111111 | false | 0 | 0.111111 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
14de0f80844a5ec9eb8bfffaa86012f45f623c87 | 145 | py | Python | tests/dep_parse_and_opinion.py | yelircaasi/wikpedia-ideology-mapping | 87ba00742fa17f3dc8fdd17f63977938af427552 | [
"MIT"
] | null | null | null | tests/dep_parse_and_opinion.py | yelircaasi/wikpedia-ideology-mapping | 87ba00742fa17f3dc8fdd17f63977938af427552 | [
"MIT"
] | null | null | null | tests/dep_parse_and_opinion.py | yelircaasi/wikpedia-ideology-mapping | 87ba00742fa17f3dc8fdd17f63977938af427552 | [
"MIT"
] | null | null | null | """
Author: Isaac Riley
Date: September 2020
Tests the dependency parsing and opinion mining functionalities
of the WikiNet class.
"""
| 16.111111 | 64 | 0.731034 | 18 | 145 | 5.888889 | 0.944444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034783 | 0.206897 | 145 | 8 | 65 | 18.125 | 0.886957 | 0.903448 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
14e2c0f0bf4de3ceaebda95f74c08ad56b927b52 | 248 | py | Python | neiba/admin.py | vique254/Neighbourhood | 2be9cbd756a9113986d456f34ad2e52da72c11ab | [
"MIT"
] | null | null | null | neiba/admin.py | vique254/Neighbourhood | 2be9cbd756a9113986d456f34ad2e52da72c11ab | [
"MIT"
] | 4 | 2020-06-06T00:33:08.000Z | 2021-09-08T01:36:02.000Z | neiba/admin.py | vique254/Neighbourhood | 2be9cbd756a9113986d456f34ad2e52da72c11ab | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
from django.contrib import admin
from .models import Neighbourhood,Profile,Business
# Register your models here.
admin.site.register(Neighbourhood)
admin.site.register(Profile)
admin.site.register(Business) | 27.555556 | 50 | 0.842742 | 32 | 248 | 6.375 | 0.5 | 0.132353 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084677 | 248 | 9 | 51 | 27.555556 | 0.898678 | 0.104839 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
14ff9455de3a62767428c844b104a10f153b8086 | 654 | py | Python | src/sqlfluff/core/parser/segments/__init__.py | edgarrmondragon/sqlfluff | b410b4803c5fa4d1dfdb1df0be3e0c479dab8ca8 | [
"MIT"
] | null | null | null | src/sqlfluff/core/parser/segments/__init__.py | edgarrmondragon/sqlfluff | b410b4803c5fa4d1dfdb1df0be3e0c479dab8ca8 | [
"MIT"
] | null | null | null | src/sqlfluff/core/parser/segments/__init__.py | edgarrmondragon/sqlfluff | b410b4803c5fa4d1dfdb1df0be3e0c479dab8ca8 | [
"MIT"
] | null | null | null | """Definitions of the segment classes."""
# flake8: noqa: F401
from sqlfluff.core.parser.segments.base import BaseSegment, UnparsableSegment
from sqlfluff.core.parser.segments.generator import SegmentGenerator
from sqlfluff.core.parser.segments.raw import (
RawSegment,
CodeSegment,
UnlexableSegment,
CommentSegment,
WhitespaceSegment,
NewlineSegment,
)
from sqlfluff.core.parser.segments.ephemeral import EphemeralSegment
from sqlfluff.core.parser.segments.meta import Indent, Dedent, TemplateSegment
from sqlfluff.core.parser.segments.keyword import (
KeywordSegment,
SymbolSegment,
ReSegment,
NamedSegment,
)
| 28.434783 | 78 | 0.784404 | 67 | 654 | 7.656716 | 0.552239 | 0.140351 | 0.187135 | 0.25731 | 0.350877 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007092 | 0.137615 | 654 | 22 | 79 | 29.727273 | 0.902482 | 0.084098 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
091a620afbaf1d9ae41c6262ca5916e7fbe2b8f7 | 58 | py | Python | brainscore/submission/__init__.py | dmayo/brain-score | 3ab4258152c9e3f8c7d29afb10158b184dbcebbe | [
"MIT"
] | 52 | 2019-12-13T06:43:44.000Z | 2022-02-21T07:47:39.000Z | brainscore/submission/__init__.py | dmayo/brain-score | 3ab4258152c9e3f8c7d29afb10158b184dbcebbe | [
"MIT"
] | 104 | 2019-12-06T18:08:54.000Z | 2022-03-31T23:57:51.000Z | brainscore/submission/__init__.py | dmayo/brain-score | 3ab4258152c9e3f8c7d29afb10158b184dbcebbe | [
"MIT"
] | 32 | 2019-12-05T14:31:14.000Z | 2022-03-10T02:04:45.000Z | """
Score model submissions on Brain-Score benchmarks.
""" | 19.333333 | 50 | 0.741379 | 7 | 58 | 6.142857 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12069 | 58 | 3 | 51 | 19.333333 | 0.843137 | 0.862069 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1197564425f2718d823d9ce2178d2ded66e61120 | 156 | py | Python | ChatBot/API_Package/max/constants.py | LeeChunHao2000/Hi-Blockchain | 1be8db74561c690cf195e933dd5ad8c4d0126fba | [
"MIT"
] | 1 | 2020-10-25T03:14:05.000Z | 2020-10-25T03:14:05.000Z | ChatBot/API_Package/max/constants.py | LeeChunHao2000/Hi-Blockchain | 1be8db74561c690cf195e933dd5ad8c4d0126fba | [
"MIT"
] | null | null | null | ChatBot/API_Package/max/constants.py | LeeChunHao2000/Hi-Blockchain | 1be8db74561c690cf195e933dd5ad8c4d0126fba | [
"MIT"
] | null | null | null | PUBLIC_API_URL = 'https://max-api.maicoin.com/api'
PRIVATE_API_URL = 'https://max-api.maicoin.com/api'
PUBLIC_API_VERSION = 'v2'
PRIVATE_API_VERSION = 'v2' | 31.2 | 51 | 0.75641 | 26 | 156 | 4.230769 | 0.384615 | 0.163636 | 0.2 | 0.254545 | 0.545455 | 0.545455 | 0.545455 | 0.545455 | 0 | 0 | 0 | 0.013889 | 0.076923 | 156 | 5 | 52 | 31.2 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.420382 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
11acfdf51c11b5178b4699a0a1affda8eec637c2 | 5,075 | py | Python | seqgra/learner/proteinhelper.py | gifford-lab/seqgra | 3c7547878ecda4c00572746b8a07e0d614c9dbef | [
"MIT"
] | null | null | null | seqgra/learner/proteinhelper.py | gifford-lab/seqgra | 3c7547878ecda4c00572746b8a07e0d614c9dbef | [
"MIT"
] | null | null | null | seqgra/learner/proteinhelper.py | gifford-lab/seqgra | 3c7547878ecda4c00572746b8a07e0d614c9dbef | [
"MIT"
] | 2 | 2021-06-14T20:27:40.000Z | 2021-06-14T20:29:29.000Z | """MIT - CSAIL - Gifford Lab - seqgra
Helper class for functions operating on amino acid sequences
@author: Konstantin Krismer
"""
import re
import logging
from typing import List
import numpy as np
class ProteinHelper:
@staticmethod
def convert_dense_to_one_hot_encoding(seq: str):
aa_to_num = dict({"A": 0, "R": 1, "N": 2, "D": 3, "C": 4,
"E": 5, "Q": 6, "G": 7, "H": 8, "I": 9,
"L": 10, "K": 11, "M": 12, "F": 13, "P": 14,
"S": 15, "T": 16, "W": 17, "Y": 18, "V": 19})
seq = list(seq)
seq = np.array([aa_to_num[aa] for aa in seq], dtype=int)
one_hot_encoded_seq = np.zeros((len(seq), len(aa_to_num)))
one_hot_encoded_seq[np.arange(len(seq)), seq] = 1
return one_hot_encoded_seq
@staticmethod
def convert_one_hot_to_dense_encoding(seq: str):
densely_encoded_seq = ["X"] * seq.shape[0]
for i in range(seq.shape[0]):
if all(seq[i, :] == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "A"
elif all(seq[i, :] == [0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "R"
elif all(seq[i, :] == [0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "N"
elif all(seq[i, :] == [0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "D"
elif all(seq[i, :] == [0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "C"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "E"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "Q"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "G"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "H"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "I"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "L"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "K"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "M"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "F"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0]):
densely_encoded_seq[i] = "P"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0]):
densely_encoded_seq[i] = "S"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0]):
densely_encoded_seq[i] = "T"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0]):
densely_encoded_seq[i] = "W"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0]):
densely_encoded_seq[i] = "Y"
elif all(seq[i, :] == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1]):
densely_encoded_seq[i] = "V"
return "".join(densely_encoded_seq)
@staticmethod
def check_sequence(seqs: List[str]) -> bool:
logger = logging.getLogger(__name__)
is_valid: bool = True
for seq in seqs:
if not re.match("^[ARNDCEQGHILKMFPSTWYV]*$", seq):
logger.warning("example with invalid amino acid sequence "
"(only uppercase single letter codes of 20 "
"canonical amino acids allowed): %s", seq)
is_valid = False
return is_valid
| 48.333333 | 75 | 0.372611 | 790 | 5,075 | 2.296203 | 0.158228 | 0.377067 | 0.506064 | 0.599779 | 0.544101 | 0.508269 | 0.492282 | 0.476295 | 0.460309 | 0.444322 | 0 | 0.155747 | 0.449655 | 5,075 | 104 | 76 | 48.798077 | 0.493734 | 0.024631 | 0 | 0.25 | 0 | 0 | 0.037022 | 0.005058 | 0 | 0 | 0 | 0 | 0 | 1 | 0.032609 | false | 0 | 0.043478 | 0 | 0.119565 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
11c1190712959e0be5910ec6270bccc7a649feb7 | 377 | py | Python | Python/python-practice/chapter3-list/motorcycles.py | jiaoqiyuan/Tests | a3595b0e4b430d910f90e428d6b6b4465f67a059 | [
"Apache-2.0"
] | null | null | null | Python/python-practice/chapter3-list/motorcycles.py | jiaoqiyuan/Tests | a3595b0e4b430d910f90e428d6b6b4465f67a059 | [
"Apache-2.0"
] | null | null | null | Python/python-practice/chapter3-list/motorcycles.py | jiaoqiyuan/Tests | a3595b0e4b430d910f90e428d6b6b4465f67a059 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
motorcycles.append('ducati')
print(motorcycles)
motorcycles.insert(0, 'ducati')
print(motorcycles)
del motorcycles[0]
print(motorcycles)
del motorcycles[1]
print(motorcycles)
poped_motorcycle = motorcycles.pop()
print(poped_motorcycle)
first_owned = motorcycles.pop(0)
print(first_owned)
| 16.391304 | 43 | 0.771883 | 45 | 377 | 6.377778 | 0.422222 | 0.278746 | 0.188153 | 0.209059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014535 | 0.087533 | 377 | 22 | 44 | 17.136364 | 0.819767 | 0.045093 | 0 | 0.357143 | 0 | 0 | 0.08078 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 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 | 1 | 0 | 4 |
11d4c7394cceba5df7b67fc67f0418b59bb0476d | 8,353 | py | Python | tests/test_types.py | mattrobenolt/ec2 | fc1f8bce6cf76899165d9ac006371181d52439f8 | [
"BSD-2-Clause"
] | 39 | 2015-01-23T00:21:28.000Z | 2020-12-27T19:33:45.000Z | tests/test_types.py | mattrobenolt/ec2 | fc1f8bce6cf76899165d9ac006371181d52439f8 | [
"BSD-2-Clause"
] | null | null | null | tests/test_types.py | mattrobenolt/ec2 | fc1f8bce6cf76899165d9ac006371181d52439f8 | [
"BSD-2-Clause"
] | 7 | 2015-06-23T03:23:11.000Z | 2020-05-16T13:22:37.000Z | from .base import BaseTestCase
import ec2
class InstancesTestCase(BaseTestCase):
def test_all(self):
"instances.all() should iterate over all reservations and collect all instances, then cache the results"
with self._patch_connection() as mock:
instances = ec2.instances.all()
self.assertEquals(4, len(instances))
# all() should cache the connection and list of instances
# so when calling a second time, _connect() shouldn't
# be called
ec2.instances.all()
mock.assert_called_once() # Should only be called once from the initial _connect
def test_filters_integration(self):
with self._patch_connection():
instances = ec2.instances.filter(state='crap')
self.assertEquals(0, len(instances))
instances = ec2.instances.filter(state='running')
self.assertEquals(2, len(instances))
self.assertEquals('running', instances[0].state)
self.assertEquals('running', instances[1].state)
instances = ec2.instances.filter(state='stopped')
self.assertEquals(2, len(instances))
self.assertEquals('stopped', instances[0].state)
self.assertEquals('stopped', instances[1].state)
instances = ec2.instances.filter(id__exact='i-abc0')
self.assertEquals(1, len(instances))
instances = ec2.instances.filter(id__iexact='I-ABC0')
self.assertEquals(1, len(instances))
instances = ec2.instances.filter(id__like=r'^i\-abc\d$')
self.assertEquals(4, len(instances))
instances = ec2.instances.filter(id__ilike=r'^I\-ABC\d$')
self.assertEquals(4, len(instances))
instances = ec2.instances.filter(id__contains='1')
self.assertEquals(1, len(instances))
instances = ec2.instances.filter(id__icontains='ABC')
self.assertEquals(4, len(instances))
instances = ec2.instances.filter(id__startswith='i-')
self.assertEquals(4, len(instances))
instances = ec2.instances.filter(id__istartswith='I-')
self.assertEquals(4, len(instances))
instances = ec2.instances.filter(id__endswith='c0')
self.assertEquals(1, len(instances))
instances = ec2.instances.filter(id__iendswith='C0')
self.assertEquals(1, len(instances))
instances = ec2.instances.filter(id__startswith='i-', name__endswith='-0')
self.assertEquals(1, len(instances))
instances = ec2.instances.filter(id__isnull=False)
self.assertEquals(4, len(instances))
instances = ec2.instances.filter(id__isnull=True)
self.assertEquals(0, len(instances))
def test_get_raises(self):
with self._patch_connection():
self.assertRaises(
ec2.instances.MultipleObjectsReturned,
ec2.instances.get,
id__startswith='i'
)
self.assertRaises(
ec2.instances.DoesNotExist,
ec2.instances.get,
name='crap'
)
def test_get(self):
with self._patch_connection():
self.assertEquals(ec2.instances.get(id='i-abc0').id, 'i-abc0')
class SecurityGroupsTestCase(BaseTestCase):
def test_all(self):
with self._patch_connection() as mock:
groups = ec2.security_groups.all()
self.assertEquals(2, len(groups))
# all() should cache the connection and list of instances
# so when calling a second time, _connect() shouldn't
# be called
ec2.security_groups.all()
mock.assert_called_once()
def test_filters_integration(self):
with self._patch_connection():
groups = ec2.security_groups.filter(name='crap')
self.assertEquals(0, len(groups))
groups = ec2.security_groups.filter(id__exact='sg-abc0')
self.assertEquals(1, len(groups))
groups = ec2.security_groups.filter(id__iexact='SG-ABC0')
self.assertEquals(1, len(groups))
groups = ec2.security_groups.filter(id__like=r'^sg\-abc\d$')
self.assertEquals(2, len(groups))
groups = ec2.security_groups.filter(id__ilike=r'^SG\-ABC\d$')
self.assertEquals(2, len(groups))
groups = ec2.security_groups.filter(id__contains='1')
self.assertEquals(1, len(groups))
groups = ec2.security_groups.filter(id__icontains='ABC')
self.assertEquals(2, len(groups))
groups = ec2.security_groups.filter(id__startswith='sg-')
self.assertEquals(2, len(groups))
groups = ec2.security_groups.filter(id__istartswith='SG-')
self.assertEquals(2, len(groups))
groups = ec2.security_groups.filter(id__endswith='c0')
self.assertEquals(1, len(groups))
groups = ec2.security_groups.filter(id__iendswith='C0')
self.assertEquals(1, len(groups))
groups = ec2.security_groups.filter(id__startswith='sg-', name__endswith='-0')
self.assertEquals(1, len(groups))
groups = ec2.security_groups.filter(id__isnull=False)
self.assertEquals(2, len(groups))
groups = ec2.security_groups.filter(id__isnull=True)
self.assertEquals(0, len(groups))
def test_get_raises(self):
with self._patch_connection():
self.assertRaises(
ec2.security_groups.MultipleObjectsReturned,
ec2.security_groups.get,
id__startswith='sg'
)
self.assertRaises(
ec2.security_groups.DoesNotExist,
ec2.security_groups.get,
name='crap'
)
def test_get(self):
with self._patch_connection():
self.assertEquals(ec2.security_groups.get(id='sg-abc0').id, 'sg-abc0')
class VPCTestCase(BaseTestCase):
def test_all(self):
with self._patch_vpc_connection() as mock:
vpcs = ec2.vpcs.all()
self.assertEquals(2, len(vpcs))
ec2.vpcs.all()
mock.assert_called_once()
def test_filters_integration(self):
with self._patch_vpc_connection():
groups = ec2.vpcs.filter(id__exact='vpc-abc0')
self.assertEquals(1, len(groups))
groups = ec2.vpcs.filter(id__iexact='VPC-ABC0')
self.assertEquals(1, len(groups))
groups = ec2.vpcs.filter(id__like=r'^vpc\-abc\d$')
self.assertEquals(2, len(groups))
groups = ec2.vpcs.filter(id__ilike=r'^VPC\-ABC\d$')
self.assertEquals(2, len(groups))
groups = ec2.vpcs.filter(id__contains='1')
self.assertEquals(1, len(groups))
groups = ec2.vpcs.filter(id__icontains='ABC')
self.assertEquals(2, len(groups))
groups = ec2.vpcs.filter(id__startswith='vpc-')
self.assertEquals(2, len(groups))
groups = ec2.vpcs.filter(id__istartswith='vpc-')
self.assertEquals(2, len(groups))
groups = ec2.vpcs.filter(id__endswith='c0')
self.assertEquals(1, len(groups))
groups = ec2.vpcs.filter(id__iendswith='C0')
self.assertEquals(1, len(groups))
groups = ec2.vpcs.filter(id__startswith='vpc-', dhcp_options_id__endswith='abc0')
self.assertEquals(1, len(groups))
groups = ec2.vpcs.filter(id__isnull=False)
self.assertEquals(2, len(groups))
groups = ec2.vpcs.filter(id__isnull=True)
self.assertEquals(0, len(groups))
def test_get_raises(self):
with self._patch_vpc_connection():
self.assertRaises(
ec2.vpcs.MultipleObjectsReturned,
ec2.vpcs.get,
id__startswith='vpc'
)
self.assertRaises(
ec2.vpcs.DoesNotExist,
ec2.vpcs.get,
name='crap'
)
def test_get(self):
with self._patch_vpc_connection():
self.assertEquals(ec2.vpcs.get(id='vpc-abc0').id, 'vpc-abc0')
| 36.160173 | 112 | 0.596432 | 927 | 8,353 | 5.193096 | 0.099245 | 0.176153 | 0.077898 | 0.093477 | 0.823224 | 0.73494 | 0.708558 | 0.65995 | 0.622559 | 0.60054 | 0 | 0.023322 | 0.286484 | 8,353 | 230 | 113 | 36.317391 | 0.784396 | 0.046929 | 0 | 0.521212 | 0 | 0 | 0.04704 | 0 | 0 | 0 | 0 | 0 | 0.375758 | 1 | 0.072727 | false | 0 | 0.012121 | 0 | 0.10303 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
11d5a1010c0d171b417630772a35dc0785d790f0 | 203 | py | Python | NaN.py | meinertsen/python | 637fc0cb89daf8bd34a015f42b3166954fb2ba59 | [
"Apache-2.0"
] | null | null | null | NaN.py | meinertsen/python | 637fc0cb89daf8bd34a015f42b3166954fb2ba59 | [
"Apache-2.0"
] | null | null | null | NaN.py | meinertsen/python | 637fc0cb89daf8bd34a015f42b3166954fb2ba59 | [
"Apache-2.0"
] | null | null | null |
# Names of columns that contains NaN
[k for k,l in [(i,j) for i,j in zip(df,df.isnull().sum())] if l]
# Columns that contains NaN
df[[k for k,l in [(i,j) for i,j in zip(df,df.isnull().sum())] if l]]
| 25.375 | 68 | 0.615764 | 47 | 203 | 2.659574 | 0.361702 | 0.064 | 0.304 | 0.352 | 0.576 | 0.576 | 0.576 | 0.576 | 0.576 | 0.576 | 0 | 0 | 0.187192 | 203 | 7 | 69 | 29 | 0.757576 | 0.295567 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
11f519d76007ed9dec956f7e3cee98912a8839a5 | 122 | py | Python | onadata/apps/restservice/services/__init__.py | ubpd/kobocat | 45906e07e8f05c30e3e26bab5570a8ab1ee264db | [
"BSD-2-Clause"
] | null | null | null | onadata/apps/restservice/services/__init__.py | ubpd/kobocat | 45906e07e8f05c30e3e26bab5570a8ab1ee264db | [
"BSD-2-Clause"
] | null | null | null | onadata/apps/restservice/services/__init__.py | ubpd/kobocat | 45906e07e8f05c30e3e26bab5570a8ab1ee264db | [
"BSD-2-Clause"
] | null | null | null | # coding: utf-8
from __future__ import unicode_literals, print_function, division, absolute_import
__all__ = ('kpi_hook')
| 30.5 | 82 | 0.803279 | 16 | 122 | 5.375 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009174 | 0.106557 | 122 | 3 | 83 | 40.666667 | 0.779817 | 0.106557 | 0 | 0 | 0 | 0 | 0.074766 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 1 | 0 | 4 |
11f63cdd3e5e638b3e8118f84410dec63b5abaed | 8,271 | py | Python | Tests/qualreas_doctests.py | alreich/qualreas | e1f94fe79a9043cfc6ae83e04ff03aaa608f373f | [
"MIT"
] | 11 | 2021-03-07T12:20:59.000Z | 2021-12-02T06:15:17.000Z | Tests/qualreas_doctests.py | alreich/qualreas | e1f94fe79a9043cfc6ae83e04ff03aaa608f373f | [
"MIT"
] | null | null | null | Tests/qualreas_doctests.py | alreich/qualreas | e1f94fe79a9043cfc6ae83e04ff03aaa608f373f | [
"MIT"
] | 3 | 2021-11-22T08:50:50.000Z | 2022-01-18T09:18:38.000Z | """
DOC TESTS:
To run the tests type the following command in a terminal window: "python -m doctest -v qualreas_doctests.py"
>>> import os
The environment variable, PYPROJ, should be set to the directory where the 'qualreas' project
resides:
>>> path = os.path.join( os.getenv('PYPROJ'), 'qualreas' )
-----------------
Interval Algebra:
-----------------
Algebras are created by reading their definition from a JSON file:
>>> alg0 = Algebra(os.path.join(path, "LinearIntervalAlgebra.json"))
Use the 'relations' property to obtain the full set of relations in the algebra:
>>> rels0 = alg0.relations
Only relation sets can be 'multiplied', so create a couple of one-element sets, {Before} & {Met-By}:
>>> b0 = RelationSet([rels0["B"]], alg0)
>>> mi0 = RelationSet([rels0["MI"]], alg0)
Now 'multiply' them together:
Before * Met-By:
>>> sorted(b0 * mi0, key=lambda rel: rel.short_name)
[B, D, M, O, S]
The following computations illustrate an identity involving relation set multiplication, that is,
if X & Y are two relation sets and 'inv()' inverts a relation set, then: X * Y = inv(inv(Y) * inv(X))
inv( inv(Met-By) * inv(Before) ):
>>> sorted( (mi0.converse * b0.converse).converse , key=lambda rel: rel.short_name)
[B, D, M, O, S]
Met-By * Before:
>>> sorted(mi0 * b0, key=lambda rel: rel.short_name)
[B, DI, FI, M, O]
inv( inv(Before) * inv(Met-By) ):
>>> sorted( (b0.converse * mi0.converse).converse , key=lambda rel: rel.short_name)
[B, DI, FI, M, O]
Relation sets can also be 'added' together. 'Addition' here is actually set intersection:
(Before * Met-By) + (Met-By * Before):
>>> sorted( (b0 * mi0) + (mi0 * b0), key=lambda rel: rel.short_name)
[B, M, O]
>>> alg0.all_equality_relations
[E]
The examples shown, above, are repeated for three more relation algebras in the next three sections. In each example,
note how different relation sets (from those obtained, above) result from multiplications of what looks like the same
relation sets (i.e., point, left-branching, and right-branching relations get pulled in to play):
-------------------------
Interval & Point Algebra:
-------------------------
>>> alg1 = Algebra(os.path.join(path, "ExtendedLinearIntervalAlgebra.json"))
>>> rels1 = alg1.relations
>>> b1 = RelationSet([rels1["B"]], alg1)
>>> mi1 = RelationSet([rels1["MI"]], alg1)
Before * Met-By:
>>> sorted(b1 * mi1, key=lambda rel: rel.short_name)
[B, D, M, O, PS, S]
inv( inv(Met-By) * inv(Before) ):
>>> sorted( (mi1.converse * b1.converse).converse , key=lambda rel: rel.short_name)
[B, D, M, O, PS, S]
Met-By * Before:
>>> sorted(mi1 * b1, key=lambda rel: rel.short_name)
[B, DI, FI, M, O, PFI]
inv( inv(Before) * inv(Met-By) ):
>>> sorted( (b1.converse * mi1.converse).converse , key=lambda rel: rel.short_name)
[B, DI, FI, M, O, PFI]
(Before * Met-By) + (Met-By * Before):
>>> sorted( (b1 * mi1) + (mi1 * b1), key=lambda rel: rel.short_name)
[B, M, O]
>>> sorted(alg1.all_equality_relations, key=lambda rel: rel.short_name)
[E, PE]
----------------------------------------
Left-Branching Interval & Point Algebra:
----------------------------------------
>>> alg2 = Algebra(os.path.join(path, "LeftBranchingIntervalAlgebra.json"))
>>> rels2 = alg2.relations
>>> b2 = RelationSet([rels2["B"]], alg2)
>>> mi2 = RelationSet([rels2["MI"]], alg2)
Before * Met-By:
>>> sorted(b2 * mi2, key=lambda rel: rel.short_name)
[B, D, LB, LO, M, O, PS, S]
inv( inv(Met-By) * inv(Before) ):
>>> sorted( (mi2.converse * b2.converse).converse , key=lambda rel: rel.short_name)
[B, D, LB, LO, M, O, PS, S]
Met-By * Before:
>>> sorted(mi2 * b2, key=lambda rel: rel.short_name)
[B, DI, FI, M, O, PFI]
inv( inv(Before) * inv(Met-By) ):
>>> sorted( (b2.converse * mi2.converse).converse , key=lambda rel: rel.short_name)
[B, DI, FI, M, O, PFI]
(Before * Met-By) + (Met-By * Before):
>>> sorted( (b2 * mi2) + (mi2 * b2), key=lambda rel: rel.short_name)
[B, M, O]
>>> sorted(alg2.all_equality_relations, key=lambda rel: rel.short_name)
[E, PE]
-----------------------------------------
Right-Branching Interval & Point Algebra:
-----------------------------------------
>>> alg3 = Algebra(os.path.join(path, "RightBranchingIntervalAlgebra.json"))
>>> rels3 = alg3.relations
>>> b3 = RelationSet([rels3["B"]], alg3)
>>> mi3 = RelationSet([rels3["MI"]], alg3)
Before * Met-By:
>>> sorted(b3 * mi3, key=lambda rel: rel.short_name)
[B, D, M, O, PS, S]
inv( inv(Met-By) * inv(Before) ):
>>> sorted( (mi3.converse * b3.converse).converse , key=lambda rel: rel.short_name)
[B, D, M, O, PS, S]
Met-By * Before:
>>> sorted(mi3 * b3, key=lambda rel: rel.short_name)
[B, DI, FI, M, O, PFI, RB, RO]
inv( inv(Before) * inv(Met-By) ):
>>> sorted( (b3.converse * mi3.converse).converse , key=lambda rel: rel.short_name)
[B, DI, FI, M, O, PFI, RB, RO]
(Before * Met-By) + (Met-By * Before):
>>> sorted( (b3 * mi3) + (mi3 * b3), key=lambda rel: rel.short_name)
[B, M, O]
>>> sorted(alg3.all_equality_relations, key=lambda rel: rel.short_name)
[E, PE]
-----------------------------
Region Connection Calculus 8:
-----------------------------
>>> alg4 = Algebra(os.path.join(path, "RCC8Algebra.json"))
>>> rels4 = alg4.relations
>>> DC = rels4['DC']
>>> EC = rels4['EC']
>>> PO = rels4['PO']
>>> TPP = rels4['TPP']
>>> NTPP = rels4['NTPP']
>>> TPPI = rels4['TPPI']
>>> NTPPI = rels4['NTPPI']
>>> EQ = rels4['EQ']
>>> house1 = SpatialObject(['Region'], 'house1')
>>> house2 = SpatialObject(['Region'], 'house2')
>>> property1 = SpatialObject(['Region'], 'property1')
>>> property2 = SpatialObject(['Region'], 'property2')
>>> road = SpatialObject(['Region'], 'road')
>>> net4 = Network(alg4, "Wikipedia RCC8 Example")
house1 {DC} house2:
>>> net4.constraint(house1,house2,[DC])
house1 {TPP,NTPP} property1:
>>> net4.constraint(house1,property1,[TPP,NTPP])
house1 {DC,EC} property2:
>>> net4.constraint(house1,property2,[DC,EC])
house1 {EC} road:
>>> net4.constraint(house1,road,[EC])
house2 {DC,EC} property1:
>>> net4.constraint(house2,property1,[DC,EC])
house2 {NTPP} property2:
>>> net4.constraint(house2,property2,[NTPP])
house2 {EC} road:
>>> net4.constraint(house2,road,[EC])
property1 {DC,EC} property2:
>>> net4.constraint(property1,property2,[DC,EC])
road { DC, EC, TPP, TPPi, PO, EQ, NTPP, NTPPi } property1
>>> net4.constraint(road,property1,[DC,EC,TPP,TPPI,PO,EQ,NTPP,NTPPI])
road { DC, EC, TPP, TPPi, PO, EQ, NTPP, NTPPi } property2
>>> net4.constraint(road,property2,[DC,EC,TPP,TPPI,PO,EQ,NTPP,NTPPI])
>>> net4.print_constraints()
<BLANKLINE>
<Network: Wikipedia RCC8 Example, 5 entities>
Constraints: (Source, Target, RelationSet)
house1, house1, [EQ]
house1, house2, [DC]
house1, property1, [NTPP, TPP]
house1, property2, [DC, EC]
house1, road, [EC]
house2, house1, [DC]
house2, house2, [EQ]
house2, property1, [DC, EC]
house2, property2, [NTPP]
house2, road, [EC]
property1, house1, [NTPPI, TPPI]
property1, house2, [DC, EC]
property1, property1, [EQ]
property1, property2, [DC, EC]
property1, road, [NTPPI, NTPP, DC, EC, TPPI, TPP, EQ, PO]
property2, house1, [DC, EC]
property2, house2, [NTPPI]
property2, property1, [DC, EC]
property2, property2, [EQ]
property2, road, [NTPPI, NTPP, DC, EC, TPPI, TPP, EQ, PO]
road, house1, [EC]
road, house2, [EC]
road, property1, [NTPPI, NTPP, DC, EC, TPPI, TPP, EQ, PO]
road, property2, [NTPPI, NTPP, DC, EC, TPPI, TPP, EQ, PO]
road, road, [EQ]
>>> net4.propagate()
>>> net4.print_constraints()
<BLANKLINE>
<Network: Wikipedia RCC8 Example, 5 entities>
Constraints: (Source, Target, RelationSet)
house1, house1, [EQ]
house1, house2, [DC]
house1, property1, [NTPP, TPP]
house1, property2, [DC, EC]
house1, road, [EC]
house2, house1, [DC]
house2, house2, [EQ]
house2, property1, [DC]
house2, property2, [NTPP]
house2, road, [EC]
property1, house1, [NTPPI, TPPI]
property1, house2, [DC]
property1, property1, [EQ]
property1, property2, [DC, EC]
property1, road, [EC, PO]
property2, house1, [DC, EC]
property2, house2, [NTPPI]
property2, property1, [DC, EC]
property2, property2, [EQ]
property2, road, [TPPI, PO]
road, house1, [EC]
road, house2, [EC]
road, property1, [EC, PO]
road, property2, [TPP, PO]
road, road, [EQ]
"""
from qualreas import *
| 27.57 | 118 | 0.633539 | 1,164 | 8,271 | 4.472509 | 0.170962 | 0.024011 | 0.053016 | 0.06627 | 0.525932 | 0.482136 | 0.482136 | 0.456396 | 0.443911 | 0.364964 | 0 | 0.03435 | 0.151735 | 8,271 | 299 | 119 | 27.662207 | 0.707668 | 0.995889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
eeb1fcf1205718df5264b13fd1d62d490314f7af | 208 | py | Python | tgproxy/errors.py | unhandled-exception/tgproxy | 85c2256bf8579f5578df2062f436dfdd17e5618a | [
"MIT"
] | 1 | 2021-10-11T20:38:42.000Z | 2021-10-11T20:38:42.000Z | tgproxy/errors.py | unhandled-exception/tgproxy | 85c2256bf8579f5578df2062f436dfdd17e5618a | [
"MIT"
] | null | null | null | tgproxy/errors.py | unhandled-exception/tgproxy | 85c2256bf8579f5578df2062f436dfdd17e5618a | [
"MIT"
] | null | null | null | class UnknownChannelType(Exception):
pass
class BaseError(Exception):
http_status = 500
class QueueFull(BaseError):
http_status = 503
class ChannelNotFound(BaseError):
http_status = 404
| 13.866667 | 36 | 0.735577 | 22 | 208 | 6.818182 | 0.545455 | 0.2 | 0.253333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053571 | 0.192308 | 208 | 14 | 37 | 14.857143 | 0.839286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.125 | 0 | 0 | 0.875 | 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 | 1 | 0 | 0 | 4 |
eebf1a80a1664c68ebf49985311e2c688228cfe6 | 240 | py | Python | miprometheus/problems/seq_to_seq/algorithmic/dual_distraction/__init__.py | vincentalbouy/mi-prometheus | 99a0c94b0d0f3476fa021213b3246fda0db8b2db | [
"Apache-2.0"
] | null | null | null | miprometheus/problems/seq_to_seq/algorithmic/dual_distraction/__init__.py | vincentalbouy/mi-prometheus | 99a0c94b0d0f3476fa021213b3246fda0db8b2db | [
"Apache-2.0"
] | null | null | null | miprometheus/problems/seq_to_seq/algorithmic/dual_distraction/__init__.py | vincentalbouy/mi-prometheus | 99a0c94b0d0f3476fa021213b3246fda0db8b2db | [
"Apache-2.0"
] | null | null | null | from .distraction_carry import DistractionCarry
from .distraction_forget import DistractionForget
from .distraction_ignore import DistractionIgnore
__all__ = [
'DistractionCarry',
'DistractionForget',
'DistractionIgnore'
]
| 24 | 49 | 0.791667 | 19 | 240 | 9.631579 | 0.526316 | 0.245902 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 240 | 9 | 50 | 26.666667 | 0.897059 | 0 | 0 | 0 | 0 | 0 | 0.208333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
e106901c7af2d7d7ae86d6f15aa1223af328fe78 | 87 | py | Python | mycal/fibcal/apps.py | jajayongjia/FibBreaker | 06db01d13a6932bd9c13daa546b554f6952dc2fe | [
"MIT"
] | null | null | null | mycal/fibcal/apps.py | jajayongjia/FibBreaker | 06db01d13a6932bd9c13daa546b554f6952dc2fe | [
"MIT"
] | null | null | null | mycal/fibcal/apps.py | jajayongjia/FibBreaker | 06db01d13a6932bd9c13daa546b554f6952dc2fe | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class FibcalConfig(AppConfig):
name = 'fibcal'
| 14.5 | 33 | 0.747126 | 10 | 87 | 6.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172414 | 87 | 5 | 34 | 17.4 | 0.902778 | 0 | 0 | 0 | 0 | 0 | 0.068966 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
e10c38d6daa7b0f90016fd7e2bc46a97139d78bb | 219 | py | Python | function.py | Kar1o/python-class | 614b3053314a08f96ff56c796f3dcfb9c04d06d1 | [
"Unlicense"
] | null | null | null | function.py | Kar1o/python-class | 614b3053314a08f96ff56c796f3dcfb9c04d06d1 | [
"Unlicense"
] | null | null | null | function.py | Kar1o/python-class | 614b3053314a08f96ff56c796f3dcfb9c04d06d1 | [
"Unlicense"
] | null | null | null | my_list = [1, 2, 3]
def add_list(my_list):
for i in my_list:
sum_list = my_list[i] + sum_list
return sum_list
def sumarize(add_list):
print("sum of " + my_list + "is" + add_list())
add_list(my_list)
sumarize()
| 16.846154 | 47 | 0.675799 | 42 | 219 | 3.214286 | 0.380952 | 0.266667 | 0.222222 | 0.192593 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01676 | 0.182648 | 219 | 12 | 48 | 18.25 | 0.73743 | 0 | 0 | 0 | 0 | 0 | 0.041096 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 0 | 0.333333 | 0.111111 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e10cfdba07c471899941827c2f850493fff25e0f | 137 | py | Python | Chapter 07/ch7_2_25.py | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | f6a4194684515495d00aa38347a725dd08f39a0c | [
"MIT"
] | null | null | null | Chapter 07/ch7_2_25.py | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | f6a4194684515495d00aa38347a725dd08f39a0c | [
"MIT"
] | null | null | null | Chapter 07/ch7_2_25.py | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | f6a4194684515495d00aa38347a725dd08f39a0c | [
"MIT"
] | null | null | null | def student(firstname, lastname ='Garg', year ='First'):
print(firstname, lastname, 'studies in', year, 'year')
student('Sujay') | 34.25 | 59 | 0.664234 | 16 | 137 | 5.6875 | 0.6875 | 0.373626 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153285 | 137 | 4 | 60 | 34.25 | 0.784483 | 0 | 0 | 0 | 0 | 0 | 0.207407 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
015115d377c33bc36dab1028db0d87f4b31e6059 | 363 | py | Python | unittest/unittest/2_FizzBuzzTest.py | fly2rain/try_git_pycharm | 0bb6b6b05c9d5942c46fa572a5f4dbaa90309b8a | [
"Unlicense"
] | null | null | null | unittest/unittest/2_FizzBuzzTest.py | fly2rain/try_git_pycharm | 0bb6b6b05c9d5942c46fa572a5f4dbaa90309b8a | [
"Unlicense"
] | null | null | null | unittest/unittest/2_FizzBuzzTest.py | fly2rain/try_git_pycharm | 0bb6b6b05c9d5942c46fa572a5f4dbaa90309b8a | [
"Unlicense"
] | null | null | null | # cf. https://www.linkedin.com/learning/unit-testing-and-test-driven-development-in-python/example-tdd-session-the-fizzbuzz-kata?u=26192810
import pytest
def fizzBuzz(x):
return str(x)
def checkFizzBuzz(value, expectedRetVal):
retVal = fizzBuzz(value)
assert retVal == expectedRetVal
def test_returns1With1PassedIn():
checkFizzBuzz(1, "1")
| 21.352941 | 139 | 0.746556 | 46 | 363 | 5.869565 | 0.76087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037855 | 0.126722 | 363 | 16 | 140 | 22.6875 | 0.81388 | 0.37741 | 0 | 0 | 0 | 0 | 0.004464 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.375 | false | 0.125 | 0.125 | 0.125 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 4 |
0156e4a81cc9f44eafd9d1bdcf60eb59dae15c1b | 238 | py | Python | kooie/Q01/Q01Py.py | kooie/MathPazzles70 | 726efc82fc7b95ad0aca78f3017c5c3c59fb0118 | [
"MIT"
] | null | null | null | kooie/Q01/Q01Py.py | kooie/MathPazzles70 | 726efc82fc7b95ad0aca78f3017c5c3c59fb0118 | [
"MIT"
] | 3 | 2018-10-06T14:59:03.000Z | 2018-10-18T09:04:09.000Z | kooie/Q01/Q01Py.py | kooie/MathPazzles70 | 726efc82fc7b95ad0aca78f3017c5c3c59fb0118 | [
"MIT"
] | 1 | 2018-10-06T10:17:11.000Z | 2018-10-06T10:17:11.000Z | # 回文判定
def isKaibun(str):
return str == str[::-1]
loopFlg = True
i = 10
while (loopFlg):
if (isKaibun(format(i,"d")) and isKaibun(format(i,"o")) and isKaibun(format(i,"b"))):
loopFlg = False
print(i)
i += 1
| 17 | 89 | 0.558824 | 35 | 238 | 3.8 | 0.542857 | 0.315789 | 0.338346 | 0.270677 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022472 | 0.252101 | 238 | 13 | 90 | 18.307692 | 0.724719 | 0.016807 | 0 | 0 | 0 | 0 | 0.012931 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0.111111 | 0.222222 | 0.111111 | 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 | 1 | 0 | 0 | 0 | 4 |
01810a310b9acfa82baa91b9bc6e5202a640e499 | 63 | py | Python | run_manual.py | hreeder/lambda-github-secgroup-updater | ce9e2d569da07d7d5144a1059d389525f8c46b37 | [
"MIT"
] | null | null | null | run_manual.py | hreeder/lambda-github-secgroup-updater | ce9e2d569da07d7d5144a1059d389525f8c46b37 | [
"MIT"
] | null | null | null | run_manual.py | hreeder/lambda-github-secgroup-updater | ce9e2d569da07d7d5144a1059d389525f8c46b37 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from secgrp_updater.main import run
run() | 21 | 35 | 0.777778 | 11 | 63 | 4.363636 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 63 | 3 | 36 | 21 | 0.842105 | 0.31746 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
01884f5b67bfc8ed2f8cd84e4625ec2270d29d74 | 215 | py | Python | python-django/ch1_helloworld/main_app/urls.py | Rokon-Uz-Zaman/thinkdiff_python_django | 5010c5f1dd8a028fb9e5235319bb6bb434831e6c | [
"MIT"
] | 92 | 2018-04-03T20:53:07.000Z | 2022-03-04T05:53:10.000Z | django-framework/ch1_helloworld/main_app/urls.py | mostafijur-rahman299/thinkdiff | b0e0c01fe38c406f4dfa8cc80b2f0c5654017079 | [
"MIT"
] | 11 | 2018-10-01T15:35:33.000Z | 2021-09-01T04:59:56.000Z | django-framework/ch1_helloworld/main_app/urls.py | mostafijur-rahman299/thinkdiff | b0e0c01fe38c406f4dfa8cc80b2f0c5654017079 | [
"MIT"
] | 98 | 2018-03-13T08:03:54.000Z | 2022-03-22T08:11:44.000Z | from django.urls import path
from . import views
urlpatterns = [
path('', views.homeView, name="home"),
path('home/', views.homeView, name="home"),
path('another/', views.anotherView, name="another")
] | 26.875 | 55 | 0.660465 | 26 | 215 | 5.461538 | 0.461538 | 0.183099 | 0.239437 | 0.295775 | 0.352113 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15814 | 215 | 8 | 56 | 26.875 | 0.78453 | 0 | 0 | 0 | 0 | 0 | 0.12963 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.285714 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
6d6ad60cf9607e5f5e637ef2bf051cef7da8f507 | 140 | py | Python | test/manual_tests/conftest.py | d33jiang/pytils | 6e44a05480abec6297b77730676bcb5fd5088f6f | [
"MIT"
] | null | null | null | test/manual_tests/conftest.py | d33jiang/pytils | 6e44a05480abec6297b77730676bcb5fd5088f6f | [
"MIT"
] | null | null | null | test/manual_tests/conftest.py | d33jiang/pytils | 6e44a05480abec6297b77730676bcb5fd5088f6f | [
"MIT"
] | null | null | null | # noinspection PyUnusedLocal
def pytest_ignore_collect(path, config):
"""Ignore all files in this test subdirectory."""
return True
| 28 | 53 | 0.75 | 17 | 140 | 6.058824 | 0.941176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164286 | 140 | 4 | 54 | 35 | 0.880342 | 0.507143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
6d78c65652e8ad67a4b14cc31e751f6eb95ebe1e | 600 | py | Python | tokenwiser/textprep/_cleaner.py | Btibert3/tokenwiser | 64f78be285d24ebc53bcc6991466517aed633888 | [
"Apache-2.0"
] | 50 | 2020-11-21T04:29:34.000Z | 2022-02-12T11:16:52.000Z | tokenwiser/textprep/_cleaner.py | Btibert3/tokenwiser | 64f78be285d24ebc53bcc6991466517aed633888 | [
"Apache-2.0"
] | 33 | 2020-11-26T11:03:52.000Z | 2021-12-04T20:27:44.000Z | tokenwiser/textprep/_cleaner.py | Btibert3/tokenwiser | 64f78be285d24ebc53bcc6991466517aed633888 | [
"Apache-2.0"
] | 7 | 2021-04-07T08:54:34.000Z | 2021-11-11T00:18:17.000Z | from sklearn.base import BaseEstimator
from ._prep import TextPrep
class Cleaner(TextPrep, BaseEstimator):
"""
Applies a lowercase and removes non-alphanum.
Usage:
```python
from tokenwiser.textprep import Cleaner
single = Cleaner().encode_single("$$$5 dollars")
assert single == "5 dollars"
multi = Cleaner().transform(["$$$5 dollars", "#hashtag!"])
assert multi == ["5 dollars", "hashtag"]
```
"""
def __init__(self):
pass
def encode_single(self, x: str):
return "".join([c.lower() for c in x if c.isalnum() or c == " "])
| 22.222222 | 73 | 0.615 | 71 | 600 | 5.098592 | 0.591549 | 0.088398 | 0.077348 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008734 | 0.236667 | 600 | 26 | 74 | 23.076923 | 0.781659 | 0.478333 | 0 | 0 | 0 | 0 | 0.003774 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.142857 | 0.285714 | 0.142857 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 4 |
6da164d36084e1e967aa3b11c562febec49d7208 | 632 | py | Python | database/_create.py | bsoe003/MWCH_Website | d4b54b881fa8f0706c24372d783fc3f325319af3 | [
"MIT"
] | null | null | null | database/_create.py | bsoe003/MWCH_Website | d4b54b881fa8f0706c24372d783fc3f325319af3 | [
"MIT"
] | null | null | null | database/_create.py | bsoe003/MWCH_Website | d4b54b881fa8f0706c24372d783fc3f325319af3 | [
"MIT"
] | null | null | null | #!flask/bin/python
"""
Filename: _create.py
From: Miguel Grinberg
Description: Creates database table from models.py.
"""
import sys
sys.path.append('..')
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from dev import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
| 27.478261 | 111 | 0.816456 | 87 | 632 | 5.678161 | 0.413793 | 0.206478 | 0.255061 | 0.105263 | 0.238866 | 0.238866 | 0.238866 | 0.238866 | 0.238866 | 0 | 0 | 0 | 0.099684 | 632 | 22 | 112 | 28.727273 | 0.86819 | 0.177215 | 0 | 0 | 0 | 0 | 0.041016 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.461538 | 0 | 0.461538 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
6dad8c1206bcf75178861ae04ccba00b0e7d4b0b | 88 | py | Python | templates/python2/main.py | m0ch1m0ch1/ac-deck | 84aa1a9dd1b4cbf97bd05431a58060e15890ee81 | [
"Apache-2.0"
] | 26 | 2020-02-10T12:16:10.000Z | 2020-05-02T04:45:55.000Z | templates/python2/main.py | m0ch1m0ch1/ac-deck | 84aa1a9dd1b4cbf97bd05431a58060e15890ee81 | [
"Apache-2.0"
] | 7 | 2020-02-10T10:32:51.000Z | 2020-04-12T11:37:03.000Z | templates/python2/main.py | m0ch1m0ch1/ac-deck | 84aa1a9dd1b4cbf97bd05431a58060e15890ee81 | [
"Apache-2.0"
] | 5 | 2020-02-26T06:47:44.000Z | 2020-04-04T13:45:37.000Z | # Code for {{.Task.Name}}
# Use raw_input() to fetch data from STDIN
print "Hello world" | 29.333333 | 42 | 0.704545 | 15 | 88 | 4.066667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.159091 | 88 | 3 | 43 | 29.333333 | 0.824324 | 0.727273 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 1 | 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 | 1 | 0 | 4 |
6dc7e51bff4fd54834451c16acdaea3f422dde39 | 113 | py | Python | sequencing_facility/__init__.py | mytardis/mytardis-seqfac | bd48ec74d8c602ceaf982ac3d58df82ee6c99a85 | [
"Apache-2.0"
] | 1 | 2020-02-12T00:54:15.000Z | 2020-02-12T00:54:15.000Z | sequencing_facility/__init__.py | mytardis/mytardis-seqfac | bd48ec74d8c602ceaf982ac3d58df82ee6c99a85 | [
"Apache-2.0"
] | 1 | 2016-10-04T23:18:51.000Z | 2016-10-05T04:20:28.000Z | sequencing_facility/__init__.py | mytardis/mytardis-seqfac | bd48ec74d8c602ceaf982ac3d58df82ee6c99a85 | [
"Apache-2.0"
] | 1 | 2021-02-12T18:40:44.000Z | 2021-02-12T18:40:44.000Z | import settings
__version__ = '1.22.3'
default_app_config = 'sequencing_facility.apps.SequencingFacilityConfig'
| 22.6 | 72 | 0.831858 | 13 | 113 | 6.692308 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 0.079646 | 113 | 4 | 73 | 28.25 | 0.798077 | 0 | 0 | 0 | 0 | 0 | 0.486726 | 0.433628 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
6ddf4a9de943845092257816f97a75569b81c183 | 595 | py | Python | pyredux/internal/store.py | rikbruil/pyredux | eed77ef94563f44da13f4cb8fce2ba72bb66a633 | [
"MIT"
] | 1 | 2016-12-03T15:13:09.000Z | 2016-12-03T15:13:09.000Z | pyredux/internal/store.py | rikbruil/pyredux | eed77ef94563f44da13f4cb8fce2ba72bb66a633 | [
"MIT"
] | null | null | null | pyredux/internal/store.py | rikbruil/pyredux | eed77ef94563f44da13f4cb8fce2ba72bb66a633 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
class BaseStore:
_store = None
def __init__(self, store):
self._store = store
def dispatch(self, action):
return self._store['dispatch'](action)
def get_state(self):
return self._store['get_state']()
class Store(BaseStore):
_store = None
def __init__(self, store):
self._store = store
BaseStore.__init__(self, store)
def subscribe(self, listener):
return self._store['subscribe'](listener)
def replace_reducer(self, reducer):
return self._store['replace_reducer'](reducer)
| 20.517241 | 54 | 0.630252 | 68 | 595 | 5.161765 | 0.279412 | 0.230769 | 0.17094 | 0.119658 | 0.273504 | 0.273504 | 0.273504 | 0.273504 | 0.273504 | 0.273504 | 0 | 0.002227 | 0.245378 | 595 | 28 | 55 | 21.25 | 0.77951 | 0.035294 | 0 | 0.352941 | 0 | 0 | 0.071678 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.352941 | false | 0 | 0 | 0.235294 | 0.823529 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
6de411dfa43267fc283dc5695072821da88670ae | 3,539 | py | Python | ucsv/ucsv.py | smbapps/ucsv | e1119f306abc601d7d423608e71133d41e47a003 | [
"MIT"
] | 1 | 2017-06-30T08:51:30.000Z | 2017-06-30T08:51:30.000Z | ucsv/ucsv.py | smbapps/ucsv | e1119f306abc601d7d423608e71133d41e47a003 | [
"MIT"
] | null | null | null | ucsv/ucsv.py | smbapps/ucsv | e1119f306abc601d7d423608e71133d41e47a003 | [
"MIT"
] | null | null | null | """
CSV reader and writer for unicode strings, from
http://docs.python.org/2/library/csv.html#examples with the addition of
UnicodeDictReader, UnicodeDictWriter, and optimizations for passing through
UTF-8.
"""
from __future__ import absolute_import
import cStringIO as StringIO
import codecs
import csv
class Recoder:
"""
Iterator that decodes an input stream and reencodes on output.
"""
def __init__(self, f, input_encoding="utf-8", output_encoding="utf-8"):
if input_encoding == output_encoding:
self.passthrough = True
self.reader = iter(f)
else:
self.passthrough = False
self.reader = codecs.getreader(input_encoding)(f)
self.encoder = codecs.getincrementalencoder(output_encoding)()
def __iter__(self):
return self
def next(self):
if self.passthrough:
return self.reader.next()
else:
return self.encoder.encode(self.reader.next())
class UnicodeReader(object):
"""
A CSV reader which will iterate over lines in the CSV file "f",
which is encoded in the given encoding.
"""
csv_reader = csv.reader
def __init__(self, f, dialect=csv.excel, encoding="utf-8", **kwds):
f = Recoder(f, input_encoding=encoding, output_encoding="utf-8")
self.reader = self.csv_reader(f, dialect=dialect, **kwds)
def _decode_row_utf8(self, row):
return [unicode(s, "utf-8") for s in row]
def next(self):
row = self.reader.next()
return self._decode_row_utf8(row)
def __iter__(self):
return self
def __getattr__(self, name):
return getattr(self.reader, name)
class UnicodeWriter(object):
"""
A CSV writer which will write rows to CSV file "f",
which is encoded in the given encoding.
"""
csv_writer = csv.writer
def __init__(self, f, dialect=csv.excel, encoding="utf-8", **kwds):
if encoding == "utf-8":
self.passthrough = True
self.writer = self.csv_writer(f, dialect=dialect, **kwds)
else:
# Redirect output to a queue
self.queue = StringIO.StringIO()
self.writer = self.csv_writer(self.queue, dialect=dialect, **kwds)
self.stream = f
self.encoder = codecs.getincrementalencoder(encoding)()
def _encode_row_utf8(self, row):
return [s.encode("utf-8") for s in row]
def writerow(self, row):
self.writer.writerow(self._encode_row_utf8(row))
if not self.passthrough:
# Fetch UTF-8 output from the queue, reencode to the target
# encoding.
data = self.queue.getvalue().decode("utf-8")
data = self.encoder.encode(data)
self.stream.write(data)
self.queue.truncate(0)
def writerows(self, rows):
for row in rows:
self.writerow(row)
def __getattr__(self, name):
return getattr(self.writer, name)
class UnicodeDictReader(UnicodeReader):
csv_reader = csv.DictReader
def _decode_row_utf8(self, row):
return dict((unicode(k, "utf-8"), unicode(v, "utf-8")) for k, v in row.items())
class UnicodeDictWriter(UnicodeWriter):
csv_writer = csv.DictWriter
def __init__(self, f, fieldnames, **kwds):
kwds['fieldnames'] = fieldnames
super(UnicodeDictWriter, self).__init__(f, **kwds)
def _encode_row_utf8(self, row):
return dict((k.encode("utf-8"), v.encode("utf-8")) for k, v in row.items())
| 29.991525 | 87 | 0.631252 | 454 | 3,539 | 4.757709 | 0.237885 | 0.027778 | 0.033333 | 0.022222 | 0.280093 | 0.222685 | 0.198148 | 0.097222 | 0.07963 | 0.07963 | 0 | 0.008729 | 0.255439 | 3,539 | 117 | 88 | 30.247863 | 0.811006 | 0.157389 | 0 | 0.271429 | 0 | 0 | 0.025694 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.228571 | false | 0.071429 | 0.057143 | 0.114286 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 4 |
6df1a2fc0da1ef95d083afa6f8ccba4a1bfde29a | 332 | py | Python | engine/station_control/unittests/test_generic_text.py | geeklevi/PythonElectron | 0a01b8842a56f91338de6c341bb1c2037aaae359 | [
"CC0-1.0"
] | null | null | null | engine/station_control/unittests/test_generic_text.py | geeklevi/PythonElectron | 0a01b8842a56f91338de6c341bb1c2037aaae359 | [
"CC0-1.0"
] | null | null | null | engine/station_control/unittests/test_generic_text.py | geeklevi/PythonElectron | 0a01b8842a56f91338de6c341bb1c2037aaae359 | [
"CC0-1.0"
] | null | null | null | # import sys
# sys.path.append("..")
import unittest
from unittest import TestCase
from ..test_plans import generic_test
# from generic_test import GenericTestPlan
class MainUnitTest(TestCase):
def test_smu_have_address(self):
self.assertTrue(1, 1)
def test_can_set_smu_address(self):
self.assertTrue(2, 2) | 25.538462 | 42 | 0.743976 | 46 | 332 | 5.152174 | 0.5 | 0.092827 | 0.126582 | 0.21097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01444 | 0.165663 | 332 | 13 | 43 | 25.538462 | 0.841155 | 0.21988 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.375 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
096e9d181a5bb18eed99dd629e7e592630754b8c | 85 | py | Python | award/apps.py | Fridah-Alwanga/Award | bc67421f54859430e4c43355705ed3662b67e5ca | [
"MIT"
] | null | null | null | award/apps.py | Fridah-Alwanga/Award | bc67421f54859430e4c43355705ed3662b67e5ca | [
"MIT"
] | null | null | null | award/apps.py | Fridah-Alwanga/Award | bc67421f54859430e4c43355705ed3662b67e5ca | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class awardConfig(AppConfig):
name = 'award'
| 14.166667 | 33 | 0.741176 | 10 | 85 | 6.3 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 85 | 5 | 34 | 17 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
0992a02598a9345cbd6f767f61ea0ce9984bd3a3 | 53 | py | Python | or-tools/utils/__init__.py | temur-kh/pdp-drl-project | eeb0194e03ed9953837eb712b6a6a2b38e64aa91 | [
"MIT"
] | 7 | 2021-12-04T13:56:23.000Z | 2022-03-23T02:12:26.000Z | or-tools/utils/__init__.py | temur-kh/pdp-drl-project | eeb0194e03ed9953837eb712b6a6a2b38e64aa91 | [
"MIT"
] | null | null | null | or-tools/utils/__init__.py | temur-kh/pdp-drl-project | eeb0194e03ed9953837eb712b6a6a2b38e64aa91 | [
"MIT"
] | null | null | null | from .error import *
from .response_builder import *
| 17.666667 | 31 | 0.773585 | 7 | 53 | 5.714286 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150943 | 53 | 2 | 32 | 26.5 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
09b38c84fed2df6b2896dc0dfad7e42ee4630e10 | 1,007 | py | Python | tests/testPrimitives.py | andrewf/fern | 16c155ff1d0c8a096b43c2c19d1f478a334682e4 | [
"MIT"
] | 1 | 2021-12-13T12:50:35.000Z | 2021-12-13T12:50:35.000Z | tests/testPrimitives.py | andrewf/fern | 16c155ff1d0c8a096b43c2c19d1f478a334682e4 | [
"MIT"
] | 1 | 2018-07-19T03:54:17.000Z | 2018-07-19T03:54:17.000Z | tests/testPrimitives.py | andrewf/fern | 16c155ff1d0c8a096b43c2c19d1f478a334682e4 | [
"MIT"
] | null | null | null | import unittest
from fern import primitives
class TestNothing(unittest.TestCase):
def testExists(self):
nothing = primitives.Nothing
class TestUndefined(unittest.TestCase):
def testExists(self):
undef = primitives.Undefined
class NotPrimitive(object):
'Just for testing is_primitive'
class TestIsPrimitive(unittest.TestCase):
def testNothingIsPrimitive(self):
self.assertTrue(primitives.is_primitive(primitives.Nothing))
def testUndefinedIsPrimitive(self):
self.assertTrue(primitives.is_primitive(primitives.Undefined))
def testBoolIsPrimitive(self):
self.assertTrue(primitives.is_primitive(True))
self.assertTrue(primitives.is_primitive(False))
def testIntIsPrimitive(self):
self.assertTrue(primitives.is_primitive(14))
def testStringIsPrimitive(self):
self.assertTrue(primitives.is_primitive('iz a string'))
def testNonPrimitive(self):
self.assertFalse(primitives.is_primitive(NotPrimitive())) | 35.964286 | 70 | 0.748759 | 102 | 1,007 | 7.313725 | 0.362745 | 0.117962 | 0.197051 | 0.209115 | 0.423592 | 0.288204 | 0.131367 | 0 | 0 | 0 | 0 | 0.002361 | 0.158888 | 1,007 | 28 | 71 | 35.964286 | 0.878394 | 0.028798 | 0 | 0.083333 | 0 | 0 | 0.039683 | 0 | 0 | 0 | 0 | 0 | 0.291667 | 1 | 0.333333 | false | 0 | 0.083333 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
09cc9bea90fe43be81a33d749f48e2a791e5b574 | 68 | py | Python | wkskel/__init__.py | florian-drawitsch/wkskel | be75b0794e71e59eb5a6d5506f7d7fb6b43f7783 | [
"MIT"
] | 1 | 2021-04-23T20:36:03.000Z | 2021-04-23T20:36:03.000Z | wkskel/__init__.py | florian-drawitsch/wkskel | be75b0794e71e59eb5a6d5506f7d7fb6b43f7783 | [
"MIT"
] | null | null | null | wkskel/__init__.py | florian-drawitsch/wkskel | be75b0794e71e59eb5a6d5506f7d7fb6b43f7783 | [
"MIT"
] | null | null | null | from .types import Nodes, Parameters
from .skeleton import Skeleton
| 22.666667 | 36 | 0.823529 | 9 | 68 | 6.222222 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.132353 | 68 | 2 | 37 | 34 | 0.949153 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
09d7015ba2fd954638ac1060c324ddbba3dcac09 | 158 | py | Python | tdameritrade/tests/unit/orders/test_constants.py | jiosec/tdameritrade | 8c911402854bf3dae428c37e6e84bb189d84835b | [
"Apache-2.0"
] | 528 | 2018-08-19T17:06:29.000Z | 2022-03-28T03:39:22.000Z | tdameritrade/tests/unit/orders/test_constants.py | jiosec/tdameritrade | 8c911402854bf3dae428c37e6e84bb189d84835b | [
"Apache-2.0"
] | 122 | 2018-10-23T00:06:22.000Z | 2022-03-27T15:17:24.000Z | tdameritrade/tests/unit/orders/test_constants.py | jiosec/tdameritrade | 8c911402854bf3dae428c37e6e84bb189d84835b | [
"Apache-2.0"
] | 232 | 2018-09-07T19:13:00.000Z | 2022-01-28T17:32:17.000Z | from tdameritrade.orders.constants import Session
def test_constant_list():
for constant in Session.list():
assert Session(constant) in Session
| 22.571429 | 49 | 0.753165 | 20 | 158 | 5.85 | 0.65 | 0.17094 | 0.290598 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177215 | 158 | 6 | 50 | 26.333333 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
61d2903b210c07f91d67e9fc2be79b4dc398d49a | 201 | py | Python | Sort/Tests/SelectionSortTest.py | AdJo-CodeProjects/Algorithms-DataStructures | b31dc8b8fcbf297d1e36c31772b420c9c3387232 | [
"Apache-2.0"
] | null | null | null | Sort/Tests/SelectionSortTest.py | AdJo-CodeProjects/Algorithms-DataStructures | b31dc8b8fcbf297d1e36c31772b420c9c3387232 | [
"Apache-2.0"
] | null | null | null | Sort/Tests/SelectionSortTest.py | AdJo-CodeProjects/Algorithms-DataStructures | b31dc8b8fcbf297d1e36c31772b420c9c3387232 | [
"Apache-2.0"
] | null | null | null | '''
Testing the selection sort functionality
'''
from Sort.Algorithms.SelectionSort import selection_sort
def test_ss(unsorted):
return selection_sort(unsorted)
print(test_ss([1,0,4,1,2,3,6]))
| 18.272727 | 56 | 0.756219 | 30 | 201 | 4.933333 | 0.7 | 0.263514 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039548 | 0.119403 | 201 | 10 | 57 | 20.1 | 0.79661 | 0.199005 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 0.75 | 0.25 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
61e1c83a0291a0fd3517094e39c59fdf9bd80c17 | 177 | py | Python | server/bots.py | Pandicon/Multiplayer-Game | 4ed4ffc3e7d94a5300f426c9f018968b7aa54c13 | [
"MIT"
] | 6 | 2021-10-21T18:27:11.000Z | 2021-11-30T12:45:22.000Z | server/bots.py | Pandicon/Multiplayer-Game | 4ed4ffc3e7d94a5300f426c9f018968b7aa54c13 | [
"MIT"
] | null | null | null | server/bots.py | Pandicon/Multiplayer-Game | 4ed4ffc3e7d94a5300f426c9f018968b7aa54c13 | [
"MIT"
] | 1 | 2021-11-09T14:04:47.000Z | 2021-11-09T14:04:47.000Z | red = 0
green = 1
blue = 2
yellow = 3
black = 4
all = [red, green, blue, yellow, black]
all_str = ["red", "green", "blue", "yellow", "black"]
def botstr(b):
return all_str[b];
| 17.7 | 53 | 0.610169 | 30 | 177 | 3.533333 | 0.533333 | 0.150943 | 0.226415 | 0.339623 | 0.433962 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034965 | 0.19209 | 177 | 9 | 54 | 19.666667 | 0.706294 | 0 | 0 | 0 | 0 | 0 | 0.129944 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0.111111 | 0.222222 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 4 |
1111a5793e886c12500d4909a98dbe711d556fd1 | 91 | py | Python | src/main.py | Kuba97/house-prices | 13b9f3b953c77f05d9d9f5b4164442c9bb212c11 | [
"Unlicense"
] | null | null | null | src/main.py | Kuba97/house-prices | 13b9f3b953c77f05d9d9f5b4164442c9bb212c11 | [
"Unlicense"
] | null | null | null | src/main.py | Kuba97/house-prices | 13b9f3b953c77f05d9d9f5b4164442c9bb212c11 | [
"Unlicense"
] | null | null | null | from model_selection.selection import validate
if __name__ == '__main__':
validate()
| 15.166667 | 46 | 0.747253 | 10 | 91 | 5.9 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164835 | 91 | 5 | 47 | 18.2 | 0.776316 | 0 | 0 | 0 | 0 | 0 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
1134c71c551b9c4e9fad7c1bdbc6fc5731a6b47c | 88 | py | Python | backend/voting/models/__init__.py | marcoacierno/pycon | 2b7b47598c4929769cc73e322b3fce2c89151e21 | [
"MIT"
] | 56 | 2018-01-20T17:18:40.000Z | 2022-03-28T22:42:04.000Z | backend/voting/models/__init__.py | marcoacierno/pycon | 2b7b47598c4929769cc73e322b3fce2c89151e21 | [
"MIT"
] | 2,029 | 2018-01-20T11:37:24.000Z | 2022-03-31T04:10:51.000Z | backend/voting/models/__init__.py | marcoacierno/pycon | 2b7b47598c4929769cc73e322b3fce2c89151e21 | [
"MIT"
] | 17 | 2018-03-17T09:44:28.000Z | 2021-12-27T19:57:35.000Z | from .ranking import RankRequest, RankSubmission # noqa
from .vote import Vote # noqa
| 29.333333 | 56 | 0.772727 | 11 | 88 | 6.181818 | 0.636364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170455 | 88 | 2 | 57 | 44 | 0.931507 | 0.102273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
1143565637e05982b310f0ae651b9dbc9a9cab64 | 120 | py | Python | src/Controller/Clock.py | anthonyf996/ChessApp | 614f72bc641793681fd5ad7040d6a4c407c9ae9e | [
"MIT"
] | null | null | null | src/Controller/Clock.py | anthonyf996/ChessApp | 614f72bc641793681fd5ad7040d6a4c407c9ae9e | [
"MIT"
] | null | null | null | src/Controller/Clock.py | anthonyf996/ChessApp | 614f72bc641793681fd5ad7040d6a4c407c9ae9e | [
"MIT"
] | null | null | null | class Clock:
def __init__(self, fpsSpec):
self.fpsSpec = fpsSpec
def tick(self):
raise NotImplementedError
| 17.142857 | 30 | 0.708333 | 14 | 120 | 5.785714 | 0.642857 | 0.271605 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208333 | 120 | 6 | 31 | 20 | 0.852632 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0 | 0.6 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1143e8870aea6d554c550eed74b1de8710d12e6b | 258 | py | Python | awward/forms.py | dgkilolo/Awwards | 07c3bba0ec635905c645445fd974adf62f176ba2 | [
"RSA-MD"
] | null | null | null | awward/forms.py | dgkilolo/Awwards | 07c3bba0ec635905c645445fd974adf62f176ba2 | [
"RSA-MD"
] | 7 | 2021-03-30T13:31:28.000Z | 2021-09-22T19:10:11.000Z | awward/forms.py | dgkilolo/Awwards | 07c3bba0ec635905c645445fd974adf62f176ba2 | [
"RSA-MD"
] | null | null | null | from django import forms
from .models import Project,Profile
class NewProjectForm(forms.ModelForm):
class Meta:
model = Project
exclude = ['profile']
class EditProfileForm(forms.ModelForm):
class Meta:
model = Profile
exclude = ['user'] | 21.5 | 39 | 0.717054 | 29 | 258 | 6.37931 | 0.517241 | 0.12973 | 0.205405 | 0.248649 | 0.302703 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189922 | 258 | 12 | 40 | 21.5 | 0.885167 | 0 | 0 | 0.2 | 0 | 0 | 0.042471 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
115b331c9f4aa999d2ba0da6b5ef5a82ec50c925 | 193 | py | Python | src/hks_pylib/errors/cryptography/batchcrypt/batchnumber.py | huykingsofm/hks_pylib | d73a896a395df301ef8082a358ec8e23f7bc708a | [
"MIT"
] | 2 | 2021-04-06T07:01:27.000Z | 2021-07-30T11:08:59.000Z | src/hks_pylib/errors/cryptography/batchcrypt/batchnumber.py | huykingsofm/hks_pylib | d73a896a395df301ef8082a358ec8e23f7bc708a | [
"MIT"
] | null | null | null | src/hks_pylib/errors/cryptography/batchcrypt/batchnumber.py | huykingsofm/hks_pylib | d73a896a395df301ef8082a358ec8e23f7bc708a | [
"MIT"
] | null | null | null | from hks_pylib.errors.cryptography.batchcrypt import BatchCryptError
class BatchNumberError(BatchCryptError):
"The exception is raised when you access an invalid element in batchnumber."
| 32.166667 | 80 | 0.829016 | 23 | 193 | 6.913043 | 0.956522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.124352 | 193 | 5 | 81 | 38.6 | 0.940828 | 0.38342 | 0 | 0 | 0 | 0 | 0.38342 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
fee1c78a51a55b078a4f5d560d0967cbc2d39a4f | 175 | py | Python | src/tokenizer/NumberToken.py | aboveyou00/cc | 816a2fb8e53723e8f2c72a8e5d9f443057017594 | [
"MIT"
] | null | null | null | src/tokenizer/NumberToken.py | aboveyou00/cc | 816a2fb8e53723e8f2c72a8e5d9f443057017594 | [
"MIT"
] | null | null | null | src/tokenizer/NumberToken.py | aboveyou00/cc | 816a2fb8e53723e8f2c72a8e5d9f443057017594 | [
"MIT"
] | null | null | null | from tokenizer.Token import *
class NumberToken(Token):
def __init__(self, linen, start, orig):
super().__init__(linen, start, orig)
self.num = int(orig)
| 25 | 44 | 0.657143 | 22 | 175 | 4.863636 | 0.681818 | 0.186916 | 0.261682 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217143 | 175 | 6 | 45 | 29.166667 | 0.781022 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
feedc7ca51588dae0f52bd15e4818e351e055961 | 157 | py | Python | .~c9_invoke_uyUd.py | variah-hauge/IA241 | 482a36fc1398d0ccd2ebc568fd7345f66c812c19 | [
"MIT"
] | null | null | null | .~c9_invoke_uyUd.py | variah-hauge/IA241 | 482a36fc1398d0ccd2ebc568fd7345f66c812c19 | [
"MIT"
] | null | null | null | .~c9_invoke_uyUd.py | variah-hauge/IA241 | 482a36fc1398d0ccd2ebc568fd7345f66c812c19 | [
"MIT"
] | null | null | null | """
lec8 functions
"""
def my_function(a,b):
result = a+b
print('a is,' a)
print('b is,' b)
return result
print(my_function(1,2))
| 12.076923 | 23 | 0.541401 | 25 | 157 | 3.32 | 0.52 | 0.240964 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026786 | 0.286624 | 157 | 12 | 24 | 13.083333 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0.074074 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.5 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
3a2cd9e3413a4e27c47dd36dda4d3dd3f1ea6aaa | 111 | py | Python | settings.py | tongplw/bot | 945b76c57a377e92a85b3359d74c3dc1b32d9a8e | [
"MIT"
] | 2 | 2021-02-07T15:41:46.000Z | 2021-02-07T17:49:46.000Z | settings.py | tongplw/bot | 945b76c57a377e92a85b3359d74c3dc1b32d9a8e | [
"MIT"
] | null | null | null | settings.py | tongplw/bot | 945b76c57a377e92a85b3359d74c3dc1b32d9a8e | [
"MIT"
] | null | null | null | import os
from dotenv import load_dotenv
load_dotenv(verbose=True)
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
| 18.5 | 42 | 0.81982 | 17 | 111 | 5.117647 | 0.588235 | 0.229885 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099099 | 111 | 5 | 43 | 22.2 | 0.87 | 0 | 0 | 0 | 0 | 0 | 0.117117 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
3a494e2600068c57c11d02c3b05c401ee0b13bd2 | 101 | py | Python | hashsuanfa.py | Octoberr/openfacelearn | 261ccedd9f52533da676eb31e9c4c56ef4204e65 | [
"Apache-2.0"
] | null | null | null | hashsuanfa.py | Octoberr/openfacelearn | 261ccedd9f52533da676eb31e9c4c56ef4204e65 | [
"Apache-2.0"
] | null | null | null | hashsuanfa.py | Octoberr/openfacelearn | 261ccedd9f52533da676eb31e9c4c56ef4204e65 | [
"Apache-2.0"
] | null | null | null | # coding:utf-8
import hashlib
md5 = hashlib.md5()
md5.update('my name is swm')
print md5.hexdigest() | 16.833333 | 28 | 0.722772 | 17 | 101 | 4.294118 | 0.764706 | 0.273973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.056818 | 0.128713 | 101 | 6 | 29 | 16.833333 | 0.772727 | 0.118812 | 0 | 0 | 0 | 0 | 0.159091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.25 | null | null | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
28d468d66345fd5bfbd7f5201d82bebf88d5f8d9 | 64 | py | Python | lib/screen/__init__.py | sshutovskyi/smart-kicker | aafc05a235b446854372b41b8e9ecf2eadf48748 | [
"MIT"
] | null | null | null | lib/screen/__init__.py | sshutovskyi/smart-kicker | aafc05a235b446854372b41b8e9ecf2eadf48748 | [
"MIT"
] | null | null | null | lib/screen/__init__.py | sshutovskyi/smart-kicker | aafc05a235b446854372b41b8e9ecf2eadf48748 | [
"MIT"
] | 1 | 2019-07-25T14:59:32.000Z | 2019-07-25T14:59:32.000Z | from .welcome import WelcomeScreen
from .game import GameScreen
| 21.333333 | 34 | 0.84375 | 8 | 64 | 6.75 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 64 | 2 | 35 | 32 | 0.964286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
e90ce89876c22b0a318677fc7d3eb1cfbefd3bc9 | 235 | py | Python | src/myinventory/admin.py | daredoes/tools-docker | a030087de0230869e461d7b3768fe787ae5fdc73 | [
"MIT"
] | null | null | null | src/myinventory/admin.py | daredoes/tools-docker | a030087de0230869e461d7b3768fe787ae5fdc73 | [
"MIT"
] | null | null | null | src/myinventory/admin.py | daredoes/tools-docker | a030087de0230869e461d7b3768fe787ae5fdc73 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import ItemModel
class ItemModelAdmin(admin.ModelAdmin):
list_display = ('name', 'id', 'image')
list_display_links = ('name', 'id')
admin.site.register(ItemModel, ItemModelAdmin)
| 26.111111 | 46 | 0.740426 | 28 | 235 | 6.107143 | 0.642857 | 0.128655 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131915 | 235 | 8 | 47 | 29.375 | 0.838235 | 0 | 0 | 0 | 0 | 0 | 0.07234 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 4 |
e913179bbc67669a045521ac21bee9b81f4571b5 | 123 | py | Python | ethpm/exceptions.py | vappm/py-ethpm | 2c215155748cf55e00fe4cf5de5ff2917f1b0d60 | [
"MIT"
] | null | null | null | ethpm/exceptions.py | vappm/py-ethpm | 2c215155748cf55e00fe4cf5de5ff2917f1b0d60 | [
"MIT"
] | null | null | null | ethpm/exceptions.py | vappm/py-ethpm | 2c215155748cf55e00fe4cf5de5ff2917f1b0d60 | [
"MIT"
] | null | null | null | class ValidationError(Exception):
"""
Error to signal something does not pass a validation check.
"""
pass
| 20.5 | 63 | 0.666667 | 14 | 123 | 5.857143 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.252033 | 123 | 5 | 64 | 24.6 | 0.891304 | 0.479675 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
3a793adbd566d5e7709ffffc818303a3782b8029 | 143 | py | Python | flexi/exceptions.py | netaneld122/flexi | 03e564356cb3e4434cd2050624afa1a5f56bd99a | [
"MIT"
] | null | null | null | flexi/exceptions.py | netaneld122/flexi | 03e564356cb3e4434cd2050624afa1a5f56bd99a | [
"MIT"
] | null | null | null | flexi/exceptions.py | netaneld122/flexi | 03e564356cb3e4434cd2050624afa1a5f56bd99a | [
"MIT"
] | null | null | null | class SubTreeAlreadyExistsException(Exception):
def __init__(self, key):
super(SubTreeAlreadyExistsException, self).__init__(key)
| 28.6 | 64 | 0.769231 | 12 | 143 | 8.5 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.13986 | 143 | 4 | 65 | 35.75 | 0.829268 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 4 |
3ac08ce9ea69aa8fb502511e9389537b8f19b00b | 364 | py | Python | server/ParcryptProject.py | kanhavishva/parcrypt | 1186bd1c3498086cedd7cf3bf599489856556035 | [
"MIT"
] | 5 | 2022-02-20T14:31:09.000Z | 2022-03-04T20:17:12.000Z | server/ParcryptProject.py | kanhavishva/parcrypt | 1186bd1c3498086cedd7cf3bf599489856556035 | [
"MIT"
] | 5 | 2022-02-23T03:57:49.000Z | 2022-03-28T10:40:41.000Z | server/ParcryptProject.py | brichard19/parcrypt | c24a363aa061b1cffa88c5950408c9c810d88a3d | [
"MIT"
] | 5 | 2022-02-20T14:31:02.000Z | 2022-02-21T16:50:22.000Z |
class ParcryptProject:
# Can be:
# 'running'
# 'done'
# 'paused'
def get_state(self):
raise Exception('get_state() must be implemented by subclass')
def get_type(self):
raise Exception('get_type() must be implemented by subclass')
def write_info(self):
raise Exception('write_info() must be implemented in subclass') | 22.75 | 67 | 0.659341 | 46 | 364 | 5.086957 | 0.456522 | 0.115385 | 0.230769 | 0.179487 | 0.25641 | 0.25641 | 0 | 0 | 0 | 0 | 0 | 0 | 0.233516 | 364 | 16 | 68 | 22.75 | 0.83871 | 0.090659 | 0 | 0 | 0 | 0 | 0.416129 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.428571 | false | 0 | 0 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
3ad9021693f849dee8f2506503c56af14ab928cb | 700 | py | Python | config.py | dlindem/ahotsak-wikibase | 406d28c0776b6bae02b08d547e8c4d80a9fb8b4d | [
"MIT"
] | null | null | null | config.py | dlindem/ahotsak-wikibase | 406d28c0776b6bae02b08d547e8c4d80a9fb8b4d | [
"MIT"
] | null | null | null | config.py | dlindem/ahotsak-wikibase | 406d28c0776b6bae02b08d547e8c4d80a9fb8b4d | [
"MIT"
] | null | null | null | datafolder = "D:/Ahotsak/"
awbuser = "DavidL_bot"
with open(datafolder+'wikibase/DavidL_bot_pwd.txt', 'r', encoding='utf-8') as pwdfile:
awbuserpass = pwdfile.read()
# with open(datafolder+'zoteroapi/zotero_api_key.txt', 'r', encoding='utf-8') as pwdfile:
# zotero_api_key = pwdfile.read()
sparql_prefixes = """
PREFIX awb: <http://datuak.ahotsak.eus/entity/>
PREFIX adp: <http://datuak.ahotsak.eus/prop/direct/>
PREFIX ap: <http://datuak.ahotsak.eus/prop/>
PREFIX aps: <http://datuak.ahotsak.eus/prop/statement/>
PREFIX apq: <http://datuak.ahotsak.eus/prop/qualifier/>
PREFIX apr: <http://datuak.ahotsak.eus/prop/reference/>
"""
# Properties with constraint: max. 1 value
max1props = [
"P19"
]
| 31.818182 | 89 | 0.721429 | 98 | 700 | 5.071429 | 0.489796 | 0.120724 | 0.205231 | 0.241449 | 0.342052 | 0.100604 | 0.100604 | 0 | 0 | 0 | 0 | 0.009449 | 0.092857 | 700 | 21 | 90 | 33.333333 | 0.773228 | 0.23 | 0 | 0 | 0 | 0 | 0.695327 | 0.050467 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.066667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
3ae5f055a7a8279a786ff2929e55c63ca892ab5d | 188 | py | Python | LeetCode/657_RobotReturnsToOrigin.py | defUserName-404/Online-Judge | 197ac5bf3e2149474b191eeff106b12cd723ec8c | [
"MIT"
] | null | null | null | LeetCode/657_RobotReturnsToOrigin.py | defUserName-404/Online-Judge | 197ac5bf3e2149474b191eeff106b12cd723ec8c | [
"MIT"
] | null | null | null | LeetCode/657_RobotReturnsToOrigin.py | defUserName-404/Online-Judge | 197ac5bf3e2149474b191eeff106b12cd723ec8c | [
"MIT"
] | null | null | null | class Solution:
def judgeCircle(self, moves: str) -> bool:
x = (moves.count('L') == moves.count('R'))
y = (moves.count('U') == moves.count('D'))
return x and y | 31.333333 | 50 | 0.531915 | 26 | 188 | 3.846154 | 0.653846 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.265957 | 188 | 6 | 51 | 31.333333 | 0.724638 | 0 | 0 | 0 | 0 | 0 | 0.021164 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
aaebd404fe4fea5e2492ee34849bdce027fc3d9f | 103 | py | Python | styletransfer/models/loss/__init__.py | jaeyeun97/MusicalStyleTransfer | 0aa9e8763597bf86ff0c13ae96dee75d165c4fc2 | [
"BSD-3-Clause"
] | 1 | 2020-04-14T14:11:14.000Z | 2020-04-14T14:11:14.000Z | styletransfer/models/loss/__init__.py | jaeyeun97/MusicalStyleTransfer | 0aa9e8763597bf86ff0c13ae96dee75d165c4fc2 | [
"BSD-3-Clause"
] | null | null | null | styletransfer/models/loss/__init__.py | jaeyeun97/MusicalStyleTransfer | 0aa9e8763597bf86ff0c13ae96dee75d165c4fc2 | [
"BSD-3-Clause"
] | null | null | null | from .gan import GANLoss
from .classify import ClassificationLoss
from .gp import cal_gradient_penalty
| 25.75 | 40 | 0.854369 | 14 | 103 | 6.142857 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116505 | 103 | 3 | 41 | 34.333333 | 0.945055 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
aaff273006ea31409f14e104fbd7c8c5a3fb0a29 | 86 | py | Python | python/graphidx/py/__init__.py | EQt/graphidx | 9716488cf29f6235072fc920fa1a473bf88e954f | [
"MIT"
] | 4 | 2020-04-03T15:18:30.000Z | 2022-01-06T15:22:48.000Z | python/graphidx/py/__init__.py | EQt/graphidx | 9716488cf29f6235072fc920fa1a473bf88e954f | [
"MIT"
] | null | null | null | python/graphidx/py/__init__.py | EQt/graphidx | 9716488cf29f6235072fc920fa1a473bf88e954f | [
"MIT"
] | null | null | null | """
This directory mainly contains Python re-implementions of code using `numba`.
"""
| 21.5 | 77 | 0.744186 | 11 | 86 | 5.818182 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.139535 | 86 | 3 | 78 | 28.666667 | 0.864865 | 0.895349 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c902affad1f62acbd19f329c0f069af9d79df978 | 23,859 | py | Python | Refinement_utils.py | Pandinosaurus/PSVH-3d-reconstruction | f0fc3faa914fbd10e23c93d685595e57084f816f | [
"MIT"
] | 20 | 2019-02-25T08:12:15.000Z | 2020-04-03T14:28:34.000Z | Refinement_utils.py | Pandinosaurus/PSVH-3d-reconstruction | f0fc3faa914fbd10e23c93d685595e57084f816f | [
"MIT"
] | 2 | 2019-08-27T16:55:04.000Z | 2020-06-09T12:21:20.000Z | Refinement_utils.py | Pandinosaurus/PSVH-3d-reconstruction | f0fc3faa914fbd10e23c93d685595e57084f816f | [
"MIT"
] | 4 | 2019-05-16T18:07:29.000Z | 2020-04-14T10:43:21.000Z | import numpy as np
import tensorflow as tf
import os
import voxel
from binvox_rw import Voxels
import time
from math import cos
from math import sin
from math import pi
from math import sqrt
voxel_size = 32
img_h = 128
img_w = 128
vector_channel = 1024
id_x = None
id_y = None
def pre_process():
global id_x, id_y
dim = voxel_size
points = []
dis = 1.2
focus = img_w * sqrt(3) / 2
for i in range(dim):
for j in range(dim):
for k in range(dim):
points.append([1.0*i/dim - 0.5, 1.0*j/dim-0.5, 1.0*k/dim-0.5])
points = np.asarray(points)
points[..., 2] += dis
for i in range(2):
points[..., i] *= focus
points[..., i] /= points[..., 2]
id_x = np.round(np.clip(points[...,0]+img_w/2,0,img_w-1)).astype(np.int32)
id_y = np.round(np.clip((points[...,1]+img_w/2),0,img_w-1)).astype(np.int32)
id_y = img_w - 1 - id_y
def lrelu(x, leak=0.2):
return tf.maximum(x, leak*x)
def residual_block(input,layer_id,num_layers=2,div=2,unpool=True):
input_shape = input.get_shape()
last_channel = input_shape[-1]
current_channel = int(int(last_channel)/div)
# reg = tf.contrib.layers.l2_regularizer(scale=0.1)
# upsampling
strides = [1,1,1,1,1]
output_shape = [int(input_shape[0]), int(input_shape[1]), int(input_shape[2]), int(input_shape[3]),
current_channel]
if unpool:
strides = [1,2,2,2,1]
output_shape = [int(input_shape[0]), int(input_shape[1]) * 2, int(input_shape[2]) * 2, int(input_shape[3]) * 2,
current_channel]
wd_0 = tf.get_variable("wd%d_0"%layer_id,shape=[3,3,3,current_channel,last_channel],initializer=tf.contrib.layers.xavier_initializer())
bd_0 = tf.get_variable("bd%d_0"%layer_id,shape=[current_channel],initializer=tf.zeros_initializer())
d_0 = tf.nn.conv3d_transpose(value=input, filter=wd_0, output_shape=output_shape, strides=strides, padding='SAME')
d_0 = tf.nn.bias_add(d_0, bd_0)
d_0 = tf.nn.relu(d_0)
last_layer = d_0
for i in range(1,num_layers+1):
wd = tf.get_variable("wd%d_%d" % (layer_id,i), shape=[3, 3, 3, current_channel, current_channel],
initializer=tf.contrib.layers.xavier_initializer())
bd = tf.get_variable("bd%d_%d" % (layer_id,i), shape=[current_channel],initializer=tf.zeros_initializer())
d = tf.nn.conv3d(last_layer, filter=wd, strides=[1, 1, 1, 1, 1], padding='SAME')
d = tf.nn.bias_add(d, bd)
d = tf.nn.relu(d)
last_layer = d
return tf.add(last_layer, d_0)
def refine_encoder(input, reuse=False):
strides = [1, 2, 2, 2, 1]
shortcuts = []
shortcuts.append(tf.stack([input[...,0],1-input[...,0]],axis=4))
with tf.variable_scope("refine_encoder",reuse=reuse):
we1 = tf.get_variable("we1",shape=[5,5,5,4,32],initializer=tf.contrib.layers.xavier_initializer())
be1 = tf.get_variable("be1",shape=[32],initializer=tf.zeros_initializer())
e_1 = tf.nn.conv3d(input, we1, strides=[1,1,1,1,1], padding="SAME")
e_1 = tf.nn.bias_add(e_1, be1)
#d_1 = tf.contrib.layers.batch_norm(d_1, is_training=phase_train)
e_1 = lrelu(e_1)
shortcuts.append(e_1) # 32 32 32 32
we2 = tf.get_variable("we2", shape=[3, 3, 3, 32, 64], initializer=tf.contrib.layers.xavier_initializer())
be2 = tf.get_variable("be2", shape=[64], initializer=tf.zeros_initializer())
e_2 = tf.nn.conv3d(e_1, we2, strides=strides, padding="SAME")
e_2 = tf.nn.bias_add(e_2, be2)
#d_2 = tf.contrib.layers.batch_norm(d_2, is_training=phase_train)
e_2 = lrelu(e_2)
shortcuts.append(e_2) # 16 16 16 64
we3 = tf.get_variable("we3", shape=[3, 3, 3, 64, 128], initializer=tf.contrib.layers.xavier_initializer())
be3 = tf.get_variable("be3", shape=[128], initializer=tf.zeros_initializer())
e_3 = tf.nn.conv3d(e_2, we3, strides=strides, padding="SAME")
e_3 = tf.nn.bias_add(e_3, be3)
# d_2 = tf.contrib.layers.batch_norm(d_2, is_training=phase_train)
e_3 = lrelu(e_3)
shortcuts.append(e_3) # 8 8 8 128
we4 = tf.get_variable("we4", shape=[3, 3, 3, 128, 256], initializer=tf.contrib.layers.xavier_initializer())
be4 = tf.get_variable("be4", shape=[256], initializer=tf.zeros_initializer())
e_4 = tf.nn.conv3d(e_3, we4, strides=strides, padding="SAME")
e_4 = tf.nn.bias_add(e_4, be4)
# d_2 = tf.contrib.layers.batch_norm(d_2, is_training=phase_train)
e_4 = lrelu(e_4)
shortcuts.append(e_4) # 4 4 4 256
we5 = tf.get_variable("we5", shape=[4, 4, 4, 256, 512], initializer=tf.contrib.layers.xavier_initializer())
be5 = tf.get_variable("be5", shape=[512], initializer=tf.zeros_initializer())
e_5 = tf.nn.conv3d(e_4, we5, strides=[1,1,1,1,1], padding="VALID")
e_5 = tf.nn.bias_add(e_5, be5)
# d_2 = tf.contrib.layers.batch_norm(d_2, is_training=phase_train)
e_5 = lrelu(e_5) # 1 1 1 1024
for _ in shortcuts:
print(_)
return e_5, shortcuts
def refine_encoder_novisualhull(input, reuse=False):
strides = [1, 2, 2, 2, 1]
shortcuts = []
shortcuts.append(tf.stack([input[...,0],1-input[...,0]],axis=4))
with tf.variable_scope("refine_encoder",reuse=reuse):
we1 = tf.get_variable("we1",shape=[5,5,5,2,32],initializer=tf.contrib.layers.xavier_initializer())
be1 = tf.get_variable("be1",shape=[32],initializer=tf.zeros_initializer())
e_1 = tf.nn.conv3d(input, we1, strides=[1,1,1,1,1], padding="SAME")
e_1 = tf.nn.bias_add(e_1, be1)
#d_1 = tf.contrib.layers.batch_norm(d_1, is_training=phase_train)
e_1 = lrelu(e_1)
shortcuts.append(e_1) # 32 32 32 32
we2 = tf.get_variable("we2", shape=[3, 3, 3, 32, 64], initializer=tf.contrib.layers.xavier_initializer())
be2 = tf.get_variable("be2", shape=[64], initializer=tf.zeros_initializer())
e_2 = tf.nn.conv3d(e_1, we2, strides=strides, padding="SAME")
e_2 = tf.nn.bias_add(e_2, be2)
#d_2 = tf.contrib.layers.batch_norm(d_2, is_training=phase_train)
e_2 = lrelu(e_2)
shortcuts.append(e_2) # 16 16 16 64
we3 = tf.get_variable("we3", shape=[3, 3, 3, 64, 128], initializer=tf.contrib.layers.xavier_initializer())
be3 = tf.get_variable("be3", shape=[128], initializer=tf.zeros_initializer())
e_3 = tf.nn.conv3d(e_2, we3, strides=strides, padding="SAME")
e_3 = tf.nn.bias_add(e_3, be3)
# d_2 = tf.contrib.layers.batch_norm(d_2, is_training=phase_train)
e_3 = lrelu(e_3)
shortcuts.append(e_3) # 8 8 8 128
we4 = tf.get_variable("we4", shape=[3, 3, 3, 128, 256], initializer=tf.contrib.layers.xavier_initializer())
be4 = tf.get_variable("be4", shape=[256], initializer=tf.zeros_initializer())
e_4 = tf.nn.conv3d(e_3, we4, strides=strides, padding="SAME")
e_4 = tf.nn.bias_add(e_4, be4)
# d_2 = tf.contrib.layers.batch_norm(d_2, is_training=phase_train)
e_4 = lrelu(e_4)
shortcuts.append(e_4) # 4 4 4 256
we5 = tf.get_variable("we5", shape=[4, 4, 4, 256, 512], initializer=tf.contrib.layers.xavier_initializer())
be5 = tf.get_variable("be5", shape=[512], initializer=tf.zeros_initializer())
e_5 = tf.nn.conv3d(e_4, we5, strides=[1,1,1,1,1], padding="VALID")
e_5 = tf.nn.bias_add(e_5, be5)
# d_2 = tf.contrib.layers.batch_norm(d_2, is_training=phase_train)
e_5 = lrelu(e_5) # 1 1 1 1024
for _ in shortcuts:
print(_)
return e_5, shortcuts
def refine_decoder(input, shortcuts, reuse = False):
strides = [1, 2, 2, 2, 1]
layer_id = 2
print(input)
batch_size = int(input.get_shape()[0])
with tf.variable_scope("refine_decoder", reuse=reuse):
input = tf.reshape(input, (batch_size, 1, 1, 1, 512))
wd = tf.get_variable("wd1", shape=[4, 4, 4, 256, 512],
initializer=tf.contrib.layers.xavier_initializer())
bd = tf.get_variable("bd1", shape=[256], initializer=tf.zeros_initializer())
d_1 = tf.nn.conv3d_transpose(input, wd, (batch_size, 4, 4, 4, 256), strides=[1, 1, 1, 1, 1], padding='VALID')
d_1 = tf.nn.bias_add(d_1, bd)
d_1 = tf.nn.relu(d_1)
d_1 = tf.add(d_1,shortcuts[4])
d_2 = residual_block(d_1, layer_id) # 8 8 8 128
layer_id += 1
d_2 = tf.add(d_2,shortcuts[3])
d_3 = residual_block(d_2, layer_id) # 16 16 16 64
layer_id += 1
d_3 = tf.add(d_3,shortcuts[2])
d_4 = residual_block(d_3, layer_id) # 32 32 32 32
layer_id += 1
d_4 = tf.add(d_4,shortcuts[1])
d_5 = residual_block(d_4, layer_id, 3, unpool=False)
layer_id += 1
last_channel = int(d_5.shape[-1])
print('d1', d_1)
print('d2', d_2)
print('d3', d_3)
print('d4', d_4)
print('d5', d_5)
wd = tf.get_variable("wd6", shape=[3, 3, 3, 2, last_channel],
initializer=tf.contrib.layers.xavier_initializer())
res = tf.nn.conv3d_transpose(d_5, wd, (batch_size, 32, 32, 32, 2), strides=[1, 1, 1, 1, 1], padding='SAME')
d_6 = res
res = tf.add(res, shortcuts[0])
res_softmax = tf.nn.softmax(res)
print('d6', res)
return res, res_softmax#,d_5,d_6
def scale_trans(st):
points = []
#dis = 1.5
focus = 138 * sqrt(3) / 2
dim = voxel_size
for i in range(dim):
for j in range(dim):
for k in range(dim):
points.append([1.0*i/dim - 0.5, 1.0*j/dim-0.5, 1.0*k/dim-0.5])
points = np.asarray(points)
#points[..., 2] += dis
# points[..., 0] += dis
#for i in range(2):
# points[..., i] *= focus
# points[..., i] /= points[..., 2]
batch = int(st.shape[0])
# points = Con(points)
# mask_indexs = []
# for i in range(batch):
# scale, transx, transy = st[i,0], st[i,1], st[i,2]
# tx = tf.round(tf.clip_by_value((points[...,2])*scale-transx+img_w/2,0,img_w-1))
# ty = img_w - 1 - tf.round(tf.clip_by_value((points[...,1])*scale+transy+img_w/2,0,img_w-1))
# t_id = ty * img_w + tx + i * img_w * img_h
# mask_indexs.append(t_id)
#
# ret = tf.stack(mask_indexs)
# total = 1
#
# for _ in ret.shape:
# total *= int(_)
#
# ret = tf.cast(tf.reshape(ret,[total]),dtype=tf.int32)
points = Con(points)
mask_indexs = []
for i in range(batch):
dis, transx, transy = st[i,0], st[i,1], st[i,2]
pointsz = points[..., 2] + dis
pointsx = (points[..., 0] * focus) / pointsz
pointsy = (points[..., 1] * focus) / pointsz
tx = tf.round(tf.clip_by_value((pointsx)-transx+img_w/2,0,img_w-1))
ty = tf.round(tf.clip_by_value((pointsy)-transy+img_w/2,0,img_w-1))
t_id = ty * img_w + tx + i * img_w * img_h
mask_indexs.append(t_id)
ret = tf.stack(mask_indexs)
total = 1
for _ in ret.shape:
total *= int(_)
ret = tf.cast(tf.reshape(ret,[total]),dtype=tf.int32)
return ret
def scale_trans_r2n2(st):
points = []
#dis = 1.5
# focus = 138 * sqrt(3) / 2
scale = 1
focus = 157.2275*scale
dim = voxel_size
for i in range(dim):
for j in range(dim):
for k in range(dim):
points.append([1.0*i/dim - 0.5, 1.0*j/dim-0.5, 1.0*k/dim-0.5])
points = np.asarray(points)
#points[..., 2] += dis
# points[..., 0] += dis
#for i in range(2):
# points[..., i] *= focus
# points[..., i] /= points[..., 2]
batch = int(st.shape[0])
# points = Con(points)
# mask_indexs = []
# for i in range(batch):
# scale, transx, transy = st[i,0], st[i,1], st[i,2]
# tx = tf.round(tf.clip_by_value((points[...,2])*scale-transx+img_w/2,0,img_w-1))
# ty = img_w - 1 - tf.round(tf.clip_by_value((points[...,1])*scale+transy+img_w/2,0,img_w-1))
# t_id = ty * img_w + tx + i * img_w * img_h
# mask_indexs.append(t_id)
#
# ret = tf.stack(mask_indexs)
# total = 1
#
# for _ in ret.shape:
# total *= int(_)
#
# ret = tf.cast(tf.reshape(ret,[total]),dtype=tf.int32)
points = Con(points)
mask_indexs = []
for i in range(batch):
dis, transx, transy = st[i,0], st[i,1], st[i,2]
pointsz = points[..., 2] + dis*scale
pointsx = (points[..., 0] * focus) / pointsz
pointsy = (points[..., 1] * focus) / pointsz
tx = tf.round(tf.clip_by_value((pointsx)-transx+img_w/2,0,img_w-1))
ty = tf.round(tf.clip_by_value((pointsy)-transy+img_w/2,0,img_w-1))
t_id = ty * img_w + tx + i * img_w * img_h
mask_indexs.append(t_id)
ret = tf.stack(mask_indexs)
total = 1
for _ in ret.shape:
total *= int(_)
ret = tf.cast(tf.reshape(ret,[total]),dtype=tf.int32)
return ret
def scale_trans_voc(st):
points = []
#dis = 1.5
scale = 0.5
focus = 138 * sqrt(3) * 10 * scale
dim = voxel_size
for i in range(dim):
for j in range(dim):
for k in range(dim):
points.append([1.0*i/dim - 0.5, 1.0*j/dim-0.5, 1.0*k/dim-0.5])
points = np.asarray(points)
#points[..., 2] += dis
# points[..., 0] += dis
#for i in range(2):
# points[..., i] *= focus
# points[..., i] /= points[..., 2]
batch = int(st.shape[0])
points = Con(points)
mask_indexs = []
for i in range(batch):
dis, transx, transy = st[i,0], st[i,1], st[i,2]
pointsz = points[..., 2] + dis*scale
pointsx = (points[..., 0] * focus) / pointsz
pointsy = (points[..., 1] * focus) / pointsz
tx = tf.round(tf.clip_by_value((pointsx)-transx+img_w/2,0,img_w-1))
ty = tf.round(tf.clip_by_value((pointsy)-transy+img_w/2,0,img_w-1))
t_id = ty * img_w + tx + i * img_w * img_h
mask_indexs.append(t_id)
ret = tf.stack(mask_indexs)
total = 1
for _ in ret.shape:
total *= int(_)
ret = tf.cast(tf.reshape(ret,[total]),dtype=tf.int32)
return ret
def rotate_mask_voc(mask, angles):
batch = int(angles.shape[0])
points = []
half = img_h/2.
for i in range(img_h):
for j in range(img_w):
points.append([1.0*i-half,1.0*j-half])
points = Con(np.asarray(points).transpose())
masks = []
for i in range(batch):
theta = 2*pi*angles[i, 2]
# theta = Con(pi)
R = tf.reshape(tf.stack([tf.cos(theta), -tf.sin(theta), tf.sin(theta), tf.cos(theta)]), [2, 2])
rotation = tf.cast(tf.clip_by_value(tf.round(tf.matmul(R, points) + half), 0, img_h - 1),
dtype=tf.int32)
# x.append(tf.reshape(rotation[0, ...], shape=[dim, dim, dim]))
# y.append(tf.reshape(rotation[1, ...], shape=[dim, dim, dim]))
# z.append(tf.reshape(rotation[2, ...], shape=[dim, dim, dim]))
x = rotation[0, ...]
y = rotation[1, ...]
index = x*img_h + y
data = tf.reshape(mask[i,...],[img_h*img_w])
new_mask = tf.gather(data, index)
masks.append(tf.reshape(new_mask,[img_w,img_h]))
masks = tf.stack(masks)
return masks
def cast(masks, mask_indexs, rotation_matrices):
dim = voxel_size
batch_size = int(masks.shape[0])
mask_shape = masks.shape
x,y,z = rotation(rotation_matrices)
total = 1
for _ in mask_shape:
total *= int(_)
masks = tf.reshape(masks, shape=[total])
data = tf.gather(masks, mask_indexs)
project_indexs = x*dim*dim+y*dim+z
project_indexs = tf.reshape(project_indexs, [int(project_indexs.shape[0])*int(project_indexs.shape[1])])
datas = tf.gather(data, project_indexs)
datas = tf.reshape(datas, [batch_size,dim,dim,dim])
return datas
def Con(val):
return tf.constant(val, dtype=np.float32)
def flip():
from binvox_rw import read_as_3d_array
from binvox_rw import Voxels
with open('model.binvox','rb') as fp:
vox = read_as_3d_array(fp)
data = vox.data
data = np.transpose(data,[2,1,0])
new_vox = Voxels(data,vox.dims,vox.translate)
with open('model_transpose.binvox','wb') as fp:
new_vox.write(fp)
def get_rotation_matrix(angles):
angles = 2*pi*angles
batch = int(angles.shape[0])
matrices = []
# for i in range(batch):
# #pitch, yaw, roll = angles[i, 1]+0.5*pi, angles[i, 2], -angles[i, 0]
# pitch, roll, yaw = -angles[i, 1]+pi, angles[i, 2], angles[i, 0]
# Rx = tf.reshape(tf.stack([Con(1),Con(0),Con(0), Con(0), tf.cos(roll), -tf.sin(roll), Con(0), tf.sin(roll), tf.cos(roll)]),[3,3])
# Ry = tf.reshape(tf.stack([tf.cos(pitch), Con(0), tf.sin(pitch), Con(0), Con(1), Con(0), -tf.sin(pitch), Con(0), tf.cos(pitch)]),[3,3])
# Rz = tf.reshape(tf.stack([tf.cos(yaw), -tf.sin(yaw), Con(0), tf.sin(yaw), tf.cos(yaw), Con(0), Con(0), Con(0), Con(1)]), [3,3])
# R = tf.matmul(Rz,tf.matmul(Ry,Rx))
# matrices.append(R)
for i in range(batch):
#pitch, yaw, roll = angles[i, 1]+0.5*pi, angles[i, 2], -angles[i, 0]
pitch, yaw, roll = angles[i, 1], angles[i, 2], angles[i, 0]
Rx = tf.reshape(tf.stack([Con(1),Con(0),Con(0), Con(0), tf.cos(roll), -tf.sin(roll), Con(0), tf.sin(roll), tf.cos(roll)]),[3,3])
Ry = tf.reshape(tf.stack([tf.cos(pitch), Con(0), tf.sin(pitch), Con(0), Con(1), Con(0), -tf.sin(pitch), Con(0), tf.cos(pitch)]),[3,3])
Rz = tf.reshape(tf.stack([tf.cos(yaw), -tf.sin(yaw), Con(0), tf.sin(yaw), tf.cos(yaw), Con(0), Con(0), Con(0), Con(1)]), [3,3])
R = tf.matmul(Rx, tf.matmul(Ry,Rz))
matrices.append(R)
matrices = tf.stack(matrices)
return matrices
def get_rotation_matrix_r2n2(angles):
angles = 2*pi*angles
batch = int(angles.shape[0])
matrices = []
# for i in range(batch):
# #pitch, yaw, roll = angles[i, 1]+0.5*pi, angles[i, 2], -angles[i, 0]
# pitch, roll, yaw = -angles[i, 1]+pi, angles[i, 2], angles[i, 0]
# Rx = tf.reshape(tf.stack([Con(1),Con(0),Con(0), Con(0), tf.cos(roll), -tf.sin(roll), Con(0), tf.sin(roll), tf.cos(roll)]),[3,3])
# Ry = tf.reshape(tf.stack([tf.cos(pitch), Con(0), tf.sin(pitch), Con(0), Con(1), Con(0), -tf.sin(pitch), Con(0), tf.cos(pitch)]),[3,3])
# Rz = tf.reshape(tf.stack([tf.cos(yaw), -tf.sin(yaw), Con(0), tf.sin(yaw), tf.cos(yaw), Con(0), Con(0), Con(0), Con(1)]), [3,3])
# R = tf.matmul(Rz,tf.matmul(Ry,Rx))
# matrices.append(R)
for i in range(batch):
#pitch, yaw, roll = angles[i, 1]+0.5*pi, angles[i, 2], -angles[i, 0]
pitch, yaw, roll = -angles[i, 1], angles[i, 2], angles[i, 0]
Rx = tf.reshape(tf.stack([Con(1),Con(0),Con(0), Con(0), tf.cos(roll), -tf.sin(roll), Con(0), tf.sin(roll), tf.cos(roll)]),[3,3])
Ry = tf.reshape(tf.stack([tf.cos(pitch), Con(0), tf.sin(pitch), Con(0), Con(1), Con(0), -tf.sin(pitch), Con(0), tf.cos(pitch)]),[3,3])
Rz = tf.reshape(tf.stack([tf.cos(yaw), -tf.sin(yaw), Con(0), tf.sin(yaw), tf.cos(yaw), Con(0), Con(0), Con(0), Con(1)]), [3,3])
R = tf.matmul(Rx, tf.matmul(Ry,Rz))
matrices.append(R)
matrices = tf.stack(matrices)
return matrices
def get_rotation_matrix_voc(angles):
angles = 2*pi*angles
batch = int(angles.shape[0])
matrices = []
# for i in range(batch):
# #pitch, yaw, roll = angles[i, 1]+0.5*pi, angles[i, 2], -angles[i, 0]
# pitch, roll, yaw = -angles[i, 1]+pi, angles[i, 2], angles[i, 0]
# Rx = tf.reshape(tf.stack([Con(1),Con(0),Con(0), Con(0), tf.cos(roll), -tf.sin(roll), Con(0), tf.sin(roll), tf.cos(roll)]),[3,3])
# Ry = tf.reshape(tf.stack([tf.cos(pitch), Con(0), tf.sin(pitch), Con(0), Con(1), Con(0), -tf.sin(pitch), Con(0), tf.cos(pitch)]),[3,3])
# Rz = tf.reshape(tf.stack([tf.cos(yaw), -tf.sin(yaw), Con(0), tf.sin(yaw), tf.cos(yaw), Con(0), Con(0), Con(0), Con(1)]), [3,3])
# R = tf.matmul(Rz,tf.matmul(Ry,Rx))
# matrices.append(R)
for i in range(batch):
#pitch, yaw, roll = angles[i, 1]+0.5*pi, angles[i, 2], -angles[i, 0]
pitch, yaw, roll = angles[i, 1], Con(0), angles[i, 0]
Rx = tf.reshape(tf.stack([Con(1),Con(0),Con(0), Con(0), tf.cos(roll), -tf.sin(roll), Con(0), tf.sin(roll), tf.cos(roll)]),[3,3])
Ry = tf.reshape(tf.stack([tf.cos(pitch), Con(0), tf.sin(pitch), Con(0), Con(1), Con(0), -tf.sin(pitch), Con(0), tf.cos(pitch)]),[3,3])
Rz = tf.reshape(tf.stack([tf.cos(yaw), -tf.sin(yaw), Con(0), tf.sin(yaw), tf.cos(yaw), Con(0), Con(0), Con(0), Con(1)]), [3,3])
R = tf.matmul(Rx, tf.matmul(Ry,Rz))
matrices.append(R)
matrices = tf.stack(matrices)
return matrices
def rotate_and_translate(R, st):
dim = voxel_size
batch = int(R.shape[0])
cords = []
for i in range(dim):
for j in range(dim):
for k in range(dim):
cords.append([1.0 * i / dim - 0.5, 1.0 * j / dim - 0.5, 1.0 * k / dim - 0.5])
cords = np.asarray(cords).transpose()
points = Con(cords)
cords = []
for i in range(batch):
dis, transx, transy = st[i, 0], st[i, 1], st[i, 2]
rotation = tf.matmul(R[i], points)
x = rotation[0, ...] - transx/dis
y = rotation[1, ...] - transy/dis
z = rotation[2, ...] + dis
rotation = tf.transpose(tf.stack([x,y,z],axis=0))
cords.append(rotation)
cords = tf.stack(cords,axis=0) # [batchsize, 32*32*32, 3]
cords = tf.reshape(cords,[batch,dim,dim,dim,3])
return cords
def DVX(visual_hull):
visual_hull = tf.expand_dims(visual_hull,axis=-1)
kernal = np.array([-1,1])
kx = Con(kernal.reshape([2,1,1,1,1]))
ky = Con(kernal.reshape([1,2,1,1,1]))
kz = Con(kernal.reshape([1,1,2,1,1]))
dx = tf.squeeze(tf.nn.conv3d(visual_hull,kx,[1,1,1,1,1],padding='SAME'))
dy = tf.squeeze(tf.nn.conv3d(visual_hull,ky,[1,1,1,1,1],padding='SAME'))
dz = tf.squeeze(tf.nn.conv3d(visual_hull,kz,[1,1,1,1,1],padding='SAME'))
res = tf.stack([dx,dy,dz],axis=-1)
return res
def rotation(R):
dim = voxel_size
batch = int(R.shape[0])
cords = []
for i in range(dim):
for j in range(dim):
for k in range(dim):
cords.append([1.0 * i / dim - 0.5, 1.0 * j / dim - 0.5, 1.0 * k / dim - 0.5])
cords = np.asarray(cords).transpose()
points = Con(cords)
x = []
y = []
z = []
for i in range(batch):
rotation = tf.cast(tf.clip_by_value(tf.round((tf.matmul(R[i], points) + 0.5) * dim), 0, dim-1), dtype=tf.int32)
# x.append(tf.reshape(rotation[0, ...], shape=[dim, dim, dim]))
# y.append(tf.reshape(rotation[1, ...], shape=[dim, dim, dim]))
# z.append(tf.reshape(rotation[2, ...], shape=[dim, dim, dim]))
x.append(rotation[0, ...])
y.append(rotation[1, ...])
z.append(rotation[2, ...] + i*dim*dim*dim)
x = tf.stack(x, axis=0)
y = tf.stack(y, axis=0)
z = tf.stack(z, axis=0)
return x, y, z | 38.669368 | 145 | 0.560292 | 3,914 | 23,859 | 3.289218 | 0.057997 | 0.022681 | 0.009088 | 0.022215 | 0.769069 | 0.739087 | 0.725882 | 0.715395 | 0.695122 | 0.691394 | 0 | 0.059937 | 0.255962 | 23,859 | 617 | 146 | 38.669368 | 0.665277 | 0.200763 | 0 | 0.561097 | 0 | 0 | 0.014069 | 0.0012 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047382 | false | 0 | 0.029925 | 0.004988 | 0.119701 | 0.022444 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c916039c778de52533ffcef4f07f40c8994886ac | 1,425 | py | Python | crpytography/tests/test_extended_euclidean.py | CheYulin/PythonStudy | 2b68a9cb2f7044d7e5ce9e7c971070eba7a36c07 | [
"MIT"
] | 3 | 2018-03-10T15:14:06.000Z | 2020-06-17T03:13:21.000Z | crpytography/tests/test_extended_euclidean.py | YcheLanguageStudio/PythonStudy | 2b68a9cb2f7044d7e5ce9e7c971070eba7a36c07 | [
"MIT"
] | null | null | null | crpytography/tests/test_extended_euclidean.py | YcheLanguageStudio/PythonStudy | 2b68a9cb2f7044d7e5ce9e7c971070eba7a36c07 | [
"MIT"
] | null | null | null | from crpyto_tool.libs.extended_euclidean import ExtendedGcdEuclidean
def gcd_euclidean(lhs, rhs):
if rhs == 0:
return lhs
else:
return gcd_euclidean(rhs, lhs % rhs)
def test_extended_gcd_euclidean(modulo_num, another_num):
extend_euclidean_algo = ExtendedGcdEuclidean(modulo_num=modulo_num, another_num=another_num)
for i in range(0, len(extend_euclidean_algo.iter_list) - 1):
print 'iter:' + str(extend_euclidean_algo.iter_list[i]) + '\t\tr:' + \
str(extend_euclidean_algo.r_list[i]) + '\t\tq:' + \
str(extend_euclidean_algo.q_list[i]) + '\t\tx:' + \
str(extend_euclidean_algo.x_list[i]) + '\t\ty:' + \
str(extend_euclidean_algo.y_list[i])
i = len(extend_euclidean_algo.iter_list) - 1
print 'iter:' + str(extend_euclidean_algo.iter_list[i]) + '\t\tr:' + \
str(extend_euclidean_algo.r_list[i]) + '\t\tq:' + \
str(extend_euclidean_algo.q_list[i])
print
if __name__ == '__main__':
print 'Demo gcd of 24 and 36 is:' + str(gcd_euclidean(24, 36)) + '\n'
test_extended_gcd_euclidean(1759, 550)
test_extended_gcd_euclidean(1137, 29)
test_extended_gcd_euclidean(37, 49)
test_extended_gcd_euclidean(49, 37)
extend_euclidean_algo = ExtendedGcdEuclidean(modulo_num=37, another_num=49)
print 'multiplicative inverse of 49 modulo 37 is:', extend_euclidean_algo.get_result()
| 39.583333 | 96 | 0.680702 | 203 | 1,425 | 4.418719 | 0.295567 | 0.217391 | 0.275362 | 0.19621 | 0.403567 | 0.403567 | 0.296544 | 0.296544 | 0.296544 | 0.296544 | 0 | 0.035777 | 0.195789 | 1,425 | 35 | 97 | 40.714286 | 0.746946 | 0 | 0 | 0.148148 | 0 | 0 | 0.086316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.037037 | null | null | 0.185185 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c94b6a4cb33ab5fa466bf7029de77a8906994174 | 614 | py | Python | backend/api/pages/schema.py | marcoacierno/pycon | 2b7b47598c4929769cc73e322b3fce2c89151e21 | [
"MIT"
] | 56 | 2018-01-20T17:18:40.000Z | 2022-03-28T22:42:04.000Z | backend/api/pages/schema.py | marcoacierno/pycon | 2b7b47598c4929769cc73e322b3fce2c89151e21 | [
"MIT"
] | 2,029 | 2018-01-20T11:37:24.000Z | 2022-03-31T04:10:51.000Z | backend/api/pages/schema.py | marcoacierno/pycon | 2b7b47598c4929769cc73e322b3fce2c89151e21 | [
"MIT"
] | 17 | 2018-03-17T09:44:28.000Z | 2021-12-27T19:57:35.000Z | from typing import List, Optional
import strawberry
from pages.models import Page
from .types import Page as PageType
@strawberry.type
class PagesQuery:
# TODO: use custom scalar for code and update custom gatsby source to use
# that instead of a generic argument called code
@strawberry.field
def pages(self, info, code: str) -> List[PageType]:
return Page.published_pages.filter(conference__code=code)
@strawberry.field
def page(self, info, code: str, slug: str) -> Optional[PageType]:
return Page.published_pages.by_slug(slug).filter(conference__code=code).first()
| 29.238095 | 87 | 0.736156 | 85 | 614 | 5.235294 | 0.529412 | 0.044944 | 0.085393 | 0.098876 | 0.14382 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180782 | 614 | 20 | 88 | 30.7 | 0.884692 | 0.192182 | 0 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 4 |
a31115356b96018e60afca528ddf4221cecc523c | 206 | py | Python | mmgen/models/architectures/cyclegan/__init__.py | plutoyuxie/mmgeneration | 0a7f5d16c970de1766ebf049d7a0264fe506504b | [
"Apache-2.0"
] | 718 | 2021-04-15T11:26:20.000Z | 2022-03-31T03:11:56.000Z | mmgen/models/architectures/cyclegan/__init__.py | plutoyuxie/mmgeneration | 0a7f5d16c970de1766ebf049d7a0264fe506504b | [
"Apache-2.0"
] | 191 | 2021-04-15T12:13:34.000Z | 2022-03-31T16:04:36.000Z | mmgen/models/architectures/cyclegan/__init__.py | plutoyuxie/mmgeneration | 0a7f5d16c970de1766ebf049d7a0264fe506504b | [
"Apache-2.0"
] | 107 | 2021-04-15T12:38:41.000Z | 2022-03-27T02:47:16.000Z | # Copyright (c) OpenMMLab. All rights reserved.
from .generator_discriminator import ResnetGenerator
from .modules import ResidualBlockWithDropout
__all__ = ['ResnetGenerator', 'ResidualBlockWithDropout']
| 34.333333 | 57 | 0.830097 | 18 | 206 | 9.222222 | 0.722222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097087 | 206 | 5 | 58 | 41.2 | 0.892473 | 0.218447 | 0 | 0 | 0 | 0 | 0.245283 | 0.150943 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
a31b0d5c0b00cc40081407526c98cfc9584e6351 | 10,249 | py | Python | durak.py | EliseevaIN/python_lesson_10 | e2422a6486b165a5ccaffc4fe0369493201c0bb8 | [
"MIT"
] | null | null | null | durak.py | EliseevaIN/python_lesson_10 | e2422a6486b165a5ccaffc4fe0369493201c0bb8 | [
"MIT"
] | null | null | null | durak.py | EliseevaIN/python_lesson_10 | e2422a6486b165a5ccaffc4fe0369493201c0bb8 | [
"MIT"
] | null | null | null | import random
class Durak:
def __init__(self, N):
self.order_num = N
self.order_cards_player_1_kozyr = []
self.order_cards_player_2_kozyr = []
def all_cards(self):
self.deck = [(6, '♥'), (7, '♥'), (8, '♥'), (9, '♥'), (10, '♥'), (11, '♥'), (12, '♥'), (13, '♥'), (14, '♥'),
(6, '♦'), (7, '♦'), (8, '♦'), (9, '♦'), (10, '♦'), (11, '♦'), (12, '♦'), (13, '♦'), (14, '♦'),
(6, '♣'), (7, '♣'), (8, '♣'), (9, '♣'), (10, '♣'), (11, '♣'), (12, '♣'), (13, '♣'), (14, '♣'),
(6, '♠'), (7, '♠'), (8, '♠'), (9, '♠'), (10, '♠'), (11, '♠'), (12, '♠'), (13, '♠'), (14, '♠')]
hand_player_1 = []
hand_player_2 = []
for i in range(6):
player_1_card = random.choice(self.deck)
hand_player_1.append(player_1_card)
self.deck.remove(player_1_card)
player_2_card = random.choice(self.deck)
hand_player_2.append(player_2_card)
self.deck.remove(player_2_card)
self.player_1_cards = hand_player_1
self.player_2_cards = hand_player_2
self.player_1_cards.sort()
self.player_2_cards.sort()
kozyr_card = random.choice(self.deck)
self.kozyr = kozyr_card[1]
random.shuffle(self.deck)
self.list_bito = []
print('карты 1-го игрока:', len(self.player_1_cards), self.player_1_cards)
print('карты 2-го игрока:', len(self.player_2_cards), self.player_2_cards)
print('карт в колоде:', len(self.deck))
print('козырь:', self.kozyr)
def bito(self, x, y):
self.list_bito.append(x)
self.list_bito.append(y)
self.list_bito.sort()
def dobor(self):
if len(self.deck) > 0 and len(self.player_1_cards) < 6:
self.next_card = self.deck[0]
self.deck.remove(self.next_card)
self.player_1_cards.append(self.next_card)
print('первый игрок взял карту из колоды {}, в колоде {} карт'.format(self.next_card, len(self.deck)))
if len(self.deck) > 0 and len(self.player_2_cards) < 6:
self.next_card = self.deck[0]
self.deck.remove(self.next_card)
self.player_2_cards.append(self.next_card)
print('второй игрок взял карту из колоды {}, в колоде {} карт'.format(self.next_card, len(self.deck)))
self.player_1_cards.sort()
self.player_2_cards.sort()
self.order_cards_player_1_not_kozyr = [x for x in self.player_1_cards if x[1]!=self.kozyr]
self.order_cards_player_1_not_kozyr.sort()
self.order_cards_player_1_kozyr = [x for x in self.player_1_cards if x[1]==self.kozyr]
self.order_cards_player_1_kozyr.sort()
self.order_cards_player_2_not_kozyr = [x for x in self.player_2_cards if x[1]!=self.kozyr]
self.order_cards_player_2_not_kozyr.sort()
self.order_cards_player_2_kozyr = [x for x in self.player_2_cards if x[1]==self.kozyr]
self.order_cards_player_2_kozyr.sort()
def order_cards(self):
w = 0
for i in range(1, self.order_num):
if w==0:
self.dobor()
if len(self.order_cards_player_1_not_kozyr) > 0:
order_cards_player_1 = self.order_cards_player_1_not_kozyr[0]
else:
order_cards_player_1 = self.order_cards_player_1_kozyr[0]
order_cards_player_1_suit = order_cards_player_1[1]
order_cards_player_1_digit = order_cards_player_1[0]
print('ход первого игрока:', order_cards_player_1)
hand_player_2_suit = [x for x in self.player_2_cards if x[1]==order_cards_player_1_suit]
hand_player_2_suit_higher = [x for x in hand_player_2_suit if x[0] > order_cards_player_1_digit]
if len(hand_player_2_suit_higher) + len(self.order_cards_player_2_kozyr)==0:
self.player_2_cards.append(order_cards_player_1)
print('второй игрок взял')
self.player_1_cards.remove(order_cards_player_1)
self.dobor()
w = 0
elif order_cards_player_1_suit==self.kozyr and order_cards_player_1[0] > \
self.order_cards_player_2_kozyr[-1][0]:
self.player_2_cards.append(order_cards_player_1)
print('второй игрок взял')
self.player_1_cards.remove(order_cards_player_1)
self.dobor()
w = 0
elif order_cards_player_1_suit==self.kozyr and order_cards_player_1[0] < \
self.order_cards_player_2_kozyr[-1][0]:
self.m = 3
if self.m <= (len(self.order_cards_player_2_kozyr) - 1):
order_cards_player_2 = self.order_cards_player_2_kozyr[self.m]
print('ход второго игрока:', order_cards_player_2)
self.bito(order_cards_player_1, order_cards_player_2)
print('бито')
self.dobor()
w = 1
elif len(hand_player_2_suit_higher)==0 and len(self.order_cards_player_2_kozyr) > 0:
print('ход второго игрока:', self.order_cards_player_2_kozyr[0])
order_cards_player_2 = self.order_cards_player_2_kozyr[0]
self.player_1_cards.remove(order_cards_player_1)
self.player_2_cards.remove(order_cards_player_2)
self.bito(order_cards_player_1, order_cards_player_2)
print('бито')
self.dobor()
w = 1
else:
print('ход второго игрока:', hand_player_2_suit_higher[0])
order_cards_player_2 = hand_player_2_suit_higher[0]
self.player_1_cards.remove(order_cards_player_1)
self.player_2_cards.remove(order_cards_player_2)
self.bito(order_cards_player_1, order_cards_player_2)
print('бито')
self.dobor()
w = 1
print('карты 1-го игрока после {} хода:'.format(i), len(self.player_1_cards), self.player_1_cards)
print('карты 2-го игрока после {} хода:'.format(i), len(self.player_2_cards), self.player_2_cards)
if w==1:
self.dobor()
if len(self.order_cards_player_2_not_kozyr) > 0:
order_cards_player_2 = self.order_cards_player_2_not_kozyr[0]
else:
order_cards_player_2 = self.order_cards_player_2_kozyr[0]
order_cards_player_2_suit = order_cards_player_2[1]
order_cards_player_2_digit = order_cards_player_2[0]
print('ход второго игрока:', order_cards_player_2)
hand_player_1_suit = [x for x in self.player_1_cards if x[1]==order_cards_player_2_suit]
hand_player_1_suit_higher = [x for x in hand_player_1_suit if x[0] > order_cards_player_2_digit]
if len(hand_player_1_suit_higher) + len(self.order_cards_player_1_kozyr)==0:
self.player_1_cards.append(order_cards_player_2)
self.player_2_cards.remove(order_cards_player_2)
print('первый игрок взял')
self.dobor()
w = 1
elif order_cards_player_2_suit==self.kozyr and order_cards_player_2[0] > \
self.order_cards_player_1_kozyr[-1][0]:
self.player_1_cards.append(order_cards_player_2)
self.player_2_cards.remove(order_cards_player_2)
print('первый игрок взял')
self.dobor()
w = 1
elif order_cards_player_2_suit==self.kozyr and order_cards_player_2[0] < \
self.order_cards_player_1_kozyr[-1][0]:
print('ход первого игрока:', self.order_cards_player_1_kozyr[-1])
order_cards_player_1 = self.order_cards_player_1_kozyr[-1]
self.player_1_cards.remove(order_cards_player_1)
self.player_2_cards.remove(order_cards_player_2)
self.bito(order_cards_player_1, order_cards_player_2)
print('бито')
self.dobor()
w = 0
elif len(hand_player_1_suit_higher)==0 and len(self.order_cards_player_1_kozyr) > 0:
print('ход первого игрока:', self.order_cards_player_1_kozyr[0])
order_cards_player_1 = self.order_cards_player_1_kozyr[0]
self.player_1_cards.remove(order_cards_player_1)
self.player_2_cards.remove(order_cards_player_2)
self.bito(order_cards_player_1, order_cards_player_2)
print('бито')
self.dobor()
w = 0
else:
print('ход первого игрока:', hand_player_1_suit_higher[0])
order_cards_player_1 = hand_player_1_suit_higher[0]
self.player_1_cards.remove(order_cards_player_1)
self.player_2_cards.remove(order_cards_player_2)
self.bito(order_cards_player_1, order_cards_player_2)
print('бито')
self.dobor()
w = 0
print('карты 1-го игрока после {} хода:'.format(i), len(self.player_1_cards), self.player_1_cards)
print('карты 2-го игрока после {} хода:'.format(i), len(self.player_2_cards), self.player_2_cards)
if len(self.player_1_cards)==0 and len(self.player_2_cards)==0:
print('ничья')
break
elif len(self.player_1_cards)==0:
print('1-й игрок победил')
break
elif len(self.player_2_cards)==0:
print('2-й игрок победил')
break
if __name__=='__main__':
cards_game = Durak(25)
cards_game.all_cards()
cards_game.order_cards() | 54.515957 | 115 | 0.566592 | 1,416 | 10,249 | 3.739407 | 0.063559 | 0.183192 | 0.287063 | 0.154108 | 0.868744 | 0.809065 | 0.741832 | 0.661945 | 0.61813 | 0.581303 | 0 | 0.044916 | 0.324422 | 10,249 | 188 | 116 | 54.515957 | 0.714616 | 0 | 0 | 0.475138 | 0 | 0 | 0.060488 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.027624 | false | 0 | 0.005525 | 0 | 0.038674 | 0.171271 | 0 | 0 | 0 | null | 0 | 1 | 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 | 4 |
a31f177be72c9aecb8703762a4e268e2caa6a2b9 | 142 | py | Python | nodenet/python/nodenet/variables/commons.py | NOOXY-research/NodeNet | 8bf7e0c2fd0e4fae4a51b2900014004728f3c935 | [
"Apache-2.0"
] | 2 | 2018-01-31T05:52:23.000Z | 2020-08-07T19:14:18.000Z | nodenet/python/nodenet/variables/commons.py | NOOXY-research/NodeNet | 8bf7e0c2fd0e4fae4a51b2900014004728f3c935 | [
"Apache-2.0"
] | 1 | 2017-11-22T09:39:50.000Z | 2017-11-22T09:39:50.000Z | nodenet/python/nodenet/variables/commons.py | magneticchen/NodeNet | 8bf7e0c2fd0e4fae4a51b2900014004728f3c935 | [
"Apache-2.0"
] | null | null | null | # nodenet/learningalgorithm/commons.py
# Description:
# "commons.py" provide commons parameters.
# Copyright 2018 NOOXY. All Rights Reserved.
| 28.4 | 44 | 0.788732 | 16 | 142 | 7 | 0.8125 | 0.160714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031746 | 0.112676 | 142 | 4 | 45 | 35.5 | 0.857143 | 0.93662 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
a367b6e024cd989143ca6125c6e71d6900e674fd | 65 | py | Python | feathr_project/feathr/constants.py | tarockey/feathr | 50e8a6d2b3f6230f49d46a78e9b4ab49d32a8282 | [
"Apache-2.0"
] | null | null | null | feathr_project/feathr/constants.py | tarockey/feathr | 50e8a6d2b3f6230f49d46a78e9b4ab49d32a8282 | [
"Apache-2.0"
] | null | null | null | feathr_project/feathr/constants.py | tarockey/feathr | 50e8a6d2b3f6230f49d46a78e9b4ab49d32a8282 | [
"Apache-2.0"
] | null | null | null | OUTPUT_PATH_TAG = "output_path"
REDIS_PASSWORD = 'REDIS_PASSWORD' | 32.5 | 33 | 0.830769 | 9 | 65 | 5.444444 | 0.555556 | 0.408163 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 65 | 2 | 33 | 32.5 | 0.816667 | 0 | 0 | 0 | 0 | 0 | 0.378788 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
a37b7f120979cb0042c4fc584559227a210079b8 | 159 | py | Python | pyf/_tmpnam.py | snoopyjc/pythonizer | 6b3683084f41f0aa06b1b4e652a0f00b19cceac1 | [
"Artistic-2.0"
] | 1 | 2022-03-13T22:08:25.000Z | 2022-03-13T22:08:25.000Z | pyf/_tmpnam.py | snoopyjc/pythonizer | 6b3683084f41f0aa06b1b4e652a0f00b19cceac1 | [
"Artistic-2.0"
] | 21 | 2022-03-17T16:53:04.000Z | 2022-03-31T23:55:24.000Z | pyf/_tmpnam.py | snoopyjc/pythonizer | 6b3683084f41f0aa06b1b4e652a0f00b19cceac1 | [
"Artistic-2.0"
] | null | null | null |
def _tmpnam():
"""Implementation of POSIX tmpnam() in list context"""
ntf = tempfile.NamedTemporaryFile(delete=False)
return (ntf, ntf.name)
| 26.5 | 59 | 0.666667 | 18 | 159 | 5.833333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207547 | 159 | 5 | 60 | 31.8 | 0.833333 | 0.301887 | 0 | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 4 |
6e63495d923d9b0728e81a2d00b38f9c002f92d3 | 136 | py | Python | djajax/apps.py | adamghill/djajax | 33fbb8afa7df59fd3c24875c61a7bbd7f6a7c809 | [
"MIT"
] | 2 | 2020-01-26T11:45:25.000Z | 2021-01-31T21:24:36.000Z | djajax/apps.py | adamghill/djajax | 33fbb8afa7df59fd3c24875c61a7bbd7f6a7c809 | [
"MIT"
] | 1 | 2020-04-25T04:08:06.000Z | 2020-04-25T13:27:56.000Z | djajax/apps.py | adamghill/djajax | 33fbb8afa7df59fd3c24875c61a7bbd7f6a7c809 | [
"MIT"
] | 2 | 2020-01-30T16:11:40.000Z | 2020-01-30T16:23:46.000Z | from django.apps import AppConfig
class DjajaxConfig(AppConfig):
name = 'djajax'
label = 'djajax'
verbose_name = "djajax"
| 17 | 33 | 0.691176 | 15 | 136 | 6.2 | 0.733333 | 0.215054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.213235 | 136 | 7 | 34 | 19.428571 | 0.869159 | 0 | 0 | 0 | 0 | 0 | 0.132353 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
6e9eeec3387d82efbd78612e3612ae770e8c99a7 | 251 | py | Python | pinto/pinto/admin/schema.py | wwitzel3/pinto | 8114a733fb8ccaf9b030c64727f626c24ffe5788 | [
"MIT"
] | 3 | 2015-01-24T14:35:50.000Z | 2016-07-06T10:04:50.000Z | pinto/pinto/admin/schema.py | wwitzel3/pinto | 8114a733fb8ccaf9b030c64727f626c24ffe5788 | [
"MIT"
] | null | null | null | pinto/pinto/admin/schema.py | wwitzel3/pinto | 8114a733fb8ccaf9b030c64727f626c24ffe5788 | [
"MIT"
] | null | null | null | import colander as c
class Settings(c.MappingSchema):
title = c.SchemaNode(c.String(), if_missing='Blog')
subtitle = c.SchemaNode(c.String(), if_missing='This is my blog.')
email = c.SchemaNode(c.String(), if_missing='user@example.com')
| 31.375 | 70 | 0.701195 | 37 | 251 | 4.675676 | 0.567568 | 0.190751 | 0.208092 | 0.312139 | 0.468208 | 0.468208 | 0 | 0 | 0 | 0 | 0 | 0 | 0.139442 | 251 | 7 | 71 | 35.857143 | 0.800926 | 0 | 0 | 0 | 0 | 0 | 0.144 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
6eb007b69d18d86aa6850776187cdb5a9b197b45 | 91 | py | Python | tweethread/__main__.py | rcurtiss/tweethread | 8c3d6fcd1c2a28081af2fb9d2798148544f67c0a | [
"MIT"
] | 2 | 2017-06-24T23:11:48.000Z | 2018-11-13T09:12:30.000Z | tweethread/__main__.py | rcurtiss/tweethread | 8c3d6fcd1c2a28081af2fb9d2798148544f67c0a | [
"MIT"
] | null | null | null | tweethread/__main__.py | rcurtiss/tweethread | 8c3d6fcd1c2a28081af2fb9d2798148544f67c0a | [
"MIT"
] | null | null | null | '''Tweethread main module'''
from .core import main
if __name__ == '__main__':
main()
| 15.166667 | 28 | 0.659341 | 11 | 91 | 4.727273 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186813 | 91 | 5 | 29 | 18.2 | 0.702703 | 0.241758 | 0 | 0 | 0 | 0 | 0.126984 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
6eb08b3f2e39493af696fa7e67eef2e618b78e35 | 106 | py | Python | tests/__init__.py | GeorgianBadita/Dronem-gym-envirnoment | f3b488f6a4b55722c4b129051555a68d7775278c | [
"MIT"
] | 5 | 2020-06-13T10:43:42.000Z | 2022-01-25T10:37:32.000Z | tests/__init__.py | GeorgianBadita/Dronem-gym-envirnoment | f3b488f6a4b55722c4b129051555a68d7775278c | [
"MIT"
] | null | null | null | tests/__init__.py | GeorgianBadita/Dronem-gym-envirnoment | f3b488f6a4b55722c4b129051555a68d7775278c | [
"MIT"
] | null | null | null | """
@author: Badita Marin-Georgian
@email: geo.badita@gmail.com
@date: 20.03.2020 00:48
""" | 21.2 | 34 | 0.59434 | 15 | 106 | 4.2 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146341 | 0.226415 | 106 | 5 | 35 | 21.2 | 0.621951 | 0.811321 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
6e1c4ff00c22e51d27ab6c210b50cb1835a70c26 | 182 | py | Python | src/engbook/asgi.py | ankurmonga7/scrum-2 | 4b0df1af8a61410eaaaf08c66c7c5f8b0c20fe01 | [
"MIT"
] | 8 | 2020-06-09T21:55:03.000Z | 2021-10-06T04:00:01.000Z | src/engbook/asgi.py | ankurmonga7/scrum-2 | 4b0df1af8a61410eaaaf08c66c7c5f8b0c20fe01 | [
"MIT"
] | 25 | 2020-06-12T04:03:06.000Z | 2022-03-12T00:31:22.000Z | src/engbook/asgi.py | ankurmonga7/scrum-2 | 4b0df1af8a61410eaaaf08c66c7c5f8b0c20fe01 | [
"MIT"
] | 29 | 2020-06-07T10:54:20.000Z | 2021-03-22T14:02:16.000Z | import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'engbook.settings.prod_settings')
application = get_asgi_application()
| 22.75 | 81 | 0.835165 | 24 | 182 | 6.041667 | 0.583333 | 0.096552 | 0.248276 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 182 | 7 | 82 | 26 | 0.863095 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
6e348f2b6cc7fd260434729e46481bb936284826 | 103 | py | Python | vedaseg/datasets/transforms/registry.py | E18301194/vedaseg | c62c8ea46dbba12f03262452dd7bed22969cfe4e | [
"Apache-2.0"
] | 2 | 2020-07-15T02:36:46.000Z | 2021-03-08T03:18:26.000Z | vedaseg/datasets/transforms/registry.py | E18301194/vedaseg | c62c8ea46dbba12f03262452dd7bed22969cfe4e | [
"Apache-2.0"
] | null | null | null | vedaseg/datasets/transforms/registry.py | E18301194/vedaseg | c62c8ea46dbba12f03262452dd7bed22969cfe4e | [
"Apache-2.0"
] | null | null | null | from vedaseg.utils import Registry
import albumentations as albu
TRANSFORMS = Registry('transforms')
| 17.166667 | 35 | 0.815534 | 12 | 103 | 7 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126214 | 103 | 5 | 36 | 20.6 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0.097087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
281e6298cb642481c45079fad95a610148b0fe5b | 157 | py | Python | scripts/tokenize.py | hannandarryl/MultilingualWordEmbeddings | ea1eaedee2bfd3803b32851a968fa1d39ba3f069 | [
"Apache-2.0"
] | null | null | null | scripts/tokenize.py | hannandarryl/MultilingualWordEmbeddings | ea1eaedee2bfd3803b32851a968fa1d39ba3f069 | [
"Apache-2.0"
] | null | null | null | scripts/tokenize.py | hannandarryl/MultilingualWordEmbeddings | ea1eaedee2bfd3803b32851a968fa1d39ba3f069 | [
"Apache-2.0"
] | null | null | null | # Tokenize All 6 Files
import sentencepiece as spm
spm.SentencePieceTrainer.Train('--input=../data/UNv1.0.6way.train --model_prefix=enfr --vocabsize=8000') | 31.4 | 104 | 0.770701 | 22 | 157 | 5.454545 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 0.082803 | 157 | 5 | 104 | 31.4 | 0.777778 | 0.127389 | 0 | 0 | 0 | 0 | 0.514706 | 0.242647 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.