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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3e4e25f7df7ab0b5a10cffb37d4f8bbd77d99cd7 | 148 | py | Python | pycore/extras/cors.py | ardihikaru/eaglestitch | b388f0c3b78b0539812985850905c78830e871aa | [
"MIT"
] | null | null | null | pycore/extras/cors.py | ardihikaru/eaglestitch | b388f0c3b78b0539812985850905c78830e871aa | [
"MIT"
] | null | null | null | pycore/extras/cors.py | ardihikaru/eaglestitch | b388f0c3b78b0539812985850905c78830e871aa | [
"MIT"
] | null | null | null | import aiohttp_cors
CORS_OPTIONS = {
"*": aiohttp_cors.ResourceOptions(
allow_credentials=True,
expose_headers="*",
allow_headers="*"
),
}
| 14.8 | 35 | 0.709459 | 15 | 148 | 6.6 | 0.666667 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141892 | 148 | 9 | 36 | 16.444444 | 0.779528 | 0 | 0 | 0 | 0 | 0 | 0.02027 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3e550df90e030bf8586681b03e9c881a4b01071b | 3,701 | py | Python | bin/lib/deleteMetadata.py | MSHE-Ledoux/geosync | e73464de12a02b4aa55e4981afe5b66ccbfa0671 | [
"ISC"
] | 4 | 2016-07-18T09:16:57.000Z | 2019-05-09T14:14:08.000Z | bin/lib/deleteMetadata.py | MSHE-Ledoux/geosync | e73464de12a02b4aa55e4981afe5b66ccbfa0671 | [
"ISC"
] | null | null | null | bin/lib/deleteMetadata.py | MSHE-Ledoux/geosync | e73464de12a02b4aa55e4981afe5b66ccbfa0671 | [
"ISC"
] | null | null | null | #!/usr/bin/python
# -*-coding:Utf-8 -*
"""module contenant deleteMetadata"""
import os
import re
import sys
def deleteMetadata(name, login, password, url, workspace, verbose=False):
#takes a keyword and delete metadata associated
url_csw = url + "/geonetwork/srv/fre/csw-publication"
keyword = workspace + ":" + name # keyword = geosync-restreint:baies_metadata__baies_metadata
# Connect to a CSW, and inspect its properties:
from owslib.csw import CatalogueServiceWeb
csw = CatalogueServiceWeb(url_csw, skip_caps=True, username=login, password=password)
# suppression des métadonnées relatives à "keyword" / couche geoserver
# TODO faire sans owslib via API rest
# ex: https://georchestra-mshe.univ-fcomte.fr/geonetwork/srv/fre/xml.search?any=geosync-ouvert:fouilles_chailluz__mobilier_pros
# cette recherche est stricte au sens où cela trouve ce qui correspond exactement (exact match) par exemple la recherche de 'myworkspace:foo' ne trouve pas 'myworkspace:foobar'
from owslib.fes import PropertyIsEqualTo, PropertyIsLike
myquery = PropertyIsEqualTo('csw:AnyText',keyword) # TODO vérifier que la recherche est stricte sinon risque de retourner des résultats non désirés (ex: 'myworkspace:foobar' en cherchant 'myworkspace:foo')
if verbose:
print "INFO CatalogueServiceWeb(" + url_csw + ",...) ... PropertyIsEqualTo('csw:AnyText'," + keyword + ")"
csw.getrecords2(constraints=[myquery], maxrecords=10)
resultat = csw.results
if verbose:
print "INFO " + str(csw.results['matches']) + " fiche(s) de metadata trouvée(s)"
if csw.results['matches'] > 1:
print "WARNING plus d'1 fiche de metadata trouvée pour " + keyword
result = True # s'il y a au moins 1 erreur, retourne False
for rec in csw.records:
try:
csw.transaction(ttype='delete', typename='MD_Metadata', identifier=csw.records[rec].identifier) #marche apparement pour les metadonnees étant de type gmd:MD_Metadata
result = True and result
except Exception as e:
sys.stderr.write("ERROR suppression de metadata pour " + keyword + " échouée : " + e.message + "\n")
print "ERROR suppression de metadata pour " + keyword + " échouée"
result = False
try:
identifier = csw.records[rec].identifier #genere une erreur si pas d'identifiant
# titre=csw.records[rec].title
print "OK suppression de metadata " + keyword + " (" + identifier + ") réussie"
except Exception as e:
print "OK suppression de metadata réussie"
print "WARNING " + e.message
return result
# test de la fonction deleteMetadata
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument("-i", "--name", action="store", dest="name", required=True)
parser.add_argument('-l', action="store", dest="login", required=True)
parser.add_argument('-p', action="store", dest="password", required=True)
parser.add_argument("-u", "--url", action="store", dest="url" , required=True)
parser.add_argument("-w", "--workspace", action="store", dest="workspace", required=True)
parser.add_argument('-v', "--verbose", action="store_true", dest="verbose", default=False)
args = parser.parse_args()
#print "INFO ",parser.parse_args()
if args.url:
deleteMetadata(args.name, args.login, args.password, args.url, args.workspace, args.verbose)
| 48.064935 | 210 | 0.652797 | 437 | 3,701 | 5.455378 | 0.453089 | 0.025168 | 0.032718 | 0.052852 | 0.148909 | 0.036913 | 0.036913 | 0 | 0 | 0 | 0 | 0.002474 | 0.235342 | 3,701 | 76 | 211 | 48.697368 | 0.839929 | 0.270738 | 0 | 0.130435 | 0 | 0 | 0.19811 | 0.025331 | 0 | 0 | 0 | 0.013158 | 0 | 0 | null | null | 0.086957 | 0.130435 | null | null | 0.152174 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3e616f67eb28c837592e977746fb6310f5686df0 | 298 | py | Python | ex26_primeira_e_ultima_ocorrencia_de_uma_string.py | FreeRafa/Curso.Python | 133b5dface3db94d21f20027580747eea7f5559d | [
"MIT"
] | 1 | 2022-01-17T11:20:33.000Z | 2022-01-17T11:20:33.000Z | ex26_primeira_e_ultima_ocorrencia_de_uma_string.py | FreeRafa/Curso.Python | 133b5dface3db94d21f20027580747eea7f5559d | [
"MIT"
] | null | null | null | ex26_primeira_e_ultima_ocorrencia_de_uma_string.py | FreeRafa/Curso.Python | 133b5dface3db94d21f20027580747eea7f5559d | [
"MIT"
] | null | null | null | from itertools import count
frase = str(input('Digite uma frase:')).upper().strip()
print('a letra a apareceu {}'.format(frase.count('A')))
print('Em que posição ela aparece primeiro {}'.format(frase.find('A')+1))
print('Em que posição ela aparece pela ultima vez {}'.format(frase.rfind('A')+1))
| 37.25 | 81 | 0.697987 | 47 | 298 | 4.425532 | 0.595745 | 0.158654 | 0.096154 | 0.163462 | 0.259615 | 0.259615 | 0 | 0 | 0 | 0 | 0 | 0.007519 | 0.107383 | 298 | 7 | 82 | 42.571429 | 0.774436 | 0 | 0 | 0 | 0 | 0 | 0.417508 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.6 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
3e68a3b94bfda47a4ac54558936d878a0bff0653 | 359 | py | Python | ubuild.py | toumorokoshi/sprinter | 20c01bf210e1e24dbfcae7416cdf266b0f936c4b | [
"MIT"
] | 3 | 2015-01-30T09:01:26.000Z | 2018-08-23T03:33:52.000Z | ubuild.py | toumorokoshi/sprinter | 20c01bf210e1e24dbfcae7416cdf266b0f936c4b | [
"MIT"
] | 26 | 2015-08-12T01:01:03.000Z | 2019-01-29T05:18:02.000Z | ubuild.py | toumorokoshi/sprinter | 20c01bf210e1e24dbfcae7416cdf266b0f936c4b | [
"MIT"
] | 3 | 2016-01-18T21:23:53.000Z | 2017-02-01T18:14:23.000Z | import os
def main(build):
build.packages.install(".", develop=True)
def test(build):
main(build)
build.packages.install("httpretty")
build.packages.install("mock")
build.packages.install("pytest")
build.packages.install("nose")
build.executables.run(
["py.test", "sprinter", "tests"]
+ build.options.args
)
| 21.117647 | 45 | 0.637883 | 41 | 359 | 5.585366 | 0.512195 | 0.283843 | 0.436681 | 0.19214 | 0.253275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.197772 | 359 | 16 | 46 | 22.4375 | 0.795139 | 0 | 0 | 0 | 0 | 0 | 0.122563 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.076923 | 0 | 0.230769 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
3e6a1be6ae733b741d88d4572f73cd34c065a586 | 1,152 | py | Python | guess.py | MightySCollins/python-challenges | 1ad41a517e6320a73634862c3bd5c67b67955a69 | [
"MIT"
] | 1 | 2018-09-16T17:06:36.000Z | 2018-09-16T17:06:36.000Z | guess.py | MightySCollins/python-challenges | 1ad41a517e6320a73634862c3bd5c67b67955a69 | [
"MIT"
] | null | null | null | guess.py | MightySCollins/python-challenges | 1ad41a517e6320a73634862c3bd5c67b67955a69 | [
"MIT"
] | 1 | 2018-09-16T17:06:22.000Z | 2018-09-16T17:06:22.000Z | from typing import List
def length(string: str) -> int:
pass
def character_code(char: str) -> int:
pass
def addition(first_number: int, second_number: int) -> int:
pass
def multiply(first_number: int, second_number: int) -> int:
pass
def lowercase(string: str) -> str:
pass
def uppercase(string: str) -> str:
pass
def remove_first_slice(array: List[int]) -> List[int]:
pass
def remove_first_pop(array: List[int]) -> List[int]:
pass
def remove_first_delete(array: List[int]) -> List[int]:
pass
assert length("Testwords") == 9
assert length("What goes here") == 14
assert character_code("a") == 97
assert character_code("😋") == 128523
assert addition(5, 10) == 15
assert addition(50, 5) == 55
assert multiply(50, 1) == 50
assert multiply(50, 5) == 250
assert lowercase("no idea") == "no idea"
assert lowercase("Tests") == "tests"
assert uppercase("HmmWhatsThis") == "HMMWHATSTHIS"
assert uppercase("words") == "WORDS"
assert remove_first_slice([2, 3, 5, 6]) == [3, 5, 6]
assert remove_first_pop([2, 3, 5, 6]) == [3, 5, 6]
assert remove_first_delete([2, 3, 5, 6]) == [3, 5, 6]
print("All done :)")
| 20.210526 | 59 | 0.655382 | 173 | 1,152 | 4.260116 | 0.312139 | 0.075984 | 0.081411 | 0.07327 | 0.363636 | 0.312076 | 0.280868 | 0.27137 | 0.27137 | 0.065129 | 0 | 0.055966 | 0.177951 | 1,152 | 56 | 60 | 20.571429 | 0.721225 | 0 | 0 | 0.257143 | 0 | 0 | 0.081597 | 0 | 0 | 0 | 0 | 0 | 0.428571 | 1 | 0.257143 | false | 0.257143 | 0.028571 | 0 | 0.285714 | 0.028571 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e47e49aac240894e91577f41cad8139eeae0b951 | 63 | py | Python | gssacipkg/__init__.py | pehruby/ACISimpleConfig | 308944afc310c79a98f5f942da85b467bea8b832 | [
"MIT"
] | 2 | 2019-04-25T17:37:34.000Z | 2019-06-22T17:12:58.000Z | gssacipkg/__init__.py | pehruby/ACISimpleConfig | 308944afc310c79a98f5f942da85b467bea8b832 | [
"MIT"
] | null | null | null | gssacipkg/__init__.py | pehruby/ACISimpleConfig | 308944afc310c79a98f5f942da85b467bea8b832 | [
"MIT"
] | null | null | null | from .gssacifunc import ( # noqa
ACIconfig,
ACIobj
)
| 12.6 | 34 | 0.619048 | 6 | 63 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.301587 | 63 | 4 | 35 | 15.75 | 0.886364 | 0.063492 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e49a9da21fa65fc9f0f9ec9fa2b3276313e296a9 | 262 | py | Python | category/views.py | GDG2021hackathon/modoogym-backend-dj | 1af8c4132a8979bf333b725b73c3e5eab3e228b5 | [
"MIT"
] | null | null | null | category/views.py | GDG2021hackathon/modoogym-backend-dj | 1af8c4132a8979bf333b725b73c3e5eab3e228b5 | [
"MIT"
] | null | null | null | category/views.py | GDG2021hackathon/modoogym-backend-dj | 1af8c4132a8979bf333b725b73c3e5eab3e228b5 | [
"MIT"
] | null | null | null | from rest_framework import viewsets
from category.models import Category
from category.serializers import CategorySerializer
class CategoryViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Category.objects.all()
serializer_class = CategorySerializer
| 26.2 | 53 | 0.835878 | 26 | 262 | 8.346154 | 0.615385 | 0.110599 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118321 | 262 | 9 | 54 | 29.111111 | 0.939394 | 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 | 0 | 0 | 0 | 3 |
e4a21891d426bbe36b9ce7ea8c76e4aa81a8ad08 | 221 | py | Python | nes/processors/cpu/instructions/branch/branch_if_clear.py | Hexadorsimal/pynes | dbb3d40c1240fa27f70fa798bcec09188755eec2 | [
"MIT"
] | 1 | 2017-05-13T18:57:09.000Z | 2017-05-13T18:57:09.000Z | nes/processors/cpu/instructions/branch/branch_if_clear.py | Hexadorsimal/py6502 | dbb3d40c1240fa27f70fa798bcec09188755eec2 | [
"MIT"
] | 7 | 2020-10-24T17:16:56.000Z | 2020-11-01T14:10:23.000Z | nes/processors/cpu/instructions/branch/branch_if_clear.py | Hexadorsimal/pynes | dbb3d40c1240fa27f70fa798bcec09188755eec2 | [
"MIT"
] | null | null | null | from .branch import BranchInstruction
class BranchIfClearInstruction(BranchInstruction):
flag_name = None
def meets_branch_condition(self, processor):
return not bool(processor.p.flags[self.flag_name])
| 24.555556 | 58 | 0.773756 | 25 | 221 | 6.68 | 0.76 | 0.095808 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 221 | 8 | 59 | 27.625 | 0.893048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
e4a57ea77d40ec0e674a4bf00390e11ff8b5a31e | 40 | py | Python | data/__init__.py | HELLORPG/GraduationProjec | 5d3925502626e7179598d447d0a07c3c28a499e2 | [
"Apache-2.0"
] | 1 | 2021-03-22T07:22:39.000Z | 2021-03-22T07:22:39.000Z | data/__init__.py | HELLORPG/GraduationProject | 5d3925502626e7179598d447d0a07c3c28a499e2 | [
"Apache-2.0"
] | null | null | null | data/__init__.py | HELLORPG/GraduationProject | 5d3925502626e7179598d447d0a07c3c28a499e2 | [
"Apache-2.0"
] | null | null | null | __all__ = ["conc_dataset", "dataloader"] | 40 | 40 | 0.725 | 4 | 40 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075 | 40 | 1 | 40 | 40 | 0.648649 | 0 | 0 | 0 | 0 | 0 | 0.536585 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e4bd239a540136255d2f0344585b5a3bd9842671 | 1,071 | py | Python | example/__init__.py | fuhrysteve/CeleryStore | 8056f1688dc37b69449ab62c368a8840befbed97 | [
"MIT"
] | 2 | 2016-01-18T15:06:57.000Z | 2016-01-20T21:36:38.000Z | example/__init__.py | fuhrysteve/CeleryStore | 8056f1688dc37b69449ab62c368a8840befbed97 | [
"MIT"
] | null | null | null | example/__init__.py | fuhrysteve/CeleryStore | 8056f1688dc37b69449ab62c368a8840befbed97 | [
"MIT"
] | null | null | null | import datetime as dt
from celery_store.mixins import PeriodicTaskMixin, TaskScheduleMixin
from celery import current_app as app
from celery.schedules import crontab
@app.task(name='sum-of-two-numbers')
def add(x, y):
return x + y
class PeriodicTask(PeriodicTaskMixin):
@property
def name(self):
return 'My Task'
def get_schedules(self):
schedule = TaskSchedule()
schedule.task = self
return [schedule]
def get_task(self):
return add
@classmethod
def get_all_with_active_schedules(cls):
return [TaskSchedule(), TaskSchedule()]
@classmethod
def get_latest_change_to_schedule(cls):
return dt.datetime.now() - dt.timedelta(minutes=5)
@property
def last_run_at(self):
return dt.datetime.now() - dt.timedelta(seconds=(60*4) + 50)
class TaskSchedule(TaskScheduleMixin):
@property
def schedule(self):
return crontab('*')
@property
def task(self):
task = PeriodicTask()
task.schedule = self
return task
| 20.596154 | 68 | 0.65733 | 127 | 1,071 | 5.433071 | 0.409449 | 0.086957 | 0.04058 | 0.055072 | 0.086957 | 0.086957 | 0 | 0 | 0 | 0 | 0 | 0.007444 | 0.247432 | 1,071 | 51 | 69 | 21 | 0.848635 | 0 | 0 | 0.171429 | 0 | 0 | 0.024276 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.257143 | false | 0 | 0.114286 | 0.2 | 0.685714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e4c5dcf1869052b0d23d0bbce109fc9dcff88da7 | 127 | py | Python | apps/core/urls.py | kkonieo/portfolio-server | 1c9524ae240dbd526a96f51cbf4d6f18291f535a | [
"MIT"
] | 4 | 2022-01-21T11:10:44.000Z | 2022-01-26T15:00:52.000Z | apps/core/urls.py | kkonieo/portfolio-server | 1c9524ae240dbd526a96f51cbf4d6f18291f535a | [
"MIT"
] | 22 | 2022-01-21T10:32:37.000Z | 2022-03-25T14:24:10.000Z | apps/core/urls.py | kkonieo/portfolio-server | 1c9524ae240dbd526a96f51cbf4d6f18291f535a | [
"MIT"
] | null | null | null | from django.urls import path
from apps.core.views import ImageView
urlpatterns = [
path("image", ImageView.as_view()),
]
| 15.875 | 39 | 0.724409 | 17 | 127 | 5.352941 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15748 | 127 | 7 | 40 | 18.142857 | 0.850467 | 0 | 0 | 0 | 0 | 0 | 0.03937 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e4d12e0f238694534f02a627f0cb986f30ac3958 | 430 | py | Python | src/pbn_api/models/__init__.py | iplweb/django-bpp | 85f183a99d8d5027ae4772efac1e4a9f21675849 | [
"BSD-3-Clause"
] | 1 | 2017-04-27T19:50:02.000Z | 2017-04-27T19:50:02.000Z | src/pbn_api/models/__init__.py | mpasternak/django-bpp | 434338821d5ad1aaee598f6327151aba0af66f5e | [
"BSD-3-Clause"
] | 41 | 2019-11-07T00:07:02.000Z | 2022-02-27T22:09:39.000Z | src/pbn_api/models/__init__.py | iplweb/bpp | f027415cc3faf1ca79082bf7bacd4be35b1a6fdf | [
"BSD-3-Clause"
] | null | null | null | from .conference import Conference # noqa
from .country import Country # noqa
from .institution import ( # noqa
Institution,
OswiadczenieInstytucji,
PublikacjaInstytucji,
)
from .journal import Journal # noqa
from .language import Language # noqa
from .publication import Publication # noqa
from .publisher import Publisher # noqa
from .scientist import Scientist # noqa
from .sentdata import SentData # noqa
| 30.714286 | 44 | 0.762791 | 47 | 430 | 6.978723 | 0.297872 | 0.170732 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183721 | 430 | 13 | 45 | 33.076923 | 0.934473 | 0.102326 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.692308 | 0 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
e4d63c4cdcd03f77f95b3f7ecd87b78df7e217d3 | 22 | py | Python | user/__init__.py | kollad/turbo-ninja | 9c3f66b2af64aec01f522d19b309cfdd723e67cf | [
"MIT"
] | null | null | null | user/__init__.py | kollad/turbo-ninja | 9c3f66b2af64aec01f522d19b309cfdd723e67cf | [
"MIT"
] | 1 | 2017-12-14T05:35:38.000Z | 2017-12-14T05:35:38.000Z | user/__init__.py | kollad/turbo-ninja | 9c3f66b2af64aec01f522d19b309cfdd723e67cf | [
"MIT"
] | null | null | null | __author__ = 'kollad'
| 11 | 21 | 0.727273 | 2 | 22 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 22 | 1 | 22 | 22 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
90332dbb43ee2a596700aef5bf285cb19c1f588d | 1,815 | py | Python | forum/templatetags/extra_filters.py | laygounas/cnprog | b33e41a431297f20fa2c4376b6a0bb1fd70751ee | [
"Apache-2.0"
] | 1 | 2018-01-12T04:10:36.000Z | 2018-01-12T04:10:36.000Z | forum/templatetags/extra_filters.py | laygounas/cnprog | b33e41a431297f20fa2c4376b6a0bb1fd70751ee | [
"Apache-2.0"
] | null | null | null | forum/templatetags/extra_filters.py | laygounas/cnprog | b33e41a431297f20fa2c4376b6a0bb1fd70751ee | [
"Apache-2.0"
] | null | null | null | from django import template
from forum import auth
register = template.Library()
@register.filter
def can_vote_up(user):
return auth.can_vote_up(user)
@register.filter
def can_flag_offensive(user):
return auth.can_flag_offensive(user)
@register.filter
def can_add_comments(user):
return auth.can_add_comments(user)
@register.filter
def can_vote_down(user):
return auth.can_vote_down(user)
@register.filter
def can_retag_questions(user):
return auth.can_retag_questions(user)
@register.filter
def can_edit_post(user, post):
return auth.can_edit_post(user, post)
@register.filter
def can_delete_comment(user, comment):
return auth.can_delete_comment(user, comment)
@register.filter
def can_view_offensive_flags(user):
return auth.can_view_offensive_flags(user)
@register.filter
def can_close_question(user, question):
return auth.can_close_question(user, question)
@register.filter
def can_lock_posts(user):
return auth.can_lock_posts(user)
@register.filter
def can_accept_answer(user, question, answer):
return auth.can_accept_answer(user, question, answer)
@register.filter
def can_reopen_question(user, question):
return auth.can_reopen_question(user, question)
@register.filter
def can_delete_post(user, post):
return auth.can_delete_post(user, post)
@register.filter
def can_view_user_edit(request_user, target_user):
return auth.can_view_user_edit(request_user, target_user)
@register.filter
def can_view_user_votes(request_user, target_user):
return auth.can_view_user_votes(request_user, target_user)
@register.filter
def can_view_user_preferences(request_user, target_user):
return auth.can_view_user_preferences(request_user, target_user) | 26.691176 | 68 | 0.762534 | 260 | 1,815 | 5.003846 | 0.153846 | 0.172175 | 0.20907 | 0.245965 | 0.786318 | 0.475788 | 0.335895 | 0.227517 | 0.172175 | 0.075327 | 0 | 0 | 0.153168 | 1,815 | 68 | 68 | 26.691176 | 0.845804 | 0 | 0 | 0.313725 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.039216 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
904248602c91cadf7680ac856fe31796ae4f6305 | 624 | py | Python | auctions/admin.py | huutrungrimp/commerce | 8a22ea44bfca69f96d721a3ebefd7729487db3cf | [
"MIT"
] | null | null | null | auctions/admin.py | huutrungrimp/commerce | 8a22ea44bfca69f96d721a3ebefd7729487db3cf | [
"MIT"
] | null | null | null | auctions/admin.py | huutrungrimp/commerce | 8a22ea44bfca69f96d721a3ebefd7729487db3cf | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import User, Category, Listing, WatchList, Bid, Comment
admin.site.register(User)
admin.site.register(Category)
admin.site.register(WatchList)
class ListingAdmin(admin.ModelAdmin):
list_display = ('title', 'username', 'price', 'status')
admin.site.register(Listing, ListingAdmin)
class CommentAdmin(admin.ModelAdmin):
list_display = ('listing', 'username', 'active')
admin.site.register(Comment, CommentAdmin)
class BidAdmin(admin.ModelAdmin):
list_display = ('listing', 'username', 'bidprice', 'bidstatus', 'completed')
admin.site.register(Bid, BidAdmin)
| 24.96 | 80 | 0.75 | 71 | 624 | 6.549296 | 0.408451 | 0.116129 | 0.219355 | 0.167742 | 0.176344 | 0.176344 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108974 | 624 | 24 | 81 | 26 | 0.836331 | 0 | 0 | 0 | 0 | 0 | 0.137821 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5f67cc490d593acacbf7442677559d5ca58933b1 | 788 | py | Python | learn/user.py | ehannesson/learn | c47325cdcd8820fda1aeb0d23e971990c68612d6 | [
"MIT"
] | null | null | null | learn/user.py | ehannesson/learn | c47325cdcd8820fda1aeb0d23e971990c68612d6 | [
"MIT"
] | null | null | null | learn/user.py | ehannesson/learn | c47325cdcd8820fda1aeb0d23e971990c68612d6 | [
"MIT"
] | null | null | null | # user.py
class User:
"""
Class representing an user.
Parameters
----------
TODO
Attributes
----------
Methods
-------
"""
def __init__(self, name, uuid=None):
self.name = name
self.uuid = self._get_uuid(uuid)
def _get_uuid(self, uuid):
"""
Get or create universally-unique identifier for user.
A UUID is generated only when the user is first created; otherwise,
this function returns the existing UUID.
"""
if uuid is None:
# TODO : create UUID function
pass
return uuid
# exercise statistics DB table
# date uuid ex_type_id ex_values user_solution actual_solution is_correct ex_time ex_level ex_subject ex_concepts user_mastery
| 18.761905 | 126 | 0.598985 | 96 | 788 | 4.71875 | 0.572917 | 0.03532 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.312183 | 788 | 41 | 127 | 19.219512 | 0.835793 | 0.571066 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04878 | 0 | 1 | 0.25 | false | 0.125 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
5f6e02930e3f57cf3ff3c88104de95c690fccb1a | 1,029 | py | Python | model.py | wichmann/evreg | b0995563a642973d7457bda995c3b6584ac3c7ff | [
"MIT"
] | null | null | null | model.py | wichmann/evreg | b0995563a642973d7457bda995c3b6584ac3c7ff | [
"MIT"
] | null | null | null | model.py | wichmann/evreg | b0995563a642973d7457bda995c3b6584ac3c7ff | [
"MIT"
] | null | null | null |
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Participant(db.Model):
id = db.Column(db.Integer, primary_key=True)
firstname = db.Column(db.String(80), nullable=False)
lastname = db.Column(db.String(80), nullable=False)
classname = db.Column(db.String(7), nullable=False)
email_student = db.Column(db.String(120), unique=True, nullable=False)
company_name = db.Column(db.String(80), nullable=False)
trainer_name = db.Column(db.String(80), nullable=False)
email_trainer = db.Column(db.String(120), nullable=False)
student_validation = db.Column(db.String(40), unique=True)
trainer_validation = db.Column(db.String(40), unique=True)
student_validated = db.Column(db.Boolean(), default=False)
trainer_validated = db.Column(db.Boolean(), default=False)
def get_full_name(self):
return '{} {}'.format(self.firstname, self.lastname)
def __repr__(self):
return f'<Student {self.get_full_name()}, {self.classname} from {self.company_name}>'
| 38.111111 | 93 | 0.708455 | 142 | 1,029 | 5 | 0.295775 | 0.135211 | 0.169014 | 0.202817 | 0.453521 | 0.4 | 0.4 | 0.205634 | 0 | 0 | 0 | 0.02164 | 0.146744 | 1,029 | 26 | 94 | 39.576923 | 0.787016 | 0 | 0 | 0 | 0 | 0 | 0.077821 | 0.022374 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.052632 | 0.105263 | 0.947368 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
5f771569a3a4bf9bc08d89d9998878e753515ec2 | 1,588 | py | Python | bfd/enum.py | zentarim/abfd | 10e86f58f0f779a4d02e07afa5f527447dfa1cd1 | [
"MIT"
] | null | null | null | bfd/enum.py | zentarim/abfd | 10e86f58f0f779a4d02e07afa5f527447dfa1cd1 | [
"MIT"
] | null | null | null | bfd/enum.py | zentarim/abfd | 10e86f58f0f779a4d02e07afa5f527447dfa1cd1 | [
"MIT"
] | null | null | null | from typing import Union, Dict, Any, Optional, Iterator, Tuple
from itertools import chain
__all__ = ['T_Enum']
MetaVals = Union[int, str, float, None]
class EnumMeta(type):
def __contains__(cls, item: MetaVals) -> bool:
return item in cls.__reverse_map
def __init__(cls, clname: str, *args):
cls.__reverse_map: Dict[Any, str] = {value: key for key, value in
chain(*(parent.__dict__.items() for parent in cls.__mro__))
if isinstance(value, (str, int, float, type(None))) and not key.startswith('_')}
super().__init__(clname, *args)
def __call__(cls, value: MetaVals) -> Optional[str]:
return cls.__reverse_map.get(value)
def __str__(cls):
return "Enum %s: [%s]" % (cls.__name__, ', '.join(("0x%02X" % value) if isinstance(value, int) else value
for value in cls.__reverse_map.keys()))
def items(cls) -> Iterator[Tuple[str, Any]]:
return ((value, key) for key, value in cls.__reverse_map.items())
class T_Enum(metaclass=EnumMeta):
"""
Implements C-like enums through the metaclass EnumMeta
"""
def __init__(self, value: MetaVals):
"""
A workaround for pycharm, which wants to have the __init__ in this class regardless of
the reimplemented __call__ in metaclass. It allows to avoid of usage
# noinspection PyArgumentList
before sentences like this:
T_enum(somevalue)
It won't be actually called. This just a stub.
:param value:
""" | 34.521739 | 113 | 0.620907 | 202 | 1,588 | 4.549505 | 0.445545 | 0.054407 | 0.070729 | 0.048966 | 0.08161 | 0.045702 | 0 | 0 | 0 | 0 | 0 | 0.002582 | 0.268262 | 1,588 | 46 | 114 | 34.521739 | 0.788296 | 0.222292 | 0 | 0 | 0 | 0 | 0.024369 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.095238 | 0.190476 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
5fbc2c6efa35d7621e55825c91669dcb1473a710 | 47 | py | Python | pytype/__version__.py | souravbadami/pytype | 804fa97e7f9208df2711976085a96f756b3949e6 | [
"Apache-2.0"
] | 1 | 2020-04-20T02:55:21.000Z | 2020-04-20T02:55:21.000Z | pytype/__version__.py | doc22940/pytype | 4772ad6fe89f4df75ae3d08e7374f68074175d4a | [
"Apache-2.0"
] | null | null | null | pytype/__version__.py | doc22940/pytype | 4772ad6fe89f4df75ae3d08e7374f68074175d4a | [
"Apache-2.0"
] | null | null | null | # pylint: skip-file
__version__ = '2020.04.01'
| 15.666667 | 26 | 0.702128 | 7 | 47 | 4.142857 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195122 | 0.12766 | 47 | 2 | 27 | 23.5 | 0.512195 | 0.361702 | 0 | 0 | 0 | 0 | 0.357143 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5fbe01098c22645c4b51a3a7b9dd36b429b02229 | 661 | py | Python | engine/ecs/system.py | TWoolhouse/Libraries | 26079ed387cb800cb97f20980720ae094008c7bf | [
"MIT"
] | 1 | 2020-10-11T15:34:56.000Z | 2020-10-11T15:34:56.000Z | engine/ecs/system.py | TWoolhouse/Libraries | 26079ed387cb800cb97f20980720ae094008c7bf | [
"MIT"
] | null | null | null | engine/ecs/system.py | TWoolhouse/Libraries | 26079ed387cb800cb97f20980720ae094008c7bf | [
"MIT"
] | null | null | null | from .component import Component
from typing import Type, TypeVar, Iterator, overload
C = TypeVar("C", bound=Component)
class System:
def __init__(self):
pass
def __call__(self, application: 'Application'):
self.__app = application
self.update(application)
def update(self, application: 'Application'):
pass
@overload
def components(self, type: Type[C]) -> Iterator[C]: ...
@overload
def components(self, type: Type[C], *types: Type[C]) -> Iterator[tuple[C]]: ...
def components(self, type: Type[C], *types: Type[C]) -> Iterator[C]:
return self.__app.world.components(type, *types)
| 26.44 | 83 | 0.644478 | 79 | 661 | 5.240506 | 0.316456 | 0.060386 | 0.123188 | 0.152174 | 0.31401 | 0.31401 | 0.31401 | 0.21256 | 0.21256 | 0.21256 | 0 | 0 | 0.213313 | 661 | 24 | 84 | 27.541667 | 0.796154 | 0 | 0 | 0.235294 | 0 | 0 | 0.034796 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.352941 | false | 0.117647 | 0.117647 | 0.058824 | 0.588235 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
395fb04b09182ee3f508c239b6a1a4985ed05cac | 295 | py | Python | utils/__init__.py | VCL3D/DronePose | c38a45270105ec2fd873540f384e070e5fc9c204 | [
"MIT"
] | 10 | 2020-08-24T12:27:52.000Z | 2021-08-31T01:48:28.000Z | utils/__init__.py | VCL3D/DronePose | c38a45270105ec2fd873540f384e070e5fc9c204 | [
"MIT"
] | 3 | 2020-08-24T12:47:09.000Z | 2021-06-08T08:45:44.000Z | utils/__init__.py | VCL3D/DronePose | c38a45270105ec2fd873540f384e070e5fc9c204 | [
"MIT"
] | 6 | 2020-08-24T12:46:57.000Z | 2021-04-06T00:43:45.000Z | from .init import *
from .opt import *
from .checkpoint import *
from .framework import *
from .logger import *
from .metrics import *
from .geometry import *
try:
from .visualization import *
except ImportError:
__KAOLIN_LOADED__ = False
else:
__KAOLIN_LOADED__ = True | 22.692308 | 33 | 0.701695 | 34 | 295 | 5.794118 | 0.529412 | 0.304569 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.227119 | 295 | 13 | 34 | 22.692308 | 0.864035 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.692308 | 0 | 0.692308 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
3964218a22141d7d8ba93228bbca7e0a0ca23f19 | 138 | py | Python | Capitulo_04/exercise4_3.py | thiagosouzalink/my_codes-exercices-book-curso_intensivo_de_python | 841aa855a7450ad3d0ba65393ba0b6debcd6a770 | [
"MIT"
] | null | null | null | Capitulo_04/exercise4_3.py | thiagosouzalink/my_codes-exercices-book-curso_intensivo_de_python | 841aa855a7450ad3d0ba65393ba0b6debcd6a770 | [
"MIT"
] | null | null | null | Capitulo_04/exercise4_3.py | thiagosouzalink/my_codes-exercices-book-curso_intensivo_de_python | 841aa855a7450ad3d0ba65393ba0b6debcd6a770 | [
"MIT"
] | null | null | null | """
4.3 – Contando até vinte: Use um laço for para exibir os números de 1 a 20,
incluindo-os.
"""
for num in range(1, 21):
print(num) | 19.714286 | 75 | 0.652174 | 28 | 138 | 3.25 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074074 | 0.217391 | 138 | 7 | 76 | 19.714286 | 0.759259 | 0.644928 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
3992ac7acc93411f669145f5838b463b2ab44d88 | 97 | py | Python | src/python/test.py | aaronhktan/homebridge-bmp280 | fdd58cc299f4a5f489238928620d9bcaac7c48b3 | [
"MIT"
] | 3 | 2020-06-17T17:14:59.000Z | 2021-08-13T08:06:09.000Z | src/python/test.py | aaronhktan/homebridge-bmp280 | fdd58cc299f4a5f489238928620d9bcaac7c48b3 | [
"MIT"
] | 1 | 2020-08-21T06:27:24.000Z | 2020-08-21T06:27:24.000Z | src/python/test.py | aaronhktan/homebridge-bmp280 | fdd58cc299f4a5f489238928620d9bcaac7c48b3 | [
"MIT"
] | null | null | null | import spidev
spi = spidev.SpiDev()
spi.open(0, 1)
print(spi.xfer2([0xD0, 0x00], 50000, 5, 8))
| 13.857143 | 43 | 0.659794 | 17 | 97 | 3.764706 | 0.764706 | 0.28125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180723 | 0.14433 | 97 | 6 | 44 | 16.166667 | 0.590361 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
39992a6e01e6f6550bbebfdad4e10a98a1d3c55e | 367 | py | Python | app/enterprise/models/enterprise.py | confbot-telegram-conferences/confbot | 52fa307275b679748b5a7a6e7cb29bfc7b792875 | [
"MIT"
] | 1 | 2022-01-18T05:19:45.000Z | 2022-01-18T05:19:45.000Z | app/enterprise/models/enterprise.py | confbot-telegram-conferences/confbot | 52fa307275b679748b5a7a6e7cb29bfc7b792875 | [
"MIT"
] | null | null | null | app/enterprise/models/enterprise.py | confbot-telegram-conferences/confbot | 52fa307275b679748b5a7a6e7cb29bfc7b792875 | [
"MIT"
] | 1 | 2022-01-18T13:54:57.000Z | 2022-01-18T13:54:57.000Z | from django.db.models import CharField, ManyToManyField
from django.utils.translation import gettext_lazy as _
from app.utils.models import BaseModel
from app.users.models import User
class Enterprise(BaseModel):
name = CharField(_("Name of Enterprise"), max_length=255)
members = ManyToManyField(User, through="UserEnterprise", related_name="enterprises")
| 36.7 | 89 | 0.798365 | 46 | 367 | 6.26087 | 0.608696 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009231 | 0.114441 | 367 | 9 | 90 | 40.777778 | 0.876923 | 0 | 0 | 0 | 0 | 0 | 0.117166 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
39a31fb769c6fae145a8af666f404baf9f291a41 | 14,728 | py | Python | cohesity_management_sdk/controllers/protection_policies.py | sachinthakare-cohesity/management-sdk-python | c95f67b7d387d5bab8392be43190e598280ae7b5 | [
"MIT"
] | null | null | null | cohesity_management_sdk/controllers/protection_policies.py | sachinthakare-cohesity/management-sdk-python | c95f67b7d387d5bab8392be43190e598280ae7b5 | [
"MIT"
] | null | null | null | cohesity_management_sdk/controllers/protection_policies.py | sachinthakare-cohesity/management-sdk-python | c95f67b7d387d5bab8392be43190e598280ae7b5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
import logging
from cohesity_management_sdk.api_helper import APIHelper
from cohesity_management_sdk.configuration import Configuration
from cohesity_management_sdk.controllers.base_controller import BaseController
from cohesity_management_sdk.http.auth.auth_manager import AuthManager
from cohesity_management_sdk.models.protection_policy import ProtectionPolicy
from cohesity_management_sdk.exceptions.error_error_exception import ErrorErrorException
class ProtectionPolicies(BaseController):
"""A Controller to access Endpoints in the cohesity_management_sdk API."""
def __init__(self, client=None, call_back=None):
super(ProtectionPolicies, self).__init__(client, call_back)
self.logger = logging.getLogger(__name__)
def get_protection_policy_by_id(self,
id):
"""Does a GET request to /public/protectionPolicies/{id}.
Returns the Protection Policy corresponding to the specified Policy
Id.
Args:
id (string): Specifies a unique id of the Protection Policy to
return.
Returns:
ProtectionPolicy: Response from the API. Success
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
try:
self.logger.info('get_protection_policy_by_id called.')
# Validate required parameters
self.logger.info('Validating required parameters for get_protection_policy_by_id.')
self.validate_parameters(id=id)
# Prepare query URL
self.logger.info('Preparing query URL for get_protection_policy_by_id.')
_url_path = '/public/protectionPolicies/{id}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'id': id
})
_query_builder = Configuration.get_base_uri()
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
self.logger.info('Preparing headers for get_protection_policy_by_id.')
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
self.logger.info('Preparing and executing request for get_protection_policy_by_id.')
_request = self.http_client.get(_query_url, headers=_headers)
AuthManager.apply(_request)
_context = self.execute_request(_request, name = 'get_protection_policy_by_id')
# Endpoint and global error handling using HTTP status codes.
self.logger.info('Validating response for get_protection_policy_by_id.')
if _context.response.status_code == 0:
raise ErrorErrorException('Error', _context)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, ProtectionPolicy.from_dictionary)
except Exception as e:
self.logger.error(e, exc_info = True)
raise
def update_protection_policy(self,
body,
id):
"""Does a PUT request to /public/protectionPolicies/{id}.
Returns the updated Protection Policy.
Args:
body (ProtectionPolicyRequest): Request to update a Protection
Policy.
id (string): Specifies a unique id of the Protection Policy to
return.
Returns:
ProtectionPolicy: Response from the API. Success
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
try:
self.logger.info('update_protection_policy called.')
# Validate required parameters
self.logger.info('Validating required parameters for update_protection_policy.')
self.validate_parameters(body=body,
id=id)
# Prepare query URL
self.logger.info('Preparing query URL for update_protection_policy.')
_url_path = '/public/protectionPolicies/{id}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'id': id
})
_query_builder = Configuration.get_base_uri()
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
self.logger.info('Preparing headers for update_protection_policy.')
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8'
}
# Prepare and execute request
self.logger.info('Preparing and executing request for update_protection_policy.')
_request = self.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
AuthManager.apply(_request)
_context = self.execute_request(_request, name = 'update_protection_policy')
# Endpoint and global error handling using HTTP status codes.
self.logger.info('Validating response for update_protection_policy.')
if _context.response.status_code == 0:
raise ErrorErrorException('Error', _context)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, ProtectionPolicy.from_dictionary)
except Exception as e:
self.logger.error(e, exc_info = True)
raise
def delete_protection_policy(self,
id):
"""Does a DELETE request to /public/protectionPolicies/{id}.
Returns Success if the Protection Policy is deleted.
Args:
id (string): Specifies a unique id of the Protection Policy to
return.
Returns:
void: Response from the API. No Content
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
try:
self.logger.info('delete_protection_policy called.')
# Validate required parameters
self.logger.info('Validating required parameters for delete_protection_policy.')
self.validate_parameters(id=id)
# Prepare query URL
self.logger.info('Preparing query URL for delete_protection_policy.')
_url_path = '/public/protectionPolicies/{id}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'id': id
})
_query_builder = Configuration.get_base_uri()
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare and execute request
self.logger.info('Preparing and executing request for delete_protection_policy.')
_request = self.http_client.delete(_query_url)
AuthManager.apply(_request)
_context = self.execute_request(_request, name = 'delete_protection_policy')
# Endpoint and global error handling using HTTP status codes.
self.logger.info('Validating response for delete_protection_policy.')
if _context.response.status_code == 0:
raise ErrorErrorException('Error', _context)
self.validate_response(_context)
except Exception as e:
self.logger.error(e, exc_info = True)
raise
def get_protection_policies(self,
environments=None,
vault_ids=None,
tenant_ids=None,
all_under_hierarchy=None,
ids=None,
names=None):
"""Does a GET request to /public/protectionPolicies.
If no parameters are specified, all Protection Policies currently on
the
Cohesity Cluster are returned.
Specifying parameters filters the results that are returned.
Args:
environments (list of Environments1Enum, optional): Filter by
Environment type such as 'kVMware', 'kView', etc. Only
Policies protecting the specified environment type are
returned. NOTE: 'kPuppeteer' refers to Cohesity's Remote
Adapter.
vault_ids (list of long|int, optional): Filter by a list of Vault
ids. Policies archiving to any of the specified vaults will be
returned.
tenant_ids (list of string, optional): TenantIds contains ids of
the tenants for which objects are to be returned.
all_under_hierarchy (bool, optional): AllUnderHierarchy specifies
if objects of all the tenants under the hierarchy of the
logged in user's organization should be returned.
ids (list of string, optional): Filter by a list of Protection
Policy ids.
names (list of string, optional): Filter by a list of Protection
Policy names.
Returns:
list of ProtectionPolicy: Response from the API. Success
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
try:
self.logger.info('get_protection_policies called.')
# Prepare query URL
self.logger.info('Preparing query URL for get_protection_policies.')
_url_path = '/public/protectionPolicies'
_query_builder = Configuration.get_base_uri()
_query_builder += _url_path
_query_parameters = {
'environments': environments,
'vaultIds': vault_ids,
'tenantIds': tenant_ids,
'allUnderHierarchy': all_under_hierarchy,
'ids': ids,
'names': names
}
_query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
_query_parameters, Configuration.array_serialization)
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
self.logger.info('Preparing headers for get_protection_policies.')
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
self.logger.info('Preparing and executing request for get_protection_policies.')
_request = self.http_client.get(_query_url, headers=_headers)
AuthManager.apply(_request)
_context = self.execute_request(_request, name = 'get_protection_policies')
# Endpoint and global error handling using HTTP status codes.
self.logger.info('Validating response for get_protection_policies.')
if _context.response.status_code == 0:
raise ErrorErrorException('Error', _context)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, ProtectionPolicy.from_dictionary)
except Exception as e:
self.logger.error(e, exc_info = True)
raise
def create_protection_policy(self,
body):
"""Does a POST request to /public/protectionPolicies.
Returns the created Protection Policy.
Args:
body (ProtectionPolicyRequest): Request to create a Protection
Policy.
Returns:
ProtectionPolicy: Response from the API. Success
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
try:
self.logger.info('create_protection_policy called.')
# Validate required parameters
self.logger.info('Validating required parameters for create_protection_policy.')
self.validate_parameters(body=body)
# Prepare query URL
self.logger.info('Preparing query URL for create_protection_policy.')
_url_path = '/public/protectionPolicies'
_query_builder = Configuration.get_base_uri()
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
self.logger.info('Preparing headers for create_protection_policy.')
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8'
}
# Prepare and execute request
self.logger.info('Preparing and executing request for create_protection_policy.')
_request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
AuthManager.apply(_request)
_context = self.execute_request(_request, name = 'create_protection_policy')
# Endpoint and global error handling using HTTP status codes.
self.logger.info('Validating response for create_protection_policy.')
if _context.response.status_code == 0:
raise ErrorErrorException('Error', _context)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, ProtectionPolicy.from_dictionary)
except Exception as e:
self.logger.error(e, exc_info = True)
raise
| 42.08 | 117 | 0.619229 | 1,533 | 14,728 | 5.720809 | 0.131115 | 0.078449 | 0.044698 | 0.036716 | 0.754048 | 0.746978 | 0.714823 | 0.675713 | 0.675713 | 0.668985 | 0 | 0.001292 | 0.316879 | 14,728 | 349 | 118 | 42.200573 | 0.870391 | 0.301331 | 0 | 0.538922 | 0 | 0 | 0.200773 | 0.101849 | 0 | 0 | 0 | 0 | 0 | 1 | 0.035928 | false | 0 | 0.041916 | 0 | 0.107784 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
39a4a6ab1790cfe5f770127787b66bb356571710 | 416 | py | Python | chunked_media/admin.py | CerealBoxMedia/chunked_media | 324d9b7d76323fa1ca5296d733b82dc5ab5f98c0 | [
"BSD-2-Clause"
] | null | null | null | chunked_media/admin.py | CerealBoxMedia/chunked_media | 324d9b7d76323fa1ca5296d733b82dc5ab5f98c0 | [
"BSD-2-Clause"
] | null | null | null | chunked_media/admin.py | CerealBoxMedia/chunked_media | 324d9b7d76323fa1ca5296d733b82dc5ab5f98c0 | [
"BSD-2-Clause"
] | null | null | null | from django.conf import settings
from django.contrib import admin
from chunked_media.models import Media
if hasattr(settings, 'CHUNKED_MEDIA_MODEL') and settings.CHUNKED_MEDIA_MODEL != 'chunked_media.Media':
# This installation provides its own custom media class;
# to avoid confusion, we won't expose the unused chunked_media.Media class
# in the admin.
pass
else:
admin.site.register(Media)
| 32 | 102 | 0.769231 | 60 | 416 | 5.216667 | 0.583333 | 0.191693 | 0.127796 | 0.159744 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163462 | 416 | 12 | 103 | 34.666667 | 0.899425 | 0.338942 | 0 | 0 | 0 | 0 | 0.140221 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.142857 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
39adb6bf40fc3d61bae5432ebc3719080c100e97 | 1,705 | py | Python | test/string_test.py | andydevs/good-handlers | b2e6ed89f14e7b4aa94b28d05eb4a529bb90e3cd | [
"MIT"
] | null | null | null | test/string_test.py | andydevs/good-handlers | b2e6ed89f14e7b4aa94b28d05eb4a529bb90e3cd | [
"MIT"
] | null | null | null | test/string_test.py | andydevs/good-handlers | b2e6ed89f14e7b4aa94b28d05eb4a529bb90e3cd | [
"MIT"
] | null | null | null | """
Good Handlers
Method and function handlers that implement common
behaviors without writing the entire function
Author: Anshul Kharbanda
Created: 6 - 24 - 2018
"""
from unittest import TestCase
from good_handlers.string import *
class Person1:
"""
Test class for ValueStringHandler
Author: Anshul Kharbanda
Created: 11 - 10 - 2017
"""
def __init__(self, name, age):
self._name = name
self._age = age
@property
def name(self):
return self._name
@property
def age(self):
return self._age
__repr__ = ValueStringHandler(('name', 'age'))
class Person2:
"""
Test class for ValueStringHandler
Author: Anshul Kharbanda
Created: 11 - 10 - 2017
"""
def __init__(self, name, age):
self._name = name
self._age = age
@property
def name(self):
return self._name
@property
def age(self):
return self._age
__repr__ = KeyValueStringHandler(('name', 'age'))
class ValueStringHandlerTest(TestCase):
"""
Tests ValueStringHandler
Author: Anshul Kharbanda
Created: 11 - 10 - 2017
"""
KLS = Person1
RPR = 'Person1(\'Joe Schmoe\', 32)'
def setUp(self):
"""
Sets up test case
"""
self.person = self.KLS(name='Joe Schmoe', age=32)
def test_repr(self):
"""
Tests repr method
"""
self.assertEqual(repr(self.person), self.RPR)
class KeyValueStringHandlerTest(ValueStringHandlerTest):
"""
Tests ValueStringHandler
Author: Anshul Kharbanda
Created: 11 - 10 - 2017
"""
KLS = Person2
RPR = 'Person2(name=\'Joe Schmoe\', age=32)' | 19.157303 | 57 | 0.608211 | 185 | 1,705 | 5.464865 | 0.308108 | 0.047478 | 0.103858 | 0.138477 | 0.502473 | 0.466864 | 0.466864 | 0.466864 | 0.466864 | 0.466864 | 0 | 0.041975 | 0.28739 | 1,705 | 89 | 58 | 19.157303 | 0.790123 | 0.304399 | 0 | 0.529412 | 0 | 0 | 0.058598 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 1 | 0.235294 | false | 0 | 0.058824 | 0.117647 | 0.705882 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
39b12623769accb981209849ce39f9f975831d5d | 209 | py | Python | real_estate_agency/resale/urls.py | Dybov/real_estate_agency | a4392b18c5169ff89c3c7b63afe017f6ede0b431 | [
"MIT"
] | 1 | 2017-09-24T18:53:59.000Z | 2017-09-24T18:53:59.000Z | real_estate_agency/resale/urls.py | Dybov/real_estate_agency | a4392b18c5169ff89c3c7b63afe017f6ede0b431 | [
"MIT"
] | null | null | null | real_estate_agency/resale/urls.py | Dybov/real_estate_agency | a4392b18c5169ff89c3c7b63afe017f6ede0b431 | [
"MIT"
] | null | null | null | from django.conf.urls import url
from .views import ResaleListView, detailed
urlpatterns = [
url(r'^$', ResaleListView.as_view(), name='index'),
url(r'^(?P<pk>\d+)/$', detailed, name='detailed'),
]
| 20.9 | 55 | 0.655502 | 27 | 209 | 5.037037 | 0.666667 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.143541 | 209 | 9 | 56 | 23.222222 | 0.759777 | 0 | 0 | 0 | 0 | 0 | 0.138756 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
39da59e60266316cba5eb1ea2a6a2d318f445471 | 210 | py | Python | tests/__init__.py | yaal-fr/canaille | 828d190adea7bc6e34d59bac42cbc1283509880b | [
"MIT"
] | 3 | 2020-11-03T14:44:53.000Z | 2021-09-26T16:49:01.000Z | tests/__init__.py | yaal-fr/canaille | 828d190adea7bc6e34d59bac42cbc1283509880b | [
"MIT"
] | null | null | null | tests/__init__.py | yaal-fr/canaille | 828d190adea7bc6e34d59bac42cbc1283509880b | [
"MIT"
] | null | null | null | import base64
def client_credentials(client):
return base64.b64encode(
client.oauthClientID.encode("utf-8")
+ b":"
+ client.oauthClientSecret.encode("utf-8")
).decode("utf-8")
| 21 | 50 | 0.633333 | 23 | 210 | 5.73913 | 0.608696 | 0.090909 | 0.151515 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054878 | 0.219048 | 210 | 9 | 51 | 23.333333 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.07619 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0.142857 | 0.428571 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
f2d8770dcee1e6f1ab5fd67ad7dc3502b3f1062f | 28,524 | py | Python | pda_factory.py | tclokie/CFLpy | 90fb71cd6f972a7dad2c7692bb0e13fdb7c60cf7 | [
"MIT"
] | null | null | null | pda_factory.py | tclokie/CFLpy | 90fb71cd6f972a7dad2c7692bb0e13fdb7c60cf7 | [
"MIT"
] | null | null | null | pda_factory.py | tclokie/CFLpy | 90fb71cd6f972a7dad2c7692bb0e13fdb7c60cf7 | [
"MIT"
] | null | null | null | from PDA import PDA
import math
EMPTY_STRING = ''
def int_to_bin(x):
return x.__format__('b')
def s_2(x):
return int_to_bin(x).count('1')
def base_b(n,b):
s = EMPTY_STRING
while n > 0:
s += str(n % b)
n //= b
return s[::-1]
def s_b(n,b):
count = 0
while n > 0:
count += n % b
n //= b
return count
# def is_k_flimsy(x, k):
# return s_2(x) > s_2(k*x)
# def find_first_k_flimsy_numbers (k, limit): # Finds the k-flimsy integers in [1..limit]
# output = []
# for i in range (1, limit):
# if (is_k_flimsy(i,k)):
# output.append(i)
# return output
def create_palindrome_PDA():
states = {'S', 'END'}
alphabet = {'', 'a', 'b'}
stack_alphabet = {'Z', 'a', 'b'}
start_state = 'S'
start_stack = 'Z'
transitions = {
('S', 'a', 'Z'): [('S', 'aZ'), ('END', 'Z')],
('S', 'a', 'a'): [('S', 'aa'), ('END', 'a')],
('S', 'a', 'b'): [('S', 'ab'), ('END', 'b')],
('S', 'b', 'Z'): [('S', 'bZ'), ('END', 'Z')],
('S', 'b', 'a'): [('S', 'ba'), ('END', 'a')],
('S', 'b', 'b'): [('S', 'bb'), ('END', 'b')],
('S', '', 'Z'): [('END', 'Z')],
('S', '', 'a'): [('END', 'a')],
('S', '', 'b'): [('END', 'b')],
('END', '', 'Z'): [('END', '')],
('END', 'a', 'a'): [('END', '')],
('END', 'b', 'b'): [('END', '')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
def create_even_palindrome_PDA():
states = {'S', 'END'}
alphabet = {'', 'a', 'b'}
stack_alphabet = {'Z', 'a', 'b'}
start_state = 'S'
start_stack = 'Z'
transitions = {
('S', 'a', 'Z'): [('S', 'aZ')],
('S', 'a', 'a'): [('S', 'aa')],
('S', 'a', 'b'): [('S', 'ab')],
('S', 'b', 'Z'): [('S', 'bZ')],
('S', 'b', 'a'): [('S', 'ba')],
('S', 'b', 'b'): [('S', 'bb')],
('S', '', 'Z'): [('END', 'Z')],
('S', '', 'a'): [('END', 'a')],
('S', '', 'b'): [('END', 'b')],
('END', '', 'Z'): [('END', '')],
('END', 'a', 'a'): [('END', '')],
('END', 'b', 'b'): [('END', '')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
def create_even_palindrome_PDA_alternate():
states = {'q_0', 'q_1', 'q_2'}
alphabet = {'a', 'b', ''}
stack_alphabet = {'Z', 'a', 'b'}
start_state = 'q_0'
start_stack = 'Z'
transitions = {
('q_0', 'a', 'Z'): [('q_0', 'aZ')],
('q_0', 'a', 'a'): [('q_0', 'aa')],
('q_0', 'a', 'b'): [('q_0', 'ab')],
('q_0', 'b', 'Z'): [('q_0', 'bZ')],
('q_0', 'b', 'a'): [('q_0', 'ba')],
('q_0', 'b', 'b'): [('q_0', 'bb')],
('q_0', '', 'Z'): [('q_1', 'Z')],
('q_0', '', 'a'): [('q_1', 'a')],
('q_0', '', 'b'): [('q_1', 'b')],
('q_1', 'a', 'a'): [('q_1', '')],
('q_1', 'b', 'b'): [('q_1', '')],
('q_1', '', 'Z'): [('q_2', '')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
def create_an_bn_PDA():
states = {'S', 'END'}
alphabet = {'', 'a', 'b'}
stack_alphabet = {'Z', 'a'}
start_state = 'S'
start_stack = 'Z'
transitions = {
('S', '', 'Z'): [('END', '')],
('S', 'a', 'Z'): [('S', 'aZ')],
('S', 'a', 'a'): [('S', 'aa')],
('S', 'b', 'a'): [('END', '')],
('END', '', 'Z'): [('END', '')],
('END', 'b', 'a'): [('END', '')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
def create_equal_as_bs_PDA():
states = {'S', 'END'}
alphabet = {'', 'a', 'b'}
stack_alphabet = {'Z', 'a', 'b'}
start_state = 'S'
start_stack = 'Z'
transitions = {
('S', '', 'Z'): [('END', '')],
('S', 'a', 'Z'): [('S', 'aZ')],
('S', 'a', 'a'): [('S', 'aa')],
('S', 'a', 'b'): [('S', '')],
('S', 'b', 'Z'): [('S', 'bZ')],
('S', 'b', 'a'): [('S', '')],
('S', 'b', 'b'): [('S', 'bb')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
def create_dyck_PDA(): # TODO: Test this
states = {'S', 'END'}
alphabet = {'', '(', ')'}
stack_alphabet = {'Z', '('}
start_state = 'S'
start_stack = 'Z'
transitions = {
('S', '(', 'Z'): [('S', '(Z')],
('S', '(', '('): [('S', '((')],
('S', ')', '('): [('S', '')],
('S', '', 'Z'): [('END', '')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
# For the language a^m b^n c^m
def create_am_bn_cm_PDA():
states = {'q_0', 'q_1', 'q_2'}
alphabet = {'', 'a', 'b', 'c'}
stack_alphabet = {'Z', 'a'}
start_state = 'q_0'
start_stack = 'Z'
transitions = {
('q_0', 'a', 'Z'): [('q_0', 'aZ')],
('q_0', 'a', 'a'): [('q_0', 'aa')],
('q_0', '', 'Z'): [('q_0', '')],
('q_0', 'b', 'Z'): [('q_1', 'Z')],
('q_0', 'b', 'a'): [('q_1', 'a')],
('q_0', 'c', 'a'): [('q_2', '')],
('q_1', 'b', 'Z'): [('q_1', 'Z')],
('q_1', 'b', 'a'): [('q_1', 'a')],
('q_1', '', 'Z'): [('q_1', '')],
('q_1', 'c', 'a'): [('q_2', '')],
('q_2', 'c', 'a'): [('q_2', '')],
('q_2', '', 'Z'): [('q_2', '')],
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
# Create a PDA to accept all 3-flimsy binary numbers
def create_3flimsy_PDA():
states = {'-0', '-1', '-2', '+2', '+1', '+0', 'END'}
alphabet = {'0', '1', ''}
stack_alphabet = {'Z', 'X'}
start_state = '-0'
start_stack = 'Z'
transitions = {
('-0', '0', 'Z'): [('-0', 'Z')],
('-0', '0', 'X'): [('-0', 'X')],
('-0', '1', 'Z'): [('-1', 'Z')],
('-0', '1', 'X'): [('-1', 'X')],
('-1', '0', 'Z'): [('-0', 'XZ')],
('-1', '0', 'X'): [('-0', 'XX')],
('-1', '1', 'Z'): [('+2', 'Z')],
('-1', '1', 'X'): [('-2', '')],
('-2', '0', 'Z'): [('-1', 'Z')],
('-2', '0', 'X'): [('-1', 'X')],
('-2', '1', 'Z'): [('-2', 'Z')],
('-2', '1', 'X'): [('-2', 'X')],
('+2', '0', 'Z'): [('+1', 'Z')],
('+2', '0', 'X'): [('+1', 'X')],
('+2', '1', 'Z'): [('+2', 'Z')],
('+2', '1', 'X'): [('+2', 'X'), ('END', '')],
('+1', '0', 'Z'): [('-0', 'Z')],
('+1', '0', 'X'): [('+0', '')],
('+1', '1', 'Z'): [('+2', 'XZ'), ('END', '')],
('+1', '1', 'X'): [('+2', 'XX'), ('END', '')],
('+0', '0', 'Z'): [('+0', 'Z')],
('+0', '0', 'X'): [('+0', 'X')],
('+0', '1', 'Z'): [('+1', 'Z')],
('+0', '1', 'X'): [('+1', 'X'), ('END', '')],
('END', '', 'Z'): [('END', '')],
('END', '', 'X'): [('END', '')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
def create_3flimsy_PDA_alternate():
states = {'-0', '-1', '-2', '+2', '+1', '+0', 'END_0', 'END_1'}
alphabet = {'0', '1', ''}
stack_alphabet = {'Z', 'X'}
start_state = '-0'
start_stack = 'Z'
transitions = {
('-0', '0', 'Z'): [('-0', 'Z')],
('-0', '0', 'X'): [('-0', 'X')],
('-0', '1', 'Z'): [('-1', 'Z')],
('-0', '1', 'X'): [('-1', 'X')],
('-1', '0', 'Z'): [('-0', 'XZ')],
('-1', '0', 'X'): [('-0', 'XX')],
('-1', '1', 'Z'): [('+2', 'Z')],
('-1', '1', 'X'): [('-2', '')],
('-2', '0', 'Z'): [('-1', 'Z')],
('-2', '0', 'X'): [('-1', 'X')],
('-2', '1', 'Z'): [('-2', 'Z')],
('-2', '1', 'X'): [('-2', 'X')],
('+2', '0', 'Z'): [('+1', 'Z')],
('+2', '0', 'X'): [('+1', 'X')],
('+2', '1', 'Z'): [('+2', 'Z')],
('+2', '1', 'X'): [('+2', 'X'), ('END_1', 'X')],
('+1', '0', 'Z'): [('-0', 'Z')],
('+1', '0', 'X'): [('+0', '')],
('+1', '1', 'Z'): [('+2', 'XZ'), ('END_0', 'Z')],
('+1', '1', 'X'): [('+2', 'XX'), ('END_0', 'X')],
('+0', '0', 'Z'): [('+0', 'Z')],
('+0', '0', 'X'): [('+0', 'X')],
('+0', '1', 'Z'): [('+1', 'Z')],
('+0', '1', 'X'): [('+1', 'X'), ('END_1', 'X')],
('END_0', '', 'Z'): [('END_0', '')],
('END_0', '', 'X'): [('END_0', '')],
('END_1', '', 'X'): [('END_0', '')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
def create_3equal_PDA():
states = {'-0', '-1', '-2', '+2', '+1', '+0', 'END_0'}
alphabet = {'0', '1', ''}
stack_alphabet = {'Z', 'X'}
start_state = '-0'
start_stack = 'Z'
transitions = {
('-0', '0', 'Z'): [('-0', 'Z')],
('-0', '0', 'X'): [('-0', 'X')],
('-0', '1', 'Z'): [('-1', 'Z')],
('-0', '1', 'X'): [('-1', 'X')],
('-1', '0', 'Z'): [('-0', 'XZ')],
('-1', '0', 'X'): [('-0', 'XX')],
('-1', '1', 'Z'): [('+2', 'Z'), ('END_0', '')],
('-1', '1', 'X'): [('-2', '')],
('-2', '0', 'Z'): [('-1', 'Z')],
('-2', '0', 'X'): [('-1', 'X')],
('-2', '1', 'Z'): [('-2', 'Z')],
('-2', '1', 'X'): [('-2', 'X')],
('+2', '0', 'Z'): [('+1', 'Z')],
('+2', '0', 'X'): [('+1', 'X')],
('+2', '1', 'Z'): [('+2', 'Z'), ('END_0', '')],
('+2', '1', 'X'): [('+2', 'X')],
('+1', '0', 'Z'): [('-0', 'Z')],
('+1', '0', 'X'): [('+0', '')],
('+1', '1', 'Z'): [('+2', 'XZ')],
('+1', '1', 'X'): [('+2', 'XX')],
('+0', '0', 'Z'): [('+0', 'Z')],
('+0', '0', 'X'): [('+0', 'X')],
('+0', '1', 'Z'): [('+1', 'Z'), ('END_0', '')],
('+0', '1', 'X'): [('+1', 'X')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
def create_5equal_PDA():
states = {'-0', '-1', '-2', '-3', '-4', '+4', '+3', '+2', '+1', '+0', 'END_0', 'END_1'}
alphabet = {'0', '1', ''}
stack_alphabet = {'Z', 'X'}
start_state = '-0'
start_stack = 'Z'
transitions = {
('+0', '0', 'X'): [('+0', 'X')],
('+0', '0', 'Z'): [('+0', 'Z')],
('+0', '1', 'X'): [('+2', 'X')],
('+0', '1', 'Z'): [('+2', 'Z'), ('END_0', 'Z')],
('+1', '0', 'X'): [('+0', '')],
('+1', '0', 'Z'): [('-0', 'Z')],
('+1', '1', 'X'): [('+3', 'XX')],
('+1', '1', 'Z'): [('+3', 'XZ'), ('END_0', 'Z')],
('+2', '0', 'X'): [('+1', 'X')],
('+2', '0', 'Z'): [('+1', 'Z')],
('+2', '1', 'X'): [('+3', 'X'), ('END_1', 'X')],
('+2', '1', 'Z'): [('+3', 'Z')],
('+3', '0', 'X'): [('+1', '')],
('+3', '0', 'Z'): [('-1', 'Z')],
('+3', '1', 'X'): [('+4', 'XX')],
('+3', '1', 'Z'): [('+4', 'XZ')],
('+4', '0', 'X'): [('+2', 'X')],
('+4', '0', 'Z'): [('+2', 'Z')],
('+4', '1', 'X'): [('+4', 'X')],
('+4', '1', 'Z'): [('+4', 'Z'), ('END_0', 'Z')],
('-0', '0', 'X'): [('-0', 'X')],
('-0', '0', 'Z'): [('-0', 'Z')],
('-0', '1', 'X'): [('-2', 'X')],
('-0', '1', 'Z'): [('-2', 'Z')],
('-1', '0', 'X'): [('-0', 'XX')],
('-1', '0', 'Z'): [('-0', 'XZ')],
('-1', '1', 'X'): [('-3', '')],
('-1', '1', 'Z'): [('+3', 'Z')],
('-2', '0', 'X'): [('-1', 'X')],
('-2', '0', 'Z'): [('-1', 'Z')],
('-2', '1', 'X'): [('-3', 'X')],
('-2', '1', 'Z'): [('-3', 'Z')],
('-3', '0', 'X'): [('-1', 'XX')],
('-3', '0', 'Z'): [('-1', 'XZ')],
('-3', '1', 'X'): [('-4', '')],
('-3', '1', 'Z'): [('+4', 'Z'), ('END_0', 'Z')],
('-4', '0', 'X'): [('-2', 'X')],
('-4', '0', 'Z'): [('-2', 'Z')],
('-4', '1', 'X'): [('-4', 'X')],
('-4', '1', 'Z'): [('-4', 'Z')],
('END_0', '', 'Z'): [('END_0', '')],
('END_1', '', 'X'): [('END_0', '')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
# Create a PDA to accept all k-flimsy binary numbers
def create_flimsy_PDA(k):
assert (type(k) == int) and (k > 1) and (k % 2 == 1)
states = {'END_0'}
alphabet = {'0', '1', EMPTY_STRING}
stack_alphabet = {'Z', 'X'}
start_state = '-0'
start_stack = 'Z'
transitions = {('END_0', EMPTY_STRING, 'Z'): [('END_0', EMPTY_STRING)],
('END_0', EMPTY_STRING, 'X'): [('END_0', EMPTY_STRING)]}
for carry in range(k):
s = str(carry)
states.add('-' + s)
states.add('+' + s)
for si in alphabet:
if si != EMPTY_STRING:
i = int(si)
for z in stack_alphabet:
added = i * k + carry
new_kn_digit = added % 2
new_carry = str(added // 2)
if new_kn_digit % 2 == i:
transitions[('-' + s, si, z)] = [('-' + new_carry, z)]
transitions[('+' + s, si, z)] = [('+' + new_carry, z)]
elif new_kn_digit % 2 == 1:
assert (i == 0) # n goes up by 0, kn goes up by 1
transitions[('-' + s, si, z)] = [('-' + new_carry, 'X' + z)]
if z == 'X':
transitions[('+' + s, si, z)] = [('+' + new_carry, EMPTY_STRING)]
else:
transitions[('+' + s, si, z)] = [('-' + new_carry, z)]
else:
assert (new_kn_digit % 2 == 0)
assert (i == 1) # n goes up by 1, kn goes up by 0
transitions[('+' + s, si, z)] = [('+' + new_carry, 'X' + z)]
if z == 'X':
transitions[('-' + s, si, z)] = [('-' + new_carry, EMPTY_STRING)]
else:
transitions[('-' + s, si, z)] = [('+' + new_carry, z)]
# Add new end states
# Transitions from END_{i+1} to END_{i} that read nothing but pop an X
for i in range(int(math.log2(k))):
new_state = 'END_' + str(i + 1)
states.add(new_state)
one_less = 'END_' + str(i)
transitions[(new_state, EMPTY_STRING, 'X')] = [(one_less, EMPTY_STRING)]
# 1-transitions that pop nothing from final states to END_x for some x?
for carry in range(k):
current_state = '+' + str(carry)
required_pops = s_2(k + carry) - 1
transitions[(current_state, '1', 'X')].append(('END_' + str(required_pops), 'X'))
if required_pops == 0:
transitions[(current_state, '1', 'Z')].append(('END_' + str(required_pops), 'Z'))
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
# Create a PDA to accept all n where b(n) = b(kn)
def create_k_equal_PDA(k):
assert (type(k) == int) and (k > 1) and (k % 2 == 1)
states = {'END_0'}
alphabet = {'0', '1', EMPTY_STRING}
stack_alphabet = {'Z', 'X'}
start_state = '-0'
start_stack = 'Z'
transitions = {('END_0', EMPTY_STRING, 'Z'): [('END_0', EMPTY_STRING)]}
for carry in range(k):
s = str(carry)
states.add('-' + s)
states.add('+' + s)
for si in alphabet:
if si != EMPTY_STRING:
i = int(si)
for z in stack_alphabet:
added = i * k + carry
new_kn_digit = added % 2
new_carry = str(added // 2)
if new_kn_digit % 2 == i:
transitions[('-' + s, si, z)] = [('-' + new_carry, z)]
transitions[('+' + s, si, z)] = [('+' + new_carry, z)]
elif new_kn_digit % 2 == 1:
assert (i == 0) # n goes up by 0, kn goes up by 1
transitions[('-' + s, si, z)] = [('-' + new_carry, 'X' + z)]
if z == 'X':
transitions[('+' + s, si, z)] = [('+' + new_carry, EMPTY_STRING)]
else:
transitions[('+' + s, si, z)] = [('-' + new_carry, z)]
else:
assert (new_kn_digit % 2 == 0)
assert (i == 1) # n goes up by 1, kn goes up by 0
transitions[('+' + s, si, z)] = [('+' + new_carry, 'X' + z)]
if z == 'X':
transitions[('-' + s, si, z)] = [('-' + new_carry, EMPTY_STRING)]
else:
transitions[('-' + s, si, z)] = [('+' + new_carry, z)]
# Add new end states
# Transitions from END_{i+1} to END_{i} that read nothing but pop an X
for i in range(int(math.log2(k))):
new_state = 'END_' + str(i + 1)
states.add(new_state)
one_less = 'END_' + str(i)
transitions[(new_state, EMPTY_STRING, 'X')] = [(one_less, EMPTY_STRING)]
# 1-transitions that pop Z (stack bottom) from stack iff reading 100000... would leave PDA at -0 with empty stack
b = math.floor(math.log2(k)) + 1
pda_states = {(start_state,
start_stack)} # working backwards from the state we want to get to, simulating reading last 1 plus leading zeros
for letter in ('0' * b + '1'):
temp = set()
for (state, stack) in pda_states:
# for all (q, S) such that ((state, stack_top) in transitions[(q, letter, S)])
# temp.add((q, S))
assert (len(stack) > 0)
for (q, let, S) in transitions:
if let == letter:
destinations = transitions[(q, letter, S)]
if (state, stack[-1]) in destinations: # no push or pop
new_stack = stack[:-1] + S
temp.add((q, new_stack))
if (state, EMPTY_STRING) in destinations: # pop
new_stack = stack + S
temp.add((q, new_stack))
if (len(stack) > 1) and ((state, stack[-2] + 'X') in destinations): # push
new_stack = stack[:-2] + S
temp.add((q, new_stack))
pda_states = temp
for (state, stack) in pda_states:
assert (len(stack) > 0)
stack_top = stack[-1]
required_pops = len(stack) - 1
# Add transition (to transitions) from $state to END by popping $stack_height
transitions[(state, '1', stack_top)].append(('END_' + str(required_pops), stack_top))
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
# Create a PDA to accept all 3-flimsy binary numbers
def create_2_flimsy_ternary_PDA():
states = {'-0', '-1', '+1', '+0', 'END_0', 'END_1'}
alphabet = {'0', '1', '2', ''}
stack_alphabet = {'Z', 'X'}
start_state = '-0'
start_stack = 'Z'
transitions = {
('-0', '0', 'Z'): [('-0', 'Z')],
('-0', '0', 'X'): [('-0', 'X')],
('-0', '1', 'Z'): [('-0', 'XZ')],
('-0', '1', 'X'): [('-0', 'XX')],
('-0', '2', 'Z'): [('+1', 'Z')],
('-0', '2', 'X'): [('-1', '')],
('-1', '0', 'Z'): [('-0', 'XZ')],
('-1', '0', 'X'): [('-0', 'XX')],
('-1', '1', 'Z'): [('+1', 'Z')],
('-1', '1', 'X'): [('-1', '')],
('-1', '2', 'Z'): [('-1', 'Z')],
('-1', '2', 'X'): [('-1', 'X')],
('+0', '0', 'Z'): [('+0', 'Z')],
('+0', '0', 'X'): [('+0', 'X')],
('+0', '1', 'Z'): [('-0', 'Z')],
('+0', '1', 'X'): [('+0', ''), ('END_1', 'X')],
('+0', '2', 'Z'): [('+1', 'XZ'), ('END_0', 'Z')],
('+0', '2', 'X'): [('+1', 'XX'), ('END_0', 'X')],
('+1', '0', 'Z'): [('-0', 'Z')],
('+1', '0', 'X'): [('+0', '')],
('+1', '1', 'Z'): [('+1', 'XZ'), ('END_0', 'Z')],
('+1', '1', 'X'): [('+1', 'XX'), ('END_0', 'X')],
('+1', '2', 'Z'): [('+1', 'Z')],
('+1', '2', 'X'): [('+1', 'X'), ('END_1', 'X')],
('END_1', '', 'X'): [('END_0', '')],
('END_0', '', 'Z'): [('END_0', '')],
('END_0', '', 'X'): [('END_0', '')]
}
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
def _char_to_int(c): # Get integer from generalized ASCII number
return ord(c) - ord('0')
def _int_to_char(i): # Get ASCII character for given number
return chr(ord('0')+i)
def _create_flimsy_transitions(states: set, transitions: dict, stack_change: int, old_carry: str, new_carry: str, read_char: str):
if stack_change == 0:
transitions[('-' + old_carry, read_char, 'Z')] = [('-' + new_carry, 'Z')]
transitions[('-' + old_carry, read_char, 'X')] = [('-' + new_carry, 'X')]
transitions[('+' + old_carry, read_char, 'Z')] = [('+' + new_carry, 'Z')]
transitions[('+' + old_carry, read_char, 'X')] = [('+' + new_carry, 'X')]
elif stack_change == 1:
transitions[('+' + old_carry, read_char, 'Z')] = [('+' + new_carry, 'XZ')]
transitions[('+' + old_carry, read_char, 'X')] = [('+' + new_carry, 'XX')]
transitions[('-' + old_carry, read_char, 'Z')] = [('+' + new_carry, 'Z')]
transitions[('-' + old_carry, read_char, 'X')] = [('-' + new_carry, EMPTY_STRING)]
elif stack_change == -1:
transitions[('-' + old_carry, read_char, 'Z')] = [('-' + new_carry, 'XZ')]
transitions[('-' + old_carry, read_char, 'X')] = [('-' + new_carry, 'XX')]
transitions[('+' + old_carry, read_char, 'Z')] = [('-' + new_carry, 'Z')]
transitions[('+' + old_carry, read_char, 'X')] = [('+' + new_carry, EMPTY_STRING)]
elif stack_change > 1:
current_state_plus = '+'+old_carry
current_state_minus = '-'+old_carry
while stack_change > 1:
stack_change -= 1
intermediate_state_plus = 'push_'+str(stack_change)+'_to_+'+new_carry
intermediate_state_minus = 'pop_'+str(stack_change)+'_to_-'+new_carry
transitions[(current_state_plus, read_char, 'Z')] = [(intermediate_state_plus, 'XZ')]
transitions[(current_state_plus, read_char, 'X')] = [(intermediate_state_plus, 'XX')]
transitions[(current_state_minus, read_char, 'Z')] = [(intermediate_state_plus, 'Z')]
transitions[(current_state_minus, read_char, 'X')] = [(intermediate_state_minus, EMPTY_STRING)]
if intermediate_state_plus in states and intermediate_state_minus in states:
return
states.add(intermediate_state_plus)
states.add(intermediate_state_minus)
current_state_plus = intermediate_state_plus
current_state_minus = intermediate_state_minus
read_char = EMPTY_STRING
final_state_plus = '+'+new_carry
final_state_minus = '-'+new_carry
transitions[(current_state_plus, read_char, 'Z')] = [(final_state_plus, 'XZ')]
transitions[(current_state_plus, read_char, 'X')] = [(final_state_plus, 'XX')]
transitions[(current_state_minus, read_char, 'Z')] = [(final_state_plus, 'Z')]
transitions[(current_state_minus, read_char, 'X')] = [(final_state_minus, EMPTY_STRING)]
elif stack_change < -1:
current_state_plus = '+' + old_carry
current_state_minus = '-' + old_carry
while stack_change < -1:
stack_change += 1
intermediate_state_plus = 'pop_' + str(-stack_change) + '_to_+' + new_carry
intermediate_state_minus = 'push_' + str(-stack_change) + '_to_-' + new_carry
transitions[(current_state_minus, read_char, 'Z')] = [(intermediate_state_minus, 'XZ')]
transitions[(current_state_minus, read_char, 'X')] = [(intermediate_state_minus, 'XX')]
transitions[(current_state_plus, read_char, 'Z')] = [(intermediate_state_minus, 'Z')]
transitions[(current_state_plus, read_char, 'X')] = [(intermediate_state_plus, EMPTY_STRING)]
if intermediate_state_plus in states and intermediate_state_minus in states:
return
states.add(intermediate_state_plus)
states.add(intermediate_state_minus)
current_state_plus = intermediate_state_plus
current_state_minus = intermediate_state_minus
read_char = EMPTY_STRING
final_state_plus = '+'+new_carry
final_state_minus = '-'+new_carry
transitions[(current_state_minus, read_char, 'Z')] = [(final_state_minus, 'XZ')]
transitions[(current_state_minus, read_char, 'X')] = [(final_state_minus, 'XX')]
transitions[(current_state_plus, read_char, 'Z')] = [(final_state_minus, 'Z')]
transitions[(current_state_plus, read_char, 'X')] = [(final_state_plus, EMPTY_STRING)]
# Create a PDA to accept all k-flimsy binary numbers
def create_base_b_k_flimsy_PDA(b, k):
assert (type(k) == int) and (type(b) == int) and (k >= 1) and (b > 1)
while k % b == 0:
k //= b
states = {'END'}
alphabet = {EMPTY_STRING}
for i in range(b):
alphabet.add(_int_to_char(i))
stack_alphabet = {'Z', 'X'}
start_state = '-0'
start_stack = 'Z'
transitions = {('END', EMPTY_STRING, 'Z'): [('END', EMPTY_STRING)],
('END', EMPTY_STRING, 'X'): [('END', EMPTY_STRING)]}
# Add END states, to pop at least/most i X's off the stack before reaching END
# Transitions from END_{i+1} to END_{i} that read nothing but pop an X
states.add('pop_at_most_0_to_END')
transitions[('pop_at_most_0_to_END', EMPTY_STRING, 'Z')] = [('END', EMPTY_STRING)]
for i in range(int(2*(b-1)*math.log(k+1, b) + 0.01)+1): # TODO: confirm this
new_state = 'pop_at_least_' + str(i + 1) + '_to_END'
one_less = 'END' if i == 0 else ('pop_at_least_' + str(i) + '_to_END')
states.add(new_state)
transitions[(new_state, EMPTY_STRING, 'X')] = [(one_less, EMPTY_STRING)]
new_state = 'pop_at_most_' + str(i + 1) + '_to_END'
one_less = 'pop_at_most_' + str(i) + '_to_END'
states.add(new_state)
transitions[(new_state, EMPTY_STRING, 'Z')] = [('END', EMPTY_STRING)]
transitions[(new_state, EMPTY_STRING, 'X')] = [(one_less, EMPTY_STRING)]
# Add main states (+/- carry)
# Transitions between those states based on reading non-final input chars
for carry in range(k):
s = _int_to_char(carry)
states.add('-' + s)
states.add('+' + s)
for si in alphabet:
if si != EMPTY_STRING:
i = _char_to_int(si)
added = i * k + carry
new_kn_digit = added % b
new_carry = _int_to_char(added // b)
stack_change = i - new_kn_digit # if positive, push on + state and pop on - state; else vice versa
_create_flimsy_transitions(states, transitions, stack_change, s, new_carry, si)
# nonzero-transitions that pop nothing from final (sign, carry) states to END_i state
for carry in range(k):
for read_char in alphabet:
if read_char != EMPTY_STRING and read_char != '0':
read_digit = _char_to_int(read_char)
plus_state = '+' + _int_to_char(carry)
min_required_pops = s_b(k*read_digit + carry, b) - read_digit
if min_required_pops > 0:
transitions[(plus_state, read_char, 'X')].append(('pop_at_least_' + str(min_required_pops) + '_to_END', 'X'))
if not ('pop_at_least_' + str(min_required_pops) + '_to_END') in states:
print("MISSING POP AT LEAST", min_required_pops, "state")
assert False
else:
transitions[(plus_state, read_char, 'Z')].append(('END', 'Z'))
transitions[(plus_state, read_char, 'X')].append(('END', 'X'))
minus_state = '-' + _int_to_char(carry)
max_required_pops = read_digit - s_b(k*read_digit + carry, b) - 1
if max_required_pops >= 0:
transitions[(minus_state, read_char, 'Z')].append(('END', 'Z'))
for i in range(1, max_required_pops + 1):
transitions[(minus_state, read_char, 'X')].append(('pop_at_most_' + str(i) + '_to_END', 'X'))
if not ('pop_at_most_' + str(i) + '_to_END') in states:
print("MISSING POP AT MOST", min_required_pops, "state")
assert False
return PDA(states, alphabet, stack_alphabet, start_state, start_stack, transitions)
| 41.519651 | 132 | 0.419191 | 3,581 | 28,524 | 3.129293 | 0.052499 | 0.010709 | 0.008835 | 0.028556 | 0.780832 | 0.744333 | 0.709084 | 0.669374 | 0.661967 | 0.617794 | 0 | 0.03442 | 0.302307 | 28,524 | 686 | 133 | 41.580175 | 0.528667 | 0.064297 | 0 | 0.54359 | 0 | 0 | 0.092919 | 0 | 0 | 0 | 0 | 0.001458 | 0.022222 | 1 | 0.037607 | false | 0 | 0.003419 | 0.006838 | 0.080342 | 0.003419 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f2e36ce39c7f2366d5efaf094103edce27b788f9 | 537 | py | Python | tests/fixtures/models/__init__.py | kuc2477/news | 215f87e6ce1a7fc99175596e6fd5b4b50a3179c6 | [
"MIT"
] | 2 | 2016-01-21T04:16:57.000Z | 2016-04-27T04:46:13.000Z | tests/fixtures/models/__init__.py | kuc2477/news | 215f87e6ce1a7fc99175596e6fd5b4b50a3179c6 | [
"MIT"
] | null | null | null | tests/fixtures/models/__init__.py | kuc2477/news | 215f87e6ce1a7fc99175596e6fd5b4b50a3179c6 | [
"MIT"
] | null | null | null | import pytest
from news.models.abstract import Readable
from .django import *
from .sqlalchemy import *
@pytest.fixture
def readable_root(author_root, title_root, content_root, summary_root):
return Readable(author=author_root, title=title_root,
content=content_root, summary=summary_root)
@pytest.fixture
def readable_child(author_child, title_child, content_child, summary_child):
return Readable(author=author_child, title=title_child,
summary=summary_child, content=content_child)
| 31.588235 | 76 | 0.761639 | 68 | 537 | 5.75 | 0.264706 | 0.061381 | 0.081841 | 0.122762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163873 | 537 | 16 | 77 | 33.5625 | 0.870824 | 0 | 0 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
f2e55fe6dd28c25ce694b3a09198bd3a4ea8a287 | 388 | py | Python | source/pkgsrc/archivers/py-czipfile/patches/patch-setup.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | 1 | 2021-11-20T22:46:39.000Z | 2021-11-20T22:46:39.000Z | source/pkgsrc/archivers/py-czipfile/patches/patch-setup.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | source/pkgsrc/archivers/py-czipfile/patches/patch-setup.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | $NetBSD: patch-setup.py,v 1.1 2016/07/09 21:13:02 wiz Exp $
Use setuptools for packaging to create nice eggs.
--- setup.py.orig 2010-07-28 06:19:12.000000000 +0900
+++ setup.py 2016-07-07 21:11:32.000000000 +0900
@@ -2,6 +2,7 @@
# vim: set expandtab tabstop=4 shiftwidth=4:
import os
+import setuptools
from distutils.core import setup
from distutils.extension import Extension
| 25.866667 | 59 | 0.724227 | 69 | 388 | 4.072464 | 0.681159 | 0.074733 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.230303 | 0.149485 | 388 | 14 | 60 | 27.714286 | 0.621212 | 0.108247 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.444444 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f2e883d1ab0e50a6c4251779ab87849afdc22851 | 451 | py | Python | core/confdb/syntax/system/hints.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 84 | 2017-10-22T11:01:39.000Z | 2022-02-27T03:43:48.000Z | core/confdb/syntax/system/hints.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 22 | 2017-12-11T07:21:56.000Z | 2021-09-23T02:53:50.000Z | core/confdb/syntax/system/hints.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 23 | 2017-12-06T06:59:52.000Z | 2022-02-24T00:02:25.000Z | # ----------------------------------------------------------------------
# ConfDB hints system syntax
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
from ..defs import DEF
from .aaa.hints import HINTS_SYSTEM_AAA
SYSTEM_HINTS_SYNTAX = DEF("system", [HINTS_SYSTEM_AAA])
| 34.692308 | 72 | 0.396896 | 36 | 451 | 4.805556 | 0.583333 | 0.190751 | 0.16185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019465 | 0.088692 | 451 | 12 | 73 | 37.583333 | 0.40146 | 0.698448 | 0 | 0 | 0 | 0 | 0.046875 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f2f000be694897d91ba68121241bfe6e995300aa | 107 | py | Python | src/application.py | namespacestd0/mygeneset.info | 0027331bb37aa96eb5f75e4a1d727a71169b3e17 | [
"Apache-2.0"
] | null | null | null | src/application.py | namespacestd0/mygeneset.info | 0027331bb37aa96eb5f75e4a1d727a71169b3e17 | [
"Apache-2.0"
] | null | null | null | src/application.py | namespacestd0/mygeneset.info | 0027331bb37aa96eb5f75e4a1d727a71169b3e17 | [
"Apache-2.0"
] | null | null | null | from biothings.web.launcher import FlaskAPILauncher
application = FlaskAPILauncher("config").get_server()
| 26.75 | 53 | 0.831776 | 11 | 107 | 8 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074766 | 107 | 3 | 54 | 35.666667 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0.056075 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f2f07a4b249352b4fe46278b3ef6d0ee47b4d0a9 | 110 | py | Python | output/models/ms_data/particles/particles_eb026_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/ms_data/particles/particles_eb026_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/ms_data/particles/particles_eb026_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.ms_data.particles.particles_eb026_xsd.particles_eb026 import Doc
__all__ = [
"Doc",
]
| 18.333333 | 83 | 0.772727 | 15 | 110 | 5.133333 | 0.733333 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0625 | 0.127273 | 110 | 5 | 84 | 22 | 0.739583 | 0 | 0 | 0 | 0 | 0 | 0.027273 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8400ace740cfe4257ea3c00e2e89221387e41455 | 9,767 | py | Python | Robot.py | robot-acceleration/URDFParser | 3d3efe342a858480c170bd314b5ade5303b86f99 | [
"MIT"
] | 2 | 2021-09-22T05:09:57.000Z | 2021-12-25T16:59:59.000Z | Robot.py | robot-acceleration/URDFParser | 3d3efe342a858480c170bd314b5ade5303b86f99 | [
"MIT"
] | null | null | null | Robot.py | robot-acceleration/URDFParser | 3d3efe342a858480c170bd314b5ade5303b86f99 | [
"MIT"
] | null | null | null | from .Link import Link
from .Joint import Joint
class Robot:
# initialization
def __init__(self, name):
self.name = name
self.links = []
self.joints = []
def next_none(self, iterable):
try:
return next(iterable)
except:
return None
#################
# Setters #
#################
def add_joint(self, joint):
self.joints.append(joint)
def add_link(self, link):
self.links.append(link)
def remove_joint(self, joint):
self.joints.remove(joint)
def remove_link(self, link):
self.links.remove(link)
#########################
# Generic Getters #
#########################
def get_num_pos(self):
return self.get_num_joints()
def get_num_vel(self):
return self.get_num_joints()
def get_num_cntrl(self):
return self.get_num_joints()
def get_name(self):
return self.name
def is_serial_chain(self):
return all([jid - self.get_parent_id(jid) == 1 for jid in range(self.get_num_joints())])
def get_parent_id(self, lid):
return self.get_link_by_id(lid).get_parent_id()
def get_parent_ids(self, lids):
return [self.get_parent_id(lid) for lid in lids]
def get_unique_parent_ids(self, lids):
return list(set(self.get_parent_ids(lids)))
def get_parent_id_array(self):
return [tpl[1] for tpl in sorted([(link.get_id(),link.get_parent_id()) for link in self.links], key=lambda tpl: tpl[0])[1:]]
def has_repeated_parents(self, jids):
return len(self.get_parent_ids(jids)) != len(self.get_unique_parent_ids(jids))
def get_subtree_by_id(self, lid):
return sorted(self.get_link_by_id(lid).get_subtree())
def get_total_subtree_count(self):
return sum([len(self.get_subtree_by_id(lid)) for lid in range(self.get_num_joints())])
def get_ancestors_by_id(self, jid):
ancestors = []
curr_id = jid
while True:
curr_id = self.get_parent_id(curr_id)
if curr_id == -1:
break
else:
ancestors.append(curr_id)
return ancestors
def get_total_ancestor_count(self):
return sum([len(self.get_ancestors_by_id(jid)) for jid in range(self.get_num_joints())])
def get_is_ancestor_of(self, jid, jid_of):
return jid in self.get_ancestors_by_id(jid_of)
def get_is_in_subtree_of(self, jid, jid_of):
return jid in self.get_subtree_by_id(jid_of)
def get_max_bfs_level(self):
return sorted(self.joints, key=lambda joint: joint.bfs_level, reverse = True)[0].bfs_level
def get_ids_by_bfs_level(self, level):
return [joint.jid for joint in self.get_joints_by_bfs_level(level)]
def get_bfs_level_by_id(self, jid):
return(self.get_joint_by_id(jid).get_bfs_level())
def get_max_bfs_width(self):
return max([len(self.get_ids_by_bfs_level(level)) for level in range(self.get_max_bfs_level() + 1)])
###############
# Joint #
###############
def get_num_joints(self):
return len(self.joints)
def get_joint_by_id(self, jid):
return self.next_none(filter(lambda fjoint: fjoint.jid == jid, self.joints))
def get_joint_by_name(self, name):
return self.next_none(filter(lambda fjoint: fjoint.name == name, self.joints))
def get_joints_by_bfs_level(self, level):
return list(filter(lambda fjoint: fjoint.bfs_level == level, self.joints))
def get_joints_ordered_by_id(self, reverse = False):
return sorted(self.joints, key=lambda item: item.jid, reverse = reverse)
def get_joints_ordered_by_name(self, reverse = False):
return sorted(self.joints, key=lambda item: item.name, reverse = reverse)
def get_joints_dict_by_id(self):
return {joint.jid:joint for joint in self.joints}
def get_joints_dict_by_name(self):
return {joint.name:joint for joint in self.joints}
def get_joints_by_parent_name(self, parent_name):
return list(filter(lambda fjoint: fjoint.parent == parent_name, self.joints))
def get_joints_by_child_name(self, child_name):
return list(filter(lambda fjoint: fjoint.child == child_name, self.joints))
def get_joint_by_parent_child_name(self, parent_name, child_name):
return self.next_none(filter(lambda fjoint: fjoint.parent == parent_name and fjoint.child == child_name, self.joints))
def get_damping_by_id(self, jid):
return self.get_joint_by_id(jid).get_damping()
##############
# Link #
##############
def get_num_links(self):
return len(self.links)
def get_num_links_effective(self):
# subtracting base link from total # of links
return get_num_links() - 1
def get_link_by_id(self, lid):
return self.next_none(filter(lambda flink: flink.lid == lid, self.links))
def get_link_by_name(self, name):
return self.next_none(filter(lambda flink: flink.name == name, self.links))
def get_links_by_bfs_level(self, level):
return list(filter(lambda flink: flink.bfs_level == level, self.links))
def get_links_ordered_by_id(self, reverse = False):
return sorted(self.links, key=lambda item: item.lid, reverse = reverse)
def get_links_ordered_by_name(self, reverse = False):
return sorted(self.links, key=lambda item: item.name, reverse = reverse)
def get_links_dict_by_id(self):
return {link.lid:link for link in self.links}
def get_links_dict_by_name(self):
return {link.name:link for link in self.links}
##############
# XMAT #
##############
def get_Xmat_by_id(self, jid):
return self.get_joint_by_id(jid).get_transformation_matrix()
def get_Xmat_by_name(self, name):
return self.get_joint_by_name(name).get_transformation_matrix()
def get_Xmats_by_bfs_level(self, level):
return [joint.get_transformation_matrix() for joint in self.get_joints_by_bfs_level(level)]
def get_Xmats_ordered_by_id(self, reverse = False):
return [joint.get_transformation_matrix() for joint in self.get_joints_ordered_by_id(reverse)]
def get_Xmats_ordered_by_name(self, reverse = False):
return [joint.get_transformation_matrix() for joint in self.get_joints_ordered_by_name(reverse)]
def get_Xmats_dict_by_id(self):
return {joint.jid:joint.get_transformation_matrix() for joint in self.joints}
def get_Xmats_dict_by_name(self):
return {joint.name:joint.get_transformation_matrix() for joint in self.joints}
###################
# XMAT_Func #
###################
def get_Xmat_Func_by_id(self, jid):
return self.get_joint_by_id(jid).get_transformation_matrix_function()
def get_Xmat_Func_by_name(self, name):
return self.get_joint_by_name(name).get_transformation_matrix_function()
def get_Xmat_Funcs_by_bfs_level(self, level):
return [joint.get_transformation_matrix_function() for joint in self.get_joints_by_bfs_level(level)]
def get_Xmat_Funcs_ordered_by_id(self, reverse = False):
return [joint.get_transformation_matrix_function() for joint in self.get_joints_ordered_by_id(reverse)]
def get_Xmat_Funcs_ordered_by_name(self, reverse = False):
return [joint.get_transformation_matrix_function() for joint in self.get_joints_ordered_by_name(reverse)]
def get_Xmat_Funcs_dict_by_id(self):
return {joint.jid:joint.get_transformation_matrix_function() for joint in self.joints}
def get_Xmat_Funcs_dict_by_name(self):
return {joint.name:joint.get_transformation_matrix_function() for joint in self.joints}
##############
# IMAT #
##############
def get_Imat_by_id(self, lid):
return self.get_link_by_id(lid).get_spatial_inertia()
def get_Imat_by_name(self, name):
return self.get_joint_by_name(name).get_spatial_inertia()
def get_Imats_by_bfs_level(self, level):
return [link.get_spatial_inertia() for link in self.get_links_by_bfs_level()]
def get_Imats_ordered_by_id(self, reverse = False):
return [link.get_spatial_inertia() for link in self.get_links_ordered_by_id(reverse)]
def get_Imats_ordered_by_name(self, reverse = False):
return [link.get_spatial_inertia() for link in self.get_links_ordered_by_name(reverse)]
def get_Imats_dict_by_id(self):
return {link.lid:link.get_spatial_inertia() for link in self.links}
def get_Imats_dict_by_name(self):
return {link.name:link.get_spatial_inertia() for link in self.links}
###############
# S #
###############
def get_S_by_id(self, jid):
return self.get_joint_by_id(jid).get_joint_subspace()
def get_S_by_name(self, name):
return self.get_joint_by_name(name).get_joint_subspace()
def get_S_by_bfs_level(self, level):
return [joint.get_joint_subspace() for joint in self.get_joints_by_bfs_level(level)]
def get_Ss_ordered_by_id(self, reverse = False):
return [joint.get_joint_subspace() for joint in self.get_joints_ordered_by_id(reverse)]
def get_Ss_ordered_by_name(self, reverse = False):
return [joint.get_joint_subspace() for joint in self.get_joints_ordered_by_name(reverse)]
def get_Ss_dict_by_id(self):
return {joint.jid:joint.get_joint_subspace() for joint in self.joints}
def get_Ss_dict_by_name(self):
return {joint.name:joint.get_joint_subspace() for joint in self.joints}
def are_Ss_identical(self,jids):
return all(all(self.get_S_by_id(jid) == self.get_S_by_id(jids[0])) for jid in jids) | 35.007168 | 132 | 0.674721 | 1,449 | 9,767 | 4.2098 | 0.073154 | 0.065902 | 0.028852 | 0.041311 | 0.76623 | 0.680984 | 0.63541 | 0.56918 | 0.501475 | 0.406885 | 0 | 0.001158 | 0.204054 | 9,767 | 279 | 133 | 35.007168 | 0.783509 | 0.017201 | 0 | 0.017857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.452381 | false | 0 | 0.011905 | 0.410714 | 0.892857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
840107b50dd0a68dc0718990fc5ce990ef22d798 | 263 | py | Python | app/web/__init__.py | Song2017/flask_image | 8a731a8f7fdcc7c0d1bd436e4db676080b861168 | [
"MIT"
] | null | null | null | app/web/__init__.py | Song2017/flask_image | 8a731a8f7fdcc7c0d1bd436e4db676080b861168 | [
"MIT"
] | null | null | null | app/web/__init__.py | Song2017/flask_image | 8a731a8f7fdcc7c0d1bd436e4db676080b861168 | [
"MIT"
] | null | null | null | from flask import render_template
from app.web.blue_print import web
# run code in different file
from app.web import littlered_bbc
from app.web import index
@web.app_errorhandler(404)
def not_found(e):
# AOP 思想
return render_template('404.html'), 404
| 20.230769 | 43 | 0.768061 | 44 | 263 | 4.454545 | 0.613636 | 0.107143 | 0.153061 | 0.163265 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040724 | 0.159696 | 263 | 12 | 44 | 21.916667 | 0.846154 | 0.125475 | 0 | 0 | 0 | 0 | 0.035242 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.571429 | 0.142857 | 0.857143 | 0.142857 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 3 |
84227adbd33d05b22c99916a17f90d9b1ef6508b | 253 | py | Python | test/test_market.py | 5267/QUANTAXIS | c3f38b805939e33309e2da7ea8cb32d245c3edfb | [
"MIT"
] | 5 | 2017-06-30T04:42:29.000Z | 2018-01-05T09:20:28.000Z | test/test_market.py | 5267/QUANTAXIS | c3f38b805939e33309e2da7ea8cb32d245c3edfb | [
"MIT"
] | null | null | null | test/test_market.py | 5267/QUANTAXIS | c3f38b805939e33309e2da7ea8cb32d245c3edfb | [
"MIT"
] | null | null | null | import QUANTAXIS as QA
#QA.QA_Setting.client=QA.QAUtil.QA_util_sql_mongo_setting(QA.QA_Setting.QA_util_sql_mongo_ip,QA.QA_Setting.QA_util_sql_mongo_port)
market=QA.QA_Market()
bid=QA.QA_QAMarket_bid.bid
market.market_make_deal(bid,QA.QA_Setting.client)
| 42.166667 | 130 | 0.865613 | 50 | 253 | 3.96 | 0.34 | 0.141414 | 0.222222 | 0.212121 | 0.252525 | 0.252525 | 0.252525 | 0 | 0 | 0 | 0 | 0 | 0.031621 | 253 | 5 | 131 | 50.6 | 0.808163 | 0.509881 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
84628793fcdbba59d8ab4ec4c3c68fbc03f54880 | 5,539 | py | Python | tests/test_networking.py | LennyPhoenix/Jank-Engine | e67f758dcdc9945a1b6084cc5c53c560e510d1ca | [
"MIT"
] | 2 | 2020-08-05T15:22:36.000Z | 2020-09-26T19:28:59.000Z | tests/test_networking.py | LennyPhoenix/Jank-Engine | e67f758dcdc9945a1b6084cc5c53c560e510d1ca | [
"MIT"
] | 16 | 2020-06-17T12:53:44.000Z | 2020-10-01T19:07:04.000Z | tests/test_networking.py | DoAltPlusF4/Jank-Engine | e67f758dcdc9945a1b6084cc5c53c560e510d1ca | [
"MIT"
] | 1 | 2020-10-01T18:36:18.000Z | 2020-10-01T18:36:18.000Z | import time
import unittest
import jank
class TestNetworkingTCP(unittest.TestCase):
def test_server(self):
server = jank.networking.Server()
server.connect("localhost", 5550, False)
server.disconnect()
def test_server_add_protocol(self):
server = jank.networking.Server()
@server.register_protocol
def decorator_protocol(socket):
pass
def non_decorator_protocol(socket):
pass
server.register_protocol(non_decorator_protocol)
def test_client_add_protocol(self):
client = jank.networking.Client()
@client.register_protocol
def decorator_protocol():
pass
def non_decorator_protocol():
pass
client.register_protocol(non_decorator_protocol)
def test_connect_client_dcc(self):
server = jank.networking.Server()
server.connect("localhost", 5551, False)
client = jank.networking.Client()
client.connect("localhost", 5551, False)
client.disconnect()
def test_connect_client_dcs(self):
server = jank.networking.Server()
server.connect("localhost", 5552, False)
client = jank.networking.Client()
client.connect("localhost", 5552, False)
server.disconnect()
def test_connect_multiple_clients_dcs(self):
server = jank.networking.Server()
server.connect("localhost", 5553, False)
client1 = jank.networking.Client()
client1.connect("localhost", 5553, False)
client2 = jank.networking.Client()
client2.connect("localhost", 5553, False)
client3 = jank.networking.Client()
client3.connect("localhost", 5553, False)
def test_ping_pong(self):
self.message = None
message = "Hello World!"
server = jank.networking.Server()
@server.register_protocol
def ping(socket, message):
server.send(socket, "pong", {"message": message}, server.TCP)
server.connect("localhost", 5554, False)
client = jank.networking.Client()
@client.register_protocol
def pong(message):
self.message = message
client.connect("localhost", 5554, False)
client.send("ping", {"message": message}, client.TCP)
time.sleep(1)
self.assertEqual(self.message, message)
del self.message
def test_broadcast(self):
server = jank.networking.Server()
server.connect("localhost", 5555, False)
client1 = jank.networking.Client()
client2 = jank.networking.Client()
client3 = jank.networking.Client()
@client1.register_protocol
@client2.register_protocol
@client3.register_protocol
def say(message):
print(message)
client1.connect("localhost", 5555, False)
client2.connect("localhost", 5555, False)
client3.connect("localhost", 5555, False)
server.broadcast("say", {"message": "Received."}, network_protocol=server.TCP)
class TestNetworkingUDP(unittest.TestCase):
def test_server(self):
server = jank.networking.Server()
server.connect("localhost", 5560, True)
server.disconnect()
def test_connect_client_dcc(self):
server = jank.networking.Server()
server.connect("localhost", 5561, True)
client = jank.networking.Client()
client.connect("localhost", 5561, True)
client.disconnect()
def test_connect_client_dcs(self):
server = jank.networking.Server()
server.connect("localhost", 5562, True)
client = jank.networking.Client()
client.connect("localhost", 5562, True)
server.disconnect()
def test_connect_multiple_clients_dcs(self):
server = jank.networking.Server()
server.connect("localhost", 5563, True)
client1 = jank.networking.Client()
client1.connect("localhost", 5563, True)
client2 = jank.networking.Client()
client2.connect("localhost", 5563, True)
client3 = jank.networking.Client()
client3.connect("localhost", 5563, True)
def test_ping_pong(self):
self.message = None
message = "Hello World!"
server = jank.networking.Server()
@server.register_protocol
def ping(socket, message):
server.send(socket, "pong", {"message": message}, server.UDP)
server.connect("localhost", 5564, True)
client = jank.networking.Client()
@client.register_protocol
def pong(message):
self.message = message
client.connect("localhost", 5564, True)
client.send("ping", {"message": message}, client.UDP)
time.sleep(1)
self.assertEqual(self.message, message)
del self.message
def test_broadcast(self):
server = jank.networking.Server()
server.connect("localhost", 5565, True)
client1 = jank.networking.Client()
client2 = jank.networking.Client()
client3 = jank.networking.Client()
@client1.register_protocol
@client2.register_protocol
@client3.register_protocol
def say(message):
print(message)
client1.connect("localhost", 5565, True)
client2.connect("localhost", 5565, True)
client3.connect("localhost", 5565, True)
server.broadcast("say", {"message": "Received."}, network_protocol=server.UDP)
if __name__ == '__main__':
unittest.main()
| 28.699482 | 86 | 0.629897 | 565 | 5,539 | 6.054867 | 0.116814 | 0.130956 | 0.111079 | 0.098802 | 0.873137 | 0.808536 | 0.777843 | 0.667056 | 0.544285 | 0.544285 | 0 | 0.036866 | 0.255642 | 5,539 | 192 | 87 | 28.848958 | 0.792869 | 0 | 0 | 0.627737 | 0 | 0 | 0.069327 | 0 | 0 | 0 | 0 | 0 | 0.014599 | 1 | 0.175182 | false | 0.029197 | 0.021898 | 0 | 0.211679 | 0.014599 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ffc2d546d3e4956e590e9ea991ef11262a14267a | 3,215 | py | Python | pyweather/cwmodel.py | ravigoel08/py-open-weather | 08e6945f78ab43112a84f6989677e4b4fd389ecf | [
"MIT"
] | 5 | 2021-01-05T09:46:10.000Z | 2021-05-26T10:58:18.000Z | pyweather/cwmodel.py | ravigoel08/py-open-weather | 08e6945f78ab43112a84f6989677e4b4fd389ecf | [
"MIT"
] | 1 | 2021-07-21T12:32:08.000Z | 2021-07-21T12:32:08.000Z | pyweather/cwmodel.py | ravigoel08/py-open-weather | 08e6945f78ab43112a84f6989677e4b4fd389ecf | [
"MIT"
] | 3 | 2021-01-18T13:14:13.000Z | 2021-04-26T14:14:54.000Z | from __future__ import annotations
from typing import List, Optional
from pydantic import BaseModel, Field
import orjson
def orjson_dumps(v, *, default):
# orjson.dumps returns bytes, to match standard json.dumps we need to decode
return orjson.dumps(v, default=default).decode()
class Coord(BaseModel):
lon: float = Field(None, description="City geo location, longitude")
lat: float = Field(None, description="City geo location, latitude")
class WeatherItem(BaseModel):
id: int = Field(None, description="Weather condition id.")
main: str = Field(
None, description="Group of weather parameters (Rain, Snow, Extreme etc.)"
)
description: str = Field(None, description="Weather condition within the group.")
icon: str = Field(None, description="Weather icon id.")
class Main(BaseModel):
temp: float = Field(None, description="Temperature.")
feels_like: float = Field(
None,
description="Temperature. This temperature parameter accounts for the human perception of weather.",
)
temp_min: float = Field(
None,
description="Minimum temperature at the moment. This is minimal currently observed temperature.",
)
temp_max: float = Field(
None,
description="Maximum temperature at the moment. This is maximal currently observed temperature.",
)
pressure: int = Field(
None,
description="Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa",
)
humidity: int = Field(None, description="Humidity, %")
sea_level: Optional[int] = Field(
None, description="Atmospheric pressure on the sea level, hPa"
)
grnd_level: Optional[int] = Field(
None, description="Atmospheric pressure on the ground level, hPa"
)
class Wind(BaseModel):
speed: float = Field(None, description="Wind speed.")
deg: int = Field(None, description="Wind direction, degrees (meteorological)")
gust: Optional[int] = Field(None, description="Wind gust.")
class Clouds(BaseModel):
all: int = Field(None, description="Cloudiness, %")
class Sys(BaseModel):
type: int = Field(None, description="Internal parameter")
id: int = Field(None, description="Internal parameter")
message: float = Field(None, description="Internal parameter")
country: str = Field(None, description="Country code (GB, JP etc.)")
sunrise: int = Field(None, description="Sunrise time, unix, UTC ")
sunset: int = Field(None, description="Sunset time, unix, UTC")
class WeatherData(BaseModel):
coord: Coord
weather: List[WeatherItem]
base: str = Field(None, description="Internal parameter")
main: Main
visibility: int = Field(None, description="")
wind: Wind
clouds: Clouds
dt: int = Field(None, description="Time of data calculation, unix, UTC")
sys: Sys
timezone: int = Field(None, description="Shift in seconds from UTC")
id: int = Field(None, description="City ID")
name: str = Field(None, description="City name")
cod: int = Field(None, description="Internal parameter")
class Config:
json_loads = orjson.loads
json_dumps = orjson_dumps
| 34.569892 | 112 | 0.684603 | 388 | 3,215 | 5.634021 | 0.322165 | 0.12763 | 0.283623 | 0.178866 | 0.370997 | 0.200823 | 0.120311 | 0.083715 | 0.083715 | 0.083715 | 0 | 0 | 0.205599 | 3,215 | 92 | 113 | 34.945652 | 0.855912 | 0.023017 | 0 | 0.056338 | 0 | 0 | 0.299777 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.014085 | false | 0 | 0.056338 | 0.014085 | 0.71831 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
ffc4d2037c3954387e7882dfe1a2e10433ce5a55 | 505 | py | Python | FEMpy/__init__.py | A-Gray-94/FEMpy | f15af7b9eb592ea4e42e3472bf4672500d6b81f7 | [
"Apache-2.0"
] | null | null | null | FEMpy/__init__.py | A-Gray-94/FEMpy | f15af7b9eb592ea4e42e3472bf4672500d6b81f7 | [
"Apache-2.0"
] | 25 | 2021-08-02T03:58:30.000Z | 2021-09-26T18:33:04.000Z | FEMpy/__init__.py | A-Gray-94/FEMpy | f15af7b9eb592ea4e42e3472bf4672500d6b81f7 | [
"Apache-2.0"
] | 1 | 2021-12-27T18:40:04.000Z | 2021-12-27T18:40:04.000Z | __version__ = "0.0.1"
from .Element import *
from .QuadElement import *
from .SerendipityQuad import *
from .Lagrange1dElement import *
from .Constitutive import *
from .isoPlaneStrain import *
from .isoPlaneStress import *
from .OrthoPlaneStress import *
from .AxialBar import *
from .LagrangePoly import *
from .GaussQuad import *
from .Assembly import *
from .Dynamics import *
from .TecplotIO import *
from .Mesh import *
from .Smoothing import getSmoother
from .Utils import *
from .LinAlg import *
| 24.047619 | 34 | 0.770297 | 59 | 505 | 6.525424 | 0.40678 | 0.415584 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009324 | 0.150495 | 505 | 20 | 35 | 25.25 | 0.888112 | 0 | 0 | 0 | 0 | 0 | 0.009901 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.947368 | 0 | 0.947368 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
fff1c1f59f63810c16825a374b850781e4ea4856 | 544 | py | Python | src/doc/saludos.py | FoxNeo/MyPythonProjects | 3499ef0853f0087f6f143e1633b0a88a3d7b9818 | [
"MIT"
] | null | null | null | src/doc/saludos.py | FoxNeo/MyPythonProjects | 3499ef0853f0087f6f143e1633b0a88a3d7b9818 | [
"MIT"
] | null | null | null | src/doc/saludos.py | FoxNeo/MyPythonProjects | 3499ef0853f0087f6f143e1633b0a88a3d7b9818 | [
"MIT"
] | null | null | null | #pydoc - generate automat documentation
class Saludos:
"""
Esta es la documentación de la clase silla
Tendra dos funciones buenos_dias y adios
y ambas será necesario pasarle un parametro con el nombre de la persona
"""
def buenos_dias(self, nombre):
""" Sirve para dar los buenos días a un nombre pasado como parametro"""
print("Buenos días {}".format(nombre))
def adios(self, nombre):
""" Sirve para decir adios a un nombre pasado como parametro"""
print("Adios {}".format(nombre)) | 36.266667 | 79 | 0.670956 | 74 | 544 | 4.905405 | 0.581081 | 0.022039 | 0.082645 | 0.104683 | 0.181818 | 0.181818 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0.242647 | 544 | 15 | 80 | 36.266667 | 0.881068 | 0.580882 | 0 | 0 | 1 | 0 | 0.11399 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0 | 0.6 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
08069e9533518c73fb8f7ad72868964a8b1d41a7 | 2,440 | py | Python | fsm.py | F74036386/telegramChatBot | 3ab75b827e7acd9d4c4674ff579739f246db0bf8 | [
"MIT"
] | null | null | null | fsm.py | F74036386/telegramChatBot | 3ab75b827e7acd9d4c4674ff579739f246db0bf8 | [
"MIT"
] | null | null | null | fsm.py | F74036386/telegramChatBot | 3ab75b827e7acd9d4c4674ff579739f246db0bf8 | [
"MIT"
] | null | null | null | from transitions.extensions import GraphMachine
class TocMachine(GraphMachine):
def __init__(self, **machine_configs):
self.machine = GraphMachine(
model = self,
**machine_configs
)
def is_going_to_92(self, update):
text = update.message.text
return text.lower() == '92'
def is_going_to_95(self, update):
text = update.message.text
return text.lower() == '95'
def is_going_to_98(self, update):
text = update.message.text
return text.lower() == '98'
def is_going_to_amo(self, update):
text = update.message.text
return text.lower() == 'amount'
def is_going_to_full(self, update):
text = update.message.text
return text.lower() == 'full'
def is_going_to_cash(self, update):
text = update.message.text
return text.lower() == 'cash'
def is_going_to_credit(self, update):
text = update.message.text
return text.lower() == 'credit card'
def on_enter_92(self, update):
update.message.reply_text("you need to 92")
update.message.reply_text("full or amount of oil")
def on_enter_95(self, update):
update.message.reply_text("you need to 95")
update.message.reply_text("full or amount of oil")
def on_enter_98(self, update):
update.message.reply_text("you need to 98")
update.message.reply_text("full or amount of oil")
def on_enter_full(self, update):
update.message.reply_text("you need to make it full")
update.message.reply_text("pay by cash or credit card")
def on_enter_amo(self, update):
update.message.reply_text("you need to get some oil")
update.message.reply_text("pay by cash or credit")
def on_enter_cash(self, update):
update.message.reply_text("you need to pay by cash")
update.message.reply_text("thanks")
self.go_back(update)
def on_enter_credit(self, update):
update.message.reply_text("you needto pay by credit card")
update.message.reply_text("thanks")
self.go_back(update)
# def on_exit_state1(self, update):
# print('Leaving state1')
# def on_enter_state2(self, update):
# update.message.reply_text("I'm entering state2")
# self.go_back(update)
# def on_exit_state2(self, update):
# print('Leaving state2')
| 32.105263 | 66 | 0.634426 | 332 | 2,440 | 4.466867 | 0.168675 | 0.192852 | 0.182063 | 0.222522 | 0.688469 | 0.665543 | 0.643965 | 0.600809 | 0.600809 | 0.165206 | 0 | 0.016493 | 0.254508 | 2,440 | 75 | 67 | 32.533333 | 0.798791 | 0.104098 | 0 | 0.27451 | 0 | 0 | 0.135632 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294118 | false | 0 | 0.019608 | 0 | 0.470588 | 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 | 0 | 0 | 0 | 3 |
08107539dd544ae41547341032460da00df09bb3 | 1,463 | gyp | Python | binding.gyp | trackds/osi2-stream | a0630b3a3a2a7330c069696ad2985332ced4db29 | [
"MIT"
] | 2 | 2018-04-01T16:02:02.000Z | 2019-01-05T13:13:27.000Z | binding.gyp | trackds/osi2-stream | a0630b3a3a2a7330c069696ad2985332ced4db29 | [
"MIT"
] | 1 | 2018-01-31T11:58:56.000Z | 2018-01-31T11:59:02.000Z | binding.gyp | trackds/osi2-stream | a0630b3a3a2a7330c069696ad2985332ced4db29 | [
"MIT"
] | null | null | null | {
"targets":[
{
"target_name":"pcap_addon",
"sources":[
"./src/winpcap/pcap_addon.cc",
"./src/winpcap/pcapObjFactory.cc",
"./src/winpcap/commLib.cc"],
"include_dirs": [
"<!(node -e \"require('nan')\")",
"lib/winpcap/include",
"lib/winpcap/include/pcap",
"src/winpcap/include"
],
"defines":[
"HAVE_REMOTE"
],
"conditions":[
["OS==\"win\"", {
"conditions":[
['target_arch=="x64"',{
"libraries": [
"-l../lib/winpcap/lib/x64/wpcap",
"-l../lib/winpcap/lib/x64/Packet"
]
}],
['target_arch=="x86"',{
"libraries": [
"-l../lib/winpcap/lib/wpcap",
"-l../lib/winpcap/lib/Packet"
]
}]
]
}],
["OS==\"linux\"", {
"libraries": [
"lib/winpcap/Lib/libwpcap.a",
"lib/winpcap/Lib/libpacket.a"
]
}]
]
}
]
} | 32.511111 | 65 | 0.285714 | 85 | 1,463 | 4.835294 | 0.411765 | 0.194647 | 0.189781 | 0.136253 | 0.218978 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012598 | 0.56596 | 1,463 | 45 | 66 | 32.511111 | 0.634646 | 0 | 0 | 0.25 | 0 | 0 | 0.331284 | 0.186475 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
081836ffc8dd467c4671335ce78c041ebfde4501 | 925 | py | Python | bl4btc/btc/migrations/0024_auto_20161013_1903.py | llennox/projects | b52e9a56260a67a290492479a8792fad690b327a | [
"MIT"
] | null | null | null | bl4btc/btc/migrations/0024_auto_20161013_1903.py | llennox/projects | b52e9a56260a67a290492479a8792fad690b327a | [
"MIT"
] | null | null | null | bl4btc/btc/migrations/0024_auto_20161013_1903.py | llennox/projects | b52e9a56260a67a290492479a8792fad690b327a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-13 19:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('btc', '0023_auto_20160923_1904'),
]
operations = [
migrations.AddField(
model_name='escrowpayoutledger',
name='validated',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='profil',
name='in_escrow',
field=models.FloatField(default=0),
),
migrations.AddField(
model_name='profil',
name='wif',
field=models.CharField(default=0, max_length=255),
),
migrations.AddField(
model_name='sysvar',
name='counter',
field=models.IntegerField(default=1),
),
]
| 25.694444 | 62 | 0.566486 | 89 | 925 | 5.730337 | 0.58427 | 0.141176 | 0.180392 | 0.211765 | 0.145098 | 0.145098 | 0 | 0 | 0 | 0 | 0 | 0.061611 | 0.315676 | 925 | 35 | 63 | 26.428571 | 0.744076 | 0.073514 | 0 | 0.357143 | 1 | 0 | 0.105386 | 0.026932 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.071429 | 0 | 0.178571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
081c8973f0c28a4ac1ba7350c8fdde34ba664764 | 142 | py | Python | venv/Lib/site-packages/execnet/_version.py | ksj-123/conduit | 3427d76d0fa364cb5d19bdd6da4aeb0a22fe9660 | [
"MIT"
] | 1 | 2021-06-07T17:07:58.000Z | 2021-06-07T17:07:58.000Z | venv/Lib/site-packages/execnet/_version.py | Arthii01052/conduit | 3427d76d0fa364cb5d19bdd6da4aeb0a22fe9660 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/execnet/_version.py | Arthii01052/conduit | 3427d76d0fa364cb5d19bdd6da4aeb0a22fe9660 | [
"MIT"
] | 1 | 2022-03-31T06:46:19.000Z | 2022-03-31T06:46:19.000Z | # coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
version = '1.9.0'
version_tuple = (1, 9, 0)
| 23.666667 | 46 | 0.704225 | 26 | 142 | 3.769231 | 0.730769 | 0.081633 | 0.061224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.059322 | 0.169014 | 142 | 5 | 47 | 28.4 | 0.771186 | 0.640845 | 0 | 0 | 1 | 0 | 0.106383 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
083871daa5577210514ffb477e59fca1c8e6a886 | 1,784 | py | Python | api/models.py | sirrobot01/bookhub-api | aebf951b9b4d6bd8ce5d5803cd6b7a2e4736e0b7 | [
"MIT"
] | 1 | 2020-08-16T22:44:55.000Z | 2020-08-16T22:44:55.000Z | api/models.py | sirrobot01/bookhub-api | aebf951b9b4d6bd8ce5d5803cd6b7a2e4736e0b7 | [
"MIT"
] | null | null | null | api/models.py | sirrobot01/bookhub-api | aebf951b9b4d6bd8ce5d5803cd6b7a2e4736e0b7 | [
"MIT"
] | null | null | null | from django.contrib.auth import get_user_model
from django.db import models
from django.utils.text import slugify
# Create your models here.
User = get_user_model()
class ShelvesModel(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=255)
description = models.TextField(blank=True, null=True)
slug = models.SlugField(unique=True, blank=True, null=True, editable=False)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
unique_together = ('user', 'name')
def __str__(self):
return self.name
def save(self, *args, **kwargs):
self.slug = slugify(self.name)
super(ShelvesModel, self).save()
class CategoryModel(models.Model):
name = models.CharField(max_length=255)
slug = models.SlugField(unique=True, blank=True, null=True, editable=False)
def __str__(self):
return self.name
def save(self, *args, **kwargs):
self.slug = slugify(self.name)
super(CategoryModel, self).save()
class BookModel(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
shelf = models.ForeignKey(ShelvesModel, blank=True, null=True, on_delete=models.CASCADE)
name = models.CharField(max_length=255)
category = models.ForeignKey(CategoryModel, on_delete=models.CASCADE)
slug = models.SlugField(unique=True, blank=True, null=True, editable=False)
description = models.TextField(blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
unique_together = ('user', 'name')
def __str__(self):
return self.name
def save(self, *args, **kwargs):
self.slug = slugify(self.name)
super(BookModel, self).save()
| 30.237288 | 92 | 0.696188 | 228 | 1,784 | 5.311404 | 0.25 | 0.044591 | 0.06441 | 0.084228 | 0.705202 | 0.705202 | 0.679604 | 0.608588 | 0.608588 | 0.608588 | 0 | 0.006186 | 0.184417 | 1,784 | 58 | 93 | 30.758621 | 0.826117 | 0.013453 | 0 | 0.7 | 0 | 0 | 0.009101 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.15 | false | 0 | 0.075 | 0.075 | 0.775 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
085354e9251719682ad1b68ecadaff7c7bd905d8 | 191 | py | Python | settings.py | eon01/imci | 189c0b1120bc30404997d4c5cd1c457bee6b321c | [
"MIT"
] | null | null | null | settings.py | eon01/imci | 189c0b1120bc30404997d4c5cd1c457bee6b321c | [
"MIT"
] | null | null | null | settings.py | eon01/imci | 189c0b1120bc30404997d4c5cd1c457bee6b321c | [
"MIT"
] | null | null | null | SOURCE = "http://tabinstore.fr"
HEADER = "User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11"
MAX_IMG_SIZE = 71680 # In Bytes
| 31.833333 | 124 | 0.717277 | 34 | 191 | 3.970588 | 0.882353 | 0.074074 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167665 | 0.125654 | 191 | 5 | 125 | 38.2 | 0.640719 | 0.041885 | 0 | 0 | 0 | 0.333333 | 0.743017 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f22a7939d36ce81485c575b8bc46a40bcd4136eb | 156 | py | Python | pathfinder/__init__.py | Acronexp/AwsmCogs | 6a49261292c28b2a4237d24b28b2cd7bf7562073 | [
"MIT"
] | null | null | null | pathfinder/__init__.py | Acronexp/AwsmCogs | 6a49261292c28b2a4237d24b28b2cd7bf7562073 | [
"MIT"
] | null | null | null | pathfinder/__init__.py | Acronexp/AwsmCogs | 6a49261292c28b2a4237d24b28b2cd7bf7562073 | [
"MIT"
] | null | null | null | from .pathfinder import Pathfinder
__red_end_user_data_statement__ = 'This cog does not store user data.'
def setup(bot):
bot.add_cog(Pathfinder(bot)) | 26 | 70 | 0.782051 | 24 | 156 | 4.708333 | 0.708333 | 0.141593 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134615 | 156 | 6 | 71 | 26 | 0.837037 | 0 | 0 | 0 | 0 | 0 | 0.216561 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f22e6e8729ccd5a5c582d574cc9c94f25ff77d23 | 180 | py | Python | exceptions/exceptions_AttributeError.py | all3g/pieces | bc378fd22ddc700891fe7f34ab0d5b341141e434 | [
"CNRI-Python"
] | 34 | 2016-10-31T02:05:24.000Z | 2018-11-08T14:33:13.000Z | exceptions/exceptions_AttributeError.py | join-us/python-programming | bc378fd22ddc700891fe7f34ab0d5b341141e434 | [
"CNRI-Python"
] | 2 | 2017-05-11T03:00:31.000Z | 2017-11-01T23:37:37.000Z | exceptions/exceptions_AttributeError.py | join-us/python-programming | bc378fd22ddc700891fe7f34ab0d5b341141e434 | [
"CNRI-Python"
] | 21 | 2016-08-19T09:05:45.000Z | 2018-11-08T14:33:16.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
class NoAttributes(object):
pass
o = NoAttributes()
print o.attribute
| 12.857143 | 55 | 0.666667 | 23 | 180 | 5.217391 | 0.913043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034014 | 0.183333 | 180 | 13 | 56 | 13.846154 | 0.782313 | 0.511111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.25 | 0 | null | null | 0.25 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f2300b6c56a4239090212b8b84d8510947a0d95a | 7,106 | py | Python | flatbuffers/python/quantra/FloatingRateBond.py | joseprupi/quantragrpc | 48192a1d490596115252c2ad33e2dee4e2b215b5 | [
"BSD-3-Clause"
] | null | null | null | flatbuffers/python/quantra/FloatingRateBond.py | joseprupi/quantragrpc | 48192a1d490596115252c2ad33e2dee4e2b215b5 | [
"BSD-3-Clause"
] | null | null | null | flatbuffers/python/quantra/FloatingRateBond.py | joseprupi/quantragrpc | 48192a1d490596115252c2ad33e2dee4e2b215b5 | [
"BSD-3-Clause"
] | null | null | null | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: quantra
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class FloatingRateBond(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = FloatingRateBond()
x.Init(buf, n + offset)
return x
@classmethod
def GetRootAsFloatingRateBond(cls, buf, offset=0):
"""This method is deprecated. Please switch to GetRootAs."""
return cls.GetRootAs(buf, offset)
# FloatingRateBond
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# FloatingRateBond
def SettlementDays(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
# FloatingRateBond
def FaceAmount(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
return 0.0
# FloatingRateBond
def Schedule(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
from quantra.Schedule import Schedule
obj = Schedule()
obj.Init(self._tab.Bytes, x)
return obj
return None
# FloatingRateBond
def Index(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
from quantra.Index import Index
obj = Index()
obj.Init(self._tab.Bytes, x)
return obj
return None
# FloatingRateBond
def AccrualDayCounter(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
# FloatingRateBond
def PaymentConvention(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
# FloatingRateBond
def FixingDays(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
# FloatingRateBond
def Spread(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
return 0.0
# FloatingRateBond
def InArrears(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
if o != 0:
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return False
# FloatingRateBond
def Redemption(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
return 0.0
# FloatingRateBond
def IssueDate(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
if o != 0:
return self._tab.String(o + self._tab.Pos)
return None
def Start(builder): builder.StartObject(11)
def FloatingRateBondStart(builder):
"""This method is deprecated. Please switch to Start."""
return Start(builder)
def AddSettlementDays(builder, settlementDays): builder.PrependInt32Slot(0, settlementDays, 0)
def FloatingRateBondAddSettlementDays(builder, settlementDays):
"""This method is deprecated. Please switch to AddSettlementDays."""
return AddSettlementDays(builder, settlementDays)
def AddFaceAmount(builder, faceAmount): builder.PrependFloat64Slot(1, faceAmount, 0.0)
def FloatingRateBondAddFaceAmount(builder, faceAmount):
"""This method is deprecated. Please switch to AddFaceAmount."""
return AddFaceAmount(builder, faceAmount)
def AddSchedule(builder, schedule): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(schedule), 0)
def FloatingRateBondAddSchedule(builder, schedule):
"""This method is deprecated. Please switch to AddSchedule."""
return AddSchedule(builder, schedule)
def AddIndex(builder, index): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(index), 0)
def FloatingRateBondAddIndex(builder, index):
"""This method is deprecated. Please switch to AddIndex."""
return AddIndex(builder, index)
def AddAccrualDayCounter(builder, accrualDayCounter): builder.PrependInt8Slot(4, accrualDayCounter, 0)
def FloatingRateBondAddAccrualDayCounter(builder, accrualDayCounter):
"""This method is deprecated. Please switch to AddAccrualDayCounter."""
return AddAccrualDayCounter(builder, accrualDayCounter)
def AddPaymentConvention(builder, paymentConvention): builder.PrependInt8Slot(5, paymentConvention, 0)
def FloatingRateBondAddPaymentConvention(builder, paymentConvention):
"""This method is deprecated. Please switch to AddPaymentConvention."""
return AddPaymentConvention(builder, paymentConvention)
def AddFixingDays(builder, fixingDays): builder.PrependInt32Slot(6, fixingDays, 0)
def FloatingRateBondAddFixingDays(builder, fixingDays):
"""This method is deprecated. Please switch to AddFixingDays."""
return AddFixingDays(builder, fixingDays)
def AddSpread(builder, spread): builder.PrependFloat64Slot(7, spread, 0.0)
def FloatingRateBondAddSpread(builder, spread):
"""This method is deprecated. Please switch to AddSpread."""
return AddSpread(builder, spread)
def AddInArrears(builder, inArrears): builder.PrependBoolSlot(8, inArrears, 0)
def FloatingRateBondAddInArrears(builder, inArrears):
"""This method is deprecated. Please switch to AddInArrears."""
return AddInArrears(builder, inArrears)
def AddRedemption(builder, redemption): builder.PrependFloat64Slot(9, redemption, 0.0)
def FloatingRateBondAddRedemption(builder, redemption):
"""This method is deprecated. Please switch to AddRedemption."""
return AddRedemption(builder, redemption)
def AddIssueDate(builder, issueDate): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(issueDate), 0)
def FloatingRateBondAddIssueDate(builder, issueDate):
"""This method is deprecated. Please switch to AddIssueDate."""
return AddIssueDate(builder, issueDate)
def End(builder): return builder.EndObject()
def FloatingRateBondEnd(builder):
"""This method is deprecated. Please switch to End."""
return End(builder) | 43.595092 | 139 | 0.713904 | 795 | 7,106 | 6.281761 | 0.161006 | 0.050461 | 0.096916 | 0.061674 | 0.441129 | 0.434321 | 0.39988 | 0.313376 | 0.296155 | 0.296155 | 0 | 0.016263 | 0.186603 | 7,106 | 163 | 140 | 43.595092 | 0.847751 | 0.154658 | 0 | 0.305085 | 1 | 0 | 0.000675 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.338983 | false | 0 | 0.042373 | 0.008475 | 0.711864 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
f27690e1960cb6c36310abf8c00c1c44015847ab | 16,371 | py | Python | psx/_dump_/3/_dump_ida_/overlay_c/make_psx.py | maoa3/scalpel | 2e7381b516cded28996d290438acc618d00b2aa7 | [
"Unlicense"
] | 15 | 2018-06-28T01:11:25.000Z | 2021-09-27T15:57:18.000Z | psx/_dump_/3/_dump_ida_/overlay_c/make_psx.py | maoa3/scalpel | 2e7381b516cded28996d290438acc618d00b2aa7 | [
"Unlicense"
] | 7 | 2018-06-29T04:08:23.000Z | 2019-10-17T13:57:22.000Z | psx/_dump_/3/_dump_ida_/overlay_c/make_psx.py | maoa3/scalpel | 2e7381b516cded28996d290438acc618d00b2aa7 | [
"Unlicense"
] | 7 | 2018-06-28T01:11:34.000Z | 2020-05-23T09:21:48.000Z | set_name(0x8012EA14, "GameOnlyTestRoutine__Fv", SN_NOWARN)
set_name(0x8012EA1C, "vecleny__Fii", SN_NOWARN)
set_name(0x8012EA40, "veclenx__Fii", SN_NOWARN)
set_name(0x8012EA6C, "GetDamageAmt__FiPiT1", SN_NOWARN)
set_name(0x8012F0DC, "CheckBlock__Fiiii", SN_NOWARN)
set_name(0x8012F22C, "FindClosest__Fiii", SN_NOWARN)
set_name(0x8012F3C8, "GetSpellLevel__Fii", SN_NOWARN)
set_name(0x8012F49C, "GetDirection8__Fiiii", SN_NOWARN)
set_name(0x8012F6B8, "DeleteMissile__Fii", SN_NOWARN)
set_name(0x8012F778, "GetMissileVel__Fiiiiii", SN_NOWARN)
set_name(0x8012F8FC, "PutMissile__Fi", SN_NOWARN)
set_name(0x8012FA38, "GetMissilePos__Fi", SN_NOWARN)
set_name(0x8012FB88, "MoveMissilePos__Fi", SN_NOWARN)
set_name(0x8012FD10, "MonsterTrapHit__FiiiiiUc", SN_NOWARN)
set_name(0x801300D0, "MonsterMHit__FiiiiiiUc", SN_NOWARN)
set_name(0x801308AC, "PlayerMHit__FiiiiiiUcUc", SN_NOWARN)
set_name(0x8013133C, "Plr2PlrMHit__FiiiiiiUc", SN_NOWARN)
set_name(0x80131B3C, "CheckMissileCol__FiiiUciiUc", SN_NOWARN)
set_name(0x801322B8, "SetMissAnim__Fii", SN_NOWARN)
set_name(0x801323A8, "SetMissDir__Fii", SN_NOWARN)
set_name(0x80132420, "AddLArrow__Fiiiiiicii", SN_NOWARN)
set_name(0x80132620, "AddArrow__Fiiiiiicii", SN_NOWARN)
set_name(0x801327FC, "GetVileMissPos__Fiii", SN_NOWARN)
set_name(0x8013293C, "AddRndTeleport__Fiiiiiicii", SN_NOWARN)
set_name(0x80132CDC, "AddFirebolt__Fiiiiiicii", SN_NOWARN)
set_name(0x80132FBC, "AddMagmaball__Fiiiiiicii", SN_NOWARN)
set_name(0x801330F0, "AddTeleport__Fiiiiiicii", SN_NOWARN)
set_name(0x8013335C, "AddLightball__Fiiiiiicii", SN_NOWARN)
set_name(0x801334D0, "AddFirewall__Fiiiiiicii", SN_NOWARN)
set_name(0x801336D4, "AddFireball__Fiiiiiicii", SN_NOWARN)
set_name(0x8013394C, "AddLightctrl__Fiiiiiicii", SN_NOWARN)
set_name(0x80133A54, "AddLightning__Fiiiiiicii", SN_NOWARN)
set_name(0x80133C4C, "AddMisexp__Fiiiiiicii", SN_NOWARN)
set_name(0x80133EC0, "CheckIfTrig__Fii", SN_NOWARN)
set_name(0x80133FCC, "AddTown__Fiiiiiicii", SN_NOWARN)
set_name(0x8013442C, "AddFlash__Fiiiiiicii", SN_NOWARN)
set_name(0x8013465C, "AddFlash2__Fiiiiiicii", SN_NOWARN)
set_name(0x80134870, "AddManashield__Fiiiiiicii", SN_NOWARN)
set_name(0x80134970, "AddFiremove__Fiiiiiicii", SN_NOWARN)
set_name(0x80134AE8, "AddGuardian__Fiiiiiicii", SN_NOWARN)
set_name(0x80134FD0, "AddChain__Fiiiiiicii", SN_NOWARN)
set_name(0x80135068, "AddRhino__Fiiiiiicii", SN_NOWARN)
set_name(0x801352C8, "AddFlare__Fiiiiiicii", SN_NOWARN)
set_name(0x801355E0, "AddAcid__Fiiiiiicii", SN_NOWARN)
set_name(0x80135704, "AddAcidpud__Fiiiiiicii", SN_NOWARN)
set_name(0x801357FC, "AddStone__Fiiiiiicii", SN_NOWARN)
set_name(0x80135B48, "AddGolem__Fiiiiiicii", SN_NOWARN)
set_name(0x80135D4C, "AddBoom__Fiiiiiicii", SN_NOWARN)
set_name(0x80135E34, "AddHeal__Fiiiiiicii", SN_NOWARN)
set_name(0x8013607C, "AddHealOther__Fiiiiiicii", SN_NOWARN)
set_name(0x8013610C, "AddElement__Fiiiiiicii", SN_NOWARN)
set_name(0x80136354, "AddIdentify__Fiiiiiicii", SN_NOWARN)
set_name(0x80136424, "AddFirewallC__Fiiiiiicii", SN_NOWARN)
set_name(0x80136700, "AddInfra__Fiiiiiicii", SN_NOWARN)
set_name(0x80136830, "AddWave__Fiiiiiicii", SN_NOWARN)
set_name(0x801368B4, "AddNova__Fiiiiiicii", SN_NOWARN)
set_name(0x80136AEC, "AddRepair__Fiiiiiicii", SN_NOWARN)
set_name(0x80136BBC, "AddRecharge__Fiiiiiicii", SN_NOWARN)
set_name(0x80136C8C, "AddDisarm__Fiiiiiicii", SN_NOWARN)
set_name(0x80136D1C, "AddApoca__Fiiiiiicii", SN_NOWARN)
set_name(0x80136F7C, "AddFlame__Fiiiiiicii", SN_NOWARN)
set_name(0x801371F8, "AddFlamec__Fiiiiiicii", SN_NOWARN)
set_name(0x80137308, "AddCbolt__Fiiiiiicii", SN_NOWARN)
set_name(0x80137520, "AddHbolt__Fiiiiiicii", SN_NOWARN)
set_name(0x80137700, "AddResurrect__Fiiiiiicii", SN_NOWARN)
set_name(0x80137794, "AddResurrectBeam__Fiiiiiicii", SN_NOWARN)
set_name(0x8013786C, "AddTelekinesis__Fiiiiiicii", SN_NOWARN)
set_name(0x801378FC, "AddBoneSpirit__Fiiiiiicii", SN_NOWARN)
set_name(0x80137B14, "AddRportal__Fiiiiiicii", SN_NOWARN)
set_name(0x80137BF8, "AddDiabApoca__Fiiiiiicii", SN_NOWARN)
set_name(0x80137D54, "AddMissile__Fiiiiiiciii", SN_NOWARN)
set_name(0x801380A8, "Sentfire__Fiii", SN_NOWARN)
set_name(0x801382A8, "MI_Dummy__Fi", SN_NOWARN)
set_name(0x801382B0, "MI_Golem__Fi", SN_NOWARN)
set_name(0x8013852C, "MI_SetManashield__Fi", SN_NOWARN)
set_name(0x80138568, "MI_LArrow__Fi", SN_NOWARN)
set_name(0x80138D44, "MI_Arrow__Fi", SN_NOWARN)
set_name(0x80138F78, "MI_Firebolt__Fi", SN_NOWARN)
set_name(0x80139660, "MI_Lightball__Fi", SN_NOWARN)
set_name(0x80139904, "MI_Acidpud__Fi", SN_NOWARN)
set_name(0x80139A34, "MI_Firewall__Fi", SN_NOWARN)
set_name(0x80139D18, "MI_Fireball__Fi", SN_NOWARN)
set_name(0x8013A6F8, "MI_Lightctrl__Fi", SN_NOWARN)
set_name(0x8013ACA8, "MI_Lightning__Fi", SN_NOWARN)
set_name(0x8013AE40, "MI_Town__Fi", SN_NOWARN)
set_name(0x8013B104, "MI_Flash__Fi", SN_NOWARN)
set_name(0x8013B534, "MI_Flash2__Fi", SN_NOWARN)
set_name(0x8013B774, "MI_Manashield__Fi", SN_NOWARN)
set_name(0x8013BD98, "MI_Firemove__Fi", SN_NOWARN)
set_name(0x8013C1F4, "MI_Guardian__Fi", SN_NOWARN)
set_name(0x8013C5E0, "MI_Chain__Fi", SN_NOWARN)
set_name(0x8013C904, "MI_Misexp__Fi", SN_NOWARN)
set_name(0x8013CC24, "MI_Acidsplat__Fi", SN_NOWARN)
set_name(0x8013CDE8, "MI_Teleport__Fi", SN_NOWARN)
set_name(0x8013D1D0, "MI_Stone__Fi", SN_NOWARN)
set_name(0x8013D398, "MI_Boom__Fi", SN_NOWARN)
set_name(0x8013D4AC, "MI_Rhino__Fi", SN_NOWARN)
set_name(0x8013D894, "MI_FirewallC__Fi", SN_NOWARN)
set_name(0x8013DC88, "MI_Infra__Fi", SN_NOWARN)
set_name(0x8013DD68, "MI_Apoca__Fi", SN_NOWARN)
set_name(0x8013E01C, "MI_Wave__Fi", SN_NOWARN)
set_name(0x8013E5C4, "MI_Nova__Fi", SN_NOWARN)
set_name(0x8013E8A4, "MI_Flame__Fi", SN_NOWARN)
set_name(0x8013EAB8, "MI_Flamec__Fi", SN_NOWARN)
set_name(0x8013EDE8, "MI_Cbolt__Fi", SN_NOWARN)
set_name(0x8013F10C, "MI_Hbolt__Fi", SN_NOWARN)
set_name(0x8013F438, "MI_Element__Fi", SN_NOWARN)
set_name(0x8013FB0C, "MI_Bonespirit__Fi", SN_NOWARN)
set_name(0x8013FF30, "MI_ResurrectBeam__Fi", SN_NOWARN)
set_name(0x8013FFC8, "MI_Rportal__Fi", SN_NOWARN)
set_name(0x8014020C, "ProcessMissiles__Fv", SN_NOWARN)
set_name(0x80140600, "ClearMissileSpot__Fi", SN_NOWARN)
set_name(0x801406F0, "MoveToScrollTarget__7CBlocks", SN_NOWARN)
set_name(0x80140704, "MonstPartJump__Fi", SN_NOWARN)
set_name(0x80140898, "DeleteMonster__Fi", SN_NOWARN)
set_name(0x80140930, "M_GetDir__Fi", SN_NOWARN)
set_name(0x801409B4, "M_StartDelay__Fii", SN_NOWARN)
set_name(0x80140A40, "M_StartRAttack__Fiii", SN_NOWARN)
set_name(0x80140BA4, "M_StartRSpAttack__Fiii", SN_NOWARN)
set_name(0x80140D14, "M_StartSpAttack__Fi", SN_NOWARN)
set_name(0x80140E48, "M_StartEat__Fi", SN_NOWARN)
set_name(0x80140F64, "M_GetKnockback__Fi", SN_NOWARN)
set_name(0x801411C0, "M_StartHit__Fiii", SN_NOWARN)
set_name(0x801414F0, "M_DiabloDeath__FiUc", SN_NOWARN)
set_name(0x80141838, "M2MStartHit__Fiii", SN_NOWARN)
set_name(0x80141B28, "MonstStartKill__FiiUc", SN_NOWARN)
set_name(0x80141E40, "M2MStartKill__Fii", SN_NOWARN)
set_name(0x80142260, "M_StartKill__Fii", SN_NOWARN)
set_name(0x80142370, "M_StartFadein__FiiUc", SN_NOWARN)
set_name(0x80142510, "M_StartFadeout__FiiUc", SN_NOWARN)
set_name(0x801426A4, "M_StartHeal__Fi", SN_NOWARN)
set_name(0x80142778, "M_ChangeLightOffset__Fi", SN_NOWARN)
set_name(0x80142840, "M_DoStand__Fi", SN_NOWARN)
set_name(0x801428F8, "M_DoWalk__Fi", SN_NOWARN)
set_name(0x80142BC4, "M_DoWalk2__Fi", SN_NOWARN)
set_name(0x80142DF8, "M_DoWalk3__Fi", SN_NOWARN)
set_name(0x80143104, "M_TryM2MHit__Fiiiii", SN_NOWARN)
set_name(0x80143314, "M_TryH2HHit__Fiiiii", SN_NOWARN)
set_name(0x80143B38, "M_DoAttack__Fi", SN_NOWARN)
set_name(0x80143D24, "M_DoRAttack__Fi", SN_NOWARN)
set_name(0x80143EDC, "M_DoRSpAttack__Fi", SN_NOWARN)
set_name(0x80144118, "M_DoSAttack__Fi", SN_NOWARN)
set_name(0x80144230, "M_DoFadein__Fi", SN_NOWARN)
set_name(0x80144328, "M_DoFadeout__Fi", SN_NOWARN)
set_name(0x80144494, "M_DoHeal__Fi", SN_NOWARN)
set_name(0x80144570, "M_DoTalk__Fi", SN_NOWARN)
set_name(0x80144A78, "M_Teleport__Fi", SN_NOWARN)
set_name(0x80144D14, "M_DoGotHit__Fi", SN_NOWARN)
set_name(0x80144DCC, "DoEnding__Fv", SN_NOWARN)
set_name(0x80144DD4, "PrepDoEnding__Fv", SN_NOWARN)
set_name(0x80144F30, "M_DoDeath__Fi", SN_NOWARN)
set_name(0x801451F4, "M_DoSpStand__Fi", SN_NOWARN)
set_name(0x801452DC, "M_DoDelay__Fi", SN_NOWARN)
set_name(0x80145414, "M_DoStone__Fi", SN_NOWARN)
set_name(0x801454D4, "M_WalkDir__Fii", SN_NOWARN)
set_name(0x80145750, "GroupUnity__Fi", SN_NOWARN)
set_name(0x80145B84, "M_CallWalk__Fii", SN_NOWARN)
set_name(0x80145D70, "M_PathWalk__Fi", SN_NOWARN)
set_name(0x80145E50, "M_CallWalk2__Fii", SN_NOWARN)
set_name(0x80145F64, "M_DumbWalk__Fii", SN_NOWARN)
set_name(0x80145FB8, "M_RoundWalk__FiiRi", SN_NOWARN)
set_name(0x80146158, "MAI_Zombie__Fi", SN_NOWARN)
set_name(0x8014636C, "MAI_SkelSd__Fi", SN_NOWARN)
set_name(0x80146520, "MAI_Snake__Fi", SN_NOWARN)
set_name(0x80146944, "MAI_Bat__Fi", SN_NOWARN)
set_name(0x80146D18, "MAI_SkelBow__Fi", SN_NOWARN)
set_name(0x80146F20, "MAI_Fat__Fi", SN_NOWARN)
set_name(0x801470F0, "MAI_Sneak__Fi", SN_NOWARN)
set_name(0x801474F8, "MAI_Fireman__Fi", SN_NOWARN)
set_name(0x8014780C, "MAI_Fallen__Fi", SN_NOWARN)
set_name(0x80147B44, "MAI_Cleaver__Fi", SN_NOWARN)
set_name(0x80147C48, "MAI_Round__FiUc", SN_NOWARN)
set_name(0x801480D4, "MAI_GoatMc__Fi", SN_NOWARN)
set_name(0x801480F4, "MAI_Ranged__FiiUc", SN_NOWARN)
set_name(0x80148338, "MAI_GoatBow__Fi", SN_NOWARN)
set_name(0x8014835C, "MAI_Succ__Fi", SN_NOWARN)
set_name(0x80148380, "MAI_AcidUniq__Fi", SN_NOWARN)
set_name(0x801483A4, "MAI_Scav__Fi", SN_NOWARN)
set_name(0x801487D8, "MAI_Garg__Fi", SN_NOWARN)
set_name(0x801489D8, "MAI_RoundRanged__FiiUciUc", SN_NOWARN)
set_name(0x80148F10, "MAI_Magma__Fi", SN_NOWARN)
set_name(0x80148F3C, "MAI_Storm__Fi", SN_NOWARN)
set_name(0x80148F68, "MAI_Acid__Fi", SN_NOWARN)
set_name(0x80148F98, "MAI_Diablo__Fi", SN_NOWARN)
set_name(0x80148FC4, "MAI_RR2__Fiii", SN_NOWARN)
set_name(0x801494E0, "MAI_Mega__Fi", SN_NOWARN)
set_name(0x80149504, "MAI_SkelKing__Fi", SN_NOWARN)
set_name(0x80149A5C, "MAI_Rhino__Fi", SN_NOWARN)
set_name(0x80149F20, "MAI_Counselor__Fi", SN_NOWARN)
set_name(0x8014A408, "MAI_Garbud__Fi", SN_NOWARN)
set_name(0x8014A5D4, "MAI_Zhar__Fi", SN_NOWARN)
set_name(0x8014A7E8, "MAI_SnotSpil__Fi", SN_NOWARN)
set_name(0x8014AA38, "MAI_Lazurus__Fi", SN_NOWARN)
set_name(0x8014ACCC, "MAI_Lazhelp__Fi", SN_NOWARN)
set_name(0x8014AE08, "MAI_Lachdanan__Fi", SN_NOWARN)
set_name(0x8014AFB4, "MAI_Warlord__Fi", SN_NOWARN)
set_name(0x8014B11C, "DeleteMonsterList__Fv", SN_NOWARN)
set_name(0x8014B268, "ProcessMonsters__Fv", SN_NOWARN)
set_name(0x8014B8B8, "DirOK__Fii", SN_NOWARN)
set_name(0x8014BD10, "PosOkMissile__Fii", SN_NOWARN)
set_name(0x8014BD78, "CheckNoSolid__Fii", SN_NOWARN)
set_name(0x8014BDBC, "LineClearF__FPFii_Uciiii", SN_NOWARN)
set_name(0x8014C044, "LineClear__Fiiii", SN_NOWARN)
set_name(0x8014C084, "LineClearF1__FPFiii_Uciiiii", SN_NOWARN)
set_name(0x8014C318, "M_FallenFear__Fii", SN_NOWARN)
set_name(0x8014C50C, "PrintMonstHistory__Fi", SN_NOWARN)
set_name(0x8014C734, "PrintUniqueHistory__Fv", SN_NOWARN)
set_name(0x8014C858, "MissToMonst__Fiii", SN_NOWARN)
set_name(0x8014CD40, "PosOkMonst2__Fiii", SN_NOWARN)
set_name(0x8014CF5C, "PosOkMonst3__Fiii", SN_NOWARN)
set_name(0x8014D250, "M_SpawnSkel__Fiii", SN_NOWARN)
set_name(0x8014D3CC, "TalktoMonster__Fi", SN_NOWARN)
set_name(0x8014D50C, "SpawnGolum__Fiiii", SN_NOWARN)
set_name(0x8014D7A4, "CanTalkToMonst__Fi", SN_NOWARN)
set_name(0x8014D814, "CheckMonsterHit__FiRUc", SN_NOWARN)
set_name(0x8014D924, "MAI_Golum__Fi", SN_NOWARN)
set_name(0x8014DCB4, "MAI_Path__Fi", SN_NOWARN)
set_name(0x8014DE34, "M_StartAttack__Fi", SN_NOWARN)
set_name(0x8014DF68, "M_StartWalk__Fiiiiii", SN_NOWARN)
set_name(0x8014E194, "AddWarpMissile__Fiii", SN_NOWARN)
set_name(0x8014E29C, "SyncPortals__Fv", SN_NOWARN)
set_name(0x8014E3A4, "AddInTownPortal__Fi", SN_NOWARN)
set_name(0x8014E3E0, "ActivatePortal__FiiiiiUc", SN_NOWARN)
set_name(0x8014E4BC, "DeactivatePortal__Fi", SN_NOWARN)
set_name(0x8014E514, "PortalOnLevel__Fi", SN_NOWARN)
set_name(0x8014E584, "RemovePortalMissile__Fi", SN_NOWARN)
set_name(0x8014E720, "SetCurrentPortal__Fi", SN_NOWARN)
set_name(0x8014E72C, "GetPortalLevel__Fv", SN_NOWARN)
set_name(0x8014E91C, "GetPortalLvlPos__Fv", SN_NOWARN)
set_name(0x8014EA00, "FreeInvGFX__Fv", SN_NOWARN)
set_name(0x8014EA08, "InvDrawSlot__Fiii", SN_NOWARN)
set_name(0x8014EA8C, "InvDrawSlotBack__FiiiiUc", SN_NOWARN)
set_name(0x8014ECE0, "InvDrawItem__FiiiUci", SN_NOWARN)
set_name(0x8014EDB0, "InvDrawSlots__Fv", SN_NOWARN)
set_name(0x8014F0C4, "PrintStat__FiiPcUc", SN_NOWARN)
set_name(0x8014F190, "DrawInvStats__Fv", SN_NOWARN)
set_name(0x8014FD1C, "DrawInvBack__Fv", SN_NOWARN)
set_name(0x8014FDA4, "DrawInvCursor__Fv", SN_NOWARN)
set_name(0x80150280, "DrawInvMsg__Fv", SN_NOWARN)
set_name(0x80150448, "DrawInv__Fv", SN_NOWARN)
set_name(0x80150478, "DrawInvTSK__FP4TASK", SN_NOWARN)
set_name(0x80150744, "DoThatDrawInv__Fv", SN_NOWARN)
set_name(0x80151020, "AutoPlace__FiiiiUc", SN_NOWARN)
set_name(0x8015133C, "SpecialAutoPlace__FiiiiUc", SN_NOWARN)
set_name(0x801516D4, "GoldAutoPlace__Fi", SN_NOWARN)
set_name(0x80151BA0, "WeaponAutoPlace__Fi", SN_NOWARN)
set_name(0x80151E28, "SwapItem__FP10ItemStructT0", SN_NOWARN)
set_name(0x80151F18, "CheckInvPaste__Fiii", SN_NOWARN)
set_name(0x80153BA4, "CheckInvCut__Fiii", SN_NOWARN)
set_name(0x80154630, "RemoveInvItem__Fii", SN_NOWARN)
set_name(0x801548D4, "RemoveSpdBarItem__Fii", SN_NOWARN)
set_name(0x801549D4, "CheckInvScrn__Fv", SN_NOWARN)
set_name(0x80154A4C, "CheckItemStats__Fi", SN_NOWARN)
set_name(0x80154AD0, "CheckBookLevel__Fi", SN_NOWARN)
set_name(0x80154C04, "CheckQuestItem__Fi", SN_NOWARN)
set_name(0x8015502C, "InvGetItem__Fii", SN_NOWARN)
set_name(0x80155324, "AutoGetItem__Fii", SN_NOWARN)
set_name(0x80155D88, "FindGetItem__FiUsi", SN_NOWARN)
set_name(0x80155E3C, "SyncGetItem__FiiiUsi", SN_NOWARN)
set_name(0x80156048, "TryInvPut__Fv", SN_NOWARN)
set_name(0x80156210, "InvPutItem__Fiii", SN_NOWARN)
set_name(0x801566B4, "SyncPutItem__FiiiiUsiUciiiiiUl", SN_NOWARN)
set_name(0x80156C50, "CheckInvHLight__Fv", SN_NOWARN)
set_name(0x80156F94, "RemoveScroll__Fi", SN_NOWARN)
set_name(0x80157178, "UseScroll__Fv", SN_NOWARN)
set_name(0x801573E0, "UseStaffCharge__Fi", SN_NOWARN)
set_name(0x801574A0, "UseStaff__Fv", SN_NOWARN)
set_name(0x80157560, "StartGoldDrop__Fv", SN_NOWARN)
set_name(0x80157664, "UseInvItem__Fii", SN_NOWARN)
set_name(0x80157B8C, "DoTelekinesis__Fv", SN_NOWARN)
set_name(0x80157CB4, "CalculateGold__Fi", SN_NOWARN)
set_name(0x80157DEC, "DropItemBeforeTrig__Fv", SN_NOWARN)
set_name(0x80157E44, "ControlInv__Fv", SN_NOWARN)
set_name(0x801581CC, "InvGetItemWH__Fi", SN_NOWARN)
set_name(0x801582C4, "InvAlignObject__Fv", SN_NOWARN)
set_name(0x80158478, "InvSetItemCurs__Fv", SN_NOWARN)
set_name(0x8015860C, "InvMoveCursLeft__Fv", SN_NOWARN)
set_name(0x801587E8, "InvMoveCursRight__Fv", SN_NOWARN)
set_name(0x80158B00, "InvMoveCursUp__Fv", SN_NOWARN)
set_name(0x80158CE8, "InvMoveCursDown__Fv", SN_NOWARN)
set_name(0x80159000, "DumpMonsters__7CBlocks", SN_NOWARN)
set_name(0x80159028, "Flush__4CPad", SN_NOWARN)
set_name(0x8015904C, "SetRGB__6DialogUcUcUc", SN_NOWARN)
set_name(0x8015906C, "SetBack__6Dialogi", SN_NOWARN)
set_name(0x80159074, "SetBorder__6Dialogi", SN_NOWARN)
set_name(0x8015907C, "SetOTpos__6Dialogi", SN_NOWARN)
set_name(0x80159088, "___6Dialog", SN_NOWARN)
set_name(0x801590B0, "__6Dialog", SN_NOWARN)
set_name(0x8015910C, "StartAutomap__Fv", SN_NOWARN)
set_name(0x80159124, "AutomapUp__Fv", SN_NOWARN)
set_name(0x8015913C, "AutomapDown__Fv", SN_NOWARN)
set_name(0x80159154, "AutomapLeft__Fv", SN_NOWARN)
set_name(0x8015916C, "AutomapRight__Fv", SN_NOWARN)
set_name(0x80159184, "AMGetLine__FUcUcUc", SN_NOWARN)
set_name(0x80159230, "AmDrawLine__Fiiii", SN_NOWARN)
set_name(0x80159298, "DrawAutomapPlr__Fv", SN_NOWARN)
set_name(0x80159610, "DrawAutoMapVertWall__Fiii", SN_NOWARN)
set_name(0x801596B8, "DrawAutoMapHorzWall__Fiii", SN_NOWARN)
set_name(0x80159760, "DrawAutoMapVertDoor__Fii", SN_NOWARN)
set_name(0x801598D8, "DrawAutoMapHorzDoor__Fii", SN_NOWARN)
set_name(0x80159A58, "DrawAutoMapVertGrate__Fii", SN_NOWARN)
set_name(0x80159AEC, "DrawAutoMapHorzGrate__Fii", SN_NOWARN)
set_name(0x80159B80, "DrawAutoMapSquare__Fii", SN_NOWARN)
set_name(0x80159C98, "DrawAutoMapStairs__Fii", SN_NOWARN)
set_name(0x80159E40, "DrawAutomap__Fv", SN_NOWARN)
set_name(0x8015A19C, "PRIM_GetPrim__FPP7LINE_F2", SN_NOWARN)
| 53.325733 | 65 | 0.831776 | 2,263 | 16,371 | 5.421564 | 0.289439 | 0.174586 | 0.273453 | 0.372891 | 0.445758 | 0.007662 | 0 | 0 | 0 | 0 | 0 | 0.155374 | 0.056075 | 16,371 | 306 | 66 | 53.5 | 0.638582 | 0 | 0 | 0 | 0 | 0 | 0.327103 | 0.098711 | 0 | 0 | 0.186916 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f27b2488336a01e59eb164874998ab36055cbb46 | 2,099 | bzl | Python | zola_deps.bzl | silvergasp/bazel_rules_zola | 6f800b9b6597fd4e4d7fe70450c207f62dc1a5bf | [
"MIT"
] | null | null | null | zola_deps.bzl | silvergasp/bazel_rules_zola | 6f800b9b6597fd4e4d7fe70450c207f62dc1a5bf | [
"MIT"
] | 2 | 2021-08-30T09:44:17.000Z | 2021-09-17T02:58:45.000Z | zola_deps.bzl | silvergasp/bazel_rules_zola | 6f800b9b6597fd4e4d7fe70450c207f62dc1a5bf | [
"MIT"
] | null | null | null | """ Third party dependencies for this project. """
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def zola_deps():
""" Fetches the dependencies for the zola project. """
if "zola-v0-14-1-x86-64-unknown-linux-gnu" not in native.existing_rules():
http_archive(
name = "zola-v0-14-1-x86-64-unknown-linux-gnu",
url = "https://github.com/getzola/zola/releases/download/v0.14.1/zola-v0.14.1-x86_64-unknown-linux-gnu.tar.gz",
build_file = "@rules_zola//third_party:zola-v0-14-1-x86-64-unknown-linux-gnu.BUILD",
sha256 = "4223f57d9b60ad7217c44a815fa975b2229f692b7ef3de4b7ce61f1634e8dc33",
)
if "zola-v0-14-1-x86_64-apple-darwin" not in native.existing_rules():
http_archive(
name = "zola-v0-14-1-x86_64-apple-darwin",
url = "https://github.com/getzola/zola/releases/download/v0.14.1/zola-v0.14.1-x86_64-apple-darwin.tar.gz",
build_file = "@rules_zola//third_party:zola-v0-14-1-x86_64-apple-darwin.BUILD",
sha256 = "754d5e1b4ca67a13c6cb4741dbff5b248075f4f4a0353d6673aa4f5afb7ec0bf",
)
if "zola-v0-14-1-x86_64-pc-windows-msvc" not in native.existing_rules():
http_archive(
name = "zola-v0-14-1-x86_64-pc-windows-msvc",
url = "https://github.com/getzola/zola/releases/download/v0.14.1/zola-v0.14.1-x86_64-pc-windows-msvc.zip",
build_file = "@rules_zola//third_party:zola-v0-14-1-x86_64-pc-windows-msvc.BUILD",
sha256 = "62bf50a6e2b606faf80cdf9112deca945fe89f67863fb06f793c27a26c968a91",
)
if "bazel_skylib" not in native.existing_rules():
http_archive(
name = "bazel_skylib",
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
],
)
| 56.72973 | 130 | 0.658885 | 278 | 2,099 | 4.859712 | 0.215827 | 0.044412 | 0.055514 | 0.079941 | 0.638786 | 0.638786 | 0.638786 | 0.634345 | 0.562546 | 0.458919 | 0 | 0.165485 | 0.193902 | 2,099 | 36 | 131 | 58.305556 | 0.632979 | 0.042878 | 0 | 0.125 | 0 | 0.21875 | 0.621554 | 0.353383 | 0 | 0 | 0 | 0 | 0 | 1 | 0.03125 | true | 0 | 0 | 0 | 0.03125 | 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 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f28d315cb1f22067583bf2663dd6cf1e2cbae6d4 | 1,277 | py | Python | unsupervisedRR/utils/io.py | Sebastian-Jung/unsupervisedRR | f4178d8187f78cc842981c163d9c5d5f3a2a1343 | [
"MIT"
] | 105 | 2021-02-24T03:21:52.000Z | 2022-03-30T03:39:49.000Z | unsupervisedRR/utils/io.py | Sebastian-Jung/unsupervisedRR | f4178d8187f78cc842981c163d9c5d5f3a2a1343 | [
"MIT"
] | 2 | 2021-04-15T12:33:21.000Z | 2021-07-22T18:41:01.000Z | unsupervisedRR/utils/io.py | Sebastian-Jung/unsupervisedRR | f4178d8187f78cc842981c163d9c5d5f3a2a1343 | [
"MIT"
] | 12 | 2021-02-24T03:31:48.000Z | 2021-09-24T12:00:35.000Z | """
Some useful I/O functions
"""
import os
import pickle
import shutil
# get all directories in a specific directory
def get_directories(path):
return [f for f in os.listdir(path) if os.path.isdir(os.path.join(path, f))]
# get all the files in a specific directory
# extension can be string or tuple of strings
def get_files(path, extension=None):
files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
if extension is not None:
files = [f for f in files if f.lower().endswith(extension)]
return files
# get all files in a specific directory
def file_exists(path):
return not os.path.exists(path)
# make directory
def makedir(path, replace_existing=False):
if not os.path.exists(path):
os.makedirs(path)
elif replace_existing:
shutil.rmtree(path)
os.makedirs(path)
else:
print("Beware .. path {} already exists".format(path))
# extract relative path from a root-directory and an absolute path
def relative_path(root, path):
return os.path.relpath(path, root)
# save pickle
def save_pickle(path, data):
with open(path, "wb") as f:
pickle.dump(data, f)
# load pickle
def load_pickle(path):
with open(path, "rb") as f:
return pickle.load(f)
| 23.648148 | 82 | 0.68285 | 202 | 1,277 | 4.277228 | 0.361386 | 0.048611 | 0.038194 | 0.069444 | 0.260417 | 0.09375 | 0.064815 | 0.064815 | 0.064815 | 0.064815 | 0 | 0 | 0.209867 | 1,277 | 53 | 83 | 24.09434 | 0.856293 | 0.233359 | 0 | 0.071429 | 0 | 0 | 0.037344 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.107143 | 0.107143 | 0.535714 | 0.035714 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f2abdf6724c13b52a9cd2263bd9d2e4d175914fe | 160 | py | Python | kreate/dependency_stopwords.py | kreate-io/kreate | 4224487af9f928ff69bce1cde1f2ec73e3e44d9e | [
"MIT"
] | 8 | 2018-04-24T15:02:07.000Z | 2018-04-27T04:52:48.000Z | kreate/dependency_stopwords.py | kreate-io/kreate | 4224487af9f928ff69bce1cde1f2ec73e3e44d9e | [
"MIT"
] | null | null | null | kreate/dependency_stopwords.py | kreate-io/kreate | 4224487af9f928ff69bce1cde1f2ec73e3e44d9e | [
"MIT"
] | null | null | null | def get():
return [
'const',
'var',
'import',
'require',
'using',
'load',
'from',
'as'
] | 14.545455 | 18 | 0.3 | 11 | 160 | 4.363636 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.525 | 160 | 11 | 19 | 14.545455 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0.223602 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | true | 0 | 0.090909 | 0.090909 | 0.272727 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4b31c41b0f8ed069a866c5709f1ef2952bd51210 | 116 | py | Python | anonimas.py | franlop24/lambdasComprehentionsPython | dbfd94dfe9f7aeb5d5cd15479ef2286c22dd177e | [
"MIT"
] | null | null | null | anonimas.py | franlop24/lambdasComprehentionsPython | dbfd94dfe9f7aeb5d5cd15479ef2286c22dd177e | [
"MIT"
] | null | null | null | anonimas.py | franlop24/lambdasComprehentionsPython | dbfd94dfe9f7aeb5d5cd15479ef2286c22dd177e | [
"MIT"
] | null | null | null | def cuadrado1(num1):
return num1**2
cuadrado2 = lambda num1: num1 ** 2
print(cuadrado1(5))
print(cuadrado2(5)) | 16.571429 | 34 | 0.698276 | 17 | 116 | 4.764706 | 0.529412 | 0.123457 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122449 | 0.155172 | 116 | 7 | 35 | 16.571429 | 0.704082 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0.2 | 0.4 | 0.4 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
4b5fd035d27ea33665b388902f9329a105dd0448 | 402 | py | Python | src/commands/inject-qmk.py | kivhift/qmk | 4f67242267713d4f9f7e74cd5704498191a982d0 | [
"MIT"
] | 2 | 2015-06-22T05:44:12.000Z | 2020-08-03T15:49:58.000Z | src/commands/inject-qmk.py | kivhift/qmk | 4f67242267713d4f9f7e74cd5704498191a982d0 | [
"MIT"
] | null | null | null | src/commands/inject-qmk.py | kivhift/qmk | 4f67242267713d4f9f7e74cd5704498191a982d0 | [
"MIT"
] | null | null | null | #
# Copyright (c) 2012 Joshua Hughes <kivhift@gmail.com>
#
import qmk
class InjectQMKCommand(qmk.Command):
'''Inject the QMK.'''
def __init__(self):
super(InjectQMKCommand, self).__init__(self)
self._name = 'INJECT-QMK'
self._help = self.__doc__
def action(self, arg):
qmk.InputFilter().injectFullKeystroke()
def commands(): return [ InjectQMKCommand() ]
| 23.647059 | 54 | 0.659204 | 44 | 402 | 5.704545 | 0.636364 | 0.063745 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012539 | 0.206468 | 402 | 16 | 55 | 25.125 | 0.774295 | 0.171642 | 0 | 0 | 0 | 0 | 0.030769 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0.111111 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
4b7e54aadb00e01a1c786159e4106700de252144 | 927 | py | Python | leo/database/strategy_backtesting_service_impl.py | Leonardo-YXH/easytrader | 2216f2c45ad333afc13ab90ed4bfbc39708c31f5 | [
"MIT"
] | null | null | null | leo/database/strategy_backtesting_service_impl.py | Leonardo-YXH/easytrader | 2216f2c45ad333afc13ab90ed4bfbc39708c31f5 | [
"MIT"
] | null | null | null | leo/database/strategy_backtesting_service_impl.py | Leonardo-YXH/easytrader | 2216f2c45ad333afc13ab90ed4bfbc39708c31f5 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
"""
@author: leonardo
@created time: 2020-11-03
@last modified time:2020-11-03
"""
def select(engine, backtesting_id):
"""
:param engine:
:param backtesting_id:
:return:
"""
sql = 'SELECT * from strategy_backtesting where backtesting_id="{}"'.format(backtesting_id)
return list(engine.execute(sql))
def insert_on_duplicate_update(engine, data):
"""
:param engine:
:param data:
:return:
"""
sql = 'insert into strategy_backtesting(backtesting_id,strategy_id ,strategy_param,backtesting_start_time,backtesting_end_time)' \
' values (%s,%s,%s,%s,%s)' \
' on duplicate key update backtesting_id=values(backtesting_id),strategy_id=values(strategy_id),strategy_param=values(strategy_param),backtesting_start_time=values(backtesting_start_time),backtesting_end_time=values(backtesting_end_time)'
return engine.execute(sql, data)
| 29.903226 | 248 | 0.709817 | 116 | 927 | 5.413793 | 0.318966 | 0.144904 | 0.095541 | 0.038217 | 0.213376 | 0.140127 | 0.140127 | 0 | 0 | 0 | 0 | 0.021767 | 0.157497 | 927 | 30 | 249 | 30.9 | 0.78233 | 0.194175 | 0 | 0 | 0 | 0.125 | 0.636758 | 0.460203 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4b8152500e25ed4610eef4a3d42119e345b969bf | 3,440 | py | Python | nrn_impl/neuron_models.py | Silmathoron/elif-madexp | 2555b3078c4106f79e3477a818a8f9d4ca76eccf | [
"BSD-2-Clause"
] | null | null | null | nrn_impl/neuron_models.py | Silmathoron/elif-madexp | 2555b3078c4106f79e3477a818a8f9d4ca76eccf | [
"BSD-2-Clause"
] | null | null | null | nrn_impl/neuron_models.py | Silmathoron/elif-madexp | 2555b3078c4106f79e3477a818a8f9d4ca76eccf | [
"BSD-2-Clause"
] | 1 | 2022-02-04T16:34:47.000Z | 2022-02-04T16:34:47.000Z | from functools import reduce
from math import pi
from neuron import h
def _new_property(obj_hierarchy, attr_name):
"""
Returns a new property, mapping attr_name to obj_hierarchy.attr_name.
For example, suppose that an object of class A has an attribute b which
itself has an attribute c which itself has an attribute d. Then placing
e = _new_property('b.c', 'd')
in the class definition of A makes A.e an alias for A.b.c.d
"""
def set(self, value):
obj = reduce(getattr, [self] + obj_hierarchy.split('.'))
setattr(obj, attr_name, value)
def get(self):
obj = reduce(getattr, [self] + obj_hierarchy.split('.'))
return getattr(obj, attr_name)
return property(fset=set, fget=get)
class eLIFNeuron:
def __init__(self, params=None):
self._sec = h.Section()
self._seg = self._sec(0.5)
self._sec.L = 1000.
self._seg.diam = 100. / pi
self._model = h.eLIF(self._seg)
if params is not None:
for k, v in params.items():
setattr(self, k, v)
g_L = _new_property('_model', 'g_L')
V_reset = _new_property('_model', 'V_reset')
t_ref = _new_property('_model', 't_ref')
E_0 = _new_property('_model', 'E_0')
E_u = _new_property('_model', 'E_u')
E_f = _new_property('_model', 'E_f')
E_d = _new_property('_model', 'E_d')
epsilon = _new_property('_model', 'epsilon')
epsilon_0 = _new_property('_model', 'epsilon_0')
alpha = _new_property('_model', 'alpha')
epsilon_c = _new_property('_model', 'epsilon_c')
delta = _new_property('_model', 'delta')
tau_e = _new_property('_model', 'tau_e')
@property
def V_th(self):
return self._model.V_th
@V_th.setter
def V_th(self, value):
self._model.V_th = value
@property
def C_m(self):
return self._seg.cm
@C_m.setter
def C_m(self, value):
self._seg.cm = value
class mAdExpNeuron:
def __init__(self, params=None):
self._sec = h.Section()
self._seg = self._sec(0.5)
self._sec.L = 1000.
self._seg.diam = 100. / pi
self._model = h.mAdExp(self._seg)
if params is not None:
for k, v in params.items():
setattr(self, k, v)
g_L = _new_property('_model', 'g_L')
V_reset = _new_property('_model', 'V_reset')
t_ref = _new_property('_model', 't_ref')
b = _new_property('_model', 'b')
a = _new_property('_model', 'a')
tau_w = _new_property('_model', 'tau_w')
Delta_T = _new_property('_model', 'Delta_T')
V_peak = _new_property('_model', 'V_peak')
E_0 = _new_property('_model', 'E_0')
E_u = _new_property('_model', 'E_u')
E_f = _new_property('_model', 'E_f')
E_d = _new_property('_model', 'E_d')
epsilon_0 = _new_property('_model', 'epsilon_0')
alpha = _new_property('_model', 'alpha')
epsilon_c = _new_property('_model', 'epsilon_c')
delta = _new_property('_model', 'delta')
gamma = _new_property('_model', 'gamma')
tau_e = _new_property('_model', 'tau_e')
@property
def V_th(self):
return self._model.V_th
@V_th.setter
def V_th(self, value):
self._model.V_th = value
self._model.V_spike = value + 5*self.Delta_T
@property
def C_m(self):
return self._seg.cm
@C_m.setter
def C_m(self, value):
self._seg.cm = value
| 27.52 | 75 | 0.611628 | 509 | 3,440 | 3.738703 | 0.182711 | 0.196532 | 0.260641 | 0.071466 | 0.680504 | 0.65423 | 0.65423 | 0.615344 | 0.615344 | 0.615344 | 0 | 0.010485 | 0.251453 | 3,440 | 124 | 76 | 27.741935 | 0.728544 | 0.088663 | 0 | 0.758621 | 0 | 0 | 0.109607 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.149425 | false | 0 | 0.034483 | 0.045977 | 0.632184 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
298e489333e0c2dc375cbf3d789f40c5d1a3b17c | 4,252 | py | Python | alerts/migrations/0001_initial.py | dymaxionlabs/satlomas-back | f4568f6535755fd4a2432ecc661a264872206c6c | [
"Apache-2.0"
] | 1 | 2021-02-18T20:11:25.000Z | 2021-02-18T20:11:25.000Z | alerts/migrations/0001_initial.py | dymaxionlabs/satlomas-back | f4568f6535755fd4a2432ecc661a264872206c6c | [
"Apache-2.0"
] | 7 | 2020-06-09T14:54:43.000Z | 2021-09-22T21:00:13.000Z | alerts/migrations/0001_initial.py | dymaxionlabs/satlomas-back | f4568f6535755fd4a2432ecc661a264872206c6c | [
"Apache-2.0"
] | 1 | 2020-05-08T20:42:49.000Z | 2020-05-08T20:42:49.000Z | # Generated by Django 3.0.5 on 2020-04-14 15:25
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('scopes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='ScopeTypeRule',
fields=[
('id',
models.AutoField(auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID')),
('scope_type',
models.CharField(choices=[('CE', 'Corredores Ecologicos'),
('AC', 'ACR'), ('DI', 'Distritos'),
('EF', 'Ecosistemas fragiles'),
('SA', 'Sitios arqueologicos')],
max_length=2)),
('threshold_type',
models.CharField(choices=[('A', 'Area'), ('P', 'Percentage')],
max_length=1)),
('threshold', models.FloatField(default=5)),
('measurement_content_type',
models.ForeignKey(limit_choices_to=models.Q(
models.Q(('app_label', 'lomas_changes'),
('model', 'coverage_measurements')),
models.Q(('app_label', 'vi_lomas_changes'),
('model', 'coverage_measurements')),
_connector='OR'),
on_delete=django.db.models.deletion.CASCADE,
to='contenttypes.ContentType')),
('user',
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='ScopeRule',
fields=[
('id',
models.AutoField(auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID')),
('threshold_type',
models.CharField(choices=[('A', 'Area'), ('P', 'Percentage')],
max_length=1)),
('threshold', models.FloatField(default=5)),
('measurement_content_type',
models.ForeignKey(limit_choices_to=models.Q(
models.Q(('app_label', 'lomas_changes'),
('model', 'coverage_measurements')),
models.Q(('app_label', 'vi_lomas_changes'),
('model', 'coverage_measurements')),
_connector='OR'),
on_delete=django.db.models.deletion.CASCADE,
to='contenttypes.ContentType')),
('scope',
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='scopes.Scope')),
('user',
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='ParameterRule',
fields=[
('id',
models.AutoField(auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID')),
('parameter', models.CharField(max_length=64)),
('threshold', models.FloatField(default=5)),
('user',
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL)),
],
),
]
| 42.949495 | 79 | 0.440734 | 315 | 4,252 | 5.75873 | 0.31746 | 0.035281 | 0.054024 | 0.084895 | 0.701213 | 0.683021 | 0.683021 | 0.683021 | 0.661522 | 0.661522 | 0 | 0.013141 | 0.445202 | 4,252 | 98 | 80 | 43.387755 | 0.755829 | 0.010583 | 0 | 0.725275 | 1 | 0 | 0.147919 | 0.049703 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.032967 | 0 | 0.076923 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
29f5e4a6ec22329c05592e8ee55385af80184168 | 1,593 | py | Python | drl/algos/base.py | seba-1511/dist_rl.pth | 0d2a24feff17f80dc2c75682889899feed13dfe6 | [
"Apache-2.0"
] | null | null | null | drl/algos/base.py | seba-1511/dist_rl.pth | 0d2a24feff17f80dc2c75682889899feed13dfe6 | [
"Apache-2.0"
] | null | null | null | drl/algos/base.py | seba-1511/dist_rl.pth | 0d2a24feff17f80dc2c75682889899feed13dfe6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from torch import nn
class BaseAgent(nn.Module):
"""
The base of all agents.
"""
def __init__(self):
super(BaseAgent, self).__init__()
def reset_stats(self, stats):
""" Resets all statistics or sets them to `stats`. """
raise NotImplementedError()
def get_stats(self, stats):
""" Returns all statistics. """
return self.stats
def forward(self, state, *args, **kwargs):
""" Returns an action to be taken. """
raise NotImplementedError()
def learn(self, state=None, action=None, reward=None, next_state=None, done=None, info=None):
""" Given (s, a, r, s') tuples, does the necessary to compute the update. """
pass
def new_episode(self, terminated=False):
""" Indicates to the agent that a new episode is about to start."""
pass
def done(self):
""" Tells whether the agents needs to continue training. """
return False
def updatable(self):
""" Returns whether the agent is ready to be updated. """
return False
def update(self, update):
""" Applies the update to the parameters. """
for param, updt in zip(self.parameters, update):
param.data.add_(updt)
def get_update(self):
""" Returns the parameter update from local experience."""
return None
def set_gradients(self, gradients):
""" Sets gradients of the parameters. """
for param, grad in zip(self.parameters(), gradients):
param.grad.data[:] = grad.data
| 28.446429 | 97 | 0.605148 | 198 | 1,593 | 4.792929 | 0.454545 | 0.028451 | 0.029505 | 0.044257 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.276836 | 1,593 | 55 | 98 | 28.963636 | 0.823785 | 0.321406 | 0 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.423077 | false | 0.076923 | 0.038462 | 0 | 0.653846 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
4b0af8006aa2316991c5872c87d060df83923e40 | 254 | py | Python | ftp_proxy/ftp_proxy_exceptions.py | mrmucox/ftp_proxy | 78f0c420b10777600652d65e8760558ae208031c | [
"Unlicense"
] | 1 | 2020-04-16T13:14:39.000Z | 2020-04-16T13:14:39.000Z | ftp_proxy/ftp_proxy_exceptions.py | mrmucox/ftp_proxy | 78f0c420b10777600652d65e8760558ae208031c | [
"Unlicense"
] | 1 | 2020-07-08T20:03:10.000Z | 2020-07-10T18:48:17.000Z | ftp_proxy/ftp_proxy_exceptions.py | mrmucox/ftp_proxy | 78f0c420b10777600652d65e8760558ae208031c | [
"Unlicense"
] | 1 | 2021-04-02T23:48:26.000Z | 2021-04-02T23:48:26.000Z | class ProxyException(Exception):
"""Proxy returned an error."""
def __init__(self, message='Proxy returned an error.'):
# Call the base class constructor with the parameters it needs
super(ProxyException, self).__init__(message)
| 36.285714 | 70 | 0.704724 | 30 | 254 | 5.7 | 0.666667 | 0.152047 | 0.175439 | 0.233918 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19685 | 254 | 6 | 71 | 42.333333 | 0.838235 | 0.338583 | 0 | 0 | 0 | 0 | 0.149068 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4b0d589c5492992611b2a95c8ae5fa65d7f5e606 | 1,395 | py | Python | logging_learning/boss_logging/tasks/__init__.py | bossjones/todayilearned | 46bdf912666018eb50902bd19512e4004db09e23 | [
"Apache-2.0"
] | null | null | null | logging_learning/boss_logging/tasks/__init__.py | bossjones/todayilearned | 46bdf912666018eb50902bd19512e4004db09e23 | [
"Apache-2.0"
] | null | null | null | logging_learning/boss_logging/tasks/__init__.py | bossjones/todayilearned | 46bdf912666018eb50902bd19512e4004db09e23 | [
"Apache-2.0"
] | null | null | null | # pylint: disable=wrong-import-position, wrong-import-order, invalid-name
"""
Invoke build script.
Show all tasks with::
invoke -l
.. seealso::
* http://pyinvoke.org
* https://github.com/pyinvoke/invoke
"""
###############################################################################
# Catch exceptions and go into ipython/ipdb
# import sys
# from IPython.core.debugger import Tracer # noqa
# from IPython.core import ultratb
# sys.excepthook = ultratb.FormattedTB(
# mode="Verbose", color_scheme="Linux", call_pdb=True, ostream=sys.__stdout__
# )
###############################################################################
import logging
from invoke import Collection, Context, Config
from invoke import task
from .constants import ROOT_DIR, PROJECT_BIN_DIR, DATA_DIR, SCRIPT_DIR
from . import local
from . import ci
LOGGER = logging.getLogger()
ns = Collection()
ns.add_collection(local)
ns.add_collection(ci)
# https://github.com/imbrra/logowanie/blob/38a1a38ea9f5b2494e5bc986df651ff9d713fda5/tasks/__init__.py
# TODO: THINK ABOUT USING THESE MODULES https://medium.com/hultner/how-to-write-bash-scripts-in-python-10c34a5c2df1
# TODO: THINK ABOUT USING THESE MODULES https://medium.com/hultner/how-to-write-bash-scripts-in-python-10c34a5c2df1
# TODO: THINK ABOUT USING THESE MODULES https://medium.com/hultner/how-to-write-bash-scripts-in-python-10c34a5c2df1
| 33.214286 | 115 | 0.681004 | 171 | 1,395 | 5.45614 | 0.51462 | 0.028939 | 0.045016 | 0.061093 | 0.299035 | 0.299035 | 0.299035 | 0.299035 | 0.299035 | 0.299035 | 0 | 0.035172 | 0.103226 | 1,395 | 41 | 116 | 34.02439 | 0.710631 | 0.648746 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d99cbdf7f9eb92bc837c0fe3cd64dc36ce2044fd | 474 | py | Python | tests/units/test_prefixes.py | dengbangjie/hepunits | 4eb5ef53b2e366990fca24b163c42af7d3ba593d | [
"BSD-3-Clause"
] | null | null | null | tests/units/test_prefixes.py | dengbangjie/hepunits | 4eb5ef53b2e366990fca24b163c42af7d3ba593d | [
"BSD-3-Clause"
] | null | null | null | tests/units/test_prefixes.py | dengbangjie/hepunits | 4eb5ef53b2e366990fca24b163c42af7d3ba593d | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license, see LICENSE.
"""
Tests for the hepunits.units.prefixes module.
"""
from pytest import approx
from math import log
from hepunits.units import mega, micro, yotta, yocto, kibi, tebi
def test_prefixes_e6():
assert 4 * mega == 1. / 0.25 / micro
def test_prefixes_e24():
assert yotta * yocto == approx(1.)
def test_prefixes_binary():
assert log(kibi, 2) == 10
assert log(tebi, 2) == 40
| 18.96 | 64 | 0.685654 | 73 | 474 | 4.369863 | 0.616438 | 0.065831 | 0.141066 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041995 | 0.196203 | 474 | 24 | 65 | 19.75 | 0.795276 | 0.261603 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | 1 | 0.3 | true | 0 | 0.3 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d9c31e2841d98d2855642c42b9952fce07e88169 | 766 | py | Python | backend/api/blog/types.py | marlenebDC/pycon | 175f2ee9e8698bbcf15dd33d2eb4739fee04c6d7 | [
"MIT"
] | null | null | null | backend/api/blog/types.py | marlenebDC/pycon | 175f2ee9e8698bbcf15dd33d2eb4739fee04c6d7 | [
"MIT"
] | null | null | null | backend/api/blog/types.py | marlenebDC/pycon | 175f2ee9e8698bbcf15dd33d2eb4739fee04c6d7 | [
"MIT"
] | null | null | null | from typing import Optional
import strawberry
from api.scalars import DateTime
from api.users.types import User
from ..helpers.i18n import make_localized_resolver
@strawberry.type
class Post:
id: strawberry.ID
author: User
title: str = strawberry.field(resolver=make_localized_resolver("title"))
slug: str = strawberry.field(resolver=make_localized_resolver("slug"))
excerpt: str = strawberry.field(resolver=make_localized_resolver("excerpt"))
content: str = strawberry.field(resolver=make_localized_resolver("content"))
published: DateTime
@strawberry.field
def image(self, info) -> Optional[str]:
if not self.image:
return None
return info.context["request"].build_absolute_uri(self.image.url)
| 29.461538 | 80 | 0.737598 | 95 | 766 | 5.821053 | 0.442105 | 0.117541 | 0.189873 | 0.188065 | 0.339964 | 0.339964 | 0.339964 | 0 | 0 | 0 | 0 | 0.003125 | 0.164491 | 766 | 25 | 81 | 30.64 | 0.860938 | 0 | 0 | 0 | 0 | 0 | 0.039164 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0 | 0.263158 | 0 | 0.842105 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d9d8b89cfbdcc52e92f8b1742f33241ee963b0b9 | 907 | py | Python | Assigments/Assigment8/Tests/test_bst_print.py | mevljas/Quality_and_testing | 6a39610084b1538eae270682a6842270e8971b7f | [
"MIT"
] | null | null | null | Assigments/Assigment8/Tests/test_bst_print.py | mevljas/Quality_and_testing | 6a39610084b1538eae270682a6842270e8971b7f | [
"MIT"
] | null | null | null | Assigments/Assigment8/Tests/test_bst_print.py | mevljas/Quality_and_testing | 6a39610084b1538eae270682a6842270e8971b7f | [
"MIT"
] | null | null | null | import pexpect
def test_bst_print():
baza = pexpect.pexpect()
try:
baza.expect("Enter command: ")
baza.send("use bst")
baza.expect("OK")
baza.expect("Enter command: ")
baza.send("add 1")
baza.expect("OK")
baza.expect("Enter command: ")
baza.send("add 2")
baza.expect("OK")
baza.expect("Enter command: ")
baza.send("print")
baza.expect("\t2")
baza.expect("1")
baza.expect("OK")
baza.expect("Enter command: ")
baza.send("size")
baza.expect("2")
baza.expect("Enter command: ")
baza.send("depth")
baza.expect("2")
baza.expect("Enter command: ")
print ("PASSED\ttest_bst_print")
except:
print ("FAILED\ttest_bst_print")
finally:
baza.kill()
if __name__ == "__main__":
test_bst_print()
| 19.297872 | 40 | 0.528115 | 103 | 907 | 4.495146 | 0.281553 | 0.323974 | 0.226782 | 0.332613 | 0.604752 | 0.604752 | 0.522678 | 0.38013 | 0.38013 | 0.289417 | 0 | 0.009646 | 0.314223 | 907 | 46 | 41 | 19.717391 | 0.734727 | 0 | 0 | 0.40625 | 0 | 0 | 0.222958 | 0.048565 | 0 | 0 | 0 | 0 | 0 | 1 | 0.03125 | false | 0.03125 | 0.03125 | 0 | 0.0625 | 0.15625 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d9dc92ad057e169878294d5c088f21a8f559b969 | 5,352 | py | Python | temboo/core/Library/MailChimp/ListBatchUnsubscribe.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 7 | 2016-03-07T02:07:21.000Z | 2022-01-21T02:22:41.000Z | temboo/core/Library/MailChimp/ListBatchUnsubscribe.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | null | null | null | temboo/core/Library/MailChimp/ListBatchUnsubscribe.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 8 | 2016-06-14T06:01:11.000Z | 2020-04-22T09:21:44.000Z | # -*- coding: utf-8 -*-
###############################################################################
#
# ListBatchUnsubscribe
# Unsubscribes one or more members from a MailChimp list.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
#
#
###############################################################################
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class ListBatchUnsubscribe(Choreography):
def __init__(self, temboo_session):
"""
Create a new instance of the ListBatchUnsubscribe Choreo. A TembooSession object, containing a valid
set of Temboo credentials, must be supplied.
"""
super(ListBatchUnsubscribe, self).__init__(temboo_session, '/Library/MailChimp/ListBatchUnsubscribe')
def new_input_set(self):
return ListBatchUnsubscribeInputSet()
def _make_result_set(self, result, path):
return ListBatchUnsubscribeResultSet(result, path)
def _make_execution(self, session, exec_id, path):
return ListBatchUnsubscribeChoreographyExecution(session, exec_id, path)
class ListBatchUnsubscribeInputSet(InputSet):
"""
An InputSet with methods appropriate for specifying the inputs to the ListBatchUnsubscribe
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
"""
def set_APIKey(self, value):
"""
Set the value of the APIKey input for this Choreo. ((required, string) The API Key provided by Mailchimp)
"""
super(ListBatchUnsubscribeInputSet, self)._set_input('APIKey', value)
def set_DeleteMember(self, value):
"""
Set the value of the DeleteMember input for this Choreo. ((optional, boolean) A flag used to completely delete the member from your list instead of just unsubscribing. Specify '1' (true) or '0' (false). Defaults to 0.)
"""
super(ListBatchUnsubscribeInputSet, self)._set_input('DeleteMember', value)
def set_Email(self, value):
"""
Set the value of the Email input for this Choreo. ((required, string) The email address to unsubscribe from a Mailchimp list . Multiple emails can be supplied separated by commas.)
"""
super(ListBatchUnsubscribeInputSet, self)._set_input('Email', value)
def set_ListId(self, value):
"""
Set the value of the ListId input for this Choreo. ((required, string) The Mailchimp List ID)
"""
super(ListBatchUnsubscribeInputSet, self)._set_input('ListId', value)
def set_SendGoodbye(self, value):
"""
Set the value of the SendGoodbye input for this Choreo. ((optional, boolean) A flag used to send the goodbye email to the email address. Specify '1' (true) or '0' (false). Defaults to 0.)
"""
super(ListBatchUnsubscribeInputSet, self)._set_input('SendGoodbye', value)
def set_SendNotify(self, value):
"""
Set the value of the SendNotify input for this Choreo. ((optional, boolean) A flag used to send the unsubscribe notification email to the address defined in the list email notification settings. Specify '1' (true) or '0' (false). Defaults to 0.)
"""
super(ListBatchUnsubscribeInputSet, self)._set_input('SendNotify', value)
def set_SupressErrors(self, value):
"""
Set the value of the SupressErrors input for this Choreo. ((optional, boolean) Whether or not to suppress errors that arise from attempting to unsubscribe an email address. Defaults to 0 (false). Set to 1 (true) to supress errors.)
"""
super(ListBatchUnsubscribeInputSet, self)._set_input('SupressErrors', value)
class ListBatchUnsubscribeResultSet(ResultSet):
"""
A ResultSet with methods tailored to the values returned by the ListBatchUnsubscribe Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
"""
def getJSONFromString(self, str):
return json.loads(str)
def get_ErrorList(self):
"""
Retrieve the value for the "ErrorList" output from this Choreo execution. ((json) A list of emails that were not successfully unsubscribed.)
"""
return self._output.get('ErrorList', None)
def get_SuccessList(self):
"""
Retrieve the value for the "SuccessList" output from this Choreo execution. ((json) A list of email successfully unsubscribed.)
"""
return self._output.get('SuccessList', None)
class ListBatchUnsubscribeChoreographyExecution(ChoreographyExecution):
def _make_result_set(self, response, path):
return ListBatchUnsubscribeResultSet(response, path)
| 45.355932 | 253 | 0.692078 | 640 | 5,352 | 5.714063 | 0.295313 | 0.027345 | 0.02297 | 0.028712 | 0.342631 | 0.247471 | 0.200711 | 0.124145 | 0.124145 | 0.10227 | 0 | 0.005829 | 0.198617 | 5,352 | 117 | 254 | 45.74359 | 0.846817 | 0.505979 | 0 | 0 | 0 | 0 | 0.055759 | 0.017825 | 0 | 0 | 0 | 0 | 0 | 1 | 0.384615 | false | 0 | 0.128205 | 0.128205 | 0.794872 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8a46af0a672739d5ea413f0d455fe993f63868cc | 1,413 | py | Python | fn_datatable_utils/setup.py | rudimeyer/resilient-community-apps | 7a46841ba41fa7a1c421d4b392b0a3ca9e36bd00 | [
"MIT"
] | 1 | 2020-08-25T03:43:07.000Z | 2020-08-25T03:43:07.000Z | fn_datatable_utils/setup.py | rudimeyer/resilient-community-apps | 7a46841ba41fa7a1c421d4b392b0a3ca9e36bd00 | [
"MIT"
] | 1 | 2019-07-08T16:57:48.000Z | 2019-07-08T16:57:48.000Z | fn_datatable_utils/setup.py | rudimeyer/resilient-community-apps | 7a46841ba41fa7a1c421d4b392b0a3ca9e36bd00 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='fn_datatable_utils',
version='1.0.0',
license='MIT',
author='Resilient Labs',
author_email='resil.labs@gmail.com',
url='http://ibm.biz/resilientcommunity',
description="Resilient Circuits Components for 'fn_datatable_utils'",
long_description="Resilient Circuits Components for 'fn_datatable_utils'",
install_requires=[
'resilient_circuits>=31.0.0'
],
packages=find_packages(),
include_package_data=True,
platforms='any',
classifiers=[
'Programming Language :: Python',
],
entry_points={
"resilient.circuits.components": [
"DtUtilsGetRowFunctionComponent = fn_datatable_utils.components.dt_utils_get_row:FunctionComponent",
"DtUtilsUpdateRowFunctionComponent = fn_datatable_utils.components.dt_utils_update_row:FunctionComponent",
"DtUtilsDeleteRowFunctionComponent = fn_datatable_utils.components.dt_utils_delete_row:FunctionComponent"
],
"resilient.circuits.configsection": ["gen_config = fn_datatable_utils.util.config:config_section_data"],
"resilient.circuits.customize": ["customize = fn_datatable_utils.util.customize:customization_data"],
"resilient.circuits.selftest": ["selftest = fn_datatable_utils.util.selftest:selftest_function"]
}
) | 40.371429 | 118 | 0.720453 | 145 | 1,413 | 6.737931 | 0.489655 | 0.101331 | 0.14739 | 0.079836 | 0.218014 | 0.218014 | 0.116684 | 0.116684 | 0 | 0 | 0 | 0.006768 | 0.163482 | 1,413 | 35 | 119 | 40.371429 | 0.819797 | 0.029724 | 0 | 0.1 | 0 | 0 | 0.632847 | 0.429197 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.033333 | 0 | 0.033333 | 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 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8a4db0296accf85603a2cbdb383c2eb700b6de61 | 270 | py | Python | nevermined_gateway/myapp.py | nevermined-io/gateway | 03e1a63f1de4083ff9a3b22516566633baaffa35 | [
"Apache-2.0"
] | 1 | 2020-12-02T16:01:04.000Z | 2020-12-02T16:01:04.000Z | nevermined_gateway/myapp.py | nevermined-io/gateway | 03e1a63f1de4083ff9a3b22516566633baaffa35 | [
"Apache-2.0"
] | 19 | 2021-02-23T10:10:04.000Z | 2022-03-22T09:14:04.000Z | nevermined_gateway/myapp.py | nevermined-io/gateway | 03e1a63f1de4083ff9a3b22516566633baaffa35 | [
"Apache-2.0"
] | null | null | null | import os
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
if 'CONFIG_FILE' in os.environ and os.environ['CONFIG_FILE']:
app.config['CONFIG_FILE'] = os.environ['CONFIG_FILE']
else:
app.config['CONFIG_FILE'] = 'config.ini'
| 18 | 61 | 0.722222 | 42 | 270 | 4.404762 | 0.357143 | 0.27027 | 0.162162 | 0.205405 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148148 | 270 | 14 | 62 | 19.285714 | 0.804348 | 0 | 0 | 0 | 0 | 0 | 0.240741 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8a9e40716ee0025190ba0b2c56176436caa6eec8 | 91 | py | Python | machines/apps.py | mkschu/greensManagerDjango | 842f6cc0e5bc9fa5f36e5d996960900886d3370a | [
"Apache-2.0"
] | null | null | null | machines/apps.py | mkschu/greensManagerDjango | 842f6cc0e5bc9fa5f36e5d996960900886d3370a | [
"Apache-2.0"
] | 1 | 2022-02-10T10:54:20.000Z | 2022-02-10T10:54:20.000Z | machines/apps.py | mkschu/greensManagerDjango | 842f6cc0e5bc9fa5f36e5d996960900886d3370a | [
"Apache-2.0"
] | 1 | 2018-11-19T23:17:52.000Z | 2018-11-19T23:17:52.000Z | from django.apps import AppConfig
class MachinesConfig(AppConfig):
name = 'machines'
| 15.166667 | 33 | 0.758242 | 10 | 91 | 6.9 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164835 | 91 | 5 | 34 | 18.2 | 0.907895 | 0 | 0 | 0 | 0 | 0 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8aa4d5d2a036a0f8ac927e13b5c8238619766a75 | 258 | py | Python | lesson_08_misc/task02.py | groall/python_learning | dc054d99d825fbbf94f4c2a211fd2cb35f897867 | [
"Apache-2.0"
] | null | null | null | lesson_08_misc/task02.py | groall/python_learning | dc054d99d825fbbf94f4c2a211fd2cb35f897867 | [
"Apache-2.0"
] | null | null | null | lesson_08_misc/task02.py | groall/python_learning | dc054d99d825fbbf94f4c2a211fd2cb35f897867 | [
"Apache-2.0"
] | 4 | 2018-01-22T12:52:02.000Z | 2018-01-22T15:32:27.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Дано натуральное число n. Выведите все числа от 1 до n. Без использования циклов.
def print_and_decr(i: int) -> int:
print("%d\n", i)
i -= 1
if i > 1:
print_and_decr(i)
print_and_decr(821)
| 17.2 | 83 | 0.608527 | 44 | 258 | 3.431818 | 0.636364 | 0.15894 | 0.238411 | 0.172185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035714 | 0.24031 | 258 | 14 | 84 | 18.428571 | 0.734694 | 0.465116 | 0 | 0 | 0 | 0 | 0.02963 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.166667 | 0.666667 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
8aafad87d55159d539cbacf91e808927b64f190f | 2,862 | py | Python | v2.5.7/otp/chat/TalkMessage.py | TTOFFLINE-LEAK/ttoffline | bb0e91704a755d34983e94288d50288e46b68380 | [
"MIT"
] | 4 | 2019-07-01T15:46:43.000Z | 2021-07-23T16:26:48.000Z | v1.0.0.test/otp/chat/TalkMessage.py | TTOFFLINE-LEAK/ttoffline | bb0e91704a755d34983e94288d50288e46b68380 | [
"MIT"
] | 1 | 2019-06-29T03:40:05.000Z | 2021-06-13T01:15:16.000Z | v2.5.7/otp/chat/TalkMessage.py | TTOFFLINE-LEAK/ttoffline | bb0e91704a755d34983e94288d50288e46b68380 | [
"MIT"
] | 4 | 2019-07-28T21:18:46.000Z | 2021-02-25T06:37:25.000Z |
class TalkMessage:
def __init__(self, messageId, timeStamp, body, senderAvatarId, senderAvatarName, senderAccountId, senderAccountName, receiverAvatarId, receiverAvatarName, receiverAccountId, receiverAccountName, talkType, extraInfo=None):
self.timeStamp = timeStamp
self.body = body
self.senderAvatarId = senderAvatarId
self.senderAvatarName = senderAvatarName
self.senderAccountId = senderAccountId
self.senderAccountName = senderAccountName
self.receiverAvatarId = receiverAvatarId
self.receiverAvatarName = receiverAvatarName
self.receiverAccountId = receiverAccountId
self.receiverAccountName = receiverAccountName
self.talkType = talkType
self.extraInfo = extraInfo
self.messageId = messageId
def getMessageId(self):
return self.messageId
def setMessageId(self, id):
self.messageId = id
def getTimeStamp(self):
return self.timeStamp
def setTimeStamp(self, timeStamp):
self.timeStamp = timeStamp
def getBody(self):
return self.body
def setBody(self, body):
self.body = body
def getSenderAvatarId(self):
return self.senderAvatarId
def setSenderAvatarId(self, senderAvatarId):
self.senderAvatarId = senderAvatarId
def getSenderAvatarName(self):
return self.senderAvatarName
def setSenderAvatarName(self, senderAvatarName):
self.senderAvatarName = senderAvatarName
def getSenderAccountId(self):
return self.senderAccountId
def setSenderAccountId(self, senderAccountId):
self.senderAccountId = senderAccountId
def getSenderAccountName(self):
return self.senderAccountName
def setSenderAccountName(self, senderAccountName):
self.senderAccountName = senderAccountName
def getReceiverAvatarId(self):
return self.receiverAvatarId
def setReceiverAvatarId(self, receiverAvatarId):
self.receiverAvatarId = receiverAvatarId
def getReceiverAvatarName(self):
return self.receiverAvatarName
def setReceiverAvatarName(self, receiverAvatarName):
self.receiverAvatarName = receiverAvatarName
def getReceiverAccountId(self):
return self.receiverAccountId
def setReceiverAccountId(self, receiverAccountId):
self.receiverAccountId = receiverAccountId
def getReceiverAccountName(self):
return self.receiverAccountName
def setReceiverAccountName(self, receiverAccountName):
self.receiverAccountName = receiverAccountName
def getTalkType(self):
return self.talkType
def setTalkType(self, talkType):
self.talkType = talkType
def getExtraInfo(self):
return self.extraInfo
def setExtraInfo(self, extraInfo):
self.extraInfo = extraInfo | 29.8125 | 225 | 0.71768 | 227 | 2,862 | 9.030837 | 0.207048 | 0.063415 | 0.08878 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221523 | 2,862 | 96 | 226 | 29.8125 | 0.920108 | 0 | 0 | 0.358209 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.402985 | false | 0 | 0 | 0.19403 | 0.61194 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8ab3497ffa56bf001300b05589591eda2c643878 | 99 | py | Python | example/login.py | Billal06/igtools3 | 43bdd72f879c1acc61aa384cfce6fbd8d4a1d457 | [
"MIT"
] | null | null | null | example/login.py | Billal06/igtools3 | 43bdd72f879c1acc61aa384cfce6fbd8d4a1d457 | [
"MIT"
] | null | null | null | example/login.py | Billal06/igtools3 | 43bdd72f879c1acc61aa384cfce6fbd8d4a1d457 | [
"MIT"
] | null | null | null | import igtools3, sys
u = sys.argv[1]
p = sys.argv[2]
l = igtools3.Session()
print (l.login(u, p))
| 14.142857 | 22 | 0.646465 | 19 | 99 | 3.368421 | 0.631579 | 0.21875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048193 | 0.161616 | 99 | 6 | 23 | 16.5 | 0.722892 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8ac969e39330f18e8e5472519f720c7af7cdea07 | 1,513 | py | Python | levelprocesser.py | dziedzic99/pycman | dc57f28adc3078ec11ecc07fde542c2404d503ab | [
"MIT"
] | null | null | null | levelprocesser.py | dziedzic99/pycman | dc57f28adc3078ec11ecc07fde542c2404d503ab | [
"MIT"
] | null | null | null | levelprocesser.py | dziedzic99/pycman | dc57f28adc3078ec11ecc07fde542c2404d503ab | [
"MIT"
] | null | null | null | from PIL import Image
import resources
def readlevel(file):
# level-loading procedure with input of gamesize^2 bitmap level file
level = [[resources.constants.leveldef['nothing'] for i in range(resources.constants.gamesize)] for j in range(resources.constants.gamesize)]
im = Image.open(resources.paths.levels + file)
im.load()
for col in range(0, resources.constants.gamesize):
for row in range(0, resources.constants.gamesize):
pixel = im.getpixel((col, row))
if pixel == resources.constants.editordef["coin"]:
level[col][row] = resources.constants.leveldef['coin']
elif pixel == resources.constants.editordef["heart"]:
level[col][row] = resources.constants.leveldef['heart']
elif pixel == resources.constants.editordef["wall"]:
level[col][row] = resources.constants.leveldef['wall']
elif pixel == resources.constants.editordef["player"]:
level[col][row] = resources.constants.leveldef['player']
elif pixel == resources.constants.editordef["red_ghost"]:
level[col][row] = resources.constants.leveldef['red_ghost']
elif pixel == resources.constants.editordef["green_ghost"]:
level[col][row] = resources.constants.leveldef['green_ghost']
elif pixel == resources.constants.editordef["blue_ghost"]:
level[col][row] = resources.constants.leveldef['blue_ghost']
return level
| 54.035714 | 145 | 0.645737 | 168 | 1,513 | 5.779762 | 0.279762 | 0.352214 | 0.214212 | 0.23069 | 0.652935 | 0.436663 | 0.129763 | 0 | 0 | 0 | 0 | 0.002562 | 0.226041 | 1,513 | 27 | 146 | 56.037037 | 0.826644 | 0.043622 | 0 | 0 | 0 | 0 | 0.072664 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.041667 | false | 0 | 0.083333 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
76e0c107e15735beb96c1872e87776daafde72fa | 42,156 | py | Python | sudoku-server/puzzles.py | sandialabs/sudoku-online | fc55b8bce2ca9e23354e2e7b8a4368994010f7a5 | [
"MIT"
] | 2 | 2021-08-15T04:08:52.000Z | 2021-11-29T02:54:41.000Z | sudoku-server/puzzles.py | sandialabs/sudoku-online | fc55b8bce2ca9e23354e2e7b8a4368994010f7a5 | [
"MIT"
] | null | null | null | sudoku-server/puzzles.py | sandialabs/sudoku-online | fc55b8bce2ca9e23354e2e7b8a4368994010f7a5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Andy Wilson, Michael Darling, David Stracuzzi, Shelley Leger
Sandia National Laboratories
February 25, 2020
Defines set of test sudoku problems to use to test the sudoku infrastructure
"""
puzzles = {
'test2-i24e40': '300000700000001000000060000000700015400300000000000020610000800000540900002000000',
'test3-i29e35': '300000700000001000000060000000700015900500000000000020610000800000340900002000000',
'test4-i28e36': '300000700000001000000090000000700014800600000000000020610000800000540300002000000',
'test5-i23e41': '560000040000010700000000000000400060030000005018000000700604000200000100000000003',
'test6-i26e38': '560000040000010700000000000000800060030000005019000000700604000200000100000000003',
'test7-i26e36hp10': '010000200800300000000000500050000410000700060002008000900000073000050000000040000',
'test8-i32e32hp2': '010000208500406000000000000306000050000020700004000000020010000000300060800000000',
'test9-i29e35hp2': '083000200000091000000000000100000409020300000000070000007600500000800030900000000',
'test10-i29e35hp7': '000090750801000000000000000050000400000801000000600000470020000000100006300000080',
'test11-i36e28hp2': '000090800704000000100000000050480000000000010090000000200600500000107000000000308',
'test12-i36e28np1': '300000700000010400506000000000200035000000080000070000070600100040005000000300000',
'test13-i34e30np1': '100000300700600000000200000060030400025000000000000800007500002300080000000000010',
'test14-i24e38np3': '100000300800007000000200000027640000060500000000000100000000042300080000000000060',
'test15-i28e34np3': '100000305600900000000080200000760010020800000050000000400000700000001000000050000',
'test16-i26e36np3': '100000305800400000000070200000640080020700000050000000400000600000001000000050000',
'test17-i24e38np4hp4': '300000670000201000080000000000570800021000000400000000600030000000000042000000009',
'test18-i29e35np3hp4': '560000030000901000000000000809000010070060000000000000104800000000050607000000200',
'test19-i21e41np8hp3': '100000306070800000000000200000236000004000085000000000000500040390000000600000000',
'test20-i22e42np3hp7': '100000306500040000000010000000000051060000200030800000700000040000602000000300000',
'test21-i16e47np1hp2': '100000340406000800000900000800040000000700009000000000097000050000031000020000000',
'test22-i33e18nt1xw1': '000400067064200000007106042000860304401000700706940000170004000940000200000010400',
'test23-i16e32nt1xw1': '700000021500402000200807000021500000073200610045700230407000802302070100106020000',
'test24-i10e41nt2xw2': '000500061516020000970060000061400000000650910000000680100806000300000506600705108',
'test25-i16e32nt1xw1': '400000081300021000100700000048010000000060210016000000601000354700504108854136000',
'test26-i8e41pp1nt4xw2xyzw1': '000605021070302000020408000100960250032087400760020000200850000000700802600200000',
'test27-i32e31yw3': '560000040700003000000800000008000030090200000000040000600050100000000908000000200',
'test28-i27e36yw1': '205700000800050300000000000090000100000200000000000030030081000400000020000900007',
'test29-i27e36yw1': '700200050000030080100000000400060700060080000000000100039500000000700000080000000',
'test30-i29e34yw1': '080000670000310000000000000000200005240000000000000013501400000000007800300000000',
'test31-i36e27yw1': '080000670000510000000000000000200004230000000000000051405300000000007800100000000',
'test32-i25e38np2hp4yw1': '000200090010000030050008000200900000000400500000000100400006020000030700000010000',
'test33-i26e38np2hp3yw1': '042080000000000001080000000700103000000000480600000000150600000000000540000900000',
'test34-i26e38np2hp3yw1': '042080000000000001080000000700103000000000480900000000150600000000000540000700000',
'test35-i24e40np3hp2yw1': '000040380050070000010000000000502008600000700000100000000200010407000000300000000',
'test36-i30e33np2hp2yw1': '100036000020000840000000000603050000500700000000000020040800000000000503000200000',
'easy1': '..3.2.6..9..3.5..1..18.64....81.29..7.......8..67.82....26.95..8..2.3..9..5.1.3..',
'easy2': '......9.7...42.18....7.5.261..9.4....5.....4....5.7..992.1.8....34.59...5.7......',
'easy3': '...1254....84.....42.8......3.....95.6.9.2.1.51.....6......3.49.....72....1298...',
'easy4': '..61.24.......457..2.9.31.8.8...56.96...9...19.13...4.5.42.9.8..627.......85.13..',
'medium1': '...439...4..6..8..395.....472..8..9....217....3..9..282.....417..9..2..3...841...',
'hard1': '4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......',
# 'hard2': '6.2.5.........3.4..........43...8....1....2........7..5..27...........81...6.....',
# 'hard3': '...5...........5.697.....2...48.2...25.1...3..8..3.........4.7..13.5..9..2...31..',
'hard4': '3..6.9.12..7.....6.2...1......74...3..29.65..1...23......8...9.5.....3..29.3.7..4',
'fiendish1': '.....5.8....6.1.43..........1.5........1.6...3.......553.....61........4.........',
'fiendish2': '85...24..72......9..4.........1.7..23.5...9...4...........8..7..17..........36.4.',
# 'fiendish3': '..53.....8......2..7..1.5..4....53...1..7...6..32...8..6.5....9..4....3......97..',
'fiendish4': '..32.4...24.5...7.......6..9..7..1...87...53...2..5..7..1.......3...6.98...8.23..',
'naked_single_test': '246.7..38...3.6.7437..4.6....8.2.7..1.......6..7.3.4....4.8..6986.4....791..6..42',
'naked_pair_test': '4.....938.32.941...953..24.37.6.9..4529..16736.47.3.9.957..83....39..4..24..3.7.9',
'naked_pair_test_2': '.8..9..3..3.....699.2.63158.2.8.459.8519.7.463946.587.563.4.9872......15.1..5..2.',
'hidden_pair_test': '.........9.46.7....768.41..3.97.1.8.7.8...3.1.513.87.2..75.261...54.32.8.........',
'hidden_pair_test_2': '72.4.8.3..8.....474.1.768.281.739......851......264.8.2.968.41334......8168943275',
'naked_triple_test': '.7.4.8.29..2.....4854.2...7..83742...2.........32617......936122.....4.313.642.7.',
'naked_triple_test_2': '294513..66..8423193..697254....56....4..8..6....47....73.164..59..735..14..928637',
'hidden_triple_test': '.....1.3.231.9.....65..31..6789243..1.3.5...6...1367....936.57...6.198433........',
'naked_quad_test': '....3..86....2..4..9..7852.3718562949..1423754..3976182..7.3859.392.54677..9.4132',
# 'hidden_quad_test': '9.15...46425.9..8186..1..2.5.2.......19...46.6.......2196.4.2532...6.817.....1694',
'pointing_pair_test': '.179.36......8....9.....5.7.72.1.43....4.2.7..6437.25.7.1....65....3......56.172.',
'pointing_pair_test_2': '.32..61..41..........9.1...5...9...4.6.....713...2...5...5.8.........519.57..986.',
'pointing_triple_test': '93..5....2..63..95856..2.....318.57...5.2.98..8...5......8..1595.821...4...56...8',
'box_line_reduction': '.16..78.3.9.8.....87...1.6..48...3..65...9.82.39...65..6.9...2..8...29369246..51.',
'box_line_reduction_2': '.2.9437159.4...6..75.....4.5..48....2.....4534..352....42....81..5..426..9.2.85.4',
'xwing_test': '1.....569492.561.8.561.924...964.8.1.64.1....218.356.4.4.5...169.5.614.2621.....5',
# 'xwing_test_2': '.......9476.91..5..9...2.81.7..5..1....7.9....8..31.6724.1...7..1..9..459.....1..',
'ywing_test': '9..24.....5.69.231.2..5..9..9.7..32...29356.7.7...29...69.2..7351..79.622.7.86..9',
# 'xyz_wing_test': '.92..175.5..2....8....3.2...75..496.2...6..75.697...3...8.9..2.7....3.899.38...4.',
# 'xyz_wing_test_2': '6.......85..9.8..782...1.3.34.2.9.8.2...8.3..18.3.7.2575.4...929....5..44...9...3',
# 'swordfish_test_333': '52941.7.3..6..3..2..32......523...76637.5.2..19.62753.3...6942.2..83.6..96.7423.5',
# 'swordfish_test_222': '926...1..537.1.42.841...6.3259734816714.6..3.36812..4.1.2....84485.7136.6.3.....1',
# 'swordfish_test_323': '.2..43.69..38962..96..25.3.89.56..136...3.....3..81.263...1..7...96743.227.358.9.',
# TODO MAL this and the others commented out don't finish without help
'underconstrained1': '.8...9743.5...8.1..1.......8....5......8.4......3....6.......7..3.5...8.9724...5.',
# 'underconstrained2': '53..7....6..1.5....98....6.8.......34..8.3..17...2...6.6....28....419..5....8..79',
# 'underconstrained3': '..97.......48.9.7......2.3....3.6...3..1....9..6....58..8.3....5.....1869.2......',
# 'underconstrained4': '......23....3.8.64....4.9.8573.......8652937.......8456.5.1....71...2....48......',
# 'underconstrained5': '.21...9.36........83962...19...31.....2...3.....9....87...69152........92.5...74.',
# 'underconstrained6': '.7.4.1..8.16.3...45.4........7.8..9.6..123........6......6...532.8.....6.......8.',
# INSOLUBLE BY PROPAGATION (BASED ON EASY 0)
'insoluble_by_propagation': '..3.2.6..9..3.5..1..18.64....81.29..7.......8..67.82....26.95..8..2.3..9..5.1.8..',
# INSOLUBLE BY INITIAL STATE CONFLICT (BASED ON EASY 0)
'insoluble_by_initial_state_conflict': '..3.2.6..9..3.5..1..18.64....81.29..7.......8..67.82....26.95..8..2.3..9..5.1.6..',
}
games = {
'test_game1_6_operators_open': {
'puzzles': ['test2-i24e40', 'easy1', 'xwing_test', 'hard4', 'underconstrained1', 'test7-i26e36hp10'],
'config_alterations': {}
},
'test_game1_6': {
'puzzles': ['test2-i24e40', 'easy1', 'xwing_test', 'hard4', 'underconstrained1', 'test7-i26e36hp10'],
'config_alterations': {'randomly_apply': ['select_ops_upfront']}
},
'test_game1_4': {
'puzzles': ['test2-i24e40', 'xwing_test', 'hard4', 'underconstrained1'],
'config_alterations': {'randomly_apply': ['select_ops_upfront']}
},
'test_game_ptgprs': {
'puzzles': ['pointing_pair_test...goal=A9', 'pointing_pair_test...goal=E2', 'pointing_pair_test...goal=B1'],
'config_alterations': {'randomly_apply': ['select_ops_upfront']}
},
'pilot_test_a_board': {
# 'test7-i26e36hp10?goal=C6?costlyops=inclusion,pointingpairs,nakedpairs,xwings?name=Pilot Test Board?select_ops_upfront'
'puzzles': ['test7-i26e36hp10...goal=C6...name=Pilot Test Board...question=Can C6 be a 7?',
'test7-i26e36hp10...goal=C6...name=Pilot Test Board2...select_ops_upfront...question=Can C6 be odd?'],
'config_alterations': {'costly_ops': ['inclusion', 'pointingpairs', 'nakedpairs', 'xwings']}
},
'test_logical_operators_in_sequence': {
'puzzles': ['test2-i24e40...name=Test Inclusion...goal=C6...question=Can C6 be 4?...answer=no',
'test9-i29e35hp2...name=Test Pointing Pairs...goal=C6...question=Can C6 equal A2 or A3?...answer=yes',
'test7-i26e36hp10...name=Test Naked Pairs...goal=C6...question=Can C6 be greater than 5?...answer=no',
'hidden_pair_test_2...name=Test Hidden Pairs...goal=F7...question=Can F7 be odd?...answer=yes',
'box_line_reduction_2...name=Test Pointing Triples...goal=C5...question=Can C5 be less than 5?...answer=yes',
'hidden_triple_test...name=Test Naked Triples...goal=A9...question=Can A9 be greater than 5?...answer=no',
#'...name=Test Hidden Triples...goal=...question=',
'xwing_test...name=Test X-Wings...goal=G6...question=Can G6 equal A7 or A8 or A9?...answer=no',
'test29-i27e36yw1...name=Test Y-Wings...goal=E8...question=Can E9 be a square (1 or 4 or 9)?',
#'...name=Test XYZ-Wings...goal=...question=',
#'...name=Test Naked Quads...goal=...question=',
#'...name=Test Hidden Quads...goal=...question=',
]
},
'training_games': {
'puzzles': [
# Requires 2 calls to inclusion, resolved after 1st call to inclusion (doesn't require 2nd)
'easy2...goal=E7...name=Training #1...question=Can E7 be 6?...answer=no',
'easy2...goal=E7...name=Training #1...question=Can E7 be 6?...answer=no...select_ops_upfront',
# Requires pointingpairs and inclusion, with final call to pointing pairs to resolve (no call to inclusion after pointing pairs)
'test11-i36e28hp2...goal=B8...name=Training #2...question=Can B8 be odd?...answer=yes',
'test11-i36e28hp2...goal=B8...name=Training #2...question=Can B8 be odd?...answer=yes...select_ops_upfront',
# Requires pointingpairs and inclusion, but doesn't require last call to inclusion _after_ pointing pairs
'test16-i26e36np3...goal=F3...name=Training #3...question=Can F3 be 3 or 7?...answer=no',
'test16-i26e36np3...goal=F3...name=Training #3...question=Can F3 be 3 or 7?...answer=no...select_ops_upfront',
]
},
'training_games_select_ops_upfront': {
'puzzles': [
'easy2...goal=E7...name=Training #1...question=Can E7 be 6?...answer=no...select_ops_upfront',
'test11-i36e28hp2...goal=B8...name=Training #2...question=Can B8 be odd?...answer=yes...select_ops_upfront',
'test16-i26e36np3...goal=F3...name=Training #3...question=Can F3 be 3 or 7?...answer=no...select_ops_upfront',
]
},
'training_games_always_select': {
'puzzles': [
'easy2...goal=E7...name=Training #1...question=Can E7 be 6?...answer=no',
'test11-i36e28hp2...goal=B8...name=Training #2...question=Can B8 be odd?...answer=yes',
'test16-i26e36np3...goal=F3...name=Training #3...question=Can F3 be 3 or 7?...answer=no',
]
},
'training_games1_select_ops_upfront': {
'puzzles': [
'easy2...goal=E7...name=Training #1...question=Can E7 be 6?...answer=no...select_ops_upfront',
]
},
'training_game2_select_ops_upfront': {
'puzzles': [
'test11-i36e28hp2...goal=B8...name=Training #2...question=Can B8 be odd?...answer=yes...select_ops_upfront',
]
},
'training_games3_select_ops_upfront': {
'puzzles': [
'test16-i26e36np3...goal=F3...name=Training #3...question=Can F3 be 3 or 7?...answer=no...select_ops_upfront',
]
},
'training_games1_always_select': {
'puzzles': [
'easy2...goal=E7...name=Training #1...question=Can E7 be 6?...answer=no',
]
},
'training_game2_always_select': {
'puzzles': [
'test11-i36e28hp2...goal=B8...name=Training #2...question=Can B8 be odd?...answer=yes',
]
},
'training_games3_always_select': {
'puzzles': [
'test16-i26e36np3...goal=F3...name=Training #3...question=Can F3 be 3 or 7?...answer=no',
]
},
'weedout_games': {
'puzzles': [
# Requires pointing pairs and inclusion; doesn't require last inclusion after pointing pairs (poss. 1 4 6 7 9)
'test36-i30e33np2hp2yw1...goal=F7...name=WeedOut #1...question=Can F7 be 1, 6, or 7?...answer=yes',
'test36-i30e33np2hp2yw1...goal=F7...name=WeedOut #1...question=Can F7 be 1, 6, or 7?...answer=yes...select_ops_upfront',
# Requires 4 calls to inclusion, resolved after 3rd call to inclusion (doesn't require 4th) (poss. 5 7 8 9)
'test4-i28e36...goal=B1...name=WeedOut #2...question=Can B1 be greater than 5?...answer=no',
'test4-i28e36...goal=B1...name=WeedOut #2...question=Can B1 be greater than 5?...answer=no...select_ops_upfront',
# Requires just 1 inclusion call to solve
'test22-i33e18nt1xw1...goal=A2...name=WeedOut #3...question=Can A2 be 3?...answer=no',
'test22-i33e18nt1xw1...goal=A2...name=WeedOut #3...question=Can A2 be 3?...answer=no...select_ops_upfront',
]
},
'weedout_games_always_select': {
'puzzles': [
'test36-i30e33np2hp2yw1...goal=F7...name=WeedOut #1...question=Can F7 be 1, 6, or 7?...answer=yes',
'test4-i28e36...goal=B1...name=WeedOut #2...question=Can B1 be greater than 5?...answer=no',
'test22-i33e18nt1xw1...goal=A2...name=WeedOut #3...question=Can A2 be 3?...answer=no',
]
},
'weedout_games_select_ops_upfront': {
'puzzles': [
'test36-i30e33np2hp2yw1...goal=F7...name=WeedOut #1...question=Can F7 be 1, 6, or 7?...answer=yes...select_ops_upfront',
'test4-i28e36...goal=B1...name=WeedOut #2...question=Can B1 be greater than 5?...answer=no...select_ops_upfront',
'test22-i33e18nt1xw1...goal=A2...name=WeedOut #3...question=Can A2 be 3?...answer=no...select_ops_upfront',
]
},
'weedout_games1_select_ops_upfront': {
'puzzles': [
'test36-i30e33np2hp2yw1...goal=F7...name=WeedOut #1...question=Can F7 be 1, 6, or 7?...answer=yes...select_ops_upfront',
]
},
'weedout_games2_select_ops_upfront': {
'puzzles': [
'test4-i28e36...goal=B1...name=WeedOut #2...question=Can B1 be greater than 5?...answer=no...select_ops_upfront',
]
},
'weedout_games3_select_ops_upfront': {
'puzzles': [
'test22-i33e18nt1xw1...goal=A2...name=WeedOut #3...question=Can A2 be 3?...answer=no...select_ops_upfront',
]
},
'weedout_games1_always_select': {
'puzzles': [
'test36-i30e33np2hp2yw1...goal=F7...name=WeedOut #1...question=Can F7 be 1, 6, or 7?...answer=yes',
]
},
'weedout_games2_always_select': {
'puzzles': [
'test4-i28e36...goal=B1...name=WeedOut #2...question=Can B1 be greater than 5?...answer=no',
]
},
'weedout_games3_always_select': {
'puzzles': [
'test22-i33e18nt1xw1...goal=A2...name=WeedOut #3...question=Can A2 be 3?...answer=no',
]
},
'logical_operators_mturk_test_suite': {
'puzzles': [
# Goal: something that gets resolved by second-to-last logical operator
# Inclusion
# Requires 1 call to inclusion; resolved after last (1) inclusion call
'medium1...goal=I3...name=Sudoku Test #01...question=Is I3 prime (2, 3, 5, or 7)?...answer=yes',
'medium1...goal=I3...name=Sudoku Test #01...question=Is I3 prime (2, 3, 5, or 7)?...answer=yes...select_ops_upfront',
# Requires 2 calls to inclusion; resolved after 1st call *** training / weed out ***
'naked_single_test...goal=E6...name=Sudoku Test #02...question=Is E6 less than 5?...answer=yes',
'naked_single_test...goal=E6...name=Sudoku Test #02...question=Is E6 less than 5?...answer=yes...select_ops_upfront',
# Requires 4 calls to inclusion; resolved by exclusion propagation of 3rd call
'test2-i24e40...goal=B2...name=Sudoku Test #03...question=Is B2 less than 6?...answer=no',
'test2-i24e40...goal=B2...name=Sudoku Test #03...question=Is B2 less than 6?...answer=no...select_ops_upfront',
# Requires 4 calls to inclusion; resolved on 3rd inclusion (no exclusion) to be 2
'test3-i29e35...goal=E2...name=Sudoku Test #04...question=Is E2 6?...answer=no',
'test3-i29e35...goal=E2...name=Sudoku Test #04...question=Is E2 6?...answer=no...select_ops_upfront',
# Requires 3 calls to inclusion; resolved after 2nd call
'test6-i26e38...goal=C5...name=Sudoku Test #05...question=Is C5 7?...answer=no',
'test6-i26e38...goal=C5...name=Sudoku Test #05...question=Is C5 7?...answer=no...select_ops_upfront',
# Process: search for last call to highest-level operator that has at least one non-exclusion operator call after it (if only one call, it can be the last).
# Pick most uncertain cell (or a cell if that call doesn't resolve any uncertainty) before the call as the goal.
# Determine how uncertainty changes before the next logical operator.
# Design a question that is answerable by how the uncertainty changes by the time the next logical operator is called.
# Do this experiment with all logical operators, not just the ones chosen for this test.
# Pointing Pairs
# Requires 1 pointing pairs call and 6 inclusion calls; 1 inclusion call happens after the pointing pairs call but is not required to answer.
'test8-i32e32hp2...goal=H2...name=Sudoku Test #06...question=Is H2 7?...answer=no',
'test8-i32e32hp2...goal=H2...name=Sudoku Test #06...question=Is H2 7?...answer=no...select_ops_upfront',
# Requires 2 pointing pairs calls. Question resolved by first, where following inclusion, pointing pairs, inclusion solves the board.
'test9-i29e35hp2...goal=C6...name=Sudoku Test #07...question=Is C6 equal to A2 or A3?...answer=yes',
'test9-i29e35hp2...goal=C6...name=Sudoku Test #07...question=Is C6 equal to A2 or A3?...answer=yes...select_ops_upfront',
# Requires 1 pointing pairs, 6 inclusions. Pointing pairs solves the board with exclusion.
'test15-i28e34np3...goal=F9...name=Sudoku Test #08...question=Is F9 odd?...answer=yes',
'test15-i28e34np3...goal=F9...name=Sudoku Test #08...question=Is F9 odd?...answer=yes...select_ops_upfront',
# Requires 1 pointing pairs, 6 inclusions. Board requires 2 inclusions afterwards, but question is resolved prior to those.
'test13-i34e30np1...goal=A6...name=Sudoku Test #09...question=Is A6 5?...answer=no',
'test13-i34e30np1...goal=A6...name=Sudoku Test #09...question=Is A6 5?...answer=no...select_ops_upfront',
# Requires 2 pointing pairs, 6 inclusions. Question resolved by first pointing pairs.
'hard1...goal=B9...name=Sudoku Test #10...question=Is B9 greater than 3?...answer=yes',
'hard1...goal=B9...name=Sudoku Test #10...question=Is B9 greater than 3?...answer=yes...select_ops_upfront',
# Naked Pairs
# 1 naked pairs, 2 pointingpairs, 7 inclusion. Solved by exclusion after nakedpairs
# C6 1, 2, 6, 9 -> 1, 2
'test7-i26e36hp10...name=Sudoku Test #11...goal=C6...question=Is C6 greater than 5?...answer=no',
'test7-i26e36hp10...name=Sudoku Test #11...goal=C6...question=Is C6 greater than 5?...answer=no...select_ops_upfront',
# 1 naked pair, 2 pointing pairs, 2 inclusions. Solved by exclusion after nakedpairs
# A6 -> 1, 2 -> 1
# Try operator before naked pairs. Pointing pairs.
# Still A6 -> 1, 2, not resolved by nakedpairs. Try to reduce uncertainty otherwise.
# B5 1, 2, 7, 8 -> 7, 8
'naked_pair_test_2...goal=B5...name=Sudoku Test #12...question=Is B5 greater than 5?...answer=yes',
'naked_pair_test_2...goal=B5...name=Sudoku Test #12...question=Is B5 greater than 5?...answer=yes...select_ops_upfront',
# 1 naked pairs, 2 pointing pairs, 5 inclusions. Requires 1 inclusion to solve after (followed by inclusion, pointingpairs to solve the board).
# I5 4, 5, 7 -> 4, 5, 7. Need better option, so look at what's resolved before next inclusion.
# A1 1, 5, 6, 7 -> 6, 7
'fiendish4...goal=A1...name=Sudoku Test #13...question=Is A1 greater than 5?...answer=yes',
'fiendish4...goal=A1...name=Sudoku Test #13...question=Is A1 greater than 5?...answer=yes...select_ops_upfront',
# 1 nakedpair, 3 pointingpairs, 10 inclusion. 1 inclusion after nakedpair.
# F6 2, 3, 4, 5, 7, 9 -> no change after nakedpair, requires an inclusion also to get to -> 2, 3, 4, 7, 9
'test10-i29e35hp7...goal=F6...name=Sudoku Test #14...question=Is F6 5?...answer=no',
'test10-i29e35hp7...goal=F6...name=Sudoku Test #14...question=Is F6 5?...answer=no...select_ops_upfront',
# 1 naked pair, 2 pointingpairs, 10 inclusions. Solved by exclusion after nakedpairs.
# B2 3, 4, 9 -> 3
'test14-i24e38np3...goal=B2...name=Sudoku Test #15...question=Is B2 a perfect square (1, 4, or 9)?...answer=no',
'test14-i24e38np3...goal=B2...name=Sudoku Test #15...question=Is B2 a perfect square (1, 4, or 9)?...answer=no...select_ops_upfront',
# Y Wings
# 1 ywings, 1 nakedpairs, 6 inclusion. Solved by exclusion immediately after y-wings
# H9 3, 5 -> 3
# 'test29-i27e36yw1...name=Sudoku Test #16...goal=E8...question=Can E9 be a square (1 or 4 or 9)?',
'test29-i27e36yw1...name=Sudoku Test #16...goal=H9...question=Is H9 3?...answer=yes',
'test29-i27e36yw1...name=Sudoku Test #16...goal=H9...question=Is H9 3?...answer=yes...select_ops_upfront',
# 1 ywings, 2 pointing pairs, 7 inclusions. solved by exclusion immediately after.
# H3 6, 9 -> 9
'test32-i25e38np2hp4yw1...goal=H3...name=Sudoku Test #17...question=Is H3 even?...answer=no',
'test32-i25e38np2hp4yw1...goal=H3...name=Sudoku Test #17...question=Is H3 even?...answer=no...select_ops_upfront',
# 1 ywings, 2 pointing pairs, 9 inclusions. Solved by exclusion after ywing
# I2 5, 7 -> 5
# 'test27-i32e31yw3...goal=%%...name=Sudoku Test #20...question=%%?...answer=%%',
# 1 ywing, 9 inclusion. solved by exclusion immediately after.
# B8 4, 8 -> 4
# Solve prior to ywing insted.
# B9 8, 9 -> No change prior to ywing. Try reducing uncertainty instead.
# G9 2, 6, 7 -> 7
'test30-i29e34yw1...goal=G9...name=Sudoku Test #18...question=Is G9 odd?...answer=yes',
'test30-i29e34yw1...goal=G9...name=Sudoku Test #18...question=Is G9 odd?...answer=yes...select_ops_upfront',
# 1 ywing, 2 pointing pairs, 2 inclusion. solved by exclusion immediately after
# F3 1, 3, 4, 5, 6, 8 -> 1, 3, 4, 5, 6
# 'ywing_test...goal=%%...name=Sudoku Test #18...question=%%?...answer=%%',
# 1 Ywing, 6 inclusion. Solved immediately after ywing by exclusion.
# E8 4, 6, 9 -> 4, 9
'test28-i27e36yw1...goal=E8...name=Sudoku Test #19...question=Is E8 a perfect square (1, 4, or 9)?...answer=yes',
'test28-i27e36yw1...goal=E8...name=Sudoku Test #19...question=Is E8 a perfect square (1, 4, or 9)?...answer=yes...select_ops_upfront',
# 1 ywings, 9 inclusion. Solved after ywing by exclusion.
# B8 3, 8 -> 3
# 'test31-i36e27yw1...goal=%%...name=Sudoku Test #20...question=%%?...answer=%%',
# 1 ywings, 2 pointing pairs, 7 inclusion. Solved immediately after ywings by exclusion
# H3 6, 9 -> 6
# 'test32-i25e38np2hp4yw1...goal=%%...name=Sudoku Test #20...question=%%?...answer=%%',
# 1 ywings, 2 pointing pairs, 5 inclusion. ywings followed by inclusion.
# D5 1, 2, 5, 6 -> no change. Need a different question prior to inclusion.
# C3 3, 5 -> 3
'box_line_reduction...goal=C3...name=Sudoku Test #20...question=Is C3 greater than 4?...answer=no',
'box_line_reduction...goal=C3...name=Sudoku Test #20...question=Is C3 greater than 4?...answer=no...select_ops_upfront',
]
},
'logical_operators_mturk_option1_select_upfront': {
'puzzles': [
# Inclusion 1
'medium1...goal=I3...name=Sudoku Test #01...question=Is I3 prime (2, 3, 5, or 7)?...answer=yes...select_ops_upfront',
'naked_single_test...goal=E6...name=Sudoku Test #02...question=Is E6 less than 5?...answer=yes...select_ops_upfront',
'test2-i24e40...goal=B2...name=Sudoku Test #03...question=Is B2 less than 6?...answer=no...select_ops_upfront',
# Pointing Pairs 1
'test15-i28e34np3...goal=F9...name=Sudoku Test #08...question=Is F9 odd?...answer=yes...select_ops_upfront',
'test13-i34e30np1...goal=A6...name=Sudoku Test #09...question=Is A6 5?...answer=no...select_ops_upfront',
# Naked Pairs 1
'naked_pair_test_2...goal=B5...name=Sudoku Test #12...question=Is B5 greater than 5?...answer=yes...select_ops_upfront',
'fiendish4...goal=A1...name=Sudoku Test #13...question=Is A1 greater than 5?...answer=yes...select_ops_upfront',
# Y Wings 1
'test32-i25e38np2hp4yw1...goal=H3...name=Sudoku Test #17...question=Is H3 even?...answer=no...select_ops_upfront',
'test28-i27e36yw1...goal=E8...name=Sudoku Test #19...question=Is E8 a perfect square (1, 4, or 9)?...answer=yes...select_ops_upfront',
'test30-i29e34yw1...goal=G9...name=Sudoku Test #18...question=Is G9 odd?...answer=yes...select_ops_upfront',
]
},
'logical_operators_mturk_option2_select_upfront': {
'puzzles': [
# Inclusion 2
'test3-i29e35...goal=E2...name=Sudoku Test #04...question=Is E2 6?...answer=no...select_ops_upfront',
'test6-i26e38...goal=C5...name=Sudoku Test #05...question=Is C5 7?...answer=no...select_ops_upfront',
# Pointing Pairs 2
'hard1...goal=B9...name=Sudoku Test #10...question=Is B9 greater than 3?...answer=yes...select_ops_upfront',
'test8-i32e32hp2...goal=H2...name=Sudoku Test #06...question=Is H2 7?...answer=no...select_ops_upfront',
'test9-i29e35hp2...goal=C6...name=Sudoku Test #07...question=Is C6 equal to A2 or A3?...answer=yes...select_ops_upfront',
# Naked Pairs 2
'test7-i26e36hp10...name=Sudoku Test #11...goal=C6...question=Is C6 greater than 5?...answer=no...select_ops_upfront',
'test10-i29e35hp7...goal=F6...name=Sudoku Test #14...question=Is F6 5?...answer=no...select_ops_upfront',
'test14-i24e38np3...goal=B2...name=Sudoku Test #15...question=Is B2 a perfect square (1, 4, or 9)?...answer=no...select_ops_upfront',
# Y Wings 2
'test29-i27e36yw1...name=Sudoku Test #16...goal=H9...question=Is H9 3?...answer=yes...select_ops_upfront',
'box_line_reduction...goal=C3...name=Sudoku Test #20...question=Is C3 greater than 4?...answer=no...select_ops_upfront',
]
},
'logical_operators_mturk_option1_always_select': {
'puzzles': [
# Inclusion 1
'medium1...goal=I3...name=Sudoku Test #01...question=Is I3 prime (2, 3, 5, or 7)?...answer=yes',
'naked_single_test...goal=E6...name=Sudoku Test #02...question=Is E6 less than 5?...answer=yes',
'test2-i24e40...goal=B2...name=Sudoku Test #03...question=Is B2 less than 6?...answer=no',
# Pointing Pairs 1
'test15-i28e34np3...goal=F9...name=Sudoku Test #08...question=Is F9 odd?...answer=yes',
'test13-i34e30np1...goal=A6...name=Sudoku Test #09...question=Is A6 5?...answer=no',
# Naked Pairs 1
'naked_pair_test_2...goal=B5...name=Sudoku Test #12...question=Is B5 greater than 5?...answer=yes',
'fiendish4...goal=A1...name=Sudoku Test #13...question=Is A1 greater than 5?...answer=yes',
# Y Wings 1
'test32-i25e38np2hp4yw1...goal=H3...name=Sudoku Test #17...question=Is H3 even?...answer=no',
'test28-i27e36yw1...goal=E8...name=Sudoku Test #19...question=Is E8 a perfect square (1, 4, or 9)?...answer=yes',
'test30-i29e34yw1...goal=G9...name=Sudoku Test #18...question=Is G9 odd?...answer=yes',
]
},
'logical_operators_mturk_option2_always_select': {
'puzzles': [
# Inclusion 2
'test3-i29e35...goal=E2...name=Sudoku Test #04...question=Is E2 6?...answer=no',
'test6-i26e38...goal=C5...name=Sudoku Test #05...question=Is C5 7?...answer=no',
# Pointing Pairs 2
'hard1...goal=B9...name=Sudoku Test #10...question=Is B9 greater than 3?...answer=yes',
'test8-i32e32hp2...goal=H2...name=Sudoku Test #06...question=Is H2 7?...answer=no',
'test9-i29e35hp2...goal=C6...name=Sudoku Test #07...question=Is C6 equal to A2 or A3?...answer=yes',
# Naked Pairs 2
'test7-i26e36hp10...name=Sudoku Test #11...goal=C6...question=Is C6 greater than 5?...answer=no',
'test10-i29e35hp7...goal=F6...name=Sudoku Test #14...question=Is F6 5?...answer=no',
'test14-i24e38np3...goal=B2...name=Sudoku Test #15...question=Is B2 a perfect square (1, 4, or 9)?...answer=no',
# Y Wings 2
'test29-i27e36yw1...name=Sudoku Test #16...goal=H9...question=Is H9 3?...answer=yes',
'box_line_reduction...goal=C3...name=Sudoku Test #20...question=Is C3 greater than 4?...answer=no',
]
},
'logical_operators_mturk_optionA_select_upfront': {
'puzzles': [
# Inclusion A
'medium1...goal=I3...name=Sudoku Test #01...question=Is I3 prime (2, 3, 5, or 7)?...answer=yes...select_ops_upfront',
# Pointing Pairs A
'test13-i34e30np1...goal=A6...name=Sudoku Test #09...question=Is A6 5?...answer=no...select_ops_upfront',
# Naked Pairs A
'fiendish4...goal=A1...name=Sudoku Test #13...question=Is A1 greater than 5?...answer=yes...select_ops_upfront',
# Y Wings A
'test28-i27e36yw1...goal=E8...name=Sudoku Test #19...question=Is E8 a perfect square (1, 4, or 9)?...answer=yes...select_ops_upfront',
'test30-i29e34yw1...goal=G9...name=Sudoku Test #18...question=Is G9 odd?...answer=yes...select_ops_upfront',
]
},
'logical_operators_mturk_optionB_select_upfront': {
'puzzles': [
# Inclusion B
'naked_single_test...goal=E6...name=Sudoku Test #02...question=Is E6 less than 5?...answer=yes...select_ops_upfront',
'test2-i24e40...goal=B2...name=Sudoku Test #03...question=Is B2 less than 6?...answer=no...select_ops_upfront',
# Pointing Pairs B
'test15-i28e34np3...goal=F9...name=Sudoku Test #08...question=Is F9 odd?...answer=yes...select_ops_upfront',
# Naked Pairs B
'naked_pair_test_2...goal=B5...name=Sudoku Test #12...question=Is B5 greater than 5?...answer=yes...select_ops_upfront',
# Y Wings B
'test32-i25e38np2hp4yw1...goal=H3...name=Sudoku Test #17...question=Is H3 even?...answer=no...select_ops_upfront',
]
},
'logical_operators_mturk_optionC_select_upfront': {
'puzzles': [
# Inclusion C
'test3-i29e35...goal=E2...name=Sudoku Test #04...question=Is E2 6?...answer=no...select_ops_upfront',
# Pointing Pairs C
'hard1...goal=B9...name=Sudoku Test #10...question=Is B9 greater than 3?...answer=yes...select_ops_upfront',
# Naked Pairs C
'test7-i26e36hp10...name=Sudoku Test #11...goal=C6...question=Is C6 greater than 5?...answer=no...select_ops_upfront',
'test14-i24e38np3...goal=B2...name=Sudoku Test #14...question=Is B2 a perfect square (1, 4, or 9)?...answer=no...select_ops_upfront',
# Y Wings C
'box_line_reduction...goal=C3...name=Sudoku Test #20...question=Is C3 greater than 4?...answer=no...select_ops_upfront',
]
},
'logical_operators_mturk_optionD_select_upfront': {
'puzzles': [
# Inclusion D
'test6-i26e38...goal=C5...name=Sudoku Test #05...question=Is C5 7?...answer=no...select_ops_upfront',
# Pointing Pairs D
'test8-i32e32hp2...goal=H2...name=Sudoku Test #06...question=Is H2 7?...answer=no...select_ops_upfront',
'test9-i29e35hp2...goal=C6...name=Sudoku Test #07...question=Is C6 equal to A2 or A3?...answer=yes...select_ops_upfront',
# Naked Pairs D
'test10-i29e35hp7...goal=F6...name=Sudoku Test #14...question=Is F6 5?...answer=no...select_ops_upfront',
# Y Wings D
'test29-i27e36yw1...name=Sudoku Test #16...goal=H9...question=Is H9 3?...answer=yes...select_ops_upfront',
]
},
'logical_operators_mturk_optionA_always_select': {
'puzzles': [
# Inclusion A
'medium1...goal=I3...name=Sudoku Test #01...question=Is I3 prime (2, 3, 5, or 7)?...answer=yes',
# Pointing Pairs A
'test13-i34e30np1...goal=A6...name=Sudoku Test #09...question=Is A6 5?...answer=no',
# Naked Pairs A
'fiendish4...goal=A1...name=Sudoku Test #13...question=Is A1 greater than 5?...answer=yes',
# Y Wings A
'test28-i27e36yw1...goal=E8...name=Sudoku Test #19...question=Is E8 a perfect square (1, 4, or 9)?...answer=yes',
'test30-i29e34yw1...goal=G9...name=Sudoku Test #18...question=Is G9 odd?...answer=yes',
]
},
'logical_operators_mturk_optionB_always_select': {
'puzzles': [
# Inclusion B
'naked_single_test...goal=E6...name=Sudoku Test #02...question=Is E6 less than 5?...answer=yes',
'test2-i24e40...goal=B2...name=Sudoku Test #03...question=Is B2 less than 6?...answer=no',
# Pointing Pairs B
'test15-i28e34np3...goal=F9...name=Sudoku Test #08...question=Is F9 odd?...answer=yes',
# Naked Pairs B
'naked_pair_test_2...goal=B5...name=Sudoku Test #12...question=Is B5 greater than 5?...answer=yes',
# Y Wings B
'test32-i25e38np2hp4yw1...goal=H3...name=Sudoku Test #17...question=Is H3 even?...answer=no',
]
},
'logical_operators_mturk_optionC_always_select': {
'puzzles': [
# Inclusion C
'test3-i29e35...goal=E2...name=Sudoku Test #04...question=Is E2 6?...answer=no',
# Pointing Pairs C
'hard1...goal=B9...name=Sudoku Test #10...question=Is B9 greater than 3?...answer=yes',
# Naked Pairs C
'test7-i26e36hp10...name=Sudoku Test #11...goal=C6...question=Is C6 greater than 5?...answer=no',
'test14-i24e38np3...goal=B2...name=Sudoku Test #14...question=Is B2 a perfect square (1, 4, or 9)?...answer=no',
# Y Wings C
'box_line_reduction...goal=C3...name=Sudoku Test #20...question=Is C3 greater than 4?...answer=no',
]
},
'logical_operators_mturk_optionD_always_select': {
'puzzles': [
# Inclusion D
'test6-i26e38...goal=C5...name=Sudoku Test #05...question=Is C5 7?...answer=no',
# Pointing Pairs D
'test8-i32e32hp2...goal=H2...name=Sudoku Test #06...question=Is H2 7?...answer=no',
'test9-i29e35hp2...goal=C6...name=Sudoku Test #07...question=Is C6 equal to A2 or A3?...answer=yes',
# Naked Pairs D
'test10-i29e35hp7...goal=F6...name=Sudoku Test #14...question=Is F6 5?...answer=no',
# Y Wings D
'test29-i27e36yw1...name=Sudoku Test #16...goal=H9...question=Is H9 3?...answer=yes',
]
},
'extra_games': {
'puzzles': [
# Exclusion only; resolved with anything
# These are un-checked by Shelley other than to confirm that they don't need any operators.
'easy1...goal=D2...name=No Logical Ops Required #1...question=Is D2 greater than 4?...answer=no',
'easy1...goal=D2...name=No Logical Ops Required #1...question=Is D2 greater than 4?...answer=no...select_ops_upfront',
'easy4...goal=A2...name=No Logical Ops Required #2...question=Is A2 odd?...answer=yes',
'easy4...goal=A2...name=No Logical Ops Required #2...question=Is A2 odd?...answer=yes...select_ops_upfront',
# May require intermediate operators.
'box_line_reduction_2...name=Extra Manipulations Required Beyond Logical Ops #1...goal=C5...question=Is C5 less than 5?...answer=yes',
'box_line_reduction_2...name=Extra Manipulations Required Beyond Logical Ops #1...goal=C5...question=Is C5 less than 5?...answer=yes...select_ops_upfront',
'hidden_pair_test_2...goal=F7...name=Extra Manipulations Required Beyond Logical Ops #2...question=Is F7 odd?...answer=yes',
'hidden_pair_test_2...goal=F7...name=Extra Manipulations Required Beyond Logical Ops #2...question=Is F7 odd?...answer=yes...select_ops_upfront',
'pointing_pair_test_2...goal=E7...name=Extra Manipulations Required Beyond Logical Ops #3...question=Is E7 8?...answer=no',
'pointing_pair_test_2...goal=E7...name=Extra Manipulations Required Beyond Logical Ops #3...question=Is E7 8?...answer=no...select_ops_upfront',
'pointing_pair_test...goal=H4...name=Extra Manipulations Required Beyond Logical Ops #4...question=Is H4 even?...answer=no',
'pointing_pair_test...goal=H4...name=Extra Manipulations Required Beyond Logical Ops #4...question=Is H4 even?...answer=no...select_ops_upfront',
'xwing_test...goal=E8...name=Extra Manipulations Required Beyond Logical Ops #5...question=Is E8 more than 5?...answer=no',
'xwing_test...goal=E8...name=Extra Manipulations Required Beyond Logical Ops #5...question=Is E8 more than 5?...answer=no...select_ops_upfront',
'hidden_triple_test...name=Extra Manipulations Required Beyond Logical Ops #6...goal=A9...question=Is A9 greater than 5?...answer=no',
'hidden_triple_test...name=Extra Manipulations Required Beyond Logical Ops #6...goal=A9...question=Is A9 greater than 5?...answer=no...select_ops_upfront',
'xwing_test...name=Extra Manipulations Required Beyond Logical Ops #7...goal=G6...question=Is G6 equal to A7 or A8 or A9?...answer=no',
'xwing_test...name=Extra Manipulations Required Beyond Logical Ops #7...goal=G6...question=Is G6 equal to A7 or A8 or A9?...answer=no...select_ops_upfront',
'naked_quad_test...goal=B2...name=Extra Manipulations Required Beyond Logical Ops #8...question=Is B2 a multiple of 3 (3 or 6 or 9)?...answer=yes',
'naked_quad_test...goal=B2...name=Extra Manipulations Required Beyond Logical Ops #8...question=Is B2 a multiple of 3 (3 or 6 or 9)?...answer=yes...select_ops_upfront',
# ...select_ops_upfront
# ...costly_ops': ['inclusion', 'pointingpairs', 'naked pairs', 'ywings']
]
}
}
| 73.699301 | 180 | 0.61799 | 5,631 | 42,156 | 4.539336 | 0.112236 | 0.055162 | 0.068464 | 0.031924 | 0.635617 | 0.621885 | 0.599351 | 0.586206 | 0.576425 | 0.569813 | 0 | 0.194812 | 0.187945 | 42,156 | 571 | 181 | 73.828371 | 0.551865 | 0.180449 | 0 | 0.472772 | 0 | 0.532178 | 0.788207 | 0.507473 | 0 | 0 | 0 | 0.001751 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
76e3f113a62b62b31608ca1aafb57c4dcc7e6ebb | 281 | py | Python | basic/messages/admin.py | neechadi/django-basic-apps | 3a90090857549ea4198a72c44f45f6edb238e2a8 | [
"BSD-3-Clause"
] | 548 | 2015-01-02T21:41:29.000Z | 2022-03-23T09:10:04.000Z | basic/messages/admin.py | neechadi/django-basic-apps | 3a90090857549ea4198a72c44f45f6edb238e2a8 | [
"BSD-3-Clause"
] | 4 | 2015-01-13T16:27:02.000Z | 2016-11-01T01:51:31.000Z | basic/messages/admin.py | neechadi/django-basic-apps | 3a90090857549ea4198a72c44f45f6edb238e2a8 | [
"BSD-3-Clause"
] | 182 | 2015-01-02T21:41:29.000Z | 2021-08-09T07:01:07.000Z | from django.contrib import admin
from basic.messages.models import Message
class MessageAdmin(admin.ModelAdmin):
list_display = ('from_user', 'to_user', 'subject', 'to_status', 'from_status', 'created', 'content_type', 'object_id')
admin.site.register(Message, MessageAdmin)
| 35.125 | 122 | 0.765125 | 36 | 281 | 5.777778 | 0.694444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099644 | 281 | 7 | 123 | 40.142857 | 0.822134 | 0 | 0 | 0 | 0 | 0 | 0.252669 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
76e8592e5fbf2f8e3d6d273c68758e6902fef2c3 | 144 | py | Python | Tests/alltests/reg.py | coderabhishek/Glue | d522608798c1c050baafe077d5599dce359bd7da | [
"BSD-3-Clause"
] | 1 | 2016-10-12T22:19:45.000Z | 2016-10-12T22:19:45.000Z | Tests/alltests/reg.py | coderabhishek/Glue | d522608798c1c050baafe077d5599dce359bd7da | [
"BSD-3-Clause"
] | null | null | null | Tests/alltests/reg.py | coderabhishek/Glue | d522608798c1c050baafe077d5599dce359bd7da | [
"BSD-3-Clause"
] | null | null | null | import re
l = ["Abhishek00","Apple12","Code","Netherlands"] : vector<std::string>
for s in l:
if re.search("[A-Z][a-z]*[0-9]+",s):
print s
| 18 | 71 | 0.597222 | 26 | 144 | 3.307692 | 0.769231 | 0.046512 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048387 | 0.138889 | 144 | 7 | 72 | 20.571429 | 0.645161 | 0 | 0 | 0 | 0 | 0 | 0.340278 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.2 | null | null | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
76ea30c801e8f682f48b3afd54c36ea76eee8883 | 10,648 | py | Python | sympy/integrals/rubi/rubi_tests/tests/test_1_4.py | jainachal03/sympy | 7dbc2f49370b31ac6960524ea7e5444e2e5a50d5 | [
"BSD-3-Clause"
] | 1 | 2018-11-20T11:40:30.000Z | 2018-11-20T11:40:30.000Z | sympy/integrals/rubi/rubi_tests/tests/test_1_4.py | jainachal03/sympy | 7dbc2f49370b31ac6960524ea7e5444e2e5a50d5 | [
"BSD-3-Clause"
] | 14 | 2018-02-08T10:11:03.000Z | 2019-04-16T10:32:46.000Z | sympy/integrals/rubi/rubi_tests/tests/test_1_4.py | jainachal03/sympy | 7dbc2f49370b31ac6960524ea7e5444e2e5a50d5 | [
"BSD-3-Clause"
] | 1 | 2020-09-09T20:41:34.000Z | 2020-09-09T20:41:34.000Z | import sys
from sympy.external import import_module
matchpy = import_module("matchpy")
if not matchpy:
#bin/test will not execute any tests now
disabled = True
if sys.version_info[:2] < (3, 6):
disabled = True
from sympy.integrals.rubi.rubi import rubi_integrate
from sympy.functions import log, sqrt, exp, cos, sin, tan, sec, csc, cot
from sympy.functions.elementary.hyperbolic import atanh as arctanh
from sympy.functions.elementary.hyperbolic import asinh as arcsinh
from sympy.functions.elementary.hyperbolic import acosh as arccosh
from sympy.functions.elementary.trigonometric import atan as arctan
from sympy.functions.elementary.trigonometric import asin as arcsin
from sympy.functions.elementary.trigonometric import acos as arccos
from sympy.integrals.rubi.utility_function import EllipticE, EllipticF, EllipticPi, hypergeom, rubi_test, AppellF1
from sympy.core.numbers import (I, pi as Pi)
from sympy.core.singleton import S
from sympy.core.symbol import symbols
from sympy.functions.elementary.exponential import exp_polar
from sympy.functions.special.hyper import hyper
from sympy.integrals.integrals import Integral
from sympy.simplify.simplify import simplify
from sympy.testing.pytest import XFAIL
A, B, C, D, a, b, c, d, e, f, g, h, i, m, n, p, x, u = symbols('A B C D a b c d e f g h i m n p x u')
def test_1():
'''
Tests for Rubi Algebraic 1.2 rules. Parsed from Maple syntax
All tests: http://www.apmaths.uwo.ca/~arich/IntegrationProblems/MapleSyntaxFiles/MapleSyntaxFiles.html
Note: Some tests are commented since they depend rules other than Algebraic1.2.
'''
test = [
[(a + b*x)**S(2)*(e + f*x)*sqrt(c + d*x)/x, x, S(5), S(2)/S(7)*f*(a + b*x)**S(2)*(c + d*x)**(S(3)/S(2))/d + S(2)/S(105)*(c + d*x)**(S(3)/S(2))*(S(2)*(S(10)*a**S(2)*d**S(2)*f - b**S(2)*c*(S(7)*d*e - S(4)*c*f) + S(7)*a*b*d*(S(5)*d*e - S(2)*c*f)) + S(3)*b*d*(S(7)*b*d*e - S(4)*b*c*f + S(4)*a*d*f)*x)/d**S(3) - S(2)*a**S(2)*e*arctanh(sqrt(c + d*x)/sqrt(c))*sqrt(c) + S(2)*a**S(2)*e*sqrt(c + d*x)],
[(a + b*x)*(e + f*x)*sqrt(c + d*x)/x, x, S(4), - S(2)/S(15)*(c + d*x)**(S(3)/S(2))*(S(2)*b*c*f - S(5)*d*(b*e + a*f) - S(3)*b*d*f*x)/d**S(2) - S(2)*a*e*arctanh(sqrt(c + d*x)/sqrt(c))*sqrt(c) + S(2)*a*e*sqrt(c + d*x)],
[(c + d*x)**S(2)*(e + f*x)*sqrt(a + b*x)/x, x, S(5), S(2)/S(7)*f*(a + b*x)**(S(3)/S(2))*(c + d*x)**S(2)/b + S(2)/S(105)*(a + b*x)**(S(3)/S(2))*(S(2)*(S(4)*a**S(2)*d**S(2)*f - S(7)*a*b*d*(d*e + S(2)*c*f) + S(5)*b**S(2)*c*(S(7)*d*e + S(2)*c*f)) + S(3)*b*d*(S(7)*b*d*e + S(4)*b*c*f - S(4)*a*d*f)*x)/b**S(3) - S(2)*c**S(2)*e*arctanh(sqrt(a + b*x)/sqrt(a))*sqrt(a) + S(2)*c**S(2)*e*sqrt(a + b*x)],
[(c + d*x)*(e + f*x)*sqrt(a + b*x)/x, x, S(4), - S(2)/S(15)*(a + b*x)**(S(3)/S(2))*(S(2)*a*d*f - S(5)*b*(d*e + c*f) - S(3)*b*d*f*x)/b**S(2) - S(2)*c*e*arctanh(sqrt(a + b*x)/sqrt(a))*sqrt(a) + S(2)*c*e*sqrt(a + b*x)],
[x**S(4)*(e + f*x)**n/((a + b*x)*(c + d*x)), x, S(8), e**S(2)*(e + f*x)**(S(1) + n)/(b*d*f**S(3)*(S(1) + n)) + (b*c + a*d)*e*(e + f*x)**(S(1) + n)/(b**S(2)*d**S(2)*f**S(2)*(S(1) + n)) + (b**S(2)*c**S(2) + a*b*c*d + a**S(2)*d**S(2))*(e + f*x)**(S(1) + n)/(b**S(3)*d**S(3)*f*(S(1) + n)) - S(2)*e*(e + f*x)**(S(2) + n)/(b*d*f**S(3)*(S(2) + n)) - (b*c + a*d)*(e + f*x)**(S(2) + n)/(b**S(2)*d**S(2)*f**S(2)*(S(2) + n)) + (e + f*x)**(S(3) + n)/(b*d*f**S(3)*(S(3) + n)) - a**S(4)*(e + f*x)**(S(1) + n)*hypergeom([S(1), S(1) + n], [S(2) + n], b*(e + f*x)/(b*e - a*f))/(b**S(3)*(b*c - a*d)*(b*e - a*f)*(S(1) + n)) + c**S(4)*(e + f*x)**(S(1) + n)*hypergeom([S(1), S(1) + n], [S(2) + n], d*(e + f*x)/(d*e - c*f))/(d**S(3)*(b*c - a*d)*(d*e - c*f)*(S(1) + n))],
[(a + b*x)*(c + d*x)*(e + f*x)*(g + h*x), x, S(2), a*c*e*g*x + S(1)/S(2)*(b*c*e*g + a*(d*e*g + c*f*g + c*e*h))*x**S(2) + S(1)/S(3)*(b*(d*e*g + c*f*g + c*e*h) + a*(d*f*g + d*e*h + c*f*h))*x**S(3) + S(1)/S(4)*(a*d*f*h + b*(d*f*g + d*e*h + c*f*h))*x**S(4) + S(1)/S(5)*b*d*f*h*x**S(5)],
[(a + b*x)*(c + d*x)*(e + f*x)/(g + h*x), x, S(2), (b*(d*g - c*h)*(f*g - e*h) - a*h*(d*f*g - d*e*h - c*f*h))*x/h**S(3) + S(1)/S(2)*(a*d*f*h - b*(d*f*g - d*e*h - c*f*h))*x**S(2)/h**S(2) + S(1)/S(3)*b*d*f*x**S(3)/h - (b*g - a*h)*(d*g - c*h)*(f*g - e*h)*log(g + h*x)/h**S(4)],
[(a + b*x)**m*(c + d*x)*(e + f*x)*(g + h*x), x, S(2), (b*c - a*d)*(b*e - a*f)*(b*g - a*h)*(a + b*x)**(S(1) + m)/(b**S(4)*(S(1) + m)) + (S(3)*a**S(2)*d*f*h + b**S(2)*(d*e*g + c*f*g + c*e*h) - S(2)*a*b*(d*f*g + d*e*h + c*f*h))*(a + b*x)**(S(2) + m)/(b**S(4)*(S(2) + m)) - (S(3)*a*d*f*h - b*(d*f*g + d*e*h + c*f*h))*(a + b*x)**(S(3) + m)/(b**S(4)*(S(3) + m)) + d*f*h*(a + b*x)**(S(4) + m)/(b**S(4)*(S(4) + m))],
[(c + d*x)**( - S(4) - m)*(e + f*x)**m*(g + h*x), x, S(3), - (d*g - c*h)*(c + d*x)**( - S(3) - m)*(e + f*x)**(S(1) + m)/(d*(d*e - c*f)*(S(3) + m)) + (c*f*h*(S(1) + m) + d*(S(2)*f*g - e*h*(S(3) + m)))*(c + d*x)**( - S(2) - m)*(e + f*x)**(S(1) + m)/(d*(d*e - c*f)**S(2)*(S(2) + m)*(S(3) + m)) - f*(c*f*h*(S(1) + m) + d*(S(2)*f*g - e*h*(S(3) + m)))*(c + d*x)**( - S(1) - m)*(e + f*x)**(S(1) + m)/(d*(d*e - c*f)**S(3)*(S(1) + m)*(S(2) + m)*(S(3) + m))],
]
for i in test:
r = rubi_integrate(i[0], i[1])
if len(i) == 5:
assert rubi_test(r, i[1], i[3], expand=True, _diff=True) or rubi_test(r, i[1], i[4], expand=True, _diff=True)
else:
assert rubi_test(r, i[1], i[3], expand=True, _diff=True)
@XFAIL
def test_2():
test = [
[x**m*(e + f*x)**n/((a + b*x)*(c + d*x)), x, S(6), b*x**(S(1) + m)*(e + f*x)**n*AppellF1(S(1) + m, - n, S(1), S(2) + m, - f*x/e, - b*x/a)/(a*(b*c - a*d)*(S(1) + m)*(S(1) + f*x/e)**n) - d*x**(S(1) + m)*(e + f*x)**n*AppellF1(S(1) + m, - n, S(1), S(2) + m, - f*x/e, - d*x/c)/(c*(b*c - a*d)*(S(1) + m)*(S(1) + f*x/e)**n)],
[(a + b*x)**m*(c + d*x)**n*(e + f*x)*(g + h*x), x, S(3), - (a + b*x)**(S(1) + m)*(c + d*x)**(S(1) + n)*(b*c*f*h*(S(2) + m) + a*d*f*h*(S(2) + n) - b*d*(f*g + e*h)*(S(3) + m + n) - b*d*f*h*(S(2) + m + n)*x)/(b**S(2)*d**S(2)*(S(2) + m + n)*(S(3) + m + n)) + (a**S(2)*d**S(2)*f*h*(S(1) + n)*(S(2) + n) + a*b*d*(S(1) + n)*(S(2)*c*f*h*(S(1) + m) - d*(f*g + e*h)*(S(3) + m + n)) + b**S(2)*(c**S(2)*f*h*(S(1) + m)*(S(2) + m) - c*d*(f*g + e*h)*(S(1) + m)*(S(3) + m + n) + d**S(2)*e*g*(S(2) + m + n)*(S(3) + m + n)))*(a + b*x)**(S(1) + m)*(c + d*x)**n*hypergeom([S(1) + m, - n], [S(2) + m], - d*(a + b*x)/(b*c - a*d))/(b**S(3)*d**S(2)*(S(1) + m)*(S(2) + m + n)*(S(3) + m + n)*(b*(c + d*x)/(b*c - a*d))**n)],
[(a + b*x)**m*(A + B*x)*(c + d*x)**n*(e + f*x)**p, x, S(7), (A*b - a*B)*(a + b*x)**(S(1) + m)*(c + d*x)**n*(e + f*x)**p*AppellF1(S(1) + m, - n, - p, S(2) + m, - d*(a + b*x)/(b*c - a*d), - f*(a + b*x)/(b*e - a*f))/(b**S(2)*(S(1) + m)*(b*(c + d*x)/(b*c - a*d))**n*(b*(e + f*x)/(b*e - a*f))**p) + B*(a + b*x)**(S(2) + m)*(c + d*x)**n*(e + f*x)**p*AppellF1(S(2) + m, - n, - p, S(3) + m, - d*(a + b*x)/(b*c - a*d), - f*(a + b*x)/(b*e - a*f))/(b**S(2)*(S(2) + m)*(b*(c + d*x)/(b*c - a*d))**n*(b*(e + f*x)/(b*e - a*f))**p)],
[(A + B*x)*(c + d*x)**n*(e + f*x)**p/(a + b*x), x, S(5), - (A*b - a*B)*(c + d*x)**(S(1) + n)*(e + f*x)**p*AppellF1(S(1) + n, S(1), - p, S(2) + n, b*(c + d*x)/(b*c - a*d), - f*(c + d*x)/(d*e - c*f))/(b*(b*c - a*d)*(S(1) + n)*(d*(e + f*x)/(d*e - c*f))**p) - B*(c + d*x)**(S(1) + n)*(e + f*x)**(S(1) + p)*hypergeom([S(1), S(2) + n + p], [S(2) + p], d*(e + f*x)/(d*e - c*f))/(b*(d*e - c*f)*(S(1) + p)), - (A*b - a*B)*(c + d*x)**(S(1) + n)*(e + f*x)**p*AppellF1(S(1) + n, - p, S(1), S(2) + n, - f*(c + d*x)/(d*e - c*f), b*(c + d*x)/(b*c - a*d))/(b*(b*c - a*d)*(S(1) + n)*(d*(e + f*x)/(d*e - c*f))**p) + B*(c + d*x)**(S(1) + n)*(e + f*x)**p*hypergeom([S(1) + n, - p], [S(2) + n], - f*(c + d*x)/(d*e - c*f))/(b*d*(S(1) + n)*(d*(e + f*x)/(d*e - c*f))**p)],
[(c*i + d*i*x)/(sqrt(c + d*x)*sqrt(e + f*x)*sqrt(g + h*x)), x, S(3), S(2)*i*EllipticE(sqrt(h)*sqrt(e + f*x)/sqrt( - f*g + e*h), sqrt( - d*(f*g - e*h)/((d*e - c*f)*h)))*sqrt( - f*g + e*h)*sqrt(c + d*x)*sqrt(f*(g + h*x)/(f*g - e*h))/(f*sqrt(h)*sqrt( - f*(c + d*x)/(d*e - c*f))*sqrt(g + h*x))],
[(a + b*x)**m*(c + d*x)**n*(e + f*x)**p, x, S(3), (a + b*x)**(S(1) + m)*(c + d*x)**n*(e + f*x)**p*AppellF1(S(1) + m, - n, - p, S(2) + m, - d*(a + b*x)/(b*c - a*d), - f*(a + b*x)/(b*e - a*f))/(b*(S(1) + m)*(b*(c + d*x)/(b*c - a*d))**n*(b*(e + f*x)/(b*e - a*f))**p)],
[(a + b*x)**m*(c + d*x)**n*(e + f*x)**p/(g + h*x), x, S(0), Integral((a + b*x)**m*(c + d*x)**n*(e + f*x)**p/(g + h*x), x)],
[x**S(3)*(S(1) + a*x)/(sqrt(a*x)*sqrt(S(1) - a*x)), x, S(8), - S(75)/S(128)*arcsin(S(1) - S(2)*a*x)/a**S(4) - S(25)/S(32)*(a*x)**(S(3)/S(2))*sqrt(S(1) - a*x)/a**S(4) - S(5)/S(8)*(a*x)**(S(5)/S(2))*sqrt(S(1) - a*x)/a**S(4) - S(1)/S(4)*(a*x)**(S(7)/S(2))*sqrt(S(1) - a*x)/a**S(4) - S(75)/S(64)*sqrt(a*x)*sqrt(S(1) - a*x)/a**S(4)],
]
for index in test:
r = rubi_integrate(index[0], index[1])
if len(index) == 5:
assert rubi_test(r, index[1], index[3], expand=True, _diff=True) or rubi_test(r, index[1], index[4], expand=True, _diff=True)
else:
assert rubi_test(r, index[1], index[3], expand=True, _diff=True)
@XFAIL
def test_numerical():
test = [
#[S(1)/((a + b*x)*sqrt(c + d*x)*sqrt(e + f*x)*sqrt(g + h*x)), x, S(1), - S(2)*EllipticPi(sqrt( - f/(d*e - c*f))*sqrt(c + d*x), - b*(d*e - c*f)/((b*c - a*d)*f), sqrt((d*e - c*f)*h/(f*(d*g - c*h))))*sqrt(d*(e + f*x)/(d*e - c*f))*sqrt(d*(g + h*x)/(d*g - c*h))/((b*c - a*d)*sqrt( - f/(d*e - c*f))*sqrt(e + f*x)*sqrt(g + h*x))],
#[S(1)/(sqrt(a + b*x)*sqrt(c + d*x)*sqrt(e + f*x)*sqrt(g + h*x)), x, S(2), - S(2)*(a + b*x)*sqrt(cos(arctan(sqrt(b*e - a*f)*sqrt(g + h*x)/(sqrt(f*g - e*h)*sqrt(a + b*x))))**S(2))/cos(arctan(sqrt(b*e - a*f)*sqrt(g + h*x)/(sqrt(f*g - e*h)*sqrt(a + b*x))))*EllipticF(sin(arctan(sqrt(b*e - a*f)*sqrt(g + h*x)/(sqrt(f*g - e*h)*sqrt(a + b*x)))), sqrt((d*e - c*f)*(b*g - a*h)/((b*e - a*f)*(d*g - c*h))))*sqrt(f*g - e*h)*sqrt((b*g - a*h)*(c + d*x)/((d*g - c*h)*(a + b*x)))*sqrt((b*g - a*h)*(e + f*x)/((f*g - e*h)*(a + b*x)))*sqrt(S(1) + (b*c - a*d)*(g + h*x)/((d*g - c*h)*(a + b*x)))/((b*g - a*h)*sqrt(b*e - a*f)*sqrt(c + d*x)*sqrt(e + f*x)*sqrt((S(1) + (b*c - a*d)*(g + h*x)/((d*g - c*h)*(a + b*x)))/(S(1) + (b*e - a*f)*(g + h*x)/((f*g - e*h)*(a + b*x))))*sqrt(S(1) + (b*e - a*f)*(g + h*x)/((f*g - e*h)*(a + b*x))))],
]
for i in test:
r = rubi_integrate(i[0], i[1])
if len(i) == 5:
assert rubi_test(r, i[1], i[3], expand=True, _diff=True, _numerical=True) or rubi_test(r, i[1], i[4], expand=True, _diff=True, _numerical=True)
else:
assert rubi_test(r, i[1], i[3], expand=True, _diff=True, _numerical=True)
| 122.390805 | 818 | 0.431818 | 2,752 | 10,648 | 1.65843 | 0.050872 | 0.053024 | 0.034838 | 0.020158 | 0.717134 | 0.644829 | 0.536372 | 0.498028 | 0.456398 | 0.413015 | 0 | 0.043201 | 0.176089 | 10,648 | 86 | 819 | 123.813953 | 0.477032 | 0.132795 | 0 | 0.225352 | 0 | 0 | 0.004561 | 0 | 0 | 0 | 0 | 0 | 0.084507 | 1 | 0.042254 | false | 0 | 0.28169 | 0 | 0.323944 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
76ed1e133f468cdb9a4009703030d4ce91f71df2 | 685 | py | Python | packages/pyright-internal/src/tests/samples/annotatedVar2.py | sasano8/pyright | e804f324ee5dbd25fd37a258791b3fd944addecd | [
"MIT"
] | 4,391 | 2019-05-07T01:18:57.000Z | 2022-03-31T20:45:44.000Z | packages/pyright-internal/src/tests/samples/annotatedVar2.py | sasano8/pyright | e804f324ee5dbd25fd37a258791b3fd944addecd | [
"MIT"
] | 2,740 | 2019-05-07T03:29:30.000Z | 2022-03-31T12:57:46.000Z | packages/pyright-internal/src/tests/samples/annotatedVar2.py | sasano8/pyright | e804f324ee5dbd25fd37a258791b3fd944addecd | [
"MIT"
] | 455 | 2019-05-07T12:55:14.000Z | 2022-03-31T17:09:15.000Z | # This sample tests annotated types on global variables.
# This should generate an error because the declared
# type below does not match the assigned type.
glob_var1 = 4
# This should generate an error because the declared
# type doesn't match the later declared type.
glob_var1 = Exception() # type: str
glob_var1 = Exception() # type: Exception
# This should generate an error because the assigned
# type doesn't match the declared type.
glob_var1 = "hello" # type: Exception
# This should generate an error.
glob_var2 = 5
def func1():
global glob_var1
global glob_var2
# This should generate an error.
glob_var1 = 3
glob_var2 = "hello" # type: str
| 23.62069 | 56 | 0.727007 | 102 | 685 | 4.794118 | 0.343137 | 0.09816 | 0.184049 | 0.204499 | 0.501022 | 0.435583 | 0.368098 | 0.192229 | 0.192229 | 0 | 0 | 0.02403 | 0.210219 | 685 | 28 | 57 | 24.464286 | 0.879852 | 0.654015 | 0 | 0.2 | 1 | 0 | 0.044843 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0a169190bfdae770c1bbd3443788096204e6e1e4 | 515 | py | Python | tests/models.py | AtteqCom/zsl_openapi | 0d9fac32ae3516b2f53a302716f162a4d688bed0 | [
"BSD-2-Clause"
] | null | null | null | tests/models.py | AtteqCom/zsl_openapi | 0d9fac32ae3516b2f53a302716f162a4d688bed0 | [
"BSD-2-Clause"
] | null | null | null | tests/models.py | AtteqCom/zsl_openapi | 0d9fac32ae3516b2f53a302716f162a4d688bed0 | [
"BSD-2-Clause"
] | null | null | null | from sqlalchemy.sql.schema import Column
from sqlalchemy.sql.sqltypes import DateTime
from sqlalchemy.sql.sqltypes import Integer
from sqlalchemy.sql.sqltypes import String
from zsl.db.model.sql_alchemy import DeclarativeBase
class User(DeclarativeBase):
__tablename__ = 'user'
__table_args__ = {'useexisting': True}
id = Column(Integer, primary_key=True)
name = Column(String(255), nullable=False)
email = Column(String(255), nullable=False)
created = Column(DateTime(), nullable=False)
| 32.1875 | 52 | 0.765049 | 64 | 515 | 5.984375 | 0.484375 | 0.146214 | 0.177546 | 0.195822 | 0.389034 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013544 | 0.139806 | 515 | 15 | 53 | 34.333333 | 0.851016 | 0 | 0 | 0 | 0 | 0 | 0.029126 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.416667 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0a23c56a55d6b1a1c59911a86bbc7bf45e7b1058 | 2,284 | py | Python | posts/models.py | domino31620/SMA-Team-3 | 0d1fe51247050f5247907537787d27f1f025b75c | [
"MIT"
] | null | null | null | posts/models.py | domino31620/SMA-Team-3 | 0d1fe51247050f5247907537787d27f1f025b75c | [
"MIT"
] | null | null | null | posts/models.py | domino31620/SMA-Team-3 | 0d1fe51247050f5247907537787d27f1f025b75c | [
"MIT"
] | 11 | 2021-07-15T20:55:50.000Z | 2021-10-01T13:33:38.000Z | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
from django.urls import reverse
import authentication.models as a
class PostCategory(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
description = models.CharField(max_length=255, blank=True, null=True)
updated_at = models.DateTimeField(auto_now=True, null=True, blank=True, editable=False)
created_at = models.DateTimeField(auto_now=True, null=True, blank=True, editable=False)
def __str__(self):
if self.name is None:
return 'Post name is empty'
return self.name
class Posts(models.Model):
user_id = models.ForeignKey(a.User, on_delete=models.CASCADE)
category = models.ForeignKey(PostCategory, on_delete=models.CASCADE)
content = models.TextField(blank=True, null=True)
image = models.ImageField(blank=True, null=True, upload_to='posts/')
status = models.CharField(max_length=255, blank=True, null=True)
like_count = models.IntegerField(default=0, editable=False)
comment_count = models.IntegerField(default=0, editable=False)
updated_at = models.DateTimeField(auto_now=True, null=True, blank=True, editable=False)
created_at = models.DateTimeField(auto_now=True, null=True, blank=True, editable=False)
def __str__(self):
return str(self.user_id)
def get_absolute_url(self):
return reverse('post-detail', kwargs={'pk': self.pk})
class PostComments(models.Model):
user_id = models.ForeignKey(a.User, related_name='details', on_delete=models.CASCADE)
post_id = models.ForeignKey(Posts, related_name='details', on_delete=models.CASCADE)
content = models.TextField()
image = models.ImageField(blank=True, null=True, upload_to='posts/')
updated_at = models.DateTimeField(auto_now=True, null=True, blank=True, editable=False)
created_at = models.DateTimeField(auto_now=True, null=True, blank=True, editable=False)
class PostLikes(models.Model):
liker_id = models.ForeignKey(a.User, related_name='likes', on_delete=models.CASCADE)
post_id = models.ForeignKey(Posts, related_name='likes', on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now=True, null=True, blank=True, editable=False) | 43.923077 | 91 | 0.743433 | 314 | 2,284 | 5.257962 | 0.245223 | 0.070866 | 0.094488 | 0.105996 | 0.723804 | 0.723804 | 0.723804 | 0.563901 | 0.517868 | 0.437916 | 0 | 0.005595 | 0.139229 | 2,284 | 52 | 92 | 43.923077 | 0.834181 | 0.010508 | 0 | 0.289474 | 0 | 0 | 0.029659 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.078947 | false | 0 | 0.105263 | 0.052632 | 0.973684 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
0a3c1ebfc5ddc12e768bba27459efea7b37e0e81 | 70 | py | Python | octopus/modules/coreacuk/settings.py | CottageLabs/magnificent-octopus-oacwellcome-fork | b1c8c412cf9a3fe66fca1c8e92ed074c9821663e | [
"Apache-2.0"
] | 2 | 2016-02-22T04:31:30.000Z | 2021-08-03T23:58:36.000Z | octopus/modules/coreacuk/settings.py | CottageLabs/magnificent-octopus-oacwellcome-fork | b1c8c412cf9a3fe66fca1c8e92ed074c9821663e | [
"Apache-2.0"
] | 9 | 2015-01-04T14:00:05.000Z | 2021-12-13T19:35:07.000Z | octopus/modules/coreacuk/settings.py | CottageLabs/magnificent-octopus-oacwellcome-fork | b1c8c412cf9a3fe66fca1c8e92ed074c9821663e | [
"Apache-2.0"
] | 3 | 2016-09-09T13:39:45.000Z | 2018-02-19T14:23:12.000Z |
CORE_API_KEY = ""
CORE_API_BASE_URL = "http://core.ac.uk:80/api-v2/" | 17.5 | 50 | 0.685714 | 14 | 70 | 3.071429 | 0.714286 | 0.325581 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047619 | 0.1 | 70 | 4 | 50 | 17.5 | 0.634921 | 0 | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0a3d030f9b591f4878542e7a145dbc3244766ce1 | 144 | py | Python | day_1/python_if_else.py | Ishaan-99-cyber/ml-workshop-wac-1 | 186d4b6544c7e55cea052312934e455a51d1698a | [
"MIT"
] | 6 | 2020-12-24T07:10:58.000Z | 2021-04-11T09:19:18.000Z | day_1/python_if_else.py | Ishaan-99-cyber/ml-workshop-wac-1 | 186d4b6544c7e55cea052312934e455a51d1698a | [
"MIT"
] | null | null | null | day_1/python_if_else.py | Ishaan-99-cyber/ml-workshop-wac-1 | 186d4b6544c7e55cea052312934e455a51d1698a | [
"MIT"
] | 6 | 2020-12-24T09:42:25.000Z | 2021-01-26T01:34:38.000Z | number = int(input())
if number % 2 == 1 or 6 <= number <= 20:
print('Weird')
elif 2 <= number <= 5 or number > 20:
print('Not Weird')
| 20.571429 | 40 | 0.555556 | 23 | 144 | 3.478261 | 0.608696 | 0.2 | 0.325 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084112 | 0.256944 | 144 | 6 | 41 | 24 | 0.663551 | 0 | 0 | 0 | 0 | 0 | 0.097222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0a4dd111e20156e8fdb4aae0cc6d5ea9c224289d | 190 | py | Python | test/test_files/st_python.py | twolfson/sublime-harness | 0b97011594092b049dbee6d3477ade737c39c59e | [
"Unlicense"
] | null | null | null | test/test_files/st_python.py | twolfson/sublime-harness | 0b97011594092b049dbee6d3477ade737c39c59e | [
"Unlicense"
] | null | null | null | test/test_files/st_python.py | twolfson/sublime-harness | 0b97011594092b049dbee6d3477ade737c39c59e | [
"Unlicense"
] | null | null | null | import os
import sublime
def run():
with open('%s', 'w') as f:
f.write(sublime.packages_path())
if os.environ.get('SUBLIME_AUTO_KILL'):
sublime.run_command('exit')
| 19 | 43 | 0.626316 | 28 | 190 | 4.107143 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.215789 | 190 | 9 | 44 | 21.111111 | 0.771812 | 0 | 0 | 0 | 0 | 0 | 0.126316 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | true | 0 | 0.285714 | 0 | 0.428571 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0a588538793e9043e475e8fc272d8568a59a203a | 297 | py | Python | Defining-Classes/Exercises/08. spoopify/song.py | geodimitrov/PythonOOP_SoftUni | f1c6718c878b618b3ab3f174cd4d187bd178940b | [
"MIT"
] | 1 | 2021-06-30T11:53:44.000Z | 2021-06-30T11:53:44.000Z | Defining-Classes/Exercises/08. spoopify/song.py | geodimitrov/PythonOOP_SoftUni | f1c6718c878b618b3ab3f174cd4d187bd178940b | [
"MIT"
] | null | null | null | Defining-Classes/Exercises/08. spoopify/song.py | geodimitrov/PythonOOP_SoftUni | f1c6718c878b618b3ab3f174cd4d187bd178940b | [
"MIT"
] | null | null | null | class Song:
def __init__(self, name, length, single):
self.name = name
self.length = length
self.single = single
def get_info(self):
return f"{self.name} - {self.length}"
#Test code
# song = Song("Running in the 90s", 3.45, False)
# print(song.get_info()) | 24.75 | 48 | 0.606061 | 42 | 297 | 4.142857 | 0.52381 | 0.137931 | 0.16092 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022624 | 0.255892 | 297 | 12 | 49 | 24.75 | 0.764706 | 0.265993 | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0 | 0.142857 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
0a5e13a433627667d6adea7076963f3ed6951361 | 1,011 | py | Python | tests/controllers/controller_test_base.py | kmelodi/EasyBimehLanding_Python | b574a76a8805b306a423229b572c36dae0159def | [
"MIT"
] | null | null | null | tests/controllers/controller_test_base.py | kmelodi/EasyBimehLanding_Python | b574a76a8805b306a423229b572c36dae0159def | [
"MIT"
] | null | null | null | tests/controllers/controller_test_base.py | kmelodi/EasyBimehLanding_Python | b574a76a8805b306a423229b572c36dae0159def | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
easybimehlanding
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
import unittest
from ..http_response_catcher import HttpResponseCatcher
from easybimehlanding.easybimehlanding_client import EasybimehlandingClient
from easybimehlanding.configuration import Configuration
class ControllerTestBase(unittest.TestCase):
"""All test classes inherit from this base class. It abstracts out
common functionality and configuration variables set up."""
@classmethod
def setUpClass(cls):
"""Class method called once before running tests in a test class."""
cls.api_client = EasybimehlandingClient()
cls.request_timeout = 30
cls.assert_precision = 0.01
def setUp(self):
"""Method called once before every test in a test class."""
self.response_catcher = HttpResponseCatcher()
self.controller.http_call_back = self.response_catcher
| 31.59375 | 84 | 0.703264 | 110 | 1,011 | 6.372727 | 0.609091 | 0.064194 | 0.045649 | 0.062767 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010152 | 0.220574 | 1,011 | 32 | 85 | 31.59375 | 0.879442 | 0.354105 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 1 | 0.153846 | false | 0 | 0.307692 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0a6992bfebd70288420382e5839e5c20832d5df6 | 1,381 | py | Python | pandas/core/api.py | mcwitt/pandas | f6d0d0829b0668a6b8c526daa388a7ccf8835d04 | [
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"BSD-3-Clause"
] | 3 | 2017-02-25T14:06:43.000Z | 2017-05-25T05:18:03.000Z | pandas/core/api.py | mcwitt/pandas | f6d0d0829b0668a6b8c526daa388a7ccf8835d04 | [
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"BSD-3-Clause"
] | 11 | 2020-06-05T17:24:17.000Z | 2022-03-11T23:15:26.000Z | pandas/core/api.py | mcwitt/pandas | f6d0d0829b0668a6b8c526daa388a7ccf8835d04 | [
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"BSD-3-Clause"
] | 3 | 2017-02-25T15:26:47.000Z | 2017-12-20T06:27:07.000Z |
# pylint: disable=W0614,W0401,W0611
# flake8: noqa
import numpy as np
from pandas.core.algorithms import factorize, match, unique, value_counts
from pandas.core.common import isnull, notnull
from pandas.core.categorical import Categorical
from pandas.core.groupby import Grouper
from pandas.formats.format import set_eng_float_format
from pandas.core.index import (Index, CategoricalIndex, Int64Index,
RangeIndex, Float64Index, MultiIndex)
from pandas.core.series import Series, TimeSeries
from pandas.core.frame import DataFrame
from pandas.core.panel import Panel, WidePanel
from pandas.core.panel4d import Panel4D
from pandas.core.groupby import groupby
from pandas.core.reshape import (pivot_simple as pivot, get_dummies,
lreshape, wide_to_long)
from pandas.core.indexing import IndexSlice
from pandas.tseries.offsets import DateOffset
from pandas.tseries.tools import to_datetime
from pandas.tseries.index import (DatetimeIndex, Timestamp,
date_range, bdate_range)
from pandas.tseries.tdi import TimedeltaIndex, Timedelta
from pandas.tseries.period import Period, PeriodIndex
# legacy
import pandas.core.datetools as datetools
from pandas.core.config import (get_option, set_option, reset_option,
describe_option, option_context, options)
| 38.361111 | 73 | 0.757422 | 174 | 1,381 | 5.91954 | 0.448276 | 0.184466 | 0.176699 | 0.040777 | 0.052427 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016874 | 0.184649 | 1,381 | 35 | 74 | 39.457143 | 0.897869 | 0.038378 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.84 | 0 | 0.84 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0a6e8cecbd5863180af95718e3a5cf6e6fadea55 | 200 | py | Python | tests/test_cipher_eat2153.py | QMSS-G5072-2020/cipher_tran_elliott | 946d7bee354c80e7108dd33820b438f967fd1c03 | [
"MIT"
] | null | null | null | tests/test_cipher_eat2153.py | QMSS-G5072-2020/cipher_tran_elliott | 946d7bee354c80e7108dd33820b438f967fd1c03 | [
"MIT"
] | null | null | null | tests/test_cipher_eat2153.py | QMSS-G5072-2020/cipher_tran_elliott | 946d7bee354c80e7108dd33820b438f967fd1c03 | [
"MIT"
] | null | null | null | from cipher_eat2153 import cipher_eat2153
def test_cipher_symbol():
expected = "zpeb?"
result = cipher_eat2153.cipher(text = "yoda?", shift = 1, encrypt = True)
assert result == expected | 33.333333 | 77 | 0.71 | 25 | 200 | 5.48 | 0.68 | 0.284672 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.079755 | 0.185 | 200 | 6 | 78 | 33.333333 | 0.760736 | 0 | 0 | 0 | 0 | 0 | 0.049751 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6a56c6885d47fda66d7f14d761acb19b5cab3ca6 | 443 | py | Python | ckanext/example_isignal/plugin.py | gg2/ckan | d61a533cc330b6050f4957573f58ec912695ed0a | [
"BSD-3-Clause"
] | 2,805 | 2015-01-02T18:13:15.000Z | 2022-03-31T03:35:01.000Z | ckanext/example_isignal/plugin.py | gg2/ckan | d61a533cc330b6050f4957573f58ec912695ed0a | [
"BSD-3-Clause"
] | 3,801 | 2015-01-02T11:05:36.000Z | 2022-03-31T19:24:37.000Z | ckanext/example_isignal/plugin.py | gg2/ckan | d61a533cc330b6050f4957573f58ec912695ed0a | [
"BSD-3-Clause"
] | 1,689 | 2015-01-02T19:46:43.000Z | 2022-03-28T14:59:43.000Z | # -*- coding: utf-8 -*-
import ckan.plugins as p
def x2(sender):
return sender * 2
def x10(sender):
return sender * 10
class ExampleISignalPlugin(p.SingletonPlugin):
p.implements(p.ISignal)
# ISignal
def get_signal_subscriptions(self):
return {
p.toolkit.signals.ckanext.signal(u'isignal_number'): [
x2,
{u'receiver': x10, u'sender': 10}
]
}
| 17.038462 | 66 | 0.564334 | 50 | 443 | 4.94 | 0.6 | 0.097166 | 0.145749 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039604 | 0.316027 | 443 | 25 | 67 | 17.72 | 0.775578 | 0.065463 | 0 | 0 | 0 | 0 | 0.068127 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.071429 | 0.214286 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
6a5bea8bdf49d48a71180f33a836ecd20a173a95 | 385 | py | Python | src/cs106b/python/backtracking/print_all_binary.py | scottwedge/coding-refresher | 7141f7f262272b93dee0467be1abf7658a3e4fb6 | [
"MIT"
] | 1 | 2020-02-10T11:34:03.000Z | 2020-02-10T11:34:03.000Z | src/cs106b/python/backtracking/print_all_binary.py | scottwedge/coding-refresher | 7141f7f262272b93dee0467be1abf7658a3e4fb6 | [
"MIT"
] | 1 | 2020-01-10T22:20:20.000Z | 2020-01-11T02:52:32.000Z | src/cs106b/python/backtracking/print_all_binary.py | scottwedge/coding-refresher | 7141f7f262272b93dee0467be1abf7658a3e4fb6 | [
"MIT"
] | 1 | 2020-01-10T22:23:56.000Z | 2020-01-10T22:23:56.000Z | def print_all_binary_strings(n):
helper(n, "")
print("-------------------")
def helper(n, s, lvl = 0):
space = (" " * lvl) + s
print(space)
if(len(s) == n):
print(s)
else:
helper(n, s + "0", lvl + 1)
helper(n, s + "1", lvl + 1)
print_all_binary_strings(1)
print_all_binary_strings(2)
print_all_binary_strings(3)
print_all_binary_strings(4) | 21.388889 | 33 | 0.563636 | 59 | 385 | 3.423729 | 0.305085 | 0.19802 | 0.346535 | 0.519802 | 0.217822 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030303 | 0.228571 | 385 | 18 | 34 | 21.388889 | 0.649832 | 0 | 0 | 0 | 0 | 0 | 0.065041 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0 | 0 | 0.133333 | 0.533333 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
6a6eb143e6ea6682670d5a76e953830ab38f04a9 | 24 | py | Python | config/default.py | Aneureka/njuapi | f45f703e20451f12d0900c5c38b93cdd6e9b672c | [
"MIT"
] | 6 | 2017-09-16T13:50:28.000Z | 2019-10-24T03:06:49.000Z | config/default.py | Aneureka/njuapi | f45f703e20451f12d0900c5c38b93cdd6e9b672c | [
"MIT"
] | null | null | null | config/default.py | Aneureka/njuapi | f45f703e20451f12d0900c5c38b93cdd6e9b672c | [
"MIT"
] | 1 | 2017-09-16T13:58:35.000Z | 2017-09-16T13:58:35.000Z | # debug
DEBUG = False
| 4.8 | 13 | 0.625 | 3 | 24 | 5 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.291667 | 24 | 4 | 14 | 6 | 0.882353 | 0.208333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6a7e844de5b9f5802a28f1f378ae027a02a4ba06 | 16,999 | py | Python | web_version/languages/nl.py | tlubitz/parameter_balancing_pypi | cb57d51548741a926fcc9ab1e7dfc80225f5de77 | [
"MIT"
] | 8 | 2018-04-13T14:54:02.000Z | 2021-03-04T10:58:09.000Z | web_version/languages/nl.py | tlubitz/parameter_balancing_pypi | cb57d51548741a926fcc9ab1e7dfc80225f5de77 | [
"MIT"
] | 39 | 2018-03-23T09:25:38.000Z | 2022-03-23T15:22:15.000Z | web_version/languages/nl.py | tlubitz/parameter_balancing_pypi | cb57d51548741a926fcc9ab1e7dfc80225f5de77 | [
"MIT"
] | 2 | 2021-04-07T15:45:11.000Z | 2022-03-21T09:26:36.000Z | # -*- coding: utf-8 -*-
{
'!langcode!': 'nl',
'!langname!': 'Nederlands',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'%(nrows)s records found': '%(nrows)s records gevonden',
'%d days ago': '%d dagen geleden',
'%d weeks ago': '%d weken gelden',
'%s %%{row} deleted': '%s rijen verwijderd',
'%s %%{row} updated': '%s rijen geupdate',
'%s selected': '%s geselecteerd',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
'(something like "it-it")': '(zoiets als "nl-nl")',
'1 day ago': '1 dag geleden',
'1 week ago': '1 week gelden',
'<': '<',
'<=': '<=',
'=': '=',
'>': '>',
'>=': '>=',
'A new version of web2py is available': 'Een nieuwe versie van web2py is beschikbaar',
'A new version of web2py is available: %s': 'Een nieuwe versie van web2py is beschikbaar: %s',
'About': 'Over',
'about': 'over',
'About application': 'Over applicatie',
'Access Control': 'Toegangscontrole',
'Add': 'Toevoegen',
'additional code for your application': 'additionele code voor je applicatie',
'admin disabled because no admin password': 'admin is uitgezet omdat er geen admin wachtwoord is',
'admin disabled because not supported on google app engine': 'admin is uitgezet omdat dit niet ondersteund wordt op google app engine',
'admin disabled because unable to access password file': 'admin is uitgezet omdat het wachtwoordbestand niet geopend kan worden',
'Admin is disabled because insecure channel': 'Admin is uitgezet om het kanaal onveilig is',
'Admin is disabled because unsecure channel': 'Admin is uitgezet om het kanaal onveilig is',
'Administration': 'Administratie',
'Administrative Interface': 'Administratieve Interface',
'Administrator Password:': 'Administrator Wachtwoord',
'Ajax Recipes': 'Ajax Recepten',
'And': 'En',
'and rename it (required):': 'en hernoem deze (vereist)',
'and rename it:': 'en hernoem:',
'appadmin': 'appadmin',
'appadmin is disabled because insecure channel': 'appadmin is uitgezet vanwege een onveilig kanaal',
'application "%s" uninstalled': 'applicatie "%s" gedeïnstalleerd',
'application compiled': 'applicatie gecompileerd',
'application is compiled and cannot be designed': 'applicatie is gecompileerd en kan niet worden ontworpen',
'Are you sure you want to delete file "%s"?': 'Weet je zeker dat je bestand "%s" wilt verwijderen?',
'Are you sure you want to delete this object?': 'Weet je zeker dat je dit object wilt verwijderen?',
'Are you sure you want to uninstall application "%s"?': 'Weet je zeker dat je applicatie "%s" wilt deïnstalleren?',
'ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.': 'LET OP: Login vereist een beveiligde (HTTPS) connectie of moet draaien op localhost.',
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'LET OP: TESTEN IS NIET THREAD SAFE, PROBEER NIET GELIJKTIJDIG MEERDERE TESTS TE DOEN.',
'ATTENTION: you cannot edit the running application!': 'LET OP: je kan de applicatie die nu draait niet editen!',
'Authentication': 'Authenticatie',
'Available Databases and Tables': 'Beschikbare databases en tabellen',
'Back': 'Terug',
'Buy this book': 'Koop dit boek',
'Cache': 'Cache',
'cache': 'cache',
'Cache Keys': 'Cache Keys',
'cache, errors and sessions cleaned': 'cache, errors en sessies geleegd',
'Cannot be empty': 'Mag niet leeg zijn',
'Cannot compile: there are errors in your app. Debug it, correct errors and try again.': 'Kan niet compileren: er bevinden zich fouten in je app. Debug, corrigeer de fouten en probeer opnieuw.',
'cannot create file': 'kan bestand niet maken',
'cannot upload file "%(filename)s"': 'kan bestand "%(filename)s" niet uploaden',
'Change Password': 'Wijzig wachtwoord',
'Change password': 'Wijzig Wachtwoord',
'change password': 'wijzig wachtwoord',
'check all': 'vink alles aan',
'Check to delete': 'Vink aan om te verwijderen',
'clean': 'leeg',
'Clear': 'Leeg',
'Clear CACHE?': 'Leeg CACHE?',
'Clear DISK': 'Leeg DISK',
'Clear RAM': 'Clear RAM',
'click to check for upgrades': 'Klik om voor upgrades te controleren',
'Client IP': 'Client IP',
'Community': 'Community',
'compile': 'compileren',
'compiled application removed': 'gecompileerde applicatie verwijderd',
'Components and Plugins': 'Components en Plugins',
'contains': 'bevat',
'Controller': 'Controller',
'Controllers': 'Controllers',
'controllers': 'controllers',
'Copyright': 'Copyright',
'create file with filename:': 'maak bestand met de naam:',
'Create new application': 'Maak nieuwe applicatie:',
'create new application:': 'maak nieuwe applicatie',
'Created By': 'Gemaakt Door',
'Created On': 'Gemaakt Op',
'crontab': 'crontab',
'Current request': 'Huidige request',
'Current response': 'Huidige response',
'Current session': 'Huidige sessie',
'currently saved or': 'op het moment opgeslagen of',
'customize me!': 'pas me aan!',
'data uploaded': 'data geupload',
'Database': 'Database',
'Database %s select': 'Database %s select',
'database administration': 'database administratie',
'Date and Time': 'Datum en Tijd',
'db': 'db',
'DB Model': 'DB Model',
'defines tables': 'definieer tabellen',
'Delete': 'Verwijder',
'delete': 'verwijder',
'delete all checked': 'verwijder alle aangevinkten',
'Delete:': 'Verwijder:',
'Demo': 'Demo',
'Deploy on Google App Engine': 'Deploy op Google App Engine',
'Deployment Recipes': 'Deployment Recepten',
'Description': 'Beschrijving',
'design': 'design',
'DESIGN': 'DESIGN',
'Design for': 'Design voor',
'DISK': 'DISK',
'Disk Cache Keys': 'Disk Cache Keys',
'Disk Cleared': 'Disk Geleegd',
'Documentation': 'Documentatie',
"Don't know what to do?": 'Weet je niet wat je moet doen?',
'done!': 'gereed!',
'Download': 'Download',
'E-mail': 'E-mail',
'E-mail invalid': 'E-mail ongeldig',
'edit': 'bewerk',
'EDIT': 'BEWERK',
'Edit': 'Bewerk',
'Edit application': 'Bewerk applicatie',
'edit controller': 'bewerk controller',
'Edit current record': 'Bewerk huidig record',
'Edit Profile': 'Bewerk Profiel',
'edit profile': 'bewerk profiel',
'Edit This App': 'Bewerk Deze App',
'Editing file': 'Bewerk bestand',
'Editing file "%s"': 'Bewerk bestand "%s"',
'Email and SMS': 'E-mail en SMS',
'enter a number between %(min)g and %(max)g': 'geef een getal tussen %(min)g en %(max)g',
'Enter an integer between %(min)g and %(max)g': 'Enter an integer between %(min)g and %(max)g',
'enter an integer between %(min)g and %(max)g': 'geef een integer tussen %(min)g en %(max)g',
'Error logs for "%(app)s"': 'Error logs voor "%(app)s"',
'errors': 'errors',
'Errors': 'Errors',
'Export': 'Export',
'export as csv file': 'exporteer als csv-bestand',
'exposes': 'stelt bloot',
'extends': 'extends',
'failed to reload module': 'niet gelukt om module te herladen',
'False': 'Onwaar',
'FAQ': 'FAQ',
'file "%(filename)s" created': 'bestand "%(filename)s" gemaakt',
'file "%(filename)s" deleted': 'bestand "%(filename)s" verwijderd',
'file "%(filename)s" uploaded': 'bestand "%(filename)s" geupload',
'file "%(filename)s" was not deleted': 'bestand "%(filename)s" was niet verwijderd',
'file "%s" of %s restored': 'bestand "%s" van %s hersteld',
'file changed on disk': 'bestand aangepast op schijf',
'file does not exist': 'bestand bestaat niet',
'file saved on %(time)s': 'bestand bewaard op %(time)s',
'file saved on %s': 'bestand bewaard op %s',
'First name': 'Voornaam',
'Forbidden': 'Verboden',
'Forms and Validators': 'Formulieren en Validators',
'Free Applications': 'Gratis Applicaties',
'Functions with no doctests will result in [passed] tests.': 'Functies zonder doctests zullen resulteren in [passed] tests.',
'Group %(group_id)s created': 'Groep %(group_id)s gemaakt',
'Group ID': 'Groep ID',
'Group uniquely assigned to user %(id)s': 'Groep is uniek toegekend aan gebruiker %(id)s',
'Groups': 'Groepen',
'Hello World': 'Hallo Wereld',
'help': 'help',
'Home': 'Home',
'How did you get here?': 'Hoe ben je hier gekomen?',
'htmledit': 'Bewerk HTML',
'import': 'import',
'Import/Export': 'Import/Export',
'includes': 'includes',
'Index': 'Index',
'insert new': 'voeg nieuwe',
'insert new %s': 'voeg nieuwe %s',
'Installed applications': 'Geïnstalleerde applicaties',
'internal error': 'interne error',
'Internal State': 'Interne State',
'Introduction': 'Introductie',
'Invalid action': 'Ongeldige actie',
'Invalid email': 'Ongeldig emailadres',
'invalid password': 'ongeldig wachtwoord',
'Invalid password': 'Ongeldig wachtwoord',
'Invalid Query': 'Ongeldige Query',
'invalid request': 'ongeldige request',
'invalid ticket': 'ongeldige ticket',
'Is Active': 'Is Actief',
'Key': 'Key',
'language file "%(filename)s" created/updated': 'taalbestand "%(filename)s" gemaakt/geupdate',
'Language files (static strings) updated': 'Taalbestanden (statische strings) geupdate',
'languages': 'talen',
'Languages': 'Talen',
'languages updated': 'talen geupdate',
'Last name': 'Achternaam',
'Last saved on:': 'Laatst bewaard op:',
'Layout': 'Layout',
'Layout Plugins': 'Layout Plugins',
'Layouts': 'Layouts',
'License for': 'Licentie voor',
'Live Chat': 'Live Chat',
'loading...': 'laden...',
'Logged in': 'Ingelogd',
'Logged out': 'Uitgelogd',
'Login': 'Login',
'login': 'login',
'Login to the Administrative Interface': 'Inloggen op de Administratieve Interface',
'logout': 'logout',
'Logout': 'Logout',
'Lost Password': 'Wachtwoord Kwijt',
'Lost password?': 'Wachtwoord kwijt?',
'Main Menu': 'Hoofdmenu',
'Manage Cache': 'Beheer Cache',
'Menu Model': 'Menu Model',
'merge': 'samenvoegen',
'Models': 'Modellen',
'models': 'modellen',
'Modified By': 'Aangepast Door',
'Modified On': 'Aangepast Op',
'Modules': 'Modules',
'modules': 'modules',
'My Sites': 'Mijn Sites',
'Name': 'Naam',
'New': 'Nieuw',
'new application "%s" created': 'nieuwe applicatie "%s" gemaakt',
'New password': 'Nieuw wachtwoord',
'New Record': 'Nieuw Record',
'new record inserted': 'nieuw record ingevoegd',
'next 100 rows': 'volgende 100 rijen',
'NO': 'NEE',
'No databases in this application': 'Geen database in deze applicatie',
'Object or table name': 'Object of tabelnaam',
'Old password': 'Oude wachtwoord',
'Online examples': 'Online voorbeelden',
'Or': 'Of',
'or import from csv file': 'of importeer van csv-bestand',
'or provide application url:': 'of geef een applicatie url:',
'Origin': 'Bron',
'Original/Translation': 'Oorspronkelijk/Vertaling',
'Other Plugins': 'Andere Plugins',
'Other Recipes': 'Andere Recepten',
'Overview': 'Overzicht',
'pack all': 'pack all',
'pack compiled': 'pack compiled',
'Password': 'Wachtwoord',
"Password fields don't match": 'Wachtwoordvelden komen niet overeen',
'Peeking at file': 'Naar bestand aan het gluren',
'please input your password again': 'geef alstublieft nogmaals uw wachtwoord',
'Plugins': 'Plugins',
'Powered by': 'Powered by',
'Preface': 'Inleiding',
'previous 100 rows': 'vorige 100 rijen',
'Profile': 'Profiel',
'Python': 'Python',
'Query': 'Query',
'Query:': 'Query:',
'Quick Examples': 'Snelle Voorbeelden',
'RAM': 'RAM',
'RAM Cache Keys': 'RAM Cache Keys',
'Ram Cleared': 'Ram Geleegd',
'Recipes': 'Recepten',
'Record': 'Record',
'record does not exist': 'record bestaat niet',
'Record ID': 'Record ID',
'Record id': 'Record id',
'register': 'registreer',
'Register': 'Registreer',
'Registration identifier': 'Registratie identifier',
'Registration key': 'Registratie sleutel',
'Registration successful': 'Registratie succesvol',
'Remember me (for 30 days)': 'Onthoudt mij (voor 30 dagen)',
'remove compiled': 'verwijder gecompileerde',
'Request reset password': 'Vraag een wachtwoord reset aan',
'Reset Password key': 'Reset Wachtwoord sleutel',
'Resolve Conflict file': 'Los Conflictbestand op',
'restore': 'herstel',
'revert': 'herstel',
'Role': 'Rol',
'Rows in Table': 'Rijen in tabel',
'Rows selected': 'Rijen geselecteerd',
'save': 'bewaar',
'Save profile': 'Bewaar profiel',
'Saved file hash:': 'Opgeslagen file hash:',
'Search': 'Zoek',
'Semantic': 'Semantisch',
'Services': 'Services',
'session expired': 'sessie verlopen',
'shell': 'shell',
'site': 'site',
'Size of cache:': 'Grootte van cache:',
'some files could not be removed': 'sommige bestanden konden niet worden verwijderd',
'starts with': 'begint met',
'state': 'state',
'static': 'statisch',
'Static files': 'Statische bestanden',
'Statistics': 'Statistieken',
'Stylesheet': 'Stylesheet',
'Submit': 'Submit',
'submit': 'submit',
'Support': 'Support',
'Sure you want to delete this object?': 'Weet je zeker dat je dit object wilt verwijderen?',
'Table': 'Tabel',
'Table name': 'Tabelnaam',
'test': 'test',
'Testing application': 'Applicatie testen',
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'De "query" is een conditie zoals "db.tabel1.veld1==\'waarde\'". Zoiets als "db.tabel1.veld1==db.tabel2.veld2" resulteert in een SQL JOIN.',
'the application logic, each URL path is mapped in one exposed function in the controller': 'the applicatie logica, elk URL pad is gemapped in een blootgestelde functie in de controller',
'The Core': 'De Core',
'the data representation, define database tables and sets': 'de data representatie, definieert database tabellen en sets',
'The output of the file is a dictionary that was rendered by the view %s': 'De output van het bestand is een dictionary die gerenderd werd door de view %s',
'the presentations layer, views are also known as templates': 'de presentatie laag, views zijn ook bekend als templates',
'The Views': 'De Views',
'There are no controllers': 'Er zijn geen controllers',
'There are no models': 'Er zijn geen modellen',
'There are no modules': 'Er zijn geen modules',
'There are no static files': 'Er zijn geen statische bestanden',
'There are no translators, only default language is supported': 'Er zijn geen vertalingen, alleen de standaard taal wordt ondersteund.',
'There are no views': 'Er zijn geen views',
'these files are served without processing, your images go here': 'Deze bestanden worden geserveerd zonder verdere verwerking, je afbeeldingen horen hier',
'This App': 'Deze App',
'This email already has an account': 'This email already has an account',
'This is a copy of the scaffolding application': 'Dit is een kopie van de steiger-applicatie',
'This is the %(filename)s template': 'Dit is de %(filename)s template',
'Ticket': 'Ticket',
'Time in Cache (h:m:s)': 'Tijd in Cache (h:m:s)',
'Timestamp': 'Timestamp (timestamp)',
'to previous version.': 'naar vorige versie.',
'too short': 'te kort',
'translation strings for the application': 'vertaalstrings voor de applicatie',
'True': 'Waar',
'try': 'probeer',
'try something like': 'probeer zoiets als',
'Twitter': 'Twitter',
'Unable to check for upgrades': 'Niet mogelijk om te controleren voor upgrades',
'unable to create application "%s"': 'niet mogelijk om applicatie "%s" te maken',
'unable to delete file "%(filename)s"': 'niet mogelijk om bestand "%(filename)s" te verwijderen',
'Unable to download': 'Niet mogelijk om te downloaden',
'Unable to download app': 'Niet mogelijk om app te downloaden',
'unable to parse csv file': 'niet mogelijk om csv-bestand te parsen',
'unable to uninstall "%s"': 'niet mogelijk om "%s" te deïnstalleren',
'uncheck all': 'vink alles uit',
'uninstall': ' deïnstalleer',
'update': 'update',
'update all languages': 'update alle talen',
'Update:': 'Update:',
'upload application:': 'upload applicatie:',
'Upload existing application': 'Upload bestaande applicatie',
'upload file:': 'upload bestand',
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Gebruik (...)&(...) voor AND, (...)|(...) voor OR, en ~(...) voor NOT om meer complexe queries te maken.',
'User %(id)s Logged-in': 'Gebruiker %(id)s Logged-in',
'User %(id)s Logged-out': 'Gebruiker %(id)s Logged-out',
'User %(id)s Password changed': 'Wachtwoord van gebruiker %(id)s is veranderd',
'User %(id)s Password reset': 'Wachtwoord van gebruiker %(id)s is gereset',
'User %(id)s Profile updated': 'Profiel van Gebruiker %(id)s geupdate',
'User %(id)s Registered': 'Gebruiker %(id)s Geregistreerd',
'User ID': 'User ID',
'value already in database or empty': 'waarde al in database of leeg',
'Verify Password': 'Verifieer Wachtwoord',
'versioning': 'versionering',
'Videos': 'Videos',
'View': 'View',
'view': 'view',
'Views': 'Vieuws',
'views': 'vieuws',
'web2py is up to date': 'web2py is up to date',
'web2py Recent Tweets': 'web2py Recente Tweets',
'Welcome': 'Welkom',
'Welcome %s': 'Welkom %s',
'Welcome to web2py': 'Welkom bij web2py',
'Welcome to web2py!': 'Welkom bij web2py!',
'Which called the function %s located in the file %s': 'Die functie %s aanriep en zich bevindt in het bestand %s',
'YES': 'JA',
'You are successfully running web2py': 'Je draait web2py succesvol',
'You can modify this application and adapt it to your needs': 'Je kan deze applicatie aanpassen naar je eigen behoeften',
'You visited the url %s': 'Je bezocht de url %s',
}
| 44.852243 | 281 | 0.702218 | 2,283 | 16,999 | 5.22777 | 0.312746 | 0.012065 | 0.007625 | 0.004357 | 0.122078 | 0.102304 | 0.073481 | 0.055132 | 0.041558 | 0.034353 | 0 | 0.003312 | 0.129714 | 16,999 | 378 | 282 | 44.970899 | 0.803434 | 0.001235 | 0 | 0 | 0 | 0.007958 | 0.820688 | 0.005537 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.058355 | 0.007958 | 0 | 0.007958 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
6a98aecbb63509b763cd138e7b0939ac193e2423 | 25,937 | py | Python | SmartFoxServer_PRO_1.6.6/Server/lib/Lib/test/test_types.py | ChisdealHD/DetlasWorldLinux | 336465a4df1a48c9a273329fc7a09d8099c4e4d5 | [
"MIT"
] | 3 | 2015-07-29T02:31:52.000Z | 2017-01-07T15:48:44.000Z | SmartFoxServer_PRO_1.6.6/Server/lib/Lib/test/test_types.py | ChisdealHD/DetlasWorldLinux | 336465a4df1a48c9a273329fc7a09d8099c4e4d5 | [
"MIT"
] | 4 | 2018-02-22T07:42:13.000Z | 2021-12-13T10:53:09.000Z | SmartFoxServer_PRO_1.6.6/Server/lib/Lib/test/test_types.py | ChisdealHD/DetlasWorldLinux | 336465a4df1a48c9a273329fc7a09d8099c4e4d5 | [
"MIT"
] | 4 | 2015-09-09T11:54:37.000Z | 2018-05-26T05:08:14.000Z | from __future__ import generators
# Python test set -- part 6, built-in types
from test.test_support import *
print '6. Built-in types'
print '6.1 Truth value testing'
if None: raise TestFailed, 'None is true instead of false'
if 0: raise TestFailed, '0 is true instead of false'
if 0L: raise TestFailed, '0L is true instead of false'
if 0.0: raise TestFailed, '0.0 is true instead of false'
if '': raise TestFailed, '\'\' is true instead of false'
if (): raise TestFailed, '() is true instead of false'
if []: raise TestFailed, '[] is true instead of false'
if {}: raise TestFailed, '{} is true instead of false'
if not 1: raise TestFailed, '1 is false instead of true'
if not 1L: raise TestFailed, '1L is false instead of true'
if not 1.0: raise TestFailed, '1.0 is false instead of true'
if not 'x': raise TestFailed, '\'x\' is false instead of true'
if not (1, 1): raise TestFailed, '(1, 1) is false instead of true'
if not [1]: raise TestFailed, '[1] is false instead of true'
if not {'x': 1}: raise TestFailed, '{\'x\': 1} is false instead of true'
def f(): pass
class C: pass
import sys
x = C()
if not f: raise TestFailed, 'f is false instead of true'
if not C: raise TestFailed, 'C is false instead of true'
if not sys: raise TestFailed, 'sys is false instead of true'
if not x: raise TestFailed, 'x is false instead of true'
print '6.2 Boolean operations'
if 0 or 0: raise TestFailed, '0 or 0 is true instead of false'
if 1 and 1: pass
else: raise TestFailed, '1 and 1 is false instead of true'
if not 1: raise TestFailed, 'not 1 is true instead of false'
print '6.3 Comparisons'
if 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass
else: raise TestFailed, 'int comparisons failed'
if 0L < 1L <= 1L == 1L >= 1L > 0L != 1L: pass
else: raise TestFailed, 'long int comparisons failed'
if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0: pass
else: raise TestFailed, 'float comparisons failed'
if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass
else: raise TestFailed, 'string comparisons failed'
if 0 in [0] and 0 not in [1]: pass
else: raise TestFailed, 'membership test failed'
if None is None and [] is not []: pass
else: raise TestFailed, 'identity test failed'
try: float('')
except ValueError: pass
else: raise TestFailed, "float('') didn't raise ValueError"
try: float('5\0')
except ValueError: pass
else: raise TestFailed, "float('5\0') didn't raise ValueError"
try: 5.0 / 0.0
except ZeroDivisionError: pass
else: raise TestFailed, "5.0 / 0.0 didn't raise ZeroDivisionError"
try: 5.0 // 0.0
except ZeroDivisionError: pass
else: raise TestFailed, "5.0 // 0.0 didn't raise ZeroDivisionError"
try: 5.0 % 0.0
except ZeroDivisionError: pass
else: raise TestFailed, "5.0 % 0.0 didn't raise ZeroDivisionError"
try: 5 / 0L
except ZeroDivisionError: pass
else: raise TestFailed, "5 / 0L didn't raise ZeroDivisionError"
try: 5 // 0L
except ZeroDivisionError: pass
else: raise TestFailed, "5 // 0L didn't raise ZeroDivisionError"
try: 5 % 0L
except ZeroDivisionError: pass
else: raise TestFailed, "5 % 0L didn't raise ZeroDivisionError"
print '6.4 Numeric types (mostly conversions)'
if 0 != 0L or 0 != 0.0 or 0L != 0.0: raise TestFailed, 'mixed comparisons'
if 1 != 1L or 1 != 1.0 or 1L != 1.0: raise TestFailed, 'mixed comparisons'
if -1 != -1L or -1 != -1.0 or -1L != -1.0:
raise TestFailed, 'int/long/float value not equal'
# calling built-in types without argument must return 0
if int() != 0: raise TestFailed, 'int() does not return 0'
if long() != 0L: raise TestFailed, 'long() does not return 0L'
if float() != 0.0: raise TestFailed, 'float() does not return 0.0'
if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass
else: raise TestFailed, 'int() does not round properly'
if long(1.9) == 1L == long(1.1) and long(-1.1) == -1L == long(-1.9): pass
else: raise TestFailed, 'long() does not round properly'
if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass
else: raise TestFailed, 'float() does not work properly'
print '6.4.1 32-bit integers'
if 12 + 24 != 36: raise TestFailed, 'int op'
if 12 + (-24) != -12: raise TestFailed, 'int op'
if (-12) + 24 != 12: raise TestFailed, 'int op'
if (-12) + (-24) != -36: raise TestFailed, 'int op'
if not 12 < 24: raise TestFailed, 'int op'
if not -24 < -12: raise TestFailed, 'int op'
# Test for a particular bug in integer multiply
xsize, ysize, zsize = 238, 356, 4
if not (xsize*ysize*zsize == zsize*xsize*ysize == 338912):
raise TestFailed, 'int mul commutativity'
# And another.
m = -sys.maxint - 1
for divisor in 1, 2, 4, 8, 16, 32:
j = m // divisor
prod = divisor * j
if prod != m:
raise TestFailed, "%r * %r == %r != %r" % (divisor, j, prod, m)
if type(prod) is not int:
raise TestFailed, ("expected type(prod) to be int, not %r" %
type(prod))
# Check for expected * overflow to long.
for divisor in 1, 2, 4, 8, 16, 32:
j = m // divisor - 1
prod = divisor * j
if type(prod) is not long:
raise TestFailed, ("expected type(%r) to be long, not %r" %
(prod, type(prod)))
# Check for expected * overflow to long.
m = sys.maxint
for divisor in 1, 2, 4, 8, 16, 32:
j = m // divisor + 1
prod = divisor * j
if type(prod) is not long:
raise TestFailed, ("expected type(%r) to be long, not %r" %
(prod, type(prod)))
print '6.4.2 Long integers'
if 12L + 24L != 36L: raise TestFailed, 'long op'
if 12L + (-24L) != -12L: raise TestFailed, 'long op'
if (-12L) + 24L != 12L: raise TestFailed, 'long op'
if (-12L) + (-24L) != -36L: raise TestFailed, 'long op'
if not 12L < 24L: raise TestFailed, 'long op'
if not -24L < -12L: raise TestFailed, 'long op'
x = sys.maxint
if int(long(x)) != x: raise TestFailed, 'long op'
try: y = int(long(x)+1L)
except OverflowError: raise TestFailed, 'long op'
if not isinstance(y, long): raise TestFailed, 'long op'
x = -x
if int(long(x)) != x: raise TestFailed, 'long op'
x = x-1
if int(long(x)) != x: raise TestFailed, 'long op'
try: y = int(long(x)-1L)
except OverflowError: raise TestFailed, 'long op'
if not isinstance(y, long): raise TestFailed, 'long op'
try: 5 << -5
except ValueError: pass
else: raise TestFailed, 'int negative shift <<'
try: 5L << -5L
except ValueError: pass
else: raise TestFailed, 'long negative shift <<'
try: 5 >> -5
except ValueError: pass
else: raise TestFailed, 'int negative shift >>'
try: 5L >> -5L
except ValueError: pass
else: raise TestFailed, 'long negative shift >>'
print '6.4.3 Floating point numbers'
if 12.0 + 24.0 != 36.0: raise TestFailed, 'float op'
if 12.0 + (-24.0) != -12.0: raise TestFailed, 'float op'
if (-12.0) + 24.0 != 12.0: raise TestFailed, 'float op'
if (-12.0) + (-24.0) != -36.0: raise TestFailed, 'float op'
if not 12.0 < 24.0: raise TestFailed, 'float op'
if not -24.0 < -12.0: raise TestFailed, 'float op'
print '6.5 Sequence types'
print '6.5.1 Strings'
if len('') != 0: raise TestFailed, 'len(\'\')'
if len('a') != 1: raise TestFailed, 'len(\'a\')'
if len('abcdef') != 6: raise TestFailed, 'len(\'abcdef\')'
if 'xyz' + 'abcde' != 'xyzabcde': raise TestFailed, 'string concatenation'
if 'xyz'*3 != 'xyzxyzxyz': raise TestFailed, 'string repetition *3'
if 0*'abcde' != '': raise TestFailed, 'string repetition 0*'
if min('abc') != 'a' or max('abc') != 'c': raise TestFailed, 'min/max string'
if 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': pass
else: raise TestFailed, 'in/not in string'
x = 'x'*103
if '%s!'%x != x+'!': raise TestFailed, 'nasty string formatting bug'
#extended slices for strings
a = '0123456789'
vereq(a[::], a)
vereq(a[::2], '02468')
vereq(a[1::2], '13579')
vereq(a[::-1],'9876543210')
vereq(a[::-2], '97531')
vereq(a[3::-2], '31')
vereq(a[-100:100:], a)
vereq(a[100:-100:-1], a[::-1])
vereq(a[-100L:100L:2L], '02468')
if have_unicode:
a = unicode('0123456789', 'ascii')
vereq(a[::], a)
vereq(a[::2], unicode('02468', 'ascii'))
vereq(a[1::2], unicode('13579', 'ascii'))
vereq(a[::-1], unicode('9876543210', 'ascii'))
vereq(a[::-2], unicode('97531', 'ascii'))
vereq(a[3::-2], unicode('31', 'ascii'))
vereq(a[-100:100:], a)
vereq(a[100:-100:-1], a[::-1])
vereq(a[-100L:100L:2L], unicode('02468', 'ascii'))
print '6.5.2 Tuples'
# calling built-in types without argument must return empty
if tuple() != (): raise TestFailed,'tuple() does not return ()'
if len(()) != 0: raise TestFailed, 'len(())'
if len((1,)) != 1: raise TestFailed, 'len((1,))'
if len((1,2,3,4,5,6)) != 6: raise TestFailed, 'len((1,2,3,4,5,6))'
if (1,2)+(3,4) != (1,2,3,4): raise TestFailed, 'tuple concatenation'
if (1,2)*3 != (1,2,1,2,1,2): raise TestFailed, 'tuple repetition *3'
if 0*(1,2,3) != (): raise TestFailed, 'tuple repetition 0*'
if min((1,2)) != 1 or max((1,2)) != 2: raise TestFailed, 'min/max tuple'
if 0 in (0,1,2) and 1 in (0,1,2) and 2 in (0,1,2) and 3 not in (0,1,2): pass
else: raise TestFailed, 'in/not in tuple'
try: ()[0]
except IndexError: pass
else: raise TestFailed, "tuple index error didn't raise IndexError"
x = ()
x += ()
if x != (): raise TestFailed, 'tuple inplace add from () to () failed'
x += (1,)
if x != (1,): raise TestFailed, 'tuple resize from () failed'
# extended slicing - subscript only for tuples
a = (0,1,2,3,4)
vereq(a[::], a)
vereq(a[::2], (0,2,4))
vereq(a[1::2], (1,3))
vereq(a[::-1], (4,3,2,1,0))
vereq(a[::-2], (4,2,0))
vereq(a[3::-2], (3,1))
vereq(a[-100:100:], a)
vereq(a[100:-100:-1], a[::-1])
vereq(a[-100L:100L:2L], (0,2,4))
# Check that a specific bug in _PyTuple_Resize() is squashed.
def f():
for i in range(1000):
yield i
vereq(list(tuple(f())), range(1000))
# Verify that __getitem__ overrides are not recognized by __iter__
# XXX: this is a problem
#class T(tuple):
# def __getitem__(self, key):
# return str(key) + '!!!'
#vereq(iter(T((1,2))).next(), 1)
print '6.5.3 Lists'
# calling built-in types without argument must return empty
if list() != []: raise TestFailed,'list() does not return []'
if len([]) != 0: raise TestFailed, 'len([])'
if len([1,]) != 1: raise TestFailed, 'len([1,])'
if len([1,2,3,4,5,6]) != 6: raise TestFailed, 'len([1,2,3,4,5,6])'
if [1,2]+[3,4] != [1,2,3,4]: raise TestFailed, 'list concatenation'
if [1,2]*3 != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3'
if [1,2]*3L != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3L'
if 0*[1,2,3] != []: raise TestFailed, 'list repetition 0*'
if 0L*[1,2,3] != []: raise TestFailed, 'list repetition 0L*'
if min([1,2]) != 1 or max([1,2]) != 2: raise TestFailed, 'min/max list'
if 0 in [0,1,2] and 1 in [0,1,2] and 2 in [0,1,2] and 3 not in [0,1,2]: pass
else: raise TestFailed, 'in/not in list'
a = [1, 2, 3, 4, 5]
a[:-1] = a
if a != [1, 2, 3, 4, 5, 5]:
raise TestFailed, "list self-slice-assign (head)"
a = [1, 2, 3, 4, 5]
a[1:] = a
if a != [1, 1, 2, 3, 4, 5]:
raise TestFailed, "list self-slice-assign (tail)"
a = [1, 2, 3, 4, 5]
a[1:-1] = a
if a != [1, 1, 2, 3, 4, 5, 5]:
raise TestFailed, "list self-slice-assign (center)"
try: [][0]
except IndexError: pass
else: raise TestFailed, "list index error didn't raise IndexError"
try: [][0] = 5
except IndexError: pass
else: raise TestFailed, "list assignment index error didn't raise IndexError"
try: [].pop()
except IndexError: pass
else: raise TestFailed, "empty list.pop() didn't raise IndexError"
try: [1].pop(5)
except IndexError: pass
else: raise TestFailed, "[1].pop(5) didn't raise IndexError"
try: [][0:1] = 5
except TypeError: pass
else: raise TestFailed, "bad list slice assignment didn't raise TypeError"
try: [].extend(None)
except TypeError: pass
else: raise TestFailed, "list.extend(None) didn't raise TypeError"
a = [1, 2, 3, 4]
a *= 0
if a != []:
raise TestFailed, "list inplace repeat"
a = []
a[:] = tuple(range(10))
if a != range(10):
raise TestFailed, "assigning tuple to slice"
print '6.5.3a Additional list operations'
a = [0,1,2,3,4]
a[0L] = 1
a[1L] = 2
a[2L] = 3
if a != [1,2,3,3,4]: raise TestFailed, 'list item assignment [0L], [1L], [2L]'
a[0] = 5
a[1] = 6
a[2] = 7
if a != [5,6,7,3,4]: raise TestFailed, 'list item assignment [0], [1], [2]'
a[-2L] = 88
a[-1L] = 99
if a != [5,6,7,88,99]: raise TestFailed, 'list item assignment [-2L], [-1L]'
a[-2] = 8
a[-1] = 9
if a != [5,6,7,8,9]: raise TestFailed, 'list item assignment [-2], [-1]'
a[:2] = [0,4]
a[-3:] = []
a[1:1] = [1,2,3]
if a != [0,1,2,3,4]: raise TestFailed, 'list slice assignment'
a[ 1L : 4L] = [7,8,9]
if a != [0,7,8,9,4]: raise TestFailed, 'list slice assignment using long ints'
del a[1:4]
if a != [0,4]: raise TestFailed, 'list slice deletion'
del a[0]
if a != [4]: raise TestFailed, 'list item deletion [0]'
del a[-1]
if a != []: raise TestFailed, 'list item deletion [-1]'
a=range(0,5)
del a[1L:4L]
if a != [0,4]: raise TestFailed, 'list slice deletion'
del a[0L]
if a != [4]: raise TestFailed, 'list item deletion [0]'
del a[-1L]
if a != []: raise TestFailed, 'list item deletion [-1]'
a.append(0)
a.append(1)
a.append(2)
if a != [0,1,2]: raise TestFailed, 'list append'
a.insert(0, -2)
a.insert(1, -1)
a.insert(2,0)
if a != [-2,-1,0,0,1,2]: raise TestFailed, 'list insert'
b = a[:]
b.insert(-2, "foo")
b.insert(-200, "left")
b.insert(200, "right")
if b != ["left",-2,-1,0,0,"foo",1,2,"right"]: raise TestFailed, 'list insert2'
# a = [-2,-1,0,0,1,2]
if a.count(0) != 2: raise TestFailed, ' list count'
if a.index(0) != 2: raise TestFailed, 'list index'
if a.index(0,2) != 2: raise TestFailed, 'list index, start argument'
if a.index(0,-4) != 2: raise TestFailed, 'list index, -start argument'
if a.index(-2,-10) != 0: raise TestFailed, 'list index, very -start argument'
if a.index(0,3) != 3: raise TestFailed, 'list index, start argument'
if a.index(0,-3) != 3: raise TestFailed, 'list index, -start argument'
if a.index(0,3,4) != 3: raise TestFailed, 'list index, stop argument'
if a.index(0,-3,-2) != 3: raise TestFailed, 'list index, -stop argument'
#XXX index with Long not working yet.
#if a.index(0,-4*sys.maxint,4*sys.maxint) != 2:
# raise TestFailed, 'list index, -maxint, maxint argument'
#try:
# a.index(0, 4*sys.maxint,-4*sys.maxint)
#except ValueError:
# pass
#else:
# raise TestFailed, 'list index, maxint,-maxint argument'
try:
a.index(2,0,-10)
except ValueError:
pass
else:
raise TestFailed, 'list index, very -stop argument'
a.remove(0)
try:
a.index(2,0,4)
except ValueError:
pass
else:
raise TestFailed, 'list index, stop argument.'
if a != [-2,-1,0,1,2]: raise TestFailed, 'list remove'
a.reverse()
if a != [2,1,0,-1,-2]: raise TestFailed, 'list reverse'
a.sort()
if a != [-2,-1,0,1,2]: raise TestFailed, 'list sort'
def revcmp(a, b): return cmp(b, a)
a.sort(revcmp)
if a != [2,1,0,-1,-2]: raise TestFailed, 'list sort with cmp func'
# The following dumps core in unpatched Python 1.5:
def myComparison(x,y):
return cmp(x%3, y%7)
z = range(12)
z.sort(myComparison)
try: z.sort(2)
except TypeError: pass
else: raise TestFailed, 'list sort compare function is not callable'
#XXX need a strategy for locking list during sort.
#def selfmodifyingComparison(x,y):
# z.append(1)
# return cmp(x, y)
#try: z.sort(selfmodifyingComparison)
#except ValueError: pass
#else: raise TestFailed, 'modifying list during sort'
try: z.sort(lambda x, y: 's')
except TypeError: pass
else: raise TestFailed, 'list sort compare function does not return int'
# Test extreme cases with long ints
a = [0,1,2,3,4]
if a[ -pow(2,128L): 3 ] != [0,1,2]:
raise TestFailed, "list slicing with too-small long integer"
if a[ 3: pow(2,145L) ] != [3,4]:
raise TestFailed, "list slicing with too-large long integer"
# extended slicing
# subscript
a = [0,1,2,3,4]
vereq(a[::], a)
vereq(a[::2], [0,2,4])
vereq(a[1::2], [1,3])
vereq(a[::-1], [4,3,2,1,0])
vereq(a[::-2], [4,2,0])
vereq(a[3::-2], [3,1])
vereq(a[-100:100:], a)
vereq(a[100:-100:-1], a[::-1])
vereq(a[-100L:100L:2L], [0,2,4])
vereq(a[1000:2000:2], [])
vereq(a[-1000:-2000:-2], [])
# deletion
del a[::2]
vereq(a, [1,3])
a = range(5)
del a[1::2]
vereq(a, [0,2,4])
a = range(5)
del a[1::-2]
vereq(a, [0,2,3,4])
a = range(10)
del a[::1000]
vereq(a, [1, 2, 3, 4, 5, 6, 7, 8, 9])
# assignment
a = range(10)
a[::2] = [-1]*5
vereq(a, [-1, 1, -1, 3, -1, 5, -1, 7, -1, 9])
a = range(10)
a[::-4] = [10]*3
vereq(a, [0, 10, 2, 3, 4, 10, 6, 7, 8 ,10])
a = range(4)
a[::-1] = a
vereq(a, [3, 2, 1, 0])
a = range(10)
b = a[:]
c = a[:]
a[2:3] = ["two", "elements"]
b[slice(2,3)] = ["two", "elements"]
c[2:3:] = ["two", "elements"]
vereq(a, b)
vereq(a, c)
a = range(10)
a[::2] = tuple(range(5))
vereq(a, [0, 1, 1, 3, 2, 5, 3, 7, 4, 9])
# Verify that __getitem__ overrides are not recognized by __iter__
class L(list):
def __getitem__(self, key):
return str(key) + '!!!'
vereq(iter(L([1,2])).next(), 1)
print '6.6 Mappings == Dictionaries'
# calling built-in types without argument must return empty
if dict() != {}: raise TestFailed,'dict() does not return {}'
d = {}
if d.keys() != []: raise TestFailed, '{}.keys()'
if d.values() != []: raise TestFailed, '{}.values()'
if d.items() != []: raise TestFailed, '{}.items()'
if d.has_key('a') != 0: raise TestFailed, '{}.has_key(\'a\')'
if ('a' in d) != 0: raise TestFailed, "'a' in {}"
if ('a' not in d) != 1: raise TestFailed, "'a' not in {}"
if len(d) != 0: raise TestFailed, 'len({})'
d = {'a': 1, 'b': 2}
if len(d) != 2: raise TestFailed, 'len(dict)'
k = d.keys()
k.sort()
if k != ['a', 'b']: raise TestFailed, 'dict keys()'
if d.has_key('a') and d.has_key('b') and not d.has_key('c'): pass
else: raise TestFailed, 'dict keys()'
if 'a' in d and 'b' in d and 'c' not in d: pass
else: raise TestFailed, 'dict keys() # in/not in version'
if d['a'] != 1 or d['b'] != 2: raise TestFailed, 'dict item'
d['c'] = 3
d['a'] = 4
if d['c'] != 3 or d['a'] != 4: raise TestFailed, 'dict item assignment'
del d['b']
if d != {'a': 4, 'c': 3}: raise TestFailed, 'dict item deletion'
# dict.clear()
d = {1:1, 2:2, 3:3}
d.clear()
if d != {}: raise TestFailed, 'dict clear'
# dict.update()
d.update({1:100})
d.update({2:20})
d.update({1:1, 2:2, 3:3})
if d != {1:1, 2:2, 3:3}: raise TestFailed, 'dict update'
d.clear()
try: d.update(None)
except AttributeError: pass
else: raise TestFailed, 'dict.update(None), AttributeError expected'
class SimpleUserDict:
def __init__(self):
self.d = {1:1, 2:2, 3:3}
def keys(self):
return self.d.keys()
def __getitem__(self, i):
return self.d[i]
d.update(SimpleUserDict())
if d != {1:1, 2:2, 3:3}: raise TestFailed, 'dict.update(instance)'
d.clear()
class FailingUserDict:
def keys(self):
raise ValueError
try: d.update(FailingUserDict())
except ValueError: pass
else: raise TestFailed, 'dict.keys() expected ValueError'
class FailingUserDict:
def keys(self):
class BogonIter:
def __iter__(self):
raise ValueError
return BogonIter()
try: d.update(FailingUserDict())
except ValueError: pass
else: raise TestFailed, 'iter(dict.keys()) expected ValueError'
class FailingUserDict:
def keys(self):
class BogonIter:
def __init__(self):
self.i = 1
def __iter__(self):
return self
def next(self):
if self.i:
self.i = 0
return 'a'
raise ValueError
return BogonIter()
def __getitem__(self, key):
return key
try: d.update(FailingUserDict())
except ValueError: pass
else: raise TestFailed, 'iter(dict.keys()).next() expected ValueError'
class FailingUserDict:
def keys(self):
class BogonIter:
def __init__(self):
self.i = ord('a')
def __iter__(self):
return self
def next(self):
if self.i <= ord('z'):
rtn = chr(self.i)
self.i += 1
return rtn
raise StopIteration
return BogonIter()
def __getitem__(self, key):
raise ValueError
try: d.update(FailingUserDict())
except ValueError: pass
else: raise TestFailed, 'dict.update(), __getitem__ expected ValueError'
# dict.fromkeys()
if dict.fromkeys('abc') != {'a':None, 'b':None, 'c':None}:
raise TestFailed, 'dict.fromkeys did not work as a class method'
d = {}
if d.fromkeys('abc') is d:
raise TestFailed, 'dict.fromkeys did not return a new dict'
if d.fromkeys('abc') != {'a':None, 'b':None, 'c':None}:
raise TestFailed, 'dict.fromkeys failed with default value'
if d.fromkeys((4,5),0) != {4:0, 5:0}:
raise TestFailed, 'dict.fromkeys failed with specified value'
if d.fromkeys([]) != {}:
raise TestFailed, 'dict.fromkeys failed with null sequence'
def g():
yield 1
if d.fromkeys(g()) != {1:None}:
raise TestFailed, 'dict.fromkeys failed with a generator'
try: {}.fromkeys(3)
except TypeError: pass
else: raise TestFailed, 'dict.fromkeys failed to raise TypeError'
class dictlike(dict): pass
#if dictlike.fromkeys('a') != {'a':None}:
# raise TestFailed, 'dictsubclass.fromkeys did not inherit'
#if dictlike().fromkeys('a') != {'a':None}:
# raise TestFailed, 'dictsubclass.fromkeys did not inherit'
if type(dictlike.fromkeys('a')) is not dictlike:
raise TestFailed, 'dictsubclass.fromkeys created wrong type'
if type(dictlike().fromkeys('a')) is not dictlike:
raise TestFailed, 'dictsubclass.fromkeys created wrong type'
from UserDict import UserDict
class mydict(dict):
def __new__(cls):
return UserDict()
#ud = mydict.fromkeys('ab')
#if ud != {'a':None, 'b':None} or not isinstance(ud,UserDict):
# raise TestFailed, 'fromkeys did not instantiate using __new__'
# dict.copy()
d = {1:1, 2:2, 3:3}
if d.copy() != {1:1, 2:2, 3:3}: raise TestFailed, 'dict copy'
if {}.copy() != {}: raise TestFailed, 'empty dict copy'
# dict.get()
d = {}
if d.get('c') is not None: raise TestFailed, 'missing {} get, no 2nd arg'
if d.get('c', 3) != 3: raise TestFailed, 'missing {} get, w/ 2nd arg'
d = {'a' : 1, 'b' : 2}
if d.get('c') is not None: raise TestFailed, 'missing dict get, no 2nd arg'
if d.get('c', 3) != 3: raise TestFailed, 'missing dict get, w/ 2nd arg'
if d.get('a') != 1: raise TestFailed, 'present dict get, no 2nd arg'
if d.get('a', 3) != 1: raise TestFailed, 'present dict get, w/ 2nd arg'
# dict.setdefault()
d = {}
if d.setdefault('key0') is not None:
raise TestFailed, 'missing {} setdefault, no 2nd arg'
if d.setdefault('key0') is not None:
raise TestFailed, 'present {} setdefault, no 2nd arg'
d.setdefault('key', []).append(3)
if d['key'][0] != 3:
raise TestFailed, 'missing {} setdefault, w/ 2nd arg'
d.setdefault('key', []).append(4)
if len(d['key']) != 2:
raise TestFailed, 'present {} setdefault, w/ 2nd arg'
# dict.popitem()
for copymode in -1, +1:
# -1: b has same structure as a
# +1: b is a.copy()
for log2size in range(12):
size = 2**log2size
a = {}
b = {}
for i in range(size):
a[`i`] = i
if copymode < 0:
b[`i`] = i
if copymode > 0:
b = a.copy()
for i in range(size):
ka, va = ta = a.popitem()
if va != int(ka): raise TestFailed, "a.popitem: %s" % str(ta)
kb, vb = tb = b.popitem()
if vb != int(kb): raise TestFailed, "b.popitem: %s" % str(tb)
if copymode < 0 and ta != tb:
raise TestFailed, "a.popitem != b.popitem: %s, %s" % (
str(ta), str(tb))
if a: raise TestFailed, 'a not empty after popitems: %s' % str(a)
if b: raise TestFailed, 'b not empty after popitems: %s' % str(b)
d.clear()
try: d.popitem()
except KeyError: pass
else: raise TestFailed, "{}.popitem doesn't raise KeyError"
# Tests for pop with specified key
d.clear()
k, v = 'abc', 'def'
d[k] = v
try: d.pop('ghi')
except KeyError: pass
else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when k not in dictionary"
if d.pop(k) != v: raise TestFailed, "{}.pop(k) doesn't find known key/value pair"
if len(d) > 0: raise TestFailed, "{}.pop(k) failed to remove the specified pair"
try: d.pop(k)
except KeyError: pass
else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when dictionary is empty"
# verify longs/ints get same value when key > 32 bits (for 64-bit archs)
# see SF bug #689659
x = 4503599627370496L
y = 4503599627370496
h = {x: 'anything', y: 'something else'}
if h[x] != h[y]:
raise TestFailed, "long/int key should match"
if d.pop(k, v) != v: raise TestFailed, "{}.pop(k, v) doesn't return default value"
d[k] = v
if d.pop(k, 1) != v: raise TestFailed, "{}.pop(k, v) doesn't find known key/value pair"
#XXX need locking strategy.
#d[1] = 1
#try:
# for i in d:
# d[i+1] = 1
#except RuntimeError:
# pass
#else:
# raise TestFailed, "changing dict size during iteration doesn't raise Error"
try: type(1, 2)
except TypeError: pass
else: raise TestFailed, 'type(), w/2 args expected TypeError'
try: type(1, 2, 3, 4)
except TypeError: pass
else: raise TestFailed, 'type(), w/4 args expected TypeError'
#XXX: Jython will probably never have buffers
#print 'Buffers'
#try: buffer('asdf', -1)
#except ValueError: pass
#else: raise TestFailed, "buffer('asdf', -1) should raise ValueError"
#
#try: buffer(None)
#except TypeError: pass
#else: raise TestFailed, "buffer(None) should raise TypeError"
#
#a = buffer('asdf')
#hash(a)
#b = a * 5
#if a == b:
# raise TestFailed, 'buffers should not be equal'
#if str(b) != ('asdf' * 5):
# raise TestFailed, 'repeated buffer has wrong content'
#if str(a * 0) != '':
# raise TestFailed, 'repeated buffer zero times has wrong content'
#if str(a + buffer('def')) != 'asdfdef':
# raise TestFailed, 'concatenation of buffers yields wrong content'
#
#try: a[1] = 'g'
#except TypeError: pass
#else: raise TestFailed, "buffer assignment should raise TypeError"
#
#try: a[0:1] = 'g'
#except TypeError: pass
#else: raise TestFailed, "buffer slice assignment should raise TypeError"
| 33.993447 | 87 | 0.624745 | 4,360 | 25,937 | 3.697018 | 0.086697 | 0.214033 | 0.045164 | 0.079906 | 0.61015 | 0.559588 | 0.473106 | 0.415038 | 0.374899 | 0.338172 | 0 | 0.064761 | 0.193315 | 25,937 | 762 | 88 | 34.038058 | 0.705635 | 0.120677 | 0 | 0.243421 | 0 | 0 | 0.255791 | 0.003832 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.085526 | 0.006579 | null | null | 0.023026 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
6a9923b1022c5223731d31e843b9a372f6fbc742 | 538 | py | Python | Geometry.py | dpetrovykh/DPy | c118f14f14c52c547ad9a712744843a9ea04262f | [
"MIT"
] | null | null | null | Geometry.py | dpetrovykh/DPy | c118f14f14c52c547ad9a712744843a9ea04262f | [
"MIT"
] | null | null | null | Geometry.py | dpetrovykh/DPy | c118f14f14c52c547ad9a712744843a9ea04262f | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 9 10:00:13 2020
@author: dpetrovykh
"""
import math
class Circle:
def __init__(self, radius= 1):
self.radius = float(radius)
@classmethod
def fromDiameter(cls, diameter):
return cls(radius = diameter/2)
@property
def area(self):
return math.pi*self.radius**2
@property
def perimeter(self):
return math.pi*self.radius*2
@property
def diameter(self):
return self.radius*2 | 19.214286 | 39 | 0.598513 | 69 | 538 | 4.608696 | 0.550725 | 0.157233 | 0.113208 | 0.100629 | 0.238994 | 0.238994 | 0.238994 | 0.238994 | 0.238994 | 0 | 0 | 0.046392 | 0.27881 | 538 | 28 | 40 | 19.214286 | 0.773196 | 0.185874 | 0 | 0.1875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0 | 0.0625 | 0.25 | 0.6875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
6a99bdcd61e7d59a8fcdb90267635f2b24a7f27c | 87 | py | Python | errors/apps.py | dpakach/RentalService | 2fe2c899b7f149ed3f0fc475100beaa0bc76619e | [
"MIT"
] | null | null | null | errors/apps.py | dpakach/RentalService | 2fe2c899b7f149ed3f0fc475100beaa0bc76619e | [
"MIT"
] | 1 | 2018-11-06T03:17:14.000Z | 2018-11-06T03:17:14.000Z | errors/apps.py | dpakach/RentalService | 2fe2c899b7f149ed3f0fc475100beaa0bc76619e | [
"MIT"
] | 1 | 2020-02-04T10:44:11.000Z | 2020-02-04T10:44:11.000Z | from django.apps import AppConfig
class ErrorsConfig(AppConfig):
name = "errors"
| 14.5 | 33 | 0.747126 | 10 | 87 | 6.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172414 | 87 | 5 | 34 | 17.4 | 0.902778 | 0 | 0 | 0 | 0 | 0 | 0.068966 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6acb5616d6e14d23086a7020e5374319a3edbb71 | 83 | py | Python | src/cldfviz/__init__.py | cldf/cldfviz | c222a735a161b61b755584f62eb1ba1c64f797c0 | [
"Apache-2.0"
] | 2 | 2021-09-09T19:53:12.000Z | 2022-01-15T23:25:36.000Z | src/cldfviz/__init__.py | cldf/cldfviz | c222a735a161b61b755584f62eb1ba1c64f797c0 | [
"Apache-2.0"
] | 20 | 2021-08-12T07:50:40.000Z | 2022-03-31T12:56:20.000Z | src/cldfviz/__init__.py | cldf/cldfviz | c222a735a161b61b755584f62eb1ba1c64f797c0 | [
"Apache-2.0"
] | 1 | 2022-02-08T10:12:05.000Z | 2022-02-08T10:12:05.000Z | import pathlib
__version__ = '0.5.1.dev0'
PKG_DIR = pathlib.Path(__file__).parent
| 16.6 | 39 | 0.759036 | 13 | 83 | 4.153846 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054054 | 0.108434 | 83 | 4 | 40 | 20.75 | 0.675676 | 0 | 0 | 0 | 0 | 0 | 0.120482 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6acbaec74d82b2549e3c40b22c2cdc007847b001 | 82 | py | Python | Session2-Conditional-Statements-part1/02_greater_number.py | elenaborisova/Crack-the-Code | d0b505ebad878d5228d98c934779ed9b28f6c034 | [
"MIT"
] | null | null | null | Session2-Conditional-Statements-part1/02_greater_number.py | elenaborisova/Crack-the-Code | d0b505ebad878d5228d98c934779ed9b28f6c034 | [
"MIT"
] | null | null | null | Session2-Conditional-Statements-part1/02_greater_number.py | elenaborisova/Crack-the-Code | d0b505ebad878d5228d98c934779ed9b28f6c034 | [
"MIT"
] | 1 | 2021-05-31T14:47:53.000Z | 2021-05-31T14:47:53.000Z | a = int(input())
b = int(input())
if a > b:
print(a)
else:
print(b)
| 10.25 | 17 | 0.463415 | 14 | 82 | 2.714286 | 0.5 | 0.421053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.329268 | 82 | 7 | 18 | 11.714286 | 0.690909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
6aced3ecebb713ea78552d726c6c7d5fc7dae846 | 542 | py | Python | learn-prefect/ordered.py | atvaccaro/problems | 666b431b5489a5990a0f29d601c384c88e0e6132 | [
"MIT"
] | null | null | null | learn-prefect/ordered.py | atvaccaro/problems | 666b431b5489a5990a0f29d601c384c88e0e6132 | [
"MIT"
] | null | null | null | learn-prefect/ordered.py | atvaccaro/problems | 666b431b5489a5990a0f29d601c384c88e0e6132 | [
"MIT"
] | 1 | 2019-11-03T04:05:34.000Z | 2019-11-03T04:05:34.000Z | from prefect import Flow, Parameter, task
@task
def a(x):
print(f'a: {x}')
@task
def b(x):
print(f'b: {x}')
@task
def c(x):
print(f'c: {x}')
with Flow('my-flow') as flow:
x = Parameter('x')
a.set_dependencies(downstream_tasks=[b], keyword_tasks={'x': x})
b.set_dependencies(downstream_tasks=[c], keyword_tasks={'x': x})
c.set_dependencies(keyword_tasks={'x': x})
# b.set_dependencies(downstream_tasks=[C], keyword_tasks={"x": param})
# c.set_dependencies(keyword_tasks={"x": param})
flow.run(x=1)
| 19.357143 | 74 | 0.634686 | 87 | 542 | 3.804598 | 0.275862 | 0.226586 | 0.196375 | 0.271903 | 0.492447 | 0.492447 | 0.356495 | 0.356495 | 0.356495 | 0.356495 | 0 | 0.002208 | 0.164207 | 542 | 27 | 75 | 20.074074 | 0.728477 | 0.212177 | 0 | 0.1875 | 0 | 0 | 0.068396 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1875 | false | 0 | 0.0625 | 0 | 0.25 | 0.1875 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6ad926261811e9620e928724803e334d9d383dc5 | 297 | py | Python | DarkPhoton_UFO/CT_couplings.py | ymzhong/mg5_aMC_tutorial | 1f1d1c7be23eb14acbc416db26dd542ad40c17d3 | [
"MIT"
] | 2 | 2021-11-11T12:20:13.000Z | 2022-03-19T12:17:27.000Z | DarkPhoton_UFO/CT_couplings.py | ymzhong/mg5_aMC_tutorial | 1f1d1c7be23eb14acbc416db26dd542ad40c17d3 | [
"MIT"
] | null | null | null | DarkPhoton_UFO/CT_couplings.py | ymzhong/mg5_aMC_tutorial | 1f1d1c7be23eb14acbc416db26dd542ad40c17d3 | [
"MIT"
] | 1 | 2021-11-11T12:20:23.000Z | 2021-11-11T12:20:23.000Z | # This file was automatically created by FeynRules 2.3.36
# Mathematica version: 12.0.0 for Linux x86 (64-bit) (April 7, 2019)
# Date: Thu 4 Mar 2021 16:26:20
from object_library import all_couplings, Coupling
from function_library import complexconjugate, re, im, csc, sec, acsc, asec, cot
| 24.75 | 80 | 0.750842 | 50 | 297 | 4.4 | 0.92 | 0.118182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112903 | 0.164983 | 297 | 11 | 81 | 27 | 0.774194 | 0.511785 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
6add7287f6c2a367ecf285c26518178da819b82a | 295 | py | Python | 01_Estrutura_Sequencial/09_converter_farenheit_celsius.py | gabrieldcpadilha/ListaDeExercicios-PythonBrasil | a92d477468bde5eac8987a26ea79af2ffeb6ad81 | [
"MIT"
] | null | null | null | 01_Estrutura_Sequencial/09_converter_farenheit_celsius.py | gabrieldcpadilha/ListaDeExercicios-PythonBrasil | a92d477468bde5eac8987a26ea79af2ffeb6ad81 | [
"MIT"
] | 10 | 2020-08-19T04:31:52.000Z | 2020-09-21T22:48:29.000Z | 01_Estrutura_Sequencial/09_converter_farenheit_celsius.py | gabrieldcpadilha/ListaDeExercicios-PythonBrasil | a92d477468bde5eac8987a26ea79af2ffeb6ad81 | [
"MIT"
] | null | null | null | """
Faça um Programa que peça a temperatura em graus Fahrenheit,
transforme e mostre a temperatura em graus Celsius.
C = 5 * ((F-32) / 9).
"""
farenheit = float(input('Informe a temperatura em Farenheit: '))
celsius = 5 * (farenheit - 32) / 9.0
print(f'A temperatura em Celsius é: {celsius}')
| 26.818182 | 64 | 0.691525 | 45 | 295 | 4.533333 | 0.577778 | 0.235294 | 0.27451 | 0.186275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037037 | 0.176271 | 295 | 10 | 65 | 29.5 | 0.802469 | 0.457627 | 0 | 0 | 0 | 0 | 0.480263 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.