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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
914442723de38fc2b2b058fb0af61bdd53a80d4f
| 200
|
py
|
Python
|
lightly/active_learning/config/__init__.py
|
CodeGuy-007/lightly
|
64143fe8a477c04288009c65fa1265cef8aa48f8
|
[
"MIT"
] | null | null | null |
lightly/active_learning/config/__init__.py
|
CodeGuy-007/lightly
|
64143fe8a477c04288009c65fa1265cef8aa48f8
|
[
"MIT"
] | null | null | null |
lightly/active_learning/config/__init__.py
|
CodeGuy-007/lightly
|
64143fe8a477c04288009c65fa1265cef8aa48f8
|
[
"MIT"
] | null | null | null |
""" Collection of Selection Configurations """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.active_learning.config.selection_config import SelectionConfig
| 28.571429
| 75
| 0.8
| 24
| 200
| 6.583333
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022857
| 0.125
| 200
| 6
| 76
| 33.333333
| 0.88
| 0.555
| 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
| 1
| 0
|
0
| 5
|
91535036315a422454bbdc67ea91a5fbd0b8c4af
| 1,940
|
py
|
Python
|
tests/test_table.py
|
wireservice/agate-stats
|
859cfbe6e9a11b175acb14d6e97e08719ec4c673
|
[
"MIT"
] | 4
|
2016-09-25T10:53:32.000Z
|
2022-01-25T00:03:09.000Z
|
tests/test_table.py
|
wireservice/agate-stats
|
859cfbe6e9a11b175acb14d6e97e08719ec4c673
|
[
"MIT"
] | 11
|
2016-02-21T01:39:23.000Z
|
2020-08-21T03:26:34.000Z
|
tests/test_table.py
|
wireservice/agate-stats
|
859cfbe6e9a11b175acb14d6e97e08719ec4c673
|
[
"MIT"
] | 4
|
2016-02-22T16:10:14.000Z
|
2017-10-09T04:06:45.000Z
|
#!/usr/bin/env python
# -*- coding: utf8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
import agate
import agatestats
class TestTable(unittest.TestCase):
def setUp(self):
self.rows = (
(1, 4, 'a'),
(2, 3, 'b'),
(None, 2, u'👍')
)
self.column_names = ['one', 'two', 'three']
self.column_types = [agate.Number(), agate.Number(), agate.Text()]
def test_stdev_outliers(self):
rows = [
(50, 4, 'a'),
] * 10
rows.append((200, 1, 'b'))
table = agate.Table(rows, self.column_names, self.column_types)
new_table = table.stdev_outliers('one')
self.assertEqual(len(new_table.rows), 10)
self.assertNotIn(200, new_table.columns['one'])
def test_stdev_outliers_reject(self):
rows = [
(50, 4, 'a'),
] * 10
rows.append((200, 1, 'b'))
table = agate.Table(rows, self.column_names, self.column_types)
new_table = table.stdev_outliers('one', reject=True)
self.assertEqual(len(new_table.rows), 1)
self.assertSequenceEqual(new_table.columns['one'], (200,))
def test_mad_outliers(self):
rows = [
(50, 4, 'a'),
] * 10
rows.append((200, 1, 'b'))
table = agate.Table(rows, self.column_names, self.column_types)
new_table = table.mad_outliers('one')
self.assertEqual(len(new_table.rows), 10)
self.assertNotIn(200, new_table.columns['one'])
def test_mad_outliers_reject(self):
rows = [
(50, 4, 'a'),
] * 10
rows.append((200, 1, 'b'))
table = agate.Table(rows, self.column_names, self.column_types)
new_table = table.mad_outliers('one', reject=True)
self.assertEqual(len(new_table.rows), 1)
self.assertSequenceEqual(new_table.columns['one'], (200,))
| 24.871795
| 74
| 0.566495
| 239
| 1,940
| 4.451883
| 0.23431
| 0.090226
| 0.070489
| 0.041353
| 0.740602
| 0.740602
| 0.740602
| 0.740602
| 0.740602
| 0.740602
| 0
| 0.043728
| 0.280928
| 1,940
| 77
| 75
| 25.194805
| 0.71828
| 0.021134
| 0
| 0.54902
| 0
| 0
| 0.024249
| 0
| 0
| 0
| 0
| 0
| 0.156863
| 1
| 0.098039
| false
| 0
| 0.098039
| 0
| 0.215686
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
e6823f6b89bf32dac78df592ae747c86e5138cf7
| 45
|
py
|
Python
|
elfinder/tests/__init__.py
|
vikifox/CMDB
|
bac9b7da204c3eee344f55bb2187df38ef3b3d4c
|
[
"Apache-2.0"
] | 16
|
2020-08-13T04:28:50.000Z
|
2021-06-10T06:24:51.000Z
|
elfinder/tests/__init__.py
|
ppetrid/yawd-elfinder
|
955d39c8194ee61f1e24f5cd5e4530bb0e6e9b3c
|
[
"BSD-3-Clause"
] | 2
|
2016-02-14T23:53:28.000Z
|
2016-12-09T21:15:14.000Z
|
elfinder/tests/__init__.py
|
ppetrid/yawd-elfinder
|
955d39c8194ee61f1e24f5cd5e4530bb0e6e9b3c
|
[
"BSD-3-Clause"
] | 24
|
2015-03-25T11:03:01.000Z
|
2018-12-04T10:14:11.000Z
|
from connector import *
from volumes import *
| 22.5
| 23
| 0.8
| 6
| 45
| 6
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.155556
| 45
| 2
| 24
| 22.5
| 0.947368
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
e691f9329b61af3ba582d8ad0239074bd93c7f22
| 1,035
|
py
|
Python
|
Calculator/Calculator_Class.py
|
KevinNourian/Calculator
|
f959d66e267e699a20f15539eeb1aaaa92b0e88f
|
[
"MIT"
] | null | null | null |
Calculator/Calculator_Class.py
|
KevinNourian/Calculator
|
f959d66e267e699a20f15539eeb1aaaa92b0e88f
|
[
"MIT"
] | null | null | null |
Calculator/Calculator_Class.py
|
KevinNourian/Calculator
|
f959d66e267e699a20f15539eeb1aaaa92b0e88f
|
[
"MIT"
] | null | null | null |
class Calculator:
def __init__(self, memory):
self.memory = memory
def add(self, num):
"""Adds an integer to number in the memory."""
self.memory = self.memory + num
def sub(self, num):
"""Subtracts an integer to number in the memory."""
self.memory = self.memory - num
def mult(self, num):
"""Adds an integer to number in the memory."""
self.memory = self.memory * num
def div(self, num):
"""Divides the number in memory by an integer."""
self.memory = self.memory / num
def root(self, root):
"""Takes the (n) root of the number in the memory."""
self.memory = self.memory**(1/root)
def get_result(self):
"""Returns the memory content."""
return self.memory
def clear_memory(self):
"""Sets the memory to 0."""
self.memory = 0
return self.memory
def set_memory(self, num):
"""Sets the memory to the integer provided by user."""
self.memory = num
| 27.236842
| 62
| 0.577778
| 140
| 1,035
| 4.221429
| 0.264286
| 0.270728
| 0.270728
| 0.203046
| 0.417936
| 0.417936
| 0.373942
| 0.373942
| 0.311337
| 0.311337
| 0
| 0.004149
| 0.301449
| 1,035
| 37
| 63
| 27.972973
| 0.813278
| 0.307246
| 0
| 0.1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.45
| false
| 0
| 0
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
e6aadf04f11aa7059b20b0fc170e6b62a8b7ba11
| 427
|
py
|
Python
|
autotest/test_002.py
|
pygsflow/pygsflow
|
83860cd58078017a65e1633b1192469777f1ce15
|
[
"CC0-1.0",
"BSD-3-Clause"
] | 17
|
2019-11-11T02:49:29.000Z
|
2022-02-17T03:45:19.000Z
|
autotest/test_002.py
|
jonathanqv/pygsflow
|
d671fdd84245ecb421a0fcab17a578425b514e93
|
[
"Unlicense"
] | 21
|
2019-07-10T21:45:11.000Z
|
2022-02-22T17:57:20.000Z
|
autotest/test_002.py
|
jonathanqv/pygsflow
|
d671fdd84245ecb421a0fcab17a578425b514e93
|
[
"Unlicense"
] | 8
|
2019-11-11T02:49:36.000Z
|
2021-09-30T18:43:45.000Z
|
# test the instantiation of empty classes
import gsflow
def test_import_classes():
from gsflow import ParameterRecord
from gsflow import ControlRecord
from gsflow import PrmsParameters
from gsflow import PrmsData
from gsflow import PrmsModel
from gsflow.modflow import Modflow
from gsflow import ControlFile
from gsflow import GsflowModel
if __name__ == "__main__":
test_import_classes()
| 25.117647
| 41
| 0.76815
| 51
| 427
| 6.196078
| 0.411765
| 0.253165
| 0.35443
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.203747
| 427
| 16
| 42
| 26.6875
| 0.929412
| 0.091335
| 0
| 0
| 0
| 0
| 0.020725
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.083333
| true
| 0
| 0.916667
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
e6c473779522a1596345e9aa71e315e4bb1cfc82
| 46
|
py
|
Python
|
mytrading/__init__.py
|
joeledwardson/betfair-browser
|
b641f134e60307250a0e51bafa849422ecf5264b
|
[
"MIT"
] | 3
|
2021-11-23T19:03:02.000Z
|
2021-11-24T08:44:23.000Z
|
mytrading/__init__.py
|
joeledwardson/betfair-browser
|
b641f134e60307250a0e51bafa849422ecf5264b
|
[
"MIT"
] | 2
|
2021-11-23T18:47:31.000Z
|
2021-12-08T15:36:11.000Z
|
mytrading/__init__.py
|
joeledwardson/betfair-browser
|
b641f134e60307250a0e51bafa849422ecf5264b
|
[
"MIT"
] | null | null | null |
# register strategies
from . import strategies
| 23
| 24
| 0.826087
| 5
| 46
| 7.6
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 46
| 2
| 24
| 23
| 0.95
| 0.413043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
fc1d60359ffbed0fa5ceeb354e9cc58c38b66994
| 286
|
py
|
Python
|
src/proj/settings/__init__.py
|
MostafaTaheri/django_boilerplate
|
fb167b1289a8023a9b8ec6de5a67a280c2041942
|
[
"MIT"
] | 4
|
2020-10-10T15:45:28.000Z
|
2020-10-29T17:25:18.000Z
|
src/proj/settings/__init__.py
|
MostafaTaheri/django_boilerplate
|
fb167b1289a8023a9b8ec6de5a67a280c2041942
|
[
"MIT"
] | 21
|
2020-10-04T08:20:06.000Z
|
2021-07-31T07:16:50.000Z
|
src/proj/settings/__init__.py
|
MostafaTaheri/django_boilerplate
|
fb167b1289a8023a9b8ec6de5a67a280c2041942
|
[
"MIT"
] | 3
|
2020-10-04T08:28:08.000Z
|
2021-07-25T07:14:26.000Z
|
# Try to activate local settings. If it fails, assume we're on production and
# activate production settings. Note that local.py shouldn't be tracked in the
# repository.
try:
from .local import * # noqa: F401, F403
except ImportError:
from .prod import * # noqa: F401, F403
| 31.777778
| 78
| 0.72028
| 43
| 286
| 4.790698
| 0.744186
| 0.097087
| 0.135922
| 0.174757
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.052632
| 0.202797
| 286
| 8
| 79
| 35.75
| 0.850877
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
fc41166d966d42dc9d49aee4bee14879da1c4720
| 65
|
py
|
Python
|
services/patient/api/controllers/__init__.py
|
gochronicles/monorepo-fastapi-neo4j
|
f71ba6d842d731cecf24eca8a8791a2108e90556
|
[
"MIT"
] | 1
|
2021-11-18T15:17:15.000Z
|
2021-11-18T15:17:15.000Z
|
services/patient/api/controllers/__init__.py
|
gochronicles/monorepo-fastapi-neo4j
|
f71ba6d842d731cecf24eca8a8791a2108e90556
|
[
"MIT"
] | null | null | null |
services/patient/api/controllers/__init__.py
|
gochronicles/monorepo-fastapi-neo4j
|
f71ba6d842d731cecf24eca8a8791a2108e90556
|
[
"MIT"
] | null | null | null |
from api.controllers.patient_controller import PatientController
| 32.5
| 64
| 0.907692
| 7
| 65
| 8.285714
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.061538
| 65
| 1
| 65
| 65
| 0.95082
| 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
| 1
| 0
|
0
| 5
|
fc63212149ad6e63c12842a776af9ca0260d839b
| 54
|
py
|
Python
|
tests/components_to_test/utils/__init__.py
|
RichardoLuo/ColossalAI
|
797a9dc5a9e801d7499b8667c3ef039a38aa15ba
|
[
"Apache-2.0"
] | 1,630
|
2021-10-30T01:00:27.000Z
|
2022-03-31T23:02:41.000Z
|
tests/components_to_test/utils/__init__.py
|
RichardoLuo/ColossalAI
|
797a9dc5a9e801d7499b8667c3ef039a38aa15ba
|
[
"Apache-2.0"
] | 166
|
2021-10-30T01:03:01.000Z
|
2022-03-31T14:19:07.000Z
|
tests/components_to_test/utils/__init__.py
|
RichardoLuo/ColossalAI
|
797a9dc5a9e801d7499b8667c3ef039a38aa15ba
|
[
"Apache-2.0"
] | 253
|
2021-10-30T06:10:29.000Z
|
2022-03-31T13:30:06.000Z
|
from .dummy_data_generator import DummyDataGenerator
| 27
| 53
| 0.888889
| 6
| 54
| 7.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092593
| 54
| 1
| 54
| 54
| 0.938776
| 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
| 1
| 0
|
0
| 5
|
5d7c1d79a75e37945b365f0ab69bf4ff84d6267b
| 210
|
py
|
Python
|
patch/patch.py
|
Arsenal591/notion-export
|
1095a48d896d122f4417aa9c482a44bae595f0ff
|
[
"MIT"
] | 4
|
2020-12-12T04:25:03.000Z
|
2021-03-30T14:30:44.000Z
|
patch/patch.py
|
Arsenal591/notion-export
|
1095a48d896d122f4417aa9c482a44bae595f0ff
|
[
"MIT"
] | null | null | null |
patch/patch.py
|
Arsenal591/notion-export
|
1095a48d896d122f4417aa9c482a44bae595f0ff
|
[
"MIT"
] | 1
|
2021-05-23T10:19:15.000Z
|
2021-05-23T10:19:15.000Z
|
from notion.block import BLOCK_TYPES, TextBlock
from .maps import patched_property_map
class PatchedTextBlock(TextBlock):
raw_data = patched_property_map("title")
BLOCK_TYPES['text'] = PatchedTextBlock
| 21
| 47
| 0.804762
| 26
| 210
| 6.230769
| 0.615385
| 0.123457
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119048
| 210
| 9
| 48
| 23.333333
| 0.875676
| 0
| 0
| 0
| 0
| 0
| 0.042857
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.8
| 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
| 1
| 0
|
0
| 5
|
5d8e6fa81e43e62ac61a403aaca9b4a4b8f122e3
| 139
|
py
|
Python
|
incasem/torch/models/__init__.py
|
kirchhausenlab/incasem
|
ee9e007c5c04571e547e2fb5af5e800bd2d2b435
|
[
"BSD-3-Clause"
] | null | null | null |
incasem/torch/models/__init__.py
|
kirchhausenlab/incasem
|
ee9e007c5c04571e547e2fb5af5e800bd2d2b435
|
[
"BSD-3-Clause"
] | null | null | null |
incasem/torch/models/__init__.py
|
kirchhausenlab/incasem
|
ee9e007c5c04571e547e2fb5af5e800bd2d2b435
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import absolute_import
from .one_conv3d import OneConv3d
from .unet import Unet
from .multitask_unet import MultitaskUnet
| 23.166667
| 41
| 0.856115
| 19
| 139
| 5.894737
| 0.526316
| 0.178571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016393
| 0.122302
| 139
| 5
| 42
| 27.8
| 0.901639
| 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
| 1
| 0
|
0
| 5
|
5daa9055fc81f8c887333fb0b2c0813dca44a492
| 5,019
|
py
|
Python
|
tests/core/manager/test_middleware_add_and_clear_api.py
|
pjryan93/web3.py
|
e066452a7b0e78d6cb8a9462532d169de901ef99
|
[
"MIT"
] | 3
|
2019-03-18T11:06:03.000Z
|
2021-09-22T06:19:36.000Z
|
tests/core/manager/test_middleware_add_and_clear_api.py
|
pjryan93/web3.py
|
e066452a7b0e78d6cb8a9462532d169de901ef99
|
[
"MIT"
] | null | null | null |
tests/core/manager/test_middleware_add_and_clear_api.py
|
pjryan93/web3.py
|
e066452a7b0e78d6cb8a9462532d169de901ef99
|
[
"MIT"
] | 5
|
2019-03-24T15:46:16.000Z
|
2020-08-28T02:42:51.000Z
|
import pytest
from web3.manager import (
RequestManager,
)
from web3.providers import (
BaseProvider,
)
def test_provider_property_setter_and_getter(middleware_factory):
provider = BaseProvider()
middleware_a = middleware_factory()
middleware_b = middleware_factory()
middleware_c = middleware_factory()
assert middleware_a is not middleware_b
assert middleware_a is not middleware_c
manager = RequestManager(None, provider, middlewares=[])
assert tuple(manager.middleware_stack) == tuple()
manager.middleware_stack.add(middleware_a)
manager.middleware_stack.add(middleware_b)
manager.middleware_stack.clear()
assert tuple(manager.middleware_stack) == tuple()
manager.middleware_stack.add(middleware_c)
manager.middleware_stack.add(middleware_b)
manager.middleware_stack.add(middleware_a)
with pytest.raises(ValueError):
manager.middleware_stack.add(middleware_b)
assert tuple(manager.middleware_stack) == (
middleware_a,
middleware_b,
middleware_c,
)
def test_add_named_middleware(middleware_factory):
mw = middleware_factory()
manager = RequestManager(None, BaseProvider(), middlewares=[(mw, 'the-name')])
assert len(manager.middleware_stack) == 1
assert tuple(manager.middleware_stack) == (mw, )
def test_add_named_duplicate_middleware(middleware_factory):
mw = middleware_factory()
manager = RequestManager(None, BaseProvider(), middlewares=[(mw, 'the-name'), (mw, 'name2')])
assert tuple(manager.middleware_stack) == (mw, mw)
manager.middleware_stack.clear()
assert len(manager.middleware_stack) == 0
manager.middleware_stack.add(mw, 'name1')
manager.middleware_stack.add(mw, 'name2')
assert tuple(manager.middleware_stack) == (mw, mw)
def test_add_duplicate_middleware(middleware_factory):
mw = middleware_factory()
with pytest.raises(ValueError):
manager = RequestManager(None, BaseProvider(), middlewares=[mw, mw])
manager = RequestManager(None, BaseProvider(), middlewares=[])
manager.middleware_stack.add(mw)
with pytest.raises(ValueError):
manager.middleware_stack.add(mw)
assert tuple(manager.middleware_stack) == (mw, )
def test_replace_middleware(middleware_factory):
mw1 = middleware_factory()
mw2 = middleware_factory()
mw3 = middleware_factory()
manager = RequestManager(None, BaseProvider(), middlewares=[mw1, (mw2, '2nd'), mw3])
assert tuple(manager.middleware_stack) == (mw1, mw2, mw3)
mw_replacement = middleware_factory()
manager.middleware_stack.replace('2nd', mw_replacement)
assert tuple(manager.middleware_stack) == (mw1, mw_replacement, mw3)
manager.middleware_stack.remove('2nd')
assert tuple(manager.middleware_stack) == (mw1, mw3)
def test_replace_middleware_without_name(middleware_factory):
mw1 = middleware_factory()
mw2 = middleware_factory()
mw3 = middleware_factory()
manager = RequestManager(None, BaseProvider(), middlewares=[mw1, mw2, mw3])
assert tuple(manager.middleware_stack) == (mw1, mw2, mw3)
mw_replacement = middleware_factory()
manager.middleware_stack.replace(mw2, mw_replacement)
assert tuple(manager.middleware_stack) == (mw1, mw_replacement, mw3)
manager.middleware_stack.remove(mw_replacement)
assert tuple(manager.middleware_stack) == (mw1, mw3)
def test_add_middleware(middleware_factory):
mw1 = middleware_factory()
mw2 = middleware_factory()
mw3 = middleware_factory()
manager = RequestManager(None, BaseProvider(), middlewares=[mw1, mw2])
manager.middleware_stack.add(mw3)
assert tuple(manager.middleware_stack) == (mw3, mw1, mw2)
def test_bury_middleware(middleware_factory):
mw1 = middleware_factory()
mw2 = middleware_factory()
mw3 = middleware_factory()
manager = RequestManager(None, BaseProvider(), middlewares=[mw1, mw2])
manager.middleware_stack.inject(mw3, layer=0)
assert tuple(manager.middleware_stack) == (mw1, mw2, mw3)
def test_bury_named_middleware(middleware_factory):
mw1 = middleware_factory()
mw2 = middleware_factory()
mw3 = middleware_factory()
manager = RequestManager(None, BaseProvider(), middlewares=[mw1, mw2])
manager.middleware_stack.inject(mw3, name='middleware3', layer=0)
assert tuple(manager.middleware_stack) == (mw1, mw2, mw3)
# make sure middleware was injected with correct name, by trying to remove
# it by name.
manager.middleware_stack.remove('middleware3')
assert tuple(manager.middleware_stack) == (mw1, mw2)
def test_remove_middleware(middleware_factory):
mw1 = middleware_factory()
mw2 = middleware_factory()
mw3 = middleware_factory()
manager = RequestManager(None, BaseProvider(), middlewares=[mw1, mw2, mw3])
assert tuple(manager.middleware_stack) == (mw1, mw2, mw3)
manager.middleware_stack.remove(mw2)
assert tuple(manager.middleware_stack) == (mw1, mw3)
| 29.350877
| 97
| 0.727436
| 566
| 5,019
| 6.219081
| 0.111307
| 0.202841
| 0.2625
| 0.16108
| 0.832386
| 0.744318
| 0.694318
| 0.653977
| 0.597443
| 0.513352
| 0
| 0.01951
| 0.162582
| 5,019
| 170
| 98
| 29.523529
| 0.817987
| 0.016736
| 0
| 0.528302
| 0
| 0
| 0.012571
| 0
| 0
| 0
| 0
| 0
| 0.216981
| 1
| 0.09434
| false
| 0
| 0.028302
| 0
| 0.122642
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
f8fb7aaf55307f9b8201136ad858274489e5b470
| 41
|
py
|
Python
|
ibis_benchmark/nyc_taxi/__init__.py
|
Quansight/ibis-benchmark
|
63d1175c87c96c3a50cefb4090ce55dc6e8341bb
|
[
"MIT"
] | 1
|
2019-12-20T14:08:32.000Z
|
2019-12-20T14:08:32.000Z
|
ibis_benchmark/nyc_taxi/__init__.py
|
Quansight/ibis-benchmark
|
63d1175c87c96c3a50cefb4090ce55dc6e8341bb
|
[
"MIT"
] | 1
|
2019-09-10T01:25:43.000Z
|
2019-10-01T21:49:02.000Z
|
ibis_benchmark/nyc_taxi/__init__.py
|
Quansight/ibis-benchmark
|
63d1175c87c96c3a50cefb4090ce55dc6e8341bb
|
[
"MIT"
] | 1
|
2021-04-17T15:37:06.000Z
|
2021-04-17T15:37:06.000Z
|
"""Benchmarking for NYC Taxi dataset."""
| 20.5
| 40
| 0.707317
| 5
| 41
| 5.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121951
| 41
| 1
| 41
| 41
| 0.805556
| 0.829268
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
5d1a6dbb8f824333a7ea14cfddf0a2966e7c106d
| 369
|
py
|
Python
|
example-py-pytest/com/automationpanda/example/calc_func.py
|
colindembovsky/python-testing-101
|
e3b9f4b7f68a93c5a976a4fa0282be007f723b18
|
[
"Apache-2.0"
] | 2
|
2018-09-02T11:49:19.000Z
|
2018-10-01T14:28:21.000Z
|
example-py-pytest/com/automationpanda/example/calc_func.py
|
colindembovsky/python-testing-101
|
e3b9f4b7f68a93c5a976a4fa0282be007f723b18
|
[
"Apache-2.0"
] | null | null | null |
example-py-pytest/com/automationpanda/example/calc_func.py
|
colindembovsky/python-testing-101
|
e3b9f4b7f68a93c5a976a4fa0282be007f723b18
|
[
"Apache-2.0"
] | 2
|
2018-07-09T03:38:09.000Z
|
2018-10-01T14:28:41.000Z
|
"""
calc_func.py contains math functions with no side effects.
"""
def add(a, b):
return a + b
def subtract(a, b):
return a + b
def multiply(a, b):
return a * b
def divide(a, b):
# automatically raises ZeroDivisionError
return a * 1.0 / b
def maximum(a, b):
return a if a >= b else b
def minimum(a, b):
return a if a <= b else b
| 12.724138
| 58
| 0.596206
| 65
| 369
| 3.369231
| 0.415385
| 0.100457
| 0.182648
| 0.205479
| 0.342466
| 0.342466
| 0.164384
| 0.164384
| 0.164384
| 0
| 0
| 0.007605
| 0.287263
| 369
| 28
| 59
| 13.178571
| 0.825095
| 0.265583
| 0
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
5d1f84ba9e061b008e735e29af27b8b865800ecb
| 134
|
py
|
Python
|
serving_utils/protos/predict_grpc.py
|
PEAT-AI/serving-utils
|
5d69d110cb92f0bae3a158582fc49d20a5e9a944
|
[
"Apache-2.0"
] | 7
|
2019-06-03T02:17:27.000Z
|
2021-06-07T14:16:39.000Z
|
serving_utils/protos/predict_grpc.py
|
PEAT-AI/serving-utils
|
5d69d110cb92f0bae3a158582fc49d20a5e9a944
|
[
"Apache-2.0"
] | 28
|
2018-07-16T11:22:46.000Z
|
2020-05-10T13:24:56.000Z
|
serving_utils/protos/predict_grpc.py
|
PEAT-AI/serving-utils
|
5d69d110cb92f0bae3a158582fc49d20a5e9a944
|
[
"Apache-2.0"
] | 3
|
2019-06-03T02:17:28.000Z
|
2021-01-21T09:18:30.000Z
|
# Generated by the Protocol Buffers compiler. DO NOT EDIT!
# source: serving_utils/protos/predict.proto
# plugin: grpclib.plugin.main
| 33.5
| 58
| 0.791045
| 19
| 134
| 5.526316
| 0.947368
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119403
| 134
| 3
| 59
| 44.666667
| 0.889831
| 0.947761
| 0
| null | 1
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
5d26e7995baaeb43c07102cdb546c7b5ca4079c8
| 46
|
py
|
Python
|
asynctmdb/imdb/__init__.py
|
lycantropos/asynctmdb
|
623dcfe0f4f599104d16d920d9a1f35dd82eac90
|
[
"MIT"
] | null | null | null |
asynctmdb/imdb/__init__.py
|
lycantropos/asynctmdb
|
623dcfe0f4f599104d16d920d9a1f35dd82eac90
|
[
"MIT"
] | null | null | null |
asynctmdb/imdb/__init__.py
|
lycantropos/asynctmdb
|
623dcfe0f4f599104d16d920d9a1f35dd82eac90
|
[
"MIT"
] | 2
|
2020-11-04T02:56:38.000Z
|
2020-11-05T08:12:04.000Z
|
from . import (title_id,
find)
| 15.333333
| 24
| 0.478261
| 5
| 46
| 4.2
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.434783
| 46
| 2
| 25
| 23
| 0.807692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
5d34f906e63f8ad1a1f6d2eb8a706997c03b794e
| 210
|
py
|
Python
|
src/products/admin.py
|
ankur-vulcan/echarity
|
12ba2762f8075359284f2da0d63af7f834e1feca
|
[
"MIT"
] | null | null | null |
src/products/admin.py
|
ankur-vulcan/echarity
|
12ba2762f8075359284f2da0d63af7f834e1feca
|
[
"MIT"
] | null | null | null |
src/products/admin.py
|
ankur-vulcan/echarity
|
12ba2762f8075359284f2da0d63af7f834e1feca
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Product, Variation, ProductImage
# Register your models here.
admin.site.register(Product)
admin.site.register(Variation)
admin.site.register(ProductImage)
| 26.25
| 52
| 0.82381
| 27
| 210
| 6.407407
| 0.481481
| 0.156069
| 0.294798
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090476
| 210
| 8
| 53
| 26.25
| 0.905759
| 0.12381
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.4
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
5d56b55290355e10b2a3bca411b61290b9fc32c8
| 141
|
py
|
Python
|
yeahp-backend/web_api/models/hierarchy_graph.py
|
flaudanum/Yet-another-AHP
|
6eba8a842156ce1651c8dbe243034427f72361d9
|
[
"MIT"
] | null | null | null |
yeahp-backend/web_api/models/hierarchy_graph.py
|
flaudanum/Yet-another-AHP
|
6eba8a842156ce1651c8dbe243034427f72361d9
|
[
"MIT"
] | null | null | null |
yeahp-backend/web_api/models/hierarchy_graph.py
|
flaudanum/Yet-another-AHP
|
6eba8a842156ce1651c8dbe243034427f72361d9
|
[
"MIT"
] | null | null | null |
from pydantic import BaseModel, Extra
class HierarchyGraph(BaseModel, extra=Extra.forbid):
root: str
dependencies: list[list[str]]
| 20.142857
| 52
| 0.751773
| 17
| 141
| 6.235294
| 0.705882
| 0.264151
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.156028
| 141
| 6
| 53
| 23.5
| 0.890756
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.25
| 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
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
53b510bba5514f3c45659a285ead7de670f6bbab
| 80
|
py
|
Python
|
python-teste/aula08a.py
|
zmixtv1/cev-Python
|
edce04f86d943d9af070bf3c5e89575ff796ec9e
|
[
"MIT"
] | null | null | null |
python-teste/aula08a.py
|
zmixtv1/cev-Python
|
edce04f86d943d9af070bf3c5e89575ff796ec9e
|
[
"MIT"
] | null | null | null |
python-teste/aula08a.py
|
zmixtv1/cev-Python
|
edce04f86d943d9af070bf3c5e89575ff796ec9e
|
[
"MIT"
] | null | null | null |
import emoji
print(emoji.emojize('Olá mundo :earth_americas:',use_aliases=True))
| 40
| 67
| 0.8125
| 12
| 80
| 5.25
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.05
| 80
| 2
| 67
| 40
| 0.828947
| 0
| 0
| 0
| 0
| 0
| 0.320988
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 1
|
0
| 5
|
54d0ff2cf004d789023114b7f2e621b3322b7a7e
| 787
|
py
|
Python
|
python/credentials.py
|
vladyck/fromksator
|
37e42ebb74db06de22a2c5e42d6fcb738dffde56
|
[
"MIT"
] | 8
|
2018-01-15T09:39:37.000Z
|
2022-01-06T21:04:20.000Z
|
python/credentials.py
|
vladyck/fromksator
|
37e42ebb74db06de22a2c5e42d6fcb738dffde56
|
[
"MIT"
] | null | null | null |
python/credentials.py
|
vladyck/fromksator
|
37e42ebb74db06de22a2c5e42d6fcb738dffde56
|
[
"MIT"
] | 10
|
2018-10-05T21:19:03.000Z
|
2021-11-16T03:45:20.000Z
|
def ansible_credentials_to_python_credentials():
import yaml
from pprint import pprint as pp
credentials_file = open('group_vars/JUNOS/credentials.yml', "r")
credentials_file_content = credentials_file.read()
credentials_file.close()
credentials_file_content_in_yaml = yaml.load(credentials_file_content)
'''
pp(credentials_file_content_in_yaml)
type(credentials_file_content_in_yaml)
credentials_file_content_in_yaml
credentials_file_content_in_yaml['credentials']['username']
credentials_file_content_in_yaml['credentials']['password']
'''
user = credentials_file_content_in_yaml['credentials']['username']
password = credentials_file_content_in_yaml['credentials']['password']
credentials = {'user': user, 'password': password}
return credentials
| 32.791667
| 78
| 0.799238
| 96
| 787
| 6.09375
| 0.291667
| 0.333333
| 0.376068
| 0.328205
| 0.512821
| 0.417094
| 0.417094
| 0.162393
| 0.162393
| 0.162393
| 0
| 0
| 0.100381
| 787
| 23
| 79
| 34.217391
| 0.826271
| 0
| 0
| 0
| 0
| 0
| 0.152574
| 0.058824
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0.181818
| 0.181818
| null | null | 0.090909
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
54d9423b6bcff3e45c4c549cf0a7e955e270a8c4
| 209
|
py
|
Python
|
poc/classes/AuxSTLocalization.py
|
bookofproofs/fpl
|
527b43b0f8bb3d459ee906e5ed8524a676ce3a2c
|
[
"MIT"
] | 4
|
2021-11-08T10:09:46.000Z
|
2021-11-13T22:25:46.000Z
|
poc/classes/AuxSTLocalization.py
|
bookofproofs/fpl
|
527b43b0f8bb3d459ee906e5ed8524a676ce3a2c
|
[
"MIT"
] | 1
|
2020-09-04T13:02:09.000Z
|
2021-06-16T07:07:44.000Z
|
poc/classes/AuxSTLocalization.py
|
bookofproofs/fpl
|
527b43b0f8bb3d459ee906e5ed8524a676ce3a2c
|
[
"MIT"
] | 1
|
2021-11-08T10:10:12.000Z
|
2021-11-08T10:10:12.000Z
|
from poc.classes.AuxST import AuxST
from poc.classes.AuxSymbolTable import AuxSymbolTable
class AuxSTLocalization(AuxST):
def __init__(self, i):
super().__init__(AuxSymbolTable.localization, i)
| 23.222222
| 56
| 0.770335
| 24
| 209
| 6.375
| 0.583333
| 0.091503
| 0.183007
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.143541
| 209
| 8
| 57
| 26.125
| 0.854749
| 0
| 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
| 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
| 1
| 0
|
0
| 5
|
54ecbcb196fb178223525416be5f6e62bca2f50c
| 7,147
|
py
|
Python
|
tests/components/homekit/test_type_sensors.py
|
technicalpickles/home-assistant
|
66b9bb2c4b42484aa1180a709c654967fad3d6b4
|
[
"Apache-2.0"
] | null | null | null |
tests/components/homekit/test_type_sensors.py
|
technicalpickles/home-assistant
|
66b9bb2c4b42484aa1180a709c654967fad3d6b4
|
[
"Apache-2.0"
] | null | null | null |
tests/components/homekit/test_type_sensors.py
|
technicalpickles/home-assistant
|
66b9bb2c4b42484aa1180a709c654967fad3d6b4
|
[
"Apache-2.0"
] | 1
|
2018-09-22T22:43:10.000Z
|
2018-09-22T22:43:10.000Z
|
"""Test different accessory types: Sensors."""
from homeassistant.components.homekit.const import PROP_CELSIUS
from homeassistant.components.homekit.type_sensors import (
AirQualitySensor, BinarySensor, CarbonDioxideSensor, HumiditySensor,
LightSensor, TemperatureSensor, BINARY_SENSOR_SERVICE_MAP)
from homeassistant.const import (
ATTR_DEVICE_CLASS, ATTR_UNIT_OF_MEASUREMENT, STATE_HOME, STATE_NOT_HOME,
STATE_OFF, STATE_ON, STATE_UNKNOWN, TEMP_CELSIUS, TEMP_FAHRENHEIT)
async def test_temperature(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = 'sensor.temperature'
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = TemperatureSensor(hass, hk_driver, 'Temperature',
entity_id, 2, None)
await hass.async_add_job(acc.run)
assert acc.aid == 2
assert acc.category == 10 # Sensor
assert acc.char_temp.value == 0.0
for key, value in PROP_CELSIUS.items():
assert acc.char_temp.properties[key] == value
hass.states.async_set(entity_id, STATE_UNKNOWN,
{ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS})
await hass.async_block_till_done()
assert acc.char_temp.value == 0.0
hass.states.async_set(entity_id, '20',
{ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS})
await hass.async_block_till_done()
assert acc.char_temp.value == 20
hass.states.async_set(entity_id, '75.2',
{ATTR_UNIT_OF_MEASUREMENT: TEMP_FAHRENHEIT})
await hass.async_block_till_done()
assert acc.char_temp.value == 24
async def test_humidity(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = 'sensor.humidity'
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = HumiditySensor(hass, hk_driver, 'Humidity', entity_id, 2, None)
await hass.async_add_job(acc.run)
assert acc.aid == 2
assert acc.category == 10 # Sensor
assert acc.char_humidity.value == 0
hass.states.async_set(entity_id, STATE_UNKNOWN)
await hass.async_block_till_done()
assert acc.char_humidity.value == 0
hass.states.async_set(entity_id, '20')
await hass.async_block_till_done()
assert acc.char_humidity.value == 20
async def test_air_quality(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = 'sensor.air_quality'
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = AirQualitySensor(hass, hk_driver, 'Air Quality',
entity_id, 2, None)
await hass.async_add_job(acc.run)
assert acc.aid == 2
assert acc.category == 10 # Sensor
assert acc.char_density.value == 0
assert acc.char_quality.value == 0
hass.states.async_set(entity_id, STATE_UNKNOWN)
await hass.async_block_till_done()
assert acc.char_density.value == 0
assert acc.char_quality.value == 0
hass.states.async_set(entity_id, '34')
await hass.async_block_till_done()
assert acc.char_density.value == 34
assert acc.char_quality.value == 1
hass.states.async_set(entity_id, '200')
await hass.async_block_till_done()
assert acc.char_density.value == 200
assert acc.char_quality.value == 5
async def test_co2(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = 'sensor.co2'
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = CarbonDioxideSensor(hass, hk_driver, 'CO2', entity_id, 2, None)
await hass.async_add_job(acc.run)
assert acc.aid == 2
assert acc.category == 10 # Sensor
assert acc.char_co2.value == 0
assert acc.char_peak.value == 0
assert acc.char_detected.value == 0
hass.states.async_set(entity_id, STATE_UNKNOWN)
await hass.async_block_till_done()
assert acc.char_co2.value == 0
assert acc.char_peak.value == 0
assert acc.char_detected.value == 0
hass.states.async_set(entity_id, '1100')
await hass.async_block_till_done()
assert acc.char_co2.value == 1100
assert acc.char_peak.value == 1100
assert acc.char_detected.value == 1
hass.states.async_set(entity_id, '800')
await hass.async_block_till_done()
assert acc.char_co2.value == 800
assert acc.char_peak.value == 1100
assert acc.char_detected.value == 0
async def test_light(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = 'sensor.light'
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = LightSensor(hass, hk_driver, 'Light', entity_id, 2, None)
await hass.async_add_job(acc.run)
assert acc.aid == 2
assert acc.category == 10 # Sensor
assert acc.char_light.value == 0.0001
hass.states.async_set(entity_id, STATE_UNKNOWN)
await hass.async_block_till_done()
assert acc.char_light.value == 0.0001
hass.states.async_set(entity_id, '300')
await hass.async_block_till_done()
assert acc.char_light.value == 300
async def test_binary(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = 'binary_sensor.opening'
hass.states.async_set(entity_id, STATE_UNKNOWN,
{ATTR_DEVICE_CLASS: 'opening'})
await hass.async_block_till_done()
acc = BinarySensor(hass, hk_driver, 'Window Opening', entity_id, 2, None)
await hass.async_add_job(acc.run)
assert acc.aid == 2
assert acc.category == 10 # Sensor
assert acc.char_detected.value == 0
hass.states.async_set(entity_id, STATE_ON,
{ATTR_DEVICE_CLASS: 'opening'})
await hass.async_block_till_done()
assert acc.char_detected.value == 1
hass.states.async_set(entity_id, STATE_OFF,
{ATTR_DEVICE_CLASS: 'opening'})
await hass.async_block_till_done()
assert acc.char_detected.value == 0
hass.states.async_set(entity_id, STATE_HOME,
{ATTR_DEVICE_CLASS: 'opening'})
await hass.async_block_till_done()
assert acc.char_detected.value == 1
hass.states.async_set(entity_id, STATE_NOT_HOME,
{ATTR_DEVICE_CLASS: 'opening'})
await hass.async_block_till_done()
assert acc.char_detected.value == 0
hass.states.async_remove(entity_id)
await hass.async_block_till_done()
assert acc.char_detected.value == 0
async def test_binary_device_classes(hass, hk_driver):
"""Test if services and characteristics are assigned correctly."""
entity_id = 'binary_sensor.demo'
for device_class, (service, char) in BINARY_SENSOR_SERVICE_MAP.items():
hass.states.async_set(entity_id, STATE_OFF,
{ATTR_DEVICE_CLASS: device_class})
await hass.async_block_till_done()
acc = BinarySensor(hass, hk_driver, 'Binary Sensor',
entity_id, 2, None)
assert acc.get_service(service).display_name == service
assert acc.char_detected.display_name == char
| 33.872038
| 77
| 0.691479
| 1,004
| 7,147
| 4.644422
| 0.10757
| 0.098434
| 0.10594
| 0.101866
| 0.759168
| 0.739438
| 0.733862
| 0.731289
| 0.717778
| 0.696118
| 0
| 0.021043
| 0.208759
| 7,147
| 210
| 78
| 34.033333
| 0.803537
| 0.011613
| 0
| 0.61745
| 0
| 0
| 0.035269
| 0.003152
| 0
| 0
| 0
| 0
| 0.342282
| 1
| 0
| false
| 0
| 0.020134
| 0
| 0.020134
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
07315aea331b25820b7f941ea5c4ecbadf677576
| 95
|
py
|
Python
|
pstmgmt/api/admin.py
|
aniketb97/pest_management
|
3acb0b1617c7832cd0c300722e6e87cb509ccc0f
|
[
"Apache-2.0"
] | null | null | null |
pstmgmt/api/admin.py
|
aniketb97/pest_management
|
3acb0b1617c7832cd0c300722e6e87cb509ccc0f
|
[
"Apache-2.0"
] | null | null | null |
pstmgmt/api/admin.py
|
aniketb97/pest_management
|
3acb0b1617c7832cd0c300722e6e87cb509ccc0f
|
[
"Apache-2.0"
] | null | null | null |
from django.contrib import admin
from .models import InsectData
# Register your models here.
| 15.833333
| 32
| 0.8
| 13
| 95
| 5.846154
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 95
| 5
| 33
| 19
| 0.95
| 0.273684
| 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
| 1
| 0
|
0
| 5
|
4ad22ebdac94ad2904d04fdf2e57ddd6614524f9
| 184
|
py
|
Python
|
STEM/admin.py
|
mzabala1/REST_AI_STEM
|
4af9bfc9ab7ec7d81e207e4dba77da61afc7b0cc
|
[
"MIT"
] | null | null | null |
STEM/admin.py
|
mzabala1/REST_AI_STEM
|
4af9bfc9ab7ec7d81e207e4dba77da61afc7b0cc
|
[
"MIT"
] | null | null | null |
STEM/admin.py
|
mzabala1/REST_AI_STEM
|
4af9bfc9ab7ec7d81e207e4dba77da61afc7b0cc
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Estudiante, Predecidos, Preguntas
admin.site.register(Predecidos)
admin.site.register(Estudiante)
admin.site.register(Preguntas)
| 23
| 53
| 0.831522
| 23
| 184
| 6.652174
| 0.478261
| 0.176471
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.081522
| 184
| 7
| 54
| 26.285714
| 0.905325
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.4
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
ab219a1feaf834e9ec26ad21c267787820e54bd6
| 138
|
py
|
Python
|
tests/pythonProj_test.py
|
manishas-jfrog/jfrog-pipelines-python-sample
|
9678e5ef92dbcd5e15e4d2c5778bb35236974862
|
[
"Apache-2.0"
] | null | null | null |
tests/pythonProj_test.py
|
manishas-jfrog/jfrog-pipelines-python-sample
|
9678e5ef92dbcd5e15e4d2c5778bb35236974862
|
[
"Apache-2.0"
] | null | null | null |
tests/pythonProj_test.py
|
manishas-jfrog/jfrog-pipelines-python-sample
|
9678e5ef92dbcd5e15e4d2c5778bb35236974862
|
[
"Apache-2.0"
] | null | null | null |
from nose.tools import *
import pythonProj
def setup():
printme ()
def teardown():
printme ()
def test_basic():
printme ()
| 11.5
| 24
| 0.637681
| 16
| 138
| 5.4375
| 0.6875
| 0.229885
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.23913
| 138
| 11
| 25
| 12.545455
| 0.828571
| 0
| 0
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.375
| true
| 0
| 0.25
| 0
| 0.625
| 0.375
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
ab4ab77946875f27afc3cd3cb97caa962bb0d1fd
| 83
|
py
|
Python
|
cs291a/__init__.py
|
jgranley/CS291a
|
d7c675bbab42d717299eb947ab84005b67f66392
|
[
"BSD-3-Clause"
] | null | null | null |
cs291a/__init__.py
|
jgranley/CS291a
|
d7c675bbab42d717299eb947ab84005b67f66392
|
[
"BSD-3-Clause"
] | null | null | null |
cs291a/__init__.py
|
jgranley/CS291a
|
d7c675bbab42d717299eb947ab84005b67f66392
|
[
"BSD-3-Clause"
] | null | null | null |
from .version import __version__
from .dataset_gen import *
from .models import *
| 27.666667
| 34
| 0.783133
| 11
| 83
| 5.454545
| 0.545455
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.156627
| 83
| 3
| 35
| 27.666667
| 0.857143
| 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
| 1
| 0
|
0
| 5
|
db570391a13173b5ef4e37f6c01a9d216758128b
| 87
|
py
|
Python
|
tests/conftest.py
|
backdfund/analyzer
|
3069008aad80a2131b2c33d6d3dabd4f22e0a946
|
[
"MIT"
] | 18
|
2021-02-17T23:04:03.000Z
|
2022-02-02T23:07:32.000Z
|
tests/conftest.py
|
Guangye-C/analyzer
|
3069008aad80a2131b2c33d6d3dabd4f22e0a946
|
[
"MIT"
] | null | null | null |
tests/conftest.py
|
Guangye-C/analyzer
|
3069008aad80a2131b2c33d6d3dabd4f22e0a946
|
[
"MIT"
] | 2
|
2021-09-12T03:12:44.000Z
|
2022-03-30T09:34:40.000Z
|
from tests.fixtures import * # pylint: disable=wildcard-import,unused-wildcard-import
| 43.5
| 86
| 0.804598
| 11
| 87
| 6.363636
| 0.727273
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.091954
| 87
| 1
| 87
| 87
| 0.886076
| 0.62069
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
db8d52823a24be58c47ba47d99edcd20b23cfbf9
| 662
|
py
|
Python
|
zenbot/logging/logmanager.py
|
Dmunch04/ZenBot
|
5002c20eec70b297cfe8bcce5639e67dbf15fa70
|
[
"MIT"
] | 7
|
2019-06-16T15:54:36.000Z
|
2022-03-28T08:53:49.000Z
|
zenbot/logging/logmanager.py
|
Dmunch04/ZenBot
|
5002c20eec70b297cfe8bcce5639e67dbf15fa70
|
[
"MIT"
] | null | null | null |
zenbot/logging/logmanager.py
|
Dmunch04/ZenBot
|
5002c20eec70b297cfe8bcce5639e67dbf15fa70
|
[
"MIT"
] | 1
|
2019-06-14T21:42:47.000Z
|
2019-06-14T21:42:47.000Z
|
from typing import NoReturn
from .console_logger import ConsoleLogger
from .file_logger import FileLogger
class LogManager:
def __init__(self):
self.console_logger = ConsoleLogger()
self.file_logger = FileLogger()
def server(self, msg: str) -> NoReturn:
self.console_logger.server(msg)
def debug(self, msg: str) -> NoReturn:
self.console_logger.debug(msg)
def error(self, msg: str) -> NoReturn:
self.console_logger.error(msg)
def warning(self, msg: str) -> NoReturn:
self.console_logger.warning(msg)
def success(self, msg: str) -> NoReturn:
self.console_logger.success(msg)
| 25.461538
| 45
| 0.676737
| 82
| 662
| 5.304878
| 0.256098
| 0.209195
| 0.234483
| 0.206897
| 0.402299
| 0.402299
| 0.402299
| 0
| 0
| 0
| 0
| 0
| 0.219033
| 662
| 25
| 46
| 26.48
| 0.841393
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.352941
| false
| 0
| 0.176471
| 0
| 0.588235
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
dbbcb00c584c0abfa317e26437f1f6be12fcaa62
| 140
|
py
|
Python
|
pyroma/testdata/complete/complete/tests.py
|
cthoyt/pyroma
|
7a129e147bcba0b2099d0c3fcd7cd3cf4b2f88d1
|
[
"MIT"
] | null | null | null |
pyroma/testdata/complete/complete/tests.py
|
cthoyt/pyroma
|
7a129e147bcba0b2099d0c3fcd7cd3cf4b2f88d1
|
[
"MIT"
] | null | null | null |
pyroma/testdata/complete/complete/tests.py
|
cthoyt/pyroma
|
7a129e147bcba0b2099d0c3fcd7cd3cf4b2f88d1
|
[
"MIT"
] | null | null | null |
import unittest
class PackageDataTest(unittest.TestCase):
def test_test(self):
# Stop pyflakes from compaining:
pass
| 15.555556
| 41
| 0.685714
| 15
| 140
| 6.333333
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 140
| 8
| 42
| 17.5
| 0.904762
| 0.214286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0.25
| 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
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
dbd61830192b49ae056c8854538d0bb4b0ffa546
| 2,251
|
py
|
Python
|
tests/test_movielens.py
|
akisaarinen/rechelper
|
97e762dd66b5413761956b242cd8a1759326afb4
|
[
"MIT"
] | null | null | null |
tests/test_movielens.py
|
akisaarinen/rechelper
|
97e762dd66b5413761956b242cd8a1759326afb4
|
[
"MIT"
] | null | null | null |
tests/test_movielens.py
|
akisaarinen/rechelper
|
97e762dd66b5413761956b242cd8a1759326afb4
|
[
"MIT"
] | null | null | null |
import unittest
import numpy as np
import rechelper.movielens
import rechelper.dataset
class MovieLensTestSuite(unittest.TestCase):
"""Note: Requires data to be set up correctly"""
def test_load_ml100k(self):
ratings_all, movies_all = rechelper.movielens.load_movielens("ml-100k")
self.assertEqual(ratings_all.shape, (100000,4))
self.assertEqual(movies_all.shape, (1682,5))
ds = rechelper.dataset.create(ratings_all)
self.assertEqual(ds.ratings.shape, (100000,3))
self.assertEqual(ds.unique_users, 943)
self.assertEqual(ds.unique_items, 1682)
self.assertEqual(ds.user_idx_map[0], 1)
self.assertEqual(ds.user_idx_map[1], 2)
self.assertEqual(ds.user_idx_map[942], 943)
self.assertEqual(ds.idx_user_map[1], 0)
self.assertEqual(ds.idx_user_map[2], 1)
self.assertEqual(ds.idx_user_map[943], 942)
self.assertEqual(ds.item_idx_map[0], 1)
self.assertEqual(ds.item_idx_map[1], 2)
self.assertEqual(ds.item_idx_map[1681], 1682)
self.assertEqual(ds.idx_item_map[1], 0)
self.assertEqual(ds.idx_item_map[2], 1)
self.assertEqual(ds.idx_item_map[1682], 1681)
ds.print_stats()
def test_load_ml_latest_small(self):
ratings_all, movies_all = rechelper.movielens.load_movielens("ml-latest-small")
self.assertEqual(ratings_all.shape, (100836,4))
self.assertEqual(movies_all.shape, (9742,5))
ds = rechelper.dataset.create(ratings_all)
self.assertEqual(ds.ratings.shape, (100836,3))
self.assertEqual(ds.unique_users, 610)
self.assertEqual(ds.unique_items, 9724)
self.assertEqual(ds.user_idx_map[0], 1)
self.assertEqual(ds.user_idx_map[1], 2)
self.assertEqual(ds.user_idx_map[609], 610)
self.assertEqual(ds.idx_user_map[1], 0)
self.assertEqual(ds.idx_user_map[2], 1)
self.assertEqual(ds.idx_user_map[610], 609)
self.assertEqual(ds.item_idx_map[0], 1)
self.assertEqual(ds.item_idx_map[1], 2)
self.assertEqual(ds.item_idx_map[9723], 193609)
self.assertEqual(ds.idx_item_map[1], 0)
self.assertEqual(ds.idx_item_map[2], 1)
self.assertEqual(ds.idx_item_map[193609], 9723)
if __name__ == '__main__':
unittest.main()
| 34.630769
| 85
| 0.700578
| 335
| 2,251
| 4.471642
| 0.19403
| 0.340454
| 0.340454
| 0.160214
| 0.77036
| 0.692924
| 0.614152
| 0.614152
| 0.614152
| 0.614152
| 0
| 0.080043
| 0.167481
| 2,251
| 65
| 86
| 34.630769
| 0.719317
| 0.018658
| 0
| 0.375
| 0
| 0
| 0.013612
| 0
| 0
| 0
| 0
| 0
| 0.708333
| 1
| 0.041667
| false
| 0
| 0.083333
| 0
| 0.145833
| 0.020833
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
9158d8fad4580917b557df1028d5769994bd9911
| 3,913
|
py
|
Python
|
ici_acme/policy/tests/test_preauth_token.py
|
SUNET/ici-acme
|
087b0564690f5584b322378b1aa791e1aae7f41c
|
[
"BSD-2-Clause-FreeBSD"
] | 2
|
2019-04-25T15:13:59.000Z
|
2021-01-06T17:49:56.000Z
|
ici_acme/policy/tests/test_preauth_token.py
|
SUNET/ici-acme
|
087b0564690f5584b322378b1aa791e1aae7f41c
|
[
"BSD-2-Clause-FreeBSD"
] | 1
|
2020-09-16T09:01:45.000Z
|
2020-09-16T13:31:07.000Z
|
ici_acme/policy/tests/test_preauth_token.py
|
SUNET/ici-acme
|
087b0564690f5584b322378b1aa791e1aae7f41c
|
[
"BSD-2-Clause-FreeBSD"
] | null | null | null |
import os
import unittest
import pkg_resources
from ici_acme.context import Context
from ici_acme.policy.token import is_valid_preauth_token
from ici_acme.resources.preauth import validate_token_signature
EXPIRED_TOKEN = '''
eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiIsIng1YyI6WyJNSUlDYXpDQ0FoS2dBd0lCQWdJSU45NDNH
NGpPdEEwd0NnWUlLb1pJemowRUF3SXdJakVUTUJFR0ExVUVBd3dLVFhrZ1VtOXZkQ0JEUVRFTE1Ba0dB
MVVFQmhNQ1UwVXdJQmNOTVRrd05ERXhNVFV5TmpRNVdoZ1BNakV4T1RBek1UZ3hOVEkyTkRsYU1DNHhD
ekFKQmdOVkJBWVRBbE5GTVE0d0RBWURWUVFMREFWVFZVNUZWREVQTUEwR0ExVUVBd3dHWVdSdGFXNHhN
Rmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUV0ZEIyQ3Vha1RnQjI2aWVIVER2SEMrQ0FL
N1VicTdsVHdlb1l1bWo0bnhpMWM3dldYREtVVHB0aTd4QXZDT3d1YkNDb2pJVDRNS1V2ZVF4T0luUGg4
cU9DQVNJd2dnRWVNQjBHQTFVZERnUVdCQlI5RldGamZUQTRybFV2bVRiY0F4WFYwd09mMURBZkJnTlZI
U01FR0RBV2dCUmpPbHllSWpCVGRVT0g1T1hITktaK3BCNnVDREJkQmdnckJnRUZCUWNCQVFSUk1FOHdL
QVlJS3dZQkJRVUhNQUtHSEdoMGRIQTZMeTlqWVM1bGVHRnRjR3hsTG1OdmJTOWpZUzVqY25Rd0l3WUlL
d1lCQlFVSE1BR0dGMmgwZEhBNkx5OXZZM053TG1WNFlXMXdiR1V1WTI5dE1DNEdBMVVkSHdRbk1DVXdJ
NkFob0IrR0hXaDBkSEE2THk5allTNWxlR0Z0Y0d4bExtTnZiUzlqY213dWNHVnRNQ0FHQTFVZEVnUVpN
QmVHRldoMGRIQTZMeTlqWVM1bGVHRnRjR3hsTG1OdmJUQUpCZ05WSFJNRUFqQUFNQXNHQTFVZER3UUVB
d0lGNERBVEJnTlZIU1VFRERBS0JnZ3JCZ0VGQlFjREFqQUtCZ2dxaGtqT1BRUURBZ05IQURCRUFpQlNt
WGVTQTVBWm9qb24zbklGL1FlaVJvdXVTR1lFWjhIK09JMkVJM21nT2dJZ0Zyc0VTb200THF2ZVllQzNy
RFRia3FLUTB6Y1lwNlJ4ZDV2aFIwWVJFbUk9Il19.eyJuYW1lcyI6WyJ0ZXN0LnRlc3QiXSwibm9uY2U
iOiJocFdHX3hTSmVNUUpqYmpDSF95NV9BIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdDo4MDAwL25ldy1
hdXRoeiIsImlhdCI6MTU1NTQxMDQ3NCwiZXhwIjoxNTU1NDEwNzc0LCJjcml0IjpbImV4cCJdfQ.dfRq
oOf6OfjzgcPdWm3fLm8t4zlv2oFCSTO1tSmAOgqFU-cj-H3q_Tk3ugfB4ZEvzjXljrwmaMNqH_mmqXIl
nA
'''
TOKEN = '''
eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiIsIng1YyI6WyJNSUlDYXpDQ0FoS2dBd0lCQWdJSU45NDNH
NGpPdEEwd0NnWUlLb1pJemowRUF3SXdJakVUTUJFR0ExVUVBd3dLVFhrZ1VtOXZkQ0JEUVRFTE1Ba0dB
MVVFQmhNQ1UwVXdJQmNOTVRrd05ERXhNVFV5TmpRNVdoZ1BNakV4T1RBek1UZ3hOVEkyTkRsYU1DNHhD
ekFKQmdOVkJBWVRBbE5GTVE0d0RBWURWUVFMREFWVFZVNUZWREVQTUEwR0ExVUVBd3dHWVdSdGFXNHhN
Rmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUV0ZEIyQ3Vha1RnQjI2aWVIVER2SEMrQ0FL
N1VicTdsVHdlb1l1bWo0bnhpMWM3dldYREtVVHB0aTd4QXZDT3d1YkNDb2pJVDRNS1V2ZVF4T0luUGg4
cU9DQVNJd2dnRWVNQjBHQTFVZERnUVdCQlI5RldGamZUQTRybFV2bVRiY0F4WFYwd09mMURBZkJnTlZI
U01FR0RBV2dCUmpPbHllSWpCVGRVT0g1T1hITktaK3BCNnVDREJkQmdnckJnRUZCUWNCQVFSUk1FOHdL
QVlJS3dZQkJRVUhNQUtHSEdoMGRIQTZMeTlqWVM1bGVHRnRjR3hsTG1OdmJTOWpZUzVqY25Rd0l3WUlL
d1lCQlFVSE1BR0dGMmgwZEhBNkx5OXZZM053TG1WNFlXMXdiR1V1WTI5dE1DNEdBMVVkSHdRbk1DVXdJ
NkFob0IrR0hXaDBkSEE2THk5allTNWxlR0Z0Y0d4bExtTnZiUzlqY213dWNHVnRNQ0FHQTFVZEVnUVpN
QmVHRldoMGRIQTZMeTlqWVM1bGVHRnRjR3hsTG1OdmJUQUpCZ05WSFJNRUFqQUFNQXNHQTFVZER3UUVB
d0lGNERBVEJnTlZIU1VFRERBS0JnZ3JCZ0VGQlFjREFqQUtCZ2dxaGtqT1BRUURBZ05IQURCRUFpQlNt
WGVTQTVBWm9qb24zbklGL1FlaVJvdXVTR1lFWjhIK09JMkVJM21nT2dJZ0Zyc0VTb200THF2ZVllQzNy
RFRia3FLUTB6Y1lwNlJ4ZDV2aFIwWVJFbUk9Il19.eyJuYW1lcyI6WyJ0ZXN0LnRlc3QiXSwibm9uY2U
iOiJDcE1OLUFHQXRTR2lSVmFGVkhhcVJnIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdDo4MDAwL25ldy1
hdXRoeiIsImlhdCI6MTU1NTQ5OTExNiwiZXhwIjo0NzExMTcyNzE2LCJjcml0IjpbImV4cCJdfQ.Ps0e
mWkZEDcyxlzy9xx1ZD_nuyM10slyIFL-9iSwpzSNG0O4Lr01Nwz0R_G4tzMEtc8tIUQWpxdYsFbv5ANV
eA
'''
# strip newlines
TOKEN=''.join(TOKEN.split('\n'))
class Test_TokenValidation(unittest.TestCase):
def setUp(self):
self.data_dir = pkg_resources.resource_filename(__name__, 'data')
self.ici_ca_dir = os.path.join(self.data_dir, 'ici-ca')
self.audience = 'http://localhost:8000/new-authz'
self.config={'STORE_PATH': '/tmp',
}
self.context = Context(config=self.config)
def test_token_validate_valid(self):
self.context._nonces['CpMN-AGAtSGiRVaFVHaqRg'] = 'legit'
preauth = validate_token_signature(TOKEN, self.audience, self.context)
res = is_valid_preauth_token(preauth, self.ici_ca_dir, self.context)
self.assertEqual(res, ['test.test'])
| 54.347222
| 80
| 0.912343
| 176
| 3,913
| 20.073864
| 0.477273
| 0.012454
| 0.009341
| 0.010756
| 0.681574
| 0.681574
| 0.681574
| 0.681574
| 0.681574
| 0.681574
| 0
| 0.100325
| 0.054945
| 3,913
| 71
| 81
| 55.112676
| 0.855057
| 0.003578
| 0
| 0.516129
| 0
| 0
| 0.774185
| 0.744675
| 0
| 1
| 0
| 0
| 0.016129
| 1
| 0.032258
| false
| 0
| 0.096774
| 0
| 0.145161
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
915de6c91c1dcd7e762ae1cffc4fbf3a6a23c384
| 180
|
py
|
Python
|
bots/botlib/exc.py
|
honk-net/honknet.py
|
c02559cb820fdf182fa771776f3df499bf6da222
|
[
"MIT"
] | 2
|
2021-09-12T21:46:16.000Z
|
2021-09-12T21:47:22.000Z
|
bots/botlib/exc.py
|
ii-Python/termchat
|
c02559cb820fdf182fa771776f3df499bf6da222
|
[
"MIT"
] | null | null | null |
bots/botlib/exc.py
|
ii-Python/termchat
|
c02559cb820fdf182fa771776f3df499bf6da222
|
[
"MIT"
] | null | null | null |
# Copyright 2021 iiPython
# Argument errors
class ExcessiveArguments(Exception):
pass
class MissingArguments(Exception):
pass
class CommandNotFound(Exception):
pass
| 15
| 36
| 0.766667
| 17
| 180
| 8.117647
| 0.647059
| 0.282609
| 0.26087
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.026846
| 0.172222
| 180
| 11
| 37
| 16.363636
| 0.899329
| 0.216667
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
91685619b92d0994061000764fdaf387c48ff163
| 457
|
py
|
Python
|
downstream/tinypersons/mmdet/core/export/__init__.py
|
bwconrad/solo-learn
|
ec510d803a4428d7d8803b90fa1484c42cb9cb52
|
[
"MIT"
] | 326
|
2021-05-06T01:15:09.000Z
|
2022-03-30T14:52:13.000Z
|
downstream/tinypersons/mmdet/core/export/__init__.py
|
bwconrad/solo-learn
|
ec510d803a4428d7d8803b90fa1484c42cb9cb52
|
[
"MIT"
] | 48
|
2021-07-06T07:17:12.000Z
|
2022-03-14T11:38:36.000Z
|
downstream/tinypersons/mmdet/core/export/__init__.py
|
bwconrad/solo-learn
|
ec510d803a4428d7d8803b90fa1484c42cb9cb52
|
[
"MIT"
] | 54
|
2021-07-07T08:40:49.000Z
|
2022-03-16T05:02:35.000Z
|
from .onnx_helper import (add_dummy_nms_for_onnx, dynamic_clip_for_onnx,
get_k_for_topk)
from .pytorch2onnx import (build_model_from_cfg,
generate_inputs_and_wrap_model,
preprocess_example_input)
__all__ = [
'build_model_from_cfg', 'generate_inputs_and_wrap_model',
'preprocess_example_input', 'get_k_for_topk', 'add_dummy_nms_for_onnx',
'dynamic_clip_for_onnx'
]
| 38.083333
| 75
| 0.682713
| 58
| 457
| 4.637931
| 0.431034
| 0.104089
| 0.081784
| 0.104089
| 0.750929
| 0.750929
| 0.750929
| 0.750929
| 0.750929
| 0.483271
| 0
| 0.002924
| 0.251641
| 457
| 11
| 76
| 41.545455
| 0.783626
| 0
| 0
| 0
| 1
| 0
| 0.286652
| 0.212254
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.2
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
9198f3f6ea893f718852c289b669bb90c9153743
| 182
|
py
|
Python
|
plugin/src/test/resources/inspections/PyTypeCheckerInspection/WithOpenBinaryPy3.py
|
consulo/consulo-python
|
586c3eaee3f9c2cc87fb088dc81fb12ffa4b3a9d
|
[
"Apache-2.0"
] | null | null | null |
plugin/src/test/resources/inspections/PyTypeCheckerInspection/WithOpenBinaryPy3.py
|
consulo/consulo-python
|
586c3eaee3f9c2cc87fb088dc81fb12ffa4b3a9d
|
[
"Apache-2.0"
] | 11
|
2017-02-27T22:35:32.000Z
|
2021-12-24T08:07:40.000Z
|
plugin/src/test/resources/inspections/PyTypeCheckerInspection/WithOpenBinaryPy3.py
|
consulo/consulo-python
|
586c3eaee3f9c2cc87fb088dc81fb12ffa4b3a9d
|
[
"Apache-2.0"
] | null | null | null |
with open('foo', 'wb') as fd:
fd.write(b'bar')
with open('foo', 'wb') as fd:
fd.write(<warning descr="Expected type 'bytes | bytearray', got 'str' instead">'bar'</warning>)
| 30.333333
| 99
| 0.620879
| 29
| 182
| 3.896552
| 0.62069
| 0.141593
| 0.19469
| 0.230089
| 0.424779
| 0.424779
| 0.424779
| 0.424779
| 0
| 0
| 0
| 0
| 0.159341
| 182
| 5
| 100
| 36.4
| 0.738562
| 0
| 0
| 0.5
| 0
| 0
| 0.373626
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
53158952f5cec73aefbb8c59469f0684e6078c0a
| 24,855
|
py
|
Python
|
cogs/memes.py
|
MiningMark48/Tidal-Bot
|
8db6ecb220fd35930ffe1df5653af7a1ca03c8e9
|
[
"MIT"
] | 6
|
2020-08-09T15:43:07.000Z
|
2022-03-11T15:12:21.000Z
|
cogs/memes.py
|
MiningMark48/Tidal-Bot
|
8db6ecb220fd35930ffe1df5653af7a1ca03c8e9
|
[
"MIT"
] | 6
|
2020-10-29T02:32:40.000Z
|
2022-01-13T03:12:45.000Z
|
cogs/memes.py
|
MiningMark48/Tidal-Bot
|
8db6ecb220fd35930ffe1df5653af7a1ca03c8e9
|
[
"MIT"
] | 1
|
2021-06-09T08:06:31.000Z
|
2021-06-09T08:06:31.000Z
|
import random
import textwrap
import typing
from functools import partial
from io import BytesIO
import aiohttp
import discord
from PIL import Image, ImageDraw, ImageFont
from discord.ext import commands
from util.spongemock import mockify
class Memes(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
self.session = aiohttp.ClientSession(loop=bot.loop)
def draw_text(self, draw, line, pos, font, font_color, outlined=False):
(x,y) = pos
if outlined:
pos_o = [(x-1,y-1),(x+1,y-1),(x-1,y+1),(x+1,y+1)]
for p in pos_o:
draw.text(p, line, font=font, fill=0x000000)
draw.text((x, y), line, fill=font_color, font=font)
def processing_drawtext(self, text: list, template_name: str, base_pos=(0,0), font_size=55, font_color=0x000000,
font_name="arial", centered=False, outlined=False) -> BytesIO:
return self.processing_drawtext_multi([text], template_name, [base_pos], font_size, font_color, font_name,
centered, outlined)
def processing_drawtext_multi(self, text: list, template_name: str, base_pos=list, font_size=55,
font_color=0x000000, font_name="arial", centered=False, outlined=False) -> BytesIO:
with Image.open("./resources/images/memetemps/template_{}".format(template_name)) as im:
font = ImageFont.truetype(f'./resources/fonts/{font_name}.ttf', size=font_size)
text_draw = ImageDraw.Draw(im)
for entry in base_pos:
(x, y) = entry
y_text = y
for line in text[base_pos.index(entry)]:
if centered:
w, _ = im.size
tw, _ = text_draw.textsize(str(line), font)
self.draw_text(text_draw, line, (((w-tw)/2), y_text), font, font_color, outlined)
else:
self.draw_text(text_draw, line, (x, y_text), font, font_color, outlined)
y_text += (font_size + 5)
final_buffer = BytesIO()
im.save(final_buffer, "png")
final_buffer.seek(0)
return final_buffer
@staticmethod
def processing_drawtext_snapchat(text: str, template_name: str, height=0, scale=1,
font_color=0xffffffff) -> BytesIO:
font_size = 24 * scale
with Image.open("./resources/images/memetemps/template_{}".format(template_name)) as im:
im = im.convert("RGBA")
im_o = Image.new('RGBA', im.size, (0,0,0,0))
font = ImageFont.truetype('./resources/fonts/arial.ttf', size=font_size)
draw = ImageDraw.Draw(im_o)
w, _ = im.size
tw, th = draw.textsize(text, font)
shape_h = 35 * scale
shape = ((0, height), (w, height+shape_h))
draw.rectangle(shape, fill=(0,0,0,160))
draw.text(((w-tw)/2, height+(shape_h-th)/2), text, fill=font_color, font=font)
im = Image.alpha_composite(im, im_o)
im = im.convert("RGB")
final_buffer = BytesIO()
im.save(final_buffer, "png")
final_buffer.seek(0)
return final_buffer
async def try_delete(self, ctx):
try:
await ctx.message.delete()
except discord.HTTPException:
pass
@staticmethod
def get_message(ctx):
return f'{ctx.author.mention}, here you go!'
@commands.command(name="alwayshasbeen", aliases=["ahb"])
@commands.cooldown(1, 5, commands.BucketType.user)
async def always_has_been(self, ctx, text1: str, text2: str, text3: str="Always has been..."):
"""
*Always has been.*
Note: This will likely require quotes.
"""
await self.try_delete(ctx)
chars_per_line = 15
lines = 3
max_chars = chars_per_line * lines
if len(text1) > max_chars or len(text2) > max_chars or len(text3) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines1 = wrapper.wrap(text=text1)
lines2 = wrapper.wrap(text=text2)
lines3 = wrapper.wrap(text=text3)
fn = partial(self.processing_drawtext_multi, [lines1, lines2, lines3], "alwayshasbeen.png",
[(155, 240), (360, 160), (720, 40)], 42, 0xffffff, outlined=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="alwayshasbeen.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def dashdefine(self, ctx, *, text: str):
"""It defines who I am"""
await self.try_delete(ctx)
chars_per_line = 28
lines = 3
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text)
fn = partial(self.processing_drawtext, lines, "dashdefine.png", (20, 20), 55)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="dashdefine.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command(name="draw25")
@commands.cooldown(1, 5, commands.BucketType.user)
async def draw_twofive(self, ctx, *, text: str):
"""...or draw 25 cards"""
await self.try_delete(ctx)
chars_per_line = 15
lines = 5
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text.upper())
fn = partial(self.processing_drawtext, lines, "draw25.png", (125, 125), 24, font_color=0xffffff,
font_name="impact", outlined=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="draw25.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command(name="exit12")
@commands.cooldown(1, 5, commands.BucketType.user)
async def exit(self, ctx, text1: str, text2: str, text3: str):
"""
Left, Exit 12. *Screech*
Note: This will likely require quotes.
"""
await self.try_delete(ctx)
chars_per_line = 10
lines = 5
max_chars = chars_per_line * lines
if len(text1) > max_chars or len(text2) > max_chars or len(text3) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines1 = wrapper.wrap(text=text1)
lines2 = wrapper.wrap(text=text2)
lines3 = wrapper.wrap(text=text3)
fn = partial(self.processing_drawtext_multi, [lines1, lines2, lines3], "exit12.png",
[(200, 100), (420, 100), (415, 540)], 30, 0xffffff)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="exit12.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command(name="financialsupport")
@commands.cooldown(1, 5, commands.BucketType.user)
async def financial_support(self, ctx, *, text: str):
"""Financially support me plz"""
await self.try_delete(ctx)
chars_per_line = 30
lines = 3
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text)
fn = partial(self.processing_drawtext, lines, "financialsupport.png", (20, 20), 40, centered=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="finan_support.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command(name="flexboat", aliases=["philswiftboat"])
@commands.cooldown(1, 5, commands.BucketType.user)
async def flex_boat(self, ctx, text1: str, text2: str):
"""
I sawed this boat in half!
Note: This will likely require quotes.
"""
await self.try_delete(ctx)
chars_per_line = 10
lines = 3
max_chars = chars_per_line * lines
if len(text1) > max_chars or len(text2) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines1 = wrapper.wrap(text=text1.upper())
lines2 = wrapper.wrap(text=text2.upper())
fn = partial(self.processing_drawtext_multi, [lines1, lines2, lines2], "flexboat.png",
[(235, 170), (70, 245), (400, 245)], 24, 0xffffff, font_name="impact", outlined=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="flex_boat.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command(name="flextape", aliases=["philswift", "flexon", "flexseal"])
@commands.cooldown(1, 5, commands.BucketType.user)
async def flex_tape(self, ctx, text1: str, text2: str, text3: str):
"""
Flex on!
Note: This will likely require quotes.
"""
await self.try_delete(ctx)
chars_per_line = 10
lines = 3
max_chars = chars_per_line * lines
if len(text1) > max_chars or len(text2) > max_chars or len(text3) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines1 = wrapper.wrap(text=text1.upper())
lines2 = wrapper.wrap(text=text2.upper())
lines3 = wrapper.wrap(text=text3.upper())
fn = partial(self.processing_drawtext_multi, [lines1, lines2, lines3], "flextape.png",
[(80, 115), (350, 115), (230, 370)], 30, 0xffffff, font_name="impact", outlined=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="flex_tape.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def kkchum(self, ctx, text1: str, text2: str):
"""
Krusty Krab > Chum Bucket
"""
await self.try_delete(ctx)
chars_per_line = 15
lines = 2
max_chars = chars_per_line * lines
if len(text1) > max_chars or len(text2) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines1 = wrapper.wrap(text=text1.upper())
lines2 = wrapper.wrap(text=text2.upper())
fn = partial(self.processing_drawtext_multi, [lines1, lines2], "kkchum.jpg", [(165, 40), (200, 460)], 40,
0xffffff, "impact", centered=False, outlined=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="kkchum.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def linus(self, ctx, *, text: str):
"""
Linus selfies ftw.
"""
await self.try_delete(ctx)
max_chars = 60
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
fn = partial(self.processing_drawtext_snapchat, text, "linus.jpg", random.randint(250, 450))
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="linus.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def nobrain(self, ctx, *, text: str):
"""Oh F***, I forgot to give you a brain."""
await self.try_delete(ctx)
chars_per_line = 20
lines = 3
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text)
fn = partial(self.processing_drawtext, lines, "nobrain.jpg", (40, 380), 24)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="nobrain.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command(name="nothere")
@commands.cooldown(1, 5, commands.BucketType.user)
async def not_here(self, ctx, *, text: str):
"""We don't do that here."""
await self.try_delete(ctx)
chars_per_line = 35
lines = 3
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text)
fn = partial(self.processing_drawtext, lines, "nothere.png", (20, 20), 28, centered=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="not_here.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def patrickpush(self, ctx, text1: str, text2: str):
"""
PUSH IT SOMEWHERE ELSE!
"""
await self.try_delete(ctx)
chars_per_line = 23
lines = 2
max_chars = chars_per_line * lines
if len(text1) > max_chars or len(text2) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines1 = wrapper.wrap(text=text1.upper())
lines2 = wrapper.wrap(text=text2.upper())
fn = partial(self.processing_drawtext_multi, [lines1, lines2], "patrickpush.jpg", [(0, 5), (0, 525)], 30,
0xffffff, "impact", centered=True, outlined=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="patrickpush.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command(name="pelosirip", aliases=['pelrip'])
@commands.cooldown(1, 5, commands.BucketType.user)
async def pelosi_rip(self, ctx, *, text: str):
"""*Rips speech*"""
await self.try_delete(ctx)
chars_per_line = 15
lines = 2
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text.upper())
fn = partial(self.processing_drawtext, lines, "pelosirip.png", (515, 255), 30, font_color=0xffffff,
font_name="impact", outlined=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="pelosi_rip.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command(aliases=['pikasurprise', 'surprisedpika'])
@commands.cooldown(1, 5, commands.BucketType.user)
async def pika(self, ctx, *, text: str):
"""!"""
await self.try_delete(ctx)
chars_per_line = 40
lines = 3
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text)
fn = partial(self.processing_drawtext, lines, "pika.png", (20, 20), 30, centered=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="pika.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def shocked(self, ctx, *, text: str):
"""O_O"""
await self.try_delete(ctx)
chars_per_line = 38
lines = 2
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text)
fn = partial(self.processing_drawtext, lines, "shocked.png", (20, 20), 32)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="shocked.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def spongebreathe(self, ctx, *, text: str):
"""*Breathe in* Shit."""
await self.try_delete(ctx)
chars_per_line = 20
lines = 3
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text)
fn = partial(self.processing_drawtext, lines, "spongebreathe.jpg", (30, 30))
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="spongebreathe.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def spongemock(self, ctx, *, text: typing.Optional[str]):
"""spOngEBoB MoCKifY soMe TeXT"""
await self.try_delete(ctx)
chars_per_line = 35
lines = 3
if not text:
messages = await ctx.channel.history(limit=1).flatten()
text = messages[0].content
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=mockify(text))
fn = partial(self.processing_drawtext, lines, "spongemock.png", (20, 20), 40, centered=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="spongemock.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def spongeout(self, ctx, *, text: str):
"""'Ight, Imma head out"""
await self.try_delete(ctx)
chars_per_line = 25
lines = 3
max_chars = chars_per_line * lines
if len(text) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines = wrapper.wrap(text=text)
fn = partial(self.processing_drawtext, lines, "spongeout.png", (20, 20), 40, centered=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="spongeout.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command(name="spongepickle")
@commands.cooldown(1, 5, commands.BucketType.user)
async def sponge_pickle(self, ctx, text1: str, text2: str):
"""
I've come for your pickle.
Note: This will likely require quotes.
"""
await self.try_delete(ctx)
chars_per_line = 10
lines = 2
max_chars = chars_per_line * lines
if len(text1) > max_chars or len(text2) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines1 = wrapper.wrap(text=text1.upper())
lines2 = wrapper.wrap(text=text2.upper())
fn = partial(self.processing_drawtext_multi, [lines1, lines2], "spongepickle.png",
[(200, 320), (400, 30)], 54, 0xffffff, font_name="impact", outlined=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="flex_boat.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def tea(self, ctx, text1: str, text2="But that's none of my business"):
"""
*Sips tea*
"""
await self.try_delete(ctx)
chars_per_line = 24
lines = 2
max_chars = chars_per_line * lines
if len(text1) > max_chars or len(text2) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines1 = wrapper.wrap(text=text1.upper())
lines2 = wrapper.wrap(text=text2.upper())
fn = partial(self.processing_drawtext_multi, [lines1, lines2], "tea.jpg", [(0, 5), (0, 475)], 55, 0xffffff,
"impact", centered=True, outlined=True)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="tea.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def twobuttons(self, ctx, text1: str, text2: str):
"""
Two buttons! *cue sweating*
Note: This will likely require quotes.
"""
await self.try_delete(ctx)
chars_per_line = 10
lines = 2
max_chars = chars_per_line * lines
if len(text1) > max_chars or len(text2) > max_chars:
return await ctx.send(f'Too many characters! Must be less than `{max_chars}`.')
async with ctx.typing():
wrapper = textwrap.TextWrapper(width=chars_per_line)
lines1 = wrapper.wrap(text=text1)
lines2 = wrapper.wrap(text=text2)
fn = partial(self.processing_drawtext_multi, [lines1, lines2], "twobuttons.png", [(80, 80), (240, 50)], 30)
final_buffer = await self.bot.loop.run_in_executor(None, fn)
file = discord.File(filename="twobuttons.png", fp=final_buffer)
await ctx.send(content=self.get_message(ctx), file=file)
def setup(bot: commands.Bot):
bot.add_cog(Memes(bot))
| 43.452797
| 119
| 0.60869
| 3,197
| 24,855
| 4.590554
| 0.101032
| 0.040883
| 0.04906
| 0.035909
| 0.793609
| 0.784069
| 0.772554
| 0.766558
| 0.736577
| 0.706391
| 0
| 0.027655
| 0.269684
| 24,855
| 571
| 120
| 43.528897
| 0.780851
| 0
| 0
| 0.644342
| 0
| 0
| 0.087702
| 0.006753
| 0
| 0
| 0.004781
| 0
| 0
| 1
| 0.016166
| false
| 0.002309
| 0.023095
| 0.004619
| 0.099307
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
5340fef5257999d10cc5ee20c0c5f4c998176a02
| 9,781
|
py
|
Python
|
waymo_open_dataset/utils/occupancy_flow_metrics_test.py
|
yangxin0/waymo-open-dataset
|
a54c80169864e7b3be2722992a8c6a5dd6c2f10d
|
[
"Apache-2.0"
] | 1
|
2022-03-28T03:49:41.000Z
|
2022-03-28T03:49:41.000Z
|
waymo_open_dataset/utils/occupancy_flow_metrics_test.py
|
xuitex/waymo-open-dataset
|
1297cdcbcd103d4befb4b498e50a0c030053e6c0
|
[
"Apache-2.0"
] | null | null | null |
waymo_open_dataset/utils/occupancy_flow_metrics_test.py
|
xuitex/waymo-open-dataset
|
1297cdcbcd103d4befb4b498e50a0c030053e6c0
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2022 The Waymo Open Dataset Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================
"""Tests for occupancy_flow_metrics."""
import numpy as np
import tensorflow as tf
from waymo_open_dataset.utils import occupancy_flow_grids
from waymo_open_dataset.utils import occupancy_flow_metrics
from waymo_open_dataset.utils import occupancy_flow_test_util
class OccupancyFlowMetricsTest(tf.test.TestCase):
def test_compute_occupancy_flow_metrics(self):
config = occupancy_flow_test_util.make_test_config()
# Two boxes with 25% overlap.
true_occupancy = np.zeros([4, 256, 256, 1], dtype=np.float32)
true_occupancy[:, 100:120, 100:120, :] = 1.0
true_occupancy = tf.convert_to_tensor(true_occupancy)
pred_occupancy = np.zeros([4, 256, 256, 1], dtype=np.float32)
pred_occupancy[:, 110:130, 110:130, :] = 1.0
pred_occupancy = tf.convert_to_tensor(pred_occupancy)
base_flow = tf.ones([4, 256, 256, 2])
true_waypoints = occupancy_flow_grids.WaypointGrids()
pred_waypoints = occupancy_flow_grids.WaypointGrids()
true_waypoints.vehicles.observed_occupancy = [true_occupancy] * 8
pred_waypoints.vehicles.observed_occupancy = [pred_occupancy] * 8
true_waypoints.vehicles.occluded_occupancy = [true_occupancy * 0.2] * 8
pred_waypoints.vehicles.occluded_occupancy = [pred_occupancy * 0.2] * 8
true_waypoints.vehicles.flow_origin_occupancy = [true_occupancy] * 8
true_waypoints.vehicles.flow = [base_flow * 0.5] * 8
pred_waypoints.vehicles.flow = [base_flow * 3.5] * 8
metrics = occupancy_flow_metrics.compute_occupancy_flow_metrics(
config=config,
true_waypoints=true_waypoints,
pred_waypoints=pred_waypoints,
)
self.assertNear(metrics.vehicles_observed_auc, 0.07, err=0.01)
self.assertNear(metrics.vehicles_occluded_auc, 0.07, err=0.01)
self.assertNear(metrics.vehicles_observed_iou, 0.14, err=0.01)
self.assertNear(metrics.vehicles_occluded_iou, 0.02, err=0.01)
self.assertNear(metrics.vehicles_flow_epe, 4.24, err=0.01)
self.assertNear(metrics.vehicles_flow_warped_occupancy_auc, 0.12, err=0.01)
self.assertNear(metrics.vehicles_flow_warped_occupancy_iou, 0.10, err=0.01)
def test_compute_occupancy_soft_iou(self):
# Both zeros.
true_occupancy = tf.zeros([2, 100, 100, 1])
pred_occupancy = tf.zeros([2, 100, 100, 1])
soft_iou = occupancy_flow_metrics._compute_occupancy_soft_iou(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(soft_iou, 0.0, err=1e-3)
# Both ones.
true_occupancy = tf.ones([2, 100, 100, 1])
pred_occupancy = tf.ones([2, 100, 100, 1])
soft_iou = occupancy_flow_metrics._compute_occupancy_soft_iou(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(soft_iou, 1.0, err=1e-3)
# Ground-truth = 0, predictions = 1.
true_occupancy = tf.zeros([2, 100, 100, 1])
pred_occupancy = tf.ones([2, 100, 100, 1])
soft_iou = occupancy_flow_metrics._compute_occupancy_soft_iou(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
# Score is explicitly zero if ground-truth is all zeros.
self.assertNear(soft_iou, 0.0, err=1e-3)
# Ground-truth has a 10x10 patch of 1s, predictions = 0.
true_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
true_occupancy[:, 10:20, 10:20, :] = 1.0
true_occupancy = tf.convert_to_tensor(true_occupancy)
pred_occupancy = tf.zeros([2, 100, 100, 1])
soft_iou = occupancy_flow_metrics._compute_occupancy_soft_iou(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(soft_iou, 0.0, err=1e-3)
# Ground-truth and predictions have a 10x10 patch of 1s at different places.
true_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
true_occupancy[:, 10:20, 10:20, :] = 1.0
true_occupancy = tf.convert_to_tensor(true_occupancy)
pred_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
pred_occupancy[:, 30:40, 30:40, :] = 1.0
pred_occupancy = tf.convert_to_tensor(pred_occupancy)
soft_iou = occupancy_flow_metrics._compute_occupancy_soft_iou(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(soft_iou, 0.0, err=1e-3)
# Ground-truth and predictions have a 10x10 patch of 1s with 50% overlap.
true_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
true_occupancy[:, 10:20, 10:20, :] = 1.0
pred_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
pred_occupancy[:, 15:25, 10:20, :] = 1.0
soft_iou = occupancy_flow_metrics._compute_occupancy_soft_iou(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(soft_iou, 0.333, err=1e-3)
# Predictions are a linear transformation of ground-truth.
true_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
true_occupancy[:, 10:20, 10:20, :] = 1.0
true_occupancy = tf.convert_to_tensor(true_occupancy)
pred_occupancy = true_occupancy / 2 + 0.25
soft_iou = occupancy_flow_metrics._compute_occupancy_soft_iou(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(soft_iou, 0.029, err=1e-3)
def test_compute_occupancy_auc(self):
# Both zeros.
true_occupancy = tf.zeros([2, 100, 100, 1])
pred_occupancy = tf.zeros([2, 100, 100, 1])
auc = occupancy_flow_metrics._compute_occupancy_auc(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(auc, 0.0, err=1e-3)
# Both ones.
true_occupancy = tf.ones([2, 100, 100, 1])
pred_occupancy = tf.ones([2, 100, 100, 1])
auc = occupancy_flow_metrics._compute_occupancy_auc(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(auc, 1.0, err=1e-3)
# Ground-truth = 0, predictions = 1.
true_occupancy = tf.zeros([2, 100, 100, 1])
pred_occupancy = tf.ones([2, 100, 100, 1])
auc = occupancy_flow_metrics._compute_occupancy_auc(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(auc, 0.0, err=1e-3)
# Ground-truth has a 10x10 patch of 1s, predictions = 0.
true_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
true_occupancy[:, 10:20, 10:20, :] = 1.0
true_occupancy = tf.convert_to_tensor(true_occupancy)
pred_occupancy = tf.zeros([2, 100, 100, 1])
auc = occupancy_flow_metrics._compute_occupancy_auc(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(auc, 0.01, err=1e-3)
# Ground-truth and predictions have a 10x10 patch of 1s at different places.
true_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
true_occupancy[:, 10:20, 10:20, :] = 1.0
true_occupancy = tf.convert_to_tensor(true_occupancy)
pred_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
pred_occupancy[:, 30:40, 30:40, :] = 1.0
pred_occupancy = tf.convert_to_tensor(pred_occupancy)
auc = occupancy_flow_metrics._compute_occupancy_auc(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(auc, 0.009, err=1e-3)
# Ground-truth and predictions have a 10x10 patch of 1s with 50% overlap.
true_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
true_occupancy[:, 10:20, 10:20, :] = 1.0
pred_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
pred_occupancy[:, 15:25, 10:20, :] = 1.0
auc = occupancy_flow_metrics._compute_occupancy_auc(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(auc, 0.26404, err=1e-3)
# Predictions are a linear transformation of ground-truth.
true_occupancy = np.zeros([2, 100, 100, 1], dtype=np.float32)
true_occupancy[:, 10:20, 10:20, :] = 1.0
true_occupancy = tf.convert_to_tensor(true_occupancy)
pred_occupancy = true_occupancy / 2 + 0.25
auc = occupancy_flow_metrics._compute_occupancy_auc(
true_occupancy=true_occupancy,
pred_occupancy=pred_occupancy,
)
self.assertNear(auc, 1.0, err=1e-3)
def test_compute_flow_epe(self):
# Both zeros.
true_flow = tf.zeros([4, 100, 100, 2])
pred_flow = tf.zeros([4, 100, 100, 2])
epe = occupancy_flow_metrics._compute_flow_epe(
true_flow=true_flow,
pred_flow=pred_flow,
)
self.assertNear(epe, 0.0, err=1e-3)
# Both ones.
true_flow = tf.ones([4, 100, 100, 2])
pred_flow = tf.ones([4, 100, 100, 2])
epe = occupancy_flow_metrics._compute_flow_epe(
true_flow=true_flow,
pred_flow=pred_flow,
)
self.assertNear(epe, 0.0, err=1e-3)
# 3**2 + 4**2 = 5**2
true_flow = tf.ones([4, 10, 10, 2]) * tf.constant([3.0, -4.0])
pred_flow = tf.zeros([4, 10, 10, 2])
epe = occupancy_flow_metrics._compute_flow_epe(
true_flow=true_flow,
pred_flow=pred_flow,
)
self.assertNear(epe, 5.0, err=1e-3)
if __name__ == '__main__':
tf.test.main()
| 40.417355
| 80
| 0.692465
| 1,433
| 9,781
| 4.473831
| 0.114445
| 0.143971
| 0.126969
| 0.032444
| 0.804243
| 0.752457
| 0.743098
| 0.732803
| 0.696303
| 0.696303
| 0
| 0.082298
| 0.185053
| 9,781
| 241
| 81
| 40.585062
| 0.721992
| 0.149371
| 0
| 0.616667
| 0
| 0
| 0.000966
| 0
| 0
| 0
| 0
| 0
| 0.133333
| 1
| 0.022222
| false
| 0
| 0.027778
| 0
| 0.055556
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 5
|
5346eb1bfc5b45ae60987df01fff2fa77d1e176f
| 289
|
py
|
Python
|
src/attrbench/lib/masking/__init__.py
|
zoeparman/benchmark
|
96331b7fa0db84f5f422b52cae2211b41bbd15ce
|
[
"MIT"
] | null | null | null |
src/attrbench/lib/masking/__init__.py
|
zoeparman/benchmark
|
96331b7fa0db84f5f422b52cae2211b41bbd15ce
|
[
"MIT"
] | 7
|
2020-03-02T13:03:50.000Z
|
2022-03-12T00:16:20.000Z
|
src/attrbench/lib/masking/__init__.py
|
zoeparman/benchmark
|
96331b7fa0db84f5f422b52cae2211b41bbd15ce
|
[
"MIT"
] | null | null | null |
from .masker import Masker
from .image_masker import ImageMasker
from .constant_masker import ConstantMasker
from .sample_average_masker import SampleAverageMasker
from .blurring_masker import BlurringMasker
from .random_masker import RandomMasker
from .tabular_masker import TabularMasker
| 41.285714
| 54
| 0.882353
| 35
| 289
| 7.085714
| 0.457143
| 0.33871
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.093426
| 289
| 7
| 55
| 41.285714
| 0.946565
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
535c3d0e448c3f7e11e03d197a1ae8d7d60497d7
| 43
|
py
|
Python
|
test/python/LIM2Metrics/py2/base/common/Python005/Python005.py
|
sagodiz/SonarQube-plug-in
|
4f8e111baecc4c9f9eaa5cd3d7ebeb1e365ace2c
|
[
"BSD-4-Clause"
] | 20
|
2015-06-16T17:39:10.000Z
|
2022-03-20T22:39:40.000Z
|
test/python/LIM2Metrics/py2/base/common/Python005/Python005.py
|
sagodiz/SonarQube-plug-in
|
4f8e111baecc4c9f9eaa5cd3d7ebeb1e365ace2c
|
[
"BSD-4-Clause"
] | 29
|
2015-12-29T19:07:22.000Z
|
2022-03-22T10:39:02.000Z
|
test/python/LIM2Metrics/py2/base/common/Python005/Python005.py
|
sagodiz/SonarQube-plug-in
|
4f8e111baecc4c9f9eaa5cd3d7ebeb1e365ace2c
|
[
"BSD-4-Clause"
] | 12
|
2015-08-28T01:22:18.000Z
|
2021-09-25T08:17:31.000Z
|
try:
print "Ez baj ha megjelenik"
| 10.75
| 32
| 0.581395
| 6
| 43
| 4.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.348837
| 43
| 4
| 33
| 10.75
| 0.892857
| 0
| 0
| 0
| 0
| 0
| 0.454545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.5
| 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
| 1
|
0
| 5
|
72aa16be47d3501cefeefa6d43e35beaedf3ac29
| 65
|
py
|
Python
|
python notebooks by Akshit Ostwal/module and packages/MyMainPackage/SubPackage/mysubscript.py
|
AkshitOstwal/Python_Bootcamp
|
ce810d0d9e5f9b04d7795f3b1024c8b4b1ad3bc8
|
[
"MIT"
] | 4
|
2019-01-09T14:07:49.000Z
|
2020-09-05T08:40:05.000Z
|
python notebooks by Akshit Ostwal/module and packages/MyMainPackage/SubPackage/mysubscript.py
|
AkshitOstwal/Python_Bootcamp
|
ce810d0d9e5f9b04d7795f3b1024c8b4b1ad3bc8
|
[
"MIT"
] | null | null | null |
python notebooks by Akshit Ostwal/module and packages/MyMainPackage/SubPackage/mysubscript.py
|
AkshitOstwal/Python_Bootcamp
|
ce810d0d9e5f9b04d7795f3b1024c8b4b1ad3bc8
|
[
"MIT"
] | null | null | null |
def sub_report():
print('hey i am a function inside submscript')
| 32.5
| 47
| 0.753846
| 11
| 65
| 4.363636
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.138462
| 65
| 2
| 47
| 32.5
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0.560606
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 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
| 1
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
f454e0bbd3c945f8828dacac0cdb60f5058e330b
| 228
|
py
|
Python
|
pyspotify/auth/__init__.py
|
Bnjorogedev/pyspotify-client
|
9e88e5ce6640f552cda08c591600bf0519700700
|
[
"MIT"
] | 1
|
2021-01-17T20:55:02.000Z
|
2021-01-17T20:55:02.000Z
|
pyspotify/auth/__init__.py
|
Bnjorogedev/pyspotify-client
|
9e88e5ce6640f552cda08c591600bf0519700700
|
[
"MIT"
] | null | null | null |
pyspotify/auth/__init__.py
|
Bnjorogedev/pyspotify-client
|
9e88e5ce6640f552cda08c591600bf0519700700
|
[
"MIT"
] | null | null | null |
from .auth_config import AuthMode
from .authorization import Authorization
from .authenticate import authenticate, _authentication_request, _authorization_code_request
from .authenticate import _get_access_token, _get_auth_code
| 45.6
| 92
| 0.885965
| 27
| 228
| 7.037037
| 0.481481
| 0.168421
| 0.231579
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 228
| 4
| 93
| 57
| 0.909091
| 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
| 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
| 5
|
f47dfade3bf6a9f40732d60e3ceb899f306b2fcd
| 43
|
py
|
Python
|
tests/__init__.py
|
jwaschkau/django-unpoly
|
31b4afcb4607a41d25ccbfe45681bc6ed1769175
|
[
"MIT"
] | 7
|
2021-06-07T12:31:26.000Z
|
2022-01-02T05:53:13.000Z
|
tests/__init__.py
|
jwaschkau/django-unpoly
|
31b4afcb4607a41d25ccbfe45681bc6ed1769175
|
[
"MIT"
] | 13
|
2021-06-23T11:32:54.000Z
|
2021-10-07T15:12:07.000Z
|
tests/__init__.py
|
jwaschkau/django-unpoly
|
31b4afcb4607a41d25ccbfe45681bc6ed1769175
|
[
"MIT"
] | null | null | null |
"""Unit test package for django-unpoly."""
| 21.5
| 42
| 0.697674
| 6
| 43
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116279
| 43
| 1
| 43
| 43
| 0.789474
| 0.837209
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
be418d17a5bff4b6095bac41e9a445fdb5a79a5c
| 106
|
py
|
Python
|
python/tuples.py
|
markfranciose/cheat_sheet_of_cheat_sheets
|
d126bbbb499af43098d3938e35df3381833cecac
|
[
"MIT"
] | null | null | null |
python/tuples.py
|
markfranciose/cheat_sheet_of_cheat_sheets
|
d126bbbb499af43098d3938e35df3381833cecac
|
[
"MIT"
] | 20
|
2020-07-21T01:52:53.000Z
|
2022-02-27T09:44:44.000Z
|
python/tuples.py
|
markfranciose/drops_of_knowledge
|
d126bbbb499af43098d3938e35df3381833cecac
|
[
"MIT"
] | null | null | null |
# define a tuple
a = (5) # will be an integer
a = (5,) # will be a tuple
a = 5, # will also be a tuple
| 21.2
| 31
| 0.575472
| 22
| 106
| 2.772727
| 0.409091
| 0.295082
| 0.295082
| 0.262295
| 0.393443
| 0
| 0
| 0
| 0
| 0
| 0
| 0.040541
| 0.301887
| 106
| 4
| 32
| 26.5
| 0.783784
| 0.660377
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 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
| 5
|
fe40babb6424925854ba2d843b8d9fba383dd39c
| 208
|
py
|
Python
|
zdiscord/service/Service.py
|
xxdunedainxx/zdiscord
|
e79039621969fd7a2987ccac4e8d6fcff11ee754
|
[
"MIT"
] | null | null | null |
zdiscord/service/Service.py
|
xxdunedainxx/zdiscord
|
e79039621969fd7a2987ccac4e8d6fcff11ee754
|
[
"MIT"
] | 57
|
2020-06-05T18:33:17.000Z
|
2020-08-17T18:28:37.000Z
|
zdiscord/service/Service.py
|
xxdunedainxx/zdiscord
|
e79039621969fd7a2987ccac4e8d6fcff11ee754
|
[
"MIT"
] | null | null | null |
from zdiscord.util.logging.LogFactory import LogFactory
import logging
class Service:
def __init__(self, name: str):
self._logger: logging._loggerClass = LogFactory.get_logger(logName=f"{name}")
| 29.714286
| 85
| 0.759615
| 26
| 208
| 5.807692
| 0.692308
| 0.211921
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139423
| 208
| 7
| 85
| 29.714286
| 0.843575
| 0
| 0
| 0
| 0
| 0
| 0.028708
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0
| 0.8
| 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
| 1
| 0
|
0
| 5
|
fe8eac936694490e6eccafccb2e93cf1a9c92473
| 87
|
py
|
Python
|
Rabbit/demo.py
|
kangyan328/RabbitMQ
|
255c4410c81bc71afaca7d7fbdf4ac436e007f6d
|
[
"MIT"
] | null | null | null |
Rabbit/demo.py
|
kangyan328/RabbitMQ
|
255c4410c81bc71afaca7d7fbdf4ac436e007f6d
|
[
"MIT"
] | null | null | null |
Rabbit/demo.py
|
kangyan328/RabbitMQ
|
255c4410c81bc71afaca7d7fbdf4ac436e007f6d
|
[
"MIT"
] | null | null | null |
from datetime import datetime
now = datetime.now()
print(now)
print(now.strftime('%x'))
| 21.75
| 29
| 0.747126
| 13
| 87
| 5
| 0.538462
| 0.338462
| 0.338462
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.091954
| 87
| 4
| 30
| 21.75
| 0.822785
| 0
| 0
| 0
| 0
| 0
| 0.022727
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0.5
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
feab1defa37c74eb75e4536c5e409ee68f30b844
| 198
|
py
|
Python
|
src/rl_behavior/src/utility/__init__.py
|
rjnieves/SwarmiesRL
|
34f81be360e8340b8cbbab19137561fdd1cd8c80
|
[
"MIT"
] | null | null | null |
src/rl_behavior/src/utility/__init__.py
|
rjnieves/SwarmiesRL
|
34f81be360e8340b8cbbab19137561fdd1cd8c80
|
[
"MIT"
] | null | null | null |
src/rl_behavior/src/utility/__init__.py
|
rjnieves/SwarmiesRL
|
34f81be360e8340b8cbbab19137561fdd1cd8c80
|
[
"MIT"
] | null | null | null |
"""Amalgamation for the utility package.
"""
from .yaw import yaw_wrap, vectorized_yaw_wrap, YawBearing
from .pid import PidLoop
from .pathplan import PathPlanning
# vim: set ts=2 sw=2 expandtab:
| 22
| 58
| 0.772727
| 29
| 198
| 5.172414
| 0.724138
| 0.093333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011765
| 0.141414
| 198
| 8
| 59
| 24.75
| 0.870588
| 0.343434
| 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
| 1
| 0
|
0
| 5
|
feaf98e0b519fb1a37edc80de2410a9e994034d1
| 2,531
|
py
|
Python
|
perelachaise/tests.py
|
MaximeLM/perelachaise-server
|
d813cfde691b005a6641f57e2baea220116277a6
|
[
"MIT"
] | null | null | null |
perelachaise/tests.py
|
MaximeLM/perelachaise-server
|
d813cfde691b005a6641f57e2baea220116277a6
|
[
"MIT"
] | null | null | null |
perelachaise/tests.py
|
MaximeLM/perelachaise-server
|
d813cfde691b005a6641f57e2baea220116277a6
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# encoding: utf-8
import datetime
from django.test import TestCase
from perelachaise.models import NodeOSM, Monument, Personnalite
class MonumentTest(TestCase):
"""
Tests du modèle Monument
"""
# Fixture
fixtures = ['perelachaise.json']
def test_create_resume(self):
"""
La création d'un monument doit supprimer les \r du résumé.
"""
# Création d'un node OSM
node_osm = NodeOSM.objects.get(pk=470258150)
node_osm.pk = 999999
node_osm.save()
# Création d'un monument
monument = Monument.objects.get(nom=u'Jim Morrison')
monument.pk = 999999
monument.resume = u'ligne 1\r\nligne 2\nligne 3\rligne4'
monument.node_osm = node_osm
monument.save()
# Vérification de la suppression des \r
self.assertEqual(u'ligne 1\nligne 2\nligne 3ligne4',monument.resume)
def test_save_resume(self):
"""
La sauvegarde d'un monument doit supprimer les \r du résumé.
"""
# Modification d'un monument
monument = Monument.objects.get(nom=u'Jim Morrison')
monument.resume = u'ligne 1\r\nligne 2\nligne 3\rligne4'
monument.save()
# Vérification de la suppression des \r
self.assertEqual(u'ligne 1\nligne 2\nligne 3ligne4',monument.resume)
class PersonnaliteTest(TestCase):
"""
Tests du modèle Personnalite
"""
# Fixture
fixtures = ['perelachaise.json']
def test_create_resume(self):
"""
La création d'une personnalité doit supprimer les \r du résumé.
"""
# Création d'une personnalité
personnalite = Personnalite.objects.get(nom=u'Jim Morrison')
personnalite.pk = 999999
personnalite.resume = u'ligne 1\r\nligne 2\nligne 3\rligne4'
personnalite.save()
# Vérification de la suppression des \r
self.assertEqual(u'ligne 1\nligne 2\nligne 3ligne4',personnalite.resume)
def test_save_resume(self):
"""
La sauvegarde d'une personnalité doit supprimer les \r du résumé.
"""
# Modification d'une personnalité
personnalite = Personnalite.objects.get(nom=u'Jim Morrison')
personnalite.resume = u'ligne 1\r\nligne 2\nligne 3\rligne4'
personnalite.save()
# Vérification de la suppression des \r
self.assertEqual(u'ligne 1\nligne 2\nligne 3ligne4',personnalite.resume)
| 31.246914
| 80
| 0.62742
| 305
| 2,531
| 5.163934
| 0.222951
| 0.030476
| 0.035556
| 0.043175
| 0.789206
| 0.789206
| 0.789206
| 0.789206
| 0.763175
| 0.624762
| 0
| 0.032841
| 0.278151
| 2,531
| 80
| 81
| 31.6375
| 0.829228
| 0.251679
| 0
| 0.666667
| 0
| 0
| 0.197151
| 0
| 0
| 0
| 0
| 0
| 0.121212
| 1
| 0.121212
| false
| 0
| 0.090909
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
22b9bf4dbb3b9da61319f423e63c3a469e10df07
| 36
|
py
|
Python
|
libs/color_naming/__init__.py
|
Flipajs/FERDA
|
120a9e16d7ab4877f72fadbe4484c8b91adf22c4
|
[
"MIT"
] | 1
|
2021-04-23T10:00:49.000Z
|
2021-04-23T10:00:49.000Z
|
libs/color_naming/__init__.py
|
Flipajs/FERDA
|
120a9e16d7ab4877f72fadbe4484c8b91adf22c4
|
[
"MIT"
] | null | null | null |
libs/color_naming/__init__.py
|
Flipajs/FERDA
|
120a9e16d7ab4877f72fadbe4484c8b91adf22c4
|
[
"MIT"
] | null | null | null |
from .color_naming import im2colors
| 18
| 35
| 0.861111
| 5
| 36
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.03125
| 0.111111
| 36
| 1
| 36
| 36
| 0.90625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
22ff5b862ccf29dd4c2805be9e2e8e5921eefc5f
| 138
|
py
|
Python
|
pyguitar/__init__.py
|
tushushu/pyguitar
|
3f02ae26b8f416aecaee897367ab5b38b0949f4e
|
[
"MIT"
] | null | null | null |
pyguitar/__init__.py
|
tushushu/pyguitar
|
3f02ae26b8f416aecaee897367ab5b38b0949f4e
|
[
"MIT"
] | null | null | null |
pyguitar/__init__.py
|
tushushu/pyguitar
|
3f02ae26b8f416aecaee897367ab5b38b0949f4e
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
@Author: tushushu
@Date: 2021-09-04 15:19:56
"""
# flake8: noqa
from .core import Fretboard, NoteName, String
| 17.25
| 45
| 0.644928
| 20
| 138
| 4.45
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.136752
| 0.152174
| 138
| 7
| 46
| 19.714286
| 0.623932
| 0.57971
| 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
| 1
| 0
|
0
| 5
|
fe19c6adf6ef70d706eb8a073bd0497a4769b487
| 161
|
py
|
Python
|
a.py
|
alehander42/symbol
|
54fd0150f8a6c6cd11ca5fddf9c4ff087f965f2c
|
[
"MIT"
] | null | null | null |
a.py
|
alehander42/symbol
|
54fd0150f8a6c6cd11ca5fddf9c4ff087f965f2c
|
[
"MIT"
] | null | null | null |
a.py
|
alehander42/symbol
|
54fd0150f8a6c6cd11ca5fddf9c4ff087f965f2c
|
[
"MIT"
] | null | null | null |
from sympy import *
x = symbols('x')
y = symbols('y')
print(x + x + y)
print(x - x)
print((x ** 2 + 2 * x + 4).subs(x, y))
print(((x + 2) * (x - 2)).expand())
| 16.1
| 38
| 0.490683
| 31
| 161
| 2.548387
| 0.354839
| 0.303797
| 0.265823
| 0.202532
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.040323
| 0.229814
| 161
| 9
| 39
| 17.888889
| 0.596774
| 0
| 0
| 0
| 0
| 0
| 0.0125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.142857
| 0
| 0.142857
| 0.571429
| 0
| 0
| 0
| null | 1
| 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
| 1
|
0
| 5
|
a3c9d9e4afdfba458c10e975ef4711feeb7ebc12
| 216
|
py
|
Python
|
mapchete_xarray/__init__.py
|
wankoelias/mapchete_xarray
|
d225cfcc78fad10767c3cbc755bc825e3110dfae
|
[
"MIT"
] | null | null | null |
mapchete_xarray/__init__.py
|
wankoelias/mapchete_xarray
|
d225cfcc78fad10767c3cbc755bc825e3110dfae
|
[
"MIT"
] | null | null | null |
mapchete_xarray/__init__.py
|
wankoelias/mapchete_xarray
|
d225cfcc78fad10767c3cbc755bc825e3110dfae
|
[
"MIT"
] | null | null | null |
from mapchete_xarray._xarray import (
InputTile,
METADATA,
OutputDataWriter,
OutputDataReader,
)
__all__ = ["InputTile", "METADATA", "OutputDataWriter", "OutputDataReader"]
__version__ = "2021.11.0"
| 21.6
| 75
| 0.717593
| 18
| 216
| 8.055556
| 0.722222
| 0.234483
| 0.455172
| 0.675862
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.038674
| 0.162037
| 216
| 9
| 76
| 24
| 0.762431
| 0
| 0
| 0
| 0
| 0
| 0.268519
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.125
| 0
| 0.125
| 0
| 1
| 0
| 0
| null | 1
| 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
| 5
|
a3e92b96cc9ea72d9aea374d5557994e2a4d02a5
| 173
|
py
|
Python
|
nf_core/modules/__init__.py
|
aunderwo/tools
|
dbfc6d8a7afcd7577a021b80e84ed9567ed0a3da
|
[
"MIT"
] | null | null | null |
nf_core/modules/__init__.py
|
aunderwo/tools
|
dbfc6d8a7afcd7577a021b80e84ed9567ed0a3da
|
[
"MIT"
] | null | null | null |
nf_core/modules/__init__.py
|
aunderwo/tools
|
dbfc6d8a7afcd7577a021b80e84ed9567ed0a3da
|
[
"MIT"
] | null | null | null |
from .pipeline_modules import ModulesRepo, PipelineModules
from .create import ModuleCreate
from .test_yml_builder import ModulesTestYmlBuilder
from .lint import ModuleLint
| 34.6
| 58
| 0.872832
| 20
| 173
| 7.4
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098266
| 173
| 4
| 59
| 43.25
| 0.948718
| 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
| 1
| 0
|
0
| 5
|
430f5d93a3fca071eda9ff02b5eca100905399b0
| 31,344
|
py
|
Python
|
webserver/services.py
|
Aderks/api.maplenodes.com
|
8c9cda1b608f6182d8f0fe54bf3dd01ffc3cfbdf
|
[
"MIT"
] | null | null | null |
webserver/services.py
|
Aderks/api.maplenodes.com
|
8c9cda1b608f6182d8f0fe54bf3dd01ffc3cfbdf
|
[
"MIT"
] | null | null | null |
webserver/services.py
|
Aderks/api.maplenodes.com
|
8c9cda1b608f6182d8f0fe54bf3dd01ffc3cfbdf
|
[
"MIT"
] | null | null | null |
from flask import Flask, url_for, jsonify, request, Response
from flask_caching import Cache
import requests
import json
import os
import subprocess
import base58
config = {
"DEBUG": False,
"CACHE_TYPE": "FileSystemCache",
"CACHE_DIR": "/services/tmp"
}
app = Flask(__name__)
app.config.from_mapping(config)
cache = Cache(app)
app.config['JSON_SORT_KEYS'] = False
# All requests require this header
headers = {'Content-Type': 'application/json',}
# Error Handling
@app.errorhandler(400)
def bad_request_error(error):
response = jsonify({
'code': 1004,
'error': 'Bad Request: Incorrect or no data parameters present'
})
return response
@app.errorhandler(500)
def internal_server_error(error):
response = jsonify({
'code': 1002,
'error': 'Internal Server Error: failed to connect to node'
})
return response
@app.errorhandler(401)
def unauthorized_error(error):
response = jsonify({
'code': 1001,
'error': 'Unauthorized User Access'
})
return response
# API
#4chanBoards
@app.route('/v1/4chanBoards', methods = ['POST'])
def api_4chanBoards():
url = 'https://a.4cdn.org/boards.json'
response = requests.get(url)
return response.json()
#btc_getrawmempoolcount
@app.route('/v1/btc_getrawmempoolcount', methods = ['GET','POST'])
def api_btc_getrawmempoolcount():
r = requests.get('https://api.maplenodes.com/v1/btc_getrawmempool')
data = r.json()
data_count = len(data)
response = '{"tx_mempool_count": '+str(data_count)+'}'
try:
return response
except:
return bad_request_error
#WorldCurrencyList
@app.route('/v1/WorldCurrencyList', methods = ['POST'])
def api_WorldCurrencyList():
response = subprocess.check_output("/services/scripts/currencylist.sh", shell=False)
try:
return response
except:
return bad_request_error
#BitlyURLShortener
@app.route('/v1/BitlyURLShortener', methods = ['POST'])
def api_BitlyURLShortener():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
url_long = payload[0]
response = subprocess.check_output(['/services/scripts/bitly.sh', url_long], shell=False)
try:
return response
except:
return bad_request_error
#CurrencyExchangeRate
@app.route('/v1/CurrencyExchangeRate', methods = ['POST'])
def api_CurrencyExchangeRate():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
currency1 = payload[0]
currency2 = payload[1]
response = subprocess.check_output(['/services/scripts/currencyconverter.sh', currency1, currency2], shell=False)
try:
return response
except:
return bad_request_error
#LiveSportsOddsList
@app.route('/v1/LiveSportsOddsList', methods = ['POST'])
def api_LiveSportsOddsList():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
active = payload[0]
response = subprocess.check_output(['/services/scripts/livesportsoddslist.sh', active], shell=False)
try:
return response
except:
return bad_request_error
#LiveSportsOdds
@app.route('/v1/LiveSportsOdds', methods = ['POST'])
def api_LiveSportsOdds():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
sport = payload[0]
region = payload[1]
response = subprocess.check_output(['/services/scripts/livesportsodds.sh', sport, region], shell=False)
try:
return response
except:
return bad_request_error
#GlobalStockLatestInfo
@app.route('/v1/GlobalStockLatestInfo', methods = ['POST'])
def api_GlobalStockLatestInfo():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
symbol = payload[0]
apikey= ''
url = 'https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol='+symbol+'&apikey='+apikey+''
response = requests.get(url)
try:
return response.json()
except:
return bad_request_error
#GlobalStockSymbolSearch
@app.route('/v1/GlobalStockSymbolSearch', methods = ['POST'])
def api_GlobalStockSymbolSearch():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
keyword = payload[0]
apikey= ''
url = 'https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords='+keyword+'&apikey='+apikey+''
response = requests.get(url)
try:
return response.json()
except:
return bad_request_error
#4chanThreads
@app.route('/v1/4chanThreads', methods = ['POST'])
def api_4chanThreads():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
board = payload[0]
response = subprocess.check_output(['/services/scripts/4chanthreads.sh', board], shell=False)
try:
return response
except:
return bad_request_error
#4chanThreadViewer
@app.route('/v1/4chanThreadViewer', methods = ['POST'])
def api_4chanThreadViewer():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
board = payload[0]
thread = payload[1]
response = subprocess.check_output(['/services/scripts/4chanthreadviewer.sh', board, thread], shell=False)
try:
return response
except:
return bad_request_error
#4chanThreadViewerPrice
@app.route('/v1/4chanThreadViewerPrice', methods = ['POST'])
def api_4chanThreadViewerPrice():
payload = request.json
payload_count = len(payload)
if len(payload) == 4:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 4'
})
return payload_error
board = payload[0]
thread = payload[1]
ticker = payload[2]
currency = payload[3]
response = subprocess.check_output(['/services/scripts/4chanthreadviewer.sh', board, thread, ticker, currency], shell=False)
try:
return response
except:
return bad_request_error
#dxGet24hrTradeHistory
@app.route('/v1/dxGet24hrTradeHistory', methods = ['POST'])
def api_dxGet24hrTradeHistory():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
show_all = payload[0]
response = subprocess.check_output(['/services/scripts/dxget24hrtradehistory.sh', show_all], shell=False)
try:
return response
except:
return bad_request_error
#dxGet24hrTradeSummary
@app.route('/v1/dxGet24hrTradeSummary', methods = ['POST'])
def api_dxGet24hrTradeSummary():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
show_all = payload[0]
response = subprocess.check_output(['/services/scripts/dxget24hrtradesummary.sh', show_all], shell=False)
try:
return response
except:
return bad_request_error
#dxGetOrders
@app.route('/v1/dxGetOrders', methods = ['POST'])
def api_dxGetOrders():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
maker = payload[0]
taker = payload[1]
response = subprocess.check_output(['/services/scripts/dxgetorders.sh', maker, taker], shell=False)
try:
return response
except:
return bad_request_error
#TwitterSearch
@app.route('/v1/TwitterSearch', methods = ['POST'])
def api_TwitterSearch():
payload = request.json
payload_count = len(payload)
if len(payload) == 3:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 3'
})
return payload_error
search = payload[0]
result_type = payload[1]
tweet_count = payload[2]
response = subprocess.check_output(['/services/scripts/twitter.sh', search, result_type, tweet_count], shell=False)
try:
return response
except:
return bad_request_error
#CCMultiPrice
@app.route('/v1/CCMultiPrice', methods = ['POST'])
def api_CCMultiPrice():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
tickers = payload[0]
currency = payload[1]
response = subprocess.check_output(['/services/scripts/cc_multi_price.sh', tickers, currency], shell=False)
try:
return response
except:
return bad_request_error
#CCSinglePrice
@app.route('/v1/CCSinglePrice', methods = ['POST'])
def api_CCSinglePrice():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
tickers = payload[0]
currency = payload[1]
response = subprocess.check_output(['/services/scripts/cc_single_price.sh', tickers, currency], shell=False)
try:
return response
except:
return bad_request_error
#CCTopListVolume24H
@app.route('/v1/CCTopListVolume24H', methods = ['POST'])
def api_CCTopListVolume24H():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
limit = payload[0]
currency = payload[1]
response = subprocess.check_output(['/services/scripts/cc_top24hr_volume.sh', limit, currency], shell=False)
try:
return response
except:
return bad_request_error
#CCTopExchangesVolumeByPair
@app.route('/v1/CCTopExchangesVolumeByPair', methods = ['POST'])
def api_CCTopExchangesVolumeByPair():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
ticker = payload[0]
currency = payload[1]
response = subprocess.check_output(['/services/scripts/cc_topexchanges_volume_bypair.sh', ticker, currency], shell=False)
try:
return response
except:
return bad_request_error
#CCTopListMarketCap
@app.route('/v1/CCTopListMarketCap', methods = ['POST'])
def api_CCTopListMarketCap():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
limit = payload[0]
currency = payload[1]
response = subprocess.check_output(['/services/scripts/cc_toplist_marketcap.sh', limit, currency], shell=False)
try:
return response
except:
return bad_request_error
#CCTopListVolumeByPair
@app.route('/v1/CCTopListVolumeByPair', methods = ['POST'])
def api_CCTopListVolumeByPair():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
ticker = payload[0]
response = subprocess.check_output(['/services/scripts/cc_toplist_pairvolume.sh', ticker], shell=False)
try:
return response
except:
return bad_request_error
#TwilioSendSMS
@app.route('/v1/TwilioSendSMS', methods = ['POST'])
def api_TwilioSendSMS():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
your_number = payload[0]
message = payload[1]
response = subprocess.check_output(['/services/scripts/sendsms.sh', your_number, message], shell=False)
try:
return response
except:
return bad_request_error
#TwilioSMSStatus
@app.route('/v1/TwilioSMSStatus', methods = ['POST'])
def api_TwilioSMSStatus():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
sid = payload[0]
response = subprocess.check_output(['/services/scripts/smsstatus.sh', sid], shell=False)
try:
return response
except:
return bad_request_error
#CurrentWeatherData
@app.route('/v1/CurrentWeatherData', methods = ['POST'])
def api_CurrentWeatherData():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
location = payload[0]
units = payload[1]
apikey= ''
url = 'http://api.openweathermap.org/data/2.5/weather?q='+location+'&units='+units+'&appid='+apikey+''
response = requests.get(url)
try:
return response.json()
except:
return bad_request_error
#TrollBox
@app.route('/v1/TrollBox', methods = ['POST'])
def api_TrollBox():
response = subprocess.check_output(['/services/trollbox/trollbox.sh'], shell=False)
try:
return response
except:
return bad_request_error
#TrollBoxMsg
@app.route('/v1/TrollBoxMsg', methods = ['POST'])
def api_TrollBoxMsg():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
user = payload[0]
message = payload[1]
response = subprocess.check_output(['/services/trollbox/trollboxmsg.sh', user, message], shell=False)
try:
return response
except:
return bad_request_error
#TelegramUserRegistration
@app.route('/v1/TelegramUserRegistration', methods = ['POST'])
def api_TelegramUserRegistration():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
username = payload[0]
response = subprocess.check_output(['/services/telegram/telegramuserregistration.sh', username], shell=False)
try:
return response
except:
return bad_request_error
#TelegramSendMsg
@app.route('/v1/TelegramSendMsg', methods = ['POST'])
def api_TelegramSendMsg():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
authorize_user = payload[0]
message = payload[1]
response = subprocess.check_output(['/services/telegram/telegramsendmessage.sh', authorize_user, message], shell=False)
try:
return response
except:
return bad_request_error
#BlackJack
@app.route('/v1/BlackJack', methods = ['POST'])
def api_BlackJack():
response = subprocess.check_output(['/services/blackjack/blackjack.sh'], shell=False)
try:
return response
except:
return bad_request_error
#BlackJackHIT
@app.route('/v1/BlackJackHIT', methods = ['POST'])
def api_BlackJackHIT():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
round_id = payload[0]
response = subprocess.check_output(['/services/blackjack/blackjack_hit.sh', round_id], shell=False)
try:
return response
except:
return bad_request_error
#BlackJackSTAND
@app.route('/v1/BlackJackSTAND', methods = ['POST'])
def api_BlackJackSTAND():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
round_id = payload[0]
response = subprocess.check_output(['/services/blackjack/blackjack_stand.sh', round_id], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_block_count
@app.route('/v1/xmr_get_block_count', methods = ['POST'])
def api_xmr_get_block_count():
response = subprocess.check_output(['/services/scripts/xmr_get_block_count.sh'], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_block_header_by_hash
@app.route('/v1/xmr_get_block_header_by_hash', methods = ['POST'])
def api_xmr_get_block_header_by_hash():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
hash = payload[0]
response = subprocess.check_output(['/services/scripts/xmr_get_block_header_by_hash.sh', hash], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_block_header_by_height
@app.route('/v1/xmr_get_block_header_by_height', methods = ['POST'])
def api_xmr_get_block_header_by_height():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
block = payload[0]
response = subprocess.check_output(['/services/scripts/xmr_get_block_header_by_height.sh', block], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_block_headers_range
@app.route('/v1/xmr_get_block_headers_range', methods = ['POST'])
def api_xmr_get_block_headers_range():
payload = request.json
payload_count = len(payload)
if len(payload) == 2:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 2'
})
return payload_error
start_block = payload[0]
end_block = payload[1]
response = subprocess.check_output(['/services/scripts/xmr_get_block_headers_range.sh', start_block, end_block], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_fee_estimate
@app.route('/v1/xmr_get_fee_estimate', methods = ['POST'])
def api_xmr_get_fee_estimate():
response = subprocess.check_output(['/services/scripts/xmr_get_fee_estimate.sh'], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_last_block_header
@app.route('/v1/xmr_get_last_block_header', methods = ['POST'])
def api_xmr_get_last_block_header():
response = subprocess.check_output(['/services/scripts/xmr_get_last_block_header.sh'], shell=False)
try:
return response
except:
return bad_request_error
#xmr_hard_fork_info
@app.route('/v1/xmr_hard_fork_info', methods = ['POST'])
def api_xmr_hard_fork_info():
response = subprocess.check_output(['/services/scripts/xmr_hard_fork_info.sh'], shell=False)
try:
return response
except:
return bad_request_error
#xmr_on_get_block_hash
@app.route('/v1/xmr_on_get_block_hash', methods = ['POST'])
def api_xmr_on_get_block_hash():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
block = payload[0]
response = subprocess.check_output(['/services/scripts/xmr_on_get_block_hash.sh', block], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_block
@app.route('/v1/xmr_get_block', methods = ['POST'])
def api_xmr_get_block():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
block = payload[0]
response = subprocess.check_output(['/services/scripts/xmr_get_block.sh', block], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_version
@app.route('/v1/xmr_get_version', methods = ['POST'])
def api_xmr_get_version():
response = subprocess.check_output(['/services/scripts/xmr_get_version.sh'], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_transaction_pool
@app.route('/v1/xmr_get_transaction_pool', methods = ['POST'])
def api_xmr_get_transaction_pool():
response = subprocess.check_output(['/services/scripts/xmr_get_transaction_pool.sh'], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_transaction_pool_stats
@app.route('/v1/xmr_get_transaction_pool_stats', methods = ['POST'])
def api_xmr_get_transaction_pool_stats():
response = subprocess.check_output(['/services/scripts/xmr_get_transaction_pool_stats.sh'], shell=False)
try:
return response
except:
return bad_request_error
#xmr_send_raw_transaction
@app.route('/v1/xmr_send_raw_transaction', methods = ['POST'])
def api_xmr_send_raw_transaction():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
tx_as_hex = payload[0]
response = subprocess.check_output(['/services/scripts/xmr_send_raw_transaction.sh', tx_as_hex], shell=False)
try:
return response
except:
return bad_request_error
#xmr_get_transactions
@app.route('/v1/xmr_get_transactions', methods = ['POST'])
def api_xmr_get_transactions():
payload = request.json
payload_count = len(payload)
if len(payload) == 1:
print (payload)
else:
payload_error = jsonify({
'code': 1025,
'error': 'Received parameters count '+str(payload_count)+' do not match expected 1'
})
return payload_error
tx_hashes = payload[0]
response = subprocess.check_output(['/services/scripts/xmr_get_transactions.sh', tx_hashes], shell=False)
try:
return response
except:
return bad_request_error
@app.route('/graph/indexer/<indexer_id>', methods = ['POST', 'GET'])
@cache.cached(timeout=60)
def api_graph_rewards(indexer_id):
data = subprocess.check_output(['/services/scripts/graph_rewards.sh', indexer_id], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Indexer-ID does not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/indexers/', methods = ['POST', 'GET'])
@cache.cached(timeout=86400)
def api_graph_indexers():
data = subprocess.check_output(['/services/scripts/graph_indexers.sh'], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Indexers does not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/network/', methods = ['POST', 'GET'])
def api_graph_network():
data = subprocess.check_output(['/services/scripts/graph_network.sh'], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Does not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/ens/<indexer_id>', methods = ['POST', 'GET'])
@cache.cached(timeout=86400)
def api_graph_ens(indexer_id):
data = subprocess.check_output(['/services/scripts/graph_ens.sh', indexer_id], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Indexer-ID does not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/allocations/<indexer_id>', methods = ['POST', 'GET'])
@cache.cached(timeout=60)
def api_graph_allocations(indexer_id):
data = subprocess.check_output(['/services/scripts/graph_allocations.sh', indexer_id], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Indexer-ID does not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/allocations/info/<indexer_id>', methods = ['POST', 'GET'])
@cache.cached(timeout=60)
def api_graph_allocations_info(indexer_id):
data = subprocess.check_output(['/services/scripts/graph_allocations_with_id.sh', indexer_id], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Indexer-ID does not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/IPFS/<subgraph_id>', methods = ['POST', 'GET'])
@cache.cached(timeout=86400)
def api_graph_ipfs(subgraph_id):
ipfs_hash = base58.b58encode(bytes.fromhex("1220"+(subgraph_id)[2:])).decode('utf-8')
response = jsonify({
'ipfs_hash': ipfs_hash
})
if response == "":
error = jsonify({
'code': 1004,
'error': 'Subgraph-ID does not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/subgraphs/', methods = ['POST', 'GET'])
@cache.cached(timeout=60)
def api_graph_subgraphs():
data = subprocess.check_output(['/services/scripts/graph_subgraphs.sh'], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Subgraphs do not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/indexers/kpi/', methods = ['POST', 'GET'])
@cache.cached(timeout=3600)
def api_graph_indexer_kpi():
data = subprocess.check_output(['/services/scripts/graph_kpi.sh'], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Does not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/subgraphs/active/', methods = ['POST', 'GET'])
@cache.cached(timeout=30)
def api_graph_subgraphs_active():
data = subprocess.check_output(['/services/scripts/graph_subgraphs_active.sh'], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Subgraphs do not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/subgraph/trace/<ipfs_hash>', methods = ['POST', 'GET'])
@cache.cached(timeout=86400)
def api_graph_subgraph_trace(ipfs_hash):
data = subprocess.check_output(['/services/scripts/graph_trace.sh', ipfs_hash], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Subgraph does not exist'
})
return error
try:
return response
except:
return bad_request_error
@app.route('/graph/network/stake/', methods = ['POST', 'GET'])
def api_graph_network_stake():
data = subprocess.check_output(['/services/scripts/graph_network_stake.sh'], shell=False)
response = Response(response=data,
status=200,
mimetype="application/json")
if response == "":
error = jsonify({
'code': 1004,
'error': 'Does not exist'
})
return error
try:
return response
except:
return bad_request_error
# Web Server is listening on 0.0.0.0:8192
if __name__ == '__main__':
app.run(host= '0.0.0.0', port= 8192)
| 22.565875
| 127
| 0.683831
| 3,788
| 31,344
| 5.479409
| 0.071014
| 0.039314
| 0.041916
| 0.060416
| 0.770331
| 0.749615
| 0.72779
| 0.704086
| 0.653739
| 0.633648
| 0
| 0.020205
| 0.188393
| 31,344
| 1,388
| 128
| 22.582133
| 0.795707
| 0.029735
| 0
| 0.746888
| 0
| 0
| 0.231353
| 0.101888
| 0
| 0
| 0
| 0
| 0
| 1
| 0.063278
| false
| 0
| 0.007261
| 0
| 0.240664
| 0.03527
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
434222f5dd88ba7f164ff434c54c6c28c7792452
| 255
|
py
|
Python
|
Python-Parameters&Arguments.py
|
H2oPtic/Codecademy-Education
|
454ecff36a055fa17b4b338e1c6f1e9b3b94ef66
|
[
"MIT"
] | null | null | null |
Python-Parameters&Arguments.py
|
H2oPtic/Codecademy-Education
|
454ecff36a055fa17b4b338e1c6f1e9b3b94ef66
|
[
"MIT"
] | null | null | null |
Python-Parameters&Arguments.py
|
H2oPtic/Codecademy-Education
|
454ecff36a055fa17b4b338e1c6f1e9b3b94ef66
|
[
"MIT"
] | null | null | null |
# Your code below:
def generate_trip_instructions(location):
print("Looks like you are planning a trip to visit " + location)
print("You can use the public subway system to get to " + location)
generate_trip_instructions("Grand Central Station")
| 42.5
| 70
| 0.756863
| 37
| 255
| 5.108108
| 0.72973
| 0.126984
| 0.253968
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.168627
| 255
| 6
| 71
| 42.5
| 0.891509
| 0.062745
| 0
| 0
| 1
| 0
| 0.480687
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.25
| 0.5
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
4346f2721d1e36bba88af2f7284c0655c1ac6f81
| 5,412
|
py
|
Python
|
session3/complete/3.py
|
robbaltzer/pb-exercises
|
4aebe998adf94dd008662dcfddadabbde68131ec
|
[
"BSD-2-Clause"
] | null | null | null |
session3/complete/3.py
|
robbaltzer/pb-exercises
|
4aebe998adf94dd008662dcfddadabbde68131ec
|
[
"BSD-2-Clause"
] | null | null | null |
session3/complete/3.py
|
robbaltzer/pb-exercises
|
4aebe998adf94dd008662dcfddadabbde68131ec
|
[
"BSD-2-Clause"
] | null | null | null |
from io import BytesIO
from unittest import TestCase
from ecc import (
G,
N,
S256Point,
Signature,
)
from helper import (
hash256,
)
from tx import Tx
class Session3Test(TestCase):
def test_example_1(self):
secret = 1800555555518005555555
z = int.from_bytes(hash256(b'ECDSA is awesome!'), 'big')
k = pow(90210, 99, N)
r = (k*G).x.num
s = (z+r*secret) * pow(k, N-2, N) % N
self.assertEqual(z, 0xcf6304e0ed625dc13713ad8b330ca764325f013fe7a3057dbe6a2053135abeb4)
self.assertEqual(r, 0x6eb4496bf97ccc36032801586b823d6c4bae7f846b1105e606e522c3aa037c09)
self.assertEqual(s, 0x65c750dca3dfeb5ba129f846997869f0353ae82eb22050af247c337fd99ae722)
point = secret * G
self.assertEqual(point.x.num, 0x4519fac3d910ca7e7138f7013706f619fa8f033e6ec6e09370ea38cee6a7574)
self.assertEqual(point.y.num, 0x82b51eab8c27c66e26c858a079bcdf4f1ada34cec420cafc7eac1a42216fb6c4)
def test_example_2(self):
z = 0xbc62d4b80d9e36da29c16c5d4d9f11731f36052c72401a76c23c0fb5a9b74423
r = 0x37206a0610995c58074999cb9767b87af4c4978db68c06e8e6e81d282047a7c6
s = 0x8ca63759c1157ebeaec0d03cecca119fc9a75bf8e6d0fa65c841c8e2738cdaec
point = S256Point(
0x04519fac3d910ca7e7138f7013706f619fa8f033e6ec6e09370ea38cee6a7574,
0x82b51eab8c27c66e26c858a079bcdf4f1ada34cec420cafc7eac1a42216fb6c4)
u = z * pow(s, N-2, N) % N
v = r * pow(s, N-2, N) % N
self.assertTrue((u*G + v*point).x.num == r)
def test_exercise_1(self):
px = 0x887387e452b8eacc4acfde10d9aaf7f6d9a0f975aabb10d006e4da568744d06c
py = 0x61de6d95231cd89026e286df3b6ae4a894a3378e393e93a0f45b666329a0ae34
signatures = (
(0xec208baa0fc1c19f708a9ca96fdeff3ac3f230bb4a7ba4aede4942ad003c0f60,
0xac8d1c87e51d0d441be8b3dd5b05c8795b48875dffe00b7ffcfac23010d3a395,
0x68342ceff8935ededd102dd876ffd6ba72d6a427a3edb13d26eb0781cb423c4),
(0x7c076ff316692a3d7eb3c3bb0f8b1488cf72e1afcd929e29307032997a838a3d,
0xeff69ef2b1bd93a66ed5219add4fb51e11a840f404876325a1e8ffe0529a2c,
0xc7207fee197d27c618aea621406f6bf5ef6fca38681d82b2f06fddbdce6feab6)
)
point = S256Point(px, py)
for z, r, s in signatures:
u = z * pow(s, N-2, N) % N
v = r * pow(s, N-2, N) % N
self.assertTrue((u*G+v*point).x.num == r)
def test_exercise_2(self):
der = bytes.fromhex('304402201f62993ee03fca342fcb45929993fa6ee885e00ddad8de154f268d98f083991402201e1ca12ad140c04e0e022c38f7ce31da426b8009d02832f0b44f39a6b178b7a1')
sec = bytes.fromhex('0204519fac3d910ca7e7138f7013706f619fa8f033e6ec6e09370ea38cee6a7574')
z = int.from_bytes(hash256(b'ECDSA is awesome!'), 'big')
sig = Signature.parse(der)
point = S256Point.parse(sec)
self.assertTrue(point.verify(z, sig))
def test_exercise_7(self):
hex_transaction = '010000000456919960ac691763688d3d3bcea9ad6ecaf875df5339e148a1fc61c6ed7a069e010000006a47304402204585bcdef85e6b1c6af5c2669d4830ff86e42dd205c0e089bc2a821657e951c002201024a10366077f87d6bce1f7100ad8cfa8a064b39d4e8fe4ea13a7b71aa8180f012102f0da57e85eec2934a82a585ea337ce2f4998b50ae699dd79f5880e253dafafb7feffffffeb8f51f4038dc17e6313cf831d4f02281c2a468bde0fafd37f1bf882729e7fd3000000006a47304402207899531a52d59a6de200179928ca900254a36b8dff8bb75f5f5d71b1cdc26125022008b422690b8461cb52c3cc30330b23d574351872b7c361e9aae3649071c1a7160121035d5c93d9ac96881f19ba1f686f15f009ded7c62efe85a872e6a19b43c15a2937feffffff567bf40595119d1bb8a3037c356efd56170b64cbcc160fb028fa10704b45d775000000006a47304402204c7c7818424c7f7911da6cddc59655a70af1cb5eaf17c69dadbfc74ffa0b662f02207599e08bc8023693ad4e9527dc42c34210f7a7d1d1ddfc8492b654a11e7620a0012102158b46fbdff65d0172b7989aec8850aa0dae49abfb84c81ae6e5b251a58ace5cfeffffffd63a5e6c16e620f86f375925b21cabaf736c779f88fd04dcad51d26690f7f345010000006a47304402200633ea0d3314bea0d95b3cd8dadb2ef79ea8331ffe1e61f762c0f6daea0fabde022029f23b3e9c30f080446150b23852028751635dcee2be669c2a1686a4b5edf304012103ffd6f4a67e94aba353a00882e563ff2722eb4cff0ad6006e86ee20dfe7520d55feffffff0251430f00000000001976a914ab0c0b2e98b1ab6dbf67d4750b0a56244948a87988ac005a6202000000001976a9143c82d7df364eb6c75be8c80df2b3eda8db57397088ac46430600'
bin_transaction = bytes.fromhex(hex_transaction)
stream = BytesIO(bin_transaction)
tx_obj = Tx.parse(stream)
self.assertEqual(
tx_obj.tx_ins[1].script_sig.instructions[0].hex(),
'304402207899531a52d59a6de200179928ca900254a36b8dff8bb75f5f5d71b1cdc26125022008b422690b8461cb52c3cc30330b23d574351872b7c361e9aae3649071c1a71601')
self.assertEqual(
tx_obj.tx_ins[1].script_sig.instructions[1].hex(),
'035d5c93d9ac96881f19ba1f686f15f009ded7c62efe85a872e6a19b43c15a2937')
self.assertEqual(tx_obj.tx_outs[0].script_pubkey.instructions[0], 0x76)
self.assertEqual(tx_obj.tx_outs[0].script_pubkey.instructions[1], 0xa9)
self.assertEqual(
tx_obj.tx_outs[0].script_pubkey.instructions[2].hex(),
'ab0c0b2e98b1ab6dbf67d4750b0a56244948a879')
self.assertEqual(tx_obj.tx_outs[0].script_pubkey.instructions[3], 0x88)
self.assertEqual(tx_obj.tx_outs[0].script_pubkey.instructions[4], 0xac)
self.assertEqual(tx_obj.tx_outs[1].amount, 40000000)
| 62.930233
| 1,360
| 0.79065
| 337
| 5,412
| 12.578635
| 0.299703
| 0.046001
| 0.014862
| 0.037745
| 0.137532
| 0.135645
| 0.129512
| 0.129512
| 0.129512
| 0.129512
| 0
| 0.426493
| 0.149113
| 5,412
| 85
| 1,361
| 63.670588
| 0.494028
| 0
| 0
| 0.142857
| 0
| 0
| 0.337398
| 0.330007
| 0
| 1
| 0.221729
| 0
| 0.207792
| 1
| 0.064935
| false
| 0
| 0.064935
| 0
| 0.142857
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
4a2f2465020231c4b26f6f16a0444f1546a91ff8
| 153
|
py
|
Python
|
tests/module_e.py
|
microsoft/Python-Import-Mocker
|
a557d046b0d52b2417b39be17001a917ce34d043
|
[
"MIT"
] | null | null | null |
tests/module_e.py
|
microsoft/Python-Import-Mocker
|
a557d046b0d52b2417b39be17001a917ce34d043
|
[
"MIT"
] | null | null | null |
tests/module_e.py
|
microsoft/Python-Import-Mocker
|
a557d046b0d52b2417b39be17001a917ce34d043
|
[
"MIT"
] | null | null | null |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
def function_e(num):
print(f"function_e({num}) from module_e was called!")
| 25.5
| 57
| 0.732026
| 23
| 153
| 4.73913
| 0.826087
| 0.165138
| 0.220183
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.150327
| 153
| 5
| 58
| 30.6
| 0.838462
| 0.444444
| 0
| 0
| 0
| 0
| 0.52439
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0
| 0.5
| 0.5
| 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
| 1
|
0
| 5
|
4a495822fbafb6ab645f4173f2ba46cf44089aff
| 4,336
|
py
|
Python
|
src/tests/orga/views/test_orga_views_dashboard.py
|
hrchu/pretalx
|
cd7e5525f80c7290d9650065b4cf4f085032adfc
|
[
"Apache-2.0"
] | 3
|
2020-03-28T06:21:27.000Z
|
2020-03-28T12:59:21.000Z
|
src/tests/orga/views/test_orga_views_dashboard.py
|
hrchu/pretalx
|
cd7e5525f80c7290d9650065b4cf4f085032adfc
|
[
"Apache-2.0"
] | 14
|
2020-03-27T22:46:38.000Z
|
2020-03-29T18:40:02.000Z
|
src/tests/orga/views/test_orga_views_dashboard.py
|
hrchu/pretalx
|
cd7e5525f80c7290d9650065b4cf4f085032adfc
|
[
"Apache-2.0"
] | 4
|
2020-03-21T10:33:20.000Z
|
2020-03-28T10:14:19.000Z
|
import pytest
from django.urls import reverse
from django_scopes import scope
@pytest.mark.parametrize("test_user", ("orga", "speaker", "superuser", "None"))
@pytest.mark.django_db
def test_dashboard_event_list(
orga_user, orga_client, speaker, event, other_event, test_user, slot
):
if test_user == "speaker":
orga_client.force_login(speaker)
elif test_user == "None":
orga_client.logout()
elif test_user == "superuser":
orga_user.is_administrator = True
orga_user.save()
response = orga_client.get(reverse("orga:event.list"), follow=True)
if test_user == "speaker":
assert response.status_code == 200
assert event.slug not in response.content.decode()
elif test_user == "orga":
assert response.status_code == 200
assert event.slug in response.content.decode()
assert other_event.slug not in response.content.decode()
elif test_user == "superuser":
assert response.status_code == 200
assert event.slug in response.content.decode(), response.content.decode()
assert other_event.slug in response.content.decode(), response.content.decode()
else:
current_url = response.redirect_chain[-1][0]
assert "login" in current_url
@pytest.mark.parametrize(
"test_user", ("orga", "speaker", "superuser", "reviewer", "None")
)
@pytest.mark.django_db
def test_event_dashboard(
orga_user, orga_client, review_user, speaker, event, test_user, slot
):
from pretalx.common.models.log import ActivityLog
ActivityLog.objects.create(
event=event,
person=speaker,
content_object=slot.submission,
action_type="pretalx.submission.create",
)
if test_user == "speaker":
orga_client.force_login(speaker)
elif test_user == "None":
orga_client.logout()
elif test_user == "superuser":
orga_user.is_administrator = True
orga_user.save()
elif test_user == "reviewer":
with scope(event=event):
event.active_review_phase.can_see_speaker_names = False
event.active_review_phase.save()
orga_client.force_login(review_user)
response = orga_client.get(event.orga_urls.base, follow=True)
if test_user == "speaker":
assert response.status_code == 404
assert event.slug not in response.content.decode()
elif test_user == "orga":
assert response.status_code == 200
assert event.slug in response.content.decode()
assert speaker.name in response.content.decode()
elif test_user == "superuser":
assert response.status_code == 200
assert event.slug in response.content.decode(), response.content.decode()
assert speaker.name in response.content.decode()
elif test_user == "reviewer":
assert not review_user.has_perm("orga.view_speakers", event)
assert response.status_code == 200
assert event.slug in response.content.decode(), response.content.decode()
assert speaker.name not in response.content.decode()
else:
current_url = response.redirect_chain[-1][0]
assert "login" in current_url
@pytest.mark.parametrize("test_user", ("orga", "speaker", "superuser", "None"))
@pytest.mark.django_db
def test_dashboard_organiser_list(
orga_user, orga_client, speaker, event, other_event, test_user
):
if test_user == "speaker":
orga_client.force_login(speaker)
elif test_user == "None":
orga_client.logout()
elif test_user == "superuser":
orga_user.is_administrator = True
orga_user.save()
response = orga_client.get(reverse("orga:organiser.list"), follow=True)
if test_user == "speaker":
assert response.status_code == 404, response.status_code
elif test_user == "orga":
assert event.organiser.name in response.content.decode()
assert other_event.organiser.name not in response.content.decode()
elif test_user == "superuser":
assert (
event.organiser.name in response.content.decode()
), response.content.decode()
assert (
other_event.organiser.name in response.content.decode()
), response.content.decode()
else:
current_url = response.redirect_chain[-1][0]
assert "login" in current_url
| 36.745763
| 87
| 0.674815
| 538
| 4,336
| 5.241636
| 0.150558
| 0.073759
| 0.16383
| 0.130496
| 0.796809
| 0.791135
| 0.789362
| 0.777305
| 0.749291
| 0.747872
| 0
| 0.008803
| 0.214022
| 4,336
| 117
| 88
| 37.059829
| 0.818662
| 0
| 0
| 0.653846
| 0
| 0
| 0.07726
| 0.005766
| 0
| 0
| 0
| 0
| 0.269231
| 1
| 0.028846
| false
| 0
| 0.038462
| 0
| 0.067308
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
4a5ecbd01ee6123db6322ac974eb493ec68a730e
| 1,038
|
py
|
Python
|
tests/test_urls_resolution.py
|
fgmacedo/django-staticpages
|
f38eb1e0d68c5292ddfc3ce98e3ced4004066040
|
[
"MIT"
] | 4
|
2016-10-20T20:57:46.000Z
|
2020-08-15T03:07:05.000Z
|
tests/test_urls_resolution.py
|
fgmacedo/django-staticpages
|
f38eb1e0d68c5292ddfc3ce98e3ced4004066040
|
[
"MIT"
] | 138
|
2017-08-25T13:02:31.000Z
|
2022-03-18T07:22:14.000Z
|
tests/test_urls_resolution.py
|
fgmacedo/django-staticpages
|
f38eb1e0d68c5292ddfc3ce98e3ced4004066040
|
[
"MIT"
] | 1
|
2017-06-24T01:43:05.000Z
|
2017-06-24T01:43:05.000Z
|
# coding: utf-8
import pytest
from yasp.models import FlatPage, Menu
@pytest.mark.django_db
def test_url_of_page_without_menu():
page = FlatPage.objects.create(slug='vision', title='Vision')
assert page.get_absolute_url() == "/vision"
@pytest.mark.django_db
def test_url_of_page_with_menu():
menu = Menu.objects.create(name='About us', slug='about-us')
page = FlatPage.objects.create(menu=menu, slug='vision', title='Vision')
assert page.get_absolute_url() == "/about-us/vision"
@pytest.mark.django_db
def test_url_of_external_page_without_menu():
page = FlatPage.objects.create(
slug='google', link='http://google.com', title='Google')
assert page.get_absolute_url() == "http://google.com"
@pytest.mark.django_db
def test_url_of_external_page_with_menu():
menu = Menu.objects.create(name='About us', slug='about-us')
page = FlatPage.objects.create(
menu=menu, slug='google', link='http://google.com', title='Google')
assert page.get_absolute_url() == "http://google.com"
| 30.529412
| 76
| 0.711946
| 151
| 1,038
| 4.668874
| 0.238411
| 0.110638
| 0.09078
| 0.102128
| 0.913475
| 0.913475
| 0.913475
| 0.913475
| 0.811348
| 0.58156
| 0
| 0.001109
| 0.131021
| 1,038
| 33
| 77
| 31.454545
| 0.780488
| 0.012524
| 0
| 0.454545
| 0
| 0
| 0.167155
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 1
| 0.181818
| false
| 0
| 0.090909
| 0
| 0.272727
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 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
| 5
|
4a7b81c00582e47a2a3cdfe5df0b059d4fd349b3
| 157
|
py
|
Python
|
python/testData/psi/AsyncDef.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/psi/AsyncDef.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/psi/AsyncDef.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
async def foo(x, y):
pass
async def foo_nested():
pass
async = 10
def bar():
print(async)
async def bar_nested():
pass
| 9.8125
| 27
| 0.535032
| 22
| 157
| 3.727273
| 0.454545
| 0.292683
| 0.268293
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02
| 0.363057
| 157
| 15
| 28
| 10.466667
| 0.8
| 0
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0.333333
| 0
| null | null | 0.111111
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
436571363b6a0821d6ff71762b7fd780f9cd54af
| 368
|
py
|
Python
|
pyscf/pbc/mpicc/__init__.py
|
nmardirossian/pyscf
|
57c8912dcfcc1157a822feede63df54ed1067115
|
[
"BSD-2-Clause"
] | 1
|
2018-05-02T19:55:30.000Z
|
2018-05-02T19:55:30.000Z
|
pyscf/pbc/mpicc/__init__.py
|
nmardirossian/pyscf
|
57c8912dcfcc1157a822feede63df54ed1067115
|
[
"BSD-2-Clause"
] | null | null | null |
pyscf/pbc/mpicc/__init__.py
|
nmardirossian/pyscf
|
57c8912dcfcc1157a822feede63df54ed1067115
|
[
"BSD-2-Clause"
] | 1
|
2018-12-06T03:10:50.000Z
|
2018-12-06T03:10:50.000Z
|
from pyscf.pbc.mpicc import ccsd
#def CCSD(mf, frozen=[]):
# return ccsd.CCSD(mf, frozen)
#def RCCSD(mf, frozen=[]):
# return ccsd.RCCSD(mf, frozen)
#def KCCSD(mf, frozen=[]):
# from pyscf.pbc.mpicc import kccsd
# return kccsd.CCSD(mf, frozen)
def KRCCSD(mf, frozen=[]):
from pyscf.pbc.mpicc import kccsd_rhf
return kccsd_rhf.RCCSD(mf, frozen)
| 23
| 41
| 0.671196
| 56
| 368
| 4.375
| 0.25
| 0.261224
| 0.146939
| 0.208163
| 0.387755
| 0.293878
| 0.293878
| 0.293878
| 0
| 0
| 0
| 0
| 0.173913
| 368
| 15
| 42
| 24.533333
| 0.805921
| 0.567935
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.5
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
78f8fd312232a732eeadf362955a7487b5b7289e
| 162
|
py
|
Python
|
Ago-Dic-2018/Orlando Martinez/practica 2/magicians.py
|
Arbupa/DAS_Sistemas
|
52263ab91436b2e5a24ce6f8493aaa2e2fe92fb1
|
[
"MIT"
] | 41
|
2017-09-26T09:36:32.000Z
|
2022-03-19T18:05:25.000Z
|
Ago-Dic-2018/Orlando Martinez/practica 2/magicians.py
|
Arbupa/DAS_Sistemas
|
52263ab91436b2e5a24ce6f8493aaa2e2fe92fb1
|
[
"MIT"
] | 67
|
2017-09-11T05:06:12.000Z
|
2022-02-14T04:44:04.000Z
|
Ago-Dic-2018/Orlando Martinez/practica 2/magicians.py
|
Arbupa/DAS_Sistemas
|
52263ab91436b2e5a24ce6f8493aaa2e2fe92fb1
|
[
"MIT"
] | 210
|
2017-09-01T00:10:08.000Z
|
2022-03-19T18:05:12.000Z
|
nombres_magos=['Luis', 'Pedro', 'Antonio']
def show_magicians(nombres_magos):
for magos in nombres_magos:
print (magos)
show_magicians(nombres_magos)
| 27
| 42
| 0.734568
| 21
| 162
| 5.380952
| 0.52381
| 0.424779
| 0.353982
| 0.442478
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.148148
| 162
| 5
| 43
| 32.4
| 0.818841
| 0
| 0
| 0
| 0
| 0
| 0.098765
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0
| 0
| 0.2
| 0.2
| 1
| 0
| 0
| null | 1
| 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
| 5
|
78fd6d7886878b2ab6caf64e3ade3be294c2ba2e
| 35
|
py
|
Python
|
algorithms/utilities/__init__.py
|
agdenadel/python-algorithms
|
28c298e2bc311c609f39a9f1c75a5abc9cc66b8a
|
[
"MIT"
] | null | null | null |
algorithms/utilities/__init__.py
|
agdenadel/python-algorithms
|
28c298e2bc311c609f39a9f1c75a5abc9cc66b8a
|
[
"MIT"
] | null | null | null |
algorithms/utilities/__init__.py
|
agdenadel/python-algorithms
|
28c298e2bc311c609f39a9f1c75a5abc9cc66b8a
|
[
"MIT"
] | null | null | null |
from .distance_functions import *
| 17.5
| 34
| 0.8
| 4
| 35
| 6.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 35
| 1
| 35
| 35
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
601a4b543bc804e1a3468c204906a5d2c6a20b4f
| 180
|
py
|
Python
|
datapypes/__init__.py
|
msmathers/datapypes
|
a02e8ef7c238b922afc10841934ea2990a7a541b
|
[
"MIT"
] | 1
|
2020-04-24T23:20:54.000Z
|
2020-04-24T23:20:54.000Z
|
datapypes/__init__.py
|
msmathers/datapypes
|
a02e8ef7c238b922afc10841934ea2990a7a541b
|
[
"MIT"
] | null | null | null |
datapypes/__init__.py
|
msmathers/datapypes
|
a02e8ef7c238b922afc10841934ea2990a7a541b
|
[
"MIT"
] | null | null | null |
from attribute import Attribute
from model import Model
from set import Set
from source import Source
from store import Store
from pype import SourcePype, StorePype, register_pypes
| 30
| 54
| 0.85
| 27
| 180
| 5.62963
| 0.444444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.138889
| 180
| 6
| 54
| 30
| 0.980645
| 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
| 1
| 0
|
0
| 5
|
6050f3820aaa4777ace7dbe840a4a4e4ea49bc13
| 56
|
py
|
Python
|
acestream/ACEStream/Player/__init__.py
|
GrandPaRPi/p2ptv-pi
|
6f79c00f9055a3763ddfe1dc41e14d2cb533f4c3
|
[
"MIT"
] | null | null | null |
acestream/ACEStream/Player/__init__.py
|
GrandPaRPi/p2ptv-pi
|
6f79c00f9055a3763ddfe1dc41e14d2cb533f4c3
|
[
"MIT"
] | null | null | null |
acestream/ACEStream/Player/__init__.py
|
GrandPaRPi/p2ptv-pi
|
6f79c00f9055a3763ddfe1dc41e14d2cb533f4c3
|
[
"MIT"
] | 2
|
2018-04-17T17:34:39.000Z
|
2020-07-26T03:43:33.000Z
|
#Embedded file name: ACEStream\Player\__init__.pyo
pass
| 18.666667
| 50
| 0.821429
| 8
| 56
| 5.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.089286
| 56
| 2
| 51
| 28
| 0.823529
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
605354f3a1a4e05cc55ff49d71ceee001e6ce3c2
| 21
|
py
|
Python
|
exercise/newfile1.py
|
LeeBeral/python
|
9f0d360d69ee5245e3ef13a9dc9fc666374587a4
|
[
"MIT"
] | null | null | null |
exercise/newfile1.py
|
LeeBeral/python
|
9f0d360d69ee5245e3ef13a9dc9fc666374587a4
|
[
"MIT"
] | null | null | null |
exercise/newfile1.py
|
LeeBeral/python
|
9f0d360d69ee5245e3ef13a9dc9fc666374587a4
|
[
"MIT"
] | null | null | null |
print(sum(range(10)))
| 21
| 21
| 0.714286
| 4
| 21
| 3.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095238
| 0
| 21
| 1
| 21
| 21
| 0.619048
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 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
| 1
|
0
| 5
|
6084922d8f59b34933705799b386b85014034e25
| 163
|
py
|
Python
|
stonesoup/dataassociator/__init__.py
|
Red-Portal/Stone-Soup-1
|
267621c86161a839da9b144c2745d28d9166d903
|
[
"MIT"
] | 157
|
2019-04-14T20:43:11.000Z
|
2022-03-30T08:30:33.000Z
|
stonesoup/dataassociator/__init__.py
|
Red-Portal/Stone-Soup-1
|
267621c86161a839da9b144c2745d28d9166d903
|
[
"MIT"
] | 364
|
2019-04-18T15:54:49.000Z
|
2022-03-31T09:50:02.000Z
|
stonesoup/dataassociator/__init__.py
|
Red-Portal/Stone-Soup-1
|
267621c86161a839da9b144c2745d28d9166d903
|
[
"MIT"
] | 86
|
2019-04-20T02:01:18.000Z
|
2022-03-28T01:03:11.000Z
|
# -*- coding: utf-8 -*-
from .base import DataAssociator, Associator, TrackToTrackAssociator
__all__ = ['DataAssociator', 'Associator', 'TrackToTrackAssociator']
| 32.6
| 68
| 0.754601
| 13
| 163
| 9.153846
| 0.769231
| 0.403361
| 0.773109
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006849
| 0.104294
| 163
| 4
| 69
| 40.75
| 0.808219
| 0.128834
| 0
| 0
| 0
| 0
| 0.328571
| 0.157143
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
60b66c628f8c75a4dd02cf0cf88bd71c3ce718ed
| 147
|
py
|
Python
|
src/pykeen/models/baseline/__init__.py
|
Rodrigo-A-Pereira/pykeen
|
76c5acb707faa524b5951b0d1d85ab1afe806462
|
[
"MIT"
] | 750
|
2020-06-23T08:36:34.000Z
|
2022-03-30T22:53:18.000Z
|
src/pykeen/models/baseline/__init__.py
|
Rodrigo-A-Pereira/pykeen
|
76c5acb707faa524b5951b0d1d85ab1afe806462
|
[
"MIT"
] | 691
|
2020-06-22T11:56:28.000Z
|
2022-03-31T16:07:32.000Z
|
src/pykeen/models/baseline/__init__.py
|
Rodrigo-A-Pereira/pykeen
|
76c5acb707faa524b5951b0d1d85ab1afe806462
|
[
"MIT"
] | 122
|
2020-06-26T14:37:56.000Z
|
2022-03-23T08:25:22.000Z
|
# -*- coding: utf-8 -*-
"""Non-parametric baseline models."""
from .models import EvaluationOnlyModel, MarginalDistributionBaseline # noqa:F401
| 24.5
| 82
| 0.734694
| 14
| 147
| 7.714286
| 0.928571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.031008
| 0.122449
| 147
| 5
| 83
| 29.4
| 0.806202
| 0.435374
| 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
| 1
| 0
|
0
| 5
|
60c6cbf7531dd4bc5c51e5680a59021b94341c6c
| 54
|
py
|
Python
|
django_project/project_name/views.py
|
fiee/generic_django_project
|
8dd83326e0b35fdebf7c9ca3f175cad042e0e3b0
|
[
"PostgreSQL"
] | 14
|
2015-03-20T13:03:19.000Z
|
2018-07-18T12:10:12.000Z
|
django_project/project_name/views.py
|
fiee/generic_django_project
|
8dd83326e0b35fdebf7c9ca3f175cad042e0e3b0
|
[
"PostgreSQL"
] | 7
|
2020-06-05T18:36:16.000Z
|
2022-02-10T10:46:08.000Z
|
django_project/project_name/views.py
|
fiee/generic_django_project
|
8dd83326e0b35fdebf7c9ca3f175cad042e0e3b0
|
[
"PostgreSQL"
] | 2
|
2016-08-21T22:00:41.000Z
|
2017-03-22T09:46:26.000Z
|
# -*- coding: utf-8 -*-
from django.views import View
| 18
| 29
| 0.648148
| 8
| 54
| 4.375
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022222
| 0.166667
| 54
| 2
| 30
| 27
| 0.755556
| 0.388889
| 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
| 1
| 0
|
0
| 5
|
60dabbec64357b9407c6ebf41b362f65c5ad8e29
| 218
|
py
|
Python
|
event/admin.py
|
shivammaniharsahu/django_event_project
|
389da2924de50fae6e489981db62b27b83d84669
|
[
"bzip2-1.0.6"
] | null | null | null |
event/admin.py
|
shivammaniharsahu/django_event_project
|
389da2924de50fae6e489981db62b27b83d84669
|
[
"bzip2-1.0.6"
] | null | null | null |
event/admin.py
|
shivammaniharsahu/django_event_project
|
389da2924de50fae6e489981db62b27b83d84669
|
[
"bzip2-1.0.6"
] | null | null | null |
from django.contrib import admin
from event.models import Event, Participant
# Register your models here.
from .models import Post
admin.site.register(Post)
admin.site.register(Event)
admin.site.register(Participant)
| 24.222222
| 43
| 0.816514
| 31
| 218
| 5.741935
| 0.419355
| 0.151685
| 0.286517
| 0.235955
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.100917
| 218
| 8
| 44
| 27.25
| 0.908163
| 0.119266
| 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
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
60de63586e93fd15f344c08d4e7d30ff9d12a5d1
| 156
|
py
|
Python
|
pyalign/__init__.py
|
jlumpe/pyalign
|
652c08066557c188636fa6b2095d8b8f08bf99df
|
[
"MIT"
] | null | null | null |
pyalign/__init__.py
|
jlumpe/pyalign
|
652c08066557c188636fa6b2095d8b8f08bf99df
|
[
"MIT"
] | null | null | null |
pyalign/__init__.py
|
jlumpe/pyalign
|
652c08066557c188636fa6b2095d8b8f08bf99df
|
[
"MIT"
] | null | null | null |
"""Python package for basic sequence alignment"""
from pairwisealignment import PairwiseAlignment
from matrix import *
from pwalign import pw_global_align
| 26
| 49
| 0.833333
| 19
| 156
| 6.736842
| 0.736842
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121795
| 156
| 5
| 50
| 31.2
| 0.934307
| 0.275641
| 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
| 1
| 0
|
0
| 5
|
60f1c864a1d5078d85cd5a5cbf720db9631cb592
| 191
|
py
|
Python
|
test/test.py
|
BenJaminKen/virtualenvTest
|
b730ebf1f37c3f55e2440a1a79c9c2c9d71f49d5
|
[
"bzip2-1.0.6"
] | null | null | null |
test/test.py
|
BenJaminKen/virtualenvTest
|
b730ebf1f37c3f55e2440a1a79c9c2c9d71f49d5
|
[
"bzip2-1.0.6"
] | null | null | null |
test/test.py
|
BenJaminKen/virtualenvTest
|
b730ebf1f37c3f55e2440a1a79c9c2c9d71f49d5
|
[
"bzip2-1.0.6"
] | null | null | null |
import unittest
#当测试开始后,flask会自动创建TestClass对象
# 然后调用setUp,然后调用我们自己写的方法,最后调用tearDown
class TestClass(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
| 21.222222
| 37
| 0.727749
| 19
| 191
| 7.315789
| 0.789474
| 0.115108
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.193717
| 191
| 9
| 38
| 21.222222
| 0.902597
| 0.335079
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.333333
| 0.166667
| 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
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
60ff3c7c7173604ac93adab8cfe59375dba5ebd9
| 106
|
py
|
Python
|
tweepy_scraping.py
|
CooperPair/Twitter_sentiment_analysis
|
866e0c1477b9f05b33f39f34cca833abbab332d9
|
[
"Apache-2.0"
] | 1
|
2018-11-08T09:56:32.000Z
|
2018-11-08T09:56:32.000Z
|
tweepy_scraping.py
|
CooperPair/Twitter_sentiment_analysis
|
866e0c1477b9f05b33f39f34cca833abbab332d9
|
[
"Apache-2.0"
] | null | null | null |
tweepy_scraping.py
|
CooperPair/Twitter_sentiment_analysis
|
866e0c1477b9f05b33f39f34cca833abbab332d9
|
[
"Apache-2.0"
] | 1
|
2019-10-01T14:20:45.000Z
|
2019-10-01T14:20:45.000Z
|
twitter_scraper import get_tweets
for tweet in get_tweets('narendramodi', pages=1):
print(tweet['text'])
| 26.5
| 49
| 0.783019
| 16
| 106
| 5
| 0.8125
| 0.225
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010417
| 0.09434
| 106
| 4
| 50
| 26.5
| 0.822917
| 0
| 0
| 0
| 0
| 0
| 0.149533
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.333333
| null | null | 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
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
7149317c3f3c24d07b642ddac4ee2e97346351c9
| 76
|
py
|
Python
|
CodeChef-API/codechef/__init__.py
|
vicky002/CodeChefScrapy
|
d51ff50584cfa056cb6ddaeb8f5693251a6a8c3d
|
[
"MIT"
] | 7
|
2015-07-12T21:25:10.000Z
|
2019-01-01T07:40:29.000Z
|
CodeChef-API/codechef/__init__.py
|
vicky002/CodeChefScrapy
|
d51ff50584cfa056cb6ddaeb8f5693251a6a8c3d
|
[
"MIT"
] | 1
|
2018-05-19T08:17:31.000Z
|
2018-05-19T08:17:31.000Z
|
CodeChef-API/codechef/__init__.py
|
vicky002/CodeChefScrapy
|
d51ff50584cfa056cb6ddaeb8f5693251a6a8c3d
|
[
"MIT"
] | 1
|
2018-08-26T08:29:29.000Z
|
2018-08-26T08:29:29.000Z
|
from user import User, Activity
from codechef import CodeChef, try_cast_int
| 25.333333
| 43
| 0.842105
| 12
| 76
| 5.166667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131579
| 76
| 2
| 44
| 38
| 0.939394
| 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
| 1
| 0
|
0
| 5
|
717669425d1a36ac1373aa64be4adff783ab8464
| 162
|
py
|
Python
|
mne/io/nedf/__init__.py
|
stevemats/mne-python
|
47051833f21bb372d60afc3adbf4305648ac7f69
|
[
"BSD-3-Clause"
] | 1,953
|
2015-01-17T20:33:46.000Z
|
2022-03-30T04:36:34.000Z
|
mne/io/nedf/__init__.py
|
LiFeng-SECUC/mne-python
|
732bb1f994e64e41a8e95dcc10dc98c22cac95c0
|
[
"BSD-3-Clause"
] | 8,490
|
2015-01-01T13:04:18.000Z
|
2022-03-31T23:02:08.000Z
|
mne/io/nedf/__init__.py
|
LiFeng-SECUC/mne-python
|
732bb1f994e64e41a8e95dcc10dc98c22cac95c0
|
[
"BSD-3-Clause"
] | 1,130
|
2015-01-08T22:39:27.000Z
|
2022-03-30T21:44:26.000Z
|
"""NEDF file import module."""
# Author: Tristan Stenner <nedf@nicht.dienstli.ch>
#
# License: BSD-3-Clause
from .nedf import read_raw_nedf, _parse_nedf_header
| 20.25
| 51
| 0.746914
| 24
| 162
| 4.833333
| 0.791667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007042
| 0.123457
| 162
| 7
| 52
| 23.142857
| 0.809859
| 0.592593
| 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
| 1
| 0
|
0
| 5
|
e07ff938edd90f12325584c0fecf07ca3c144a61
| 102
|
py
|
Python
|
basic_dist/utils.py
|
Seanny123/basic_imp_python
|
a25682b1da1da8a1af5edd7e70babb0dd34eb6f9
|
[
"MIT"
] | null | null | null |
basic_dist/utils.py
|
Seanny123/basic_imp_python
|
a25682b1da1da8a1af5edd7e70babb0dd34eb6f9
|
[
"MIT"
] | null | null | null |
basic_dist/utils.py
|
Seanny123/basic_imp_python
|
a25682b1da1da8a1af5edd7e70babb0dd34eb6f9
|
[
"MIT"
] | null | null | null |
from basic_dist.structs import Query
def dist(x: Query, y: Query):
return (x.data - y.data) ** 2
| 20.4
| 36
| 0.666667
| 18
| 102
| 3.722222
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012195
| 0.196078
| 102
| 4
| 37
| 25.5
| 0.804878
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 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
| 1
| 1
| 0
| 0
|
0
| 5
|
e08bc45c634d7beae0028da7a7a4a74f2f19be67
| 42
|
py
|
Python
|
src/v0tools/lib/__init__.py
|
shollingsworth/v0tools
|
a68e9bba6e4b3b63c70e1435c0916c1fdf25422f
|
[
"MIT"
] | 4
|
2021-09-09T01:26:31.000Z
|
2022-02-23T00:38:08.000Z
|
src/v0tools/lib/__init__.py
|
shollingsworth/v0tools
|
a68e9bba6e4b3b63c70e1435c0916c1fdf25422f
|
[
"MIT"
] | null | null | null |
src/v0tools/lib/__init__.py
|
shollingsworth/v0tools
|
a68e9bba6e4b3b63c70e1435c0916c1fdf25422f
|
[
"MIT"
] | null | null | null |
"""Helper libs for various operations."""
| 21
| 41
| 0.714286
| 5
| 42
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119048
| 42
| 1
| 42
| 42
| 0.810811
| 0.833333
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
e098bc3208ef9b8943618148f58bfab5f4fdbd41
| 33
|
py
|
Python
|
src/corpustools/__init__.py
|
2kodevs/Search-Engine
|
840001f825d9632c6c7a5fd24151b79ca1a9a06b
|
[
"MIT"
] | null | null | null |
src/corpustools/__init__.py
|
2kodevs/Search-Engine
|
840001f825d9632c6c7a5fd24151b79ca1a9a06b
|
[
"MIT"
] | null | null | null |
src/corpustools/__init__.py
|
2kodevs/Search-Engine
|
840001f825d9632c6c7a5fd24151b79ca1a9a06b
|
[
"MIT"
] | null | null | null |
from .reader import CorpusReader
| 16.5
| 32
| 0.848485
| 4
| 33
| 7
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121212
| 33
| 1
| 33
| 33
| 0.965517
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
e0f52799dff5364d023e66f0cc311f898158dd5f
| 89
|
py
|
Python
|
perfil/admin.py
|
Matheusvicentesn/django-e-commerce
|
3bc94c4d2eded0ed0ce632008dfdafece68bf195
|
[
"MIT"
] | null | null | null |
perfil/admin.py
|
Matheusvicentesn/django-e-commerce
|
3bc94c4d2eded0ed0ce632008dfdafece68bf195
|
[
"MIT"
] | 5
|
2021-04-08T21:32:17.000Z
|
2021-09-22T19:29:23.000Z
|
perfil/admin.py
|
Matheusvicentesn/django-e-commerce
|
3bc94c4d2eded0ed0ce632008dfdafece68bf195
|
[
"MIT"
] | 1
|
2021-07-25T22:40:18.000Z
|
2021-07-25T22:40:18.000Z
|
from django.contrib import admin
from .models import Perfil
admin.site.register(Perfil)
| 17.8
| 32
| 0.820225
| 13
| 89
| 5.615385
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.11236
| 89
| 4
| 33
| 22.25
| 0.924051
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
1cb822730c8cdfdc080aa653b84bbcddfad69247
| 24,542
|
py
|
Python
|
dev/Tools/Python/2.7.13/mac/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyxb/bundles/wssplat/raw/soap11.py
|
jeikabu/lumberyard
|
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
|
[
"AML"
] | 8
|
2019-10-07T16:33:47.000Z
|
2020-12-07T03:59:58.000Z
|
dev/Tools/Python/2.7.13/mac/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyxb/bundles/wssplat/raw/soap11.py
|
jeikabu/lumberyard
|
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
|
[
"AML"
] | null | null | null |
dev/Tools/Python/2.7.13/mac/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyxb/bundles/wssplat/raw/soap11.py
|
jeikabu/lumberyard
|
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
|
[
"AML"
] | 5
|
2020-08-27T20:44:18.000Z
|
2021-08-21T22:54:11.000Z
|
# ./pyxb/bundles/wssplat/raw/soap11.py
# -*- coding: utf-8 -*-
# PyXB bindings for NM:124ab58ff634848548cf6d9d1320f856ff23519e
# Generated 2014-10-19 06:24:56.581865 by PyXB version 1.2.4 using Python 2.7.3.final.0
# Namespace http://schemas.xmlsoap.org/soap/envelope/
from __future__ import unicode_literals
import pyxb
import pyxb.binding
import pyxb.binding.saxer
import io
import pyxb.utils.utility
import pyxb.utils.domutils
import sys
import pyxb.utils.six as _six
# Unique identifier for bindings created at the same time
_GenerationUID = pyxb.utils.utility.UniqueIdentifier('urn:uuid:8de0be4a-5782-11e4-b3e4-c8600024e903')
# Version of PyXB used to generate the bindings
_PyXBVersion = '1.2.4'
# Generated bindings are not compatible across PyXB versions
if pyxb.__version__ != _PyXBVersion:
raise pyxb.PyXBVersionError(_PyXBVersion)
# Import bindings for namespaces imported into schema
import pyxb.binding.datatypes
# NOTE: All namespace declarations are reserved within the binding
Namespace = pyxb.namespace.NamespaceForURI('http://schemas.xmlsoap.org/soap/envelope/', create_if_missing=True)
Namespace.configureCategories(['typeBinding', 'elementBinding'])
def CreateFromDocument (xml_text, default_namespace=None, location_base=None):
"""Parse the given XML and use the document element to create a
Python instance.
@param xml_text An XML document. This should be data (Python 2
str or Python 3 bytes), or a text (Python 2 unicode or Python 3
str) in the L{pyxb._InputEncoding} encoding.
@keyword default_namespace The L{pyxb.Namespace} instance to use as the
default namespace where there is no default namespace in scope.
If unspecified or C{None}, the namespace of the module containing
this function will be used.
@keyword location_base: An object to be recorded as the base of all
L{pyxb.utils.utility.Location} instances associated with events and
objects handled by the parser. You might pass the URI from which
the document was obtained.
"""
if pyxb.XMLStyle_saxer != pyxb._XMLStyle:
dom = pyxb.utils.domutils.StringToDOM(xml_text)
return CreateFromDOM(dom.documentElement, default_namespace=default_namespace)
if default_namespace is None:
default_namespace = Namespace.fallbackNamespace()
saxer = pyxb.binding.saxer.make_parser(fallback_namespace=default_namespace, location_base=location_base)
handler = saxer.getContentHandler()
xmld = xml_text
if isinstance(xmld, _six.text_type):
xmld = xmld.encode(pyxb._InputEncoding)
saxer.parse(io.BytesIO(xmld))
instance = handler.rootObject()
return instance
def CreateFromDOM (node, default_namespace=None):
"""Create a Python instance from the given DOM node.
The node tag must correspond to an element declaration in this module.
@deprecated: Forcing use of DOM interface is unnecessary; use L{CreateFromDocument}."""
if default_namespace is None:
default_namespace = Namespace.fallbackNamespace()
return pyxb.binding.basis.element.AnyCreateFromDOM(node, default_namespace)
# Atomic simple type: [anonymous]
class STD_ANON (pyxb.binding.datatypes.boolean):
"""An atomic simple type."""
_ExpandedName = None
_XSDLocation = pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 76, 5)
_Documentation = None
STD_ANON._CF_pattern = pyxb.binding.facets.CF_pattern()
STD_ANON._CF_pattern.addPattern(pattern='0|1')
STD_ANON._InitializeFacetMap(STD_ANON._CF_pattern)
# List simple type: {http://schemas.xmlsoap.org/soap/envelope/}encodingStyle
# superclasses pyxb.binding.datatypes.anySimpleType
class encodingStyle (pyxb.binding.basis.STD_list):
"""
'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification
"""
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'encodingStyle')
_XSDLocation = pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 84, 2)
_Documentation = "\n\t 'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification\n\t "
_ItemType = pyxb.binding.datatypes.anyURI
encodingStyle._InitializeFacetMap()
Namespace.addCategoryObject('typeBinding', 'encodingStyle', encodingStyle)
# Complex type {http://schemas.xmlsoap.org/soap/envelope/}Envelope with content type ELEMENT_ONLY
class Envelope_ (pyxb.binding.basis.complexTypeDefinition):
"""Complex type {http://schemas.xmlsoap.org/soap/envelope/}Envelope with content type ELEMENT_ONLY"""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'Envelope')
_XSDLocation = pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 42, 2)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
# Element {http://schemas.xmlsoap.org/soap/envelope/}Header uses Python identifier Header
__Header = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(Namespace, 'Header'), 'Header', '__httpschemas_xmlsoap_orgsoapenvelope_Envelope__httpschemas_xmlsoap_orgsoapenvelopeHeader', False, pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 51, 2), )
Header = property(__Header.value, __Header.set, None, None)
# Element {http://schemas.xmlsoap.org/soap/envelope/}Body uses Python identifier Body
__Body = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(Namespace, 'Body'), 'Body', '__httpschemas_xmlsoap_orgsoapenvelope_Envelope__httpschemas_xmlsoap_orgsoapenvelopeBody', False, pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 59, 2), )
Body = property(__Body.value, __Body.set, None, None)
_AttributeWildcard = pyxb.binding.content.Wildcard(process_contents=pyxb.binding.content.Wildcard.PC_lax, namespace_constraint=(pyxb.binding.content.Wildcard.NC_not, 'http://schemas.xmlsoap.org/soap/envelope/'))
_HasWildcardElement = True
_ElementMap.update({
__Header.name() : __Header,
__Body.name() : __Body
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', 'Envelope', Envelope_)
# Complex type {http://schemas.xmlsoap.org/soap/envelope/}Header with content type ELEMENT_ONLY
class Header_ (pyxb.binding.basis.complexTypeDefinition):
"""Complex type {http://schemas.xmlsoap.org/soap/envelope/}Header with content type ELEMENT_ONLY"""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'Header')
_XSDLocation = pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 52, 2)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
_AttributeWildcard = pyxb.binding.content.Wildcard(process_contents=pyxb.binding.content.Wildcard.PC_lax, namespace_constraint=(pyxb.binding.content.Wildcard.NC_not, 'http://schemas.xmlsoap.org/soap/envelope/'))
_HasWildcardElement = True
_ElementMap.update({
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', 'Header', Header_)
# Complex type {http://schemas.xmlsoap.org/soap/envelope/}Body with content type ELEMENT_ONLY
class Body_ (pyxb.binding.basis.complexTypeDefinition):
"""Complex type {http://schemas.xmlsoap.org/soap/envelope/}Body with content type ELEMENT_ONLY"""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'Body')
_XSDLocation = pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 60, 2)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
_AttributeWildcard = pyxb.binding.content.Wildcard(process_contents=pyxb.binding.content.Wildcard.PC_lax, namespace_constraint=pyxb.binding.content.Wildcard.NC_any)
_HasWildcardElement = True
_ElementMap.update({
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', 'Body', Body_)
# Complex type {http://schemas.xmlsoap.org/soap/envelope/}Fault with content type ELEMENT_ONLY
class Fault_ (pyxb.binding.basis.complexTypeDefinition):
"""
Fault reporting structure
"""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'Fault')
_XSDLocation = pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 99, 2)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
# Element faultcode uses Python identifier faultcode
__faultcode = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, 'faultcode'), 'faultcode', '__httpschemas_xmlsoap_orgsoapenvelope_Fault__faultcode', False, pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 106, 6), )
faultcode = property(__faultcode.value, __faultcode.set, None, None)
# Element faultstring uses Python identifier faultstring
__faultstring = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, 'faultstring'), 'faultstring', '__httpschemas_xmlsoap_orgsoapenvelope_Fault__faultstring', False, pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 107, 6), )
faultstring = property(__faultstring.value, __faultstring.set, None, None)
# Element faultactor uses Python identifier faultactor
__faultactor = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, 'faultactor'), 'faultactor', '__httpschemas_xmlsoap_orgsoapenvelope_Fault__faultactor', False, pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 108, 6), )
faultactor = property(__faultactor.value, __faultactor.set, None, None)
# Element detail uses Python identifier detail
__detail = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, 'detail'), 'detail', '__httpschemas_xmlsoap_orgsoapenvelope_Fault__detail', False, pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 109, 6), )
detail = property(__detail.value, __detail.set, None, None)
_ElementMap.update({
__faultcode.name() : __faultcode,
__faultstring.name() : __faultstring,
__faultactor.name() : __faultactor,
__detail.name() : __detail
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', 'Fault', Fault_)
# Complex type {http://schemas.xmlsoap.org/soap/envelope/}detail with content type ELEMENT_ONLY
class detail (pyxb.binding.basis.complexTypeDefinition):
"""Complex type {http://schemas.xmlsoap.org/soap/envelope/}detail with content type ELEMENT_ONLY"""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'detail')
_XSDLocation = pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 113, 2)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
_AttributeWildcard = pyxb.binding.content.Wildcard(process_contents=pyxb.binding.content.Wildcard.PC_lax, namespace_constraint=pyxb.binding.content.Wildcard.NC_any)
_HasWildcardElement = True
_ElementMap.update({
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', 'detail', detail)
Envelope = pyxb.binding.basis.element(pyxb.namespace.ExpandedName(Namespace, 'Envelope'), Envelope_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 41, 2))
Namespace.addCategoryObject('elementBinding', Envelope.name().localName(), Envelope)
Header = pyxb.binding.basis.element(pyxb.namespace.ExpandedName(Namespace, 'Header'), Header_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 51, 2))
Namespace.addCategoryObject('elementBinding', Header.name().localName(), Header)
Body = pyxb.binding.basis.element(pyxb.namespace.ExpandedName(Namespace, 'Body'), Body_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 59, 2))
Namespace.addCategoryObject('elementBinding', Body.name().localName(), Body)
Fault = pyxb.binding.basis.element(pyxb.namespace.ExpandedName(Namespace, 'Fault'), Fault_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 98, 2))
Namespace.addCategoryObject('elementBinding', Fault.name().localName(), Fault)
Envelope_._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(Namespace, 'Header'), Header_, scope=Envelope_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 51, 2)))
Envelope_._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(Namespace, 'Body'), Body_, scope=Envelope_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 59, 2)))
def _BuildAutomaton ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton
del _BuildAutomaton
import pyxb.utils.fac as fac
counters = set()
cc_0 = fac.CounterCondition(min=0, max=1, metadata=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 44, 6))
counters.add(cc_0)
cc_1 = fac.CounterCondition(min=0, max=None, metadata=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 46, 6))
counters.add(cc_1)
states = []
final_update = None
symbol = pyxb.binding.content.ElementUse(Envelope_._UseForTag(pyxb.namespace.ExpandedName(Namespace, 'Header')), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 44, 6))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
final_update = set()
symbol = pyxb.binding.content.ElementUse(Envelope_._UseForTag(pyxb.namespace.ExpandedName(Namespace, 'Body')), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 45, 6))
st_1 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_1)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_1, False))
symbol = pyxb.binding.content.WildcardUse(pyxb.binding.content.Wildcard(process_contents=pyxb.binding.content.Wildcard.PC_lax, namespace_constraint=(pyxb.binding.content.Wildcard.NC_not, 'http://schemas.xmlsoap.org/soap/envelope/')), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 46, 6))
st_2 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_2)
transitions = []
transitions.append(fac.Transition(st_0, [
fac.UpdateInstruction(cc_0, True) ]))
transitions.append(fac.Transition(st_1, [
fac.UpdateInstruction(cc_0, False) ]))
st_0._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_2, [
]))
st_1._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_2, [
fac.UpdateInstruction(cc_1, True) ]))
st_2._set_transitionSet(transitions)
return fac.Automaton(states, counters, False, containing_state=None)
Envelope_._Automaton = _BuildAutomaton()
def _BuildAutomaton_ ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_
del _BuildAutomaton_
import pyxb.utils.fac as fac
counters = set()
cc_0 = fac.CounterCondition(min=0, max=None, metadata=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 54, 6))
counters.add(cc_0)
states = []
final_update = set()
final_update.add(fac.UpdateInstruction(cc_0, False))
symbol = pyxb.binding.content.WildcardUse(pyxb.binding.content.Wildcard(process_contents=pyxb.binding.content.Wildcard.PC_lax, namespace_constraint=(pyxb.binding.content.Wildcard.NC_not, 'http://schemas.xmlsoap.org/soap/envelope/')), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 54, 6))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
transitions = []
transitions.append(fac.Transition(st_0, [
fac.UpdateInstruction(cc_0, True) ]))
st_0._set_transitionSet(transitions)
return fac.Automaton(states, counters, True, containing_state=None)
Header_._Automaton = _BuildAutomaton_()
def _BuildAutomaton_2 ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_2
del _BuildAutomaton_2
import pyxb.utils.fac as fac
counters = set()
cc_0 = fac.CounterCondition(min=0, max=None, metadata=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 62, 6))
counters.add(cc_0)
states = []
final_update = set()
final_update.add(fac.UpdateInstruction(cc_0, False))
symbol = pyxb.binding.content.WildcardUse(pyxb.binding.content.Wildcard(process_contents=pyxb.binding.content.Wildcard.PC_lax, namespace_constraint=pyxb.binding.content.Wildcard.NC_any), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 62, 6))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
transitions = []
transitions.append(fac.Transition(st_0, [
fac.UpdateInstruction(cc_0, True) ]))
st_0._set_transitionSet(transitions)
return fac.Automaton(states, counters, True, containing_state=None)
Body_._Automaton = _BuildAutomaton_2()
Fault_._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, 'faultcode'), pyxb.binding.datatypes.QName, scope=Fault_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 106, 6)))
Fault_._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, 'faultstring'), pyxb.binding.datatypes.string, scope=Fault_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 107, 6)))
Fault_._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, 'faultactor'), pyxb.binding.datatypes.anyURI, scope=Fault_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 108, 6)))
Fault_._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, 'detail'), detail, scope=Fault_, location=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 109, 6)))
def _BuildAutomaton_3 ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_3
del _BuildAutomaton_3
import pyxb.utils.fac as fac
counters = set()
cc_0 = fac.CounterCondition(min=0, max=1, metadata=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 108, 6))
counters.add(cc_0)
cc_1 = fac.CounterCondition(min=0, max=1, metadata=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 109, 6))
counters.add(cc_1)
states = []
final_update = None
symbol = pyxb.binding.content.ElementUse(Fault_._UseForTag(pyxb.namespace.ExpandedName(None, 'faultcode')), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 106, 6))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
final_update = set()
symbol = pyxb.binding.content.ElementUse(Fault_._UseForTag(pyxb.namespace.ExpandedName(None, 'faultstring')), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 107, 6))
st_1 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_1)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_0, False))
symbol = pyxb.binding.content.ElementUse(Fault_._UseForTag(pyxb.namespace.ExpandedName(None, 'faultactor')), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 108, 6))
st_2 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_2)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_1, False))
symbol = pyxb.binding.content.ElementUse(Fault_._UseForTag(pyxb.namespace.ExpandedName(None, 'detail')), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 109, 6))
st_3 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_3)
transitions = []
transitions.append(fac.Transition(st_1, [
]))
st_0._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_2, [
]))
transitions.append(fac.Transition(st_3, [
]))
st_1._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_2, [
fac.UpdateInstruction(cc_0, True) ]))
transitions.append(fac.Transition(st_3, [
fac.UpdateInstruction(cc_0, False) ]))
st_2._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_3, [
fac.UpdateInstruction(cc_1, True) ]))
st_3._set_transitionSet(transitions)
return fac.Automaton(states, counters, False, containing_state=None)
Fault_._Automaton = _BuildAutomaton_3()
def _BuildAutomaton_4 ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_4
del _BuildAutomaton_4
import pyxb.utils.fac as fac
counters = set()
cc_0 = fac.CounterCondition(min=0, max=None, metadata=pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 115, 6))
counters.add(cc_0)
states = []
final_update = set()
final_update.add(fac.UpdateInstruction(cc_0, False))
symbol = pyxb.binding.content.WildcardUse(pyxb.binding.content.Wildcard(process_contents=pyxb.binding.content.Wildcard.PC_lax, namespace_constraint=pyxb.binding.content.Wildcard.NC_any), pyxb.utils.utility.Location('/tmp/pyxbdist.mqXn05k/PyXB-1.2.4/pyxb/bundles/wssplat/schemas/soap11.xsd', 115, 6))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
transitions = []
transitions.append(fac.Transition(st_0, [
fac.UpdateInstruction(cc_0, True) ]))
st_0._set_transitionSet(transitions)
return fac.Automaton(states, counters, True, containing_state=None)
detail._Automaton = _BuildAutomaton_4()
| 53.46841
| 349
| 0.756132
| 3,113
| 24,542
| 5.790235
| 0.102795
| 0.047601
| 0.038169
| 0.054591
| 0.756949
| 0.743634
| 0.71706
| 0.710402
| 0.679057
| 0.662247
| 0
| 0.027791
| 0.120284
| 24,542
| 458
| 350
| 53.585153
| 0.807087
| 0.149621
| 0
| 0.538462
| 1
| 0.137124
| 0.203486
| 0.160172
| 0
| 0
| 0
| 0
| 0
| 1
| 0.023411
| false
| 0
| 0.050167
| 0
| 0.331104
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
1cdcc988e354454dfbced6cb65d4926a0bcf29eb
| 174
|
py
|
Python
|
ratings/models/__init__.py
|
exolever/django-ratings-models
|
7a355d0d5ab17a69c699e3153fa592004a56c62a
|
[
"MIT"
] | 1
|
2021-07-06T01:43:39.000Z
|
2021-07-06T01:43:39.000Z
|
ratings/models/__init__.py
|
exolever/django-ratings-models
|
7a355d0d5ab17a69c699e3153fa592004a56c62a
|
[
"MIT"
] | 5
|
2019-03-20T16:18:41.000Z
|
2019-03-27T19:39:22.000Z
|
ratings/models/__init__.py
|
exolever/django-ratings-models
|
7a355d0d5ab17a69c699e3153fa592004a56c62a
|
[
"MIT"
] | 1
|
2019-05-23T08:35:39.000Z
|
2019-05-23T08:35:39.000Z
|
from .interaction import Interaction # noqa
from .overall_rating import OverallRating # noqa
from .rating import Rating # noqa
from .skip_rating import SkipRating # noqa
| 34.8
| 49
| 0.793103
| 22
| 174
| 6.181818
| 0.409091
| 0.176471
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16092
| 174
| 4
| 50
| 43.5
| 0.931507
| 0.109195
| 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
| 1
| 0
|
0
| 5
|
1cf03c492f9e0c2a2e27a1388cdc14a039f77eee
| 85
|
py
|
Python
|
dbl_archive_data_storage/frugal_storer/frugal_resource.py
|
ubsicap/dbl-archive-data-storage
|
03786ed54024a55ae96b93948a656a3c01269894
|
[
"MIT"
] | null | null | null |
dbl_archive_data_storage/frugal_storer/frugal_resource.py
|
ubsicap/dbl-archive-data-storage
|
03786ed54024a55ae96b93948a656a3c01269894
|
[
"MIT"
] | 12
|
2018-12-11T17:49:01.000Z
|
2019-02-21T18:26:22.000Z
|
dbl_archive_data_storage/frugal_storer/frugal_resource.py
|
ubsicap/dbl-archive-data-storage
|
03786ed54024a55ae96b93948a656a3c01269894
|
[
"MIT"
] | null | null | null |
class FrugalResource():
properties = None
def __init__(self):
pass
| 12.142857
| 23
| 0.611765
| 8
| 85
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.305882
| 85
| 6
| 24
| 14.166667
| 0.813559
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0.25
| 0
| 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
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
e80a1cc03f5bc4bf024849df9144ee1b2861fc69
| 230
|
py
|
Python
|
optur/storages/__init__.py
|
ytsmiling/optur
|
cbc56c60b322ea764592f01758798f745199b455
|
[
"MIT"
] | 1
|
2022-01-19T09:18:15.000Z
|
2022-01-19T09:18:15.000Z
|
optur/storages/__init__.py
|
ytsmiling/optur
|
cbc56c60b322ea764592f01758798f745199b455
|
[
"MIT"
] | null | null | null |
optur/storages/__init__.py
|
ytsmiling/optur
|
cbc56c60b322ea764592f01758798f745199b455
|
[
"MIT"
] | null | null | null |
from optur.storages.builder import create_inmemory_storage, create_posix_storage
from optur.storages.storage import Storage, StorageClient
__all__ = ["Storage", "StorageClient", "create_inmemory_storage", "create_posix_storage"]
| 46
| 89
| 0.83913
| 27
| 230
| 6.703704
| 0.407407
| 0.099448
| 0.187845
| 0.298343
| 0.430939
| 0.430939
| 0
| 0
| 0
| 0
| 0
| 0
| 0.073913
| 230
| 4
| 90
| 57.5
| 0.849765
| 0
| 0
| 0
| 0
| 0
| 0.273913
| 0.1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
e83859edebbf8fec8d16b18332045ee13343aaab
| 341
|
py
|
Python
|
Basic/16_class/dunder_method.py
|
sekilas13/Python
|
8b2c91cf0c90ebaba7a22e97bd69dae7a6564714
|
[
"MIT"
] | 79
|
2021-09-12T02:31:14.000Z
|
2022-03-29T08:46:53.000Z
|
Basic/16_class/dunder_method.py
|
sekilas13/Python
|
8b2c91cf0c90ebaba7a22e97bd69dae7a6564714
|
[
"MIT"
] | 121
|
2021-09-10T02:38:47.000Z
|
2022-03-30T03:30:35.000Z
|
Basic/16_class/dunder_method.py
|
sekilas13/Python
|
8b2c91cf0c90ebaba7a22e97bd69dae7a6564714
|
[
"MIT"
] | 76
|
2021-09-10T02:27:28.000Z
|
2022-03-28T10:24:12.000Z
|
class Hewan:
def __init__(self, nama_hewan, suara):
self.nama_hewan = nama_hewan
self.suara = suara
def __repr__(self):
return "kucing {} bersuara {}".format(self.nama_hewan, self.suara)
if __name__ == "__main__":
hewan = Hewan("sapi", "Mooo")
print(f" {hewan.nama_hewan} bersuara :{hewan.suara}")
| 26.230769
| 74
| 0.636364
| 43
| 341
| 4.55814
| 0.44186
| 0.229592
| 0.19898
| 0.183673
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.219941
| 341
| 12
| 75
| 28.416667
| 0.736842
| 0
| 0
| 0
| 0
| 0
| 0.234604
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0
| 0.111111
| 0.444444
| 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
| 1
| 0
| 0
|
0
| 5
|
1c0ce8ad76f4906a2dc28c42714806dde909bfac
| 43
|
py
|
Python
|
demo.py
|
thomas-marquis/immo-tools-lib
|
455d726923ad723b099ee098e8ded7e28942904c
|
[
"MIT"
] | null | null | null |
demo.py
|
thomas-marquis/immo-tools-lib
|
455d726923ad723b099ee098e8ded7e28942904c
|
[
"MIT"
] | null | null | null |
demo.py
|
thomas-marquis/immo-tools-lib
|
455d726923ad723b099ee098e8ded7e28942904c
|
[
"MIT"
] | null | null | null |
import numpy as np
ones = np.ones((3, 3))
| 10.75
| 22
| 0.627907
| 9
| 43
| 3
| 0.666667
| 0.444444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058824
| 0.209302
| 43
| 3
| 23
| 14.333333
| 0.735294
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 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
| 5
|
1c8b2730cc348387267986e6916c429b513da81c
| 81
|
py
|
Python
|
intel_pytorch_extension_py/ops/nms.py
|
CaoE/intel-extension-for-pytorch
|
2a31cef7592207a7d08e346542218b5a79df8df9
|
[
"Apache-2.0"
] | null | null | null |
intel_pytorch_extension_py/ops/nms.py
|
CaoE/intel-extension-for-pytorch
|
2a31cef7592207a7d08e346542218b5a79df8df9
|
[
"Apache-2.0"
] | 1
|
2021-03-30T04:54:24.000Z
|
2021-03-30T04:54:24.000Z
|
intel_pytorch_extension_py/ops/nms.py
|
CaoE/intel-extension-for-pytorch
|
2a31cef7592207a7d08e346542218b5a79df8df9
|
[
"Apache-2.0"
] | null | null | null |
import _torch_ipex as core
nms = core.nms
batch_score_nms = core.batch_score_nms
| 20.25
| 38
| 0.82716
| 15
| 81
| 4.066667
| 0.533333
| 0.229508
| 0.42623
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.123457
| 81
| 4
| 38
| 20.25
| 0.859155
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
1c98df619e9041bb351d2436654aa5cf78dbca0f
| 58
|
py
|
Python
|
app/dashmachine/dashboard.py
|
rmountjoy92/dashmachine-server
|
50d47266eab137a155035e3bd3bfcb002eebe17e
|
[
"MIT"
] | 3
|
2021-11-11T19:16:27.000Z
|
2022-02-27T23:38:43.000Z
|
app/dashmachine/dashboard.py
|
rmountjoy92/dashmachine-server
|
50d47266eab137a155035e3bd3bfcb002eebe17e
|
[
"MIT"
] | null | null | null |
app/dashmachine/dashboard.py
|
rmountjoy92/dashmachine-server
|
50d47266eab137a155035e3bd3bfcb002eebe17e
|
[
"MIT"
] | null | null | null |
class Dashboard:
def __init__(self, dm):
pass
| 14.5
| 27
| 0.603448
| 7
| 58
| 4.428571
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.310345
| 58
| 3
| 28
| 19.333333
| 0.775
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.333333
| 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
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
98e7b3d469fc880fc2afbf749186d05b9e0959a0
| 117
|
py
|
Python
|
python/testData/inspections/PyUnresolvedReferencesInspection/DunderAll/m2.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/inspections/PyUnresolvedReferencesInspection/DunderAll/m2.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/inspections/PyUnresolvedReferencesInspection/DunderAll/m2.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
t1 = ["m2m2"]
__all__ = ["m2m1"]
__all__ += t1
def m2m1():
pass
def m2m2():
pass
def m2m3():
pass
| 6.882353
| 18
| 0.504274
| 15
| 117
| 3.4
| 0.466667
| 0.27451
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15
| 0.316239
| 117
| 17
| 19
| 6.882353
| 0.4875
| 0
| 0
| 0.333333
| 0
| 0
| 0.067797
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.333333
| 0
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
98f2ed98ecb5a26a8715eea401e624fc5f407bda
| 92
|
py
|
Python
|
modules/GoogleReverseImageSearch.py
|
shiny-fortnight/reverse_search
|
2c92ad8372eb212252abac65c308a9f84ee16016
|
[
"Apache-2.0"
] | 1
|
2020-07-03T16:34:08.000Z
|
2020-07-03T16:34:08.000Z
|
modules/GoogleReverseImageSearch.py
|
shiny-fortnight/reverse_search
|
2c92ad8372eb212252abac65c308a9f84ee16016
|
[
"Apache-2.0"
] | null | null | null |
modules/GoogleReverseImageSearch.py
|
shiny-fortnight/reverse_search
|
2c92ad8372eb212252abac65c308a9f84ee16016
|
[
"Apache-2.0"
] | 2
|
2016-01-24T22:28:09.000Z
|
2019-03-06T06:31:54.000Z
|
def searchImage(query):
return "https://www.google.com/searchbyimage?&image_url="+query
| 30.666667
| 67
| 0.75
| 12
| 92
| 5.666667
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.086957
| 92
| 2
| 68
| 46
| 0.809524
| 0
| 0
| 0
| 0
| 0
| 0.521739
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
c73cf92c987cd02d057272634c77811ebf412325
| 123
|
py
|
Python
|
backend/features.py
|
ReynaldoCC/arango-backend
|
fe7e28b7ee266ce9b50054758018cfad976bc7c3
|
[
"BSD-3-Clause"
] | 1
|
2020-04-07T04:33:21.000Z
|
2020-04-07T04:33:21.000Z
|
backend/features.py
|
ReynaldoCC/arango-backend
|
fe7e28b7ee266ce9b50054758018cfad976bc7c3
|
[
"BSD-3-Clause"
] | null | null | null |
backend/features.py
|
ReynaldoCC/arango-backend
|
fe7e28b7ee266ce9b50054758018cfad976bc7c3
|
[
"BSD-3-Clause"
] | 1
|
2020-04-07T16:06:22.000Z
|
2020-04-07T16:06:22.000Z
|
from django.db.backends.base.features import BaseDatabaseFeatures
class DatabaseFeatures(BaseDatabaseFeatures):
pass
| 20.5
| 65
| 0.837398
| 12
| 123
| 8.583333
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105691
| 123
| 5
| 66
| 24.6
| 0.936364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 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
| 1
| 1
| 0
| 0
| 0
|
0
| 5
|
c7427ca7c5f9a8b6221f571717af1b3f618688b2
| 46,160
|
py
|
Python
|
importer_django/bbsc_importer.py
|
stjordanis/owid-importer
|
4341713d7fa88b41327ea48419ed5785b5cb9faf
|
[
"MIT"
] | 15
|
2018-12-07T06:11:49.000Z
|
2022-01-24T03:38:05.000Z
|
importer_django/bbsc_importer.py
|
stjordanis/owid-importer
|
4341713d7fa88b41327ea48419ed5785b5cb9faf
|
[
"MIT"
] | 10
|
2020-04-05T01:08:27.000Z
|
2022-02-17T23:54:13.000Z
|
importer_django/bbsc_importer.py
|
stjordanis/owid-importer
|
4341713d7fa88b41327ea48419ed5785b5cb9faf
|
[
"MIT"
] | 6
|
2018-11-03T09:14:58.000Z
|
2021-05-17T21:59:59.000Z
|
import sys
import os
import hashlib
import json
import logging
import requests
import unidecode
import shutil
import time
import zipfile
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import grapher_admin.wsgi
from openpyxl import load_workbook
from grapher_admin.models import Entity, DatasetSubcategory, DatasetCategory, Dataset, Source, Variable, VariableType, DataValue, ChartDimension
from importer.models import ImportHistory, AdditionalCountryInfo
from country_name_tool.models import CountryName
from django.conf import settings
from django.db import connection, transaction
from django.utils import timezone
from django.urls import reverse
from grapher_admin.views import write_dataset_csv
# we will use the file checksum to check if the downloaded file has changed since we last saw it
def file_checksum(filename, blocksize=2**20):
m = hashlib.md5()
with open(filename, "rb") as f:
while True:
buffer = f.read(blocksize)
if not buffer:
break
m.update(buffer)
return m.hexdigest()
def short_unit_extract(unit: str):
common_short_units = ['$', '£', '€', '%'] # used for extracting short forms of units of measurement
short_unit = None
if unit:
if ' per ' in unit:
short_form = unit.split(' per ')[0]
if any(w in short_form for w in common_short_units):
for x in common_short_units:
if x in short_form:
short_unit = x
break
else:
short_unit = short_form
elif any(x in unit for x in common_short_units):
for y in common_short_units:
if y in unit:
short_unit = y
break
elif 'percentage' in unit:
short_unit = '%'
elif 'percent' in unit.lower():
short_unit = '%'
elif len(unit) < 9: # this length is sort of arbitrary at this point, taken from the unit 'hectares'
short_unit = unit
return short_unit
source_description = {
'dataPublishedBy': "World Bank Data on Statistical Capacity",
'link': "https://data.worldbank.org/data-catalog/data-on-statistical-capacity",
'retrievedDate': timezone.now().strftime("%d-%B-%y")
}
bbsc_zip_file_url = 'http://databank.worldbank.org/data/download/BBSC_Excel.zip'
bbsc_downloads_save_location = settings.BASE_DIR + '/data/bbsc_downloads/'
# create a directory for holding the downloads
# if the directory exists, delete it and recreate it
if not os.path.exists(bbsc_downloads_save_location):
os.makedirs(bbsc_downloads_save_location)
#else:
# shutil.rmtree(bbsc_downloads_save_location)
# os.makedirs(bbsc_downloads_save_location)
logger = logging.getLogger('importer')
start_time = time.time()
logger.info("Getting the zip file")
request_header = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
r = requests.get(bbsc_zip_file_url, stream=True, headers=request_header)
if r.ok:
with open(bbsc_downloads_save_location + 'bbsc.zip', 'wb') as out_file:
shutil.copyfileobj(r.raw, out_file)
logger.info("Saved the zip file to disk.")
z = zipfile.ZipFile(bbsc_downloads_save_location + 'bbsc.zip')
excel_filename = bbsc_downloads_save_location + z.namelist()[0] # there should be only one file inside the zipfile, so we will load that one
z.extractall(bbsc_downloads_save_location)
r = None # we do not need the request anymore
logger.info("Successfully extracted the zip file")
else:
logger.error("The file could not be downloaded. Stopping the script...")
sys.exit("Could not download file.")
bbsc_category_name_in_db = 'World Bank Data on Statistical Capacity' # set the name of the root category of all data that will be imported by this script
import_history = ImportHistory.objects.filter(import_type='bbsc')
#excel_filename = bbsc_downloads_save_location + "BBSCEXCEL.xlsx"
with transaction.atomic():
# if bbsc imports were never performed
if not import_history:
logger.info("This is the very first BBSC data import.")
wb = load_workbook(excel_filename, read_only=True)
series_ws = wb['Series']
data_ws = wb['Data']
country_ws = wb['Country']
column_number = 0 # this will be reset to 0 on each new row
row_number = 0 # this will be reset to 0 if we switch to another worksheet, or start reading the worksheet from the beginning one more time
global_cat = {} # global catalog of indicators
# data in the worksheets is not loaded into memory at once, that causes RAM to quickly fill up
# instead, we go through each row and cell one-by-one, looking at each piece of data separately
# this has the disadvantage of needing to traverse the worksheet several times, if we need to look up some rows/cells again
for row in series_ws.rows:
row_number += 1
for cell in row:
if row_number > 1:
column_number += 1
if column_number == 1:
global_cat[cell.value.upper().strip()] = {}
indicatordict = global_cat[cell.value.upper().strip()]
if column_number == 2:
indicatordict['category'] = cell.value
if column_number == 3:
indicatordict['name'] = cell.value
if column_number == 5:
indicatordict['description'] = cell.value
if column_number == 6:
if cell.value:
indicatordict['unitofmeasure'] = cell.value
else:
if '(' not in indicatordict['name']:
indicatordict['unitofmeasure'] = ''
else:
indicatordict['unitofmeasure'] = indicatordict['name'][
indicatordict['name'].rfind('(') + 1:indicatordict[
'name'].rfind(')')]
if column_number == 11:
if cell.value:
indicatordict['limitations'] = cell.value
else:
indicatordict['limitations'] = ''
if column_number == 12:
if cell.value:
indicatordict['sourcenotes'] = cell.value
else:
indicatordict['sourcenotes'] = ''
if column_number == 13:
if cell.value:
indicatordict['comments'] = cell.value
else:
indicatordict['comments'] = ''
if column_number == 14:
indicatordict['source'] = cell.value
if column_number == 15:
if cell.value:
indicatordict['concept'] = cell.value
else:
indicatordict['concept'] = ''
if column_number == 17:
if cell.value:
indicatordict['sourcelinks'] = cell.value
else:
indicatordict['sourcelinks'] = ''
if column_number == 18:
if cell.value:
indicatordict['weblinks'] = cell.value
else:
indicatordict['weblinks'] = ''
indicatordict['saved'] = False
column_number = 0
category_vars = {} # categories and their corresponding variables
for key, value in global_cat.items():
if value['category'] in category_vars:
category_vars[value['category']].append(key)
else:
category_vars[value['category']] = []
category_vars[value['category']].append(key)
existing_categories = DatasetCategory.objects.values('name')
existing_categories_list = {item['name'] for item in existing_categories}
if bbsc_category_name_in_db not in existing_categories_list:
the_category = DatasetCategory(name=bbsc_category_name_in_db, fetcher_autocreated=True)
the_category.save()
logger.info("Inserting a category %s." % bbsc_category_name_in_db.encode('utf8'))
else:
the_category = DatasetCategory.objects.get(name=bbsc_category_name_in_db)
existing_subcategories = DatasetSubcategory.objects.filter(categoryId=the_category.pk).values('name')
existing_subcategories_list = {item['name'] for item in existing_subcategories}
bbsc_categories_list = []
for key, value in category_vars.items():
bbsc_categories_list.append(key)
if key not in existing_subcategories_list:
the_subcategory = DatasetSubcategory(name=key, categoryId=the_category)
the_subcategory.save()
logger.info("Inserting a subcategory %s." % key.encode('utf8'))
existing_entities = Entity.objects.values('name')
existing_entities_list = {item['name'] for item in existing_entities}
country_tool_names = CountryName.objects.all()
country_tool_names_dict = {}
for each in country_tool_names:
country_tool_names_dict[each.country_name.lower()] = each.owid_country
country_name_entity_ref = {} # this dict will hold the country names from excel and the appropriate entity object (this is used when saving the variables and their values)
row_number = 0
for row in country_ws.rows:
row_number += 1
for cell in row:
if row_number > 1:
column_number += 1
if column_number == 1:
country_code = cell.value
if column_number == 3:
country_name = cell.value
if column_number == 7:
country_special_notes = cell.value
if column_number == 8:
country_region = cell.value
if column_number == 9:
country_income_group = cell.value
if column_number == 24:
country_latest_census = cell.value
if column_number == 25:
country_latest_survey = cell.value
if column_number == 26:
country_recent_income_source = cell.value
if column_number == 31:
entity_info = AdditionalCountryInfo()
entity_info.country_code = country_code
entity_info.country_name = country_name
entity_info.country_wb_region = country_region
entity_info.country_wb_income_group = country_income_group
entity_info.country_special_notes = country_special_notes
entity_info.country_latest_census = country_latest_census
entity_info.country_latest_survey = country_latest_survey
entity_info.country_recent_income_source = country_recent_income_source
entity_info.dataset = 'bbsc'
entity_info.save()
if country_tool_names_dict.get(unidecode.unidecode(country_name.lower()), 0):
newentity = Entity.objects.get(name=country_tool_names_dict[unidecode.unidecode(country_name.lower())].owid_name)
elif country_name in existing_entities_list:
newentity = Entity.objects.get(name=country_name)
else:
newentity = Entity(name=country_name, validated=False)
newentity.save()
logger.info("Inserting a country %s." % newentity.name.encode('utf8'))
country_name_entity_ref[country_code] = newentity
column_number = 0
insert_string = 'INSERT into data_values (value, year, entityId, variableId) VALUES (%s, %s, %s, %s)' # this is used for constructing the query for mass inserting to the data_values table
data_values_tuple_list = []
datasets_list = []
for category in bbsc_categories_list:
newdataset = Dataset(name='World Bank Data on Statistical Capacity - ' + category,
description='This is a dataset imported by the automated fetcher',
namespace='bbsc', categoryId=the_category,
subcategoryId=DatasetSubcategory.objects.get(name=category, categoryId=the_category))
newdataset.save()
datasets_list.append(newdataset)
logger.info("Inserting a dataset %s." % newdataset.name.encode('utf8'))
row_number = 0
columns_to_years = {}
for row in data_ws.rows:
row_number += 1
data_values = []
for cell in row:
if row_number == 1:
column_number += 1
if cell.value:
try:
last_available_year = int(cell.value)
columns_to_years[column_number] = last_available_year
last_available_column = column_number
except:
pass
if row_number > 1:
column_number += 1
if column_number == 1:
country_name = cell.value
if column_number == 2:
country_code = cell.value
if column_number == 3:
indicator_name = cell.value
if column_number == 4:
indicator_code = cell.value.upper().strip()
if column_number > 4 and column_number <= last_available_column:
if cell.value or cell.value == 0:
data_values.append({'value': cell.value, 'year': columns_to_years[column_number]})
if column_number > 4 and column_number == last_available_column:
if len(data_values):
if indicator_code in category_vars[category]:
if not global_cat[indicator_code]['saved']:
source_description['additionalInfo'] = "Definitions and characteristics of countries and other territories: " + "https://ourworldindata.org" + reverse("servebbsccountryinfo") + "\n"
source_description['additionalInfo'] += "Limitations and exceptions:\n" + global_cat[indicator_code]['limitations'] + "\n" if global_cat[indicator_code]['limitations'] else ''
source_description['additionalInfo'] += "Notes from original source:\n" + global_cat[indicator_code]['sourcenotes'] + "\n" if global_cat[indicator_code]['sourcenotes'] else ''
source_description['additionalInfo'] += "General comments:\n" + global_cat[indicator_code]['comments'] + "\n" if global_cat[indicator_code]['comments'] else ''
source_description['additionalInfo'] += "Statistical concept and methodology:\n" + global_cat[indicator_code]['concept'] + "\n" if global_cat[indicator_code]['concept'] else ''
source_description['additionalInfo'] += "Related source links:\n" + global_cat[indicator_code]['sourcelinks'] + "\n" if global_cat[indicator_code]['sourcelinks'] else ''
source_description['additionalInfo'] += "Other web links:\n" + global_cat[indicator_code]['weblinks'] + "\n" if global_cat[indicator_code]['weblinks'] else ''
source_description['dataPublisherSource'] = global_cat[indicator_code]['source']
newsource = Source(name='World Bank Data on Statistical Capacity: ' + global_cat[indicator_code]['name'],
description=json.dumps(source_description),
datasetId=newdataset.pk)
newsource.save()
logger.info("Inserting a source %s." % newsource.name.encode('utf8'))
s_unit = short_unit_extract(global_cat[indicator_code]['unitofmeasure'])
newvariable = Variable(name=global_cat[indicator_code]['name'], unit=global_cat[indicator_code]['unitofmeasure'] if global_cat[indicator_code]['unitofmeasure'] else '', short_unit=s_unit, description=global_cat[indicator_code]['description'],
code=indicator_code, timespan='', datasetId=newdataset, variableTypeId=VariableType.objects.get(pk=4), sourceId=newsource)
newvariable.save()
logger.info("Inserting a variable %s." % newvariable.name.encode('utf8'))
global_cat[indicator_code]['variable_object'] = newvariable
global_cat[indicator_code]['saved'] = True
else:
newvariable = global_cat[indicator_code]['variable_object']
for i in range(0, len(data_values)):
data_values_tuple_list.append((data_values[i]['value'], data_values[i]['year'], country_name_entity_ref[country_code].pk, newvariable.pk))
if len(data_values_tuple_list) > 3000: # insert when the length of the list goes over 3000
with connection.cursor() as c:
c.executemany(insert_string, data_values_tuple_list)
logger.info("Dumping data values...")
data_values_tuple_list = []
column_number = 0
if row_number % 10 == 0:
time.sleep(0.001) # this is done in order to not keep the CPU busy all the time, the delay after each 10th row is 1 millisecond
if len(data_values_tuple_list): # insert any leftover data_values
with connection.cursor() as c:
c.executemany(insert_string, data_values_tuple_list)
logger.info("Dumping data values...")
newimport = ImportHistory(import_type='bbsc', import_time=timezone.now().strftime('%Y-%m-%d %H:%M:%S'),
import_notes='Initial import of BBSC datasets',
import_state=json.dumps({'file_hash': file_checksum(bbsc_downloads_save_location + 'bbsc.zip')}))
newimport.save()
for dataset in datasets_list:
write_dataset_csv(dataset.pk, dataset.name, None, 'bbsc_fetcher', '')
logger.info("Import complete.")
else:
last_import = import_history.last()
deleted_indicators = {} # This is used to keep track which variables' data values were already deleted before writing new values
if json.loads(last_import.import_state)['file_hash'] == file_checksum(bbsc_downloads_save_location + 'bbsc.zip'):
logger.info('No updates available.')
sys.exit('No updates available.')
logger.info('New data is available.')
available_variables = Variable.objects.filter(datasetId__in=Dataset.objects.filter(namespace='bbsc'))
available_variables_list = []
for each in available_variables.values('code'):
available_variables_list.append(each['code'])
chart_dimension_vars = ChartDimension.objects.all().values('variableId').distinct()
chart_dimension_vars_list = {item['variableId'] for item in chart_dimension_vars}
existing_variables_ids = [item['id'] for item in available_variables.values('id')]
existing_variables_id_code = {item['id']: item['code'] for item in available_variables.values('id', 'code')}
existing_variables_code_id = {item['code']: item['id'] for item in available_variables.values('id', 'code')}
vars_being_used = [] # we will not be deleting any variables that are currently being used by charts
for each_var in existing_variables_ids:
if each_var in chart_dimension_vars_list:
vars_being_used.append(existing_variables_id_code[each_var])
wb = load_workbook(excel_filename, read_only=True)
series_ws = wb['Series']
data_ws = wb['Data']
country_ws = wb['Country']
column_number = 0 # this will be reset to 0 on each new row
row_number = 0 # this will be reset to 0 if we switch to another worksheet, or start reading the worksheet from the beginning one more time
global_cat = {} # global catalog of indicators
# data in the worksheets is not loaded into memory at once, that causes RAM to quickly fill up
# instead, we go through each row and cell one-by-one, looking at each piece of data separately
# this has the disadvantage of needing to traverse the worksheet several times, if we need to look up some rows/cells again
for row in series_ws.rows:
row_number += 1
for cell in row:
if row_number > 1:
column_number += 1
if column_number == 1:
global_cat[cell.value.upper().strip()] = {}
indicatordict = global_cat[cell.value.upper().strip()]
if column_number == 2:
indicatordict['category'] = cell.value
if column_number == 3:
indicatordict['name'] = cell.value
if column_number == 5:
indicatordict['description'] = cell.value
if column_number == 6:
if cell.value:
indicatordict['unitofmeasure'] = cell.value
else:
if '(' not in indicatordict['name']:
indicatordict['unitofmeasure'] = ''
else:
indicatordict['unitofmeasure'] = indicatordict['name'][
indicatordict['name'].rfind('(') + 1:indicatordict[
'name'].rfind(')')]
if column_number == 11:
if cell.value:
indicatordict['limitations'] = cell.value
else:
indicatordict['limitations'] = ''
if column_number == 12:
if cell.value:
indicatordict['sourcenotes'] = cell.value
else:
indicatordict['sourcenotes'] = ''
if column_number == 13:
if cell.value:
indicatordict['comments'] = cell.value
else:
indicatordict['comments'] = ''
if column_number == 14:
indicatordict['source'] = cell.value
if column_number == 15:
if cell.value:
indicatordict['concept'] = cell.value
else:
indicatordict['concept'] = ''
if column_number == 17:
if cell.value:
indicatordict['sourcelinks'] = cell.value
else:
indicatordict['sourcelinks'] = ''
if column_number == 18:
if cell.value:
indicatordict['weblinks'] = cell.value
else:
indicatordict['weblinks'] = ''
indicatordict['saved'] = False
column_number = 0
new_variables = []
for key, value in global_cat.items():
new_variables.append(key)
vars_to_add = list(set(new_variables).difference(available_variables_list))
newly_added_vars = list(set(new_variables).difference(available_variables_list))
vars_to_delete = list(set(available_variables_list).difference(new_variables))
for each in vars_to_delete:
if each not in vars_being_used:
logger.info("Deleting data values for the variable: %s" % each.encode('utf8'))
while DataValue.objects.filter(variableId__pk=existing_variables_code_id[each]).first():
with connection.cursor() as c: # if we don't limit the deleted values, the db might just hang
c.execute('DELETE FROM %s WHERE variableId = %s LIMIT 10000;' %
(DataValue._meta.db_table, existing_variables_code_id[each]))
source_object = Variable.objects.get(code=each, datasetId__in=Dataset.objects.filter(namespace='bbsc')).sourceId
Variable.objects.get(code=each, datasetId__in=Dataset.objects.filter(namespace='bbsc')).delete()
logger.info("Deleting the variable: %s" % each.encode('utf8'))
logger.info("Deleting the source: %s" % source_object.name.encode('utf8'))
source_object.delete()
category_vars = {} # categories and their corresponding variables
for key, value in global_cat.items():
if value['category'] in category_vars:
category_vars[value['category']].append(key)
else:
category_vars[value['category']] = []
category_vars[value['category']].append(key)
existing_categories = DatasetCategory.objects.values('name')
existing_categories_list = {item['name'] for item in existing_categories}
if bbsc_category_name_in_db not in existing_categories_list:
the_category = DatasetCategory(name=bbsc_category_name_in_db, fetcher_autocreated=True)
the_category.save()
logger.info("Inserting a category %s." % bbsc_category_name_in_db.encode('utf8'))
else:
the_category = DatasetCategory.objects.get(name=bbsc_category_name_in_db)
existing_subcategories = DatasetSubcategory.objects.filter(categoryId=the_category).values('name')
existing_subcategories_list = {item['name'] for item in existing_subcategories}
bbsc_categories_list = []
for key, value in category_vars.items():
bbsc_categories_list.append(key)
if key not in existing_subcategories_list:
the_subcategory = DatasetSubcategory(name=key, categoryId=the_category)
the_subcategory.save()
logger.info("Inserting a subcategory %s." % key.encode('utf8'))
cats_to_add = list(set(bbsc_categories_list).difference(list(existing_subcategories_list)))
existing_entities = Entity.objects.values('name')
existing_entities_list = {item['name'] for item in existing_entities}
country_tool_names = CountryName.objects.all()
country_tool_names_dict = {}
for each in country_tool_names:
country_tool_names_dict[each.country_name.lower()] = each.owid_country
country_name_entity_ref = {} # this dict will hold the country names from excel and the appropriate entity object (this is used when saving the variables and their values)
AdditionalCountryInfo.objects.filter(dataset='bbsc').delete() # We will load new additional country data now
row_number = 0
for row in country_ws.rows:
row_number += 1
for cell in row:
if row_number > 1:
column_number += 1
if column_number == 1:
country_code = cell.value
if column_number == 3:
country_name = cell.value
if column_number == 7:
country_special_notes = cell.value
if column_number == 8:
country_region = cell.value
if column_number == 9:
country_income_group = cell.value
if column_number == 24:
country_latest_census = cell.value
if column_number == 25:
country_latest_survey = cell.value
if column_number == 26:
country_recent_income_source = cell.value
if column_number == 31:
entity_info = AdditionalCountryInfo()
entity_info.country_code = country_code
entity_info.country_name = country_name
entity_info.country_wb_region = country_region
entity_info.country_wb_income_group = country_income_group
entity_info.country_special_notes = country_special_notes
entity_info.country_latest_census = country_latest_census
entity_info.country_latest_survey = country_latest_survey
entity_info.country_recent_income_source = country_recent_income_source
entity_info.dataset = 'bbsc'
entity_info.save()
if country_tool_names_dict.get(unidecode.unidecode(country_name.lower()), 0):
newentity = Entity.objects.get(name=country_tool_names_dict[unidecode.unidecode(country_name.lower())].owid_name)
elif country_name in existing_entities_list:
newentity = Entity.objects.get(name=country_name)
else:
newentity = Entity(name=country_name, validated=False)
newentity.save()
logger.info("Inserting a country %s." % newentity.name.encode('utf8'))
country_name_entity_ref[country_code] = newentity
column_number = 0
insert_string = 'INSERT into data_values (value, year, entityId, variableId) VALUES (%s, %s, %s, %s)' # this is used for constructing the query for mass inserting to the data_values table
data_values_tuple_list = []
total_values_tracker = 0
dataset_id_oldname_list = []
for category in bbsc_categories_list:
if category in cats_to_add:
newdataset = Dataset(name='World Bank Data on Statistical Capacity - ' + category,
description='This is a dataset imported by the automated fetcher',
namespace='bbsc', categoryId=the_category,
subcategoryId=DatasetSubcategory.objects.get(name=category,
categoryId=the_category))
newdataset.save()
dataset_id_oldname_list.append({'id': newdataset.pk, 'newname': newdataset.name, 'oldname': None})
logger.info("Inserting a dataset %s." % newdataset.name.encode('utf8'))
else:
newdataset = Dataset.objects.get(name='World Bank Data on Statistical Capacity - ' + category, categoryId=DatasetCategory.objects.get(
name=bbsc_category_name_in_db))
dataset_id_oldname_list.append({'id': newdataset.pk, 'newname': newdataset.name, 'oldname': newdataset.name})
row_number = 0
columns_to_years = {}
for row in data_ws.rows:
row_number += 1
data_values = []
for cell in row:
if row_number == 1:
column_number += 1
if cell.value:
try:
last_available_year = int(cell.value)
columns_to_years[column_number] = last_available_year
last_available_column = column_number
except:
pass
if row_number > 1:
column_number += 1
if column_number == 1:
country_name = cell.value
if column_number == 2:
country_code = cell.value
if column_number == 3:
indicator_name = cell.value
if column_number == 4:
indicator_code = cell.value.upper().strip()
if column_number > 4 and column_number <= last_available_column:
if cell.value or cell.value == 0:
data_values.append({'value': cell.value, 'year': columns_to_years[column_number]})
if column_number > 4 and column_number == last_available_column:
if len(data_values):
if indicator_code in category_vars[category]:
total_values_tracker += len(data_values)
if indicator_code in vars_to_add:
source_description['additionalInfo'] = "Definitions and characteristics of countries and other territories: " + "https://ourworldindata.org" + reverse("servebbsccountryinfo") + "\n"
source_description['additionalInfo'] += "Limitations and exceptions:\n" + global_cat[indicator_code]['limitations'] + "\n" if global_cat[indicator_code]['limitations'] else ''
source_description['additionalInfo'] += "Notes from original source:\n" + global_cat[indicator_code]['sourcenotes'] + "\n" if global_cat[indicator_code]['sourcenotes'] else ''
source_description['additionalInfo'] += "General comments:\n" + global_cat[indicator_code]['comments'] + "\n" if global_cat[indicator_code]['comments'] else ''
source_description['additionalInfo'] += "Statistical concept and methodology:\n" + global_cat[indicator_code]['concept'] + "\n" if global_cat[indicator_code]['concept'] else ''
source_description['additionalInfo'] += "Related source links:\n" + global_cat[indicator_code]['sourcelinks'] + "\n" if global_cat[indicator_code]['sourcelinks'] else ''
source_description['additionalInfo'] += "Other web links:\n" + global_cat[indicator_code]['weblinks'] + "\n" if global_cat[indicator_code]['weblinks'] else ''
source_description['dataPublisherSource'] = global_cat[indicator_code]['source']
newsource = Source(name='World Bank Data on Statistical Capacity: ' + global_cat[indicator_code]['name'],
description=json.dumps(source_description),
datasetId=newdataset.pk)
newsource.save()
logger.info("Inserting a source %s." % newsource.name.encode('utf8'))
global_cat[indicator_code]['source_object'] = newsource
s_unit = short_unit_extract(global_cat[indicator_code]['unitofmeasure'])
newvariable = Variable(name=global_cat[indicator_code]['name'],
unit=global_cat[indicator_code]['unitofmeasure'] if
global_cat[indicator_code]['unitofmeasure'] else '',
short_unit=s_unit,
description=global_cat[indicator_code]['description'],
code=indicator_code,
timespan='',
datasetId=newdataset,
variableTypeId=VariableType.objects.get(pk=4),
sourceId=newsource)
newvariable.save()
global_cat[indicator_code]['variable_object'] = newvariable
vars_to_add.remove(indicator_code)
global_cat[indicator_code]['saved'] = True
logger.info("Inserting a variable %s." % newvariable.name.encode('utf8'))
else:
if not global_cat[indicator_code]['saved']:
newsource = Source.objects.get(name='World Bank Data on Statistical Capacity: ' + Variable.objects.get(code=indicator_code, datasetId__in=Dataset.objects.filter(namespace='bbsc')).name)
newsource.name = 'World Bank Data on Statistical Capacity: ' + global_cat[indicator_code]['name']
source_description['additionalInfo'] = "Definitions and characteristics of countries and other territories: " + "https://ourworldindata.org" + reverse("servebbsccountryinfo") + "\n"
source_description['additionalInfo'] += "Limitations and exceptions:\n" + global_cat[indicator_code]['limitations'] + "\n" if global_cat[indicator_code]['limitations'] else ''
source_description['additionalInfo'] += "Notes from original source:\n" + global_cat[indicator_code]['sourcenotes'] + "\n" if global_cat[indicator_code]['sourcenotes'] else ''
source_description['additionalInfo'] += "General comments:\n" + global_cat[indicator_code]['comments'] + "\n" if global_cat[indicator_code]['comments'] else ''
source_description['additionalInfo'] += "Statistical concept and methodology:\n" + global_cat[indicator_code]['concept'] + "\n" if global_cat[indicator_code]['concept'] else ''
source_description['additionalInfo'] += "Related source links:\n" + global_cat[indicator_code]['sourcelinks'] + "\n" if global_cat[indicator_code]['sourcelinks'] else ''
source_description['additionalInfo'] += "Other web links:\n" + global_cat[indicator_code]['weblinks'] + "\n" if global_cat[indicator_code]['weblinks'] else ''
source_description['dataPublisherSource'] = global_cat[indicator_code]['source']
newsource.description=json.dumps(source_description)
newsource.datasetId=newdataset.pk
newsource.save()
logger.info("Updating the source %s." % newsource.name.encode('utf8'))
s_unit = short_unit_extract(global_cat[indicator_code]['unitofmeasure'])
newvariable = Variable.objects.get(code=indicator_code, datasetId__in=Dataset.objects.filter(namespace='bbsc'))
newvariable.name = global_cat[indicator_code]['name']
newvariable.unit=global_cat[indicator_code]['unitofmeasure'] if global_cat[indicator_code]['unitofmeasure'] else ''
newvariable.short_unit = s_unit
newvariable.description=global_cat[indicator_code]['description']
newvariable.timespan=''
newvariable.datasetId=newdataset
newvariable.sourceId=newsource
newvariable.save()
global_cat[indicator_code]['variable_object'] = newvariable
logger.info("Updating the variable %s." % newvariable.name.encode('utf8'))
global_cat[indicator_code]['saved'] = True
else:
newvariable = global_cat[indicator_code]['variable_object']
if indicator_code not in newly_added_vars:
if not deleted_indicators.get(indicator_code, 0):
while DataValue.objects.filter(variableId__pk=newvariable.pk).first():
with connection.cursor() as c:
c.execute(
'DELETE FROM %s WHERE variableId = %s LIMIT 10000;' %
(DataValue._meta.db_table, newvariable.pk))
deleted_indicators[indicator_code] = True
logger.info("Deleting data values for the variable %s." % indicator_code.encode('utf8'))
for i in range(0, len(data_values)):
data_values_tuple_list.append((data_values[i]['value'], data_values[i]['year'],
country_name_entity_ref[country_code].pk,
newvariable.pk))
if len(
data_values_tuple_list) > 3000: # insert when the length of the list goes over 3000
with connection.cursor() as c:
c.executemany(insert_string, data_values_tuple_list)
logger.info("Dumping data values...")
data_values_tuple_list = []
column_number = 0
if row_number % 10 == 0:
time.sleep(0.001) # this is done in order to not keep the CPU busy all the time, the delay after each 10th row is 1 millisecond
if len(data_values_tuple_list): # insert any leftover data_values
with connection.cursor() as c:
c.executemany(insert_string, data_values_tuple_list)
logger.info("Dumping data values...")
# now deleting subcategories and datasets that are empty (that don't contain any variables), if any
all_bbsc_datasets = Dataset.objects.filter(namespace='bbsc')
all_bbsc_datasets_with_vars = Variable.objects.filter(datasetId__in=all_bbsc_datasets).values(
'datasetId').distinct()
all_bbsc_datasets_with_vars_dict = {item['datasetId'] for item in all_bbsc_datasets_with_vars}
for each in all_bbsc_datasets:
if each.pk not in all_bbsc_datasets_with_vars_dict:
cat_to_delete = each.subcategoryId
logger.info("Deleting empty dataset %s." % each.name)
logger.info("Deleting empty category %s." % cat_to_delete.name)
each.delete()
cat_to_delete.delete()
newimport = ImportHistory(import_type='bbsc', import_time=timezone.now().strftime('%Y-%m-%d %H:%M:%S'),
import_notes='Imported a total of %s data values.' % total_values_tracker,
import_state=json.dumps(
{'file_hash': file_checksum(bbsc_downloads_save_location + 'bbsc.zip')}))
newimport.save()
# now exporting csvs to the repo
for dataset in dataset_id_oldname_list:
write_dataset_csv(dataset['id'], dataset['newname'], dataset['oldname'], 'bbsc_fetcher', '')
print("--- %s seconds ---" % (time.time() - start_time))
| 61.793842
| 282
| 0.539363
| 4,535
| 46,160
| 5.267696
| 0.107166
| 0.044623
| 0.051237
| 0.062623
| 0.797899
| 0.784461
| 0.758843
| 0.746327
| 0.738415
| 0.725313
| 0
| 0.007901
| 0.3776
| 46,160
| 746
| 283
| 61.876676
| 0.823529
| 0.066161
| 0
| 0.696456
| 0
| 0.004623
| 0.113279
| 0.000488
| 0.004623
| 0
| 0
| 0
| 0
| 1
| 0.003082
| false
| 0.003082
| 0.057011
| 0
| 0.063174
| 0.001541
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
c7436d6658db6c6c16d328545e90e72563575228
| 16,943
|
py
|
Python
|
instances/simulation/inst-20210422-1717/timetabling_closed-SI/inst-20210422-1717-c90-pas1_9h-3h.py
|
LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure
|
bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11
|
[
"BSD-3-Clause"
] | null | null | null |
instances/simulation/inst-20210422-1717/timetabling_closed-SI/inst-20210422-1717-c90-pas1_9h-3h.py
|
LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure
|
bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11
|
[
"BSD-3-Clause"
] | null | null | null |
instances/simulation/inst-20210422-1717/timetabling_closed-SI/inst-20210422-1717-c90-pas1_9h-3h.py
|
LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure
|
bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11
|
[
"BSD-3-Clause"
] | null | null | null |
"""
PERIODS
"""
numPeriods = 180
"""
STOPS
"""
numStations = 13
station_names = (
"Hamburg Hbf", # 0
"Landwehr", # 1
"Hasselbrook", # 2
"Wansbeker Chaussee*", # 3
"Friedrichsberg*", # 4
"Barmbek*", # 5
"Alte Woehr (Stadtpark)", # 6
"Ruebenkamp (City Nord)", # 7
"Ohlsdorf*", # 8
"Kornweg", # 9
"Hoheneichen", # 10
"Wellingsbuettel", # 11
"Poppenbuettel*", # 12
)
numStops = 26
stops_position = (
(0, 0), # Stop 0
(2, 0), # Stop 1
(3, 0), # Stop 2
(4, 0), # Stop 3
(5, 0), # Stop 4
(6, 0), # Stop 5
(7, 0), # Stop 6
(8, 0), # Stop 7
(9, 0), # Stop 8
(11, 0), # Stop 9
(13, 0), # Stop 10
(14, 0), # Stop 11
(15, 0), # Stop 12
(15, 1), # Stop 13
(15, 1), # Stop 14
(13, 1), # Stop 15
(12, 1), # Stop 16
(11, 1), # Stop 17
(10, 1), # Stop 18
(9, 1), # Stop 19
(8, 1), # Stop 20
(7, 1), # Stop 21
(6, 1), # Stop 22
(4, 1), # Stop 23
(2, 1), # Stop 24
(1, 1), # Stop 25
)
stops_distance = (
(0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 0
(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 1
(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 2
(0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 3
(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 4
(0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 5
(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 6
(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 7
(0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 8
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 9
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 10
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 11
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 12
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 13
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 14
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 15
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 16
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), # Stop 17
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0), # Stop 18
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0), # Stop 19
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), # Stop 20
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), # Stop 21
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), # Stop 22
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), # Stop 23
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2), # Stop 24
(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 25
)
station_start = 0
"""
TRAMS
"""
numTrams = 18
tram_capacity = 514
tram_capacity_cargo = 304
tram_capacity_min_passenger = 208
tram_capacity_min_cargo = 0
tram_speed = 1
tram_headway = 1
tram_min_service = 1
tram_max_service = 10
min_time_next_tram = 0.333
tram_travel_deviation = 0.167
"""
PASSENGERS
"""
passenger_set = "pas-20210422-1717-int1"
passenger_service_time_board = 0.0145
passenger_service_time_alight = 0.0145
"""
CARGO
"""
numCargo = 90
cargo_size = 4
cargo_station_destination = (
8, # 0
8, # 1
4, # 2
5, # 3
3, # 4
8, # 5
4, # 6
3, # 7
5, # 8
12, # 9
12, # 10
5, # 11
5, # 12
3, # 13
8, # 14
3, # 15
12, # 16
4, # 17
5, # 18
5, # 19
8, # 20
5, # 21
5, # 22
5, # 23
8, # 24
5, # 25
12, # 26
8, # 27
4, # 28
8, # 29
5, # 30
8, # 31
3, # 32
5, # 33
12, # 34
4, # 35
3, # 36
12, # 37
12, # 38
8, # 39
3, # 40
5, # 41
4, # 42
4, # 43
12, # 44
3, # 45
12, # 46
12, # 47
5, # 48
3, # 49
12, # 50
5, # 51
12, # 52
5, # 53
12, # 54
4, # 55
5, # 56
3, # 57
4, # 58
12, # 59
5, # 60
3, # 61
8, # 62
5, # 63
4, # 64
5, # 65
3, # 66
8, # 67
5, # 68
12, # 69
4, # 70
8, # 71
8, # 72
3, # 73
5, # 74
12, # 75
3, # 76
8, # 77
3, # 78
8, # 79
3, # 80
4, # 81
12, # 82
3, # 83
12, # 84
5, # 85
3, # 86
3, # 87
5, # 88
4, # 89
)
cargo_release = (
2, # 0
3, # 1
3, # 2
5, # 3
6, # 4
6, # 5
7, # 6
8, # 7
8, # 8
9, # 9
9, # 10
10, # 11
12, # 12
12, # 13
12, # 14
13, # 15
14, # 16
14, # 17
15, # 18
16, # 19
17, # 20
18, # 21
19, # 22
21, # 23
22, # 24
24, # 25
25, # 26
26, # 27
27, # 28
28, # 29
28, # 30
29, # 31
30, # 32
30, # 33
32, # 34
33, # 35
33, # 36
34, # 37
35, # 38
36, # 39
37, # 40
37, # 41
37, # 42
37, # 43
37, # 44
37, # 45
38, # 46
38, # 47
39, # 48
41, # 49
41, # 50
43, # 51
44, # 52
44, # 53
45, # 54
45, # 55
46, # 56
46, # 57
46, # 58
47, # 59
48, # 60
49, # 61
49, # 62
51, # 63
52, # 64
52, # 65
55, # 66
56, # 67
57, # 68
57, # 69
61, # 70
61, # 71
61, # 72
62, # 73
63, # 74
64, # 75
64, # 76
65, # 77
65, # 78
66, # 79
66, # 80
67, # 81
70, # 82
70, # 83
70, # 84
71, # 85
71, # 86
71, # 87
71, # 88
72, # 89
)
cargo_station_deadline = (
33, # 0
119, # 1
119, # 2
176, # 3
59, # 4
123, # 5
72, # 6
18, # 7
171, # 8
90, # 9
175, # 10
142, # 11
88, # 12
32, # 13
157, # 14
84, # 15
131, # 16
105, # 17
170, # 18
155, # 19
156, # 20
140, # 21
38, # 22
173, # 23
123, # 24
126, # 25
91, # 26
36, # 27
87, # 28
144, # 29
127, # 30
108, # 31
40, # 32
134, # 33
141, # 34
101, # 35
163, # 36
108, # 37
144, # 38
85, # 39
98, # 40
47, # 41
47, # 42
76, # 43
175, # 44
162, # 45
48, # 46
97, # 47
87, # 48
114, # 49
164, # 50
143, # 51
54, # 52
142, # 53
55, # 54
55, # 55
56, # 56
56, # 57
56, # 58
57, # 59
118, # 60
59, # 61
160, # 62
112, # 63
95, # 64
141, # 65
168, # 66
170, # 67
105, # 68
139, # 69
71, # 70
71, # 71
71, # 72
82, # 73
73, # 74
90, # 75
135, # 76
109, # 77
161, # 78
128, # 79
151, # 80
77, # 81
80, # 82
98, # 83
169, # 84
81, # 85
129, # 86
104, # 87
97, # 88
99, # 89
)
cargo_max_delay = 3
cargo_service_time_load = 0.3333333333333333
cargo_service_time_unload = 0.25
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 8991598675325360468762009371570610170
#index for seed sequence child
child_seed_index = (
0, # 0
)
"""
Results from timetabling
"""
scheme = "SI"
method = "timetabling_closed"
passengerData = "0-rep"
downstream_cargo = False
delivery_optional = False
assignment_method = "timetabling_closed"
operating = (
True, # 0
True, # 1
True, # 2
True, # 3
True, # 4
True, # 5
True, # 6
True, # 7
True, # 8
True, # 9
True, # 10
True, # 11
True, # 12
True, # 13
True, # 14
True, # 15
True, # 16
True, # 17
)
tram_tour = (
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 0
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 1
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 2
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 3
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 4
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 5
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 6
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 7
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 8
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 9
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 10
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 11
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 12
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 13
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 14
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 15
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 16
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 17
)
tram_time_arrival = (
(5.0, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 22.0, 25.0, 29.0, 31.0, 34.0, 38.0, 40.0, 43.0, 46.0, 49.0, 56.0, 63.0, 65.0, 67.0, 70.0, 72.0, 76.0, 80.0), # 0
(7.0, 10.0, 13.0, 15.0, 17.0, 20.0, 22.0, 25.0, 27.0, 30.0, 33.0, 35.0, 39.0, 44.0, 46.0, 48.0, 51.0, 63.0, 74.0, 85.0, 89.0, 99.0, 102.0, 105.0, 107.0, 117.0), # 1
(9.0, 13.0, 15.0, 17.0, 20.0, 22.0, 25.0, 27.0, 29.0, 34.0, 37.0, 39.0, 45.0, 47.0, 51.0, 55.0, 65.0, 74.0, 85.0, 96.0, 99.0, 104.0, 114.0, 117.0, 119.0, 131.0), # 2
(12.0, 15.0, 18.0, 21.0, 24.0, 27.0, 29.0, 31.0, 33.0, 36.0, 41.0, 45.0, 55.0, 60.0, 68.0, 70.0, 74.0, 85.0, 96.0, 103.0, 105.0, 114.0, 119.0, 127.0, 138.0, 148.0), # 3
(29.0, 41.0, 43.0, 45.0, 47.0, 49.0, 51.0, 53.0, 55.0, 58.0, 61.0, 63.0, 65.0, 68.0, 70.0, 73.0, 84.0, 96.0, 103.0, 105.0, 114.0, 119.0, 130.0, 139.0, 147.0, 152.0), # 4
(40.0, 50.0, 52.0, 54.0, 56.0, 58.0, 60.0, 62.0, 64.0, 67.0, 70.0, 72.0, 74.0, 77.0, 79.0, 90.0, 97.0, 103.0, 113.0, 124.0, 126.0, 131.0, 139.0, 148.0, 151.0, 154.0), # 5
(49.0, 52.0, 54.0, 56.0, 58.0, 61.0, 63.0, 65.0, 67.0, 70.0, 73.0, 75.0, 77.0, 84.0, 95.0, 98.0, 110.0, 113.0, 124.0, 126.0, 134.0, 144.0, 148.0, 151.0, 153.0, 156.0), # 6
(62.0, 74.0, 76.0, 78.0, 80.0, 82.0, 84.0, 86.0, 88.0, 91.0, 94.0, 96.0, 98.0, 105.0, 107.0, 109.0, 112.0, 124.0, 134.0, 136.0, 147.0, 149.0, 151.0, 153.0, 155.0, 158.0), # 7
(73.0, 81.0, 83.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 104.0, 107.0, 118.0, 126.0, 128.0, 131.0, 133.0, 140.0, 143.0, 145.0, 147.0, 149.0, 151.0, 153.0, 155.0, 157.0, 160.0), # 8
(86.0, 98.0, 100.0, 102.0, 104.0, 106.0, 110.0, 112.0, 114.0, 117.0, 120.0, 130.0, 132.0, 134.0, 136.0, 139.0, 142.0, 145.0, 147.0, 149.0, 151.0, 153.0, 155.0, 157.0, 159.0, 162.0), # 9
(97.0, 100.0, 102.0, 104.0, 106.0, 110.0, 112.0, 114.0, 119.0, 128.0, 131.0, 133.0, 135.0, 137.0, 139.0, 141.0, 144.0, 147.0, 149.0, 151.0, 153.0, 155.0, 157.0, 159.0, 161.0, 164.0), # 10
(99.0, 102.0, 104.0, 108.0, 110.0, 120.0, 122.0, 125.0, 127.0, 130.0, 133.0, 135.0, 137.0, 139.0, 141.0, 143.0, 146.0, 149.0, 151.0, 153.0, 155.0, 157.0, 159.0, 161.0, 163.0, 166.0), # 11
(110.0, 115.0, 117.0, 119.0, 121.0, 123.0, 125.0, 127.0, 129.0, 132.0, 135.0, 137.0, 139.0, 141.0, 143.0, 145.0, 148.0, 151.0, 153.0, 155.0, 157.0, 159.0, 161.0, 163.0, 165.0, 168.0), # 12
(114.0, 117.0, 119.0, 121.0, 123.0, 125.0, 127.0, 129.0, 131.0, 134.0, 137.0, 139.0, 141.0, 143.0, 145.0, 147.0, 150.0, 153.0, 155.0, 157.0, 159.0, 161.0, 163.0, 165.0, 167.0, 170.0), # 13
(116.0, 119.0, 121.0, 123.0, 125.0, 127.0, 129.0, 131.0, 133.0, 136.0, 139.0, 141.0, 143.0, 145.0, 147.0, 149.0, 152.0, 155.0, 157.0, 159.0, 161.0, 163.0, 165.0, 167.0, 169.0, 172.0), # 14
(118.0, 121.0, 123.0, 125.0, 127.0, 129.0, 131.0, 133.0, 135.0, 138.0, 141.0, 143.0, 145.0, 147.0, 149.0, 151.0, 154.0, 157.0, 159.0, 161.0, 163.0, 165.0, 167.0, 169.0, 171.0, 174.0), # 15
(120.0, 123.0, 125.0, 127.0, 129.0, 131.0, 133.0, 135.0, 137.0, 140.0, 143.0, 145.0, 147.0, 149.0, 151.0, 153.0, 156.0, 159.0, 161.0, 163.0, 165.0, 167.0, 169.0, 171.0, 173.0, 176.0), # 16
(122.0, 125.0, 127.0, 129.0, 131.0, 133.0, 135.0, 137.0, 139.0, 142.0, 145.0, 147.0, 149.0, 151.0, 153.0, 155.0, 158.0, 161.0, 163.0, 165.0, 167.0, 169.0, 171.0, 173.0, 175.0, 178.0), # 17
)
tram_time_departure = (
(6.0, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0, 21.0, 23.0, 27.0, 30.0, 33.0, 37.0, 39.0, 42.0, 44.0, 47.0, 55.0, 62.0, 64.0, 66.0, 69.0, 71.0, 75.0, 78.0, 88.0), # 0
(8.0, 12.0, 14.0, 16.0, 19.0, 21.0, 24.0, 26.0, 28.0, 31.0, 34.0, 38.0, 43.0, 45.0, 47.0, 49.0, 61.0, 73.0, 84.0, 88.0, 98.0, 101.0, 104.0, 106.0, 115.0, 127.0), # 1
(11.0, 14.0, 16.0, 19.0, 21.0, 24.0, 26.0, 28.0, 32.0, 35.0, 38.0, 44.0, 46.0, 50.0, 54.0, 63.0, 72.0, 84.0, 95.0, 98.0, 103.0, 113.0, 116.0, 118.0, 129.0, 140.0), # 2
(13.0, 17.0, 20.0, 23.0, 26.0, 28.0, 30.0, 32.0, 34.0, 39.0, 44.0, 54.0, 59.0, 67.0, 69.0, 72.0, 83.0, 95.0, 102.0, 104.0, 113.0, 118.0, 126.0, 137.0, 146.0, 151.0), # 3
(39.0, 42.0, 44.0, 46.0, 48.0, 50.0, 52.0, 54.0, 56.0, 59.0, 62.0, 64.0, 67.0, 69.0, 72.0, 82.0, 94.0, 102.0, 104.0, 113.0, 118.0, 129.0, 138.0, 146.0, 150.0, 153.0), # 4
(48.0, 51.0, 53.0, 55.0, 57.0, 59.0, 61.0, 63.0, 65.0, 68.0, 71.0, 73.0, 76.0, 78.0, 89.0, 95.0, 101.0, 112.0, 123.0, 125.0, 130.0, 138.0, 147.0, 150.0, 152.0, 155.0), # 5
(50.0, 53.0, 55.0, 57.0, 60.0, 62.0, 64.0, 66.0, 68.0, 71.0, 74.0, 76.0, 83.0, 94.0, 97.0, 108.0, 111.0, 123.0, 125.0, 133.0, 143.0, 147.0, 150.0, 152.0, 154.0, 157.0), # 6
(72.0, 75.0, 77.0, 79.0, 81.0, 83.0, 85.0, 87.0, 89.0, 92.0, 95.0, 97.0, 104.0, 106.0, 108.0, 110.0, 122.0, 133.0, 135.0, 146.0, 148.0, 150.0, 152.0, 154.0, 156.0, 159.0), # 7
(79.0, 82.0, 84.0, 86.0, 88.0, 90.0, 92.0, 94.0, 102.0, 105.0, 117.0, 125.0, 127.0, 130.0, 132.0, 138.0, 141.0, 144.0, 146.0, 148.0, 150.0, 152.0, 154.0, 156.0, 158.0, 161.0), # 8
(96.0, 99.0, 101.0, 103.0, 105.0, 109.0, 111.0, 113.0, 115.0, 118.0, 129.0, 131.0, 133.0, 135.0, 138.0, 140.0, 143.0, 146.0, 148.0, 150.0, 152.0, 154.0, 156.0, 158.0, 160.0, 163.0), # 9
(98.0, 101.0, 103.0, 105.0, 109.0, 111.0, 113.0, 118.0, 126.0, 129.0, 132.0, 134.0, 136.0, 138.0, 140.0, 142.0, 145.0, 148.0, 150.0, 152.0, 154.0, 156.0, 158.0, 160.0, 162.0, 165.0), # 10
(100.0, 103.0, 107.0, 109.0, 119.0, 121.0, 124.0, 126.0, 128.0, 131.0, 134.0, 136.0, 138.0, 140.0, 142.0, 144.0, 147.0, 150.0, 152.0, 154.0, 156.0, 158.0, 160.0, 162.0, 164.0, 167.0), # 11
(113.0, 116.0, 118.0, 120.0, 122.0, 124.0, 126.0, 128.0, 130.0, 133.0, 136.0, 138.0, 140.0, 142.0, 144.0, 146.0, 149.0, 152.0, 154.0, 156.0, 158.0, 160.0, 162.0, 164.0, 166.0, 169.0), # 12
(115.0, 118.0, 120.0, 122.0, 124.0, 126.0, 128.0, 130.0, 132.0, 135.0, 138.0, 140.0, 142.0, 144.0, 146.0, 148.0, 151.0, 154.0, 156.0, 158.0, 160.0, 162.0, 164.0, 166.0, 168.0, 171.0), # 13
(117.0, 120.0, 122.0, 124.0, 126.0, 128.0, 130.0, 132.0, 134.0, 137.0, 140.0, 142.0, 144.0, 146.0, 148.0, 150.0, 153.0, 156.0, 158.0, 160.0, 162.0, 164.0, 166.0, 168.0, 170.0, 173.0), # 14
(119.0, 122.0, 124.0, 126.0, 128.0, 130.0, 132.0, 134.0, 136.0, 139.0, 142.0, 144.0, 146.0, 148.0, 150.0, 152.0, 155.0, 158.0, 160.0, 162.0, 164.0, 166.0, 168.0, 170.0, 172.0, 175.0), # 15
(121.0, 124.0, 126.0, 128.0, 130.0, 132.0, 134.0, 136.0, 138.0, 141.0, 144.0, 146.0, 148.0, 150.0, 152.0, 154.0, 157.0, 160.0, 162.0, 164.0, 166.0, 168.0, 170.0, 172.0, 174.0, 177.0), # 16
(123.0, 126.0, 128.0, 130.0, 132.0, 134.0, 136.0, 138.0, 140.0, 143.0, 146.0, 148.0, 150.0, 152.0, 154.0, 156.0, 159.0, 162.0, 164.0, 166.0, 168.0, 170.0, 172.0, 174.0, 176.0, 179.0), # 17
)
cargo_tram_assignment = (
2, # 0
5, # 1
8, # 2
8, # 3
4, # 4
5, # 5
5, # 6
2, # 7
9, # 8
4, # 9
9, # 10
6, # 11
5, # 12
4, # 13
5, # 14
4, # 15
7, # 16
8, # 17
17, # 18
7, # 19
4, # 20
9, # 21
4, # 22
17, # 23
7, # 24
9, # 25
4, # 26
4, # 27
8, # 28
8, # 29
9, # 30
4, # 31
4, # 32
9, # 33
8, # 34
4, # 35
5, # 36
4, # 37
4, # 38
4, # 39
5, # 40
4, # 41
4, # 42
4, # 43
17, # 44
8, # 45
4, # 46
4, # 47
5, # 48
5, # 49
5, # 50
9, # 51
5, # 52
9, # 53
5, # 54
5, # 55
5, # 56
5, # 57
5, # 58
5, # 59
9, # 60
6, # 61
8, # 62
7, # 63
7, # 64
9, # 65
7, # 66
8, # 67
8, # 68
7, # 69
7, # 70
7, # 71
7, # 72
7, # 73
7, # 74
7, # 75
8, # 76
8, # 77
9, # 78
7, # 79
7, # 80
7, # 81
7, # 82
8, # 83
7, # 84
7, # 85
9, # 86
8, # 87
8, # 88
8, # 89
)
| 27.1088
| 190
| 0.462728
| 4,186
| 16,943
| 1.858815
| 0.068801
| 0.155764
| 0.213212
| 0.260121
| 0.56985
| 0.5169
| 0.509446
| 0.46138
| 0.458424
| 0.430664
| 0
| 0.53434
| 0.280706
| 16,943
| 624
| 191
| 27.152244
| 0.104127
| 0.126365
| 0
| 0.605072
| 0
| 0
| 0.016822
| 0.001562
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.009058
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
c78e03d1d5b7c408fe024f177857c36afd06132d
| 4,141
|
py
|
Python
|
code2.py
|
StoneGo/lweb3
|
f55f4b432db96c908edfb1ece1870236101b351e
|
[
"MIT"
] | null | null | null |
code2.py
|
StoneGo/lweb3
|
f55f4b432db96c908edfb1ece1870236101b351e
|
[
"MIT"
] | null | null | null |
code2.py
|
StoneGo/lweb3
|
f55f4b432db96c908edfb1ece1870236101b351e
|
[
"MIT"
] | null | null | null |
import json
from web3 import Web3
# infura_url = "https://mainnet.infura.io/v3/953247doc42b419aa3416810d625cc8c"
infura_url = "https://mainnet.infura.io/v3/add0c570ed374fb69ef44b7265327bd7"
web3 = Web3(Web3.HTTPProvider(infura_url))
print(web3.isConnected())
print(web3.eth.blockNumber)
abi = json.loads('[{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_releaseTime","type":"uint256"}],"name":"mintTimelocked","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]')
address="0xd26114cd6EE289AccF82350c8d8487fedB8A0C07"
contract= web3.eth.contract(address = address, abi = abi)
totalSupply = contract.functions.totalSupply().call()
print(web3.fromWei(totalSupply,'ether'))
print(contract.functions.name().call())
print(contract.functions.symbol().call())
balance = contract.functions.balanceOf(address).call()
print(web3.fromWei(balance, 'ether'))
| 217.947368
| 3,470
| 0.652016
| 457
| 4,141
| 5.868709
| 0.148797
| 0.0783
| 0.107383
| 0.161074
| 0.696868
| 0.660701
| 0.607755
| 0.571588
| 0.538777
| 0.458986
| 0
| 0.0283
| 0.010142
| 4,141
| 19
| 3,471
| 217.947368
| 0.626006
| 0.018353
| 0
| 0
| 0
| 0.066667
| 0.876722
| 0.859252
| 0
| 0
| 0.010335
| 0
| 0
| 1
| 0
| false
| 0
| 0.133333
| 0
| 0.133333
| 0.4
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
c7cd51055c7df99cf025354367f159b692908f61
| 114
|
py
|
Python
|
backend/application/collaborator/__init__.py
|
vitor-kato/ACMEVita-API
|
f2efee5e40649e450ca9d845990b93098a61efd5
|
[
"MIT"
] | null | null | null |
backend/application/collaborator/__init__.py
|
vitor-kato/ACMEVita-API
|
f2efee5e40649e450ca9d845990b93098a61efd5
|
[
"MIT"
] | null | null | null |
backend/application/collaborator/__init__.py
|
vitor-kato/ACMEVita-API
|
f2efee5e40649e450ca9d845990b93098a61efd5
|
[
"MIT"
] | null | null | null |
from flask import Blueprint
from . import models, schemas
collaborator_bp = Blueprint("collaborator", __name__)
| 19
| 53
| 0.798246
| 13
| 114
| 6.615385
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131579
| 114
| 5
| 54
| 22.8
| 0.868687
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0.666667
| 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
| 1
|
0
| 5
|
1bf3dbcb46e2ee864aefac478a027bcc12c66109
| 54
|
py
|
Python
|
app/unit_test/test_seed.py
|
raynaglieri/wecken_api
|
fd816860d357756ec4dbe3df79f287d50dcffe6e
|
[
"MIT"
] | null | null | null |
app/unit_test/test_seed.py
|
raynaglieri/wecken_api
|
fd816860d357756ec4dbe3df79f287d50dcffe6e
|
[
"MIT"
] | null | null | null |
app/unit_test/test_seed.py
|
raynaglieri/wecken_api
|
fd816860d357756ec4dbe3df79f287d50dcffe6e
|
[
"MIT"
] | null | null | null |
# Seed Test File
def test_sample():
assert True
| 9
| 18
| 0.666667
| 8
| 54
| 4.375
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.259259
| 54
| 5
| 19
| 10.8
| 0.875
| 0.259259
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0.5
| true
| 0
| 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
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
401b807309f9f3243a91ddd35315665c8ca4191a
| 123
|
py
|
Python
|
gluon/packages/dal/pydal/exceptions.py
|
Cwlowe/web2py
|
6ae4c3c274be1026cbc45b0fcd8d1180c74b9070
|
[
"BSD-3-Clause"
] | 9
|
2018-04-19T05:08:30.000Z
|
2021-11-23T07:36:58.000Z
|
gluon/packages/dal/pydal/exceptions.py
|
mohit3011/Quiz-Mate
|
17988a623abde439aef2b43fc8dc3162b5cae15e
|
[
"BSD-3-Clause"
] | 98
|
2017-11-02T19:00:44.000Z
|
2022-03-22T16:15:39.000Z
|
gluon/packages/dal/pydal/exceptions.py
|
mohit3011/Quiz-Mate
|
17988a623abde439aef2b43fc8dc3162b5cae15e
|
[
"BSD-3-Clause"
] | 9
|
2017-10-24T21:53:36.000Z
|
2021-11-23T07:36:59.000Z
|
# -*- coding: utf-8 -*-
class NotFoundException(Exception):
pass
class NotAuthorizedException(Exception):
pass
| 12.3
| 40
| 0.691057
| 11
| 123
| 7.727273
| 0.727273
| 0.305882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.01
| 0.186992
| 123
| 9
| 41
| 13.666667
| 0.84
| 0.170732
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 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
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
40233cc0ba85d51ea3579b3ff41013725e670d80
| 143
|
py
|
Python
|
object_oriented/main.py
|
yangyangv2/py-get-started
|
190564923832f583ea8d689e61377a7434d530a2
|
[
"Apache-2.0"
] | null | null | null |
object_oriented/main.py
|
yangyangv2/py-get-started
|
190564923832f583ea8d689e61377a7434d530a2
|
[
"Apache-2.0"
] | null | null | null |
object_oriented/main.py
|
yangyangv2/py-get-started
|
190564923832f583ea8d689e61377a7434d530a2
|
[
"Apache-2.0"
] | null | null | null |
from hs_student import HighSchoolStudent
james = HighSchoolStudent('james')
print(james.get_name_capitalize())
print(james.get_school_name())
| 23.833333
| 40
| 0.825175
| 18
| 143
| 6.277778
| 0.611111
| 0.389381
| 0.230089
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.06993
| 143
| 6
| 41
| 23.833333
| 0.849624
| 0
| 0
| 0
| 0
| 0
| 0.034722
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0.5
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
40241c862ccba488fe9d95df17aea6495333fa9f
| 26
|
py
|
Python
|
dummy_package/__init__.py
|
b1quint/testing_rtd
|
4745a223eebbf182ff217d05615298f88453b085
|
[
"MIT"
] | null | null | null |
dummy_package/__init__.py
|
b1quint/testing_rtd
|
4745a223eebbf182ff217d05615298f88453b085
|
[
"MIT"
] | null | null | null |
dummy_package/__init__.py
|
b1quint/testing_rtd
|
4745a223eebbf182ff217d05615298f88453b085
|
[
"MIT"
] | 1
|
2019-01-16T13:40:38.000Z
|
2019-01-16T13:40:38.000Z
|
from . import greet_people
| 26
| 26
| 0.846154
| 4
| 26
| 5.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115385
| 26
| 1
| 26
| 26
| 0.913043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
4058b36c734b6f36bdcbaa2cdaec167d470b0eb4
| 155
|
py
|
Python
|
ptgaze/common/__init__.py
|
martinhoang11/pytorch_mpiigaze_demo
|
26f9cd0c4278041ceb905ebb1ccbe5825f822d6f
|
[
"MIT"
] | 134
|
2020-03-23T10:28:27.000Z
|
2022-03-30T05:59:03.000Z
|
ptgaze/common/__init__.py
|
martinhoang11/pytorch_mpiigaze_demo
|
26f9cd0c4278041ceb905ebb1ccbe5825f822d6f
|
[
"MIT"
] | 22
|
2020-08-28T05:31:43.000Z
|
2022-03-27T12:16:29.000Z
|
ptgaze/common/__init__.py
|
martinhoang11/pytorch_mpiigaze_demo
|
26f9cd0c4278041ceb905ebb1ccbe5825f822d6f
|
[
"MIT"
] | 31
|
2020-03-27T06:39:38.000Z
|
2022-03-29T19:12:49.000Z
|
from .camera import Camera
from .eye import Eye
from .face import Face
from .face_parts import FaceParts, FacePartsName
from .visualizer import Visualizer
| 25.833333
| 48
| 0.825806
| 22
| 155
| 5.772727
| 0.409091
| 0.125984
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135484
| 155
| 5
| 49
| 31
| 0.947761
| 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
| 1
| 0
|
0
| 5
|
4063cbdc2695522e44a8343112489af643a6d9ef
| 2,066
|
py
|
Python
|
firestore.py
|
esaavedra76/gdgmxdemoctdriver
|
5474b42ce631ffb2f5f9c724bb748194d05ac2c6
|
[
"MIT"
] | null | null | null |
firestore.py
|
esaavedra76/gdgmxdemoctdriver
|
5474b42ce631ffb2f5f9c724bb748194d05ac2c6
|
[
"MIT"
] | null | null | null |
firestore.py
|
esaavedra76/gdgmxdemoctdriver
|
5474b42ce631ffb2f5f9c724bb748194d05ac2c6
|
[
"MIT"
] | null | null | null |
import logging
from firebase_admin import auth, firestore
def initializeBatch():
return firestore.client().batch()
def commitBatch(batch):
batch.commit()
def setMatrixCellBatched(batch, cell_id, cell_data):
doc_ref = firestore.client().collection('matrix').document(cell_id)
try:
batch.set(doc_ref, cell_data)
return True
except:
logging.error("unable to set/update document {}".format(cell_id))
return False
def updateMatrixCellBatched(batch, cell_id, cell_data):
doc_ref = firestore.client().collection('matrix').document(cell_id)
try:
batch.update(doc_ref, cell_data)
return True
except:
logging.error("unable to set/update document {}".format(cell_id))
return False
def updateMatrixCell(cell_id, cell_data):
doc_ref = firestore.client().collection('matrix').document(cell_id)
try:
doc_ref.update(cell_data)
return True
except:
logging.error("unable to set/update document {}".format(cell_id))
return False
def getMatrixOrdered():
query_ref = firestore.client().collection('matrix').orderBy(u'position')
try:
return [el.to_dict() for el in query_ref.get()]
except:
logging.error("document(s) not found")
return None
def getMatrixAll():
query_ref = firestore.client().collection('matrix')
try:
return [el.to_dict() for el in query_ref.get()]
except:
logging.error("document(s) not found")
return None
def getMatrix(row):
query_ref = firestore.client().collection('matrix').where(u'row', u'==', row)
try:
return [el.to_dict() for el in query_ref.get()]
except:
logging.error("document(s) not found")
return None
def getMatrixByCoords(row, col):
query_ref = firestore.client().collection('matrix').where(u'row', u'==', row).where(u'col', u'==', col)
try:
return [el.to_dict() for el in query_ref.get()]
except:
logging.error("document(s) not found")
return None
| 26.151899
| 107
| 0.648596
| 264
| 2,066
| 4.94697
| 0.208333
| 0.041348
| 0.096478
| 0.150077
| 0.771822
| 0.771822
| 0.712098
| 0.712098
| 0.712098
| 0.712098
| 0
| 0
| 0.220232
| 2,066
| 78
| 108
| 26.487179
| 0.810677
| 0
| 0
| 0.655172
| 0
| 0
| 0.118702
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.155172
| false
| 0
| 0.034483
| 0.017241
| 0.448276
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
406deac91b8fac4ff1bf7db71ab6e7786c2ef1e2
| 111
|
py
|
Python
|
avython/gitautotag/__init__.py
|
avara1986/avython
|
a9372865545e55e2e130881b7d743f37d4f415ef
|
[
"Apache-2.0"
] | null | null | null |
avython/gitautotag/__init__.py
|
avara1986/avython
|
a9372865545e55e2e130881b7d743f37d4f415ef
|
[
"Apache-2.0"
] | null | null | null |
avython/gitautotag/__init__.py
|
avara1986/avython
|
a9372865545e55e2e130881b7d743f37d4f415ef
|
[
"Apache-2.0"
] | null | null | null |
# encoding: utf-8
from __future__ import absolute_import
from avython.gitautotag.gitautotag import GitAutotag
| 22.2
| 52
| 0.846847
| 14
| 111
| 6.357143
| 0.642857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010101
| 0.108108
| 111
| 4
| 53
| 27.75
| 0.888889
| 0.135135
| 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
| 1
| 0
|
0
| 5
|
408d67e546986f1e1516aff64fc8fc38fa75e90e
| 141
|
py
|
Python
|
codes/t003_mutable_immutable_object/mutable/abcapi37to50.py
|
tmduong2000/python-tutorial
|
a50daf8cc52ec6c188869c51eecfe8b743300b06
|
[
"MIT"
] | null | null | null |
codes/t003_mutable_immutable_object/mutable/abcapi37to50.py
|
tmduong2000/python-tutorial
|
a50daf8cc52ec6c188869c51eecfe8b743300b06
|
[
"MIT"
] | null | null | null |
codes/t003_mutable_immutable_object/mutable/abcapi37to50.py
|
tmduong2000/python-tutorial
|
a50daf8cc52ec6c188869c51eecfe8b743300b06
|
[
"MIT"
] | null | null | null |
# file3: abcapi37to50.py
def api_test37(self):
print 'api_test37: "%s", "%s"' %(self.cls_attr37, self.instance_attr37)
print '-' * 40
| 35.25
| 75
| 0.659574
| 20
| 141
| 4.45
| 0.65
| 0.202247
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12605
| 0.156028
| 141
| 4
| 76
| 35.25
| 0.621849
| 0.156028
| 0
| 0
| 0
| 0
| 0.194915
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.666667
| 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
| 1
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.