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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d941c96bdb3de312619f0e0d1f86224deb79a8f6
| 790
|
py
|
Python
|
model/base.py
|
taogogo/webpyCMS
|
d5eb2543e1d8cf07dab37aa28e5748b1abf413c5
|
[
"MIT"
] | 63
|
2015-02-01T16:56:04.000Z
|
2022-02-04T04:12:32.000Z
|
model/base.py
|
taogogo/webpyCMS
|
d5eb2543e1d8cf07dab37aa28e5748b1abf413c5
|
[
"MIT"
] | 2
|
2015-12-25T01:50:12.000Z
|
2021-03-13T14:27:27.000Z
|
model/base.py
|
taogogo/webpyCMS
|
d5eb2543e1d8cf07dab37aa28e5748b1abf413c5
|
[
"MIT"
] | 37
|
2015-01-12T06:35:32.000Z
|
2020-07-26T15:56:45.000Z
|
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#coding=utf-8
from model.db.database import *
class base:
def getTable(self):
return self.__class__.__name__
def getDb(self):
return database()
def insert(self,data):
return self.getDb().insert(self.getTable(),data)
def delete(self,condition):
return self.getDb().delete(self.getTable(), condition)
def getList(self,colums,condition,orders='',limits=''):
return self.getDb().getList(self.getTable(),colums,condition,orders,limits)
def getOne(self,colums,condition,orders='',limits=''):
return self.getDb().getOne(self.getTable(),colums,condition,orders,limits)
def update(self, data,condition):
return self.getDb().update(self.getTable(),data,condition)
| 30.384615
| 83
| 0.66962
| 98
| 790
| 5.316327
| 0.306122
| 0.115163
| 0.143954
| 0.207294
| 0.337812
| 0.337812
| 0.337812
| 0.176583
| 0
| 0
| 0
| 0.003049
| 0.16962
| 790
| 25
| 84
| 31.6
| 0.791159
| 0.067089
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4375
| false
| 0
| 0.0625
| 0.4375
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
d995e041fec48a2146f5ecf5310a73278a2e80a0
| 1,608
|
py
|
Python
|
python/test/test_move.py
|
Innoviox/taktician
|
c2997342264a8c9dba33b401984a2cba45d91386
|
[
"MIT"
] | 55
|
2016-05-03T04:24:12.000Z
|
2022-03-11T02:36:22.000Z
|
python/test/test_move.py
|
Innoviox/taktician
|
c2997342264a8c9dba33b401984a2cba45d91386
|
[
"MIT"
] | 19
|
2016-05-22T02:13:21.000Z
|
2021-11-10T21:46:58.000Z
|
python/test/test_move.py
|
Innoviox/taktician
|
c2997342264a8c9dba33b401984a2cba45d91386
|
[
"MIT"
] | 13
|
2016-05-22T00:42:20.000Z
|
2021-06-21T12:36:50.000Z
|
import tak
class TestMove(object):
def test_is_slide(self):
assert not tak.MoveType.PLACE_FLAT.is_slide()
assert not tak.MoveType.PLACE_STANDING.is_slide()
assert not tak.MoveType.PLACE_CAPSTONE.is_slide()
assert tak.MoveType.SLIDE_LEFT.is_slide()
assert tak.MoveType.SLIDE_RIGHT.is_slide()
assert tak.MoveType.SLIDE_UP.is_slide()
assert tak.MoveType.SLIDE_DOWN.is_slide()
def test_direction(self):
assert tak.MoveType.SLIDE_LEFT.direction() == (-1, 0)
assert tak.MoveType.SLIDE_RIGHT.direction() == (1, 0)
assert tak.MoveType.SLIDE_UP.direction() == (0, 1)
assert tak.MoveType.SLIDE_DOWN.direction() == (0, -1)
def test_all_moves():
moves = set(tak.enumerate_moves(5))
assert tak.Move(0, 0) in moves
assert tak.Move(0, 4) in moves
assert tak.Move(4, 4) in moves
assert tak.Move(0, 0, tak.MoveType.PLACE_CAPSTONE) in moves
assert tak.Move(0, 0, tak.MoveType.PLACE_STANDING) in moves
assert tak.Move(5, 5) not in moves
assert tak.Move(0, 0, tak.MoveType.SLIDE_RIGHT, (1, 1, 1, 1)) in moves
assert tak.Move(1, 0, tak.MoveType.SLIDE_RIGHT, (1, 1, 1)) in moves
assert tak.Move(2, 0, tak.MoveType.SLIDE_RIGHT, (1, 1, 1)) not in moves
assert all(m.type != tak.MoveType.SLIDE_LEFT
for m in moves
if m.x == 0)
assert all(m.type != tak.MoveType.SLIDE_RIGHT
for m in moves
if m.x == 4)
assert all(m.type != tak.MoveType.SLIDE_UP
for m in moves
if m.y == 4)
assert all(m.type != tak.MoveType.SLIDE_DOWN
for m in moves
if m.y == 0)
| 34.212766
| 73
| 0.65796
| 267
| 1,608
| 3.838951
| 0.146067
| 0.214634
| 0.234146
| 0.171707
| 0.798049
| 0.667317
| 0.512195
| 0.268293
| 0.106341
| 0.074146
| 0
| 0.03254
| 0.216418
| 1,608
| 46
| 74
| 34.956522
| 0.780952
| 0
| 0
| 0.105263
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.631579
| 1
| 0.078947
| false
| 0
| 0.026316
| 0
| 0.131579
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d998e9c8237b38943f7775e0350d78ac33a091b6
| 183
|
py
|
Python
|
test_import.py
|
Musire/Chess_Game
|
a3e5e18d94a96d60ef7bf7b999b1224928d8e08a
|
[
"Unlicense"
] | null | null | null |
test_import.py
|
Musire/Chess_Game
|
a3e5e18d94a96d60ef7bf7b999b1224928d8e08a
|
[
"Unlicense"
] | null | null | null |
test_import.py
|
Musire/Chess_Game
|
a3e5e18d94a96d60ef7bf7b999b1224928d8e08a
|
[
"Unlicense"
] | null | null | null |
import board
import pieces
import pygame
from pygame.locals import *
import game_test as gt
if __name__ == '__main__':
gt.main(gt.gameOn)
| 8.318182
| 28
| 0.590164
| 22
| 183
| 4.5
| 0.636364
| 0.121212
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.349727
| 183
| 21
| 29
| 8.714286
| 0.831933
| 0
| 0
| 0
| 0
| 0
| 0.049383
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.714286
| 0
| 0.714286
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
7949187d6b1ecb72ec6f8c54919298df96f935e4
| 159
|
py
|
Python
|
tests/urls.py
|
xncbf/django-dynamodb-cache
|
be6d1b4b8e92d581041043bcd694f2a9f00ee386
|
[
"MIT"
] | 21
|
2022-02-16T10:18:24.000Z
|
2022-03-31T23:40:06.000Z
|
tests/urls.py
|
xncbf/django-dynamodb-cache
|
be6d1b4b8e92d581041043bcd694f2a9f00ee386
|
[
"MIT"
] | 9
|
2022-03-01T06:40:59.000Z
|
2022-03-26T08:12:31.000Z
|
tests/urls.py
|
xncbf/django-dynamodb-cache
|
be6d1b4b8e92d581041043bcd694f2a9f00ee386
|
[
"MIT"
] | null | null | null |
from django.http import HttpResponse
from django.urls import path
def test(request):
return HttpResponse(b"teste")
urlpatterns = [path("test", test)]
| 14.454545
| 36
| 0.735849
| 21
| 159
| 5.571429
| 0.666667
| 0.17094
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157233
| 159
| 10
| 37
| 15.9
| 0.873134
| 0
| 0
| 0
| 0
| 0
| 0.056604
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0.2
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
794b6a2a17cba475ba172d378e620c1fdce0c7e0
| 23
|
py
|
Python
|
example_snippets/multimenus_snippets/Snippets/SciPy/Special functions/Gamma and Related Functions/polygamma Polygamma function which is the $n$th derivative of the digamma (psi) function.py
|
kuanpern/jupyterlab-snippets-multimenus
|
477f51cfdbad7409eab45abe53cf774cd70f380c
|
[
"BSD-3-Clause"
] | null | null | null |
example_snippets/multimenus_snippets/Snippets/SciPy/Special functions/Gamma and Related Functions/polygamma Polygamma function which is the $n$th derivative of the digamma (psi) function.py
|
kuanpern/jupyterlab-snippets-multimenus
|
477f51cfdbad7409eab45abe53cf774cd70f380c
|
[
"BSD-3-Clause"
] | null | null | null |
example_snippets/multimenus_snippets/Snippets/SciPy/Special functions/Gamma and Related Functions/polygamma Polygamma function which is the $n$th derivative of the digamma (psi) function.py
|
kuanpern/jupyterlab-snippets-multimenus
|
477f51cfdbad7409eab45abe53cf774cd70f380c
|
[
"BSD-3-Clause"
] | 1
|
2021-02-04T04:51:48.000Z
|
2021-02-04T04:51:48.000Z
|
special.polygamma(n, x)
| 23
| 23
| 0.782609
| 4
| 23
| 4.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.043478
| 23
| 1
| 23
| 23
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
79589f10b68d379a9611d6e6d8c0e4a681d596ba
| 110
|
py
|
Python
|
src/drugbank_downloader/__init__.py
|
cthoyt/drugbank_downloader
|
1bfac2b7d900abf03788c9441882a739df313d9e
|
[
"MIT"
] | 11
|
2020-12-20T18:18:27.000Z
|
2022-03-27T13:26:12.000Z
|
src/drugbank_downloader/__init__.py
|
cthoyt/drugbank_downloader
|
1bfac2b7d900abf03788c9441882a739df313d9e
|
[
"MIT"
] | 1
|
2021-08-31T01:25:53.000Z
|
2021-08-31T08:44:32.000Z
|
src/drugbank_downloader/__init__.py
|
cthoyt/drugbank_downloader
|
1bfac2b7d900abf03788c9441882a739df313d9e
|
[
"MIT"
] | 1
|
2021-12-07T08:23:43.000Z
|
2021-12-07T08:23:43.000Z
|
# -*- coding: utf-8 -*-
from .api import download_drugbank, get_drugbank_root, open_drugbank, parse_drugbank
| 27.5
| 84
| 0.763636
| 15
| 110
| 5.266667
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010309
| 0.118182
| 110
| 3
| 85
| 36.666667
| 0.804124
| 0.190909
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
7960f1c9ac683e25211e3fd17b168fe0130ee093
| 94
|
py
|
Python
|
tests/artist_app/apps.py
|
moshthepitt/django-vega-admin
|
865774e51b3a2c2df81fec1f212acc3bdcea9eaa
|
[
"MIT"
] | 4
|
2018-11-24T14:46:45.000Z
|
2020-12-04T08:49:28.000Z
|
tests/artist_app/apps.py
|
moshthepitt/django-vega-admin
|
865774e51b3a2c2df81fec1f212acc3bdcea9eaa
|
[
"MIT"
] | 40
|
2018-11-17T11:34:35.000Z
|
2020-06-26T11:27:01.000Z
|
tests/artist_app/apps.py
|
moshthepitt/django-vega-admin
|
865774e51b3a2c2df81fec1f212acc3bdcea9eaa
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class AuthorAppConfig(AppConfig):
name = 'author_app'
| 15.666667
| 33
| 0.765957
| 11
| 94
| 6.454545
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.159574
| 94
| 5
| 34
| 18.8
| 0.898734
| 0
| 0
| 0
| 0
| 0
| 0.106383
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
798fbc8cb9feca40182335bfce6137c11edb4f2f
| 159
|
py
|
Python
|
setup.py
|
sswingle/plotille
|
9b00815b129d46613f86befa93f798397ca087c0
|
[
"MIT"
] | null | null | null |
setup.py
|
sswingle/plotille
|
9b00815b129d46613f86befa93f798397ca087c0
|
[
"MIT"
] | null | null | null |
setup.py
|
sswingle/plotille
|
9b00815b129d46613f86befa93f798397ca087c0
|
[
"MIT"
] | null | null | null |
from setuptools import setup, find_packages
setup(
name='plotille',
version='3.7.3',
packages=find_packages(include=['plotille', 'plotille.*'])
)
| 19.875
| 62
| 0.685535
| 19
| 159
| 5.631579
| 0.631579
| 0.224299
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022222
| 0.150943
| 159
| 7
| 63
| 22.714286
| 0.77037
| 0
| 0
| 0
| 0
| 0
| 0.194969
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.166667
| 0
| 0.166667
| 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
| 0
| 0
|
0
| 4
|
79987dc0609fefd65509b22f8a9455176aef6dba
| 190
|
py
|
Python
|
robotdocs/robotdocsconf.py
|
beleki/crl-remotescript
|
b7222e2eb0fcd1e03b8ed6052c053bcc57a3649e
|
[
"BSD-3-Clause"
] | 3
|
2019-05-22T11:32:55.000Z
|
2019-06-12T13:02:28.000Z
|
robotdocs/robotdocsconf.py
|
beleki/crl-remotescript
|
b7222e2eb0fcd1e03b8ed6052c053bcc57a3649e
|
[
"BSD-3-Clause"
] | 10
|
2019-03-10T08:28:08.000Z
|
2019-07-26T07:44:11.000Z
|
robotdocs/robotdocsconf.py
|
beleki/crl-remotescript
|
b7222e2eb0fcd1e03b8ed6052c053bcc57a3649e
|
[
"BSD-3-Clause"
] | 7
|
2019-03-10T08:27:09.000Z
|
2020-01-24T19:48:27.000Z
|
# TODO: this should be removed as soon as crl.devutils starts to use
# entry_points
from crl.remotescript.robotdocsconf import robotdocs
__copyright__ = 'Copyright (C) 2019, Nokia'
| 23.75
| 68
| 0.757895
| 26
| 190
| 5.346154
| 0.884615
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025641
| 0.178947
| 190
| 7
| 69
| 27.142857
| 0.865385
| 0.447368
| 0
| 0
| 0
| 0
| 0.245098
| 0
| 0
| 0
| 0
| 0.142857
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
8db9af526345664e3df68a3dfdbaa7a29c92fae6
| 231
|
py
|
Python
|
pyf/_carp.py
|
snoopyjc/pythonizer
|
6b3683084f41f0aa06b1b4e652a0f00b19cceac1
|
[
"Artistic-2.0"
] | 1
|
2022-03-13T22:08:25.000Z
|
2022-03-13T22:08:25.000Z
|
pyf/_carp.py
|
snoopyjc/pythonizer
|
6b3683084f41f0aa06b1b4e652a0f00b19cceac1
|
[
"Artistic-2.0"
] | 21
|
2022-03-17T16:53:04.000Z
|
2022-03-31T23:55:24.000Z
|
pyf/_carp.py
|
snoopyjc/pythonizer
|
6b3683084f41f0aa06b1b4e652a0f00b19cceac1
|
[
"Artistic-2.0"
] | null | null | null |
def _carp(*args,skip=1):
"""Warn with no backtrace"""
if TRACEBACK:
print(_longmess(*args, skip=skip), end='', file=sys.stderr)
else:
print(_shortmess(*args, skip=skip), end='', file=sys.stderr)
| 28.875
| 69
| 0.588745
| 30
| 231
| 4.433333
| 0.633333
| 0.180451
| 0.180451
| 0.225564
| 0.421053
| 0.421053
| 0.421053
| 0
| 0
| 0
| 0
| 0.005618
| 0.229437
| 231
| 7
| 70
| 33
| 0.741573
| 0.095238
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0
| 0
| 0.2
| 0.4
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
8dbfbad6ee81e3eb3c8dceff8d66cf2ea1fc6198
| 168
|
py
|
Python
|
bokeh/serve_through_api/flask_api/api_end_point.py
|
eshanMewantha/data-visualization
|
d9cdd5551092d90572e34af1ebd82af414f16aaf
|
[
"MIT"
] | null | null | null |
bokeh/serve_through_api/flask_api/api_end_point.py
|
eshanMewantha/data-visualization
|
d9cdd5551092d90572e34af1ebd82af414f16aaf
|
[
"MIT"
] | null | null | null |
bokeh/serve_through_api/flask_api/api_end_point.py
|
eshanMewantha/data-visualization
|
d9cdd5551092d90572e34af1ebd82af414f16aaf
|
[
"MIT"
] | null | null | null |
from flask import Flask
from html_generator import get_template
app = Flask(__name__)
@app.route('/')
def hello_bokeh():
return get_template()
app.run(port=5050)
| 15.272727
| 39
| 0.75
| 25
| 168
| 4.72
| 0.68
| 0.186441
| 0.237288
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027586
| 0.136905
| 168
| 11
| 40
| 15.272727
| 0.786207
| 0
| 0
| 0
| 0
| 0
| 0.005917
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0.285714
| 0.142857
| 0.571429
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
8dc0f5b5af03ab1fbfa4aec2667d301936aea478
| 80
|
py
|
Python
|
tests/conftest.py
|
SohailChamadia-everestek/python-microservice
|
49f835077a0750e95088272dcba3ec83579dd845
|
[
"MIT"
] | null | null | null |
tests/conftest.py
|
SohailChamadia-everestek/python-microservice
|
49f835077a0750e95088272dcba3ec83579dd845
|
[
"MIT"
] | null | null | null |
tests/conftest.py
|
SohailChamadia-everestek/python-microservice
|
49f835077a0750e95088272dcba3ec83579dd845
|
[
"MIT"
] | null | null | null |
# File containing all the common fixtures including the fixture for the database
| 80
| 80
| 0.8375
| 12
| 80
| 5.583333
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15
| 80
| 1
| 80
| 80
| 0.985294
| 0.975
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
5c17977b3eee89f5e0756174244ff06fe612b277
| 78
|
py
|
Python
|
setup.py
|
0x4ndy/ytpersist
|
638be3c08e5fb3f8c3cab6dad090518fe10ac1d6
|
[
"MIT"
] | null | null | null |
setup.py
|
0x4ndy/ytpersist
|
638be3c08e5fb3f8c3cab6dad090518fe10ac1d6
|
[
"MIT"
] | null | null | null |
setup.py
|
0x4ndy/ytpersist
|
638be3c08e5fb3f8c3cab6dad090518fe10ac1d6
|
[
"MIT"
] | null | null | null |
from setuptools import setup
setup(name='ytpersist', packages=['ytpersist'])
| 19.5
| 47
| 0.769231
| 9
| 78
| 6.666667
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.089744
| 78
| 3
| 48
| 26
| 0.84507
| 0
| 0
| 0
| 0
| 0
| 0.230769
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
5c20503d44224596441a1ada2016b281367683f7
| 31
|
py
|
Python
|
tests/functional/__init__.py
|
charles-cooper/Pyrseas
|
2c3fcb8ffd838d80c9ae29393ab7d393f04be3b0
|
[
"BSD-3-Clause"
] | 269
|
2015-01-23T19:36:22.000Z
|
2022-03-22T13:37:30.000Z
|
tests/functional/__init__.py
|
charles-cooper/Pyrseas
|
2c3fcb8ffd838d80c9ae29393ab7d393f04be3b0
|
[
"BSD-3-Clause"
] | 131
|
2015-01-25T00:49:17.000Z
|
2022-02-22T22:55:11.000Z
|
tests/functional/__init__.py
|
charles-cooper/Pyrseas
|
2c3fcb8ffd838d80c9ae29393ab7d393f04be3b0
|
[
"BSD-3-Clause"
] | 57
|
2015-04-16T00:26:35.000Z
|
2022-01-31T10:24:33.000Z
|
"""Pyrseas functional tests"""
| 15.5
| 30
| 0.709677
| 3
| 31
| 7.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.096774
| 31
| 1
| 31
| 31
| 0.785714
| 0.774194
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
308c43fbdffa8720d493b5f173d54bcb7983e8c5
| 182
|
py
|
Python
|
webapp/extensions.py
|
TunedMystic/hydra
|
32337acf36ee92ac68b6e30ead8937ebe52cf21b
|
[
"MIT"
] | 2
|
2015-03-16T03:15:20.000Z
|
2015-03-16T03:16:12.000Z
|
webapp/extensions.py
|
TunedMystic/hydra
|
32337acf36ee92ac68b6e30ead8937ebe52cf21b
|
[
"MIT"
] | null | null | null |
webapp/extensions.py
|
TunedMystic/hydra
|
32337acf36ee92ac68b6e30ead8937ebe52cf21b
|
[
"MIT"
] | null | null | null |
from __future__ import absolute_import
from flask.ext.sqlalchemy import SQLAlchemy
# flask-sqlalchemy
db = SQLAlchemy()
INSTALLED_EXTENSIONS = (
# flask-sqlalchemy
db,
)
| 14
| 43
| 0.752747
| 20
| 182
| 6.55
| 0.5
| 0.229008
| 0.259542
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.175824
| 182
| 12
| 44
| 15.166667
| 0.873333
| 0.181319
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
30b170d7d9a991835f10ed3bda96c3e8d4c0b662
| 58
|
py
|
Python
|
pipeline/src/restarter/__init__.py
|
sawyerwatts/StopSpotDataPipeline
|
6537d0d1779d9ffa6a3096c02f4081d659c12a0e
|
[
"MIT"
] | 3
|
2020-02-19T05:25:56.000Z
|
2020-02-22T21:31:34.000Z
|
pipeline/src/restarter/__init__.py
|
sawyerwatts/StopSpotDataPipeline
|
6537d0d1779d9ffa6a3096c02f4081d659c12a0e
|
[
"MIT"
] | 69
|
2020-02-20T20:30:03.000Z
|
2020-05-29T01:20:05.000Z
|
pipeline/src/restarter/__init__.py
|
wolakdav/TeamBeeCapstoneProject
|
6957416273fda85a12e86408ae635d7491fb1035
|
[
"MIT"
] | 4
|
2020-06-05T03:47:49.000Z
|
2020-12-21T01:17:02.000Z
|
from .Restarter import Restarter
restarter = Restarter()
| 14.5
| 32
| 0.793103
| 6
| 58
| 7.666667
| 0.5
| 0.782609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137931
| 58
| 3
| 33
| 19.333333
| 0.92
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
30c45e74302d60b3fd14260346499533ae9db89f
| 149
|
py
|
Python
|
Mundo 1/Aula07.Ex08.py
|
uirasiqueira/Exercicios_Python
|
409b7be9cf278e3043149654de7b41be56a3d951
|
[
"MIT"
] | null | null | null |
Mundo 1/Aula07.Ex08.py
|
uirasiqueira/Exercicios_Python
|
409b7be9cf278e3043149654de7b41be56a3d951
|
[
"MIT"
] | null | null | null |
Mundo 1/Aula07.Ex08.py
|
uirasiqueira/Exercicios_Python
|
409b7be9cf278e3043149654de7b41be56a3d951
|
[
"MIT"
] | null | null | null |
v = float(input('Qual o comprimento da parede em metro?'))
c = v*100
m = v*1000
print('O comprimento da parede em cm é {} e em mm é {}'.format(c,m))
| 29.8
| 68
| 0.651007
| 31
| 149
| 3.129032
| 0.645161
| 0.247423
| 0.28866
| 0.412371
| 0.453608
| 0
| 0
| 0
| 0
| 0
| 0
| 0.057851
| 0.187919
| 149
| 4
| 69
| 37.25
| 0.743802
| 0
| 0
| 0
| 0
| 0
| 0.57047
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.25
| 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
| 0
|
0
| 4
|
eb553a3ebefa11c38121f0865b9d09d24990a5f0
| 69
|
py
|
Python
|
watchmen/__init__.py
|
Indexical-Metrics-Measure-Advisory/watchmen-data-processor
|
d50b93e92868500552416997707d71720487bd77
|
[
"MIT"
] | null | null | null |
watchmen/__init__.py
|
Indexical-Metrics-Measure-Advisory/watchmen-data-processor
|
d50b93e92868500552416997707d71720487bd77
|
[
"MIT"
] | null | null | null |
watchmen/__init__.py
|
Indexical-Metrics-Measure-Advisory/watchmen-data-processor
|
d50b93e92868500552416997707d71720487bd77
|
[
"MIT"
] | null | null | null |
from watchmen.common.log import log
log.init()
# init_connectors()
| 11.5
| 35
| 0.753623
| 10
| 69
| 5.1
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 69
| 5
| 36
| 13.8
| 0.85
| 0.246377
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
ebaf16fe296dee038df18de76b4bfcaeb21e5e3d
| 157
|
py
|
Python
|
Algorithms/SimpleArraySum.py
|
AlexJunior01/HackerRank
|
d6353bf47074dbb42bf511450d164ca98c70aa46
|
[
"MIT"
] | null | null | null |
Algorithms/SimpleArraySum.py
|
AlexJunior01/HackerRank
|
d6353bf47074dbb42bf511450d164ca98c70aa46
|
[
"MIT"
] | null | null | null |
Algorithms/SimpleArraySum.py
|
AlexJunior01/HackerRank
|
d6353bf47074dbb42bf511450d164ca98c70aa46
|
[
"MIT"
] | null | null | null |
def simpleArraySum(ar):
return sum(ar)
ar_count = int(input())
ar = list(map(int, input().rstrip().split()))
result = simpleArraySum(ar)
print(result)
| 17.444444
| 45
| 0.681529
| 22
| 157
| 4.818182
| 0.636364
| 0.301887
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.133758
| 157
| 8
| 46
| 19.625
| 0.779412
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0
| 0.166667
| 0.333333
| 0.166667
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
ebba8f49b49c242502ed37bc0bf6255de31a60cd
| 45
|
py
|
Python
|
ranges.py
|
Tiesco789/guppe
|
464702a2d618e149439a9b5c763f82c5376d2c32
|
[
"MIT"
] | null | null | null |
ranges.py
|
Tiesco789/guppe
|
464702a2d618e149439a9b5c763f82c5376d2c32
|
[
"MIT"
] | null | null | null |
ranges.py
|
Tiesco789/guppe
|
464702a2d618e149439a9b5c763f82c5376d2c32
|
[
"MIT"
] | null | null | null |
for num in range(10, -1, -1):
print(num)
| 15
| 29
| 0.555556
| 9
| 45
| 2.777778
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117647
| 0.244444
| 45
| 2
| 30
| 22.5
| 0.617647
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
690d94f72b7b855301d7230f4b61325c4fa1a146
| 1,544
|
py
|
Python
|
primed/__init__.py
|
eyb1/primed
|
f9a1a17f74785d6e82a6e5f93fd6b08f3b9dc3e0
|
[
"Apache-2.0"
] | null | null | null |
primed/__init__.py
|
eyb1/primed
|
f9a1a17f74785d6e82a6e5f93fd6b08f3b9dc3e0
|
[
"Apache-2.0"
] | null | null | null |
primed/__init__.py
|
eyb1/primed
|
f9a1a17f74785d6e82a6e5f93fd6b08f3b9dc3e0
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
MMMMMMMMMNh MMMMMMMMMNd MMMM MMMMm MMMM MMMMMMMMd MMMMMMMMMN
MMMMdhhMMMM MMMMdhhMMMM MMMM MMMMMs /MMMM MMMMNmmmm MMMMdhhMMMM
MMMM mMMM MMMM MMMM MMMM MMMMMM-.mMMMMM MMMM MMMM MMMM
MMMM mMMM MMMM MMMM MMMM MMMMMMdsMMMMMM MMMM MMMM MMMM
MMMM mMMM MMMM MMMM MMMM MMMMMMMMMMMMMM MMMMNddd MMMM MMMM
MMMM mMMM MMMMmdmMMMM MMMM MMMMdMMMMdMMMM MMMMNddd MMMM MMMM
MMMM mMMM MMMMdMMMMm MMMM MMMM/hMMN-MMMM MMMM MMMM MMMM
MMMM --NMMM MMMM/ MMMm MMMM MMMM NM MMMM MMMM MMMM MMMM
MMMMNNNMMMM MMMM dMMM MMMM MMMM MMMM MMMMMNNNN MMMMNNNMMMM
MMMMdhhhhh hhhh hhhh hhhh hhhh hhhh hhhhhhhhs hhhhhhhhhh
MMMM
MMMM
MMMM
MMMM
KP:
########################################################################
# #
# PRIMED TOOLKIT #
# #
########################################################################
'''
__author__ = "Eugene Bann, Primed"
__copyright__ = 'Copyright (C) 2018 Demios, Inc.'
__version__ = '0.9'
from cnlp import match_elements
from .nlp import ireplace
from .nlp import ngrams
from .nlp import oxfordize
from .nlp import capi
from .nlp import clean
from .nlp import a
from .nlp import snake
from .nlp import wiki_uri
from .utilities import cprint
| 35.090909
| 72
| 0.534326
| 156
| 1,544
| 5.198718
| 0.410256
| 0.394575
| 0.4291
| 0.374846
| 0.187423
| 0.078915
| 0.078915
| 0.078915
| 0
| 0
| 0
| 0.006809
| 0.334197
| 1,544
| 43
| 73
| 35.906977
| 0.782101
| 0.756477
| 0
| 0
| 0
| 0
| 0.145205
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.769231
| 0
| 0.769231
| 0.076923
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
69123513037dec231112c4a975a26d342679c4ab
| 340
|
py
|
Python
|
spec/python/test_imports_abs_abs.py
|
DarkShadow44/kaitai_struct_tests
|
4bb13cef82965cca66dda2eb2b77cd64e9f70a12
|
[
"MIT"
] | 11
|
2018-04-01T03:58:15.000Z
|
2021-08-14T09:04:55.000Z
|
spec/python/test_imports_abs_abs.py
|
DarkShadow44/kaitai_struct_tests
|
4bb13cef82965cca66dda2eb2b77cd64e9f70a12
|
[
"MIT"
] | 73
|
2016-07-20T10:27:15.000Z
|
2020-12-17T18:56:46.000Z
|
spec/python/test_imports_abs_abs.py
|
DarkShadow44/kaitai_struct_tests
|
4bb13cef82965cca66dda2eb2b77cd64e9f70a12
|
[
"MIT"
] | 37
|
2016-08-15T08:25:56.000Z
|
2021-08-28T14:48:46.000Z
|
import unittest
from imports_abs_abs import ImportsAbsAbs
class TestImportsAbsAbs(unittest.TestCase):
def test_imports_abs_abs(self):
with ImportsAbsAbs.from_file('src/fixed_struct.bin') as r:
self.assertEqual(r.one, 80)
self.assertEqual(r.two.one, 65)
self.assertEqual(r.two.two.one, 67)
| 28.333333
| 66
| 0.694118
| 46
| 340
| 4.978261
| 0.565217
| 0.196507
| 0.209607
| 0.165939
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022305
| 0.208824
| 340
| 11
| 67
| 30.909091
| 0.828996
| 0
| 0
| 0
| 0
| 0
| 0.058824
| 0
| 0
| 0
| 0
| 0
| 0.375
| 1
| 0.125
| false
| 0
| 0.625
| 0
| 0.875
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6939b1266f90ec1e1fd7ea51c4767e540525ecca
| 128
|
py
|
Python
|
waitlist/forms.py
|
rafaeltcell/django-waitlist-1.5
|
ae70f22f94564c11fce7bf0b47a014bb076f39f3
|
[
"MIT"
] | null | null | null |
waitlist/forms.py
|
rafaeltcell/django-waitlist-1.5
|
ae70f22f94564c11fce7bf0b47a014bb076f39f3
|
[
"MIT"
] | null | null | null |
waitlist/forms.py
|
rafaeltcell/django-waitlist-1.5
|
ae70f22f94564c11fce7bf0b47a014bb076f39f3
|
[
"MIT"
] | null | null | null |
from django import forms
class WaitlistEntryForm(forms.Form):
email = forms.EmailField(label='Your email', max_length=255)
| 25.6
| 64
| 0.773438
| 17
| 128
| 5.764706
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.026786
| 0.125
| 128
| 4
| 65
| 32
| 0.848214
| 0
| 0
| 0
| 0
| 0
| 0.078125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
15eb5b13aa3683f575e12ef0cd21982504ba5a0e
| 156
|
py
|
Python
|
geo/__init__.py
|
sandialabs/sibl
|
010cbc3fbbd14cdfa3742ec4c95100f05146dce8
|
[
"MIT"
] | 3
|
2020-07-08T13:30:24.000Z
|
2021-11-03T22:43:40.000Z
|
cli/tests/__init__.py
|
sandialabs/sibl
|
010cbc3fbbd14cdfa3742ec4c95100f05146dce8
|
[
"MIT"
] | 31
|
2020-02-03T15:32:43.000Z
|
2022-03-07T14:51:17.000Z
|
geo/src/bind/__init__.py
|
sandialabs/sibl
|
010cbc3fbbd14cdfa3742ec4c95100f05146dce8
|
[
"MIT"
] | null | null | null |
# This is a blank file used to allow import from subdirectories.
# Reference: https://stackoverflow.com/questions/1260792/import-a-file-from-a-subdirectory
| 52
| 90
| 0.801282
| 23
| 156
| 5.434783
| 0.782609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.049645
| 0.096154
| 156
| 2
| 91
| 78
| 0.836879
| 0.967949
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c60cab82d58fd10d5b4214c83c9b82183ae34942
| 87
|
py
|
Python
|
app.py
|
anyric/Yummy-Recipes-Api
|
08e8b75e5aabee45eead44a3c949830f0dcd782d
|
[
"MIT"
] | null | null | null |
app.py
|
anyric/Yummy-Recipes-Api
|
08e8b75e5aabee45eead44a3c949830f0dcd782d
|
[
"MIT"
] | 17
|
2018-01-03T12:57:34.000Z
|
2018-03-21T15:04:43.000Z
|
app.py
|
anyric/Yummy-Recipes-Api
|
08e8b75e5aabee45eead44a3c949830f0dcd782d
|
[
"MIT"
] | 1
|
2018-03-17T14:38:22.000Z
|
2018-03-17T14:38:22.000Z
|
"""module to run app"""
from apps import app
if __name__ == '__main__':
app.run()
| 14.5
| 26
| 0.632184
| 13
| 87
| 3.615385
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.206897
| 87
| 5
| 27
| 17.4
| 0.681159
| 0.195402
| 0
| 0
| 0
| 0
| 0.125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
d69a10f2a3dd1c820708787c8ca82831c0952fcb
| 265
|
py
|
Python
|
htmlmth/mods/html/remove_script_tag_type.py
|
ZwCreatePhoton/htmlmth
|
74d23ca2fa53e11b2587251d2f71c8f275548182
|
[
"MIT"
] | null | null | null |
htmlmth/mods/html/remove_script_tag_type.py
|
ZwCreatePhoton/htmlmth
|
74d23ca2fa53e11b2587251d2f71c8f275548182
|
[
"MIT"
] | null | null | null |
htmlmth/mods/html/remove_script_tag_type.py
|
ZwCreatePhoton/htmlmth
|
74d23ca2fa53e11b2587251d2f71c8f275548182
|
[
"MIT"
] | null | null | null |
import re
from . import Mod
def remove_script_tag_type(output):
p = re.compile(r"(?i)(<\s*script.*\s+)(type\s*=\s*[\"'].*[\"'])(.*>)")
output = re.sub(p, r"\1" + r"\3", output)
return output
mod_remove_script_tag_type = Mod(remove_script_tag_type)
| 20.384615
| 74
| 0.615094
| 43
| 265
| 3.55814
| 0.44186
| 0.235294
| 0.294118
| 0.372549
| 0.287582
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008889
| 0.150943
| 265
| 12
| 75
| 22.083333
| 0.671111
| 0
| 0
| 0
| 0
| 0
| 0.170455
| 0.132576
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0.285714
| 0
| 0.571429
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
d6a695c55c17e91ccb50a99a6e9223f834d3592f
| 2,873
|
py
|
Python
|
DailyProgrammer/DP20150810A.py
|
DayGitH/Python-Challenges
|
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
|
[
"MIT"
] | 2
|
2020-12-23T18:59:22.000Z
|
2021-04-14T13:16:09.000Z
|
DailyProgrammer/DP20150810A.py
|
DayGitH/Python-Challenges
|
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
|
[
"MIT"
] | null | null | null |
DailyProgrammer/DP20150810A.py
|
DayGitH/Python-Challenges
|
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
|
[
"MIT"
] | null | null | null |
"""
[2015-08-10] Challenge #227 [Easy] Square Spirals
https://www.reddit.com/r/dailyprogrammer/comments/3ggli3/20150810_challenge_227_easy_square_spirals/
# [](#EasyIcon) __(Easy)__: Square Spirals
Take a square grid, and put a cross on the center point, like this:
+ + + + +
+ + + + +
+ + X + +
+ + + + +
+ + + + +
The grid is 5-by-5, and the cross indicates point 1. Let's call the top-left corner location (1, 1), so the center
point is at location (3, 3). Now, place another cross to the right, and trace the path:
+ + + + +
+ + + + +
+ + X-X +
+ + + + +
+ + + + +
This second point (point 2) is now at location (4, 3). If you continually move around anticlockwise as much as you can
from this point, you will form a square spiral, as this diagram shows the beginning of:
+ + + + +
+ X-X-X .
| | .
+ X X-X .
| |
+ X-X-X-X
+ + + + +
Your challenge today is to do two things: convert a point number to its location on the spiral, and vice versa.
# Formal Inputs and Outputs
## Input Specification
On the first line, you'll be given a number **S**. This is the size of the spiral. If **S** equals 5, then the grid is
a 5-by-5 grid, as shown in the demonstration above. **S** will always be an odd number.
You will then be given one of two inputs on the next line:
* You'll be given a single number **N** - this is the point number of a point on the spiral.
* You'll be given two numbers **X** and **Y** (on the same line, separated by a space) - this is the location of a
point on the spiral.
## Output Description
If you're given the point number of a point, work out its location. If you're given a location, find out its point
number.
# Sample Inputs and Outputs
## Example 1
(Where is 8 on this spiral?)
5-4-3
| |
6 1-2
|
7-8-9
### Input
3
8
### Output
(2, 3)
## Example 2
This corresponds to the top-left point (1, 1) in [this 7-by-7
grid](https://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Ulam_spiral_howto_all_numbers.svg/811px-Ulam_spiral_howto_all_numbers.svg.png)
### Input
7
1 1
### Output
37
## Example 3
### Input
11
50
### Output
(10, 9)
## Example 4
### Input
9
6 8
### Output
47
If your solution can't solve the next two inputs before the heat death of the universe, don't worry.
## Example 5
Let's test how fast your solution is!
### Input
1024716039
557614022
### Output
(512353188, 512346213)
## Example 6
:D
### Input
234653477
11777272 289722
### Output
54790653381545607
# Finally
Got any cool challenge ideas? Submit them to /r/DailyProgrammer_Ideas!
"""
def main():
pass
if __name__ == "__main__":
main()
| 25.882883
| 142
| 0.609119
| 443
| 2,873
| 3.891648
| 0.395034
| 0.011601
| 0.013921
| 0.016241
| 0.134571
| 0.100928
| 0.0058
| 0.0058
| 0.0058
| 0
| 0
| 0.077557
| 0.281935
| 2,873
| 110
| 143
| 26.118182
| 0.758119
| 0.974939
| 0
| 0
| 0
| 0
| 0.125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0.25
| 0
| 0
| 0.25
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
d6e1dbc4afff9a9562c62b37f22aeb858dfe1eb3
| 278
|
py
|
Python
|
nbtex/__init__.py
|
narang99/pytex
|
75c0a5bada8859a1ecad98305647fdbeb6cd85ce
|
[
"MIT"
] | 1
|
2020-08-27T18:02:42.000Z
|
2020-08-27T18:02:42.000Z
|
nbtex/__init__.py
|
narang99/pytex
|
75c0a5bada8859a1ecad98305647fdbeb6cd85ce
|
[
"MIT"
] | null | null | null |
nbtex/__init__.py
|
narang99/pytex
|
75c0a5bada8859a1ecad98305647fdbeb6cd85ce
|
[
"MIT"
] | null | null | null |
from nbtex.core.Ast import Var, makeVar
from nbtex.Matrix import Matrix, MatrixBuilder, MatrixWithDots
from nbtex.Vector import Vector, makeVector
from nbtex.Dots import Dots
from nbtex.platforms.jupyter import latex, platex
from nbtex.Symbols import Greek, Set, Operator, Arrow
| 46.333333
| 62
| 0.830935
| 40
| 278
| 5.775
| 0.55
| 0.233766
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111511
| 278
| 6
| 63
| 46.333333
| 0.935223
| 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
| 0
| 0
|
0
| 4
|
d6e45a6c956ea2c36ff7f3976a1a5ac2f9950051
| 191
|
py
|
Python
|
tracing_app/adopters/apps.py
|
jsmera/tracing_app
|
d55d460f7307ea450aa6233663b80ed3347cd27f
|
[
"MIT"
] | null | null | null |
tracing_app/adopters/apps.py
|
jsmera/tracing_app
|
d55d460f7307ea450aa6233663b80ed3347cd27f
|
[
"MIT"
] | null | null | null |
tracing_app/adopters/apps.py
|
jsmera/tracing_app
|
d55d460f7307ea450aa6233663b80ed3347cd27f
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class AdoptersConfig(AppConfig):
name = "tracing_app.adopters"
verbose_name = _("Adopters")
| 23.875
| 54
| 0.774869
| 23
| 191
| 6.217391
| 0.73913
| 0.13986
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.146597
| 191
| 7
| 55
| 27.285714
| 0.877301
| 0
| 0
| 0
| 0
| 0
| 0.146597
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
ba6c79b02311d2d291d96e83ac1e19b35270fdba
| 112
|
py
|
Python
|
webgallery/gallery/admin.py
|
havardox/Kooliprojekt_TA-18E_Erik_Harald
|
f336638292d87ebfaa8c5a769e10a25908a8f05c
|
[
"MIT"
] | null | null | null |
webgallery/gallery/admin.py
|
havardox/Kooliprojekt_TA-18E_Erik_Harald
|
f336638292d87ebfaa8c5a769e10a25908a8f05c
|
[
"MIT"
] | null | null | null |
webgallery/gallery/admin.py
|
havardox/Kooliprojekt_TA-18E_Erik_Harald
|
f336638292d87ebfaa8c5a769e10a25908a8f05c
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from gallery.models import UserProfile, User
admin.site.register(UserProfile)
| 22.4
| 44
| 0.839286
| 15
| 112
| 6.266667
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098214
| 112
| 4
| 45
| 28
| 0.930693
| 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
| 0
| 0
|
0
| 4
|
ba7bed44868436c12636c34efba55e09e88d533c
| 140
|
py
|
Python
|
config.py
|
panubo/buildids
|
c35134b4af64dc5adda37e7f97d53b1e86c18766
|
[
"MIT"
] | null | null | null |
config.py
|
panubo/buildids
|
c35134b4af64dc5adda37e7f97d53b1e86c18766
|
[
"MIT"
] | null | null | null |
config.py
|
panubo/buildids
|
c35134b4af64dc5adda37e7f97d53b1e86c18766
|
[
"MIT"
] | null | null | null |
import os
STORAGE_PATH = os.getenv('STORAGE_PATH', '')
DEBUG = bool(os.environ.get('DEBUG', 'False').lower() in ("true", "yes", "t", "1"))
| 28
| 83
| 0.621429
| 21
| 140
| 4.047619
| 0.761905
| 0.258824
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008065
| 0.114286
| 140
| 4
| 84
| 35
| 0.677419
| 0
| 0
| 0
| 0
| 0
| 0.221429
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
bacb52cc05edda11dce7fd95bf66f5dc8c264da6
| 343
|
py
|
Python
|
holdout_sgd/_average.py
|
aprilpear/holdout-sgd
|
fa81bce57fb98aef262536fb2d7a26567d3143f7
|
[
"BSD-2-Clause"
] | 5
|
2020-04-06T07:41:42.000Z
|
2020-11-30T02:15:20.000Z
|
holdout_sgd/_average.py
|
aprilpear/holdout-sgd
|
fa81bce57fb98aef262536fb2d7a26567d3143f7
|
[
"BSD-2-Clause"
] | null | null | null |
holdout_sgd/_average.py
|
aprilpear/holdout-sgd
|
fa81bce57fb98aef262536fb2d7a26567d3143f7
|
[
"BSD-2-Clause"
] | 2
|
2020-06-21T13:35:13.000Z
|
2020-09-01T02:53:17.000Z
|
import torch
import numpy as np
from functools import reduce
def get_average_gradients(participants):
g_array = [p.get_gradients() for p in participants]
return torch.mean(torch.stack(g_array), dim=0)
def get_std_gradients(participants):
g_array = [p.get_gradients() for p in participants]
return torch.std(torch.stack(g_array), dim=0)
| 26.384615
| 52
| 0.781341
| 56
| 343
| 4.607143
| 0.428571
| 0.093023
| 0.170543
| 0.209302
| 0.689922
| 0.689922
| 0.534884
| 0.534884
| 0.534884
| 0.534884
| 0
| 0.006623
| 0.119534
| 343
| 13
| 53
| 26.384615
| 0.847682
| 0
| 0
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.333333
| 0
| 0.777778
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
baccb6816ec40cfef7ee90ba3d603e581eadb797
| 86
|
py
|
Python
|
src/pyaid/tests/__init__.py
|
jddecarlo/pyaid
|
c9ff224ece4fd890be2355991309179ee8a6a5bd
|
[
"MIT"
] | null | null | null |
src/pyaid/tests/__init__.py
|
jddecarlo/pyaid
|
c9ff224ece4fd890be2355991309179ee8a6a5bd
|
[
"MIT"
] | null | null | null |
src/pyaid/tests/__init__.py
|
jddecarlo/pyaid
|
c9ff224ece4fd890be2355991309179ee8a6a5bd
|
[
"MIT"
] | null | null | null |
"""Initializes the pyaid.tests module. Add any necessary initialization code here."""
| 43
| 85
| 0.77907
| 11
| 86
| 6.090909
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116279
| 86
| 1
| 86
| 86
| 0.881579
| 0.918605
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
bad9d5ce3f98b82e256c12a1e09ed9a4929c1103
| 353
|
py
|
Python
|
tests/beta_tests/test_parse_float.py
|
the-zebulan/CodeWars
|
1eafd1247d60955a5dfb63e4882e8ce86019f43a
|
[
"MIT"
] | 40
|
2016-03-09T12:26:20.000Z
|
2022-03-23T08:44:51.000Z
|
tests/beta_tests/test_parse_float.py
|
akalynych/CodeWars
|
1eafd1247d60955a5dfb63e4882e8ce86019f43a
|
[
"MIT"
] | null | null | null |
tests/beta_tests/test_parse_float.py
|
akalynych/CodeWars
|
1eafd1247d60955a5dfb63e4882e8ce86019f43a
|
[
"MIT"
] | 36
|
2016-11-07T19:59:58.000Z
|
2022-03-31T11:18:27.000Z
|
import unittest
from katas.beta.parse_float import parse_float
class ParseFloatTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(parse_float('1.0'), 1.0)
def test_equal_2(self):
self.assertEqual(parse_float('234.0234'), 234.0234)
def test_is_none_1(self):
self.assertIsNone(parse_float('a'))
| 23.533333
| 59
| 0.711048
| 51
| 353
| 4.686275
| 0.470588
| 0.209205
| 0.100418
| 0.200837
| 0.242678
| 0
| 0
| 0
| 0
| 0
| 0
| 0.071672
| 0.169972
| 353
| 14
| 60
| 25.214286
| 0.744027
| 0
| 0
| 0
| 0
| 0
| 0.033994
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0.333333
| false
| 0
| 0.222222
| 0
| 0.666667
| 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
| 0
| 0
| 1
| 0
|
0
| 4
|
bae281bccdae5f0342f0dd9704bd338a3bb51916
| 246
|
py
|
Python
|
bin/ominoes/pentominoes-plus-square-tetromino-8x8.py
|
tiwo/puzzler
|
7ad3d9a792f0635f7ec59ffa85fb46b54fd77a7e
|
[
"Intel"
] | null | null | null |
bin/ominoes/pentominoes-plus-square-tetromino-8x8.py
|
tiwo/puzzler
|
7ad3d9a792f0635f7ec59ffa85fb46b54fd77a7e
|
[
"Intel"
] | null | null | null |
bin/ominoes/pentominoes-plus-square-tetromino-8x8.py
|
tiwo/puzzler
|
7ad3d9a792f0635f7ec59ffa85fb46b54fd77a7e
|
[
"Intel"
] | 1
|
2022-01-02T16:54:14.000Z
|
2022-01-02T16:54:14.000Z
|
#!/usr/bin/env python
# $Id$
"""
8x8 grid with pentominoes plus 2x2 square tetromino.
16146 solutions
"""
import puzzler
from puzzler.puzzles.pentominoes import PentominoesPlusSquareTetromino8x8
puzzler.run(PentominoesPlusSquareTetromino8x8)
| 17.571429
| 73
| 0.808943
| 26
| 246
| 7.653846
| 0.807692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.059361
| 0.109756
| 246
| 13
| 74
| 18.923077
| 0.849315
| 0.386179
| 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
| 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
| 4
|
244050cdcb2a818b9e4b404a7bb50bccdcd3c651
| 277
|
py
|
Python
|
authors/apps/articles/migrations/0018_merge_20190123_1319.py
|
andela/Ah-backend-guardians
|
cc84c18f7c222bc69cf4a263a1c2296b6d335c8b
|
[
"BSD-3-Clause"
] | null | null | null |
authors/apps/articles/migrations/0018_merge_20190123_1319.py
|
andela/Ah-backend-guardians
|
cc84c18f7c222bc69cf4a263a1c2296b6d335c8b
|
[
"BSD-3-Clause"
] | 32
|
2019-01-09T07:52:32.000Z
|
2022-01-13T01:01:55.000Z
|
authors/apps/articles/migrations/0018_merge_20190123_1319.py
|
andela/Ah-backend-guardians
|
cc84c18f7c222bc69cf4a263a1c2296b6d335c8b
|
[
"BSD-3-Clause"
] | 3
|
2019-01-03T12:05:53.000Z
|
2019-09-24T11:41:14.000Z
|
# Generated by Django 2.1.5 on 2019-01-23 13:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('articles', '0017_merge_20190123_1105'),
('articles', '0017_merge_20190123_0856'),
]
operations = [
]
| 18.466667
| 49
| 0.65343
| 33
| 277
| 5.30303
| 0.787879
| 0.137143
| 0.194286
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.219626
| 0.227437
| 277
| 14
| 50
| 19.785714
| 0.598131
| 0.162455
| 0
| 0
| 1
| 0
| 0.278261
| 0.208696
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.125
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
244218d2153b7377b1f2fec1139e1e09771d1d43
| 1,311
|
py
|
Python
|
tests/t_cli/t_commands/test_version.py
|
gitter-badger/xobox
|
5278774f4dea55c54fa06803326bfbb9355caf47
|
[
"MIT"
] | null | null | null |
tests/t_cli/t_commands/test_version.py
|
gitter-badger/xobox
|
5278774f4dea55c54fa06803326bfbb9355caf47
|
[
"MIT"
] | null | null | null |
tests/t_cli/t_commands/test_version.py
|
gitter-badger/xobox
|
5278774f4dea55c54fa06803326bfbb9355caf47
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
tests.t_cli.t_commands.test_version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2017 by the Stormrose Project team, see AUTHORS.
:license: MIT License, see LICENSE for details.
"""
from unittest import TestCase
from xobox.cli.base import BaseCommand
from xobox.cli.commands.version import VersionCommand
class TestXoboxCliCommandsVersion(TestCase):
"""
Unit tests for :py:mod:`xobox.cli.commands.version`
"""
def test_01(self):
"""
Test Case 01:
Check if :py:class:`~xobox.cli.commands.version.VersionCommand` is a subclass of
:py:class:`~xobox.cli.commands.base.BaseCommand`.
Test is passed if :py:class:`~xobox.cli.commands.version.VersionCommand` is a subclass of
:py:class:`~xobox.cli.commands.base.BaseCommand`.
"""
self.assertTrue(issubclass(VersionCommand, BaseCommand))
def test_02(self):
"""
Test Case 02:
Try creating an instance of :py:class:`~xobox.cli.commands.version.VersionCommand`.
Test is passed if instance proves being an instance of
:py:class:`~xobox.cli.commands.version.VersionCommand`.
"""
obj = VersionCommand()
self.assertIsInstance(obj, VersionCommand)
| 31.214286
| 97
| 0.640732
| 152
| 1,311
| 5.493421
| 0.375
| 0.086228
| 0.153293
| 0.165269
| 0.366467
| 0.366467
| 0.366467
| 0.366467
| 0.366467
| 0.366467
| 0
| 0.012745
| 0.221968
| 1,311
| 41
| 98
| 31.97561
| 0.805882
| 0.580473
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.222222
| 1
| 0.222222
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
245fb26285ee03c03f2dedd95c6d461c318acefc
| 212
|
py
|
Python
|
services/director-v2/src/simcore_service_director_v2/main.py
|
colinRawlings/osparc-simcore
|
bf2f18d5bc1e574d5f4c238d08ad15156184c310
|
[
"MIT"
] | 25
|
2018-04-13T12:44:12.000Z
|
2022-03-12T15:01:17.000Z
|
services/director-v2/src/simcore_service_director_v2/main.py
|
colinRawlings/osparc-simcore
|
bf2f18d5bc1e574d5f4c238d08ad15156184c310
|
[
"MIT"
] | 2,553
|
2018-01-18T17:11:55.000Z
|
2022-03-31T16:26:40.000Z
|
services/director-v2/src/simcore_service_director_v2/main.py
|
mrnicegyu11/osparc-simcore
|
b6fa6c245dbfbc18cc74a387111a52de9b05d1f4
|
[
"MIT"
] | 20
|
2018-01-18T19:45:33.000Z
|
2022-03-29T07:08:47.000Z
|
"""Main application to be deployed in for example uvicorn.
"""
from fastapi import FastAPI
from simcore_service_director_v2.core.application import init_app
# SINGLETON FastAPI app
the_app: FastAPI = init_app()
| 26.5
| 65
| 0.806604
| 31
| 212
| 5.322581
| 0.677419
| 0.084848
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005405
| 0.127358
| 212
| 7
| 66
| 30.285714
| 0.886486
| 0.367925
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
030a75b3f5dc51f5a4c5839a336ff4a2a648c615
| 114
|
py
|
Python
|
src/bike_classifier_whisk_0_1_21/__init__.py
|
AdamBarnhard/bike_classifier_whisk_0_1_21
|
46c09d164853a5207861454e21a905d4e401608d
|
[
"MIT"
] | 1
|
2021-11-12T03:41:36.000Z
|
2021-11-12T03:41:36.000Z
|
src/bike_classifier_whisk_0_1_21/__init__.py
|
AdamBarnhard/bike_classifier_whisk_0_1_21
|
46c09d164853a5207861454e21a905d4e401608d
|
[
"MIT"
] | 8
|
2020-05-12T22:27:31.000Z
|
2022-03-12T00:29:34.000Z
|
src/bike_classifier_whisk_0_1_21/__init__.py
|
AdamBarnhard/bike_classifier_whisk_0_1_21
|
46c09d164853a5207861454e21a905d4e401608d
|
[
"MIT"
] | null | null | null |
from os.path import realpath
from whisk.project import Project
project = Project.from_module(realpath(__file__))
| 22.8
| 49
| 0.824561
| 16
| 114
| 5.5625
| 0.5625
| 0.314607
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 114
| 4
| 50
| 28.5
| 0.872549
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
030a803b9ccb78e61dc625acc9873a37672e5299
| 1,043
|
py
|
Python
|
sdk/python/pulumi_azure_native/aad/__init__.py
|
sebtelko/pulumi-azure-native
|
711ec021b5c73da05611c56c8a35adb0ce3244e4
|
[
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_azure_native/aad/__init__.py
|
sebtelko/pulumi-azure-native
|
711ec021b5c73da05611c56c8a35adb0ce3244e4
|
[
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_azure_native/aad/__init__.py
|
sebtelko/pulumi-azure-native
|
711ec021b5c73da05611c56c8a35adb0ce3244e4
|
[
"Apache-2.0"
] | null | null | null |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from .. import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .domain_service import *
from .get_domain_service import *
from .get_ou_container import *
from .ou_container import *
from ._inputs import *
from . import outputs
# Make subpackages available:
if typing.TYPE_CHECKING:
import pulumi_azure_native.aad.v20170101 as v20170101
import pulumi_azure_native.aad.v20170601 as v20170601
import pulumi_azure_native.aad.v20200101 as v20200101
import pulumi_azure_native.aad.v20210301 as v20210301
else:
v20170101 = _utilities.lazy_import('pulumi_azure_native.aad.v20170101')
v20170601 = _utilities.lazy_import('pulumi_azure_native.aad.v20170601')
v20200101 = _utilities.lazy_import('pulumi_azure_native.aad.v20200101')
v20210301 = _utilities.lazy_import('pulumi_azure_native.aad.v20210301')
| 37.25
| 80
| 0.782359
| 143
| 1,043
| 5.468531
| 0.405594
| 0.122762
| 0.173913
| 0.235294
| 0.491049
| 0.424552
| 0.199488
| 0
| 0
| 0
| 0
| 0.143333
| 0.137105
| 1,043
| 27
| 81
| 38.62963
| 0.725556
| 0.221477
| 0
| 0
| 1
| 0
| 0.163975
| 0.163975
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.894737
| 0
| 0.894737
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
0326f46df6db48bed085fa1bf976c6be25bfca27
| 50
|
py
|
Python
|
manim/utils/exceptions.py
|
philschatz/manim
|
e3359a571d9a02a08979b3e037ddada3e874eb7c
|
[
"MIT"
] | 2
|
2020-07-17T19:59:51.000Z
|
2020-10-14T16:38:23.000Z
|
manim/utils/exceptions.py
|
philschatz/manim
|
e3359a571d9a02a08979b3e037ddada3e874eb7c
|
[
"MIT"
] | 3
|
2021-04-28T14:44:39.000Z
|
2021-04-28T15:32:43.000Z
|
manim/utils/exceptions.py
|
philschatz/manim
|
e3359a571d9a02a08979b3e037ddada3e874eb7c
|
[
"MIT"
] | 1
|
2021-02-09T08:04:03.000Z
|
2021-02-09T08:04:03.000Z
|
class EndSceneEarlyException(Exception):
pass
| 16.666667
| 40
| 0.8
| 4
| 50
| 10
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.14
| 50
| 2
| 41
| 25
| 0.930233
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
033281b8c4686a20a0e2d87913fd9f24160aa59f
| 232
|
py
|
Python
|
game/routing.py
|
BlackwoodOne/Storytelling2.0
|
6a75045ced8711f52e568290b4b6b0d546434d7b
|
[
"MIT"
] | 1
|
2018-07-20T20:17:47.000Z
|
2018-07-20T20:17:47.000Z
|
game/routing.py
|
BlackwoodOne/Storytelling2.0
|
6a75045ced8711f52e568290b4b6b0d546434d7b
|
[
"MIT"
] | null | null | null |
game/routing.py
|
BlackwoodOne/Storytelling2.0
|
6a75045ced8711f52e568290b4b6b0d546434d7b
|
[
"MIT"
] | null | null | null |
from django.conf.urls import url
from . import consumers
websocket_urlpatterns = [
url(r'^ws/lobby/(?P<game_id>[^/]+)/$', consumers.NewPlayerConsumer),
url(r'^ws/collect/(?P<game_id>[^/]+)/$', consumers.CollectConsumer),
]
| 29
| 72
| 0.676724
| 29
| 232
| 5.310345
| 0.62069
| 0.051948
| 0.077922
| 0.207792
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107759
| 232
| 8
| 73
| 29
| 0.743961
| 0
| 0
| 0
| 0
| 0
| 0.266094
| 0.266094
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
033fbcd682a52321856e020e86fc563b5fc89129
| 85
|
py
|
Python
|
Anandks.py
|
Anandks07/fossotober
|
b446426b3f3aca85caac66445a781d4fa56f659b
|
[
"MIT"
] | null | null | null |
Anandks.py
|
Anandks07/fossotober
|
b446426b3f3aca85caac66445a781d4fa56f659b
|
[
"MIT"
] | null | null | null |
Anandks.py
|
Anandks07/fossotober
|
b446426b3f3aca85caac66445a781d4fa56f659b
|
[
"MIT"
] | 1
|
2020-10-01T04:45:44.000Z
|
2020-10-01T04:45:44.000Z
|
print("Anand K S")
print("AM.EN.U4CSE19106")
print("S1 CSE B")
print("Marvel rockz")
| 17
| 25
| 0.682353
| 15
| 85
| 3.866667
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092105
| 0.105882
| 85
| 4
| 26
| 21.25
| 0.671053
| 0
| 0
| 0
| 0
| 0
| 0.529412
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
0357c515eba098c6f19d17b59a3435d89dd69ba9
| 131
|
py
|
Python
|
config_1.py
|
NormanLo4319/ETL-Project
|
de792d98d112e51a55fa29a4654fb386c3b67b79
|
[
"MIT"
] | 1
|
2020-07-19T07:09:59.000Z
|
2020-07-19T07:09:59.000Z
|
config_1.py
|
NormanLo4319/ETL-Project
|
de792d98d112e51a55fa29a4654fb386c3b67b79
|
[
"MIT"
] | null | null | null |
config_1.py
|
NormanLo4319/ETL-Project
|
de792d98d112e51a55fa29a4654fb386c3b67b79
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
# Yelp Key
ID = "Enter Your Yelp ID Here"
ykey = "Enter your Yelp API Key Here"
| 11.909091
| 37
| 0.625954
| 23
| 131
| 3.565217
| 0.695652
| 0.219512
| 0.317073
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009901
| 0.229008
| 131
| 10
| 38
| 13.1
| 0.80198
| 0.381679
| 0
| 0
| 0
| 0
| 0.671053
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
03601f7dfbd8374adbad70a6f3e1cefdca05eac7
| 1,134
|
py
|
Python
|
PYTHON POO AULAS/Aula002-Init e Self.py
|
lucasjlgc/Python-POO
|
56c98e7abb47a0268396f1981e58a0a2441db4fe
|
[
"MIT"
] | null | null | null |
PYTHON POO AULAS/Aula002-Init e Self.py
|
lucasjlgc/Python-POO
|
56c98e7abb47a0268396f1981e58a0a2441db4fe
|
[
"MIT"
] | null | null | null |
PYTHON POO AULAS/Aula002-Init e Self.py
|
lucasjlgc/Python-POO
|
56c98e7abb47a0268396f1981e58a0a2441db4fe
|
[
"MIT"
] | null | null | null |
"""#CLASSES, MÉTODOS E SELF"""
"""
1 -Classes são abstrações e descrevem como os dados serão representados e manipulados.
Em Python, todos os tipos nativos também são classes. Por exemplo, o tipo int é uma classe do Python,
que permite representar números inteiros e realizar operações como soma, subtração, multiplicação, etc.,
com objetos inteiros
2- Método __init__: É um método, que por definição,
é executada sempre que instanciamos(Criamos) um objeto.
E método é o mesmo que função, mas função interna de uma classe, que só existe e atua nos seus objetos.
Ela só é vista fora do escopo do objeto se o programador desejar.
3- SELF: É esse parametro onde em cada objeto, específica e unicamente, que os métodos
vão atuar, e é por isso que o método self é necessário em cada método de uma classe.
Pode criar 1 trilhão de objetos de uma mesma classe. Mas o self se refere aquele objeto
específico, ok ?"""
class Carro:
portas = 3
def __init__(self):
print("Carro criado")
def exibePortas(self):
return self.portas
veloster = Carro()
print("Numero de portas:", veloster.exibePortas())
| 37.8
| 106
| 0.740741
| 179
| 1,134
| 4.648045
| 0.547486
| 0.032452
| 0.026442
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005495
| 0.197531
| 1,134
| 29
| 107
| 39.103448
| 0.908791
| 0.021164
| 0
| 0
| 0
| 0
| 0.13615
| 0
| 0
| 0
| 0
| 0.206897
| 0
| 1
| 0.25
| false
| 0
| 0
| 0.125
| 0.625
| 0.25
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
0375bcf0514c864c9aa3fbc1e36aa20c31ba345f
| 1,688
|
py
|
Python
|
tests/test_doc_methods.py
|
ybibaev/monypy
|
f1ad4b9e67f48a8b73aa74eb05113f1fc01f3a04
|
[
"MIT"
] | 6
|
2018-04-29T17:56:18.000Z
|
2019-03-18T20:05:19.000Z
|
tests/test_doc_methods.py
|
ddstte/monypy
|
f1ad4b9e67f48a8b73aa74eb05113f1fc01f3a04
|
[
"MIT"
] | null | null | null |
tests/test_doc_methods.py
|
ddstte/monypy
|
f1ad4b9e67f48a8b73aa74eb05113f1fc01f3a04
|
[
"MIT"
] | 2
|
2018-04-29T19:30:30.000Z
|
2018-04-30T07:28:41.000Z
|
import pytest
from monypy.doc import MONGODB_ID_KEY
from monypy.exceptions import DocumentDoesNotExist
@pytest.mark.asyncio
async def test_save(empty_doc):
empty = empty_doc()
assert MONGODB_ID_KEY not in empty
await empty.save()
assert MONGODB_ID_KEY in empty
assert 1 == await empty_doc.documents.count({})
@pytest.mark.asyncio
async def test_save_two(empty_doc):
empty = empty_doc()
await empty.save()
empty.test = 'test'
await empty.save()
assert MONGODB_ID_KEY in empty
assert 1 == await empty_doc.documents.count({})
@pytest.mark.asyncio
async def test_refresh(empty_doc):
empty = empty_doc()
await empty.save()
empty.test = 'test'
await empty.refresh()
assert MONGODB_ID_KEY in empty
assert 'test' not in empty
assert 1 == await empty_doc.documents.count({})
@pytest.mark.asyncio
async def test_refresh_not_saved(empty_doc):
empty = empty_doc()
with pytest.raises(DocumentDoesNotExist):
await empty.refresh()
assert MONGODB_ID_KEY not in empty
@pytest.mark.asyncio
async def test_save_nested_and_refresh(empty_doc):
empty = empty_doc(test={'test': 'test'})
await empty.save()
await empty.refresh()
assert not isinstance(empty['test'], empty_doc)
@pytest.mark.asyncio
async def test_delete(empty_doc):
empty = empty_doc()
await empty.save()
await empty.delete()
assert 0 == await empty_doc.documents.count({})
@pytest.mark.asyncio
async def test_delete_not_saved(empty_doc):
empty = empty_doc()
with pytest.raises(DocumentDoesNotExist):
await empty.delete()
assert 0 == await empty_doc.documents.count({})
| 20.095238
| 51
| 0.706754
| 235
| 1,688
| 4.876596
| 0.144681
| 0.139616
| 0.103839
| 0.13438
| 0.864747
| 0.818499
| 0.794066
| 0.609075
| 0.578534
| 0.578534
| 0
| 0.003666
| 0.191943
| 1,688
| 83
| 52
| 20.337349
| 0.83651
| 0
| 0
| 0.745098
| 0
| 0
| 0.014218
| 0
| 0
| 0
| 0
| 0
| 0.235294
| 1
| 0
| false
| 0
| 0.058824
| 0
| 0.058824
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 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
| 4
|
cee82b18b29f2116c803c97832c8ecdddb422c2b
| 219
|
py
|
Python
|
pysal/esda/__init__.py
|
cubensys/pysal
|
8d50990f6e6603ba79ae1a887a20a1e3a0734e51
|
[
"MIT",
"BSD-3-Clause"
] | null | null | null |
pysal/esda/__init__.py
|
cubensys/pysal
|
8d50990f6e6603ba79ae1a887a20a1e3a0734e51
|
[
"MIT",
"BSD-3-Clause"
] | null | null | null |
pysal/esda/__init__.py
|
cubensys/pysal
|
8d50990f6e6603ba79ae1a887a20a1e3a0734e51
|
[
"MIT",
"BSD-3-Clause"
] | 1
|
2021-07-19T01:46:17.000Z
|
2021-07-19T01:46:17.000Z
|
"""
:mod:`esda` --- Exploratory Spatial Data Analysis
=================================================
"""
import mapclassify
import moran
import smoothing
import getisord
import geary
import join_counts
import gamma
| 16.846154
| 49
| 0.607306
| 21
| 219
| 6.285714
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.109589
| 219
| 12
| 50
| 18.25
| 0.676923
| 0.452055
| 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
| 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
| 4
|
cef3feb1057b8e9fd39195e65ff7055924e2f158
| 313
|
py
|
Python
|
ambra_sdk/service/entrypoints/radreport.py
|
dicomgrid/sdk-python
|
bb12eed311bad73dfb863917df4dc5cbcd91a447
|
[
"Apache-2.0"
] | 9
|
2020-04-20T23:45:44.000Z
|
2021-04-18T11:22:17.000Z
|
ambra_sdk/service/entrypoints/radreport.py
|
dicomgrid/sdk-python
|
bb12eed311bad73dfb863917df4dc5cbcd91a447
|
[
"Apache-2.0"
] | 13
|
2020-02-08T16:15:05.000Z
|
2021-09-13T22:55:28.000Z
|
ambra_sdk/service/entrypoints/radreport.py
|
dicomgrid/sdk-python
|
bb12eed311bad73dfb863917df4dc5cbcd91a447
|
[
"Apache-2.0"
] | 6
|
2020-03-25T17:47:45.000Z
|
2021-04-18T11:22:19.000Z
|
from ambra_sdk.service.entrypoints.generated.radreport import \
AsyncRadreport as GAsyncRadreport
from ambra_sdk.service.entrypoints.generated.radreport import \
Radreport as GRadreport
class Radreport(GRadreport):
"""Radreport."""
class AsyncRadreport(GAsyncRadreport):
"""AsyncRadreport."""
| 24.076923
| 63
| 0.776358
| 30
| 313
| 8.033333
| 0.433333
| 0.074689
| 0.099585
| 0.157676
| 0.448133
| 0.448133
| 0.448133
| 0.448133
| 0
| 0
| 0
| 0
| 0.127796
| 313
| 12
| 64
| 26.083333
| 0.882784
| 0.083067
| 0
| 0.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
cef45bde41045314a30b35154bd419b342357e43
| 119
|
py
|
Python
|
tezos_etl/setup.py
|
ankitchiplunkar/tezos-etl
|
c74eca68e42825fddecbd78afd2e68d84e559680
|
[
"MIT"
] | 3
|
2020-03-24T15:26:16.000Z
|
2020-06-17T12:47:35.000Z
|
tezos_etl/setup.py
|
ankitchiplunkar/tezos-etl
|
c74eca68e42825fddecbd78afd2e68d84e559680
|
[
"MIT"
] | null | null | null |
tezos_etl/setup.py
|
ankitchiplunkar/tezos-etl
|
c74eca68e42825fddecbd78afd2e68d84e559680
|
[
"MIT"
] | null | null | null |
from distutils.core import setup
setup(name='tezos_etl',
version='0.1',
py_modules=['tezos_etl'],
)
| 17
| 32
| 0.621849
| 16
| 119
| 4.4375
| 0.8125
| 0.225352
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.021739
| 0.226891
| 119
| 6
| 33
| 19.833333
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0.176471
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 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
| 0
| 0
|
0
| 4
|
cefbb752879de51f5128afc0b66a6798ad1b15fa
| 234
|
py
|
Python
|
src/tests/test_library.py
|
ttafsir/rf-network
|
7c9eef35dcb35823d151cdfdce96713af4023579
|
[
"MIT"
] | null | null | null |
src/tests/test_library.py
|
ttafsir/rf-network
|
7c9eef35dcb35823d151cdfdce96713af4023579
|
[
"MIT"
] | null | null | null |
src/tests/test_library.py
|
ttafsir/rf-network
|
7c9eef35dcb35823d151cdfdce96713af4023579
|
[
"MIT"
] | null | null | null |
from pluggy import PluginManager
from rf_network.library import NetworkTransportLibrary
class TestLibrary:
def test_create_library(self):
lib = NetworkTransportLibrary()
assert isinstance(lib.pm, PluginManager)
| 23.4
| 54
| 0.773504
| 24
| 234
| 7.416667
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.175214
| 234
| 9
| 55
| 26
| 0.92228
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 1
| 0.166667
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
cefc1f9d5c17a1452f56a88099096f8d97ca14c6
| 121
|
py
|
Python
|
blitzcrank/__init__.py
|
samhine/blitzcrank
|
340898e9a8dfeedba747adb2a94c5b76687f7f11
|
[
"MIT"
] | null | null | null |
blitzcrank/__init__.py
|
samhine/blitzcrank
|
340898e9a8dfeedba747adb2a94c5b76687f7f11
|
[
"MIT"
] | null | null | null |
blitzcrank/__init__.py
|
samhine/blitzcrank
|
340898e9a8dfeedba747adb2a94c5b76687f7f11
|
[
"MIT"
] | null | null | null |
from blitzcrank.Blitzcrank import Blitzcrank
from .apis import champion, champion_mastery, item, league, match, summoner
| 40.333333
| 75
| 0.834711
| 15
| 121
| 6.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107438
| 121
| 2
| 76
| 60.5
| 0.925926
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
3041812a441311f4f0512686d0abf67de27a985f
| 136
|
py
|
Python
|
mundo 1/ex016.py
|
thiagofreitascarneiro/Curso-de-Python---Curso-em-Video
|
0342e482780b5a1c6f78cddd51d9bfad785c79fa
|
[
"MIT"
] | 1
|
2021-08-04T13:21:22.000Z
|
2021-08-04T13:21:22.000Z
|
mundo 1/ex016.py
|
thiagofreitascarneiro/Curso-de-Python---Curso-em-Video
|
0342e482780b5a1c6f78cddd51d9bfad785c79fa
|
[
"MIT"
] | null | null | null |
mundo 1/ex016.py
|
thiagofreitascarneiro/Curso-de-Python---Curso-em-Video
|
0342e482780b5a1c6f78cddd51d9bfad785c79fa
|
[
"MIT"
] | null | null | null |
import math
value = float(input("Digite um valor:"))
print(f'O valor digitado foi {value} e a sua porção inteira é {math.trunc(value)}')
| 45.333333
| 83
| 0.727941
| 24
| 136
| 4.125
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132353
| 136
| 3
| 83
| 45.333333
| 0.838983
| 0
| 0
| 0
| 0
| 0
| 0.649635
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
06410df1a75b0e7f9b5721681799019949e270ab
| 281
|
py
|
Python
|
exercises/ja/exc_01_03_02.py
|
Jette16/spacy-course
|
32df0c8f6192de6c9daba89740a28c0537e4d6a0
|
[
"MIT"
] | 2,085
|
2019-04-17T13:10:40.000Z
|
2022-03-30T21:51:46.000Z
|
exercises/ja/exc_01_03_02.py
|
Jette16/spacy-course
|
32df0c8f6192de6c9daba89740a28c0537e4d6a0
|
[
"MIT"
] | 79
|
2019-04-18T14:42:55.000Z
|
2022-03-07T08:15:43.000Z
|
exercises/ja/exc_01_03_02.py
|
Jette16/spacy-course
|
32df0c8f6192de6c9daba89740a28c0537e4d6a0
|
[
"MIT"
] | 361
|
2019-04-17T13:34:32.000Z
|
2022-03-28T04:42:45.000Z
|
# 日本語クラスをインポートし、nlpオブジェクトを作成
from ____ import ____
nlp = ____
# テキストを処理
doc = ____("私はツリーカンガルーとイルカが好きです。")
# 「ツリーカンガルー」のスライスを選択
tree_kangaroos = ____
print(tree_kangaroos.text)
# 「ツリーカンガルーとイルカ」のスライスを選択
tree_kangaroos_and_dolphins = ____
print(tree_kangaroos_and_dolphins.text)
| 17.5625
| 39
| 0.807829
| 28
| 281
| 6.964286
| 0.607143
| 0.266667
| 0.215385
| 0.246154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.106762
| 281
| 15
| 40
| 18.733333
| 0.776892
| 0.270463
| 0
| 0
| 0
| 0
| 0.1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.142857
| 0
| 0.142857
| 0.285714
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0655875b30e82c98f51c0a36395f1015dc1c8753
| 245
|
py
|
Python
|
signals/signals/apps/relation/api_v1/views.py
|
gonzaloamadio/django-signals2
|
809d1c0b627f5ec68e7bc4f73fdc7de7e7545706
|
[
"MIT"
] | null | null | null |
signals/signals/apps/relation/api_v1/views.py
|
gonzaloamadio/django-signals2
|
809d1c0b627f5ec68e7bc4f73fdc7de7e7545706
|
[
"MIT"
] | null | null | null |
signals/signals/apps/relation/api_v1/views.py
|
gonzaloamadio/django-signals2
|
809d1c0b627f5ec68e7bc4f73fdc7de7e7545706
|
[
"MIT"
] | null | null | null |
from signals.apps.relation import models
from . import serializers
from signals.libs.views import APIViewSet
class RelationViewSet(APIViewSet):
queryset = models.Relation.objects.all()
serializer_class = serializers.RelationSerializer
| 27.222222
| 53
| 0.812245
| 27
| 245
| 7.333333
| 0.62963
| 0.111111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122449
| 245
| 8
| 54
| 30.625
| 0.92093
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
06601386e30fd121ec6928beb8d8b1ca5e272441
| 6,363
|
py
|
Python
|
tests/contrib/networks/tf_networks/supported.py
|
nicolay-r/AREk
|
19c39ec0dc9a17464cade03b9c4da0c6d1d21191
|
[
"MIT"
] | 18
|
2019-12-14T18:43:11.000Z
|
2022-03-21T05:55:36.000Z
|
tests/contrib/networks/tf_networks/supported.py
|
nicolay-r/AREk
|
19c39ec0dc9a17464cade03b9c4da0c6d1d21191
|
[
"MIT"
] | 284
|
2020-08-08T20:52:44.000Z
|
2022-03-31T05:26:20.000Z
|
tests/contrib/networks/tf_networks/supported.py
|
nicolay-r/AREk
|
19c39ec0dc9a17464cade03b9c4da0c6d1d21191
|
[
"MIT"
] | 1
|
2021-08-07T13:17:43.000Z
|
2021-08-07T13:17:43.000Z
|
from arekit.contrib.networks.context.architectures.att_ef_bilstm import AttentionEndsAndFramesBiLSTM
from arekit.contrib.networks.context.architectures.att_ef_cnn import AttentionEndsAndFramesCNN
from arekit.contrib.networks.context.architectures.att_ef_pcnn import AttentionEndsAndFramesPCNN
from arekit.contrib.networks.context.architectures.att_ends_cnn import AttentionEndsCNN
from arekit.contrib.networks.context.architectures.att_frames_bilstm import AttentionFramesBiLSTM
from arekit.contrib.networks.context.architectures.att_frames_cnn import AttentionFramesCNN
from arekit.contrib.networks.context.architectures.att_se_bilstm import AttentionSynonymEndsBiLSTM
from arekit.contrib.networks.context.architectures.att_se_cnn import AttentionSynonymEndsCNN
from arekit.contrib.networks.context.architectures.att_self_p_zhou_bilstm import AttentionSelfPZhouBiLSTM
from arekit.contrib.networks.context.architectures.att_self_p_zhou_rcnn import AttentionSelfPZhouRCNN
from arekit.contrib.networks.context.architectures.att_self_z_yang_bilstm import AttentionSelfZYangBiLSTM
from arekit.contrib.networks.context.architectures.att_self_z_yang_rcnn import AttentionSelfZYangRCNN
from arekit.contrib.networks.context.architectures.bilstm import BiLSTM
from arekit.contrib.networks.context.architectures.ian_ef import IANEndsAndFrames
from arekit.contrib.networks.context.architectures.ian_ends import IANEndsBased
from arekit.contrib.networks.context.architectures.ian_frames import IANFrames
from arekit.contrib.networks.context.architectures.ian_se import IANSynonymEndsBased
from arekit.contrib.networks.context.architectures.att_ends_pcnn import AttentionEndsPCNN
from arekit.contrib.networks.context.architectures.att_frames_pcnn import AttentionFramesPCNN
from arekit.contrib.networks.context.architectures.att_se_pcnn import AttentionSynonymEndsPCNN
from arekit.contrib.networks.context.architectures.pcnn import PiecewiseCNN
from arekit.contrib.networks.context.architectures.rcnn import RCNN
from arekit.contrib.networks.context.architectures.self_att_bilstm import SelfAttentionBiLSTM
from arekit.contrib.networks.context.configurations.att_ef_bilstm import AttentionEndsAndFramesBiLSTMConfig
from arekit.contrib.networks.context.configurations.att_ef_cnn import AttentionEndsAndFramesCNNConfig
from arekit.contrib.networks.context.configurations.att_ef_pcnn import AttentionEndsAndFramesPCNNConfig
from arekit.contrib.networks.context.configurations.att_self_p_zhou_bilstm import AttentionSelfPZhouBiLSTMConfig
from arekit.contrib.networks.context.configurations.att_ends_cnn import AttentionEndsCNNConfig
from arekit.contrib.networks.context.configurations.bilstm import BiLSTMConfig
from arekit.contrib.networks.context.configurations.att_ends_pcnn import AttentionEndsPCNNConfig
from arekit.contrib.networks.context.configurations.att_frames_bilstm import AttentionFramesBiLSTMConfig
from arekit.contrib.networks.context.configurations.att_frames_cnn import AttentionFramesCNNConfig
from arekit.contrib.networks.context.configurations.att_frames_pcnn import AttentionFramesPCNNConfig
from arekit.contrib.networks.context.configurations.att_self_p_zhou_rcnn import AttentionSelfPZhouRCNNConfig
from arekit.contrib.networks.context.configurations.att_self_z_yang_bilstm import AttentionSelfZYangBiLSTMConfig
from arekit.contrib.networks.context.configurations.att_se_bilstm import AttentionSynonymEndsBiLSTMConfig
from arekit.contrib.networks.context.configurations.att_se_cnn import AttentionSynonymEndsCNNConfig
from arekit.contrib.networks.context.configurations.att_se_pcnn import AttentionSynonymEndsPCNNConfig
from arekit.contrib.networks.context.configurations.att_self_z_yang_rcnn import AttentionSelfZYangRCNNConfig
from arekit.contrib.networks.context.configurations.ian_ef import IANEndsAndFramesConfig
from arekit.contrib.networks.context.configurations.ian_ends import IANEndsBasedConfig
from arekit.contrib.networks.context.configurations.ian_se import IANSynonymEndsBasedConfig
from arekit.contrib.networks.context.configurations.ian_frames import IANFramesConfig
from arekit.contrib.networks.context.configurations.rcnn import RCNNConfig
from arekit.contrib.networks.context.configurations.rnn import RNNConfig
from arekit.contrib.networks.context.configurations.self_att_bilstm import SelfAttentionBiLSTMConfig
from arekit.contrib.networks.context.configurations.cnn import CNNConfig
from arekit.contrib.networks.context.architectures.cnn import VanillaCNN
from arekit.contrib.networks.context.architectures.rnn import RNN
def get_supported():
return [# Self-attention
(SelfAttentionBiLSTMConfig(), SelfAttentionBiLSTM()),
(AttentionSelfPZhouBiLSTMConfig(), AttentionSelfPZhouBiLSTM()),
(AttentionSelfZYangBiLSTMConfig(), AttentionSelfZYangBiLSTM()),
# CNN based
(CNNConfig(), VanillaCNN()),
(CNNConfig(), PiecewiseCNN()),
# RNN-based
(RNNConfig(), RNN()),
(BiLSTMConfig(), BiLSTM()),
# RCNN-based models (Recurrent-CNN)
(RCNNConfig(), RCNN()),
(AttentionSelfPZhouRCNNConfig(), AttentionSelfPZhouRCNN()),
(AttentionSelfZYangRCNNConfig(), AttentionSelfZYangRCNN()),
# IAN (Interactive attention networks)
(IANFramesConfig(), IANFrames()),
(IANEndsAndFramesConfig(), IANEndsAndFrames()),
(IANEndsBasedConfig(), IANEndsBased()),
(IANSynonymEndsBasedConfig(), IANSynonymEndsBased()),
# MLP-Attention-based
(AttentionEndsAndFramesBiLSTMConfig(), AttentionEndsAndFramesBiLSTM()),
(AttentionFramesBiLSTMConfig(), AttentionFramesBiLSTM()),
(AttentionSynonymEndsBiLSTMConfig(), AttentionSynonymEndsBiLSTM()),
(AttentionEndsAndFramesPCNNConfig(), AttentionEndsAndFramesPCNN()),
[AttentionEndsAndFramesCNNConfig(), AttentionEndsAndFramesCNN()],
(AttentionEndsCNNConfig(), AttentionEndsCNN()),
(AttentionEndsPCNNConfig(), AttentionEndsPCNN()),
(AttentionSynonymEndsPCNNConfig(), AttentionSynonymEndsPCNN()),
(AttentionSynonymEndsCNNConfig(), AttentionSynonymEndsCNN()),
(AttentionFramesCNNConfig(), AttentionFramesCNN()),
(AttentionFramesPCNNConfig(), AttentionFramesPCNN())]
| 71.494382
| 112
| 0.826654
| 601
| 6,363
| 8.603993
| 0.133111
| 0.094759
| 0.161091
| 0.236898
| 0.498743
| 0.498743
| 0.385032
| 0.309998
| 0.088958
| 0.088958
| 0
| 0
| 0.100267
| 6,363
| 89
| 113
| 71.494382
| 0.903231
| 0.019645
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.013158
| true
| 0
| 0.644737
| 0.013158
| 0.671053
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
ebf3204a06e90e8bf0612f775abcb25f8f0dd47b
| 133
|
py
|
Python
|
ex07.py
|
ScottDig/Practice-Python-Exercises
|
3d89a61888c780b6df30e4f294a4468937612954
|
[
"MIT"
] | null | null | null |
ex07.py
|
ScottDig/Practice-Python-Exercises
|
3d89a61888c780b6df30e4f294a4468937612954
|
[
"MIT"
] | null | null | null |
ex07.py
|
ScottDig/Practice-Python-Exercises
|
3d89a61888c780b6df30e4f294a4468937612954
|
[
"MIT"
] | null | null | null |
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
b = [even for even in a if even % 2 == 0]
print(b)
c = [even*3 for even in a]
print(c)
| 14.777778
| 42
| 0.526316
| 32
| 133
| 2.1875
| 0.65625
| 0.2
| 0.257143
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.21875
| 0.278195
| 133
| 9
| 43
| 14.777778
| 0.510417
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.4
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
23157a832151a302c688b4c36566a5731392863f
| 382
|
py
|
Python
|
print_emoji.py
|
NitulKalita/Python-CLI
|
dd967e601485189672693a5082a129feb7898698
|
[
"MIT"
] | 6
|
2021-09-04T17:46:31.000Z
|
2021-11-28T14:30:19.000Z
|
print_emoji.py
|
NitulKalita/Python-CLI
|
dd967e601485189672693a5082a129feb7898698
|
[
"MIT"
] | null | null | null |
print_emoji.py
|
NitulKalita/Python-CLI
|
dd967e601485189672693a5082a129feb7898698
|
[
"MIT"
] | 2
|
2021-10-01T07:53:45.000Z
|
2021-11-19T18:13:52.000Z
|
'''#using CLDR name
print("\N{grinning face}")
print("\N{winking face}")
print("\N{thumbs up sign}")
'''
'''#using unicodes
print("\U0001f600") #grinning face
print("\U0001F609") #winking face
print("\U0001F44D") #thumbs up
'''
#using the emoji module
import emoji
print(emoji.emojize(":grinning_face:"))
print(emoji.emojize(":winking_face:"))
print(emoji.emojize(":thumbs_up:"))
| 21.222222
| 39
| 0.698953
| 51
| 382
| 5.176471
| 0.392157
| 0.204545
| 0.193182
| 0.159091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.057471
| 0.089005
| 382
| 18
| 40
| 21.222222
| 0.701149
| 0.188482
| 0
| 0
| 0
| 0
| 0.298507
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.25
| 0
| 0.25
| 0.75
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
233b0e0e9138f0417c0402b01ba13748164eebb6
| 882
|
py
|
Python
|
.config/python/startup.py
|
cjbayliss/conf
|
1e3c91b47eef85a419ac352257d4f6da9a80be31
|
[
"CC0-1.0"
] | null | null | null |
.config/python/startup.py
|
cjbayliss/conf
|
1e3c91b47eef85a419ac352257d4f6da9a80be31
|
[
"CC0-1.0"
] | 1
|
2019-05-13T01:48:53.000Z
|
2019-06-04T00:54:32.000Z
|
.config/python/startup.py
|
cjbayliss/conf
|
1e3c91b47eef85a419ac352257d4f6da9a80be31
|
[
"CC0-1.0"
] | null | null | null |
# if you are a python developer or someone else considering writing
# files into peoples home directory, PLEASE allow people to at least
# turn it off, at a bare minimum. providing a way to change where the
# files are written is polite too!
#
# no, readline.set_auto_history(False) doesnt stop python writing
# ~/.python_history, it just stops python adding history to that file.
#
# refs:
#
# * https://bugs.python.org/issue5845
# * https://bugs.python.org/issue20886
# * https://bugs.python.org/issue26870
# * https://bugs.python.org/issue29779
# * https://bugs.python.org/issue41563
# * https://docs.python.org/3/library/readline.html#example
# * https://github.com/python/cpython/pull/13208
# * https://unix.stackexchange.com/a/297834
try:
import readline
readline.write_history_file = lambda *args: None
del readline
except ImportError:
pass
| 33.923077
| 70
| 0.726757
| 126
| 882
| 5.047619
| 0.642857
| 0.084906
| 0.117925
| 0.141509
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.048518
| 0.15873
| 882
| 25
| 71
| 35.28
| 0.808625
| 0.815193
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.166667
| 0.333333
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
|
0
| 4
|
2350c84da68d4e880839edbfc491d8e9b44a0cc2
| 95
|
py
|
Python
|
sequencers/apps.py
|
bihealth/digestiflow-server
|
298c53f95dbf56e7be0d0b8bcceacabc21257d5f
|
[
"MIT"
] | 13
|
2019-11-27T19:12:15.000Z
|
2021-12-01T21:32:18.000Z
|
sequencers/apps.py
|
bihealth/digestiflow-server
|
298c53f95dbf56e7be0d0b8bcceacabc21257d5f
|
[
"MIT"
] | 60
|
2019-03-27T14:43:19.000Z
|
2022-03-22T09:12:53.000Z
|
sequencers/apps.py
|
bihealth/digestiflow-server
|
298c53f95dbf56e7be0d0b8bcceacabc21257d5f
|
[
"MIT"
] | 3
|
2020-11-09T07:08:42.000Z
|
2022-02-09T11:37:54.000Z
|
from django.apps import AppConfig
class SequencersConfig(AppConfig):
name = "sequencers"
| 15.833333
| 34
| 0.768421
| 10
| 95
| 7.3
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 95
| 5
| 35
| 19
| 0.9125
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
235907d5f80d5e334bc2bf99669791b2ddbb2396
| 138
|
py
|
Python
|
wsgi.py
|
dbca-asi/mapproxy
|
4bbfd5865146a0cedc3b4ba00ac87059bacf0f5c
|
[
"Apache-2.0"
] | null | null | null |
wsgi.py
|
dbca-asi/mapproxy
|
4bbfd5865146a0cedc3b4ba00ac87059bacf0f5c
|
[
"Apache-2.0"
] | null | null | null |
wsgi.py
|
dbca-asi/mapproxy
|
4bbfd5865146a0cedc3b4ba00ac87059bacf0f5c
|
[
"Apache-2.0"
] | null | null | null |
# WSGI module for use with uWSGI or gunicorn
from mapproxy.wsgiapp import make_wsgi_app
application = make_wsgi_app('/app/mapproxy.yaml')
| 34.5
| 49
| 0.811594
| 22
| 138
| 4.909091
| 0.727273
| 0.148148
| 0.203704
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115942
| 138
| 3
| 50
| 46
| 0.885246
| 0.304348
| 0
| 0
| 0
| 0
| 0.191489
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
2369e5d93c23eade0b67166985f4029006cbbf3b
| 34
|
py
|
Python
|
tests/__init__.py
|
sjaiswalvmware/wavefront-pyformance
|
a2b487dbacecc8cbf8288e669614433d089cf0d5
|
[
"ECL-2.0",
"Apache-2.0"
] | 2
|
2018-08-28T18:28:33.000Z
|
2021-06-11T19:33:01.000Z
|
tests/__init__.py
|
sjaiswalvmware/wavefront-pyformance
|
a2b487dbacecc8cbf8288e669614433d089cf0d5
|
[
"ECL-2.0",
"Apache-2.0"
] | 14
|
2018-08-28T20:30:40.000Z
|
2021-04-15T08:27:31.000Z
|
tests/__init__.py
|
sjaiswalvmware/wavefront-pyformance
|
a2b487dbacecc8cbf8288e669614433d089cf0d5
|
[
"ECL-2.0",
"Apache-2.0"
] | 9
|
2018-08-28T18:48:23.000Z
|
2021-01-29T11:12:59.000Z
|
"""Wavefront Pyformance Tests."""
| 17
| 33
| 0.705882
| 3
| 34
| 8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.088235
| 34
| 1
| 34
| 34
| 0.774194
| 0.794118
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
237529045771522500fb6359f23815502b4fa570
| 63,955
|
py
|
Python
|
pyked/tests/test_converters.py
|
jsantner/PyKED
|
1e5dd80bba1da4260681290cd8fca0536d652fec
|
[
"BSD-3-Clause"
] | 12
|
2017-05-23T19:04:51.000Z
|
2021-05-27T09:03:30.000Z
|
pyked/tests/test_converters.py
|
mefuller/PyKED
|
ed312c332f14b886dd98921ea5329597ee8c2716
|
[
"BSD-3-Clause"
] | 103
|
2017-02-20T00:54:14.000Z
|
2022-02-25T02:03:39.000Z
|
pyked/tests/test_converters.py
|
mefuller/PyKED
|
ed312c332f14b886dd98921ea5329597ee8c2716
|
[
"BSD-3-Clause"
] | 18
|
2017-03-14T23:29:57.000Z
|
2020-09-16T09:27:21.000Z
|
""""
Tests for the converters
"""
# Standard libraries
import os
import pkg_resources
from requests.exceptions import ConnectionError
import socket
from tempfile import TemporaryDirectory
import xml.etree.ElementTree as etree
from shutil import copy
import pytest
import numpy.random
from numpy.testing import assert_allclose
# Local imports
from ..converters import (ParseError, KeywordError, MissingElementError,
MissingAttributeError
)
from ..converters import (get_file_metadata, get_reference, get_experiment_kind,
get_common_properties, get_ignition_type, get_datapoints,
ReSpecTh_to_ChemKED, main, respth2ck, ck2respth
)
from .._version import __version__
from ..chemked import ChemKED
class TestErrors(object):
"""
"""
def test_parse_error(self):
"""(Very) basic test of ParseError.
"""
with pytest.raises(ParseError) as excinfo:
raise ParseError('this is an error')
assert 'this is an error' in str(excinfo.value)
def test_keyword_error(self):
"""Basic test of KeywordError.
"""
with pytest.raises(KeywordError) as excinfo:
raise KeywordError('this is a test')
assert 'Error: this is a test.' in str(excinfo.value)
def test_missing_element_error(self):
"""Basic test of MissingElementError.
"""
with pytest.raises(MissingElementError) as excinfo:
raise MissingElementError('fileAuthor')
assert 'Error: required element fileAuthor is missing.' in str(excinfo.value)
def test_missing_attribute_error(self):
"""Basic test of MissingAttributeError.
"""
with pytest.raises(MissingAttributeError) as excinfo:
raise MissingAttributeError('preferredKey', 'bibliographyLink')
assert 'Error: required attribute preferredKey of bibliographyLink is missing.' in str(excinfo.value)
class TestFileMetadata(object):
"""
"""
def test_valid_metadata(self):
"""Ensure valid metadata validates properly.
"""
root = etree.Element('experiment')
author = etree.SubElement(root, 'fileAuthor')
author.text = 'Kyle Niemeyer'
version = etree.SubElement(root, 'fileVersion')
major_version = etree.SubElement(version, 'major')
major_version.text = '1'
minor_version = etree.SubElement(version, 'minor')
minor_version.text = '0'
meta = get_file_metadata(root)
assert meta['chemked-version'] == __version__
assert meta['file-authors'][0]['name'] == 'Kyle Niemeyer'
# ChemKED version will always start at 0
assert meta['file-version'] == 0
def test_missing_fileauthor(self):
"""Ensure missing file author raises error.
"""
root = etree.Element('experiment')
version = etree.SubElement(root, 'fileVersion')
major_version = etree.SubElement(version, 'major')
major_version.text = '1'
minor_version = etree.SubElement(version, 'minor')
minor_version.text = '0'
with pytest.raises(MissingElementError) as excinfo:
get_file_metadata(root)
assert 'Error: required element fileAuthor is missing.' in str(excinfo.value)
def test_blank_fileauthor(self):
"""Ensure blank file author raises error.
"""
root = etree.Element('experiment')
author = etree.SubElement(root, 'fileAuthor')
author.text = ''
version = etree.SubElement(root, 'fileVersion')
major_version = etree.SubElement(version, 'major')
major_version.text = '1'
minor_version = etree.SubElement(version, 'minor')
minor_version.text = '0'
with pytest.raises(MissingElementError) as excinfo:
get_file_metadata(root)
assert 'Error: required element fileAuthor is missing' in str(excinfo.value)
class TestGetReference(object):
"""
"""
@pytest.fixture(scope='function')
def disable_socket(self):
"""Disables socket to prevent network access.
"""
old_socket = socket.socket
def guard(*args, **kwargs):
raise ConnectionError("No internet")
socket.socket = guard
yield
socket.socket = old_socket
def test_valid_reference(self):
"""Ensure valid reference reads properly.
"""
root = etree.Element('experiment')
ref = etree.SubElement(root, 'bibliographyLink')
ref.set('doi', '10.1016/j.ijhydene.2007.04.008')
ref.set('preferredKey', 'Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond'
)
with pytest.warns(UserWarning) as record:
ref = get_reference(root)
m = str(record.pop(UserWarning).message)
assert m == 'Using DOI to obtain reference information, rather than preferredKey.'
assert ref['doi'] == '10.1016/j.ijhydene.2007.04.008'
assert ref['journal'] == 'International Journal of Hydrogen Energy'
assert ref['year'] == 2007
assert ref['volume'] == 32
assert ref['pages'] == '2216-2226'
assert len(ref['authors']) == 4
assert {'name': 'N CHAUMEIX'} in ref['authors']
assert {'name': 'S PICHON'} in ref['authors']
assert {'name': 'F LAFOSSE'} in ref['authors']
assert {'name': 'C PAILLARD'} in ref['authors']
def test_missing_bibliography(self):
"""Test for completely missing bibliography element.
"""
root = etree.Element('experiment')
with pytest.raises(MissingElementError) as excinfo:
get_reference(root)
assert 'Error: required element bibliographyLink is missing' in str(excinfo.value)
def test_missing_doi(self):
"""Ensure can handle missing DOI.
"""
root = etree.Element('experiment')
ref = etree.SubElement(root, 'bibliographyLink')
ref.set('preferredKey', 'Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond'
)
with pytest.warns(UserWarning) as record:
ref = get_reference(root)
m = str(record.pop(UserWarning).message)
assert m == ('Missing doi attribute in bibliographyLink. Setting "detail" key as a '
'fallback; please update to the appropriate fields.')
assert ref['detail'] == ('Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond.'
)
def test_missing_doi_period_at_end(self):
"""Ensure can handle missing DOI with period at end of reference.
"""
root = etree.Element('experiment')
ref = etree.SubElement(root, 'bibliographyLink')
ref.set('preferredKey', 'Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond.'
)
with pytest.warns(UserWarning) as record:
ref = get_reference(root)
m = str(record.pop(UserWarning).message)
assert m == ('Missing doi attribute in bibliographyLink. Setting "detail" key as a '
'fallback; please update to the appropriate fields.')
assert ref['detail'] == ('Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond.'
)
def test_missing_preferredkey(self):
"""Ensure can handle DOI with missing ``preferredKey``.
"""
root = etree.Element('experiment')
ref = etree.SubElement(root, 'bibliographyLink')
ref.set('doi', '10.1016/j.ijhydene.2007.04.008')
ref = get_reference(root)
assert ref['doi'] == '10.1016/j.ijhydene.2007.04.008'
assert ref['journal'] == 'International Journal of Hydrogen Energy'
assert ref['year'] == 2007
assert ref['volume'] == 32
assert ref['pages'] == '2216-2226'
assert len(ref['authors']) == 4
assert {'name': 'N CHAUMEIX'} in ref['authors']
assert {'name': 'S PICHON'} in ref['authors']
assert {'name': 'F LAFOSSE'} in ref['authors']
assert {'name': 'C PAILLARD'} in ref['authors']
def test_incorrect_doi(self, capfd):
"""Ensure can handle invalid DOI.
"""
root = etree.Element('experiment')
ref = etree.SubElement(root, 'bibliographyLink')
ref.set('doi', '10.1000/invalid.doi')
ref.set('preferredKey', 'Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond'
)
with pytest.warns(UserWarning) as record:
ref = get_reference(root)
m = str(record.pop(UserWarning).message)
assert m == ('Missing doi attribute in bibliographyLink or lookup failed. Setting "detail" '
'key as a fallback; please update to the appropriate fields.')
assert ref['detail'] == (
'Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond.'
)
def test_incorrect_doi_period_at_end(self, capfd):
"""Ensure can handle invalid DOI with period at end of reference.
"""
root = etree.Element('experiment')
ref = etree.SubElement(root, 'bibliographyLink')
ref.set('doi', '10.1000/invalid.doi')
ref.set('preferredKey', 'Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond.'
)
with pytest.warns(UserWarning) as record:
ref = get_reference(root)
m = str(record.pop(UserWarning).message)
assert m == ('Missing doi attribute in bibliographyLink or lookup failed. Setting "detail" '
'key as a fallback; please update to the appropriate fields.')
assert ref['detail'] == (
'Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond.'
)
def test_doi_missing_internet(self, disable_socket):
"""Ensure that DOI validation fails gracefully with no Internet.
"""
root = etree.Element('experiment')
ref = etree.SubElement(root, 'bibliographyLink')
ref.set('doi', '10.1016/j.ijhydene.2007.04.008')
ref.set('preferredKey', 'Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond'
)
with pytest.warns(UserWarning) as record:
ref = get_reference(root)
m = str(record.pop(UserWarning).message)
assert m == ('Missing doi attribute in bibliographyLink or lookup failed. Setting "detail" '
'key as a fallback; please update to the appropriate fields.')
assert ref['detail'] == ('Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
'Fig. 12., right, open diamond.'
)
def test_missing_doi_preferredkey(self):
"""Ensure error if missing both DOI and ``preferredKey``.
"""
root = etree.Element('experiment')
ref = etree.SubElement(root, 'bibliographyLink')
ref.set('doi', '10.1000/invalid.doi')
with pytest.raises(KeywordError) as excinfo:
ref = get_reference(root)
assert ('DOI not found and preferredKey attribute not set' in str(excinfo.value))
def test_doi_missing_preferredkey(self):
"""Ensure error if missing ``preferredKey`` and not found DOI.
"""
root = etree.Element('experiment')
etree.SubElement(root, 'bibliographyLink')
with pytest.raises(MissingAttributeError) as excinfo:
get_reference(root)
assert ('Error: required attribute preferredKey of bibliographyLink '
'is missing.' in str(excinfo.value)
)
def test_doi_author_orcid(self):
"""Test proper addition of author ORCID if present.
"""
root = etree.Element('experiment')
ref = etree.SubElement(root, 'bibliographyLink')
ref.set('doi', '10.1016/j.cpc.2017.02.004')
ref = get_reference(root)
assert ref['doi'] == '10.1016/j.cpc.2017.02.004'
assert ref['journal'] == 'Computer Physics Communications'
assert ref['year'] == 2017
assert ref['volume'] == 215
assert ref['pages'] == '188-203'
assert len(ref['authors']) == 3
assert {'name': 'Kyle E. Niemeyer',
'ORCID': '0000-0003-4425-7097'
} in ref['authors']
assert {'name': 'Nicholas J. Curtis',
'ORCID': '0000-0002-0303-4711'
} in ref['authors']
assert {'name': 'Chih-Jen Sung'} in ref['authors']
class TestGetExperiment(object):
"""
"""
@pytest.mark.parametrize('apparatus', [
'shock tube', 'rapid compression machine',
])
def test_proper_experiment_types(self, apparatus):
"""Ensure proper validation of accepted experiment types.
"""
root = etree.Element('experiment')
exp = etree.SubElement(root, 'experimentType')
exp.text = 'Ignition delay measurement'
app = etree.SubElement(root, 'apparatus')
kind = etree.SubElement(app, 'kind')
kind.text = apparatus
ref = get_experiment_kind(root)
assert ref['experiment-type'] == 'ignition delay'
assert ref['apparatus']['kind'] == apparatus
@pytest.mark.parametrize('experiment_type', [
'Laminar flame speed measurement',
'Outlet concentration measurement',
'Concentration time profile measurement',
'Jet stirred reactor measurement',
'Burner stabilized flame speciation measurement',
])
def test_invalid_experiment_types(self, experiment_type):
"""Ensure unsupported types raise correct errors.
"""
root = etree.Element('experiment')
exp = etree.SubElement(root, 'experimentType')
exp.text = experiment_type
with pytest.raises(NotImplementedError) as excinfo:
get_experiment_kind(root)
assert experiment_type + ' not (yet) supported' in str(excinfo.value)
@pytest.mark.parametrize('apparatus', [
'perfectly stirred reactor', 'internal combustion engine', 'flow reactor'
])
def test_invalid_apparatus_types(self, apparatus):
"""Ensure unsupported apparatus types raise correct errors.
"""
root = etree.Element('experiment')
exp = etree.SubElement(root, 'experimentType')
exp.text = 'Ignition delay measurement'
app = etree.SubElement(root, 'apparatus')
kind = etree.SubElement(app, 'kind')
kind.text = apparatus
with pytest.raises(NotImplementedError) as excinfo:
get_experiment_kind(root)
assert apparatus + ' experiment not (yet) supported' in str(excinfo.value)
def test_missing_apparatus_kind(self):
"""Ensure proper error raised if missing apparatus kind.
"""
root = etree.Element('experiment')
exp = etree.SubElement(root, 'experimentType')
exp.text = 'Ignition delay measurement'
etree.SubElement(root, 'apparatus')
with pytest.raises(MissingElementError) as excinfo:
get_experiment_kind(root)
assert 'Error: required element apparatus/kind is missing.' in str(excinfo.value)
def test_missing_apparatus(self):
"""Ensure proper error raised if missing apparatus.
"""
root = etree.Element('experiment')
exp = etree.SubElement(root, 'experimentType')
exp.text = 'Ignition delay measurement'
with pytest.raises(MissingElementError) as excinfo:
get_experiment_kind(root)
assert 'Error: required element apparatus/kind is missing.' in str(excinfo.value)
class TestCommonProperties(object):
"""
"""
@pytest.mark.parametrize('physical_property, value, units', [
('pressure', '2.18', 'atm'),
('pressure', '700', 'Torr'),
('pressure', '700', 'torr'),
('pressure', '1', 'bar'),
('pressure', '1000', 'mbar'),
('temperature', '1000.0', 'K'),
('pressure rise', '0.10', '1/ms'),
])
def test_proper_common_properties(self, physical_property, value, units):
"""Ensure proper handling of correct common properties.
"""
root = etree.Element('experiment')
properties = etree.SubElement(root, 'commonProperties')
prop = etree.SubElement(properties, 'property')
prop.set('name', physical_property)
prop.set('units', units)
prop_value = etree.SubElement(prop, 'value')
prop_value.text = value
# not sure how else to handle this...
if units == 'Torr':
units = 'torr'
common = get_common_properties(root)
assert common[physical_property.replace(' ', '-')] == [' '.join([value, units])]
@pytest.mark.parametrize('physical_property, value, units', [
('pressure', '2.18', 'K'),
('temperature', '1000.0', 'Pa'),
('pressure rise', '0.10', 'ms'),
])
def test_common_property_invalid_units(self, physical_property, value, units):
"""Ensure error raised when improper units given for common properties.
"""
root = etree.Element('experiment')
properties = etree.SubElement(root, 'commonProperties')
prop = etree.SubElement(properties, 'property')
prop.set('name', physical_property)
prop.set('units', units)
prop_value = etree.SubElement(prop, 'value')
prop_value.text = value
with pytest.raises(KeywordError) as excinfo:
get_common_properties(root)
assert 'Error: units incompatible for property ' + physical_property in str(excinfo.value)
@pytest.mark.parametrize('composition_type', ['mole fraction', 'mass fraction'])
def test_proper_common_initial_composition(self, composition_type):
"""Ensure proper handling of initial composition common property.
"""
root = etree.Element('experiment')
properties = etree.SubElement(root, 'commonProperties')
initial_composition = etree.SubElement(properties, 'property')
initial_composition.set('name', 'initial composition')
species_refs = [{'name': 'H2', 'inchi': '1S/H2/h1H', 'amount': 0.00444},
{'name': 'O2', 'inchi': '1S/O2/c1-2', 'amount': 0.00566},
{'name': 'Ar', 'inchi': '1S/Ar', 'amount': 0.9899},
]
for spec in species_refs:
component = etree.SubElement(initial_composition, 'component')
species = etree.SubElement(component, 'speciesLink')
species.set('preferredKey', spec['name'])
species.set('InChI', spec['inchi'])
amount = etree.SubElement(component, 'amount')
amount.set('units', composition_type)
amount.text = str(spec['amount'])
common = get_common_properties(root)
assert common['composition']['kind'] == composition_type
assert len(common['composition']['species']) == 3
for spec_ref, spec in zip(species_refs, common['composition']['species']):
assert spec['species-name'] == spec_ref['name']
assert spec['InChI'] == spec_ref['inchi']
assert spec['amount'] == [spec_ref['amount']]
def test_common_property_invalid_property(self):
"""Ensure error raised when invalid property given in common properties.
"""
root = etree.Element('experiment')
properties = etree.SubElement(root, 'commonProperties')
prop = etree.SubElement(properties, 'property')
prop.set('name', 'compression time')
with pytest.raises(KeywordError) as excinfo:
get_common_properties(root)
assert 'Error: Property compression time not supported as common property.' in str(excinfo.value)
def test_species_missing_inchi(self, capfd):
"""Check for warning when species missing InChI.
"""
root = etree.Element('experiment')
properties = etree.SubElement(root, 'commonProperties')
initial_composition = etree.SubElement(properties, 'property')
initial_composition.set('name', 'initial composition')
component = etree.SubElement(initial_composition, 'component')
species = etree.SubElement(component, 'speciesLink')
species.set('preferredKey', 'H2')
amount = etree.SubElement(component, 'amount')
amount.set('units', 'mole fraction')
amount.text = '1.0'
with pytest.warns(UserWarning) as record:
get_common_properties(root)
m = str(record.pop(UserWarning).message)
assert m == 'Missing InChI for species H2'
def test_inconsistent_composition_type(self):
"""Check for error when inconsistent composition types.
"""
root = etree.Element('experiment')
properties = etree.SubElement(root, 'commonProperties')
initial_composition = etree.SubElement(properties, 'property')
initial_composition.set('name', 'initial composition')
component = etree.SubElement(initial_composition, 'component')
species = etree.SubElement(component, 'speciesLink')
species.set('preferredKey', 'H2')
species.set('InChI', '1S/H2/h1H')
amount = etree.SubElement(component, 'amount')
amount.set('units', 'mole fraction')
amount.text = '0.5'
component = etree.SubElement(initial_composition, 'component')
species = etree.SubElement(component, 'speciesLink')
species.set('preferredKey', 'O2')
species.set('InChI', '1S/O2/c1-2')
amount = etree.SubElement(component, 'amount')
amount.set('units', 'mass fraction')
amount.text = '0.5'
with pytest.raises(KeywordError) as excinfo:
get_common_properties(root)
assert ('Error: composition units mass fraction not consistent '
'with mole fraction'
) in str(excinfo.value)
def test_common_composition_units_ppm_ppb(self):
"""Test proper handling of common composition unit conversion for ppm and ppb.
"""
root = etree.Element('experiment')
properties = etree.SubElement(root, 'commonProperties')
initial_composition = etree.SubElement(properties, 'property')
initial_composition.set('name', 'initial composition')
species_refs = [{'name': 'H2', 'inchi': '1S/H2/h1H',
'amount': 100, 'units': 'ppb'
},
{'name': 'O2', 'inchi': '1S/O2/c1-2',
'amount': 10, 'units': 'ppm',
},
{'name': 'Ar', 'inchi': '1S/Ar',
'amount': 0.999985, 'units': 'mole fraction'},
]
for spec in species_refs:
component = etree.SubElement(initial_composition, 'component')
species = etree.SubElement(component, 'speciesLink')
species.set('preferredKey', spec['name'])
species.set('InChI', spec['inchi'])
amount = etree.SubElement(component, 'amount')
amount.set('units', spec['units'])
amount.text = str(spec['amount'])
with pytest.warns(UserWarning) as record:
common = get_common_properties(root)
m = str(record.pop(UserWarning).message)
assert m == 'Assuming molar ppb in composition and converting to mole fraction'
m = str(record.pop(UserWarning).message)
assert m == 'Assuming molar ppm in composition and converting to mole fraction'
assert common['composition']['kind'] == 'mole fraction'
assert len(common['composition']['species']) == 3
assert common['composition']['species'][0]['species-name'] == 'H2'
assert common['composition']['species'][0]['InChI'] == '1S/H2/h1H'
assert_allclose(common['composition']['species'][0]['amount'], [100.e-9])
assert common['composition']['species'][1]['species-name'] == 'O2'
assert common['composition']['species'][1]['InChI'] == '1S/O2/c1-2'
assert_allclose(common['composition']['species'][1]['amount'], [10.e-6])
assert common['composition']['species'][2]['species-name'] == 'Ar'
assert common['composition']['species'][2]['InChI'] == '1S/Ar'
assert_allclose(common['composition']['species'][2]['amount'], [0.999985])
def test_common_composition_units_percent(self):
"""Test proper handling of common composition unit conversion for (mole) percent.
"""
root = etree.Element('experiment')
properties = etree.SubElement(root, 'commonProperties')
initial_composition = etree.SubElement(properties, 'property')
initial_composition.set('name', 'initial composition')
species_refs = [{'name': 'Ar', 'inchi': '1S/Ar', 'amount': 1.0, 'units': 'percent'}]
for spec in species_refs:
component = etree.SubElement(initial_composition, 'component')
species = etree.SubElement(component, 'speciesLink')
species.set('preferredKey', spec['name'])
species.set('InChI', spec['inchi'])
amount = etree.SubElement(component, 'amount')
amount.set('units', spec['units'])
amount.text = str(spec['amount'])
with pytest.warns(UserWarning) as record:
common = get_common_properties(root)
m = str(record.pop(UserWarning).message)
assert m == 'Assuming percent in composition means mole percent'
assert common['composition']['kind'] == 'mole percent'
assert len(common['composition']['species']) == 1
assert common['composition']['species'][0]['species-name'] == 'Ar'
assert common['composition']['species'][0]['InChI'] == '1S/Ar'
assert_allclose(common['composition']['species'][0]['amount'], [1.0])
def test_common_composition_units_error(self):
"""Test error for inappropriate common composition units.
"""
root = etree.Element('experiment')
properties = etree.SubElement(root, 'commonProperties')
initial_composition = etree.SubElement(properties, 'property')
initial_composition.set('name', 'initial composition')
species_refs = [{'name': 'H2', 'inchi': '1S/H2/h1H',
'amount': 100, 'units': 'grams'
},
]
for spec in species_refs:
component = etree.SubElement(initial_composition, 'component')
species = etree.SubElement(component, 'speciesLink')
species.set('preferredKey', spec['name'])
species.set('InChI', spec['inchi'])
amount = etree.SubElement(component, 'amount')
amount.set('units', spec['units'])
amount.text = str(spec['amount'])
with pytest.raises(KeywordError) as excinfo:
get_common_properties(root)
assert ('Composition units need to be one of: mole fraction, '
'mass fraction, mole percent, percent, ppm, or ppb.') in str(excinfo.value)
class TestIgnitionType(object):
"""
"""
@pytest.mark.parametrize('ignition_target',
['P', 'T', 'OH', 'OH*', 'CH*', 'CH', 'OHEX', 'CHEX']
)
@pytest.mark.parametrize('ignition_type', ['max', 'd/dt max', '1/2 max', 'min', 'baseline max intercept from d/dt'])
def test_valid_ignition_types(self, ignition_target, ignition_type):
"""Check for proper parsing of valid ignition types.
"""
root = etree.Element('experiment')
ignition = etree.SubElement(root, 'ignitionType')
ignition.set('target', ignition_target)
ignition.set('type', ignition_type)
ignition = get_ignition_type(root)
def test_missing_attributes(self):
"""Check for error upon missing attributes
"""
root = etree.Element('experiment')
with pytest.raises(MissingElementError) as excinfo:
ignition = get_ignition_type(root)
assert 'Error: required element ignitionType is missing.' in str(excinfo.value)
root = etree.Element('experiment')
ignition = etree.SubElement(root, 'ignitionType')
ignition.set('target', 'P')
with pytest.raises(MissingAttributeError) as excinfo:
ignition = get_ignition_type(root)
assert 'Error: required attribute type of ignitionType is missing.' in str(excinfo.value)
root = etree.Element('experiment')
ignition = etree.SubElement(root, 'ignitionType')
ignition.set('type', 'max')
with pytest.raises(MissingAttributeError) as excinfo:
ignition = get_ignition_type(root)
assert 'Error: required attribute target of ignitionType is missing.' in str(excinfo.value)
@pytest.mark.parametrize('ignition_type',
['baseline min intercept from d/dt',
'concentration', 'relative concentration'
])
def test_unsupported_ignition_types(self, ignition_type):
"""Check error returned for unsupported/invalid ignition types.
"""
root = etree.Element('experiment')
ignition = etree.SubElement(root, 'ignitionType')
ignition.set('target', 'P')
ignition.set('type', ignition_type)
with pytest.raises(KeywordError) as excinfo:
ignition = get_ignition_type(root)
assert 'Error: ' + ignition_type + ' not valid ignition type' in str(excinfo.value)
@pytest.mark.parametrize('ignition_target', ['O2', 'CO', 'density'])
def test_unsupported_ignition_targets(self, ignition_target):
"""Check error returned for unsupported/invalid ignition targets.
"""
root = etree.Element('experiment')
ignition = etree.SubElement(root, 'ignitionType')
ignition.set('target', ignition_target)
ignition.set('type', 'max')
with pytest.raises(KeywordError) as excinfo:
ignition = get_ignition_type(root)
assert ('Error: ' + ignition_target.upper() + ' not valid ignition target'
in str(excinfo.value)
)
def test_multiple_targets(self):
"""Check for error with multiple ignition targets.
"""
root = etree.Element('experiment')
ignition = etree.SubElement(root, 'ignitionType')
ignition.set('target', 'OH;CH')
ignition.set('type', 'max')
with pytest.raises(NotImplementedError) as excinfo:
ignition = get_ignition_type(root)
assert 'Multiple ignition targets not supported.' in str(excinfo.value)
class TestGetDatapoints(object):
"""
"""
def test_valid_datapoints_single_datagroup(self):
"""Test valid parsing of datapoints when in a single dataGroup.
"""
root = etree.Element('experiment')
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'ignition delay')
prop.set('units', 'us')
num_points = 10
temps = numpy.random.uniform(low=300.0, high=1000.0, size=(num_points,))
ignition_delays = numpy.random.uniform(low=100., high=700., size=(num_points,))
for temp, ignition_delay in zip(temps, ignition_delays):
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(temp)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(ignition_delay)
datapoints = get_datapoints(root)
assert len(datapoints) == num_points
for datapoint, temp, ignition_delay in zip(datapoints, temps, ignition_delays):
assert datapoint['temperature'] == [str(temp) + ' K']
assert datapoint['ignition-delay'] == [str(ignition_delay) + ' us']
def test_valid_datapoints_two_datagroup(self):
"""Test valid parsing of datapoints when in a two dataGroups.
"""
root = etree.Element('experiment')
apparatus = etree.SubElement(root, 'apparatus')
kind = etree.SubElement(apparatus, 'kind')
kind.text = 'rapid compression machine'
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'ignition delay')
prop.set('units', 'us')
temp = numpy.random.uniform(low=300.0, high=1000.0)
ignition_delay = numpy.random.uniform(low=100., high=700.)
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(temp)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(ignition_delay)
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x4')
prop.set('name', 'time')
prop.set('units', 's')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x5')
prop.set('name', 'volume')
prop.set('units', 'cm3')
num_points = 100
times = numpy.linspace(0., 10.e-2, num_points)
volumes = numpy.cos(times * 20. * numpy.pi)
for time, volume in zip(times, volumes):
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x4')
x1.text = str(time)
x2 = etree.SubElement(datapoint, 'x5')
x2.text = str(volume)
datapoints = get_datapoints(root)
assert len(datapoints) == 1
datapoint = datapoints[0]
assert datapoint['temperature'] == [str(temp) + ' K']
assert datapoint['ignition-delay'] == [str(ignition_delay) + ' us']
volume_history = datapoint['time-histories'][0]
assert len(volume_history['values']) == num_points
assert volume_history['time']['units'] == 's'
assert volume_history['time']['column'] == 0
assert volume_history['quantity']['units'] == 'cm3'
assert volume_history['quantity']['column'] == 1
for datapoint, time, volume in zip(volume_history['values'], times, volumes):
assert datapoint == [float(str(time)), float(str(volume))]
def test_missing_datagroup_property_datapoint(self):
"""Raise error when missing a dataGroup, property, or dataPoint.
"""
root = etree.Element('experiment')
with pytest.raises(MissingElementError) as excinfo:
get_datapoints(root)
assert 'Error: required element dataGroup is missing.' in str(excinfo.value)
datagroup = etree.SubElement(root, 'dataGroup')
with pytest.raises(MissingElementError) as excinfo:
get_datapoints(root)
assert 'Error: required element property is missing.' in str(excinfo.value)
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
with pytest.raises(MissingElementError) as excinfo:
get_datapoints(root)
assert 'Error: required element dataPoint is missing.' in str(excinfo.value)
def test_datapoint_invalid_property(self):
"""Raise error when invalid property for a ``dataPoint``.
"""
root = etree.Element('experiment')
exp = etree.SubElement(root, 'experimentType')
exp.text = 'Ignition delay measurement'
app = etree.SubElement(root, 'apparatus')
kind = etree.SubElement(app, 'kind')
kind.text = 'shock tube'
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'compression time')
prop.set('units', 'ms')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(30.0)
datagroup = etree.SubElement(root, 'dataGroup')
with pytest.raises(KeyError) as excinfo:
get_datapoints(root)
assert 'compression time not valid dataPoint property' in str(excinfo.value)
def test_datapoint_extra_value(self):
"""Raise error when value without associated property definition
"""
root = etree.Element('experiment')
exp = etree.SubElement(root, 'experimentType')
exp.text = 'Ignition delay measurement'
app = etree.SubElement(root, 'apparatus')
kind = etree.SubElement(app, 'kind')
kind.text = 'shock tube'
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(1000.0)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(100.0)
with pytest.raises(KeywordError) as excinfo:
get_datapoints(root)
assert 'value missing from properties: x2' in str(excinfo.value)
def test_time_history_extra_property(self):
"""Ensure error when extra property in volume history dataGroup.
"""
root = etree.Element('experiment')
apparatus = etree.SubElement(root, 'apparatus')
kind = etree.SubElement(apparatus, 'kind')
kind.text = 'rapid compression machine'
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'ignition delay')
prop.set('units', 'us')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(1000.0)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(100.0)
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x3')
prop.set('name', 'time')
prop.set('units', 's')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x4')
prop.set('name', 'volume')
prop.set('units', 'cm3')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x5')
prop.set('name', 'not allowed property')
prop.set('units', 'Pa')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x3 = etree.SubElement(datapoint, 'x3')
x3.text = str(0.0)
x4 = etree.SubElement(datapoint, 'x4')
x4.text = str(50.0)
x5 = etree.SubElement(datapoint, 'x5')
x5.text = str(101325.0)
with pytest.raises(KeywordError) as excinfo:
get_datapoints(root)
assert ('Only volume, temperature, pressure, and time are allowed in a time-history '
'dataGroup.') in str(excinfo.value)
# remove bad property description, but retain bad extra dataPoint value
datagroup.remove(prop)
with pytest.raises(KeywordError) as excinfo:
get_datapoints(root)
assert ('Value tag {} not found in dataGroup tags: {}'.format('x5', ['x4'])
in str(excinfo.value))
def test_volume_history_missing_property(self):
"""Ensure error when missing property in volume history dataGroup.
"""
root = etree.Element('experiment')
apparatus = etree.SubElement(root, 'apparatus')
kind = etree.SubElement(apparatus, 'kind')
kind.text = 'rapid compression machine'
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'ignition delay')
prop.set('units', 'us')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(1000.0)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(100.0)
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x3')
prop.set('name', 'time')
prop.set('units', 's')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x3 = etree.SubElement(datapoint, 'x3')
x3.text = str(0.0)
with pytest.raises(KeywordError) as excinfo:
get_datapoints(root)
assert ('Both time and quantity properties required for time-history.' in str(excinfo.value))
# try the same with volume, and time missing
datagroup.remove(prop)
datagroup.remove(datapoint)
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x4')
prop.set('name', 'volume')
prop.set('units', 'cm3')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x3 = etree.SubElement(datapoint, 'x4')
x3.text = str(50.0)
with pytest.raises(KeywordError) as excinfo:
get_datapoints(root)
assert ('Both time and quantity properties required for time-history.' in str(excinfo.value))
def test_volume_history_missing_value(self):
"""Ensure error when missing value in volume history dataGroup.
"""
root = etree.Element('experiment')
apparatus = etree.SubElement(root, 'apparatus')
kind = etree.SubElement(apparatus, 'kind')
kind.text = 'rapid compression machine'
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'ignition delay')
prop.set('units', 'us')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(1000.0)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(100.0)
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x3')
prop.set('name', 'time')
prop.set('units', 's')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x4')
prop.set('name', 'volume')
prop.set('units', 'cm3')
# Have time, but missing volume
datapoint = etree.SubElement(datagroup, 'dataPoint')
x3 = etree.SubElement(datapoint, 'x3')
x3.text = str(0.0)
with pytest.raises(KeywordError) as excinfo:
get_datapoints(root)
assert ('Both time and quantity values required in each time-history dataPoint.'
in str(excinfo.value))
# try again with volume, but missing time
datapoint.remove(x3)
x4 = etree.SubElement(datapoint, 'x4')
x4.text = str(50.0)
with pytest.raises(KeywordError) as excinfo:
get_datapoints(root)
assert ('Both time and quantity values required in each time-history dataPoint.'
in str(excinfo.value))
@pytest.mark.parametrize('type, value', [
('mole fraction', 1.0),
('mass fraction', 1.0),
('mole percent', 100.0),
])
@pytest.mark.filterwarnings('ignore:Missing InChI for species H2')
def test_datapoints_composition(self, type, value):
"""Test valid parsing of datapoints with composition.
"""
root = etree.Element('experiment')
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'ignition delay')
prop.set('units', 'us')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x3')
prop.set('name', 'composition')
prop.set('units', type)
specieslink = etree.SubElement(prop, 'speciesLink')
specieslink.set('preferredKey', 'H2')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(1000.0)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(100.0)
x3 = etree.SubElement(datapoint, 'x3')
x3.text = str(value)
datapoints = get_datapoints(root)
assert len(datapoints) == 1
datapoint = datapoints[0]
assert datapoint['temperature'] == [str(1000.0) + ' K']
assert datapoint['ignition-delay'] == [str(100.0) + ' us']
assert datapoint['composition']['kind'] == type
assert datapoint['composition']['species'][0] == {'amount': [value],
'species-name': 'H2',
'InChI': None
}
@pytest.mark.parametrize('kind, value', [
('percent', 100.0),
('ppm', 1.0),
('ppb', 1.0),
])
def test_datapoints_composition_warning(self, kind, value):
"""Test valid parsing of datapoints with composition with warnings.
"""
root = etree.Element('experiment')
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'ignition delay')
prop.set('units', 'us')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x3')
prop.set('name', 'composition')
prop.set('units', kind)
specieslink = etree.SubElement(prop, 'speciesLink')
specieslink.set('preferredKey', 'H2')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(1000.0)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(100.0)
x3 = etree.SubElement(datapoint, 'x3')
x3.text = str(value)
with pytest.warns(UserWarning) as record:
datapoints = get_datapoints(root)
m = str(record.pop(UserWarning).message)
assert m == 'Missing InChI for species H2'
m = str(record.pop(UserWarning).message)
if kind == 'percent':
assert m == 'Assuming percent in composition means mole percent'
kind = 'mole percent'
elif kind == 'ppm':
assert m == 'Assuming molar ppm in composition and converting to mole fraction'
kind = 'mole fraction'
value *= 1e-6
elif kind == 'ppb':
assert m == 'Assuming molar ppb in composition and converting to mole fraction'
kind = 'mole fraction'
value *= 1e-9
assert len(datapoints) == 1
datapoint = datapoints[0]
assert datapoint['temperature'] == [str(1000.0) + ' K']
assert datapoint['ignition-delay'] == [str(100.0) + ' us']
assert datapoint['composition']['kind'] == kind
assert datapoint['composition']['species'][0] == {'amount': [value],
'species-name': 'H2',
'InChI': None
}
def test_datapoints_composition_error(self):
"""Test valid parsing of datapoints with improper unit error.
"""
root = etree.Element('experiment')
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'ignition delay')
prop.set('units', 'us')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x3')
prop.set('name', 'composition')
prop.set('units', 'grams')
specieslink = etree.SubElement(prop, 'speciesLink')
specieslink.set('preferredKey', 'H2')
specieslink.set('InChI', '1S/H2/h1H')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(1000.0)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(100.0)
x3 = etree.SubElement(datapoint, 'x3')
x3.text = str(10.0)
with pytest.raises(KeywordError) as excinfo:
get_datapoints(root)
assert ('Error: composition units need to be one of: mole fraction, '
'mass fraction, mole percent, percent, ppm, or ppb.'
) in str(excinfo.value)
def test_datapoints_inconsistent_composition_error(self):
"""Test error raised for datapoint with inconsistent composition type.
"""
root = etree.Element('experiment')
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'temperature')
prop.set('units', 'K')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'ignition delay')
prop.set('units', 'us')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x3')
prop.set('name', 'composition')
prop.set('units', 'mass fraction')
specieslink = etree.SubElement(prop, 'speciesLink')
specieslink.set('preferredKey', 'H2')
specieslink.set('InChI', '1S/H2/h1H')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x4')
prop.set('name', 'composition')
prop.set('units', 'mole fraction')
specieslink = etree.SubElement(prop, 'speciesLink')
specieslink.set('preferredKey', 'O2')
specieslink.set('InChI', '1S/O2/c1-2')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(1000.0)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(100.0)
x3 = etree.SubElement(datapoint, 'x3')
x3.text = str(0.5)
x3 = etree.SubElement(datapoint, 'x4')
x3.text = str(0.5)
with pytest.raises(KeywordError) as excinfo:
get_datapoints(root)
assert ('Error: composition units mole fraction not consistent with '
'mass fraction'
) in str(excinfo.value)
class TestConvertReSpecTh(object):
"""
"""
@pytest.mark.parametrize('filename_xml', ['testfile_st.xml', 'testfile_rcm.xml'])
@pytest.mark.filterwarnings('ignore:Using DOI')
def test_valid_conversion(self, filename_xml):
"""Test proper conversion of ReSpecTh files.
"""
file_path = os.path.join(filename_xml)
filename = pkg_resources.resource_filename(__name__, file_path)
file_author = 'Kyle Niemeyer'
file_author_orcid = '0000-0003-4425-7097'
# Skip all the validation because we know the test files are correct and we're not
# testing the validation methods here
properties = ReSpecTh_to_ChemKED(filename, file_author, file_author_orcid, validate=False)
c = ChemKED(dict_input=properties, skip_validation=True)
# compare with ChemKED file of same experiment
file_path = os.path.join(os.path.splitext(filename_xml)[0] + '.yaml')
filename = pkg_resources.resource_filename(__name__, file_path)
c_true = ChemKED(yaml_file=filename, skip_validation=True)
assert c.file_authors[1]['name'] == file_author
assert c.file_authors[1]['ORCID'] == file_author_orcid
assert c.reference.detail == 'Converted from ReSpecTh XML file {}'.format(filename_xml)
assert c.apparatus.kind == c_true.apparatus.kind
assert c.experiment_type == c_true.experiment_type
assert c.reference.doi == c_true.reference.doi
assert len(c.datapoints) == len(c_true.datapoints)
@pytest.mark.filterwarnings('ignore:Using DOI')
def test_error_rcm_pressurerise(self):
"""Test for appropriate error if RCM file has pressure rise.
"""
file_path = os.path.join('testfile_rcm.xml')
filename = pkg_resources.resource_filename(__name__, file_path)
# add pressure rise to common properties
tree = etree.parse(filename)
root = tree.getroot()
properties = root.find('commonProperties')
prop = etree.SubElement(properties, 'property')
prop.set('name', 'pressure rise')
prop.set('units', '1/ms')
prop_value = etree.SubElement(prop, 'value')
prop_value.text = '0.10'
# write new file, and try to load
et = etree.ElementTree(root)
with TemporaryDirectory() as temp_dir:
filename = os.path.join(temp_dir, 'test.xml')
et.write(filename, encoding='utf-8', xml_declaration=True)
with pytest.raises(KeywordError) as excinfo:
ReSpecTh_to_ChemKED(filename)
assert 'Pressure rise cannot be defined for RCM.' in str(excinfo.value)
@pytest.mark.filterwarnings('ignore:Using DOI')
def test_error_st_volumehistory(self):
"""Test for appropriate error if shock tube file has volume history.
"""
file_path = os.path.join('testfile_st.xml')
filename = pkg_resources.resource_filename(__name__, file_path)
tree = etree.parse(filename)
root = tree.getroot()
datagroup = etree.SubElement(root, 'dataGroup')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x1')
prop.set('name', 'time')
prop.set('units', 's')
prop = etree.SubElement(datagroup, 'property')
prop.set('id', 'x2')
prop.set('name', 'volume')
prop.set('units', 'cm3')
datapoint = etree.SubElement(datagroup, 'dataPoint')
x1 = etree.SubElement(datapoint, 'x1')
x1.text = str(0.0)
x2 = etree.SubElement(datapoint, 'x2')
x2.text = str(10.0)
# write new file, and try to load
et = etree.ElementTree(root)
with TemporaryDirectory() as temp_dir:
filename = os.path.join(temp_dir, 'test.xml')
et.write(filename, encoding='utf-8', xml_declaration=True)
with pytest.raises(KeywordError) as excinfo:
ReSpecTh_to_ChemKED(filename)
assert 'Volume history cannot be defined for shock tube.' in str(excinfo.value)
@pytest.mark.filterwarnings('ignore:Using DOI')
def test_author_orcid_no_name(self):
"""Test that passing an ORCID to the conversion without a name raises an error
"""
file_path = os.path.join('testfile_st.xml')
filename = pkg_resources.resource_filename(__name__, file_path)
file_author_orcid = '0000-0003-4425-7097'
# Skip all the validation because we know the test files are correct and we're not
# testing the validation methods here
with pytest.raises(KeywordError) as e:
ReSpecTh_to_ChemKED(filename, file_author_orcid=file_author_orcid)
assert 'If file_author_orcid is specified, file_author must be as well' in str(e.value)
@pytest.mark.filterwarnings('ignore:Using DOI')
def test_file_author_only(self):
"""Test that passing the file author only works properly
"""
file_path = os.path.join('testfile_st.xml')
filename = pkg_resources.resource_filename(__name__, file_path)
file_author = 'Kyle Niemeyer'
# Skip all the validation because we know the test files are correct and we're not
# testing the validation methods here
properties = ReSpecTh_to_ChemKED(filename, file_author, validate=False)
c = ChemKED(dict_input=properties, skip_validation=True)
assert c.file_authors[1]['name'] == file_author
assert c.file_authors[1].get('ORCID', None) is None
class TestConverterMain(object):
"""
"""
def test_conversion_main_xml_to_yaml(self):
"""Test detection in converter for xml->yaml
"""
file_path = os.path.join('testfile_st.xml')
filename = pkg_resources.resource_filename(__name__, file_path)
file_author = 'Kyle E Niemeyer'
file_author_orcid = '0000-0003-4425-7097'
with TemporaryDirectory() as temp_dir:
newfile = os.path.join(temp_dir, 'test.yaml')
with pytest.warns(UserWarning) as record:
main(['-i', filename, '-o', newfile, '-fa', file_author, '-fo', file_author_orcid])
c = ChemKED(yaml_file=newfile)
m = str(record.pop(UserWarning).message)
assert m == 'Using DOI to obtain reference information, rather than preferredKey.'
true_yaml = pkg_resources.resource_filename(__name__, os.path.join('testfile_st.yaml'))
c_true = ChemKED(yaml_file=true_yaml)
assert c.file_authors[0]['name'] == c_true.file_authors[0]['name']
assert c.file_authors[1]['name'] == file_author
assert c.file_authors[1]['ORCID'] == file_author_orcid
assert c.reference.detail == 'Converted from ReSpecTh XML file {}'.format(file_path)
assert c.apparatus.kind == c_true.apparatus.kind
assert c.experiment_type == c_true.experiment_type
assert c.reference.doi == c_true.reference.doi
assert len(c.datapoints) == len(c_true.datapoints)
def test_conversion_main_yaml_to_xml(self):
"""Test detection in converter for yaml->xml
"""
file_path = os.path.join('testfile_st.yaml')
filename = pkg_resources.resource_filename(__name__, file_path)
fa_name = 'Kyle Niemeyer'
fa_orcid = '0000-0003-4425-7097'
with TemporaryDirectory() as temp_dir:
newfile = os.path.join(temp_dir, 'test.xml')
main(['-i', filename, '-o', newfile, '-fa', fa_name, '-fo', fa_orcid])
assert os.path.exists(newfile)
def test_conversion_respth2ck_default_output(self):
"""Test respth2ck converter when used via command-line arguments.
"""
file_path = os.path.join('testfile_st.xml')
filename = pkg_resources.resource_filename(__name__, file_path)
with TemporaryDirectory() as temp_dir:
xml_file = copy(filename, temp_dir)
with pytest.warns(UserWarning) as record:
respth2ck(['-i', xml_file])
newfile = os.path.join(os.path.splitext(xml_file)[0] + '.yaml')
assert os.path.exists(newfile)
m = str(record.pop(UserWarning).message)
assert m == 'Using DOI to obtain reference information, rather than preferredKey.'
def test_conversion_respth2ck_with_output(self):
"""Test respth2ck converter when used via command-line arguments.
"""
file_path = os.path.join('testfile_st.xml')
filename = pkg_resources.resource_filename(__name__, file_path)
with TemporaryDirectory() as temp_dir:
newfile = os.path.join(temp_dir, 'test.yaml')
with pytest.warns(UserWarning) as record:
respth2ck(['-i', filename, '-o', newfile])
assert os.path.exists(newfile)
m = str(record.pop(UserWarning).message)
assert m == 'Using DOI to obtain reference information, rather than preferredKey.'
def test_conversion_ck2respth(self):
"""Test ck2respth converter when used via command-line arguments.
"""
file_path = os.path.join('testfile_st.yaml')
filename = pkg_resources.resource_filename(__name__, file_path)
with TemporaryDirectory() as temp_dir:
newfile = os.path.join(temp_dir, 'test.xml')
ck2respth(['-i', filename, '-o', newfile])
assert os.path.exists(newfile)
def test_conversion_invalid_xml_xml(self):
"""Test converter main raises errors when two xml files are passed.
"""
file_path = os.path.join('testfile_st.xml')
filename = pkg_resources.resource_filename(__name__, file_path)
with pytest.raises(KeywordError) as excinfo:
main(['-i', filename, '-o', 'test.xml'])
assert 'Cannot convert .xml to .xml' in str(excinfo.value)
def test_conversion_invalid_yaml_yaml(self):
"""Test converter main raises errors when two yaml files are passed.
"""
file_path = os.path.join('testfile_st.yaml')
filename = pkg_resources.resource_filename(__name__, file_path)
with pytest.raises(KeywordError) as excinfo:
main(['-i', filename, '-o', 'test.yaml'])
assert 'Cannot convert .yaml to .yaml' in str(excinfo.value)
def test_conversion_invalid_file_type(self):
"""Test converter main raises errors when an invalid file extension is passed.
"""
file_path = os.path.join('dataframe_st.csv')
filename = pkg_resources.resource_filename(__name__, file_path)
with pytest.raises(KeywordError) as excinfo:
main(['-i', filename, '-o', 'test.py'])
assert 'Input/output args need to be .xml/.yaml' in str(excinfo.value)
| 42.075658
| 120
| 0.605817
| 7,032
| 63,955
| 5.418231
| 0.071672
| 0.081888
| 0.031915
| 0.032073
| 0.796436
| 0.761004
| 0.730112
| 0.700585
| 0.667594
| 0.643789
| 0
| 0.021435
| 0.266156
| 63,955
| 1,519
| 121
| 42.103357
| 0.790382
| 0.075537
| 0
| 0.691564
| 0
| 0
| 0.222438
| 0.003408
| 0
| 0
| 0
| 0
| 0.144112
| 1
| 0.056239
| false
| 0
| 0.012302
| 0
| 0.07645
| 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
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
88c15f3a68607446b0114ed83a0348b838a92d0b
| 76
|
py
|
Python
|
Chapter03/main_funct.py
|
PacktPublishing/Secret-Recipes-of-the-Python-Ninja
|
805d00c7a54927ba94c9077e9a580508ee3c5e56
|
[
"MIT"
] | 13
|
2018-06-21T01:44:49.000Z
|
2021-12-01T10:49:53.000Z
|
Chapter03/main_funct.py
|
PacktPublishing/Secret-Recipes-of-the-Python-Ninja
|
805d00c7a54927ba94c9077e9a580508ee3c5e56
|
[
"MIT"
] | null | null | null |
Chapter03/main_funct.py
|
PacktPublishing/Secret-Recipes-of-the-Python-Ninja
|
805d00c7a54927ba94c9077e9a580508ee3c5e56
|
[
"MIT"
] | 6
|
2018-10-05T08:29:24.000Z
|
2022-01-11T14:49:50.000Z
|
def a_funct():
text = "I am the original function call"
return text
| 19
| 44
| 0.657895
| 12
| 76
| 4.083333
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.263158
| 76
| 3
| 45
| 25.333333
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0.407895
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
0032a22f27a1f5a2d66505a6105f9b59923ec938
| 125
|
py
|
Python
|
ocean-world-wechat/oceanworldapp/OrderModel/admin.py
|
l2m2/dirty-projects
|
e3bff1f829e20b78462e3e91ab094cfad2f1a692
|
[
"MIT"
] | 1
|
2020-06-04T00:54:00.000Z
|
2020-06-04T00:54:00.000Z
|
ocean-world-wechat/oceanworldapp/OrderModel/admin.py
|
l2m2/dirty-projects
|
e3bff1f829e20b78462e3e91ab094cfad2f1a692
|
[
"MIT"
] | null | null | null |
ocean-world-wechat/oceanworldapp/OrderModel/admin.py
|
l2m2/dirty-projects
|
e3bff1f829e20b78462e3e91ab094cfad2f1a692
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from OrderModel.models import Order
# Register your models here.
admin.site.register(Order)
| 25
| 35
| 0.824
| 18
| 125
| 5.722222
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.112
| 125
| 5
| 36
| 25
| 0.927928
| 0.208
| 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
| 0
| 0
|
0
| 4
|
003b28e0cb772543894e0c1e588890d20626510d
| 29
|
py
|
Python
|
thermo-env/lib/python3.5/types.py
|
ndebuhr/thermoModelingAlpha
|
9e1a0f9ac4caabf386c1e3103ec69f269131a6b9
|
[
"MIT"
] | 4
|
2017-09-24T21:30:46.000Z
|
2019-06-01T13:37:44.000Z
|
thermo-env/lib/python3.5/types.py
|
ndebuhr/thermo-state-solver
|
9e1a0f9ac4caabf386c1e3103ec69f269131a6b9
|
[
"MIT"
] | 19
|
2020-01-28T21:41:50.000Z
|
2022-03-11T23:17:39.000Z
|
thermo-env/lib/python3.5/types.py
|
ndebuhr/thermo-state-solver
|
9e1a0f9ac4caabf386c1e3103ec69f269131a6b9
|
[
"MIT"
] | null | null | null |
/usr/lib64/python3.5/types.py
| 29
| 29
| 0.793103
| 6
| 29
| 3.833333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137931
| 0
| 29
| 1
| 29
| 29
| 0.655172
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
003c33af7c58295555612f94c24bcad5608fef68
| 997
|
py
|
Python
|
detect/__init__.py
|
oeg-upm/ttla
|
ab1cc5a2777b3d4fb905f4452379f469153c904b
|
[
"Apache-2.0"
] | null | null | null |
detect/__init__.py
|
oeg-upm/ttla
|
ab1cc5a2777b3d4fb905f4452379f469153c904b
|
[
"Apache-2.0"
] | 5
|
2019-04-03T12:58:29.000Z
|
2021-06-02T00:18:34.000Z
|
detect/__init__.py
|
oeg-upm/bob
|
ab1cc5a2777b3d4fb905f4452379f469153c904b
|
[
"Apache-2.0"
] | null | null | null |
from loader import *
from Detection import get_num_kind, get_kind_and_nums
#__all__ = ['get_num_kind', 'get_kind_and_nums']
# import pandas as pd
#
# CATEGORICAL = 'categorical'
# UNKNOWN = 'unknown'
#
#
# def detect_column_types(file_dir):
# """
# :param file_dir: the location of the data file
# :return: the list of types
# """
# from categorical import is_categorical
#
# funcs_and_types = {
# CATEGORICAL: is_categorical,
# }
#
# ext = file_dir[-4:]
# if ext == ".csv":
# df = pd.read_csv(file_dir)
# else:
# df = None
#
# types = []
# if df is not None:
# for col in df:
# known = False
# for data_type in funcs_and_types.keys():
# if funcs_and_types[data_type](df[col]):
# types.append(data_type)
# known = True
# break
# if not known:
# types.append(UNKNOWN)
#
# return types
| 24.317073
| 57
| 0.540622
| 119
| 997
| 4.260504
| 0.411765
| 0.055227
| 0.076923
| 0.051282
| 0.094675
| 0.094675
| 0.094675
| 0
| 0
| 0
| 0
| 0.001534
| 0.346038
| 997
| 40
| 58
| 24.925
| 0.776074
| 0.849549
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
cc401ad766f39fb5b8f1b25e0dfa6a67b7d9089e
| 94
|
py
|
Python
|
src/properties/admin.py
|
KaustubhKekre/homeland
|
4fad8946498ed40050d9efef14dc85a958452bcb
|
[
"MIT"
] | null | null | null |
src/properties/admin.py
|
KaustubhKekre/homeland
|
4fad8946498ed40050d9efef14dc85a958452bcb
|
[
"MIT"
] | null | null | null |
src/properties/admin.py
|
KaustubhKekre/homeland
|
4fad8946498ed40050d9efef14dc85a958452bcb
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Property
admin.site.register(Property)
| 15.666667
| 32
| 0.819149
| 13
| 94
| 5.923077
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117021
| 94
| 5
| 33
| 18.8
| 0.927711
| 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
| 0
| 0
|
0
| 4
|
cc65c88e81f491415bbb9679f349714a7f7716b2
| 48
|
py
|
Python
|
gorgona/preprocessor/default.py
|
theseus-automl/gorgona
|
a7366d54430caa5a038488432fb93702e1cb83b8
|
[
"Apache-2.0"
] | 1
|
2021-12-12T10:47:00.000Z
|
2021-12-12T10:47:00.000Z
|
gorgona/preprocessor/default.py
|
theseus-automl/gorgona
|
a7366d54430caa5a038488432fb93702e1cb83b8
|
[
"Apache-2.0"
] | 5
|
2021-12-12T10:45:04.000Z
|
2022-01-17T07:51:14.000Z
|
gorgona/preprocessor/default.py
|
theseus-automl/gorgona
|
a7366d54430caa5a038488432fb93702e1cb83b8
|
[
"Apache-2.0"
] | null | null | null |
class Defaults:
repl = ''
join_on = ' '
| 12
| 17
| 0.5
| 5
| 48
| 4.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.354167
| 48
| 3
| 18
| 16
| 0.741935
| 0
| 0
| 0
| 0
| 0
| 0.020833
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 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
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
cca13af6fb5bf4336e777c5eae055841637ccc1e
| 41
|
py
|
Python
|
arg_ranker/__init__.py
|
caozhichongchong/arg_ranker
|
9b4c8da6ebc433c37788ec2eb4edb84b3e558d5a
|
[
"MIT"
] | 11
|
2020-05-06T19:25:20.000Z
|
2022-03-07T07:40:48.000Z
|
arg_ranker/__init__.py
|
caozhichongchong/arg_ranker
|
9b4c8da6ebc433c37788ec2eb4edb84b3e558d5a
|
[
"MIT"
] | 5
|
2021-08-18T08:54:59.000Z
|
2022-03-24T18:19:35.000Z
|
arg_ranker/__init__.py
|
caozhichongchong/arg_ranker
|
9b4c8da6ebc433c37788ec2eb4edb84b3e558d5a
|
[
"MIT"
] | 7
|
2019-06-19T16:25:55.000Z
|
2022-01-12T20:11:50.000Z
|
import arg_ranker
__version__ = "2.8.1"
| 10.25
| 21
| 0.731707
| 7
| 41
| 3.571429
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085714
| 0.146341
| 41
| 3
| 22
| 13.666667
| 0.628571
| 0
| 0
| 0
| 0
| 0
| 0.121951
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
ccb8f1b1687cfbb505b4fa831faa7844d40668c1
| 448
|
py
|
Python
|
cs2021/lab/lab00.py
|
FalsePsyche/Uni_pythonprog
|
d6f0162571fcf445947bba020944bcadd5699627
|
[
"Unlicense"
] | 1
|
2017-01-12T22:09:31.000Z
|
2017-01-12T22:09:31.000Z
|
cs2021/lab/lab00.py
|
FalsePsyche/Uni_pythonprog
|
d6f0162571fcf445947bba020944bcadd5699627
|
[
"Unlicense"
] | null | null | null |
cs2021/lab/lab00.py
|
FalsePsyche/Uni_pythonprog
|
d6f0162571fcf445947bba020944bcadd5699627
|
[
"Unlicense"
] | null | null | null |
# Tanner Bornemann
# Lab00 - Python Programming - Section 001
# 2017-01-13
def twenty_seventeen():
"""Come up with the most creative expression that evaluates to 2017,
using only numbers and the +, *, and - operators.
>>> twenty_seventeen()
2017
>>> twenty_seventeen() + twenty_seventeen()
4034
>>> twenty_seventeen() * 3
6051
>>> twenty_seventeen() / 2
1008.5
"""
return (9 * 9) + ((22 * 2) * 44)
| 23.578947
| 72
| 0.611607
| 54
| 448
| 4.962963
| 0.703704
| 0.335821
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129129
| 0.256696
| 448
| 18
| 73
| 24.888889
| 0.675676
| 0.734375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
ccd02bade746bc5b2962bb889944444893e454ee
| 411
|
py
|
Python
|
backup_client/filehandler/__init__.py
|
henriknero/backup_client
|
3df4d67383c5671110faeb10d42686258d15b538
|
[
"MIT"
] | 1
|
2019-01-11T10:18:15.000Z
|
2019-01-11T10:18:15.000Z
|
backup_client/filehandler/__init__.py
|
henriknero/backup_client
|
3df4d67383c5671110faeb10d42686258d15b538
|
[
"MIT"
] | 3
|
2019-01-12T11:33:03.000Z
|
2021-06-01T23:19:04.000Z
|
backup_client/filehandler/__init__.py
|
henriknero/backup_client
|
3df4d67383c5671110faeb10d42686258d15b538
|
[
"MIT"
] | null | null | null |
from watchdog import observers
from watchdog import events
import backup_client.network as gitcom
class FileObserver(object):
def __init__(self):
self.file_observer = observers.Observer()
self.event_handler = events.FileSystemEventHandler()
def start(self):
self.file_observer.start()
def stop(self):
self.file_observer.stop()
self.file_observer.join()
| 21.631579
| 60
| 0.703163
| 48
| 411
| 5.8125
| 0.5
| 0.114695
| 0.229391
| 0.215054
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.211679
| 411
| 18
| 61
| 22.833333
| 0.861111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.583333
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
aee343fffd584de2217b4cecddcbfc9c603cf739
| 214
|
py
|
Python
|
articles/urls.py
|
Shubhammehta2012/Bootcamp
|
52a95e1557f0aa299773f0132982fbddef2a1f74
|
[
"Apache-2.0"
] | null | null | null |
articles/urls.py
|
Shubhammehta2012/Bootcamp
|
52a95e1557f0aa299773f0132982fbddef2a1f74
|
[
"Apache-2.0"
] | null | null | null |
articles/urls.py
|
Shubhammehta2012/Bootcamp
|
52a95e1557f0aa299773f0132982fbddef2a1f74
|
[
"Apache-2.0"
] | null | null | null |
from django.conf.urls import url
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.articles, name = 'articles'),
url(r'post_ar/$', views.post_ar, name = 'post_ar'),
]
| 23.777778
| 56
| 0.668224
| 32
| 214
| 4.375
| 0.40625
| 0.128571
| 0.2
| 0.257143
| 0.414286
| 0.414286
| 0.414286
| 0
| 0
| 0
| 0
| 0
| 0.172897
| 214
| 8
| 57
| 26.75
| 0.79096
| 0
| 0
| 0.285714
| 0
| 0
| 0.121495
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.428571
| 0
| 0.428571
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
4e209883eb289eea0774f54bf6116b4901896faf
| 33
|
py
|
Python
|
yapftests/huawei/huaweistyle/resources/paragraph_1/1_5_a_line_statement_incorrect_.py
|
akuleshov7/huawei-yapf
|
72c188257e2bafa4da9e553ba0ee9b86831c51b8
|
[
"Apache-2.0"
] | 12
|
2020-04-24T18:12:08.000Z
|
2021-06-09T16:53:10.000Z
|
yapftests/huawei/huaweistyle/resources/paragraph_1/1_5_a_line_statement_incorrect_.py
|
akuleshov7/h-yapf
|
72c188257e2bafa4da9e553ba0ee9b86831c51b8
|
[
"Apache-2.0"
] | 1
|
2020-09-09T19:55:35.000Z
|
2020-09-14T00:07:29.000Z
|
yapftests/huawei/huaweistyle/resources/paragraph_1/1_5_a_line_statement_incorrect_.py
|
akuleshov7/h-yapf
|
72c188257e2bafa4da9e553ba0ee9b86831c51b8
|
[
"Apache-2.0"
] | null | null | null |
rect.length = 0; rect.width = 0;
| 16.5
| 32
| 0.636364
| 6
| 33
| 3.5
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074074
| 0.181818
| 33
| 1
| 33
| 33
| 0.703704
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
4e293389a635a1df608a1a25d5eb4f0565c8c794
| 356
|
py
|
Python
|
qlearning/random_agent.py
|
mattuntergassmair/udacity-deep_rl-navigation
|
29f1702ae75f6f8fe627d1a892533c64cde6d13e
|
[
"MIT"
] | null | null | null |
qlearning/random_agent.py
|
mattuntergassmair/udacity-deep_rl-navigation
|
29f1702ae75f6f8fe627d1a892533c64cde6d13e
|
[
"MIT"
] | null | null | null |
qlearning/random_agent.py
|
mattuntergassmair/udacity-deep_rl-navigation
|
29f1702ae75f6f8fe627d1a892533c64cde6d13e
|
[
"MIT"
] | null | null | null |
import numpy as np
class RandomAgent:
"""
An agent that selects among the available actions uniformly at random
"""
def __init__(self, n_actions):
self.n_actions = n_actions
def observe(self, s0, a, r, s1, done):
pass # do nothing
def get_action(self, state):
return np.random.randint(self.n_actions)
| 19.777778
| 73
| 0.643258
| 50
| 356
| 4.4
| 0.7
| 0.145455
| 0.163636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007692
| 0.269663
| 356
| 17
| 74
| 20.941176
| 0.838462
| 0.227528
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.375
| false
| 0.125
| 0.125
| 0.125
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
9d6b133d1bba44e4b45d9a48569091b63171a049
| 214
|
py
|
Python
|
datachunks/__init__.py
|
amaslyaev/datachunks
|
33d2729ad9fa51e47be7ef43166da6f05fc4d426
|
[
"MIT"
] | null | null | null |
datachunks/__init__.py
|
amaslyaev/datachunks
|
33d2729ad9fa51e47be7ef43166da6f05fc4d426
|
[
"MIT"
] | null | null | null |
datachunks/__init__.py
|
amaslyaev/datachunks
|
33d2729ad9fa51e47be7ef43166da6f05fc4d426
|
[
"MIT"
] | null | null | null |
"""
Data chunking for humans.
See README.md for details.
"""
__version__ = '0.0.4'
from ._chunks import chunks, achunks # noqa: F401
from ._chunkingfeeder import ChunkingFeeder, AsyncChunkingFeeder # noqa: F401
| 23.777778
| 78
| 0.747664
| 27
| 214
| 5.703704
| 0.703704
| 0.103896
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.049451
| 0.149533
| 214
| 8
| 79
| 26.75
| 0.796703
| 0.350467
| 0
| 0
| 0
| 0
| 0.038462
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
9d992202421aec16b85a6818421cc521d64b77d4
| 352
|
py
|
Python
|
ansible-kvm/library/macgen.py
|
AutomateWithAnsible/ansible_examples
|
81e0f6f9226d48409b398acead333c03815b96ac
|
[
"MIT"
] | 168
|
2015-05-29T13:56:01.000Z
|
2022-02-17T07:38:17.000Z
|
ansible-kvm/library/macgen.py
|
AutomateWithAnsible/ansible_examples
|
81e0f6f9226d48409b398acead333c03815b96ac
|
[
"MIT"
] | 21
|
2017-05-01T15:19:59.000Z
|
2021-06-29T23:04:36.000Z
|
ansible-kvm/library/macgen.py
|
AutomateWithAnsible/ansible_examples
|
81e0f6f9226d48409b398acead333c03815b96ac
|
[
"MIT"
] | 79
|
2015-07-04T16:47:20.000Z
|
2022-02-17T07:38:23.000Z
|
#! /usr/bin/env python
# macgen.py script to generate a MAC address for guests on Xen
#
mac_1 = 0x00
mac_2 = 0x16
mac_3 = 0x3e
import random
#
def randomMAC():
mac = [ mac_1, mac_2, mac_3,
random.randint(0x00, 0x7f),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff) ]
return ':'.join(map(lambda x: "%02x" % x, mac))
#
print randomMAC()
| 18.526316
| 62
| 0.673295
| 58
| 352
| 3.982759
| 0.62069
| 0.168831
| 0.220779
| 0.181818
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.100346
| 0.178977
| 352
| 18
| 63
| 19.555556
| 0.698962
| 0.232955
| 0
| 0
| 1
| 0
| 0.018868
| 0
| 0
| 0
| 0.135849
| 0
| 0
| 0
| null | null | 0
| 0.090909
| null | null | 0.090909
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
9d9a5c993607d67983ee2029a920a58e0b4c0e53
| 4,426
|
py
|
Python
|
palette.py
|
zMathieu/TERMVideo
|
e74803a8117eb05d3be40491cf8d4bda1601e702
|
[
"MIT"
] | null | null | null |
palette.py
|
zMathieu/TERMVideo
|
e74803a8117eb05d3be40491cf8d4bda1601e702
|
[
"MIT"
] | null | null | null |
palette.py
|
zMathieu/TERMVideo
|
e74803a8117eb05d3be40491cf8d4bda1601e702
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3
# coding: utf-8
from PIL import Image
NB_COLORS_HEIGHT = 43
NB_COLORS_WIDTH = 6
def make_palette():
palette = []
im = Image.open('colors.png')
for x in range(0, im.height, int(im.height/NB_COLORS_HEIGHT)):
for y in range(0, im.width, int(im.width/NB_COLORS_WIDTH)):
palette.append(im.getpixel((y, x))[:3])
return palette[:4] + palette[6:]
# palette = make_palette()
palette = [(35, 35, 35), (255, 92, 87), (90, 247, 142), (243, 249, 157), (87, 199, 255), (255, 106, 193), (154, 237, 254), (255, 255, 255), (68, 68, 68), (255, 92, 87), (90, 247, 142), (243, 249, 157), (87, 199, 255), (255, 106, 193), (154, 237, 254), (255, 255, 255), (0, 0, 0), (0, 0, 95), (0, 0, 135), (0, 0, 175), (0, 0, 215), (0, 0, 255), (0, 95, 0), (0, 95, 95), (0, 95, 135), (0, 95, 175), (0, 95, 215), (0, 95, 255), (0, 135, 0), (0, 135, 95), (0, 135, 135), (0, 135, 175), (0, 135, 215), (0, 135, 255), (0, 175, 0), (0, 175, 95), (0, 175, 135), (0, 175, 175), (0, 175, 215), (0, 175, 255), (0, 215, 0), (0, 215, 95), (0, 215, 135), (0, 215, 175), (0, 215, 215), (0, 215, 255), (0, 255, 0), (0, 255, 95), (0, 255, 135), (0, 255, 175), (0, 255, 215), (0, 255, 255), (95, 0, 0), (95, 0, 95), (95, 0, 135), (95, 0, 175), (95, 0, 215), (95, 0, 255), (95, 95, 0), (95, 95, 95), (95, 95, 135), (95, 95, 175), (95, 95, 215), (95, 95, 255), (95, 135, 0), (95, 135, 95), (95, 135, 135), (95, 135, 175), (95, 135, 215), (95, 135, 255), (95, 175, 0), (95, 175, 95), (95, 175, 135), (95, 175, 175), (95, 175, 215), (95, 175, 255), (95, 215, 0), (95, 215, 95), (95, 215, 135), (95, 215, 175), (95, 215, 215), (95, 215, 255), (95, 255, 0), (95, 255, 95), (95, 255, 135), (95, 255, 175), (95, 255, 215), (95, 255, 255), (135, 0, 0), (135, 0, 95), (135, 0, 135), (135, 0, 175), (135, 0, 215), (135, 0, 255), (135, 95, 0), (135, 95, 95), (135, 95, 135), (135, 95, 175), (135, 95, 215), (135, 95, 255), (135, 135, 0), (135, 135, 95), (135, 135, 135), (135, 135, 175), (135, 135, 215), (135, 135, 255), (135, 175, 0), (135, 175, 95), (135, 175, 135), (135, 175, 175), (135, 175, 215), (135, 175, 255), (135, 215, 0), (135, 215, 95), (135, 215, 135), (135, 215, 175), (135, 215, 215), (135, 215, 255), (135, 255, 0), (135, 255, 95), (135, 255, 135), (135, 255, 175), (135, 255, 215), (135, 255, 255), (175, 0, 0), (175, 0, 95), (175, 0, 135), (175, 0, 175), (175, 0, 215), (175, 0, 255), (175, 95, 0), (175, 95, 95), (175, 95, 135), (175, 95, 175), (175, 95, 215), (175, 95, 255), (175, 135, 0), (175, 135, 95), (175, 135, 135), (175, 135, 175), (175, 135, 215), (175, 135, 255), (175, 175, 0), (175, 175, 95), (175, 175, 135), (175, 175, 175), (175, 175, 215), (175, 175, 255), (175, 215, 0), (175, 215, 95), (175, 215, 135), (175, 215, 175), (175, 215, 215), (175, 215, 255), (175, 255, 0), (175, 255, 95), (175, 255, 135), (175, 255, 175), (175, 255, 215), (175, 255, 255), (215, 0, 0), (215, 0, 95), (215, 0, 135), (215, 0, 175), (215, 0, 215), (215, 0, 255), (215, 95, 0), (215, 95, 95), (215, 95, 135), (215, 95, 175), (215, 95, 215), (215, 95, 255), (215, 135, 0), (215, 135, 95), (215, 135, 135), (215, 135, 175), (215, 135, 215), (215, 135, 255), (215, 175, 0), (215, 175, 95), (215, 175, 135), (215, 175, 175), (215, 175, 215), (215, 175, 255), (215, 215, 0), (215, 215, 95), (215, 215, 135), (215, 215, 175), (215, 215, 215), (215, 215, 255), (215, 255, 0), (215, 255, 95), (215, 255, 135), (215, 255, 175), (215, 255, 215), (215, 255, 255), (255, 0, 0), (255, 0, 95), (255, 0, 135), (255, 0, 175), (255, 0, 215), (255, 0, 255), (255, 95, 0), (255, 95, 95), (255, 95, 135), (255, 95, 175), (255, 95, 215), (255, 95, 255), (255, 135, 0), (255, 135, 95), (255, 135, 135), (255, 135, 175), (255, 135, 215), (255, 135, 255), (255, 175, 0), (255, 175, 95), (255, 175, 135), (255, 175, 175), (255, 175, 215), (255, 175, 255), (255, 215, 0), (255, 215, 95), (255, 215, 135), (255, 215, 175), (255, 215, 215), (255, 215, 255), (255, 255, 0), (255, 255, 95), (255, 255, 135), (255, 255, 175), (255, 255, 215), (255, 255, 255), (8, 8, 8), (18, 18, 18), (28, 28, 28), (38, 38, 38), (48, 48, 48), (58, 58, 58), (68, 68, 68), (78, 78, 78), (88, 88, 88), (98, 98, 98), (108, 108, 108), (118, 118, 118), (128, 128, 128), (138, 138, 138), (148, 148, 148), (158, 158, 158), (168, 168, 168), (178, 178, 178), (188, 188, 188), (198, 198, 198), (208, 208, 208), (218, 218, 218), (228, 228, 228), (238, 238, 238)]
| 184.416667
| 3,991
| 0.50113
| 838
| 4,426
| 2.634845
| 0.093079
| 0.065217
| 0.02038
| 0.013587
| 0.35779
| 0.053442
| 0.053442
| 0.053442
| 0.053442
| 0.053442
| 0
| 0.544868
| 0.194306
| 4,426
| 23
| 3,992
| 192.434783
| 0.074313
| 0.013556
| 0
| 0
| 0
| 0
| 0.002292
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.090909
| false
| 0
| 0.090909
| 0
| 0.272727
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
9da0b456159193544b077808915f9f264b951314
| 242
|
py
|
Python
|
adttools/helper/__init__.py
|
kent010341/azure-digital-twins-tools
|
fc2700465cb5b7f3130c1ec0c0dd3fcba39de8c8
|
[
"MIT"
] | null | null | null |
adttools/helper/__init__.py
|
kent010341/azure-digital-twins-tools
|
fc2700465cb5b7f3130c1ec0c0dd3fcba39de8c8
|
[
"MIT"
] | 2
|
2022-03-28T08:09:45.000Z
|
2022-03-28T08:25:32.000Z
|
adttools/helper/__init__.py
|
kent010341/azure-digital-twins-tools
|
fc2700465cb5b7f3130c1ec0c0dd3fcba39de8c8
|
[
"MIT"
] | null | null | null |
from .ModelHelper import ModelHelper
from .RelationshipHelper import RelationshipHelper
from .PropertyHelper import PropertyHelper
from .TwinHelper import TwinHelper
from .QueryHelper import QueryHelper
from .DeployHelper import DeployHelper
| 34.571429
| 50
| 0.876033
| 24
| 242
| 8.833333
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.099174
| 242
| 6
| 51
| 40.333333
| 0.972477
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
9db416e35e9f04304fb70477c1bdb3ff05a18f75
| 204
|
py
|
Python
|
helpers/DataLoader.py
|
sevmardi/Social_network_analysis
|
d299fc0120f12c2ad8ca871cad160a66873dcae0
|
[
"MIT"
] | 1
|
2021-09-16T17:01:07.000Z
|
2021-09-16T17:01:07.000Z
|
helpers/DataLoader.py
|
sevmardi/Social_network_analysis
|
d299fc0120f12c2ad8ca871cad160a66873dcae0
|
[
"MIT"
] | null | null | null |
helpers/DataLoader.py
|
sevmardi/Social_network_analysis
|
d299fc0120f12c2ad8ca871cad160a66873dcae0
|
[
"MIT"
] | null | null | null |
import numpy as np
class DataLoader:
def load_medium(self):
data = "../data/medium.in"
return data
def load_large(self):
data = "../data/large.in"
return data
| 14.571429
| 34
| 0.568627
| 26
| 204
| 4.384615
| 0.538462
| 0.122807
| 0.210526
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.318627
| 204
| 13
| 35
| 15.692308
| 0.820144
| 0
| 0
| 0.25
| 0
| 0
| 0.161765
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.125
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
9db43bfa4545eb015cbc1d5b471dc7f7173c373d
| 136
|
py
|
Python
|
siina/__init__.py
|
ahartikainen/Siina
|
0a229b4e2082707a6e6fbb6b677e7b44b7567a8e
|
[
"Apache-2.0"
] | 12
|
2018-01-01T08:49:41.000Z
|
2021-09-09T11:21:34.000Z
|
siina/__init__.py
|
ahartikainen/Siina
|
0a229b4e2082707a6e6fbb6b677e7b44b7567a8e
|
[
"Apache-2.0"
] | 1
|
2019-03-13T10:59:14.000Z
|
2019-08-15T20:15:26.000Z
|
siina/__init__.py
|
ahartikainen/Siina
|
0a229b4e2082707a6e6fbb6b677e7b44b7567a8e
|
[
"Apache-2.0"
] | 2
|
2019-08-20T21:18:09.000Z
|
2020-11-17T00:18:45.000Z
|
"""Init for the package."""
from .core import Radar
from .dzt import read_dzt
from .filters import butterworth
__version__ = "19.8.28"
| 19.428571
| 32
| 0.742647
| 21
| 136
| 4.571429
| 0.761905
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.043103
| 0.147059
| 136
| 6
| 33
| 22.666667
| 0.784483
| 0.154412
| 0
| 0
| 0
| 0
| 0.06422
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
9de4330cafcd5c2d73fade72fb6bd8da5f9724ac
| 51
|
py
|
Python
|
backend/run.py
|
uvasomrc/ed-platform
|
6453c7404c44765e325ccc1be2b9c76726cb7682
|
[
"MIT"
] | null | null | null |
backend/run.py
|
uvasomrc/ed-platform
|
6453c7404c44765e325ccc1be2b9c76726cb7682
|
[
"MIT"
] | 22
|
2018-01-18T00:55:11.000Z
|
2018-05-31T16:34:15.000Z
|
backend/run.py
|
uvasomrc/ed-platform
|
6453c7404c44765e325ccc1be2b9c76726cb7682
|
[
"MIT"
] | null | null | null |
from ed_platform import app
app.run(threaded=True)
| 17
| 27
| 0.823529
| 9
| 51
| 4.555556
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098039
| 51
| 2
| 28
| 25.5
| 0.891304
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
9dffcdf3a4d3d5896eac631f098b3f494556588f
| 49
|
py
|
Python
|
Day 2/file2.py
|
adamsaparudin/python-datascience
|
1b4164bb8a091f88def950f07108fe023737399c
|
[
"MIT"
] | null | null | null |
Day 2/file2.py
|
adamsaparudin/python-datascience
|
1b4164bb8a091f88def950f07108fe023737399c
|
[
"MIT"
] | null | null | null |
Day 2/file2.py
|
adamsaparudin/python-datascience
|
1b4164bb8a091f88def950f07108fe023737399c
|
[
"MIT"
] | null | null | null |
myfile = open("myfile1.txt")
print(myfile.read())
| 24.5
| 28
| 0.714286
| 7
| 49
| 5
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.021739
| 0.061224
| 49
| 2
| 29
| 24.5
| 0.73913
| 0
| 0
| 0
| 0
| 0
| 0.22
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
3b03e83385729b6495c6426e14499f0f0b0d54a3
| 190
|
py
|
Python
|
tests/proxies/empty_child.py
|
webu/dalec
|
ddc4f3c4627c84c5a70e9052d28f77d6ff8755a7
|
[
"BSD-3-Clause"
] | null | null | null |
tests/proxies/empty_child.py
|
webu/dalec
|
ddc4f3c4627c84c5a70e9052d28f77d6ff8755a7
|
[
"BSD-3-Clause"
] | null | null | null |
tests/proxies/empty_child.py
|
webu/dalec
|
ddc4f3c4627c84c5a70e9052d28f77d6ff8755a7
|
[
"BSD-3-Clause"
] | null | null | null |
class EmptyChildProxy:
"""
Bad because does not extends dalec.proxy.Proxy
"""
app = "empty_child"
def _fetch(self, *args, **kwargs):
print("Are you my mummy?")
| 19
| 50
| 0.6
| 23
| 190
| 4.869565
| 0.956522
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.268421
| 190
| 9
| 51
| 21.111111
| 0.805755
| 0.242105
| 0
| 0
| 0
| 0
| 0.21875
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.75
| 0.25
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
d18b29de6492d80182b53d0fe82db98f6999e9b6
| 184
|
py
|
Python
|
backend/api/admin.py
|
saulhappy/drf
|
5e62da54cdf0f0fead742c891d34e7eacd488a1b
|
[
"MIT"
] | null | null | null |
backend/api/admin.py
|
saulhappy/drf
|
5e62da54cdf0f0fead742c891d34e7eacd488a1b
|
[
"MIT"
] | null | null | null |
backend/api/admin.py
|
saulhappy/drf
|
5e62da54cdf0f0fead742c891d34e7eacd488a1b
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from products.models import Product
@admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
list_display = ("title", "content", "price")
| 20.444444
| 48
| 0.76087
| 22
| 184
| 6.318182
| 0.772727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 184
| 8
| 49
| 23
| 0.863354
| 0
| 0
| 0
| 0
| 0
| 0.092391
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
d1a52e453f05e7c7fd81648d7c9aad1d09e867fe
| 13,009
|
py
|
Python
|
scvi/models/iavae.py
|
jimmayxu/scVI
|
23cb7597e0b0677736a14c903c8053ad62c74938
|
[
"MIT"
] | null | null | null |
scvi/models/iavae.py
|
jimmayxu/scVI
|
23cb7597e0b0677736a14c903c8053ad62c74938
|
[
"MIT"
] | null | null | null |
scvi/models/iavae.py
|
jimmayxu/scVI
|
23cb7597e0b0677736a14c903c8053ad62c74938
|
[
"MIT"
] | null | null | null |
import warnings
import torch
import torch.nn as nn
import torch.distributions as dist
import torch.nn.functional as F
from .log_likelihood import log_zinb_positive, log_nb_positive
from .modules import DecoderSCVI, Encoder, DecoderPoisson
from .iaf_encoder import EncoderIAF
from .utils import one_hot
class IAVAE(nn.Module):
def __init__(
self,
n_input: int,
n_batch: int = 0,
n_labels: int = 0,
n_hidden: int = 128,
n_latent: int = 10,
n_layers: int = 1,
t: int = 3,
dropout_rate: float = 5e-2,
dispersion: str = "gene",
log_variational: bool = True,
reconstruction_loss: str = "zinb",
do_h: bool = False,
):
"""
EXPERIMENTAL: Posterior functionalities may not be working
Model does not implement Forward.
Training should be performed with ratio_loss method
:param n_input:
:param n_batch:
:param n_labels:
:param n_hidden:
:param n_latent:
:param n_layers:
:param t: Number of autoregressive steps
:param dropout_rate:
:param dispersion:
:param log_variational:
:param reconstruction_loss:
"""
super().__init__()
warnings.warn('EXPERIMENTAL: Posterior functionalities may not be working')
self.dispersion = dispersion
self.n_latent = n_latent
self.log_variational = log_variational
self.reconstruction_loss = reconstruction_loss
# Automatically deactivate if useless
self.n_batch = n_batch
self.n_labels = n_labels
if self.dispersion == "gene":
self.px_r = torch.nn.Parameter(torch.randn(n_input))
elif self.dispersion == "gene-batch":
self.px_r = torch.nn.Parameter(torch.randn(n_input, n_batch))
elif self.dispersion == "gene-label":
self.px_r = torch.nn.Parameter(torch.randn(n_input, n_labels))
else: # gene-cell
pass
# latent space representation
self.z_encoder = EncoderIAF(
n_in=n_input,
n_latent=n_latent,
n_cat_list=None,
n_layers=n_layers,
t=t,
n_hidden=n_hidden,
dropout_rate=dropout_rate,
do_h=do_h
)
# l encoder goes from n_input-dimensional data to 1-d library size
self.l_encoder = Encoder(
n_input, 1, n_layers=1, n_hidden=n_hidden, dropout_rate=dropout_rate
)
# decoder goes from n_latent-dimensional space to n_input-d data
self.decoder = DecoderSCVI(
n_latent,
n_input,
n_cat_list=[n_batch],
n_layers=n_layers,
n_hidden=n_hidden,
)
def inference(self, x, batch_index=None, y=None, n_samples=1):
"""
:param x:
:param batch_index:
:param y:
:param n_samples:
:return:
"""
x_ = x
if self.log_variational:
x_ = torch.log(1 + x_)
# Sampling
ql_m, ql_v, library = self.l_encoder(x_)
n_batch = len(ql_m)
if n_samples > 1:
# Managing library
ql_m = ql_m.unsqueeze(0).expand((n_samples, ql_m.size(0), ql_m.size(1)))
ql_v = ql_v.unsqueeze(0).expand((n_samples, ql_v.size(0), ql_v.size(1)))
library = dist.Normal(ql_m, ql_v.sqrt()).sample()
# Managing z Latent
z = torch.zeros(n_samples, n_batch, self.n_latent, device=ql_m.device, dtype=ql_m.dtype)
log_qz_x = torch.zeros(n_samples, n_batch, device=ql_m.device, dtype=ql_m.dtype)
for idx in range(n_samples):
zi, log_qz_x_i = self.z_encoder(x_, y)
z[idx, :] = zi
log_qz_x[idx, :] = log_qz_x_i
else:
z, log_qz_x = self.z_encoder(x_, y)
assert z.shape[0] == library.shape[0], (z.shape, library.shape)
# library = torch.clamp(library, max=13)
px_scale, px_r, px_rate, px_dropout = self.decoder(self.dispersion, z, library, batch_index, y)
if self.dispersion == "gene-label":
px_r = F.linear(one_hot(y, self.n_labels), self.px_r) # px_r gets transposed - last dimension is nb genes
elif self.dispersion == "gene-batch":
px_r = F.linear(one_hot(batch_index, self.n_batch), self.px_r)
elif self.dispersion == "gene":
px_r = self.px_r
px_r = torch.exp(px_r)
return dict(
px_scale=px_scale,
px_r=px_r,
px_rate=px_rate,
px_dropout=px_dropout,
z=z,
log_qz_x=log_qz_x,
ql_m=ql_m,
ql_v=ql_v,
library=library
)
def ratio_loss(self, x, local_l_mean, local_l_var, batch_index=None, y=None, return_mean=True):
outputs = self.inference(x, batch_index=batch_index, y=y, n_samples=1)
ql_m = outputs['ql_m']
ql_v = outputs['ql_v']
library = outputs['library']
px_rate = outputs['px_rate']
z = outputs['z']
log_qz_x = outputs['log_qz_x']
px_r = outputs['px_r']
px_dropout = outputs['px_dropout']
# variationnal probas computation
log_ql_x = dist.Normal(ql_m, torch.sqrt(ql_v)).log_prob(library).sum(dim=-1)
# priors computation
log_pz = dist.Normal(torch.zeros_like(z), torch.ones_like(z)).log_prob(z).sum(dim=-1)
log_pl = dist.Normal(local_l_mean, torch.sqrt(local_l_var)).log_prob(library).sum(dim=-1)
# reconstruction proba computation
log_px_zl = -self.get_reconstruction_loss(x, px_rate, px_r, px_dropout)
assert log_px_zl.shape == log_pl.shape == log_pz.shape == log_qz_x.shape == log_ql_x.shape
ratio = (
log_px_zl + log_pz + log_pl
- log_qz_x - log_ql_x
)
if not return_mean:
return ratio
elbo = ratio.mean(dim=0)
return -elbo
def get_reconstruction_loss(self, x, px_rate, px_r, px_dropout):
# Reconstruction Loss
if self.reconstruction_loss == 'zinb':
reconst_loss = -log_zinb_positive(x, px_rate, px_r, px_dropout)
elif self.reconstruction_loss == 'nb':
reconst_loss = -log_nb_positive(x, px_rate, px_r)
else:
raise NotImplementedError
return reconst_loss
def iwelbo(self, x, local_l_mean, local_l_var, batch_index=None, y=None, k=3, single_backward=False):
n_batch = len(x)
log_ratios = torch.zeros(k, n_batch, device='cuda', dtype=torch.float)
for it in range(k):
log_ratios[it, :] = self.ratio_loss(
x,
local_l_mean,
local_l_var,
batch_index=batch_index,
y=y,
return_mean=False
)
normalizers, _ = log_ratios.max(dim=0)
w_tilde = torch.softmax(log_ratios - normalizers, dim=0).detach()
if not single_backward:
loss = - (w_tilde * log_ratios).sum(dim=0)
else:
selected_k = torch.distributions.Categorical(probs=w_tilde.transpose(-1, -2)).sample()
assert len(selected_k) == n_batch
loss = - log_ratios[selected_k, torch.arange(n_batch)]
return loss.mean(dim=0)
class IALogNormalPoissonVAE(nn.Module):
def __init__(
self,
n_input: int,
n_batch: int = 0,
n_labels: int = 0,
n_hidden: int = 128,
n_latent: int = 10,
n_layers: int = 1,
t: int = 3,
dropout_rate: float = 5e-2,
log_variational: bool = True,
gt_decoder: nn.Module = None,
do_h: bool = False,
):
"""
"""
self.trained_decoder = gt_decoder is None
super().__init__()
warnings.warn('EXPERIMENTAL: Posterior functionalities may not be working')
self.n_latent = n_latent
self.log_variational = log_variational
# Automatically deactivate if useless
self.n_batch = n_batch
self.n_labels = n_labels
# decoder goes from n_latent-dimensional space to n_input-d data
if self.trained_decoder:
self.decoder = DecoderPoisson(
n_latent,
n_input,
n_cat_list=[n_batch],
n_layers=n_layers,
n_hidden=n_hidden,
)
else:
self.decoder = gt_decoder
# latent space representation
self.z_encoder = EncoderIAF(
n_in=n_input,
n_latent=n_latent,
n_cat_list=None,
n_layers=n_layers,
t=t,
n_hidden=n_hidden,
dropout_rate=dropout_rate,
do_h=do_h
)
# l encoder goes from n_input-dimensional data to 1-d library size
self.l_encoder = Encoder(
n_input, 1, n_layers=1, n_hidden=n_hidden, dropout_rate=dropout_rate
)
def inference(self, x, batch_index=None, y=None, n_samples=1):
"""
:param x:
:param batch_index:
:param y:
:param n_samples:
:return:
"""
x_ = x
if self.log_variational:
x_ = torch.log(1 + x_)
# Sampling
ql_m, ql_v, library = self.l_encoder(x_)
n_batch = len(ql_m)
if n_samples > 1:
# Managing library
ql_m = ql_m.unsqueeze(0).expand((n_samples, ql_m.size(0), ql_m.size(1)))
ql_v = ql_v.unsqueeze(0).expand((n_samples, ql_v.size(0), ql_v.size(1)))
library = dist.Normal(ql_m, ql_v.sqrt()).sample()
# Managing z Latent
z = torch.zeros(n_samples, n_batch, self.n_latent, device=ql_m.device, dtype=ql_m.dtype)
log_qz_x = torch.zeros(n_samples, n_batch, device=ql_m.device, dtype=ql_m.dtype)
for idx in range(n_samples):
zi, log_qz_x_i = self.z_encoder(x_, y)
z[idx, :] = zi
log_qz_x[idx, :] = log_qz_x_i
else:
z, log_qz_x = self.z_encoder(x_, y)
# library = torch.clamp(library, max=13)
assert z.shape[0] == library.shape[0]
# assert z.shape[1] == library.shape[1], 'Different n_batch'
# px_rate = self.decoder(self.dispersion, z, library, batch_index, y)
px_rate = self.decoder(z, library, batch_index, y)
return dict(
px_rate=px_rate,
z=z,
log_qz_x=log_qz_x,
ql_m=ql_m,
ql_v=ql_v,
library=library
)
def ratio_loss(self, x, local_l_mean, local_l_var, batch_index=None, y=None, return_mean=True):
outputs = self.inference(x, batch_index=batch_index, y=y, n_samples=1)
ql_m = outputs['ql_m']
ql_v = outputs['ql_v']
library = outputs['library']
px_rate = outputs['px_rate']
z = outputs['z']
log_qz_x = outputs['log_qz_x']
# variationnal probas computation
log_ql_x = dist.Normal(ql_m, torch.sqrt(ql_v)).log_prob(library).sum(dim=-1)
# priors computation
log_pz = dist.Normal(torch.zeros_like(z), torch.ones_like(z)).log_prob(z).sum(dim=-1)
log_pl = dist.Normal(local_l_mean, torch.sqrt(local_l_var)).log_prob(library).sum(dim=-1)
# reconstruction proba computation
log_px_zl = -self.get_reconstruction_loss(x, px_rate)
log_ratio = log_px_zl + log_pz - log_qz_x
# ratio = (
# log_px_zl + log_pz + log_pl
# - log_qz_x - log_ql_x
# )
if not return_mean:
return log_ratio
elbo = log_ratio.mean(dim=0)
return -elbo
@staticmethod
def get_reconstruction_loss(x, rate):
rl = -torch.distributions.Poisson(rate).log_prob(x)
assert rl.dim() == rate.dim() # rl should be (n_batch, n_input)
# or (n_samples, n_batch, n_input)
return torch.sum(rl, dim=-1)
def iwelbo(self, x, local_l_mean, local_l_var, batch_index=None, y=None, k=3, single_backward=False):
n_batch = len(x)
log_ratios = torch.zeros(k, n_batch, device='cuda', dtype=torch.float)
for it in range(k):
log_ratios[it, :] = self.ratio_loss(
x,
local_l_mean,
local_l_var,
batch_index=batch_index,
y=y,
return_mean=False
)
normalizers, _ = log_ratios.max(dim=0)
w_tilde = torch.softmax(log_ratios - normalizers, dim=0).detach()
if not single_backward:
loss = - (w_tilde * log_ratios).sum(dim=0)
else:
selected_k = torch.distributions.Categorical(probs=w_tilde.transpose(-1, -2)).sample()
assert len(selected_k) == n_batch
loss = - log_ratios[selected_k, torch.arange(n_batch)]
return loss.mean(dim=0)
| 34.97043
| 118
| 0.576601
| 1,796
| 13,009
| 3.888085
| 0.111915
| 0.013748
| 0.018903
| 0.006874
| 0.759559
| 0.740656
| 0.717457
| 0.692682
| 0.692682
| 0.68008
| 0
| 0.009149
| 0.319471
| 13,009
| 371
| 119
| 35.06469
| 0.779623
| 0.121685
| 0
| 0.715356
| 0
| 0
| 0.023504
| 0
| 0
| 0
| 0
| 0
| 0.022472
| 1
| 0.037453
| false
| 0.003745
| 0.033708
| 0
| 0.116105
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 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
| 4
|
d1ad03cea5b141d2ef7932b45a67128abcd9bd4f
| 1,474
|
py
|
Python
|
tests/test_moving_average.py
|
smiszym/manokee
|
afb63b8ce5ba3f83bb924965b8d5098a6d28c474
|
[
"MIT"
] | null | null | null |
tests/test_moving_average.py
|
smiszym/manokee
|
afb63b8ce5ba3f83bb924965b8d5098a6d28c474
|
[
"MIT"
] | 14
|
2021-03-11T02:05:20.000Z
|
2022-03-12T01:05:11.000Z
|
tests/test_moving_average.py
|
smiszym/manokee
|
afb63b8ce5ba3f83bb924965b8d5098a6d28c474
|
[
"MIT"
] | null | null | null |
from manokee.ping import MovingAverage
def test_moving_average_constant():
avg = MovingAverage(window=4)
assert avg.get() is None
for _ in range(20):
assert avg.new_value(4) == 4
assert avg.get() == 4
def test_moving_average_increasing():
avg = MovingAverage(window=4)
assert avg.get() is None
assert avg.new_value(4) == 4
assert avg.new_value(5) == 4.5
assert avg.new_value(6) == 5
assert avg.new_value(7) == 5.5
assert avg.new_value(8) == 6.5
assert avg.new_value(9) == 7.5
assert avg.new_value(10) == 8.5
assert avg.get() == 8.5
def test_moving_average_decreasing():
avg = MovingAverage(window=4)
assert avg.get() is None
assert avg.new_value(4) == 4
assert avg.new_value(3) == 3.5
assert avg.new_value(2) == 3
assert avg.new_value(1) == 2.5
assert avg.new_value(0) == 1.5
assert avg.new_value(-1) == 0.5
assert avg.new_value(-2) == -0.5
assert avg.new_value(-3) == -1.5
assert avg.get() == -1.5
def test_moving_average_alternating():
avg = MovingAverage(window=4)
assert avg.get() is None
assert avg.new_value(4) == 4
assert avg.new_value(3) == 3.5
assert avg.new_value(4) == (4 + 3 + 4) / 3
assert avg.new_value(3) == 3.5
assert avg.new_value(4) == 3.5
assert avg.new_value(3) == 3.5
assert avg.new_value(4) == 3.5
assert avg.new_value(3) == 3.5
assert avg.new_value(4) == 3.5
assert avg.get() == 3.5
| 28.346154
| 46
| 0.623474
| 255
| 1,474
| 3.454902
| 0.141176
| 0.337117
| 0.340522
| 0.482406
| 0.797957
| 0.624291
| 0.533485
| 0.533485
| 0.501703
| 0.455165
| 0
| 0.074561
| 0.226594
| 1,474
| 51
| 47
| 28.901961
| 0.698246
| 0
| 0
| 0.465116
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.767442
| 1
| 0.093023
| false
| 0
| 0.023256
| 0
| 0.116279
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d1b4e45f06b0dc3820734b562d1caa8f6c4686e5
| 102
|
py
|
Python
|
Projects in Python/projeto_18.py
|
gusta-ino/Projects-in-Python
|
4cc8e636f1e940b345070cf0a4ab153bc0d50044
|
[
"MIT"
] | 1
|
2022-03-17T17:14:31.000Z
|
2022-03-17T17:14:31.000Z
|
Projects in Python/projeto_18.py
|
gusta-ino/Projects-in-Python
|
4cc8e636f1e940b345070cf0a4ab153bc0d50044
|
[
"MIT"
] | null | null | null |
Projects in Python/projeto_18.py
|
gusta-ino/Projects-in-Python
|
4cc8e636f1e940b345070cf0a4ab153bc0d50044
|
[
"MIT"
] | null | null | null |
#exe numeros aleatorios
import random
num = random.randint(1 ,1000)
#num = random.random()
print(num)
| 17
| 29
| 0.745098
| 15
| 102
| 5.066667
| 0.666667
| 0.236842
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.05618
| 0.127451
| 102
| 6
| 30
| 17
| 0.797753
| 0.421569
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
0617f69863d24d514afc41657f0af94f59d3134f
| 61
|
py
|
Python
|
app.py
|
hariprasad1003/calcymath
|
8e395397ce128ece6e15ca16a87495841b4f5ad0
|
[
"MIT"
] | null | null | null |
app.py
|
hariprasad1003/calcymath
|
8e395397ce128ece6e15ca16a87495841b4f5ad0
|
[
"MIT"
] | null | null | null |
app.py
|
hariprasad1003/calcymath
|
8e395397ce128ece6e15ca16a87495841b4f5ad0
|
[
"MIT"
] | null | null | null |
import __init__ as cm
add_num = cm.add(2,1)
print(add_num)
| 12.2
| 22
| 0.721311
| 13
| 61
| 2.923077
| 0.692308
| 0.263158
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.039216
| 0.163934
| 61
| 4
| 23
| 15.25
| 0.705882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
ae246a57357186b5ec00fc8ff2edacf71fa3b72f
| 765
|
py
|
Python
|
setup.py
|
trojsten/judge-client
|
75d28dd7e638ca28bae6b16b256dba16f39385ff
|
[
"MIT"
] | 2
|
2018-08-19T15:00:02.000Z
|
2020-06-17T11:54:47.000Z
|
setup.py
|
trojsten/judge-client
|
75d28dd7e638ca28bae6b16b256dba16f39385ff
|
[
"MIT"
] | 1
|
2022-01-19T21:02:45.000Z
|
2022-01-19T21:02:45.000Z
|
setup.py
|
trojsten/judge-client
|
75d28dd7e638ca28bae6b16b256dba16f39385ff
|
[
"MIT"
] | null | null | null |
import setuptools
setuptools.setup(
name="trojsten_judge_client",
version="1.0.2",
url="https://github.com/trojsten/judge-client",
author="Michal Hozza",
author_email="mhozza@gmail.com",
description="Client for Trojsten Judge System.",
long_description=open('README.rst').read(),
packages=setuptools.find_packages(),
test_suite='tests',
install_requires=['six'],
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
| 27.321429
| 52
| 0.623529
| 81
| 765
| 5.802469
| 0.592593
| 0.242553
| 0.319149
| 0.165957
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.020168
| 0.222222
| 765
| 27
| 53
| 28.333333
| 0.769748
| 0
| 0
| 0
| 0
| 0
| 0.511111
| 0.027451
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.045455
| 0
| 0.045455
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
ae4136053df05242fb35aa825c08de850d49da33
| 18
|
py
|
Python
|
crawlers/fiction/___litmir.me.py
|
fostroll/ru_corner
|
defb681aa9311c2dd6ed98d1b934453c29e9a750
|
[
"Apache-2.0"
] | null | null | null |
crawlers/fiction/___litmir.me.py
|
fostroll/ru_corner
|
defb681aa9311c2dd6ed98d1b934453c29e9a750
|
[
"Apache-2.0"
] | null | null | null |
crawlers/fiction/___litmir.me.py
|
fostroll/ru_corner
|
defb681aa9311c2dd6ed98d1b934453c29e9a750
|
[
"Apache-2.0"
] | null | null | null | ERROR: type should be string, got "https://litmir.me\n"
| 9
| 17
| 0.722222
| 3
| 18
| 4.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.055556
| 18
| 1
| 18
| 18
| 0.764706
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
ae571407bf851b8b8183473a12f772abbf410804
| 123
|
py
|
Python
|
sandbox/example_app/models.py
|
stefanobettini/django-gdpr-helpers
|
c2e525cf2d28c64f9c8a83c8ffcb118684459271
|
[
"BSD-3-Clause"
] | null | null | null |
sandbox/example_app/models.py
|
stefanobettini/django-gdpr-helpers
|
c2e525cf2d28c64f9c8a83c8ffcb118684459271
|
[
"BSD-3-Clause"
] | 3
|
2021-11-11T11:03:48.000Z
|
2021-11-20T07:48:12.000Z
|
sandbox/example_app/models.py
|
stefanobettini/django-gdpr-helpers
|
c2e525cf2d28c64f9c8a83c8ffcb118684459271
|
[
"BSD-3-Clause"
] | 2
|
2020-07-28T22:53:51.000Z
|
2021-05-19T09:10:59.000Z
|
from django.db import models
class ExampleModel(models.Model):
first_name = models.CharField("Name", max_length=255)
| 20.5
| 57
| 0.764228
| 17
| 123
| 5.411765
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028037
| 0.130081
| 123
| 5
| 58
| 24.6
| 0.831776
| 0
| 0
| 0
| 0
| 0
| 0.03252
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
ae60a1d942ffecadb7f6ca038f0e802ee469a279
| 106
|
py
|
Python
|
training/ticketing_system/apps.py
|
aberon10/training
|
7f418d563280b9d1ab939935206b023e4206cb54
|
[
"MIT"
] | null | null | null |
training/ticketing_system/apps.py
|
aberon10/training
|
7f418d563280b9d1ab939935206b023e4206cb54
|
[
"MIT"
] | null | null | null |
training/ticketing_system/apps.py
|
aberon10/training
|
7f418d563280b9d1ab939935206b023e4206cb54
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class TicketingSystemConfig(AppConfig):
name = 'ticketing_system'
| 17.666667
| 39
| 0.792453
| 11
| 106
| 7.545455
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.141509
| 106
| 5
| 40
| 21.2
| 0.912088
| 0
| 0
| 0
| 0
| 0
| 0.150943
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
ae675a82546204f05352b56f41c3a1928e1a39cd
| 113
|
py
|
Python
|
src/tts.py
|
kwonbosung02/Harmony_hackathon
|
a5a5acd2e171ae7566e0d49c3729c98e1c68036f
|
[
"MIT"
] | 2
|
2020-07-12T12:03:33.000Z
|
2020-07-13T04:57:43.000Z
|
src/tts.py
|
kwonbosung02/Harmony_hackathon
|
a5a5acd2e171ae7566e0d49c3729c98e1c68036f
|
[
"MIT"
] | null | null | null |
src/tts.py
|
kwonbosung02/Harmony_hackathon
|
a5a5acd2e171ae7566e0d49c3729c98e1c68036f
|
[
"MIT"
] | null | null | null |
from gtts import gTTS
import os
tts = gTTS(text='사진 찍습니다. 하나...... 둘...... 셋', lang='ko')
tts.save("music3.mp3")
| 22.6
| 57
| 0.610619
| 20
| 113
| 3.45
| 0.8
| 0.289855
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.020408
| 0.132743
| 113
| 4
| 58
| 28.25
| 0.683673
| 0
| 0
| 0
| 0
| 0
| 0.345133
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
ae751e1aa4bc79e1345e0afbb50dee045cb9b28e
| 218
|
py
|
Python
|
rx/internal/__init__.py
|
rlugojr/RxPy
|
9f9b1de0ab833e53b0d1626a3b43a6c9424f01ec
|
[
"ECL-2.0",
"Apache-2.0"
] | 78
|
2015-01-22T23:57:01.000Z
|
2021-06-04T15:16:22.000Z
|
rx/internal/__init__.py
|
rlugojr/RxPy
|
9f9b1de0ab833e53b0d1626a3b43a6c9424f01ec
|
[
"ECL-2.0",
"Apache-2.0"
] | 1
|
2015-10-19T12:59:57.000Z
|
2015-10-19T12:59:57.000Z
|
rx/internal/__init__.py
|
rlugojr/RxPy
|
9f9b1de0ab833e53b0d1626a3b43a6c9424f01ec
|
[
"ECL-2.0",
"Apache-2.0"
] | 11
|
2015-02-16T20:43:45.000Z
|
2018-05-30T11:46:50.000Z
|
from .priorityqueue import PriorityQueue
from .enumerable import Enumerable
from .basic import noop, default_error
from .exceptions import SequenceContainsNoElementsError, ArgumentOutOfRangeException, DisposedException
| 54.5
| 103
| 0.885321
| 20
| 218
| 9.6
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.082569
| 218
| 4
| 103
| 54.5
| 0.96
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
ae8db5ae2dd212bcdf231820a14bf5ec2fa5299f
| 65
|
py
|
Python
|
qal/common/tests/resources/__init__.py
|
OptimalBPM/qal
|
4d7a31c0d68042b4110e1fa3e733711e0fdd473e
|
[
"Unlicense"
] | 3
|
2016-05-02T14:35:55.000Z
|
2021-08-31T14:19:15.000Z
|
qal/common/tests/resources/__init__.py
|
OptimalBPM/qal
|
4d7a31c0d68042b4110e1fa3e733711e0fdd473e
|
[
"Unlicense"
] | null | null | null |
qal/common/tests/resources/__init__.py
|
OptimalBPM/qal
|
4d7a31c0d68042b4110e1fa3e733711e0fdd473e
|
[
"Unlicense"
] | 1
|
2018-03-18T13:19:52.000Z
|
2018-03-18T13:19:52.000Z
|
"""Contains all the files needed for qal.common.tests to work."""
| 65
| 65
| 0.738462
| 11
| 65
| 4.363636
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.123077
| 65
| 1
| 65
| 65
| 0.842105
| 0.907692
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
8824582b855ac3170c0ffd9295bc47e698d347e1
| 2,337
|
py
|
Python
|
UnitTests/test_SpectralSettings_test.py
|
r0m30d4c/DlubalRFEM6
|
4bd0d744007bdc27d86d6ce535a507cdc81552ca
|
[
"MIT"
] | null | null | null |
UnitTests/test_SpectralSettings_test.py
|
r0m30d4c/DlubalRFEM6
|
4bd0d744007bdc27d86d6ce535a507cdc81552ca
|
[
"MIT"
] | null | null | null |
UnitTests/test_SpectralSettings_test.py
|
r0m30d4c/DlubalRFEM6
|
4bd0d744007bdc27d86d6ce535a507cdc81552ca
|
[
"MIT"
] | null | null | null |
import sys
sys.path.append(".")
from RFEM.Loads.lineLoad import LineLoad
from RFEM.enums import *
from RFEM.dataTypes import *
from RFEM.initModel import *
from RFEM.BasicObjects.material import *
from RFEM.BasicObjects.section import *
from RFEM.BasicObjects.thickness import *
from RFEM.BasicObjects.node import *
from RFEM.BasicObjects.line import *
from RFEM.BasicObjects.member import *
from RFEM.BasicObjects.surface import *
from RFEM.BasicObjects.solid import *
from RFEM.BasicObjects.opening import *
from RFEM.BasicObjects.lineSet import *
from RFEM.BasicObjects.memberSet import *
from RFEM.BasicObjects.surfaceSet import *
from RFEM.BasicObjects.solidSet import *
from RFEM.TypesForNodes.nodalSupport import *
from RFEM.TypesForMembers.memberHinge import *
from RFEM.LoadCasesAndCombinations.staticAnalysisSettings import *
from RFEM.LoadCasesAndCombinations.spectralAnalysisSettings import *
from RFEM.LoadCasesAndCombinations.loadCase import *
from RFEM.Loads.nodalLoad import *
from RFEM.Loads.memberLoad import *
from RFEM.Loads.surfaceLoad import *
def test_spectral_analysis_settings():
clientModel.service.begin_modification('new')
# Create Material
Material(1, 'S235')
#Create Spectral Analysis Settings
SpectralAnalysisSettings(1, 'SpectralSettings_1', PeriodicResponseCombinationRule.SRSS, DirectionalComponentCombinationRule.SRSS)
SpectralAnalysisSettings(2, 'SpectralSettings_2', PeriodicResponseCombinationRule.SRSS, DirectionalComponentCombinationRule.SCALED_SUM, equivalent_linear_combination=True, save_mode_results=True, signed_dominant_mode_results=True)
SpectralAnalysisSettings(3, 'SpectralSettings_3', PeriodicResponseCombinationRule.SRSS, DirectionalComponentCombinationRule.SCALED_SUM, directional_component_scale_value=0.4)
SpectralAnalysisSettings(4, 'SpectralSettings_4', PeriodicResponseCombinationRule.CQC, DirectionalComponentCombinationRule.SCALED_SUM, constant_d_for_each_mode=12)
SpectralAnalysisSettings(5, 'SpectralSettings_5', PeriodicResponseCombinationRule.CQC, DirectionalComponentCombinationRule.SCALED_SUM, damping_for_cqc_rule=CqsDampingRule.DIFFERENT_FOR_EACH_MODE)
SpectralAnalysisSettings(6, 'SpectralSettings_6', PeriodicResponseCombinationRule.CQC, DirectionalComponentCombinationRule.ABSOLUTE_SUM)
print('Ready!')
clientModel.service.finish_modification()
| 48.6875
| 231
| 0.854514
| 240
| 2,337
| 8.170833
| 0.366667
| 0.101989
| 0.164202
| 0.172361
| 0.160122
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009225
| 0.072315
| 2,337
| 47
| 232
| 49.723404
| 0.895295
| 0.020539
| 0
| 0
| 0
| 0
| 0.053368
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.026316
| true
| 0
| 0.684211
| 0
| 0.710526
| 0.026316
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
884172d83ad0bb7874958e31f72dda8d93d42710
| 116
|
py
|
Python
|
socialdistribution/apps.py
|
lida9/CMPUT404-project-socialdistribution
|
8faebcc71e79b368888a5f5b9c007b7ea575f2d7
|
[
"W3C-20150513"
] | 1
|
2021-03-01T04:44:17.000Z
|
2021-03-01T04:44:17.000Z
|
socialdistribution/apps.py
|
lida9/CMPUT404-project-socialdistribution
|
8faebcc71e79b368888a5f5b9c007b7ea575f2d7
|
[
"W3C-20150513"
] | 58
|
2021-02-20T03:09:15.000Z
|
2021-04-14T06:11:08.000Z
|
socialdistribution/apps.py
|
lida9/CMPUT404-project-socialdistribution
|
8faebcc71e79b368888a5f5b9c007b7ea575f2d7
|
[
"W3C-20150513"
] | null | null | null |
from django.apps import AppConfig
class SocialdistributionConfig(AppConfig):
name = 'socialdistribution'
| 19.333333
| 43
| 0.767241
| 10
| 116
| 8.9
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172414
| 116
| 5
| 44
| 23.2
| 0.927083
| 0
| 0
| 0
| 0
| 0
| 0.162162
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
88427627fbc56714029b5ad7590bfddbf713c741
| 395
|
py
|
Python
|
hug_explainable/__init__.py
|
hugapi/hug_explainable
|
c9953acbbf766ba1fc1ba644139dced3d67649a5
|
[
"MIT"
] | 4
|
2016-11-06T04:52:14.000Z
|
2018-11-02T02:02:22.000Z
|
hug_explainable/__init__.py
|
hugapi/hug_explainable
|
c9953acbbf766ba1fc1ba644139dced3d67649a5
|
[
"MIT"
] | 1
|
2018-11-03T05:04:17.000Z
|
2018-11-03T05:04:17.000Z
|
hug_explainable/__init__.py
|
hugapi/hug_explainable
|
c9953acbbf766ba1fc1ba644139dced3d67649a5
|
[
"MIT"
] | 2
|
2017-12-02T13:02:34.000Z
|
2018-11-02T02:04:17.000Z
|
"""Provides an on demand context manager that makes it easy to profile and explain code blocks / paths within hug."""
from hug_explainable._version import current
from hug_explainable.directive import Explainable, explain
from hug_explainable.type import explainable_toggle
from hug_explainable.context_manager import explainable
DONT_EXPLAIN = explainable_toggle(False)
__version__ = current
| 39.5
| 117
| 0.843038
| 53
| 395
| 6.037736
| 0.54717
| 0.0875
| 0.225
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113924
| 395
| 9
| 118
| 43.888889
| 0.914286
| 0.281013
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
8882120a639ec98078338978cd9249cc063935ab
| 142
|
py
|
Python
|
main.py
|
yasminhillis/detail_an_img
|
c6b9431c65c64d957599b2e2ea94cfca98f15026
|
[
"MIT"
] | 1
|
2020-10-19T15:56:11.000Z
|
2020-10-19T15:56:11.000Z
|
main.py
|
yasminhillis/detail_an_img
|
c6b9431c65c64d957599b2e2ea94cfca98f15026
|
[
"MIT"
] | null | null | null |
main.py
|
yasminhillis/detail_an_img
|
c6b9431c65c64d957599b2e2ea94cfca98f15026
|
[
"MIT"
] | null | null | null |
from PIL import Image
from PIL import ImageFilter
baby = Image.open('cute-baby.jpg')
detail = baby.filter(ImageFilter.DETAIL)
detail.show()
| 17.75
| 40
| 0.767606
| 21
| 142
| 5.190476
| 0.571429
| 0.12844
| 0.238532
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119718
| 142
| 8
| 41
| 17.75
| 0.872
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
88abe39b0358fd35f1bb8d7923d702f4e6da1f0c
| 514
|
py
|
Python
|
GLQGridCoord.py
|
dchandan/PySHTOOLS
|
8b1c32229db87b43d3f40d8f759a3e939f9d9a54
|
[
"BSD-3-Clause"
] | 1
|
2017-11-19T14:48:22.000Z
|
2017-11-19T14:48:22.000Z
|
GLQGridCoord.py
|
dchandan/PySHTOOLS
|
8b1c32229db87b43d3f40d8f759a3e939f9d9a54
|
[
"BSD-3-Clause"
] | 1
|
2018-01-30T07:08:55.000Z
|
2018-01-30T07:08:55.000Z
|
GLQGridCoord.py
|
dchandan/PySHTOOLS
|
8b1c32229db87b43d3f40d8f759a3e939f9d9a54
|
[
"BSD-3-Clause"
] | null | null | null |
from _shtools import glqgridcoord
def GLQGridCoord(l):
"""
Given a maximum spherical harmonic degree, this routine
will determine the latitude and longitude coordinates associated with
grids that are used in the Gauss-Legendre quadratue spherical harmonic
expansion routines. The coordinates are output in DEGREES.
ARGUMENTS
l - maximum spherical harmonic degree
RETURNS
latitudes, longitudes
Both are 1D arrays containing
"""
return glqgridcoord(l)
| 34.266667
| 75
| 0.725681
| 60
| 514
| 6.2
| 0.733333
| 0.137097
| 0.129032
| 0.16129
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002564
| 0.241245
| 514
| 15
| 76
| 34.266667
| 0.951282
| 0.735409
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.